Files
Agent-System-Backend/internal/runtime/workflow.go
T
weichenandCursor ebeb6c599c Route a matched intent to its workflow after commands
Why: A hit intent should start the bound workflow, and a command that shares the same id still has to win.
Evidence: go test ./internal/intentgate/ ./internal/runmgr/ ./internal/server/ passed. Recognize keeps slots and the missing-slot question. StartWorkflowRun copies the definition and selects the workflow runner even when mock is on.
Impact: Ordinary turns are unchanged. The workflow runner body is still a stub until the executor lands.
Refs: feature/agent-harness-p4
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-10-01 16:04:49 +00:00

32 lines
691 B
Go

package runtime
import (
"fmt"
"agent-system-backend/internal/workflow"
)
// WorkflowRunner 执行启动时拷贝下来的工作流定义。
type WorkflowRunner struct{}
func (WorkflowRunner) Name() string { return "workflow" }
func (WorkflowRunner) Execute(rc RunCtx) error {
return runWorkflow(rc)
}
type workflowSource interface {
Workflow() (workflow.Launch, bool)
}
func runWorkflow(rc RunCtx) error {
src, ok := rc.(workflowSource)
if !ok {
return fmt.Errorf("workflow: 当前运行没有工作流定义")
}
if _, ok := src.Workflow(); !ok {
return fmt.Errorf("workflow: 当前运行没有工作流定义")
}
return fmt.Errorf("workflow: 执行器尚未接上")
}