@dakera-ai/dakera 0.11.55 → 0.11.57

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.mjs CHANGED
@@ -96,6 +96,12 @@ function parseErrorCode(raw) {
96
96
  }
97
97
  return "UNKNOWN" /* UNKNOWN */;
98
98
  }
99
+ function flattenRecalledMemory(item) {
100
+ if (item && typeof item === "object" && item.memory && typeof item.memory === "object") {
101
+ return { ...item.memory, score: item.score, depth: item.depth };
102
+ }
103
+ return item;
104
+ }
99
105
  var DEFAULT_TIMEOUT = 3e4;
100
106
  var DEFAULT_MAX_RETRIES = 3;
101
107
  var DEFAULT_BASE_DELAY = 100;
@@ -353,7 +359,33 @@ var DakeraClient = class {
353
359
  if (options.ids) body.ids = options.ids;
354
360
  if (options.filter) body.filter = options.filter;
355
361
  if (options.deleteAll) body.delete_all = true;
356
- return this.request("POST", `/v1/namespaces/${namespace}/delete`, body);
362
+ return this.request("POST", `/v1/namespaces/${namespace}/vectors/delete`, body);
363
+ }
364
+ /** Bulk update vector metadata matching a filter. */
365
+ async bulkUpdateVectors(namespace, filter, update) {
366
+ return this.request(
367
+ "POST",
368
+ `/v1/namespaces/${encodeURIComponent(namespace)}/vectors/bulk-update`,
369
+ { filter, update }
370
+ );
371
+ }
372
+ /** Bulk delete vectors matching a filter. */
373
+ async bulkDeleteVectors(namespace, filter) {
374
+ return this.request(
375
+ "POST",
376
+ `/v1/namespaces/${encodeURIComponent(namespace)}/vectors/bulk-delete`,
377
+ { filter }
378
+ );
379
+ }
380
+ /** Count vectors in a namespace, optionally filtered. */
381
+ async countVectors(namespace, filter) {
382
+ const body = {};
383
+ if (filter) body.filter = filter;
384
+ return this.request(
385
+ "POST",
386
+ `/v1/namespaces/${encodeURIComponent(namespace)}/vectors/count`,
387
+ body
388
+ );
357
389
  }
358
390
  /**
359
391
  * Fetch vectors by ID.
@@ -578,6 +610,14 @@ var DakeraClient = class {
578
610
  async health() {
579
611
  return this.request("GET", "/health");
580
612
  }
613
+ /** K8s readiness probe — checks storage and dependencies. */
614
+ async healthReady() {
615
+ return this.request("GET", "/health/ready");
616
+ }
617
+ /** K8s liveness probe — checks process is alive. */
618
+ async healthLive() {
619
+ return this.request("GET", "/health/live");
620
+ }
581
621
  /**
582
622
  * Get index statistics for a namespace.
583
623
  *
@@ -1062,7 +1102,11 @@ var DakeraClient = class {
1062
1102
  if (options?.until !== void 0) body["until"] = options.until;
1063
1103
  if (options?.routing !== void 0) body["routing"] = options.routing;
1064
1104
  if (options?.rerank !== void 0) body["rerank"] = options.rerank;
1065
- return this.request("POST", "/v1/memory/recall", { ...body, agent_id: agentId2 });
1105
+ const raw = await this.request("POST", "/v1/memory/recall", { ...body, agent_id: agentId2 });
1106
+ return {
1107
+ memories: (raw.memories ?? []).map(flattenRecalledMemory),
1108
+ ...raw.associated_memories ? { associated_memories: raw.associated_memories.map(flattenRecalledMemory) } : {}
1109
+ };
1066
1110
  }
1067
1111
  /** Get a specific memory */
