plancompile

package
v0.6.9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 11, 2026 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Compile

Compile turns a parsed plan and an executor chain into one linear TaskChainDefinition. For each plan step it emits a seed task (noop + prompt template) then a full copy of the executor graph with rewritten task IDs and transitions. Successful chain exits from step i route to seed_step_{i+1} when i < last step.

func ExtractStepChain

func ExtractStepChain(full *taskengine.TaskChainDefinition, stepIndex1Based int) (*taskengine.TaskChainDefinition, error)

ExtractStepChain returns the subgraph for a single plan step from a chain produced by Compile. It includes seed_step_k and all tasks with IDs prefixed s{k}__, and rewrites transitions that jump to seed_step_{k+1} so the subgraph terminates at the end of the step instead.

Types

type ParsedPlan

type ParsedPlan struct {
	Goal  string
	Steps []string
}

ParsedPlan is the result of parsing plan Markdown (same shape as planservice.renderMarkdown).

func ParseMarkdown

func ParseMarkdown(md string) (*ParsedPlan, error)

ParseMarkdown extracts goal and ordered step descriptions from rendered plan Markdown. It understands lines like "**Goal:** ...", "## Steps", and checklist items "- [ ] 1. text". Indented lines starting with ">" (execution result excerpts) are skipped.

type PlanShowActive

type PlanShowActive interface {
	Show(ctx context.Context) (string, error)
	Active(ctx context.Context) (*planstore.Plan, []*planstore.PlanStep, error)
}

PlanShowActive is implemented by planservice.Service for RunActiveCompiled without importing planservice (avoids cycles).

type RunActiveCompiledResult

type RunActiveCompiledResult struct {
	Goal       string
	Steps      []string
	Chain      *taskengine.TaskChainDefinition
	Path       string
	Output     any
	OutputType taskengine.DataType
	State      []taskengine.CapturedStateUnit
}

RunActiveCompiledResult is the outcome of compiling the active plan markdown and executing the compiled chain.

func RunActiveCompiled

func RunActiveCompiled(
	ctx context.Context,
	planSvc PlanShowActive,
	chains taskchainservice.Service,
	exec execservice.TasksEnvService,
	executorChainID string,
	compiledChainID string,
	writePath string,
	precompiled *taskengine.TaskChainDefinition,
	eventSink taskengine.TaskEventSink,
) (*RunActiveCompiledResult, error)

RunActiveCompiled loads markdown via planservice.Show, parses and compiles it with the executor chain, optionally persists the compiled JSON, then runs Execute with the plan goal as string input. precompiled, when non-empty, skips Compile (reuse planservice Next cache or explicit artifact). eventSink publishes plan_run_* events to the same bus/TaskEvent pipeline as task execution (optional; nil disables).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL