superun-ai-cli 0.1.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/INSTALL.md +118 -0
- package/README.en.md +257 -0
- package/README.md +255 -0
- package/dist/api/agent-command-api.d.ts +39 -0
- package/dist/api/agent-command-api.js +69 -0
- package/dist/api/agent-command-api.js.map +1 -0
- package/dist/api/agent-query-api.d.ts +14 -0
- package/dist/api/agent-query-api.js +72 -0
- package/dist/api/agent-query-api.js.map +1 -0
- package/dist/api/config-api.d.ts +9 -0
- package/dist/api/config-api.js +17 -0
- package/dist/api/config-api.js.map +1 -0
- package/dist/api/conversation-api.d.ts +15 -0
- package/dist/api/conversation-api.js +29 -0
- package/dist/api/conversation-api.js.map +1 -0
- package/dist/api/integration-api.d.ts +9 -0
- package/dist/api/integration-api.js +17 -0
- package/dist/api/integration-api.js.map +1 -0
- package/dist/api/plugin-api.d.ts +9 -0
- package/dist/api/plugin-api.js +14 -0
- package/dist/api/plugin-api.js.map +1 -0
- package/dist/api/preview-version-api.d.ts +6 -0
- package/dist/api/preview-version-api.js +31 -0
- package/dist/api/preview-version-api.js.map +1 -0
- package/dist/api/publish-api.d.ts +19 -0
- package/dist/api/publish-api.js +17 -0
- package/dist/api/publish-api.js.map +1 -0
- package/dist/api/upload-api.d.ts +8 -0
- package/dist/api/upload-api.js +71 -0
- package/dist/api/upload-api.js.map +1 -0
- package/dist/auth/browser-login.d.ts +11 -0
- package/dist/auth/browser-login.js +77 -0
- package/dist/auth/browser-login.js.map +1 -0
- package/dist/auth/pat-store.d.ts +15 -0
- package/dist/auth/pat-store.js +131 -0
- package/dist/auth/pat-store.js.map +1 -0
- package/dist/auto-tools/read-logs.d.ts +3 -0
- package/dist/auto-tools/read-logs.js +4 -0
- package/dist/auto-tools/read-logs.js.map +1 -0
- package/dist/auto-tools/registry.d.ts +8 -0
- package/dist/auto-tools/registry.js +26 -0
- package/dist/auto-tools/registry.js.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +10 -0
- package/dist/cli.js.map +1 -0
- package/dist/commands/auth/index.d.ts +4 -0
- package/dist/commands/auth/index.js +10 -0
- package/dist/commands/auth/index.js.map +1 -0
- package/dist/commands/auth/login.d.ts +3 -0
- package/dist/commands/auth/login.js +23 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.d.ts +4 -0
- package/dist/commands/auth/logout.js +15 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/status.d.ts +4 -0
- package/dist/commands/auth/status.js +14 -0
- package/dist/commands/auth/status.js.map +1 -0
- package/dist/commands/chat/create.d.ts +4 -0
- package/dist/commands/chat/create.js +8 -0
- package/dist/commands/chat/create.js.map +1 -0
- package/dist/commands/chat/demo.d.ts +4 -0
- package/dist/commands/chat/demo.js +11 -0
- package/dist/commands/chat/demo.js.map +1 -0
- package/dist/commands/chat/develop.d.ts +4 -0
- package/dist/commands/chat/develop.js +10 -0
- package/dist/commands/chat/develop.js.map +1 -0
- package/dist/commands/chat/index.d.ts +4 -0
- package/dist/commands/chat/index.js +26 -0
- package/dist/commands/chat/index.js.map +1 -0
- package/dist/commands/chat/interaction.d.ts +4 -0
- package/dist/commands/chat/interaction.js +22 -0
- package/dist/commands/chat/interaction.js.map +1 -0
- package/dist/commands/chat/message.d.ts +6 -0
- package/dist/commands/chat/message.js +78 -0
- package/dist/commands/chat/message.js.map +1 -0
- package/dist/commands/chat/plugin.d.ts +4 -0
- package/dist/commands/chat/plugin.js +82 -0
- package/dist/commands/chat/plugin.js.map +1 -0
- package/dist/commands/chat/publish.d.ts +3 -0
- package/dist/commands/chat/publish.js +207 -0
- package/dist/commands/chat/publish.js.map +1 -0
- package/dist/commands/chat/send.d.ts +4 -0
- package/dist/commands/chat/send.js +5 -0
- package/dist/commands/chat/send.js.map +1 -0
- package/dist/commands/chat/state.d.ts +4 -0
- package/dist/commands/chat/state.js +26 -0
- package/dist/commands/chat/state.js.map +1 -0
- package/dist/commands/chat/stop.d.ts +4 -0
- package/dist/commands/chat/stop.js +16 -0
- package/dist/commands/chat/stop.js.map +1 -0
- package/dist/commands/chat/style.d.ts +4 -0
- package/dist/commands/chat/style.js +45 -0
- package/dist/commands/chat/style.js.map +1 -0
- package/dist/commands/chat/wait.d.ts +4 -0
- package/dist/commands/chat/wait.js +11 -0
- package/dist/commands/chat/wait.js.map +1 -0
- package/dist/commands/session/get.d.ts +4 -0
- package/dist/commands/session/get.js +15 -0
- package/dist/commands/session/get.js.map +1 -0
- package/dist/commands/session/index.d.ts +4 -0
- package/dist/commands/session/index.js +8 -0
- package/dist/commands/session/index.js.map +1 -0
- package/dist/commands/session/list.d.ts +4 -0
- package/dist/commands/session/list.js +43 -0
- package/dist/commands/session/list.js.map +1 -0
- package/dist/commands/shared.d.ts +33 -0
- package/dist/commands/shared.js +127 -0
- package/dist/commands/shared.js.map +1 -0
- package/dist/commands/system/update.d.ts +6 -0
- package/dist/commands/system/update.js +10 -0
- package/dist/commands/system/update.js.map +1 -0
- package/dist/commands/system/version.d.ts +4 -0
- package/dist/commands/system/version.js +8 -0
- package/dist/commands/system/version.js.map +1 -0
- package/dist/config/constants.d.ts +9 -0
- package/dist/config/constants.js +22 -0
- package/dist/config/constants.js.map +1 -0
- package/dist/config/runtime-config.d.ts +9 -0
- package/dist/config/runtime-config.js +28 -0
- package/dist/config/runtime-config.js.map +1 -0
- package/dist/contracts/cli-output.d.ts +110 -0
- package/dist/contracts/cli-output.js +2 -0
- package/dist/contracts/cli-output.js.map +1 -0
- package/dist/contracts/node-wire.d.ts +36381 -0
- package/dist/contracts/node-wire.js +102 -0
- package/dist/contracts/node-wire.js.map +1 -0
- package/dist/contracts/value.d.ts +6 -0
- package/dist/contracts/value.js +20 -0
- package/dist/contracts/value.js.map +1 -0
- package/dist/conversation/demo-preview.d.ts +7 -0
- package/dist/conversation/demo-preview.js +62 -0
- package/dist/conversation/demo-preview.js.map +1 -0
- package/dist/conversation/development-snapshot.d.ts +5 -0
- package/dist/conversation/development-snapshot.js +52 -0
- package/dist/conversation/development-snapshot.js.map +1 -0
- package/dist/conversation/next-actions.d.ts +4 -0
- package/dist/conversation/next-actions.js +199 -0
- package/dist/conversation/next-actions.js.map +1 -0
- package/dist/conversation/round-selector.d.ts +4 -0
- package/dist/conversation/round-selector.js +25 -0
- package/dist/conversation/round-selector.js.map +1 -0
- package/dist/conversation/session-waiter.d.ts +28 -0
- package/dist/conversation/session-waiter.js +176 -0
- package/dist/conversation/session-waiter.js.map +1 -0
- package/dist/conversation/state-resolver.d.ts +8 -0
- package/dist/conversation/state-resolver.js +90 -0
- package/dist/conversation/state-resolver.js.map +1 -0
- package/dist/conversation/text-projector.d.ts +5 -0
- package/dist/conversation/text-projector.js +45 -0
- package/dist/conversation/text-projector.js.map +1 -0
- package/dist/development.d.ts +1 -0
- package/dist/development.js +16 -0
- package/dist/development.js.map +1 -0
- package/dist/interactions/context.d.ts +23 -0
- package/dist/interactions/context.js +50 -0
- package/dist/interactions/context.js.map +1 -0
- package/dist/interactions/handlers/index.d.ts +2 -0
- package/dist/interactions/handlers/index.js +52 -0
- package/dist/interactions/handlers/index.js.map +1 -0
- package/dist/interactions/handlers/reply-ask.d.ts +2 -0
- package/dist/interactions/handlers/reply-ask.js +33 -0
- package/dist/interactions/handlers/reply-ask.js.map +1 -0
- package/dist/interactions/handlers/reply-ddl.d.ts +2 -0
- package/dist/interactions/handlers/reply-ddl.js +8 -0
- package/dist/interactions/handlers/reply-ddl.js.map +1 -0
- package/dist/interactions/handlers/reply-plugin.d.ts +3 -0
- package/dist/interactions/handlers/reply-plugin.js +56 -0
- package/dist/interactions/handlers/reply-plugin.js.map +1 -0
- package/dist/interactions/handlers/reply-prd.d.ts +2 -0
- package/dist/interactions/handlers/reply-prd.js +35 -0
- package/dist/interactions/handlers/reply-prd.js.map +1 -0
- package/dist/interactions/handlers/reply-secret.d.ts +2 -0
- package/dist/interactions/handlers/reply-secret.js +27 -0
- package/dist/interactions/handlers/reply-secret.js.map +1 -0
- package/dist/interactions/handlers/reply-semantic.d.ts +2 -0
- package/dist/interactions/handlers/reply-semantic.js +98 -0
- package/dist/interactions/handlers/reply-semantic.js.map +1 -0
- package/dist/interactions/handlers/reply-style.d.ts +2 -0
- package/dist/interactions/handlers/reply-style.js +9 -0
- package/dist/interactions/handlers/reply-style.js.map +1 -0
- package/dist/interactions/handlers/reply-universal-ask.d.ts +2 -0
- package/dist/interactions/handlers/reply-universal-ask.js +13 -0
- package/dist/interactions/handlers/reply-universal-ask.js.map +1 -0
- package/dist/interactions/handlers/types.d.ts +10 -0
- package/dist/interactions/handlers/types.js +2 -0
- package/dist/interactions/handlers/types.js.map +1 -0
- package/dist/interactions/interaction-id.d.ts +2 -0
- package/dist/interactions/interaction-id.js +15 -0
- package/dist/interactions/interaction-id.js.map +1 -0
- package/dist/interactions/parsers/ask-user-tool.d.ts +2 -0
- package/dist/interactions/parsers/ask-user-tool.js +14 -0
- package/dist/interactions/parsers/ask-user-tool.js.map +1 -0
- package/dist/interactions/parsers/ddl-approval.d.ts +2 -0
- package/dist/interactions/parsers/ddl-approval.js +12 -0
- package/dist/interactions/parsers/ddl-approval.js.map +1 -0
- package/dist/interactions/parsers/plugin-action.d.ts +2 -0
- package/dist/interactions/parsers/plugin-action.js +19 -0
- package/dist/interactions/parsers/plugin-action.js.map +1 -0
- package/dist/interactions/parsers/prd-clarification.d.ts +2 -0
- package/dist/interactions/parsers/prd-clarification.js +26 -0
- package/dist/interactions/parsers/prd-clarification.js.map +1 -0
- package/dist/interactions/parsers/secret-input.d.ts +2 -0
- package/dist/interactions/parsers/secret-input.js +27 -0
- package/dist/interactions/parsers/secret-input.js.map +1 -0
- package/dist/interactions/parsers/semantic-action.d.ts +4 -0
- package/dist/interactions/parsers/semantic-action.js +84 -0
- package/dist/interactions/parsers/semantic-action.js.map +1 -0
- package/dist/interactions/parsers/style-selection.d.ts +15 -0
- package/dist/interactions/parsers/style-selection.js +77 -0
- package/dist/interactions/parsers/style-selection.js.map +1 -0
- package/dist/interactions/parsers/universal-ask-user.d.ts +2 -0
- package/dist/interactions/parsers/universal-ask-user.js +15 -0
- package/dist/interactions/parsers/universal-ask-user.js.map +1 -0
- package/dist/interactions/questions.d.ts +46 -0
- package/dist/interactions/questions.js +95 -0
- package/dist/interactions/questions.js.map +1 -0
- package/dist/interactions/registry.d.ts +4 -0
- package/dist/interactions/registry.js +64 -0
- package/dist/interactions/registry.js.map +1 -0
- package/dist/output/exit-codes.d.ts +22 -0
- package/dist/output/exit-codes.js +27 -0
- package/dist/output/exit-codes.js.map +1 -0
- package/dist/output/writer.d.ts +13 -0
- package/dist/output/writer.js +53 -0
- package/dist/output/writer.js.map +1 -0
- package/dist/program.d.ts +9 -0
- package/dist/program.js +39 -0
- package/dist/program.js.map +1 -0
- package/dist/runner.d.ts +11 -0
- package/dist/runner.js +54 -0
- package/dist/runner.js.map +1 -0
- package/dist/runtime.d.ts +48 -0
- package/dist/runtime.js +404 -0
- package/dist/runtime.js.map +1 -0
- package/dist/transport/api-client.d.ts +17 -0
- package/dist/transport/api-client.js +37 -0
- package/dist/transport/api-client.js.map +1 -0
- package/dist/transport/http-client.d.ts +20 -0
- package/dist/transport/http-client.js +79 -0
- package/dist/transport/http-client.js.map +1 -0
- package/dist/update/update-lock.d.ts +1 -0
- package/dist/update/update-lock.js +57 -0
- package/dist/update/update-lock.js.map +1 -0
- package/dist/update/version-gate.d.ts +6 -0
- package/dist/update/version-gate.js +118 -0
- package/dist/update/version-gate.js.map +1 -0
- package/package.json +43 -0
package/INSTALL.md
ADDED
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
# superun-ai-cli 安装与配置指南
|
|
2
|
+
|
|
3
|
+
[English README](README.en.md) | [中文 README](README.md)
|
|
4
|
+
|
|
5
|
+
本指南供 AI Agent 协助用户安装和配置 CLI。请使用用户的语言说明进度,只完成安装、登录和只读验证,不自动创建、修改或发布项目。
|
|
6
|
+
|
|
7
|
+
- npm 包名:`superun-ai-cli`。
|
|
8
|
+
- 命令名:`superun-ai`。
|
|
9
|
+
- 官方仓库:<https://github.com/AiGuangInc/superun-ai-cli>。
|
|
10
|
+
- 默认服务:<https://superun.com>。不要擅自指定其他服务地址。
|
|
11
|
+
|
|
12
|
+
## 1. 检查环境
|
|
13
|
+
|
|
14
|
+
```bash
|
|
15
|
+
node --version
|
|
16
|
+
npm --version
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
需要 Node.js 22 或更新版本和 npm。缺少依赖或版本不满足时,说明问题并征得用户同意后再安装或升级;不要擅自更换用户的 Node.js 管理方式、修改全局配置或使用 `sudo`。
|
|
20
|
+
|
|
21
|
+
如果 `superun-ai` 已存在,先检查其路径及 `superun-ai version`,区分 npm 安装和源码目录链接。保留现有凭据及用户未提交的代码,不卸载或覆盖其他工具。
|
|
22
|
+
|
|
23
|
+
## 2. 确认可用的安装方式
|
|
24
|
+
|
|
25
|
+
当前仓库尚未正式发布到 npm。执行安装时应重新查询,避免依赖过时的发布状态:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
npm view superun-ai-cli name version repository.url dist.tarball --registry=https://registry.npmjs.org --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
- 查询成功:核对包名和官方仓库归属后,使用 npm 安装。若包归属无法确认,先停止并说明,不安装同名的未知来源包。
|
|
32
|
+
- 明确返回该包的 `E404`:说明 npm 安装尚不可用。有官方仓库访问权限时,从源码安装;没有权限时,请用户提供可访问的官方源码或等待发布。
|
|
33
|
+
- 网络、证书、认证或其他错误:保留真实错误并先排查,不把它们当成“包未发布”,也不要反复重试安装。
|
|
34
|
+
|
|
35
|
+
### 已发布:从 npm 安装
|
|
36
|
+
|
|
37
|
+
```bash
|
|
38
|
+
npm install -g superun-ai-cli --registry=https://registry.npmjs.org
|
|
39
|
+
```
|
|
40
|
+
|
|
41
|
+
### 未发布:从源码安装
|
|
42
|
+
|
|
43
|
+
需要 Git 和仓库访问权限。先确认安装目录;若已有本仓库,复用该目录并检查 `git status` 和 remote,不覆盖未提交改动、不强制切换分支。
|
|
44
|
+
|
|
45
|
+
新目录安装示例:
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git clone https://github.com/AiGuangInc/superun-ai-cli.git
|
|
49
|
+
cd superun-ai-cli
|
|
50
|
+
npm ci
|
|
51
|
+
npm run build
|
|
52
|
+
npm install -g .
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
逐条执行,失败即停。仓库访问失败时,说明需要的访问权限,不索取 GitHub 凭据明文。不要修改 `private`、包名或版本号,不执行 `npm publish`,也不要绕过发行版的版本校验。
|
|
56
|
+
|
|
57
|
+
源码安装可能把全局命令链接到当前目录,因此应保留源码目录。以后更新源码时,先确认工作区干净再同步代码、安装匹配依赖并重新构建;全局命令若不是源码链接,再执行 `npm install -g .`。不要用 `superun-ai update` 获取尚未发布的版本。
|
|
58
|
+
|
|
59
|
+
## 3. 单独验证命令安装
|
|
60
|
+
|
|
61
|
+
安装完成后再运行帮助和版本命令:
|
|
62
|
+
|
|
63
|
+
```bash
|
|
64
|
+
superun-ai --help
|
|
65
|
+
superun-ai version
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
确认命令可以启动。若提示找不到命令,检查当前终端的 `PATH`、所用 Node.js 安装及 npm 全局目录;不要把它误判为业务登录失败。不要通过全量打印环境变量来排查,避免泄露凭据。
|
|
69
|
+
|
|
70
|
+
## 4. 引导用户登录
|
|
71
|
+
|
|
72
|
+
先查询本地配置状态:
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
superun-ai auth status
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
- 返回 `CONFIGURED`:复用已有 PAT,不先执行 `auth logout`,也不要求用户重复登录。
|
|
79
|
+
- 明确提示未配置 PAT:执行下面的登录命令,让用户本人在浏览器完成登录。
|
|
80
|
+
- 提示凭据文件异常、版本检查失败或其他错误:说明错误,等待用户决定如何处理,不删除凭据或无限循环登录。
|
|
81
|
+
|
|
82
|
+
```bash
|
|
83
|
+
superun-ai auth login
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
CLI 会打开 Superun 登录页面,完成后领取 PAT 并保存到本地。浏览器未自动打开时,把 CLI 打印的登录地址提供给用户。保持登录命令运行,等它返回成功;不要另起重复登录流程。等待期间告诉用户需要完成网页登录,超时或取消时如实说明。
|
|
87
|
+
|
|
88
|
+
如果用户明确要导入已有 PAT,请让用户在自己的交互式终端执行:
|
|
89
|
+
|
|
90
|
+
```bash
|
|
91
|
+
superun-ai auth login --pat
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
`--pat` 后不能跟凭据值,由终端隐藏读取。不要让用户把 PAT 发到聊天里,也不要读取或展示凭据文件内容。已安全设置 `SUPERUN_PAT` 的自动化环境可直接复用;需要持久化时可通过 `auth login --stdin` 输入,但不得回显或记录秘密。
|
|
95
|
+
|
|
96
|
+
## 5. 只读验证线上访问
|
|
97
|
+
|
|
98
|
+
登录完成后执行:
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
superun-ai session list --limit 1
|
|
102
|
+
```
|
|
103
|
+
|
|
104
|
+
返回 `ok: true`、`state: COMPLETED` 表示查询成功;空列表也是正常结果,不要为了验证自动创建项目。`auth status` 只证明本地有配置,不能替代本次实际访问校验。
|
|
105
|
+
|
|
106
|
+
如果返回鉴权错误,先说明现有 PAT 或权限校验未通过,由用户决定是否重新登录;不要自动清除 PAT、切换账号或更换服务地址。其他网络或业务错误也应如实反馈。
|
|
107
|
+
|
|
108
|
+
## 6. 向用户交付结果
|
|
109
|
+
|
|
110
|
+
简要告知安装来源、实际版本、命令是否可用、登录与只读验证结果,并给出下一步入口:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
superun-ai --help
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
只在用户随后提出创作需求时才调用 `chat create`。安装配置本身不代表用户授权创建项目、启用插件、发布应用、改变站点可见性或发 npm 包。
|
|
117
|
+
|
|
118
|
+
<!-- @author xiuyu.yi -->
|
package/README.en.md
ADDED
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
# superun-ai-cli
|
|
2
|
+
|
|
3
|
+
[English](README.en.md) | [中文](README.md)
|
|
4
|
+
|
|
5
|
+
superun-ai-cli is a command-line tool for project management, conversational creation, interactive questions, plugins, and application publishing. People and automation use the same commands; business results are returned as JSON.
|
|
6
|
+
|
|
7
|
+
## Installation
|
|
8
|
+
|
|
9
|
+
Requires Node.js 22 or newer and npm.
|
|
10
|
+
|
|
11
|
+
> The package has not yet been officially published to npm. Users with repository access can install from source now; registry installation will be available after publication.
|
|
12
|
+
|
|
13
|
+
### 🤖 Install and configure with an AI agent (recommended)
|
|
14
|
+
|
|
15
|
+
Send the following prompt to Claude Code, Codex, or another AI coding agent. The agent will follow the [installation guide](INSTALL.md) to check your environment, install the CLI, and guide you through login and verification:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
Read https://raw.githubusercontent.com/AiGuangInc/superun-ai-cli/refs/heads/main/INSTALL.md and help me install and configure superun-ai-cli. Check which installation method is available first. Let me complete login in my browser; do not request or display my PAT in plain text.
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
If the agent already has this repository open, ask it to read `INSTALL.md` in the repository root.
|
|
22
|
+
|
|
23
|
+
### Manual installation
|
|
24
|
+
|
|
25
|
+
Source installation currently requires Git and repository access. Run these commands in the directory where you want to keep the source:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/AiGuangInc/superun-ai-cli.git
|
|
29
|
+
cd superun-ai-cli
|
|
30
|
+
npm ci
|
|
31
|
+
npm run build
|
|
32
|
+
npm install -g .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
If you already have a local checkout, use that directory and preserve any uncommitted changes.
|
|
36
|
+
|
|
37
|
+
After the package is published to npm, install it directly without cloning or compiling the source:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g superun-ai-cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`-g` installs the package globally. Once the global command directory is on your `PATH`, you can run `superun-ai` from any directory.
|
|
44
|
+
|
|
45
|
+
The package name is `superun-ai-cli`; the shell command is `superun-ai`.
|
|
46
|
+
|
|
47
|
+
## Help
|
|
48
|
+
|
|
49
|
+
After installation, run help separately. These commands do not start login or create a project:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
superun-ai --help
|
|
53
|
+
superun-ai chat --help
|
|
54
|
+
superun-ai chat style generate --help
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## Command tree
|
|
58
|
+
|
|
59
|
+
The tree below lists command groups, positional arguments, and their purpose. Replace required arguments written as `<...>` with actual values. Use each command's `--help` to see its options and requirements.
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
superun-ai
|
|
63
|
+
├── auth # Manage PAT login
|
|
64
|
+
│ ├── login # Sign in and save a PAT
|
|
65
|
+
│ ├── status # Check local PAT configuration
|
|
66
|
+
│ └── logout # Remove the locally saved PAT
|
|
67
|
+
├── session # Query projects
|
|
68
|
+
│ ├── list # List projects
|
|
69
|
+
│ └── get <sessionId> # Get project details
|
|
70
|
+
├── chat # Conversational creation
|
|
71
|
+
│ ├── create # Create a project and send a request
|
|
72
|
+
│ ├── send <sessionId> # Continue the conversation
|
|
73
|
+
│ ├── state <sessionId> # Inspect the task and interactions
|
|
74
|
+
│ ├── wait <sessionId> # Wait for input or a task result
|
|
75
|
+
│ ├── stop <sessionId> # Stop the remote task
|
|
76
|
+
│ ├── style # Manage creative styles
|
|
77
|
+
│ │ ├── generate <sessionId> # Generate style candidates
|
|
78
|
+
│ │ ├── list <sessionId> # List style batches
|
|
79
|
+
│ │ └── select <sessionId> <choiceId> # Choose a completed style
|
|
80
|
+
│ ├── demo <sessionId> # View the demo and record it as viewed
|
|
81
|
+
│ ├── develop <sessionId> # Keep the demo and plan development
|
|
82
|
+
│ ├── interaction # Answer or skip interactions
|
|
83
|
+
│ │ ├── reply <sessionId> <interactionId> # Submit an answer
|
|
84
|
+
│ │ └── skip <sessionId> <interactionId> # Skip an eligible interaction
|
|
85
|
+
│ ├── plugin # Query, enable, and disable plugins
|
|
86
|
+
│ │ ├── list <sessionId> # List available plugins
|
|
87
|
+
│ │ ├── status <sessionId> <pluginId> # Inspect a plugin
|
|
88
|
+
│ │ ├── enable <sessionId> <pluginId> # Enable a plugin
|
|
89
|
+
│ │ └── disable <sessionId> <pluginId> # Disable a plugin
|
|
90
|
+
│ └── publish # Publish applications and manage visibility
|
|
91
|
+
│ ├── status <sessionId> # Query versions and deployment progress
|
|
92
|
+
│ ├── start <sessionId> <encryptedId> # Publish a specific version
|
|
93
|
+
│ └── visibility <sessionId> <visibility> # Make the site public or private
|
|
94
|
+
├── update # Check and install the required version
|
|
95
|
+
└── version # Show local and output-schema versions
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## PAT login
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
superun-ai auth login
|
|
102
|
+
superun-ai auth status
|
|
103
|
+
superun-ai auth logout
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
`auth login` reuses an existing PAT. If none is configured, it opens the Superun website so you can sign in and obtain a PAT, then saves it locally without requiring you to copy it. When you first run a business command in an interactive terminal without a PAT, the CLI uses the same login flow and then resumes the original command.
|
|
107
|
+
|
|
108
|
+
Browser login waits for up to five minutes. Press Ctrl+C to cancel. If the browser does not open automatically, use the URL printed in the terminal. The website login token is only used to obtain a PAT and is not stored locally.
|
|
109
|
+
|
|
110
|
+
To import an existing PAT manually:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
superun-ai auth login --pat
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`--pat` reads hidden input from the terminal, even if `SUPERUN_PAT` is already set. It is an input-mode switch: do not put the PAT after it, and do not combine it with `--stdin`.
|
|
117
|
+
|
|
118
|
+
Automated business commands without a PAT fail instead of opening a browser. Set `SUPERUN_PAT` or log in using standard input:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
printf '%s\n' "$SUPERUN_PAT" | superun-ai auth login --stdin
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
The CLI prefers `SUPERUN_PAT`, then `~/.config/superun-ai-cli/credentials.json`. The file uses `0600` permissions. Logging out removes the local credential without revoking the server-side PAT. Never put a PAT in command-line arguments, source control, or logs.
|
|
125
|
+
|
|
126
|
+
`auth status` only checks local credential configuration. It does not open a browser or request a PAT. `CONFIGURED` means a credential is configured locally; its validity and project permissions are checked by actual business requests. An expired or disabled PAT, or a damaged credential file, results in an error rather than an automatic login or overwrite.
|
|
127
|
+
|
|
128
|
+
`auth logout` deletes the saved PAT. If `SUPERUN_PAT` is set, it remains effective until you remove it from your shell:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
unset SUPERUN_PAT
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
Help, `version`, `update`, and `auth logout` do not require an existing PAT. With `SUPERUN_PAT` set, you can call business commands without first running login again.
|
|
135
|
+
|
|
136
|
+
## Common commands
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
superun-ai session list --limit 20
|
|
140
|
+
superun-ai session get <sessionId>
|
|
141
|
+
superun-ai chat create --message "Build a promotional website for a coffee shop"
|
|
142
|
+
superun-ai chat send <sessionId> --message "Add a membership benefits section"
|
|
143
|
+
superun-ai chat state <sessionId>
|
|
144
|
+
superun-ai chat wait <sessionId> --timeout 120
|
|
145
|
+
superun-ai chat stop <sessionId>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
Write commands support `--no-wait`, returning as soon as the request is accepted. `chat wait` waits for input, a selection, or task completion. When an explicit local waiting limit is reached, it returns the current state with `waitTimedOut: true`; you can continue querying. Ctrl+C only ends local waiting. Use `chat stop` explicitly to stop a remote task.
|
|
149
|
+
|
|
150
|
+
The CLI connects to Superun by default. Use the global `--endpoint <URL>` option to specify an API endpoint and `--locale <language>` to choose the response language.
|
|
151
|
+
|
|
152
|
+
## Answering interactions
|
|
153
|
+
|
|
154
|
+
When the CLI returns `NEEDS_INPUT`, read the questions, allowed `actions`, and `answerSchema` in `interactions`. Always reply using the `interactionId` from that result.
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"action": "SUBMIT",
|
|
159
|
+
"answers": [
|
|
160
|
+
{ "questionId": "q0", "selectedIndices": [0], "otherValue": "" }
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
superun-ai chat interaction reply <sessionId> <interactionId> --input ./answer.json
|
|
167
|
+
superun-ai chat interaction skip <sessionId> <interactionId>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
Selection indices start at `0`. Skip only when the interaction allows `SKIP`. Completing the requirements questionnaire starts style generation directly; omit `action` or use `GENERATE_STYLES`. The `SUBMIT` example above applies to ordinary questions. Stage transitions, database approvals, and other interactions use their own returned actions.
|
|
171
|
+
|
|
172
|
+
For secret input, submit `{"values":{"requested-key":"secret-value"}}` with only the requested keys. Values are not echoed. Stale or ambiguous interactions are rejected; query the current state again.
|
|
173
|
+
|
|
174
|
+
`chat interaction reply --no-wait` controls waiting for subsequent creation after the reply has been processed. Some plugin configuration steps must finish in the foreground before submitting their interaction result; this option does not skip those steps. After an interruption, check the plugin and conversation states first.
|
|
175
|
+
|
|
176
|
+
## Styles, plugins, and publishing
|
|
177
|
+
|
|
178
|
+
Interactions, styles, plugins, and publishing belong under `chat`. Use `chat interaction`, `chat style`, `chat plugin`, and `chat publish`; they are not top-level commands.
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
superun-ai chat style generate <sessionId> --content "Create a clean brand style" --count 2
|
|
182
|
+
superun-ai chat style list <sessionId>
|
|
183
|
+
superun-ai chat style select <sessionId> <choiceId>
|
|
184
|
+
|
|
185
|
+
superun-ai chat plugin list <sessionId>
|
|
186
|
+
superun-ai chat plugin status <sessionId> <pluginId>
|
|
187
|
+
superun-ai chat plugin enable <sessionId> <pluginId>
|
|
188
|
+
superun-ai chat plugin disable <sessionId> <pluginId>
|
|
189
|
+
|
|
190
|
+
superun-ai chat publish status <sessionId>
|
|
191
|
+
superun-ai chat publish start <sessionId> <encryptedId>
|
|
192
|
+
superun-ai chat publish visibility <sessionId> public
|
|
193
|
+
superun-ai chat publish visibility <sessionId> private
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
Style generation defaults to two candidates and supports one to four. Use the returned `choiceId` to select a style. Publishing uses the returned `encryptedId` and tracks the selected version's deployment. Plugin IDs come from `chat plugin list`.
|
|
197
|
+
|
|
198
|
+
After the user explicitly asks to launch the site, use `chat publish status <sessionId> --for-launch` to get the latest pending version from the publishing panel. Show its `changeLog` unchanged, then follow the returned publishing command without a second confirmation. For a deployment already in progress, only track progress. If deployment is complete but the site is not public, finish the visibility step and return the public URL. `status` is always read-only; an ordinary status query does not grant publishing authorization.
|
|
199
|
+
|
|
200
|
+
`chat publish start --indexing allow|deny` controls search-engine indexing, not visitor access. Change site visibility with `chat publish visibility`. If the service requires acknowledgment of cloud costs, review them before explicitly passing `--acknowledge-cloud-fee`.
|
|
201
|
+
|
|
202
|
+
## Attachments
|
|
203
|
+
|
|
204
|
+
`chat create/send` accepts repeated `--file <path>` options. Small text files may be included directly in the message; other files are uploaded and approved before the message is sent. The per-file limit is 20 MB.
|
|
205
|
+
|
|
206
|
+
`session get --include-attachments` returns visible attachments. `chat state --include-file <name>` reads a named visible file. System files and secret configuration are not returned as result attachments.
|
|
207
|
+
|
|
208
|
+
## Output and errors
|
|
209
|
+
|
|
210
|
+
Business commands write one JSON result to stdout. Diagnostics and update progress go to stderr.
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"schemaVersion": "1",
|
|
215
|
+
"ok": true,
|
|
216
|
+
"data": {
|
|
217
|
+
"state": "RUNNING",
|
|
218
|
+
"sessionId": "session_id",
|
|
219
|
+
"messages": [],
|
|
220
|
+
"progress": [],
|
|
221
|
+
"interactions": []
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
| Exit code | Meaning |
|
|
227
|
+
|---|---|
|
|
228
|
+
| 0 | Query succeeded, request accepted, running, input needed, or completed |
|
|
229
|
+
| 2 | Invalid arguments or input |
|
|
230
|
+
| 3 | Missing or invalid PAT, or access denied |
|
|
231
|
+
| 4 | Version check or update failed |
|
|
232
|
+
| 5 | Business failure, stale or ambiguous interaction, or uncertain write outcome |
|
|
233
|
+
| 6 | Interaction unsupported by this CLI version |
|
|
234
|
+
| 7 | Timeout for an attachment or auxiliary operation |
|
|
235
|
+
| 8 | Network or response-protocol error |
|
|
236
|
+
| 130 | Local command interrupted |
|
|
237
|
+
|
|
238
|
+
`OUTCOME_UNKNOWN` means a request may have been accepted. Do not immediately retry the write. Query the returned session ID first. If a create request did not return a session ID, check the project list before deciding what to do next.
|
|
239
|
+
|
|
240
|
+
## Updates
|
|
241
|
+
|
|
242
|
+
Published releases check the required version before business commands and install it when needed, then resume the command. If an update or verification fails, the CLI stops; resolve the reported issue before retrying. Help, `version`, and `auth logout` work offline.
|
|
243
|
+
|
|
244
|
+
For the current source installation, rebuild in the source directory. If the global command is not linked to that checkout, run `npm install -g .` again. Do not use `superun-ai update` to retrieve an unpublished version.
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
superun-ai version
|
|
248
|
+
superun-ai update
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## Uninstalling
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
npm uninstall -g superun-ai-cli
|
|
255
|
+
```
|
|
256
|
+
|
|
257
|
+
<!-- @author xiuyu.yi -->
|
package/README.md
ADDED
|
@@ -0,0 +1,255 @@
|
|
|
1
|
+
# superun-ai-cli
|
|
2
|
+
|
|
3
|
+
[English](README.en.md) | [中文](README.md)
|
|
4
|
+
|
|
5
|
+
superun-ai-cli 命令行工具,支持项目管理、对话创作、交互问答、插件管理和应用发布。人和自动化程序使用同一组命令;业务结果以 JSON 输出。
|
|
6
|
+
|
|
7
|
+
## 安装
|
|
8
|
+
|
|
9
|
+
需要 Node.js 22 或更新版本,以及 npm。
|
|
10
|
+
|
|
11
|
+
> 当前版本尚未在 npm 正式发布。有仓库访问权限的用户可以先从源码安装;npm 安装方式在正式发布后可用。
|
|
12
|
+
|
|
13
|
+
### 🤖 通过 AI Agent 安装配置(推荐)
|
|
14
|
+
|
|
15
|
+
把下面这段话发给 Claude Code、Codex 或其他 AI 编码 Agent,它会根据[安装指南](INSTALL.md)检查环境、安装 CLI,并引导你完成登录与验证:
|
|
16
|
+
|
|
17
|
+
```text
|
|
18
|
+
请阅读 https://raw.githubusercontent.com/AiGuangInc/superun-ai-cli/refs/heads/main/INSTALL.md,帮我安装并配置 superun-ai-cli。请先确认可用的安装方式,登录时让我在浏览器完成操作,不要索取或展示 PAT 明文。
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
如果 Agent 已经打开本仓库,也可以直接让它阅读根目录的 `INSTALL.md`。
|
|
22
|
+
|
|
23
|
+
### 手动安装
|
|
24
|
+
|
|
25
|
+
当前从源码安装需要 Git 和仓库访问权限。在准备存放代码的目录执行:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
git clone https://github.com/AiGuangInc/superun-ai-cli.git
|
|
29
|
+
cd superun-ai-cli
|
|
30
|
+
npm ci
|
|
31
|
+
npm run build
|
|
32
|
+
npm install -g .
|
|
33
|
+
```
|
|
34
|
+
|
|
35
|
+
如果本地已有仓库,请使用已有目录,不要覆盖未提交的改动。
|
|
36
|
+
|
|
37
|
+
正式发布到 npm 后,可直接安装,无需源码和自行编译:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
npm install -g superun-ai-cli
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
`-g` 表示全局安装。全局命令目录在 `PATH` 中时,可以在任意目录使用 `superun-ai`。
|
|
44
|
+
|
|
45
|
+
安装包名为 `superun-ai-cli`,使用时的命令名为 `superun-ai`。
|
|
46
|
+
|
|
47
|
+
## 查看帮助
|
|
48
|
+
|
|
49
|
+
安装完成后,单独执行以下命令查看帮助;这些命令不会发起登录或创作:
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
superun-ai --help
|
|
53
|
+
superun-ai chat --help
|
|
54
|
+
superun-ai chat style generate --help
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
## 命令树
|
|
58
|
+
|
|
59
|
+
下面列出完整命令层级、位置参数和用途。`<...>` 表示需要替换的必填位置参数;选项参数及其要求可通过各命令的 `--help` 查看。
|
|
60
|
+
|
|
61
|
+
```text
|
|
62
|
+
superun-ai
|
|
63
|
+
├── auth # 管理 PAT 登录
|
|
64
|
+
│ ├── login # 登录 Superun 并保存 PAT
|
|
65
|
+
│ ├── status # 查看本地 PAT 配置状态
|
|
66
|
+
│ └── logout # 清除本地 PAT
|
|
67
|
+
├── session # 查询项目
|
|
68
|
+
│ ├── list # 查询项目列表
|
|
69
|
+
│ └── get <sessionId> # 查询项目详情
|
|
70
|
+
├── chat # 对话创作
|
|
71
|
+
│ ├── create # 新建项目并发送需求
|
|
72
|
+
│ ├── send <sessionId> # 继续项目创作
|
|
73
|
+
│ ├── state <sessionId> # 查询当前任务和交互
|
|
74
|
+
│ ├── wait <sessionId> # 等待当前交互或任务结果
|
|
75
|
+
│ ├── stop <sessionId> # 停止远端任务
|
|
76
|
+
│ ├── style # 管理创作风格
|
|
77
|
+
│ │ ├── generate <sessionId> # 生成风格候选
|
|
78
|
+
│ │ ├── list <sessionId> # 查询全部风格批次
|
|
79
|
+
│ │ └── select <sessionId> <choiceId> # 选择已完成的风格
|
|
80
|
+
│ ├── demo <sessionId> # 查看演示快照并记录已查看状态
|
|
81
|
+
│ ├── develop <sessionId> # 保留演示,进入研发并生成规划
|
|
82
|
+
│ ├── interaction # 回答或跳过交互
|
|
83
|
+
│ │ ├── reply <sessionId> <interactionId> # 提交回答
|
|
84
|
+
│ │ └── skip <sessionId> <interactionId> # 跳过当前交互
|
|
85
|
+
│ ├── plugin # 查询、启用和禁用插件
|
|
86
|
+
│ │ ├── list <sessionId> # 查询可用插件
|
|
87
|
+
│ │ ├── status <sessionId> <pluginId> # 查询插件状态
|
|
88
|
+
│ │ ├── enable <sessionId> <pluginId> # 启用插件
|
|
89
|
+
│ │ └── disable <sessionId> <pluginId> # 禁用插件
|
|
90
|
+
│ └── publish # 发布应用和管理站点状态
|
|
91
|
+
│ ├── status <sessionId> # 查询发布版本与部署进度
|
|
92
|
+
│ ├── start <sessionId> <encryptedId> # 发布指定版本
|
|
93
|
+
│ └── visibility <sessionId> <visibility> # 设置站点上线或下线状态
|
|
94
|
+
├── update # 检查并安装指定版本
|
|
95
|
+
└── version # 显示本地版本与输出协议版本
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
## PAT 登录
|
|
99
|
+
|
|
100
|
+
```bash
|
|
101
|
+
superun-ai auth login
|
|
102
|
+
superun-ai auth status
|
|
103
|
+
superun-ai auth logout
|
|
104
|
+
```
|
|
105
|
+
|
|
106
|
+
已有 PAT 时,`auth login` 直接复用;没有时自动打开 Superun 网页,完成登录后领取 PAT 并保存到本地,无需手动复制。首次在交互终端执行业务命令时,如果没有 PAT,也会自动进入同一登录流程,完成后继续执行原命令。
|
|
107
|
+
|
|
108
|
+
网页登录最多等待 5 分钟,按 Ctrl+C 可取消。浏览器未自动打开时,可以手动打开终端提示的地址。网页登录 Token 只用于申请 PAT,不会保存到本地。
|
|
109
|
+
|
|
110
|
+
如果已经有 PAT,也可以手动导入:
|
|
111
|
+
|
|
112
|
+
```bash
|
|
113
|
+
superun-ai auth login --pat
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
`--pat` 会在终端隐藏读取输入,即使已设置 `SUPERUN_PAT` 也会要求重新输入。它是输入方式开关,后面不能直接跟 PAT 明文,并且不能与 `--stdin` 同时使用。
|
|
117
|
+
|
|
118
|
+
自动化脚本中缺少 PAT 时会报错,不会自动打开浏览器。可以设置 `SUPERUN_PAT`,也可以通过标准输入登录:
|
|
119
|
+
|
|
120
|
+
```bash
|
|
121
|
+
printf '%s\n' "$SUPERUN_PAT" | superun-ai auth login --stdin
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
凭据优先级为 `SUPERUN_PAT` 环境变量,其次是 `~/.config/superun-ai-cli/credentials.json`。文件权限为 `0600`;退出登录只清除本地保存的凭据,不撤销服务端 PAT。请勿将 PAT 写进命令行参数、仓库或日志。
|
|
125
|
+
|
|
126
|
+
`auth status` 只查看本地凭据配置,不会打开浏览器或申请 PAT。返回 `CONFIGURED` 表示本地已配置凭据;已有 PAT 是否有效、是否有权访问项目,会在实际业务请求时校验。PAT 过期、禁用或本地文件损坏时会报错,不会自动重新登录或覆盖凭据。
|
|
127
|
+
|
|
128
|
+
`auth logout` 会删除本地保存的 PAT,下次使用时重新登录。若设置了 `SUPERUN_PAT`,环境变量仍然有效,需要在终端手动清除:
|
|
129
|
+
|
|
130
|
+
```bash
|
|
131
|
+
unset SUPERUN_PAT
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
帮助、`version`、`update` 和清除本地凭据的 `auth logout` 不要求已有 PAT。提供 `SUPERUN_PAT` 即可直接调用业务命令,无需重复执行登录命令。
|
|
135
|
+
|
|
136
|
+
## 常用命令
|
|
137
|
+
|
|
138
|
+
```bash
|
|
139
|
+
superun-ai session list --limit 20
|
|
140
|
+
superun-ai session get <sessionId>
|
|
141
|
+
superun-ai chat create --message "为咖啡店制作一个活动网站"
|
|
142
|
+
superun-ai chat send <sessionId> --message "增加会员权益介绍"
|
|
143
|
+
superun-ai chat state <sessionId>
|
|
144
|
+
superun-ai chat wait <sessionId> --timeout 120
|
|
145
|
+
superun-ai chat stop <sessionId>
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
写命令支持 `--no-wait`:请求被接受后立即返回。`chat wait` 等待到需要输入、需要选择或任务结束;达到本地等待时限后返回当前状态和 `waitTimedOut: true`,可以继续查询。按 Ctrl+C 只结束本地等待;远端停止需要显式执行 `chat stop`。
|
|
149
|
+
|
|
150
|
+
默认连接 Superun 服务。全局参数 `--endpoint <URL>` 可指定 API 地址,`--locale <language>` 可指定响应语言。
|
|
151
|
+
|
|
152
|
+
## 回答交互
|
|
153
|
+
|
|
154
|
+
当返回 `NEEDS_INPUT` 时,读取 `interactions` 中的问题、允许的 `actions` 和 `answerSchema`。每次回复都使用该结果中的 `interactionId`。
|
|
155
|
+
|
|
156
|
+
```json
|
|
157
|
+
{
|
|
158
|
+
"action": "SUBMIT",
|
|
159
|
+
"answers": [
|
|
160
|
+
{ "questionId": "q0", "selectedIndices": [0], "otherValue": "" }
|
|
161
|
+
]
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
```bash
|
|
166
|
+
superun-ai chat interaction reply <sessionId> <interactionId> --input ./answer.json
|
|
167
|
+
superun-ai chat interaction skip <sessionId> <interactionId>
|
|
168
|
+
```
|
|
169
|
+
|
|
170
|
+
选择下标从 `0` 开始。只有交互声明支持 `SKIP` 时才可跳过。需求问卷答齐后直接生成风格,`action` 可省略或填写 `GENERATE_STYLES`;上面的 `SUBMIT` 示例适用于普通问答。阶段交接、数据库变更确认等交互应使用各自返回的动作。
|
|
171
|
+
|
|
172
|
+
密钥输入使用 `{"values":{"请求的键名":"密钥值"}}`,只提交当前交互要求的键;内容不会回显。过期或存在歧义的交互会被拒绝,请重新查询状态。
|
|
173
|
+
|
|
174
|
+
`chat interaction reply --no-wait` 控制回答处理完成后的创作等待。部分插件配置需要在前台等待配置结束并提交交互结果,这一步不会因该选项被省略;中断后应先查询插件与会话状态。
|
|
175
|
+
|
|
176
|
+
## 风格、插件和发布
|
|
177
|
+
|
|
178
|
+
交互、风格、插件和发布均归属对话创作,统一使用 `chat interaction`、`chat style`、`chat plugin` 和 `chat publish`,不提供对应顶层入口。
|
|
179
|
+
|
|
180
|
+
```bash
|
|
181
|
+
superun-ai chat style generate <sessionId> --content "生成简洁的品牌风格" --count 2
|
|
182
|
+
superun-ai chat style list <sessionId>
|
|
183
|
+
superun-ai chat style select <sessionId> <choiceId>
|
|
184
|
+
|
|
185
|
+
superun-ai chat plugin list <sessionId>
|
|
186
|
+
superun-ai chat plugin status <sessionId> <pluginId>
|
|
187
|
+
superun-ai chat plugin enable <sessionId> <pluginId>
|
|
188
|
+
superun-ai chat plugin disable <sessionId> <pluginId>
|
|
189
|
+
|
|
190
|
+
superun-ai chat publish status <sessionId>
|
|
191
|
+
superun-ai chat publish start <sessionId> <encryptedId>
|
|
192
|
+
superun-ai chat publish visibility <sessionId> public
|
|
193
|
+
superun-ai chat publish visibility <sessionId> private
|
|
194
|
+
```
|
|
195
|
+
|
|
196
|
+
风格默认生成 2 个,支持 1~4 个;使用查询结果中的 `choiceId`。发布使用查询结果中的 `encryptedId`,按目标版本跟踪部署状态。插件 ID 以 `chat plugin list` 返回值为准。
|
|
197
|
+
|
|
198
|
+
用户明确回复“上线运营”后,使用 `chat publish status <sessionId> --for-launch` 获取 Glow 发布面板的最新待发布版本,原样展示该版本的 `changeLog`,再按返回的命令直接发布,无需二次确认。发布中的版本只跟踪进度;部署后尚未公开的站点继续执行上线动作,完成后返回正式链接。`status` 始终只读,普通状态查询不会自动获得发布授权。
|
|
199
|
+
|
|
200
|
+
`chat publish start --indexing allow|deny` 控制搜索引擎索引,不限制用户访问;站点上下线使用 `chat publish visibility`。若服务端要求确认云服务费用,了解费用后可显式传入 `--acknowledge-cloud-fee`。
|
|
201
|
+
|
|
202
|
+
## 附件
|
|
203
|
+
|
|
204
|
+
`chat create/send` 支持重复传入 `--file <path>`。小型文本文件可以直接作为内容输入,其余文件上传并完成审核后才发送消息。单文件上限 20MB。
|
|
205
|
+
|
|
206
|
+
`session get --include-attachments` 返回可见附件清单;`chat state --include-file <name>` 读取指定可见附件正文。系统文件和密钥配置文件不会作为结果附件返回。
|
|
207
|
+
|
|
208
|
+
## 输出与错误
|
|
209
|
+
|
|
210
|
+
业务命令在 stdout 输出一条 JSON,诊断和更新进度写入 stderr。
|
|
211
|
+
|
|
212
|
+
```json
|
|
213
|
+
{
|
|
214
|
+
"schemaVersion": "1",
|
|
215
|
+
"ok": true,
|
|
216
|
+
"data": {
|
|
217
|
+
"state": "RUNNING",
|
|
218
|
+
"sessionId": "session_id",
|
|
219
|
+
"messages": [],
|
|
220
|
+
"progress": [],
|
|
221
|
+
"interactions": []
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
```
|
|
225
|
+
|
|
226
|
+
| 退出码 | 含义 |
|
|
227
|
+
|---|---|
|
|
228
|
+
| 0 | 查询成功、请求已接受、仍在运行、需要输入或任务完成 |
|
|
229
|
+
| 2 | 参数或输入格式错误 |
|
|
230
|
+
| 3 | PAT 缺失、无效或访问被拒绝 |
|
|
231
|
+
| 4 | 版本检查或更新失败 |
|
|
232
|
+
| 5 | 业务失败、交互过期/歧义或写请求结果不确定 |
|
|
233
|
+
| 6 | 当前版本不支持所需交互 |
|
|
234
|
+
| 7 | 附件等辅助操作等待超时 |
|
|
235
|
+
| 8 | 网络或响应协议错误 |
|
|
236
|
+
| 130 | 本地命令被中断 |
|
|
237
|
+
|
|
238
|
+
`OUTCOME_UNKNOWN` 表示请求可能已被接受,不能直接重试写操作。先使用返回的会话 ID 查询状态;创建请求若未取得会话 ID,应查询项目列表确认。
|
|
239
|
+
|
|
240
|
+
## 更新
|
|
241
|
+
|
|
242
|
+
正式发行版会在执行业务命令前检查版本,需要更新时自动安装指定版本后继续执行。更新或校验失败时会停止执行,请根据错误提示处理后重试。帮助、`version` 和 `auth logout` 可离线使用。
|
|
243
|
+
|
|
244
|
+
当前从源码安装的版本,请在源码目录重新构建;如果全局命令不是链接到该目录,再执行 `npm install -g .`。不要使用 `superun-ai update` 获取尚未发布的版本。
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
superun-ai version
|
|
248
|
+
superun-ai update
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
## 卸载
|
|
252
|
+
|
|
253
|
+
```bash
|
|
254
|
+
npm uninstall -g superun-ai-cli
|
|
255
|
+
```
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/** 对话创建、工具回复和项目内容更新。@author xiuyu.yi */
|
|
2
|
+
import type { ApiClient } from '../transport/api-client.js';
|
|
3
|
+
import type { JsonObject } from '../contracts/value.js';
|
|
4
|
+
export type ChatInput = {
|
|
5
|
+
sessionId?: string;
|
|
6
|
+
content: string;
|
|
7
|
+
model?: string;
|
|
8
|
+
minDuration?: number;
|
|
9
|
+
previewVersionId?: number;
|
|
10
|
+
workspaceId?: string;
|
|
11
|
+
mode?: number;
|
|
12
|
+
framework?: number;
|
|
13
|
+
sessionExtra?: Record<string, string>;
|
|
14
|
+
roundExtra?: Record<string, string>;
|
|
15
|
+
businessParams?: JsonObject;
|
|
16
|
+
preReplyMessageId?: string;
|
|
17
|
+
parallelSelectRequest?: JsonObject;
|
|
18
|
+
excludedInheritedRoundExtraKeys?: Array<string>;
|
|
19
|
+
attachments?: Array<JsonObject>;
|
|
20
|
+
};
|
|
21
|
+
export declare class AgentCommandApi {
|
|
22
|
+
private readonly client;
|
|
23
|
+
constructor(client: ApiClient);
|
|
24
|
+
chat(input: ChatInput): Promise<JsonObject>;
|
|
25
|
+
parallel(input: JsonObject): Promise<JsonObject>;
|
|
26
|
+
viewDemo(sessionId: string): Promise<JsonObject>;
|
|
27
|
+
stop(sessionId: string, scope: 'own' | 'all', messageId?: string): Promise<void>;
|
|
28
|
+
reply(sessionId: string, toolId: string, toolResult?: unknown): Promise<JsonObject>;
|
|
29
|
+
replySingle(input: JsonObject): Promise<JsonObject>;
|
|
30
|
+
messageExtra(sessionId: string, messageId: string, extra: JsonObject): Promise<void>;
|
|
31
|
+
saveAttachment(sessionId: string, name: string, content: unknown, replyMessageId?: string): Promise<void>;
|
|
32
|
+
contentExtra(input: {
|
|
33
|
+
sessionId: string;
|
|
34
|
+
messageId: string;
|
|
35
|
+
contentId: string;
|
|
36
|
+
extra: JsonObject;
|
|
37
|
+
}): Promise<void>;
|
|
38
|
+
sessionExtra(sessionId: string, extra: Record<string, string>): Promise<void>;
|
|
39
|
+
}
|