@metagptx/deepflow-cli 0.1.0 → 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 CHANGED
@@ -70,7 +70,7 @@ npm run smoke
70
70
  npm run pack:dry-run
71
71
  ```
72
72
 
73
- Run the full Web/Core-backed smoke when a token and app are available:
73
+ Run the full Web-backed smoke when a token and app are available:
74
74
 
75
75
  ```bash
76
76
  DEEPFLOW_CLI_E2E_TOKEN=<dfpat_token> \
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## 背景
4
4
 
5
- DeepFlow 需要提供一种面向外部系统的调用方式,但外部调用方不应直接耦合 Web/Core HTTP API 细节。CLI 作为稳定入口,对外暴露“方法”语义:调用方执行 `deepflow <method>`,CLI 负责读取配置、鉴权、请求 DeepFlow Web API、处理响应和输出结构化结果。
5
+ DeepFlow 需要提供一种面向外部系统的调用方式,但外部调用方不应直接耦合 Web API 细节或 Core 内部标识。CLI 作为稳定入口,对外暴露“方法”语义:调用方执行 `deepflow <method>`,CLI 负责读取配置、鉴权、请求 DeepFlow Web API、处理响应和输出结构化结果。
6
6
 
7
7
  首版目标是支持外部创建一个迭代并启动 Plan,后续再逐步扩展查询、停止、继续执行、获取结果等能力。
8
8
 
@@ -204,13 +204,12 @@ deepflow plan run --repo <repo_id_or_app_code> --name "Demo Iteration" --context
204
204
  "ok": true,
205
205
  "method": "plan.run",
206
206
  "iterationId": "local-iteration-id",
207
- "backendIterationId": "backend-iteration-id",
208
207
  "planSessionId": "session-id",
209
208
  "runId": "run-id",
210
- "uiUrl": "http://localhost:3100/iterations/backend-iteration-id/plan?sessionId=session-id",
209
+ "uiUrl": "http://localhost:3100/iterations/local-iteration-id/plan?sessionId=session-id",
211
210
  "statusUrl": "http://localhost:3100/api/local/sessions/session-id?iterationId=local-iteration-id",
212
- "messagesUrl": "http://localhost:3100/api/sessions/session-id/messages?iteration_id=backend-iteration-id",
213
- "stopUrl": "http://localhost:3100/api/sessions/session-id/stop?iteration_id=backend-iteration-id"
211
+ "messagesUrl": "http://localhost:3100/api/local/sessions/session-id/messages?iterationId=local-iteration-id",
212
+ "stopUrl": "http://localhost:3100/api/local/sessions/session-id/stop?iterationId=local-iteration-id"
214
213
  }
