infinicode 2.2.2 → 2.3.0
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/cli.js +12 -1
- package/dist/commands/install-tui.d.ts +6 -0
- package/dist/commands/install-tui.js +96 -0
- package/dist/commands/run.js +24 -8
- package/package.json +3 -2
package/dist/cli.js
CHANGED
|
@@ -14,8 +14,9 @@ import { providersList, providersAdd, providersRemove, providersTest } from './c
|
|
|
14
14
|
import { consoleRepl, consoleRun } from './commands/console.js';
|
|
15
15
|
import { serve } from './commands/serve.js';
|
|
16
16
|
import { mcpCommand } from './commands/mcp.js';
|
|
17
|
+
import { installTui } from './commands/install-tui.js';
|
|
17
18
|
import { DEFAULT_CONFIG } from './kernel/config-schema.js';
|
|
18
|
-
const VERSION = '2.
|
|
19
|
+
const VERSION = '2.3.0';
|
|
19
20
|
const config = new Conf({
|
|
20
21
|
projectName: 'infinicode',
|
|
21
22
|
defaults: DEFAULT_CONFIG,
|
|
@@ -296,6 +297,16 @@ program
|
|
|
296
297
|
.action(async (opts) => {
|
|
297
298
|
await serve(config, opts);
|
|
298
299
|
});
|
|
300
|
+
// ── infinicode: install the TUI binary into this install ───────────────────
|
|
301
|
+
program
|
|
302
|
+
.command('install-tui')
|
|
303
|
+
.description('Download/copy the TUI binary into this install so bare `infinicode` can launch it')
|
|
304
|
+
.option('--from <path>', 'copy the TUI binary from a local path')
|
|
305
|
+
.option('--url <url>', 'download the TUI binary from a URL (or set INFINICODE_TUI_URL)')
|
|
306
|
+
.option('--force', 'reinstall even if a TUI binary is already present')
|
|
307
|
+
.action(async (opts) => {
|
|
308
|
+
await installTui({ ...opts, url: opts.url ?? process.env.INFINICODE_TUI_URL });
|
|
309
|
+
});
|
|
299
310
|
// ── OpenKernel: MCP control server (stdio) ─────────────────────────────────
|
|
300
311
|
program
|
|
301
312
|
.command('mcp')
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* infinicode install-tui — fetch the TUI binary into this install's bin/.
|
|
3
|
+
*
|
|
4
|
+
* The npm package ships the kernel + device-mesh CLI only (the TUI binary is
|
|
5
|
+
* large + platform-specific, so it is not published). This command puts the
|
|
6
|
+
* right TUI binary in place so bare `infinicode` can launch it:
|
|
7
|
+
*
|
|
8
|
+
* infinicode install-tui # auto-find a local copy (repo / OneDrive)
|
|
9
|
+
* infinicode install-tui --from C:\path\tui.exe
|
|
10
|
+
* infinicode install-tui --url https://host/infinicode-tui.exe
|
|
11
|
+
*
|
|
12
|
+
* It never fails the way the old launcher did (no loop) — it either installs the
|
|
13
|
+
* binary or prints exactly how to provide one.
|
|
14
|
+
*/
|
|
15
|
+
import { existsSync, copyFileSync, mkdirSync, renameSync, chmodSync, statSync, createWriteStream } from 'node:fs';
|
|
16
|
+
import { dirname, join, resolve } from 'node:path';
|
|
17
|
+
import { fileURLToPath } from 'node:url';
|
|
18
|
+
import { homedir } from 'node:os';
|
|
19
|
+
import { Readable } from 'node:stream';
|
|
20
|
+
import { pipeline } from 'node:stream/promises';
|
|
21
|
+
import chalk from 'chalk';
|
|
22
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
23
|
+
/** Platform-specific TUI binary filename. */
|
|
24
|
+
function tuiName() {
|
|
25
|
+
return process.platform === 'win32' ? 'infinicode-tui.exe' : 'infinicode-tui';
|
|
26
|
+
}
|
|
27
|
+
/** This install's bin/ dir (<pkg>/dist/commands → <pkg>/bin). */
|
|
28
|
+
function targetBinDir() {
|
|
29
|
+
return resolve(__dirname, '..', '..', 'bin');
|
|
30
|
+
}
|
|
31
|
+
/** Common local locations to copy an existing TUI binary from. */
|
|
32
|
+
function localCandidates(name, explicit) {
|
|
33
|
+
const home = homedir();
|
|
34
|
+
return [
|
|
35
|
+
explicit,
|
|
36
|
+
join(process.cwd(), 'bin', name),
|
|
37
|
+
join(home, 'OneDrive', 'Desktop', 'infinicode-main', 'bin', name),
|
|
38
|
+
join(home, 'Desktop', 'infinicode-main', 'bin', name),
|
|
39
|
+
].filter((p) => Boolean(p));
|
|
40
|
+
}
|
|
41
|
+
async function download(url, dest) {
|
|
42
|
+
console.log(chalk.dim(` downloading ${url} …`));
|
|
43
|
+
const res = await fetch(url, { redirect: 'follow' });
|
|
44
|
+
if (!res.ok || !res.body)
|
|
45
|
+
throw new Error(`download failed: HTTP ${res.status}`);
|
|
46
|
+
const tmp = `${dest}.download`;
|
|
47
|
+
await pipeline(Readable.fromWeb(res.body), createWriteStream(tmp));
|
|
48
|
+
renameSync(tmp, dest);
|
|
49
|
+
}
|
|
50
|
+
function finalize(dest) {
|
|
51
|
+
if (process.platform !== 'win32') {
|
|
52
|
+
try {
|
|
53
|
+
chmodSync(dest, 0o755);
|
|
54
|
+
}
|
|
55
|
+
catch {
|
|
56
|
+
/* best-effort */
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const mb = (statSync(dest).size / 1024 / 1024).toFixed(1);
|
|
60
|
+
console.log(chalk.green(` ✓ TUI installed → ${dest} (${mb} MB)`));
|
|
61
|
+
console.log(chalk.dim(' run it with: ') + chalk.cyan('infinicode'));
|
|
62
|
+
}
|
|
63
|
+
export async function installTui(opts) {
|
|
64
|
+
const name = tuiName();
|
|
65
|
+
const binDir = targetBinDir();
|
|
66
|
+
const dest = join(binDir, name);
|
|
67
|
+
console.log(chalk.bold('\n infinicode · install TUI'));
|
|
68
|
+
console.log(chalk.dim(' ' + '-'.repeat(40)));
|
|
69
|
+
if (existsSync(dest) && !opts.force) {
|
|
70
|
+
console.log(chalk.green(` ✓ already installed → ${dest}`));
|
|
71
|
+
console.log(chalk.dim(' reinstall with --force'));
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
mkdirSync(binDir, { recursive: true });
|
|
75
|
+
// 1. Explicit URL (hosted release / mirror).
|
|
76
|
+
if (opts.url) {
|
|
77
|
+
await download(opts.url, dest);
|
|
78
|
+
finalize(dest);
|
|
79
|
+
return;
|
|
80
|
+
}
|
|
81
|
+
// 2. Copy from an explicit --from path or a known local/OneDrive location.
|
|
82
|
+
const src = localCandidates(name, opts.from).find(p => existsSync(p));
|
|
83
|
+
if (src) {
|
|
84
|
+
copyFileSync(src, dest);
|
|
85
|
+
console.log(chalk.dim(` copied from ${src}`));
|
|
86
|
+
finalize(dest);
|
|
87
|
+
return;
|
|
88
|
+
}
|
|
89
|
+
// 3. Nothing found — tell the user exactly how to provide one.
|
|
90
|
+
console.log(chalk.yellow(` no ${name} found to install.`));
|
|
91
|
+
console.log(chalk.dim(' provide one of:'));
|
|
92
|
+
console.log(chalk.cyan(` infinicode install-tui --from "<path to ${name}>"`));
|
|
93
|
+
console.log(chalk.cyan(` infinicode install-tui --url "https://…/${name}"`));
|
|
94
|
+
console.log(chalk.dim(' (or set env INFINICODE_TUI_URL and re-run)'));
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
package/dist/commands/run.js
CHANGED
|
@@ -19,6 +19,7 @@ import ora from 'ora';
|
|
|
19
19
|
import { existsSync } from 'node:fs';
|
|
20
20
|
import { dirname, join, resolve } from 'node:path';
|
|
21
21
|
import { fileURLToPath } from 'node:url';
|
|
22
|
+
import { createRequire } from 'node:module';
|
|
22
23
|
import { ASCII_VIDEO_FPS, ASCII_VIDEO_FRAMES } from '../ascii-video-animation.js';
|
|
23
24
|
import { getProviderPreset } from '../kernel/free-providers.js';
|
|
24
25
|
import { buildKernelFromConfig } from '../kernel/setup.js';
|
|
@@ -27,19 +28,32 @@ import { openAICompatBaseURL } from '../kernel/provider-url.js';
|
|
|
27
28
|
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
28
29
|
const PROMPT_ANIMATION_MAX_FRAMES = Math.min(ASCII_VIDEO_FRAMES.length, ASCII_VIDEO_FPS * 3);
|
|
29
30
|
/**
|
|
30
|
-
* Locate the
|
|
31
|
+
* Locate the TUI binary. Resolution order (opencode/esbuild pattern):
|
|
32
|
+
* 1. the platform package installed via optionalDependencies
|
|
33
|
+
* (infinicode-tui-<platform>-<arch>) — auto-installed by npm, universal.
|
|
34
|
+
* 2. this install's own bin/ (dev repo, or `infinicode install-tui`).
|
|
35
|
+
* Returns null if none is present.
|
|
36
|
+
*
|
|
31
37
|
* IMPORTANT: never fall back to spawning `infinicode` itself — that re-enters
|
|
32
|
-
* this default command and creates an infinite launch loop
|
|
33
|
-
* ships the CLI/kernel only, without the large platform-specific TUI binary).
|
|
38
|
+
* this default command and creates an infinite launch loop.
|
|
34
39
|
*/
|
|
35
40
|
function resolveTuiBinary() {
|
|
36
|
-
const
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
41
|
+
const exe = process.platform === 'win32' ? 'infinicode-tui.exe' : 'infinicode-tui';
|
|
42
|
+
// 1. Platform binary package (npm installs only the one matching this OS/arch).
|
|
43
|
+
const pkg = `infinicode-tui-${process.platform}-${process.arch}`;
|
|
44
|
+
try {
|
|
45
|
+
const require = createRequire(import.meta.url);
|
|
46
|
+
const p = require.resolve(`${pkg}/${exe}`);
|
|
40
47
|
if (existsSync(p))
|
|
41
48
|
return p;
|
|
42
49
|
}
|
|
50
|
+
catch {
|
|
51
|
+
/* platform package not installed — fall through */
|
|
52
|
+
}
|
|
53
|
+
// 2. Local bin/ (dev checkout or a manual `install-tui`).
|
|
54
|
+
const local = join(resolve(__dirname, '..', '..'), 'bin', exe);
|
|
55
|
+
if (existsSync(local))
|
|
56
|
+
return local;
|
|
43
57
|
return null;
|
|
44
58
|
}
|
|
45
59
|
function fitPromptFrameToTerminal(frame) {
|
|
@@ -365,7 +379,9 @@ export async function runAgent(_masterUrl, _model, _useTui, config) {
|
|
|
365
379
|
console.log(chalk.cyan(' infinicode mcp ') + chalk.dim('# MCP control server for a harness'));
|
|
366
380
|
console.log(chalk.cyan(' infinicode mission run ... ') + chalk.dim('# headless mission execution'));
|
|
367
381
|
console.log(chalk.cyan(' infinicode console ') + chalk.dim('# slash-command console'));
|
|
368
|
-
console.log(chalk.dim('\nTo
|
|
382
|
+
console.log(chalk.dim('\nTo get the TUI on this machine, run:'));
|
|
383
|
+
console.log(chalk.cyan(' infinicode install-tui ') + chalk.dim('# auto-find a local copy (repo/OneDrive)'));
|
|
384
|
+
console.log(chalk.cyan(' infinicode install-tui --url <url>') + chalk.dim(' # or download from a hosted binary'));
|
|
369
385
|
process.exit(1);
|
|
370
386
|
}
|
|
371
387
|
const { execa } = await import('execa');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "infinicode",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.3.0",
|
|
4
4
|
"description": "OpenKernel — provider-agnostic AI execution kernel. Native coding agent + mission-driven execution runtime.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/kernel/index.js",
|
|
@@ -84,6 +84,7 @@
|
|
|
84
84
|
"typescript": "^5.4.5"
|
|
85
85
|
},
|
|
86
86
|
"optionalDependencies": {
|
|
87
|
-
"playwright": "^1.47.0"
|
|
87
|
+
"playwright": "^1.47.0",
|
|
88
|
+
"infinicode-tui-win32-x64": "2.3.0"
|
|
88
89
|
}
|
|
89
90
|
}
|