@fieldwangai/agentflow 0.1.160 → 0.1.163

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 (111) hide show
  1. package/bin/lib/auth.mjs +231 -14
  2. package/bin/lib/catalog-flows.mjs +2 -0
  3. package/bin/lib/cli-auth-page.mjs +103 -0
  4. package/bin/lib/flow-dsl/codegen.mjs +23 -2
  5. package/bin/lib/flow-dsl/lint.mjs +44 -0
  6. package/bin/lib/flow-dsl/parser.mjs +68 -1
  7. package/bin/lib/marketplace-usage.mjs +218 -0
  8. package/bin/lib/marketplace.mjs +183 -3
  9. package/bin/lib/node-package-manifest.mjs +1 -1
  10. package/bin/lib/skill-runtime.mjs +6 -0
  11. package/bin/lib/spaces.mjs +200 -0
  12. package/bin/lib/table.mjs +2 -3
  13. package/bin/lib/ui-server.mjs +471 -84
  14. package/bin/lib/workspace-draft.mjs +74 -0
  15. package/bin/lib/workspace-routes.mjs +484 -4
  16. package/bin/lib/workspace-server.mjs +373 -30
  17. package/bin/lib/workspace-state.mjs +2 -1
  18. package/builtin/nodes/agent_subAgent.md +5 -1
  19. package/builtin/nodes/context_bundle.md +44 -0
  20. package/builtin/nodes/context_knowledge.md +29 -0
  21. package/builtin/nodes/context_skills.md +29 -0
  22. package/builtin/nodes/context_workspace.md +36 -0
  23. package/builtin/nodes/control_while.md +12 -5
  24. package/builtin/nodes/tool_git_worktree_load.md +4 -3
  25. package/builtin/pipelines/new/workspace.flow.js +1 -1
  26. package/builtin/web-ui/dist/assets/{WorkflowAssistantThread-Bfo9Ythw.js → WorkflowAssistantThread-DmhIgoD7.js} +1 -1
  27. package/builtin/web-ui/dist/assets/index-CI9J6Unt.js +873 -0
  28. package/builtin/web-ui/dist/assets/index-DY5vE7v1.css +1 -0
  29. package/builtin/web-ui/dist/index.html +2 -2
  30. package/package.json +5 -1
  31. package/shared/slot-types.js +1 -0
  32. package/skills/agentflow-author-flow/SKILL.md +81 -8
  33. package/skills/agentflow-author-flow/agents/openai.yaml +3 -3
  34. package/skills/agentflow-cli/SKILL.md +179 -27
  35. package/skills/agentflow-cli/agents/openai.yaml +2 -2
  36. package/skills/agentflow-cli/runtime/bin/lib/skill-runtime.mjs +14879 -0
  37. package/skills/agentflow-cli/runtime/builtin/nodes/agent_subAgent.md +38 -0
  38. package/skills/agentflow-cli/runtime/builtin/nodes/context_bundle.md +44 -0
  39. package/skills/agentflow-cli/runtime/builtin/nodes/context_knowledge.md +29 -0
  40. package/skills/agentflow-cli/runtime/builtin/nodes/context_skills.md +29 -0
  41. package/skills/agentflow-cli/runtime/builtin/nodes/context_workspace.md +36 -0
  42. package/skills/agentflow-cli/runtime/builtin/nodes/control_agent_toBool.md +26 -0
  43. package/skills/agentflow-cli/runtime/builtin/nodes/control_anyOne.md +19 -0
  44. package/skills/agentflow-cli/runtime/builtin/nodes/control_cancelled.md +26 -0
  45. package/skills/agentflow-cli/runtime/builtin/nodes/control_cd_workspace.md +50 -0
  46. package/skills/agentflow-cli/runtime/builtin/nodes/control_delay.md +31 -0
  47. package/skills/agentflow-cli/runtime/builtin/nodes/control_end.md +13 -0
  48. package/skills/agentflow-cli/runtime/builtin/nodes/control_if.md +21 -0
  49. package/skills/agentflow-cli/runtime/builtin/nodes/control_interval_loop.md +55 -0
  50. package/skills/agentflow-cli/runtime/builtin/nodes/control_load_mcp.md +24 -0
  51. package/skills/agentflow-cli/runtime/builtin/nodes/control_load_skills.md +35 -0
  52. package/skills/agentflow-cli/runtime/builtin/nodes/control_parse_json.md +25 -0
  53. package/skills/agentflow-cli/runtime/builtin/nodes/control_start.md +13 -0
  54. package/skills/agentflow-cli/runtime/builtin/nodes/control_subflow_call.md +27 -0
  55. package/skills/agentflow-cli/runtime/builtin/nodes/control_toBool.md +27 -0
  56. package/skills/agentflow-cli/runtime/builtin/nodes/control_user_workspace.md +24 -0
  57. package/skills/agentflow-cli/runtime/builtin/nodes/control_wait_until.md +34 -0
  58. package/skills/agentflow-cli/runtime/builtin/nodes/control_while.md +131 -0
  59. package/skills/agentflow-cli/runtime/builtin/nodes/display_ascii.md +24 -0
  60. package/skills/agentflow-cli/runtime/builtin/nodes/display_chart.md +32 -0
  61. package/skills/agentflow-cli/runtime/builtin/nodes/display_code.md +39 -0
  62. package/skills/agentflow-cli/runtime/builtin/nodes/display_html.md +32 -0
  63. package/skills/agentflow-cli/runtime/builtin/nodes/display_image.md +36 -0
  64. package/skills/agentflow-cli/runtime/builtin/nodes/display_markdown.md +24 -0
  65. package/skills/agentflow-cli/runtime/builtin/nodes/display_mermaid.md +24 -0
  66. package/skills/agentflow-cli/runtime/builtin/nodes/display_react_app.md +53 -0
  67. package/skills/agentflow-cli/runtime/builtin/nodes/display_table.md +32 -0
  68. package/skills/agentflow-cli/runtime/builtin/nodes/provide_bool.md +14 -0
  69. package/skills/agentflow-cli/runtime/builtin/nodes/provide_file.md +14 -0
  70. package/skills/agentflow-cli/runtime/builtin/nodes/provide_json.md +14 -0
  71. package/skills/agentflow-cli/runtime/builtin/nodes/provide_password.md +14 -0
  72. package/skills/agentflow-cli/runtime/builtin/nodes/provide_str.md +14 -0
  73. package/skills/agentflow-cli/runtime/builtin/nodes/tool_display_share_link.md +47 -0
  74. package/skills/agentflow-cli/runtime/builtin/nodes/tool_get_env.md +20 -0
  75. package/skills/agentflow-cli/runtime/builtin/nodes/tool_git_checkout.md +70 -0
  76. package/skills/agentflow-cli/runtime/builtin/nodes/tool_git_worktree_load.md +74 -0
  77. package/skills/agentflow-cli/runtime/builtin/nodes/tool_git_worktree_unload.md +52 -0
  78. package/skills/agentflow-cli/runtime/builtin/nodes/tool_gitlab_create_mr.md +114 -0
  79. package/skills/agentflow-cli/runtime/builtin/nodes/tool_jenkins_build.md +67 -0
  80. package/skills/agentflow-cli/runtime/builtin/nodes/tool_load_key.md +26 -0
  81. package/skills/agentflow-cli/runtime/builtin/nodes/tool_nodejs.md +52 -0
  82. package/skills/agentflow-cli/runtime/builtin/nodes/tool_print.md +21 -0
  83. package/skills/agentflow-cli/runtime/builtin/nodes/tool_save_key.md +26 -0
  84. package/skills/agentflow-cli/runtime/builtin/nodes/tool_set_run_env.md +38 -0
  85. package/skills/agentflow-cli/runtime/builtin/nodes/tool_user_ask.md +27 -0
  86. package/skills/agentflow-cli/runtime/builtin/nodes/tool_user_check.md +26 -0
  87. package/skills/agentflow-cli/runtime/builtin/nodes/tool_wecom_send_app_markdown.md +57 -0
  88. package/skills/agentflow-cli/runtime/builtin/nodes/tool_wecom_send_group_markdown.md +45 -0
  89. package/skills/agentflow-cli/runtime/builtin/nodes/workspace_one_click_task.md +44 -0
  90. package/skills/agentflow-cli/runtime/builtin/nodes/workspace_run.md +16 -0
  91. package/skills/agentflow-cli/runtime/builtin/nodes/workspace_scheduled_run.md +16 -0
  92. package/skills/agentflow-cli/runtime/builtin/nodes/workspace_subflow_input.md +14 -0
  93. package/skills/agentflow-cli/runtime/package.json +6 -0
  94. package/skills/agentflow-cli/scripts/agentflow-auth-store.mjs +113 -0
  95. package/skills/agentflow-cli/scripts/agentflow-cli.mjs +457 -28
  96. package/skills/agentflow-cli/scripts/agentflow-runtime.mjs +11 -4
  97. package/skills/agentflow-flow-add-instances/SKILL.md +2 -2
  98. package/skills/agentflow-flow-dsl/SKILL.md +73 -8
  99. package/skills/agentflow-flow-dsl/agents/openai.yaml +2 -2
  100. package/skills/agentflow-flow-dsl/references/node-calls.md +6 -2
  101. package/skills/agentflow-flow-dsl/references/subflow-authoring.md +34 -7
  102. package/skills/agentflow-flow-edit-node-fields/SKILL.md +3 -3
  103. package/skills/agentflow-flow-recipes/SKILL.md +1 -1
  104. package/skills/agentflow-flow-recipes/references/recipes.md +1 -2
  105. package/skills/agentflow-flow-sync-ui/SKILL.md +1 -1
  106. package/skills/agentflow-node-dsl/SKILL.md +5 -13
  107. package/skills/agentflow-node-reference/references/builtin-nodes.md +37 -5
  108. package/skills/agentflow-workspace-markdown/SKILL.md +1 -1
  109. package/builtin/web-ui/dist/assets/index-XbeI5foV.js +0 -872
  110. package/builtin/web-ui/dist/assets/index-e1omCEau.css +0 -1
  111. package/skills/agentflow-workspace-graph/SKILL.md +0 -85
