/** SDK-owned platform module. This implementation is maintained in goodvibes-sdk. */
/**
* Proposal → workstream assembly (BIG-3 item 1), the final stage of the
* WRFC→orchestration migration. `fromPlanProposal()` maps an APPROVED
* PlanProposal (platform/core/plan-proposal.ts, produced by the BIG-2 planner
* decomposition pipeline) into a `CreateWorkstreamInput` the engine can run
* directly, so `/workstream launch` executes the REAL multi-item plan instead
* of flattening it through the `fromChainSpec` compat path.
*
* The mapping, one honest step at a time:
* - ONE work item per proposal work item. The proposal item's `title` becomes
* the work item's title and its `brief` becomes the work item's `task`, the
* prompt/context the phase agents actually run against (the phase-runner
* prepends "Work item:
" to review/fix prompts, so both survive into
* the agent's context). The proposal item's id is preserved so provenance,
* dependencies, and fleet nodes all line up 1:1.
* - Every item runs the SAME standard role-phase pipeline, engineer→review,
* the exact `engineerReviewPhases` template `fromChainSpec` uses
* (controller-compat.ts). The only per-assembly parameter is phase
* `capacity`: it defaults to the item count so independent items run
* concurrently (bounded only by their dependencies), where a single compat
* chain stays at capacity 1. Callers may cap concurrency via `opts.capacity`.
* - Inter-item dependencies carry over verbatim: `workItem.dependsOn` (already
* resolved to item ids by assemblePlanProposal) becomes the engine work
* item's `dependsOn`, which the scheduler gates the claim path on (an item
* is not claimable until every dependency reaches 'passed'; see the
* 'blocked-dependency' state and applyDependencyGates).
* - Workstream-level provenance records where the plan came from
* (decomposedBy, proposalId, strategy, agent cost/elapsed).
* - Best-of-N (attempts.ts): a proposal item's `attempts`/`autoAcceptWinner`
* carry through to the engine work-item spec. Previously the plan format
* constrained best-of-N OUT (every item was single-attempt); the engine now
* supports it, so the planner may propose it and a consumer's plan format may
* re-enable the field. A best-of-N item may be NON-LEAF: it may declare its own
* `dependsOn` (each attempt inherits it) and other items may depend on it (they
* gate on the group's picked-and-merged winner, see WorkItemSpec.attempts and
* scheduler.ts dependencyStatus). Only expanded under `worktree` isolation.
*
* ASSERT-AT-ASSEMBLY (BIG-3 item 2): even though `assemblePlanProposal` already
* rejects dangling dependencies and cycles, this function re-checks both and
* THROWS on violation rather than quietly building a broken workstream, a
* dangling dependency would gate an item on nothing, and a cycle would deadlock
* every item in it forever in 'blocked-dependency'. Belt-and-braces, because a
* caller could hand us a hand-built or mutated proposal that never went through
* the assembler.
*/
import type { ConfigManager } from '../config/manager.js';
import type { PlanProposal } from '../core/plan-proposal.js';
import type { CreateWorkstreamInput } from './engine.js';
export interface FromPlanProposalOptions {
/**
* Per-phase capacity for the engineer/review phases. Defaults to the number
* of work items, so all independent items can run concurrently (dependencies
* still gate the rest). Set a lower value to cap concurrency; clamped to at
* least 1.
*/
readonly capacity?: number | undefined;
}
/**
* Assemble a `CreateWorkstreamInput` from an approved multi-item PlanProposal.
* See the module doc for the full mapping and the assembly-time assertions.
*/
/**
* Approve-and-launch as ONE confirmed act: assemble the proposal into a
* workstream, create it, and START it in a single call. The `confirm: true`
* flag is the explicit confirmation, without it nothing is created (a
* structured refusal, not a throw), so a surface renders proposal -> confirm ->
* running through this one function instead of shelling the user through
* approve-then-assemble-then-create-then-start ceremony.
*/
export declare function approveAndLaunchProposal(engine: Pick, proposal: PlanProposal, configManager: Pick, opts?: FromPlanProposalOptions & {
readonly confirm?: boolean | undefined;
}): {
launched: true;
workstreamId: string;
} | {
launched: false;
requiresConfirm: true;
};
export declare function fromPlanProposal(proposal: PlanProposal, configManager: Pick, opts?: FromPlanProposalOptions): CreateWorkstreamInput;
//# sourceMappingURL=proposal-workstream.d.ts.map