| 266 | } |
| 267 | |
| 268 | func (rt *AgentTaskRuntime) RegisterForegroundTask(taskID, parentTaskID, parentScopeID, workerLabel, description, agentType string) *AgentTaskRecord { |
| 269 | now := nowSeconds() |
| 270 | record := &AgentTaskRecord{ |
| 271 | TaskID: taskID, ParentTaskID: parentTaskID, ParentScopeID: parentScopeID, |
| 272 | WorkerLabel: workerLabel, Description: description, AgentType: agentType, |
| 273 | Status: "running", CreatedAt: now, UpdatedAt: now, |
| 274 | } |
| 275 | rt.mu.Lock() |
| 276 | rt.registerRecordLocked(record, false) |
| 277 | rt.mu.Unlock() |
| 278 | return record |
| 279 | } |
| 280 | |
| 281 | func (rt *AgentTaskRuntime) CompleteForegroundTask(record *AgentTaskRecord, terminationReason string) { |
| 282 | rt.setForegroundTaskTerminal(record, "completed", terminationReason) |