@mnemosyne_os/sdk 1.0.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 +233 -0
- package/dist/index.cjs +530 -0
- package/dist/index.d.cts +443 -0
- package/dist/index.d.ts +443 -0
- package/dist/index.js +479 -0
- package/package.json +51 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,443 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @mnemosyne/sdk — Public Types
|
|
5
|
+
*
|
|
6
|
+
* Ce fichier est la surface publique du SDK.
|
|
7
|
+
* Toute modification ici constitue un changement de contrat API.
|
|
8
|
+
*
|
|
9
|
+
* [SDK][ZERO-TRUST][AUDIT-TRAIL]
|
|
10
|
+
*/
|
|
11
|
+
/** Scopes disponibles pour une app tierce */
|
|
12
|
+
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:COOK' | 'vault:write:COOK' | 'share:request' | 'share:grant'
|
|
13
|
+
/** Validation de licence NFT on-chain pour MnemoStore */
|
|
14
|
+
| 'nft:validate'
|
|
15
|
+
/** Accès en lecture au NeuralGraph (nœuds, arêtes, clusters) */
|
|
16
|
+
| 'neural:graph:read'
|
|
17
|
+
/** Requêtes LLM directes via le runtime Mnemosyne — scope premium */
|
|
18
|
+
| 'llm:query';
|
|
19
|
+
/** Intents IPC autorisés */
|
|
20
|
+
type MnemoIntent = 'INGEST' | 'QUERY' | 'CORRELATE' | 'FORGET';
|
|
21
|
+
/** Vault cible */
|
|
22
|
+
type MnemoVault = 'DEV' | 'SOCIAL' | 'PERSONAL' | 'FINANCE' | 'COOK';
|
|
23
|
+
/** Types de spine */
|
|
24
|
+
type SpineType = 'GIT' | 'ARCHITECTURE' | 'DECISION' | 'DEBUG' | 'FEATURE' | 'REDDIT_POST' | 'LINKEDIN_POST' | 'SOCIAL_NODE' | 'DOCUMENT' | 'NOTE' | 'CUSTOM';
|
|
25
|
+
/** Manifest de l'application — fichier `app.manifest.json` */
|
|
26
|
+
interface AppManifest {
|
|
27
|
+
/** Identifiant unique stable de l'app (snake_case recommandé) */
|
|
28
|
+
id: string;
|
|
29
|
+
/** Nom affiché à l'utilisateur */
|
|
30
|
+
name: string;
|
|
31
|
+
/** Version SemVer */
|
|
32
|
+
version: string;
|
|
33
|
+
/** Auteur ou organisation */
|
|
34
|
+
author?: string;
|
|
35
|
+
/** Version du SDK requise */
|
|
36
|
+
mnemosyne_sdk: string;
|
|
37
|
+
/** Scopes demandés — Zero-Trust : tout scope non listé est refusé */
|
|
38
|
+
scopes: MnemoScope[];
|
|
39
|
+
/** Vaults accessibles */
|
|
40
|
+
vaults: MnemoVault[];
|
|
41
|
+
/** Intents IPC autorisés */
|
|
42
|
+
intents: MnemoIntent[];
|
|
43
|
+
/** Taille maximale d'une chronicle (KB) — défaut 64KB */
|
|
44
|
+
max_chronicle_size_kb?: number;
|
|
45
|
+
/**
|
|
46
|
+
* Si true, chaque requête inter-app déclenche un popup de consentement utilisateur.
|
|
47
|
+
* Si false, le consentement est demandé une seule fois et mémorisé.
|
|
48
|
+
*/
|
|
49
|
+
requires_consent?: boolean;
|
|
50
|
+
/** Description courte affichée dans le Synaptic Hub */
|
|
51
|
+
description?: string;
|
|
52
|
+
}
|
|
53
|
+
interface MnemoClientOptions {
|
|
54
|
+
/** Identifiant de l'app — doit correspondre à AppManifest.id */
|
|
55
|
+
appId: string;
|
|
56
|
+
/** Chemin vers app.manifest.json ou objet manifest inline */
|
|
57
|
+
manifest: string | AppManifest;
|
|
58
|
+
/**
|
|
59
|
+
* Transport à utiliser :
|
|
60
|
+
* 'ws' → WebSocket local (app Node.js externe à Mnemosyne)
|
|
61
|
+
* 'ipc' → Electron IPC (app embarquée via PluginHub)
|
|
62
|
+
* 'auto' → Détecte automatiquement selon l'environnement (défaut)
|
|
63
|
+
*/
|
|
64
|
+
transport?: 'ws' | 'ipc' | 'auto';
|
|
65
|
+
/** Port du WebSocket server Mnemosyne (défaut: 7799) */
|
|
66
|
+
wsPort?: number;
|
|
67
|
+
/** Token JWT d'authentification (obtenu via MnemoClient.register) */
|
|
68
|
+
token?: string;
|
|
69
|
+
/** Timeout des requêtes en ms (défaut: 30000) */
|
|
70
|
+
timeoutMs?: number;
|
|
71
|
+
}
|
|
72
|
+
interface IngestPayload {
|
|
73
|
+
/** Contenu textuel brut à vectoriser */
|
|
74
|
+
content: string;
|
|
75
|
+
/** Type de spine sémantique */
|
|
76
|
+
spineType: SpineType;
|
|
77
|
+
/** Vault de destination */
|
|
78
|
+
vault: MnemoVault;
|
|
79
|
+
/** Métadonnées optionnelles (non vectorisées, stockées as-is) */
|
|
80
|
+
metadata?: Record<string, unknown>;
|
|
81
|
+
/** Dimension des vecteurs (défaut: 512) */
|
|
82
|
+
dimension?: number;
|
|
83
|
+
}
|
|
84
|
+
interface IngestResult {
|
|
85
|
+
success: boolean;
|
|
86
|
+
chronicleId?: string;
|
|
87
|
+
error?: string;
|
|
88
|
+
/** Si true, le contenu a été nettoyé par l'AI-Firewall (injection détectée) */
|
|
89
|
+
sanitized?: boolean;
|
|
90
|
+
}
|
|
91
|
+
interface QueryOptions {
|
|
92
|
+
/** Nombre max de résultats (défaut: 10) */
|
|
93
|
+
limit?: number;
|
|
94
|
+
/** Vault à interroger (défaut: vault déclaré dans le manifest) */
|
|
95
|
+
vault?: MnemoVault;
|
|
96
|
+
/** Seuil de similarité minimum 0-1 (défaut: 0.0) */
|
|
97
|
+
threshold?: number;
|
|
98
|
+
}
|
|
99
|
+
interface Chronicle {
|
|
100
|
+
id: string;
|
|
101
|
+
content: string;
|
|
102
|
+
spineType: SpineType;
|
|
103
|
+
score: number;
|
|
104
|
+
timestamp: string;
|
|
105
|
+
source_app_id: string;
|
|
106
|
+
}
|
|
107
|
+
interface QueryResult {
|
|
108
|
+
success: boolean;
|
|
109
|
+
chronicles: Chronicle[];
|
|
110
|
+
error?: string;
|
|
111
|
+
}
|
|
112
|
+
interface ShareRequest {
|
|
113
|
+
/** App source dont on veut lire les vecteurs */
|
|
114
|
+
fromAppId: string;
|
|
115
|
+
/** Raison affichée à l'utilisateur dans le popup de consentement */
|
|
116
|
+
reason: string;
|
|
117
|
+
/** Timeout du consentement en ms (défaut: 60000) */
|
|
118
|
+
timeoutMs?: number;
|
|
119
|
+
}
|
|
120
|
+
interface ShareResult {
|
|
121
|
+
granted: boolean;
|
|
122
|
+
chronicles?: Chronicle[];
|
|
123
|
+
error?: string;
|
|
124
|
+
}
|
|
125
|
+
interface RegisterResult {
|
|
126
|
+
token: string;
|
|
127
|
+
expiresAt: number;
|
|
128
|
+
appId: string;
|
|
129
|
+
}
|
|
130
|
+
/**
|
|
131
|
+
* Paramètres pour valider une licence NFT.
|
|
132
|
+
* La validation se fait on-chain via le runtime Mnemosyne OS (pas directement dans le SDK).
|
|
133
|
+
*/
|
|
134
|
+
interface NFTLicenseParams {
|
|
135
|
+
/** Adresse du wallet à vérifier */
|
|
136
|
+
walletAddress: string;
|
|
137
|
+
/** Chain ID cible — voir MNEMOSYNE_CHAINS dans constants.ts */
|
|
138
|
+
chainId?: number;
|
|
139
|
+
}
|
|
140
|
+
/** Résultat de validation d'une licence NFT */
|
|
141
|
+
interface NFTValidation {
|
|
142
|
+
/** true si le wallet possède le NFT de licence de cette app */
|
|
143
|
+
valid: boolean;
|
|
144
|
+
walletAddress: string;
|
|
145
|
+
appId: string;
|
|
146
|
+
/** Timestamp Unix ms de la vérification */
|
|
147
|
+
checkedAt: number;
|
|
148
|
+
/** Timestamp Unix ms d'expiration du cache OS (5 min) */
|
|
149
|
+
cacheExpiresAt?: number;
|
|
150
|
+
}
|
|
151
|
+
/** Un nœud dans le NeuralGraph */
|
|
152
|
+
interface GraphNode {
|
|
153
|
+
id: string;
|
|
154
|
+
label: string;
|
|
155
|
+
spineType: SpineType;
|
|
156
|
+
weight: number;
|
|
157
|
+
timestamp: string;
|
|
158
|
+
}
|
|
159
|
+
/** Une arête dans le NeuralGraph */
|
|
160
|
+
interface GraphEdge {
|
|
161
|
+
source: string;
|
|
162
|
+
target: string;
|
|
163
|
+
strength: number;
|
|
164
|
+
type: 'causal' | 'temporal' | 'semantic';
|
|
165
|
+
}
|
|
166
|
+
/** Résultat d'une requête sur le NeuralGraph */
|
|
167
|
+
interface GraphQueryResult {
|
|
168
|
+
success: boolean;
|
|
169
|
+
nodes: GraphNode[];
|
|
170
|
+
edges: GraphEdge[];
|
|
171
|
+
centerNodeId?: string;
|
|
172
|
+
error?: string;
|
|
173
|
+
}
|
|
174
|
+
type MnemoEventType = 'connected' | 'disconnected' | 'error' | 'tamper-alert' | 'share-request' | 'nft-revoked';
|
|
175
|
+
interface MnemoEvent<T = unknown> {
|
|
176
|
+
type: MnemoEventType;
|
|
177
|
+
data: T;
|
|
178
|
+
timestamp: number;
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @mnemosyne/sdk — JWT HMAC-SHA256 Auth
|
|
183
|
+
*
|
|
184
|
+
* Génère et valide des tokens d'authentification pour les apps SDK.
|
|
185
|
+
* Utilise `node:crypto` — zéro dépendance externe.
|
|
186
|
+
*
|
|
187
|
+
* Format : base64url(header).base64url(payload).base64url(signature)
|
|
188
|
+
* Algorithme : HMAC-SHA256 (symétrique, secret partagé OS ↔ app)
|
|
189
|
+
*
|
|
190
|
+
* [SDK][SECURITY][AUTH]
|
|
191
|
+
*/
|
|
192
|
+
interface JwtPayload {
|
|
193
|
+
sub: string;
|
|
194
|
+
iat: number;
|
|
195
|
+
exp: number;
|
|
196
|
+
scopes: string[];
|
|
197
|
+
jti: string;
|
|
198
|
+
}
|
|
199
|
+
interface JwtVerifyResult {
|
|
200
|
+
valid: boolean;
|
|
201
|
+
payload?: JwtPayload;
|
|
202
|
+
reason?: string;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Vérifie un token JWT.
|
|
206
|
+
* Utilise `timingSafeEqual` pour éviter les timing attacks.
|
|
207
|
+
*/
|
|
208
|
+
declare function verifyToken(token: string, secret: string): JwtVerifyResult;
|
|
209
|
+
/**
|
|
210
|
+
* Génère un token pour une app SDK.
|
|
211
|
+
* @param appId Identifiant de l'app
|
|
212
|
+
* @param scopes Scopes autorisés
|
|
213
|
+
* @param secret Secret HMAC (32 bytes minimum)
|
|
214
|
+
* @param ttlMs Durée de vie en ms (défaut: 24h)
|
|
215
|
+
*/
|
|
216
|
+
declare function generateAppToken(appId: string, scopes: string[], secret: string, ttlMs?: number): {
|
|
217
|
+
token: string;
|
|
218
|
+
expiresAt: number;
|
|
219
|
+
};
|
|
220
|
+
/**
|
|
221
|
+
* Génère un secret HMAC aléatoire (à stocker dans le keychain OS).
|
|
222
|
+
*/
|
|
223
|
+
declare function generateSecret(): string;
|
|
224
|
+
|
|
225
|
+
/**
|
|
226
|
+
* @mnemosyne/sdk — MnemoClient
|
|
227
|
+
*
|
|
228
|
+
* Client principal du SDK. Dual transport : WebSocket (externe) + IPC Electron (embarqué).
|
|
229
|
+
* Authentification JWT HMAC-SHA256.
|
|
230
|
+
*
|
|
231
|
+
* Usage minimal :
|
|
232
|
+
* ```typescript
|
|
233
|
+
* import { MnemoClient } from '@mnemosyne/sdk';
|
|
234
|
+
* const client = await MnemoClient.connect({ appId: 'my-app', manifest: './app.manifest.json' });
|
|
235
|
+
* await client.ingest({ content: '...', spineType: 'REDDIT_POST', vault: 'SOCIAL' });
|
|
236
|
+
* ```
|
|
237
|
+
*
|
|
238
|
+
* [SDK][ZERO-TRUST][DUAL-TRANSPORT]
|
|
239
|
+
*/
|
|
240
|
+
|
|
241
|
+
type EventHandler<T = unknown> = (event: MnemoEvent<T>) => void;
|
|
242
|
+
declare class MnemoClient {
|
|
243
|
+
private readonly manifest;
|
|
244
|
+
private readonly options;
|
|
245
|
+
private ws;
|
|
246
|
+
private token;
|
|
247
|
+
private connected;
|
|
248
|
+
private readonly pending;
|
|
249
|
+
private readonly handlers;
|
|
250
|
+
/**
|
|
251
|
+
* Crée et connecte un client Mnemosyne.
|
|
252
|
+
* @throws si le manifest est invalide ou la connexion échoue
|
|
253
|
+
*/
|
|
254
|
+
static connect(options: MnemoClientOptions): Promise<MnemoClient>;
|
|
255
|
+
private constructor();
|
|
256
|
+
private _connect;
|
|
257
|
+
private _resolveTransport;
|
|
258
|
+
private _connectWs;
|
|
259
|
+
private _connectIpc;
|
|
260
|
+
private _rpc;
|
|
261
|
+
private _rpcWs;
|
|
262
|
+
private _rpcIpc;
|
|
263
|
+
private _handleRpcResponse;
|
|
264
|
+
private _handleEvent;
|
|
265
|
+
private _register;
|
|
266
|
+
/**
|
|
267
|
+
* Renouvelle le token JWT avant expiration.
|
|
268
|
+
* Appelé automatiquement si le token expire dans moins de 5 minutes.
|
|
269
|
+
*/
|
|
270
|
+
renewToken(): Promise<void>;
|
|
271
|
+
/**
|
|
272
|
+
* Ingère du contenu dans le vault Mnemosyne.
|
|
273
|
+
* Isolé par source_app_id — seule ton app peut lire ce qu'elle écrit.
|
|
274
|
+
*/
|
|
275
|
+
ingest(payload: IngestPayload): Promise<IngestResult>;
|
|
276
|
+
/**
|
|
277
|
+
* Requête sémantique — retourne uniquement les chronicles de ton app (source_app_id isolation).
|
|
278
|
+
*/
|
|
279
|
+
query(text: string, options?: QueryOptions): Promise<QueryResult>;
|
|
280
|
+
/**
|
|
281
|
+
* Demande un accès aux chronicles d'une autre app.
|
|
282
|
+
* Déclenche un popup de consentement utilisateur dans Mnemosyne OS.
|
|
283
|
+
* Timeout : 60s par défaut (configurable).
|
|
284
|
+
*/
|
|
285
|
+
requestShare(request: ShareRequest): Promise<ShareResult>;
|
|
286
|
+
on<T = unknown>(type: MnemoEventType, handler: EventHandler<T>): () => void;
|
|
287
|
+
private _emit;
|
|
288
|
+
/**
|
|
289
|
+
* Ferme proprement la connexion.
|
|
290
|
+
* Attend la résolution de tous les RPC en cours.
|
|
291
|
+
*/
|
|
292
|
+
disconnect(): Promise<void>;
|
|
293
|
+
get isConnected(): boolean;
|
|
294
|
+
get appId(): string;
|
|
295
|
+
get appManifest(): AppManifest;
|
|
296
|
+
/** Inspecte le token actuel (décodé, sans vérification) */
|
|
297
|
+
get tokenInfo(): {
|
|
298
|
+
sub: string;
|
|
299
|
+
exp: number;
|
|
300
|
+
scopes: string[];
|
|
301
|
+
} | null;
|
|
302
|
+
}
|
|
303
|
+
|
|
304
|
+
/**
|
|
305
|
+
* @mnemosyne/sdk — AppManifest Validator
|
|
306
|
+
*
|
|
307
|
+
* Valide le fichier app.manifest.json avant toute connexion.
|
|
308
|
+
* Utilise Zod pour un parsing strict — aucun champ inconnu passé au serveur.
|
|
309
|
+
*
|
|
310
|
+
* [SDK][ZERO-TRUST][AUDIT-TRAIL]
|
|
311
|
+
*/
|
|
312
|
+
|
|
313
|
+
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:COOK", "vault:write:COOK", "share:request", "share:grant"];
|
|
314
|
+
declare const AppManifestSchema: z.ZodObject<{
|
|
315
|
+
id: z.ZodString;
|
|
316
|
+
name: z.ZodString;
|
|
317
|
+
version: z.ZodString;
|
|
318
|
+
author: z.ZodOptional<z.ZodString>;
|
|
319
|
+
mnemosyne_sdk: z.ZodString;
|
|
320
|
+
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:COOK", "vault:write:COOK", "share:request", "share:grant"]>, "many">;
|
|
321
|
+
vaults: z.ZodArray<z.ZodEnum<["DEV", "SOCIAL", "PERSONAL", "FINANCE", "COOK"]>, "many">;
|
|
322
|
+
intents: z.ZodArray<z.ZodEnum<["INGEST", "QUERY", "CORRELATE", "FORGET"]>, "many">;
|
|
323
|
+
max_chronicle_size_kb: z.ZodDefault<z.ZodOptional<z.ZodNumber>>;
|
|
324
|
+
requires_consent: z.ZodDefault<z.ZodOptional<z.ZodBoolean>>;
|
|
325
|
+
description: z.ZodOptional<z.ZodString>;
|
|
326
|
+
}, "strict", z.ZodTypeAny, {
|
|
327
|
+
id: string;
|
|
328
|
+
name: string;
|
|
329
|
+
version: string;
|
|
330
|
+
mnemosyne_sdk: string;
|
|
331
|
+
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:COOK" | "vault:write:COOK" | "share:request" | "share:grant")[];
|
|
332
|
+
vaults: ("DEV" | "SOCIAL" | "PERSONAL" | "FINANCE" | "COOK")[];
|
|
333
|
+
intents: ("INGEST" | "QUERY" | "CORRELATE" | "FORGET")[];
|
|
334
|
+
max_chronicle_size_kb: number;
|
|
335
|
+
requires_consent: boolean;
|
|
336
|
+
author?: string | undefined;
|
|
337
|
+
description?: string | undefined;
|
|
338
|
+
}, {
|
|
339
|
+
id: string;
|
|
340
|
+
name: string;
|
|
341
|
+
version: string;
|
|
342
|
+
mnemosyne_sdk: string;
|
|
343
|
+
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:COOK" | "vault:write:COOK" | "share:request" | "share:grant")[];
|
|
344
|
+
vaults: ("DEV" | "SOCIAL" | "PERSONAL" | "FINANCE" | "COOK")[];
|
|
345
|
+
intents: ("INGEST" | "QUERY" | "CORRELATE" | "FORGET")[];
|
|
346
|
+
author?: string | undefined;
|
|
347
|
+
max_chronicle_size_kb?: number | undefined;
|
|
348
|
+
requires_consent?: boolean | undefined;
|
|
349
|
+
description?: string | undefined;
|
|
350
|
+
}>;
|
|
351
|
+
/**
|
|
352
|
+
* Charge et valide un manifest depuis le filesystem.
|
|
353
|
+
* @throws {Error} si le manifest est invalide ou introuvable
|
|
354
|
+
*/
|
|
355
|
+
declare function loadManifest(pathOrManifest: string | AppManifest): AppManifest;
|
|
356
|
+
/**
|
|
357
|
+
* Parse et valide un objet manifest brut.
|
|
358
|
+
* @throws {Error} avec détail des violations Zod
|
|
359
|
+
*/
|
|
360
|
+
declare function parseManifest(raw: unknown): AppManifest;
|
|
361
|
+
/**
|
|
362
|
+
* Vérifie qu'un scope est déclaré dans le manifest.
|
|
363
|
+
* Utilisé par MnemoClient avant chaque opération.
|
|
364
|
+
*/
|
|
365
|
+
declare function assertScope(manifest: AppManifest, scope: (typeof VALID_SCOPES)[number]): void;
|
|
366
|
+
/**
|
|
367
|
+
* Vérifie qu'un vault est accessible selon le manifest.
|
|
368
|
+
*/
|
|
369
|
+
declare function assertVault(manifest: AppManifest, vault: string): void;
|
|
370
|
+
|
|
371
|
+
/**
|
|
372
|
+
* @mnemosyne_os/sdk — Public Constants
|
|
373
|
+
*
|
|
374
|
+
* Expose les méthodes RPC disponibles sur le serveur SDK (ws://localhost:7799)
|
|
375
|
+
* et les constantes de l'écosystème Mnemosyne OS.
|
|
376
|
+
*
|
|
377
|
+
* [SDK][LAYER-2][ZERO-TRUST]
|
|
378
|
+
*/
|
|
379
|
+
/**
|
|
380
|
+
* Méthodes JSON-RPC exposées par le SDK WebSocket Server de Mnemosyne OS.
|
|
381
|
+
* Le serveur écoute sur ws://127.0.0.1:7799 (localhost uniquement).
|
|
382
|
+
*
|
|
383
|
+
* @example
|
|
384
|
+
* ```typescript
|
|
385
|
+
* import { MNEMOSYNE_METHODS } from '@mnemosyne_os/sdk';
|
|
386
|
+
* // Utilisation directe (sans MnemoClient) :
|
|
387
|
+
* ws.send(JSON.stringify({ id: '1', method: MNEMOSYNE_METHODS.REGISTER, params: { manifest } }));
|
|
388
|
+
* ```
|
|
389
|
+
*/
|
|
390
|
+
declare const MNEMOSYNE_METHODS: {
|
|
391
|
+
/** Enregistre l'app, valide le manifest, retourne un JWT 24h */
|
|
392
|
+
readonly REGISTER: "sdk.register";
|
|
393
|
+
/** Ingère du contenu dans le vault (vectorisation incluse) */
|
|
394
|
+
readonly INGEST: "sdk.ingest";
|
|
395
|
+
/** Requête sémantique — résultats filtrés par source_app_id */
|
|
396
|
+
readonly QUERY: "sdk.query";
|
|
397
|
+
/** Trouve les connexions causales entre deux contenus */
|
|
398
|
+
readonly CORRELATE: "sdk.correlate";
|
|
399
|
+
/** Supprime un chronicle par ID (scope vault:write requis) */
|
|
400
|
+
readonly FORGET: "sdk.forget";
|
|
401
|
+
/** Demande d'accès aux chronicles d'une autre app (popup consentement) */
|
|
402
|
+
readonly SHARE: "sdk.share";
|
|
403
|
+
/**
|
|
404
|
+
* Vérifie qu'un wallet possède le NFT de licence de cette app.
|
|
405
|
+
* Requiert le scope `nft:validate` dans le manifest.
|
|
406
|
+
* Cache TTL 5 min côté OS pour ne pas spam la blockchain.
|
|
407
|
+
*/
|
|
408
|
+
readonly NFT_VALIDATE: "sdk.nft.validate";
|
|
409
|
+
/**
|
|
410
|
+
* Requête le NeuralGraph — retourne les nœuds et arêtes proches du texte.
|
|
411
|
+
* Requiert le scope `neural:graph:read` dans le manifest.
|
|
412
|
+
*/
|
|
413
|
+
readonly GRAPH_QUERY: "sdk.graph.query";
|
|
414
|
+
};
|
|
415
|
+
type MnemoMethod = typeof MNEMOSYNE_METHODS[keyof typeof MNEMOSYNE_METHODS];
|
|
416
|
+
/** Port par défaut du SDK WebSocket Server */
|
|
417
|
+
declare const MNEMOSYNE_WS_PORT = 7799;
|
|
418
|
+
/** Host du SDK WebSocket Server (localhost uniquement — sécurité Zero-Trust) */
|
|
419
|
+
declare const MNEMOSYNE_WS_HOST = "127.0.0.1";
|
|
420
|
+
/** Durée de validité d'un JWT SDK (en secondes) */
|
|
421
|
+
declare const MNEMOSYNE_TOKEN_TTL_S: number;
|
|
422
|
+
/** Durée du cache de validation NFT côté OS (en ms) */
|
|
423
|
+
declare const MNEMOSYNE_NFT_CACHE_TTL_MS: number;
|
|
424
|
+
declare const MNEMOSYNE_CHAINS: {
|
|
425
|
+
readonly BASE: {
|
|
426
|
+
readonly id: 8453;
|
|
427
|
+
readonly name: "Base";
|
|
428
|
+
readonly rpc: "https://mainnet.base.org";
|
|
429
|
+
};
|
|
430
|
+
readonly POLYGON: {
|
|
431
|
+
readonly id: 137;
|
|
432
|
+
readonly name: "Polygon";
|
|
433
|
+
readonly rpc: "https://polygon-rpc.com";
|
|
434
|
+
};
|
|
435
|
+
readonly BASE_SEPOLIA: {
|
|
436
|
+
readonly id: 84532;
|
|
437
|
+
readonly name: "Base Sepolia (testnet)";
|
|
438
|
+
readonly rpc: "https://sepolia.base.org";
|
|
439
|
+
};
|
|
440
|
+
};
|
|
441
|
+
type MnemoChain = keyof typeof MNEMOSYNE_CHAINS;
|
|
442
|
+
|
|
443
|
+
export { type AppManifest, AppManifestSchema, type Chronicle, 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, 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, verifyToken };
|