@memvid/sdk 2.0.146 → 2.0.147

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/index.d.ts CHANGED
@@ -264,6 +264,113 @@ export declare function listMemories(options?: {
264
264
  apiKey?: string;
265
265
  dashboardUrl?: string;
266
266
  }): Promise<MemoryInfo[]>;
267
+ /**
268
+ * Options for creating a project on the cloud.
269
+ */
270
+ export interface CreateProjectOptions {
271
+ /** Name for the project */
272
+ name: string;
273
+ /** Optional description */
274
+ description?: string;
275
+ /** API key (uses global config or env var if not specified) */
276
+ apiKey?: string;
277
+ /** Dashboard URL (uses global config or env var if not specified) */
278
+ dashboardUrl?: string;
279
+ }
280
+ /**
281
+ * Result of creating a project on the cloud.
282
+ */
283
+ export interface CreateProjectResult {
284
+ /** The project ID (24-char ObjectId format) */
285
+ id: string;
286
+ /** Organisation ID */
287
+ organisationId: string;
288
+ /** URL-friendly slug */
289
+ slug: string;
290
+ /** Project name */
291
+ name: string;
292
+ /** Description */
293
+ description: string | null;
294
+ /** Creation timestamp */
295
+ createdAt: string;
296
+ /** Last update timestamp */
297
+ updatedAt: string;
298
+ }
299
+ /**
300
+ * Project info returned from listProjects.
301
+ */
302
+ export interface ProjectInfo {
303
+ /** The project ID (24-char ObjectId format) */
304
+ id: string;
305
+ /** Organisation ID */
306
+ organisationId: string;
307
+ /** URL-friendly slug */
308
+ slug: string;
309
+ /** Project name */
310
+ name: string;
311
+ /** Description */
312
+ description: string | null;
313
+ /** Creation timestamp */
314
+ createdAt: string;
315
+ /** Last update timestamp */
316
+ updatedAt: string;
317
+ }
318
+ /**
319
+ * Create a new project on the cloud dashboard.
320
+ *
321
+ * Projects are containers that organize multiple memories together.
322
+ * Use projects to group related memories (e.g., by environment, team, or use case).
323
+ *
324
+ * @param options - Project creation options
325
+ * @returns The created project details
326
+ *
327
+ * @example
328
+ * ```typescript
329
+ * import { configure, createProject, createMemory, create } from 'memvid';
330
+ *
331
+ * configure({
332
+ * apiKey: 'mv2_your_api_key',
333
+ * dashboardUrl: 'http://localhost:3001',
334
+ * });
335
+ *
336
+ * // Create a project
337
+ * const project = await createProject({
338
+ * name: 'Production Environment',
339
+ * description: 'All production memories',
340
+ * });
341
+ *
342
+ * console.log('Created project:', project.id);
343
+ *
344
+ * // Create a memory in this project
345
+ * const memory = await createMemory({
346
+ * name: 'Customer Support KB',
347
+ * projectId: project.id,
348
+ * });
349
+ * ```
350
+ */
351
+ export declare function createProject(options: CreateProjectOptions): Promise<CreateProjectResult>;
352
+ /**
353
+ * List all projects for the authenticated organisation.
354
+ *
355
+ * @param options - Optional API key and dashboard URL overrides
356
+ * @returns Array of project info objects
357
+ *
358
+ * @example
359
+ * ```typescript
360
+ * import { configure, listProjects } from 'memvid';
361
+ *
362
+ * configure({ apiKey: 'mv2_your_api_key' });
363
+ *
364
+ * const projects = await listProjects();
365
+ * for (const project of projects) {
366
+ * console.log(`${project.name} (${project.id})`);
367
+ * }
368
+ * ```
369
+ */
370
+ export declare function listProjects(options?: {
371
+ apiKey?: string;
372
+ dashboardUrl?: string;
373
+ }): Promise<ProjectInfo[]>;
267
374
  type UseFunction = {
268
375
  (kind: Kind, filename: string, apiKeyOrOptions?: ApiKey | UseOptions, options?: UseOptions): Promise<Memvid>;
269
376
  verify(path: string, options?: UseVerifyOptions): Promise<unknown>;
package/dist/index.js CHANGED
@@ -44,6 +44,8 @@ exports.validateConfig = validateConfig;
44
44
  exports.resolveMemory = resolveMemory;
45
45
  exports.createMemory = createMemory;
46
46
  exports.listMemories = listMemories;
47
+ exports.createProject = createProject;
48
+ exports.listProjects = listProjects;
47
49
  exports.lockWho = lockWho;
48
50
  exports.lockNudge = lockNudge;
49
51
  exports.lock = lock;
@@ -454,6 +456,136 @@ async function listMemories(options) {
454
456
  updatedAt: m.updated_at,
455
457
  }));
