ikie-cli 0.1.43 → 0.1.45

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 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 ?? 'http://80.225.207.132:3000';
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/index.js CHANGED
@@ -164,22 +164,28 @@ async function main() {
164
164
  config.requestsPerMinute = Math.floor(rpm);
165
165
  }
166
166
  // If user hasn't explicitly chosen a model, fetch the server's default.
167
+ // Retry once: the server can be slow on a cold start / right after a deploy,
168
+ // and a single timeout would otherwise silently strand us on the stale
169
+ // config default instead of the current server default.
167
170
  if (!argv.model && !hasExplicitModel()) {
168
- try {
169
- const modelsUrl = (config.baseURL ?? IKIE_API_BASE).includes('/api/v1')
170
- ? (config.baseURL ?? IKIE_API_BASE).replace('/api/v1', '/api/models')
171
- : `${IKIE_HOST}/api/models`;
172
- const res = await fetch(modelsUrl, { signal: AbortSignal.timeout(4000) });
173
- if (res.ok) {
174
- const data = await res.json();
175
- const serverDefault = data.models?.find(m => m.is_default);
176
- if (serverDefault) {
177
- config.model = serverDefault.name;
171
+ const modelsUrl = (config.baseURL ?? IKIE_API_BASE).includes('/api/v1')
172
+ ? (config.baseURL ?? IKIE_API_BASE).replace('/api/v1', '/api/models')
173
+ : `${IKIE_HOST}/api/models`;
174
+ for (let attempt = 0; attempt < 2; attempt++) {
175
+ try {
176
+ const res = await fetch(modelsUrl, { signal: AbortSignal.timeout(8000) });
177
+ if (res.ok) {
178
+ const data = await res.json();
179
+ const serverDefault = data.models?.find(m => m.is_default);
180
+ if (serverDefault) {
181
+ config.model = serverDefault.name;
182
+ }
183
+ break;
178
184
  }
179
185
  }
180
- }
181
- catch {
182
- // Silently fall back to DEFAULT_MODEL
186
+ catch {
187
+ // Retry once, then silently fall back to DEFAULT_MODEL.
188
+ }
183
189
  }
184
190
  }
185
191
  const oneShot = argv._.length > 0 ? argv._.join(' ') : undefined;
@@ -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('http://80.225.207.132:3000/dashboard'));
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
@@ -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
- const response = await fetch(apiUrl);
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
- console.log(` ${c.error('Failed to load models.')}`);
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
- const text = data.toString('utf8');
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') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ikie-cli",
3
- "version": "0.1.43",
3
+ "version": "0.1.45",
4
4
  "description": "Agentic coding CLI — your terminal AI pair programmer",
5
5
  "type": "module",
6
6
  "bin": {