- Marked the Executor Stub Enhancement section in TODO.md as complete, detailing the enhancements made to the executor's functionality. - Improved the Executor to simulate full execution with Job integration, including phase transitions and logging. - Introduced a Config struct for customizable executor behavior, allowing for testing with callbacks and job integration control. - Implemented phase-specific methods for modular execution, preparing for future real phase implementations. - Added comprehensive tests for the executor, including smoke tests and verification of phase progression and job logs. - Updated progress tracking in TODO.md to reflect the current status of the executor and integration testing.
55 lines
1.6 KiB
Go
55 lines
1.6 KiB
Go
package executor
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/yaoapp/yao/agent/robot/types"
|
|
)
|
|
|
|
// RunInspiration executes P0: Inspiration phase (Clock trigger only)
|
|
//
|
|
// This phase gathers information to help make good goals.
|
|
// ClockContext is the key input - Agent knows what time it is and can decide
|
|
// what to do (e.g., 5pm Friday → write weekly report).
|
|
//
|
|
// Implementation (TODO Phase 4):
|
|
// 1. Build prompt with ClockContext + data sources (KB, DB, web search)
|
|
// 2. Call Inspiration Agent via Assistant.Stream()
|
|
// 3. Parse response to InspirationReport (markdown)
|
|
func (e *Executor) RunInspiration(_ *types.Context, exec *types.Execution, _ interface{}) error {
|
|
// TODO (Phase 4): Replace with real Agent call
|
|
// agentID := robot.Config.Resources.GetPhaseAgent(types.PhaseInspiration)
|
|
// messages := buildInspirationMessages(exec.Input.Clock, robot)
|
|
// response, err := callAgentStream(ctx, agentID, messages)
|
|
// if err != nil {
|
|
// return err
|
|
// }
|
|
// exec.Inspiration = parseInspirationReport(response)
|
|
|
|
// Simulate Agent Stream delay
|
|
e.simulateStreamDelay()
|
|
|
|
// Generate mock inspiration report
|
|
exec.Inspiration = &types.InspirationReport{
|
|
Clock: types.NewClockContext(time.Now(), ""),
|
|
Content: `## Summary
|
|
Mock inspiration report for testing.
|
|
|
|
## Highlights
|
|
- [High] Test item 1 - Critical business metric changed
|
|
- [Normal] Test item 2 - Regular update available
|
|
|
|
## Opportunities
|
|
- Market growth potential identified
|
|
- New customer segment emerging
|
|
|
|
## Risks
|
|
- None identified in current period
|
|
|
|
## Pending
|
|
- 2 tasks from previous execution
|
|
- 1 scheduled report due`,
|
|
}
|
|
|
|
return nil
|
|
}
|