456
458
  }
459
+ /**
460
+ * Create a new project on the cloud dashboard.
461
+ *
462
+ * Projects are containers that organize multiple memories together.
463
+ * Use projects to group related memories (e.g., by environment, team, or use case).
464
+ *
465
+ * @param options - Project creation options
466
+ * @returns The created project details
467
+ *
468
+ * @example
469
+ * ```typescript
470
+ * import { configure, createProject, createMemory, create } from 'memvid';
471
+ *
472
+ * configure({
473
+ * apiKey: 'mv2_your_api_key',
474
+ * dashboardUrl: 'http://localhost:3001',
475
+ * });
476
+ *
477
+ * // Create a project
478
+ * const project = await createProject({
479
+ * name: 'Production Environment',
480
+ * description: 'All production memories',
481
+ * });
482
+ *
483
+ * console.log('Created project:', project.id);
484
+ *
485
+ * // Create a memory in this project
486
+ * const memory = await createMemory({
487
+ * name: 'Customer Support KB',
488
+ * projectId: project.id,
489
+ * });
490
+ * ```
491
+ */
492
+ async function createProject(options) {
493
+ const { name, description } = options;
494
+ // Resolve API key
495
+ const apiKey = options.apiKey || globalConfig.apiKey || process.env.MEMVID_API_KEY;
496
+ if (!apiKey) {
497
+ throw new error_1.ApiKeyRequiredError("API key required for createProject(). " +
498
+ "Set via configure({ apiKey: 'mv2_...' }), MEMVID_API_KEY env var, or options.apiKey. " +
499
+ "Get your API key at https://memvid.com/dashboard/api-keys");
500
+ }
501
+ // Resolve dashboard URL
502
+ const dashboardUrl = (options.dashboardUrl ||
503
+ globalConfig.dashboardUrl ||
504
+ process.env.MEMVID_DASHBOARD_URL ||
505
+ "https://memvid.com").replace(/\/$/, "");
506
+ const url = `${dashboardUrl}/api/projects`;
507
+ const body = { name };
508
+ if (description)
509
+ body.description = description;
510
+ const response = await fetch(url, {
511
+ method: "POST",
512
+ headers: {
513
+ "Content-Type": "application/json",
514
+ "x-api-key": apiKey,
515
+ },
516
+ body: JSON.stringify(body),
517
+ });
518
+ if (!response.ok) {
519
+ const text = await response.text().catch(() => "");
520
+ throw new error_1.MemvidError("MV022", `Failed to create project: ${response.status} ${response.statusText}. ${text}`);
521
+ }
522
+ const json = await response.json();
523
+ const data = json.data || json;
524
+ return {
525
+ id: data.id,
526
+ organisationId: data.organisation_id,
527
+ slug: data.slug,
528
+ name: data.name,
529
+ description: data.description,
530
+ createdAt: data.created_at,
531
+ updatedAt: data.updated_at,
532
+ };
533
+ }
534
+ /**
535
+ * List all projects for the authenticated organisation.
536
+ *
537
+ * @param options - Optional API key and dashboard URL overrides
538
+ * @returns Array of project info objects
539
+ *
540
+ * @example
541
+ * ```typescript
542
+ * import { configure, listProjects } from 'memvid';
543
+ *
544
+ * configure({ apiKey: 'mv2_your_api_key' });
545
+ *
546
+ * const projects = await listProjects();
547
+ * for (const project of projects) {
548
+ * console.log(`${project.name} (${project.id})`);
549
+ * }
550
+ * ```
551
+ */
552
+ async function listProjects(options) {
553
+ // Resolve API key
554
+ const apiKey = options?.apiKey || globalConfig.apiKey || process.env.MEMVID_API_KEY;
555
+ if (!apiKey) {
556
+ throw new error_1.ApiKeyRequiredError("API key required for listProjects(). " +
557
+ "Set via configure({ apiKey: 'mv2_...' }), MEMVID_API_KEY env var, or options.apiKey. " +
558
+ "Get your API key at https://memvid.com/dashboard/api-keys");
559
+ }
560
+ // Resolve dashboard URL
561
+ const dashboardUrl = (options?.dashboardUrl ||
562
+ globalConfig.dashboardUrl ||
563
+ process.env.MEMVID_DASHBOARD_URL ||
564
+ "https://memvid.com").replace(/\/$/, "");
565
+ const url = `${dashboardUrl}/api/projects`;
566
+ const response = await fetch(url, {
567
+ method: "GET",
568
+ headers: {
569
+ "x-api-key": apiKey,
570
+ },
571
+ });
572
+ if (!response.ok) {
573
+ const text = await response.text().catch(() => "");
574
+ throw new error_1.MemvidError("MV023", `Failed to list projects: ${response.status} ${response.statusText}. ${text}`);
575
+ }
576
+ const json = await response.json();
577
+ const data = json.data || json;
578
+ const projects = data.projects || [];
579
+ return projects.map((p) => ({
580
+ id: p.id,
581
+ organisationId: p.organisation_id,
582
+ slug: p.slug,
583
+ name: p.name,
584
+ description: p.description,
585
+ createdAt: p.created_at,
586
+ updatedAt: p.updated_at,
587
+ }));
588
+ }
457
589
  // ===========================================================================
