| 1 | package boot |
| 2 | |
| 3 | import ( |
| 4 | "time" |
| 5 | |
| 6 | "reasonix/internal/agent" |
| 7 | "reasonix/internal/config" |
| 8 | ) |
| 9 | |
| 10 | // taskBudgetFromConfig maps the configured spend gate onto the agent budget. |
| 11 | // Zero and negative values disable the time axis; only a positive value is an |
| 12 | // explicit wall-clock budget. |
| 13 | func taskBudgetFromConfig(cfg *config.Config) agent.TaskBudget { |
| 14 | b := agent.TaskBudget{Cost: cfg.Agent.TaskCostBudget} |
| 15 | switch minutes := cfg.Agent.TaskTimeBudgetMinutes; { |
| 16 | case minutes < 0: |
| 17 | b.Wall = -1 |
| 18 | case minutes > 0: |
| 19 | b.Wall = time.Duration(minutes * float64(time.Minute)) |
| 20 | } |
| 21 | return b |
| 22 | } |
| 23 |