Files
boocode/apps/coder/src/conductor/flows/authoring.ts
indifferentketchup 1937af8df9 feat: in-app Orchestrator (Phase 2) — multi-agent conductor
Brings the deterministic Han-flow conductor into BooCode: launch any read-only
flow from BooChat or BooCoder, watch each agent stream live in a Paseo-style
run pane, get an evidence-disciplined report — on local Qwen, persisted and
resumable. Read-only enforced hard via qwen --approval-mode plan (orchestrator
tasks fail closed if qwen is unavailable; never fall to write-capable native).

Backend (apps/coder): re-homed conductor defs, flow_runs/flow_steps schema,
flow-runner + dispatcher onTaskTerminal hook, restart-resume, runs routes
(launch/list/get/cancel), user-channel WS. Contracts: two flow_run_* frames.
Web: orchestrator pane kind + OrchestratorPane, Workflow button + slash flows
(BooChat/BooCoder parity), FlowLauncherDialog, "New Orchestrator" in the + and
split menus, runs history + export. Plan: openspec/changes/orchestrator.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-03 15:22:48 +00:00

91 lines
3.5 KiB
TypeScript

/**
* Han authoring/reporting skills as best-effort ONE-PASS flows. Each drafts an
* artifact (an ADR, a standard, a runbook, a test scaffold, a summary) and runs
* the adversarial-validator gate over it. Han intends some of these to be
* interactive; unattended they produce a first draft.
*/
import type { Spine } from '../types.js';
import { q, repoLine } from './_util.js';
export const adr: Spine = {
name: 'adr',
description: 'architecture decision record draft (one-pass)',
contracts: ['evidence', 'yagni'],
angles: [
{
id: 'architect',
agent: 'system-architect',
label: 'ADR draft (system-architect)',
task: (ctx) =>
`Draft an Architecture Decision Record for the decision below — Context, the Decision, the Options considered with trade-offs, Consequences (positive and negative), and the status. Ground it in the real constraints; mark anything assumed.${repoLine(ctx)}\n\nDECISION: ${q(ctx)}`,
},
],
};
export const codingStandard: Spine = {
name: 'coding-standard',
description: 'coding standard draft (one-pass)',
contracts: ['evidence', 'yagni'],
angles: [
{
id: 'author',
agent: 'software-architect',
label: 'Standard draft (software-architect)',
task: (ctx) =>
`Draft a coding standard for the topic below — the rule stated imperatively, the rationale (the failure it prevents), a correct and an incorrect example, and its scope of application. Keep it enforceable and specific.${repoLine(ctx)}\n\nTOPIC: ${q(ctx)}`,
},
],
};
export const runbook: Spine = {
name: 'runbook',
description: 'operational runbook draft (one-pass)',
contracts: ['evidence', 'yagni'],
angles: [
{
id: 'devops',
agent: 'devops-engineer',
label: 'Runbook draft (devops-engineer)',
task: (ctx) =>
`Draft an operational runbook for the scenario below — detection signals, immediate mitigation steps, diagnosis path, rollback/recovery, and escalation. Concrete commands/locations where known.${repoLine(ctx)}\n\nSCENARIO: ${q(ctx)}`,
},
{
id: 'oncall',
agent: 'on-call-engineer',
label: 'Failure-mode review (on-call-engineer)',
minBand: 'medium',
task: (ctx) =>
`List the failure modes the runbook for the scenario below must cover, and the earliest signal for each.\n\nSCENARIO: ${q(ctx)}`,
},
],
};
export const tdd: Spine = {
name: 'tdd',
description: 'failing-test scaffold + plan (one-pass; not the full red-green loop)',
contracts: ['evidence', 'yagni'],
angles: [
{
id: 'tests',
agent: 'test-engineer',
label: 'Red tests + plan (test-engineer)',
task: (ctx) =>
`For the behaviour below, write the failing ("red") tests that specify it — observable inputs/outputs and collaborator interactions — and outline the smallest implementation that would make them pass. Note: this is a single pass, not the interactive red-green-refactor loop.${repoLine(ctx)}\n\nBEHAVIOUR: ${q(ctx)}`,
},
],
};
export const stakeholderSummary: Spine = {
name: 'stakeholder-summary',
description: 'plain-language stakeholder summary (Han reporting)',
angles: [
{
id: 'summary',
agent: 'project-manager',
label: 'Stakeholder summary (project-manager)',
task: (ctx) =>
`Write a plain-language summary of the feature/work below for a non-technical stakeholder — what it is, why it matters, what changes for users, and the rough shape of the effort. No jargon, no implementation detail.${repoLine(ctx)}\n\nSUBJECT: ${q(ctx)}`,
},
],
};