ports

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 16, 2026 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewWorkflowInstance

func NewWorkflowInstance(workflowID, sessionID string) *core.WorkflowInstance

NewWorkflowInstance is a convenience function to create a new instance.

Types

type AgentFinder

type AgentFinder interface {
	// FindAgentsByRole finds available agents by role.
	FindAgentsByRole(ctx context.Context, role string) ([]string, error)
}

AgentFinder finds available agents by capability/role.

type ConditionEvaluator

type ConditionEvaluator interface {
	// EvaluateCondition evaluates a condition string against current context.
	EvaluateCondition(ctx context.Context, condition string, facts map[string]interface{}) (bool, error)
}

ConditionEvaluator evaluates workflow edge conditions against current facts.

type Extractor

type Extractor interface {
	// Extract converts free-text input to a structured payload.
	// The returned value should be a Go struct that can be flattened to Datalog facts.
	Extract(ctx context.Context, text string) (any, error)
}

Extractor converts free-text payloads to structured data. This bridges the neuro-symbolic gap: when an LLM returns unstructured text, the extractor maps it to a Go struct so Datalog rules can fire on the result.

type GenePoolPort

type GenePoolPort interface {
	// LoadActiveGenes fetches the relevant domain logic bounds for the current phase.
	// The frame parameter is an interface to avoid circular imports.
	LoadActiveGenes(ctx context.Context, frame any) ([]any, error)
}

GenePoolPort handles fetching and mapping crystallized logic rules.

type GenerativePort

type GenerativePort interface {
	// Generate produces structured output based on the assembled CognitiveFrame.
	// The frame parameter is an interface to avoid circular imports.
	Generate(ctx context.Context, frame any) (any, error)
}

GenerativePort encapsulates interactions with Large Language Models.

type InMemorySessionStore

type InMemorySessionStore struct {
	// contains filtered or unexported fields
}

InMemorySessionStore is a thread-safe in-memory implementation of SessionStateStore. This store is used for transient workflow execution state and does NOT persist to MEB.

func NewInMemorySessionStore

func NewInMemorySessionStore() *InMemorySessionStore

NewInMemorySessionStore creates a new in-memory session store.

func (*InMemorySessionStore) ClearSession

func (s *InMemorySessionStore) ClearSession(ctx context.Context, sessionID string) error

func (*InMemorySessionStore) Create

func (s *InMemorySessionStore) Create(ctx context.Context, instance *core.WorkflowInstance) error

func (*InMemorySessionStore) Delete

func (s *InMemorySessionStore) Delete(ctx context.Context, sessionKey string) error

func (*InMemorySessionStore) Exists

func (s *InMemorySessionStore) Exists(ctx context.Context, sessionKey string) bool

func (*InMemorySessionStore) Get

func (*InMemorySessionStore) List

func (s *InMemorySessionStore) List(ctx context.Context, sessionID string) ([]*core.WorkflowInstance, error)

func (*InMemorySessionStore) SessionCount

func (s *InMemorySessionStore) SessionCount() int

SessionCount returns the number of unique sessions.

func (*InMemorySessionStore) Size

func (s *InMemorySessionStore) Size() int

Size returns the number of instances in the store.

func (*InMemorySessionStore) Update

func (s *InMemorySessionStore) Update(ctx context.Context, instance *core.WorkflowInstance) error

type KnowledgeStore

type KnowledgeStore interface {
	// Recall retrieves the top-K most relevant facts for a query.
	// Uses graphID to scope the search to a specific knowledge tier/graph.
	Recall(ctx context.Context, query string, topK int, graphID string) ([]core.Atom, error)

	// GetFacts retrieves facts matching a specific pattern (subject/predicate/object).
	// Uses graphID to scope the search to a specific knowledge tier/graph.
	GetFacts(ctx context.Context, subject, predicate, object, graphID string) ([]core.Quad, error)

	// StreamFacts streams facts matching a pattern using zero-copy iteration.
	// Uses graphID to scope the search to a specific knowledge tier/graph.
	StreamFacts(ctx context.Context, subject, predicate, object, graphID string) func(func(core.Quad) bool)
}

KnowledgeStore defines the interface for retrieving knowledge facts from a persistent store. This is used for the OODA Orient phase to hydrate context from the knowledge base.

type ReasoningPort

type ReasoningPort interface {
	// VerifyExecutes evaluates a Datalog query and returns structural Audit results.
	VerifyWithDatalog(ctx context.Context, datalogQuery string) ([]map[string]string, error)
}

ReasoningPort provides pure Datalog evaluation capabilities against the underlying graph store.

type SessionStateStore

type SessionStateStore interface {
	// Create creates a new workflow instance in session memory.
	Create(ctx context.Context, instance *core.WorkflowInstance) error

	// Get retrieves a workflow instance by session key.
	Get(ctx context.Context, sessionKey string) (*core.WorkflowInstance, error)

	// Update updates an existing workflow instance.
	Update(ctx context.Context, instance *core.WorkflowInstance) error

	// Delete removes a workflow instance from session memory.
	Delete(ctx context.Context, sessionKey string) error

	// Exists checks if a workflow instance exists.
	Exists(ctx context.Context, sessionKey string) bool

	// List returns all workflow instances for a session.
	List(ctx context.Context, sessionID string) ([]*core.WorkflowInstance, error)

	// ClearSession removes all instances for a session (cleanup).
	ClearSession(ctx context.Context, sessionID string) error
}

SessionStateStore defines the interface for storing workflow execution state in memory. This is separate from MEB (persistent storage) - state here is transient.

type StoragePort

type StoragePort interface {
	// SaveTrace records the final result of a CognitiveFrame epoch.
	// The frame parameter is an interface to avoid circular imports.
	SaveTrace(ctx context.Context, frame any) error
}

StoragePort guarantees persistence across the Hexagonal system.

type TransientFact

type TransientFact struct {
	Subject   string
	Predicate string
	Object    string
	Graph     string
	CreatedAt string // ISO8601 timestamp
}

TransientFact represents a fact stored in transient session memory.

type TransientStore

type TransientStore interface {
	// Put stores a fact in the session's transient memory.
	Put(ctx context.Context, sessionID, key string, fact *TransientFact) error

	// Get retrieves a fact from the session's transient memory.
	Get(ctx context.Context, sessionID, key string) (*TransientFact, error)

	// GetAll retrieves all facts for a session.
	GetAll(ctx context.Context, sessionID string) ([]*TransientFact, error)

	// Delete removes a fact from the session's transient memory.
	Delete(ctx context.Context, sessionID, key string) error

	// ClearSession removes all facts for a session.
	ClearSession(ctx context.Context, sessionID string) error

	// ToAtoms converts all session facts to core.Atom format for Brain evaluation.
	ToAtoms(ctx context.Context, sessionID string) ([]core.Atom, error)

	// ToQuads converts all session facts to core.Quad format for storage.
	ToQuads(ctx context.Context, sessionID string) ([]core.Quad, error)
}

TransientStore defines the interface for storing transient coordination facts during OODA loop execution. Facts in this store are isolated by SessionID and are NOT persisted to MEB (BadgerDB). This is used for short-term memory: current_node, agent_status, workflow progress, etc.

type WorkflowLoader

type WorkflowLoader interface {
	// LoadWorkflow loads a workflow definition by ID.
	LoadWorkflow(ctx context.Context, workflowID string) (*core.WorkflowDef, error)
}

WorkflowLoader defines the interface for loading workflow definitions. This decouples the workflow source (Datalog, YAML, JSON, etc.) from execution.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL