@mnemosyne_os/sdk 1.1.0 → 1.2.0
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.
- package/README.md +11 -0
- package/dist/index.cjs +272 -3679
- package/dist/index.d.cts +501 -49
- package/dist/index.d.ts +501 -49
- package/dist/index.js +252 -3688
- package/package.json +3 -3
package/dist/index.d.ts
CHANGED
|
@@ -1,29 +1,63 @@
|
|
|
1
1
|
import { z } from 'zod';
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @
|
|
4
|
+
* @mnemosyne_os/sdk — Public Types
|
|
5
5
|
*
|
|
6
|
-
*
|
|
7
|
-
*
|
|
6
|
+
* This file is the public API contract surface of the SDK.
|
|
7
|
+
* Any modification here constitutes a breaking or additive API change.
|
|
8
|
+
*
|
|
9
|
+
* Version history:
|
|
10
|
+
* v1.1.0 — initial types (ingest, query, git, agents, NFT, NeuralGraph)
|
|
11
|
+
* v1.2.0 — custom vault support, Resonance types, Correlate/Forget/DynamicSpine API
|
|
8
12
|
*
|
|
9
13
|
* [SDK][ZERO-TRUST][AUDIT-TRAIL]
|
|
10
14
|
*/
|
|
11
|
-
/**
|
|
12
|
-
|
|
13
|
-
|
|
15
|
+
/**
|
|
16
|
+
* All available permission scopes for a Layer 2 application.
|
|
17
|
+
*
|
|
18
|
+
* Scopes follow the pattern `resource:action:target`.
|
|
19
|
+
* Any scope not listed here is silently refused by the Zero-Trust gate.
|
|
20
|
+
*
|
|
21
|
+
* **Custom vault scopes:**
|
|
22
|
+
* Use `vault:read:CUSTOM` / `vault:write:CUSTOM` to request read/write access
|
|
23
|
+
* to any custom vault created by the user. The actual vault ID is resolved at
|
|
24
|
+
* runtime from the `vaults` field of the manifest.
|
|
25
|
+
*/
|
|
26
|
+
type MnemoScope = 'vault:read:DEV' | 'vault:write:DEV' | 'vault:read:SOCIAL' | 'vault:write:SOCIAL' | 'vault:read:PERSONAL' | 'vault:write:PERSONAL' | 'vault:read:FINANCE' | 'vault:write:FINANCE' | 'vault:read:RESEARCH' | 'vault:write:RESEARCH'
|
|
27
|
+
/** Wildcard scope — grants read access to any user-created custom vault. */
|
|
28
|
+
| 'vault:read:CUSTOM'
|
|
29
|
+
/** Wildcard scope — grants write access to any user-created custom vault. */
|
|
30
|
+
| 'vault:write:CUSTOM' | 'share:request' | 'share:grant'
|
|
31
|
+
/** Read access to the Mnemosyne OS monorepo git log. */
|
|
14
32
|
| 'monorepo:read'
|
|
15
|
-
/**
|
|
33
|
+
/** List active connected SDK agents. */
|
|
16
34
|
| 'agents:read'
|
|
17
|
-
/**
|
|
35
|
+
/** On-chain NFT licence validation for MnemoStore. Premium scope. */
|
|
18
36
|
| 'nft:validate'
|
|
19
|
-
/**
|
|
37
|
+
/** Read access to the NeuralGraph (nodes, edges, clusters). */
|
|
20
38
|
| 'neural:graph:read'
|
|
21
|
-
/**
|
|
22
|
-
| 'llm:query'
|
|
23
|
-
/**
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
39
|
+
/** Direct LLM queries via the Mnemosyne runtime. Premium scope. */
|
|
40
|
+
| 'llm:query'
|
|
41
|
+
/**
|
|
42
|
+
* [PHASE-58] Read access to the Perpetual Memory Bridges.
|
|
43
|
+
* Allows a Layer 2 app to call getBridgeHistory() and computeResonance().
|
|
44
|
+
* Write access (saveBridges) is CORE-ONLY and not exposed to Layer 2.
|
|
45
|
+
*/
|
|
46
|
+
| 'bridge:read';
|
|
47
|
+
/**
|
|
48
|
+
* Allowed IPC intents for a Layer 2 application.
|
|
49
|
+
* An intent is the high-level operation the app is permitted to perform.
|
|
50
|
+
* Each intent maps to one or more WS server routes.
|
|
51
|
+
*/
|
|
52
|
+
type MnemoIntent = 'INGEST' /** Write content to a vault (triggers vectorization). */ | 'QUERY' /** Semantic search against a vault. */ | 'CORRELATE' /** Find causal/temporal/semantic links between chronicles. */ | 'FORGET' /** Delete a chronicle by ID (GDPR). */ | 'GIT_LOG' /** Read the monorepo git commit log. */ | 'LIST_AGENTS' /** List active SDK agents connected to the WS server. */ | 'LIST_VAULTS' /** Discover available vaults (core + custom). */ | 'BRIDGE_READ'; /** [PHASE-58] Read bridge history and compute resonance scores. */
|
|
53
|
+
/**
|
|
54
|
+
* Target vault identifier.
|
|
55
|
+
*
|
|
56
|
+
* Core vaults are fixed string literals.
|
|
57
|
+
* Custom vaults created via Phase 41 are identified by an opaque uppercase string ID
|
|
58
|
+
* (e.g. `'MY_NOTES'`). Discover available custom vault IDs via `sdk.vaults.list`.
|
|
59
|
+
*/
|
|
60
|
+
type MnemoVault = 'DEV' | 'SOCIAL' | 'PERSONAL' | 'FINANCE' | 'RESEARCH' | (string & {});
|
|
27
61
|
/** Types de spine sémantiques */
|
|
28
62
|
type SpineType = 'GIT' | 'ARCHITECTURE' | 'DECISION' | 'DEBUG' | 'FEATURE' | 'REDDIT_POST' | 'LINKEDIN_POST' | 'SOCIAL_NODE' | 'DOCUMENT' | 'NOTE' | 'CUSTOM'
|
|
29
63
|
/** Créé par le Cockpit ou via sdk.resonances.list */
|
|
@@ -31,9 +65,9 @@ type SpineType = 'GIT' | 'ARCHITECTURE' | 'DECISION' | 'DEBUG' | 'FEATURE' | 'RE
|
|
|
31
65
|
/** Persistance de session / contexte de reprise */
|
|
32
66
|
| 'SESSION'
|
|
33
67
|
/** Mise à jour de position (phase, état courant) */
|
|
34
|
-
| 'POSITION_UPDATE'
|
|
35
|
-
/**
|
|
36
|
-
| '
|
|
68
|
+
| 'POSITION_UPDATE' | 'API' | 'DOC' | 'ERROR'
|
|
69
|
+
/** [PHASE-64] Affective & Ideational Spines */
|
|
70
|
+
| 'EPIPHANY' | 'EMOTIONAL' | 'TENSION' | 'FLOW' | 'IDEATIONAL' | 'HYPOTHESIS' | 'CONCERN' | 'VISION' | 'CONTEXTUAL' | 'DISCOVERY' | (string & {});
|
|
37
71
|
/** Manifest de l'application — fichier `app.manifest.json` */
|
|
38
72
|
interface AppManifest {
|
|
39
73
|
/** Identifiant unique stable de l'app (snake_case recommandé) */
|
|
@@ -107,6 +141,34 @@ interface QueryOptions {
|
|
|
107
141
|
vault?: MnemoVault;
|
|
108
142
|
/** Seuil de similarité minimum 0-1 (défaut: 0.0) */
|
|
109
143
|
threshold?: number;
|
|
144
|
+
/**
|
|
145
|
+
* [SDK 1.2 — Semantic Bridge] Opt-in true semantic ranking.
|
|
146
|
+
*
|
|
147
|
+
* When `false` / omitted, the server returns the N most recent chronicles
|
|
148
|
+
* (the Cockpit fast-path, ~5ms, query text ignored).
|
|
149
|
+
*
|
|
150
|
+
* When `true`, the server embeds the query via the host's active model
|
|
151
|
+
* (Vertex 768D / e5-base / Hybrid) and ranks via `querySemanticContext`
|
|
152
|
+
* with cosine similarity × spineType weight under the cognitive `scope`.
|
|
153
|
+
*
|
|
154
|
+
* Use `true` for agent-style queries where relevance matters more than
|
|
155
|
+
* recency. Default behaviour stays "recent" to preserve historical
|
|
156
|
+
* contracts (notably Cockpit's live feed).
|
|
157
|
+
*/
|
|
158
|
+
semantic?: boolean;
|
|
159
|
+
/**
|
|
160
|
+
* [SDK 1.2] Cognitive ranking scope for type-weighting. Only meaningful
|
|
161
|
+
* when `semantic: true`. Defaults to `'SOURCE_CODE'` server-side, which
|
|
162
|
+
* boosts ARCHITECTURE / GIT / API spines and dampens DOCUMENT / VISION.
|
|
163
|
+
* Other valid scopes depend on the host's `type-weights.ts` table.
|
|
164
|
+
*/
|
|
165
|
+
scope?: string;
|
|
166
|
+
/**
|
|
167
|
+
* [SDK 1.2] Optional whitelist of spineTypes to restrict results to.
|
|
168
|
+
* Server-side SQL `IN` clause. Example: `['ARCHITECTURE', 'GIT']` to
|
|
169
|
+
* surface design docs + commit history only.
|
|
170
|
+
*/
|
|
171
|
+
spineTypeFilter?: string[];
|
|
110
172
|
}
|
|
111
173
|
interface Chronicle {
|
|
112
174
|
id: string;
|
|
@@ -117,10 +179,33 @@ interface Chronicle {
|
|
|
117
179
|
timestamp: string;
|
|
118
180
|
source_app_id: string;
|
|
119
181
|
}
|
|
182
|
+
/**
|
|
183
|
+
* [SDK 1.2 — Semantic Bridge] Debug breadcrumb returned by the server when
|
|
184
|
+
* the client opted into `semantic: true`. Lets agents distinguish "I asked
|
|
185
|
+
* for semantic and got it" from "I asked for semantic and it silently fell
|
|
186
|
+
* back to recent" (and why). Only populated on opt-in.
|
|
187
|
+
*/
|
|
188
|
+
interface QuerySemanticDebug {
|
|
189
|
+
/** Did the client request semantic ranking? Always true when this field is present. */
|
|
190
|
+
wanted: boolean;
|
|
191
|
+
/** Did the semantic branch actually execute? (false ⇒ fell back to recent, see `error`) */
|
|
192
|
+
used: boolean;
|
|
193
|
+
/** Dimension of the embedding vector used (768 for Vertex/e5-base, 512 for nomic local). */
|
|
194
|
+
vectorDim?: number;
|
|
195
|
+
/** Total chronicle count in the target vault at query time. */
|
|
196
|
+
vaultSize?: number;
|
|
197
|
+
/** Error message if `used` is false. Examples: provider not registered, vector dim mismatch. */
|
|
198
|
+
error?: string;
|
|
199
|
+
}
|
|
120
200
|
interface QueryResult {
|
|
121
201
|
success: boolean;
|
|
122
202
|
chronicles: Chronicle[];
|
|
123
203
|
error?: string;
|
|
204
|
+
/**
|
|
205
|
+
* [SDK 1.2] Present only when the client sent `semantic: true`. See
|
|
206
|
+
* {@link QuerySemanticDebug}. Absent on fast-path / non-opt-in queries.
|
|
207
|
+
*/
|
|
208
|
+
_semantic?: QuerySemanticDebug;
|
|
124
209
|
}
|
|
125
210
|
interface ShareRequest {
|
|
126
211
|
/** App source dont on veut lire les vecteurs */
|
|
@@ -140,6 +225,135 @@ interface RegisterResult {
|
|
|
140
225
|
expiresAt: number;
|
|
141
226
|
appId: string;
|
|
142
227
|
}
|
|
228
|
+
/**
|
|
229
|
+
* Describes a vault (core or custom) returned by `sdk.vaults.list`.
|
|
230
|
+
* Use `id` as the `vault` parameter in `ingest()` and `query()` calls.
|
|
231
|
+
*/
|
|
232
|
+
interface VaultInfo {
|
|
233
|
+
/** Unique vault identifier (uppercase, e.g. `'DEV'`, `'MY_NOTES'`). */
|
|
234
|
+
id: string;
|
|
235
|
+
/** Human-readable display name. */
|
|
236
|
+
displayName: string;
|
|
237
|
+
/** Whether this is a built-in core vault (`true`) or user-created (`false`). */
|
|
238
|
+
fixed: boolean;
|
|
239
|
+
/** Accent color (hex) for UI rendering. */
|
|
240
|
+
color: string;
|
|
241
|
+
/** Chronicle count at query time. */
|
|
242
|
+
chronicleCount: number;
|
|
243
|
+
/** SQLite file size in KB. */
|
|
244
|
+
sizeKb: number;
|
|
245
|
+
}
|
|
246
|
+
interface VaultListResult {
|
|
247
|
+
success: boolean;
|
|
248
|
+
/** Core vaults (DEV, SOCIAL, PERSONAL, FINANCE, RESEARCH). */
|
|
249
|
+
coreVaults: VaultInfo[];
|
|
250
|
+
/** User-created custom vaults. */
|
|
251
|
+
customVaults: VaultInfo[];
|
|
252
|
+
error?: string;
|
|
253
|
+
}
|
|
254
|
+
/**
|
|
255
|
+
* Options for a causal/semantic correlation query.
|
|
256
|
+
* Finds chronicles that are causally or semantically linked to a source chronicle.
|
|
257
|
+
*/
|
|
258
|
+
interface CorrelateOptions {
|
|
259
|
+
/** ID of the source chronicle to find correlations for. */
|
|
260
|
+
sourceId: string;
|
|
261
|
+
/** Maximum number of correlations to return (default: 10). */
|
|
262
|
+
limit?: number;
|
|
263
|
+
/** Vault to search in (defaults to the app's primary vault). */
|
|
264
|
+
vault?: MnemoVault;
|
|
265
|
+
/** Minimum correlation strength 0-1 (default: 0.5). */
|
|
266
|
+
threshold?: number;
|
|
267
|
+
}
|
|
268
|
+
interface CorrelationEntry {
|
|
269
|
+
chronicle: Chronicle;
|
|
270
|
+
/** Correlation strength between 0 and 1. */
|
|
271
|
+
strength: number;
|
|
272
|
+
/** Nature of the link between the two chronicles. */
|
|
273
|
+
type: 'causal' | 'temporal' | 'semantic';
|
|
274
|
+
}
|
|
275
|
+
interface CorrelateResult {
|
|
276
|
+
success: boolean;
|
|
277
|
+
correlations: CorrelationEntry[];
|
|
278
|
+
error?: string;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Result of a `sdk.forget` call.
|
|
282
|
+
* Deletes a chronicle by ID from the vault. Requires `vault:write:*` scope.
|
|
283
|
+
*/
|
|
284
|
+
interface ForgetResult {
|
|
285
|
+
success: boolean;
|
|
286
|
+
/** ID of the deleted chronicle. */
|
|
287
|
+
deletedId: string;
|
|
288
|
+
error?: string;
|
|
289
|
+
}
|
|
290
|
+
/**
|
|
291
|
+
* Request to allocate a new dynamic spine in the OS registry.
|
|
292
|
+
* Dynamic spines allow Layer 2 apps to define their own semantic categories
|
|
293
|
+
* that appear in the Mnemosyne OS neural graph alongside core spine types.
|
|
294
|
+
*
|
|
295
|
+
* Requires scope `vault:write:CUSTOM` and the Protocole du Guichet to be active.
|
|
296
|
+
*/
|
|
297
|
+
interface DynamicSpineRequest {
|
|
298
|
+
/** Unique ID for this spine (snake_case, e.g. `'my_app_events'`). */
|
|
299
|
+
id: string;
|
|
300
|
+
/** Display name shown in the OS neural graph. */
|
|
301
|
+
name: string;
|
|
302
|
+
/** Base spine type to inherit semantic weight from. */
|
|
303
|
+
type: SpineType | string;
|
|
304
|
+
/** Emoji or icon key for UI rendering. */
|
|
305
|
+
icon: string;
|
|
306
|
+
/** Short description of what this spine captures. */
|
|
307
|
+
description?: string;
|
|
308
|
+
}
|
|
309
|
+
interface DynamicSpineResult {
|
|
310
|
+
success: boolean;
|
|
311
|
+
/** Full spine ID as registered (may be namespaced, e.g. `'my-app/my_events'`). */
|
|
312
|
+
spineId?: string;
|
|
313
|
+
error?: string;
|
|
314
|
+
}
|
|
315
|
+
interface DynamicSpineInfo {
|
|
316
|
+
id: string;
|
|
317
|
+
name: string;
|
|
318
|
+
type: string;
|
|
319
|
+
icon: string;
|
|
320
|
+
/** App ID that owns this spine. */
|
|
321
|
+
ownerAppId: string;
|
|
322
|
+
/** ISO timestamp of allocation. */
|
|
323
|
+
allocatedAt: string;
|
|
324
|
+
}
|
|
325
|
+
/**
|
|
326
|
+
* A Resonance record returned by `sdk.resonances.list`.
|
|
327
|
+
* Resonances are cognitive projects tracked in the DEV vault.
|
|
328
|
+
*/
|
|
329
|
+
interface ResonanceRecord {
|
|
330
|
+
/** Unique resonance identifier (e.g. `'agent-cockpit'`). */
|
|
331
|
+
id: string;
|
|
332
|
+
/** Display name of the resonance. */
|
|
333
|
+
name: string;
|
|
334
|
+
/** Current lifecycle status. */
|
|
335
|
+
status: 'active' | 'paused' | 'done';
|
|
336
|
+
spineType: 'RESONANCE';
|
|
337
|
+
/** Number of chronicles tagged with this resonance. */
|
|
338
|
+
spineCount: number;
|
|
339
|
+
/** Number of agents currently working on this resonance. */
|
|
340
|
+
agentCount: number;
|
|
341
|
+
/** Milliseconds since last activity. */
|
|
342
|
+
lastActivity: number;
|
|
343
|
+
/** Last known position string (set via `updatePosition`). */
|
|
344
|
+
lastPosition?: string;
|
|
345
|
+
}
|
|
346
|
+
/**
|
|
347
|
+
* Result of `sdk.resonance.updatePosition`.
|
|
348
|
+
*/
|
|
349
|
+
interface PositionUpdateResult {
|
|
350
|
+
/** Whether the position was persisted. */
|
|
351
|
+
ok: boolean;
|
|
352
|
+
resonanceId: string;
|
|
353
|
+
phase: string;
|
|
354
|
+
/** Unix timestamp (ms) of the update. */
|
|
355
|
+
ts: number;
|
|
356
|
+
}
|
|
143
357
|
/**
|
|
144
358
|
* Un commit git retourné par MNEMOSYNE_METHODS.GIT_LOG.
|
|
145
359
|
* Le path du repo est hardcodé côté serveur (Zero-Trust).
|
|
@@ -154,6 +368,21 @@ interface GitCommit {
|
|
|
154
368
|
ts: number;
|
|
155
369
|
repo: string;
|
|
156
370
|
}
|
|
371
|
+
/** Options for MnemoClient.gitLog(). */
|
|
372
|
+
interface GitLogOptions {
|
|
373
|
+
/** Number of commits to return (default: 20, server cap: 50). */
|
|
374
|
+
limit?: number;
|
|
375
|
+
/** Time range filter (e.g. "7 days ago", "2024-01-01"). */
|
|
376
|
+
since?: string;
|
|
377
|
+
/** Filter commits by message pattern (e.g. "[RESONANCE:agent-cockpit]"). */
|
|
378
|
+
filter?: string;
|
|
379
|
+
}
|
|
380
|
+
/** Result of MnemoClient.gitLog(). */
|
|
381
|
+
interface GitLogResult {
|
|
382
|
+
success: boolean;
|
|
383
|
+
commits: GitCommit[];
|
|
384
|
+
error?: string;
|
|
385
|
+
}
|
|
157
386
|
/**
|
|
158
387
|
* Un agent SDK retourné par MNEMOSYNE_METHODS.LIST_AGENTS.
|
|
159
388
|
*/
|
|
@@ -209,7 +438,94 @@ interface GraphQueryResult {
|
|
|
209
438
|
centerNodeId?: string;
|
|
210
439
|
error?: string;
|
|
211
440
|
}
|
|
212
|
-
type MnemoEventType = 'connected' | 'disconnected' | 'error' | 'tamper-alert' | 'share-request'
|
|
441
|
+
type MnemoEventType = 'connected' | 'disconnected' | 'error' | 'tamper-alert' | 'share-request'
|
|
442
|
+
/** Fired when a connected NFT licence is transferred mid-session. */
|
|
443
|
+
| 'nft-revoked'
|
|
444
|
+
/** Fired by the OS when another app ingests a new chronicle. */
|
|
445
|
+
| 'chronicle:new'
|
|
446
|
+
/** Fired when a Layer 2 dynamic spine is allocated or released. */
|
|
447
|
+
| 'spine:change'
|
|
448
|
+
/**
|
|
449
|
+
* [PHASE-58] Fired after each Semantic Reflect scan persists new bridges.
|
|
450
|
+
* payload: { sessionId, newCount, knownCount, totalFound }
|
|
451
|
+
*/
|
|
452
|
+
| 'bridge:new';
|
|
453
|
+
/**
|
|
454
|
+
* A semantic bridge between two chronicles in different vaults.
|
|
455
|
+
* Returned by getBridgeHistory().
|
|
456
|
+
* [PHASE-58][PLATFORM][READ-ONLY]
|
|
457
|
+
*/
|
|
458
|
+
interface BridgeRecord {
|
|
459
|
+
id: number;
|
|
460
|
+
scanned_at: string;
|
|
461
|
+
from_id: number;
|
|
462
|
+
from_vault: string;
|
|
463
|
+
from_spine: string;
|
|
464
|
+
from_label: string;
|
|
465
|
+
to_id: number;
|
|
466
|
+
to_vault: string;
|
|
467
|
+
to_spine: string;
|
|
468
|
+
to_label: string;
|
|
469
|
+
/** Cosine similarity score (0-1). High values = strong cognitive link. */
|
|
470
|
+
cosine: number;
|
|
471
|
+
/** UUID of the scan session that discovered this bridge. */
|
|
472
|
+
session_id: string | null;
|
|
473
|
+
/** 1 if this bridge was never seen before this scan, 0 if already known. */
|
|
474
|
+
is_new: 0 | 1;
|
|
475
|
+
/** JSON array of tags (reserved for future use). */
|
|
476
|
+
tags: string;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* A bridge scan session — groups all bridges found in one Semantic Reflect run.
|
|
480
|
+
*/
|
|
481
|
+
interface BridgeScanSession {
|
|
482
|
+
/** UUID — unique session identifier. */
|
|
483
|
+
id: string;
|
|
484
|
+
scanned_at: string;
|
|
485
|
+
threshold: number;
|
|
486
|
+
total_found: number;
|
|
487
|
+
new_count: number;
|
|
488
|
+
llm_synthesis: string | null;
|
|
489
|
+
duration_ms: number | null;
|
|
490
|
+
}
|
|
491
|
+
/** Options for getBridgeHistory(). */
|
|
492
|
+
interface BridgeHistoryOptions {
|
|
493
|
+
/** Maximum bridges to return (default: 500). */
|
|
494
|
+
limit?: number;
|
|
495
|
+
/** ISO timestamp — only return bridges after this date. */
|
|
496
|
+
since?: string;
|
|
497
|
+
/** Minimum cosine similarity (0-1, default: 0.0). */
|
|
498
|
+
minCosine?: number;
|
|
499
|
+
/** Filter by source vault (default: 'ALL'). */
|
|
500
|
+
vaultFilter?: 'DEV' | 'SOCIAL' | 'PERSONAL' | 'ALL';
|
|
501
|
+
/** Only return bridges that were new when first discovered. */
|
|
502
|
+
onlyNew?: boolean;
|
|
503
|
+
}
|
|
504
|
+
/** Result of getBridgeHistory(). */
|
|
505
|
+
interface BridgeHistoryResult {
|
|
506
|
+
success: boolean;
|
|
507
|
+
bridges: BridgeRecord[];
|
|
508
|
+
error?: string;
|
|
509
|
+
}
|
|
510
|
+
/**
|
|
511
|
+
* Result of computeResonance() — resonance score for a text before publication.
|
|
512
|
+
* [PLATFORM] Use this to gate social posts on cognitive relevance.
|
|
513
|
+
*/
|
|
514
|
+
interface ResonanceScore {
|
|
515
|
+
success: boolean;
|
|
516
|
+
/** Aggregated cosine score (0-1). */
|
|
517
|
+
score: number;
|
|
518
|
+
/** Qualitative band: LOW (<0.60), MEDIUM (0.60-0.80), HIGH_RESONANCE (>0.80). */
|
|
519
|
+
level: 'LOW' | 'MEDIUM' | 'HIGH_RESONANCE';
|
|
520
|
+
/** Top K matching bridges. */
|
|
521
|
+
topMatches: Array<{
|
|
522
|
+
bridgeId: number;
|
|
523
|
+
fromLabel: string;
|
|
524
|
+
toLabel: string;
|
|
525
|
+
cosine: number;
|
|
526
|
+
vault: string;
|
|
527
|
+
}>;
|
|
528
|
+
}
|
|
213
529
|
interface MnemoEvent<T = unknown> {
|
|
214
530
|
type: MnemoEventType;
|
|
215
531
|
data: T;
|
|
@@ -351,6 +667,13 @@ declare class MnemoClient {
|
|
|
351
667
|
* [PHASE-50] Lit un fichier .md depuis le repo OS (docs/, packages/).
|
|
352
668
|
*/
|
|
353
669
|
readFile(path: string): Promise<string>;
|
|
670
|
+
/**
|
|
671
|
+
* Returns the most recent git commits from the OS monorepo.
|
|
672
|
+
* Calls the server-side `sdk.git.log` RPC (repo path is hardcoded server-side
|
|
673
|
+
* for Zero-Trust — the client cannot choose it).
|
|
674
|
+
* Requires scope `monorepo:read` and intent `GIT_LOG` in the manifest.
|
|
675
|
+
*/
|
|
676
|
+
gitLog(options?: GitLogOptions): Promise<GitLogResult>;
|
|
354
677
|
}
|
|
355
678
|
|
|
356
679
|
/**
|
|
@@ -416,25 +739,27 @@ declare class MnemoClientBrowser {
|
|
|
416
739
|
* Requête sémantique sur le vault — retourne les chronicles les plus proches.
|
|
417
740
|
* Requiert le scope `vault:read:<vault>` et l'intent `QUERY`.
|
|
418
741
|
*
|
|
419
|
-
* @param text
|
|
420
|
-
* @param vault
|
|
421
|
-
* @param limit
|
|
742
|
+
* @param text - Texte de recherche
|
|
743
|
+
* @param vault - Vault cible (défaut: 'DEV')
|
|
744
|
+
* @param limit - Nombre max de résultats (défaut: 10)
|
|
745
|
+
* @param options - [SDK 1.2] Options sémantiques additionnelles (semantic,
|
|
746
|
+
* scope, spineTypeFilter). Voir {@link QueryOptions}.
|
|
422
747
|
*/
|
|
423
|
-
query(text: string, vault?: string, limit?: number): Promise<Chronicle[]>;
|
|
748
|
+
query(text: string, vault?: string, limit?: number, options?: Pick<QueryOptions, 'semantic' | 'scope' | 'spineTypeFilter'>): Promise<Chronicle[]>;
|
|
424
749
|
/**
|
|
425
|
-
*
|
|
426
|
-
*
|
|
750
|
+
* Returns the active Resonances (cognitive projects) from the DEV vault.
|
|
751
|
+
* Requires scope `vault:read:DEV`.
|
|
427
752
|
*/
|
|
428
|
-
resonancesList(): Promise<
|
|
753
|
+
resonancesList(): Promise<ResonanceRecord[]>;
|
|
429
754
|
/**
|
|
430
|
-
*
|
|
431
|
-
*
|
|
755
|
+
* Persists the current position of a Resonance in the DEV vault.
|
|
756
|
+
* Requires scope `vault:write:DEV`.
|
|
432
757
|
*
|
|
433
|
-
* @param resonanceId -
|
|
434
|
-
* @param position -
|
|
435
|
-
* @param phase -
|
|
758
|
+
* @param resonanceId - Resonance identifier
|
|
759
|
+
* @param position - Current position description (e.g. 'Phase 51.2 — auto-poll')
|
|
760
|
+
* @param phase - Current phase (e.g. 'Phase 51')
|
|
436
761
|
*/
|
|
437
|
-
updatePosition(resonanceId: string, position: string, phase: string): Promise<
|
|
762
|
+
updatePosition(resonanceId: string, position: string, phase: string): Promise<PositionUpdateResult>;
|
|
438
763
|
/**
|
|
439
764
|
* Retourne les commits récents du monorepo Mnemosyne OS.
|
|
440
765
|
* Requiert le scope `monorepo:read` et l'intent `GIT_LOG`.
|
|
@@ -453,10 +778,103 @@ declare class MnemoClientBrowser {
|
|
|
453
778
|
*/
|
|
454
779
|
readFile(path: string): Promise<string>;
|
|
455
780
|
/**
|
|
456
|
-
*
|
|
457
|
-
*
|
|
781
|
+
* Lists Layer 2 apps currently connected to the SDK WebSocket Server.
|
|
782
|
+
* Requires scope `agents:read` and intent `LIST_AGENTS`.
|
|
458
783
|
*/
|
|
459
784
|
agentsList(): Promise<AgentInfo[]>;
|
|
785
|
+
/**
|
|
786
|
+
* Returns all available vaults (core built-ins + user-created custom vaults).
|
|
787
|
+
* Use the `id` field of each entry as the `vault` param in `ingest()` and `query()`.
|
|
788
|
+
* Requires intent `LIST_VAULTS`.
|
|
789
|
+
*/
|
|
790
|
+
vaultsList(): Promise<VaultListResult>;
|
|
791
|
+
/**
|
|
792
|
+
* Finds chronicles causally or semantically linked to a source chronicle.
|
|
793
|
+
* Requires intent `CORRELATE` and the appropriate vault read scope.
|
|
794
|
+
*
|
|
795
|
+
* @param options - `{ sourceId, vault?, limit?, threshold? }`
|
|
796
|
+
*/
|
|
797
|
+
correlate(options: CorrelateOptions): Promise<CorrelateResult>;
|
|
798
|
+
/**
|
|
799
|
+
* Permanently deletes a chronicle by ID. Requires intent `FORGET`
|
|
800
|
+
* and the appropriate vault write scope.
|
|
801
|
+
*
|
|
802
|
+
* @param chronicleId - ID of the chronicle to delete.
|
|
803
|
+
* @param vault - Vault to delete from (default: 'DEV').
|
|
804
|
+
*/
|
|
805
|
+
forget(chronicleId: string, vault?: string): Promise<ForgetResult>;
|
|
806
|
+
/**
|
|
807
|
+
* Queries the NeuralGraph — returns nodes and edges near the given text.
|
|
808
|
+
* Requires scope `neural:graph:read`.
|
|
809
|
+
*
|
|
810
|
+
* @param text - Search text to embed and match against the graph.
|
|
811
|
+
* @param threshold - Minimum edge strength 0-1 (default: 0.5).
|
|
812
|
+
*/
|
|
813
|
+
graphQuery(text: string, threshold?: number): Promise<GraphQueryResult>;
|
|
814
|
+
/**
|
|
815
|
+
* Allocates a new dynamic spine in the OS Protocole du Guichet registry.
|
|
816
|
+
* Requires scope `vault:write:CUSTOM`.
|
|
817
|
+
*
|
|
818
|
+
* @example
|
|
819
|
+
* ```ts
|
|
820
|
+
* await client.spineRegister({
|
|
821
|
+
* id: 'my_events', name: 'App Events', type: 'SESSION', icon: '📊'
|
|
822
|
+
* });
|
|
823
|
+
* ```
|
|
824
|
+
*/
|
|
825
|
+
spineRegister(spine: DynamicSpineRequest): Promise<DynamicSpineResult>;
|
|
826
|
+
/**
|
|
827
|
+
* Releases a dynamic spine previously allocated by this app.
|
|
828
|
+
* Requires scope `vault:write:CUSTOM`.
|
|
829
|
+
*/
|
|
830
|
+
spineRelease(spineId: string): Promise<{
|
|
831
|
+
success: boolean;
|
|
832
|
+
error?: string;
|
|
833
|
+
}>;
|
|
834
|
+
/**
|
|
835
|
+
* Lists all currently allocated dynamic spines across all apps.
|
|
836
|
+
*/
|
|
837
|
+
spineList(): Promise<DynamicSpineInfo[]>;
|
|
838
|
+
/**
|
|
839
|
+
* Returns the persistent semantic bridges stored in the user's vault.
|
|
840
|
+
* Bridges are cognitive links discovered by Semantic Reflect scans between
|
|
841
|
+
* cross-vault chronicles (e.g. SOCIAL ⇔ DEV, PERSONAL ⇔ DEV).
|
|
842
|
+
*
|
|
843
|
+
* [PHASE-58][PLATFORM][READ-ONLY]
|
|
844
|
+
*
|
|
845
|
+
* Required manifest: `scopes: ['bridge:read']`, `intents: ['BRIDGE_READ']`
|
|
846
|
+
*
|
|
847
|
+
* @param options - Optional filters: `{ limit, since, minCosine, vaultFilter, onlyNew }`
|
|
848
|
+
*
|
|
849
|
+
* @example
|
|
850
|
+
* ```typescript
|
|
851
|
+
* const result = await client.getBridgeHistory({ minCosine: 0.80, limit: 50 });
|
|
852
|
+
* console.log(`${result.bridges.length} high-confidence bridges`);
|
|
853
|
+
* ```
|
|
854
|
+
*/
|
|
855
|
+
getBridgeHistory(options?: BridgeHistoryOptions): Promise<BridgeHistoryResult>;
|
|
856
|
+
/**
|
|
857
|
+
* Computes a resonance score for a text against the user's bridge history.
|
|
858
|
+
* Use this to measure cognitive relevance before publishing a social post.
|
|
859
|
+
*
|
|
860
|
+
* [PHASE-58][PLATFORM][READ-ONLY]
|
|
861
|
+
*
|
|
862
|
+
* Required manifest: `scopes: ['bridge:read']`, `intents: ['BRIDGE_READ']`
|
|
863
|
+
*
|
|
864
|
+
* @param text - Text to score (e.g. LinkedIn/Reddit post draft).
|
|
865
|
+
* @param topK - Number of top matches to return (default: 5).
|
|
866
|
+
*
|
|
867
|
+
* @returns { score: 0-1, level: 'LOW'|'MEDIUM'|'HIGH_RESONANCE', topMatches }
|
|
868
|
+
*
|
|
869
|
+
* @example
|
|
870
|
+
* ```typescript
|
|
871
|
+
* const score = await client.computeResonance(postDraft, 5);
|
|
872
|
+
* if (score.level === 'HIGH_RESONANCE') {
|
|
873
|
+
* console.log('✨ This post aligns with your cognitive graph!');
|
|
874
|
+
* }
|
|
875
|
+
* ```
|
|
876
|
+
*/
|
|
877
|
+
computeResonance(text: string, topK?: number): Promise<ResonanceScore>;
|
|
460
878
|
/**
|
|
461
879
|
* Enregistre un handler pour les push events envoyés par l'OS.
|
|
462
880
|
* Déclenché par exemple quand un autre client ingère un chronicle (`chronicle:new`).
|
|
@@ -503,7 +921,7 @@ declare class MnemoClientBrowser {
|
|
|
503
921
|
* [SDK][ZERO-TRUST][AUDIT-TRAIL][MN-004]
|
|
504
922
|
*/
|
|
505
923
|
|
|
506
|
-
declare const VALID_SCOPES: readonly ["vault:read:DEV", "vault:write:DEV", "vault:read:SOCIAL", "vault:write:SOCIAL", "vault:read:PERSONAL", "vault:write:PERSONAL", "vault:read:FINANCE", "vault:write:FINANCE", "vault:read:
|
|
924
|
+
declare const VALID_SCOPES: readonly ["vault:read:DEV", "vault:write:DEV", "vault:read:SOCIAL", "vault:write:SOCIAL", "vault:read:PERSONAL", "vault:write:PERSONAL", "vault:read:FINANCE", "vault:write:FINANCE", "vault:read:RESEARCH", "vault:write:RESEARCH", "vault:read:CUSTOM", "vault:write:CUSTOM", "share:request", "share:grant", "monorepo:read", "agents:read", "nft:validate", "neural:graph:read", "llm:query", "bridge:read"];
|
|
507
925
|
/**
|
|
508
926
|
* Scopes qui requièrent TOUJOURS un GRANT utilisateur côté OS.
|
|
509
927
|
* Indépendant de tout flag déclaré par l'app.
|
|
@@ -516,9 +934,15 @@ declare const AppManifestSchema: z.ZodObject<{
|
|
|
516
934
|
version: z.ZodString;
|
|
517
935
|
author: z.ZodOptional<z.ZodString>;
|
|
518
936
|
mnemosyne_sdk: z.ZodString;
|
|
519
|
-
scopes: z.ZodArray<z.ZodEnum<["vault:read:DEV", "vault:write:DEV", "vault:read:SOCIAL", "vault:write:SOCIAL", "vault:read:PERSONAL", "vault:write:PERSONAL", "vault:read:FINANCE", "vault:write:FINANCE", "vault:read:
|
|
520
|
-
|
|
521
|
-
|
|
937
|
+
scopes: z.ZodArray<z.ZodEnum<["vault:read:DEV", "vault:write:DEV", "vault:read:SOCIAL", "vault:write:SOCIAL", "vault:read:PERSONAL", "vault:write:PERSONAL", "vault:read:FINANCE", "vault:write:FINANCE", "vault:read:RESEARCH", "vault:write:RESEARCH", "vault:read:CUSTOM", "vault:write:CUSTOM", "share:request", "share:grant", "monorepo:read", "agents:read", "nft:validate", "neural:graph:read", "llm:query", "bridge:read"]>, "many">;
|
|
938
|
+
/**
|
|
939
|
+
* Vaults the app can access.
|
|
940
|
+
* Core vaults must use the built-in identifiers (DEV, SOCIAL, etc.).
|
|
941
|
+
* Custom vault IDs are opaque uppercase strings — the manifest may list them
|
|
942
|
+
* here to pre-declare intent, and the OS validates them at runtime.
|
|
943
|
+
*/
|
|
944
|
+
vaults: z.ZodArray<z.ZodUnion<[z.ZodEnum<["DEV", "SOCIAL", "PERSONAL", "FINANCE", "RESEARCH"]>, z.ZodString]>, "many">;
|
|
945
|
+
intents: z.ZodArray<z.ZodEnum<["INGEST", "QUERY", "CORRELATE", "FORGET", "GIT_LOG", "LIST_AGENTS", "LIST_VAULTS", "BRIDGE_READ"]>, "many">;
|
|
522
946
|
max_chronicle_size_kb: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
523
947
|
/**
|
|
524
948
|
* @deprecated Remplacé par requiresOsGrant() — ce flag n'a aucun effet sur la sécurité.
|
|
@@ -531,9 +955,9 @@ declare const AppManifestSchema: z.ZodObject<{
|
|
|
531
955
|
name: string;
|
|
532
956
|
version: string;
|
|
533
957
|
mnemosyne_sdk: string;
|
|
534
|
-
scopes: ("vault:read:DEV" | "vault:write:DEV" | "vault:read:SOCIAL" | "vault:write:SOCIAL" | "vault:read:PERSONAL" | "vault:write:PERSONAL" | "vault:read:FINANCE" | "vault:write:FINANCE" | "vault:read:
|
|
535
|
-
vaults:
|
|
536
|
-
intents: ("INGEST" | "QUERY" | "CORRELATE" | "FORGET")[];
|
|
958
|
+
scopes: ("vault:read:DEV" | "vault:write:DEV" | "vault:read:SOCIAL" | "vault:write:SOCIAL" | "vault:read:PERSONAL" | "vault:write:PERSONAL" | "vault:read:FINANCE" | "vault:write:FINANCE" | "vault:read:RESEARCH" | "vault:write:RESEARCH" | "vault:read:CUSTOM" | "vault:write:CUSTOM" | "share:request" | "share:grant" | "monorepo:read" | "agents:read" | "nft:validate" | "neural:graph:read" | "llm:query" | "bridge:read")[];
|
|
959
|
+
vaults: string[];
|
|
960
|
+
intents: ("INGEST" | "QUERY" | "CORRELATE" | "FORGET" | "GIT_LOG" | "LIST_AGENTS" | "LIST_VAULTS" | "BRIDGE_READ")[];
|
|
537
961
|
max_chronicle_size_kb: number;
|
|
538
962
|
requires_consent: boolean;
|
|
539
963
|
author?: string | undefined;
|
|
@@ -543,9 +967,9 @@ declare const AppManifestSchema: z.ZodObject<{
|
|
|
543
967
|
name: string;
|
|
544
968
|
version: string;
|
|
545
969
|
mnemosyne_sdk: string;
|
|
546
|
-
scopes: ("vault:read:DEV" | "vault:write:DEV" | "vault:read:SOCIAL" | "vault:write:SOCIAL" | "vault:read:PERSONAL" | "vault:write:PERSONAL" | "vault:read:FINANCE" | "vault:write:FINANCE" | "vault:read:
|
|
547
|
-
vaults:
|
|
548
|
-
intents: ("INGEST" | "QUERY" | "CORRELATE" | "FORGET")[];
|
|
970
|
+
scopes: ("vault:read:DEV" | "vault:write:DEV" | "vault:read:SOCIAL" | "vault:write:SOCIAL" | "vault:read:PERSONAL" | "vault:write:PERSONAL" | "vault:read:FINANCE" | "vault:write:FINANCE" | "vault:read:RESEARCH" | "vault:write:RESEARCH" | "vault:read:CUSTOM" | "vault:write:CUSTOM" | "share:request" | "share:grant" | "monorepo:read" | "agents:read" | "nft:validate" | "neural:graph:read" | "llm:query" | "bridge:read")[];
|
|
971
|
+
vaults: string[];
|
|
972
|
+
intents: ("INGEST" | "QUERY" | "CORRELATE" | "FORGET" | "GIT_LOG" | "LIST_AGENTS" | "LIST_VAULTS" | "BRIDGE_READ")[];
|
|
549
973
|
author?: string | undefined;
|
|
550
974
|
max_chronicle_size_kb?: number | undefined;
|
|
551
975
|
requires_consent?: boolean | undefined;
|
|
@@ -562,8 +986,12 @@ declare function loadManifest(pathOrManifest: string | AppManifest): AppManifest
|
|
|
562
986
|
*/
|
|
563
987
|
declare function parseManifest(raw: unknown): AppManifest;
|
|
564
988
|
/**
|
|
565
|
-
*
|
|
566
|
-
*
|
|
989
|
+
* Validates that a scope is declared in the manifest.
|
|
990
|
+
* Used by MnemoClient before each vault operation.
|
|
991
|
+
*
|
|
992
|
+
* For custom vault operations, the scope `vault:read:CUSTOM` or
|
|
993
|
+
* `vault:write:CUSTOM` is accepted as a wildcard that grants access
|
|
994
|
+
* to any custom vault listed in `manifest.vaults`.
|
|
567
995
|
*/
|
|
568
996
|
declare function assertScope(manifest: AppManifest, scope: (typeof VALID_SCOPES)[number]): void;
|
|
569
997
|
/**
|
|
@@ -660,10 +1088,34 @@ declare const MNEMOSYNE_METHODS: {
|
|
|
660
1088
|
*/
|
|
661
1089
|
readonly NFT_VALIDATE: "sdk.nft.validate";
|
|
662
1090
|
/**
|
|
663
|
-
*
|
|
664
|
-
*
|
|
1091
|
+
* Queries the NeuralGraph — returns nodes and edges near the given text.
|
|
1092
|
+
* Requires scope `neural:graph:read`.
|
|
665
1093
|
*/
|
|
666
1094
|
readonly GRAPH_QUERY: "sdk.graph.query";
|
|
1095
|
+
/**
|
|
1096
|
+
* Lists all available vaults (core built-ins + user-created custom vaults).
|
|
1097
|
+
* Requires intent `LIST_VAULTS`.
|
|
1098
|
+
* Returns `VaultListResult` with `coreVaults` and `customVaults` arrays.
|
|
1099
|
+
* Use the `id` field of each vault as the `vault` param in ingest/query.
|
|
1100
|
+
*/
|
|
1101
|
+
readonly LIST_VAULTS: "sdk.vaults.list";
|
|
1102
|
+
/**
|
|
1103
|
+
* Allocates a new dynamic spine in the OS neural registry (Protocole du Guichet).
|
|
1104
|
+
* Requires scope `vault:write:CUSTOM`.
|
|
1105
|
+
* The allocated spine appears in the Mnemosyne OS neural graph.
|
|
1106
|
+
*/
|
|
1107
|
+
readonly REGISTER_SPINE: "sdk.spine.register";
|
|
1108
|
+
/**
|
|
1109
|
+
* Releases a previously allocated dynamic spine.
|
|
1110
|
+
* Only the owning app can release its own spines.
|
|
1111
|
+
* Requires scope `vault:write:CUSTOM`.
|
|
1112
|
+
*/
|
|
1113
|
+
readonly RELEASE_SPINE: "sdk.spine.release";
|
|
1114
|
+
/**
|
|
1115
|
+
* Lists all currently allocated dynamic spines across all registered apps.
|
|
1116
|
+
* Returns an array of `DynamicSpineInfo` objects.
|
|
1117
|
+
*/
|
|
1118
|
+
readonly LIST_SPINES: "sdk.spine.list";
|
|
667
1119
|
};
|
|
668
1120
|
type MnemoMethod = typeof MNEMOSYNE_METHODS[keyof typeof MNEMOSYNE_METHODS];
|
|
669
1121
|
/** Port par défaut du SDK WebSocket Server */
|
|
@@ -693,4 +1145,4 @@ declare const MNEMOSYNE_CHAINS: {
|
|
|
693
1145
|
};
|
|
694
1146
|
type MnemoChain = keyof typeof MNEMOSYNE_CHAINS;
|
|
695
1147
|
|
|
696
|
-
export { type AgentInfo, type AppManifest, AppManifestSchema, type Chronicle, GRANT_REQUIRED_SCOPE_PREFIXES, type GitCommit, type GraphEdge, type GraphNode, type GraphQueryResult, type IngestPayload, type IngestResult, type JwtPayload, type JwtVerifyResult, MNEMOSYNE_CHAINS, MNEMOSYNE_METHODS, MNEMOSYNE_NFT_CACHE_TTL_MS, MNEMOSYNE_TOKEN_TTL_S, MNEMOSYNE_WS_HOST, MNEMOSYNE_WS_PORT, type MnemoChain, MnemoClient, MnemoClientBrowser, type MnemoClientOptions, type MnemoEvent, type MnemoEventType, type MnemoIntent, type MnemoMethod, type MnemoScope, type MnemoVault, type NFTLicenseParams, type NFTValidation, type QueryOptions, type QueryResult, type RegisterResult, type ShareRequest, type ShareResult, type SpineType, assertScope, assertVault, generateAppToken, generateSecret, loadManifest, parseManifest, requiresOsGrant, verifyToken };
|
|
1148
|
+
export { type AgentInfo, type AppManifest, AppManifestSchema, type BridgeHistoryOptions, type BridgeHistoryResult, type BridgeRecord, type BridgeScanSession, type Chronicle, type CorrelateOptions, type CorrelateResult, type CorrelationEntry, type DynamicSpineInfo, type DynamicSpineRequest, type DynamicSpineResult, type ForgetResult, GRANT_REQUIRED_SCOPE_PREFIXES, type GitCommit, type GitLogOptions, type GitLogResult, type GraphEdge, type GraphNode, type GraphQueryResult, type IngestPayload, type IngestResult, type JwtPayload, type JwtVerifyResult, MNEMOSYNE_CHAINS, MNEMOSYNE_METHODS, MNEMOSYNE_NFT_CACHE_TTL_MS, MNEMOSYNE_TOKEN_TTL_S, MNEMOSYNE_WS_HOST, MNEMOSYNE_WS_PORT, type MnemoChain, MnemoClient, MnemoClientBrowser, type MnemoClientOptions, type MnemoEvent, type MnemoEventType, type MnemoIntent, type MnemoMethod, type MnemoScope, type MnemoVault, type NFTLicenseParams, type NFTValidation, type PositionUpdateResult, type QueryOptions, type QueryResult, type QuerySemanticDebug, type RegisterResult, type ResonanceRecord, type ResonanceScore, type ShareRequest, type ShareResult, type SpineType, type VaultInfo, type VaultListResult, assertScope, assertVault, generateAppToken, generateSecret, loadManifest, parseManifest, requiresOsGrant, verifyToken };
|