1068
1112
  async getMemory(agentId2, memoryId2) {
@@ -1112,6 +1156,28 @@ var DakeraClient = class {
1112
1156
  async batchForget(request) {
1113
1157
  return this.request("DELETE", "/v1/memories/forget/batch", request);
1114
1158
  }
1159
+ /**
1160
+ * Store multiple memories in a single request (DAK-5508).
1161
+ *
1162
+ * Uses `POST /v1/memories/store/batch`. The server embeds all contents in a
1163
+ * single ONNX inference pass, yielding ≥100× throughput vs. N sequential
1164
+ * single-store calls. Accepts up to 1 000 memories per call.
1165
+ *
1166
+ * @example
1167
+ * ```ts
1168
+ * const resp = await client.storeMemoriesBatch({
1169
+ * agent_id: 'agent-1',
1170
+ * memories: [
1171
+ * { content: 'The user prefers dark mode', importance: 0.8 },
1172
+ * { content: 'The user is based in Berlin', importance: 0.7 },
1173
+ * ],
1174
+ * });
1175
+ * console.log(`Stored ${resp.stored_count} memories`);
1176
+ * ```
1177
+ */
1178
+ async storeMemoriesBatch(request) {
1179
+ return this.request("POST", "/v1/memories/store/batch", request);
1180
+ }
1115
1181
  /** Search memories for an agent */
1116
1182
  async searchMemories(agentId2, query, options) {
1117
1183
  const body = { query };
@@ -1121,7 +1187,8 @@ var DakeraClient = class {
1121
1187
  if (options?.routing !== void 0) body["routing"] = options.routing;
1122
1188
  if (options?.rerank !== void 0) body["rerank"] = options.rerank;
1123
1189
  const result = await this.request("POST", "/v1/memory/search", { ...body, agent_id: agentId2 });
1124
- return result.memories ?? result;
1190
+ const items = result.memories ?? result;
1191
+ return (Array.isArray(items) ? items : []).map(flattenRecalledMemory);
1125
1192
  }
1126
1193
  /** Update importance of memories */
1127
1194
  async updateImportance(agentId2, request) {
@@ -1139,6 +1206,22 @@ var DakeraClient = class {
1139
1206
  async consolidate(agentId2, request) {
1140
1207
  return this.request("POST", "/v1/memory/consolidate", { ...request ?? {}, agent_id: agentId2 });
1141
1208
  }
1209
+ /** Consolidate memories directly for an agent (DBSCAN clustering). */
1210
+ async consolidateAgent(agentId2) {
1211
+ return this.request("POST", `/v1/agents/${encodeURIComponent(agentId2)}/consolidate`);
1212
+ }
1213
+ /** Get the consolidation execution log for an agent. */
1214
+ async getConsolidationLog(agentId2) {
1215
+ return this.request("GET", `/v1/agents/${encodeURIComponent(agentId2)}/consolidation/log`);
1216
+ }
1217
+ /** Update the consolidation configuration for an agent. */
1218
+ async patchConsolidationConfig(agentId2, config) {
1219
+ return this.request(
1220
+ "PATCH",
1221
+ `/v1/agents/${encodeURIComponent(agentId2)}/consolidation/config`,
1222
+ config
1223
+ );
1224
+ }
1142
1225
  /** Submit feedback on a memory recall */
1143
1226
  async memoryFeedback(agentId2, request) {
1144
1227
  return this.request("POST", "/v1/memory/feedback", { ...request, agent_id: agentId2 });
@@ -1261,6 +1344,14 @@ var DakeraClient = class {
1261
1344
  // =========================================================================
1262
1345
  // Entity Extraction Operations (CE-4)
1263
1346
  // =========================================================================
1347
+ /** Get entity extraction configuration for a namespace. */
1348
+ async getNamespaceEntityConfig(namespace) {
1349
+ return this.request("GET", `/v1/namespaces/${encodeURIComponent(namespace)}/config`);
1350
+ }
1351
+ /** Get the extractor provider configuration for a namespace. */
1352
+ async getNamespaceExtractor(namespace) {
1353
+ return this.request("GET", `/v1/namespaces/${encodeURIComponent(namespace)}/extractor`);
1354
+ }
1264
1355
  /**
1265
1356
  * Configure entity extraction for a namespace.
1266
1357
  *
@@ -1314,7 +1405,7 @@ var DakeraClient = class {
1314
1405
  }
1315
1406
  /** End a session. Returns the session state and total memory count at close. */
1316
1407
  async endSession(sessionId2) {
1317
- return this.request("POST", `/v1/sessions/${sessionId2}/end`);
1408
+ return this.request("POST", `/v1/sessions/${sessionId2}/end`, {});
1318
1409
  }
1319
1410
  /** Get session details */
1320
1411
  async getSession(sessionId2) {
@@ -2216,6 +2307,226 @@ var DakeraClient = class {
2216
2307
  const body = namespace ? { namespace } : {};
2217
2308
  return this.request("POST", "/admin/fulltext/reindex", body);
2218
2309
  }
2310
+ // ---------------------------------------------------------------------------
2311
+ // Admin — Cluster & Maintenance
2312
+ // ---------------------------------------------------------------------------
2313
+ /** GET /admin/cluster/replication — cluster replication status. */
2314
+ async adminClusterReplication() {
2315
+ return this.request("GET", "/admin/cluster/replication");
2316
+ }
2317
+ /** GET /admin/cluster/shards — list shards. */
2318
+ async adminListShards() {
2319
+ return this.request("GET", "/admin/cluster/shards");
2320
+ }
2321
+ /** POST /admin/cluster/shards/rebalance — rebalance shards. */
2322
+ async adminRebalanceShards(request) {
2323
+ return this.request("POST", "/admin/cluster/shards/rebalance", request ?? {});
2324
+ }
2325
+ /** GET /admin/cluster/maintenance — maintenance mode status. */
2326
+ async adminMaintenanceStatus() {
2327
+ return this.request("GET", "/admin/cluster/maintenance");
2328
+ }
2329
+ /** POST /admin/cluster/maintenance/enable — enable maintenance mode. */
2330
+ async adminEnableMaintenance(request) {
2331
+ return this.request("POST", "/admin/cluster/maintenance/enable", request);
2332
+ }
2333
+ /** POST /admin/cluster/maintenance/disable — disable maintenance mode. */
2334
+ async adminDisableMaintenance(request) {
2335
+ return this.request("POST", "/admin/cluster/maintenance/disable", request ?? {});
2336
+ }
2337
+ // ---------------------------------------------------------------------------
2338
+ // Admin — Quotas
2339
+ // ---------------------------------------------------------------------------
2340
+ /** GET /admin/quotas — list all namespace quotas. */
2341
+ async adminListQuotas() {
2342
+ return this.request("GET", "/admin/quotas");
2343
+ }
2344
+ /** GET /admin/quotas/default — get default quota configuration. */
2345
+ async adminGetDefaultQuota() {
2346
+ return this.request("GET", "/admin/quotas/default");
2347
+ }
2348
+ /** PUT /admin/quotas/default — set default quota configuration. */
2349
+ async adminSetDefaultQuota(request) {
2350
+ return this.request("PUT", "/admin/quotas/default", request);
2351
+ }
2352
+ /** GET /admin/quotas/{namespace} — get namespace quota. */
2353
+ async adminGetQuota(namespace) {
2354
+ return this.request("GET", `/admin/quotas/${namespace}`);
2355
+ }
2356
+ /** PUT /admin/quotas/{namespace} — set namespace quota. */
2357
+ async adminSetQuota(namespace, request) {
2358
+ return this.request("PUT", `/admin/quotas/${namespace}`, request);
2359
+ }
2360
+ /** DELETE /admin/quotas/{namespace} — remove namespace quota. */
2361
+ async adminDeleteQuota(namespace) {
2362
+ return this.request("DELETE", `/admin/quotas/${namespace}`);
2363
+ }
2364
+ /** POST /admin/quotas/{namespace}/check — check if operation would exceed quota. */
2365
+ async adminCheckQuota(namespace, request) {
2366
+ return this.request("POST", `/admin/quotas/${namespace}/check`, request);
2367
+ }
2368
+ // ---------------------------------------------------------------------------
2369
+ // Admin — Slow Queries
2370
+ // ---------------------------------------------------------------------------
2371
+ /** GET /admin/slow-queries — list recent slow queries. */
2372
+ async adminListSlowQueries(params) {
2373
+ const qs = params ? new URLSearchParams(Object.entries(params).filter(([, v]) => v !== void 0).map(([k, v]) => [k, String(v)])).toString() : "";
2374
+ const path = qs ? `/admin/slow-queries?${qs}` : "/admin/slow-queries";
2375
+ return this.request("GET", path);
2376
+ }
2377
+ /** GET /admin/slow-queries/summary — slow query summary. */
2378
+ async adminSlowQuerySummary() {
2379
+ return this.request("GET", "/admin/slow-queries/summary");
2380
+ }
2381
+ /** DELETE /admin/slow-queries — clear slow query log. */
2382
+ async adminClearSlowQueries(namespace) {
2383
+ const path = namespace ? `/admin/slow-queries?namespace=${encodeURIComponent(namespace)}` : "/admin/slow-queries";
2384
+ return this.request("DELETE", path);
2385
+ }
2386
+ /** PATCH /admin/slow-queries/config — update slow query configuration. */
2387
+ async adminUpdateSlowQueryConfig(config) {
2388
+ return this.request("PATCH", "/admin/slow-queries/config", config);
2389
+ }
2390
+ // ---------------------------------------------------------------------------
2391
+ // Admin — Backups
2392
+ // ---------------------------------------------------------------------------
2393
+ /** GET /admin/backups — list all backups. */
2394
+ async adminListBackups() {
2395
+ return this.request("GET", "/admin/backups");
2396
+ }
2397
+ /** POST /admin/backups — create a new backup. */
2398
+ async adminCreateBackup(request) {
2399
+ return this.request("POST", "/admin/backups", request);
2400
+ }
2401
+ /** GET /admin/backups/{id} — get backup details. */
2402
+ async adminGetBackup(backupId) {
2403
+ return this.request("GET", `/admin/backups/${backupId}`);
2404
+ }
2405
+ /** DELETE /admin/backups/{id} — delete a backup. */
2406
+ async adminDeleteBackup(backupId) {
2407
+ return this.request("DELETE", `/admin/backups/${backupId}`);
2408
+ }
2409
+ /** GET /admin/backups/schedule — get backup schedule. */
2410
+ async adminGetBackupSchedule() {
2411
+ return this.request("GET", "/admin/backups/schedule");
2412
+ }
2413
+ /** POST /admin/backups/schedule — update backup schedule. */
2414
+ async adminUpdateBackupSchedule(request) {
2415
+ return this.request("POST", "/admin/backups/schedule", request);
2416
+ }
2417
+ /** POST /admin/backups/restore — restore from backup. */
2418
+ async adminRestoreBackup(request) {
2419
+ return this.request("POST", "/admin/backups/restore", request);
2420
+ }
2421
+ /** GET /admin/backups/restore/{id} — restore operation status. */
2422
+ async adminGetRestoreStatus(restoreId) {
2423
+ return this.request("GET", `/admin/backups/restore/${restoreId}`);
2424
+ }
2425
+ // ---------------------------------------------------------------------------
2426
+ // Ops — Diagnostics & Jobs
2427
+ // ---------------------------------------------------------------------------
2428
+ /** GET /ops/diagnostics — system diagnostics. */
2429
+ async opsDiagnostics() {
2430
+ return this.request("GET", "/ops/diagnostics");
2431
+ }
2432
+ /** GET /ops/jobs — list background jobs. */
2433
+ async opsListJobs() {
2434
+ return this.request("GET", "/ops/jobs");
2435
+ }
2436
+ /** GET /ops/jobs/{id} — get job status. */
2437
+ async opsGetJob(jobId) {
2438
+ return this.request("GET", `/ops/jobs/${jobId}`);
2439
+ }
2440
+ /** POST /ops/compact — trigger compaction. */
2441
+ async opsCompact(request) {
2442
+ return this.request("POST", "/ops/compact", request ?? {});
2443
+ }
2444
+ /** POST /ops/shutdown — request graceful shutdown. */
2445
+ async opsShutdown() {
2446
+ return this.request("POST", "/ops/shutdown");
2447
+ }
2448
+ // ────────────────────────────────────────────────────────────
2449
+ // Phase 3 — Engine Parity
2450
+ // ────────────────────────────────────────────────────────────
2451
+ /** GET /v1/namespaces/{namespace}/fulltext/stats — full-text index statistics. */
2452
+ async fulltextStats(namespace) {
2453
+ return this.request(
2454
+ "GET",
2455
+ `/v1/namespaces/${encodeURIComponent(namespace)}/fulltext/stats`
2456
+ );
2457
+ }
2458
+ /** POST /v1/namespaces/{namespace}/fulltext/delete — delete documents from full-text index. */
2459
+ async fulltextDelete(namespace, ids) {
2460
+ return this.request(
2461
+ "POST",
2462
+ `/v1/namespaces/${encodeURIComponent(namespace)}/fulltext/delete`,
2463
+ { ids }
2464
+ );
2465
+ }
2466
+ /** GET /admin/ttl/stats — TTL statistics across all namespaces. */
2467
+ async adminTtlStats() {
2468
+ return this.request("GET", "/admin/ttl/stats");
2469
+ }
2470
+ /** POST /v1/route — route a query to the best-matching namespace(s). */
2471
+ async routeQuery(request) {
2472
+ return this.request("POST", "/v1/route", request);
2473
+ }
2474
+ /** GET /v1/import/{job_id}/status — check import job progress. */
2475
+ async importJobStatus(jobId) {
2476
+ return this.request(
2477
+ "GET",
2478
+ `/v1/import/${encodeURIComponent(jobId)}/status`
2479
+ );
2480
+ }
2481
+ /** GET /admin/backups/{id}/download — download a backup as binary data. */
2482
+ async adminDownloadBackup(backupId) {
2483
+ const url = `${this.baseUrl}/admin/backups/${encodeURIComponent(backupId)}/download`;
2484
+ const response = await fetch(url, {
2485
+ headers: { ...this.headers, Accept: "application/octet-stream" }
2486
+ });
2487
+ if (!response.ok) {
2488
+ throw new Error(`Download failed: ${response.status}`);
2489
+ }
2490
+ return response.arrayBuffer();
2491
+ }
2492
+ /** POST /admin/backups/upload — upload a backup archive. */
2493
+ async adminUploadBackup(data) {
2494
+ const url = `${this.baseUrl}/admin/backups/upload`;
2495
+ const headers = {};
2496
+ if (this.apiKey) {
2497
+ headers["Authorization"] = `Bearer ${this.apiKey}`;
2498
+ }
2499
+ headers["Content-Type"] = "application/gzip";
2500
+ const response = await fetch(url, {
2501
+ method: "POST",
2502
+ headers,
2503
+ body: data instanceof ArrayBuffer ? data : data
2504
+ });
2505
+ if (!response.ok) {
2506
+ throw new Error(`Upload failed: ${response.status}`);
2507
+ }
2508
+ return response.json();
2509
+ }
2510
+ /** GET /admin/storage/tiers — storage tier overview. */
2511
+ async adminStorageTierOverview() {
2512
+ return this.request("GET", "/admin/storage/tiers");
2513
+ }
2514
+ /** GET /admin/background-activity — current background activity. */
2515
+ async adminBackgroundActivity() {
2516
+ return this.request("GET", "/admin/background-activity");
2517
+ }
2518
+ /** GET /admin/memory-type-stats — memory type distribution statistics. */
2519
+ async adminMemoryTypeStats() {
2520
+ return this.request("GET", "/admin/memory-type-stats");
2521
+ }
2522
+ /** POST /admin/namespaces/migrate-dimensions — migrate namespace embedding dimensions. */
2523
+ async adminMigrateNamespaceDimensions(request) {
2524
+ return this.request(
2525
+ "POST",
2526
+ "/admin/namespaces/migrate-dimensions",
2527
+ request ?? {}
2528
+ );
2529
+ }
2219
2530
  };
2220
2531
 
2221
2532
  // src/types.ts
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dakera-ai/dakera",
3
- "version": "0.11.55",
3
+ "version": "0.11.57",
4
4
  "description": "TypeScript/JavaScript SDK for Dakera AI memory platform",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",