Documentation
¶
Overview ¶
Code generated by Candacegen (csf/compiler/api_codegen). DO NOT EDIT.
Package csf composes the research controller compiler and runtime in one Go process. It makes no hard-real-time or physical-safety guarantee.
Code generated by Candacegen from the pinned OpenSearch SDK using ifacemaker; DO NOT EDIT.
Index ¶
- Constants
- Variables
- func CLIOperations() []string
- func CheckSourceSnapshot(ctx context.Context, request CheckRequest) (*pb.CommandReceipt, error)
- func Compile(controller *brainspinev1.Controller) (*brainspinev1.Program, error)
- func Evaluate(program *brainspinev1.Program, features []int64) (*brainspinev1.Action, error)
- func ImportantSourcePaths() []string
- func PrepareAgentAssignment(recipe *pb.AgentAssignmentRecipe) (*pb.AgentAssignmentPlan, error)
- func SubmitAgentAssignmentHTTP(ctx context.Context, client *api.ClientWithResponses, endpoint string, ...) (*pb.AgentAssignmentReceipt, error)
- type AgentMCPAuthenticator
- type AgentWorkbenchRequests
- type Artifacts
- type Change
- type CheckRequest
- type Client
- func (client *Client) CallOperation(ctx context.Context, operation string, input []byte) ([]byte, error)
- func (client *Client) CancelSimulation(ctx context.Context, request *contract0.CancelSimulationRequest) (*contract0.CancelSimulationResponse, error)
- func (client *Client) Compile(ctx context.Context, request *contract0.CompileRequest) (*contract0.CompileResponse, error)
- func (client *Client) GetDocument(ctx context.Context, request *contract0.GetDocumentRequest) (*contract0.GetDocumentResponse, error)
- func (client *Client) GetGraph(ctx context.Context, request *contract0.GetGraphRequest) (*contract0.GetGraphResponse, error)
- func (client *Client) GetOwnAgentConfiguration(ctx context.Context, request *contract0.GetOwnAgentConfigurationRequest) (*contract0.GetOwnAgentConfigurationResponse, error)
- func (client *Client) GetSnapshot(ctx context.Context, request *contract0.GetSnapshotRequest) (*contract0.GetSnapshotResponse, error)
- func (client *Client) GetWorkbenchTheme(ctx context.Context, request *contract0.GetWorkbenchThemeRequest) (*contract0.GetWorkbenchThemeResponse, error)
- func (client *Client) IngestDocument(ctx context.Context, request *contract0.IngestDocumentRequest) (*contract0.IngestDocumentResponse, error)
- func (client *Client) InspectSimulation(ctx context.Context, request *contract0.InspectSimulationRequest) (*contract0.InspectSimulationResponse, error)
- func (client *Client) LearnAboutCSF(ctx context.Context, request *contract0.LearnAboutCSFRequest) (*contract0.LearnAboutCSFResponse, error)
- func (client *Client) ListSimulations(ctx context.Context, request *contract0.ListSimulationsRequest) (*contract0.ListSimulationsResponse, error)
- func (client *Client) PrepareAgentAssignment(ctx context.Context, request *contract0.PrepareAgentAssignmentRequest) (*contract0.PrepareAgentAssignmentResponse, error)
- func (client *Client) PutEdge(ctx context.Context, request *contract0.PutEdgeRequest) (*contract0.PutEdgeResponse, error)
- func (client *Client) PutNode(ctx context.Context, request *contract0.PutNodeRequest) (*contract0.PutNodeResponse, error)
- func (client *Client) ReadSimulationLogs(ctx context.Context, request *contract0.ReadSimulationLogsRequest) (*contract0.ReadSimulationLogsResponse, error)
- func (client *Client) RebuildSimulationTrace(ctx context.Context, request *contract0.RebuildSimulationTraceRequest) (*contract0.RebuildSimulationTraceResponse, error)
- func (client *Client) RecordSimulationEvents(ctx context.Context, request *contract0.RecordSimulationEventsRequest) (*contract0.RecordSimulationEventsResponse, error)
- func (client *Client) ReloadWorkbenchTheme(ctx context.Context, request *contract0.ReloadWorkbenchThemeRequest) (*contract0.ReloadWorkbenchThemeResponse, error)
- func (client *Client) Search(ctx context.Context, request *contract0.SearchRequest) (*contract0.SearchResponse, error)
- func (client *Client) SendEmail(ctx context.Context, request *contract1.SendEmailRequest) (*contract1.SendEmailResponse, error)
- func (client *Client) SubmitSimulation(ctx context.Context, request *contract0.SubmitSimulationRequest) (*contract0.SubmitSimulationResponse, error)
- func (client *Client) UpdateOwnAgentConfiguration(ctx context.Context, request *contract0.UpdateOwnAgentConfigurationRequest) (*contract0.UpdateOwnAgentConfigurationResponse, error)
- type CopilotHistoryReader
- type Dashboard
- type EmailProvenance
- type FarmAgent
- type FarmAgentSource
- type FarmCheck
- type FarmCheckpoint
- type FarmDashboard
- func (dashboard *FarmDashboard) ActiveConnections() int
- func (dashboard *FarmDashboard) Close(ctx context.Context) error
- func (dashboard *FarmDashboard) Observe(ctx context.Context)
- func (dashboard *FarmDashboard) Register(router gin.IRouter)
- func (dashboard *FarmDashboard) RenderFarm() ([]byte, error)
- func (dashboard *FarmDashboard) Snapshot() FarmView
- type FarmEvent
- type FarmLink
- type FarmOption
- type FarmScore
- type FarmTask
- type FarmView
- type HumanOperation
- type IAgentConfigurationStore
- type IBatch
- type IDockerSimulations
- type IEmailSender
- type IHTTPDoer
- type IKnowledgeIndex
- type IKnowledgeStore
- type IOpenSearchClient
- type ISimulationLogs
- type ISimulationTraces
- type Inspection
- type InspectionOption
- func WithInspectionBrowserConnections(source func() int) InspectionOption
- func WithInspectionProjectionWorkers(workers *ProjectionWorkers) InspectionOption
- func WithInspectionReceipts(path string) InspectionOption
- func WithInspectionRegistry(registry *prometheus.Registry) InspectionOption
- func WithInspectionSimulations(simulations *Simulations) InspectionOption
- func WithInspectionSnapshot(snapshot func() FarmView) InspectionOption
- func WithInspectionTelemetry(source func(ctx context.Context) (api.TelemetrySnapshot, error)) InspectionOption
- type LocalSimulations
- type OnboardingConfig
- type OpenSearch
- func (search *OpenSearch) Close() error
- func (search *OpenSearch) Index(ctx context.Context, document *pb.SourceDocument, text string) error
- func (search *OpenSearch) IndexSimulationSource(ctx context.Context, index string, source *pb.SimulationTraceSource) (string, error)
- func (search *OpenSearch) Search(ctx context.Context, request *pb.SearchRequest) (*pb.SearchResult, error)
- func (search *OpenSearch) SimulationSource(ctx context.Context, index string, runID string) (*pb.SimulationLogRecord, error)
- type Option
- func WithAgentConfigurations(store IAgentConfigurationStore) Option
- func WithDashboard(dashboard *Dashboard) Option
- func WithEmail(sender IEmailSender) Option
- func WithKnowledge(store IKnowledgeStore, index IKnowledgeIndex, artifacts *Artifacts) Option
- func WithMCPTool[In, Out any](tool mcp.Tool, handler mcp.ToolHandlerFor[In, Out]) Option
- func WithOnboarding(config OnboardingConfig) Option
- func WithSimulations(simulations *Simulations) Option
- func WithWorkbenchThemeDirectory(directory string) Option
- type Postgres
- func (store *Postgres) ClaimProjection(ctx context.Context) (*pb.ProjectionTask, error)
- func (store *Postgres) CompleteProjection(ctx context.Context, task *pb.ProjectionTask) error
- func (store *Postgres) CountProjections(ctx context.Context) ([]*pb.ProjectionCount, error)
- func (store *Postgres) FailProjection(ctx context.Context, task *pb.ProjectionTask, problem string) error
- func (store *Postgres) GetAgentConfiguration(ctx context.Context, agentID string) (*pb.AgentConfiguration, error)
- func (store *Postgres) GetDocument(ctx context.Context, request *pb.DocumentRequest) (*pb.SourceDocument, error)
- func (store *Postgres) GetGraph(ctx context.Context, request *pb.GraphRequest) (*pb.GraphSnapshot, error)
- func (store *Postgres) GetProjection(ctx context.Context, request *pb.DocumentRequest) (*pb.ProjectionTask, error)
- func (store *Postgres) Initialize(ctx context.Context) error
- func (store *Postgres) Migrate(ctx context.Context) error
- func (store *Postgres) PutAgentConfiguration(ctx context.Context, agentID string, expectedRevision uint32, ...) (*pb.AgentConfiguration, error)
- func (store *Postgres) PutDocument(ctx context.Context, document *pb.SourceDocument) (*pb.SourceDocument, error)
- func (store *Postgres) PutEdge(ctx context.Context, edge *pb.KnowledgeEdge) (*pb.KnowledgeEdge, error)
- func (store *Postgres) PutNode(ctx context.Context, node *pb.KnowledgeNode) (*pb.KnowledgeNode, error)
- type ProjectionWorkers
- type Runtime
- func (runtime *Runtime) Activate(controller *brainspinev1.Controller, epoch uint64) (*brainspinev1.Program, error)
- func (runtime *Runtime) Handle(request *brainspinev1.RuntimeRequest) *brainspinev1.RuntimeResponse
- func (runtime *Runtime) Reset(epoch uint64) error
- func (runtime *Runtime) Step(observation *brainspinev1.Observation, nowTick uint64) *brainspinev1.Action
- type Service
- func (service *Service) AgentMCPHandler(authenticator *AgentMCPAuthenticator) http.Handler
- func (service *Service) CancelSimulation(ctx context.Context, request *pb.CancelSimulationRequest) (*pb.CancelSimulationResponse, error)
- func (service *Service) Compile(ctx context.Context, request *pb.CompileRequest) (*pb.CompileResponse, error)
- func (service *Service) GetDocument(ctx context.Context, request *pb.GetDocumentRequest) (*pb.GetDocumentResponse, error)
- func (service *Service) GetGraph(ctx context.Context, request *pb.GetGraphRequest) (*pb.GetGraphResponse, error)
- func (service *Service) GetOwnAgentConfiguration(ctx context.Context, _ *pb.GetOwnAgentConfigurationRequest) (*pb.GetOwnAgentConfigurationResponse, error)
- func (service *Service) GetSnapshot(ctx context.Context, request *pb.GetSnapshotRequest) (*pb.GetSnapshotResponse, error)
- func (service *Service) GetWorkbenchTheme(ctx context.Context, request *pb.GetWorkbenchThemeRequest) (*pb.GetWorkbenchThemeResponse, error)
- func (service *Service) IngestDocument(ctx context.Context, request *pb.IngestDocumentRequest) (*pb.IngestDocumentResponse, error)
- func (service *Service) InspectSimulation(ctx context.Context, request *pb.InspectSimulationRequest) (*pb.InspectSimulationResponse, error)
- func (service *Service) LearnAboutCSF(ctx context.Context, request *pb.LearnAboutCSFRequest) (*pb.LearnAboutCSFResponse, error)
- func (service *Service) ListSimulations(ctx context.Context, request *pb.ListSimulationsRequest) (*pb.ListSimulationsResponse, error)
- func (service *Service) MCPHandler() *mcp.StreamableHTTPHandler
- func (service *Service) PrepareAgentAssignment(ctx context.Context, request *pb.PrepareAgentAssignmentRequest) (*pb.PrepareAgentAssignmentResponse, error)
- func (service *Service) PutEdge(ctx context.Context, request *pb.PutEdgeRequest) (*pb.PutEdgeResponse, error)
- func (service *Service) PutNode(ctx context.Context, request *pb.PutNodeRequest) (*pb.PutNodeResponse, error)
- func (service *Service) ReadSimulationLogs(ctx context.Context, request *pb.ReadSimulationLogsRequest) (*pb.ReadSimulationLogsResponse, error)
- func (service *Service) RebuildSimulationTrace(ctx context.Context, request *pb.RebuildSimulationTraceRequest) (*pb.RebuildSimulationTraceResponse, error)
- func (service *Service) RecordSimulationEvents(ctx context.Context, request *pb.RecordSimulationEventsRequest) (*pb.RecordSimulationEventsResponse, error)
- func (service *Service) Register(router gin.IRouter)
- func (service *Service) ReloadWorkbenchTheme(ctx context.Context, request *pb.ReloadWorkbenchThemeRequest) (*pb.ReloadWorkbenchThemeResponse, error)
- func (service *Service) Search(ctx context.Context, request *pb.SearchRequest) (*pb.SearchResponse, error)
- func (service *Service) SendEmail(ctx context.Context, request *emailv1.SendEmailRequest) (*emailv1.SendEmailResponse, error)
- func (service *Service) ServeStdioMCP(ctx context.Context) error
- func (service *Service) StartProjectionWorkers(ctx context.Context) (*ProjectionWorkers, error)
- func (service *Service) SubmitSimulation(ctx context.Context, request *pb.SubmitSimulationRequest) (*pb.SubmitSimulationResponse, error)
- func (service *Service) UpdateOwnAgentConfiguration(ctx context.Context, request *pb.UpdateOwnAgentConfigurationRequest) (*pb.UpdateOwnAgentConfigurationResponse, error)
- type SimulationOption
- type Simulations
- type SourceCheck
- type SourceFile
- type SourceWatch
- type WatchResult
Constants ¶
const ( // AgentMCPAuthorizationHeader carries a session-bound credential for an agent MCP request. AgentMCPAuthorizationHeader = "Authorization" // AgentMCPAgentIDHeader identifies the agent making an authenticated MCP request. AgentMCPAgentIDHeader = "X-CSF-Agent-ID" // AgentMCPSessionIDHeader identifies the agent session making an authenticated MCP request. AgentMCPSessionIDHeader = "X-CSF-Session-ID" )
const ( SchemaVersion = 1 Scale = int64(1000) ValueLimit = int64(1000000000) CoefficientLimit = int64(1000000) FeatureLimit = int64(10000) FeatureCount = 4 MaxInstructions = 128 MaxDepth = 16 MaxAgeTicks = uint64(3) )
const ( SnapshotPath = "/api/snapshot" CompilePath = "/api/compile" )
const ( ChangeCreated = "created" ChangeModified = "modified" ChangeDeleted = "deleted" )
const (
WatchRegistryID = "brainspine.source-checks.v1"
)
const WorkbenchThemeFileName = "workbench-theme.css"
WorkbenchThemeFileName is the only stylesheet the theme capability reads.
Variables ¶
var ( ErrInvalidRequest = errors.New("invalid request") ErrNotFound = errors.New("not found") ErrConflict = errors.New("revision conflict") ErrMCPToolConflict = errors.New("MCP tool name already registered") ErrInvalidMCPTool = errors.New("invalid MCP tool registration") )
Input, identity and revision errors are stable transport classifications. Backend and encoding failures remain server errors at the HTTP boundary.
Functions ¶
func CLIOperations ¶
func CLIOperations() []string
func CheckSourceSnapshot ¶
func CheckSourceSnapshot(ctx context.Context, request CheckRequest) (*pb.CommandReceipt, error)
CheckSourceSnapshot returns a generated receipt for the bounded registry. Command identifies an in-process invocation, never a shell execution.
func Compile ¶
func Compile(controller *brainspinev1.Controller) (*brainspinev1.Program, error)
Compile rejects unsupported expressions before creating a bounded program. Deterministic protobuf is used only for this map-free, unknown-field-free versioned contract. This is not a universal canonical protobuf encoding.
func Evaluate ¶
func Evaluate(program *brainspinev1.Program, features []int64) (*brainspinev1.Action, error)
Evaluate interprets the compiled program with bounded integer arithmetic. Multiplication cannot overflow int64: |stack value| <= 1e9 and |gain| <= 1e6.
func ImportantSourcePaths ¶
func ImportantSourcePaths() []string
ImportantSourcePaths is a fresh explicit allowlist, never a recursive scan.
func PrepareAgentAssignment ¶
func PrepareAgentAssignment(recipe *pb.AgentAssignmentRecipe) (*pb.AgentAssignmentPlan, error)
PrepareAgentAssignment freezes a recipe into an independently owned plan. Retry keys depend on assignment identity, not content: editing an already submitted recipe must conflict with Workbench's existing idempotency receipt.
func SubmitAgentAssignmentHTTP ¶
func SubmitAgentAssignmentHTTP(ctx context.Context, client *api.ClientWithResponses, endpoint string, plan *pb.AgentAssignmentPlan) (*pb.AgentAssignmentReceipt, error)
SubmitAgentAssignmentHTTP is a consumer-side example of executing a plan through the existing generated Workbench client. Hosts composing in process can pass NewAgentWorkbenchRequests directly to their adapter instead. A partial receipt is returned if session creation succeeds but prompt acceptance is unconfirmed. Retry the original plan to recover its identities.
Types ¶
type AgentMCPAuthenticator ¶
type AgentMCPAuthenticator struct {
// contains filtered or unexported fields
}
AgentMCPAuthenticator signs and verifies identity-bound session credentials for CSF's protected streamable MCP route. Its signing key stays with the host.
func NewAgentMCPAuthenticator ¶
func NewAgentMCPAuthenticator(key []byte) (*AgentMCPAuthenticator, error)
NewAgentMCPAuthenticator creates an authenticator from one caller-owned signing key. Credentials remain valid for their identity tuple until key rotation.
func (*AgentMCPAuthenticator) AgentMCPHeaders ¶
func (authenticator *AgentMCPAuthenticator) AgentMCPHeaders(agentID string, sessionID string) (http.Header, error)
AgentMCPHeaders returns the complete bearer and identity headers for one validated agent session without disclosing the signing key. It is intended for the trusted local in-process bridge, not for untrusted callers to mint identities.
type AgentWorkbenchRequests ¶
type AgentWorkbenchRequests struct {
Session api.CreateSessionJSONRequestBody
Prompt api.SubmitPromptJSONRequestBody
}
AgentWorkbenchRequests uses the Workbench's generated request types. This translation is the sole boundary between CSF recipes and its current backend.
func NewAgentWorkbenchRequests ¶
func NewAgentWorkbenchRequests(plan *pb.AgentAssignmentPlan) (*AgentWorkbenchRequests, error)
NewAgentWorkbenchRequests verifies a prepared plan before translating it. The same keys safely replay session creation and prompt acceptance; retries never claim that a backend completed work whose result was not observed.
type Artifacts ¶
type Artifacts struct {
// contains filtered or unexported fields
}
Artifacts retains bytes under their SHA256. Writes never replace a blob.
func NewArtifacts ¶
type CheckRequest ¶
type CheckRequest struct {
Changes []Change
Files []SourceFile
}
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client uses generated method signatures with protobuf's JSON codec.
func (*Client) CallOperation ¶
func (*Client) CancelSimulation ¶
func (client *Client) CancelSimulation(ctx context.Context, request *contract0.CancelSimulationRequest) (*contract0.CancelSimulationResponse, error)
func (*Client) Compile ¶
func (client *Client) Compile(ctx context.Context, request *contract0.CompileRequest) (*contract0.CompileResponse, error)
func (*Client) GetDocument ¶
func (client *Client) GetDocument(ctx context.Context, request *contract0.GetDocumentRequest) (*contract0.GetDocumentResponse, error)
func (*Client) GetGraph ¶
func (client *Client) GetGraph(ctx context.Context, request *contract0.GetGraphRequest) (*contract0.GetGraphResponse, error)
func (*Client) GetOwnAgentConfiguration ¶
func (client *Client) GetOwnAgentConfiguration(ctx context.Context, request *contract0.GetOwnAgentConfigurationRequest) (*contract0.GetOwnAgentConfigurationResponse, error)
func (*Client) GetSnapshot ¶
func (client *Client) GetSnapshot(ctx context.Context, request *contract0.GetSnapshotRequest) (*contract0.GetSnapshotResponse, error)
func (*Client) GetWorkbenchTheme ¶
func (client *Client) GetWorkbenchTheme(ctx context.Context, request *contract0.GetWorkbenchThemeRequest) (*contract0.GetWorkbenchThemeResponse, error)
func (*Client) IngestDocument ¶
func (client *Client) IngestDocument(ctx context.Context, request *contract0.IngestDocumentRequest) (*contract0.IngestDocumentResponse, error)
func (*Client) InspectSimulation ¶
func (client *Client) InspectSimulation(ctx context.Context, request *contract0.InspectSimulationRequest) (*contract0.InspectSimulationResponse, error)
func (*Client) LearnAboutCSF ¶
func (client *Client) LearnAboutCSF(ctx context.Context, request *contract0.LearnAboutCSFRequest) (*contract0.LearnAboutCSFResponse, error)
func (*Client) ListSimulations ¶
func (client *Client) ListSimulations(ctx context.Context, request *contract0.ListSimulationsRequest) (*contract0.ListSimulationsResponse, error)
func (*Client) PrepareAgentAssignment ¶
func (client *Client) PrepareAgentAssignment(ctx context.Context, request *contract0.PrepareAgentAssignmentRequest) (*contract0.PrepareAgentAssignmentResponse, error)
func (*Client) PutEdge ¶
func (client *Client) PutEdge(ctx context.Context, request *contract0.PutEdgeRequest) (*contract0.PutEdgeResponse, error)
func (*Client) PutNode ¶
func (client *Client) PutNode(ctx context.Context, request *contract0.PutNodeRequest) (*contract0.PutNodeResponse, error)
func (*Client) ReadSimulationLogs ¶
func (client *Client) ReadSimulationLogs(ctx context.Context, request *contract0.ReadSimulationLogsRequest) (*contract0.ReadSimulationLogsResponse, error)
func (*Client) RebuildSimulationTrace ¶
func (client *Client) RebuildSimulationTrace(ctx context.Context, request *contract0.RebuildSimulationTraceRequest) (*contract0.RebuildSimulationTraceResponse, error)
func (*Client) RecordSimulationEvents ¶
func (client *Client) RecordSimulationEvents(ctx context.Context, request *contract0.RecordSimulationEventsRequest) (*contract0.RecordSimulationEventsResponse, error)
func (*Client) ReloadWorkbenchTheme ¶
func (client *Client) ReloadWorkbenchTheme(ctx context.Context, request *contract0.ReloadWorkbenchThemeRequest) (*contract0.ReloadWorkbenchThemeResponse, error)
func (*Client) Search ¶
func (client *Client) Search(ctx context.Context, request *contract0.SearchRequest) (*contract0.SearchResponse, error)
func (*Client) SendEmail ¶
func (client *Client) SendEmail(ctx context.Context, request *contract1.SendEmailRequest) (*contract1.SendEmailResponse, error)
func (*Client) SubmitSimulation ¶
func (client *Client) SubmitSimulation(ctx context.Context, request *contract0.SubmitSimulationRequest) (*contract0.SubmitSimulationResponse, error)
func (*Client) UpdateOwnAgentConfiguration ¶
func (client *Client) UpdateOwnAgentConfiguration(ctx context.Context, request *contract0.UpdateOwnAgentConfigurationRequest) (*contract0.UpdateOwnAgentConfigurationResponse, error)
type CopilotHistoryReader ¶
type CopilotHistoryReader func(ctx context.Context, sessionID string) (copilotbridge.HistorySnapshot, error)
CopilotHistoryReader reads one explicitly selected native Copilot session. The bridge owns SDK lifecycle, source isolation and typed event decoding.
type Dashboard ¶
type Dashboard struct {
// contains filtered or unexported fields
}
Dashboard observes one run's append-only artifact. It never owns the runtime.
func NewDashboard ¶
func (*Dashboard) Register ¶
Register mounts the basic metric view; Service owns its generated APIs.
func (*Dashboard) Snapshot ¶
func (dashboard *Dashboard) Snapshot() *brainspinev1.Snapshot
type EmailProvenance ¶
type EmailProvenance struct {
// contains filtered or unexported fields
}
EmailProvenance observes host-owned metadata at send time. It reads only the explicitly configured observer file, never a Docker socket or other sessions.
func NewEmailProvenance ¶
func NewEmailProvenance(configuration *emailv1.EmailHostConfiguration, now func() time.Time) *EmailProvenance
func (*EmailProvenance) Snapshot ¶
func (source *EmailProvenance) Snapshot(ctx context.Context) (*provenancev1.ReceiptMetadata, error)
type FarmAgent ¶
type FarmAgent struct {
Name, Role, State, Task, Note, ObservedAt, SessionID, Worktree, TicketURL string
Model, StartedAt, FinishedAt, Duration, DurationLabel string
Tokens *api.UsageObservation
PremiumRequests *float64
}
These are the board's presentation inputs, not a second domain contract. Runtime/program/knowledge contracts remain in their generated protobufs.
type FarmAgentSource ¶
FarmAgentSource supplies observed workers without owning another durable store.
type FarmCheckpoint ¶
type FarmDashboard ¶
type FarmDashboard struct {
// contains filtered or unexported fields
}
FarmDashboard mounts into an existing process. Observe owns publication and priority writes; sessions only consume immutable published views.
func NewFarmDashboard ¶
func NewFarmDashboard(origins []string, options ...FarmOption) (*FarmDashboard, error)
func (*FarmDashboard) ActiveConnections ¶
func (dashboard *FarmDashboard) ActiveConnections() int
ActiveConnections counts live board WebSockets, including connection cleanup. Workbench chat streams and terminal sockets have different owners and are excluded.
func (*FarmDashboard) Observe ¶
func (dashboard *FarmDashboard) Observe(ctx context.Context)
Observe runs under the caller's process context; it owns no listener.
func (*FarmDashboard) Register ¶
func (dashboard *FarmDashboard) Register(router gin.IRouter)
func (*FarmDashboard) RenderFarm ¶
func (dashboard *FarmDashboard) RenderFarm() ([]byte, error)
RenderFarm is useful for deterministic page inspection without opening a listener.
func (*FarmDashboard) Snapshot ¶
func (dashboard *FarmDashboard) Snapshot() FarmView
Snapshot returns the latest immutable view for sibling in-process mounts.
type FarmOption ¶
type FarmOption func(dashboard *FarmDashboard)
func WithFarmAgentSource ¶
func WithFarmAgentSource(source FarmAgentSource) FarmOption
func WithFarmWorkPath ¶
func WithFarmWorkPath(path string) FarmOption
type FarmView ¶
type FarmView struct {
BrowserConnections int
Title, Phase, UpdatedAt, Now, Uptime, Elapsed, StartedAt, Branch, TicketURL string
RuntimeCount, Goroutines, GoMaxProcs, HeapMiB, Containers, WorktreeCount int
ContainersObservedAt, WorktreesObservedAt, SourceError, AgentSourceError, Notice string
Agents []FarmAgent
Tasks []FarmTask
Feed []FarmEvent
Scores []FarmScore
Operations []HumanOperation
DashboardLinks []FarmLink
Checkpoint FarmCheckpoint
}
type HumanOperation ¶
type HumanOperation struct{ Name, Description string }
func HumanOperations ¶
func HumanOperations() []HumanOperation
type IAgentConfigurationStore ¶
type IAgentConfigurationStore interface {
GetAgentConfiguration(ctx context.Context, agentID string) (*pb.AgentConfiguration, error)
PutAgentConfiguration(ctx context.Context, agentID string, expectedRevision uint32, configuration *pb.AgentConfigurationInput) (*pb.AgentConfiguration, error)
}
IAgentConfigurationStore retains one revisioned external-tool configuration per authenticated agent. It stores opaque secret references, never values.
type IBatch ¶
type IBatch interface {
SubmitJob(ctx context.Context, input *batch.SubmitJobInput, options ...func(options *batch.Options)) (*batch.SubmitJobOutput, error)
DescribeJobs(ctx context.Context, input *batch.DescribeJobsInput, options ...func(options *batch.Options)) (*batch.DescribeJobsOutput, error)
TerminateJob(ctx context.Context, input *batch.TerminateJobInput, options ...func(options *batch.Options)) (*batch.TerminateJobOutput, error)
}
IBatch is the consumer seam over the upstream generated AWS SDK.
type IDockerSimulations ¶
type IDockerSimulations interface {
ContainerCreate(ctx context.Context, options client.ContainerCreateOptions) (client.ContainerCreateResult, error)
ContainerInspect(ctx context.Context, id string, options client.ContainerInspectOptions) (client.ContainerInspectResult, error)
ContainerStart(ctx context.Context, id string, options client.ContainerStartOptions) (client.ContainerStartResult, error)
ContainerStop(ctx context.Context, id string, options client.ContainerStopOptions) (client.ContainerStopResult, error)
ContainerRemove(ctx context.Context, id string, options client.ContainerRemoveOptions) (client.ContainerRemoveResult, error)
ContainerLogs(ctx context.Context, id string, options client.ContainerLogsOptions) (client.ContainerLogsResult, error)
}
IDockerSimulations consumes the upstream Docker Engine SDK, not a second orchestrator process. The application owns the socket and client lifetime.
type IEmailSender ¶
type IEmailSender interface {
Send(ctx context.Context, message *emailv1.EmailMessage) (*emailv1.EmailReceipt, error)
}
IEmailSender is the shared capability, not an SMTP implementation.
type IKnowledgeIndex ¶
type IKnowledgeIndex interface {
Index(ctx context.Context, document *pb.SourceDocument, text string) error
Search(ctx context.Context, request *pb.SearchRequest) (*pb.SearchResult, error)
}
IKnowledgeIndex is a rebuildable projection, never the evidence authority.
type IKnowledgeStore ¶
type IKnowledgeStore interface {
PutDocument(ctx context.Context, document *pb.SourceDocument) (*pb.SourceDocument, error)
GetDocument(ctx context.Context, request *pb.DocumentRequest) (*pb.SourceDocument, error)
PutNode(ctx context.Context, node *pb.KnowledgeNode) (*pb.KnowledgeNode, error)
PutEdge(ctx context.Context, edge *pb.KnowledgeEdge) (*pb.KnowledgeEdge, error)
GetGraph(ctx context.Context, request *pb.GraphRequest) (*pb.GraphSnapshot, error)
ClaimProjection(ctx context.Context) (*pb.ProjectionTask, error)
CompleteProjection(ctx context.Context, task *pb.ProjectionTask) error
FailProjection(ctx context.Context, task *pb.ProjectionTask, problem string) error
GetProjection(ctx context.Context, request *pb.DocumentRequest) (*pb.ProjectionTask, error)
CountProjections(ctx context.Context) ([]*pb.ProjectionCount, error)
}
IKnowledgeStore owns durable source identities and immutable symbolic facts.
type IOpenSearchClient ¶
type IOpenSearchClient interface {
Index(ctx context.Context, req opensearchapi.IndexReq) (*opensearchapi.IndexResp, error)
Search(ctx context.Context, req *opensearchapi.SearchReq) (*opensearchapi.SearchResp, error)
}
IOpenSearchClient is the shared generated Index/Search contract.
type ISimulationLogs ¶
type ISimulationLogs interface {
GetLogEvents(ctx context.Context, input *cloudwatchlogs.GetLogEventsInput, options ...func(options *cloudwatchlogs.Options)) (*cloudwatchlogs.GetLogEventsOutput, error)
}
ISimulationLogs reads the job's CloudWatch stream without an inbound worker listener.
type ISimulationTraces ¶
type Inspection ¶
type Inspection struct {
// contains filtered or unexported fields
}
Inspection mounts observations in the caller's router and registry. It owns no listener or background task. Receipts remain the event ledger; their retained counts are gauges because retention can remove records.
func NewInspection ¶
func NewInspection(options ...InspectionOption) *Inspection
func (*Inspection) Collect ¶
func (inspection *Inspection) Collect(output chan<- prometheus.Metric)
func (*Inspection) Describe ¶
func (inspection *Inspection) Describe(output chan<- *prometheus.Desc)
func (*Inspection) Register ¶
func (inspection *Inspection) Register(router gin.IRouter)
type InspectionOption ¶
type InspectionOption func(inspection *Inspection)
func WithInspectionBrowserConnections ¶
func WithInspectionBrowserConnections(source func() int) InspectionOption
WithInspectionBrowserConnections samples the live board's connection registry. Without a source the series is absent, rather than reporting a measured zero.
func WithInspectionProjectionWorkers ¶
func WithInspectionProjectionWorkers(workers *ProjectionWorkers) InspectionOption
func WithInspectionReceipts ¶
func WithInspectionReceipts(path string) InspectionOption
func WithInspectionRegistry ¶
func WithInspectionRegistry(registry *prometheus.Registry) InspectionOption
WithInspectionRegistry shares the host's registry with optional capabilities. The host owns this registry and must not register Go/process collectors twice.
func WithInspectionSimulations ¶
func WithInspectionSimulations(simulations *Simulations) InspectionOption
func WithInspectionSnapshot ¶
func WithInspectionSnapshot(snapshot func() FarmView) InspectionOption
func WithInspectionTelemetry ¶
func WithInspectionTelemetry(source func(ctx context.Context) (api.TelemetrySnapshot, error)) InspectionOption
type LocalSimulations ¶
type LocalSimulations struct {
// contains filtered or unexported fields
}
LocalSimulations is an optional capability of the shared host. It never owns a listener or a goroutine; Simulations.Work drives its bounded reconciliation.
func NewLocalSimulations ¶
func NewLocalSimulations(docker IDockerSimulations, config *pb.LocalSimulationConfig) (*LocalSimulations, error)
type OnboardingConfig ¶
type OnboardingConfig struct {
CSFRoot string
CSFRevision string
ConsumerRoot string
ConsumerRevision string
// CopilotHistoryReader is opt-in and reads from the bridge's disposable
// native snapshot for explicitly selected session IDs.
CopilotHistoryReader CopilotHistoryReader
}
OnboardingConfig is supplied by the host. ConsumerRoot is an explicitly authorized checkout; callers select relative paths within it. Empty CSFRoot uses the documentation embedded in this exact build. Omitted revisions use each document's content hash, so uncommitted edits retain distinct identities.
type OpenSearch ¶
type OpenSearch struct {
// contains filtered or unexported fields
}
OpenSearch projects canonical documents using a configured ML Commons model. Empty model configuration means lexical search, explicitly labelled as such.
func ConnectOpenSearch ¶
func ConnectOpenSearch(endpoint string, index string, model string, transport IHTTPDoer) (*OpenSearch, error)
ConnectOpenSearch owns a configured upstream SDK client until Close.
func NewOpenSearch ¶
func NewOpenSearch(index string, model string, client IOpenSearchClient) (*OpenSearch, error)
NewOpenSearch composes the document projection with generated SDK contracts. The caller owns the supplied clients and their lifecycle.
func (*OpenSearch) Close ¶
func (search *OpenSearch) Close() error
Close releases SDK background resources without closing the caller's HTTP client.
func (*OpenSearch) Index ¶
func (search *OpenSearch) Index(ctx context.Context, document *pb.SourceDocument, text string) error
func (*OpenSearch) IndexSimulationSource ¶
func (search *OpenSearch) IndexSimulationSource(ctx context.Context, index string, source *pb.SimulationTraceSource) (string, error)
IndexSimulationSource uses the same generated SDK client as knowledge search. Source records retain original event/trajectory text, not only rendered spans.
func (*OpenSearch) Search ¶
func (search *OpenSearch) Search(ctx context.Context, request *pb.SearchRequest) (*pb.SearchResult, error)
func (*OpenSearch) SimulationSource ¶
func (search *OpenSearch) SimulationSource(ctx context.Context, index string, runID string) (*pb.SimulationLogRecord, error)
type Option ¶
type Option func(service *Service)
func WithAgentConfigurations ¶
func WithAgentConfigurations(store IAgentConfigurationStore) Option
func WithDashboard ¶
func WithEmail ¶
func WithEmail(sender IEmailSender) Option
func WithKnowledge ¶
func WithKnowledge(store IKnowledgeStore, index IKnowledgeIndex, artifacts *Artifacts) Option
func WithMCPTool ¶
WithMCPTool adds one typed consumer-owned tool to the same MCP server as CSF's generated operations. The MCP SDK derives and validates the input and output schemas from In and Out; CSF only supplies registration ordering and collision checks.
func WithOnboarding ¶
func WithOnboarding(config OnboardingConfig) Option
func WithSimulations ¶
func WithSimulations(simulations *Simulations) Option
func WithWorkbenchThemeDirectory ¶
WithWorkbenchThemeDirectory selects where the host reads workbench-theme.css. Missing or empty files use the default theme. Agents edit the file, then call ReloadWorkbenchTheme; they cannot choose a file path through an operation.
type Postgres ¶
type Postgres struct {
// contains filtered or unexported fields
}
Postgres owns the relational projection of retained source and experiment data.
func (*Postgres) ClaimProjection ¶
func (*Postgres) CompleteProjection ¶
func (*Postgres) CountProjections ¶
func (*Postgres) FailProjection ¶
func (*Postgres) GetAgentConfiguration ¶
func (*Postgres) GetDocument ¶
func (store *Postgres) GetDocument(ctx context.Context, request *pb.DocumentRequest) (*pb.SourceDocument, error)
func (*Postgres) GetGraph ¶
func (store *Postgres) GetGraph(ctx context.Context, request *pb.GraphRequest) (*pb.GraphSnapshot, error)
func (*Postgres) GetProjection ¶
func (store *Postgres) GetProjection(ctx context.Context, request *pb.DocumentRequest) (*pb.ProjectionTask, error)
func (*Postgres) Initialize ¶
Initialize bootstraps an empty, explicitly selected database, then applies additive migrations. Each phase commits atomically. Existing installations fail bootstrap rather than silently adopting a schema.
func (*Postgres) Migrate ¶
Migrate uses the shared migration ledger for additive, transactional upgrades.
func (*Postgres) PutAgentConfiguration ¶
func (store *Postgres) PutAgentConfiguration(ctx context.Context, agentID string, expectedRevision uint32, configuration *pb.AgentConfigurationInput) (*pb.AgentConfiguration, error)
func (*Postgres) PutDocument ¶
func (store *Postgres) PutDocument(ctx context.Context, document *pb.SourceDocument) (*pb.SourceDocument, error)
func (*Postgres) PutEdge ¶
func (store *Postgres) PutEdge(ctx context.Context, edge *pb.KnowledgeEdge) (*pb.KnowledgeEdge, error)
func (*Postgres) PutNode ¶
func (store *Postgres) PutNode(ctx context.Context, node *pb.KnowledgeNode) (*pb.KnowledgeNode, error)
type ProjectionWorkers ¶
type ProjectionWorkers struct {
// contains filtered or unexported fields
}
ProjectionWorkers runs bounded, at-least-once projection work in its caller's process. PostgreSQL owns claims and retries; wakeups are only a latency hint.
func (*ProjectionWorkers) Active ¶
func (workers *ProjectionWorkers) Active() int64
func (*ProjectionWorkers) Close ¶
func (workers *ProjectionWorkers) Close()
func (*ProjectionWorkers) Configured ¶
func (workers *ProjectionWorkers) Configured() int
func (*ProjectionWorkers) Counts ¶
func (workers *ProjectionWorkers) Counts(ctx context.Context) ([]*pb.ProjectionCount, error)
type Runtime ¶
type Runtime struct {
// contains filtered or unexported fields
}
Runtime has one owner. Compose it directly into a Go loop, or use the JSONL test adapter. No goroutine, socket, container or service registry is required.
func NewRuntime ¶
func NewRuntime() *Runtime
func (*Runtime) Activate ¶
func (runtime *Runtime) Activate(controller *brainspinev1.Controller, epoch uint64) (*brainspinev1.Program, error)
Activate is an episode-boundary operation in this prototype. It compiles the candidate completely before replacing the active immutable program.
func (*Runtime) Handle ¶
func (runtime *Runtime) Handle(request *brainspinev1.RuntimeRequest) *brainspinev1.RuntimeResponse
func (*Runtime) Step ¶
func (runtime *Runtime) Step(observation *brainspinev1.Observation, nowTick uint64) *brainspinev1.Action
Step rejects stale, replayed and wrong-epoch observations. Braking is a simulation fallback policy, not a theorem about a physical vehicle.
type Service ¶
type Service struct {
// contains filtered or unexported fields
}
Service composes CSF capabilities and their generated HTTP/MCP operations. It opens no listener and owns no process.
func (*Service) AgentMCPHandler ¶
func (service *Service) AgentMCPHandler(authenticator *AgentMCPAuthenticator) http.Handler
AgentMCPHandler returns a streamable MCP HTTP handler that checks the bearer credential against both identity headers before exposing CSF's private request identity.
func (*Service) CancelSimulation ¶
func (service *Service) CancelSimulation(ctx context.Context, request *pb.CancelSimulationRequest) (*pb.CancelSimulationResponse, error)
func (*Service) Compile ¶
func (service *Service) Compile(ctx context.Context, request *pb.CompileRequest) (*pb.CompileResponse, error)
func (*Service) GetDocument ¶
func (service *Service) GetDocument(ctx context.Context, request *pb.GetDocumentRequest) (*pb.GetDocumentResponse, error)
func (*Service) GetGraph ¶
func (service *Service) GetGraph(ctx context.Context, request *pb.GetGraphRequest) (*pb.GetGraphResponse, error)
func (*Service) GetOwnAgentConfiguration ¶
func (service *Service) GetOwnAgentConfiguration(ctx context.Context, _ *pb.GetOwnAgentConfigurationRequest) (*pb.GetOwnAgentConfigurationResponse, error)
GetOwnAgentConfiguration returns the configuration selected by the signed transport identity. Callers cannot choose an agent ID through this API.
func (*Service) GetSnapshot ¶
func (service *Service) GetSnapshot(ctx context.Context, request *pb.GetSnapshotRequest) (*pb.GetSnapshotResponse, error)
func (*Service) GetWorkbenchTheme ¶
func (service *Service) GetWorkbenchTheme(ctx context.Context, request *pb.GetWorkbenchThemeRequest) (*pb.GetWorkbenchThemeResponse, error)
func (*Service) IngestDocument ¶
func (service *Service) IngestDocument(ctx context.Context, request *pb.IngestDocumentRequest) (*pb.IngestDocumentResponse, error)
func (*Service) InspectSimulation ¶
func (service *Service) InspectSimulation(ctx context.Context, request *pb.InspectSimulationRequest) (*pb.InspectSimulationResponse, error)
func (*Service) LearnAboutCSF ¶
func (service *Service) LearnAboutCSF(ctx context.Context, request *pb.LearnAboutCSFRequest) (*pb.LearnAboutCSFResponse, error)
func (*Service) ListSimulations ¶
func (service *Service) ListSimulations(ctx context.Context, request *pb.ListSimulationsRequest) (*pb.ListSimulationsResponse, error)
func (*Service) MCPHandler ¶
func (service *Service) MCPHandler() *mcp.StreamableHTTPHandler
MCPHandler supports legacy clients and per-request protocol metadata. Durable knowledge belongs to the service stores, so the HTTP transport is stateless.
func (*Service) PrepareAgentAssignment ¶
func (service *Service) PrepareAgentAssignment(ctx context.Context, request *pb.PrepareAgentAssignmentRequest) (*pb.PrepareAgentAssignmentResponse, error)
PrepareAgentAssignment prepares data only. The caller decides when to submit it; this capability allocates no session, worker, process or persistent state.
func (*Service) PutEdge ¶
func (service *Service) PutEdge(ctx context.Context, request *pb.PutEdgeRequest) (*pb.PutEdgeResponse, error)
func (*Service) PutNode ¶
func (service *Service) PutNode(ctx context.Context, request *pb.PutNodeRequest) (*pb.PutNodeResponse, error)
func (*Service) ReadSimulationLogs ¶
func (service *Service) ReadSimulationLogs(ctx context.Context, request *pb.ReadSimulationLogsRequest) (*pb.ReadSimulationLogsResponse, error)
func (*Service) RebuildSimulationTrace ¶
func (service *Service) RebuildSimulationTrace(ctx context.Context, request *pb.RebuildSimulationTraceRequest) (*pb.RebuildSimulationTraceResponse, error)
RebuildSimulationTrace derives versioned spans from OpenSearch alone. The durable delivery ledger prevents repeating an accepted or ambiguous export.
func (*Service) RecordSimulationEvents ¶
func (service *Service) RecordSimulationEvents(ctx context.Context, request *pb.RecordSimulationEventsRequest) (*pb.RecordSimulationEventsResponse, error)
func (*Service) ReloadWorkbenchTheme ¶
func (service *Service) ReloadWorkbenchTheme(ctx context.Context, request *pb.ReloadWorkbenchThemeRequest) (*pb.ReloadWorkbenchThemeResponse, error)
func (*Service) Search ¶
func (service *Service) Search(ctx context.Context, request *pb.SearchRequest) (*pb.SearchResponse, error)
func (*Service) SendEmail ¶
func (service *Service) SendEmail(ctx context.Context, request *emailv1.SendEmailRequest) (*emailv1.SendEmailResponse, error)
SendEmail accepts content only, and never accepts a caller-selected recipient or claimed provenance. Legacy unauthenticated HTTP/MCP routes fail closed.
func (*Service) ServeStdioMCP ¶
ServeStdioMCP serves the same generated tools over the caller process's standard input and output. The application still owns the process lifetime and cancellation context.
func (*Service) StartProjectionWorkers ¶
func (service *Service) StartProjectionWorkers(ctx context.Context) (*ProjectionWorkers, error)
StartProjectionWorkers starts one pool for this service. The caller closes it before closing the store, artifacts or shared OpenSearch client.
func (*Service) SubmitSimulation ¶
func (service *Service) SubmitSimulation(ctx context.Context, request *pb.SubmitSimulationRequest) (*pb.SubmitSimulationResponse, error)
func (*Service) UpdateOwnAgentConfiguration ¶
func (service *Service) UpdateOwnAgentConfiguration(ctx context.Context, request *pb.UpdateOwnAgentConfigurationRequest) (*pb.UpdateOwnAgentConfigurationResponse, error)
UpdateOwnAgentConfiguration replaces only the signed caller's references. expected_revision is a compare-and-swap precondition owned by the store.
type SimulationOption ¶
type SimulationOption func(simulations *Simulations)
func WithLocalSimulations ¶
func WithLocalSimulations(local *LocalSimulations) SimulationOption
func WithSimulationLogSearch ¶
func WithSimulationLogSearch(search *OpenSearch) SimulationOption
func WithSimulationTraces ¶
func WithSimulationTraces(client ISimulationTraces) SimulationOption
type Simulations ¶
type Simulations struct {
// contains filtered or unexported fields
}
Simulations owns job admission and observation; the application owns its worker lifetime.
func NewSimulations ¶
func NewSimulations(store *Postgres, artifacts *Artifacts, config *pb.SimulationConfig, provider IBatch, logs ISimulationLogs, options ...SimulationOption) (*Simulations, error)
type SourceCheck ¶
type SourceCheck func(ctx context.Context, request CheckRequest) error
type SourceFile ¶
These are in-process snapshots, not wire DTOs. Each check sees the exact bytes whose digest caused notification, including explicit missing files.
type SourceWatch ¶
type SourceWatch struct {
// contains filtered or unexported fields
}
func NewSourceWatch ¶
func NewSourceWatch(root string, paths []string, interval time.Duration, check SourceCheck) (*SourceWatch, error)
NewSourceWatch accepts only explicit relative files, bounded in count and size. Checks must honor ctx; a callback owns no additional watcher goroutine.
func (*SourceWatch) Start ¶
func (watch *SourceWatch) Start(ctx context.Context) (<-chan WatchResult, error)
Start captures the baseline before returning. One goroutine owns observation, checks and coalescing. A slow consumer applies backpressure, cancellably.
type WatchResult ¶
Source Files
¶
- agent_assignment.go
- agent_configuration.go
- agent_configuration_postgres.go
- agent_mcp_authentication.go
- agent_workbench.go
- api_cgen.go
- compiler.go
- dashboard.go
- email.go
- farm.go
- knowledge.go
- metrics.go
- metrics_simulations.go
- metrics_telemetry.go
- onboarding.go
- opensearch.go
- opensearch_client_cgen.go
- postgres.go
- projection.go
- projection_postgres.go
- runtime.go
- service.go
- simulation_artifacts.go
- simulation_local.go
- simulation_logs.go
- simulation_progress.go
- simulation_traces.go
- simulation_views.go
- simulation_views_gen.go
- simulation_views_seam.go
- simulations.go
- watch.go
- watch_checks.go
- workbench_theme.go