215
214
  ```
216
215
 
@@ -355,7 +354,7 @@ DeepFlowCli/
355
354
  - 统一错误转换
356
355
  5. 实现 `deepflow plan run`,返回 `statusUrl` / `messagesUrl` / `stopUrl`。
357
356
  6. 增加 `--json` 输出和退出码。
358
- 7. 补单元测试、本地 smoke 和可选 Web/Core e2e smoke。
357
+ 7. 补单元测试、本地 smoke 和可选 Web e2e smoke。
359
358
 
360
359
  ## 待确认问题
361
360
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@metagptx/deepflow-cli",
3
- "version": "0.1.0",
3
+ "version": "0.1.1",
4
4
  "description": "Command line interface for DeepFlow external automation.",
5
5
  "license": "UNLICENSED",
6
6
  "type": "module",
package/src/args.js CHANGED
@@ -4,7 +4,6 @@ const VALUE_FLAGS = new Set([
4
4
  "base-url",
5
5
  "baseUrl",
6
6
  "base-branch",
7
- "backend-iteration",
8
7
  "context",
9
8
  "context-file",
10
9
  "fast-timeout",
@@ -45,7 +44,6 @@ const LONG_ALIASES = new Map([
45
44
  ["--base-url", "base-url"],
46
45
  ["--baseUrl", "baseUrl"],
47
46
  ["--base-branch", "base-branch"],
48
- ["--backend-iteration", "backend-iteration"],
49
47
  ["--context", "context"],
50
48
  ["--context-file", "context-file"],
51
49
  ["--fast-timeout", "fast-timeout"],
package/src/cli.js CHANGED
@@ -42,8 +42,8 @@ Usage:
42
42
  deepflow apps list [--json]
43
43
  deepflow plan run --repo <repo_id_or_app_code> [--name <name>] [--context <text>] [--prompt <text>] [--json]
44
44
  deepflow plan status --iteration <local_iteration_id> --session <session_id> [--json]
45
- deepflow session messages --backend-iteration <backend_iteration_id> --session <session_id> [--json]
46
- deepflow session stop --backend-iteration <backend_iteration_id> --session <session_id> [--json]
45
+ deepflow session messages --iteration <local_iteration_id> --session <session_id> [--json]
46
+ deepflow session stop --iteration <local_iteration_id> --session <session_id> [--json]
47
47
 
48
48
  Global options:
49
49
  --base-url <url> DeepFlow Web URL. Default: http://localhost:3100
@@ -154,15 +154,13 @@ function buildRepoBranches(repoRef, flags) {
154
154
  }
155
155
 
156
156
  function buildUiUrl(baseUrl, iteration, sessionId) {
157
- const routeId = iteration.backendIterationId || iteration.id;
158
- const path = `/iterations/${encodeURIComponent(routeId)}/plan?sessionId=${encodeURIComponent(sessionId)}`;
157
+ const path = `/iterations/${encodeURIComponent(iteration.id)}/plan?sessionId=${encodeURIComponent(sessionId)}`;
159
158
 
160
159
  return new URL(path, baseUrl).toString();
161
160
  }
162
161
 
163
162
  function buildSessionLinks(baseUrl, {
164
163
  localIterationId,
165
- backendIterationId,
166
164
  sessionId,
167
165
  }) {
168
166
  return {
@@ -171,11 +169,11 @@ function buildSessionLinks(baseUrl, {
171
169
  sessionId,
172
170
  }),
173
171
  messagesUrl: buildSessionMessagesUrl(baseUrl, {
174
- backendIterationId,
172
+ localIterationId,
175
173
  sessionId,
176
174
  }),
177
175
  stopUrl: buildSessionStopUrl(baseUrl, {
178
- backendIterationId,
176
+ localIterationId,
179
177
  sessionId,
180
178
  }),
181
179
  };
@@ -350,7 +348,6 @@ async function runPlanRun(flags, env) {
350
348
  });
351
349
  const links = buildSessionLinks(reachableBaseUrl, {
352
350
  localIterationId: iteration.id,
353
- backendIterationId: iteration.backendIterationId,
354
351
  sessionId: session.session_id,
355
352
  });
356
353
 
@@ -359,7 +356,6 @@ async function runPlanRun(flags, env) {
359
356
  method: "plan.run",
360
357
  baseUrl: reachableBaseUrl,
361
358
  iterationId: iteration.id,
362
- backendIterationId: iteration.backendIterationId,
363
359
  iterationName: iteration.name,
364
360
  repoId,
365
361
  planSessionId: session.session_id,
@@ -395,21 +391,14 @@ async function runPlanStatus(flags, env) {
395
391
 
396
392
  async function runSessionMessages(flags, env) {
397
393
  const sessionId = requireOption(flags, "session", "--session <session_id> is required.");
398
- const backendIterationId = flags.backendIteration || flags.iteration;
399
-
400
- if (!backendIterationId) {
401
- throw new CliError("--backend-iteration <backend_iteration_id> is required.", {
402
- code: "missing_argument",
403
- exitCode: 2,
404
- });
405
- }
394
+ const localIterationId = requireOption(flags, "iteration", "--iteration <local_iteration_id> is required.");
406
395
 
407
396
  const runtimeConfig = await resolveRuntimeConfig(flags, env);
408
397
  requireToken(runtimeConfig.token);
409
398
  const client = makeClient(runtimeConfig, flags);
410
399
  const reachableBaseUrl = await resolveReachableBaseUrl(client);
411
400
  const messages = await client.listMessages({
412
- backendIterationId,
401
+ localIterationId,
413
402
  sessionId,
414
403
  });
415
404
 
@@ -417,7 +406,7 @@ async function runSessionMessages(flags, env) {
417
406
  ok: true,
418
407
  method: "session.messages",
419
408
  baseUrl: reachableBaseUrl,
420
- backendIterationId,
409
+ iterationId: localIterationId,
421
410
  sessionId,
422
411
  messages,
423
412
  };
@@ -425,21 +414,14 @@ async function runSessionMessages(flags, env) {
425
414
 
426
415
  async function runSessionStop(flags, env) {
427
416
  const sessionId = requireOption(flags, "session", "--session <session_id> is required.");
428
- const backendIterationId = flags.backendIteration || flags.iteration;
429
-
430
- if (!backendIterationId) {
431
- throw new CliError("--backend-iteration <backend_iteration_id> is required.", {
432
- code: "missing_argument",
433
- exitCode: 2,
434
- });
435
- }
417
+ const localIterationId = requireOption(flags, "iteration", "--iteration <local_iteration_id> is required.");
436
418
 
437
419
  const runtimeConfig = await resolveRuntimeConfig(flags, env);
438
420
  requireToken(runtimeConfig.token);
439
421
  const client = makeClient(runtimeConfig, flags);
440
422
  const reachableBaseUrl = await resolveReachableBaseUrl(client);
441
423
  const response = await client.stopSession({
442
- backendIterationId,
424
+ localIterationId,
443
425
  sessionId,
444
426
  });
445
427
 
@@ -447,7 +429,7 @@ async function runSessionStop(flags, env) {
447
429
  ok: true,
448
430
  method: "session.stop",
449
431
  baseUrl: reachableBaseUrl,
450
- backendIterationId,
432
+ iterationId: localIterationId,
451
433
  sessionId,
452
434
  response,
453
435
  };
package/src/client.js CHANGED
@@ -216,11 +216,11 @@ export class DeepFlowClient {
216
216
  }
217
217
 
218
218
  async listMessages({
219
- backendIterationId,
219
+ localIterationId,
220
220
  sessionId,
221
221
  }) {
222
222
  return this.request(
223
- `/api/sessions/${encodeURIComponent(sessionId)}/messages?iteration_id=${encodeURIComponent(backendIterationId)}`,
223
+ `/api/local/sessions/${encodeURIComponent(sessionId)}/messages?iterationId=${encodeURIComponent(localIterationId)}`,
224
224
  {
225
225
  timeoutMs: this.fastTimeoutMs,
226
226
  auditMethod: "session.messages",
@@ -229,11 +229,11 @@ export class DeepFlowClient {
229
229
  }
230
230
 
231
231
  async stopSession({
232
- backendIterationId,
232
+ localIterationId,
233
233
  sessionId,
234
234
  }) {
235
235
  return this.request(
236
- `/api/sessions/${encodeURIComponent(sessionId)}/stop?iteration_id=${encodeURIComponent(backendIterationId)}`,
236
+ `/api/local/sessions/${encodeURIComponent(sessionId)}/stop?iterationId=${encodeURIComponent(localIterationId)}`,
237
237
  {
238
238
  method: "POST",
239
239
  timeoutMs: this.fastTimeoutMs,
@@ -254,21 +254,21 @@ export function buildPlanStatusUrl(baseUrl, {
254
254
  }
255
255
 
256
256
  export function buildSessionMessagesUrl(baseUrl, {
257
- backendIterationId,
257
+ localIterationId,
258
258
  sessionId,
259
259
  }) {
260
260
  return new URL(
261
- `/api/sessions/${encodeURIComponent(sessionId)}/messages?iteration_id=${encodeURIComponent(backendIterationId)}`,
261
+ `/api/local/sessions/${encodeURIComponent(sessionId)}/messages?iterationId=${encodeURIComponent(localIterationId)}`,
262
262
  baseUrl,
263
263
  ).toString();
264
264
  }
265
265
 
266
266
  export function buildSessionStopUrl(baseUrl, {
267
- backendIterationId,
267
+ localIterationId,
268
268
  sessionId,
269
269
  }) {
270
270
  return new URL(
271
- `/api/sessions/${encodeURIComponent(sessionId)}/stop?iteration_id=${encodeURIComponent(backendIterationId)}`,
271
+ `/api/local/sessions/${encodeURIComponent(sessionId)}/stop?iterationId=${encodeURIComponent(localIterationId)}`,
272
272
  baseUrl,
273
273
  ).toString();
274
274
  }
package/src/output.js CHANGED
@@ -40,7 +40,6 @@ export function writeResult(io, result, { json = false } = {}) {
40
40
  case "plan.run":
41
41
  io.stdout.write("Plan run started.\n");
42
42
  io.stdout.write(`Iteration: ${result.iterationId}\n`);
43
- io.stdout.write(`Backend iteration: ${result.backendIterationId}\n`);
44
43
  io.stdout.write(`Plan session: ${result.planSessionId}\n`);
45
44
  if (result.runId) {
46
45
  io.stdout.write(`Run: ${result.runId}\n`);