@@ -30,8 +30,8 @@
30
30
  @keyframes af-app-loading-slide { from { transform: translateX(-115%); } to { transform: translateX(250%); } }
31
31
  @media (prefers-reduced-motion: reduce) { .af-app-loading__track span { width: 100%; animation: none; } }
32
32
  </style>
33
- <script type="module" crossorigin src="/assets/index-XbeI5foV.js"></script>
34
- <link rel="stylesheet" crossorigin href="/assets/index-e1omCEau.css">
33
+ <script type="module" crossorigin src="/assets/index-CI9J6Unt.js"></script>
34
+ <link rel="stylesheet" crossorigin href="/assets/index-DY5vE7v1.css">
35
35
  </head>
36
36
  <body>
37
37
  <div id="root">
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@fieldwangai/agentflow",
3
- "version": "0.1.160",
3
+ "version": "0.1.163",
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",
@@ -50,6 +50,7 @@
50
50
  "test": "node --test test/*.test.mjs",
51
51
  "postinstall": "node bin/ensure-workspace-reference.mjs",
52
52
  "build:web-ui": "cd builtin/web-ui && npm install && npm run build",
53
+ "build:agentflow-cli-skill-runtime": "node scripts/build-agentflow-cli-skill-runtime.mjs",
53
54
  "build:website": "cd website && npm install && npm run build",
