@metagptx/deepflow-suite-cli 0.2.10 → 0.3.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.
Files changed (58) hide show
  1. package/README.md +44 -50
  2. package/bin/deepflow-suite.js +4 -4
  3. package/bundle/deepflow-release.json +21 -91
  4. package/bundle/skills/deepflow-suite/SKILL.md +7 -1
  5. package/bundle/skills/df-agentctrl/SKILL.md +92 -10
  6. package/bundle/skills/df-agentrt/SKILL.md +65 -14
  7. package/bundle/skills/df-agentrt-repo/SKILL.md +4 -0
  8. package/bundle/skills/df-task/SKILL.md +98 -26
  9. package/bundle/skills/df-taskdriver/SKILL.md +8 -4
  10. package/bundle/skills/df-workbench/SKILL.md +5 -9
  11. package/manifest.json +12 -30
  12. package/package.json +8 -17
  13. package/runtime/df-agentctrl/commands.mjs +93 -0
  14. package/runtime/df-agentctrl/df-agentctrl.mjs +119 -0
  15. package/runtime/df-agentctrl/release.json +1 -0
  16. package/runtime/df-agentrt/agentrt.mjs +3 -0
  17. package/runtime/df-agentrt/df-agentrt.mjs +3 -0
  18. package/runtime/df-agentrt/release.json +1 -0
  19. package/runtime/df-agentrt/runtime.mjs +326 -0
  20. package/runtime/df-agentrt/usage.mjs +16 -0
  21. package/runtime/df-task/commands.mjs +181 -0
  22. package/runtime/df-task/df-task.mjs +155 -0
  23. package/runtime/df-task/protocol.mjs +3 -0
  24. package/runtime/df-task/release.json +1 -0
  25. package/runtime/df-taskdriver/df-taskdriver.mjs +131 -0
  26. package/runtime/df-taskdriver/release.json +1 -0
  27. package/runtime/{df-workbench.mjs → df-workbench/df-workbench.mjs} +17 -175
  28. package/runtime/df-workbench/release.json +1 -0
  29. package/scripts/build-package.mjs +29 -25
  30. package/src/bundle.mjs +4 -1
  31. package/src/cli-install.mjs +35 -125
  32. package/src/commands/doctor.mjs +2 -0
  33. package/src/linker.mjs +2 -2
  34. package/src/manifest.mjs +7 -13
  35. package/src/package-cli.mjs +44 -60
  36. package/bin/df-agentctrl.js +0 -10
  37. package/bin/df-agentrt.js +0 -10
  38. package/bin/df-task.js +0 -10
  39. package/bin/df-taskdriver.js +0 -10
  40. package/bin/df-workbench.js +0 -10
  41. package/bundle/skills/deepflow-suite/manifest.yaml +0 -20
  42. package/bundle/skills/df-agentctrl/references/environment.md +0 -40
  43. package/bundle/skills/df-agentctrl/references/query-scope.md +0 -50
  44. package/bundle/skills/df-agentrt/references/environment.md +0 -29
  45. package/bundle/skills/df-agentrt/references/invocation-result.md +0 -11
  46. package/bundle/skills/df-agentrt/references/query-scope.md +0 -30
  47. package/bundle/skills/df-agentrt/references/session-create.md +0 -14
  48. package/bundle/skills/df-task/references/environment.md +0 -50
  49. package/bundle/skills/df-task/references/query-scope.md +0 -49
  50. package/bundle/skills/df-task/references/reading.md +0 -9
  51. package/bundle/skills/df-task/skill_test.go +0 -201
  52. package/bundle/skills/df-workbench/manifest.yaml +0 -5
  53. package/scripts/build-runtime-packages.mjs +0 -38
  54. package/skills/deepflow-suite/SKILL.md +0 -81
  55. package/skills/deepflow-suite/manifest.yaml +0 -20
  56. package/src/cli-launcher.mjs +0 -71
  57. package/src/runtime-build.mjs +0 -193
  58. package/src/runtime-package.mjs +0 -31
package/README.md CHANGED
@@ -1,72 +1,66 @@
1
1
  # `@metagptx/deepflow-suite-cli`