458
590
  // Load platform-specific native binary
459
591
  function loadNativeAddon() {
@@ -944,6 +1076,23 @@ class MemvidImpl {
944
1076
  return result;
945
1077
  });
946
1078
  }
1079
+ /**
1080
+ * Remove a frame by its ID.
1081
+ *
1082
+ * This performs a soft delete (tombstone) - the frame is marked as deleted
1083
+ * and won't appear in search results or timeline, but the data remains
1084
+ * in the file until compaction.
1085
+ *
1086
+ * @param frameId - The frame ID to remove (returned by put())
1087
+ * @returns The WAL sequence number of the tombstone operation
1088
+ */
1089
+ async remove(frameId) {
1090
+ return wrapAsync(async () => {
1091
+ const result = await this.core.remove(frameId);
1092
+ (0, analytics_1.trackCommand)(this.filename, "remove", true);
1093
+ return result;
1094
+ });
1095
+ }
947
1096
  async putMany(requests, options) {
948
1097
  return wrapAsync(async () => {
949
1098
  const embedder = options?.embedder;
@@ -1550,6 +1699,9 @@ class MemvidImpl {
1550
1699
  async applyTicket(ticket) {
1551
1700
  return wrapAsync(() => this.core.applyTicket(ticket));
1552
1701
  }
1702
+ async applySignedTicket(ticket) {
1703
+ return wrapAsync(() => this.core.applySignedTicket(ticket));
1704
+ }
1553
1705
  async getMemoryBinding() {
1554
1706
  return wrapAsync(() => this.core.getMemoryBinding());
1555
1707
  }
package/dist/types.d.ts CHANGED
@@ -351,6 +351,7 @@ export interface SessionReplayResult {
351
351
  }
352
352
  export interface NativeMemvid {
353
353
  put(args: NativePutArgs): Promise<string>;
354
+ remove(frameId: string): Promise<number>;
354
355
  putMany(requests: NativePutManyRequest[], options?: NativePutManyOptions): Promise<string[]>;
355
356
  find(query: string, options?: NativeFindOptions): Promise<unknown>;
356
357
  findWithEmbedding(query: string, embedding: number[], options?: NativeFindOptions): Promise<unknown>;
@@ -365,7 +366,10 @@ export interface NativeMemvid {
365
366
  seal(): Promise<void>;
366
367
  enableLex(): Promise<void>;
367
368
  setVectorCompression(enabled: boolean): Promise<void>;
369
+ /** @deprecated Use applySignedTicket() for cryptographically verified tickets */
368
370
  applyTicket(ticket: string): Promise<void>;
371
+ /** Apply a cryptographically signed ticket (verifies signature against Memvid public key) */
372
+ applySignedTicket(ticket: string): Promise<void>;
369
373
  getMemoryBinding(): Promise<MemoryBinding | null>;
370
374
  unbindMemory(): Promise<void>;
371
375
  getCapacity(): Promise<number>;
@@ -404,6 +408,8 @@ export interface TicketInfo {
404
408
  seq_no: number;
405
409
  expires_in_secs: number;
406
410
  capacity_bytes: number;
411
+ /** Whether the ticket was cryptographically verified against Memvid's public key */
412
+ verified: boolean;
407
413
  }
408
414
  export interface SyncTicketResult {
409
415
  already_bound: boolean;
@@ -411,6 +417,19 @@ export interface SyncTicketResult {
411
417
  issuer: string;
412
418
  seq_no: number;
413
419
  capacity_bytes: number;
420
+ /** Whether the ticket was cryptographically verified against Memvid's public key */
421
+ verified: boolean;
422
+ }
423
+ /** A cryptographically signed ticket from the Memvid control plane */
424
+ export interface SignedTicket {
425
+ issuer: string;
426
+ seq_no: number;
427
+ expires_in_secs: number;
428
+ capacity_bytes?: number;
429
+ /** The memory ID this ticket is bound to */
430
+ memory_id: string;
431
+ /** Base64-encoded Ed25519 signature */
432
+ signature: string;
414
433
  }
415
434
  export interface HeatmapEntry {
416
435
  frame_id: number;
@@ -553,6 +572,17 @@ export interface Memvid {
553
572
  /** Absolute or relative path to the backing `.mv2` file. */
554
573
  path(): Promise<string>;
555
574
  put(data: PutInput): Promise<string>;
575
+ /**
576
+ * Remove a frame by its ID.
577
+ *
578
+ * This performs a soft delete (tombstone) - the frame is marked as deleted
579
+ * and won't appear in search results or timeline, but the data remains
580
+ * in the file until compaction.
581
+ *
582
+ * @param frameId - The frame ID to remove (returned by put())
583
+ * @returns The WAL sequence number of the tombstone operation
584
+ */
585
+ remove(frameId: string): Promise<number>;
556
586
  /**
557
587
  * Batch ingest multiple documents using parallel segment building.
558
588
  * Much more efficient than calling put() multiple times.
@@ -580,7 +610,10 @@ export interface Memvid {
580
610
  seal(): Promise<void>;
581
611
  enableLex(): Promise<void>;
582
612
  setVectorCompression(enabled: boolean): Promise<void>;
613
+ /** @deprecated Use applySignedTicket() for cryptographically verified tickets */
583
614
  applyTicket(ticket: string): Promise<void>;
615
+ /** Apply a cryptographically signed ticket (verifies signature against Memvid public key) */
616
+ applySignedTicket(ticket: string): Promise<void>;
584
617
  getMemoryBinding(): Promise<MemoryBinding | null>;
585
618
  unbindMemory(): Promise<void>;
586
619
  getCapacity(): Promise<number>;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@memvid/sdk",
3
- "version": "2.0.146",
3
+ "version": "2.0.147",
4
4
  "description": "Single-file AI memory system for Node.js. Store, search, and query documents with built-in RAG.",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",
@@ -41,10 +41,10 @@
41
41
  "node": ">=18"
42
42
  },
43
43
  "optionalDependencies": {
44
- "@memvid/sdk-darwin-arm64": "2.0.146",
45
- "@memvid/sdk-darwin-x64": "2.0.146",
46
- "@memvid/sdk-linux-x64-gnu": "2.0.146",
47
- "@memvid/sdk-win32-x64-msvc": "2.0.146"
44
+ "@memvid/sdk-darwin-arm64": "2.0.147",
45
+ "@memvid/sdk-darwin-x64": "2.0.147",
46
+ "@memvid/sdk-linux-x64-gnu": "2.0.147",
47
+ "@memvid/sdk-win32-x64-msvc": "2.0.147"
48
48
  },
49
49
  "peerDependencies": {
50
50
  "@langchain/core": ">=0.3.0",