taskflow-hosts
v0.2.3
Published
Shared host-runner collection for taskflow — the codex, claude, opencode, and grok SubagentRunner implementations + their argv builders and event-stream parsers. The per-host MCP servers, plugin scaffolds, and bins live in codex-taskflow / claude-taskflow
Maintainers
Readme
taskflow-hosts
Shared host-runner collection for taskflow.
This package holds the SubagentRunner implementations for taskflow's non-pi
hosts — codex, claude, opencode, and grok — plus their pure argv
builders (buildCodexArgs / buildClaudeArgs / buildOpencodeArgs /
buildGrokArgs) and event-stream parsers. It is the single place host
runners live; a new host adds a <host>-runner.ts here.
Why a separate package
Each host has two halves:
- The runner — spawn that host's CLI, fold its JSON event stream into a
host-neutral
RunResult, classify the outcome. + the pure argv builder + permission/model helpers. - The delivery — the per-host MCP server + bin + plugin scaffold, which is
that host ecosystem's install target (
codex plugin add,claude plugin install, OpenCode config,grok plugin install).
Half #1 is nearly identical in shape across hosts and changes for the same
reasons (a taskflow-core contract change, or a host CLI flag change). Half #2
is genuinely host-specific (different install mechanisms, different plugin
manifests). So #1 is collected here; #2 stays in codex-taskflow /
claude-taskflow / opencode-taskflow / grok-taskflow, which import their
runner from this package.
Install
You usually don't install this directly — install the host delivery package:
npm install -g codex-taskflow # or claude-taskflow / opencode-taskflow / grok-taskflowFor code-level use:
npm install taskflow-hostsUsage
// one host, tree-shaken:
import { codexSubagentRunner, buildCodexArgs } from "taskflow-hosts/codex";
import { grokSubagentRunner, buildGrokArgs } from "taskflow-hosts/grok";
// or the barrel:
import {
claudeSubagentRunner,
opencodeSubagentRunner,
grokSubagentRunner,
} from "taskflow-hosts";Each runner export includes: the SubagentRunner (codexSubagentRunner / …),
the runXxxAgentTask function, the pure buildXxxArgs builder, the
foldXxxEventLine parser + newXxxAccumulator, and the permission/model
helpers (sandboxForTools, permissionArgsForTools / permissionArgsForGrokTools,
isReadOnlyPhase, resolveXxxModel, xxxBin).
Hosts
| Host | CLI spawn | Delivery package |
|------|-----------|------------------|
| Codex | codex exec --json | codex-taskflow |
| Claude Code | claude -p --output-format stream-json | claude-taskflow |
| OpenCode | opencode run --format json | opencode-taskflow |
| Grok Build | grok -p --output-format streaming-json | grok-taskflow |
Adding a host
- Add
<host>-runner.tsinsrc/(model it on an existing one — a purebuildXxxArgs+ the event parser + aSubagentRunnerexport). - Add an export entry in
src/index.ts(watch for name collisions on shared helper names likepermissionArgsForTools). - Add
*-runner.test.ts(event-stream parser) +*-args.test.ts(argv contract — CI-locked) intest/. - The host's delivery (MCP server/bin + plugin scaffold) goes in a
taskflow-hosts-depending package of its own.
See AGENTS.md and DECISIONS.md in
the repo root for the full architecture and the packaging decision.
License
MIT
