MCPcopy Create free account
hub / github.com/GongShichen/LuminaCode / SendMessage

Method SendMessage

agent/task_runtime.go:331–357  ·  view source on GitHub ↗
(taskID, scopeID, prompt string)

Source from the content-addressed store, hash-verified

329}
330
331func (rt *AgentTaskRuntime) SendMessage(taskID, scopeID, prompt string) any {
332 rt.mu.Lock()
333 record := rt.records[taskID]
334 spec, ok := rt.workerSpecs[taskID]
335 if record == nil || record.ParentScopeID != scopeID || !ok {
336 rt.mu.Unlock()
337 return "Error: Worker is not reusable or has already terminated."
338 }
339 if !record.Reusable {
340 rt.mu.Unlock()
341 return "Error: Worker is not reusable or has already terminated."
342 }
343 if record.Status != "idle" {
344 rt.mu.Unlock()
345 return "Error: Worker is currently busy processing previous request."
346 }
347 rt.cancelIdleTTLLocked(taskID)
348 ctx, cancel := context.WithCancel(context.Background())
349 rt.workers[taskID] = cancel
350 record.Status = "queued"
351 record.UpdatedAt = nowSeconds()
352 rt.workerSpecs[taskID] = spec
353 cp := *record
354 rt.mu.Unlock()
355 go rt.runWorker(ctx, taskID, prompt)
356 return &cp
357}
358
359func (rt *AgentTaskRuntime) StopTask(taskID, scopeID string) any {
360 rt.mu.Lock()

Calls 3

cancelIdleTTLLockedMethod · 0.95
runWorkerMethod · 0.95
nowSecondsFunction · 0.70