@bubx/cli 0.1.0 → 0.1.1
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 +13 -12
- package/dist/main.js +13 -13
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -4,31 +4,32 @@ CLI 支持 macOS 和 Linux,需要 Node.js 22.23+(22.x)或 24+。设备凭
|
|
|
4
4
|
|
|
5
5
|
```sh
|
|
6
6
|
npm install -g @bubx/cli
|
|
7
|
-
|
|
7
|
+
bub --version
|
|
8
|
+
bub bot start
|
|
8
9
|
```
|
|
9
10
|
|
|
10
11
|
在仓库内开发时,在根目录运行 `pnpm build` 并启动 API 和 Relay,再运行 `pnpm cli bot start`。
|
|
11
12
|
|
|
12
|
-
安装后,在终端运行 `
|
|
13
|
+
安装后,在终端运行 `bub bot start`,选择已有 Bot 或创建一个新 Bot。新建时填写名称、确认工作区并选择 Adapter。每个 Bot 保存自己的工作区、Adapter、模型、推理强度和权限,由独立 Bot Server 进程执行。多个 Bot 可以同时在线并共享本机设备授权。已有单 Bot 配置会作为已有 Bot 出现在菜单中。
|
|
13
14
|
|
|
14
15
|
首次需要授权时,从终端扫码或点击设备批准链接。Bot 在线后,用相同账号在客户端的 Bot 列表中打开。向他人共享时,在 Bot 成员页创建 Team 邀请并复制链接或显示二维码。[启动与连接交互](../../docs/agent/design/cli/onboarding.md) · [本机 Codex 实测](../../docs/agent/reviews/bot-start/README.md)
|
|
15
16
|
|
|
16
17
|
## 命令
|
|
17
18
|
|
|
18
|
-
| 命令
|
|
19
|
-
|
|
|
20
|
-
| `
|
|
21
|
-
| `
|
|
22
|
-
| `
|
|
23
|
-
| `
|
|
24
|
-
| `
|
|
19
|
+
| 命令 | 用途 |
|
|
20
|
+
| --------------- | ---------------------------------------------------- |
|
|
21
|
+
| `bub bot start` | 选择已有 Bot 或新建 Bot。已运行的 Bot 会显示当前状态 |
|
|
22
|
+
| `bub status` | 查看本机所有 Bot 的 Adapter、工作区和状态 |
|
|
23
|
+
| `bub stop` | 停止指定的运行中 Bot |
|
|
24
|
+
| `bub devices` | 查看本机 CLI 的共享设备授权和凭证到期时间 |
|
|
25
|
+
| `bub agents` | 查看本机 Codex、agy 登录状态及尚待接入的 Adapter |
|
|
25
26
|
|
|
26
|
-
`
|
|
27
|
+
`bub bot call <bot-id> <method> [payload]` 按当前登录用户远程调用 Bot Server。载荷为 JSON。可以使用 `--request-id` 固定请求标识,或用 `--watch` 持续读取订阅事件。
|
|
27
28
|
|
|
28
|
-
新 Bot 默认归属账号的个人组织,也可用 `
|
|
29
|
+
新 Bot 默认归属账号的个人组织,也可用 `bub bot start --org <org-id>` 指定有管理权限的组织。只有一个运行中的 Bot 时,`bub stop` 直接停止。多个候选 Bot 通过名称和工作区区分。脚本使用 `bub status --json` 读取 `bots` 数组,使用数组里的本地 `id` 或已注册的 `botId` 指定目标。
|
|
29
30
|
|
|
30
31
|
```sh
|
|
31
|
-
|
|
32
|
+
bub stop --bot <bot-id>
|
|
32
33
|
```
|
|
33
34
|
|
|
34
35
|
Codex 支持只读、工作区可写和完全访问。每条消息用一个临时原生会话执行,网页收到完整文本。当前执行为非交互模式,逐次任务审批和原生会话恢复属于完整 App Server 适配范围。[Codex Adapter](../../packages/agent-adapters/codex/README.md)
|
package/dist/main.js
CHANGED
|
@@ -183,7 +183,7 @@ function requireTerminal(command) {
|
|
|
183
183
|
}
|
|
184
184
|
async function selectBot(rows, purpose) {
|
|
185
185
|
if (rows.length === 0) return purpose === "start" ? "new" : void 0;
|
|
186
|
-
const command = purpose === "stop" ? "
|
|
186
|
+
const command = purpose === "stop" ? "bub stop" : "bub bot " + purpose;
|
|
187
187
|
requireTerminal(command);
|
|
188
188
|
const entries = rows.map((row) => ({
|
|
189
189
|
value: row,
|
|
@@ -283,7 +283,7 @@ async function promptBotStart({
|
|
|
283
283
|
saved,
|
|
284
284
|
loadModels
|
|
285
285
|
}) {
|
|
286
|
-
requireTerminal("
|
|
286
|
+
requireTerminal("bub bot start");
|
|
287
287
|
let name;
|
|
288
288
|
let workspace;
|
|
289
289
|
if (existingName === void 0) {
|
|
@@ -740,11 +740,11 @@ import qr from "qrcode-terminal";
|
|
|
740
740
|
// package.json
|
|
741
741
|
var package_default = {
|
|
742
742
|
name: "@bubx/cli",
|
|
743
|
-
version: "0.1.
|
|
743
|
+
version: "0.1.1",
|
|
744
744
|
description: "Bubai Bot CLI",
|
|
745
745
|
type: "module",
|
|
746
746
|
bin: {
|
|
747
|
-
|
|
747
|
+
bub: "./dist/main.js"
|
|
748
748
|
},
|
|
749
749
|
files: [
|
|
750
750
|
"dist/main.js",
|
|
@@ -1230,7 +1230,7 @@ function readProfile(directory2) {
|
|
|
1230
1230
|
}
|
|
1231
1231
|
function requireProfile(directory2) {
|
|
1232
1232
|
const profile = readProfile(directory2);
|
|
1233
|
-
if (!profile) throw new Error("Run
|
|
1233
|
+
if (!profile) throw new Error("Run bub init first.");
|
|
1234
1234
|
return profile;
|
|
1235
1235
|
}
|
|
1236
1236
|
function deviceDirectory(directory2, profile) {
|
|
@@ -1403,7 +1403,7 @@ async function callBot(directory2, botId, method, input, {
|
|
|
1403
1403
|
const credential = credentialStore(profile.id).read("device");
|
|
1404
1404
|
const device = profile.device;
|
|
1405
1405
|
if (!credential || !device || device.revokedAt)
|
|
1406
|
-
throw new Error("Run
|
|
1406
|
+
throw new Error("Run bub login first.");
|
|
1407
1407
|
const payload = z2.json().parse(JSON.parse(input));
|
|
1408
1408
|
const sessionId = payload && typeof payload === "object" && "sessionId" in payload && typeof payload.sessionId === "string" ? payload.sessionId : void 0;
|
|
1409
1409
|
const controller = new AbortController();
|
|
@@ -1467,15 +1467,15 @@ async function configure(directory2, expectedExecution, rotate = false) {
|
|
|
1467
1467
|
try {
|
|
1468
1468
|
const profile = requireProfile(directory2);
|
|
1469
1469
|
if (profile.deviceOnly)
|
|
1470
|
-
throw new Error("\u8BF7\u5148\u8FD0\u884C
|
|
1470
|
+
throw new Error("\u8BF7\u5148\u8FD0\u884C bub bot start \u65B0\u5EFA Bot\u3002");
|
|
1471
1471
|
if (expectedExecution && executionFingerprint(profile) !== expectedExecution)
|
|
1472
1472
|
throw new Error(
|
|
1473
|
-
"The Bot configuration changed. Run
|
|
1473
|
+
"The Bot configuration changed. Run bub bot start to confirm it again."
|
|
1474
1474
|
);
|
|
1475
1475
|
const account = requireProfile(deviceDirectory(directory2, profile));
|
|
1476
1476
|
const credential = credentialStore(account.id).read("device");
|
|
1477
1477
|
if (!credential || account.device?.revokedAt)
|
|
1478
|
-
throw new Error("Run
|
|
1478
|
+
throw new Error("Run bub login first.");
|
|
1479
1479
|
const api = createControlClient(profile.apiOrigin, credential);
|
|
1480
1480
|
const bot = await api.registerBot({
|
|
1481
1481
|
registrationId: profile.botRegistrationId,
|
|
@@ -1908,7 +1908,7 @@ function findBot(bots, id) {
|
|
|
1908
1908
|
({ profile }) => profile.id === id || profile.botId === id
|
|
1909
1909
|
);
|
|
1910
1910
|
if (!bot)
|
|
1911
|
-
throw new Error(`\u627E\u4E0D\u5230 Bot ${id}\u3002\u8BF7\u7528
|
|
1911
|
+
throw new Error(`\u627E\u4E0D\u5230 Bot ${id}\u3002\u8BF7\u7528 bub status --json \u67E5\u770B ID\u3002`);
|
|
1912
1912
|
return bot;
|
|
1913
1913
|
}
|
|
1914
1914
|
async function chooseRunningBot(id) {
|
|
@@ -1976,7 +1976,7 @@ async function startBot({ org }) {
|
|
|
1976
1976
|
console.log(`\u2713 ${name} \u5DF2\u5728\u7EBF`);
|
|
1977
1977
|
console.log("\u4F7F\u7528\u540C\u4E00\u8D26\u53F7\u5728\u5BA2\u6237\u7AEF\u7684 Bot \u5217\u8868\u4E2D\u6253\u5F00\u3002");
|
|
1978
1978
|
}
|
|
1979
|
-
var program = new Command().name("
|
|
1979
|
+
var program = new Command().name("bub").description("Bubai Bot CLI").version(package_default.version);
|
|
1980
1980
|
var botCommands = program.command("bot").description("Manage local Bots");
|
|
1981
1981
|
botCommands.command("start").description("Select or create a Bot, then start it").option("--org <id>", "Organization ID for a new Bot").action(startBot);
|
|
1982
1982
|
botCommands.command("call <bot-id> <method> [payload]").description("Call a Bot Server as the signed-in user").option("--request-id <id>", "Use this request ID for result recovery").option("--watch", "Read events until the connection closes").action(
|
|
@@ -2031,7 +2031,7 @@ function advancedBot(id) {
|
|
|
2031
2031
|
const legacy = bots.find((bot) => bot.directory === directory);
|
|
2032
2032
|
if (legacy) return legacy;
|
|
2033
2033
|
if (bots.length === 1) return bots[0];
|
|
2034
|
-
if (!bots.length) throw new Error("\u8BF7\u5148\u8FD0\u884C
|
|
2034
|
+
if (!bots.length) throw new Error("\u8BF7\u5148\u8FD0\u884C bub bot start \u65B0\u5EFA Bot\u3002");
|
|
2035
2035
|
throw new Error("\u6709\u591A\u4E2A Bot\uFF0C\u8BF7\u4F7F\u7528 --bot \u6307\u5B9A ID\u3002");
|
|
2036
2036
|
}
|
|
2037
2037
|
program.command("start").description("Start a local Bot Server for advanced use").option("--foreground", "Run Bot Server in the current terminal").option("--bot <id>", "Select the Bot by ID").action(
|
|
@@ -2094,7 +2094,7 @@ program.command("status").description("List all local Bots").option("--json", "P
|
|
|
2094
2094
|
return;
|
|
2095
2095
|
}
|
|
2096
2096
|
if (!bots.length) {
|
|
2097
|
-
console.log("\u672C\u673A\u6682\u65E0 Bot\u3002\u8FD0\u884C
|
|
2097
|
+
console.log("\u672C\u673A\u6682\u65E0 Bot\u3002\u8FD0\u884C bub bot start \u65B0\u5EFA\u3002");
|
|
2098
2098
|
return;
|
|
2099
2099
|
}
|
|
2100
2100
|
const { displayBotState: displayBotState2, displayWorkspace: displayWorkspace2 } = await Promise.resolve().then(() => (init_start_prompts(), start_prompts_exports));
|