infinicode 2.2.2 → 2.2.3
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 +3 -1
- package/package.json +1 -1
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.2.
|
|
19
|
+
const VERSION = '2.2.3';
|
|
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
|
@@ -365,7 +365,9 @@ export async function runAgent(_masterUrl, _model, _useTui, config) {
|
|
|
365
365
|
console.log(chalk.cyan(' infinicode mcp ') + chalk.dim('# MCP control server for a harness'));
|
|
366
366
|
console.log(chalk.cyan(' infinicode mission run ... ') + chalk.dim('# headless mission execution'));
|
|
367
367
|
console.log(chalk.cyan(' infinicode console ') + chalk.dim('# slash-command console'));
|
|
368
|
-
console.log(chalk.dim('\nTo
|
|
368
|
+
console.log(chalk.dim('\nTo get the TUI on this machine, run:'));
|
|
369
|
+
console.log(chalk.cyan(' infinicode install-tui ') + chalk.dim('# auto-find a local copy (repo/OneDrive)'));
|
|
370
|
+
console.log(chalk.cyan(' infinicode install-tui --url <url>') + chalk.dim(' # or download from a hosted binary'));
|
|
369
371
|
process.exit(1);
|
|
370
372
|
}
|
|
371
373
|
const { execa } = await import('execa');
|
package/package.json
CHANGED