@lanonasis/memory-client 1.0.0 → 2.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/dist/core/index.d.ts +421 -0
- package/dist/core/index.js +490 -0
- package/dist/core/index.js.map +1 -0
- package/dist/index.d.ts +159 -395
- package/dist/index.esm.js +321 -737
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +329 -744
- package/dist/index.js.map +1 -1
- package/dist/node/index.d.ts +301 -0
- package/dist/node/index.js +610 -0
- package/dist/node/index.js.map +1 -0
- package/dist/presets/index.d.ts +146 -0
- package/dist/presets/index.js +234 -0
- package/dist/presets/index.js.map +1 -0
- package/dist/react/index.d.ts +213 -0
- package/dist/react/index.js +348 -0
- package/dist/react/index.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/vue/index.d.ts +211 -0
- package/dist/vue/index.js +356 -0
- package/dist/vue/index.js.map +1 -0
- package/package.json +76 -22
package/dist/index.d.ts
CHANGED
|
@@ -70,108 +70,71 @@ declare const createMemorySchema: z.ZodObject<{
|
|
|
70
70
|
title: z.ZodString;
|
|
71
71
|
content: z.ZodString;
|
|
72
72
|
summary: z.ZodOptional<z.ZodString>;
|
|
73
|
-
memory_type: z.ZodDefault<z.ZodEnum<
|
|
73
|
+
memory_type: z.ZodDefault<z.ZodEnum<{
|
|
74
|
+
context: "context";
|
|
75
|
+
project: "project";
|
|
76
|
+
knowledge: "knowledge";
|
|
77
|
+
reference: "reference";
|
|
78
|
+
personal: "personal";
|
|
79
|
+
workflow: "workflow";
|
|
80
|
+
}>>;
|
|
74
81
|
topic_id: z.ZodOptional<z.ZodString>;
|
|
75
82
|
project_ref: z.ZodOptional<z.ZodString>;
|
|
76
|
-
tags: z.ZodDefault<z.ZodArray<z.ZodString
|
|
83
|
+
tags: z.ZodDefault<z.ZodArray<z.ZodString>>;
|
|
77
84
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
78
|
-
},
|
|
79
|
-
title: string;
|
|
80
|
-
content: string;
|
|
81
|
-
memory_type: "context" | "project" | "knowledge" | "reference" | "personal" | "workflow";
|
|
82
|
-
tags: string[];
|
|
83
|
-
summary?: string | undefined;
|
|
84
|
-
topic_id?: string | undefined;
|
|
85
|
-
project_ref?: string | undefined;
|
|
86
|
-
metadata?: Record<string, unknown> | undefined;
|
|
87
|
-
}, {
|
|
88
|
-
title: string;
|
|
89
|
-
content: string;
|
|
90
|
-
summary?: string | undefined;
|
|
91
|
-
memory_type?: "context" | "project" | "knowledge" | "reference" | "personal" | "workflow" | undefined;
|
|
92
|
-
topic_id?: string | undefined;
|
|
93
|
-
project_ref?: string | undefined;
|
|
94
|
-
tags?: string[] | undefined;
|
|
95
|
-
metadata?: Record<string, unknown> | undefined;
|
|
96
|
-
}>;
|
|
85
|
+
}, z.core.$strip>;
|
|
97
86
|
declare const updateMemorySchema: z.ZodObject<{
|
|
98
87
|
title: z.ZodOptional<z.ZodString>;
|
|
99
88
|
content: z.ZodOptional<z.ZodString>;
|
|
100
89
|
summary: z.ZodOptional<z.ZodString>;
|
|
101
|
-
memory_type: z.ZodOptional<z.ZodEnum<
|
|
102
|
-
|
|
90
|
+
memory_type: z.ZodOptional<z.ZodEnum<{
|
|
91
|
+
context: "context";
|
|
92
|
+
project: "project";
|
|
93
|
+
knowledge: "knowledge";
|
|
94
|
+
reference: "reference";
|
|
95
|
+
personal: "personal";
|
|
96
|
+
workflow: "workflow";
|
|
97
|
+
}>>;
|
|
98
|
+
status: z.ZodOptional<z.ZodEnum<{
|
|
99
|
+
active: "active";
|
|
100
|
+
archived: "archived";
|
|
101
|
+
draft: "draft";
|
|
102
|
+
deleted: "deleted";
|
|
103
|
+
}>>;
|
|
103
104
|
topic_id: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
104
105
|
project_ref: z.ZodOptional<z.ZodNullable<z.ZodString>>;
|
|
105
|
-
tags: z.ZodOptional<z.ZodArray<z.ZodString
|
|
106
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
106
107
|
metadata: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
|
|
107
|
-
},
|
|
108
|
-
title?: string | undefined;
|
|
109
|
-
content?: string | undefined;
|
|
110
|
-
summary?: string | undefined;
|
|
111
|
-
memory_type?: "context" | "project" | "knowledge" | "reference" | "personal" | "workflow" | undefined;
|
|
112
|
-
topic_id?: string | null | undefined;
|
|
113
|
-
project_ref?: string | null | undefined;
|
|
114
|
-
status?: "active" | "archived" | "draft" | "deleted" | undefined;
|
|
115
|
-
tags?: string[] | undefined;
|
|
116
|
-
metadata?: Record<string, unknown> | undefined;
|
|
117
|
-
}, {
|
|
118
|
-
title?: string | undefined;
|
|
119
|
-
content?: string | undefined;
|
|
120
|
-
summary?: string | undefined;
|
|
121
|
-
memory_type?: "context" | "project" | "knowledge" | "reference" | "personal" | "workflow" | undefined;
|
|
122
|
-
topic_id?: string | null | undefined;
|
|
123
|
-
project_ref?: string | null | undefined;
|
|
124
|
-
status?: "active" | "archived" | "draft" | "deleted" | undefined;
|
|
125
|
-
tags?: string[] | undefined;
|
|
126
|
-
metadata?: Record<string, unknown> | undefined;
|
|
127
|
-
}>;
|
|
108
|
+
}, z.core.$strip>;
|
|
128
109
|
declare const searchMemorySchema: z.ZodObject<{
|
|
129
110
|
query: z.ZodString;
|
|
130
|
-
memory_types: z.ZodOptional<z.ZodArray<z.ZodEnum<
|
|
131
|
-
|
|
111
|
+
memory_types: z.ZodOptional<z.ZodArray<z.ZodEnum<{
|
|
112
|
+
context: "context";
|
|
113
|
+
project: "project";
|
|
114
|
+
knowledge: "knowledge";
|
|
115
|
+
reference: "reference";
|
|
116
|
+
personal: "personal";
|
|
117
|
+
workflow: "workflow";
|
|
118
|
+
}>>>;
|
|
119
|
+
tags: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
132
120
|
topic_id: z.ZodOptional<z.ZodString>;
|
|
133
121
|
project_ref: z.ZodOptional<z.ZodString>;
|
|
134
|
-
status: z.ZodDefault<z.ZodEnum<
|
|
122
|
+
status: z.ZodDefault<z.ZodEnum<{
|
|
123
|
+
active: "active";
|
|
124
|
+
archived: "archived";
|
|
125
|
+
draft: "draft";
|
|
126
|
+
deleted: "deleted";
|
|
127
|
+
}>>;
|
|
135
128
|
limit: z.ZodDefault<z.ZodNumber>;
|
|
136
129
|
threshold: z.ZodDefault<z.ZodNumber>;
|
|
137
|
-
},
|
|
138
|
-
status: "active" | "archived" | "draft" | "deleted";
|
|
139
|
-
query: string;
|
|
140
|
-
limit: number;
|
|
141
|
-
threshold: number;
|
|
142
|
-
topic_id?: string | undefined;
|
|
143
|
-
project_ref?: string | undefined;
|
|
144
|
-
tags?: string[] | undefined;
|
|
145
|
-
memory_types?: ("context" | "project" | "knowledge" | "reference" | "personal" | "workflow")[] | undefined;
|
|
146
|
-
}, {
|
|
147
|
-
query: string;
|
|
148
|
-
topic_id?: string | undefined;
|
|
149
|
-
project_ref?: string | undefined;
|
|
150
|
-
status?: "active" | "archived" | "draft" | "deleted" | undefined;
|
|
151
|
-
tags?: string[] | undefined;
|
|
152
|
-
memory_types?: ("context" | "project" | "knowledge" | "reference" | "personal" | "workflow")[] | undefined;
|
|
153
|
-
limit?: number | undefined;
|
|
154
|
-
threshold?: number | undefined;
|
|
155
|
-
}>;
|
|
130
|
+
}, z.core.$strip>;
|
|
156
131
|
declare const createTopicSchema: z.ZodObject<{
|
|
157
132
|
name: z.ZodString;
|
|
158
133
|
description: z.ZodOptional<z.ZodString>;
|
|
159
134
|
color: z.ZodOptional<z.ZodString>;
|
|
160
135
|
icon: z.ZodOptional<z.ZodString>;
|
|
161
136
|
parent_topic_id: z.ZodOptional<z.ZodString>;
|
|
162
|
-
},
|
|
163
|
-
name: string;
|
|
164
|
-
description?: string | undefined;
|
|
165
|
-
color?: string | undefined;
|
|
166
|
-
icon?: string | undefined;
|
|
167
|
-
parent_topic_id?: string | undefined;
|
|
168
|
-
}, {
|
|
169
|
-
name: string;
|
|
170
|
-
description?: string | undefined;
|
|
171
|
-
color?: string | undefined;
|
|
172
|
-
icon?: string | undefined;
|
|
173
|
-
parent_topic_id?: string | undefined;
|
|
174
|
-
}>;
|
|
137
|
+
}, z.core.$strip>;
|
|
175
138
|
/**
|
|
176
139
|
* Inferred types from schemas
|
|
177
140
|
*/
|
|
@@ -180,22 +143,50 @@ type UpdateMemoryRequest = z.infer<typeof updateMemorySchema>;
|
|
|
180
143
|
type SearchMemoryRequest = z.infer<typeof searchMemorySchema>;
|
|
181
144
|
type CreateTopicRequest = z.infer<typeof createTopicSchema>;
|
|
182
145
|
|
|
146
|
+
/**
|
|
147
|
+
* Core Memory Client - Pure Browser-Safe Implementation
|
|
148
|
+
*
|
|
149
|
+
* NO Node.js dependencies, NO CLI code, NO child_process
|
|
150
|
+
* Works in: Browser, React Native, Cloudflare Workers, Edge Functions, Deno, Bun
|
|
151
|
+
*
|
|
152
|
+
* Bundle size: ~15KB gzipped
|
|
153
|
+
*/
|
|
154
|
+
|
|
183
155
|
/**
|
|
184
156
|
* Configuration options for the Memory Client
|
|
185
157
|
*/
|
|
186
|
-
interface
|
|
158
|
+
interface CoreMemoryClientConfig {
|
|
187
159
|
/** API endpoint URL */
|
|
188
160
|
apiUrl: string;
|
|
189
161
|
/** API key for authentication */
|
|
190
162
|
apiKey?: string;
|
|
191
163
|
/** Bearer token for authentication (alternative to API key) */
|
|
192
164
|
authToken?: string;
|
|
193
|
-
/**
|
|
165
|
+
/** Organization ID (optional - will be auto-resolved if not provided) */
|
|
166
|
+
organizationId?: string;
|
|
167
|
+
/** User ID (optional - used as fallback for organization ID) */
|
|
168
|
+
userId?: string;
|
|
169
|
+
/** Request timeout in milliseconds (default: 30000) */
|
|
194
170
|
timeout?: number;
|
|
195
|
-
/** Enable gateway mode for enhanced performance */
|
|
196
|
-
useGateway?: boolean;
|
|
197
171
|
/** Custom headers to include with requests */
|
|
198
172
|
headers?: Record<string, string>;
|
|
173
|
+
/** Retry configuration */
|
|
174
|
+
retry?: {
|
|
175
|
+
maxRetries?: number;
|
|
176
|
+
retryDelay?: number;
|
|
177
|
+
backoff?: 'linear' | 'exponential';
|
|
178
|
+
};
|
|
179
|
+
/** Cache configuration (browser only) */
|
|
180
|
+
cache?: {
|
|
181
|
+
enabled?: boolean;
|
|
182
|
+
ttl?: number;
|
|
183
|
+
};
|
|
184
|
+
/** Called when an error occurs */
|
|
185
|
+
onError?: (error: ApiError$1) => void;
|
|
186
|
+
/** Called before each request */
|
|
187
|
+
onRequest?: (endpoint: string) => void;
|
|
188
|
+
/** Called after each response */
|
|
189
|
+
onResponse?: (endpoint: string, duration: number) => void;
|
|
199
190
|
}
|
|
200
191
|
/**
|
|
201
192
|
* Standard API response wrapper
|
|
@@ -205,6 +196,15 @@ interface ApiResponse<T> {
|
|
|
205
196
|
error?: string;
|
|
206
197
|
message?: string;
|
|
207
198
|
}
|
|
199
|
+
/**
|
|
200
|
+
* API error with details
|
|
201
|
+
*/
|
|
202
|
+
interface ApiError$1 {
|
|
203
|
+
message: string;
|
|
204
|
+
code?: string;
|
|
205
|
+
statusCode?: number;
|
|
206
|
+
details?: unknown;
|
|
207
|
+
}
|
|
208
208
|
/**
|
|
209
209
|
* Paginated response for list operations
|
|
210
210
|
*/
|
|
@@ -218,12 +218,20 @@ interface PaginatedResponse<T> {
|
|
|
218
218
|
};
|
|
219
219
|
}
|
|
220
220
|
/**
|
|
221
|
-
* Memory Client class for interacting with the Memory as a Service API
|
|
221
|
+
* Core Memory Client class for interacting with the Memory as a Service API
|
|
222
|
+
*
|
|
223
|
+
* This is a pure browser-safe client with zero Node.js dependencies.
|
|
224
|
+
* It uses only standard web APIs (fetch, AbortController, etc.)
|
|
222
225
|
*/
|
|
223
|
-
declare class
|
|
226
|
+
declare class CoreMemoryClient {
|
|
224
227
|
private config;
|
|
225
228
|
private baseHeaders;
|
|
226
|
-
constructor(config:
|
|
229
|
+
constructor(config: CoreMemoryClientConfig);
|
|
230
|
+
/**
|
|
231
|
+
* Enrich request body with organization context if configured
|
|
232
|
+
* This ensures the API has the organization_id even if not in auth token
|
|
233
|
+
*/
|
|
234
|
+
private enrichWithOrgContext;
|
|
227
235
|
/**
|
|
228
236
|
* Make an HTTP request to the API
|
|
229
237
|
*/
|
|
@@ -319,341 +327,100 @@ declare class MemoryClient {
|
|
|
319
327
|
/**
|
|
320
328
|
* Update configuration
|
|
321
329
|
*/
|
|
322
|
-
updateConfig(updates: Partial<
|
|
330
|
+
updateConfig(updates: Partial<CoreMemoryClientConfig>): void;
|
|
323
331
|
/**
|
|
324
332
|
* Get current configuration (excluding sensitive data)
|
|
325
333
|
*/
|
|
326
|
-
getConfig(): Omit<
|
|
334
|
+
getConfig(): Omit<CoreMemoryClientConfig, 'apiKey' | 'authToken'>;
|
|
327
335
|
}
|
|
328
336
|
/**
|
|
329
|
-
* Factory function to create a new Memory Client instance
|
|
337
|
+
* Factory function to create a new Core Memory Client instance
|
|
330
338
|
*/
|
|
331
|
-
declare function createMemoryClient(config:
|
|
339
|
+
declare function createMemoryClient(config: CoreMemoryClientConfig): CoreMemoryClient;
|
|
332
340
|
|
|
333
341
|
/**
|
|
334
|
-
*
|
|
335
|
-
*
|
|
336
|
-
* Provides intelligent CLI detection and MCP channel utilization
|
|
337
|
-
* when @lanonasis/cli v1.5.2+ is available in the environment
|
|
342
|
+
* Error handling for Memory Client
|
|
343
|
+
* Browser-safe, no Node.js dependencies
|
|
338
344
|
*/
|
|
339
|
-
|
|
340
|
-
interface CLIInfo {
|
|
341
|
-
available: boolean;
|
|
342
|
-
version?: string;
|
|
343
|
-
mcpAvailable?: boolean;
|
|
344
|
-
authenticated?: boolean;
|
|
345
|
-
}
|
|
346
|
-
interface CLIExecutionOptions {
|
|
347
|
-
timeout?: number;
|
|
348
|
-
verbose?: boolean;
|
|
349
|
-
outputFormat?: 'json' | 'table' | 'yaml';
|
|
350
|
-
}
|
|
351
|
-
interface CLICommand {
|
|
352
|
-
command: string;
|
|
353
|
-
args: string[];
|
|
354
|
-
options?: CLIExecutionOptions;
|
|
355
|
-
}
|
|
356
|
-
interface MCPChannel {
|
|
357
|
-
available: boolean;
|
|
358
|
-
version?: string;
|
|
359
|
-
capabilities?: string[];
|
|
360
|
-
}
|
|
361
|
-
interface CLICapabilities {
|
|
362
|
-
cliAvailable: boolean;
|
|
363
|
-
mcpSupport: boolean;
|
|
364
|
-
authenticated: boolean;
|
|
365
|
-
goldenContract: boolean;
|
|
366
|
-
version?: string;
|
|
367
|
-
}
|
|
368
|
-
type RoutingStrategy = 'cli-first' | 'api-first' | 'cli-only' | 'api-only' | 'auto';
|
|
369
345
|
/**
|
|
370
|
-
*
|
|
346
|
+
* Base error class for Memory Client errors
|
|
371
347
|
*/
|
|
372
|
-
declare class
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
*/
|
|
378
|
-
detectCLI(): Promise<CLIInfo>;
|
|
379
|
-
private performDetection;
|
|
380
|
-
/**
|
|
381
|
-
* Execute CLI command and return parsed JSON result
|
|
382
|
-
*/
|
|
383
|
-
executeCLICommand<T = any>(command: string, options?: CLIExecutionOptions): Promise<ApiResponse<T>>;
|
|
384
|
-
/**
|
|
385
|
-
* Get preferred CLI command (onasis for Golden Contract, fallback to lanonasis)
|
|
386
|
-
*/
|
|
387
|
-
private getPreferredCLICommand;
|
|
388
|
-
/**
|
|
389
|
-
* Memory operations via CLI
|
|
390
|
-
*/
|
|
391
|
-
createMemoryViaCLI(title: string, content: string, options?: {
|
|
392
|
-
memoryType?: string;
|
|
393
|
-
tags?: string[];
|
|
394
|
-
topicId?: string;
|
|
395
|
-
}): Promise<ApiResponse<any>>;
|
|
396
|
-
listMemoriesViaCLI(options?: {
|
|
397
|
-
limit?: number;
|
|
398
|
-
memoryType?: string;
|
|
399
|
-
tags?: string[];
|
|
400
|
-
sortBy?: string;
|
|
401
|
-
}): Promise<ApiResponse<any>>;
|
|
402
|
-
searchMemoriesViaCLI(query: string, options?: {
|
|
403
|
-
limit?: number;
|
|
404
|
-
memoryTypes?: string[];
|
|
405
|
-
}): Promise<ApiResponse<any>>;
|
|
406
|
-
/**
|
|
407
|
-
* Health check via CLI
|
|
408
|
-
*/
|
|
409
|
-
healthCheckViaCLI(): Promise<ApiResponse<any>>;
|
|
410
|
-
/**
|
|
411
|
-
* MCP-specific operations
|
|
412
|
-
*/
|
|
413
|
-
getMCPStatus(): Promise<ApiResponse<any>>;
|
|
414
|
-
listMCPTools(): Promise<ApiResponse<any>>;
|
|
415
|
-
/**
|
|
416
|
-
* Authentication operations
|
|
417
|
-
*/
|
|
418
|
-
getAuthStatus(): Promise<ApiResponse<any>>;
|
|
419
|
-
/**
|
|
420
|
-
* Check if specific CLI features are available
|
|
421
|
-
*/
|
|
422
|
-
getCapabilities(): Promise<{
|
|
423
|
-
cliAvailable: boolean;
|
|
424
|
-
version?: string;
|
|
425
|
-
mcpSupport: boolean;
|
|
426
|
-
authenticated: boolean;
|
|
427
|
-
goldenContract: boolean;
|
|
428
|
-
}>;
|
|
429
|
-
private isGoldenContractCompliant;
|
|
430
|
-
/**
|
|
431
|
-
* Force refresh CLI detection
|
|
432
|
-
*/
|
|
433
|
-
refresh(): Promise<CLIInfo>;
|
|
434
|
-
/**
|
|
435
|
-
* Get cached CLI info without re-detection
|
|
436
|
-
*/
|
|
437
|
-
getCachedInfo(): CLIInfo | null;
|
|
348
|
+
declare class MemoryClientError extends Error {
|
|
349
|
+
code?: string | undefined;
|
|
350
|
+
statusCode?: number | undefined;
|
|
351
|
+
details?: unknown | undefined;
|
|
352
|
+
constructor(message: string, code?: string | undefined, statusCode?: number | undefined, details?: unknown | undefined);
|
|
438
353
|
}
|
|
439
|
-
|
|
440
354
|
/**
|
|
441
|
-
*
|
|
442
|
-
*
|
|
443
|
-
* Intelligently routes requests through CLI v1.5.2+ when available,
|
|
444
|
-
* with fallback to direct API for maximum compatibility and performance
|
|
355
|
+
* Network/API error
|
|
445
356
|
*/
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
/** Prefer CLI when available (default: true) */
|
|
449
|
-
preferCLI?: boolean;
|
|
450
|
-
/** Enable MCP channels when available (default: true) */
|
|
451
|
-
enableMCP?: boolean;
|
|
452
|
-
/** CLI detection timeout in ms (default: 5000) */
|
|
453
|
-
cliDetectionTimeout?: number;
|
|
454
|
-
/** Fallback to direct API on CLI failure (default: true) */
|
|
455
|
-
fallbackToAPI?: boolean;
|
|
456
|
-
/** Minimum CLI version required for Golden Contract compliance (default: 1.5.2) */
|
|
457
|
-
minCLIVersion?: string;
|
|
458
|
-
/** Enable verbose logging for troubleshooting (default: false) */
|
|
459
|
-
verbose?: boolean;
|
|
460
|
-
}
|
|
461
|
-
interface OperationResult<T> {
|
|
462
|
-
data?: T;
|
|
463
|
-
error?: string;
|
|
464
|
-
source: 'cli' | 'api';
|
|
465
|
-
mcpUsed?: boolean;
|
|
357
|
+
declare class ApiError extends MemoryClientError {
|
|
358
|
+
constructor(message: string, statusCode?: number, details?: unknown);
|
|
466
359
|
}
|
|
467
360
|
/**
|
|
468
|
-
*
|
|
361
|
+
* Authentication error
|
|
469
362
|
*/
|
|
470
|
-
declare class
|
|
471
|
-
|
|
472
|
-
private cliIntegration;
|
|
473
|
-
private config;
|
|
474
|
-
private capabilities;
|
|
475
|
-
private createDefaultCapabilities;
|
|
476
|
-
constructor(config: EnhancedMemoryClientConfig);
|
|
477
|
-
/**
|
|
478
|
-
* Initialize the client and detect capabilities
|
|
479
|
-
*/
|
|
480
|
-
initialize(): Promise<void>;
|
|
481
|
-
/**
|
|
482
|
-
* Get current capabilities
|
|
483
|
-
*/
|
|
484
|
-
getCapabilities(): Promise<Awaited<ReturnType<CLIIntegration['getCapabilities']>>>;
|
|
485
|
-
/**
|
|
486
|
-
* Determine if operation should use CLI
|
|
487
|
-
*/
|
|
488
|
-
private shouldUseCLI;
|
|
489
|
-
/**
|
|
490
|
-
* Execute operation with intelligent routing
|
|
491
|
-
*/
|
|
492
|
-
private executeOperation;
|
|
493
|
-
/**
|
|
494
|
-
* Health check with intelligent routing
|
|
495
|
-
*/
|
|
496
|
-
healthCheck(): Promise<OperationResult<{
|
|
497
|
-
status: string;
|
|
498
|
-
timestamp: string;
|
|
499
|
-
}>>;
|
|
500
|
-
/**
|
|
501
|
-
* Create memory with CLI/API routing
|
|
502
|
-
*/
|
|
503
|
-
createMemory(memory: CreateMemoryRequest): Promise<OperationResult<MemoryEntry>>;
|
|
504
|
-
/**
|
|
505
|
-
* List memories with intelligent routing
|
|
506
|
-
*/
|
|
507
|
-
listMemories(options?: {
|
|
508
|
-
page?: number;
|
|
509
|
-
limit?: number;
|
|
510
|
-
memory_type?: string;
|
|
511
|
-
topic_id?: string;
|
|
512
|
-
project_ref?: string;
|
|
513
|
-
status?: string;
|
|
514
|
-
tags?: string[];
|
|
515
|
-
sort?: string;
|
|
516
|
-
order?: 'asc' | 'desc';
|
|
517
|
-
}): Promise<OperationResult<any>>;
|
|
518
|
-
/**
|
|
519
|
-
* Search memories with MCP enhancement when available
|
|
520
|
-
*/
|
|
521
|
-
searchMemories(request: SearchMemoryRequest): Promise<OperationResult<{
|
|
522
|
-
results: MemorySearchResult[];
|
|
523
|
-
total_results: number;
|
|
524
|
-
search_time_ms: number;
|
|
525
|
-
}>>;
|
|
526
|
-
/**
|
|
527
|
-
* Get memory by ID (API only for now)
|
|
528
|
-
*/
|
|
529
|
-
getMemory(id: string): Promise<OperationResult<MemoryEntry>>;
|
|
530
|
-
/**
|
|
531
|
-
* Update memory (API only for now)
|
|
532
|
-
*/
|
|
533
|
-
updateMemory(id: string, updates: UpdateMemoryRequest): Promise<OperationResult<MemoryEntry>>;
|
|
534
|
-
/**
|
|
535
|
-
* Delete memory (API only for now)
|
|
536
|
-
*/
|
|
537
|
-
deleteMemory(id: string): Promise<OperationResult<void>>;
|
|
538
|
-
createTopic(topic: any): Promise<OperationResult<MemoryTopic>>;
|
|
539
|
-
getTopics(): Promise<OperationResult<MemoryTopic[]>>;
|
|
540
|
-
getTopic(id: string): Promise<OperationResult<MemoryTopic>>;
|
|
541
|
-
updateTopic(id: string, updates: any): Promise<OperationResult<MemoryTopic>>;
|
|
542
|
-
deleteTopic(id: string): Promise<OperationResult<void>>;
|
|
543
|
-
/**
|
|
544
|
-
* Get memory statistics
|
|
545
|
-
*/
|
|
546
|
-
getMemoryStats(): Promise<OperationResult<UserMemoryStats>>;
|
|
547
|
-
/**
|
|
548
|
-
* Force CLI re-detection
|
|
549
|
-
*/
|
|
550
|
-
refreshCLIDetection(): Promise<void>;
|
|
551
|
-
/**
|
|
552
|
-
* Get authentication status from CLI
|
|
553
|
-
*/
|
|
554
|
-
getAuthStatus(): Promise<OperationResult<any>>;
|
|
555
|
-
/**
|
|
556
|
-
* Get MCP status when available
|
|
557
|
-
*/
|
|
558
|
-
getMCPStatus(): Promise<OperationResult<any>>;
|
|
559
|
-
/**
|
|
560
|
-
* Update authentication for both CLI and API client
|
|
561
|
-
*/
|
|
562
|
-
setAuthToken(token: string): void;
|
|
563
|
-
setApiKey(apiKey: string): void;
|
|
564
|
-
clearAuth(): void;
|
|
565
|
-
/**
|
|
566
|
-
* Update configuration
|
|
567
|
-
*/
|
|
568
|
-
updateConfig(updates: Partial<EnhancedMemoryClientConfig>): void;
|
|
569
|
-
/**
|
|
570
|
-
* Get configuration summary
|
|
571
|
-
*/
|
|
572
|
-
getConfigSummary(): {
|
|
573
|
-
apiUrl: string;
|
|
574
|
-
preferCLI: boolean;
|
|
575
|
-
enableMCP: boolean;
|
|
576
|
-
capabilities?: Awaited<ReturnType<CLIIntegration['getCapabilities']>>;
|
|
577
|
-
};
|
|
363
|
+
declare class AuthenticationError extends MemoryClientError {
|
|
364
|
+
constructor(message?: string);
|
|
578
365
|
}
|
|
579
366
|
/**
|
|
580
|
-
*
|
|
367
|
+
* Validation error
|
|
581
368
|
*/
|
|
582
|
-
declare
|
|
583
|
-
|
|
584
|
-
/**
|
|
585
|
-
* Configuration utilities for Memory Client SDK
|
|
586
|
-
* Provides smart defaults and environment detection for CLI/MCP integration
|
|
587
|
-
*/
|
|
588
|
-
|
|
589
|
-
interface SmartConfigOptions {
|
|
590
|
-
/** Prefer CLI integration when available (default: true in Node.js environments) */
|
|
591
|
-
preferCLI?: boolean;
|
|
592
|
-
/** Minimum CLI version required for Golden Contract compliance (default: 1.5.2) */
|
|
593
|
-
minCLIVersion?: string;
|
|
594
|
-
/** Enable MCP channel detection (default: true) */
|
|
595
|
-
enableMCP?: boolean;
|
|
596
|
-
/** API fallback configuration */
|
|
597
|
-
apiConfig?: Partial<MemoryClientConfig>;
|
|
598
|
-
/** Timeout for CLI detection in milliseconds (default: 3000) */
|
|
599
|
-
cliDetectionTimeout?: number;
|
|
600
|
-
/** Enable verbose logging for troubleshooting (default: false) */
|
|
601
|
-
verbose?: boolean;
|
|
369
|
+
declare class ValidationError extends MemoryClientError {
|
|
370
|
+
constructor(message: string, details?: unknown);
|
|
602
371
|
}
|
|
603
372
|
/**
|
|
604
|
-
*
|
|
373
|
+
* Timeout error
|
|
605
374
|
*/
|
|
606
|
-
declare
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
isVSCode: boolean;
|
|
610
|
-
isCursor: boolean;
|
|
611
|
-
isWindsurf: boolean;
|
|
612
|
-
readonly isIDE: boolean;
|
|
613
|
-
readonly supportsCLI: boolean;
|
|
614
|
-
};
|
|
615
|
-
/**
|
|
616
|
-
* Create smart configuration with environment-aware defaults
|
|
617
|
-
*/
|
|
618
|
-
declare function createSmartConfig(baseConfig: Partial<MemoryClientConfig>, options?: SmartConfigOptions): EnhancedMemoryClientConfig;
|
|
375
|
+
declare class TimeoutError extends MemoryClientError {
|
|
376
|
+
constructor(message?: string);
|
|
377
|
+
}
|
|
619
378
|
/**
|
|
620
|
-
*
|
|
379
|
+
* Rate limit error
|
|
621
380
|
*/
|
|
622
|
-
declare
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
*/
|
|
626
|
-
development: (apiKey?: string) => EnhancedMemoryClientConfig;
|
|
627
|
-
/**
|
|
628
|
-
* Production configuration optimized for performance
|
|
629
|
-
*/
|
|
630
|
-
production: (apiKey?: string) => EnhancedMemoryClientConfig;
|
|
631
|
-
/**
|
|
632
|
-
* IDE extension configuration with MCP prioritization
|
|
633
|
-
*/
|
|
634
|
-
ideExtension: (apiKey?: string) => EnhancedMemoryClientConfig;
|
|
635
|
-
/**
|
|
636
|
-
* Browser-only configuration (no CLI support)
|
|
637
|
-
*/
|
|
638
|
-
browserOnly: (apiKey?: string) => EnhancedMemoryClientConfig;
|
|
639
|
-
/**
|
|
640
|
-
* CLI-first configuration for server environments
|
|
641
|
-
*/
|
|
642
|
-
serverCLI: (apiKey?: string) => EnhancedMemoryClientConfig;
|
|
643
|
-
};
|
|
381
|
+
declare class RateLimitError extends MemoryClientError {
|
|
382
|
+
constructor(message?: string);
|
|
383
|
+
}
|
|
644
384
|
/**
|
|
645
|
-
*
|
|
385
|
+
* Not found error
|
|
646
386
|
*/
|
|
647
|
-
declare
|
|
387
|
+
declare class NotFoundError extends MemoryClientError {
|
|
388
|
+
constructor(resource: string);
|
|
389
|
+
}
|
|
648
390
|
|
|
649
391
|
/**
|
|
650
392
|
* @lanonasis/memory-client
|
|
651
393
|
*
|
|
652
|
-
* Memory as a Service (MaaS) Client SDK for Lanonasis
|
|
394
|
+
* Universal Memory as a Service (MaaS) Client SDK for Lanonasis
|
|
653
395
|
* Intelligent memory management with semantic search capabilities
|
|
396
|
+
*
|
|
397
|
+
* v2.0.0 - Universal SDK Redesign
|
|
398
|
+
* "Drop In and Sleep" Architecture - Works everywhere with zero configuration
|
|
399
|
+
*
|
|
400
|
+
* @example Browser/Web App
|
|
401
|
+
* ```ts
|
|
402
|
+
* import { createMemoryClient } from '@lanonasis/memory-client/core';
|
|
403
|
+
* const client = createMemoryClient({ apiKey: 'your-key' });
|
|
404
|
+
* ```
|
|
405
|
+
*
|
|
406
|
+
* @example Node.js
|
|
407
|
+
* ```ts
|
|
408
|
+
* import { createNodeMemoryClient } from '@lanonasis/memory-client/node';
|
|
409
|
+
* const client = await createNodeMemoryClient({ apiKey: process.env.KEY });
|
|
410
|
+
* ```
|
|
411
|
+
*
|
|
412
|
+
* @example React
|
|
413
|
+
* ```tsx
|
|
414
|
+
* import { MemoryProvider, useMemories } from '@lanonasis/memory-client/react';
|
|
415
|
+
* ```
|
|
416
|
+
*
|
|
417
|
+
* @example Vue
|
|
418
|
+
* ```ts
|
|
419
|
+
* import { createMemoryPlugin, useMemories } from '@lanonasis/memory-client/vue';
|
|
420
|
+
* ```
|
|
654
421
|
*/
|
|
655
422
|
|
|
656
|
-
declare const VERSION = "
|
|
423
|
+
declare const VERSION = "2.0.0";
|
|
657
424
|
declare const CLIENT_NAME = "@lanonasis/memory-client";
|
|
658
425
|
declare const isBrowser: boolean;
|
|
659
426
|
declare const isNode: string | false;
|
|
@@ -661,19 +428,16 @@ declare const defaultConfigs: {
|
|
|
661
428
|
readonly development: {
|
|
662
429
|
readonly apiUrl: "http://localhost:3001";
|
|
663
430
|
readonly timeout: 30000;
|
|
664
|
-
readonly useGateway: false;
|
|
665
431
|
};
|
|
666
432
|
readonly production: {
|
|
667
433
|
readonly apiUrl: "https://api.lanonasis.com";
|
|
668
434
|
readonly timeout: 15000;
|
|
669
|
-
readonly useGateway: true;
|
|
670
435
|
};
|
|
671
|
-
readonly
|
|
436
|
+
readonly edge: {
|
|
672
437
|
readonly apiUrl: "https://api.lanonasis.com";
|
|
673
|
-
readonly timeout:
|
|
674
|
-
readonly useGateway: true;
|
|
438
|
+
readonly timeout: 5000;
|
|
675
439
|
};
|
|
676
440
|
};
|
|
677
441
|
|
|
678
|
-
export {
|
|
679
|
-
export type {
|
|
442
|
+
export { ApiError as ApiErrorClass, AuthenticationError, CLIENT_NAME, CoreMemoryClient, MEMORY_STATUSES, MEMORY_TYPES, CoreMemoryClient as MemoryClient, MemoryClientError, NotFoundError, RateLimitError, TimeoutError, VERSION, ValidationError, createMemoryClient, createMemorySchema, createTopicSchema, defaultConfigs, isBrowser, isNode, searchMemorySchema, updateMemorySchema };
|
|
443
|
+
export type { ApiError$1 as ApiError, ApiResponse, CoreMemoryClientConfig, CreateMemoryRequest, CreateTopicRequest, CoreMemoryClientConfig as MemoryClientConfig, MemoryEntry, MemorySearchResult, MemoryStatus, MemoryTopic, MemoryType, PaginatedResponse, SearchMemoryRequest, UpdateMemoryRequest, UserMemoryStats };
|