2
2
 
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.
3
+ DeepFlow ships one portable Node package containing `deepflow-suite`, five service
4
+ CLIs and seven Skills. Node.js 22.13+ is required. Users do not need Go, Make, a
5
+ workspace checkout, optional dependencies or an OS-specific runtime package.
6
6
 
7
- ## Install
7
+ ## Install and check
8
8
 
9
9
  ```bash
10
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
11
+ deepflow-suite install
12
+ deepflow-suite doctor --json
14
13
  ```
15
14
 
16
- The public package includes the `deepflow-suite` entrypoint, the five service
17
- CLI launchers (`df-workbench`, `df-task`, `df-taskdriver`, `df-agentctrl`, and
18
- `df-agentrt`), and seven bundled Skills. npm automatically selects the matching
19
- runtime package for `darwin-arm64`, `darwin-x64`, `linux-arm64`, `linux-x64`, or
20
- `win32-x64`; the user does not need a DeepFlow checkout, Go, or Make.
21
-
22
- `install --source package` copies the seven Skills into `$CODEX_HOME/skills`
23
- (or `~/.codex/skills`) and verifies all six command launchers plus the selected
24
- runtime package. `doctor --source package --json` reports the same complete
25
- distribution check. Use `--target` to choose another Skill directory and
26
- `--force` only when replacing an existing installation is intentional.
27
-
28
- If npm is run with `--omit=optional`, package installation fails before changing
29
- the Skill directory and reports the missing platform runtime package. Reinstall
30
- without `--omit=optional` to obtain the four Go-backed CLIs.
31
-
32
- ## Environment selection
33
-
34
- The service Skills cover `local`, `dev`, and domestic production `prod-cn`.
35
- Select the environment explicitly, then configure the service URL described in
36
- its Skill; installing the package does not select an environment or log in.
37
- The package release does not update deployed Runtime images, existing Session
38
- Skill snapshots, or Agent Control definitions.
15
+ npm registers `deepflow-suite`, `df-workbench`, `df-task`, `df-taskdriver`,
16
+ `df-agentctrl` and `df-agentrt` through `package.json#bin`. The installer copies
17
+ bundled Skills to `$CODEX_HOME/skills` (or `~/.codex/skills`); `--target` chooses
18
+ another Skill directory. Existing regular Skill directories require `--force`.
19
+ Skills contain instructions and references; they rely on Suite-provided commands
20
+ and do not carry CLI implementations. `--source package` remains supported and
21
+ is the default. npm installation does not modify the user's Skill directories.
22
+
23
+ `doctor` checks the installed Skill contents, all six entrypoints, their Suite
24
+ version, and the command actually selected by PATH. It reports stale commands
25
+ from previous installations without overwriting them. Each service CLI supports
26
+ `--cli-version --json`, separate from Agent definition `--version` arguments.
27
+ `npm install --ignore-scripts --omit=optional` is supported.
28
+
29
+ Select local/dev/prod explicitly before service calls, then configure the URL
30
+ and identity documented by the relevant Skill. Installation performs no login
31
+ or service calls. CLI releases do not update services, Agent definitions or
32
+ existing Session snapshots.
39
33
 
40
34
  ## Workspace development
41
35
 
42
- From the DeepFlow workspace, install relative Skill links and build the five
43
- service CLIs:
36
+ CLI source belongs to each service's `cli/` directory. Suite bundles those
37
+ sources without maintaining another client implementation. Development links
38
+ point directly to Node entries and do not compile services:
44
39
 
45
40
  ```bash
46
- deepflow-suite install --source workspace --bin-dir "$HOME/.local/bin"
47
- deepflow-suite doctor --source workspace --json
41
+ node tools/deepflow-cli/bin/deepflow-suite.js install --source workspace
42
+ node tools/deepflow-cli/bin/deepflow-suite.js doctor --source workspace --json
48
43
  ```
49
44
 
50
- The workspace distribution contains `deepflow-suite`, `df-workbench`,
51
- `df-task`, `df-taskdriver`, `df-agentctrl`, `df-agentrt`, and `df-agentrt-repo`.
52
- The four Runtime variant Skills (`df-agentrt-full`, `df-agentrt-git`,
53
- `df-agentrt-ci`, and `df-agentrt-preview`) are selected by Agent definitions
54
- and are not part of the ordinary distribution.
45
+ Use `--bin-dir` to choose a command directory. Replacing a different existing
46
+ command requires `--force`. The normal Skill set is `deepflow-suite`,
47
+ `df-workbench`, `df-task`, `df-taskdriver`, `df-agentctrl`, `df-agentrt` and
48
+ `df-agentrt-repo`; Runtime-specific variant Skills remain separate.
55
49
 
