@dakera-ai/dakera 0.11.54 → 0.11.56
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 +172 -38
- package/dist/index.d.mts +616 -12
- package/dist/index.d.ts +616 -12
- package/dist/index.js +325 -23
- package/dist/index.mjs +325 -23
- package/package.json +4 -2
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.
|
|
@@ -465,11 +497,11 @@ var DakeraClient = class {
|
|
|
465
497
|
*
|
|
466
498
|
* When `vector` is omitted the server falls back to BM25-only full-text
|
|
467
499
|
* search. When provided, results are blended with vector similarity
|
|
468
|
-
* according to `
|
|
500
|
+
* according to `vectorWeight`.
|
|
469
501
|
*
|
|
470
502
|
* @param namespace - Target namespace
|
|
471
503
|
* @param query - Text query
|
|
472
|
-
* @param options - Search options: vector (optional), topK,
|
|
504
|
+
* @param options - Search options: vector (optional), topK, vectorWeight, filter
|
|
473
505
|
* @returns Hybrid search results
|
|
474
506
|
*
|
|
475
507
|
* @example
|
|
@@ -478,7 +510,7 @@ var DakeraClient = class {
|
|
|
478
510
|
* const results = await client.hybridSearch('my-namespace', 'machine learning', {
|
|
479
511
|
* vector: [0.1, 0.2, 0.3],
|
|
480
512
|
* topK: 10,
|
|
481
|
-
*
|
|
513
|
+
* vectorWeight: 0.7, // 70% vector, 30% text
|
|
482
514
|
* });
|
|
483
515
|
* // BM25-only (no vector)
|
|
484
516
|
* const results = await client.hybridSearch('my-namespace', 'machine learning');
|
|
@@ -486,9 +518,9 @@ var DakeraClient = class {
|
|
|
486
518
|
*/
|
|
487
519
|
async hybridSearch(namespace, query, options = {}) {
|
|
488
520
|
const body = {
|
|
489
|
-
query,
|
|
521
|
+
text: query,
|
|
490
522
|
top_k: options.topK ?? 10,
|
|
491
|
-
|
|
523
|
+
vector_weight: options.vectorWeight ?? 0.5
|
|
492
524
|
};
|
|
493
525
|
if (options.vector != null) {
|
|
494
526
|
body["vector"] = options.vector;
|
|
@@ -516,7 +548,7 @@ var DakeraClient = class {
|
|
|
516
548
|
"GET",
|
|
517
549
|
"/v1/namespaces"
|
|
518
550
|
);
|
|
519
|
-
return response.namespaces;
|
|
551
|
+
return response.namespaces.map((ns) => ({ namespace: ns, vector_count: 0 }));
|
|
520
552
|
}
|
|
521
553
|
/**
|
|
522
554
|
* Get namespace information.
|
|
@@ -535,11 +567,16 @@ var DakeraClient = class {
|
|
|
535
567
|
* @returns Created namespace info
|
|
536
568
|
*/
|
|
537
569
|
async createNamespace(namespace, options = {}) {
|
|
538
|
-
const body = {
|
|
539
|
-
if (options.dimensions) body.
|
|
570
|
+
const body = {};
|
|
571
|
+
if (options.dimensions) body.dimension = options.dimensions;
|
|
540
572
|
if (options.indexType) body.index_type = options.indexType;
|
|
541
573
|
if (options.metadata) body.metadata = options.metadata;
|
|
542
|
-
|
|
574
|
+
const response = await this.request(
|
|
575
|
+
"PUT",
|
|
576
|
+
`/v1/namespaces/${namespace}`,
|
|
577
|
+
body
|
|
578
|
+
);
|
|
579
|
+
return { namespace: response.namespace, vector_count: 0, dimension: response.dimension };
|
|
543
580
|
}
|
|
544
581
|
/**
|
|
545
582
|
* Create or update a namespace configuration (upsert semantics).
|
|
@@ -573,6 +610,14 @@ var DakeraClient = class {
|
|
|
573
610
|
async health() {
|
|
574
611
|
return this.request("GET", "/health");
|
|
575
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
|
+
}
|
|
576
621
|
/**
|
|
577
622
|
* Get index statistics for a namespace.
|
|
578
623
|
*
|
|
@@ -1024,7 +1069,7 @@ var DakeraClient = class {
|
|
|
1024
1069
|
// ===========================================================================
|
|
1025
1070
|
/** Store a memory for an agent */
|
|
1026
1071
|
async storeMemory(agentId2, request) {
|
|
1027
|
-
return this.request("POST",
|
|
1072
|
+
return this.request("POST", "/v1/memory/store", { ...request, agent_id: agentId2 });
|
|
1028
1073
|
}
|
|
1029
1074
|
/**
|
|
1030
1075
|
* Recall memories for an agent.
|
|
@@ -1057,19 +1102,23 @@ var DakeraClient = class {
|
|
|
1057
1102
|
if (options?.until !== void 0) body["until"] = options.until;
|
|
1058
1103
|
if (options?.routing !== void 0) body["routing"] = options.routing;
|
|
1059
1104
|
if (options?.rerank !== void 0) body["rerank"] = options.rerank;
|
|
1060
|
-
|
|
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
|
+
};
|
|
1061
1110
|
}
|
|
1062
1111
|
/** Get a specific memory */
|
|
1063
1112
|
async getMemory(agentId2, memoryId2) {
|
|
1064
|
-
return this.request("GET", `/v1/
|
|
1113
|
+
return this.request("GET", `/v1/memory/get/${memoryId2}?agent_id=${encodeURIComponent(agentId2)}`);
|
|
1065
1114
|
}
|
|
1066
1115
|
/** Update an existing memory */
|
|
1067
|
-
async updateMemory(
|
|
1068
|
-
return this.request("PUT", `/v1/
|
|
1116
|
+
async updateMemory(_agentId, memoryId2, request) {
|
|
1117
|
+
return this.request("PUT", `/v1/memory/update/${memoryId2}`, request);
|
|
1069
1118
|
}
|
|
1070
1119
|
/** Delete a memory */
|
|
1071
1120
|
async forget(agentId2, memoryId2) {
|
|
1072
|
-
return this.request("
|
|
1121
|
+
return this.request("POST", "/v1/memory/forget", { agent_id: agentId2, memory_ids: [memoryId2] });
|
|
1073
1122
|
}
|
|
1074
1123
|
/**
|
|
1075
1124
|
* Bulk-recall memories using filter predicates (CE-2).
|
|
@@ -1115,20 +1164,45 @@ var DakeraClient = class {
|
|
|
1115
1164
|
if (options?.min_importance !== void 0) body["min_importance"] = options.min_importance;
|
|
1116
1165
|
if (options?.routing !== void 0) body["routing"] = options.routing;
|
|
1117
1166
|
if (options?.rerank !== void 0) body["rerank"] = options.rerank;
|
|
1118
|
-
const result = await this.request("POST",
|
|
1119
|
-
|
|
1167
|
+
const result = await this.request("POST", "/v1/memory/search", { ...body, agent_id: agentId2 });
|
|
1168
|
+
const items = result.memories ?? result;
|
|
1169
|
+
return (Array.isArray(items) ? items : []).map(flattenRecalledMemory);
|
|
1120
1170
|
}
|
|
1121
1171
|
/** Update importance of memories */
|
|
1122
1172
|
async updateImportance(agentId2, request) {
|
|
1123
|
-
|
|
1173
|
+
let result = { status: "ok" };
|
|
1174
|
+
for (const memoryId2 of request.memory_ids) {
|
|
1175
|
+
result = await this.request("POST", "/v1/memory/importance", {
|
|
1176
|
+
agent_id: agentId2,
|
|
1177
|
+
memory_id: memoryId2,
|
|
1178
|
+
importance: request.importance
|
|
1179
|
+
});
|
|
1180
|
+
}
|
|
1181
|
+
return result;
|
|
1124
1182
|
}
|
|
1125
1183
|
/** Consolidate memories for an agent */
|
|
1126
1184
|
async consolidate(agentId2, request) {
|
|
1127
|
-
return this.request("POST",
|
|
1185
|
+
return this.request("POST", "/v1/memory/consolidate", { ...request ?? {}, agent_id: agentId2 });
|
|
1186
|
+
}
|
|
1187
|
+
/** Consolidate memories directly for an agent (DBSCAN clustering). */
|
|
1188
|
+
async consolidateAgent(agentId2) {
|
|
1189
|
+
return this.request("POST", `/v1/agents/${encodeURIComponent(agentId2)}/consolidate`);
|
|
1190
|
+
}
|
|
1191
|
+
/** Get the consolidation execution log for an agent. */
|
|
1192
|
+
async getConsolidationLog(agentId2) {
|
|
1193
|
+
return this.request("GET", `/v1/agents/${encodeURIComponent(agentId2)}/consolidation/log`);
|
|
1194
|
+
}
|
|
1195
|
+
/** Update the consolidation configuration for an agent. */
|
|
1196
|
+
async patchConsolidationConfig(agentId2, config) {
|
|
1197
|
+
return this.request(
|
|
1198
|
+
"PATCH",
|
|
1199
|
+
`/v1/agents/${encodeURIComponent(agentId2)}/consolidation/config`,
|
|
1200
|
+
config
|
|
1201
|
+
);
|
|
1128
1202
|
}
|
|
1129
1203
|
/** Submit feedback on a memory recall */
|
|
1130
1204
|
async memoryFeedback(agentId2, request) {
|
|
1131
|
-
return this.request("POST",
|
|
1205
|
+
return this.request("POST", "/v1/memory/feedback", { ...request, agent_id: agentId2 });
|
|
1132
1206
|
}
|
|
1133
1207
|
// ===========================================================================
|
|
1134
1208
|
// Memory Feedback Loop — INT-1
|
|
@@ -1248,6 +1322,14 @@ var DakeraClient = class {
|
|
|
1248
1322
|
// =========================================================================
|
|
1249
1323
|
// Entity Extraction Operations (CE-4)
|
|
1250
1324
|
// =========================================================================
|
|
1325
|
+
/** Get entity extraction configuration for a namespace. */
|
|
1326
|
+
async getNamespaceEntityConfig(namespace) {
|
|
1327
|
+
return this.request("GET", `/v1/namespaces/${encodeURIComponent(namespace)}/config`);
|
|
1328
|
+
}
|
|
1329
|
+
/** Get the extractor provider configuration for a namespace. */
|
|
1330
|
+
async getNamespaceExtractor(namespace) {
|
|
1331
|
+
return this.request("GET", `/v1/namespaces/${encodeURIComponent(namespace)}/extractor`);
|
|
1332
|
+
}
|
|
1251
1333
|
/**
|
|
1252
1334
|
* Configure entity extraction for a namespace.
|
|
1253
1335
|
*
|
|
@@ -1274,7 +1356,7 @@ var DakeraClient = class {
|
|
|
1274
1356
|
* @note Requires CE-4 (GLiNER) on the server.
|
|
1275
1357
|
*/
|
|
1276
1358
|
async extractEntities(text, entityTypes) {
|
|
1277
|
-
const body = { text };
|
|
1359
|
+
const body = { content: text };
|
|
1278
1360
|
if (entityTypes !== void 0) {
|
|
1279
1361
|
body["entity_types"] = entityTypes;
|
|
1280
1362
|
}
|
|
@@ -1301,7 +1383,7 @@ var DakeraClient = class {
|
|
|
1301
1383
|
}
|
|
1302
1384
|
/** End a session. Returns the session state and total memory count at close. */
|
|
1303
1385
|
async endSession(sessionId2) {
|
|
1304
|
-
return this.request("POST", `/v1/sessions/${sessionId2}/end
|
|
1386
|
+
return this.request("POST", `/v1/sessions/${sessionId2}/end`, {});
|
|
1305
1387
|
}
|
|
1306
1388
|
/** Get session details */
|
|
1307
1389
|
async getSession(sessionId2) {
|
|
@@ -2203,6 +2285,226 @@ var DakeraClient = class {
|
|
|
2203
2285
|
const body = namespace ? { namespace } : {};
|
|
2204
2286
|
return this.request("POST", "/admin/fulltext/reindex", body);
|
|
2205
2287
|
}
|
|
2288
|
+
// ---------------------------------------------------------------------------
|
|
2289
|
+
// Admin — Cluster & Maintenance
|
|
2290
|
+
// ---------------------------------------------------------------------------
|
|
2291
|
+
/** GET /admin/cluster/replication — cluster replication status. */
|
|
2292
|
+
async adminClusterReplication() {
|
|
2293
|
+
return this.request("GET", "/admin/cluster/replication");
|
|
2294
|
+
}
|
|
2295
|
+
/** GET /admin/cluster/shards — list shards. */
|
|
2296
|
+
async adminListShards() {
|
|
2297
|
+
return this.request("GET", "/admin/cluster/shards");
|
|
2298
|
+
}
|
|
2299
|
+
/** POST /admin/cluster/shards/rebalance — rebalance shards. */
|
|
2300
|
+
async adminRebalanceShards(request) {
|
|
2301
|
+
return this.request("POST", "/admin/cluster/shards/rebalance", request ?? {});
|
|
2302
|
+
}
|
|
2303
|
+
/** GET /admin/cluster/maintenance — maintenance mode status. */
|
|
2304
|
+
async adminMaintenanceStatus() {
|
|
2305
|
+
return this.request("GET", "/admin/cluster/maintenance");
|
|
2306
|
+
}
|
|
2307
|
+
/** POST /admin/cluster/maintenance/enable — enable maintenance mode. */
|
|
2308
|
+
async adminEnableMaintenance(request) {
|
|
2309
|
+
return this.request("POST", "/admin/cluster/maintenance/enable", request);
|
|
2310
|
+
}
|
|
2311
|
+
/** POST /admin/cluster/maintenance/disable — disable maintenance mode. */
|
|
2312
|
+
async adminDisableMaintenance(request) {
|
|
2313
|
+
return this.request("POST", "/admin/cluster/maintenance/disable", request ?? {});
|
|
2314
|
+
}
|
|
2315
|
+
// ---------------------------------------------------------------------------
|
|
2316
|
+
// Admin — Quotas
|
|
2317
|
+
// ---------------------------------------------------------------------------
|
|
2318
|
+
/** GET /admin/quotas — list all namespace quotas. */
|
|
2319
|
+
async adminListQuotas() {
|
|
2320
|
+
return this.request("GET", "/admin/quotas");
|
|
2321
|
+
}
|
|
2322
|
+
/** GET /admin/quotas/default — get default quota configuration. */
|
|
2323
|
+
async adminGetDefaultQuota() {
|
|
2324
|
+
return this.request("GET", "/admin/quotas/default");
|
|
2325
|
+
}
|
|
2326
|
+
/** PUT /admin/quotas/default — set default quota configuration. */
|
|
2327
|
+
async adminSetDefaultQuota(request) {
|
|
2328
|
+
return this.request("PUT", "/admin/quotas/default", request);
|
|
2329
|
+
}
|
|
2330
|
+
/** GET /admin/quotas/{namespace} — get namespace quota. */
|
|
2331
|
+
async adminGetQuota(namespace) {
|
|
2332
|
+
return this.request("GET", `/admin/quotas/${namespace}`);
|
|
2333
|
+
}
|
|
2334
|
+
/** PUT /admin/quotas/{namespace} — set namespace quota. */
|
|
2335
|
+
async adminSetQuota(namespace, request) {
|
|
2336
|
+
return this.request("PUT", `/admin/quotas/${namespace}`, request);
|
|
2337
|
+
}
|
|
2338
|
+
/** DELETE /admin/quotas/{namespace} — remove namespace quota. */
|
|
2339
|
+
async adminDeleteQuota(namespace) {
|
|
2340
|
+
return this.request("DELETE", `/admin/quotas/${namespace}`);
|
|
2341
|
+
}
|
|
2342
|
+
/** POST /admin/quotas/{namespace}/check — check if operation would exceed quota. */
|
|
2343
|
+
async adminCheckQuota(namespace, request) {
|
|
2344
|
+
return this.request("POST", `/admin/quotas/${namespace}/check`, request);
|
|
2345
|
+
}
|
|
2346
|
+
// ---------------------------------------------------------------------------
|
|
2347
|
+
// Admin — Slow Queries
|
|
2348
|
+
// ---------------------------------------------------------------------------
|
|
2349
|
+
/** GET /admin/slow-queries — list recent slow queries. */
|
|
2350
|
+
async adminListSlowQueries(params) {
|
|
2351
|
+
const qs = params ? new URLSearchParams(Object.entries(params).filter(([, v]) => v !== void 0).map(([k, v]) => [k, String(v)])).toString() : "";
|
|
2352
|
+
const path = qs ? `/admin/slow-queries?${qs}` : "/admin/slow-queries";
|
|
2353
|
+
return this.request("GET", path);
|
|
2354
|
+
}
|
|
2355
|
+
/** GET /admin/slow-queries/summary — slow query summary. */
|
|
2356
|
+
async adminSlowQuerySummary() {
|
|
2357
|
+
return this.request("GET", "/admin/slow-queries/summary");
|
|
2358
|
+
}
|
|
2359
|
+
/** DELETE /admin/slow-queries — clear slow query log. */
|
|
2360
|
+
async adminClearSlowQueries(namespace) {
|
|
2361
|
+
const path = namespace ? `/admin/slow-queries?namespace=${encodeURIComponent(namespace)}` : "/admin/slow-queries";
|
|
2362
|
+
return this.request("DELETE", path);
|
|
2363
|
+
}
|
|
2364
|
+
/** PATCH /admin/slow-queries/config — update slow query configuration. */
|
|
2365
|
+
async adminUpdateSlowQueryConfig(config) {
|
|
2366
|
+
return this.request("PATCH", "/admin/slow-queries/config", config);
|
|
2367
|
+
}
|
|
2368
|
+
// ---------------------------------------------------------------------------
|
|
2369
|
+
// Admin — Backups
|
|
2370
|
+
// ---------------------------------------------------------------------------
|
|
2371
|
+
/** GET /admin/backups — list all backups. */
|
|
2372
|
+
async adminListBackups() {
|
|
2373
|
+
return this.request("GET", "/admin/backups");
|
|
2374
|
+
}
|
|
2375
|
+
/** POST /admin/backups — create a new backup. */
|
|
2376
|
+
async adminCreateBackup(request) {
|
|
2377
|
+
return this.request("POST", "/admin/backups", request);
|
|
2378
|
+
}
|
|
2379
|
+
/** GET /admin/backups/{id} — get backup details. */
|
|
2380
|
+
async adminGetBackup(backupId) {
|
|
2381
|
+
return this.request("GET", `/admin/backups/${backupId}`);
|
|
2382
|
+
}
|
|
2383
|
+
/** DELETE /admin/backups/{id} — delete a backup. */
|
|
2384
|
+
async adminDeleteBackup(backupId) {
|
|
2385
|
+
return this.request("DELETE", `/admin/backups/${backupId}`);
|
|
2386
|
+
}
|
|
2387
|
+
/** GET /admin/backups/schedule — get backup schedule. */
|
|
2388
|
+
async adminGetBackupSchedule() {
|
|
2389
|
+
return this.request("GET", "/admin/backups/schedule");
|
|
2390
|
+
}
|
|
2391
|
+
/** POST /admin/backups/schedule — update backup schedule. */
|
|
2392
|
+
async adminUpdateBackupSchedule(request) {
|
|
2393
|
+
return this.request("POST", "/admin/backups/schedule", request);
|
|
2394
|
+
}
|
|
2395
|
+
/** POST /admin/backups/restore — restore from backup. */
|
|
2396
|
+
async adminRestoreBackup(request) {
|
|
2397
|
+
return this.request("POST", "/admin/backups/restore", request);
|
|
2398
|
+
}
|
|
2399
|
+
/** GET /admin/backups/restore/{id} — restore operation status. */
|
|
2400
|
+
async adminGetRestoreStatus(restoreId) {
|
|
2401
|
+
return this.request("GET", `/admin/backups/restore/${restoreId}`);
|
|
2402
|
+
}
|
|
2403
|
+
// ---------------------------------------------------------------------------
|
|
2404
|
+
// Ops — Diagnostics & Jobs
|
|
2405
|
+
// ---------------------------------------------------------------------------
|
|
2406
|
+
/** GET /ops/diagnostics — system diagnostics. */
|
|
2407
|
+
async opsDiagnostics() {
|
|
2408
|
+
return this.request("GET", "/ops/diagnostics");
|
|
2409
|
+
}
|
|
2410
|
+
/** GET /ops/jobs — list background jobs. */
|
|
2411
|
+
async opsListJobs() {
|
|
2412
|
+
return this.request("GET", "/ops/jobs");
|
|
2413
|
+
}
|
|
2414
|
+
/** GET /ops/jobs/{id} — get job status. */
|
|
2415
|
+
async opsGetJob(jobId) {
|
|
2416
|
+
return this.request("GET", `/ops/jobs/${jobId}`);
|
|
2417
|
+
}
|
|
2418
|
+
/** POST /ops/compact — trigger compaction. */
|
|
2419
|
+
async opsCompact(request) {
|
|
2420
|
+
return this.request("POST", "/ops/compact", request ?? {});
|
|
2421
|
+
}
|
|
2422
|
+
/** POST /ops/shutdown — request graceful shutdown. */
|
|
2423
|
+
async opsShutdown() {
|
|
2424
|
+
return this.request("POST", "/ops/shutdown");
|
|
2425
|
+
}
|
|
2426
|
+
// ────────────────────────────────────────────────────────────
|
|
2427
|
+
// Phase 3 — Engine Parity
|
|
2428
|
+
// ────────────────────────────────────────────────────────────
|
|
2429
|
+
/** GET /v1/namespaces/{namespace}/fulltext/stats — full-text index statistics. */
|
|
2430
|
+
async fulltextStats(namespace) {
|
|
2431
|
+
return this.request(
|
|
2432
|
+
"GET",
|
|
2433
|
+
`/v1/namespaces/${encodeURIComponent(namespace)}/fulltext/stats`
|
|
2434
|
+
);
|
|
2435
|
+
}
|
|
2436
|
+
/** POST /v1/namespaces/{namespace}/fulltext/delete — delete documents from full-text index. */
|
|
2437
|
+
async fulltextDelete(namespace, ids) {
|
|
2438
|
+
return this.request(
|
|
2439
|
+
"POST",
|
|
2440
|
+
`/v1/namespaces/${encodeURIComponent(namespace)}/fulltext/delete`,
|
|
2441
|
+
{ ids }
|
|
2442
|
+
);
|
|
2443
|
+
}
|
|
2444
|
+
/** GET /admin/ttl/stats — TTL statistics across all namespaces. */
|
|
2445
|
+
async adminTtlStats() {
|
|
2446
|
+
return this.request("GET", "/admin/ttl/stats");
|
|
2447
|
+
}
|
|
2448
|
+
/** POST /v1/route — route a query to the best-matching namespace(s). */
|
|
2449
|
+
async routeQuery(request) {
|
|
2450
|
+
return this.request("POST", "/v1/route", request);
|
|
2451
|
+
}
|
|
2452
|
+
/** GET /v1/import/{job_id}/status — check import job progress. */
|
|
2453
|
+
async importJobStatus(jobId) {
|
|
2454
|
+
return this.request(
|
|
2455
|
+
"GET",
|
|
2456
|
+
`/v1/import/${encodeURIComponent(jobId)}/status`
|
|
2457
|
+
);
|
|
2458
|
+
}
|
|
2459
|
+
/** GET /admin/backups/{id}/download — download a backup as binary data. */
|
|
2460
|
+
async adminDownloadBackup(backupId) {
|
|
2461
|
+
const url = `${this.baseUrl}/admin/backups/${encodeURIComponent(backupId)}/download`;
|
|
2462
|
+
const response = await fetch(url, {
|
|
2463
|
+
headers: { ...this.headers, Accept: "application/octet-stream" }
|
|
2464
|
+
});
|
|
2465
|
+
if (!response.ok) {
|
|
2466
|
+
throw new Error(`Download failed: ${response.status}`);
|
|
2467
|
+
}
|
|
2468
|
+
return response.arrayBuffer();
|
|
2469
|
+
}
|
|
2470
|
+
/** POST /admin/backups/upload — upload a backup archive. */
|
|
2471
|
+
async adminUploadBackup(data) {
|
|
2472
|
+
const url = `${this.baseUrl}/admin/backups/upload`;
|
|
2473
|
+
const headers = {};
|
|
2474
|
+
if (this.apiKey) {
|
|
2475
|
+
headers["Authorization"] = `Bearer ${this.apiKey}`;
|
|
2476
|
+
}
|
|
2477
|
+
headers["Content-Type"] = "application/gzip";
|
|
2478
|
+
const response = await fetch(url, {
|
|
2479
|
+
method: "POST",
|
|
2480
|
+
headers,
|
|
2481
|
+
body: data instanceof ArrayBuffer ? data : data
|
|
2482
|
+
});
|
|
2483
|
+
if (!response.ok) {
|
|
2484
|
+
throw new Error(`Upload failed: ${response.status}`);
|
|
2485
|
+
}
|
|
2486
|
+
return response.json();
|
|
2487
|
+
}
|
|
2488
|
+
/** GET /admin/storage/tiers — storage tier overview. */
|
|
2489
|
+
async adminStorageTierOverview() {
|
|
2490
|
+
return this.request("GET", "/admin/storage/tiers");
|
|
2491
|
+
}
|
|
2492
|
+
/** GET /admin/background-activity — current background activity. */
|
|
2493
|
+
async adminBackgroundActivity() {
|
|
2494
|
+
return this.request("GET", "/admin/background-activity");
|
|
2495
|
+
}
|
|
2496
|
+
/** GET /admin/memory-type-stats — memory type distribution statistics. */
|
|
2497
|
+
async adminMemoryTypeStats() {
|
|
2498
|
+
return this.request("GET", "/admin/memory-type-stats");
|
|
2499
|
+
}
|
|
2500
|
+
/** POST /admin/namespaces/migrate-dimensions — migrate namespace embedding dimensions. */
|
|
2501
|
+
async adminMigrateNamespaceDimensions(request) {
|
|
2502
|
+
return this.request(
|
|
2503
|
+
"POST",
|
|
2504
|
+
"/admin/namespaces/migrate-dimensions",
|
|
2505
|
+
request ?? {}
|
|
2506
|
+
);
|
|
2507
|
+
}
|
|
2206
2508
|
};
|
|
2207
2509
|
|
|
2208
2510
|
// src/types.ts
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dakera-ai/dakera",
|
|
3
|
-
"version": "0.11.
|
|
3
|
+
"version": "0.11.56",
|
|
4
4
|
"description": "TypeScript/JavaScript SDK for Dakera AI memory platform",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/index.mjs",
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"dev": "tsup src/index.ts --format cjs,esm --dts --watch",
|
|
22
22
|
"test": "vitest run",
|
|
23
23
|
"test:watch": "vitest",
|
|
24
|
-
"lint": "eslint src
|
|
24
|
+
"lint": "eslint src/",
|
|
25
25
|
"typecheck": "tsc --noEmit",
|
|
26
26
|
"prepublishOnly": "npm run build"
|
|
27
27
|
},
|
|
@@ -56,10 +56,12 @@
|
|
|
56
56
|
"node": ">=20.12.0"
|
|
57
57
|
},
|
|
58
58
|
"devDependencies": {
|
|
59
|
+
"@eslint/js": "^10.0.1",
|
|
59
60
|
"@types/node": "^25.6.0",
|
|
60
61
|
"eslint": "^10.1.0",
|
|
61
62
|
"tsup": "^8.0.1",
|
|
62
63
|
"typescript": "^6.0.0",
|
|
64
|
+
"typescript-eslint": "^8.59.3",
|
|
63
65
|
"vitest": "^4.1.0"
|
|
64
66
|
},
|
|
65
67
|
"overrides": {
|