54
55
  "dev": "AGENTFLOW_DEV=1 node bin/agentflow.mjs ui",
55
56
  "dev:web": "cd builtin/web-ui && npm run dev",
@@ -69,5 +70,8 @@
69
70
  "ora": "^9.3.0",
70
71
  "sharp": "^0.34.5",
71
72
  "update-notifier": "^7.0.0"
73
+ },
74
+ "devDependencies": {
75
+ "esbuild": "^0.28.2"
72
76
  }
73
77
  }
@@ -28,6 +28,7 @@ export const SLOT_TYPE_COLORS = Object.freeze({
28
28
  node: "#ff9800",
29
29
  bool: "#9c27b0",
30
30
  json: "#00bcd4",
31
+ context: "#7c5cff",
31
32
  image: "#ec407a",
32
33
  any: "#9e9e9e",
33
34
  });
@@ -1,16 +1,89 @@
1
1
  ---
2
2
  name: agentflow-author-flow
3
- description: Legacy Pipeline authoring is retired. Redirect new AgentFlow creation and editing requests to the Workspace Graph skill and server-side Workspace preview.
3
+ description: Create an AgentFlow from a user's idea, iterate in a private runnable Draft Workspace, show the preview URL, test and inspect outputs, then publish the approved graph and explicitly configure Scheduled Run activation. Use for end-to-end requests such as “创建一个流程”, “给我 Preview”, “试运行并动态修改”, “发布这个 Flow”, “配置定时运行”, “make a temporary flow”, or “run it on a schedule”.
4
4
  ---
5
5
 
6
- # Legacy Pipeline Authoring(已下线)
6
+ # AgentFlow Flow Lifecycle
7
7
 
8
- 旧的 Flow/Pipeline (`flow.yaml` + `control_start/control_end`) 执行功能已经下线。此 skill 不再创建、发布或执行新的 Pipeline。
8
+ Orchestrate the complete authoring lifecycle. Use `agentflow-flow-dsl` for graph structure,
9
+ `agentflow-node-dsl` when deterministic custom code is needed, and `agentflow-cli` for Draft,
10
+ execution, publication, and schedule operations. Read those selected Skills completely before acting.
9
11
 
10
- 新任务统一使用:
12
+ ## Required lifecycle
11
13
 
12
- - `agentflow-workspace-graph`:创建或修改 `workspace.flow.js`
13
- - `agentflow-cli workspace-preview`:上传到服务器临时 Workspace,打开所见即所得画布
14
- - Workspace 页面中的 `Run` / `Scheduled Run`:执行 Workspace
14
+ 1. Check `agentflow-cli config`. Require authorization and `localRuntime.available: true`. If
15
+ authorization is missing, run `agentflow-cli auth start`, return the URL to the user, and run
16
+ `auth complete` after approval; never ask the user to paste a personal Token. The Runtime is
17
+ bundled with the Skill; if unavailable, update/reinstall the SkillHub package instead of
18
+ installing an npm CLI.
19
+ 2. Translate the user's idea into a local `workspace.flow.js`. Search the remote node catalog before
20
+ creating a custom node package.
21
+ 3. Run DSL lint, then layout. Do not upload an invalid or unreadable graph.
22
+ 4. Create a private runnable Draft:
15
23
 