56
- ## Publishing
50
+ ## Build and release
57
51
 
58
- The package is prepared for public scoped publication like Console CLI:
52
+ Run service CLI contract tests and Node tests, then:
59
53
 
60
54
  ```bash
61
- npm run test
62
- npm run build:runtime
63
- npm run check:runtime
64
- npm run pack:dry-run
55
+ npm test
56
+ npm pack
65
57
  npm publish
66
58
  ```
67
59
 
68
- Publish the five platform runtime packages before publishing the main package;
69
- all six entrypoints and platform packages must use the same version. `prepack`
70
- materializes the seven Skill bundle, the Workbench Node entrypoint, and the
71
- runtime release metadata. The published installer never overwrites an existing
72
- Skill or CLI file without `--force`.
60
+ `prepack` gathers the five Node clients and seven Skills and generates release
61
+ metadata from the npm package version. The package has no native build or
62
+ runtime download step. Cross-platform install tests use the same npm tarball.
63
+ Old platform packages remain available for pinned 0.2.x releases; mark them
64
+ deprecated after the portable release is available, rather than unpublishing
65
+ packages still referenced by older versions. The legacy `@metagptx/deepflow-cli`
66
+ package and its `deepflow` command are a separate product entrypoint.
@@ -14,7 +14,7 @@ function parseArgs(argv) {
14
14
  const [first, ...rest] = argv;
15
15
  const command = first?.startsWith("-") ? undefined : first;
16
16
  const argumentsToParse = command ? rest : argv;
17
- const options = { source: "workspace", workspaceRoot: process.cwd() };
17
+ const options = { source: "package", workspaceRoot: process.cwd() };
18
18
  for (let index = 0; index < argumentsToParse.length; index += 1) {
19
19
  const argument = argumentsToParse[index];
20
20
  if (argument === "--source") options.source = argumentsToParse[++index];
@@ -27,14 +27,14 @@ function parseArgs(argv) {
27
27
  else if (argument === "--skip-cli") options.skipCli = true;
28
28
  else if (argument === "--json") options.json = true;
29
29
  else if (argument === "--help" || argument === "-h") options.help = true;
30
- else if (argument === "--version" || argument === "-v") options.version = true;
30
+ else if (argument === "--version" || argument === "--cli-version" || argument === "-v") options.version = true;
31
31
  else throw new Error(`unknown option: ${argument}`);
32
32
  }
33
33
  return { command, options };
34
34
  }
35
35
 
36
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.`);
37
+ console.log(`${CLI_NAME} — DeepFlow distribution installer\n\nCommands:\n install [--target <path>] [--force] Install bundled Skills; npm provides all five CLIs\n doctor [--json] Check Skills, CLI versions and PATH\n install --source workspace [--root <path>] [--bin-dir <path>] [--skip-cli]\n doctor --source workspace [--root <path>] [--bin-dir <path>]\n bundle --root <path> --output <path>\n\nThe default source is package.`);
38
38
  }
39
39
 
40
40
  function output(value, json) {
@@ -47,7 +47,7 @@ const manifestPath = path.join(packageRoot, "manifest.json");
47
47
 
48
48
  if (options.version) {
49
49
  const packageJson = JSON.parse(await readFile(path.join(packageRoot, "package.json"), "utf8"));
50
- console.log(packageJson.version);
50
+ console.log(options.json ? JSON.stringify({ name: CLI_NAME, version: packageJson.version, entry: fileURLToPath(import.meta.url) }) : packageJson.version);
51
51
  process.exit(0);
52
52
  }
53
53
 
@@ -2,13 +2,13 @@
2
2
  "schemaVersion": 1,
3
3
  "distribution": "deepflow-suite",
4
4
  "package": "@metagptx/deepflow-suite-cli",
5
- "version": "0.2.10",
5
+ "version": "0.3.0",
6
6
  "platform": "any",
7
7
  "arch": "any",
8
8
  "cli": {
9
9
  "name": "deepflow-suite",
10
10
  "package": "@metagptx/deepflow-suite-cli",
11
- "version": "0.2.10",
11
+ "version": "0.3.0",
12
12
  "command": "deepflow-suite"
13
13
  },
14
14
  "skills": [
@@ -16,15 +16,10 @@
16
16
  "name": "deepflow-suite",
17
17
  "source": "tools/deepflow-cli/skills/deepflow-suite",
18
18
  "files": [
19
- {
20
- "path": "manifest.yaml",
21
- "size": 362,
22
- "sha256": "03089402b9a59b0605c582e968226f7868928043daea37d5944468d1f4b41b92"
23
- },
24
19
  {
25
20
  "path": "SKILL.md",
26
- "size": 3524,
27
- "sha256": "8be45b44925906998ec838dcd46a74e164b8e75572523b4facc7cc5e0e1a3118"
21
+ "size": 4018,
22
+ "sha256": "ebd8b217b9ce1ca5dc50024838db41ad8afae08a2bc6d2b2cebd6cd5f46fd0b1"
28
23
  }
29
24
  ]
30
25
  },
@@ -32,15 +27,10 @@
32
27
  "name": "df-workbench",
33
28
  "source": "deepflow-workbench/skills/df-workbench",
34
29
  "files": [
35
- {
36
- "path": "manifest.yaml",
37
- "size": 84,
38
- "sha256": "e7e7697d875a49b5d3d4dd4d38fb8479d8a1fb175ab65ab6a2c79addbb171457"
39
- },
40
30
  {
41
31
  "path": "SKILL.md",
42
- "size": 5782,
43
- "sha256": "a7df787038aa0f47a81da0c6ff28239d793e621c262c5254661009d16c9177fd"
32
+ "size": 5558,
33
+ "sha256": "54a13bb845b859f855b94facbb5cd1c6d7721be6dd2ec86dee6e8e7feb2be998"
44
34
  }
45
35
  ]
46
36
  },
@@ -83,35 +73,15 @@
83
73
  "size": 4538,
84
74
  "sha256": "7b3b288ed60b2222fce168c0d61939a00b9579c523ca7027cc69844a9035553f"
85
75
  },
86
- {
87
- "path": "references/environment.md",
88
- "size": 3654,
89
- "sha256": "efd881f367692dbfcc15393b9b80a0011f98e50b67b778e8619606f3191b6ce4"
90
- },
91
76
  {
92
77
  "path": "references/fact-types.md",
93
78
  "size": 3974,
94
79
  "sha256": "5dd10c73e652d018ce20617ec8a5e1becb55fb935f15a366831050063a8989fc"
95
80
  },
96
- {
97
- "path": "references/query-scope.md",
98
- "size": 1941,
99
- "sha256": "5f8fe18b67b9db77cd64cbf7450fa8fa4d6bf3c1cbb06d1b697029476c516d81"
100
- },
101
- {
102
- "path": "references/reading.md",
103
- "size": 1953,
104
- "sha256": "94bc4eb79b3f560b5bf0eb1cc728a1b2594dc698de02917f0ea53aea3d9c59f2"
105
- },
106
- {
107
- "path": "skill_test.go",
108
- "size": 9146,
109
- "sha256": "88dfe1f8104812ff1c9c8dd2c869e116a0774e0972fde7e2bd3329f0b2cd332e"
110
- },
111
81
  {
112
82
  "path": "SKILL.md",
113
- "size": 13099,
114
- "sha256": "c83eef5901c10a4669d98ee7cf3d210a310bfef021e6aff5a3f1ec0913318ee1"
83
+ "size": 15851,
84
+ "sha256": "cf87273902c71c1a66511818397d603cd5e820fb01d211c65be6f818b65ba1f5"
115
85
  }
116
86
  ]
117
87
  },
@@ -121,8 +91,8 @@
121
91
  "files": [
122
92
  {
123
93
  "path": "SKILL.md",
124
- "size": 13261,
125
- "sha256": "108ad742c99f5299a520954f994c1d969212b945881542a83a6e13d8b4def33d"
94
+ "size": 13372,
95
+ "sha256": "8a17db4c0f15a64ed18d05abaf1dcc43688cc58f03e96c1f8dd91d11a862f09f"
126
96
  }
127
97
  ]
128
98
  },
@@ -135,21 +105,11 @@
135
105
  "size": 251,
136
106
  "sha256": "6c2ab44fe6dc9ea7aa769965d92c71d7367d785a04fd4579e1629452dc4a68ef"
137
107
  },
138
- {
139
- "path": "references/environment.md",
140
- "size": 2944,
141
- "sha256": "f39554b21c5bd945f60c228002c6cc19067dc2e3472f8095ba68401449ccad10"
142
- },
143
108
  {
144
109
  "path": "references/maintenance.md",
145
110
  "size": 5170,
146
111
  "sha256": "e303df1eb9849bfe6611e2e6fad37079b5d5934068a66173b8f11efc92343f2a"
147
112
  },
148
- {
149
- "path": "references/query-scope.md",
150
- "size": 1739,
151
- "sha256": "c9044a12bb9f5b703f25d6b3b4d283e2b5626a6378a86d825b1ed3c02843c5f1"
152
- },
153
113
  {
154
114
  "path": "scripts/to_snapshot.py",
155
115
  "size": 833,
@@ -157,8 +117,8 @@
157
117
  },
158
118
  {
159
119
  "path": "SKILL.md",
160
- "size": 5120,
161
- "sha256": "3d4733fecf8feed798c4870356ae403b97a24214ed3c67fe8a89710640f0373e"
120
+ "size": 8774,
121
+ "sha256": "6e23208944de6bb1247a31c4f634a9a5ee6c67e2593cc3149d1075742ec4c077"
162
122
  }
163
123
  ]
164
124
  },
@@ -166,30 +126,10 @@
166
126
  "name": "df-agentrt",
167
127
  "source": "deepflow-agent-runtime/skills/df-agentrt",
168
128
  "files": [
169
- {
170
- "path": "references/environment.md",
171
- "size": 2156,
172
- "sha256": "71598b8ba22d69e92eec71fd0f8f00ead49681d3b9466b665696203d303bc5e8"
173
- },
174
- {
175
- "path": "references/invocation-result.md",
176
- "size": 1949,
177
- "sha256": "5fa8680a74a78fac3a7c67bf1184e2a4b230fd3243a8bab1a0105155d3b8173d"
178
- },
179
- {
180
- "path": "references/query-scope.md",
181
- "size": 1484,
182
- "sha256": "6ba469d71a3fc0be2905491479644cd5cc8064170c853b703358ec8fb19da760"
183
- },
184
- {
185
- "path": "references/session-create.md",
186
- "size": 668,
187
- "sha256": "6d31dc9858b72fafd5431ace1073dad8115d9f525bf7aad59bb86705faf1a779"
188
- },
189
129
  {
190
130
  "path": "SKILL.md",
191
- "size": 10787,
192
- "sha256": "a80b106dd9f2661c794eec40da955a267f20119ec9db89b112982c4d6b3f034e"
131
+ "size": 12458,
132
+ "sha256": "aaa0811be96749e3dbf2b640291bedc3251a64a406cee6ac7f6e5f77d9b66307"
193
133
  }
194
134
  ]
195
135
  },
@@ -199,8 +139,8 @@
199
139
  "files": [
200
140
  {
201
141
  "path": "SKILL.md",
202
- "size": 3198,
203
- "sha256": "1f2e9b3c3631eefc8d0bbf1a3727a0aaf64ea31647da26f22dc025ba0aae996d"
142
+ "size": 3492,
143
+ "sha256": "f04a22e7967727217003071b7ad7c9268fde9058af4e1f8d3de22e28e18ac718"
204
144
  }
205
145
  ]
206
146
  }
@@ -209,37 +149,27 @@
209
149
  {
210
150
  "name": "df-workbench",
211
151
  "project": "deepflow-workbench",
212
- "install": "project",
213
- "package": "@metagptx/deepflow-suite-cli",
214
- "mode": "node"
152
+ "entry": "cli/df-workbench.mjs"
215
153
  },
216
154
  {
217
155
  "name": "df-task",
218
156
  "project": "deepflow-task",
219
- "install": "make install-cli",
220
- "package": "platform-runtime",
221
- "mode": "binary"
157
+ "entry": "cli/df-task.mjs"
222
158
  },
223
159
  {
224
160
  "name": "df-taskdriver",
225
161
  "project": "deepflow-task-driver",
226
- "install": "make install-cli",
227
- "package": "platform-runtime",
228
- "mode": "binary"
162
+ "entry": "cli/df-taskdriver.mjs"
229
163
  },
230
164
  {
231
165
  "name": "df-agentctrl",
232
166
  "project": "deepflow-agent-ctrl",
233
- "install": "make install-cli",
234
- "package": "platform-runtime",
235
- "mode": "binary"
167
+ "entry": "cli/df-agentctrl.mjs"
236
168
  },
237
169
  {
238
170
  "name": "df-agentrt",
239
171
  "project": "deepflow-agent-runtime",
240
- "install": "make build",
241
- "package": "platform-runtime",
242
- "mode": "binary"
172
+ "entry": "cli/df-agentrt.mjs"
243
173
  }
244
174
  ]
245
175
  }
@@ -5,6 +5,10 @@ description: DeepFlow 统一入口。常规任务默认使用 df-workbench;只
5
5
 
6
6
  # DeepFlow Suite
7
7
 
8
+ ## CLI 依赖
9
+
10
+ CLI 由 `@metagptx/deepflow-suite-cli` 统一安装,本 Skill 不携带 CLI 实现。使用前应已完成 Suite 安装;缺少命令或版本不匹配时,用 `deepflow-suite doctor --json` 核对。Run 内缺少工具属于执行环境异常,不临时安装或编译。
11
+
8
12
  这是 DeepFlow 的统一用户和开发者入口。它开放完整的 DeepFlow 能力,但不默认调用整条链路:普通任务先走 `df-workbench`,只有确实需要解释推进、Agent 或 Runtime 问题时才升级到其他项目 CLI。
9
13
 
10
14
  ## 依赖
@@ -22,7 +26,9 @@ description: DeepFlow 统一入口。常规任务默认使用 df-workbench;只
22
26
 
23
27
  ## 环境门禁
24
28
 
25
- 用户没有明确说 `local`、本地、`dev`、开发环境或 `prod`、生产环境时,先询问:
29
+ 以下门禁适用于连接环境内服务。纯离线证据分析、源码审查或能力编写无需选择环境;不能借离线分析自动连接材料里引用的服务。
30
+
31
+ 需要连接服务、用户尚未明确说 `local`、本地、`dev`、开发环境或 `prod`、生产环境时,先询问:
26
32
 
27
33
  ```text
28
34
  请指定目标环境:local(本地)、dev(开发环境)还是 prod(生产环境)?
@@ -5,32 +5,114 @@ description: 使用df-agentctrl CLI查询DeepFlow Agent控制面的可用智能
5
5
 
6
6
  # DeepFlow Agent Control
7
7
 
8
- 通过`df-agentctrl`操作Agent定义和版本。运行命令前确认CLI已在PATH中;服务地址由`DF_AGENTCTRL_BASE_URL`或`--base-url`提供,默认`http://127.0.0.1:8080`。本Skill不安装二进制,也不自动启动服务。
8
+ ## CLI 依赖
9
9
 
10
- ## 环境与可用性
10
+ CLI 由 `@metagptx/deepflow-suite-cli` 统一安装,本 Skill 不携带 CLI 实现。使用前应已完成 Suite 安装;缺少命令或版本不匹配时,用 `deepflow-suite doctor --json` 核对。Run 内缺少工具属于执行环境异常,不临时安装或编译。
11
11
 
12
- 托管 Run 沿用注入的 `DF_AGENTCTRL_BASE_URL` 与当前流程环境,不重新询问、不根据业务项目目标环境切换控制面,缺失/冲突先报告。外部调用先确认 local/dev/prod,再按[环境与地址](references/environment.md)显式选址;未明确先询问,失败不切换,跨服务保持同一环境。先验证 `/healthz`,生产写操作限已有授权。
12
+ 通过`df-agentctrl`操作Agent定义和版本。运行命令前确认CLI已在PATH中;服务地址由`DF_AGENTCTRL_BASE_URL`或`--base-url`提供,默认`http://127.0.0.1:8080`。本 Skill 不安装 CLI,也不自动启动服务。
13
13
 
14
- 入口为 `df-agentctrl help`。工具缺失属于部署缺口;托管 Run 不安装、编译或猜 Runtime 地址,本地维护安装方法见项目 README。
14
+ ## 目标环境门禁与地址
15
15
 
16
- ## 查询范围
16
+ 每次调用控制面前,必须先确认用户要操作的目标环境。在推进器拉起的 Run 里按下文「Run 内的目标环境」确定,不询问。其他情况下,用户没有明确说 `local`、本地、`dev`、开发环境或 `prod`、生产环境时,先询问:
17
17
 
18
- 有业务上下文时使用 `list/get --metadata-source <source> --metadata-query-key <key> --json`,只按已确认的具体来源和 key 过滤;metadata 是软范围,不是权限。需要创建 metadata、共享范围或解释范围内不存在时读[范围说明](references/query-scope.md)。
18
+ ```text
19
+ 请指定目标环境:local(本地)、dev(开发环境)还是 prod(生产环境)?
20
+ ```
21
+
22
+ 环境一旦选定,本轮所有服务调用都必须保持在同一环境;不能因为连接失败就切换到另一环境,也不能把当前机器所在位置当成目标环境。
23
+
24
+ | 目标环境 | 本地执行时的地址 | 在 dev-k8s 内执行时的地址 |
25
+ | --- | --- | --- |
26
+ | `local` | `http://127.0.0.1:8080` | 不适用 |
27
+ | `dev` | `https://deepflowagentctrl.dev.deepwisdomai.com` | `http://deepflowagentctrl.deepflow.svc.cluster.local:8080` |
28
+ | `prod` | 尚未配置 | 尚未配置 |
29
+
30
+ 地址列描述的是同一目标环境的两种访问方式:本地 CLI 使用 dev Ingress,集群内 Agent 使用 dev Service DNS。确认环境后,可以用用户明确提供的 `--base-url` 覆盖该环境的默认地址,但该地址必须属于已选环境;如果地址与环境冲突,先停止并澄清,不能用它绕过环境门禁。`prod` 目前没有地址,任何 prod 操作都必须停止并说明尚未接入。
31
+
32
+ 本地操作 dev 时示例:
33
+
34
+ ```bash
35
+ df-agentctrl --base-url https://deepflowagentctrl.dev.deepwisdomai.com list --json
36
+ ```
37
+
38
+ ### Run 内的目标环境
39
+
40
+ `DF_TASK_ID`、`DF_RUN_ID`、`DF_TASK_ACTOR_KIND` 都非空时,你运行在推进器拉起的 Run 里,没有用户可以询问。此时目标环境由部署决定:用注入的 `DF_AGENTCTRL_BASE_URL` 对照上表反查所属环境,例如 `http://deepflowagentctrl.deepflow.svc.cluster.local:8080` 即 `dev`。每一轮、每个 Run 都按同一规则确定,不需要也不应该等待任何人确认。
41
+
42
+ 反查不到任何环境、地址属于 `prod`,或指令要求操作的环境与反查结果不一致时,停止,不调用服务、不改用其他地址,在最终回复里说明注入地址和冲突原因。
43
+
44
+ 先请求选定地址的 `GET /healthz`,确认控制面可用后再执行创建、保存、启停或回退。健康检查失败时报告该环境不可达,不得静默改用 localhost 或其他环境。
45
+
46
+ ```bash
47
+ df-agentctrl help
48
+ df-agentctrl list --json
49
+ ```
50
+
51
+ 若命令不存在,说明缺少 Suite CLI 安装;向调用方说明需要安装 `@metagptx/deepflow-suite-cli` 并提供控制面地址。不要因为这个Skill是在runtime里加载的,就把runtime地址当作控制面地址。
52
+
53
+ ## 业务 metadata 与软范围查询
54
+
55
+ Agent 定义可以在创建时携带业务方自定义的 JSON metadata。基础服务只约定顶层的
56
+ `source`、`query_keys` 和 `data`:`source` 与 `query_keys` 用于可选的软范围查询,`data`
57
+ 由业务方自行组织,服务不会解释其中字段。
58
+
59
+ 创建时把 metadata 放在快照文件的顶层:
60
+
61
+ ```json
62
+ {
63
+ "name": "代码评审Agent",
64
+ "description": "阅读代码变更并给出可操作的评审意见",
65
+ "instructions": "根据任务提供的代码和上下文完成评审。",
66
+ "skills": [],
67
+ "mcp_config": {},
68
+ "metadata": {
69
+ "source": "workbench",
70
+ "query_keys": ["account:u123"],
71
+ "data": {"project": "orders"}
72
+ },
73
+ "change_note": "初始版本"
74
+ }
75
+ ```
76
+
77
+ ```bash
78
+ df-agentctrl create --file agent.json --json
79
+ ```
80
+
81
+ 有业务上下文时,优先限定目录和读取范围:
82
+
83
+ ```bash
84
+ df-agentctrl list \
85
+ --metadata-source workbench \
86
+ --metadata-query-key account:u123 \
87
+ --json
88
+ df-agentctrl get <agent-id> \
89
+ --metadata-source workbench \
90
+ --metadata-query-key account:u123 \
91
+ --json
92
+ ```
93
+
94
+ 查询规则:`query_keys` 可以包含多个标识;`"*"` 表示显式共享,匹配任意来源和查询标识;
95
+ 不提供过滤参数仍然查询全部启用Agent(`list`)或按 ID 读取(`get`)。metadata 是查询范围,
96
+ 不是权限控制。若按范围 `get` 返回不存在,应同时考虑 Agent 不属于该范围的情况。
97
+
98
+ metadata 归属于 Agent 定义本身,而不是某个版本。当前 CLI 只有 `create --file` 能在创建时
99
+ 写入 metadata;`save` 是版本快照写入,不要把 metadata 加进保存文件,也没有单独修改 metadata
100
+ 的命令。保存已有 Agent 时沿用维护说明中的快照格式。
19
101
 
20
102
  ## 发现与读取
21
103
 
22
104
  目录的 `description` 应让调度器理解职责、所需输入、产出、完成条件和同一责任的续办范围;这些是定义内容,不是新增控制面字段。维护定义时将角色流程写在执行定义中,不要求调度器硬编码角色名称。选新能力前应先根据 Task 事实确认是否已有承担该目标/产物的 Run;目录描述本身不记录某个 Task 的所有权或 Session 状态。
23
105
 
24
- 1. 需要发现新能力时查询 `list --json`(有业务范围则加过滤)。以 `id`、`default_version` 和 `description` 判断输入、输出、职责及完成条件;name 可以重复。目录契约已足够时,不逐个读取 instructions、skills 和 MCP。已有执行的续办依据来自 Task 事实及其固定快照,不是重新发现目录。
25
- 2. 契约不足、约束有歧义或需要审查/维护定义时,再读取选中项的明确版本:
106
+ 1. 有业务上下文时使用上面的 metadata 过滤;没有上下文时使用`list --json`保持历史全量行为。根据任务和Agent的`description`选择合适定义;`name`允许重复,身份以`id`为准。
107
+ 2. 从选中目录项取`id`和`default_version`,按明确版本读取完整定义:
26
108
 
27
109
  ```bash
28
110
  df-agentctrl get <agent-id> --version <default_version> --json
29
111
  ```
30
112
 
31
- 3. 执行准备方创建 Session 时仍须读取该固定版本的完整定义,不能拿目录摘要代替 instructions/skills/MCP。默认版本可能并发变化,固定目录版本保证本次选择一致;同一轮已读的固定版本无需重复获取。
113
+ 3. 读取响应中的`agent`元数据与`version`定义。定义包含`description`、`instructions`、`skills`、`mcp_config`,以及版本号、时间等元数据。
32
114
 
33
- 没有合适 Agent 时如实说明,不为一次查询自动创建或改写定义。检查停用 Agent 用 `list --include-disabled --json`;停用不删除历史。
115
+ 需要稳定内容时固定目录返回的具体版本,避免两次请求之间默认版本变化。没有合适Agent时如实说明,不为了完成一次查询就自动新建或改写Agent。需要检查停用Agent时使用`list --include-disabled --json`;停用不删除历史。
34
116
 
35
117
  ## 职责边界
36
118