handlers

package
v0.0.0-...-4a3d204 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const MaxPageLimit = 1000

MaxPageLimit is the hard ceiling on any list/recall page size. It caps the damage from an accidental or malicious `?limit=1000000`, which would otherwise turn into an unbounded scan + allocation.

Variables

This section is empty.

Functions

This section is empty.

Types

type AdminHandler

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

func NewAdminHandler

func NewAdminHandler(svc *service.AdminService) *AdminHandler

func (*AdminHandler) CryptoShredAnchor

func (h *AdminHandler) CryptoShredAnchor(w http.ResponseWriter, r *http.Request)

CryptoShredAnchor handles POST /v1/admin/anchors/{id}/shred — per-subject cryptographic erasure.

func (*AdminHandler) Redact

func (h *AdminHandler) Redact(w http.ResponseWriter, r *http.Request)

Redact handles POST /v1/admin/memories/{id}/redact — GDPR redaction.

func (*AdminHandler) Reembed

func (h *AdminHandler) Reembed(w http.ResponseWriter, r *http.Request)

Reembed handles POST /v1/admin/agents/{id}/reembed — recompute an agent's vectors under the currently configured embedding model (same dimension).

func (*AdminHandler) ResolveContradiction

func (h *AdminHandler) ResolveContradiction(w http.ResponseWriter, r *http.Request)

ResolveContradiction handles POST /v1/admin/contradictions/resolve.

func (*AdminHandler) ReviewAction

func (h *AdminHandler) ReviewAction(w http.ResponseWriter, r *http.Request)

ReviewAction handles POST /v1/memories/{id}/review — a human review-queue decision on a stale-flagged belief. action=verify resets freshness and clears the flag; action=dismiss clears the flag only. Both are recorded on the audit chain as their own mutation types.

func (*AdminHandler) UpdateMemory

func (h *AdminHandler) UpdateMemory(w http.ResponseWriter, r *http.Request)

UpdateMemory handles PATCH /v1/memories/{id} — an audited admin correction of a memory's confidence and/or content.

type AgentHandler

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

func NewAgentHandler

func NewAgentHandler(svc *service.AgentService) *AgentHandler

func (*AgentHandler) Create

func (h *AgentHandler) Create(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) Delete

func (h *AgentHandler) Delete(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) GetByID

func (h *AgentHandler) GetByID(w http.ResponseWriter, r *http.Request)

func (*AgentHandler) List

func (h *AgentHandler) List(w http.ResponseWriter, r *http.Request)

type AnchorHandler

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

AnchorHandler exposes anchors — the tenant-scoped referents that memory traces

func NewAnchorHandler

func NewAnchorHandler(anchors *store.EntityStore, memories *store.MemoryStore) *AnchorHandler

func (*AnchorHandler) Create

func (h *AnchorHandler) Create(w http.ResponseWriter, r *http.Request)

func (*AnchorHandler) Delete