16
- 历史 `flow.yaml` 仅用于读取、迁移和审计,不得作为新功能的实现目标。不要调用 `agentflow apply`、`/api/flow/run` 或创建 `control_start/control_end`。
24
+ ```bash
25
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs draft-create \
26
+ --file <flowDir> --ttl-seconds 7200
27
+ ```
28
+
29
+ Add `--with-dependencies` when `<flowDir>/nodes/` exists. Return the Draft URL to the user. A Draft
30
+ is hidden from the formal Flow list, writable in the Workspace UI, and runnable. Its Scheduled Run
31
+ nodes are always suppressed and cannot trigger real Cron jobs.
32
+
33
+ 5. Test the intended Run or Scheduled Run entry manually with `draft-run`. Inspect returned display
34
+ outputs; use run status and logs for failures or long-running work. Obtain confirmation before a
35
+ test that calls an external service or has business side effects.
36
+ 6. Keep the revision returned by every Draft mutation. Apply feedback to the same Draft. If the user
37
+ edited in the UI, pull the Draft before changing a stale local DSL:
38
+
39
+ ```bash
40
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs draft-pull \
41
+ --draft-id <draft-id> --output <flowDir> --replace
42
+ ```
43
+
44
+ Then edit locally, lint/layout again, and update against that exact revision:
45
+
46
+ ```bash
47
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs draft-update \
48
+ --draft-id <draft-id> \
49
+ --base-revision <last-revision> \
50
+ --file <flowDir>
51
+ ```
52
+
53
+ On a revision conflict, stop and pull before reapplying the intended change; never overwrite UI
54
+ edits with a stale local graph. Repeat preview and execution until the user accepts the actual
55
+ output. Do not treat lint, Mock data, or a visual-only preview as production-equivalent acceptance.
56
+ 7. Before publication, state the exact Draft ID, target Flow ID, destination, and schedule mode. Wait
57
+ for explicit confirmation. Publication defaults to personal space and scheduling disabled.
58
+ 8. Promote the exact tested Draft:
59
+
60
+ ```bash
61
+ node <agentflow-cli-skill-dir>/scripts/agentflow-cli.mjs draft-publish \
62
+ --draft-id <draft-id> \
63
+ --flow-id <flow-id> \
64
+ --target-space personal \
65
+ --schedule disabled
66
+ ```
67
+
68
+ Use `--schedule enabled` only when the user explicitly wants automatic execution. Promotion is
69
+ create-only; do not replace an existing Flow without a separate explicit decision.
70
+ 9. When scheduling is enabled, verify the returned schedule and run `schedule-list --flow-id
71
+ <flow-id>`. Report it as armed only when `enabled: true`, status is not invalid/error, and
72
+ `nextRunAt` is present. Include Cron, timezone, overlap policy, and next run time in the handoff.
73
+
74
+ ## Schedule changes after publication
75
+
76
+ Use `schedule-enable`, `schedule-disable`, or `schedule-set`; do not republish the whole graph merely
77
+ to flip an operational switch. Use `schedule-run-now` for a manual verification of the scheduled
78
+ entry. Re-read `schedule-list` after every mutation.
79
+
80
+ ## Safety gates
81
+
82
+ - Keep read-only `workspace-preview` for sharing only. It cannot run or save; use a Draft for review
83
+ plus execution.
84
+ - Never activate Draft schedules. Draft configuration is design data only.
85
+ - Do not embed tokens, passwords, cookies, or local absolute paths in DSL or node packages.
86
+ - Do not claim external integrations are ready from Mock execution. Require the user's real account,
87
+ network, credentials, and downstream evidence.
88
+ - If the user requests publication but has not reviewed the Draft output, stop at the Draft and ask
89
+ for confirmation.
@@ -1,4 +1,4 @@
1
1
  interface:
2
- display_name: "AgentFlow Flow Authoring"
3
- short_description: "Generate, preview, confirm, and publish AgentFlow flows"
4
- default_prompt: "Use $agentflow-author-flow to generate a local AgentFlow, open its platform-style preview, and publish it after I confirm."
2
+ display_name: "AgentFlow 流程创作"
3
+ short_description: "创建、预览、试运行、修改、发布并配置定时 Flow"
4
+ default_prompt: "使用 $agentflow-author-flow 把我的想法做成可运行 Draft,和我一起修改;确认后再发布,并按我的选择配置定时运行。"
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: agentflow-cli
3
- description: Direct AgentFlow operation through a bundled token-backed CLI, without MCP. Use when Codex needs to search, publish, install, or synchronize versioned node packages; pull or publish portable Workspace DSL flows; upload previews; run or inspect Workspace graphs; or read logs and display outputs through AgentFlow HTTP APIs using AGENTFLOW_TOKEN from env or .env.
3
+ description: Direct AgentFlow operation through a bundled browser-authorized CLI, without MCP or npm. Use when Codex needs to authorize AgentFlow access, create, update, run, or publish temporary Workspace drafts; search usage-ranked Marketplace Flow templates and nodes; publish, install, privatize, or synchronize versioned resources; pull or publish portable Workspace DSL flows; manage scheduled runs; upload read-only previews; run or inspect Workspace graphs; or read logs and display outputs through AgentFlow HTTP APIs.
4
4
  ---
