@fieldwangai/agentflow 0.1.142 → 0.1.143

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.
@@ -15,7 +15,7 @@
15
15
  href="https://fonts.googleapis.com/css2?family=Material+Symbols+Outlined:opsz,wght,FILL,GRAD@24,400,0,0"
16
16
  rel="stylesheet"
17
17
  />
18
- <script type="module" crossorigin src="/assets/index-pLsH0Uyj.js"></script>
18
+ <script type="module" crossorigin src="/assets/index-c8AUUsSF.js"></script>
19
19
  <link rel="stylesheet" crossorigin href="/assets/index-CtG65J3e.css">
20
20
  </head>
21
21
  <body>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fieldwangai/agentflow",
3
- "version": "0.1.142",
3
+ "version": "0.1.143",
4
4
  "description": "Orchestration system for long-running complex agent tasks using Cursor, OpenCode, Claude Code, or Codex as execution backends",
5
5
  "type": "module",
6
6
  "main": "bin/agentflow.mjs",
@@ -124,6 +124,11 @@ The reusable transport lives in `scripts/workflow-report-client.mjs`. The CLI ex
124
124
 
125
125
  Every write requires the real business adapter `source`. Put the key-level `expectedVersions` map in the JSON file; use `absent` for a new resource key. `--expected-revision` is retained only for legacy whole-Workflow locking and should not be used by new integrations.
126
126
 
127
+ The only admin write exception is audited version-membership repair. Read its strict revision with
128
+ `workflow-get --runtime-only --admin-operation repair-version-membership`, then send the matching
129
+ `workflow-report --admin-operation repair-version-membership` request as defined by
130
+ `agentflow-workflow-report`. This flag does not grant general Workflow read or write access.
131
+
127
132
  ## Workflow
128
133
 
129
134
  1. Check token availability with `config`.
@@ -41,9 +41,9 @@ Commands:
41
41
  logs --run-id <id>
42
42
  display-outputs --flow-id <id> [--flow-source user]
43
43
  sync-workspace --workspace <id>
44
- workflow-get --workflow tapd:<id> [--flow-id <id>] [--runtime-only]
44
+ workflow-get --workflow tapd:<id> [--flow-id <id>] [--runtime-only] [--admin-operation repair-version-membership]
45
45
  workflow-access-sync --workflow tapd:<id> --file <access.json>
46
- workflow-report --workflow tapd:<id> --file <report.json> [--source <adapter>] [--expected-revision <revision>] [--idempotency-key <key>]
46
+ workflow-report --workflow tapd:<id> --file <report.json> [--source <adapter>] [--expected-revision <revision>] [--idempotency-key <key>] [--admin-operation repair-version-membership]
47
47
  workflow-artifact-publish --workflow tapd:<id> --file <artifact.json> [--source <adapter>] [--expected-revision <revision>] [--idempotency-key <key>]
48
48
  `;
49
49
  }
@@ -390,12 +390,14 @@ async function main() {
390
390
  const flowId = option(args, "flow-id") || option(args, "flow");
391
391
  const flowSource = option(args, "flow-source") || "user";
392
392
  const runtimeOnly = args["runtime-only"] === true || args.cached === true ? "1" : "";
393
+ const adminOperation = option(args, "admin-operation") || "";
393
394
  const client = createWorkflowReportClient({ baseUrl: normalizedBaseUrl(args), token: authToken(args) });
394
395
  printJson(await client.getState({
395
396
  workflow: workflow.key,
396
397
  flowId,
397
398
  flowSource,
398
399
  runtimeOnly: runtimeOnly === "1",
400
+ adminOperation,
399
401
  }));
400
402
  return;
401
403
  }
@@ -412,11 +414,13 @@ async function main() {
412
414
  const expectedRevision = option(args, "expected-revision");
413
415
  const idempotencyKey = option(args, "idempotency-key");
414
416
  const reportSource = option(args, "source");
417
+ const adminOperation = option(args, "admin-operation");
415
418
  const flowId = option(args, "flow-id") || option(args, "flow");
416
419
  const flowSource = option(args, "flow-source");
417
420
  if (expectedRevision) body.expectedRevision = expectedRevision;
418
421
  if (idempotencyKey) body.idempotencyKey = idempotencyKey;
419
422
  if (reportSource) body.source = reportSource;
423
+ if (adminOperation) body.adminOperation = adminOperation;
420
424
  if (!String(body.source || "").trim()) throw new Error("Missing Workflow report source. Pass --source <adapter> or include source in the JSON file.");
421
425
  if (flowId) body.flowId = flowId;
422
426
  if (flowSource) body.flowSource = flowSource;
@@ -50,12 +50,13 @@ export function createWorkflowReportClient({ baseUrl, token, fetchImpl = globalT
50
50
  };
51
51
 
52
52
  return {
53
- getState({ workflow, flowId = "", flowSource = "user", runtimeOnly = false } = {}) {
53
+ getState({ workflow, flowId = "", flowSource = "user", runtimeOnly = false, adminOperation = "" } = {}) {
54
54
  return request(`/api/workflows/state${workflowQuery({
55
55
  workflow,
56
56
  flowId,
57
57
  flowSource,
58
58
  runtimeOnly: runtimeOnly ? "1" : "",
59
+ adminOperation,
59
60
  })}`);
60
61
  },
61
62
  syncAccess(body = {}) {
@@ -91,6 +91,8 @@ For local Markdown or other content that must become a browser URL, publish it f
91
91
 
92
92
  - Treat TAPD personnel as derived authority when the Adapter can read them: TAPD Owner maps to Workflow Owner and registered TAPD participants map to Viewer.
93
93
  - Keep explicit grants separate from derived TAPD membership. Allow Owner and explicit Reporter writes. Treat TAPD participant Viewer, explicit Viewer, same-team Viewer, share-link Viewer, and ordinary admin review as read-only. The only admin write exception is an explicit audited `adminOperation=repair-version-membership` Report containing only `kind=version` timeline projections, with required `expectedRevision` and `idempotencyKey`; it must never admit Action, Artifact, Observation, GlobalState, Extension, Checklist, or non-version projection writes. Accept legacy `editor` only as a compatibility alias for Reporter.
94
+ - An admin obtaining the strict revision for that repair must explicitly read state with
95
+ `adminOperation=repair-version-membership` (CLI: `workflow-get --runtime-only --admin-operation repair-version-membership`). The server resolves only that read as `admin-version-repair`; it does not grant ordinary admin CLI access to unrelated Workflows.
94
96
  - `observation.state` replaces the complete previous observation for the same `clientId`.
95
97
  - `globalState.patch` recursively merges objects; arrays and scalars replace; `null` and `remove` delete explicit paths. The first reporting source to write a path owns it; another source cannot overwrite an owned path.
96
98
  - Reusing an `action.key` updates the same semantic stage. Do not create a new key for refreshes or retries.
@@ -240,12 +240,20 @@ GET /api/workflows/state?workflow=tapd%3A1020124&runtimeOnly=1
240
240
  Authorization: Bearer <AGENTFLOW_TOKEN>
241
241
  ```
