@smartmemory/sdk-js 1.4.25 → 1.4.26
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-CLtPrdbi.js → core-sjVwMmLA.js} +295 -272
- package/dist/core.js +1 -1
- package/dist/index.js +1 -1
- package/dist/react.js +1 -1
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ var I = (i) => {
|
|
|
2
2
|
throw TypeError(i);
|
|
3
3
|
};
|
|
4
4
|
var $ = (i, e, t) => e.has(i) || I("Cannot " + t);
|
|
5
|
-
var p = (i, e, t) => ($(i, e, "read from private field"), t ? t.call(i) : e.get(i)), k = (i, e, t) => e.has(i) ? I("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), w = (i, e, t,
|
|
5
|
+
var p = (i, e, t) => ($(i, e, "read from private field"), t ? t.call(i) : e.get(i)), k = (i, e, t) => e.has(i) ? I("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), w = (i, e, t, s) => ($(i, e, "write to private field"), s ? s.call(i, t) : e.set(i, t), t), S = (i, e, t) => ($(i, e, "access private method"), t);
|
|
6
6
|
const R = {
|
|
7
7
|
access: "smart_memory_auth_token",
|
|
8
8
|
refresh: "smart_memory_refresh_token",
|
|
@@ -112,14 +112,14 @@ class U {
|
|
|
112
112
|
/** @private */
|
|
113
113
|
_getFromStorage(e, t = []) {
|
|
114
114
|
try {
|
|
115
|
-
const
|
|
115
|
+
const s = this.storageType === "localStorage" ? localStorage : sessionStorage, r = this.storageType === "localStorage" ? sessionStorage : localStorage, n = s.getItem(e) || r.getItem(e);
|
|
116
116
|
if (n != null) return n;
|
|
117
117
|
for (const a of t) {
|
|
118
|
-
const c =
|
|
118
|
+
const c = s.getItem(a) || r.getItem(a);
|
|
119
119
|
if (c != null) {
|
|
120
120
|
this._setInStorage(e, c);
|
|
121
121
|
try {
|
|
122
|
-
|
|
122
|
+
s.removeItem(a), r.removeItem(a);
|
|
123
123
|
} catch {
|
|
124
124
|
}
|
|
125
125
|
return c;
|
|
@@ -133,10 +133,10 @@ class U {
|
|
|
133
133
|
/** @private */
|
|
134
134
|
_setInStorage(e, t) {
|
|
135
135
|
try {
|
|
136
|
-
const
|
|
137
|
-
t != null ? (
|
|
138
|
-
} catch (
|
|
139
|
-
console.error("Failed to write to storage:",
|
|
136
|
+
const s = this.storageType === "localStorage" ? localStorage : sessionStorage, r = this.storageType === "localStorage" ? sessionStorage : localStorage;
|
|
137
|
+
t != null ? (s.setItem(e, t), r.removeItem(e)) : (s.removeItem(e), r.removeItem(e));
|
|
138
|
+
} catch (s) {
|
|
139
|
+
console.error("Failed to write to storage:", s);
|
|
140
140
|
}
|
|
141
141
|
}
|
|
142
142
|
/** @private */
|
|
@@ -144,8 +144,8 @@ class U {
|
|
|
144
144
|
if (e == null) return null;
|
|
145
145
|
const t = String(e).trim();
|
|
146
146
|
if (!t) return null;
|
|
147
|
-
const
|
|
148
|
-
return
|
|
147
|
+
const s = t.toLowerCase();
|
|
148
|
+
return s === "none" || s === "null" || s === "undefined" ? null : t;
|
|
149
149
|
}
|
|
150
150
|
}
|
|
151
151
|
var m, d, T;
|
|
@@ -159,10 +159,10 @@ class P {
|
|
|
159
159
|
* @param {function(string): void} options.onTokenRefreshed
|
|
160
160
|
* @param {function(): void} options.onRefreshFailed
|
|
161
161
|
*/
|
|
162
|
-
constructor({ apiBaseUrl: e, refreshEndpoint: t, tokenManager:
|
|
162
|
+
constructor({ apiBaseUrl: e, refreshEndpoint: t, tokenManager: s, useCookieAuth: r = !1, onTokenRefreshed: n, onRefreshFailed: a }) {
|
|
163
163
|
k(this, d);
|
|
164
164
|
k(this, m, null);
|
|
165
|
-
this.apiBaseUrl = e, this.refreshEndpoint = t, this.tokenManager =
|
|
165
|
+
this.apiBaseUrl = e, this.refreshEndpoint = t, this.tokenManager = s, this.useCookieAuth = r, this.onTokenRefreshed = n, this.onRefreshFailed = a;
|
|
166
166
|
}
|
|
167
167
|
async refresh() {
|
|
168
168
|
if (p(this, m))
|
|
@@ -179,16 +179,16 @@ m = new WeakMap(), d = new WeakSet(), T = async function() {
|
|
|
179
179
|
const e = this.tokenManager.getRefreshToken();
|
|
180
180
|
if (!e && !this.useCookieAuth)
|
|
181
181
|
throw this.onRefreshFailed(), new Error("No refresh token");
|
|
182
|
-
const t = JSON.stringify(e ? { refresh_token: e } : {}),
|
|
182
|
+
const t = JSON.stringify(e ? { refresh_token: e } : {}), s = await fetch(`${this.apiBaseUrl}${this.refreshEndpoint}`, {
|
|
183
183
|
...this.useCookieAuth ? { credentials: "include" } : {},
|
|
184
184
|
method: "POST",
|
|
185
185
|
headers: { "Content-Type": "application/json" },
|
|
186
186
|
body: t
|
|
187
187
|
});
|
|
188
|
-
if (!
|
|
189
|
-
throw this.onRefreshFailed(), new Error(`Refresh failed: ${
|
|
190
|
-
const
|
|
191
|
-
return this.tokenManager.setAccessToken(
|
|
188
|
+
if (!s.ok)
|
|
189
|
+
throw this.onRefreshFailed(), new Error(`Refresh failed: ${s.status}`);
|
|
190
|
+
const r = await s.json();
|
|
191
|
+
return this.tokenManager.setAccessToken(r.access_token), r.refresh_token && this.tokenManager.setRefreshToken(r.refresh_token), this.onTokenRefreshed(r.access_token), r.access_token;
|
|
192
192
|
};
|
|
193
193
|
const b = "smart_memory_sso_redirect";
|
|
194
194
|
class C {
|
|
@@ -198,8 +198,8 @@ class C {
|
|
|
198
198
|
* @param {string[]} [options.allowedHosts=[]] - Allowed redirect hostnames
|
|
199
199
|
* @param {import('./TokenManager.js').TokenManager} options.tokenManager
|
|
200
200
|
*/
|
|
201
|
-
constructor({ webAppUrl: e, allowedHosts: t = [], tokenManager:
|
|
202
|
-
this.webAppUrl = e, this.allowedHosts = t, this.tokenManager =
|
|
201
|
+
constructor({ webAppUrl: e, allowedHosts: t = [], tokenManager: s }) {
|
|
202
|
+
this.webAppUrl = e, this.allowedHosts = t, this.tokenManager = s;
|
|
203
203
|
}
|
|
204
204
|
getLoginUrl(e) {
|
|
205
205
|
const t = e || `${window.location.origin}/auth/callback`;
|
|
@@ -230,7 +230,7 @@ class C {
|
|
|
230
230
|
}
|
|
231
231
|
}
|
|
232
232
|
}
|
|
233
|
-
class
|
|
233
|
+
class M {
|
|
234
234
|
constructor(e) {
|
|
235
235
|
this.mode = e.mode, this.apiBaseUrl = e.apiBaseUrl, this.endpoints = e.endpoints || {}, this.listeners = /* @__PURE__ */ new Set(), this.useCookieAuth = e.useCookieAuth ?? this.mode === "sso", this.apiKey = e.apiKey || null, this.apiKey && (this.mode = "apiKey"), this.tokenManager = new U({
|
|
236
236
|
storage: e.storage || "localStorage",
|
|
@@ -241,8 +241,8 @@ class L {
|
|
|
241
241
|
tokenManager: this.tokenManager,
|
|
242
242
|
useCookieAuth: this.useCookieAuth,
|
|
243
243
|
onTokenRefreshed: (t) => {
|
|
244
|
-
var
|
|
245
|
-
this.currentToken = t, this.notifyListeners(), (
|
|
244
|
+
var s;
|
|
245
|
+
this.currentToken = t, this.notifyListeners(), (s = e.onTokenRefresh) == null || s.call(e, t);
|
|
246
246
|
},
|
|
247
247
|
onRefreshFailed: () => {
|
|
248
248
|
this.clearLocalAuth();
|
|
@@ -266,14 +266,14 @@ class L {
|
|
|
266
266
|
return this.tokenManager.getTenantId();
|
|
267
267
|
}
|
|
268
268
|
hasRole(e) {
|
|
269
|
-
var t,
|
|
270
|
-
return ((
|
|
269
|
+
var t, s;
|
|
270
|
+
return ((s = (t = this.currentUser) == null ? void 0 : t.roles) == null ? void 0 : s.includes(e)) || !1;
|
|
271
271
|
}
|
|
272
272
|
getAuthHeaders(e = {}) {
|
|
273
273
|
const t = { ...e };
|
|
274
274
|
this.currentToken && (t.Authorization = this.currentToken.startsWith("Bearer ") ? this.currentToken : `Bearer ${this.currentToken}`);
|
|
275
|
-
const
|
|
276
|
-
return
|
|
275
|
+
const s = this.tokenManager.getTeamId();
|
|
276
|
+
return s && (t["X-Workspace-Id"] = s), t;
|
|
277
277
|
}
|
|
278
278
|
getRequestOptions(e = {}) {
|
|
279
279
|
return this.useCookieAuth ? { credentials: "include", ...e } : { ...e };
|
|
@@ -291,8 +291,8 @@ class L {
|
|
|
291
291
|
this.listeners.forEach((t) => {
|
|
292
292
|
try {
|
|
293
293
|
t(e);
|
|
294
|
-
} catch (
|
|
295
|
-
console.error("Auth listener error:",
|
|
294
|
+
} catch (s) {
|
|
295
|
+
console.error("Auth listener error:", s);
|
|
296
296
|
}
|
|
297
297
|
});
|
|
298
298
|
}
|
|
@@ -341,11 +341,11 @@ class L {
|
|
|
341
341
|
let t = await fetch(
|
|
342
342
|
e,
|
|
343
343
|
this.getRequestOptions({ method: "GET", headers: this.getAuthHeaders() })
|
|
344
|
-
),
|
|
344
|
+
), s = !1;
|
|
345
345
|
if (!t.ok && (this.currentToken || this.tokenManager.getTeamId()) && (t = await fetch(
|
|
346
346
|
e,
|
|
347
347
|
this.getRequestOptions({ method: "GET", headers: {} })
|
|
348
|
-
),
|
|
348
|
+
), s = t.ok), !t.ok && t.status === 401 && this.refreshManager)
|
|
349
349
|
try {
|
|
350
350
|
await this.refreshManager.refresh(), t = await fetch(
|
|
351
351
|
e,
|
|
@@ -354,10 +354,10 @@ class L {
|
|
|
354
354
|
} catch {
|
|
355
355
|
}
|
|
356
356
|
if (!t.ok) return !1;
|
|
357
|
-
const
|
|
358
|
-
this.currentUser =
|
|
359
|
-
const n = (
|
|
360
|
-
return n && (this.tokenManager.setTeamId(n), this.tokenManager.setTenantId((
|
|
357
|
+
const r = await t.json();
|
|
358
|
+
this.currentUser = r, this.tokenManager.setUser(r);
|
|
359
|
+
const n = (r == null ? void 0 : r.default_team_id) || this.tokenManager.getTeamId() || null;
|
|
360
|
+
return n && (this.tokenManager.setTeamId(n), this.tokenManager.setTenantId((r == null ? void 0 : r.tenant_id) || n)), s && (this.tokenManager.setAccessToken(null), this.currentToken = null, r != null && r.default_team_id && this.tokenManager.setTeamId(r.default_team_id)), this.notifyListeners(), !0;
|
|
361
361
|
} catch {
|
|
362
362
|
return !1;
|
|
363
363
|
}
|
|
@@ -372,11 +372,11 @@ class g extends Error {
|
|
|
372
372
|
* @param {number} [status=0] - HTTP status code (0 for network errors)
|
|
373
373
|
* @param {Object|null} [detail=null] - Error detail from API response
|
|
374
374
|
*/
|
|
375
|
-
constructor(e, t = 0,
|
|
376
|
-
super(e), this.name = "APIError", this.status = t, this.detail =
|
|
375
|
+
constructor(e, t = 0, s = null) {
|
|
376
|
+
super(e), this.name = "APIError", this.status = t, this.detail = s;
|
|
377
377
|
}
|
|
378
378
|
}
|
|
379
|
-
class
|
|
379
|
+
class L {
|
|
380
380
|
/**
|
|
381
381
|
* @param {import('../auth/AuthCore.js').AuthCore} authCore
|
|
382
382
|
* @param {{ fetchFn?: typeof globalThis.fetch }} [options]
|
|
@@ -389,12 +389,12 @@ class M {
|
|
|
389
389
|
}
|
|
390
390
|
async request(e, t = {}) {
|
|
391
391
|
var a, c;
|
|
392
|
-
const
|
|
392
|
+
const s = `${this.baseURL}${e}`, r = {
|
|
393
393
|
"Content-Type": "application/json",
|
|
394
394
|
...this.auth.getAuthHeaders(t.headers)
|
|
395
|
-
}, n = this.auth.getRequestOptions({ ...t, headers:
|
|
395
|
+
}, n = this.auth.getRequestOptions({ ...t, headers: r });
|
|
396
396
|
try {
|
|
397
|
-
let o = await this.fetchFn(
|
|
397
|
+
let o = await this.fetchFn(s, n);
|
|
398
398
|
if (o.status === 401 && !t.__isRetry)
|
|
399
399
|
try {
|
|
400
400
|
await this.auth.refreshToken();
|
|
@@ -403,7 +403,7 @@ class M {
|
|
|
403
403
|
...this.auth.getAuthHeaders(t.headers)
|
|
404
404
|
};
|
|
405
405
|
o = await this.fetchFn(
|
|
406
|
-
|
|
406
|
+
s,
|
|
407
407
|
this.auth.getRequestOptions({ ...n, headers: u, __isRetry: !0 })
|
|
408
408
|
);
|
|
409
409
|
} catch {
|
|
@@ -422,23 +422,23 @@ class M {
|
|
|
422
422
|
async get(e, t = {}) {
|
|
423
423
|
return this.request(e, { ...t, method: "GET" });
|
|
424
424
|
}
|
|
425
|
-
async post(e, t,
|
|
425
|
+
async post(e, t, s = {}) {
|
|
426
426
|
return this.request(e, {
|
|
427
|
-
...
|
|
427
|
+
...s,
|
|
428
428
|
method: "POST",
|
|
429
429
|
body: JSON.stringify(t)
|
|
430
430
|
});
|
|
431
431
|
}
|
|
432
|
-
async put(e, t,
|
|
432
|
+
async put(e, t, s = {}) {
|
|
433
433
|
return this.request(e, {
|
|
434
|
-
...
|
|
434
|
+
...s,
|
|
435
435
|
method: "PUT",
|
|
436
436
|
body: JSON.stringify(t)
|
|
437
437
|
});
|
|
438
438
|
}
|
|
439
|
-
async patch(e, t,
|
|
439
|
+
async patch(e, t, s = {}) {
|
|
440
440
|
return this.request(e, {
|
|
441
|
-
...
|
|
441
|
+
...s,
|
|
442
442
|
method: "PATCH",
|
|
443
443
|
body: JSON.stringify(t)
|
|
444
444
|
});
|
|
@@ -448,20 +448,43 @@ class M {
|
|
|
448
448
|
}
|
|
449
449
|
/** @private */
|
|
450
450
|
async _handleError(e) {
|
|
451
|
-
var
|
|
451
|
+
var r, n;
|
|
452
452
|
let t;
|
|
453
|
-
const
|
|
453
|
+
const s = (n = (r = e.headers) == null ? void 0 : r.get) == null ? void 0 : n.call(r, "content-type");
|
|
454
454
|
try {
|
|
455
|
-
|
|
455
|
+
s != null && s.includes("application/json") ? t = await e.json() : t = { message: await e.text() };
|
|
456
456
|
} catch {
|
|
457
457
|
t = { message: `HTTP ${e.status}` };
|
|
458
458
|
}
|
|
459
459
|
return new g(
|
|
460
|
-
|
|
460
|
+
this._extractMessage(t, e.status),
|
|
461
461
|
e.status,
|
|
462
462
|
t
|
|
463
463
|
);
|
|
464
464
|
}
|
|
465
|
+
/**
|
|
466
|
+
* Coerce a FastAPI/JSON error body into a human-readable string.
|
|
467
|
+
*
|
|
468
|
+
* FastAPI's `detail` may be a plain string, a structured object
|
|
469
|
+
* (e.g. `{code, current_version}`), or an array of 422 validation errors.
|
|
470
|
+
* Passing a non-string straight to `new APIError(message)` makes the Error
|
|
471
|
+
* base coerce it to the literal `"[object Object]"` — which the BETA-NDA-1
|
|
472
|
+
* gate rendered to the user on a 409 version_mismatch. Always return a string;
|
|
473
|
+
* the full body is still preserved on `error.detail` (3rd APIError arg) so
|
|
474
|
+
* callers like ndaGate.js can read `error.detail.detail.code`.
|
|
475
|
+
* @private
|
|
476
|
+
*/
|
|
477
|
+
_extractMessage(e, t) {
|
|
478
|
+
var r;
|
|
479
|
+
const s = e == null ? void 0 : e.detail;
|
|
480
|
+
if (typeof s == "string") return s;
|
|
481
|
+
if (s && typeof s == "object") {
|
|
482
|
+
if (typeof s.message == "string") return s.message;
|
|
483
|
+
if (typeof s.code == "string") return s.code;
|
|
484
|
+
if (Array.isArray(s) && typeof ((r = s[0]) == null ? void 0 : r.msg) == "string") return s[0].msg;
|
|
485
|
+
}
|
|
486
|
+
return typeof (e == null ? void 0 : e.message) == "string" ? e.message : `HTTP ${t}`;
|
|
487
|
+
}
|
|
465
488
|
}
|
|
466
489
|
class z {
|
|
467
490
|
constructor(e) {
|
|
@@ -470,16 +493,16 @@ class z {
|
|
|
470
493
|
async create({
|
|
471
494
|
content: e,
|
|
472
495
|
memoryType: t = "semantic",
|
|
473
|
-
metadata:
|
|
474
|
-
usePipeline:
|
|
496
|
+
metadata: s = null,
|
|
497
|
+
usePipeline: r = !0,
|
|
475
498
|
profileName: n = null,
|
|
476
499
|
conversationContext: a = null
|
|
477
500
|
}) {
|
|
478
501
|
const c = {
|
|
479
502
|
content: e,
|
|
480
503
|
memory_type: t,
|
|
481
|
-
metadata:
|
|
482
|
-
use_pipeline:
|
|
504
|
+
metadata: s,
|
|
505
|
+
use_pipeline: r,
|
|
483
506
|
profile_name: n
|
|
484
507
|
};
|
|
485
508
|
return a != null && (c.conversation_context = a), this.api.post("/memory/add", c);
|
|
@@ -507,9 +530,9 @@ class z {
|
|
|
507
530
|
async delete(e) {
|
|
508
531
|
return this.api.delete(`/memory/${e}`);
|
|
509
532
|
}
|
|
510
|
-
async list({ limit: e = 50, offset: t = 0, type:
|
|
511
|
-
let
|
|
512
|
-
return
|
|
533
|
+
async list({ limit: e = 50, offset: t = 0, type: s = null } = {}) {
|
|
534
|
+
let r = `/memory/list?limit=${e}&offset=${t}`;
|
|
535
|
+
return s && (r += `&memory_type=${s}`), this.api.get(r);
|
|
513
536
|
}
|
|
514
537
|
/**
|
|
515
538
|
* Search for memory items.
|
|
@@ -540,32 +563,32 @@ class z {
|
|
|
540
563
|
* present only under `cite: true`. Pre-LINEAGE-1 callers who indexed into a
|
|
541
564
|
* bare array must read `response.results` instead.
|
|
542
565
|
*/
|
|
543
|
-
async search(e, { topK: t = 5, enableHybrid:
|
|
544
|
-
const l = { query: e, top_k: t, enable_hybrid:
|
|
545
|
-
return
|
|
566
|
+
async search(e, { topK: t = 5, enableHybrid: s = !0, memoryType: r = null, expertise: n = !1, cite: a = !1, decompose: c = !1, multiHop: o = !1, maxHops: u = 3, budgetMs: y = 1500, semanticHops: f = !1, includeReference: _ = !1, includeConsolidated: v = !1, consolidationFirst: A = !1 } = {}) {
|
|
567
|
+
const l = { query: e, top_k: t, enable_hybrid: s };
|
|
568
|
+
return r && (l.memory_type = r), n && (l.expertise = !0), a && (l.cite = !0), c && (l.decompose = !0), o && (l.multi_hop = !0), o && u !== 3 && (l.max_hops = u), o && y !== 1500 && (l.budget_ms = y), o && f && (l.semantic_hops = !0), _ && (l.include_reference = !0), v && (l.include_consolidated = !0), A && (l.consolidation_first = !0), this.api.post("/memory/search", l);
|
|
546
569
|
}
|
|
547
|
-
async getWorkingContext(e, t, { k:
|
|
570
|
+
async getWorkingContext(e, t, { k: s = 20, maxTokens: r = null, strategy: n = null } = {}) {
|
|
548
571
|
const a = {
|
|
549
572
|
session_id: e,
|
|
550
573
|
query: t,
|
|
551
|
-
k:
|
|
574
|
+
k: s
|
|
552
575
|
};
|
|
553
|
-
return
|
|
576
|
+
return r != null && (a.max_tokens = r), n != null && (a.strategy = n), this.api.post("/memory/context", a);
|
|
554
577
|
}
|
|
555
|
-
async searchAdvanced(e, { algorithm: t = "query_traversal", maxResults:
|
|
578
|
+
async searchAdvanced(e, { algorithm: t = "query_traversal", maxResults: s = 15, useSSG: r = !0 } = {}) {
|
|
556
579
|
return this.api.post("/memory/search/advanced", {
|
|
557
580
|
query: e,
|
|
558
581
|
algorithm: t,
|
|
559
|
-
max_results:
|
|
560
|
-
use_ssg:
|
|
582
|
+
max_results: s,
|
|
583
|
+
use_ssg: r
|
|
561
584
|
});
|
|
562
585
|
}
|
|
563
|
-
async ingest(e, { profileName: t = null, extractorName:
|
|
586
|
+
async ingest(e, { profileName: t = null, extractorName: s = "llm", context: r = {} } = {}) {
|
|
564
587
|
return this.api.post("/memory/ingest", {
|
|
565
588
|
content: e,
|
|
566
589
|
profile_name: t,
|
|
567
|
-
extractor_name:
|
|
568
|
-
context:
|
|
590
|
+
extractor_name: s,
|
|
591
|
+
context: r
|
|
569
592
|
});
|
|
570
593
|
}
|
|
571
594
|
async getLineage(e) {
|
|
@@ -574,9 +597,9 @@ class z {
|
|
|
574
597
|
async getLinks(e) {
|
|
575
598
|
return this.api.get(`/memory/${e}/links`);
|
|
576
599
|
}
|
|
577
|
-
async searchByMetadata(e, t, { memoryType:
|
|
578
|
-
const
|
|
579
|
-
return
|
|
600
|
+
async searchByMetadata(e, t, { memoryType: s = null } = {}) {
|
|
601
|
+
const r = new URLSearchParams({ metadata_key: e, metadata_value: t });
|
|
602
|
+
return s && r.append("memory_type", s), this.api.get(`/memory/by-metadata?${r}`);
|
|
580
603
|
}
|
|
581
604
|
async getNeighbors(e) {
|
|
582
605
|
return this.api.get(`/memory/${e}/neighbors`);
|
|
@@ -586,43 +609,43 @@ class z {
|
|
|
586
609
|
}
|
|
587
610
|
async ingestConversation(e, {
|
|
588
611
|
sessionBoundaries: t = null,
|
|
589
|
-
conversationId:
|
|
590
|
-
sessionDates:
|
|
612
|
+
conversationId: s = null,
|
|
613
|
+
sessionDates: r = null,
|
|
591
614
|
turnsPerChunk: n = 15,
|
|
592
615
|
maxChunkChars: a = 12e3,
|
|
593
616
|
maxConcurrent: c = 4
|
|
594
617
|
} = {}) {
|
|
595
618
|
const o = { turns: e, turns_per_chunk: n, max_chunk_chars: a, max_concurrent: c };
|
|
596
|
-
return t && (o.session_boundaries = t),
|
|
619
|
+
return t && (o.session_boundaries = t), s && (o.conversation_id = s), r && (o.session_dates = r), this.api.post("/memory/ingest/conversation", o);
|
|
597
620
|
}
|
|
598
|
-
async ingestDocument(e, { title: t = null, source:
|
|
621
|
+
async ingestDocument(e, { title: t = null, source: s = null, chunkStrategy: r = null } = {}) {
|
|
599
622
|
const n = { content: e };
|
|
600
|
-
return t && (n.title = t),
|
|
623
|
+
return t && (n.title = t), s && (n.source = s), r && (n.chunk_strategy = r), this.api.post("/memory/ingest/document", n);
|
|
601
624
|
}
|
|
602
|
-
async codeIndex(e, { repo: t = null, commit:
|
|
603
|
-
const
|
|
604
|
-
return t && (
|
|
625
|
+
async codeIndex(e, { repo: t = null, commit: s = null } = {}) {
|
|
626
|
+
const r = { path: e };
|
|
627
|
+
return t && (r.repo = t), s && (r.commit = s), this.api.post("/memory/code/index", r);
|
|
605
628
|
}
|
|
606
|
-
async codeSearch(e, { entityType: t = null, repo:
|
|
607
|
-
const a = new URLSearchParams({ query: e, limit:
|
|
608
|
-
return t && a.append("entity_type", t),
|
|
629
|
+
async codeSearch(e, { entityType: t = null, repo: s = null, limit: r = 20, semantic: n = !1 } = {}) {
|
|
630
|
+
const a = new URLSearchParams({ query: e, limit: r, semantic: n });
|
|
631
|
+
return t && a.append("entity_type", t), s && a.append("repo", s), this.api.get(`/memory/code/search?${a}`);
|
|
609
632
|
}
|
|
610
633
|
async codeContext(e, { repo: t = null } = {}) {
|
|
611
|
-
const
|
|
612
|
-
return t &&
|
|
634
|
+
const s = new URLSearchParams({ entity_name: e });
|
|
635
|
+
return t && s.append("repo", t), this.api.get(`/memory/code/context?${s}`);
|
|
613
636
|
}
|
|
614
637
|
async codeDeadCode(e) {
|
|
615
638
|
return this.api.get(`/memory/code/dead-code?repo=${encodeURIComponent(e)}`);
|
|
616
639
|
}
|
|
617
|
-
async codeDependencies(e, { direction: t = "both", repo:
|
|
618
|
-
const
|
|
619
|
-
return
|
|
640
|
+
async codeDependencies(e, { direction: t = "both", repo: s = null } = {}) {
|
|
641
|
+
const r = new URLSearchParams({ entity_name: e, direction: t });
|
|
642
|
+
return s && r.append("repo", s), this.api.get(`/memory/code/dependencies?${r}`);
|
|
620
643
|
}
|
|
621
644
|
async getPlan(e) {
|
|
622
645
|
return this.api.get(`/memory/plans/${e}`);
|
|
623
646
|
}
|
|
624
|
-
async updatePlanTask(e, { taskId: t, status:
|
|
625
|
-
return this.api.patch(`/memory/plans/${e}/task`, { task_id: t, status:
|
|
647
|
+
async updatePlanTask(e, { taskId: t, status: s }) {
|
|
648
|
+
return this.api.patch(`/memory/plans/${e}/task`, { task_id: t, status: s });
|
|
626
649
|
}
|
|
627
650
|
async completePlan(e, { graduate: t = !1 } = {}) {
|
|
628
651
|
return this.api.post(`/memory/plans/${e}/complete`, { graduate: t });
|
|
@@ -630,11 +653,11 @@ class z {
|
|
|
630
653
|
async failPlan(e, t) {
|
|
631
654
|
return this.api.post(`/memory/plans/${e}/fail`, { reason: t });
|
|
632
655
|
}
|
|
633
|
-
async link(e, t,
|
|
656
|
+
async link(e, t, s = "RELATED") {
|
|
634
657
|
return this.api.post("/memory/link", {
|
|
635
658
|
source_id: e,
|
|
636
659
|
target_id: t,
|
|
637
|
-
link_type:
|
|
660
|
+
link_type: s
|
|
638
661
|
});
|
|
639
662
|
}
|
|
640
663
|
async enrich(e, t = []) {
|
|
@@ -658,44 +681,44 @@ class z {
|
|
|
658
681
|
* @param {string} [query] - Original query that produced these results.
|
|
659
682
|
* @returns {Promise<{updated: number, edges_strengthened: number, outcome: string}>}
|
|
660
683
|
*/
|
|
661
|
-
async feedback(e, t,
|
|
662
|
-
const
|
|
663
|
-
return
|
|
684
|
+
async feedback(e, t, s = null) {
|
|
685
|
+
const r = { item_ids: e, outcome: t };
|
|
686
|
+
return s != null && (r.query = s), this.api.post("/memory/feedback", r);
|
|
664
687
|
}
|
|
665
|
-
async ground(e, t,
|
|
688
|
+
async ground(e, t, s = null) {
|
|
666
689
|
return this.api.post(`/memory/${e}/ground`, {
|
|
667
690
|
item_id: e,
|
|
668
691
|
source_url: t,
|
|
669
|
-
validation:
|
|
692
|
+
validation: s
|
|
670
693
|
});
|
|
671
694
|
}
|
|
672
695
|
async clearAll(e = !1) {
|
|
673
696
|
return this.api.delete(`/memory/clear-all?nuclear=${e}`);
|
|
674
697
|
}
|
|
675
698
|
// --- Temporal ---
|
|
676
|
-
async getHistory(e, { startTime: t = null, endTime:
|
|
677
|
-
let n = `/memory/temporal/${e}/history?limit=${
|
|
678
|
-
return t && (n += `&start_time=${t}`),
|
|
699
|
+
async getHistory(e, { startTime: t = null, endTime: s = null, limit: r = 100 } = {}) {
|
|
700
|
+
let n = `/memory/temporal/${e}/history?limit=${r}`;
|
|
701
|
+
return t && (n += `&start_time=${t}`), s && (n += `&end_time=${s}`), this.api.get(n);
|
|
679
702
|
}
|
|
680
|
-
async timeTravel(e, { query: t = null, limit:
|
|
681
|
-
let
|
|
682
|
-
return t && (
|
|
703
|
+
async timeTravel(e, { query: t = null, limit: s = 100 } = {}) {
|
|
704
|
+
let r = `/memory/temporal/at/${e}?limit=${s}`;
|
|
705
|
+
return t && (r += `&query=${encodeURIComponent(t)}`), this.api.get(r);
|
|
683
706
|
}
|
|
684
707
|
async getItemAtTime(e, t) {
|
|
685
708
|
return this.api.get(`/memory/temporal/${e}/at/${t}`);
|
|
686
709
|
}
|
|
687
|
-
async getChanges(e, { since: t = null, until:
|
|
710
|
+
async getChanges(e, { since: t = null, until: s = null, changeType: r = null } = {}) {
|
|
688
711
|
let n = `/memory/temporal/${e}/changes`;
|
|
689
712
|
const a = [];
|
|
690
|
-
return t && a.push(`since=${t}`),
|
|
713
|
+
return t && a.push(`since=${t}`), s && a.push(`until=${s}`), r && a.push(`change_type=${r}`), a.length && (n += `?${a.join("&")}`), this.api.get(n);
|
|
691
714
|
}
|
|
692
|
-
async compareVersions(e, t,
|
|
693
|
-
return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${
|
|
715
|
+
async compareVersions(e, t, s) {
|
|
716
|
+
return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${s}`);
|
|
694
717
|
}
|
|
695
|
-
async rollback(e, { toVersion: t = null, toTime:
|
|
696
|
-
let
|
|
718
|
+
async rollback(e, { toVersion: t = null, toTime: s = null } = {}) {
|
|
719
|
+
let r = `/memory/temporal/${e}/rollback`;
|
|
697
720
|
const n = [];
|
|
698
|
-
return t !== null && n.push(`to_version=${t}`),
|
|
721
|
+
return t !== null && n.push(`to_version=${t}`), s && n.push(`to_time=${s}`), n.length && (r += `?${n.join("&")}`), this.api.post(r);
|
|
699
722
|
}
|
|
700
723
|
// --- Clustering ---
|
|
701
724
|
async runClustering(e = 0.1, t = !1) {
|
|
@@ -727,8 +750,8 @@ class E {
|
|
|
727
750
|
async create({
|
|
728
751
|
content: e,
|
|
729
752
|
decisionType: t = "inference",
|
|
730
|
-
confidence:
|
|
731
|
-
sourceTraceId:
|
|
753
|
+
confidence: s = 0.8,
|
|
754
|
+
sourceTraceId: r = null,
|
|
732
755
|
sourceSessionId: n = null,
|
|
733
756
|
evidenceIds: a = null,
|
|
734
757
|
domain: c = null,
|
|
@@ -741,8 +764,8 @@ class E {
|
|
|
741
764
|
return this.api.post("/memory/decisions/create", {
|
|
742
765
|
content: e,
|
|
743
766
|
decision_type: t,
|
|
744
|
-
confidence:
|
|
745
|
-
source_trace_id:
|
|
767
|
+
confidence: s,
|
|
768
|
+
source_trace_id: r,
|
|
746
769
|
source_session_id: n,
|
|
747
770
|
evidence_ids: a,
|
|
748
771
|
domain: c,
|
|
@@ -850,8 +873,8 @@ class E {
|
|
|
850
873
|
* @param {string} [options.direction='both'] - causes|effects|both
|
|
851
874
|
* @param {number} [options.maxDepth=3]
|
|
852
875
|
*/
|
|
853
|
-
async getCausalChain(e, { direction: t = "both", maxDepth:
|
|
854
|
-
return this.api.get(`/memory/decisions/${e}/causal-chain?direction=${t}&max_depth=${
|
|
876
|
+
async getCausalChain(e, { direction: t = "both", maxDepth: s = 3 } = {}) {
|
|
877
|
+
return this.api.get(`/memory/decisions/${e}/causal-chain?direction=${t}&max_depth=${s}`);
|
|
855
878
|
}
|
|
856
879
|
/**
|
|
857
880
|
* Find existing decisions that may conflict with this one.
|
|
@@ -882,7 +905,7 @@ class E {
|
|
|
882
905
|
});
|
|
883
906
|
}
|
|
884
907
|
}
|
|
885
|
-
class
|
|
908
|
+
class x {
|
|
886
909
|
constructor(e) {
|
|
887
910
|
this.api = e;
|
|
888
911
|
}
|
|
@@ -900,23 +923,23 @@ class O {
|
|
|
900
923
|
* server auto-populate from scope.resolve_agent_id().
|
|
901
924
|
*/
|
|
902
925
|
async createOpinion(e, t = {}) {
|
|
903
|
-
const
|
|
904
|
-
return t.confidence !== void 0 && (
|
|
926
|
+
const s = { content: e };
|
|
927
|
+
return t.confidence !== void 0 && (s.confidence = t.confidence), t.subject !== void 0 && (s.subject = t.subject), t.subjectType !== void 0 && (s.subject_type = t.subjectType), t.disposition !== void 0 && (s.disposition = t.disposition), t.formedFrom !== void 0 && (s.formed_from = t.formedFrom), t.domain !== void 0 && (s.domain = t.domain), t.agentId !== void 0 && (s.agent_id = t.agentId), this.api.post("/memory/opinions/create", s);
|
|
905
928
|
}
|
|
906
929
|
}
|
|
907
|
-
class
|
|
930
|
+
class O {
|
|
908
931
|
constructor(e) {
|
|
909
932
|
this.api = e;
|
|
910
933
|
}
|
|
911
934
|
async getNeighbors(e) {
|
|
912
935
|
return this.api.get(`/memory/${e}/neighbors`);
|
|
913
936
|
}
|
|
914
|
-
async addEdge(e, t,
|
|
937
|
+
async addEdge(e, t, s, r = {}) {
|
|
915
938
|
return this.api.post("/memory/edge", {
|
|
916
939
|
source_id: e,
|
|
917
940
|
target_id: t,
|
|
918
|
-
relation_type:
|
|
919
|
-
properties:
|
|
941
|
+
relation_type: s,
|
|
942
|
+
properties: r
|
|
920
943
|
});
|
|
921
944
|
}
|
|
922
945
|
async getHealth() {
|
|
@@ -936,8 +959,8 @@ class x {
|
|
|
936
959
|
* @param {string} endId
|
|
937
960
|
* @param {number} [maxHops=5]
|
|
938
961
|
*/
|
|
939
|
-
async findShortestPath(e, t,
|
|
940
|
-
return this.api.get(`/memory/graph/path?start_id=${encodeURIComponent(e)}&end_id=${encodeURIComponent(t)}&max_hops=${
|
|
962
|
+
async findShortestPath(e, t, s = 5) {
|
|
963
|
+
return this.api.get(`/memory/graph/path?start_id=${encodeURIComponent(e)}&end_id=${encodeURIComponent(t)}&max_hops=${s}`);
|
|
941
964
|
}
|
|
942
965
|
/**
|
|
943
966
|
* Fetch the full knowledge graph.
|
|
@@ -1034,12 +1057,12 @@ class q {
|
|
|
1034
1057
|
async list() {
|
|
1035
1058
|
return this.api.get("/memory/teams");
|
|
1036
1059
|
}
|
|
1037
|
-
async create({ name: e, description: t = null, dataClassification:
|
|
1060
|
+
async create({ name: e, description: t = null, dataClassification: s = "internal", costCenter: r = null }) {
|
|
1038
1061
|
return this.api.post("/memory/teams", {
|
|
1039
1062
|
name: e,
|
|
1040
1063
|
description: t,
|
|
1041
|
-
data_classification:
|
|
1042
|
-
cost_center:
|
|
1064
|
+
data_classification: s,
|
|
1065
|
+
cost_center: r
|
|
1043
1066
|
});
|
|
1044
1067
|
}
|
|
1045
1068
|
async get(e) {
|
|
@@ -1054,14 +1077,14 @@ class q {
|
|
|
1054
1077
|
async getMembers(e) {
|
|
1055
1078
|
return this.api.get(`/memory/teams/${e}/members`);
|
|
1056
1079
|
}
|
|
1057
|
-
async addMember(e, t,
|
|
1080
|
+
async addMember(e, t, s = "member") {
|
|
1058
1081
|
return this.api.post(`/memory/teams/${e}/members`, {
|
|
1059
1082
|
user_id: t,
|
|
1060
|
-
role:
|
|
1083
|
+
role: s
|
|
1061
1084
|
});
|
|
1062
1085
|
}
|
|
1063
|
-
async updateMember(e, t,
|
|
1064
|
-
return this.api.patch(`/memory/teams/${e}/members/${t}`, { role:
|
|
1086
|
+
async updateMember(e, t, s) {
|
|
1087
|
+
return this.api.patch(`/memory/teams/${e}/members/${t}`, { role: s });
|
|
1065
1088
|
}
|
|
1066
1089
|
async removeMember(e, t) {
|
|
1067
1090
|
return this.api.delete(`/memory/teams/${e}/members/${t}`);
|
|
@@ -1117,11 +1140,11 @@ class K {
|
|
|
1117
1140
|
async getCurrentUser() {
|
|
1118
1141
|
return this.api.get("/auth/me");
|
|
1119
1142
|
}
|
|
1120
|
-
async createAPIKey(e, t,
|
|
1143
|
+
async createAPIKey(e, t, s = null) {
|
|
1121
1144
|
return this.api.post("/memory/api-keys", {
|
|
1122
1145
|
name: e,
|
|
1123
1146
|
scopes: t,
|
|
1124
|
-
expires_in_days:
|
|
1147
|
+
expires_in_days: s
|
|
1125
1148
|
});
|
|
1126
1149
|
}
|
|
1127
1150
|
async listAPIKeys() {
|
|
@@ -1138,12 +1161,12 @@ class H {
|
|
|
1138
1161
|
async list() {
|
|
1139
1162
|
return this.api.get("/memory/agents");
|
|
1140
1163
|
}
|
|
1141
|
-
async create({ name: e, description: t = null, agentConfig:
|
|
1164
|
+
async create({ name: e, description: t = null, agentConfig: s = {}, roles: r = ["user"] }) {
|
|
1142
1165
|
return this.api.post("/memory/agents", {
|
|
1143
1166
|
name: e,
|
|
1144
1167
|
description: t,
|
|
1145
|
-
agent_config:
|
|
1146
|
-
roles:
|
|
1168
|
+
agent_config: s,
|
|
1169
|
+
roles: r
|
|
1147
1170
|
});
|
|
1148
1171
|
}
|
|
1149
1172
|
async get(e) {
|
|
@@ -1169,9 +1192,9 @@ class H {
|
|
|
1169
1192
|
* @param {string} domain - Domain string (e.g. "python").
|
|
1170
1193
|
* @returns {Promise<{evaluation: object|null}>}
|
|
1171
1194
|
*/
|
|
1172
|
-
async getEvaluation(e, t,
|
|
1173
|
-
const
|
|
1174
|
-
return this.api.get(`/memory/agents/${e}/evaluation${
|
|
1195
|
+
async getEvaluation(e, t, s) {
|
|
1196
|
+
const r = new URLSearchParams({ dimension: t, domain: s }).toString();
|
|
1197
|
+
return this.api.get(`/memory/agents/${e}/evaluation${r ? "?" + r : ""}`);
|
|
1175
1198
|
}
|
|
1176
1199
|
/**
|
|
1177
1200
|
* Get evaluation history for an agent on a given (dimension, domain) slot.
|
|
@@ -1185,8 +1208,8 @@ class H {
|
|
|
1185
1208
|
* @param {number} [options.limit=20] - Maximum records to return.
|
|
1186
1209
|
* @returns {Promise<{history: object[]}>}
|
|
1187
1210
|
*/
|
|
1188
|
-
async listEvaluationHistory(e, t,
|
|
1189
|
-
const n = new URLSearchParams({ dimension: t, domain:
|
|
1211
|
+
async listEvaluationHistory(e, t, s, { limit: r = 20 } = {}) {
|
|
1212
|
+
const n = new URLSearchParams({ dimension: t, domain: s, limit: String(r) }).toString();
|
|
1190
1213
|
return this.api.get(`/memory/agents/${e}/evaluation/history${n ? "?" + n : ""}`);
|
|
1191
1214
|
}
|
|
1192
1215
|
}
|
|
@@ -1204,7 +1227,7 @@ class B {
|
|
|
1204
1227
|
return this.api.get("/usage/tiers");
|
|
1205
1228
|
}
|
|
1206
1229
|
}
|
|
1207
|
-
class
|
|
1230
|
+
class G {
|
|
1208
1231
|
constructor(e) {
|
|
1209
1232
|
this.api = e;
|
|
1210
1233
|
}
|
|
@@ -1221,7 +1244,7 @@ class D {
|
|
|
1221
1244
|
return this.api.get("/memory/plugins");
|
|
1222
1245
|
}
|
|
1223
1246
|
}
|
|
1224
|
-
class
|
|
1247
|
+
class N {
|
|
1225
1248
|
constructor(e) {
|
|
1226
1249
|
this.api = e;
|
|
1227
1250
|
}
|
|
@@ -1244,7 +1267,7 @@ class G {
|
|
|
1244
1267
|
return this.api.get("/memory/token-usage/current");
|
|
1245
1268
|
}
|
|
1246
1269
|
}
|
|
1247
|
-
class
|
|
1270
|
+
class V {
|
|
1248
1271
|
constructor(e) {
|
|
1249
1272
|
this.api = e;
|
|
1250
1273
|
}
|
|
@@ -1257,9 +1280,9 @@ class N {
|
|
|
1257
1280
|
* @param {string} [options.endTime] - ISO end time
|
|
1258
1281
|
* @param {number} [options.limit=100]
|
|
1259
1282
|
*/
|
|
1260
|
-
async getHistory(e, { startTime: t = null, endTime:
|
|
1261
|
-
let n = `/memory/temporal/${e}/history?limit=${
|
|
1262
|
-
return t && (n += `&start_time=${t}`),
|
|
1283
|
+
async getHistory(e, { startTime: t = null, endTime: s = null, limit: r = 100 } = {}) {
|
|
1284
|
+
let n = `/memory/temporal/${e}/history?limit=${r}`;
|
|
1285
|
+
return t && (n += `&start_time=${t}`), s && (n += `&end_time=${s}`), this.api.get(n);
|
|
1263
1286
|
}
|
|
1264
1287
|
// === TIME-TRAVEL QUERIES ===
|
|
1265
1288
|
/**
|
|
@@ -1269,9 +1292,9 @@ class N {
|
|
|
1269
1292
|
* @param {string} [options.query]
|
|
1270
1293
|
* @param {number} [options.limit=100]
|
|
1271
1294
|
*/
|
|
1272
|
-
async timeTravel(e, { query: t = null, limit:
|
|
1273
|
-
let
|
|
1274
|
-
return t && (
|
|
1295
|
+
async timeTravel(e, { query: t = null, limit: s = 100 } = {}) {
|
|
1296
|
+
let r = `/memory/temporal/at/${e}?limit=${s}`;
|
|
1297
|
+
return t && (r += `&query=${encodeURIComponent(t)}`), this.api.get(r);
|
|
1275
1298
|
}
|
|
1276
1299
|
/**
|
|
1277
1300
|
* Get specific item as it existed at timestamp.
|
|
@@ -1290,10 +1313,10 @@ class N {
|
|
|
1290
1313
|
* @param {string} [options.until]
|
|
1291
1314
|
* @param {string} [options.changeType]
|
|
1292
1315
|
*/
|
|
1293
|
-
async getChanges(e, { since: t = null, until:
|
|
1316
|
+
async getChanges(e, { since: t = null, until: s = null, changeType: r = null } = {}) {
|
|
1294
1317
|
let n = `/memory/temporal/${e}/changes`;
|
|
1295
1318
|
const a = [];
|
|
1296
|
-
return t && a.push(`since=${t}`),
|
|
1319
|
+
return t && a.push(`since=${t}`), s && a.push(`until=${s}`), r && a.push(`change_type=${r}`), a.length && (n += `?${a.join("&")}`), this.api.get(n);
|
|
1297
1320
|
}
|
|
1298
1321
|
// === VERSION COMPARISON ===
|
|
1299
1322
|
/**
|
|
@@ -1302,8 +1325,8 @@ class N {
|
|
|
1302
1325
|
* @param {number} v1
|
|
1303
1326
|
* @param {number} v2
|
|
1304
1327
|
*/
|
|
1305
|
-
async compareVersions(e, t,
|
|
1306
|
-
return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${
|
|
1328
|
+
async compareVersions(e, t, s) {
|
|
1329
|
+
return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${s}`);
|
|
1307
1330
|
}
|
|
1308
1331
|
// === ROLLBACK ===
|
|
1309
1332
|
/**
|
|
@@ -1313,10 +1336,10 @@ class N {
|
|
|
1313
1336
|
* @param {number} [options.toVersion]
|
|
1314
1337
|
* @param {string} [options.toTime]
|
|
1315
1338
|
*/
|
|
1316
|
-
async rollback(e, { toVersion: t = null, toTime:
|
|
1317
|
-
let
|
|
1339
|
+
async rollback(e, { toVersion: t = null, toTime: s = null } = {}) {
|
|
1340
|
+
let r = `/memory/temporal/${e}/rollback`;
|
|
1318
1341
|
const n = [];
|
|
1319
|
-
return t !== null && n.push(`to_version=${t}`),
|
|
1342
|
+
return t !== null && n.push(`to_version=${t}`), s && n.push(`to_time=${s}`), n.length && (r += `?${n.join("&")}`), this.api.post(r);
|
|
1320
1343
|
}
|
|
1321
1344
|
// === AUDIT TRAIL ===
|
|
1322
1345
|
/**
|
|
@@ -1328,10 +1351,10 @@ class N {
|
|
|
1328
1351
|
* @param {string} [options.startTime]
|
|
1329
1352
|
* @param {string} [options.endTime]
|
|
1330
1353
|
*/
|
|
1331
|
-
async getAuditTrail(e, { changeType: t = null, userId:
|
|
1354
|
+
async getAuditTrail(e, { changeType: t = null, userId: s = null, startTime: r = null, endTime: n = null } = {}) {
|
|
1332
1355
|
let a = `/memory/temporal/${e}/audit`;
|
|
1333
1356
|
const c = [];
|
|
1334
|
-
return t && c.push(`change_type=${t}`),
|
|
1357
|
+
return t && c.push(`change_type=${t}`), s && c.push(`user_id=${s}`), r && c.push(`start_time=${r}`), n && c.push(`end_time=${n}`), c.length && (a += `?${c.join("&")}`), this.api.get(a);
|
|
1335
1358
|
}
|
|
1336
1359
|
// === TEMPORAL SEARCH ===
|
|
1337
1360
|
/**
|
|
@@ -1341,12 +1364,12 @@ class N {
|
|
|
1341
1364
|
* @param {string} endTime
|
|
1342
1365
|
* @param {number} [limit=100]
|
|
1343
1366
|
*/
|
|
1344
|
-
async searchDuringRange(e, t,
|
|
1367
|
+
async searchDuringRange(e, t, s, r = 100) {
|
|
1345
1368
|
const n = new URLSearchParams({
|
|
1346
1369
|
query: e,
|
|
1347
1370
|
start_time: t,
|
|
1348
|
-
end_time:
|
|
1349
|
-
limit: String(
|
|
1371
|
+
end_time: s,
|
|
1372
|
+
limit: String(r)
|
|
1350
1373
|
}).toString();
|
|
1351
1374
|
return this.api.get(`/memory/temporal/search/during?${n}`);
|
|
1352
1375
|
}
|
|
@@ -1359,10 +1382,10 @@ class N {
|
|
|
1359
1382
|
* @param {string} [options.reportType='HIPAA']
|
|
1360
1383
|
* @param {string[]} [options.itemIds]
|
|
1361
1384
|
*/
|
|
1362
|
-
async complianceReport(e, t, { reportType:
|
|
1363
|
-
let n = `/memory/temporal/compliance/report?start_date=${e}&end_date=${t}&report_type=${
|
|
1364
|
-
if (
|
|
1365
|
-
for (const a of
|
|
1385
|
+
async complianceReport(e, t, { reportType: s = "HIPAA", itemIds: r = null } = {}) {
|
|
1386
|
+
let n = `/memory/temporal/compliance/report?start_date=${e}&end_date=${t}&report_type=${s}`;
|
|
1387
|
+
if (r && r.length)
|
|
1388
|
+
for (const a of r)
|
|
1366
1389
|
n += `&item_ids=${encodeURIComponent(a)}`;
|
|
1367
1390
|
return this.api.get(n);
|
|
1368
1391
|
}
|
|
@@ -1390,7 +1413,7 @@ class N {
|
|
|
1390
1413
|
return this.api.get(`/memory/temporal/relationships/${e}/valid-periods`);
|
|
1391
1414
|
}
|
|
1392
1415
|
}
|
|
1393
|
-
class
|
|
1416
|
+
class D {
|
|
1394
1417
|
constructor(e) {
|
|
1395
1418
|
this.api = e;
|
|
1396
1419
|
}
|
|
@@ -1401,11 +1424,11 @@ class V {
|
|
|
1401
1424
|
* @param {number} [options.topK=100]
|
|
1402
1425
|
* @param {Object[]} [options.memoryItems] - Direct items to analyze
|
|
1403
1426
|
*/
|
|
1404
|
-
async runAnalysis({ query: e = "*", topK: t = 100, memoryItems:
|
|
1427
|
+
async runAnalysis({ query: e = "*", topK: t = 100, memoryItems: s = [] } = {}) {
|
|
1405
1428
|
return this.api.post("/memory/governance/run-analysis", {
|
|
1406
1429
|
query: e,
|
|
1407
1430
|
top_k: t,
|
|
1408
|
-
memory_items:
|
|
1431
|
+
memory_items: s
|
|
1409
1432
|
});
|
|
1410
1433
|
}
|
|
1411
1434
|
/**
|
|
@@ -1415,10 +1438,10 @@ class V {
|
|
|
1415
1438
|
* @param {boolean} [options.autoFixableOnly=false]
|
|
1416
1439
|
*/
|
|
1417
1440
|
async listViolations({ severity: e = null, autoFixableOnly: t = !1 } = {}) {
|
|
1418
|
-
const
|
|
1419
|
-
e &&
|
|
1420
|
-
const
|
|
1421
|
-
return this.api.get(`/memory/governance/violations${
|
|
1441
|
+
const s = [];
|
|
1442
|
+
e && s.push(`severity=${e}`), t && s.push("auto_fixable_only=true");
|
|
1443
|
+
const r = s.length ? `?${s.join("&")}` : "";
|
|
1444
|
+
return this.api.get(`/memory/governance/violations${r}`);
|
|
1422
1445
|
}
|
|
1423
1446
|
/**
|
|
1424
1447
|
* Get a specific violation by ID.
|
|
@@ -1435,12 +1458,12 @@ class V {
|
|
|
1435
1458
|
* @param {string} [params.rationale='']
|
|
1436
1459
|
* @param {string} [params.decidedBy='human']
|
|
1437
1460
|
*/
|
|
1438
|
-
async applyDecision({ violationId: e, action: t = "approve", rationale:
|
|
1461
|
+
async applyDecision({ violationId: e, action: t = "approve", rationale: s = "", decidedBy: r = "human" }) {
|
|
1439
1462
|
return this.api.post("/memory/governance/apply-decision", {
|
|
1440
1463
|
violation_id: e,
|
|
1441
1464
|
action: t,
|
|
1442
|
-
rationale:
|
|
1443
|
-
decided_by:
|
|
1465
|
+
rationale: s,
|
|
1466
|
+
decided_by: r
|
|
1444
1467
|
});
|
|
1445
1468
|
}
|
|
1446
1469
|
/**
|
|
@@ -1512,11 +1535,11 @@ class W {
|
|
|
1512
1535
|
* @param {string} [params.memoryType='semantic']
|
|
1513
1536
|
* @param {boolean} [params.useLlm=true]
|
|
1514
1537
|
*/
|
|
1515
|
-
async challenge({ assertion: e, memoryType: t = "semantic", useLlm:
|
|
1538
|
+
async challenge({ assertion: e, memoryType: t = "semantic", useLlm: s = !0 }) {
|
|
1516
1539
|
return this.api.post("/memory/reasoning/challenge", {
|
|
1517
1540
|
assertion: e,
|
|
1518
1541
|
memory_type: t,
|
|
1519
|
-
use_llm:
|
|
1542
|
+
use_llm: s
|
|
1520
1543
|
});
|
|
1521
1544
|
}
|
|
1522
1545
|
/**
|
|
@@ -1529,12 +1552,12 @@ class W {
|
|
|
1529
1552
|
* @param {boolean} [params.useWikipedia=true]
|
|
1530
1553
|
* @param {boolean} [params.useLlm=true]
|
|
1531
1554
|
*/
|
|
1532
|
-
async resolve({ existingItemId: e, newFact: t, autoResolve:
|
|
1555
|
+
async resolve({ existingItemId: e, newFact: t, autoResolve: s = !0, strategy: r = null, useWikipedia: n = !0, useLlm: a = !0 }) {
|
|
1533
1556
|
return this.api.post("/memory/reasoning/resolve", {
|
|
1534
1557
|
existing_item_id: e,
|
|
1535
1558
|
new_fact: t,
|
|
1536
|
-
auto_resolve:
|
|
1537
|
-
strategy:
|
|
1559
|
+
auto_resolve: s,
|
|
1560
|
+
strategy: r,
|
|
1538
1561
|
use_wikipedia: n,
|
|
1539
1562
|
use_llm: a
|
|
1540
1563
|
});
|
|
@@ -1610,12 +1633,12 @@ class Y {
|
|
|
1610
1633
|
* @param {number} [params.minQualityScore=0.4]
|
|
1611
1634
|
* @param {boolean} [params.useLlmDetection=true]
|
|
1612
1635
|
*/
|
|
1613
|
-
async extract({ content: e, minSteps: t = 2, minQualityScore:
|
|
1636
|
+
async extract({ content: e, minSteps: t = 2, minQualityScore: s = 0.4, useLlmDetection: r = !0 }) {
|
|
1614
1637
|
return this.api.post("/memory/reasoning/traces/extract", {
|
|
1615
1638
|
content: e,
|
|
1616
1639
|
min_steps: t,
|
|
1617
|
-
min_quality_score:
|
|
1618
|
-
use_llm_detection:
|
|
1640
|
+
min_quality_score: s,
|
|
1641
|
+
use_llm_detection: r
|
|
1619
1642
|
});
|
|
1620
1643
|
}
|
|
1621
1644
|
/**
|
|
@@ -1637,11 +1660,11 @@ class Y {
|
|
|
1637
1660
|
* @param {string} [params.artifactId]
|
|
1638
1661
|
* @param {number} [params.limit=10]
|
|
1639
1662
|
*/
|
|
1640
|
-
async query({ query: e, artifactId: t = null, limit:
|
|
1663
|
+
async query({ query: e, artifactId: t = null, limit: s = 10 }) {
|
|
1641
1664
|
return this.api.post("/memory/reasoning/traces/query", {
|
|
1642
1665
|
query: e,
|
|
1643
1666
|
artifact_id: t,
|
|
1644
|
-
limit:
|
|
1667
|
+
limit: s
|
|
1645
1668
|
});
|
|
1646
1669
|
}
|
|
1647
1670
|
/**
|
|
@@ -1664,11 +1687,11 @@ class Z {
|
|
|
1664
1687
|
* @param {Array<{docId: string, text: string}>} params.rawChunks
|
|
1665
1688
|
* @param {Object} [params.params={}]
|
|
1666
1689
|
*/
|
|
1667
|
-
async runInference({ registryId: e = "default", rawChunks: t, params:
|
|
1690
|
+
async runInference({ registryId: e = "default", rawChunks: t, params: s = {} }) {
|
|
1668
1691
|
return this.api.post("/memory/ontology/inference/run", {
|
|
1669
1692
|
registry_id: e,
|
|
1670
|
-
raw_chunks: t.map((
|
|
1671
|
-
params:
|
|
1693
|
+
raw_chunks: t.map((r) => ({ doc_id: r.docId, text: r.text })),
|
|
1694
|
+
params: s
|
|
1672
1695
|
});
|
|
1673
1696
|
}
|
|
1674
1697
|
// === REGISTRY MANAGEMENT ===
|
|
@@ -1685,11 +1708,11 @@ class Z {
|
|
|
1685
1708
|
* @param {string} [params.description='']
|
|
1686
1709
|
* @param {string} [params.domain='general']
|
|
1687
1710
|
*/
|
|
1688
|
-
async createRegistry({ name: e, description: t = "", domain:
|
|
1711
|
+
async createRegistry({ name: e, description: t = "", domain: s = "general" }) {
|
|
1689
1712
|
return this.api.post("/memory/ontology/registries", {
|
|
1690
1713
|
name: e,
|
|
1691
1714
|
description: t,
|
|
1692
|
-
domain:
|
|
1715
|
+
domain: s
|
|
1693
1716
|
});
|
|
1694
1717
|
}
|
|
1695
1718
|
/**
|
|
@@ -1698,8 +1721,8 @@ class Z {
|
|
|
1698
1721
|
* @param {string} [version]
|
|
1699
1722
|
*/
|
|
1700
1723
|
async getSnapshot(e, t = null) {
|
|
1701
|
-
let
|
|
1702
|
-
return t && (
|
|
1724
|
+
let s = `/memory/ontology/registry/${e}/snapshot`;
|
|
1725
|
+
return t && (s += `?version=${encodeURIComponent(t)}`), this.api.get(s);
|
|
1703
1726
|
}
|
|
1704
1727
|
/**
|
|
1705
1728
|
* Apply a changeset to create a new version of the registry.
|
|
@@ -1709,11 +1732,11 @@ class Z {
|
|
|
1709
1732
|
* @param {Object} params.changeset - OntologyIR changeset
|
|
1710
1733
|
* @param {string} [params.message='']
|
|
1711
1734
|
*/
|
|
1712
|
-
async applyChangeset(e, { baseVersion: t = "", changeset:
|
|
1735
|
+
async applyChangeset(e, { baseVersion: t = "", changeset: s, message: r = "" }) {
|
|
1713
1736
|
return this.api.post(`/memory/ontology/registry/${e}/apply`, {
|
|
1714
1737
|
base_version: t,
|
|
1715
|
-
changeset:
|
|
1716
|
-
message:
|
|
1738
|
+
changeset: s,
|
|
1739
|
+
message: r
|
|
1717
1740
|
});
|
|
1718
1741
|
}
|
|
1719
1742
|
/**
|
|
@@ -1739,10 +1762,10 @@ class Z {
|
|
|
1739
1762
|
* @param {string} [params.targetVersion='']
|
|
1740
1763
|
* @param {string} [params.message='']
|
|
1741
1764
|
*/
|
|
1742
|
-
async rollbackRegistry(e, { targetVersion: t = "", message:
|
|
1765
|
+
async rollbackRegistry(e, { targetVersion: t = "", message: s = "" }) {
|
|
1743
1766
|
return this.api.post(`/memory/ontology/registry/${e}/rollback`, {
|
|
1744
1767
|
target_version: t,
|
|
1745
|
-
message:
|
|
1768
|
+
message: s
|
|
1746
1769
|
});
|
|
1747
1770
|
}
|
|
1748
1771
|
/**
|
|
@@ -1751,8 +1774,8 @@ class Z {
|
|
|
1751
1774
|
* @param {string} [version]
|
|
1752
1775
|
*/
|
|
1753
1776
|
async exportRegistry(e, t = null) {
|
|
1754
|
-
let
|
|
1755
|
-
return t && (
|
|
1777
|
+
let s = `/memory/ontology/registry/${e}/export`;
|
|
1778
|
+
return t && (s += `?version=${encodeURIComponent(t)}`), this.api.get(s);
|
|
1756
1779
|
}
|
|
1757
1780
|
/**
|
|
1758
1781
|
* Import data into a registry.
|
|
@@ -1761,10 +1784,10 @@ class Z {
|
|
|
1761
1784
|
* @param {Object} params.data - Complete ontology data to import
|
|
1762
1785
|
* @param {string} [params.message='']
|
|
1763
1786
|
*/
|
|
1764
|
-
async importRegistry(e, { data: t, message:
|
|
1787
|
+
async importRegistry(e, { data: t, message: s = "" }) {
|
|
1765
1788
|
return this.api.post(`/memory/ontology/registry/${e}/import`, {
|
|
1766
1789
|
data: t,
|
|
1767
|
-
message:
|
|
1790
|
+
message: s
|
|
1768
1791
|
});
|
|
1769
1792
|
}
|
|
1770
1793
|
// === ENRICHMENT & GROUNDING ===
|
|
@@ -1793,11 +1816,11 @@ class Z {
|
|
|
1793
1816
|
* @param {string} params.itemId
|
|
1794
1817
|
* @param {string[]} params.candidates
|
|
1795
1818
|
*/
|
|
1796
|
-
async runGrounding({ grounder: e = "wikipedia", itemId: t, candidates:
|
|
1819
|
+
async runGrounding({ grounder: e = "wikipedia", itemId: t, candidates: s }) {
|
|
1797
1820
|
return this.api.post("/memory/ontology/grounding/run", {
|
|
1798
1821
|
grounder: e,
|
|
1799
1822
|
item_id: t,
|
|
1800
|
-
candidates:
|
|
1823
|
+
candidates: s
|
|
1801
1824
|
});
|
|
1802
1825
|
}
|
|
1803
1826
|
// === TEMPLATES ===
|
|
@@ -1833,11 +1856,11 @@ class Z {
|
|
|
1833
1856
|
* @param {string} params.name
|
|
1834
1857
|
* @param {string} [params.description='']
|
|
1835
1858
|
*/
|
|
1836
|
-
async saveAsTemplate({ registryId: e, name: t, description:
|
|
1859
|
+
async saveAsTemplate({ registryId: e, name: t, description: s = "" }) {
|
|
1837
1860
|
return this.api.post("/memory/ontology/templates", {
|
|
1838
1861
|
registry_id: e,
|
|
1839
1862
|
name: t,
|
|
1840
|
-
description:
|
|
1863
|
+
description: s
|
|
1841
1864
|
});
|
|
1842
1865
|
}
|
|
1843
1866
|
/**
|
|
@@ -1862,12 +1885,12 @@ class Z {
|
|
|
1862
1885
|
* @param {number} [params.confidence=0.9]
|
|
1863
1886
|
* @param {boolean} [params.isGlobal=false]
|
|
1864
1887
|
*/
|
|
1865
|
-
async createPattern({ name: e, entityType: t, confidence:
|
|
1888
|
+
async createPattern({ name: e, entityType: t, confidence: s = 0.9, isGlobal: r = !1 }) {
|
|
1866
1889
|
return this.api.post("/memory/ontology/patterns", {
|
|
1867
1890
|
name: e,
|
|
1868
1891
|
entity_type: t,
|
|
1869
|
-
confidence:
|
|
1870
|
-
is_global:
|
|
1892
|
+
confidence: s,
|
|
1893
|
+
is_global: r
|
|
1871
1894
|
});
|
|
1872
1895
|
}
|
|
1873
1896
|
/**
|
|
@@ -1906,10 +1929,10 @@ class Z {
|
|
|
1906
1929
|
* @param {string} params.baseRegistryId
|
|
1907
1930
|
* @param {string} [params.pinnedVersion]
|
|
1908
1931
|
*/
|
|
1909
|
-
async subscribe(e, { baseRegistryId: t, pinnedVersion:
|
|
1932
|
+
async subscribe(e, { baseRegistryId: t, pinnedVersion: s = null }) {
|
|
1910
1933
|
return this.api.post(`/memory/ontology/registry/${e}/subscribe`, {
|
|
1911
1934
|
base_registry_id: t,
|
|
1912
|
-
pinned_version:
|
|
1935
|
+
pinned_version: s
|
|
1913
1936
|
});
|
|
1914
1937
|
}
|
|
1915
1938
|
/**
|
|
@@ -2044,9 +2067,9 @@ class X {
|
|
|
2044
2067
|
* @param {boolean} [options.sentimentAnalysis]
|
|
2045
2068
|
* @param {boolean} [options.topicAnalysis]
|
|
2046
2069
|
*/
|
|
2047
|
-
async detectBias({ protectedAttributes: e = null, sentimentAnalysis: t = null, topicAnalysis:
|
|
2048
|
-
const
|
|
2049
|
-
return e !== null && (
|
|
2070
|
+
async detectBias({ protectedAttributes: e = null, sentimentAnalysis: t = null, topicAnalysis: s = null } = {}) {
|
|
2071
|
+
const r = {};
|
|
2072
|
+
return e !== null && (r.protected_attributes = e), t !== null && (r.sentiment_analysis = t), s !== null && (r.topic_analysis = s), this.api.post("/memory/analytics/bias", r);
|
|
2050
2073
|
}
|
|
2051
2074
|
}
|
|
2052
2075
|
class Q {
|
|
@@ -2132,8 +2155,8 @@ class ee {
|
|
|
2132
2155
|
* @param {string} [runId]
|
|
2133
2156
|
*/
|
|
2134
2157
|
async getState(e, t = null) {
|
|
2135
|
-
let
|
|
2136
|
-
return t && (
|
|
2158
|
+
let s = `/memory/pipeline/${e}/state`;
|
|
2159
|
+
return t && (s += `?run_id=${encodeURIComponent(t)}`), this.api.get(s);
|
|
2137
2160
|
}
|
|
2138
2161
|
/**
|
|
2139
2162
|
* Reset a pipeline, clearing its state.
|
|
@@ -2164,11 +2187,11 @@ class ee {
|
|
|
2164
2187
|
* @param {string} [params.description='']
|
|
2165
2188
|
* @param {Object} params.config
|
|
2166
2189
|
*/
|
|
2167
|
-
async createConfig({ name: e, description: t = "", config:
|
|
2190
|
+
async createConfig({ name: e, description: t = "", config: s }) {
|
|
2168
2191
|
return this.api.post("/memory/pipeline/configs", {
|
|
2169
2192
|
name: e,
|
|
2170
2193
|
description: t,
|
|
2171
|
-
config:
|
|
2194
|
+
config: s
|
|
2172
2195
|
});
|
|
2173
2196
|
}
|
|
2174
2197
|
/**
|
|
@@ -2186,11 +2209,11 @@ class ee {
|
|
|
2186
2209
|
* @param {string} [params.description='']
|
|
2187
2210
|
* @param {Object} [params.config={}]
|
|
2188
2211
|
*/
|
|
2189
|
-
async updateConfig(e, { name: t = "", description:
|
|
2212
|
+
async updateConfig(e, { name: t = "", description: s = "", config: r = {} }) {
|
|
2190
2213
|
return this.api.patch(`/memory/pipeline/configs/${e}`, {
|
|
2191
2214
|
name: t,
|
|
2192
|
-
description:
|
|
2193
|
-
config:
|
|
2215
|
+
description: s,
|
|
2216
|
+
config: r
|
|
2194
2217
|
});
|
|
2195
2218
|
}
|
|
2196
2219
|
/**
|
|
@@ -2212,11 +2235,11 @@ class te {
|
|
|
2212
2235
|
* @param {Object} params.payload
|
|
2213
2236
|
* @param {Object} [params.metadata={}]
|
|
2214
2237
|
*/
|
|
2215
|
-
async store({ conversationId: e, payload: t, metadata:
|
|
2238
|
+
async store({ conversationId: e, payload: t, metadata: s = {} }) {
|
|
2216
2239
|
return this.api.post("/memory/archive/store", {
|
|
2217
2240
|
conversation_id: e,
|
|
2218
2241
|
payload: t,
|
|
2219
|
-
metadata:
|
|
2242
|
+
metadata: s
|
|
2220
2243
|
});
|
|
2221
2244
|
}
|
|
2222
2245
|
/**
|
|
@@ -2227,7 +2250,7 @@ class te {
|
|
|
2227
2250
|
return this.api.get(`/memory/archive/${e}`);
|
|
2228
2251
|
}
|
|
2229
2252
|
}
|
|
2230
|
-
class
|
|
2253
|
+
class se {
|
|
2231
2254
|
constructor(e) {
|
|
2232
2255
|
this.api = e;
|
|
2233
2256
|
}
|
|
@@ -2287,8 +2310,8 @@ class re {
|
|
|
2287
2310
|
* @param {number} [options.maxDistance=3]
|
|
2288
2311
|
* @param {number} [options.minSurprise=0.5]
|
|
2289
2312
|
*/
|
|
2290
|
-
async getDiscoveries(e, { maxDistance: t = 3, minSurprise:
|
|
2291
|
-
return this.api.get(`/memory/zettel/${e}/discoveries?max_distance=${t}&min_surprise=${
|
|
2313
|
+
async getDiscoveries(e, { maxDistance: t = 3, minSurprise: s = 0.5 } = {}) {
|
|
2314
|
+
return this.api.get(`/memory/zettel/${e}/discoveries?max_distance=${t}&min_surprise=${s}`);
|
|
2292
2315
|
}
|
|
2293
2316
|
/**
|
|
2294
2317
|
* Find paths between two notes.
|
|
@@ -2296,8 +2319,8 @@ class re {
|
|
|
2296
2319
|
* @param {string} targetId
|
|
2297
2320
|
* @param {number} [maxPaths=5]
|
|
2298
2321
|
*/
|
|
2299
|
-
async getPath(e, t,
|
|
2300
|
-
return this.api.get(`/memory/zettel/${e}/path/${t}?max_paths=${
|
|
2322
|
+
async getPath(e, t, s = 5) {
|
|
2323
|
+
return this.api.get(`/memory/zettel/${e}/path/${t}?max_paths=${s}`);
|
|
2301
2324
|
}
|
|
2302
2325
|
// === WIKILINK SUPPORT ===
|
|
2303
2326
|
/**
|
|
@@ -2323,8 +2346,8 @@ class re {
|
|
|
2323
2346
|
* @param {number} [options.depth=2]
|
|
2324
2347
|
* @param {boolean} [options.includeMetadata=true]
|
|
2325
2348
|
*/
|
|
2326
|
-
async getSubgraph(e, { depth: t = 2, includeMetadata:
|
|
2327
|
-
return this.api.get(`/memory/zettel/${e}/graph?depth=${t}&include_metadata=${
|
|
2349
|
+
async getSubgraph(e, { depth: t = 2, includeMetadata: s = !0 } = {}) {
|
|
2350
|
+
return this.api.get(`/memory/zettel/${e}/graph?depth=${t}&include_metadata=${s}`);
|
|
2328
2351
|
}
|
|
2329
2352
|
// === ADDITIONAL DISCOVERY ===
|
|
2330
2353
|
/**
|
|
@@ -2365,8 +2388,8 @@ class re {
|
|
|
2365
2388
|
* @param {string} value
|
|
2366
2389
|
* @param {number} [limit=100]
|
|
2367
2390
|
*/
|
|
2368
|
-
async findByProperty(e, t,
|
|
2369
|
-
return this.api.get(`/memory/zettel/by-property?key=${encodeURIComponent(e)}&value=${encodeURIComponent(t)}&limit=${
|
|
2391
|
+
async findByProperty(e, t, s = 100) {
|
|
2392
|
+
return this.api.get(`/memory/zettel/by-property?key=${encodeURIComponent(e)}&value=${encodeURIComponent(t)}&limit=${s}`);
|
|
2370
2393
|
}
|
|
2371
2394
|
/**
|
|
2372
2395
|
* Find notes mentioning an entity.
|
|
@@ -2382,11 +2405,11 @@ class re {
|
|
|
2382
2405
|
* @param {string} relationType
|
|
2383
2406
|
* @param {number} [limit=100]
|
|
2384
2407
|
*/
|
|
2385
|
-
async queryByRelation(e, t,
|
|
2386
|
-
return this.api.get(`/memory/zettel/by-relation/${e}/${t}?limit=${
|
|
2408
|
+
async queryByRelation(e, t, s = 100) {
|
|
2409
|
+
return this.api.get(`/memory/zettel/by-relation/${e}/${t}?limit=${s}`);
|
|
2387
2410
|
}
|
|
2388
2411
|
}
|
|
2389
|
-
class
|
|
2412
|
+
class re {
|
|
2390
2413
|
constructor(e) {
|
|
2391
2414
|
this.api = e;
|
|
2392
2415
|
}
|
|
@@ -2401,9 +2424,9 @@ class se {
|
|
|
2401
2424
|
*/
|
|
2402
2425
|
async list(e = {}) {
|
|
2403
2426
|
const t = Object.fromEntries(
|
|
2404
|
-
Object.entries(e).filter(([,
|
|
2405
|
-
),
|
|
2406
|
-
return this.api.get(`/memory/procedures/matches${
|
|
2427
|
+
Object.entries(e).filter(([, r]) => r != null)
|
|
2428
|
+
), s = new URLSearchParams(t).toString();
|
|
2429
|
+
return this.api.get(`/memory/procedures/matches${s ? "?" + s : ""}`);
|
|
2407
2430
|
}
|
|
2408
2431
|
/**
|
|
2409
2432
|
* Submit feedback for a procedure match.
|
|
@@ -2411,9 +2434,9 @@ class se {
|
|
|
2411
2434
|
* @param {string} feedback - One of "success", "failure", "neutral"
|
|
2412
2435
|
* @param {string} [note] - Optional explanation
|
|
2413
2436
|
*/
|
|
2414
|
-
async submitFeedback(e, t,
|
|
2415
|
-
const
|
|
2416
|
-
return
|
|
2437
|
+
async submitFeedback(e, t, s = null) {
|
|
2438
|
+
const r = { feedback: t };
|
|
2439
|
+
return s && (r.note = s), this.api.post(`/memory/procedures/matches/${e}/feedback`, r);
|
|
2417
2440
|
}
|
|
2418
2441
|
/**
|
|
2419
2442
|
* Get aggregated procedure match statistics.
|
|
@@ -2437,9 +2460,9 @@ class ne {
|
|
|
2437
2460
|
*/
|
|
2438
2461
|
async list(e = {}) {
|
|
2439
2462
|
const t = Object.fromEntries(
|
|
2440
|
-
Object.entries(e).filter(([,
|
|
2441
|
-
),
|
|
2442
|
-
return this.api.get(`/memory/procedures/candidates${
|
|
2463
|
+
Object.entries(e).filter(([, r]) => r != null)
|
|
2464
|
+
), s = new URLSearchParams(t).toString();
|
|
2465
|
+
return this.api.get(`/memory/procedures/candidates${s ? "?" + s : ""}`);
|
|
2443
2466
|
}
|
|
2444
2467
|
/**
|
|
2445
2468
|
* Promote a candidate cluster to a new procedure.
|
|
@@ -2453,14 +2476,14 @@ class ne {
|
|
|
2453
2476
|
* @returns {Promise<Object>} Response with procedure_id and status
|
|
2454
2477
|
*/
|
|
2455
2478
|
async promote(e, t = {}) {
|
|
2456
|
-
const
|
|
2479
|
+
const s = {
|
|
2457
2480
|
name: t.name ?? null,
|
|
2458
2481
|
description: t.description ?? null,
|
|
2459
2482
|
procedure_type: t.procedure_type ?? "extraction",
|
|
2460
2483
|
preferred_profile: t.preferred_profile ?? "quick_extract",
|
|
2461
2484
|
remove_working_items: t.remove_working_items ?? !1
|
|
2462
2485
|
};
|
|
2463
|
-
return this.api.post(`/memory/procedures/candidates/${e}/promote`,
|
|
2486
|
+
return this.api.post(`/memory/procedures/candidates/${e}/promote`, s);
|
|
2464
2487
|
}
|
|
2465
2488
|
/**
|
|
2466
2489
|
* Dismiss a candidate cluster from future recommendations.
|
|
@@ -2488,9 +2511,9 @@ class ie {
|
|
|
2488
2511
|
*/
|
|
2489
2512
|
async list(e = {}) {
|
|
2490
2513
|
const t = Object.fromEntries(
|
|
2491
|
-
Object.entries(e).filter(([,
|
|
2492
|
-
),
|
|
2493
|
-
return this.api.get(`/memory/procedures/drift${
|
|
2514
|
+
Object.entries(e).filter(([, r]) => r != null)
|
|
2515
|
+
), s = new URLSearchParams(t).toString();
|
|
2516
|
+
return this.api.get(`/memory/procedures/drift${s ? "?" + s : ""}`);
|
|
2494
2517
|
}
|
|
2495
2518
|
/**
|
|
2496
2519
|
* Get a single drift event with full change details.
|
|
@@ -2507,8 +2530,8 @@ class ie {
|
|
|
2507
2530
|
* @returns {Promise<{status: string, event_id: string, resolved: boolean}>}
|
|
2508
2531
|
*/
|
|
2509
2532
|
async resolve(e, t = null) {
|
|
2510
|
-
const
|
|
2511
|
-
return t != null && (
|
|
2533
|
+
const s = {};
|
|
2534
|
+
return t != null && (s.note = t), this.api.post(`/memory/procedures/drift/${e}/resolve`, s);
|
|
2512
2535
|
}
|
|
2513
2536
|
/**
|
|
2514
2537
|
* Trigger a drift sweep across all procedures in the workspace.
|
|
@@ -2577,9 +2600,9 @@ class ae {
|
|
|
2577
2600
|
* @param {number} [params.limit=20]
|
|
2578
2601
|
* @param {string} [params.before] ISO 8601 datetime
|
|
2579
2602
|
*/
|
|
2580
|
-
async list({ isHeartbeat: e = null, limit: t = 20, before:
|
|
2581
|
-
const
|
|
2582
|
-
return e !== null && (
|
|
2603
|
+
async list({ isHeartbeat: e = null, limit: t = 20, before: s = null } = {}) {
|
|
2604
|
+
const r = { limit: t };
|
|
2605
|
+
return e !== null && (r.is_heartbeat = e), s !== null && (r.before = s), this.api.get("/memory/summary/list", r);
|
|
2583
2606
|
}
|
|
2584
2607
|
/** SnapshotDelta between two snapshots. Returns null on 404. */
|
|
2585
2608
|
async delta({ from: e, to: t }) {
|
|
@@ -2588,9 +2611,9 @@ class ae {
|
|
|
2588
2611
|
from: e,
|
|
2589
2612
|
to: t
|
|
2590
2613
|
});
|
|
2591
|
-
} catch (
|
|
2592
|
-
if ((
|
|
2593
|
-
throw
|
|
2614
|
+
} catch (s) {
|
|
2615
|
+
if ((s == null ? void 0 : s.status) === 404) return null;
|
|
2616
|
+
throw s;
|
|
2594
2617
|
}
|
|
2595
2618
|
}
|
|
2596
2619
|
/** Admin-only delete. Throws on 403/404/500. */
|
|
@@ -2600,9 +2623,9 @@ class ae {
|
|
|
2600
2623
|
}
|
|
2601
2624
|
class ce {
|
|
2602
2625
|
constructor(e) {
|
|
2603
|
-
this.auth = new
|
|
2604
|
-
const t = new
|
|
2605
|
-
this.memories = new z(t), this.decisions = new E(t), this.opinions = new
|
|
2626
|
+
this.auth = new M(e);
|
|
2627
|
+
const t = new L(this.auth, { fetchFn: e.fetchFn });
|
|
2628
|
+
this.memories = new z(t), this.decisions = new E(t), this.opinions = new x(t), this.graph = new O(t), this.teams = new q(t), this.profiles = new j(t), this.subscriptions = new F(t), this.authAPI = new K(t), this.agents = new H(t), this.usage = new B(t), this.insights = new G(t), this.tokenUsage = new N(t), this.temporal = new V(t), this.governance = new D(t), this.evolution = new J(t), this.reasoning = new W(t), this.reasoningTraces = new Y(t), this.ontology = new Z(t), this.analytics = new X(t), this.validation = new Q(t), this.pipeline = new ee(t), this.archive = new te(t), this.zettelkasten = new se(t), this.procedureMatches = new re(t), this.procedureCandidates = new ne(t), this.procedureDrift = new ie(t), this.summaries = new ae(t);
|
|
2606
2629
|
}
|
|
2607
2630
|
setTeamId(e) {
|
|
2608
2631
|
this.auth.tokenManager.setTeamId(e), this.auth.notifyListeners();
|
|
@@ -2613,11 +2636,11 @@ class ce {
|
|
|
2613
2636
|
}
|
|
2614
2637
|
export {
|
|
2615
2638
|
g as A,
|
|
2616
|
-
|
|
2639
|
+
L as B,
|
|
2617
2640
|
E as D,
|
|
2618
2641
|
J as E,
|
|
2619
|
-
|
|
2620
|
-
|
|
2642
|
+
D as G,
|
|
2643
|
+
G as I,
|
|
2621
2644
|
z as M,
|
|
2622
2645
|
Z as O,
|
|
2623
2646
|
ee as P,
|
|
@@ -2626,22 +2649,22 @@ export {
|
|
|
2626
2649
|
q as T,
|
|
2627
2650
|
B as U,
|
|
2628
2651
|
Q as V,
|
|
2629
|
-
|
|
2652
|
+
se as Z,
|
|
2630
2653
|
H as a,
|
|
2631
2654
|
X as b,
|
|
2632
2655
|
te as c,
|
|
2633
2656
|
K as d,
|
|
2634
|
-
|
|
2635
|
-
|
|
2636
|
-
|
|
2657
|
+
M as e,
|
|
2658
|
+
O as f,
|
|
2659
|
+
x as g,
|
|
2637
2660
|
ne as h,
|
|
2638
|
-
|
|
2661
|
+
re as i,
|
|
2639
2662
|
j,
|
|
2640
2663
|
Y as k,
|
|
2641
2664
|
F as l,
|
|
2642
|
-
|
|
2665
|
+
V as m,
|
|
2643
2666
|
U as n,
|
|
2644
|
-
|
|
2667
|
+
N as o,
|
|
2645
2668
|
P as p,
|
|
2646
2669
|
C as q
|
|
2647
2670
|
};
|