5
5
 
6
6
  # AgentFlow CLI
@@ -52,21 +52,44 @@ For other SkillHub-supported agents, change the agent name:
52
52
  skillhub install agentflow-cli --global --agent claude-code
53
53
  ```
54
54
 
55
- After installation, configure only the direct API token. Do not add an MCP server for this skill.
55
+ After installation, authorize the CLI through the AgentFlow browser page. Do not add an MCP server for this skill.
56
+ The Skill already includes the version-matched local Runtime used for Workspace DSL parsing,
57
+ lint/layout, and node-package operations. Do not install an npm package or put `agentflow` on
58
+ `PATH`. `AGENTFLOW_PACKAGE_ROOT` and `--agentflow-package-root` are development overrides only.
56
59
 
57
- Install or update the `@fieldwangai/agentflow` CLI as the local runtime and keep `agentflow` on
58
- `PATH`. The bundled skill intentionally does not copy AgentFlow's parser/runtime modules. It locates
59
- the runtime from an explicit `--agentflow-package-root`, `AGENTFLOW_PACKAGE_ROOT`, the current
60
- project's `node_modules`, or the `agentflow` executable on `PATH`.
61
-
62
- Verify both token and runtime discovery before local DSL or node-package work:
60
+ Verify both authorization and runtime discovery before local DSL or node-package work:
63
61
 
64
62
  ```bash
65
63
  node <skill-dir>/scripts/agentflow-cli.mjs config
66
64
  ```
67
65
 
68
- Require `localRuntime.available: true`. Pure remote reporting commands can still run without a local
69
- runtime, but package creation, installation, Flow pull/publish, and Workspace graph parsing cannot.
66
+ Require `localRuntime.available: true`. A normal SkillHub installation resolves
67
+ `<skill-dir>/runtime`; if it does not, reinstall or update `agentflow-cli` from SkillHub rather than
68
+ installing a separate CLI package. Pure remote reporting commands can still run without a local
69
+ Runtime, but package creation, installation, Flow pull/publish, and Workspace graph parsing cannot.
70
+
71
+ ## Browser authorization
72
+
73
+ When `config` reports `hasToken: false`, do not ask the user to paste a token. Start a non-blocking
74
+ authorization and return its `verificationUrl`:
75
+
76
+ ```bash
77
+ node <skill-dir>/scripts/agentflow-cli.mjs auth start
78
+ ```
79
+
80
+ The user opens the URL, logs in to AgentFlow if necessary, reviews the requested access, and clicks
81
+ Allow. After the user says authorization is complete, exchange the pending one-time request:
82
+
83
+ ```bash
84
+ node <skill-dir>/scripts/agentflow-cli.mjs auth complete
85
+ node <skill-dir>/scripts/agentflow-cli.mjs auth status
86
+ ```
87
+
88
+ `auth start` never prints the secret device code. `auth complete` saves a separate CLI credential in
89
+ `~/.agentflow/auth.json` with owner-only permissions; it never copies the browser cookie. Use
90
+ `AGENTFLOW_AUTH_FILE` only for isolated automation or tests. Revoke the CLI Session and clear its
91
+ local profile with `auth logout`. Do not send the authorization URL to anyone except the requesting
92
+ user; although it contains no access token, it represents an active approval request.
70
93
 
71
94
  ## Configuration
72
95
 
@@ -75,10 +98,12 @@ The CLI reads configuration in this order:
75
98
  1. CLI flags: `--base-url`, `--token`
76
99
  2. Environment variables: `AGENTFLOW_BASE_URL`, `AGENTFLOW_TOKEN`, `AGENTFLOW_SESSION_TOKEN`
77
100
  3. Env files: `AGENTFLOW_ENV_FILE`, then `.env`, `.agentflow.env`, then `~/.agentflow.env`
101
+ 4. Browser-authorized profile: `~/.agentflow/auth.json`
78
102
 
79
103
  Default base URL: `http://ai.mengma.bigo.inner/`.
80
104
 
81
- Required token: `AGENTFLOW_TOKEN` or `AGENTFLOW_SESSION_TOKEN`. Never print the token in the final answer or logs.
105
+ For CI or service accounts, `AGENTFLOW_TOKEN` or `AGENTFLOW_SESSION_TOKEN` overrides the saved
106
+ profile. Never print any token in the final answer or logs.
82
107
 
