@siduri-x/core 2.0.1 → 2.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (41) hide show
  1. package/dist/action-policy.d.ts +8 -1
  2. package/dist/action-policy.js +84 -24
  3. package/dist/action-policy.test.js +67 -1
  4. package/dist/action.d.ts +1 -1
  5. package/dist/capability.d.ts +6 -2
  6. package/dist/capability.js +5 -1
  7. package/dist/capability.test.js +1 -0
  8. package/dist/chat-contract.d.ts +3 -1
  9. package/dist/chat-contract.js +5 -2
  10. package/dist/container.d.ts +74 -0
  11. package/dist/container.js +81 -0
  12. package/dist/context.d.ts +3 -1
  13. package/dist/context.js +13 -0
  14. package/dist/index.d.ts +11 -3
  15. package/dist/index.js +2 -0
  16. package/dist/input-normalizer.js +3 -1
  17. package/dist/intent-classifier.d.ts +4 -2
  18. package/dist/intent-classifier.js +32 -1
  19. package/dist/intent-classifier.test.js +52 -0
  20. package/dist/memory-settler.d.ts +2 -1
  21. package/dist/memory-settler.js +9 -1
  22. package/dist/perception-cycle.test.js +134 -0
  23. package/dist/perception-pipeline.d.ts +76 -0
  24. package/dist/perception-pipeline.js +258 -0
  25. package/dist/perception-pipeline.test.d.ts +1 -0
  26. package/dist/perception-pipeline.test.js +65 -0
  27. package/dist/prompt-compiler.d.ts +2 -1
  28. package/dist/prompt-compiler.js +7 -1
  29. package/dist/proposals.d.ts +4 -1
  30. package/dist/response-envelope.d.ts +2 -1
  31. package/dist/response-envelope.js +2 -1
  32. package/dist/runtime-facades.test.js +27 -27
  33. package/dist/runtime.d.ts +36 -113
  34. package/dist/runtime.js +58 -403
  35. package/dist/siduri-db.d.ts +25 -9
  36. package/dist/siduri-db.js +114 -15
  37. package/dist/siduri-db.test.js +4 -3
  38. package/dist/sqlite-action-store.d.ts +1 -1
  39. package/dist/sqlite-action-store.js +37 -6
  40. package/dist/sqlite-action-store.test.js +9 -0
  41. package/package.json +1 -1
