core

package
v0.0.0-...-d59b4eb Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2026 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package core contains the shared observe → reason → record cycle logic used by both the HTTP server (main.go) and the Lambda handler (cmd/lambda/).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func EnvOr

func EnvOr(key, fallback string) string

EnvOr reads an environment variable with a fallback default.

func MustEnv

func MustEnv(key string) string

MustEnv reads a required environment variable or fatally exits.

Types

type CycleResult

type CycleResult struct {
	DecisionID string  `json:"decisionId"`
	ActionType string  `json:"actionType"`
	Confidence float64 `json:"confidence"`
	Situation  string  `json:"situation"`
	Status     string  `json:"status"`
	Error      string  `json:"error,omitempty"`
}

CycleResult summarizes the outcome of one observe-reason-record cycle.

func RunObserveReasonCycle

func RunObserveReasonCycle(ctx context.Context, mcpClient *mcp.Client, skillLoader *skills.Loader, store *decisions.Store, orchestratorURL string, monitor *monitoring.Monitor) CycleResult

RunObserveReasonCycle executes the observe → consult → reason → record loop. Returns a CycleResult summarizing the outcome. If monitor is non-nil, publishes CloudWatch metrics at the end of each cycle.

type ExecuteRequest

type ExecuteRequest struct {
	DecisionID string `json:"decisionId"`
	ActionType string `json:"actionType"`
}

ExecuteRequest is the payload for the POST /execute safety gate.

type ReasonRequest

type ReasonRequest struct {
	MCPContext     map[string]interface{} `json:"mcpContext"`
	RelevantSkills []SkillPayload         `json:"relevantSkills"`
	Situation      string                 `json:"situation"`
}

ReasonRequest is the payload sent to node-orchestrator's POST /reason.

type ReasonResponse

type ReasonResponse struct {
	ActionType    string    `json:"actionType"`
	ReasoningText string    `json:"reasoningText"`
	Embedding     []float32 `json:"embedding"`
	Confidence    float64   `json:"confidence"`
	CcloudCommand *string   `json:"ccloudCommand"`
}

ReasonResponse is the structured decision returned by POST /reason.

func CallReasonEndpoint

func CallReasonEndpoint(orchestratorURL string, reqPayload ReasonRequest) (*ReasonResponse, error)

CallReasonEndpoint sends the cluster state & skills to node-orchestrator's /reason route.

type SkillPayload

type SkillPayload struct {
	Name string `json:"name"`
	Body string `json:"body"`
}

SkillPayload represents a skill sent to the reasoning endpoint.

Jump to

Keyboard shortcuts

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