alink-cli 0.5.0 → 0.6.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/bin/agentlink.js +16 -3
- package/dist/daemon.js +18753 -796
- package/package.json +6 -5
package/bin/agentlink.js
CHANGED
|
@@ -308,11 +308,17 @@ async function ctlRestart(args) {
|
|
|
308
308
|
await ctlStart(startArgs);
|
|
309
309
|
}
|
|
310
310
|
|
|
311
|
-
//
|
|
311
|
+
// `local` 子命令 = 同机驾驶舱:本地起 single 模式 hub + daemon,自动开浏览器,
|
|
312
|
+
// 不遥控。归一成 daemon 认的 --local flag(daemon 参数不收 positional)。既接受
|
|
313
|
+
// `npx alink-cli local`,也接受 `npx alink-cli --local`。
|
|
314
|
+
if (rawArgs[0] === "local") rawArgs[0] = "--local";
|
|
315
|
+
|
|
316
|
+
// --tunnel / --local 模式下 daemon 会自起本地 hub,且与 --hub 互斥,此时绝不注入 --hub。
|
|
312
317
|
const tunnelMode = hasFlag("tunnel");
|
|
318
|
+
const localMode = hasFlag("local");
|
|
313
319
|
|
|
314
|
-
// 1) 补 --hub 默认值:官方 hub
|
|
315
|
-
if (!hasFlag("hub") && !tunnelMode) {
|
|
320
|
+
// 1) 补 --hub 默认值:官方 hub。本地模式(tunnel/local)自带 localhost hub,跳过。
|
|
321
|
+
if (!hasFlag("hub") && !tunnelMode && !localMode) {
|
|
316
322
|
rawArgs.push("--hub", OFFICIAL_HUB);
|
|
317
323
|
}
|
|
318
324
|
|
|
@@ -330,6 +336,9 @@ if (hasFlag("pair")) {
|
|
|
330
336
|
if (explicitToken !== readCredentialFile()) tokenToPersist = explicitToken;
|
|
331
337
|
} else if (process.env.AGENTLINK_TOKEN) {
|
|
332
338
|
// 环境变量已给——daemon 自己会读 AGENTLINK_TOKEN,这里什么都不用做。
|
|
339
|
+
} else if (localMode) {
|
|
340
|
+
// --local:single 模式本地 hub,daemon 自己现生成一个 UUID token 并打印/开浏览器。
|
|
341
|
+
// 不复用落盘凭证(那多半是官方 al1. 多租户串,喂给本地 single hub 是错的),也不配对。
|
|
333
342
|
} else {
|
|
334
343
|
// 命令行和环境变量都没有——回落到落盘凭证(若有),塞进 AGENTLINK_TOKEN 供
|
|
335
344
|
// daemon 读取。
|
|
@@ -379,6 +388,7 @@ function printHelp() {
|
|
|
379
388
|
process.stdout.write(
|
|
380
389
|
[
|
|
381
390
|
`用法: npx ${self} [--hub <wss://…>] [--dir <目录>]…`,
|
|
391
|
+
` npx ${self} local [--dir …] # 同机驾驶舱:本地起 hub 并自动开浏览器,不遥控`,
|
|
382
392
|
` npx ${self} qr # 终端打印本机凭证二维码(给新手机录密钥)`,
|
|
383
393
|
` npx ${self} start [--dir …] # 后台运行(先前台配对过一次)`,
|
|
384
394
|
` npx ${self} status|logs [-f]|stop|restart`,
|
|
@@ -398,6 +408,9 @@ function printHelp() {
|
|
|
398
408
|
` --dir <path> 工作目录根,可重复;缺省当前目录。运行时可用其下任意子目录。`,
|
|
399
409
|
` --tunnel 不连任何 hub:本地起 hub + 免费 Cloudflare 隧道并打印公网链接`,
|
|
400
410
|
` (需已安装 cloudflared)。与 --hub 互斥。`,
|
|
411
|
+
` local 同机场景:本地起 single 模式 hub + daemon,自动用浏览器打开`,
|
|
412
|
+
` 控制台(localhost),把这台电脑上的多个 agent 统一管起来。`,
|
|
413
|
+
` 不遥控、不联网、无需扫码。--port 可改本地 hub 端口(默认 8080)。`,
|
|
401
414
|
` --help, -h 显示本帮助。`,
|
|
402
415
|
``,
|
|
403
416
|
`示例:`,
|