func (h *AnchorHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete unlinks (default) or purges (?purge=true) an anchor. Purge is the GDPR/HIPAA erasure path: it hard-deletes the anchor's traces, then the anchor.

func (*AnchorHandler) GetByID

func (h *AnchorHandler) GetByID(w http.ResponseWriter, r *http.Request)

func (*AnchorHandler) List

func (h *AnchorHandler) List(w http.ResponseWriter, r *http.Request)

func (*AnchorHandler) ListMemories

func (h *AnchorHandler) ListMemories(w http.ResponseWriter, r *http.Request)

ListMemories returns an anchor's durable profile — the traces bound to it.

type AskHandler

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

AskHandler answers a natural-language question grounded in recalled memories. It can search one agent, several agents, or the whole tenant ("all agents as one memory"), then asks the configured LLM to synthesize an answer that cites the specific memories it used. It writes nothing.

func NewAskHandler

func NewAskHandler(hybrid *service.HybridRecallService, llm domain.LLMClient, agents *store.AgentStore, logger *zap.Logger) *AskHandler

func (*AskHandler) Ask

func (h *AskHandler) Ask(w http.ResponseWriter, r *http.Request)

Ask handles GET /v1/ask?query=...&agent_ids=<csv|all>&top_k=...

It is read-only, so it lives on GET (like recall) and does not require the "write" scope. An empty or "all" agent_ids searches every agent in the tenant as one unified memory; a comma-separated list fans out per agent and merges.

type AuditHandler

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

func NewAuditHandler

func NewAuditHandler(s *store.MutationLogStore, signingKey string) *AuditHandler

func (*AuditHandler) Chain

func (h *AuditHandler) Chain(w http.ResponseWriter, r *http.Request)

Chain handles GET /v1/audit/chain — returns recent hash-chain rows (with seq/prev_hash/row_hash) for visualizing the audit trail in the console. Optional ?agent_id= filters to one agent's records within the tenant chain; ?limit= caps how many (default 100, max 500).

func (*AuditHandler) Export

func (h *AuditHandler) Export(w http.ResponseWriter, r *http.Request)

Export handles GET /v1/audit/export — streams the tenant's full audit trail as NDJSON, with a trailer carrying the head hash and (if configured) an HMAC so a recipient can confirm origin and completeness.

func (*AuditHandler) Verify

func (h *AuditHandler) Verify(w http.ResponseWriter, r *http.Request)

Verify handles GET /v1/audit/verify — recomputes the tenant's hash chain and reports whether the audit trail is intact (tamper-evident).

type AuthHandler

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

func NewAuthHandler

func NewAuthHandler(svc *service.AuthService, sessionTTL time.Duration) *AuthHandler

func (*AuthHandler) Config

func (h *AuthHandler) Config(w http.ResponseWriter, r *http.Request)

Config tells the console which auth methods are available.

func (*AuthHandler) CreateOrg

func (h *AuthHandler) CreateOrg(w http.ResponseWriter, r *http.Request)

CreateOrg provisions a new organization for the signed-in user and switches the session to it.

func (*AuthHandler) Login

func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request)

func (*AuthHandler) Logout

func (h *AuthHandler) Logout(w http.ResponseWriter, r *http.Request)

func (*AuthHandler) Me

func (*AuthHandler) OAuthCallback

func (h *AuthHandler) OAuthCallback(w http.ResponseWriter, r *http.Request)

OAuthCallback completes the flow: validates state, exchanges the code, fetches the profile, logs the user in, and redirects to the console.

func (*AuthHandler) OAuthStart

func (h *AuthHandler) OAuthStart(w http.ResponseWriter, r *http.Request)

OAuthStart redirects the browser to the provider's consent screen.

func (*AuthHandler) Register

func (h *AuthHandler) Register(w http.ResponseWriter, r *http.Request)

func (*AuthHandler) SSOCallback

func (h *AuthHandler) SSOCallback(w http.ResponseWriter, r *http.Request)

SSOCallback handles GET /auth/sso/callback — exchange the code with WorkOS, which returns the (IdP-verified) user, then start a session.

func (*AuthHandler) SSOStart

func (h *AuthHandler) SSOStart(w http.ResponseWriter, r *http.Request)

SSOStart handles GET /auth/sso/start — redirect to WorkOS AuthKit.

func (*AuthHandler) SwitchTenant

func (h *AuthHandler) SwitchTenant(w http.ResponseWriter, r *http.Request)

type BillingHandler

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

BillingHandler serves the managed-cloud billing surface: current plan + usage, Razorpay subscription creation, client-side payment verification, cancellation, and the Razorpay webhook.

func NewBillingHandler

func NewBillingHandler(store domain.BillingStore, rzp *billing.Client, baseURL string, logger *zap.Logger) *BillingHandler

func (*BillingHandler) Cancel

func (h *BillingHandler) Cancel(w http.ResponseWriter, r *http.Request)

Cancel cancels the org's Razorpay subscription at the end of the current billing cycle. Razorpay has no hosted customer portal, so this replaces it. The downgrade to the free tier arrives via the subscription.cancelled webhook.

func (*BillingHandler) ChangePlan

func (h *BillingHandler) ChangePlan(w http.ResponseWriter, r *http.Request)

ChangePlan switches an already-subscribed org between self-serve plans by updating its existing Razorpay subscription in place — no new Checkout modal. Downgrades are scheduled for the end of the current billing cycle (the org keeps what it paid for); upgrades apply immediately. The subscription.* webhook remains the source of truth. Only card mandates can be updated; UPI/eMandate subscriptions return 409.

func (*BillingHandler) Checkout

func (h *BillingHandler) Checkout(w http.ResponseWriter, r *http.Request)