83
108
  Example `.env`:
84
109
 
@@ -104,16 +129,14 @@ List flows:
104
129
  node <skill-dir>/scripts/agentflow-cli.mjs list-flows
105
130
  ```
106
131
 
107
- For a package used only in the current local checkout, use the packaged AgentFlow CLI (the
108
- Node DSL workflow is documented in `agentflow-node-dsl`):
132
+ Validate and lay out Workspace DSL with the same bundled CLI:
109
133
 
110
134
  ```bash
111
- agentflow marketplace list --json
112
- agentflow marketplace publish-node ./my-node --json
113
- agentflow validate MyFlow --json
135
+ node <skill-dir>/scripts/agentflow-cli.mjs dsl-lint --file <flowDir>
136
+ node <skill-dir>/scripts/agentflow-cli.mjs dsl-layout --file <flowDir>
114
137
  ```
115
138
 
116
- These commands copy a package only into the current workspace marketplace.
139
+ Add `--all` to `dsl-layout` only for a new graph or an explicitly requested full rearrangement.
117
140
 
118
141
  To distribute a complete package directory (including `scripts/`, `templates/`, or assets) through
119
142
  an AgentFlow server, use the token-backed commands. The CLI packs the directory as ZIP; `index.mjs`
@@ -129,7 +152,8 @@ node <skill-dir>/scripts/agentflow-cli.mjs node-package-install \
129
152
  ```
130
153
 
131
154
  Before authoring a new code node, search the remote catalog. The result is structured JSON with the
132
- exact import specifier, input/output slots, content hash, and install hint:
155
+ exact import specifier, input/output slots, content hash, visibility, install hint, and server-owned
156
+ `useCount` / `installCount` / `uniqueUserCount` statistics:
133
157
 
134
158
  ```bash
135
159
  node <skill-dir>/scripts/agentflow-cli.mjs node-package-search --query "read csv"
@@ -138,6 +162,52 @@ node <skill-dir>/scripts/agentflow-cli.mjs node-package-search --query "read csv
138
162
  Prefer an existing suitable exact version. Install it and import its returned `specifier`; create a
139
163
  new local package only when no result meets the requested behavior.
140
164
 
165
+ ## Marketplace resources
166
+
167
+ List complete runnable Flow templates or node packages. Results are public resources by default,
168
+ ordered by `useCount DESC`, and always include the usage statistics in their JSON records:
169
+
170
+ ```bash
171
+ node <skill-dir>/scripts/agentflow-cli.mjs marketplace-list --kind flow
172
+ node <skill-dir>/scripts/agentflow-cli.mjs marketplace-list --kind node --query "用户校验"
173
+ node <skill-dir>/scripts/agentflow-cli.mjs marketplace-list --kind flow --owned
174
+ ```
175
+
176
+ `--owned` includes the current user's private resources. Creating or testing a Draft never exposes
177
+ it. Publishing to the Marketplace is a separate explicit operation; it defaults to public, strips
178
+ runtime state, and disables Scheduled Run entries in the immutable template snapshot:
179
+
180
+ ```bash
181
+ node <skill-dir>/scripts/agentflow-cli.mjs marketplace-flow-publish \
182
+ --flow-id user-import-validation \
183
+ --flow-source user \
184
+ --version 1.0.0 \
185
+ --visibility public
186
+ ```
187
+
188
+ Install a public or owned private template into the caller's personal space. Installation creates a
189
+ copy, records its Marketplace origin for later successful-run accounting, and keeps scheduling
190
+ disabled until the installer explicitly enables it:
191
+
192
+ ```bash
193
+ node <skill-dir>/scripts/agentflow-cli.mjs marketplace-flow-install \
194
+ --flow user-import-validation@1.0.0 \
195
+ --flow-id my-user-import-validation
196
+ ```
197
+
198
+ Owners can stop discovery and new installation without deleting already installed copies:
199
+
200
+ ```bash
201
+ node <skill-dir>/scripts/agentflow-cli.mjs marketplace-visibility \
202
+ --kind flow \
203
+ --resource user-import-validation@1.0.0 \
204
+ --visibility private
205
+ ```
206
+
207
+ The same command supports `--kind node`. Never infer Marketplace publication from ordinary
208
+ `publish-flow`: that command writes an editable personal/workspace/team Flow, while
209
+ `marketplace-flow-publish` creates a reusable immutable template.
210
+
141
211
  When a Flow already declares its dependencies, do not install packages one by one. Synchronize the
142
212
  whole Flow from its versioned imports:
143
213
 
@@ -158,8 +228,8 @@ import myNode from "marketplace:my_node@1.0.0";
158
228
  const result = myNode("My node", { input: "value" });
159
229
  ```
160
230
 
