@metagptx/deepflow-suite-cli 0.0.0-stage → 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 +48 -2
- package/bin/deepflow-suite.js +77 -0
- package/bundle/deepflow-release.json +185 -0
- package/bundle/skills/deepflow-suite/SKILL.md +79 -0
- package/bundle/skills/deepflow-suite/manifest.yaml +20 -0
- package/bundle/skills/df-agentctrl/SKILL.md +143 -0
- package/bundle/skills/df-agentctrl/assets/agent.json +8 -0
- package/bundle/skills/df-agentctrl/references/maintenance.md +68 -0
- package/bundle/skills/df-agentctrl/scripts/to_snapshot.py +26 -0
- package/bundle/skills/df-agentrt/SKILL.md +191 -0
- package/bundle/skills/df-agentrt-repo/SKILL.md +83 -0
- package/bundle/skills/df-task/SKILL.md +177 -0
- package/bundle/skills/df-task/assets/payload-examples/adjudication.json +5 -0
- package/bundle/skills/df-task/assets/payload-examples/artifact_published.json +6 -0
- package/bundle/skills/df-task/assets/payload-examples/help_requested.json +5 -0
- package/bundle/skills/df-task/assets/payload-examples/run_outcome.json +5 -0
- package/bundle/skills/df-task/assets/payload-examples/run_terminated.json +4 -0
- package/bundle/skills/df-task/assets/payload-examples/summary.json +4 -0
- package/bundle/skills/df-task/references/fact-types.md +48 -0
- package/bundle/skills/df-task/skill_test.go +201 -0
- package/bundle/skills/df-taskdriver/SKILL.md +126 -0
- package/bundle/skills/df-workbench/SKILL.md +64 -0
- package/bundle/skills/df-workbench/manifest.yaml +5 -0
- package/manifest.json +68 -0
- package/package.json +28 -4
- package/scripts/build-package.mjs +12 -0
- package/skills/deepflow-suite/SKILL.md +79 -0
- package/skills/deepflow-suite/manifest.yaml +20 -0
- package/src/bundle-installer.mjs +189 -0
- package/src/bundle.mjs +128 -0
- package/src/cli-install.mjs +140 -0
- package/src/commands/doctor.mjs +35 -0
- package/src/commands/install.mjs +32 -0
- package/src/constants.mjs +30 -0
- package/src/linker.mjs +96 -0
- package/src/manifest.mjs +72 -0
package/README.md
CHANGED
|
@@ -1,3 +1,49 @@
|
|
|
1
|
-
#
|
|
1
|
+
# `@metagptx/deepflow-suite-cli`
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
`deepflow-suite` is the published DeepFlow distribution CLI. It is intentionally
|
|
4
|
+
separate from the legacy `@metagptx/deepflow-cli` package, which owns the
|
|
5
|
+
`deepflow` command.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install -g @metagptx/deepflow-suite-cli
|
|
11
|
+
deepflow-suite --help
|
|
12
|
+
deepflow-suite install --source package
|
|
13
|
+
deepflow-suite doctor --source package --json
|
|
14
|
+
```
|
|
15
|
+
|
|
16
|
+
The package installation mode copies the seven bundled Skills into
|
|
17
|
+
`$CODEX_HOME/skills` (or `~/.codex/skills`). Use `--target` to choose another
|
|
18
|
+
Skill directory and `--force` only when replacing an existing installation is
|
|
19
|
+
intentional.
|
|
20
|
+
|
|
21
|
+
## Workspace development
|
|
22
|
+
|
|
23
|
+
From the DeepFlow workspace, install relative Skill links and build the five
|
|
24
|
+
service CLIs:
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
deepflow-suite install --source workspace --bin-dir "$HOME/.local/bin"
|
|
28
|
+
deepflow-suite doctor --source workspace --json
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
The workspace distribution contains `deepflow-suite`, `df-workbench`,
|
|
32
|
+
`df-task`, `df-taskdriver`, `df-agentctrl`, `df-agentrt`, and `df-agentrt-repo`.
|
|
33
|
+
The three Runtime variant Skills (`df-agentrt-full`, `df-agentrt-git`, and
|
|
34
|
+
`df-agentrt-preview`) remain service-local and are not part of the ordinary
|
|
35
|
+
distribution.
|
|
36
|
+
|
|
37
|
+
## Publishing
|
|
38
|
+
|
|
39
|
+
The package is prepared for public scoped publication like Console CLI:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
npm run test
|
|
43
|
+
npm run pack:dry-run
|
|
44
|
+
npm publish
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
`prepack` materializes the seven Skill bundle and its release manifest. The
|
|
48
|
+
published `deepflow-suite` command never overwrites an existing Skill or CLI
|
|
49
|
+
file without `--force`.
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
import path from "node:path";
|
|
4
|
+
import { fileURLToPath } from "node:url";
|
|
5
|
+
import { readFile } from "node:fs/promises";
|
|
6
|
+
|
|
7
|
+
import { assembleBundle } from "../src/bundle.mjs";
|
|
8
|
+
import { installBundleSkills } from "../src/bundle-installer.mjs";
|
|
9
|
+
import { CLI_NAME, defaultCodexSkillsDir } from "../src/constants.mjs";
|
|
10
|
+
import { doctor } from "../src/commands/doctor.mjs";
|
|
11
|
+
import { install } from "../src/commands/install.mjs";
|
|
12
|
+
|
|
13
|
+
function parseArgs(argv) {
|
|
14
|
+
const [first, ...rest] = argv;
|
|
15
|
+
const command = first?.startsWith("-") ? undefined : first;
|
|
16
|
+
const argumentsToParse = command ? rest : argv;
|
|
17
|
+
const options = { source: "workspace", workspaceRoot: process.cwd() };
|
|
18
|
+
for (let index = 0; index < argumentsToParse.length; index += 1) {
|
|
19
|
+
const argument = argumentsToParse[index];
|
|
20
|
+
if (argument === "--source") options.source = argumentsToParse[++index];
|
|
21
|
+
else if (argument === "--root") options.workspaceRoot = path.resolve(argumentsToParse[++index]);
|
|
22
|
+
else if (argument === "--output") options.outputDir = path.resolve(argumentsToParse[++index]);
|
|
23
|
+
else if (argument === "--bundle") options.bundleDir = path.resolve(argumentsToParse[++index]);
|
|
24
|
+
else if (argument === "--target") options.targetDir = path.resolve(argumentsToParse[++index]);
|
|
25
|
+
else if (argument === "--bin-dir") options.binDir = path.resolve(argumentsToParse[++index]);
|
|
26
|
+
else if (argument === "--force") options.force = true;
|
|
27
|
+
else if (argument === "--skip-cli") options.skipCli = true;
|
|
28
|
+
else if (argument === "--json") options.json = true;
|
|
29
|
+
else if (argument === "--help" || argument === "-h") options.help = true;
|
|
30
|
+
else if (argument === "--version" || argument === "-v") options.version = true;
|
|
31
|
+
else throw new Error(`unknown option: ${argument}`);
|
|
32
|
+
}
|
|
33
|
+
return { command, options };
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
function printHelp() {
|
|
37
|
+
console.log(`${CLI_NAME} — DeepFlow distribution installer\n\nCommands:\n install --source workspace [--root <path>] [--bin-dir <path>] [--skip-cli]\n install --source package [--target <path>] [--force]\n install --source bundle --bundle <path> [--target <path>] [--force]\n doctor [--root <path>] [--bin-dir <path>]\n bundle --root <path> --output <path>\n\nUse ${CLI_NAME} --help for this message.`);
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
function output(value, json) {
|
|
41
|
+
console.log(json ? JSON.stringify(value, null, 2) : JSON.stringify(value));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
const { command, options } = parseArgs(process.argv.slice(2));
|
|
45
|
+
const packageRoot = path.resolve(path.dirname(fileURLToPath(import.meta.url)), "..");
|
|
46
|
+
const manifestPath = path.join(packageRoot, "manifest.json");
|
|
47
|
+
|
|
48
|
+
if (options.version) {
|
|
49
|
+
const packageJson = JSON.parse(await readFile(path.join(packageRoot, "package.json"), "utf8"));
|
|
50
|
+
console.log(packageJson.version);
|
|
51
|
+
process.exit(0);
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
if (!command || options.help) {
|
|
55
|
+
printHelp();
|
|
56
|
+
process.exit(0);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
try {
|
|
60
|
+
const result = command === "install" && options.source === "bundle"
|
|
61
|
+
? await installBundleSkills({
|
|
62
|
+
...options,
|
|
63
|
+
targetDir: options.targetDir ?? defaultCodexSkillsDir(),
|
|
64
|
+
})
|
|
65
|
+
: command === "install"
|
|
66
|
+
? await install({ ...options, manifestPath })
|
|
67
|
+
: command === "doctor"
|
|
68
|
+
? await doctor({ ...options, manifestPath })
|
|
69
|
+
: command === "bundle"
|
|
70
|
+
? await assembleBundle({ ...options, manifestPath })
|
|
71
|
+
: (() => { throw new Error(`unknown command: ${command}`); })();
|
|
72
|
+
output(result, options.json);
|
|
73
|
+
if (command === "doctor" && !result.ok) process.exitCode = 1;
|
|
74
|
+
} catch (error) {
|
|
75
|
+
console.error(error.message);
|
|
76
|
+
process.exitCode = 1;
|
|
77
|
+
}
|
|
@@ -0,0 +1,185 @@
|
|
|
1
|
+
{
|
|
2
|
+
"schemaVersion": 1,
|
|
3
|
+
"distribution": "deepflow-suite",
|
|
4
|
+
"package": "@metagptx/deepflow-suite-cli",
|
|
5
|
+
"version": "0.1.1",
|
|
6
|
+
"platform": "darwin",
|
|
7
|
+
"arch": "arm64",
|
|
8
|
+
"cli": {
|
|
9
|
+
"name": "deepflow-suite",
|
|
10
|
+
"package": "@metagptx/deepflow-suite-cli",
|
|
11
|
+
"version": "0.1.1",
|
|
12
|
+
"command": "deepflow-suite"
|
|
13
|
+
},
|
|
14
|
+
"skills": [
|
|
15
|
+
{
|
|
16
|
+
"name": "deepflow-suite",
|
|
17
|
+
"source": "tools/deepflow-cli/skills/deepflow-suite",
|
|
18
|
+
"files": [
|
|
19
|
+
{
|
|
20
|
+
"path": "manifest.yaml",
|
|
21
|
+
"size": 362,
|
|
22
|
+
"sha256": "35e52b807171fa954b465853732740faaa37ab2f4a798f5e10f6f3dc101ae167"
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
"path": "SKILL.md",
|
|
26
|
+
"size": 3054,
|
|
27
|
+
"sha256": "39fd13809264aa2fa83b535c604c3a83511748f51be6a8b2fb52be3682f31481"
|
|
28
|
+
}
|
|
29
|
+
]
|
|
30
|
+
},
|
|
31
|
+
{
|
|
32
|
+
"name": "df-workbench",
|
|
33
|
+
"source": "deepflow-workbench/skills/df-workbench",
|
|
34
|
+
"files": [
|
|
35
|
+
{
|
|
36
|
+
"path": "manifest.yaml",
|
|
37
|
+
"size": 84,
|
|
38
|
+
"sha256": "e7e7697d875a49b5d3d4dd4d38fb8479d8a1fb175ab65ab6a2c79addbb171457"
|
|
39
|
+
},
|
|
40
|
+
{
|
|
41
|
+
"path": "SKILL.md",
|
|
42
|
+
"size": 2758,
|
|
43
|
+
"sha256": "c86ee01f8b130669f87efc223ffdeff96841a89037c39738eaf8730bdd58091b"
|
|
44
|
+
}
|
|
45
|
+
]
|
|
46
|
+
},
|
|
47
|
+
{
|
|
48
|
+
"name": "df-task",
|
|
49
|
+
"source": "deepflow-task/skills/df-task",
|
|
50
|
+
"files": [
|
|
51
|
+
{
|
|
52
|
+
"path": "assets/payload-examples/adjudication.json",
|
|
53
|
+
"size": 142,
|
|
54
|
+
"sha256": "fec652168ca886b43ac2ba635343c0d98d316f40cb1f5e4c9d1d8582cebe141f"
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
"path": "assets/payload-examples/artifact_published.json",
|
|
58
|
+
"size": 159,
|
|
59
|
+
"sha256": "1e766567855af8a89f424c9248b0dada83ca0773a9d4006f7b44a7771a153cd5"
|
|
60
|
+
},
|
|
61
|
+
{
|
|
62
|
+
"path": "assets/payload-examples/help_requested.json",
|
|
63
|
+
"size": 164,
|
|
64
|
+
"sha256": "cd4e79ae2e4698d7e46ceadb006e0518139ed85e768cd160ea75d64cb0fc53f0"
|
|
65
|
+
},
|
|
66
|
+
{
|
|
67
|
+
"path": "assets/payload-examples/run_outcome.json",
|
|
68
|
+
"size": 167,
|
|
69
|
+
"sha256": "43c4de8531d455af3bc908e70b287218f0bc464417f29f5213da2477c2485086"
|
|
70
|
+
},
|
|
71
|
+
{
|
|
72
|
+
"path": "assets/payload-examples/run_terminated.json",
|
|
73
|
+
"size": 88,
|
|
74
|
+
"sha256": "df880d0c9dcce614af6869d684c038592720246b45484d4274572d59ff842a99"
|
|
75
|
+
},
|
|
76
|
+
{
|
|
77
|
+
"path": "assets/payload-examples/summary.json",
|
|
78
|
+
"size": 198,
|
|
79
|
+
"sha256": "c8954184c2b3454a7b11d1089555374068ac44fb50d4f476ddf498d188ab988c"
|
|
80
|
+
},
|
|
81
|
+
{
|
|
82
|
+
"path": "references/fact-types.md",
|
|
83
|
+
"size": 3353,
|
|
84
|
+
"sha256": "37c13c13822734744d9f4a73710e1206009eeb037102620ccdb77af78e1dcb39"
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
"path": "skill_test.go",
|
|
88
|
+
"size": 9132,
|
|
89
|
+
"sha256": "fc4f7b01d9641e74d26093f552be28c16b99f132ef77cc9f79a48efbca85a3c3"
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
"path": "SKILL.md",
|
|
93
|
+
"size": 12155,
|
|
94
|
+
"sha256": "aec1bb832519f6503b9e17cbe34bf4ff39bac451f57912d5cd42de1a3e2e77e2"
|
|
95
|
+
}
|
|
96
|
+
]
|
|
97
|
+
},
|
|
98
|
+
{
|
|
99
|
+
"name": "df-taskdriver",
|
|
100
|
+
"source": "deepflow-task-driver/skills/df-taskdriver",
|
|
101
|
+
"files": [
|
|
102
|
+
{
|
|
103
|
+
"path": "SKILL.md",
|
|
104
|
+
"size": 13110,
|
|
105
|
+
"sha256": "8e547dca84792272cdfbad841a162dce6f98d6e13e440f6db60763a559d4d823"
|
|
106
|
+
}
|
|
107
|
+
]
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
"name": "df-agentctrl",
|
|
111
|
+
"source": "deepflow-agent-ctrl/skills/df-agentctrl",
|
|
112
|
+
"files": [
|
|
113
|
+
{
|
|
114
|
+
"path": "assets/agent.json",
|
|
115
|
+
"size": 251,
|
|
116
|
+
"sha256": "6c2ab44fe6dc9ea7aa769965d92c71d7367d785a04fd4579e1629452dc4a68ef"
|
|
117
|
+
},
|
|
118
|
+
{
|
|
119
|
+
"path": "references/maintenance.md",
|
|
120
|
+
"size": 3388,
|
|
121
|
+
"sha256": "ba0bfb12eba04bb6be090b43180a3dc672584e9ec63142fd3671755b57e27375"
|
|
122
|
+
},
|
|
123
|
+
{
|
|
124
|
+
"path": "scripts/to_snapshot.py",
|
|
125
|
+
"size": 833,
|
|
126
|
+
"sha256": "d532da019f9e2112e86b5f68ac6f8ad4b3351d806b924750ac1299dce76c6988"
|
|
127
|
+
},
|
|
128
|
+
{
|
|
129
|
+
"path": "SKILL.md",
|
|
130
|
+
"size": 8078,
|
|
131
|
+
"sha256": "72f692d4daed01c78a360bc7cd4e541a66d1f23e7b3b43df4836c02eae9d5efd"
|
|
132
|
+
}
|
|
133
|
+
]
|
|
134
|
+
},
|
|
135
|
+
{
|
|
136
|
+
"name": "df-agentrt",
|
|
137
|
+
"source": "deepflow-agent-runtime/skills/df-agentrt",
|
|
138
|
+
"files": [
|
|
139
|
+
{
|
|
140
|
+
"path": "SKILL.md",
|
|
141
|
+
"size": 10079,
|
|
142
|
+
"sha256": "f1d8abb45c3bd7010b01a89393a16c143ed5718b092af9804f2fd849a2274f68"
|
|
143
|
+
}
|
|
144
|
+
]
|
|
145
|
+
},
|
|
146
|
+
{
|
|
147
|
+
"name": "df-agentrt-repo",
|
|
148
|
+
"source": "deepflow-agent-runtime/skills/df-agentrt-repo",
|
|
149
|
+
"files": [
|
|
150
|
+
{
|
|
151
|
+
"path": "SKILL.md",
|
|
152
|
+
"size": 3198,
|
|
153
|
+
"sha256": "1f2e9b3c3631eefc8d0bbf1a3727a0aaf64ea31647da26f22dc025ba0aae996d"
|
|
154
|
+
}
|
|
155
|
+
]
|
|
156
|
+
}
|
|
157
|
+
],
|
|
158
|
+
"clis": [
|
|
159
|
+
{
|
|
160
|
+
"name": "df-workbench",
|
|
161
|
+
"project": "deepflow-workbench",
|
|
162
|
+
"install": "project"
|
|
163
|
+
},
|
|
164
|
+
{
|
|
165
|
+
"name": "df-task",
|
|
166
|
+
"project": "deepflow-task",
|
|
167
|
+
"install": "make install-cli"
|
|
168
|
+
},
|
|
169
|
+
{
|
|
170
|
+
"name": "df-taskdriver",
|
|
171
|
+
"project": "deepflow-task-driver",
|
|
172
|
+
"install": "make install-cli"
|
|
173
|
+
},
|
|
174
|
+
{
|
|
175
|
+
"name": "df-agentctrl",
|
|
176
|
+
"project": "deepflow-agent-ctrl",
|
|
177
|
+
"install": "make install-cli"
|
|
178
|
+
},
|
|
179
|
+
{
|
|
180
|
+
"name": "df-agentrt",
|
|
181
|
+
"project": "deepflow-agent-runtime",
|
|
182
|
+
"install": "make build"
|
|
183
|
+
}
|
|
184
|
+
]
|
|
185
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: deepflow-suite
|
|
3
|
+
description: DeepFlow 统一入口。常规任务默认使用 df-workbench;只有用户明确要求或 Workbench 事实无法解释阻塞时,才按顺序检查 Task、Task Driver、Agent Control 和 Agent Runtime。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DeepFlow Suite
|
|
7
|
+
|
|
8
|
+
这是 DeepFlow 的统一用户和开发者入口。它开放完整的 DeepFlow 能力,但不默认调用整条链路:普通任务先走 `df-workbench`,只有确实需要解释推进、Agent 或 Runtime 问题时才升级到其他项目 CLI。
|
|
9
|
+
|
|
10
|
+
## 依赖
|
|
11
|
+
|
|
12
|
+
本 Skill 依赖以下项目级 Skill 和 CLI:
|
|
13
|
+
|
|
14
|
+
- `df-workbench`:用户身份、工作区、Workbench 配置和任务事实;
|
|
15
|
+
- `df-task`:Task 原始事实和事实落库核对;
|
|
16
|
+
- `df-taskdriver`:任务推进和唤起兑现诊断;
|
|
17
|
+
- `df-agentctrl`:Agent 定义、版本和可分配目录;
|
|
18
|
+
- `df-agentrt`:Session、Invocation、transcript 和运行现场。
|
|
19
|
+
- `df-agentrt-repo`:在 Runtime 会话中发现和追加代码仓库。
|
|
20
|
+
|
|
21
|
+
这些依赖由 `deepflow-suite` 安装器统一安装。不要因为某个依赖缺失就自行复制 Skill、克隆仓库或切换安装源。
|
|
22
|
+
|
|
23
|
+
## 环境门禁
|
|
24
|
+
|
|
25
|
+
用户没有明确说 `local`、本地、`dev`、开发环境或 `prod`、生产环境时,先询问:
|
|
26
|
+
|
|
27
|
+
```text
|
|
28
|
+
请指定目标环境:local(本地)、dev(开发环境)还是 prod(生产环境)?
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
环境一旦选定,本轮所有 Workbench、Task、Driver、Agent Control 和 Runtime 请求保持在同一环境。连接失败不能静默切换环境。
|
|
32
|
+
|
|
33
|
+
## 默认路由
|
|
34
|
+
|
|
35
|
+
### 普通任务
|
|
36
|
+
|
|
37
|
+
创建任务、继续对话、查看任务和读取可见进度,只调用 `df-workbench`:
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
df-workbench me --json
|
|
41
|
+
df-workbench config --json
|
|
42
|
+
df-workbench task create --message '<用户原始请求>' --json
|
|
43
|
+
df-workbench task send <task-id> --message '<补充内容>' --json
|
|
44
|
+
df-workbench task get <task-id> --json
|
|
45
|
+
df-workbench task facts <task-id> --json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
不要在普通用户入口直接调用 `df-task` 写接口,不要伪造 `DF_TASK_ACTOR_*`,不要自行创建 Run 或选择执行 Agent。
|
|
49
|
+
|
|
50
|
+
### 深度排障
|
|
51
|
+
|
|
52
|
+
用户询问“任务为什么卡住”“为什么没有执行”“查看 Session/Invocation”“检查 Driver/Agent/Runtime”时,按以下顺序只读检查:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
df-workbench
|
|
56
|
+
→ df-task
|
|
57
|
+
→ df-taskdriver
|
|
58
|
+
→ df-agentctrl
|
|
59
|
+
→ df-agentrt
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
前一步事实不足以解释问题时,才进入下一步。不要把某个服务可达描述成整条链路成功,也不要把未知状态描述成完成或失败。
|
|
63
|
+
|
|
64
|
+
## 写操作安全
|
|
65
|
+
|
|
66
|
+
- 普通排障优先只读;
|
|
67
|
+
- 取消、释放 Session、修复孤儿执行、启停或回退 Agent 前必须获得明确确认;
|
|
68
|
+
- 不直接修改 Task 事实;
|
|
69
|
+
- 不因诊断失败而重建 Session、Invocation 或切换环境;
|
|
70
|
+
- 所有服务请求保持在用户选定的环境。
|
|
71
|
+
|
|
72
|
+
## 输出边界
|
|
73
|
+
|
|
74
|
+
回复时区分:
|
|
75
|
+
|
|
76
|
+
1. 已由事实确认的结果;
|
|
77
|
+
2. Driver、Agent Control 或 Runtime 返回的诊断;
|
|
78
|
+
3. 仍无法确认的未知状态;
|
|
79
|
+
4. 需要用户或服务维护者采取的下一步。
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
id: deepflow-suite
|
|
2
|
+
version: 0.1.1
|
|
3
|
+
kind: composite-skill
|
|
4
|
+
requires:
|
|
5
|
+
skills:
|
|
6
|
+
- df-workbench
|
|
7
|
+
- df-task
|
|
8
|
+
- df-taskdriver
|
|
9
|
+
- df-agentctrl
|
|
10
|
+
- df-agentrt
|
|
11
|
+
- df-agentrt-repo
|
|
12
|
+
cli:
|
|
13
|
+
- df-workbench
|
|
14
|
+
- df-task
|
|
15
|
+
- df-taskdriver
|
|
16
|
+
- df-agentctrl
|
|
17
|
+
- df-agentrt
|
|
18
|
+
resolution:
|
|
19
|
+
managed_by: deepflow-suite
|
|
20
|
+
install_missing_dependencies: false
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: df-agentctrl
|
|
3
|
+
description: 使用df-agentctrl CLI查询DeepFlow Agent控制面的可用智能体目录、读取指定版本定义,或按用户要求创建和维护Agent、比较版本、启停和回退。适用于调度前发现Agent以及管理员维护Agent定义,不负责runtime执行或任务编排。
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# DeepFlow Agent Control
|
|
7
|
+
|
|
8
|
+
通过`df-agentctrl`操作Agent定义和版本。运行命令前确认CLI已在PATH中;服务地址由`DF_AGENTCTRL_BASE_URL`或`--base-url`提供,默认`http://127.0.0.1:8080`。本Skill不安装二进制,也不自动启动服务。
|
|
9
|
+
|
|
10
|
+
## 目标环境门禁与地址
|
|
11
|
+
|
|
12
|
+
每次调用控制面前,必须先确认用户要操作的目标环境。在推进器拉起的 Run 里按下文「Run 内的目标环境」确定,不询问。其他情况下,用户没有明确说 `local`、本地、`dev`、开发环境或 `prod`、生产环境时,先询问:
|
|
13
|
+
|
|
14
|
+
```text
|
|
15
|
+
请指定目标环境:local(本地)、dev(开发环境)还是 prod(生产环境)?
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
环境一旦选定,本轮所有服务调用都必须保持在同一环境;不能因为连接失败就切换到另一环境,也不能把当前机器所在位置当成目标环境。
|
|
19
|
+
|
|
20
|
+
| 目标环境 | 本地执行时的地址 | 在 dev-k8s 内执行时的地址 |
|
|
21
|
+
| --- | --- | --- |
|
|
22
|
+
| `local` | `http://127.0.0.1:8080` | 不适用 |
|
|
23
|
+
| `dev` | `https://deepflowagentctrl.dev.deepwisdomai.com` | `http://deepflowagentctrl.deepflow.svc.cluster.local:8080` |
|
|
24
|
+
| `prod` | 尚未配置 | 尚未配置 |
|
|
25
|
+
|
|
26
|
+
地址列描述的是同一目标环境的两种访问方式:本地 CLI 使用 dev Ingress,集群内 Agent 使用 dev Service DNS。确认环境后,可以用用户明确提供的 `--base-url` 覆盖该环境的默认地址,但该地址必须属于已选环境;如果地址与环境冲突,先停止并澄清,不能用它绕过环境门禁。`prod` 目前没有地址,任何 prod 操作都必须停止并说明尚未接入。
|
|
27
|
+
|
|
28
|
+
本地操作 dev 时示例:
|
|
29
|
+
|
|
30
|
+
```bash
|
|
31
|
+
df-agentctrl --base-url https://deepflowagentctrl.dev.deepwisdomai.com list --json
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
### Run 内的目标环境
|
|
35
|
+
|
|
36
|
+
`DF_TASK_ID`、`DF_RUN_ID`、`DF_TASK_ACTOR_KIND` 都非空时,你运行在推进器拉起的 Run 里,没有用户可以询问。此时目标环境由部署决定:用注入的 `DF_AGENTCTRL_BASE_URL` 对照上表反查所属环境,例如 `http://deepflowagentctrl.deepflow.svc.cluster.local:8080` 即 `dev`。每一轮、每个 Run 都按同一规则确定,不需要也不应该等待任何人确认。
|
|
37
|
+
|
|
38
|
+
反查不到任何环境、地址属于 `prod`,或指令要求操作的环境与反查结果不一致时,停止,不调用服务、不改用其他地址,在最终回复里说明注入地址和冲突原因。
|
|
39
|
+
|
|
40
|
+
先请求选定地址的 `GET /healthz`,确认控制面可用后再执行创建、保存、启停或回退。健康检查失败时报告该环境不可达,不得静默改用 localhost 或其他环境。
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
df-agentctrl help
|
|
44
|
+
df-agentctrl list --json
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
若命令不存在,说明缺少CLI部署:本项目源码可用时运行`make install-cli`,否则向调用方说明需要安装`df-agentctrl`及提供控制面地址。不要因为这个Skill是在runtime里加载的,就把runtime地址当作控制面地址。
|
|
48
|
+
|
|
49
|
+
## 业务 metadata 与软范围查询
|
|
50
|
+
|
|
51
|
+
Agent 定义可以在创建时携带业务方自定义的 JSON metadata。基础服务只约定顶层的
|
|
52
|
+
`source`、`query_keys` 和 `data`:`source` 与 `query_keys` 用于可选的软范围查询,`data`
|
|
53
|
+
由业务方自行组织,服务不会解释其中字段。
|
|
54
|
+
|
|
55
|
+
创建时把 metadata 放在快照文件的顶层:
|
|
56
|
+
|
|
57
|
+
```json
|
|
58
|
+
{
|
|
59
|
+
"name": "代码评审Agent",
|
|
60
|
+
"description": "阅读代码变更并给出可操作的评审意见",
|
|
61
|
+
"instructions": "根据任务提供的代码和上下文完成评审。",
|
|
62
|
+
"skills": [],
|
|
63
|
+
"mcp_config": {},
|
|
64
|
+
"metadata": {
|
|
65
|
+
"source": "workbench",
|
|
66
|
+
"query_keys": ["account:u123"],
|
|
67
|
+
"data": {"project": "orders"}
|
|
68
|
+
},
|
|
69
|
+
"change_note": "初始版本"
|
|
70
|
+
}
|
|
71
|
+
```
|
|
72
|
+
|
|
73
|
+
```bash
|
|
74
|
+
df-agentctrl create --file agent.json --json
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
有业务上下文时,优先限定目录和读取范围:
|
|
78
|
+
|
|
79
|
+
```bash
|
|
80
|
+
df-agentctrl list \
|
|
81
|
+
--metadata-source workbench \
|
|
82
|
+
--metadata-query-key account:u123 \
|
|
83
|
+
--json
|
|
84
|
+
df-agentctrl get <agent-id> \
|
|
85
|
+
--metadata-source workbench \
|
|
86
|
+
--metadata-query-key account:u123 \
|
|
87
|
+
--json
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
查询规则:`query_keys` 可以包含多个标识;`"*"` 表示显式共享,匹配任意来源和查询标识;
|
|
91
|
+
不提供过滤参数仍然查询全部启用Agent(`list`)或按 ID 读取(`get`)。metadata 是查询范围,
|
|
92
|
+
不是权限控制。若按范围 `get` 返回不存在,应同时考虑 Agent 不属于该范围的情况。
|
|
93
|
+
|
|
94
|
+
metadata 归属于 Agent 定义本身,而不是某个版本。当前 CLI 只有 `create --file` 能在创建时
|
|
95
|
+
写入 metadata;`save` 是版本快照写入,不要把 metadata 加进保存文件,也没有单独修改 metadata
|
|
96
|
+
的命令。保存已有 Agent 时沿用维护说明中的快照格式。
|
|
97
|
+
|
|
98
|
+
## 发现与读取
|
|
99
|
+
|
|
100
|
+
1. 有业务上下文时使用上面的 metadata 过滤;没有上下文时使用`list --json`保持历史全量行为。根据任务和Agent的`description`选择合适定义;`name`允许重复,身份以`id`为准。
|
|
101
|
+
2. 从选中目录项取`id`和`default_version`,按明确版本读取完整定义:
|
|
102
|
+
|
|
103
|
+
```bash
|
|
104
|
+
df-agentctrl get <agent-id> --version <default_version> --json
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
3. 读取响应中的`agent`元数据与`version`定义。定义包含`description`、`instructions`、`skills`、`mcp_config`,以及版本号、时间等元数据。
|
|
108
|
+
|
|
109
|
+
需要稳定内容时固定目录返回的具体版本,避免两次请求之间默认版本变化。没有合适Agent时如实说明,不为了完成一次查询就自动新建或改写Agent。需要检查停用Agent时使用`list --include-disabled --json`;停用不删除历史。
|
|
110
|
+
|
|
111
|
+
## 职责边界
|
|
112
|
+
|
|
113
|
+
- 控制面提供定义;聚合平台读取定义后组装`AgentData`并注入runtime。runtime不依赖控制面的API。
|
|
114
|
+
- 调度智能体如何选择Agent、创建worker记录和执行任务,由既定调度流程及其playbook/skill负责。查询到Agent不代表已经分配或执行任务。
|
|
115
|
+
- `provider`、`model`、`thinking level`、任务上下文与执行提示词覆盖不属于本控制面字段。
|
|
116
|
+
- Skills只保留名称和固定版本或`follow_latest`,执行准备方负责解析和获取Skill内容。MCP只保存配置,不在这里做连通性检查或服务部署。
|
|
117
|
+
|
|
118
|
+
## 维护Agent
|
|
119
|
+
|
|
120
|
+
仅在任务要求创建、修改、启停或回退定义时使用写命令;沿用用户已经给出的授权范围。详细快照格式和操作示例见[维护说明](references/maintenance.md)。
|
|
121
|
+
|
|
122
|
+
```text
|
|
123
|
+
df-agentctrl create --file agent.json --json
|
|
124
|
+
df-agentctrl save <agent-id> --file agent.json [--change-note <text>] --json
|
|
125
|
+
df-agentctrl versions <agent-id> --json
|
|
126
|
+
df-agentctrl diff <agent-id> --from <n> --to <n> [--json]
|
|
127
|
+
df-agentctrl enable <agent-id> --json
|
|
128
|
+
df-agentctrl disable <agent-id> --json
|
|
129
|
+
df-agentctrl rollback <agent-id> --version <n> [--change-note <text>] --json
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
`save`提交完整快照,不是Patch;每次成功保存都会创建新版本并立即成为默认版本。回退也是创建新版本,当前名称和启停状态不变。所有命令支持`--base-url`,全局选项可放在命令前后;子命令帮助用`help <command>`。
|
|
133
|
+
|
|
134
|
+
## 输出与错误
|
|
135
|
+
|
|
136
|
+
自动处理响应使用`--json`:stdout只包含成功JSON,stderr是错误。默认Diff输出是文件统计和unified patch。
|
|
137
|
+
|
|
138
|
+
- 退出0:成功。
|
|
139
|
+
- 退出2:参数、UUID、版本号或输入文件无效;请求尚未发送,修正后再执行。
|
|
140
|
+
- 退出1:网络或服务端失败,读取stderr。400/422按字段修正;404核对ID和版本。
|
|
141
|
+
- `create/save/rollback`超时后,先用`list/get/versions`判断写入是否已发生。这些命令没有请求幂等键,不能盲目重试。
|
|
142
|
+
|
|
143
|
+
完成维护后报告Agent ID、实际产生的版本和操作结果;只做目录查询时报告选中的ID和版本,不声称runtime已启动。
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
# Agent定义维护
|
|
2
|
+
|
|
3
|
+
## 快照格式
|
|
4
|
+
|
|
5
|
+
新建时可复制本Skill的[示例](../assets/agent.json),然后按任务填写:
|
|
6
|
+
|
|
7
|
+
```json
|
|
8
|
+
{
|
|
9
|
+
"name": "代码评审Agent",
|
|
10
|
+
"description": "阅读代码变更并给出可操作的评审意见",
|
|
11
|
+
"instructions": "根据任务提供的代码和上下文完成评审。",
|
|
12
|
+
"skills": [],
|
|
13
|
+
"mcp_config": {},
|
|
14
|
+
"change_note": "初始版本"
|
|
15
|
+
}
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
如果需要按业务范围发现Agent,可在创建快照的顶层增加可选 metadata。`source` 和 `query_keys`
|
|
19
|
+
供控制面做软范围查询,`data` 由业务方自行组织:
|
|
20
|
+
|
|
21
|
+
```json
|
|
22
|
+
"metadata": {
|
|
23
|
+
"source": "workbench",
|
|
24
|
+
"query_keys": ["account:u123"],
|
|
25
|
+
"data": {"project": "orders"}
|
|
26
|
+
}
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
metadata 只在 `create` 时写入 Agent 记录;`save` 提交的是版本定义快照,不接受 metadata 字段。
|
|
30
|
+
|
|
31
|
+
名称必填、允许重复;长度上限为200字符,职责说明2000、Instructions 200000、修改说明2000。`name`属于Agent元数据,历史版本不保留过去的名称。
|
|
32
|
+
|
|
33
|
+
Skill引用的`name`使用Marketplace slug;例如固定`{"name":"code-review","version":"1.0.0"}`或跟随`{"name":"code-review","follow_latest":true}`,两种策略二选一。不要把Marketplace数据库ID或Skill文件内容写进定义。控制面保存时不访问Marketplace验证该引用。
|
|
34
|
+
|
|
35
|
+
MCP空配置用`{}`,非空用`{"mcpServers":{...}}`;不加入模型、运行会话或调度业务字段。保存会完整覆盖版本内容,遗漏字段不意味着保留旧值。
|
|
36
|
+
|
|
37
|
+
## 编辑已有Agent
|
|
38
|
+
|
|
39
|
+
先读取完整定义,转换为可写快照,再修改需要调整的字段:
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
df-agentctrl get <agent-id> --json > current.json
|
|
43
|
+
python3 <skill-dir>/scripts/to_snapshot.py < current.json > agent.json
|
|
44
|
+
# 按任务修改agent.json,保留未修改的Instructions、Skills和MCP。
|
|
45
|
+
df-agentctrl save <agent-id> --file agent.json --change-note '调整评审指令' --json
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
`<skill-dir>`使用当前Skill所在目录的实际路径。转换脚本保留名称和四项定义字段,清空修改说明,不携带`id`、时间、版本号等服务端元数据。不要直接把`get`响应作为`save`请求提交。
|
|
49
|
+
|
|
50
|
+
`--change-note`覆盖文件里的说明,`--change-note=`可显式清空。保存成功返回`{"agent": {...}, "version": {...}}`,从响应取实际版本号,不假设仍是读取版本加一(其他管理员可能同时保存)。
|
|
51
|
+
|
|
52
|
+
## 版本与回退
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
df-agentctrl versions <agent-id> --json
|
|
56
|
+
df-agentctrl diff <agent-id> --from 1 --to 2
|
|
57
|
+
df-agentctrl rollback <agent-id> --version 1 --change-note '恢复版本1内容' --json
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
Diff比较同一个Agent的两个已有版本,返回`description.md`、`instructions.md`、`skills.json`和`mcp-config.json`中实际变化的文件。`--json`返回结构化`files`及每个文件的`patch`。
|
|
61
|
+
|
|
62
|
+
若当前为v2,回退v1会创建v3,不把默认指针直接拨回v1。回退返回新版本对象,名称与启停状态保持当前值。
|
|
63
|
+
|
|
64
|
+
## 启停与失败恢复
|
|
65
|
+
|
|
66
|
+
启停是幂等操作:`enable`恢复默认目录可见性,`disable`隐藏目录项;两者均保留历史,不取消已开始的执行。
|
|
67
|
+
|
|
68
|
+
写请求超时可能发生在事务已经提交之后。先检查返回的ID(若有)、目录、当前版本和版本历史;无法确认是否提交时报告不确定性,不重复创建版本。控制面没有删除Agent、删除历史或补丁更新命令。
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
#!/usr/bin/env python3
|
|
2
|
+
"""Read a df-agentctrl get --json response on stdin and emit a writable snapshot."""
|
|
3
|
+
import argparse
|
|
4
|
+
import json
|
|
5
|
+
import sys
|
|
6
|
+
|
|
7
|
+
|
|
8
|
+
def main():
|
|
9
|
+
argparse.ArgumentParser(description=__doc__).parse_args()
|
|
10
|
+
try:
|
|
11
|
+
detail = json.load(sys.stdin)
|
|
12
|
+
agent, version = detail["agent"], detail["version"]
|
|
13
|
+
snapshot = {"name": agent["name"]}
|
|
14
|
+
for key in ("description", "instructions", "skills", "mcp_config"):
|
|
15
|
+
snapshot[key] = version[key]
|
|
16
|
+
snapshot["change_note"] = ""
|
|
17
|
+
except (ValueError, TypeError, KeyError) as exc:
|
|
18
|
+
print(f"Expected a complete df-agentctrl get --json response: {exc}", file=sys.stderr)
|
|
19
|
+
return 2
|
|
20
|
+
json.dump(snapshot, sys.stdout, ensure_ascii=False, indent=2)
|
|
21
|
+
print()
|
|
22
|
+
return 0
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
if __name__ == "__main__":
|
|
26
|
+
sys.exit(main())
|