Checkout creates a Razorpay subscription for a self-serve plan upgrade and returns the subscription id + public key the browser needs to open the Checkout modal. The subscription only becomes active once payment succeeds (verified via /verify and the subscription.* webhooks).

func (*BillingHandler) Get

Get returns the org's plan, limits, and current-period usage for the console.

func (*BillingHandler) Verify

func (h *BillingHandler) Verify(w http.ResponseWriter, r *http.Request)

Verify validates the signature returned by the Checkout modal's success handler. On success it optimistically marks the org active so the console reflects the upgrade immediately; the subscription.* webhook remains the source of truth for the plan and ongoing status.

func (*BillingHandler) Webhook

func (h *BillingHandler) Webhook(w http.ResponseWriter, r *http.Request)

Webhook receives Razorpay events (unauthenticated; verified via signature) and reconciles the org's plan. Always returns 200 on a well-formed, verified event so Razorpay stops retrying. Orgs are resolved from the subscription's notes[tenant_id].

type CanonHandler

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

func NewCanonHandler

func NewCanonHandler(svc *service.MemoryService, memories *store.MemoryStore) *CanonHandler

func (*CanonHandler) Create

func (h *CanonHandler) Create(w http.ResponseWriter, r *http.Request)

func (*CanonHandler) Delete

func (h *CanonHandler) Delete(w http.ResponseWriter, r *http.Request)

func (*CanonHandler) List

func (h *CanonHandler) List(w http.ResponseWriter, r *http.Request)

type CognitiveHandler

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

func (*CognitiveHandler) GetCalibration

func (h *CognitiveHandler) GetCalibration(w http.ResponseWriter, r *http.Request)

func (*CognitiveHandler) GetConfidenceStats

func (h *CognitiveHandler) GetConfidenceStats(w http.ResponseWriter, r *http.Request)

func (*CognitiveHandler) GetMemoryHealth

func (h *CognitiveHandler) GetMemoryHealth(w http.ResponseWriter, r *http.Request)

GetMemoryHealth returns statistics about the memory system health for an agent.

func (*CognitiveHandler) PenalizeMemory

func (h *CognitiveHandler) PenalizeMemory(w http.ResponseWriter, r *http.Request)

func (*CognitiveHandler) ReinforceMemory

func (h *CognitiveHandler) ReinforceMemory(w http.ResponseWriter, r *http.Request)

func (*CognitiveHandler) SetCalibrationService

func (h *CognitiveHandler) SetCalibrationService(cs *service.CalibrationService)

func (*CognitiveHandler) SetConfidenceService

func (h *CognitiveHandler) SetConfidenceService(cs *service.ConfidenceService)

func (*CognitiveHandler) TriggerConsolidation

func (h *CognitiveHandler) TriggerConsolidation(w http.ResponseWriter, r *http.Request)

TriggerConsolidation manually triggers the consolidation pipeline for an agent.

func (*CognitiveHandler) TriggerDecay

func (h *CognitiveHandler) TriggerDecay(w http.ResponseWriter, r *http.Request)

type ConsoleHandler

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

func NewConsoleHandler

func NewConsoleHandler(svc *service.ConsoleService) *ConsoleHandler

func (*ConsoleHandler) Contradictions

func (h *ConsoleHandler) Contradictions(w http.ResponseWriter, r *http.Request)

Contradictions handles GET /v1/agents/{id}/contradictions.

func (*ConsoleHandler) Dashboard

func (h *ConsoleHandler) Dashboard(w http.ResponseWriter, r *http.Request)

Dashboard handles GET /v1/agents/{id}/dashboard.

func (*ConsoleHandler) Memories

func (h *ConsoleHandler) Memories(w http.ResponseWriter, r *http.Request)

Memories handles GET /v1/agents/{id}/memories?tier=&type=&limit=&offset=.

func (*ConsoleHandler) ReviewQueue

func (h *ConsoleHandler) ReviewQueue(w http.ResponseWriter, r *http.Request)

ReviewQueue handles GET /v1/agents/{id}/review-queue.

func (*ConsoleHandler) Snapshot

func (h *ConsoleHandler) Snapshot(w http.ResponseWriter, r *http.Request)

Snapshot handles GET /v1/agents/{id}/snapshot?at=<RFC3339> — beliefs as of a past instant (defaults to now).

type ConversationHandler

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

func NewConversationHandler

