33 lines
1.0 KiB
Go
33 lines
1.0 KiB
Go
package main
|
|
|
|
import (
|
|
"context"
|
|
"time"
|
|
|
|
"git.cin.su/m/Assistant/contracts/work"
|
|
)
|
|
|
|
// localExecutor provides the bounded local execution capability. It never
|
|
// claims that an unsupported or external action happened. The work owner
|
|
// records the WAITING callback and can retry after a suitable executor is
|
|
// configured or a human chooses the next step.
|
|
type localExecutor struct {
|
|
now func() time.Time
|
|
}
|
|
|
|
func newLocalExecutor() localExecutor {
|
|
return localExecutor{now: time.Now}
|
|
}
|
|
|
|
func (e localExecutor) Execute(_ context.Context, request work.AgentExecutionRequest) (work.AgentExecutionResult, error) {
|
|
now := time.Now()
|
|
if e.now != nil {
|
|
now = e.now()
|
|
}
|
|
return work.AgentExecutionResult{
|
|
State: work.AgentExecutionWaiting,
|
|
Summary: "Локальный исполнитель не поддерживает эту операцию; durable работа сохранена и ожидает подходящего исполнителя.",
|
|
ObservedAtUnixMillis: now.UnixMilli(),
|
|
}, nil
|
|
}
|