infinicode 2.8.114 → 2.8.115

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/README.md CHANGED
@@ -132,11 +132,11 @@ Discovery options: `--lan` (same subnet, zero-config UDP broadcast, port 47915),
132
132
 
133
133
  ### One-link MCP mesh connection
134
134
 
135
- On the first Tailscale device, start MCP with a shared token and generate its direct link:
135
+ On the first Tailscale device, generate the direct link and start MCP. Infinicode creates and persists the shared token automatically:
136
136
 
137
137
  ```bash
138
- infinicode mesh link --token YOUR_SECRET
139
- infinicode mcp --tailscale --token YOUR_SECRET
138
+ infinicode mesh link
139
+ infinicode mcp --tailscale
140
140
  ```
141
141
 
142
142
  Give the single generated `http://.../fed/join?token=...` URL to the agent on the second device. It can connect immediately with either:
@@ -1,5 +1,6 @@
1
1
  import chalk from 'chalk';
2
2
  import { execa } from 'execa';
3
+ import { randomBytes } from 'node:crypto';
3
4
  import { buildMeshJoinLink } from '../kernel/federation/mesh-link.js';
4
5
  async function tailscaleHost() {
5
6
  try {
@@ -23,7 +24,10 @@ export async function meshLink(config, opts) {
23
24
  const port = Number.parseInt(rawPort, 10);
24
25
  if (!Number.isInteger(port) || port < 1 || port > 65535)
25
26
  throw new Error('mesh link port must be between 1 and 65535');
26
- const token = opts.token ?? fed.token;
27
+ const generatedToken = !opts.token && !fed.token;
28
+ const token = opts.token ?? fed.token ?? randomBytes(24).toString('base64url');
29
+ if (token !== fed.token)
30
+ config.set('federation', { ...fed, token });
27
31
  const bracketedHost = host.includes(':') && !host.startsWith('[') ? `[${host}]` : host;
28
32
  const link = buildMeshJoinLink(`${opts.https ? 'https' : 'http'}://${bracketedHost}:${port}`, token);
29
33
  if (opts.quiet) {
@@ -32,13 +36,11 @@ export async function meshLink(config, opts) {
32
36
  }
33
37
  console.log(chalk.bold('\n Infinicode direct mesh link'));
34
38
  console.log(chalk.cyan(` ${link}`));
39
+ console.log(chalk.green(`\n ${generatedToken ? 'Generated and saved a new mesh token.' : 'Mesh token saved and ready.'}`));
35
40
  console.log(chalk.dim('\n Give this one URL to the agent on the other device.'));
36
41
  console.log(` Direct MCP: ${chalk.cyan(`infinicode mcp --connect "${link}"`)}`);
37
42
  console.log(` OpenCode/Claude: ${chalk.cyan(`infinicode mesh join "${link}" --host all`)}`);
38
- if (token)
39
- console.log(chalk.yellow('\n This link grants mesh access. Treat it like a password and rotate the token if shared accidentally.'));
40
- else
41
- console.log(chalk.yellow('\n This mesh has no token. Add --token <secret> on both devices for production use.'));
43
+ console.log(chalk.yellow('\n This link grants mesh access. Treat it like a password and rotate the token if shared accidentally.'));
42
44
  console.log();
43
45
  return link;
44
46
  }