func NewConversationHandler(svc *service.ConversationService, anchors *store.EntityStore, sessions *store.SessionStore) *ConversationHandler

func (*ConversationHandler) Ingest

Ingest handles POST /v1/agents/{id}/conversations/ingest.

type DocumentHandler

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

DocumentHandler ingests an uploaded document (PDF/DOCX/XLSX/Markdown/text) as memories for a single agent. Two modes: "extract" runs the LLM to pull atomic beliefs from each chunk; "verbatim" stores each chunk as-is. Everything flows through MemoryService.Create, so embeddings, contradiction detection, the Provenance Firewall, and the audit chain apply exactly as for any other write.

func NewDocumentHandler

func NewDocumentHandler(memories *service.MemoryService, llm domain.LLMClient, agents *store.AgentStore, anchors *store.EntityStore, billing domain.BillingStore, billingEnabled bool, logger *zap.Logger) *DocumentHandler

func (*DocumentHandler) Ingest

func (h *DocumentHandler) Ingest(w http.ResponseWriter, r *http.Request)

Ingest handles POST /v1/documents/ingest (multipart/form-data):

file       the document (required)
agent_id   target agent UUID (required)
mode       "extract" (default) or "verbatim"
quarantine "true" to hold writes for review (Provenance Firewall)

type EmbeddingHandler

type EmbeddingHandler struct{}

EmbeddingHandler exposes the deployment's active embedding configuration (read-only). The model/dimension are a deploy-time choice shared by all tenants, so this is informational, not editable.

func NewEmbeddingHandler

func NewEmbeddingHandler() *EmbeddingHandler

func (*EmbeddingHandler) Info

Info handles GET /v1/embedding/info.

type EpisodeHandler

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

func NewEpisodeHandler

func NewEpisodeHandler(svc *service.EpisodeService) *EpisodeHandler

func (*EpisodeHandler) Create

func (h *EpisodeHandler) Create(w http.ResponseWriter, r *http.Request)

func (*EpisodeHandler) GetAssociations

func (h *EpisodeHandler) GetAssociations(w http.ResponseWriter, r *http.Request)

func (*EpisodeHandler) GetByID

func (h *EpisodeHandler) GetByID(w http.ResponseWriter, r *http.Request)

func (*EpisodeHandler) Recall

func (h *EpisodeHandler) Recall(w http.ResponseWriter, r *http.Request)

func (*EpisodeHandler) RecordOutcome

func (h *EpisodeHandler) RecordOutcome(w http.ResponseWriter, r *http.Request)

type FeedbackHandler

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

func NewFeedbackHandler

func NewFeedbackHandler(svc *service.FeedbackService) *FeedbackHandler

func (*FeedbackHandler) Create

func (h *FeedbackHandler) Create(w http.ResponseWriter, r *http.Request)

type GraphHandler

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

func NewGraphHandler

func NewGraphHandler(
	hybridSvc *service.HybridRecallService,
	graphSvc *service.GraphBuilderService,
	graphStore domain.GraphStore,
	entityStore domain.EntityStore,
	agentStore domain.AgentStore,
	memoryStore domain.MemoryStore,
) *GraphHandler

func (*GraphHandler) GetRelationships

func (h *GraphHandler) GetRelationships(w http.ResponseWriter, r *http.Request)

func (*GraphHandler) HybridRecall

func (h *GraphHandler) HybridRecall(w http.ResponseWriter, r *http.Request)

func (*GraphHandler) ListEntities

func (h *GraphHandler) ListEntities(w http.ResponseWriter, r *http.Request)

func (*GraphHandler) Traverse

func (h *GraphHandler) Traverse(w http.ResponseWriter, r *http.Request)

type LearningHandler

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

func NewLearningHandler

func NewLearningHandler(
	learningSvc *service.LearningService,
	implicitFeedbackSvc *service.ImplicitFeedbackDetector,
	mutationLogStore domain.MutationLogStore,
	agentStore domain.AgentStore,
) *LearningHandler

func (*LearningHandler) DetectImplicitFeedback

func (h *LearningHandler) DetectImplicitFeedback(w http.ResponseWriter, r *http.Request)

DetectImplicitFeedback handles POST /v1/learning/detect-feedback

func (*LearningHandler) GetMutationHistory

func (h *LearningHandler) GetMutationHistory(w http.ResponseWriter, r *http.Request)

GetMutationHistory handles GET /v1/memories/:id/mutations

