已合并
harness编排器用户提示优化,提供安装agent配置功能 #14
harness编排器用户提示优化,提供安装agent配置功能 #14
已合并
sunday创建于 9月15日
共 4 个文件变更+324-7
@@ -2,3 +2,4 @@
2node_modules/2node_modules/
3dist/3dist/
4__pycache__4__pycache__
5+docs/superpowers/
@@ -7,6 +7,7 @@ disable-model-invocation: true
7# Workflow Orchestrator7# Workflow Orchestrator
8 8 
9`$SKILL_ROOT` = the absolute path of the directory containing this SKILL.md.9`$SKILL_ROOT` = the absolute path of the directory containing this SKILL.md.
10+`$START_DIR` = the absolute startup directory of the current Agent session, recorded when this skill begins. It is the plugin project directory containing the model-adapter files.
10 11 
11## Inputs12## Inputs
12 13 
@@ -17,13 +18,37 @@ Four required inputs:
17- `provider` — the Coding Agent CLI used to execute the workflow's tasks.18- `provider` — the Coding Agent CLI used to execute the workflow's tasks.
18- `prompt` — the prompt for this development task.19- `prompt` — the prompt for this development task.
19 20 
21+For a missing `work_dir`, suggest `$START_DIR/<task_or_project_name_in_snake_case>`. Use the task or project identifier from the prompt, convert word boundaries and separators to underscores, and use lowercase. Ask for an identifier only when needed to derive this directory. Preserve a user-supplied `work_dir`.
22+ 
20## Steps23## Steps
21 24 
22-1. **Collect inputs.** For any of the four that is missing, immediately call the question tool to ask the user; never guess or invent a default.25+For questions, use the environment's question tool when available; otherwise ask in chat and wait for the reply.
23- Done when: all four are in hand.26+ 
24-2. **Absolutize paths.** Resolve `workflow.yaml` and `work_dir` with `realpath -m` (`-m` because `work_dir` may not exist yet).27+1. **Prepare input candidates.** First read the orchestrator's CLI help:
25- Done when: both are absolute.28+ 
26-3. **Run the orchestrator** (blackbox — see below) in a detached tmux session, logging output to `<work_dir>/orchestrator.log` with the exit status appended.29+ ```bash
30+ python3 "$SKILL_ROOT/scripts/orchestrator.py" --help
31+ ```
32+ 
33+ Use the values shown for `--provider` as the source of truth for provider options and validation. Proceed when the command succeeds and lists the accepted values. Preserve valid values the user has supplied. For missing inputs, propose values supported by the current task and session:
34+ - `workflow.yaml`: use the workflow file identified by the user or current plugin workflow; ask if no file is identified.
35+ - `work_dir`: use the task or project directory suggestion under Inputs.
36+ - `provider`: propose the actual CLI command name running the current Agent session when it appears in the help's accepted values. Match the current CLI itself rather than a protocol-compatible alternative. When the current session was started with CANNBot, use `cannbot` even though its agent protocol is compatible with OpenCode. Use session context to identify it; installed executables and configuration directories alone do not identify the running CLI. If the CLI is unknown or unsupported, ask the user to choose from the accepted values.
37+ - `prompt`: use the user's development request, preserving requirements and acceptance criteria; ask for any missing task requirements.
38+ Ask the user for unresolved values. Proposed values remain candidates until confirmed.
39+ Done when: all four concrete candidates are available and `provider` is accepted by the CLI help.
40+2. **Absolutize paths.** Run `realpath -m` on `workflow.yaml`, `work_dir`, and `$START_DIR` (`-m` allows the proposed `work_dir` to be absent).
41+ Done when: the three resulting paths are absolute and retain their intended locations.
42+3. **Confirm all four inputs.** Use a single question-tool call containing exactly four questions, one for each input. Populate the provider options from the CLI help output collected in Step 1, and validate any edited provider against that list. In each question body, display the complete current candidate value, including full paths and prompt text. For every option, use the actual value or a meaningful short form as the `label`; put the full value and its explanation in the `description`. Never use a generic label such as "Use this path" that conceals the value. Allow the user to edit each value directly. If a value is missing or invalid, ask only about that value and wait for the user's response. Reuse confirmations already given for these exact values during this run. Suggestions, preselected choices, and silence do not count as confirmation.
43+4. **Prepare Agent configuration.** Run the linker and require exit status 0 before starting tmux:
44+ 
45+ ```bash
46+ python3 "$SKILL_ROOT/scripts/link_agent_config.py" \
47+ --start-dir "<start_dir>" \
48+ --work-dir "<work_dir>" >> "<work_dir>/orchestrator.log" 2>&1
49+ ```
50+ Done when: `work_dir` exists, the linker exits 0, and its redirected output is present in `<work_dir>/orchestrator.log`.
51+5. **Run the orchestrator** (blackbox — see below) in a detached tmux session, logging output to `<work_dir>/orchestrator.log` with the exit status appended.
27 52 
28 Session name `<session>`: `orchestrator-<slug>`, where `<slug>` is the basename of `work_dir` with every character outside `[A-Za-z0-9_-]` replaced by `-`. If `tmux has-session -t <session>` says the name is taken, append `-2`, `-3`, … until it is free.53 Session name `<session>`: `orchestrator-<slug>`, where `<slug>` is the basename of `work_dir` with every character outside `[A-Za-z0-9_-]` replaced by `-`. If `tmux has-session -t <session>` says the name is taken, append `-2`, `-3`, … until it is free.
29 54 
@@ -33,7 +58,7 @@ Four required inputs:
33 --yaml "<workflow.yaml>" \58 --yaml "<workflow.yaml>" \
34 --work-dir "<work_dir>" \59 --work-dir "<work_dir>" \
35 --provider "<provider>" \60 --provider "<provider>" \
36- --prompt "<prompt>" > "<work_dir>/orchestrator.log" 2>&1; \61+ --prompt "<prompt>" >> "<work_dir>/orchestrator.log" 2>&1; \
37 echo "exit status: $?" >> "<work_dir>/orchestrator.log"'62 echo "exit status: $?" >> "<work_dir>/orchestrator.log"'
38 ```63 ```
39 64 
@@ -44,4 +69,4 @@ Four required inputs:
44 69 
45## Blackbox rule70## Blackbox rule
46 71 
47-orchestrator.py is a blackbox: invoke it only through the command line above and judge it only by its output and exit code. Never read or edit its source.72+orchestrator.py is a blackbox: invoke it with `--help` to discover accepted providers or with the launch command above to run the workflow. Judge it only by its output and exit code. Never read or edit its source.