mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-08-05 02:18:46 +02:00
Add files via upload
This commit is contained in:
@@ -12,6 +12,9 @@ import (
|
||||
// 与 CallTool 路径一致,使监控页能展示「执行中」状态。
|
||||
func newEinoExecuteMonitorCallbacks(ctx context.Context, ag *agent.Agent, recorder einomcp.ExecutionRecorder) (
|
||||
begin func(toolCallID, command string) string,
|
||||
appendPartial func(executionID, toolCallID, chunk string),
|
||||
registerCancel func(executionID string, cancel context.CancelFunc),
|
||||
unregisterCancel func(executionID string),
|
||||
finish func(executionID, toolCallID, command, stdout string, success bool, invokeErr error),
|
||||
) {
|
||||
begin = func(toolCallID, command string) string {
|
||||
@@ -25,6 +28,24 @@ func newEinoExecuteMonitorCallbacks(ctx context.Context, ag *agent.Agent, record
|
||||
}
|
||||
return id
|
||||
}
|
||||
appendPartial = func(executionID, toolCallID, chunk string) {
|
||||
if ag == nil || executionID == "" || chunk == "" {
|
||||
return
|
||||
}
|
||||
ag.AppendLocalToolExecutionPartialOutput(executionID, chunk)
|
||||
}
|
||||
registerCancel = func(executionID string, cancel context.CancelFunc) {
|
||||
if ag == nil || executionID == "" || cancel == nil {
|
||||
return
|
||||
}
|
||||
ag.RegisterLocalToolExecutionCancel(executionID, cancel)
|
||||
}
|
||||
unregisterCancel = func(executionID string) {
|
||||
if ag == nil || executionID == "" {
|
||||
return
|
||||
}
|
||||
ag.UnregisterLocalToolExecutionCancel(executionID)
|
||||
}
|
||||
finish = func(executionID, toolCallID, command, stdout string, success bool, invokeErr error) {
|
||||
if ag == nil {
|
||||
return
|
||||
@@ -43,5 +64,5 @@ func newEinoExecuteMonitorCallbacks(ctx context.Context, ag *agent.Agent, record
|
||||
recorder(id, toolCallID)
|
||||
}
|
||||
}
|
||||
return begin, finish
|
||||
return begin, appendPartial, registerCancel, unregisterCancel, finish
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user