func (*LearningHandler) GetStats

func (h *LearningHandler) GetStats(w http.ResponseWriter, r *http.Request)

GetStats handles GET /v1/agents/:id/learning/stats

func (*LearningHandler) RecordOutcome

func (h *LearningHandler) RecordOutcome(w http.ResponseWriter, r *http.Request)

RecordOutcome handles POST /v1/learning/outcome

type MCPHandler

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

MCPHandler serves the MCP Streamable HTTP transport in-process, so any MCP client can connect to <server>/mcp with just an Engram API key — no local engram-mcp binary, no env vars:

claude mcp add --transport http engram \
  "https://console.hakuya.ai/mcp?agent_id=your-agent-id" \
  --header "Authorization: Bearer mk_or_rk_key"

The transport is stateless: each POST is one JSON-RPC call. Per request we build an MCP server bound to the caller's key. Tool calls run against this same server's REST stack via an in-process transport (httpClient) — no socket, so tenant isolation, key scopes, quota, and audit are enforced exactly as for a direct API call, with no network hop. An optional default agent may be given as ?agent_id= or the X-Engram-Agent-Id header (otherwise tools take agent_id as a parameter). An optional ?subject= (or X-Engram-Subject) binds the whole connection to one subject/anchor, so every write/recall is scoped to it.

Auth is enforced by the APIKeyAuth middleware mounted in front of this route, which rejects missing/invalid keys with 401 before we get here.

func NewMCPHandler

func NewMCPHandler(httpClient *http.Client) *MCPHandler

NewMCPHandler builds the embedded MCP endpoint. httpClient must be backed by the in-process transport that dispatches to this server's router.

func (*MCPHandler) Handle

func (h *MCPHandler) Handle(w http.ResponseWriter, r *http.Request)

Handle dispatches a single MCP JSON-RPC request.

type MemoryHandler

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

func NewMemoryHandler

func NewMemoryHandler(svc *service.MemoryService, hybridSvc *service.HybridRecallService, anchors *store.EntityStore, sessions *store.SessionStore) *MemoryHandler

func (*MemoryHandler) Create

func (h *MemoryHandler) Create(w http.ResponseWriter, r *http.Request)

func (*MemoryHandler) Delete

func (h *MemoryHandler) Delete(w http.ResponseWriter, r *http.Request)

func (*MemoryHandler) Extract

func (h *MemoryHandler) Extract(w http.ResponseWriter, r *http.Request)

func (*MemoryHandler) GetByID

func (h *MemoryHandler) GetByID(w http.ResponseWriter, r *http.Request)

func (*MemoryHandler) ListQuarantine

func (h *MemoryHandler) ListQuarantine(w http.ResponseWriter, r *http.Request)

ListQuarantine returns the Provenance Firewall review queue for an agent.

func (*MemoryHandler) Recall

func (h *MemoryHandler) Recall(w http.ResponseWriter, r *http.Request)

func (*MemoryHandler) RejectQuarantine

func (h *MemoryHandler) RejectQuarantine(w http.ResponseWriter, r *http.Request)

RejectQuarantine permanently discards a quarantined trace.

func (*MemoryHandler) ReleaseQuarantine

func (h *MemoryHandler) ReleaseQuarantine(w http.ResponseWriter, r *http.Request)

ReleaseQuarantine admits a quarantined trace into active memory.

func (*MemoryHandler) Restore

func (h *MemoryHandler) Restore(w http.ResponseWriter, r *http.Request)

type MetacognitiveHandler

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

MetacognitiveHandler handles metacognitive reflection endpoints.

func NewMetacognitiveHandler

func NewMetacognitiveHandler(ms *service.MetacognitiveService) *MetacognitiveHandler

NewMetacognitiveHandler creates a new metacognitive handler.

func (*MetacognitiveHandler) AssessConfidence

func (h *MetacognitiveHandler) AssessConfidence(w http.ResponseWriter, r *http.Request)

AssessConfidence handles GET /v1/cognitive/confidence for assessing a single memory.

func (*MetacognitiveHandler) DetectUncertainty

func (h *MetacognitiveHandler) DetectUncertainty(w http.ResponseWriter, r *http.Request)

DetectUncertainty handles GET /v1/cognitive/uncertainty for detecting uncertainty areas.

func (*MetacognitiveHandler) Reflect

