Files
boocode/apps/coder/src/conductor/flows/architectural-analysis.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

52 lines
2.4 KiB
TypeScript

import type { Spine, StepContext } from '../types.js';
const q = (ctx: StepContext) => String(ctx.input.question);
const repoLine = (ctx: StepContext) => (ctx.input.repoPath ? ` Repo/focus: ${String(ctx.input.repoPath)}.` : '');
/**
* Han `architectural-analysis` — assess a module/system across static structure,
* runtime behaviour, and concurrency, then synthesise architecture changes.
* The analyst angles fan out (behaviour at medium, concurrency at large), a
* code fold collects them, and software-architect synthesises the recommendation.
*/
export const architecturalAnalysis: Spine = {
name: 'architectural-analysis',
description: 'structure + behaviour + concurrency → architecture synthesis',
angles: [
{
id: 'structural',
agent: 'structural-analyst',
label: 'Static structure (structural-analyst)',
task: (ctx) =>
`Analyse the STATIC structure of the focus below — module boundaries, coupling, dependency direction, abstractions, duplication. Numbered findings, cite repo/path:line.${repoLine(ctx)}\n\nFOCUS: ${q(ctx)}`,
},
{
id: 'behavioral',
agent: 'behavioral-analyst',
label: 'Runtime behaviour (behavioral-analyst)',
minBand: 'medium',
task: (ctx) =>
`Analyse the RUNTIME behaviour of the focus below — data flow, error propagation, state management, integration boundaries. Numbered findings, cite repo/path:line.${repoLine(ctx)}\n\nFOCUS: ${q(ctx)}`,
},
{
id: 'concurrency',
agent: 'concurrency-analyst',
label: 'Concurrency (concurrency-analyst)',
minBand: 'large',
task: (ctx) =>
`Analyse CONCURRENCY/async risks in the focus below — races, shared-resource contention, lock ordering, deadlock potential, async error handling. Numbered findings, cite repo/path:line.${repoLine(ctx)}\n\nFOCUS: ${q(ctx)}`,
},
],
synthesizer: {
agent: 'software-architect',
label: 'Architecture synthesis (software-architect)',
task: (ctx) =>
[
'Synthesise the analyses below into recommended INTRA-codebase architecture changes — module boundaries, class/interface design, abstraction/extension points, refactoring paths — grounded in high cohesion, loose coupling, and SOLID. Cross-reference the findings you build on; give pseudocode sketches for proposed boundaries.',
'',
'----- ANALYSES -----',
ctx.results.fold ?? '',
].join('\n'),
},
};