Adds an agent swarm / multi-agent execution mode to Step-Realtime-CLI, plus related cleanups.#30
Adds an agent swarm / multi-agent execution mode to Step-Realtime-CLI, plus related cleanups.#30Daiyimo wants to merge 29 commits into
Conversation
…-test-suite test: add comprehensive test suite (848 tests, 11 files)
…licy add tests and harden command policy
…install-support add Windows voice install support
- AGENTS.md §7: state that README.md, README_CN.md, and .gitignore are temporarily not accepting modifications, to keep contributors from landing parallel edits and creating merge conflicts. - AGENTS.md §7: link to docs/skills/pr-review-decision.md as the reference for maintainer-style PR review (decision rubric, blocker checklist, bilingual CN/EN comment templates). - docs/skills/pr-review-decision.md: new guide. Tool-agnostic; describes the workflow from "here's a PR" to "here's the comment to paste." - .gitignore: ignore .claude/ so per-user agent config doesn't leak in.
* chore: align prettier checks * fix: preserve smart compaction aborts
…onfig (stepfun-ai#20) - Add 33 new/enhanced test files covering packages/core, packages/utils, packages/realtime, packages/agent-sdk, extensions/*, skills/builtin, src/gateway, src/bootstrap, src/commands, src/tui, and integration tests - Refine vitest.config.ts coverage.include to precisely list tested modules, add lcov reporter for CI integration - Add test:changed script to package.json for incremental test runs - Fix sox-driver.test.ts for Windows platform guard (upstream PR stepfun-ai#12 compat)
Remove STEP_CLI_ENABLE_OPENTUI env var gate; OpenTUI is now unconditionally enabled.
…ams, remove dead code - swarm-plugin: add _enterLock mutex to prevent concurrent enter() racing on active state - swarm-plugin: cap seenPrompts at 1024 with semi-truncation to prevent unbounded growth - subagent-plugin: replace bare catch in safeFinalize with logger.warn - subagent-plugin: add 5 AgentSwarm params (context_mode, preset, isolate_workspace, worktree_name, wait_ms) - subagent-plugin: fix escapeXml to include apostrophe escaping - swarm-plugin.test: add afterEach cleanup to prevent test state leakage - open-tui-capability: remove dead parseOpenTuiEnabledValue function - pr-review-decision: fix Prettier escape artifacts (replace_all, first) Co-Authored-By: Claude <noreply@anthropic.com>
|
Thanks for the contribution! To get this ready to merge:
Full conventions: |
- Register createSwarmPlugin() in builtins so beforeModelRequest hook injects swarm reminder
- Add /swarm [on|off|task] slash command with manual/task/tool trigger modes
- Wrap AgentSwarm tool execution with swarmMode.enter('tool')/exit() lifecycle
- Auto-exit swarm mode after turn completes for non-manual triggers
- Fix StepCliInteractiveUiTone import missing from runtime.ts
Co-Authored-By: Claude <noreply@anthropic.com>
Resolve add/add conflicts in test files and workflows by taking upstream versions. Our swarm mode changes (runtime.ts, subagent-plugin.ts) are unaffected. Co-Authored-By: Claude <noreply@anthropic.com>
The env-var gating in root-command, resume-command, and the binary-bundle define was left inconsistent after the runtime layer hard-coded the flag to true. Replace all three with compile-time true so rolldown can still fold the dead TTY path, and drop the now-unused define entry. Co-Authored-By: Claude <noreply@anthropic.com>
本次修复 Step-Realtime-CLI 在 Windows CMD 下通过 setup.ps1 安装后
TUI 无法正常使用的三个 Bug,并附带几项工作区既存的改动。
Bug① TUI 闪退(@opentui/core bun bundle 无法在 Node 加载)
- 根因:@opentui/core 全版本都是 Bun 打包产物(含 bun:ffi),
Node 的 ESM loader 不支持 bun: 协议,TUI 启动即崩
- 修复:src/commands/root-command.ts 的 shouldUseTui 分支加智能
respawn——Node 进程 + TUI 路径自动 spawn('bun', ...) 切到 Bun
子进程;非 TUI 路径仍跑 Node,零影响;靠 process.versions.bun
判断避免无限循环;Bun 不可用时输出清晰错误并 exit 1
Bug② /swarm 在 TUI 没反应(gateway 级 slash 命令被绕过)
- 根因:TUI 的 handleSlashCommand 本地拦截所有 "/" 输入,但只
识别少数命令,/swarm 落入 default 显示不明显 "Unknown Command"
且不清空输入框;gateway 的 executeSlashCommand 只在 REPL 用,
TUI 模式通过 SDK 通信完全绕过
- 修复:贯穿 gateway/SDK 链新增 executeSlashCommand 转发机制,
让 TUI 把未识别的 slash 命令回传给 gateway 处理
- packages/protocol: StepCliSlashCommandResult 接口 + 方法签名
- src/gateway/runtime.ts: public executeSlashCommandExternal
(/swarm 特殊处理调 handleSwarmCommand + addEvent)
- src/gateway/local-gateway.ts + service/session-service.ts: 委托
- packages/sdk/src/index.ts: SDK 新增 executeSlashCommand
- src/tui/app.tsx: default case 转发 gateway + submitPromptContent
- src/tui/slash-commands.ts: /swarm 加入自动补全
Bug③ TUI 滚动失效(Bun setRawMode 不启用 VT 输入标志)
- 根因:Bug① 让 TUI 改跑 Bun 下,但 Bun 的 setRawMode(true) 在
Windows 上不会启用 ENABLE_VIRTUAL_TERMINAL_INPUT (0x200)——而
Node 的 libuv 会。没有这个标志 CMD 不把特殊键/鼠标翻译成 VT
序列,@opentui/core 的 StdinParser 收不到字节,所有滚动空操作
- 修复:新增 src/tui/win-console-input.ts,通过 bun:ffi + kernel32
的 GetConsoleMode/SetConsoleMode 在 STD_INPUT_HANDLE 补 0x200;
包装 setRawMode 每次进 raw 模式重新断言;纯增量 OR 不删已有标志
- src/runtime/local-opentui-entry.tsx: createCliRenderer 前调
install,后调 ensure 兜底;修正 useAlternateScreen → screenMode
属性名(CliRendererConfig 用 screenMode,默认 alternate-screen)
- 降级:非 Windows / 非 Bun / kernel32 不可用 全部 no-op
附带既存改动(工作区预先存在,一并提交):
- 注册 packages/agent-sdk 为 workspace 包
(package.json、pnpm-workspace.yaml、scripts/build-packages.mjs、
pnpm-lock.yaml)
- TUI altScreen Windows 兼容:无配置时 Windows 默认 false
(src/bootstrap/config/loader.ts、src/runtime/runtime-config.ts)
验证:
- pnpm build 通过
- 非 TUI 路径零回归(node bin/step-cli.js --help / --version)
- Bun 基础链路正常(bun bin/step-cli.js --help / --version)
- QA 独立回归验证三个 Bug 修复全 PASS,无跨 Bug 回归
- dist 已同步到 ~/.step-cli/bin/dist/
- @step-cli/agent-sdk 被 extensions/realtime-voice 消费,knip 从根 workspace 看不到引用 - rg 是外部系统二进制,非 Node.js 包声明的 binary
|
Status update from the maintainer side — and thanks for the patience on this one. The swarm core itself is solidly engineered: the state machine with dedup, reminder injection scoped to the top-level harness, reuse of the existing BackgroundSubtaskManager, and the accompanying tests all read well. That said, we want to take proper time to think through the agent swarm / multi-agent execution mode before moving on it. The project already ships AgentTeam (parallel teammates within one turn) and SubAgent, so adding a third parallel-orchestration primitive is a product-level architecture decision — when to reach for swarm vs team, and whether they should converge — and we'd rather settle that deliberately than merge first and untangle later. We're keeping this PR open while it's under consideration; nothing here is lost, and we'll follow up on this thread and in #61 once we've landed on a direction. In the meantime, if you'd like something that can land quickly, a few focused areas where contributions are very welcome right now:
Thanks again for the work here — we'll be back on this thread once the orchestration direction is settled. |
Closes #61
Main changes
skills/builtin/src/swarm-plugin.ts)enter/exit/isActive) with dedup bytrigger:promptbeforeModelRequesthook injects swarm reminder for top-level main harness onlygetSwarmMode()for TUI or other consumersskills/builtin/src/subagent-plugin.ts)AgentSwarmlaunches parallel subagents fromitems+prompt_templateBackgroundSubtaskManagersubagent_modeloverride per swarm<agent_swarm_result>XML summaryAgentHarnessOptions.modelnow supportedSTEP_CLI_ENABLE_OPENTUIgate removed; OpenTUI is always enabled in this buildTests
getSwarmModeDocs / chores
task_list/task_waithintsdocs/skills/pr-review-decision.md.gitignoreignores `docs/compose/