Reflect handles POST /v1/cognitive/reflect.

type MindHandler

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

MindHandler provides observability into an agent's cognitive state.

func (*MindHandler) GetMind

func (h *MindHandler) GetMind(w http.ResponseWriter, r *http.Request)

GetMind returns a comprehensive view of an agent's cognitive state. GET /v1/agents/{id}/mind

type ObservabilityHandler

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

ObservabilityHandler serves the per-tenant observability snapshot: usage vs quota, estimated COGS, request performance, belief-health, scale, and audit. Gated behind the Observability plan feature (managed-cloud premium).

func NewObservabilityHandler

func NewObservabilityHandler(billing domain.BillingStore, memories *store.MemoryStore, agents *store.AgentStore, anchors *store.EntityStore, mutations *store.MutationLogStore, metrics *observability.Registry, logger *zap.Logger) *ObservabilityHandler

func (*ObservabilityHandler) Overview

Overview handles GET /v1/observability/overview.

type OverviewHandler

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

OverviewHandler serves the console landing "cockpit": a tenant-wide rollup of belief health, the unified attention queue (needs-review + quarantine + contradictions), audit-chain integrity, a recent-activity series, and a per-agent knowledge-health summary. Unlike the premium observability snapshot it carries no usage/cost/latency data and is available on every plan — it is the home screen, not a billed feature.

func NewOverviewHandler

func NewOverviewHandler(console *service.ConsoleService, memories *store.MemoryStore, agents *store.AgentStore, anchors *store.EntityStore, mutations *store.MutationLogStore, logger *zap.Logger) *OverviewHandler

func (*OverviewHandler) Overview

func (h *OverviewHandler) Overview(w http.ResponseWriter, r *http.Request)

Overview handles GET /v1/overview.

type PolicyHandler

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

func NewPolicyHandler

func NewPolicyHandler(svc *service.PolicyService) *PolicyHandler

func (*PolicyHandler) Get

func (*PolicyHandler) Upsert

func (h *PolicyHandler) Upsert(w http.ResponseWriter, r *http.Request)

type ProcedureHandler

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

func NewProcedureHandler

func NewProcedureHandler(svc *service.ProceduralService) *ProcedureHandler

func (*ProcedureHandler) GetByID

func (h *ProcedureHandler) GetByID(w http.ResponseWriter, r *http.Request)

GetByID retrieves a specific procedure. GET /v1/procedures/:id

func (*ProcedureHandler) LearnFromEpisode

func (h *ProcedureHandler) LearnFromEpisode(w http.ResponseWriter, r *http.Request)

LearnFromEpisode extracts procedures from an episode outcome. POST /v1/procedures/learn

func (*ProcedureHandler) Match

Match finds procedures applicable to the current situation. POST /v1/procedures/match

func (*ProcedureHandler) RecordOutcome

func (h *ProcedureHandler) RecordOutcome(w http.ResponseWriter, r *http.Request)

RecordOutcome records the success/failure of using a procedure. POST /v1/procedures/:id/outcome

type SchemaHandler

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

func NewSchemaHandler

func NewSchemaHandler(svc *service.SchemaService) *SchemaHandler

func (*SchemaHandler) Contradict

func (h *SchemaHandler) Contradict(w http.ResponseWriter, r *http.Request)

Contradict records a contradiction for a schema. POST /v1/schemas/:id/contradict

func (*SchemaHandler) Delete

func (h *SchemaHandler) Delete(w http.ResponseWriter, r *http.Request)

Delete removes a schema. DELETE /v1/schemas/:id

func (*SchemaHandler) Detect

func (h *SchemaHandler) Detect(w http.ResponseWriter, r *http.Request)

Detect triggers schema detection for an agent. POST /v1/schemas/detect

func (*SchemaHandler) GetByID

func (h *SchemaHandler) GetByID(w http.ResponseWriter, r *http.Request)

GetByID retrieves a specific schema. GET /v1/schemas/:id

func (*SchemaHandler) List

func (h *SchemaHandler) List(w http.ResponseWriter, r *http.Request)

List retrieves all schemas for an agent. GET /v1/schemas?agent_id=...

func (*SchemaHandler) Match

func (h *SchemaHandler) Match(w http.ResponseWriter, r *http.Request)

Match finds schemas that apply to the current situation. POST /v1/schemas/match

func (*SchemaHandler) Validate

