@cleocode/contracts 2026.5.56 → 2026.5.58

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.
@@ -0,0 +1,209 @@
1
+ /**
2
+ * Sub-accessor interfaces for UmbrellaDataAccessor role-specific databases.
3
+ *
4
+ * Each interface provides typed access to a specific CLEO database role.
5
+ * These are returned by UmbrellaDataAccessor.getSubAccessor(role).
6
+ *
7
+ * Implementors:
8
+ * - BrainAccessor → brain.db (memory observations, semantic graph)
9
+ * - ConduitAccessor → conduit.db (project-scoped messaging)
10
+ * - NexusAccessor → nexus.db (code intelligence graph)
11
+ * - SignaldockAccessor → signaldock.db (global agent identity)
12
+ * - TelemetryAccessor → (future — telemetry collection)
13
+ *
14
+ * See DocsAccessor in docs-accessor.ts for the docs/llmtxt sub-accessor.
15
+ *
16
+ * @task T9188
17
+ * @epic T9048
18
+ * @see ADR-068 (DB Charter — per-DB write ownership)
19
+ * @see ADR-069 (Coordination Layers — Storage Layer contract)
20
+ */
21
+
22
+ // ---------------------------------------------------------------------------
23
+ // BrainAccessor
24
+ // ---------------------------------------------------------------------------
25
+
26
+ /**
27
+ * Parameters for {@link BrainAccessor.observe}.
28
+ */
29
+ export interface BrainObserveParams {
30
+ /** Free-text observation content. */
31
+ text: string;
32
+ /** Human-readable title. */
33
+ title?: string;
34
+ /** Memory type / entry type. */
35
+ type?: string;
36
+ /** Source session ID linking this observation to a session. */
37
+ sourceSessionId?: string;
38
+ /** Agent identifier that produced this observation. */
39
+ agent?: string;
40
+ }
41
+
42
+ /**
43
+ * A memory hit returned by {@link BrainAccessor.find}.
44
+ */
45
+ export interface BrainMemoryHit {
46
+ /** Unique entry ID. */
47
+ readonly id: string;
48
+ /** Entry text. */
49
+ readonly text: string;
50
+ /** Entry title. */
51
+ readonly title: string | null;
52
+ /** Similarity or relevance score (0–1). */
53
+ readonly score: number;
54
+ /** Entry type. */
55
+ readonly type: string | null;
56
+ }
57
+
58
+ /**
59
+ * BrainAccessor — typed interface for brain.db (memory / observation store).
60
+ *
61
+ * Consumers depend on BrainAccessor, NOT on brain-retrieval internals.
62
+ *
63
+ * @task T9188
64
+ * @epic T9048
65
+ */
66
+ export interface BrainAccessor {
67
+ /**
68
+ * Store a new observation in brain.db.
69
+ *
70
+ * @param text - Observation text (required, non-empty).
71
+ * @param params - Additional observation metadata.
72
+ * @returns ID of the stored observation.
73
+ */
74
+ observe(text: string, params?: Omit<BrainObserveParams, 'text'>): Promise<string>;
75
+
76
+ /**
77
+ * Find memory entries matching the given query.
78
+ *
79
+ * @param query - Free-text search query.
80
+ * @param limit - Maximum results (default: 10).
81
+ * @returns Ranked memory hits.
82
+ */
83
+ find(query: string, limit?: number): Promise<BrainMemoryHit[]>;
84
+
85
+ /**
86
+ * Release resources held by this accessor.
87
+ */
88
+ close(): Promise<void>;
89
+ }
90
+
91
+ // ---------------------------------------------------------------------------
92
+ // ConduitAccessor
93
+ // ---------------------------------------------------------------------------
94
+
95
+ /**
96
+ * ConduitAccessor — typed interface for conduit.db (project-scoped messaging).
97
+ *
98
+ * Minimal surface for T9188; full messaging API lives in conduit-sqlite.ts.
99
+ *
100
+ * @task T9188
101
+ * @epic T9048
102
+ */
103
+ export interface ConduitAccessor {
104
+ /**
105
+ * Publish a message to a conduit topic.
106
+ *
107
+ * @param topic - Topic identifier.
108
+ * @param payload - Message payload (JSON-serializable).
109
+ */
110
+ publish(topic: string, payload: unknown): Promise<void>;
111
+
112
+ /**
113
+ * Check whether conduit.db is open and accessible.
114
+ *
115
+ * @returns True if the database is healthy.
116
+ */
117
+ ping(): Promise<boolean>;
118
+
119
+ /**
120
+ * Release resources held by this accessor.
121
+ */
122
+ close(): Promise<void>;
123
+ }
124
+
125
+ // ---------------------------------------------------------------------------
126
+ // NexusAccessor
127
+ // ---------------------------------------------------------------------------
128
+
129
+ /**
130
+ * NexusAccessor — typed interface for nexus.db (code intelligence).
131
+ *
132
+ * Minimal surface for T9188; full nexus API lives in nexus-sqlite.ts.
133
+ *
134
+ * @task T9188
135
+ * @epic T9048
136
+ */
137
+ export interface NexusAccessor {
138
+ /**
139
+ * Check whether nexus.db is open and accessible.
140
+ *
141
+ * @returns True if the database is healthy.
142
+ */
143
+ ping(): Promise<boolean>;
144
+
145
+ /**
146
+ * Release resources held by this accessor.
147
+ */
148
+ close(): Promise<void>;
149
+ }
150
+
151
+ // ---------------------------------------------------------------------------
152
+ // SignaldockAccessor
153
+ // ---------------------------------------------------------------------------
154
+
155
+ /**
156
+ * SignaldockAccessor — typed interface for signaldock.db (global agent identity).
157
+ *
158
+ * Minimal surface for T9188; full signaldock API lives in signaldock-sqlite.ts.
159
+ *
160
+ * @task T9188
161
+ * @epic T9048
162
+ */
163
+ export interface SignaldockAccessor {
164
+ /**
165
+ * Check whether signaldock.db is open and accessible.
166
+ *
167
+ * @returns True if the database is healthy.
168
+ */
169
+ ping(): Promise<boolean>;
170
+
171
+ /**
172
+ * Release resources held by this accessor.
173
+ */
174
+ close(): Promise<void>;
175
+ }
176
+
177
+ // ---------------------------------------------------------------------------
178
+ // TelemetryAccessor
179
+ // ---------------------------------------------------------------------------
180
+
181
+ /**
182
+ * TelemetryAccessor — typed interface for telemetry collection (future DB).
183
+ *
184
+ * Placeholder for T9188 contract completeness. Full implementation deferred.
185
+ *
186
+ * @task T9188
187
+ * @epic T9048
188
+ */
189
+ export interface TelemetryAccessor {
190
+ /**
191
+ * Record a telemetry event.
192
+ *
193
+ * @param event - Event name.
194
+ * @param data - Event payload (JSON-serializable).
195
+ */
196
+ record(event: string, data?: Record<string, unknown>): Promise<void>;
197
+
198
+ /**
199
+ * Check whether telemetry collection is available.
200
+ *
201
+ * @returns True if collection is operational.
202
+ */
203
+ ping(): Promise<boolean>;
204
+
205
+ /**
206
+ * Release resources held by this accessor.
207
+ */
208
+ close(): Promise<void>;
209
+ }