242
242
 
243
+ 管理员为版本归属修复读取严格锁时,必须显式声明同一受限意图:
244
+
245
+ ```http
246
+ GET /api/workflows/state?workflow=tapd%3A1013667&runtimeOnly=1&adminOperation=repair-version-membership
247
+ Authorization: Bearer <AGENTFLOW_TOKEN>
248
+ ```
249
+
243
250
  | Query 参数 | 类型 | 必填 | 含义 |
244
251
  | --- | --- | --- | --- |
245
252
  | `workflow` | string | 与 namespace/id 二选一 | 规范 key,例如 `tapd:1020124` |
246
253
  | `namespace` | string | 与 workflow 二选一 | 当前仅支持 `tapd` |
247
254
  | `id` | string | 与 workflow 二选一 | TAPD short ID |
248
255
  | `runtimeOnly` | `0 \| 1` | 否 | `1` 只读取已保存运行态,不主动刷新上游;CLI 的 `--runtime-only` 使用它 |
256
+ | `adminOperation` | string | 管理员版本修复时必填 | 仅 `repair-version-membership`;只授予取得严格锁所需的受限读取,不授予普通 Workflow 写权限;服务端强制按 runtime-only 读取 |
249
257
  | `flowId` | string | 否 | 关联 AgentFlow 项目时指定项目 ID |
250
258
  | `flowSource` | string | 否 | 项目来源,默认 `user` |
251
259
  | `workspaceId` | string | 否 | 项目工作区上下文 |
@@ -353,14 +361,15 @@ Authorization: Bearer <AGENTFLOW_TOKEN>
353
361
  "projections": {
354
362
  "timeline": [{
355
363
  "kind": "version",
356
- "id": "1013667",
364
+ "id": "1133202860001000338",
365
+ "key": "prd-flow:tapd-current-version:1133202860001000338",
357
366
  "title": "Likee Android&iOS V5.63",
358
367
  "date": "2026-08-11",
359
368
  "source": "prd-flow"
360
369
  }]
361
370
  },
362
371
  "expectedRevision": "runtime:<revision-from-get>",
363
- "idempotencyKey": "admin-version-repair:1013667:v563"
372
+ "idempotencyKey": "admin-version-repair:1013667:version-1133202860001000338"
364
373
  }
365
374
  ```
366
375
 
@@ -708,7 +717,7 @@ timeline-membership:tapd-1020124:version-1133202860001000338:v1
708
717
  ### 10.5 管理员修复版本归属
709
718
 
710
719
  1. 仅在批量治理版本归属时使用;普通业务状态仍由 Owner/Reporter 上报。
711
- 2. 管理员 GET 当前 Workflow,人工或程序核对目标版本并保存 `runtimeRevision`。
720
+ 2. 管理员使用 `adminOperation=repair-version-membership` GET 当前 Workflow,人工或程序核对目标版本自身的稳定 ID,并保存 `runtimeRevision`;不得把 TAPD 需求 ID 当作版本 ID。
712
721
  3. 发送只含 `kind=version` timeline 的 `repair-version-membership` 请求。
713
722
  4. 验证响应包含 `administrativeRepair`,事件 actor 是操作管理员,且非版本/其他 source 投影未变化。
714
723
  5. `409` 时重新读取、重新核对并只重试一次;不得绕过严格锁。
@@ -748,7 +757,7 @@ prd-flow 只是一个接入实现,不是协议依赖:
748
757
  - Action 下能看到稳定 key 的 MR、构建或测试产物。
749
758
  - Markdown Publish 返回可访问 URL,但不会推进业务状态。
750
759
  - 版本改名/改期不产生新迭代节点,版本切换不会删除第三方 Sprint。
751
- - 管理员版本归属修复只能改 `kind=version` 投影,要求 runtimeRevision/幂等键并留下管理员 actor 审计;普通 Report 仍返回 403。
760
+ - 管理员只有显式携带版本修复意图时才能 GET 当前 runtimeRevision;修复只能改 `kind=version` 投影,要求 runtimeRevision/幂等键并留下管理员 actor 审计;无意图读取与普通 Report 仍返回 403。
752
761
  - 自定义 extension 能保存;注册渲染器后能显示对应文档区 / Issue 区。
753
762
  - 不同资源 key 可并发更新;同 key 旧版本返回包含具体 `resourceKey` 的 409。
754
763
  - 409 会触发一次 key 级 read → re-merge → retry,且失败请求不会部分落库。