@tencentcloudadp/cli 0.1.4 → 0.1.5
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 +3 -3
- package/bin/adp.js +3 -2
- package/dist/cli.js +1929 -441
- package/dist/cli.js.map +1 -1
- package/package.json +2 -1
- package/skills/adp/SKILL.md +3 -2
- package/skills/adp/configuration/SKILL.md +3 -0
- package/skills/adp/create/SKILL.md +39 -7
- package/skills/adp/evals/evals.json +14 -0
- package/skills/adp/gotchas/SKILL.md +8 -4
- package/skills/adp/references/app-modes.md +2 -1
- package/skills/adp/references/auth.md +3 -3
- package/skills/adp/references/credentials.md +46 -8
- package/skills/adp/references/mcp.md +78 -0
- package/skills/adp/references/pitfalls.md +6 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@tencentcloudadp/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
4
4
|
"description": "CLI for Tencent Cloud Agent Development Platform (ADP)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -36,6 +36,7 @@
|
|
|
36
36
|
"test": "vitest run",
|
|
37
37
|
"test:unit": "vitest run tests/unit",
|
|
38
38
|
"test:integration": "vitest run tests/integration",
|
|
39
|
+
"check:portable": "pnpm lint && pnpm typecheck && node scripts/architecture-check.mjs && node scripts/check-esm-imports.mjs && node scripts/check-secrets.mjs && pnpm knip && pnpm build && pnpm test:unit && pnpm test:integration && pnpm workbuddy:connector && node scripts/smoke-cli.mjs",
|
|
39
40
|
"eval:cli": "vitest run tests/integration/cli/agent-contract.test.ts tests/integration/cli/agent-eval.test.ts tests/integration/cli/agent-grader.test.ts",
|
|
40
41
|
"eval:grade": "tsx scripts/grade-agent-eval.ts",
|
|
41
42
|
"knip": "knip"
|
package/skills/adp/SKILL.md
CHANGED
|
@@ -58,7 +58,7 @@ adp schema --command "channel" --compact --format json
|
|
|
58
58
|
|
|
59
59
|
| 当前任务 | 读取 |
|
|
60
60
|
| --- | --- |
|
|
61
|
-
|
|
|
61
|
+
| 创建应用、添加 Claw 子 Agent、选模式、知识库导入、工作流与异步试跑、应用/工作流包导入导出 | [create/SKILL.md](create/SKILL.md) |
|
|
62
62
|
| 修改 adp.jsonc、环境覆盖、同步草稿 | [configuration/SKILL.md](configuration/SKILL.md) |
|
|
63
63
|
| 发布、模式限制、挂载插件或 Skill | [gotchas/SKILL.md](gotchas/SKILL.md) |
|
|
64
64
|
| 平台 Skill 发布、引用方、分类、共享到企业技能中心 | [references/platform-skills.md](references/platform-skills.md) |
|
|
@@ -66,7 +66,8 @@ adp schema --command "channel" --compact --format json
|
|
|
66
66
|
| 盘点应用、翻页、统计会话 | [references/inventory.md](references/inventory.md) |
|
|
67
67
|
| 绑定或发布报错、全量覆盖字段 | [references/pitfalls.md](references/pitfalls.md) |
|
|
68
68
|
| 记忆库、记忆条目、用户摘要、应用绑定记忆库 | [references/memory.md](references/memory.md) |
|
|
69
|
-
| 插件/连接器凭证、API Key
|
|
69
|
+
| 插件/连接器凭证、OAuth 授权、工具密钥(ADP API Key:创建/启停/删除)、插件工具详情与跨空间共享 | [references/credentials.md](references/credentials.md) |
|
|
70
|
+
| MCP 插件:直接调用平台 MCP 插件(如可灵)、实时工具列表、将导出的 MCP 插件装入 Coding Agent、注册外部 MCP Server | [references/mcp.md](references/mcp.md) |
|
|
70
71
|
| 工作台定时任务(按调度跑 prompt)、运行日志 | [references/timers.md](references/timers.md) |
|
|
71
72
|
| 云盘:上传下载文件、目录、挂载给应用 | [references/volumes.md](references/volumes.md) |
|
|
72
73
|
| 取 AppKey(对话/分享用的应用密钥)、启停和删除 key、分享链接、分享会话、企业共享应用、A2A 地址 | [references/app-keys.md](references/app-keys.md) |
|
|
@@ -37,6 +37,9 @@ adp schema --command dev --format json
|
|
|
37
37
|
| Plugin tools | `agent.tools` (`plugin_id` + `tool_id`) |
|
|
38
38
|
| Plugins / connectors | `agent.plugin_ids` / `agent.plugins` / `connector_ids` |
|
|
39
39
|
| Skill mounts | `agent.skill_ids` (Claw only) |
|
|
40
|
+
| Claw main agent | `agent` (`agent.profile.role` 0) plus top-level `agent_id` |
|
|
41
|
+
| Claw sub-agents | not a second `agent` block; `adp agent create --role 1` |
|
|
42
|
+
| Claw team collaboration | `mode.claw.team_enabled`, `mode.claw.team_prompt` |
|
|
40
43
|
| Multi-agent collab | `mode.multi_agent.collaboration_mode` |
|
|
41
44
|
| Bind an existing workflow | `mode.single_workflow.workflow_id` |
|
|
42
45
|
|
|
@@ -50,7 +50,7 @@ adp init --name "<name>" --space-id "<space_id>" --model-id "<model_id>" \
|
|
|
50
50
|
--app-mode <1|2|3|4> --create-remote --format json
|
|
51
51
|
```
|
|
52
52
|
|
|
53
|
-
`--create-remote` calls `CreateApp`. **Claw (`4`)** then `CreateAgent` and writes `agent_id`. A Claw app has
|
|
53
|
+
`--create-remote` calls `CreateApp`. **Claw (`4`)** then `CreateAgent` for the main agent (`Role=0`) and writes `agent_id`. A Claw app has **1 main agent (`Role=0`) and up to 19 sub-agents (`Role=1`)**, 20 agents in total. Creating a second main agent fails with `AgentAlreadyExists` (ADP returns the existing id); edit that agent with `adp agent update`. Add a sub-agent with `adp agent create --role 1` (see [Agents after init](#agents-after-init)). Standard (`1`) / single-workflow (`3`) have no agent (`CreateAgent` is rejected). Multi-Agent (`2`) binds the first listed agent if the platform created one; a fresh Multi-Agent app usually has none, so `agent_id` stays empty and that is expected. Then `ModifyApp` (and `ModifyAgent` only when `agent_id` is set). For Standard, put the role in `role_description`, not only `instructions.md`: `adp init --app-mode 1` (and `3`) copies the instructions (an existing `instructions.md` included) into top-level `role_description`; edit that key afterwards. Creation consumes quota and is not easily undone from this CLI without `adp delete --yes`.
|
|
54
54
|
|
|
55
55
|
Then publish only if they asked to 上线 / 发布:
|
|
56
56
|
|
|
@@ -78,7 +78,7 @@ Right after `adp deploy` the first call of a tool can fail on the runtime side (
|
|
|
78
78
|
|
|
79
79
|
## Knowledge-base documents
|
|
80
80
|
|
|
81
|
-
Default KB id equals `app_id`. Same
|
|
81
|
+
Default KB id equals `app_id`. Same profile keys on the public cloud and the independent site; no extra COS or AppKey. Read it with `adp kb get --kb-id "<app_id>" --space-id "<space_id>"` (the platform's `DescribeKB` only serves shared KBs, so the CLI reads the default KB from the space's KB list and needs the space).
|
|
82
82
|
|
|
83
83
|
```bash
|
|
84
84
|
adp kb doc import --file ./faq.md --format json --cwd "<project>"
|
|
@@ -101,13 +101,45 @@ A Claw agent only searches knowledge through the `KnowledgeRetrievalAnswer` tool
|
|
|
101
101
|
|
|
102
102
|
## Agents after init
|
|
103
103
|
|
|
104
|
-
`adp agent create` is **Claw-only** (`app_mode 4`)
|
|
104
|
+
`adp agent create` is **Claw-only** (`app_mode 4`). A Claw app has **1 main agent (`Role=0`)** and up to **19 sub-agents (`Role=1`)** (20 agents total). `adp.jsonc` `agent` is the main agent. `adp dev` / `adp deploy` call `ModifyAgent` only for that `agent_id`; they do not overwrite sub-agents.
|
|
105
|
+
|
|
106
|
+
`CreateAgent` with `Role=0` is idempotent once a main agent exists: a second `adp agent create` without `--role 1` returns `AgentAlreadyExists` (including `--dry-run`). The error `next_actions` include a runnable `adp agent create --role 1` preview. Edit the main agent with `adp agent update`.
|
|
107
|
+
|
|
108
|
+
Add a sub-agent (this is how to handle “给这个应用添加子 agent,名字叫 …”):
|
|
105
109
|
|
|
106
110
|
```bash
|
|
107
|
-
adp
|
|
111
|
+
adp schema --command "agent create" --format json
|
|
112
|
+
adp agent create --app-id "<claw_app_id>" --role 1 --name "<name>" \
|
|
113
|
+
--description "<when the main agent should delegate>" \
|
|
114
|
+
--instructions "<how this sub-agent works>" \
|
|
115
|
+
[--model-id "<model_id>"] --dry-run --format json
|
|
116
|
+
adp agent create --app-id "<claw_app_id>" --role 1 --name "<name>" \
|
|
117
|
+
--description "<when the main agent should delegate>" \
|
|
118
|
+
--instructions "<how this sub-agent works>" \
|
|
119
|
+
[--model-id "<model_id>"] --format json
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
`--sub-agent` is the same as `--role 1`. `--description` is the routing text the main agent uses to decide when to delegate. `--name` is required for a sub-agent (do not reuse the main agent's name from `adp.jsonc`). The same flags work with no `adp.jsonc` as long as `--app-id` is set. With `--role 1`, the CLI does **not** copy the main agent's `instructions.md`, `skill_ids`, or `plugin_ids`. Pass `--instructions` or `--instructions-file` for the sub-agent prompt; if you pass neither, the prompt is a short default from the name. Pass `--skill-id` only for skills this sub-agent should mount (default: none). Omit `--model-id` to inherit a real `adp.jsonc` model, else the main agent's model, else the first `ModelScene=18` model, else `Auto/auto`.
|
|
123
|
+
|
|
124
|
+
Change a sub-agent without rewriting `adp.jsonc` by passing only the fields that change. The CLI reads the current agent and keeps the rest (including `Role`):
|
|
125
|
+
|
|
126
|
+
```bash
|
|
127
|
+
adp agent update --app-id "<claw_app_id>" --agent-id "<sub_agent_id>" \
|
|
128
|
+
--name "<name>" --description "<when to delegate>" --dry-run --format json
|
|
108
129
|
```
|
|
109
130
|
|
|
110
|
-
|
|
131
|
+
With no field flags, `adp agent update` still syncs `adp.jsonc` plus `instructions.md` onto `--agent-id`.
|
|
132
|
+
|
|
133
|
+
Claw multi-agent collaboration (doc 134193) has two mechanisms:
|
|
134
|
+
|
|
135
|
+
1. **单向委派 (default).** The main agent routes work to sub-agents from each sub-agent's `name` and `description`. Each sub-agent runs with its own `instructions`, model, skills, and tools.
|
|
136
|
+
2. **团队协作 (optional).** Set `mode.claw.team_enabled` and `mode.claw.team_prompt` in `adp.jsonc` (`ClawAgentConfig.AgentTeamConfig`). Teammates can report back and talk to each other according to `team_prompt`. That is app config, not a substitute for creating the sub-agent.
|
|
137
|
+
|
|
138
|
+
On Standard (`1`), Multi-Agent (`2`) or single-workflow (`3`) apps the CLI reads the app mode first and refuses with a usage error, also under `--dry-run` (upstream would answer `560001`). Edit an existing agent with `adp agent update`; for another Claw agent, create a Claw app with `adp init --app-mode 4`. Re-create a missing main agent (role 0) only when `adp agent list` shows no role 0 agent:
|
|
139
|
+
|
|
140
|
+
```bash
|
|
141
|
+
adp agent create --app-id "<claw_app_id>" --dry-run --format json
|
|
142
|
+
```
|
|
111
143
|
|
|
112
144
|
This CLI does **not** generate canvas JSON — copy a template from
|
|
113
145
|
[../references/workflows.md](../references/workflows.md), export one, or pull one from an existing app. It can bind an existing id in `adp.jsonc`
|
|
@@ -117,8 +149,8 @@ This CLI does **not** generate canvas JSON — copy a template from
|
|
|
117
149
|
|
|
118
150
|
## Workflows
|
|
119
151
|
|
|
120
|
-
`adp workflow` uses the same
|
|
121
|
-
actions).
|
|
152
|
+
`adp workflow` uses the same profile keys as every other command (it calls LKE canvas
|
|
153
|
+
actions). Public cloud sends them to `lke.tencentcloudapi.com`; an independent or custom profile sends them to its ADP host.
|
|
122
154
|
|
|
123
155
|
```bash
|
|
124
156
|
adp workflow list --app-id "<app_id>" --format json --fields workflowId,name,status,isEnable
|
|
@@ -55,6 +55,20 @@
|
|
|
55
55
|
"没有写入尝试",
|
|
56
56
|
"最终回答区分预览与已创建"
|
|
57
57
|
]
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
"id": 5,
|
|
61
|
+
"name": "claw-sub-agent",
|
|
62
|
+
"prompt": "给这个应用添加子agent,名字叫ray的测试agent。应用 ID 是 4004,这是一个已经有主 Agent 的 Claw 应用。先看 schema,再预览,确认后再创建。不要改主 Agent,也不要因为应用里已经有 Agent 就放弃。",
|
|
63
|
+
"expected_output": "按 create/SKILL.md 执行 adp agent create --app-id 4004 --role 1 --name ray的测试agent 的 dry-run,然后去掉 --dry-run 真正创建。结果是新的子 Agent,不是 AgentAlreadyExists。",
|
|
64
|
+
"files": [],
|
|
65
|
+
"assertions": [
|
|
66
|
+
"先读取 agent create 的 schema",
|
|
67
|
+
"用 --role 1 和名字 ray的测试agent 对应用 4004 做 --dry-run 且成功",
|
|
68
|
+
"去掉 --dry-run 后创建出新的子 Agent,且没有复制主 Agent 的 skill",
|
|
69
|
+
"role 1 的创建没有报 AgentAlreadyExists,也没有被适配器拦截",
|
|
70
|
+
"最终回答说明已添加名为 ray的测试agent 的子 Agent"
|
|
71
|
+
]
|
|
58
72
|
}
|
|
59
73
|
]
|
|
60
74
|
}
|
|
@@ -30,7 +30,7 @@ Platform has two domains: **draft** (owner only) and **release** (end users). `M
|
|
|
30
30
|
|
|
31
31
|
Claw cannot switch to or from 1/2/3 on the same app. Create a new app.
|
|
32
32
|
|
|
33
|
-
`CreateAgent` is **Claw-only**. Standard (`1`) and single-workflow (`3`) have no agent. Multi-Agent (`2`) may bind an existing agent from `DescribeAgentSummaryList`. Standard instructions live in `role_description`, not only `instructions.md`.
|
|
33
|
+
`CreateAgent` is **Claw-only**. A Claw app has one main agent (`Role=0`) and up to 19 sub-agents (`Role=1`). A second role 0 create returns `AgentAlreadyExists`; add a sub-agent with `adp agent create --role 1` (see [create/SKILL.md](../create/SKILL.md)). Standard (`1`) and single-workflow (`3`) have no agent. Multi-Agent (`2`) may bind an existing agent from `DescribeAgentSummaryList`. Standard instructions live in `role_description`, not only `instructions.md`.
|
|
34
34
|
|
|
35
35
|
`app_mode` is not Multi-Agent **collaboration**. That is `mode.multi_agent.collaboration_mode` (1 free-handoff / 2 workflow / 3 Plan-and-Execute).
|
|
36
36
|
|
|
@@ -59,13 +59,13 @@ Full table: [../references/app-modes.md](../references/app-modes.md).
|
|
|
59
59
|
- `adp app copy --target-space-id <id> --yes` copies an app; the copy is named "<name>的副本NN", so rename it with `adp app update` if the user cares.
|
|
60
60
|
- Check what is bound with `adp agent resources --agent-id <id> [--type skills]`; quotas with `adp agent limits`.
|
|
61
61
|
- Skill **mounts** are Claw-only (`agent.skill_ids`).
|
|
62
|
-
- Child agents are agents, never tools. Do not put an `agent_id` in a plugin list.
|
|
62
|
+
- Child agents are agents, never tools. Do not put an `agent_id` in a plugin list. On Claw, create them with `adp agent create --app-id <id> --role 1 --name "<name>" --description "<when to delegate>"`. `Role=0` is the one main agent.
|
|
63
63
|
|
|
64
64
|
## Knowledge
|
|
65
65
|
|
|
66
66
|
An ID flag fed a name or non-numeric string fails with `InvalidIdFormat` (exit 2; the platform only says `invalid character … looking for beginning of value`). Use the numeric ID from the matching `list` command.
|
|
67
67
|
|
|
68
|
-
Default KB id = `app_id`; read it with `adp kb get --kb-id <app_id> --space-id <space_id>`. `adp kb doc import` uses the same
|
|
68
|
+
Default KB id = `app_id`; read it with `adp kb get --kb-id <app_id> --space-id <space_id>`. `adp kb doc import` uses the same profile keys on the public cloud and the independent site; no extra COS or AppKey. Shared KBs, categories, labels, and QA are managed with `adp kb create`, `adp kb category`, `adp kb label`, and `adp kb qa`; check `adp schema --command kb --compact --format json` for flags. Bind a shared KB to an app with `shared_kb_ids` in `adp.jsonc`. To use a KB from another space, the owner runs `adp kb share set --space-id <owner_space> --kb-id <kb_id> --scope spaces --space <target> --yes`; read the current scope with `adp kb share get --space-id <owner_space> --kb-id <kb_id>` and check the target side with `adp kb share inbound --space-id <target>`. Both `kb share get` and `kb share set` need the owning space (`--space-id` or `adp.jsonc`). `kb share set` replaces the whole scope and is visible to everyone in the target spaces, so confirm the targets with the user; add `--request-approval --remark` only when the user wants admin approval.
|
|
69
69
|
|
|
70
70
|
Pagination: `--page` (0-based) works on page-numbered lists. Cursor lists do not take it: `adp audit list` refuses `--page` with a UsageError and continues with the `--cursor` value from its next action; `conversation messages` continues with `--record-id`. `adp docs search` continues with `--page` over the same ranked pool (`total` appears when the portal returned every hit).
|
|
71
71
|
|
|
@@ -73,9 +73,13 @@ Pagination: `--page` (0-based) works on page-numbered lists. Cursor lists do not
|
|
|
73
73
|
|
|
74
74
|
`adp conversation list` returns sessions the current CAM key can see. It is not application-wide C-end volume. The result field `scope` is `owner`; there is no `--scope` flag. Without `adp.jsonc`, pass `--app-id` after `space list` and `app list --space-id`. Do not run `adp init` to list sessions. `adp conversation messages` reads one of those sessions. A `tool_call` row is the tool span: `trace.toolName`, `trace.traceId`, `title` (call), and content `text` (result). There is no separate thought document. `--type 0`, `5`, and `20` are refused; pass the `type` from the `conversation list` row. `adp conversation create|get|rename|reset|delete` default to `--type 2` (evaluation); pass `--type 1` for visitor sessions or you get `ConversationNotFound`. After `delete`, `get` answers `ConversationNotFound`; `reset` clears context but keeps history, and is a write: it needs `--yes` (without it the CLI refuses and the next action is the same command with `--yes`). `get` / `messages` / `reset` / `delete` accept `--app-id` (validated and echoed, not sent: these APIs take only the conversation ID). `adp chat` sessions are type 5 (API) and cannot be read back with `conversation messages`; next actions suggest `adp chat` only for type 1 conversations. `adp conversation record get --record-id` takes the question record ID from `conversation messages`, or the reply `recordId` from `adp tail` together with that row's `--conversation-id`. Rows from `adp chat` (API conversations) cannot be resolved that way. `adp app token sse|ws` print a masked token; add `--reveal` only when the caller must hand it to a channel client. `adp usage` is one app's model KPIs for the last 7 days and needs `--app-id` or `adp.jsonc`. It may fail with 450002 (no metric permission); then use `adp app list --fields appId,name,status,updateTime`.
|
|
75
75
|
|
|
76
|
+
## 直接调用平台 MCP 插件
|
|
77
|
+
|
|
78
|
+
平台插件 `pluginKind=2`(例如可灵)的地址是 `https://adp.cloud.tencent.com/plugin/mcp/<pluginId>/mcp`,鉴权是 ADP API Key(工具密钥),不是 CAM,也不是 `adp credential` 里的连接器凭证。先 `adp plugin key create`(默认写入 `~/.adp/tool-key`,权限 0600),再 `adp plugin tool call`。每个账号最多 2 把,超出报 `ToolKeyLimitReached`(`4509400`);明文无法从列表取回,先 `adp plugin key list` 确认要删的闲置密钥。删除前必须先 `adp plugin key disable --key-id <id>`,再 `adp plugin key delete --key-id <id> --yes`;仍启用时删除报 `ToolKeyNotDisabled`(`4509404`)。`--dry-run` 没有本地密钥时也只返回预览(`hasKey: false`),不发请求。不要把密钥写进命令参数。MCP 调用与 Coding Agent 接入见 [../references/mcp.md](../references/mcp.md),工具密钥与凭证管理见 [../references/credentials.md](../references/credentials.md)。
|
|
79
|
+
|
|
76
80
|
## 工作流边界
|
|
77
81
|
|
|
78
|
-
`adp workflow` 已支持 list/get/deploy/enable/disable/export/import/remove/run
|
|
82
|
+
`adp workflow` 已支持 list/get/deploy/enable/disable/export/import/remove/run,与其他命令共用当前 profile 的密钥。公有云发到 `lke.tencentcloudapi.com`,独立站或自定义站点发到该 profile 的 ADP 主机。
|
|
79
83
|
`workflow import` 遇到目标应用里有同名工作流会报 `WorkflowImportDuplicate`,缺变量报 `WorkflowImportMissingVariables`;启用后要发布应用才在生产生效。
|
|
80
84
|
|
|
81
85
|
## 应用包导入导出
|
|
@@ -25,6 +25,7 @@ Integer enum on `CreateApp` / `adp.jsonc` `app_mode`:
|
|
|
25
25
|
- `adp.jsonc` `agent.skill_ids` is meaningful for Claw (`4`). For mode `2`, leave it empty; the platform rejects skill mounts.
|
|
26
26
|
- `agent.tools` is `{ plugin_id, tool_id }` (optional `tool_source`: 0 plugin / 1 workflow). `agent.plugin_ids` / `agent.plugins` enable plugins; `agent.connector_ids` are connectors (same `PluginList` on the wire). Do not stuff connector ids into `plugin_ids`.
|
|
27
27
|
- Greeting, memory, web search, shared KBs, and Claw team prompt live on the **app**, not the agent: `greeting`, `memory`, `web_search`, `shared_kb_ids`, `mode.claw`.
|
|
28
|
+
- **Claw sub-agents.** `app_mode` 4 has 1 main agent (`AgentProfile.Role=0`, stored as `adp.jsonc` `agent` / `agent_id`) and up to 19 sub-agents (`Role=1`). `CreateAgent` with `Role=0` is idempotent and returns the existing main agent (`AgentAlreadyExists` from the CLI). Add a sub-agent with `adp agent create --role 1` (`--description` is when the main agent should delegate). `ParentAgentId` is read-only on list/get. `mode.claw.team_enabled` and `mode.claw.team_prompt` turn on optional team collaboration; the default is one-way delegation from the main agent. Details: [../create/SKILL.md](../create/SKILL.md).
|
|
28
29
|
- Default-KB documents: `adp kb doc import --file …` (KB id defaults to `app_id`). Create shared KBs with `adp kb create`; bind them with `shared_kb_ids`.
|
|
29
30
|
- **`shared_kb_ids` is full-overwrite.** Omitting the key leaves bindings untouched;
|
|
30
31
|
`[]` unbinds everything; a list replaces the whole set. Always read `adp app get`
|
|
@@ -32,5 +33,5 @@ Integer enum on `CreateApp` / `adp.jsonc` `app_mode`:
|
|
|
32
33
|
prefix. Details: [pitfalls.md](pitfalls.md).
|
|
33
34
|
- Sub-agents are not Tools. Never put a child `agent_id` into a plugin/tool list.
|
|
34
35
|
- Binding an existing canvas workflow: `mode.single_workflow.workflow_id`. `adp workflow`
|
|
35
|
-
(
|
|
36
|
+
(same profile keys on the public cloud and the independent site) can also list, get, deploy, enable, disable, export, import, remove, and async-run (`workflow run`, mode 3 with an entry workflow)
|
|
36
37
|
canvases; `adp app export` / `adp app import` move a released app as a package. The default export includes workflows, connectors, knowledge bases, agents, and skills (`--include` / `--exclude` / `--no-kb` narrow it; a selected workflow keeps the connectors and knowledge bases it references). A mode 3 copy whose package has no workflow files still needs its entry workflow exported, imported, and bound — see [../create/SKILL.md](../create/SKILL.md) §Workflows.
|
|
@@ -53,8 +53,8 @@ adp auth status --format json
|
|
|
53
53
|
|
|
54
54
|
## 只有一套凭据
|
|
55
55
|
|
|
56
|
-
所有命令(含 `adp workflow`、`adp kb doc`)都共用同一套
|
|
57
|
-
`adp workflow` 和 `adp kb doc import`
|
|
58
|
-
鉴权失败时先看 `auth status` 的 `source
|
|
56
|
+
所有命令(含 `adp workflow`、`adp kb doc`)都共用同一套 SecretId/SecretKey,公有云和独立站走同一套命令。
|
|
57
|
+
`adp workflow` 和 `adp kb doc import` 里尚未迁到 ADP 的步骤调用 LKE 2023-11-30:公有云发到 `lke.tencentcloudapi.com`,独立站或自定义站点发到该 profile 的 ADP 主机。
|
|
58
|
+
鉴权失败时先看 `auth status` 的 `source` 和站点。公有云再确认 CAM 策略含 ADP 与 LKE 权限;独立站确认密钥来自独立站密钥管理,而不是 CAM。
|
|
59
59
|
不要反复登录,不要换应用绕过权限。
|
|
60
60
|
`adp env list --format json` 只列环境变量名称和敏感标记,不返回值。
|
|
@@ -1,14 +1,50 @@
|
|
|
1
|
-
#
|
|
1
|
+
# 密钥与凭证
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
本章节管理两类不同用途的凭据,切勿混用:
|
|
4
|
+
|
|
5
|
+
1. **工具密钥(ADP API Key:`adp plugin key`)**:账号级 Bearer 密钥(对应控制台「工具密钥」),用于直接调用平台托管的 MCP 插件网关(`https://adp.cloud.tencent.com/plugin/mcp/<pluginId>/mcp`)。
|
|
6
|
+
2. **连接器与插件出站凭证(`adp credential`)**:空间级凭证(`--space-id` 或 `adp.jsonc`),供插件/连接器在执行时访问第三方外部服务(如外部 API Key、OAuth 2.0)。
|
|
7
|
+
|
|
8
|
+
> **相关索引**:如何使用工具密钥直接调用平台 MCP 插件(如可灵视频生成)、查看实时 MCP 工具列表,或将导出的 MCP 插件通过 CLI + Skill 无缝接入各个 Coding Agent,详见 [mcp.md](mcp.md)。
|
|
9
|
+
|
|
10
|
+
---
|
|
4
11
|
|
|
5
12
|
## 安全规则
|
|
6
13
|
|
|
7
|
-
-
|
|
8
|
-
-
|
|
9
|
-
-
|
|
14
|
+
- 秘密值默认不落日志、不进命令行参数:不要把明文密钥写进命令参数、代码仓库、配置文件(如 `mcp.json` / `SKILL.md`)、日志或对话回复。
|
|
15
|
+
- 连接器凭证(`adp credential`)只写不读:`list`/`get` 不返回 token;创建或更新时仅通过 `--token-env <变量名>` 或交互式隐藏输入传入。
|
|
16
|
+
- 工具密钥(`adp plugin key`)仅在 `create` 瞬间由云端返回一次明文,CLI 默认直接写入本机 `~/.adp/tool-key`(权限 `0600`),终端输出默认打码;`list` 接口只返回脱敏值(如 `lf***C9lG`),无法从服务端再次取回明文。
|
|
17
|
+
|
|
18
|
+
---
|
|
10
19
|
|
|
11
|
-
##
|
|
20
|
+
## 工具密钥(ADP API Key)
|
|
21
|
+
|
|
22
|
+
用于鉴权直连平台 MCP 插件网关(调用方式见 [mcp.md](mcp.md#2-直接调用-mcp-插件如可灵))。底层调用 LKE `CreateApiKey`、`DescribeApiKeyList`、`ModifyApiKey`、`ModifyApiKeyStatus`、`DeleteApiKey`。
|
|
23
|
+
|
|
24
|
+
```bash
|
|
25
|
+
adp plugin key list --format json # 列出当前账号的工具密钥(脱敏值、status、lastAccessTime)
|
|
26
|
+
adp plugin key create --description "kling" --format json # 创建并默认写入 ~/.adp/tool-key (0600),输出脱敏
|
|
27
|
+
adp plugin key update --key-id <id> --description "new note" --format json
|
|
28
|
+
adp plugin key disable --key-id <id> --format json # 禁用密钥(status 变为 2;删除前必须先禁用)
|
|
29
|
+
adp plugin key enable --key-id <id> --format json # 重新启用密钥(status 变为 1)
|
|
30
|
+
adp plugin key delete --key-id <id> --yes --format json # 删除已禁用的密钥(若与 ~/.adp/tool-key 相同则同步清理本地文件)
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
- **明文保存与显示**:`adp plugin key create` 默认将明文保存到 `~/.adp/tool-key`(权限 `0600`),不在终端回显完整密钥。仅当用户明确需要在终端查看明文时才加 `--reveal`。若传 `--no-save` 则必须同时加 `--reveal`,否则 CLI 拒绝执行,防止密钥创建后丢失。
|
|
34
|
+
- **密钥读取优先级**:当执行 `adp plugin tool call` 或 `adp plugin tool list`(见 [mcp.md](mcp.md))时,按 `--api-key-env <变量名>` → 环境变量 `ADP_API_KEY` → `~/.adp/tool-key` 顺序读取。
|
|
35
|
+
- **数量上限与清理流程(`4509400` / `ToolKeyLimitReached`)**:
|
|
36
|
+
- 平台每个账号最多允许同时存在 **2 把**工具密钥。超出时 `adp plugin key create`(以及真实执行的 `--auto-create-key`)报冲突错误 `ToolKeyLimitReached`(云端 `FailedOperation: 4509400-创建的密钥已达到上限`,退出码 `5`)。
|
|
37
|
+
- 由于已有密钥的明文无法从服务端取回,若本机没有 `~/.adp/tool-key` 且未设置 `ADP_API_KEY`:
|
|
38
|
+
1. 先运行 `adp plugin key list --format json` 查看现有密钥(`lastAccessTime` 为 `"0"` 表示从未使用过的闲置密钥)。
|
|
39
|
+
2. 向用户确认要清理哪一把后,**必须先禁用再删除**:先执行 `adp plugin key disable --key-id <id> --format json`,再执行 `adp plugin key delete --key-id <id> --yes --format json`。
|
|
40
|
+
3. 未禁用直接删除会报冲突错误 `ToolKeyNotDisabled`(云端 `4509404-密钥未处于禁用状态,请先禁用后再删除`,退出码 `5`)。
|
|
41
|
+
4. 删除腾出额度后,再执行 `adp plugin key create --format json`。若用户手头已有明文密钥,直接将其设置到环境变量 `ADP_API_KEY` 即可,无需删旧建新。
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
## 连接器与插件出站凭证(`adp credential`)
|
|
46
|
+
|
|
47
|
+
按空间可见,供插件/连接器调用第三方外部服务时使用。只有创建者能 `get` 详情;别人的凭证报 `CredentialNotFound` 不代表不存在,不要据此删除或重建。
|
|
12
48
|
|
|
13
49
|
```bash
|
|
14
50
|
adp credential list --space-id <id> --fields credentialId,name,typeLabel,consumer --format json
|
|
@@ -26,10 +62,12 @@ adp credential access --space-id <id> --credential-id <id> --referrer-type app_a
|
|
|
26
62
|
- `delete` 前 CLI 会查引用,被引用时报 `CredentialInUse` 且不删除。先用 `references` 告诉用户哪些应用/工作台在用,由用户决定替换方案;删除需要用户明确同意才加 `--yes`。
|
|
27
63
|
- `adp plugin oauth-url --plugin-id <id> --credential-id <id>` 为已有 OAuth 凭证生成授权链接,同样交给用户本人打开;`adp plugin auth check --plugin-id <id> --credential-id <id>` 查是否已授权(部分账号报 450002 无权限)。非 OAuth 2.0 插件报 `PluginNotOAuth`。
|
|
28
64
|
|
|
29
|
-
|
|
65
|
+
---
|
|
66
|
+
|
|
67
|
+
## 插件工具详情与跨空间共享
|
|
30
68
|
|
|
31
69
|
```bash
|
|
32
|
-
adp plugin tool get --plugin-id <id> --tool-id <id> --format json # 工具入参/出参,tool-id 见 adp plugin get
|
|
70
|
+
adp plugin tool get --plugin-id <id> --tool-id <id> --format json # 工具入参/出参,tool-id 见 adp plugin get(直接调用 MCP 工具见 mcp.md)
|
|
33
71
|
adp plugin share get --plugin-id <id> [--pending] --format json # scope: none | all | spaces;--pending 没有待审批配置时返回 hasPending:false
|
|
34
72
|
adp plugin share set --plugin-id <id> --scope spaces --space <sp> --yes --format json
|
|
35
73
|
adp plugin share set --plugin-id <id> --credential <cid>=all --yes # 只改某个凭证的共享范围
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
# MCP 插件调用与接入
|
|
2
|
+
|
|
3
|
+
平台上 `pluginKind = 2` 的插件(例如「可灵视频生成」)通过统一的 Streamable HTTP MCP 网关对外提供工具列表与直接调用能力。
|
|
4
|
+
|
|
5
|
+
> **相关索引**:MCP 网关鉴权使用的是 **ADP API Key(工具密钥,`adp plugin key`)**,而非 CAM `SecretId`/`SecretKey` 或连接器出站凭证。工具密钥的创建、查看、启停、删除与 2 把配额上限处理,详见 [credentials.md](credentials.md#工具密钥adp-api-key);插件调用第三方服务所需的出站凭证与 OAuth 授权,见 [credentials.md](credentials.md#连接器与插件出站凭证adp-credential)。
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## 1. 平台 MCP 网关地址与协议
|
|
10
|
+
|
|
11
|
+
- **固定地址格式**:`https://adp.cloud.tencent.com/plugin/mcp/<pluginId>/mcp`
|
|
12
|
+
- **传输协议**:MCP JSON-RPC 2.0(Streamable HTTP),依次执行 `initialize`、`notifications/initialized`,再执行 `tools/list` 或 `tools/call`。
|
|
13
|
+
- **鉴权方式**:请求头 `Authorization: Bearer <ADP API Key>`。CLI 仅向该网关白名单前缀发送 Bearer Token,且拒绝重定向。
|
|
14
|
+
- **密钥读取顺序**:`--api-key-env <变量名>` → 环境变量 `ADP_API_KEY` → 本地文件 `~/.adp/tool-key`(由 `adp plugin key create` 默认以 `0600` 权限写入,见 [credentials.md](credentials.md#工具密钥adp-api-key))。若显式传了 `--api-key-env` 但对应变量为空,CLI 会直接报错而不会回退到其他密钥。
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 2. 直接调用 MCP 插件(如可灵)
|
|
19
|
+
|
|
20
|
+
1. **查找 MCP 插件 ID**:先用 `adp space list --format json` 获取空间 ID,再执行 `adp plugin list --space-id <id> --query "可灵" --format json`,确认目标插件的 `pluginKind` 为 `2`(例如可灵视频生成插件 ID 形如 `651c15de-2756-40f5-9c91-442a48767065`,以实际查询结果为准,不要凭记忆硬编码)。
|
|
21
|
+
2. **查看工具与入参 Schema**:
|
|
22
|
+
- 从平台目录读取:`adp plugin get --space-id <id> --plugin-id <id> --format json` 查看 `tools[]` 的 `toolId` 与 `name`,再用 `adp plugin tool get --plugin-id <id> --tool-id <toolId> --format json` 查看单个工具的入参/出参定义。
|
|
23
|
+
- 从 MCP 网关实时读取:`adp plugin tool list --plugin-id <id> --format json` 直接向 MCP Server 发送 `tools/list`,返回所有实时工具的 `name`、`description` 与 `inputSchema`。
|
|
24
|
+
3. **准备工具密钥**:若本机尚无 `~/.adp/tool-key` 且未设置 `ADP_API_KEY`,先运行 `adp plugin key create --format json` 生成并保存工具密钥(或在调用时加 `--auto-create-key`)。如遇密钥数量上限(`ToolKeyLimitReached` / `4509400`),按 [credentials.md](credentials.md#工具密钥adp-api-key) 先禁用并删除闲置密钥后再创建。
|
|
25
|
+
4. **发起工具调用**:
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
# 按工具名直接调用(无需额外请求 Cloud API 反查名称)
|
|
29
|
+
adp plugin tool call --plugin-id <id> --tool-name SubmitKlingTextToVideoJob --input '<json>' --format json
|
|
30
|
+
|
|
31
|
+
# 按工具 ID 调用(CLI 自动通过 DescribeTool 反查工具名后再调 MCP)
|
|
32
|
+
adp plugin tool call --plugin-id <id> --tool-id <toolId> --input '<json>' --dry-run --format json
|
|
33
|
+
|
|
34
|
+
# 实时列出 MCP 服务端工具及 JSON Schema
|
|
35
|
+
adp plugin tool list --plugin-id <id> --format json
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
### 调用参数与注意事项
|
|
39
|
+
|
|
40
|
+
- `--tool-name` 与 `--tool-id` 二选一即可;同时传入但名称不一致时报 `UsageError`。
|
|
41
|
+
- `--input`(别名 `--args`)接收 JSON 对象字符串,默认为 `{}`。
|
|
42
|
+
- `--dry-run`:仅预览将要请求的 MCP URL、工具名与解析后的参数,不发送 HTTP 请求。即使本机尚未配置工具密钥且未传 `--auto-create-key`,`--dry-run` 仍会成功返回预览(`hasKey: false`),并提示在真实调用前执行 `adp plugin key create` 或加 `--auto-create-key`。
|
|
43
|
+
- `--auto-create-key`:当本机没有可用工具密钥时,自动创建一把写入 `~/.adp/tool-key` 并完成调用,全程不在输出中打印明文;与 `--dry-run` 同用时仅标记 `wouldCreateKey: true`,不会真正创建密钥。
|
|
44
|
+
- `--timeout-ms`:默认 `60000`(60 秒),提交视频生成等耗时任务时可适当调大(上限 `600000`)。
|
|
45
|
+
- **异步任务两步走**:视频生成等长耗时工具通常拆分为 `Submit*`(如 `SubmitKlingTextToVideoJob`)与 `Query*`(如 `QueryKlingTextToVideoJob`)。先调 `Submit*` 从返回结果中取出任务 ID(如 `data.id`),再将其作为 `{"task_id": "<id>"}` 传给对应的 `Query*` 工具轮询状态。
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## 3. 将导出的 MCP 插件无缝装入任意 Coding Agent(CLI + Skill 方式)
|
|
50
|
+
|
|
51
|
+
无需在各个 Coding Agent 的 `mcp.json` 中硬编码明文 Bearer Token,通过 `adp` CLI + Skill 即可在 `claude`、`cursor`、`codex`、`agents`、`codebuddy`、`workbuddy` 中安全、无缝地调用任何 ADP MCP 插件:
|
|
52
|
+
|
|
53
|
+
1. **方式一:安装通用 `adp` 伴生 Skill(推荐,一次安装即可按需调用全部 MCP 插件)**
|
|
54
|
+
- 预览安装目录:`adp skills install --dry-run --format json`(支持 `--scope global|project` 与 `--agent cursor,claude,codex,agents,codebuddy,workbuddy`)。
|
|
55
|
+
- 执行安装:`adp skills install --yes --format json`(WorkBuddy 连接器环境已内置,无需执行)。
|
|
56
|
+
- 确保本机已通过 `adp plugin key create --format json` 生成并缓存 `~/.adp/tool-key`(权限 `0600`,详见 [credentials.md](credentials.md#工具密钥adp-api-key))。此后任何安装了该 Skill 的 Coding Agent 均可按本页第 2 节自动发现并调用目标插件。
|
|
57
|
+
2. **方式二:为特定 MCP 插件派生独立专属 Skill(适合高频使用的单一插件,如“可灵”)**
|
|
58
|
+
- 先执行 `adp plugin get --space-id <id> --plugin-id <pluginId> --format json` 与 `adp plugin tool list --plugin-id <pluginId> --format json`,获取该插件全部工具的 `name`、`description` 和 `inputSchema`。
|
|
59
|
+
- 确认本机工具密钥已就绪(`adp plugin tool list` 返回 `hasKey: true`)。
|
|
60
|
+
- 在目标 Coding Agent 的 skills 目录(全局如 `~/.cursor/skills/<skill-name>/SKILL.md`、`~/.claude/skills/<skill-name>/SKILL.md`,或项目级 `.cursor/skills/`、`.claude/skills/` 等)创建专属 `SKILL.md`:
|
|
61
|
+
- Frontmatter 的 `description` 写明该插件的能力与触发词。
|
|
62
|
+
- 正文写明固定的 `--plugin-id <pluginId>`、各工具的 `name` 与入参 JSON Schema,以及标准调用模板:
|
|
63
|
+
`adp plugin tool call --plugin-id <pluginId> --tool-name <ToolName> --input '<json>' --format json`
|
|
64
|
+
- **严禁**将 `ADP_API_KEY` 明文写入 `SKILL.md` 或 `mcp.json`;调用时由 `adp plugin tool call` 自动从 `~/.adp/tool-key` 或环境变量读取(安全规则见 [credentials.md](credentials.md#安全规则))。
|
|
65
|
+
|
|
66
|
+
---
|
|
67
|
+
|
|
68
|
+
## 4. 在空间目录中注册自定义外部 MCP Server
|
|
69
|
+
|
|
70
|
+
若要将外部自建的 MCP Server 注册为 ADP 空间中的插件(供应用内 Agent 绑定使用):
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
adp plugin create --space-id <id> --name <name> --mcp-url https://your-mcp-server.example/mcp --mcp-transport 1 --icon-url https://cdn.xiaowei.qq.com/static/adp/app-default-avatar.png --format json
|
|
74
|
+
adp plugin update --space-id <id> --plugin-id <id> --mcp-url https://your-mcp-server.example/mcp --mcp-transport 1 --format json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
- `--mcp-transport`:`0` 表示 SSE + HTTP,`1` 表示 Streamable HTTP。
|
|
78
|
+
- 平台在创建和更新时会立即连接 `--mcp-url` 校验连通性,因此地址必须是真实可达的线上地址(占位域名会报 `460030`)。
|
|
@@ -3,6 +3,12 @@
|
|
|
3
3
|
Symptom → cause → fix. Each one constrains an API this CLI already calls. Verify the
|
|
4
4
|
platform side with `adp docs search "<action>" --format json` when in doubt.
|
|
5
5
|
|
|
6
|
+
## Windows 启动与本地文件
|
|
7
|
+
|
|
8
|
+
- Windows 连接器使用 `adp.cmd`。若连 `--version` 都抛 `ERR_UNSUPPORTED_ESM_URL_SCHEME`,是旧版入口加载故障,不是账号/网络失败;登录或重复连接无法修复。需更新实际安装副本到含修复的发布版,WorkBuddy 托管前缀可能不同于普通 npm 全局前缀。
|
|
9
|
+
- 本地文件路径按宿主系统解析,中文/空格需作为一个参数传递,`..` 与 UNC/盘符使用原生语义;远端 COS/ZIP 路径仍按远端规则。不要把用户名或路径当作资源 ID。
|
|
10
|
+
- POSIX 私密文件为0600;Windows依赖用户目录ACL,不要声称chmod提供仅本人访问,也不要把凭据写进共享目录或聊天。
|
|
11
|
+
|
|
6
12
|
## Single-workflow `WorkflowId` must be written through the bind path
|
|
7
13
|
|
|
8
14
|
- **Symptom**: the workflow is deployed and enabled, but `adp app get` still shows an
|