export type UInt64 = number | string | bigint; export type UInt128 = string | bigint; export type AgentId = UInt64; export type ContextHash = UInt64; export type EventId = UInt128; export type SessionId = UInt64; export type GoalId = UInt64; export type MetadataValue = { String: string; } | { Integer: number; } | { Float: number; } | { Boolean: boolean; } | { Json: any; }; export interface Event { id?: EventId; timestamp?: number | string; agent_id: AgentId; agent_type: string; session_id: SessionId; event_type: EventType; causality_chain: EventId[]; context: EventContext; metadata: Record; context_size_bytes: number; segment_pointer: string | null; /** Set to true for events containing source code. Activates code tokenizer, code BM25 indexing, and NLQ code routing. */ is_code?: boolean; } export type EventType = { Action: ActionEvent; } | { Observation: ObservationEvent; } | { Cognitive: CognitiveEvent; } | { Communication: CommunicationEvent; } | { Learning: { event: LearningEvent; }; } | { Context: ContextEvent; }; export interface ContextEvent { text: string; context_type: string; language?: string; } /** A memory was retrieved in response to a query. */ export type MemoryRetrievedEvent = { MemoryRetrieved: { query_id: string; memory_ids: UInt64[]; }; }; /** A specific memory was used to inform a decision. */ export type MemoryUsedEvent = { MemoryUsed: { query_id: string; memory_id: UInt64; }; }; /** Strategies were served as candidates for a query. */ export type StrategyServedEvent = { StrategyServed: { query_id: string; strategy_ids: number[]; }; }; /** A specific strategy was selected and used. */ export type StrategyUsedEvent = { StrategyUsed: { query_id: string; strategy_id: number; }; }; /** The outcome of an action taken based on recalled data. */ export type OutcomeEvent = { Outcome: { query_id: string; success: boolean; }; }; /** Claims were retrieved in response to a query. */ export type ClaimRetrievedEvent = { ClaimRetrieved: { query_id: string; claim_ids: UInt64[]; }; }; /** A specific claim was used to inform a decision. */ export type ClaimUsedEvent = { ClaimUsed: { query_id: string; claim_id: UInt64; }; }; export type LearningEvent = MemoryRetrievedEvent | MemoryUsedEvent | StrategyServedEvent | StrategyUsedEvent | OutcomeEvent | ClaimRetrievedEvent | ClaimUsedEvent; export interface ActionEvent { action_name: string; parameters: any; outcome: ActionOutcome; duration_ns: number | bigint; } export interface ObservationEvent { observation_type: string; data: any; confidence: number; source: string; } export interface CognitiveEvent { process_type: CognitiveType; input: any; output: any; reasoning_trace: string[]; } export interface CommunicationEvent { message_type: string; sender: AgentId; recipient: AgentId; content: any; } export type ActionOutcome = { Success: { result: any; }; } | { Failure: { error: string; error_code: number; }; } | { Partial: { result: any; issues: string[]; }; }; export type CognitiveType = "GoalFormation" | "Planning" | "Reasoning" | "MemoryRetrieval" | "LearningUpdate"; export interface BoundingBox { min: [number, number, number]; max: [number, number, number]; } export interface SpatialContext { location: [number, number, number]; bounds: BoundingBox | null; reference_frame: string; } export interface TimeOfDay { hour: number; minute: number; timezone: string; } export interface Deadline { goal_id: UInt64; timestamp: number; priority: number; } export interface TemporalPattern { pattern_name: string; frequency: number; phase: number; } export interface TemporalContext { time_of_day: TimeOfDay | null; deadlines: Deadline[]; patterns: TemporalPattern[]; } export interface EnvironmentState { variables: Record; spatial: SpatialContext | null; temporal: TemporalContext; } export interface Goal { id: UInt64; description: string; priority: number; deadline: number | null; progress: number; subgoals: UInt64[]; } export interface ComputationalResources { cpu_percent: number; memory_bytes: number; storage_bytes: number; network_bandwidth: number; } export interface ResourceAvailability { available: boolean; capacity: number; current_usage: number; estimated_cost: number | null; } export interface ResourceState { computational: ComputationalResources; external: Record; } export interface EventContext { environment: EnvironmentState; active_goals: Goal[]; resources: ResourceState; fingerprint?: ContextHash; goal_bucket_id?: number; embeddings: number[] | null; } export interface ProcessEventRequest { event: Event; enable_semantic?: boolean; } export interface ProcessEventResponse { success: boolean; event_id?: string; nodes_created: number; patterns_detected: number; processing_time_ms: number; claims_extracted?: number; } export interface PaginationQuery { limit?: number; } export interface ActionSuggestionsQuery { context_hash: ContextHash; last_action_node?: number; limit?: number; } export interface ClaimSearchRequest { query_text: string; top_k?: number; min_similarity?: number; } export interface ClaimSearchGroup { subject: string; claims: ClaimResponse[]; } export interface ClaimSearchResponse { groups: ClaimSearchGroup[]; ungrouped: ClaimResponse[]; total_results: number; } export interface EvidenceSpan { start_offset: number; end_offset: number; text_snippet: string; } export interface ClaimEntity { text: string; label: string; } export interface ClaimResponse { claim_id: UInt64; claim_text: string; confidence: number; source_event_id: UInt64; similarity: number | null; evidence_spans: EvidenceSpan[]; support_count: number; status: string; created_at: number | string; last_accessed: number | string; claim_type: string; subject_entity: string | null; expires_at: number | string | null; temporal_weight: number; superseded_by: UInt64 | null; entities: ClaimEntity[]; } export interface MemoryResponse { id: UInt64; agent_id: AgentId; session_id: SessionId; /** Natural language summary of what happened. */ summary: string; /** The single most important lesson from this experience. */ takeaway: string; /** Why it succeeded or failed — identifies the key causal factors. */ causal_note: string; /** Memory tier: Episodic → Semantic → Schema. */ tier: "Episodic" | "Semantic" | "Schema"; /** Consolidation lifecycle status. */ consolidation_status: "Active" | "Consolidated" | "Archived"; /** If consolidated into a schema, the parent schema memory ID. */ schema_id?: UInt64; /** For Semantic/Schema memories, the IDs of memories that were merged. */ consolidated_from?: UInt64[]; strength: number; relevance_score: number; access_count: number; formed_at: number | string; last_accessed: number | string; context_hash: ContextHash; context: EventContext; outcome: string; memory_type: string; } export interface ContextMemoriesRequest { context: EventContext; limit?: number; min_similarity?: number; agent_id?: AgentId; session_id?: SessionId; } export interface PlaybookBranch { /** The condition that triggers this branch. */ condition: string; /** What to do when this condition is met. */ action: string; } export interface PlaybookStep { /** Step number (1-indexed). */ step: number; /** What to do at this step. */ action: string; /** Prerequisite condition (when to execute). */ condition: string; /** Condition under which this step should be skipped. */ skip_if: string; /** Recovery instruction if this step fails. */ recovery: string; /** Conditional alternative actions. */ branches: PlaybookBranch[]; } export interface StrategyResponse { id: number; name: string; agent_id: AgentId; /** Natural language summary of the strategy. */ summary: string; /** Specific conditions where this strategy applies. */ when_to_use: string; /** Conditions where this strategy should NOT be used. */ when_not_to_use: string; /** Known failure modes with recovery hints. */ failure_modes: string[]; /** Executable steps with branching and recovery logic. */ playbook: PlaybookStep[]; /** What would have happened with a different approach. */ counterfactual: string; /** IDs of strategies this one replaces (version lineage). */ supersedes: UInt64[]; /** Cross-domain applicability tags. */ applicable_domains: string[]; quality_score: number; success_count: number; failure_count: number; reasoning_steps: ReasoningStepResponse[]; strategy_type: string; support_count: number; expected_success: number; expected_cost: number; expected_value: number; confidence: number; goal_bucket_id: number; behavior_signature: string; precondition: string; action_hint: string; } export interface SimilarStrategyResponse extends StrategyResponse { /** Similarity score from the multi-dimensional match. */ score: number; } export interface StrategySimilarityRequest { goal_ids?: UInt64[]; tool_names?: string[]; result_types?: string[]; context_hash?: ContextHash; agent_id?: AgentId; limit?: number; min_score?: number; } export interface ReasoningStepResponse { description: string; applicability?: string; expected_outcome?: string; sequence_order: number; } export interface ActionSuggestionResponse { action_name: string; success_probability: number; evidence_count: number; reasoning: string; } export interface EpisodeResponse { id: UInt64; agent_id: AgentId; event_count: number; significance: number; outcome: string | null; } export interface StatsResponse { total_events_processed: number; total_nodes_created: number; total_episodes_detected: number; total_memories_formed: number; total_strategies_extracted: number; total_reinforcements_applied: number; average_processing_time_ms: number; stores: { memories: { total: number; avg_strength: number; avg_access_count: number; agents_with_memories: number; }; strategies: { total: number; high_quality: number; avg_quality: number; agents_with_strategies: number; }; claims: { total: number; embeddings_indexed: number; }; graph: { nodes: number; edges: number; avg_degree: number; largest_component: number; }; }; } export interface GraphNodeResponse { id: number; label: string; node_type: string; created_at: number; properties: Record; } export interface GraphEdgeResponse { id: number; from: number; to: number; edge_type: string; weight: number; confidence: number; } export interface GraphResponse { nodes: GraphNodeResponse[]; edges: GraphEdgeResponse[]; } export interface LearningMetricsResponse { total_events: number; unique_contexts: number; learned_patterns: number; strong_memories: number; overall_success_rate: number; average_edge_weight: number; } export interface AnalyticsResponse { node_count: number; edge_count: number; connected_components: number; largest_component_size: number; average_path_length: number; diameter: number; clustering_coefficient: number; average_clustering: number; modularity: number; community_count: number; learning_metrics: LearningMetricsResponse; } export interface GraphQuery { limit?: number; session_id?: SessionId; agent_type?: string; } export interface GraphContextQuery extends GraphQuery { context_hash: ContextHash; } export interface GraphQueryFilter { key: string; value: string | number | boolean; operator?: "equals" | "contains" | "starts_with" | "ends_with"; } export interface GraphNodeQueryRequest { node_types: string[]; property_filters: GraphQueryFilter[]; } export interface GraphNodeQueryResult { id: string | number; node_type?: string; properties?: Record; } export interface GraphNodeQueryResponse { results: GraphNodeQueryResult[]; } export interface GraphTraverseQuery { start: string; max_depth?: number; node_types?: string[]; } export interface GraphTraverseResponse { nodes: GraphNodeQueryResult[]; edges: GraphEdgeResponse[]; } export interface WriteLane { lane_id: number; depth: number; in_flight: number; completed: number; rejected: number; } export interface WriteLanes { num_lanes: number; lanes: WriteLane[]; total_submitted: number; total_completed: number; total_rejected: number; write_p50_ms: number; write_p95_ms: number; write_p99_ms: number; } export interface ReadGate { permits_total: number; in_flight: number; completed: number; rejected: number; read_p50_ms: number; read_p95_ms: number; read_p99_ms: number; } export interface SequenceTracker { tracked_domains: number; } export interface HealthResponse { status: string; version: string; uptime_seconds: number; is_healthy: boolean; node_count: number; edge_count: number; processing_rate: number; write_lanes: WriteLanes; read_gate: ReadGate; sequence_tracker: SequenceTracker; } export interface ErrorResponse { error: string; details?: string; } export interface RecallContextResult { strategies: any[]; memories: any[]; claims: any[]; recall_ms: number; } export interface PerceiveActLearnOptions { message: string; modelOutput: string; spec: any; claimsQuery?: string; memoryLimit?: number; strategyLimit?: number; contextVariables?: Record; goals?: Array<{ text: string; priority?: 1 | 2 | 3 | 4 | 5; progress?: number; }>; retry?: { attempt: number; maxRetries: number; }; causedBy?: string; } export interface PerceiveActLearnResult { recall: RecallContextResult; intent: any; assistantResponse: string; eventIds: string[]; total_ms: number; } export interface SimpleEventRequest { agent_id: AgentId; agent_type: string; session_id: SessionId; action: string; data: Record; success: boolean; enable_semantic?: boolean; } export type SearchMode = "keyword" | "semantic" | "hybrid"; export type FusionStrategy = "RRF" | "Linear" | "Max"; export interface SearchRequest { query: string; mode: SearchMode; limit?: number; fusion_strategy?: FusionStrategy; } export interface SearchResult { node_id: number; score: number; node_type: string; properties: Record; } export interface SearchResponse { results: SearchResult[]; mode: SearchMode; total: number; } /** camelCase alternative for SearchRequest. */ export interface SearchOptions { query: string; mode?: SearchMode; limit?: number; fusionStrategy?: FusionStrategy; } /** camelCase alternative for ClaimSearchRequest. */ export interface ClaimSearchOptions { queryText: string; topK?: number; minSimilarity?: number; } export interface CommunityInfo { community_id: number; size: number; node_ids: number[]; } export interface CommunityDetectionResponse { communities: CommunityInfo[]; modularity: number; iterations: number; community_count: number; algorithm: string; } export interface CentralityScore { node_id: number; degree: number; betweenness: number; closeness: number; eigenvector: number; pagerank: number; combined: number; } export type CentralityResponse = CentralityScore[]; export interface PPRScore { node_id: number; score: number; } export interface PPRResponse { source_node_id: number; algorithm: string; scores: PPRScore[]; } export interface ReachableNode { node_id: number; origin: number; arrival_time: number | string; hops: number; predecessor: number; } export interface ReachabilityResponse { source_node_id: number; reachable_count: number; max_depth: number; edges_traversed: number; reachable: ReachableNode[]; } export interface CausalPathResponse { source: number; target: number; found: boolean; path: number[]; } export interface IndexStatsResponse { insert_count: number; query_count: number; range_query_count: number; hit_count: number; miss_count: number; last_accessed: number | string; } export interface GraphPersistResponse { success: boolean; nodes_persisted: number; edges_persisted: number; } export interface PlanningStrategiesRequest { goal_description: string; goal_bucket_id: number; context_fingerprint: ContextHash; } export interface StrategyCandidate { goal_description: string; steps: number; confidence: number; total_energy: number; decision: string; } export interface PlanningStrategiesResponse { ok: boolean; candidates: StrategyCandidate[]; } export interface PlanningActionsRequest { goal_description: string; goal_bucket_id: number; step_index: number; context_fingerprint: ContextHash; } export interface ActionCandidate { action_type: string; confidence: number; energy: number; feasibility: number; } export interface PlanningActionsResponse { ok: boolean; actions: ActionCandidate[]; } export interface PlanningPlanRequest { goal_description: string; goal_bucket_id: number; context_fingerprint: ContextHash; session_id: SessionId; } export interface PlanningPlanResponse { ok: boolean; mode: string; goal_description: string; goal_bucket_id: number; strategy_candidates: StrategyCandidate[]; action_candidates: ActionCandidate[]; } export interface PlanningExecuteRequest { goal_description: string; goal_bucket_id: number; context_fingerprint: ContextHash; session_id: SessionId; } export interface PlanningExecuteResponse { ok: boolean; execution_id: number; } export interface PlanningValidateRequest { execution_id: number; event: Event; } export interface PredictionError { total_z: number; event_z: number; memory_z: number; strategy_z: number; mismatch_layer: string; } export interface PlanningValidateResponse { ok: boolean; prediction_error: PredictionError | null; repair_triggered: boolean; repair_result: { scope: string; repaired_actions: number; repaired_strategies: number; } | null; } export interface WorldModelStatsResponse { enabled: boolean; mode: string; running_mean?: number; running_variance?: number; total_scored?: number; total_trained?: number; avg_loss?: number; is_warmed_up?: boolean; planning: { strategy_generation_enabled: boolean; action_generation_enabled: boolean; }; } export interface AdminImportResponse { success: boolean; memories_imported: number; strategies_imported: number; graph_nodes_imported: number; graph_edges_imported: number; total_records: number; mode: string; } export interface EmbeddingsProcessResponse { claims_processed: number; success: boolean; } export interface NLQRequest { question: string; group_id?: string; limit?: number; offset?: number; session_id?: number; include_context?: boolean; metadata?: Record; } export interface NLQEntityResolved { text: string; node_id: number; node_type: string; confidence: number; } export interface NLQResponse { answer: string; intent: string; entities_resolved: NLQEntityResolved[]; confidence: number; result_count: number; execution_time_ms: number; query_used: string; explanation: string[]; total_count: number; } /** camelCase alternative for NLQRequest. */ export interface NLQOptions { question: string; groupId?: string; limit?: number; offset?: number; sessionId?: number; includeContext?: boolean; metadata?: Record; } export type StructuredMemoryProvenance = "Manual" | "EpisodePipeline" | "NlqUpsert"; export interface LedgerEntry { amount: number; description: string; direction: "Credit" | "Debit"; } export interface LedgerTemplate { Ledger: { entity_pair: [string, string]; entries: LedgerEntry[]; balance: number; provenance: StructuredMemoryProvenance; }; } export interface StateMachineTemplate { StateMachine: { entity: string; current_state: string; history: Array<{ from: string; to: string; trigger: string; }>; provenance: StructuredMemoryProvenance; }; } export interface PreferenceListTemplate { PreferenceList: { entity: string; ranked_items: Array<{ item: string; rank: number; score: number; }>; provenance: StructuredMemoryProvenance; }; } export interface TreeTemplate { Tree: { root: string; children: Record; provenance: StructuredMemoryProvenance; }; } export type StructuredMemoryTemplate = LedgerTemplate | StateMachineTemplate | PreferenceListTemplate | TreeTemplate; export interface StructuredMemoryUpsertRequest { key: string; template: StructuredMemoryTemplate; } export interface StructuredMemoryUpsertResponse { success: boolean; key: string; } export interface StructuredMemoryListResponse { keys: string[]; count: number; } export interface StructuredMemoryGetResponse { key: string; template: StructuredMemoryTemplate; } export interface StructuredMemoryDeleteResponse { success: boolean; key: string; } export interface LedgerAppendRequest { amount: number; description: string; direction: "Credit" | "Debit"; } export interface LedgerAppendResponse { success: boolean; balance: number; } export interface LedgerBalanceResponse { key: string; balance: number; } export interface StateTransitionRequest { new_state: string; trigger: string; } export interface StateTransitionResponse { success: boolean; new_state: string; } export interface StateCurrentResponse { key: string; current_state: string; } export interface PreferenceUpdateRequest { item: string; rank: number; score?: number; } export interface PreferenceUpdateResponse { success: boolean; } export interface TreeAddChildRequest { parent: string; child: string; } export interface TreeAddChildResponse { success: boolean; } export interface StateChangeEventRequest { agent_id: AgentId; agent_type: string; session_id: SessionId; entity: string; new_state: string; old_state?: string; trigger?: string; extra_metadata?: Record; enable_semantic?: boolean; } export interface TransactionEventRequest { agent_id: AgentId; agent_type: string; session_id: SessionId; from: string; to: string; amount: number; direction?: "Credit" | "Debit"; description?: string; extra_metadata?: Record; enable_semantic?: boolean; } export interface ConversationMessage { role: "user" | "assistant"; content: string; metadata?: Record; } export interface ConversationSession { session_id: string; topic?: string; messages: ConversationMessage[]; contains_fact?: boolean; fact_id?: string | null; fact_quote?: string | null; } export interface ConversationIngestRequest { case_id?: string; sessions: ConversationSession[]; include_assistant_facts?: boolean; group_id?: string; metadata?: Record; } export interface ConversationCompactionResult { facts_extracted: number; goals_extracted: number; goals_deduplicated: number; procedural_steps: number; memories_created: number; memories_updated: number; memories_deleted: number; playbooks_extracted: number; llm_success: boolean; } export interface ConversationIngestResponse { case_id: string; messages_processed: number; events_submitted: number; compaction: ConversationCompactionResult; rolling_summary_started: boolean; } export interface MessageRequest { role: "user" | "assistant"; content: string; session_id?: string; case_id?: string; include_assistant_facts?: boolean; } export interface MessageResponse { case_id: string; session_id: string; messages_processed: number; events_submitted: number; buffered: boolean; buffer_size: number; compaction: ConversationCompactionResult | null; } export interface CodeFileEventRequest { agent_id: AgentId; agent_type: string; session_id: SessionId; file_path: string; content: string; language?: string; repository?: string; git_ref?: string; enable_ast?: boolean; enable_semantic?: boolean; } export interface CodeReviewEventRequest { agent_id: AgentId; agent_type: string; session_id: SessionId; review_id: string; action: "comment" | "approve" | "request_changes"; body: string; file_path?: string; line_range?: [number, number]; repository: string; title?: string; enable_semantic?: boolean; } export interface CodeSearchRequest { name_pattern?: string; kind?: "function" | "class" | "enum" | "interface" | "module" | "variable" | "typealias"; language?: string; file_pattern?: string; limit?: number; } export interface CodeEntity { name: string; qualified_name: string; kind: string; file_path: string; language: string; line_range: [number, number]; signature: string | null; doc_comment: string | null; visibility: string | null; } export interface CodeSearchResponse { entities: CodeEntity[]; total_matches: number; } export interface MinnsQLRequest { query: string; group_id?: string; } export interface MinnsQLStats { nodes_scanned: number; edges_traversed: number; execution_time_ms: number; } export interface MinnsQLResponse { columns: string[]; rows: any[][]; stats: MinnsQLStats; } export interface SubscriptionCreateRequest { query: string; group_id?: string; } export interface SubscriptionInitialResult { columns: string[]; rows: any[][]; } export interface SubscriptionCreateResponse { subscription_id: string; initial: SubscriptionInitialResult; strategy: string; } export interface SubscriptionInfo { subscription_id: string; query: string; strategy: string; cached_row_count: number; } export interface SubscriptionListResponse { subscriptions: SubscriptionInfo[]; } export interface SubscriptionUpdate { subscription_id: string; inserts: any[][]; deletes: any[][]; count: number | null; was_full_rerun: boolean; } export interface SubscriptionPollResponse { updates: SubscriptionUpdate[]; } export interface SubscriptionDeleteResponse { unsubscribed: boolean; } export interface TableColumnDef { name: string; col_type: "String" | "Int64" | "Float64" | "Bool" | "Timestamp" | "Json" | "NodeRef"; nullable?: boolean; primary_key?: boolean; autoincrement?: boolean; default_value?: any; } export type TableConstraint = { PrimaryKey: string[]; } | { Unique: string[]; } | { NotNull: string[]; }; export interface TableCreateRequest { name: string; columns: TableColumnDef[]; constraints?: TableConstraint[]; } export interface TableCreateResponse { table_id: number; name: string; } export interface TableSchemaColumn { name: string; col_type: string; nullable: boolean; autoincrement: boolean; default_value?: any; } export interface TableSchema { table_id: number; name: string; columns: TableSchemaColumn[]; constraints: TableConstraint[]; } export interface TableDropResponse { table_id: number; dropped: boolean; } export interface TableRowInsertRequest { group_id?: string; values: any[]; } export interface TableRowInsertResponse { row_id: number; version_id: number; } export interface TableRowUpdateRequest { group_id?: string; values: any[]; } export interface TableRowUpdateResponse { old_version_id: number; new_version_id: number; } export interface TableRowDeleteRequest { group_id?: string; } export interface TableRowDeleteResponse { version_id: number; } export interface TableRowScanQuery { when?: "active" | "all"; as_of?: string; group_id?: string; limit?: number; offset?: number; } export interface TableRow { row_id: number; version_id: number; group_id: string; valid_from: string; valid_until: string | null; values: any[]; } export interface TableRowScanResponse { count: number; rows: TableRow[]; } export interface TableCompactResponse { versions_removed: number; pages_compacted: number; } export interface TableStatsResponse { name: string; active_rows: number; total_versions: number; pages: number; generation: number; } export interface WorkflowStepDef { id: string; role: string; task: string; depends_on?: string[]; inputs?: Record; outputs?: Record; metadata?: Record; } export interface WorkflowCreateRequest { name: string; intent?: string; description?: string; steps: WorkflowStepDef[]; group_id?: string; metadata?: Record; } export interface WorkflowCreateResponse { success: boolean; workflow_id: string; workflow_name: string; nodes_created: number; edges_created: number; step_node_ids: Record; } export interface WorkflowSummary { workflow_id: string; name: string; intent?: string; step_count: number; group_id: string; created_at: string; active: boolean; } export interface WorkflowListResponse { workflows: WorkflowSummary[]; count: number; } export interface WorkflowStepDetail { node_id: number; id: string; role: string; task: string; depends_on: string[]; inputs: Record; outputs: Record; state: string | null; metadata: Record; } export interface WorkflowDetailResponse { workflow_id: string; name: string; intent?: string; description?: string; group_id: string; created_at: string; steps: WorkflowStepDetail[]; metadata?: Record; } export interface WorkflowUpdateRequest { name?: string; intent?: string; description?: string; steps: WorkflowStepDef[]; group_id?: string; metadata?: Record; } export interface WorkflowUpdateResponse { success: boolean; workflow_id: string; nodes_created: number; nodes_superseded: number; edges_created: number; edges_superseded: number; step_node_ids: Record; } export interface WorkflowDeleteResponse { success: boolean; workflow_id: string; edges_superseded: number; } export interface WorkflowStepTransitionRequest { state: string; result?: string; } export interface WorkflowStepTransitionResponse { success: boolean; workflow_id: string; step_id: string; new_state: string; } export interface WorkflowFeedbackRequest { feedback: string; outcome: "success" | "partial" | "failure"; } export interface WorkflowFeedbackResponse { success: boolean; workflow_id: string; feedback_node_id: number; } export interface AgentRegisterRequest { agent_id: string; group_id: string; repository: string; capabilities: string[]; } export interface AgentRegisterResponse { agent_node_id: number; repo_node_id: number; status: string; } export interface AgentInfo { node_id: number; agent_id: string; group_id: string; repositories: string[]; capabilities: string[]; last_seen: number; } export interface AgentListResponse { agents: AgentInfo[]; } export interface OntologyProperty { property_name: string; domain: string; range: string; is_symmetric: boolean; is_functional: boolean; is_append_only: boolean; cascade_dependents: string[]; } export interface OntologyPropertiesResponse { properties: OntologyProperty[]; count: number; } export interface OntologyUploadRequest { ttl: string; } export interface OntologyUploadResponse { status: string; properties_registered: number; cascade_properties_updated: number; } export interface OntologyDiscoverResponse { proposals_created: number; proposal_ids: string[]; cascade_properties_updated: number; } export interface OntologyCascadeInferenceResponse { status: string; properties_updated: number; } export interface OntologyObservation { predicate: string; domain: string; range: string; count: number; last_seen: number; } export interface OntologyObservationsResponse { observations: OntologyObservation[]; stats: { total_predicates: number; total_observations: number; timestamp: number; }; } export interface OntologyProposal { id: string; property_name: string; domain: string; range: string; is_symmetric: boolean; is_functional: boolean; status: string; confidence: number; } export interface OntologyProposalsResponse { proposals: OntologyProposal[]; count: number; } export interface OntologyProposalApproveResponse { status: string; properties_registered: number; } export interface OntologyProposalRejectResponse { status: string; } export interface OntologyStatsResponse { status: string; total_observations: number; pending_proposals: number; } export interface ModuleUploadRequest { name: string; wasm_base64: string; permissions: string[]; group_id?: string; } export interface ModuleUploadResponse { name: string; module_id: number; enabled: boolean; permissions: string[]; functions: string[]; triggers: number; } export interface ModuleInfo { name: string; module_id: string; enabled: boolean; permissions: string[]; functions: string[]; triggers: any[]; } export interface ModuleDetailResponse { name: string; module_id: number; enabled: boolean; permissions: string[]; functions: string[]; triggers: number; } export interface ModuleDeleteResponse { deleted: boolean; } export interface ModuleCallRequest { args_base64?: string; } export interface ModuleCallResponse { result_base64: string; } export interface ModuleUsageResponse { module_name: string; total_life_consumed_lo: number; total_life_consumed_hi: number; total_calls: number; total_rows_read: number; total_rows_written: number; total_graph_queries: number; total_http_requests: number; total_http_bytes: number; total_subscription_events: number; period_start: number; last_updated: number; } export interface ModuleUsageResetResponse { previous_period: Record; reset: boolean; } export interface ModuleSchedule { schedule_id: number; cron: string; function: string; enabled: boolean; next_run: number; last_run: number; } export interface ModuleScheduleCreateRequest { cron: string; function: string; } export interface ModuleScheduleCreateResponse { schedule_id: number; } export interface ModuleScheduleDeleteResponse { deleted: boolean; } export interface GraphImportNode { /** Node name. Concept nodes are deduplicated by name; other types always create fresh. */ name: string; /** Node type: "concept" (default), "agent", "event", "context", "goal", "episode", "memory", "strategy", "tool", "result", "claim". */ type?: string; /** Type-specific properties (e.g. concept_type, confidence, agent_id, capabilities). */ properties?: Record; } export interface GraphImportEdge { /** Source node name (references name in nodes array, or existing Concept in the graph). */ source: string; /** Target node name. */ target: string; /** Edge type: "association" (default), "causality", "temporal", "contextual", "interaction", "goal_relation", "communication", "derived_from", "supported_by", "code_structure", "about". */ type?: string; /** Relationship name (used as association_type for Association edges). */ label?: string; /** Edge weight. Default: 0.8. */ weight?: number; /** Confidence score. Default: 0.9. */ confidence?: number; /** Temporal validity start (nanoseconds since epoch). */ valid_from?: number; /** Temporal validity end (nanoseconds since epoch). Null = currently active. */ valid_until?: number; /** Additional edge properties. */ properties?: Record; } export interface GraphImportRequest { nodes: GraphImportNode[]; edges: GraphImportEdge[]; /** Multi-tenant partition key. */ group_id?: string; } export interface GraphImportResponse { nodes_created: number; nodes_reused: number; edges_created: number; errors: string[]; } export interface ApiKeyCreateRequest { name: string; group_id?: string; permissions?: string[]; } export interface ApiKeyCreateResponse { key: string; name: string; group_id?: string; permissions: string[]; warning: string; } export interface ApiKeyInfo { name: string; group_id?: string; permissions: string[]; enabled: boolean; created_at: string; } export interface ApiKeyDeleteResponse { deleted: boolean; }