@@ -0,0 +1,65 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const perception_pipeline_1 = require("./perception-pipeline");
4
+ const gating_1 = require("./gating");
5
+ const action_policy_1 = require("./action-policy");
6
+ const dispatcher_1 = require("./dispatcher");
7
+ const session_history_1 = require("./session-history");
8
+ describe('PerceptionPipeline (Pipes & Filters Execution)', () => {
9
+ function createMockContext(overrides = {}) {
10
+ return {
11
+ companionId: 'test-companion',
12
+ companionName: 'Test Companion',
13
+ perception: {
14
+ source: 'text_chat',
15
+ text: 'Hello world',
16
+ roleOrContext: 'OWNER',
17
+ },
18
+ organs: {},
19
+ gating: new gating_1.ResponseGatingEngine(),
20
+ actionPolicy: new action_policy_1.ActionPolicyEngine(),
21
+ dispatcher: new dispatcher_1.ExperienceDispatcher(),
22
+ sessionHistory: new session_history_1.SessionHistoryManager(),
23
+ ...overrides,
24
+ };
25
+ }
26
+ test('executes stages in sequence and returns response envelope', async () => {
27
+ const executedStages = [];
28
+ const stageA = async (ctx) => {
29
+ executedStages.push('stageA');
30
+ ctx.rawText = (ctx.perception.text || '').toUpperCase();
31
+ };
32
+ const stageB = async (ctx) => {
33
+ executedStages.push('stageB');
34
+ ctx.responseEnvelope = { result: ctx.rawText };
35
+ };
36
+ const pipeline = new perception_pipeline_1.PerceptionPipeline([stageA, stageB]);
37
+ const ctx = createMockContext();
38
+ const result = await pipeline.execute(ctx);
39
+ expect(executedStages).toEqual(['stageA', 'stageB']);
40
+ expect(result).toEqual({ result: 'HELLO WORLD' });
41
+ });
42
+ test('halts pipeline execution early when a stage returns false', async () => {
43
+ const executedStages = [];
44
+ const stageA = async () => {
45
+ executedStages.push('stageA');
46
+ };
47
+ const stageReject = async (ctx) => {
48
+ executedStages.push('stageReject');
49
+ ctx.responseEnvelope = { rejected: true, reason: 'halt_early' };
50
+ return false; // halt
51
+ };
52
+ const stageB = async () => {
53
+ executedStages.push('stageB');
54
+ };
55
+ const pipeline = new perception_pipeline_1.PerceptionPipeline([stageA, stageReject, stageB]);
56
+ const ctx = createMockContext();
57
+ const result = await pipeline.execute(ctx);
58
+ expect(executedStages).toEqual(['stageA', 'stageReject']);
59
+ expect(result).toEqual({ rejected: true, reason: 'halt_early' });
60
+ });
61
+ test('createDefaultPerceptionPipeline constructs a 12-stage pipeline', () => {
62
+ const defaultPipeline = (0, perception_pipeline_1.createDefaultPerceptionPipeline)();
63
+ expect(defaultPipeline.stages.length).toBe(12);
64
+ });
65
+ });
@@ -1,4 +1,4 @@
1
- import { BehaviorOrgan, BehaviorDirective, KnowledgeItem, Claim, RequestContext } from './index';
1
+ import { BehaviorOrgan, BehaviorDirective, KnowledgeItem, Claim, RequestContext, InteractionMode } from './index';
2
2
  export interface PromptCompilationParams {
3
3
  companionName: string;
4
4
  companionId: string;
@@ -10,6 +10,7 @@ export interface PromptCompilationParams {
10
10
  knowledgeData: KnowledgeItem[];
11
11
  memoryData: Claim[];
12
12
  lifeContext?: string[];
13
+ effectiveMode?: InteractionMode;
13
14
  }
14
15
  export interface CompiledPrompts {
15
16
  systemPrompt: string;
@@ -5,7 +5,7 @@ exports.compilePrompts = compilePrompts;
5
5
  * Compiles neutral system prompt and formatted context prompt from structured data.
6
6
  */
7
7
  async function compilePrompts(params) {
8
- const { companionName, companionId, role, requestContext, behavior, activeDirectives, subsystemDiagnostics, knowledgeData, memoryData, lifeContext, } = params;
8
+ const { companionName, companionId, role, requestContext, behavior, activeDirectives, subsystemDiagnostics, knowledgeData, memoryData, lifeContext, effectiveMode, } = params;
9
9
  let contextPrompt = '';
10
10
  if (Object.keys(subsystemDiagnostics).length > 0) {
11
11
  contextPrompt +=
@@ -43,8 +43,14 @@ async function compilePrompts(params) {
43
43
  actorId: requestContext.actor.actorId,
44
44
  })
45
45
  : '';
46
+ const modeInstruction = effectiveMode === 'casual'
47
+ ? 'Operating Mode: Casual (Zero memory drift - do not attempt to persist personal claims or directives).'
48
+ : effectiveMode === 'teach'
49
+ ? 'Operating Mode: Teach Mode (Active learning session - accurately capture user preferences and proposed boundaries for operator review).'
50
+ : undefined;
46
51
  const systemPrompt = [
47
52
  `You are ${companionName}.`,
53
+ modeInstruction,
48
54
  'This is a neutral conversation context.',
49
55
  'Use only approved, permitted memory as factual personal context.',
50
56
  'Do not claim prior personal knowledge when no approved memory supports it.',
@@ -20,7 +20,10 @@ export interface MemoryProposal {
20
20
  }
21
21
  export interface BehaviorProposal {
22
22
  directive: string;
23
- priority: number;
23
+ priority?: number;
24
+ category?: 'guardrail' | 'relational' | 'behavioral' | string;
25
+ scopeActor?: string;
26
+ supersedesId?: string;
24
27
  subject?: string;
25
28
  predicate?: string;
26
29
  value?: string;
@@ -1,4 +1,4 @@
1
- import { StagedResponsePlan, ResponseGateEvaluation, Claim, ResponseCitation, ExperienceEvent, ActionExecutionResult } from './index';
1
+ import { StagedResponsePlan, ResponseGateEvaluation, Claim, ResponseCitation, ExperienceEvent, ActionExecutionResult, InteractionMode } from './index';
2
2
  import { MemoryProposalReceipt } from './memory-settler';
3
3
  import { FormattedMouthOutput } from './mouth-types';
4
4
  export interface AssembleResponseEnvelopeParams {
@@ -14,6 +14,7 @@ export interface AssembleResponseEnvelopeParams {
14
14
  subsystemDiagnostics: Record<string, string>;
15
15
  experienceEvents: ExperienceEvent[];
16
16
  mouthDelivery?: FormattedMouthOutput;
17
+ effectiveMode?: InteractionMode;
17
18
  }
18
19
  /**
19
20
  * Creates the standardized rejection envelope for responses that fail gate evaluation.
@@ -29,7 +29,7 @@ function createGateRejectionEnvelope(stagedPlan, gateEval) {
29
29
  * Assembles the standardized response structure for approved companion responses.
30
30
  */
31
31
  function assembleResponseEnvelope(params) {
32
- const { stagedPlan, speech, language, speechId, createdMemoryProposals, memoryProposalReceipts, actionResults, filteredEvidenceIds, filteredCitations, subsystemDiagnostics, experienceEvents, mouthDelivery, } = params;
32
+ const { stagedPlan, speech, language, speechId, createdMemoryProposals, memoryProposalReceipts, actionResults, filteredEvidenceIds, filteredCitations, subsystemDiagnostics, experienceEvents, mouthDelivery, effectiveMode, } = params;
33
33
  return {
34
34
  status: 'APPROVED',
35
35
  response_id: stagedPlan.responseId,
@@ -42,6 +42,7 @@ function assembleResponseEnvelope(params) {
42
42
  },
43
43
  delivery: mouthDelivery,
44
44
  metadata: {
45
+ mode: effectiveMode ?? 'hybrid',
45
46
  language,
46
47
  proposals: createdMemoryProposals,
47
48
  memory_proposals: memoryProposalReceipts,
@@ -1,8 +1,8 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const runtime_1 = require("./runtime");
4
- describe('SiduriRuntime Facade Methods & Delegation', () => {
5
- test('delegates vision and observation methods to configured organs', async () => {
3
+ const container_1 = require("./container");
4
+ describe('CompanionContainer & Direct Domain Access', () => {
5
+ test('delegates vision and observation methods to configured organs via container', async () => {
6
6
  const mockVision = {
7
7
  analyze: jest.fn().mockResolvedValue('an ancient artifact'),
8
8
  };
@@ -11,23 +11,23 @@ describe('SiduriRuntime Facade Methods & Delegation', () => {
11
11
  current: jest.fn().mockReturnValue([{ observationId: 'obs-1' }]),
12
12
  clearExpired: jest.fn().mockReturnValue(1),
13
13
  };
14
- const runtime = new runtime_1.SiduriRuntime('test-comp', { name: 'Test' }, {
14
+ const container = new container_1.CompanionContainer('test-comp', { name: 'Test' }, {
15
15
  vision: mockVision,
16
16
  observation: mockObservation,
17
17
  });
18
- const visionResult = await runtime.analyzeVision('http://example.com/img.png', 'describe');
18
+ const visionResult = await container.vision.analyze('http://example.com/img.png', 'describe');
19
19
  expect(visionResult).toBe('an ancient artifact');
20
20
  expect(mockVision.analyze).toHaveBeenCalledWith('http://example.com/img.png', 'describe');
21
21
  const frame = new Uint8Array([1, 2, 3]);
22
- const obsResult = await runtime.ingestObservation(frame, 'camera-1', 'provider-x');
22
+ const obsResult = await container.observation.ingest(frame, 'camera-1', 'provider-x');
23
23
  expect(obsResult.duplicate).toBe(false);
24
24
  expect(mockObservation.ingest).toHaveBeenCalledWith(frame, 'camera-1', 'provider-x');
25
- const cur = runtime.getCurrentObservations();
25
+ const cur = container.observation.current();
26
26
  expect(cur).toEqual([{ observationId: 'obs-1' }]);
27
- const cleared = runtime.clearExpiredObservations();
27
+ const cleared = container.observation.clearExpired();
28
28
  expect(cleared).toBe(1);
29
29
  });
30
- test('delegates memory operations cleanly through facade methods', async () => {
30
+ test('delegates memory operations directly on the memory organ', async () => {
31
31
  const mockMemory = {
32
32
  initialize: jest.fn().mockResolvedValue(undefined),
33
33
  getClaims: jest.fn().mockResolvedValue([{ id: 'claim-1' }]),
@@ -42,39 +42,39 @@ describe('SiduriRuntime Facade Methods & Delegation', () => {
42
42
  disableDirective: jest.fn().mockResolvedValue(undefined),
43
43
  resetMemory: jest.fn().mockResolvedValue(undefined),
44
44
  };
45
- const runtime = new runtime_1.SiduriRuntime('test-comp', { name: 'Test' }, {
45
+ const container = new container_1.CompanionContainer('test-comp', { name: 'Test' }, {
46
46
  memory: mockMemory,
47
47
  });
48
- expect(await runtime.getClaims(10)).toEqual([{ id: 'claim-1' }]);
48
+ expect(await container.memory.getClaims(10)).toEqual([{ id: 'claim-1' }]);
49
49
  expect(mockMemory.getClaims).toHaveBeenCalledWith(10);
50
- expect(await runtime.getPendingClaims()).toEqual([{ id: 'claim-pending-1' }]);
51
- expect(await runtime.getDirectives()).toEqual([{ id: 'dir-1' }]);
52
- await runtime.approveClaim('c-1');
50
+ expect(await container.memory.getPendingClaims()).toEqual([{ id: 'claim-pending-1' }]);
51
+ expect(await container.memory.getDirectives()).toEqual([{ id: 'dir-1' }]);
52
+ await container.memory.approveClaim('c-1');
53
53
  expect(mockMemory.approveClaim).toHaveBeenCalledWith('c-1');
54
- await runtime.rejectClaim('c-2');
54
+ await container.memory.rejectClaim('c-2');
55
55
  expect(mockMemory.rejectClaim).toHaveBeenCalledWith('c-2');
56
- await runtime.updateClaim('c-1', { value: 'new' });
57
- expect(mockMemory.updateClaim).toHaveBeenCalledWith('c-1', { value: 'new' });
58
- await runtime.approveDirective('d-1');
56
+ await container.memory.updateClaim('c-1', { value: 'updated' });
57
+ expect(mockMemory.updateClaim).toHaveBeenCalledWith('c-1', { value: 'updated' });
58
+ await container.memory.approveDirective('d-1');
59
59
  expect(mockMemory.approveDirective).toHaveBeenCalledWith('d-1');
60
- await runtime.rejectDirective('d-2');
60
+ await container.memory.rejectDirective('d-2');
61
61
  expect(mockMemory.rejectDirective).toHaveBeenCalledWith('d-2');
62
- await runtime.revokeDirective('d-3');
62
+ await container.memory.revokeDirective('d-3');
63
63
  expect(mockMemory.revokeDirective).toHaveBeenCalledWith('d-3');
64
- await runtime.disableDirective('d-4');
64
+ await container.memory.disableDirective('d-4');
65
65
  expect(mockMemory.disableDirective).toHaveBeenCalledWith('d-4');
66
- await runtime.resetMemory();
66
+ await container.memory.resetMemory();
67
67
  expect(mockMemory.resetMemory).toHaveBeenCalled();
68
68
  });
69
69
  test('configures SqliteActionStore when actionStore is sqlite', () => {
70
- const runtime = new runtime_1.SiduriRuntime('comp-sqlite', {
70
+ const container = new container_1.CompanionContainer('comp-sqlite', {
71
71
  id: 'comp-sqlite',
72
72
  name: 'Sqlite Test',
73
73
  actionStore: 'sqlite',
74
74
  });
75
- expect(runtime.actionPolicy.getStore()).toBeDefined();
75
+ expect(container.actionPolicy.getStore()).toBeDefined();
76
76
  // Verify it is an instance of SqliteActionStore
77
- expect(runtime.actionPolicy.getStore().constructor.name).toBe('SqliteActionStore');
77
+ expect(container.actionPolicy.getStore().constructor.name).toBe('SqliteActionStore');
78
78
  });
79
79
  test('accepts custom actionStore via RuntimeOrgans', () => {
80
80
  const customStore = {
@@ -87,9 +87,9 @@ describe('SiduriRuntime Facade Methods & Delegation', () => {
87
87
  getAuditLog: jest.fn(),
88
88
  verifyAuditChain: jest.fn(),
89
89
  };
90
- const runtime = new runtime_1.SiduriRuntime('comp-custom', { id: 'comp-custom', name: 'Custom' }, {
90
+ const container = new container_1.CompanionContainer('comp-custom', { id: 'comp-custom', name: 'Custom' }, {
91
91
  actionStore: customStore,
92
92
  });
93
- expect(runtime.actionPolicy.getStore()).toBe(customStore);
93
+ expect(container.actionPolicy.getStore()).toBe(customStore);
94
94
  });
95
95
  });
package/dist/runtime.d.ts CHANGED
@@ -1,127 +1,50 @@
1
- import { BrainOrgan, MemoryOrgan, VoiceOrgan, KnowledgeOrgan, VisionOrgan, BehaviorOrgan, BodyOrgan, HandsOrgan, EarOrgan, ObservationOrgan, ObservationResult, Observation, Message, RequestContext, ActionPolicyEngine, ApproveActionOptions, ActionApprovalResult, ActionStore, ResponseGatingEngine, StageResponseOptions, ApproveResponseOptions, RejectResponseOptions, ExperienceDispatcher, ExperienceAdapter, OrganConfig, Claim, BehaviorDirective, StagedResponsePlan, ResponseGateEvaluation, EvidenceRecord, MouthOrgan, MouthUtterance, MouthMedium, FormattedMouthOutput, MouthStreamChunk, MouthChannel, SelfRepository, EKnowledgeOrgan } from './index';
2
- export interface SiduriRuntimeConfig {
3
- name: string;
4
- brain?: OrganConfig | Record<string, unknown>;
5
- voice?: OrganConfig | Record<string, unknown>;
6
- memory?: OrganConfig | Record<string, unknown>;
7
- knowledge?: OrganConfig | Record<string, unknown>;
8
- behavior?: OrganConfig | Record<string, unknown>;
9
- body?: OrganConfig | Record<string, unknown>;
10
- vision?: OrganConfig | Record<string, unknown>;
11
- hands?: OrganConfig | Record<string, unknown>;
12
- ear?: OrganConfig | Record<string, unknown>;
13
- observation?: OrganConfig | Record<string, unknown>;
14
- mouth?: OrganConfig | Record<string, unknown>;
15
- self?: OrganConfig | Record<string, unknown>;
16
- externalKnowledge?: OrganConfig | Record<string, unknown>;
17
- actionPolicy?: Record<string, unknown>;
18
- actionStore?: 'in-memory' | 'sqlite' | {
19
- type: 'sqlite' | 'in-memory';
20
- dbPath?: string;
21
- };
22
- actionStorePath?: string;
23
- [key: string]: unknown;
24
- }
25
- export interface RuntimeOrgans {
26
- brain?: BrainOrgan;
27
- memory?: MemoryOrgan;
28
- voice?: VoiceOrgan | ExperienceAdapter;
29
- knowledge?: KnowledgeOrgan;
30
- vision?: VisionOrgan;
31
- behavior?: BehaviorOrgan;
32
- body?: BodyOrgan | ExperienceAdapter;
33
- hands?: HandsOrgan;
34
- ear?: EarOrgan;
35
- observation?: ObservationOrgan;
36
- mouth?: MouthOrgan;
37
- self?: SelfRepository;
38
- externalKnowledge?: EKnowledgeOrgan;
39
- actionStore?: ActionStore;
40
- actionPolicy?: ActionPolicyEngine;
41
- }
42
- export interface CompanionPerception {
43
- source: string;
44
- text?: string;
45
- audioBuffer?: Uint8Array;
46
- roleOrContext?: 'OWNER' | 'VIEWER' | 'OPERATOR' | RequestContext | string;
47
- context?: RequestContext;
48
- history?: Message[];
49
- medium?: MouthMedium;
50
- metadata?: Record<string, unknown>;
51
- signal?: AbortSignal;
52
- }
1
+ import { BrainOrgan, MemoryOrgan, VoiceOrgan, KnowledgeOrgan, VisionOrgan, BehaviorOrgan, BodyOrgan, HandsOrgan, EarOrgan, ObservationOrgan, MouthOrgan, SelfRepository, EKnowledgeOrgan, Message, RequestContext, MouthMedium, ResponseGatingEngine, ActionPolicyEngine, ExperienceDispatcher } from './index';
2
+ import { SessionHistoryManager } from './session-history';
3
+ import { CompanionPerception, PerceptionPipeline } from './perception-pipeline';
4
+ import { CompanionContainer, RuntimeOrgans, SiduriRuntimeConfig } from './container';
5
+ export { CompanionPerception, RuntimeOrgans, SiduriRuntimeConfig };
53
6
  /**
54
- * SiduriRuntime coordinates companion lifecycle, sensory perception,
55
- * context retrieval, cognition planning, safety gating, action execution,
56
- * and experience emission across decoupled organs.
7
+ * SiduriRuntime coordinates companion perception and cognition execution.
8
+ * Lifecycle management and organ storage are handled by CompanionContainer.
9
+ * The 12-stage perception cycle is executed via PerceptionPipeline.
57
10
  */
58
11
  export declare class SiduriRuntime {
59
- id: string;
60
- config: SiduriRuntimeConfig;
61
- brain?: BrainOrgan;
62
- memory?: MemoryOrgan;
63
- voice?: VoiceOrgan | ExperienceAdapter;
64
- knowledge?: KnowledgeOrgan;
65
- vision?: VisionOrgan;
66
- behavior?: BehaviorOrgan;
67
- body?: BodyOrgan | ExperienceAdapter;
68
- hands?: HandsOrgan;
69
- ear?: EarOrgan;
70
- observation?: ObservationOrgan;
71
- mouth?: MouthOrgan;
72
- self?: SelfRepository;
73
- externalKnowledge?: EKnowledgeOrgan;
74
- gating: ResponseGatingEngine;
75
- actionPolicy: ActionPolicyEngine;
76
- dispatcher: ExperienceDispatcher;
77
- private readonly sessionHistory;
12
+ readonly id: string;
13
+ readonly config: SiduriRuntimeConfig;
14
+ readonly container: CompanionContainer;
15
+ readonly pipeline: PerceptionPipeline;
16
+ constructor(id: string, config: SiduriRuntimeConfig, containerOrOrgans?: CompanionContainer | RuntimeOrgans, pipeline?: PerceptionPipeline);
17
+ get organs(): RuntimeOrgans;
18
+ get brain(): BrainOrgan | undefined;
19
+ get memory(): MemoryOrgan | undefined;
20
+ get voice(): VoiceOrgan | undefined;
21
+ get knowledge(): KnowledgeOrgan | undefined;
22
+ get vision(): VisionOrgan | undefined;
23
+ get behavior(): BehaviorOrgan | undefined;
24
+ get body(): BodyOrgan | undefined;
25
+ get hands(): HandsOrgan | undefined;
26
+ get ear(): EarOrgan | undefined;
27
+ get observation(): ObservationOrgan | undefined;
28
+ set observation(org: ObservationOrgan | undefined);
29
+ get mouth(): MouthOrgan | undefined;
30
+ get self(): SelfRepository | undefined;
31
+ get externalKnowledge(): EKnowledgeOrgan | undefined;
32
+ get gating(): ResponseGatingEngine;
33
+ get actionPolicy(): ActionPolicyEngine;
34
+ get dispatcher(): ExperienceDispatcher;
35
+ get sessionHistory(): SessionHistoryManager;
78
36
  get conversationHistory(): Message[];
79
37
  set conversationHistory(messages: Message[]);
80
- constructor(id: string, config: SiduriRuntimeConfig, organs?: RuntimeOrgans);
81
38
  initialize(): Promise<void>;
82
39
  getSessionHistory(sessionKey: string): Message[];
83
40
  clearHistory(sessionKey?: string): void;
84
- analyzeVision(imageUrl: string, prompt: string): Promise<string>;
85
- ingestObservation(frame: Uint8Array, sourceName: string, providerId?: string): Promise<ObservationResult>;
86
- getCurrentObservations(now?: Date): Observation[];
87
- clearExpiredObservations(now?: Date): number;
88
- getClaims(limit?: number): Promise<Claim[]>;
89
- getPendingClaims(limit?: number): Promise<Claim[]>;
90
- getDirectives(): Promise<BehaviorDirective[]>;
91
- approveClaim(id: string): Promise<void>;
92
- rejectClaim(id: string): Promise<void>;
93
- updateClaim(id: string, updates: Partial<Pick<Claim, 'subject' | 'predicate' | 'value' | 'scope' | 'sensitivity' | 'confidence' | 'validFrom' | 'validUntil'>>): Promise<Claim>;
94
- approveDirective(id: string, companionId?: string): Promise<void>;
95
- rejectDirective(id: string, companionId?: string): Promise<void>;
96
- revokeDirective(id: string, companionId?: string): Promise<void>;
97
- disableDirective(id: string, companionId?: string): Promise<void>;
98
- resetMemory(): Promise<void>;
99
- stageResponse(options: StageResponseOptions): StagedResponsePlan;
100
- evaluateGate(plan: StagedResponsePlan, evidenceRecords?: EvidenceRecord[]): ResponseGateEvaluation;
101
- approveResponse(options: ApproveResponseOptions): {
102
- success: boolean;
103
- reason?: string;
104
- plan?: StagedResponsePlan;
105
- };
106
- rejectResponse(options: RejectResponseOptions): {
107
- success: boolean;
108
- reason?: string;
109
- plan?: StagedResponsePlan;
110
- };
111
- approveAction(options: ApproveActionOptions): Promise<ActionApprovalResult>;
112
- getStagedPlan(responseId: string): StagedResponsePlan | undefined;
113
- findStagedPlanByCorrelation(companionId: string, correlationId: string): StagedResponsePlan | undefined;
114
41
  /**
115
42
  * Processes an incoming perception (sensory audio, text, platform event, or observation alert)
116
- * through the perception -> retrieval -> cognition -> gating -> action -> experience cycle.
43
+ * through the decoupled PerceptionPipeline.
117
44
  */
118
45
  processPerception(perception: CompanionPerception): Promise<any>;
119
- speakMouth(utterance: MouthUtterance): Promise<FormattedMouthOutput | undefined>;
120
- formatMouth(utterance: MouthUtterance, medium?: MouthMedium): FormattedMouthOutput | undefined;
121
- registerMouthChannel(channel: MouthChannel): void;
122
- unregisterMouthChannel(channelId: string): void;
123
- broadcastMouth(utterance: MouthUtterance): Promise<FormattedMouthOutput[]>;
124
- interruptMouth(reason?: string): void;
125
- streamMouth(utterance: MouthUtterance): AsyncIterable<MouthStreamChunk>;
46
+ /**
47
+ * Primary entrypoint for text chat messages.
48
+ */
126
49
  handleUserMessage(message: string, roleOrContext?: 'OWNER' | 'VIEWER' | 'OPERATOR' | RequestContext | string, history?: Message[], medium?: MouthMedium, signal?: AbortSignal): Promise<any>;
127
50
  }