161
- Run `agentflow flow dsl lint <flowDir>` with that workspace as the current project before publishing
162
- the flow. `publish-flow` also checks that the server contains every exact imported version before it
231
+ Run the bundled `dsl-lint` command with that workspace as `--workspace-root` before publishing the
232
+ flow. `publish-flow` also checks that the server contains every exact imported version before it
163
233
  writes the Flow. Do not unpack ZIPs by hand or copy only `index.mjs`; relative package files are part
164
234
  of the node's versioned content.
165
235
 
@@ -169,7 +239,8 @@ Publish a new local Flow after the user has reviewed it:
169
239
  node <skill-dir>/scripts/agentflow-cli.mjs publish-flow \
170
240
  --flow-id release-check \
171
241
  --file .workspace/agentflow/pipelines/release-check/flow.yaml \
172
- --target-space personal
242
+ --target-space personal \
243
+ --schedule disabled
173
244
  ```
174
245
 
175
246
  When the reviewed code Flow contains `nodes/`, publish the Flow and all complete package directories
@@ -180,6 +251,7 @@ node <skill-dir>/scripts/agentflow-cli.mjs publish-flow \
180
251
  --flow-id release-check \
181
252
  --file .workspace/agentflow/pipelines/release-check \
182
253
  --target-space personal \
254
+ --schedule disabled \
183
255
  --with-dependencies
184
256
  ```
185
257
 
@@ -188,7 +260,7 @@ and rewrites relative node imports only in the upload payload. It never edits lo
188
260
  `workspace.flow.js`. Without `--with-dependencies`, `publish-flow` continues to reject Flow directories
189
261
  that contain `nodes/` or `workspace.nodes.json` rather than silently dropping them.
190
262
 
191
- Destinations are `personal`, `workspace`, and `team`. `team` creates a workspace Flow and shares it as editor with the current account's active team. Publishing is create-only by default. If the exact Flow already exists, stop and ask whether to update it; only after explicit confirmation rerun with `--replace`. Replacement first reads the server revision and submits it with the update.
263
+ Destinations are `personal`, `workspace`, and `team`. `team` creates a workspace Flow and shares it as editor with the current account's active team. `publish-flow` defaults to `--schedule disabled`; use `enabled` only after explicit confirmation, and reserve `preserve` for migrations. Publishing is create-only by default. If the exact Flow already exists, stop and ask whether to update it; only after explicit confirmation rerun with `--replace`. Replacement first reads the server revision and submits it with the update.
192
264
 
193
265
  Read one flow graph:
194
266
 
@@ -249,6 +321,82 @@ This is for visual review only. It does not publish a formal Flow/Pipeline or
249
321
  create schedules. The returned temporary project is hidden from the normal
250
322
  Flow list and must not be treated as a durable source of truth.
251
323
 
324
+ ## Runnable Workspace drafts
325
+
326
+ For the review-and-test loop, use a Draft instead of the read-only Preview. A Draft is private to
327
+ the token owner, hidden from the formal Flow list, writable in the Workspace UI, runnable, and
328
+ automatically removed after its TTL. Scheduled Run nodes may be present, but Draft saves never arm
329
+ real schedules.
330
+
331
+ Create one after DSL lint and layout:
332
+
333
+ ```bash
334
+ node <skill-dir>/scripts/agentflow-cli.mjs draft-create \
335
+ --file .workspace/agentflow/pipelines/<flow-id> \
336
+ --ttl-seconds 7200
337
+ ```
338
+
339
+ If the Flow contains local `nodes/`, add `--with-dependencies`; this uploads the complete immutable
340
+ packages before creating the Draft. Reuse the returned Draft and URL while iterating:
341
+
342
+ ```bash
343
+ node <skill-dir>/scripts/agentflow-cli.mjs draft-pull \
344
+ --draft-id <draft-id> \
345
+ --output .workspace/agentflow/pipelines/<flow-id> \
346
+ --replace
347
+
348
+ node <skill-dir>/scripts/agentflow-cli.mjs draft-update \
349
+ --draft-id <draft-id> \
350
+ --base-revision <revision-from-create-update-or-pull> \
351
+ --file .workspace/agentflow/pipelines/<flow-id>
352
+
353
+ node <skill-dir>/scripts/agentflow-cli.mjs draft-run \
354
+ --draft-id <draft-id> \
355
+ --run-node-id <run-node-id> \
356
+ --input topic=hello
357
+ ```
358
+
359
+ `draft-update` resets previous runtime output unless `--keep-runtime` is passed. It requires the
360
+ revision returned by the preceding create, update, or pull and rejects stale updates. If the user
361
+ edited the Draft in the UI, run `draft-pull` before changing the local DSL; do not retry a 409 with
362
+ an invented or freshly fetched revision against an unrefreshed local file.
363
+
364
+ After the user explicitly approves the tested Draft, promote that exact graph. Scheduling defaults
365
+ to disabled; choose `enabled` only after the user asked to activate it:
366
+
367
+ ```bash
368
+ node <skill-dir>/scripts/agentflow-cli.mjs draft-publish \
369
+ --draft-id <draft-id> \
370
+ --flow-id <flow-id> \
371
+ --target-space personal \
372
+ --schedule disabled
373
+ ```
374
+
375
+ Promotion is create-only and keeps the Draft until TTL expiry for recovery. `--schedule enabled`
376
+ enables every Scheduled Run entry and fails when the Draft has none. `--schedule preserve` retains
377
+ the graph values and is for advanced migrations, not the normal confirmation flow.
378
+
379
+ ## Scheduled Run operations
380
+
381
+ Manage published Workspace schedules explicitly:
382
+
383
+ ```bash
384
+ node <skill-dir>/scripts/agentflow-cli.mjs schedule-list --flow-id <flow-id>
385
+ node <skill-dir>/scripts/agentflow-cli.mjs schedule-enable \
386
+ --flow-id <flow-id> --schedule-node-id <node-id>
387
+ node <skill-dir>/scripts/agentflow-cli.mjs schedule-disable \
388
+ --flow-id <flow-id> --schedule-node-id <node-id>
389
+ node <skill-dir>/scripts/agentflow-cli.mjs schedule-set \
390
+ --flow-id <flow-id> --schedule-node-id <node-id> \
391
+ --enabled true --cron "0 8 * * *" --timezone Asia/Shanghai --overlap-policy skip
392
+ node <skill-dir>/scripts/agentflow-cli.mjs schedule-run-now \
393
+ --flow-id <flow-id> --schedule-node-id <node-id>
394
+ ```
395
+
396
+ After publishing or changing a schedule, require `enabled`, `lastStatus`, and `nextRunAt` in the
397
+ returned schedule state before reporting it as armed. Draft schedule configuration is visible and
398
+ editable but returns `suppressed: true` and never gets a `nextRunAt` registration.
399
+
252
400
  Run a Workspace graph:
