infinicode 2.2.1 → 2.2.2

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 CHANGED
@@ -15,7 +15,7 @@ import { consoleRepl, consoleRun } from './commands/console.js';
15
15
  import { serve } from './commands/serve.js';
16
16
  import { mcpCommand } from './commands/mcp.js';
17
17
  import { DEFAULT_CONFIG } from './kernel/config-schema.js';
18
- const VERSION = '2.2.1';
18
+ const VERSION = '2.2.2';
19
19
  const config = new Conf({
20
20
  projectName: 'infinicode',
21
21
  defaults: DEFAULT_CONFIG,
@@ -26,10 +26,21 @@ import { SilentLogger } from '../kernel/index.js';
26
26
  import { openAICompatBaseURL } from '../kernel/provider-url.js';
27
27
  const __dirname = dirname(fileURLToPath(import.meta.url));
28
28
  const PROMPT_ANIMATION_MAX_FRAMES = Math.min(ASCII_VIDEO_FRAMES.length, ASCII_VIDEO_FPS * 3);
29
- function resolveInfinicodeCommand() {
29
+ /**
30
+ * Locate the bundled TUI binary, or null if it isn't shipped in this install.
31
+ * IMPORTANT: never fall back to spawning `infinicode` itself — that re-enters
32
+ * this default command and creates an infinite launch loop (the npm package
33
+ * ships the CLI/kernel only, without the large platform-specific TUI binary).
34
+ */
35
+ function resolveTuiBinary() {
30
36
  const rootDir = resolve(__dirname, '..', '..');
31
- const bundled = join(rootDir, 'bin', 'infinicode-tui.exe');
32
- return existsSync(bundled) ? bundled : 'infinicode';
37
+ const names = process.platform === 'win32' ? ['infinicode-tui.exe'] : ['infinicode-tui'];
38
+ for (const name of names) {
39
+ const p = join(rootDir, 'bin', name);
40
+ if (existsSync(p))
41
+ return p;
42
+ }
43
+ return null;
33
44
  }
34
45
  function fitPromptFrameToTerminal(frame) {
35
46
  const columns = Math.max(1, (process.stdout.columns ?? 120) - 1);
@@ -345,27 +356,27 @@ export async function runAgent(_masterUrl, _model, _useTui, config) {
345
356
  }
346
357
  console.log(chalk.dim('-'.repeat(40)));
347
358
  await renderPromptAnimation();
359
+ const tuiBinary = resolveTuiBinary();
360
+ if (!tuiBinary) {
361
+ console.log(chalk.yellow('\ninfinicode TUI is not bundled in this install.'));
362
+ console.log(chalk.dim('The npm package ships the kernel + device-mesh CLI only — the TUI binary is'));
363
+ console.log(chalk.dim('large and platform-specific, so it is not published. Use these instead:'));
364
+ console.log(chalk.cyan(' infinicode serve --hub ') + chalk.dim('# run this device as a mesh node'));
365
+ console.log(chalk.cyan(' infinicode mcp ') + chalk.dim('# MCP control server for a harness'));
366
+ console.log(chalk.cyan(' infinicode mission run ... ') + chalk.dim('# headless mission execution'));
367
+ console.log(chalk.cyan(' infinicode console ') + chalk.dim('# slash-command console'));
368
+ console.log(chalk.dim('\nTo use the TUI, build it from source and place it in bin/ (infinicode-tui[.exe]).'));
369
+ process.exit(1);
370
+ }
348
371
  const { execa } = await import('execa');
349
- const infinicodeCommand = resolveInfinicodeCommand();
350
372
  try {
351
- if (infinicodeCommand === 'infinicode') {
352
- await execa('which', ['infinicode']).catch(() => execa('where', ['infinicode']));
353
- }
354
- await execa(infinicodeCommand, [], {
373
+ await execa(tuiBinary, [], {
355
374
  stdio: 'inherit',
356
375
  env: process.env,
357
376
  });
358
377
  }
359
378
  catch (e) {
360
379
  const err = e;
361
- if (err.code === 'ENOENT') {
362
- console.log(chalk.yellow('\ninfinicode TUI binary not found.'));
363
- console.log(chalk.dim('\nThe TUI requires the infinicode binary in bin/ or on PATH.'));
364
- console.log(chalk.dim('Build from source:'));
365
- console.log(chalk.cyan(' pnpm build'));
366
- console.log();
367
- process.exit(1);
368
- }
369
380
  if (err.exitCode) {
370
381
  process.exit(err.exitCode);
371
382
  }
@@ -36,6 +36,8 @@ export declare class MeshClient {
36
36
  private opts;
37
37
  constructor(opts?: MeshClientOptions);
38
38
  private headers;
39
+ /** Normalize a base URL so a trailing slash doesn't produce `//fed/...` (→ 404). */
40
+ private base;
39
41
  fetchManifest(baseUrl: string): Promise<NodeManifest>;
40
42
  rpc(baseUrl: string, env: FederationEnvelope): Promise<FederationEnvelope>;
41
43
  /**
@@ -152,8 +152,12 @@ export class MeshClient {
152
152
  h['authorization'] = `Bearer ${this.opts.token}`;
153
153
  return h;
154
154
  }
155
+ /** Normalize a base URL so a trailing slash doesn't produce `//fed/...` (→ 404). */
156
+ base(baseUrl) {
157
+ return baseUrl.replace(/\/+$/, '');
158
+ }
155
159
  async fetchManifest(baseUrl) {
156
- const res = await fetch(`${baseUrl}/fed/manifest`, {
160
+ const res = await fetch(`${this.base(baseUrl)}/fed/manifest`, {
157
161
  headers: this.headers(),
158
162
  signal: AbortSignal.timeout(this.opts.timeoutMs ?? 5000),
159
163
  });
@@ -162,7 +166,7 @@ export class MeshClient {
162
166
  return (await res.json());
163
167
  }
164
168
  async rpc(baseUrl, env) {
165
- const res = await fetch(`${baseUrl}/fed/rpc`, {
169
+ const res = await fetch(`${this.base(baseUrl)}/fed/rpc`, {
166
170
  method: 'POST',
167
171
  headers: this.headers(),
168
172
  body: JSON.stringify(env),
@@ -180,7 +184,7 @@ export class MeshClient {
180
184
  const ctrl = new AbortController();
181
185
  (async () => {
182
186
  try {
183
- const res = await fetch(`${baseUrl}/fed/stream`, {
187
+ const res = await fetch(`${this.base(baseUrl)}/fed/stream`, {
184
188
  headers: this.headers(),
185
189
  signal: ctrl.signal,
186
190
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "infinicode",
3
- "version": "2.2.1",
3
+ "version": "2.2.2",
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",