mirror of
https://github.com/Ed1s0nZ/CyberStrikeAI.git
synced 2026-11-13 15:57:22 +01:00
Delete the Eino model adapters, callbacks, middleware, orchestration, summarization and single-agent runner together with their dependencies. Chat, batch tasks, workflow Agent nodes and sub-agents now share the Pi runtime, and dispatch is a single code path instead of an engine switch. Configuration migrates eino_middleware/eino_skills to runtime/skills and drops the retired callback settings while old files still load. Settings, i18n and docs describe Pi only. Also carry the Pi follow-up fixes: empty required lists are omitted from tool schemas, historical tool results stay with their call batch, model proxies work over HTTP/1.1, single-query retrieval skips query expansion, and finalization docs match Pi lifecycle events.
55 lines
1.2 KiB
Go
55 lines
1.2 KiB
Go
package security
|
|
|
|
import (
|
|
"context"
|
|
"io"
|
|
"sync"
|
|
)
|
|
|
|
type ShellExecuteRequest struct {
|
|
Command string
|
|
RunInBackendGround bool
|
|
}
|
|
type ShellExecuteResponse struct {
|
|
Output string
|
|
ExitCode *int
|
|
}
|
|
type shellStreamItem struct {
|
|
response *ShellExecuteResponse
|
|
err error
|
|
}
|
|
|
|
type ShellStream struct {
|
|
items <-chan shellStreamItem
|
|
cancel context.CancelFunc
|
|
}
|
|
|
|
func (s *ShellStream) Recv() (*ShellExecuteResponse, error) {
|
|
item, ok := <-s.items
|
|
if !ok {
|
|
return nil, io.EOF
|
|
}
|
|
return item.response, item.err
|
|
}
|
|
func (s *ShellStream) Close() { s.cancel() }
|
|
|
|
type shellStreamWriter struct {
|
|
ctx context.Context
|
|
items chan shellStreamItem
|
|
once sync.Once
|
|
}
|
|
|
|
func (w *shellStreamWriter) Send(response *ShellExecuteResponse, err error) bool {
|
|
select {
|
|
case <-w.ctx.Done():
|
|
return true
|
|
case w.items <- shellStreamItem{response, err}:
|
|
return false
|
|
}
|
|
}
|
|
func (w *shellStreamWriter) Close() { w.once.Do(func() { close(w.items) }) }
|
|
func newShellStream(ctx context.Context, cancel context.CancelFunc, size int) (*ShellStream, *shellStreamWriter) {
|
|
items := make(chan shellStreamItem, size)
|
|
return &ShellStream{items, cancel}, &shellStreamWriter{ctx: ctx, items: items}
|
|
}
|