feat: import agents_and_robots platform as unibots (Matrix-out, unibus transport)
Reemplaza el scaffold del echobot por la plataforma completa de bots traida desde ~/DataProyects/Github/agents_and_robots tras la operacion Matrix-out: los bots ya no hablan por Matrix sino por el bus unibus (modelo todo-rooms + E2E via shell/transportunibus sobre github.com/enmanuel/unibus/pkg/client). - go.mod: replace de unibus -> ../unibus y de fn-registry -> ../../../.. (paths relativos reajustados a la nueva ubicacion dentro de fn_registry). - app.md: bump a 0.2.0, descripcion + arquitectura + comandos + gotchas reales. - modulo Go conservado como github.com/enmanuel/agents (sin reescribir imports). agents_and_robots queda archivado como museo de la era Matrix.
This commit is contained in:
@@ -0,0 +1,92 @@
|
||||
// Package orchestration defines pure types for multi-bot coordination.
|
||||
// Zero side effects — only data structures and helpers.
|
||||
package orchestration
|
||||
|
||||
import "encoding/json"
|
||||
|
||||
// TaskEvent is sent by the orchestrator to a bot via the bus.
|
||||
// It tells the bot: "answer this question in this room with this context."
|
||||
type TaskEvent struct {
|
||||
TaskID string `json:"task_id"`
|
||||
TargetBotID string `json:"target_bot_id"`
|
||||
TargetRoomID string `json:"target_room_id"`
|
||||
OriginalSender string `json:"original_sender"`
|
||||
OriginalQuestion string `json:"original_question"`
|
||||
Iteration int `json:"iteration"`
|
||||
PreviousResponses []BotResponse `json:"previous_responses,omitempty"`
|
||||
RoomContext []ContextMessage `json:"room_context,omitempty"`
|
||||
}
|
||||
|
||||
// BotResponse is a bot's reply to a TaskEvent.
|
||||
type BotResponse struct {
|
||||
BotID string `json:"bot_id"`
|
||||
Text string `json:"text"`
|
||||
}
|
||||
|
||||
// TaskResult is sent by a bot back to the orchestrator via the bus.
|
||||
type TaskResult struct {
|
||||
TaskID string `json:"task_id"`
|
||||
BotID string `json:"bot_id"`
|
||||
Text string `json:"text"`
|
||||
Error string `json:"error,omitempty"`
|
||||
}
|
||||
|
||||
// QualityScore is the LLM's evaluation of a bot's response.
|
||||
type QualityScore struct {
|
||||
Score float64 `json:"score"` // 0.0–1.0
|
||||
Continue bool `json:"continue"` // should the pipeline continue?
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// RoutingDecision is the LLM's choice of which bot should respond.
|
||||
type RoutingDecision struct {
|
||||
TargetBotID string `json:"bot_id"`
|
||||
Confidence float64 `json:"confidence"`
|
||||
Reason string `json:"reason"`
|
||||
}
|
||||
|
||||
// ContextMessage is a single message from the room's recent history.
|
||||
type ContextMessage struct {
|
||||
SenderID string `json:"sender_id"`
|
||||
Content string `json:"content"`
|
||||
}
|
||||
|
||||
// ParticipantInfo describes a bot available for routing.
|
||||
type ParticipantInfo struct {
|
||||
ID string `json:"id"`
|
||||
MatrixUserID string `json:"matrix_user_id"` // e.g. "@assistant-bot:server"
|
||||
Description string `json:"description"`
|
||||
Capabilities []string `json:"capabilities,omitempty"`
|
||||
}
|
||||
|
||||
// MarshalTaskEvent serializes a TaskEvent to JSON for bus transport.
|
||||
func MarshalTaskEvent(t TaskEvent) (string, error) {
|
||||
b, err := json.Marshal(t)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(b), nil
|
||||
}
|
||||
|
||||
// UnmarshalTaskEvent deserializes a TaskEvent from JSON.
|
||||
func UnmarshalTaskEvent(data string) (TaskEvent, error) {
|
||||
var t TaskEvent
|
||||
err := json.Unmarshal([]byte(data), &t)
|
||||
return t, err
|
||||
}
|
||||
|
||||
// MarshalTaskResult serializes a TaskResult to JSON for bus transport.
|
||||
func MarshalTaskResult(r TaskResult) (string, error) {
|
||||
b, err := json.Marshal(r)
|
||||
if err != nil {
|
||||
return "", err
|
||||
}
|
||||
return string(b), nil
|
||||
}
|
||||
|
||||
// UnmarshalTaskResult deserializes a TaskResult from JSON.
|
||||
func UnmarshalTaskResult(data string) (TaskResult, error) {
|
||||
var r TaskResult
|
||||
err := json.Unmarshal([]byte(data), &r)
|
||||
return r, err
|
||||
}
|
||||
Reference in New Issue
Block a user