func (h *SchemaHandler) Validate(w http.ResponseWriter, r *http.Request)

Validate validates a schema. POST /v1/schemas/:id/validate

type SessionHandler

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

func NewSessionHandler

func NewSessionHandler(sessions *store.SessionStore, anchors *store.EntityStore, agents domain.AgentStore, ttl time.Duration) *SessionHandler

func (*SessionHandler) Create

func (h *SessionHandler) Create(w http.ResponseWriter, r *http.Request)

func (*SessionHandler) End

End closes a session and sets when its memory should be swept.

func (*SessionHandler) GetByID

func (h *SessionHandler) GetByID(w http.ResponseWriter, r *http.Request)

type SettingsHandler

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

SettingsHandler exposes per-tenant engine tuning (decay, confidence deltas, competition) so operators can adjust the cognitive engine without a redeploy.

func NewSettingsHandler

func NewSettingsHandler(store domain.TenantSettingsStore) *SettingsHandler

func (*SettingsHandler) Get

Get returns the tenant's effective engine settings (defaults if never set).

func (*SettingsHandler) Update

func (h *SettingsHandler) Update(w http.ResponseWriter, r *http.Request)

Update upserts the tenant's engine settings. Values are sanitized (clamped to safe ranges) before persistence so a bad write can't destabilize the engine.

type SetupHandler

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

SetupHandler handles bootstrap and API key management endpoints.

func NewSetupHandler

func NewSetupHandler(ts domain.TenantStore, aks domain.APIKeyStore, setupToken string) *SetupHandler

func (*SetupHandler) Bootstrap

func (h *SetupHandler) Bootstrap(w http.ResponseWriter, r *http.Request)

Bootstrap creates a new tenant and its first master key atomically. Requires the X-Setup-Token header to match ENGRAM_SETUP_TOKEN.

func (*SetupHandler) CreateKey

func (h *SetupHandler) CreateKey(w http.ResponseWriter, r *http.Request)

CreateKey creates a new API key for the authenticated tenant.

func (*SetupHandler) ListKeys

func (h *SetupHandler) ListKeys(w http.ResponseWriter, r *http.Request)

ListKeys returns all active keys for the authenticated tenant.

func (*SetupHandler) RevokeKey

func (h *SetupHandler) RevokeKey(w http.ResponseWriter, r *http.Request)

RevokeKey revokes a key by ID. Immediate effect on the next request using that key.

type TenantHandler

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

TenantHandler exposes the legacy POST /v1/tenants endpoint. Deprecated: use POST /v1/setup instead.

func NewTenantHandler

func NewTenantHandler(ts domain.TenantStore, aks domain.APIKeyStore, setupToken string) *TenantHandler

func (*TenantHandler) Create

func (h *TenantHandler) Create(w http.ResponseWriter, r *http.Request)

Create is the legacy tenant bootstrap endpoint. It mints a tenant plus a full-scope master key, so it carries the same X-Setup-Token gate as /v1/setup: with no token configured it is disabled entirely. Deprecated — callers receive a Deprecation header.

type TierHandler

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

func NewTierHandler

func NewTierHandler(memorySvc *service.MemoryService) *TierHandler

func (*TierHandler) GetHotMemories

func (h *TierHandler) GetHotMemories(w http.ResponseWriter, r *http.Request)

func (*TierHandler) GetTierStats

func (h *TierHandler) GetTierStats(w http.ResponseWriter, r *http.Request)

type WorkingMemoryHandler

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

func (*WorkingMemoryHandler) Activate

Activate performs intelligent memory activation for a task. POST /v1/cognitive/activate

func (*WorkingMemoryHandler) ClearSession

func (h *WorkingMemoryHandler) ClearSession(w http.ResponseWriter, r *http.Request)

ClearSession clears the working memory session. DELETE /v1/cognitive/session

func (*WorkingMemoryHandler) GetSession

func (h *WorkingMemoryHandler) GetSession(w http.ResponseWriter, r *http.Request)

GetSession retrieves the current working memory session. GET /v1/cognitive/session?agent_id=...

func (*WorkingMemoryHandler) UpdateGoal

func (h *WorkingMemoryHandler) UpdateGoal(w http.ResponseWriter, r *http.Request)

UpdateGoal updates the current goal in working memory. PUT /v1/cognitive/goal

Jump to

Keyboard shortcuts

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