Why: Q1 WP5 - platform's SQLite becomes an implementation of the squad Store port so run state and orchestration state live in one database, and platform's in-process execution goes through the Executor port instead of bypassing it (X6). Evidence: all five modules go vet clean and go test ok, including engine-on-SQLite (state in DB, no run-level JSON files, second engine recovers from the same DB), SQLiteStore round trip, and the full squad compatibility net. Impact: runState/hitlGate exported so the port is implementable; Options.Store wires into engineDeps; leader persistence and checkpoints route through the port; PrepareWorkspace no longer writes run-level JSON (st.save owns it); platform RunInProcess takes squad.Executor (callers updated); serve mounts the engine on platform's RunStore - single orchestration.db for both. Refs: Documents proposal 2026-10-07-agent-stack-n1q1i1-plans.md Q1 WP5
31 lines
693 B
Go
31 lines
693 B
Go
package platform
|
|
|
|
import (
|
|
"context"
|
|
|
|
"agent-squad/squad"
|
|
)
|
|
|
|
// stubExecutor 是测试用的 squad.Executor(X6 后调用方经端口注入)。
|
|
type stubExecutor struct {
|
|
result *squad.ExecResult
|
|
err error
|
|
}
|
|
|
|
func (s stubExecutor) Name() string { return "stub" }
|
|
|
|
func (s stubExecutor) Execute(ctx context.Context, req squad.ExecRequest) (*squad.ExecResult, error) {
|
|
if s.result == nil {
|
|
return nil, s.err
|
|
}
|
|
// 每次调用返回拷贝:调用方会改写 Success 字段,共享指针会跨步骤串味。
|
|
cp := *s.result
|
|
if s.result.Patches != nil {
|
|
cp.Patches = map[string][]byte{}
|
|
for k, v := range s.result.Patches {
|
|
cp.Patches[k] = v
|
|
}
|
|
}
|
|
return &cp, s.err
|
|
}
|