253
401
 
254
402
  ```bash
@@ -306,14 +454,18 @@ The only admin write exception is audited version-membership repair. Read its st
306
454
 
307
455
  ## Workflow
308
456
 
309
- 1. Check token availability with `config`.
310
- 2. Use `list-workspace` or `list-flows` to discover Flow/Pipeline targets only. Use `node-package-search` before creating a new code node. Use `publish-flow` only after a local Flow has passed validation and the user has confirmed the preview.
311
- 3. Use `run` to start the flow. If the task needs the generated page/text, inspect returned `displayOutputs` or call `display-outputs`.
312
- 4. Use `status`, `list-run-by-workspace`, and `logs` when a run is active, failed, or needs debugging.
457
+ 1. Check authorization with `config`. If missing, use `auth start`, give the URL to the user, then
458
+ run `auth complete` only after the user approves it.
459
+ 2. Use `list-workspace` or `list-flows` to discover Flow/Pipeline targets only. Use `marketplace-list` or `node-package-search` before creating a new Flow/node; both expose usage counts for comparison. Use `publish-flow` only after a local Flow has passed validation and the user has confirmed the preview, and use `marketplace-flow-publish` only after the user explicitly wants a reusable Marketplace snapshot.
460
+ 3. For a new user-authored Flow, prefer `draft-create` `draft-run`/`draft-update` explicit user confirmation `draft-publish`. Keep `workspace-preview` for read-only sharing.
461
+ 4. Use `run` to start a published flow. If the task needs the generated page/text, inspect returned `displayOutputs` or call `display-outputs`.
462
+ 5. Use `status`, `list-run-by-workspace`, and `logs` when a run is active, failed, or needs debugging. Use `schedule-list` after every schedule mutation or scheduled publish.
313
463
 
314
464
  ## Failure Handling
315
465
 
316
- - If the CLI says the token is missing, ask the user to set `AGENTFLOW_TOKEN` in env or `.env`.
466
+ - If authorization is missing, use `auth start` and return the URL. Do not ask the user to paste a
467
+ personal Token into the conversation. Use environment Tokens only for non-interactive CI or
468
+ service accounts.
317
469
  - If `publish-flow` returns 409, do not add `--replace` automatically. Ask the user to confirm updating the existing Flow.
318
470
  - If team publishing says no active team is assigned, keep the local draft and ask the user to choose personal/workspace or have an admin assign the account to a team.
319
471
  - If the API returns 401/403, do not retry with a printed token. Ask the user to refresh the token.
@@ -1,4 +1,4 @@
1
1
  interface:
2
2
  display_name: "AgentFlow CLI"
3
- short_description: "Search packages and operate portable AgentFlow workspaces"
4
- default_prompt: "Use $agentflow-cli to search node packages and operate a portable AgentFlow workspace."
3
+ short_description: "Draft, test, publish, and schedule AgentFlow workspaces"
4
+ default_prompt: "Use $agentflow-cli to create a runnable Draft, test it, publish it after confirmation, and manage its schedule."