@puyinkai/aike-internal-cli 0.2.0 → 0.2.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 -3
- package/aike_internal_cli.py +1 -4
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,9 +8,12 @@ CLI 读取平台下发的 `/state/runtime-secrets/aike/runtime-env.json`(读
|
|
|
8
8
|
|
|
9
9
|
| Key | 用途 |
|
|
10
10
|
|---|---|
|
|
11
|
-
| `AIKE_TOOL_BFF_URL` |
|
|
12
|
-
| `AIKE_MCP_ACCESS_TOKEN` |
|
|
13
|
-
|
|
11
|
+
| `AIKE_TOOL_BFF_URL` | aike-tool-bff 在 MCP 网关上的完整地址:test `https://mcp.test.wangxiaobao.com/mcp/wow`,生产去掉 `.test`。由 aike-application 下发(配置项 `AIKE_TOOL_BFF_PUBLIC_URL`) |
|
|
12
|
+
| `AIKE_MCP_ACCESS_TOKEN` | MCP 网关令牌。网关校验后以 `X-MCP-Subject-Id` 注入用户,这是唯一的身份来源 |
|
|
13
|
+
|
|
14
|
+
协议:标准 MCP stateless streamable-HTTP,CLI 直接发 `tools/call`。tool-bff 响应为标准 JSON-RPC(不带 pierre 外壳),
|
|
15
|
+
工具失败时 `isError=true`、`structuredContent` 为 `{code, message}`,CLI 原样输出为 `error`。错误码见主仓库
|
|
16
|
+
`docs/contracts/digital-person.md`;本地联调获取令牌见主仓库 `docs/references/mcp-token.md`。
|
|
14
17
|
|
|
15
18
|
## 命令
|
|
16
19
|
|
|
@@ -24,6 +27,13 @@ python3 aike_internal_cli.py digital-person video status --request-id X
|
|
|
24
27
|
|
|
25
28
|
输出固定是一行 JSON:成功为 `{"ok": true, "data": ...}`,失败为 `{"ok": false, "error": {"code", "message"}}`,退出码 1。
|
|
26
29
|
|
|
30
|
+
## 本地联调
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
AIKE_TOOL_BFF_URL=https://mcp.test.wangxiaobao.com/mcp/wow AIKE_MCP_ACCESS_TOKEN=<MCP 令牌> \
|
|
34
|
+
python3 aike_internal_cli.py digital-person status
|
|
35
|
+
```
|
|
36
|
+
|
|
27
37
|
## 发布
|
|
28
38
|
|
|
29
39
|
```bash
|
package/aike_internal_cli.py
CHANGED
|
@@ -15,7 +15,7 @@ import urllib.error
|
|
|
15
15
|
import urllib.request
|
|
16
16
|
import uuid
|
|
17
17
|
|
|
18
|
-
VERSION = "0.2.
|
|
18
|
+
VERSION = "0.2.1"
|
|
19
19
|
RUNTIME_ENV_FILE = "/state/runtime-secrets/aike/runtime-env.json"
|
|
20
20
|
VIDEO_POLL_SECONDS = 5
|
|
21
21
|
_ids = itertools.count(1)
|
|
@@ -46,7 +46,6 @@ class Client:
|
|
|
46
46
|
def __init__(self):
|
|
47
47
|
self.url = runtime_value("AIKE_TOOL_BFF_URL")
|
|
48
48
|
self.token = runtime_value("AIKE_MCP_ACCESS_TOKEN")
|
|
49
|
-
self.user_id = runtime_value("AIKE_USER_ID")
|
|
50
49
|
if not self.url:
|
|
51
50
|
raise ToolError("CONFIG_MISSING", "缺少 AIKE_TOOL_BFF_URL")
|
|
52
51
|
if not self.token:
|
|
@@ -56,8 +55,6 @@ class Client:
|
|
|
56
55
|
token = self.token if self.token.lower().startswith("bearer ") else "Bearer " + self.token
|
|
57
56
|
headers = {"Authorization": token, "Content-Type": "application/json",
|
|
58
57
|
"Accept": "application/json, text/event-stream", "User-Agent": "aike-internal-cli/" + VERSION}
|
|
59
|
-
if self.user_id:
|
|
60
|
-
headers["X-Aike-User-Id"] = self.user_id
|
|
61
58
|
body = {"jsonrpc": "2.0", "id": next(_ids), "method": "tools/call",
|
|
62
59
|
"params": {"name": tool, "arguments": arguments or {}}}
|
|
63
60
|
request = urllib.request.Request(self.url, data=json.dumps(body, ensure_ascii=False).encode("utf-8"),
|