@smartmemory/sdk-js 1.4.119 → 1.4.120

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.
@@ -1,38 +1,35 @@
1
- var z = (o) => {
2
- throw TypeError(o);
3
- };
4
- var P = (o, e, t) => e.has(o) || z("Cannot " + t);
5
- var v = (o, e, t) => (P(o, e, "read from private field"), t ? t.call(o) : e.get(o)), q = (o, e, t) => e.has(o) ? z("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(o) : e.set(o, t), L = (o, e, t, s) => (P(o, e, "write to private field"), s ? s.call(o, t) : e.set(o, t), t), O = (o, e, t) => (P(o, e, "access private method"), t);
6
- const j = {
1
+ import { C as z, R as O } from "./index-BKI1h_Wn.js";
2
+ import { f as T } from "./recovery-JyUr2KHh.js";
3
+ const P = {
7
4
  access: "smart_memory_auth_token",
8
5
  refresh: "smart_memory_refresh_token",
9
6
  user: "smart_memory_user",
10
7
  tenant: "smart_memory_tenant_id",
11
8
  workspace: "smart_memory_workspace_id"
12
- }, I = {
9
+ }, w = {
13
10
  access: ["access_token", "sm_token"],
14
11
  refresh: ["refresh_token", "sm_refresh_token"],
15
12
  user: ["sm_user"],
16
13
  tenant: ["tenant_id", "workspace_id", "sm_workspace_id"],
17
14
  workspace: ["smart_memory_team_id", "team_id", "sm_team_id"]
18
15
  };
19
- class K {
16
+ class x {
20
17
  /**
21
18
  * @param {Object} options
22
19
  * @param {'localStorage' | 'sessionStorage' | 'memory'} [options.storage='localStorage']
23
20
  * @param {Object} [options.keys] - Custom storage key names
24
21
  */
25
22
  constructor({ storage: e = "localStorage", keys: t = {} } = {}) {
26
- var n;
23
+ var s;
27
24
  this.storageType = e;
28
- const s = t.workspace || t.team || j.workspace;
29
- this.keys = { ...j, ...t, workspace: s }, (n = this.keys).team ?? (n.team = s), this.workspaceAliases = [
30
- ...I.workspace,
31
- ...t.team && t.team !== s ? [t.team] : []
25
+ const n = t.workspace || t.team || P.workspace;
26
+ this.keys = { ...P, ...t, workspace: n }, (s = this.keys).team ?? (s.team = n), this.workspaceAliases = [
27
+ ...w.workspace,
28
+ ...t.team && t.team !== n ? [t.team] : []
32
29
  ], this._memory = { access: null, refresh: null, user: null, tenant: null, workspace: null };
33
30
  }
34
31
  getAccessToken() {
35
- return this.storageType === "memory" ? this._memory.access : this._getFromStorage(this.keys.access, I.access);
32
+ return this.storageType === "memory" ? this._memory.access : this._getFromStorage(this.keys.access, w.access);
36
33
  }
37
34
  setAccessToken(e) {
38
35
  if (this.storageType === "memory") {
@@ -42,7 +39,7 @@ class K {
42
39
  this._setInStorage(this.keys.access, e);
43
40
  }
44
41
  getRefreshToken() {
45
- return this.storageType === "memory" ? this._memory.refresh : this._getFromStorage(this.keys.refresh, I.refresh);
42
+ return this.storageType === "memory" ? this._memory.refresh : this._getFromStorage(this.keys.refresh, w.refresh);
46
43
  }
47
44
  setRefreshToken(e) {
48
45
  if (this.storageType === "memory") {
@@ -53,7 +50,7 @@ class K {
53
50
  }
54
51
  getUser() {
55
52
  if (this.storageType === "memory") return this._memory.user;
56
- const e = this._getFromStorage(this.keys.user, I.user);
53
+ const e = this._getFromStorage(this.keys.user, w.user);
57
54
  if (!e) return null;
58
55
  try {
59
56
  return JSON.parse(e);
@@ -69,7 +66,7 @@ class K {
69
66
  this._setInStorage(this.keys.user, e ? JSON.stringify(e) : null);
70
67
  }
71
68
  getTenantId() {
72
- return this.storageType === "memory" ? this._memory.tenant : this._normalizeId(this._getFromStorage(this.keys.tenant, I.tenant));
69
+ return this.storageType === "memory" ? this._memory.tenant : this._normalizeId(this._getFromStorage(this.keys.tenant, w.tenant));
73
70
  }
74
71
  setTenantId(e) {
75
72
  const t = this._normalizeId(e);
@@ -106,7 +103,7 @@ class K {
106
103
  localStorage.removeItem(e), sessionStorage.removeItem(e);
107
104
  } catch {
108
105
  }
109
- for (const e of Object.values(I))
106
+ for (const e of Object.values(w))
110
107
  for (const t of e)
111
108
  try {
112
109
  localStorage.removeItem(t), sessionStorage.removeItem(t);
@@ -124,17 +121,17 @@ class K {
124
121
  /** @private */
125
122
  _getFromStorage(e, t = []) {
126
123
  try {
127
- const s = this.storageType === "localStorage" ? localStorage : sessionStorage, n = this.storageType === "localStorage" ? sessionStorage : localStorage, r = s.getItem(e) || n.getItem(e);
124
+ const n = this.storageType === "localStorage" ? localStorage : sessionStorage, s = this.storageType === "localStorage" ? sessionStorage : localStorage, r = n.getItem(e) || s.getItem(e);
128
125
  if (r != null) return r;
129
126
  for (const i of t) {
130
- const a = s.getItem(i) || n.getItem(i);
131
- if (a != null) {
132
- this._setInStorage(e, a);
127
+ const o = n.getItem(i) || s.getItem(i);
128
+ if (o != null) {
129
+ this._setInStorage(e, o);
133
130
  try {
134
- s.removeItem(i), n.removeItem(i);
131
+ n.removeItem(i), s.removeItem(i);
135
132
  } catch {
136
133
  }
137
- return a;
134
+ return o;
138
135
  }
139
136
  }
140
137
  return null;
@@ -145,10 +142,10 @@ class K {
145
142
  /** @private */
146
143
  _setInStorage(e, t) {
147
144
  try {
148
- const s = this.storageType === "localStorage" ? localStorage : sessionStorage, n = this.storageType === "localStorage" ? sessionStorage : localStorage;
149
- t != null ? (s.setItem(e, t), n.removeItem(e)) : (s.removeItem(e), n.removeItem(e));
150
- } catch (s) {
151
- console.error("Failed to write to storage:", s);
145
+ const n = this.storageType === "localStorage" ? localStorage : sessionStorage, s = this.storageType === "localStorage" ? sessionStorage : localStorage;
146
+ t != null ? (n.setItem(e, t), s.removeItem(e)) : (n.removeItem(e), s.removeItem(e));
147
+ } catch (n) {
148
+ console.error("Failed to write to storage:", n);
152
149
  }
153
150
  }
154
151
  /** @private */
@@ -156,62 +153,20 @@ class K {
156
153
  if (e == null) return null;
157
154
  const t = String(e).trim();
158
155
  if (!t) return null;
159
- const s = t.toLowerCase();
160
- return s === "none" || s === "null" || s === "undefined" ? null : t;
161
- }
162
- }
163
- var _, A, B;
164
- class D {
165
- /**
166
- * @param {Object} options
167
- * @param {string} options.apiBaseUrl
168
- * @param {string} options.refreshEndpoint
169
- * @param {import('./TokenManager.js').TokenManager} options.tokenManager
170
- * @param {boolean} [options.useCookieAuth=false]
171
- * @param {function(string): void} options.onTokenRefreshed
172
- * @param {function(): void} options.onRefreshFailed
173
- */
174
- constructor({ apiBaseUrl: e, refreshEndpoint: t, tokenManager: s, useCookieAuth: n = !1, onTokenRefreshed: r, onRefreshFailed: i }) {
175
- q(this, A);
176
- q(this, _, null);
177
- this.apiBaseUrl = e, this.refreshEndpoint = t, this.tokenManager = s, this.useCookieAuth = n, this.onTokenRefreshed = r, this.onRefreshFailed = i;
178
- }
179
- async refresh() {
180
- if (v(this, _))
181
- return v(this, _);
182
- L(this, _, O(this, A, B).call(this));
183
- try {
184
- return await v(this, _);
185
- } finally {
186
- L(this, _, null);
187
- }
156
+ const n = t.toLowerCase();
157
+ return n === "none" || n === "null" || n === "undefined" ? null : t;
188
158
  }
189
159
  }
190
- _ = new WeakMap(), A = new WeakSet(), B = async function() {
191
- const e = this.tokenManager.getRefreshToken();
192
- if (!e && !this.useCookieAuth)
193
- throw this.onRefreshFailed(), new Error("No refresh token");
194
- const t = JSON.stringify(e ? { refresh_token: e } : {}), s = await fetch(`${this.apiBaseUrl}${this.refreshEndpoint}`, {
195
- ...this.useCookieAuth ? { credentials: "include" } : {},
196
- method: "POST",
197
- headers: { "Content-Type": "application/json" },
198
- body: t
199
- });
200
- if (!s.ok)
201
- throw this.onRefreshFailed(), new Error(`Refresh failed: ${s.status}`);
202
- const n = await s.json();
203
- return this.tokenManager.setAccessToken(n.access_token), n.refresh_token && this.tokenManager.setRefreshToken(n.refresh_token), this.onTokenRefreshed(n.access_token), n.access_token;
204
- };
205
- const E = "smart_memory_sso_redirect";
206
- class G {
160
+ const U = "smart_memory_sso_redirect";
161
+ class j {
207
162
  /**
208
163
  * @param {Object} options
209
164
  * @param {string} options.webAppUrl - Web app URL for login redirect
210
165
  * @param {string[]} [options.allowedHosts=[]] - Allowed redirect hostnames
211
166
  * @param {import('./TokenManager.js').TokenManager} options.tokenManager
212
167
  */
213
- constructor({ webAppUrl: e, allowedHosts: t = [], tokenManager: s }) {
214
- this.webAppUrl = e, this.allowedHosts = t, this.tokenManager = s;
168
+ constructor({ webAppUrl: e, allowedHosts: t = [], tokenManager: n }) {
169
+ this.webAppUrl = e, this.allowedHosts = t, this.tokenManager = n;
215
170
  }
216
171
  getLoginUrl(e) {
217
172
  const t = e || `${window.location.origin}/auth/callback`;
@@ -228,38 +183,42 @@ class G {
228
183
  }
229
184
  storeRedirect(e) {
230
185
  try {
231
- sessionStorage.setItem(E, e);
186
+ sessionStorage.setItem(U, e);
232
187
  } catch (t) {
233
188
  console.warn("Failed to store redirect URL:", t);
234
189
  }
235
190
  }
236
191
  getAndClearRedirect() {
237
192
  try {
238
- const e = sessionStorage.getItem(E);
239
- return sessionStorage.removeItem(E), e;
193
+ const e = sessionStorage.getItem(U);
194
+ return sessionStorage.removeItem(U), e;
240
195
  } catch {
241
196
  return null;
242
197
  }
243
198
  }
244
199
  }
245
- class N {
200
+ class F {
246
201
  constructor(e) {
247
- 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 K({
202
+ this.sessionRevision = 0, this.connection = new z(), 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 x({
248
203
  storage: e.storage || "localStorage",
249
204
  keys: e.tokenKeys
250
- }), this.mode !== "apiKey" ? this.refreshManager = new D({
205
+ }), this.mode !== "apiKey" ? this.refreshManager = new O({
251
206
  apiBaseUrl: this.apiBaseUrl,
252
207
  refreshEndpoint: this.endpoints.refresh || "/auth/refresh",
253
208
  tokenManager: this.tokenManager,
254
209
  useCookieAuth: this.useCookieAuth,
210
+ getRequestOptions: (t) => this.getRequestOptions(t),
211
+ fetchFn: e.fetchFn,
212
+ connection: this.connection,
213
+ getSessionKey: () => JSON.stringify([this.sessionRevision, this.currentToken, this.tokenManager.getWorkspaceId()]),
255
214
  onTokenRefreshed: (t) => {
256
- var s;
257
- this.currentToken = t, this.notifyListeners(), (s = e.onTokenRefresh) == null || s.call(e, t);
215
+ var n;
216
+ this.currentToken = t, this.notifyListeners(), (n = e.onTokenRefresh) == null || n.call(e, t);
258
217
  },
259
218
  onRefreshFailed: () => {
260
219
  this.clearLocalAuth();
261
220
  }
262
- }) : this.refreshManager = null, this.mode === "sso" && (this.ssoManager = new G({
221
+ }) : this.refreshManager = null, this.mode === "sso" && (this.ssoManager = new j({
263
222
  webAppUrl: e.webAppUrl,
264
223
  allowedHosts: e.allowedRedirectHosts || [],
265
224
  tokenManager: this.tokenManager
@@ -278,22 +237,34 @@ class N {
278
237
  return this.tokenManager.getTenantId();
279
238
  }
280
239
  hasRole(e) {
281
- var t, s;
282
- return ((s = (t = this.currentUser) == null ? void 0 : t.roles) == null ? void 0 : s.includes(e)) || !1;
240
+ var t, n;
241
+ return ((n = (t = this.currentUser) == null ? void 0 : t.roles) == null ? void 0 : n.includes(e)) || !1;
283
242
  }
284
243
  getAuthHeaders(e = {}) {
285
- const t = { ...e };
286
- this.currentToken && (t.Authorization = this.currentToken.startsWith("Bearer ") ? this.currentToken : `Bearer ${this.currentToken}`);
287
- const s = this.tokenManager.getWorkspaceId();
288
- return s && (t["X-Workspace-Id"] = s), t;
244
+ const t = typeof (e == null ? void 0 : e.entries) == "function" || Array.isArray(e) ? Object.fromEntries(new Headers(e)) : { ...e }, n = this.tokenManager.getWorkspaceId();
245
+ for (const s of Object.keys(t))
246
+ (s.toLowerCase() === "authorization" || n && s.toLowerCase() === "x-workspace-id") && delete t[s];
247
+ return this.currentToken && (t.Authorization = this.currentToken.startsWith("Bearer ") ? this.currentToken : `Bearer ${this.currentToken}`), n && (t["X-Workspace-Id"] = n), t;
289
248
  }
290
249
  getRequestOptions(e = {}) {
291
- return this.useCookieAuth ? { credentials: "include", ...e } : { ...e };
250
+ var n;
251
+ if (!this.useCookieAuth) return { ...e };
252
+ const t = typeof ((n = e.headers) == null ? void 0 : n.entries) == "function" || Array.isArray(e.headers) ? Object.fromEntries(new Headers(e.headers)) : { ...e.headers };
253
+ if (["POST", "PUT", "PATCH", "DELETE"].includes((e.method || "GET").toUpperCase()) && typeof document < "u") {
254
+ const s = document.cookie.split(/;\s*/).find((r) => r.startsWith("sm_csrf="));
255
+ if (s) {
256
+ for (const r of Object.keys(t))
257
+ r.toLowerCase() === "x-csrf-token" && delete t[r];
258
+ t["x-csrf-token"] = decodeURIComponent(s.slice(8));
259
+ }
260
+ }
261
+ return { credentials: "include", ...e, headers: t };
292
262
  }
293
263
  addListener(e) {
294
264
  return this.listeners.add(e), () => this.listeners.delete(e);
295
265
  }
296
266
  notifyListeners() {
267
+ this.isAuthenticated() && this.connection.authenticated();
297
268
  const e = {
298
269
  isAuthenticated: this.isAuthenticated(),
299
270
  user: this.currentUser,
@@ -304,8 +275,8 @@ class N {
304
275
  this.listeners.forEach((t) => {
305
276
  try {
306
277
  t(e);
307
- } catch (s) {
308
- console.error("Auth listener error:", s);
278
+ } catch (n) {
279
+ console.error("Auth listener error:", n);
309
280
  }
310
281
  });
311
282
  }
@@ -315,7 +286,7 @@ class N {
315
286
  return this.ssoManager.getLoginUrl(e);
316
287
  }
317
288
  clearLocalAuth() {
318
- if (this.mode === "apiKey") {
289
+ if (this.sessionRevision++, this.connection.signedOut(), this.mode === "apiKey") {
319
290
  this.apiKey = null, this.currentToken = null, this.notifyListeners();
320
291
  return;
321
292
  }
@@ -343,8 +314,7 @@ class N {
343
314
  return this.apiKey;
344
315
  if (!this.refreshManager)
345
316
  throw new Error("Token refresh not available in this mode");
346
- const e = await this.refreshManager.refresh();
347
- return this.currentToken = e, e;
317
+ return await this.refreshManager.refresh();
348
318
  }
349
319
  async bootstrapSession() {
350
320
  if (this.mode === "apiKey" || !this.useCookieAuth)
@@ -354,11 +324,11 @@ class N {
354
324
  let t = await fetch(
355
325
  e,
356
326
  this.getRequestOptions({ method: "GET", headers: this.getAuthHeaders() })
357
- ), s = !1;
327
+ ), n = !1;
358
328
  if (!t.ok && (this.currentToken || this.tokenManager.getWorkspaceId()) && (t = await fetch(
359
329
  e,
360
330
  this.getRequestOptions({ method: "GET", headers: {} })
361
- ), s = t.ok), !t.ok && t.status === 401 && this.refreshManager)
331
+ ), n = t.ok), !t.ok && t.status === 401 && this.refreshManager)
362
332
  try {
363
333
  await this.refreshManager.refresh(), t = await fetch(
364
334
  e,
@@ -367,10 +337,10 @@ class N {
367
337
  } catch {
368
338
  }
369
339
  if (!t.ok) return !1;
370
- const n = await t.json();
371
- this.currentUser = n, this.tokenManager.setUser(n);
372
- const r = (n == null ? void 0 : n.default_workspace_id) || (n == null ? void 0 : n.default_team_id) || null, i = r || this.tokenManager.getWorkspaceId() || null;
373
- return i && (this.tokenManager.setWorkspaceId(i), this.tokenManager.setTenantId((n == null ? void 0 : n.tenant_id) || i)), s && (this.tokenManager.setAccessToken(null), this.currentToken = null, r && this.tokenManager.setWorkspaceId(r)), this.notifyListeners(), !0;
340
+ const s = await t.json();
341
+ this.currentUser = s, this.tokenManager.setUser(s);
342
+ const r = (s == null ? void 0 : s.default_workspace_id) || (s == null ? void 0 : s.default_team_id) || null, i = r || this.tokenManager.getWorkspaceId() || null;
343
+ return i && (this.tokenManager.setWorkspaceId(i), this.tokenManager.setTenantId((s == null ? void 0 : s.tenant_id) || i)), n && (this.tokenManager.setAccessToken(null), this.currentToken = null, r && this.tokenManager.setWorkspaceId(r)), this.notifyListeners(), !0;
374
344
  } catch {
375
345
  return !1;
376
346
  }
@@ -379,23 +349,23 @@ class N {
379
349
  this.tokenManager.setTenantId(e), this.notifyListeners();
380
350
  }
381
351
  }
382
- class w extends Error {
352
+ class _ extends Error {
383
353
  /**
384
354
  * @param {string} message - Error message
385
355
  * @param {number} [status=0] - HTTP status code (0 for network errors)
386
356
  * @param {Object|null} [detail=null] - Error detail from API response
387
357
  */
388
- constructor(e, t = 0, s = null) {
389
- super(e), this.name = "APIError", this.status = t, this.detail = s;
358
+ constructor(e, t = 0, n = null) {
359
+ super(e), this.name = "APIError", this.status = t, this.detail = n;
390
360
  }
391
361
  }
392
- function U(o) {
393
- return typeof FormData < "u" && o instanceof FormData;
362
+ function q(a) {
363
+ return typeof FormData < "u" && a instanceof FormData;
394
364
  }
395
- function F(o) {
396
- return (o == null ? void 0 : o.name) === "AbortError";
365
+ function L(a) {
366
+ return (a == null ? void 0 : a.name) === "AbortError";
397
367
  }
398
- class J {
368
+ class W {
399
369
  /**
400
370
  * @param {import('../auth/AuthCore.js').AuthCore} authCore
401
371
  * @param {{ fetchFn?: typeof globalThis.fetch }} [options]
@@ -417,94 +387,80 @@ class J {
417
387
  * @param {RequestInit & { signal?: AbortSignal }} [options]
418
388
  */
419
389
  async request(e, t = {}) {
420
- var i, a;
421
- const s = `${this.baseURL}${e}`, n = {
422
- ...U(t.body) ? {} : { "Content-Type": "application/json" },
390
+ const n = `${this.baseURL}${e}`, s = {
391
+ ...q(t.body) ? {} : { "Content-Type": "application/json" },
423
392
  ...this.auth.getAuthHeaders(t.headers)
424
- }, r = this.auth.getRequestOptions({ ...t, headers: n });
393
+ }, r = this.auth.getRequestOptions({ ...t, headers: s });
425
394
  try {
426
- let c = await this.fetchFn(s, r);
427
- if (c.status === 401 && !t.__isRetry)
428
- try {
429
- await this.auth.refreshToken();
430
- const u = {
431
- ...U(t.body) ? {} : { "Content-Type": "application/json" },
432
- ...this.auth.getAuthHeaders(t.headers)
433
- };
434
- c = await this.fetchFn(
435
- s,
436
- this.auth.getRequestOptions({ ...r, headers: u, __isRetry: !0 })
437
- );
438
- } catch {
439
- }
440
- if (c.status === 401)
441
- throw (a = (i = this.auth).clearLocalAuth) == null || a.call(i), new w("Authentication required", 401, "auth_expired");
442
- if (c.status === 204)
395
+ const i = await T(this.auth, (o) => this.fetchFn(
396
+ n,
397
+ this.auth.getRequestOptions({
398
+ ...r,
399
+ headers: this.auth.getAuthHeaders(s),
400
+ ...o ? { __isRetry: !0 } : {}
401
+ })
402
+ ), { source: n, signal: t.signal, retry: !t.__isRetry });
403
+ if (i.status === 401)
404
+ throw new _("Authentication required", 401, "auth_expired");
405
+ if (i.status === 204)
443
406
  return null;
444
- if (!c.ok)
445
- throw await this._handleError(c);
446
- return await c.json();
447
- } catch (c) {
448
- throw c instanceof w || F(c) ? c : new w(c.message, 0, "network_error");
407
+ if (!i.ok)
408
+ throw await this._handleError(i);
409
+ return await i.json();
410
+ } catch (i) {
411
+ throw i.recoverable === !1 ? new _("Authentication required", 401, "auth_expired") : i instanceof _ || i.name === "SessionRefreshError" || L(i) ? i : new _(i.message, 0, "network_error");
449
412
  }
450
413
  }
451
414
  async get(e, t = {}) {
452
415
  return this.request(e, { ...t, method: "GET" });
453
416
  }
454
- async post(e, t, s = {}) {
417
+ async post(e, t, n = {}) {
455
418
  return this.request(e, {
456
- ...s,
419
+ ...n,
457
420
  method: "POST",
458
421
  body: JSON.stringify(t)
459
422
  });
460
423
  }
461
424
  async requestBinary(e, t = {}) {
462
- var i, a;
463
- const s = `${this.baseURL}${e}`, n = {
464
- ...U(t.body) ? {} : { "Content-Type": "application/json" },
425
+ const n = `${this.baseURL}${e}`, s = {
426
+ ...q(t.body) ? {} : { "Content-Type": "application/json" },
465
427
  ...this.auth.getAuthHeaders(t.headers)
466
- }, r = this.auth.getRequestOptions({ ...t, headers: n });
428
+ }, r = this.auth.getRequestOptions({ ...t, headers: s });
467
429
  try {
468
- let c = await this.fetchFn(s, r);
469
- if (c.status === 401 && !t.__isRetry)
470
- try {
471
- await this.auth.refreshToken();
472
- const u = {
473
- ...U(t.body) ? {} : { "Content-Type": "application/json" },
474
- ...this.auth.getAuthHeaders(t.headers)
475
- };
476
- c = await this.fetchFn(
477
- s,
478
- this.auth.getRequestOptions({ ...r, headers: u, __isRetry: !0 })
479
- );
480
- } catch {
481
- }
482
- if (c.status === 401)
483
- throw (a = (i = this.auth).clearLocalAuth) == null || a.call(i), new w("Authentication required", 401, "auth_expired");
484
- if (!c.ok)
485
- throw await this._handleError(c);
486
- return await c.arrayBuffer();
487
- } catch (c) {
488
- throw c instanceof w || F(c) ? c : new w(c.message, 0, "network_error");
430
+ const i = await T(this.auth, (o) => this.fetchFn(
431
+ n,
432
+ this.auth.getRequestOptions({
433
+ ...r,
434
+ headers: this.auth.getAuthHeaders(s),
435
+ ...o ? { __isRetry: !0 } : {}
436
+ })
437
+ ), { source: n, signal: t.signal, retry: !t.__isRetry });
438
+ if (i.status === 401)
439
+ throw new _("Authentication required", 401, "auth_expired");
440
+ if (!i.ok)
441
+ throw await this._handleError(i);
442
+ return await i.arrayBuffer();
443
+ } catch (i) {
444
+ throw i.recoverable === !1 ? new _("Authentication required", 401, "auth_expired") : i instanceof _ || i.name === "SessionRefreshError" || L(i) ? i : new _(i.message, 0, "network_error");
489
445
  }
490
446
  }
491
- async postForm(e, t, s = {}) {
447
+ async postForm(e, t, n = {}) {
492
448
  return this.request(e, {
493
- ...s,
449
+ ...n,
494
450
  method: "POST",
495
451
  body: t
496
452
  });
497
453
  }
498
- async put(e, t, s = {}) {
454
+ async put(e, t, n = {}) {
499
455
  return this.request(e, {
500
- ...s,
456
+ ...n,
501
457
  method: "PUT",
502
458
  body: JSON.stringify(t)
503
459
  });
504
460
  }
505
- async patch(e, t, s = {}) {
461
+ async patch(e, t, n = {}) {
506
462
  return this.request(e, {
507
- ...s,
463
+ ...n,
508
464
  method: "PATCH",
509
465
  body: JSON.stringify(t)
510
466
  });
@@ -514,15 +470,15 @@ class J {
514
470
  }
515
471
  /** @private */
516
472
  async _handleError(e) {
517
- var n, r;
473
+ var s, r;
518
474
  let t;
519
- const s = (r = (n = e.headers) == null ? void 0 : n.get) == null ? void 0 : r.call(n, "content-type");
475
+ const n = (r = (s = e.headers) == null ? void 0 : s.get) == null ? void 0 : r.call(s, "content-type");
520
476
  try {
521
- s != null && s.includes("application/json") ? t = await e.json() : t = { message: await e.text() };
477
+ n != null && n.includes("application/json") ? t = await e.json() : t = { message: await e.text() };
522
478
  } catch {
523
479
  t = { message: `HTTP ${e.status}` };
524
480
  }
525
- return new w(
481
+ return new _(
526
482
  this._extractMessage(t, e.status),
527
483
  e.status,
528
484
  t
@@ -541,18 +497,18 @@ class J {
541
497
  * @private
542
498
  */
543
499
  _extractMessage(e, t) {
544
- var n;
545
- const s = e == null ? void 0 : e.detail;
546
- if (typeof s == "string") return s;
547
- if (s && typeof s == "object") {
548
- if (typeof s.message == "string") return s.message;
549
- if (typeof s.code == "string") return s.code;
550
- if (Array.isArray(s) && typeof ((n = s[0]) == null ? void 0 : n.msg) == "string") return s[0].msg;
500
+ var s;
501
+ const n = e == null ? void 0 : e.detail;
502
+ if (typeof n == "string") return n;
503
+ if (n && typeof n == "object") {
504
+ if (typeof n.message == "string") return n.message;
505
+ if (typeof n.code == "string") return n.code;
506
+ if (Array.isArray(n) && typeof ((s = n[0]) == null ? void 0 : s.msg) == "string") return n[0].msg;
551
507
  }
552
508
  return typeof (e == null ? void 0 : e.message) == "string" ? e.message : `HTTP ${t}`;
553
509
  }
554
510
  }
555
- class V {
511
+ class B {
556
512
  constructor(e) {
557
513
  this.api = e;
558
514
  }
@@ -579,20 +535,20 @@ class V {
579
535
  async create({
580
536
  content: e,
581
537
  memoryType: t = "semantic",
582
- metadata: s = null,
583
- usePipeline: n = !0,
538
+ metadata: n = null,
539
+ usePipeline: s = !0,
584
540
  profileName: r = null,
585
541
  conversationContext: i = null,
586
- embed: a = null
542
+ embed: o = null
587
543
  }) {
588
544
  const c = {
589
545
  content: e,
590
546
  memory_type: t,
591
- metadata: s,
592
- use_pipeline: n,
547
+ metadata: n,
548
+ use_pipeline: s,
593
549
  profile_name: r
594
550
  };
595
- return i != null && (c.conversation_context = i), a != null && (c.embed = a), this.api.post("/memory/add", c);
551
+ return i != null && (c.conversation_context = i), o != null && (c.embed = o), this.api.post("/memory/add", c);
596
552
  }
597
553
  async get(e) {
598
554
  const t = await this.api.get(`/memory/${encodeURIComponent(e)}`);
@@ -614,11 +570,11 @@ class V {
614
570
  async update(e, t) {
615
571
  return this.api.patch(`/memory/${encodeURIComponent(e)}`, t);
616
572
  }
617
- async supersede(e, { content: t, memoryType: s, metadata: n = {}, reason: r }) {
573
+ async supersede(e, { content: t, memoryType: n, metadata: s = {}, reason: r }) {
618
574
  return this.api.post(`/memory/${encodeURIComponent(e)}/supersede`, {
619
575
  content: t,
620
- memory_type: s,
621
- metadata: n,
576
+ memory_type: n,
577
+ metadata: s,
622
578
  reason: r
623
579
  });
624
580
  }
@@ -638,10 +594,10 @@ class V {
638
594
  * @throws 400 if `newItemId` equals `id`; 404 if either item is missing *or*
639
595
  * out of scope (deliberately indistinguishable); 409 if the store declined.
640
596
  */
641
- async supersedeLink(e, t, s = null) {
597
+ async supersedeLink(e, t, n = null) {
642
598
  return this.api.post(`/memory/${encodeURIComponent(e)}/supersede-link`, {
643
599
  new_item_id: t,
644
- reason: s
600
+ reason: n
645
601
  });
646
602
  }
647
603
  async delete(e) {
@@ -667,13 +623,13 @@ class V {
667
623
  async list({
668
624
  limit: e = 50,
669
625
  offset: t = 0,
670
- type: s = null,
671
- metadataKey: n = null,
626
+ type: n = null,
627
+ metadataKey: s = null,
672
628
  metadataValue: r = null,
673
629
  includeGrounding: i = null
674
630
  } = {}) {
675
- const a = new URLSearchParams({ limit: e, offset: t });
676
- return s != null && a.append("memory_type", s), n != null && a.append("metadata_key", n), r != null && a.append("metadata_value", r), i != null && a.append("include_grounding", i), this.api.get(`/memory/list?${a}`);
631
+ const o = new URLSearchParams({ limit: e, offset: t });
632
+ return n != null && o.append("memory_type", n), s != null && o.append("metadata_key", s), r != null && o.append("metadata_value", r), i != null && o.append("include_grounding", i), this.api.get(`/memory/list?${o}`);
677
633
  }
678
634
  /**
679
635
  * Search for memory items.
@@ -741,21 +697,21 @@ class V {
741
697
  * hopStrategy: consensus follows entities several top results agree on; relevance follows
742
698
  * best-result entities and one-off bridges; semantic asks an LLM. Omitted preserves core default.
743
699
  * since/until: ISO strings or Dates bounding created_at in [since, until), independent of asOfDate. */
744
- async search(e, { topK: t = 5, enableHybrid: s = !0, memoryType: n = null, expertise: r = !1, cite: i = !1, decompose: a = !1, multiHop: c = !1, maxHops: u = 3, budgetMs: h = 1500, semanticHops: y = !1, includeReference: d = !1, includeConsolidated: $ = !1, consolidationFirst: k = !1, asOfDate: g = null, asOfStrict: p = !1, includeSuperseded: b = !1, includeRetracted: R = !1, includeArchived: C = !1, excludeSpeculative: m = !1, since: H = null, until: W = null, hopStrategy: x = null, channelWeights: T = null, reranker: M = null } = {}) {
745
- const l = { query: e, top_k: t, enable_hybrid: s };
746
- if (T != null) {
747
- const S = /* @__PURE__ */ new Set(["entity-graph", "ssg-traversal", "semantic", "regex-text", "lexical", "spreading-activation", "facts", "structural-semantic"]);
748
- for (const f of Object.keys(T)) {
700
+ async search(e, { topK: t = 5, enableHybrid: n = !0, memoryType: s = null, expertise: r = !1, cite: i = !1, decompose: o = !1, multiHop: c = !1, maxHops: u = 3, budgetMs: y = 1500, semanticHops: h = !1, includeReference: d = !1, includeConsolidated: $ = !1, consolidationFirst: k = !1, asOfDate: g = null, asOfStrict: p = !1, includeSuperseded: I = !1, includeRetracted: b = !1, includeArchived: v = !1, excludeSpeculative: m = !1, since: E = null, until: M = null, hopStrategy: A = null, channelWeights: S = null, reranker: C = null } = {}) {
701
+ const l = { query: e, top_k: t, enable_hybrid: n };
702
+ if (S != null) {
703
+ const R = /* @__PURE__ */ new Set(["entity-graph", "ssg-traversal", "semantic", "regex-text", "lexical", "spreading-activation", "facts", "structural-semantic"]);
704
+ for (const f of Object.keys(S)) {
749
705
  if (["contains", "keyword-bm25"].includes(f))
750
706
  throw new Error(`Channel ${f} was removed; use lexical.`);
751
- if (!S.has(f)) throw new Error(`Unknown search channel ${f}. Accepted: ${[...S].join(", ")}`);
707
+ if (!R.has(f)) throw new Error(`Unknown search channel ${f}. Accepted: ${[...R].join(", ")}`);
752
708
  }
753
- l.channel_weights = T;
709
+ l.channel_weights = S;
754
710
  }
755
- M != null && (l.reranker = M);
756
- for (const [S, f] of Object.entries({ since: H, until: W }))
757
- f != null && (l[S] = f instanceof Date ? f.toISOString() : f);
758
- return n && (l.memory_type = n), r && (l.expertise = !0), i && (l.cite = !0), a && (l.decompose = !0), x != null && (l.hop_strategy = x), c && (l.multi_hop = !0), c && u !== 3 && (l.max_hops = u), c && h !== 1500 && (l.budget_ms = h), c && y && (l.semantic_hops = !0), d && (l.include_reference = !0), $ && (l.include_consolidated = !0), k && (l.consolidation_first = !0), g && (l.as_of_date = g instanceof Date ? g.toISOString() : g), p && (l.as_of_strict = !0), b && (l.include_superseded = !0), R && (l.include_retracted = !0), C && (l.include_archived = !0), m && (l.exclude_speculative = !0), this.api.post("/memory/search", l);
711
+ C != null && (l.reranker = C);
712
+ for (const [R, f] of Object.entries({ since: E, until: M }))
713
+ f != null && (l[R] = f instanceof Date ? f.toISOString() : f);
714
+ return s && (l.memory_type = s), r && (l.expertise = !0), i && (l.cite = !0), o && (l.decompose = !0), A != null && (l.hop_strategy = A), c && (l.multi_hop = !0), c && u !== 3 && (l.max_hops = u), c && y !== 1500 && (l.budget_ms = y), c && h && (l.semantic_hops = !0), d && (l.include_reference = !0), $ && (l.include_consolidated = !0), k && (l.consolidation_first = !0), g && (l.as_of_date = g instanceof Date ? g.toISOString() : g), p && (l.as_of_strict = !0), I && (l.include_superseded = !0), b && (l.include_retracted = !0), v && (l.include_archived = !0), m && (l.exclude_speculative = !0), this.api.post("/memory/search", l);
759
715
  }
760
716
  /**
761
717
  * Ask a question and get a written answer plus the evidence behind it (DIST-LITE-9).
@@ -780,9 +736,9 @@ class V {
780
736
  * Relation rows carry both display labels and graph node ids; combine them as
781
737
  * `${source_id}->${target_id}:${type}` to address the edge in a graph view.
782
738
  */
783
- async ask(e, { limit: t = 5, reasoning: s = !0 } = {}) {
784
- const n = { question: e, limit: t };
785
- return s !== !0 && (n.reasoning = s), this.api.post("/memory/ask", n);
739
+ async ask(e, { limit: t = 5, reasoning: n = !0 } = {}) {
740
+ const s = { question: e, limit: t };
741
+ return n !== !0 && (s.reasoning = n), this.api.post("/memory/ask", s);
786
742
  }
787
743
  /**
788
744
  * Get the complete audit answer for one memory (PLAT-AUDITABLE-MEMORY-1).
@@ -800,28 +756,28 @@ class V {
800
756
  async explain(e) {
801
757
  return this.api.get(`/memory/${encodeURIComponent(e)}/explain`);
802
758
  }
803
- async getWorkingContext(e, t, { k: s = 20, maxTokens: n = null, strategy: r = null } = {}) {
759
+ async getWorkingContext(e, t, { k: n = 20, maxTokens: s = null, strategy: r = null } = {}) {
804
760
  const i = {
805
761
  session_id: e,
806
762
  query: t,
807
- k: s
763
+ k: n
808
764
  };
809
- return n != null && (i.max_tokens = n), r != null && (i.strategy = r), this.api.post("/memory/context", i);
765
+ return s != null && (i.max_tokens = s), r != null && (i.strategy = r), this.api.post("/memory/context", i);
810
766
  }
811
- async searchAdvanced(e, { algorithm: t = "query_traversal", maxResults: s = 15, useSSG: n = !0 } = {}) {
767
+ async searchAdvanced(e, { algorithm: t = "query_traversal", maxResults: n = 15, useSSG: s = !0 } = {}) {
812
768
  return this.api.post("/memory/search/advanced", {
813
769
  query: e,
814
770
  algorithm: t,
815
- max_results: s,
816
- use_ssg: n
771
+ max_results: n,
772
+ use_ssg: s
817
773
  });
818
774
  }
819
- async ingest(e, { profileName: t = null, extractorName: s = "llm", context: n = {} } = {}) {
775
+ async ingest(e, { profileName: t = null, extractorName: n = "llm", context: s = {} } = {}) {
820
776
  return this.api.post("/memory/ingest", {
821
777
  content: e,
822
778
  profile_name: t,
823
- extractor_name: s,
824
- context: n
779
+ extractor_name: n,
780
+ context: s
825
781
  });
826
782
  }
827
783
  async getLineage(e) {
@@ -839,15 +795,15 @@ class V {
839
795
  * endpoints return slightly different item shapes, so migrate deliberately rather
840
796
  * than by find-and-replace.
841
797
  */
842
- async searchByMetadata(e, t, { memoryType: s = null, limit: n = 25, since: r = null, until: i = null } = {}) {
843
- const a = new URLSearchParams({
798
+ async searchByMetadata(e, t, { memoryType: n = null, limit: s = 25, since: r = null, until: i = null } = {}) {
799
+ const o = new URLSearchParams({
844
800
  metadata_key: e,
845
801
  metadata_value: t,
846
- limit: n
802
+ limit: s
847
803
  });
848
804
  for (const [c, u] of Object.entries({ since: r, until: i }))
849
- u != null && a.append(c, u instanceof Date ? u.toISOString() : u);
850
- return s && a.append("memory_type", s), this.api.get(`/memory/by-metadata?${a}`);
805
+ u != null && o.append(c, u instanceof Date ? u.toISOString() : u);
806
+ return n && o.append("memory_type", n), this.api.get(`/memory/by-metadata?${o}`);
851
807
  }
852
808
  async getNeighbors(e) {
853
809
  return this.api.get(`/memory/${encodeURIComponent(e)}/neighbors`);
@@ -857,19 +813,19 @@ class V {
857
813
  }
858
814
  async ingestConversation(e, {
859
815
  sessionBoundaries: t = null,
860
- conversationId: s = null,
861
- sessionDates: n = null,
816
+ conversationId: n = null,
817
+ sessionDates: s = null,
862
818
  turnsPerChunk: r = 15,
863
819
  maxChunkChars: i = 12e3,
864
- maxConcurrent: a = 4,
820
+ maxConcurrent: o = 4,
865
821
  context: c = null
866
822
  } = {}) {
867
- const u = { turns: e, turns_per_chunk: r, max_chunk_chars: i, max_concurrent: a };
868
- return t && (u.session_boundaries = t), s && (u.conversation_id = s), n && (u.session_dates = n), c !== null && (u.context = c), this.api.post("/memory/ingest/conversation", u);
823
+ const u = { turns: e, turns_per_chunk: r, max_chunk_chars: i, max_concurrent: o };
824
+ return t && (u.session_boundaries = t), n && (u.conversation_id = n), s && (u.session_dates = s), c !== null && (u.context = c), this.api.post("/memory/ingest/conversation", u);
869
825
  }
870
- async ingestDocument(e, { title: t = null, source: s = null, chunkStrategy: n = null, context: r = null } = {}) {
826
+ async ingestDocument(e, { title: t = null, source: n = null, chunkStrategy: s = null, context: r = null } = {}) {
871
827
  const i = { content: e };
872
- return t && (i.title = t), s && (i.source = s), n && (i.chunk_strategy = n), r !== null && (i.context = r), this.api.post("/memory/ingest/document", i);
828
+ return t && (i.title = t), n && (i.source = n), s && (i.chunk_strategy = s), r !== null && (i.context = r), this.api.post("/memory/ingest/document", i);
873
829
  }
874
830
  /**
875
831
  * Import a ChatGPT or Claude conversation export (DIST-CHAT-IMPORT-1).
@@ -891,38 +847,38 @@ class V {
891
847
  * `warnings` — a non-empty list means something was capped, skipped, or degraded
892
848
  * even though the call succeeded.
893
849
  */
894
- async importChatExport(e, { sourceFormat: t = "auto", maxConversations: s = 25 } = {}) {
895
- const n = new FormData();
896
- return n.append("file", e, e.name || "conversations.json"), n.append("source_format", t), n.append("max_conversations", String(s)), this.api.post("/memory/import/chat-export", n);
850
+ async importChatExport(e, { sourceFormat: t = "auto", maxConversations: n = 25 } = {}) {
851
+ const s = new FormData();
852
+ return s.append("file", e, e.name || "conversations.json"), s.append("source_format", t), s.append("max_conversations", String(n)), this.api.post("/memory/import/chat-export", s);
897
853
  }
898
854
  /** List supported chat-export formats and how a user obtains each export. */
899
855
  async chatExportFormats() {
900
856
  return this.api.get("/memory/import/chat-export/formats");
901
857
  }
902
- async codeIndex(e, { repo: t = null, commit: s = null } = {}) {
903
- const n = { path: e };
904
- return t && (n.repo = t), s && (n.commit = s), this.api.post("/memory/code/index", n);
858
+ async codeIndex(e, { repo: t = null, commit: n = null } = {}) {
859
+ const s = { path: e };
860
+ return t && (s.repo = t), n && (s.commit = n), this.api.post("/memory/code/index", s);
905
861
  }
906
- async codeSearch(e, { entityType: t = null, repo: s = null, limit: n = 20, semantic: r = !1 } = {}) {
907
- const i = new URLSearchParams({ query: e, limit: n, semantic: r });
908
- return t && i.append("entity_type", t), s && i.append("repo", s), this.api.get(`/memory/code/search?${i}`);
862
+ async codeSearch(e, { entityType: t = null, repo: n = null, limit: s = 20, semantic: r = !1 } = {}) {
863
+ const i = new URLSearchParams({ query: e, limit: s, semantic: r });
864
+ return t && i.append("entity_type", t), n && i.append("repo", n), this.api.get(`/memory/code/search?${i}`);
909
865
  }
910
866
  async codeContext(e, { repo: t = null } = {}) {
911
- const s = new URLSearchParams({ entity_name: e });
912
- return t && s.append("repo", t), this.api.get(`/memory/code/context?${s}`);
867
+ const n = new URLSearchParams({ entity_name: e });
868
+ return t && n.append("repo", t), this.api.get(`/memory/code/context?${n}`);
913
869
  }
914
870
  async codeDeadCode(e) {
915
871
  return this.api.get(`/memory/code/dead-code?repo=${encodeURIComponent(e)}`);
916
872
  }
917
- async codeDependencies(e, { direction: t = "both", repo: s = null } = {}) {
918
- const n = new URLSearchParams({ entity_name: e, direction: t });
919
- return s && n.append("repo", s), this.api.get(`/memory/code/dependencies?${n}`);
873
+ async codeDependencies(e, { direction: t = "both", repo: n = null } = {}) {
874
+ const s = new URLSearchParams({ entity_name: e, direction: t });
875
+ return n && s.append("repo", n), this.api.get(`/memory/code/dependencies?${s}`);
920
876
  }
921
877
  async getPlan(e) {
922
878
  return this.api.get(`/memory/plans/${e}`);
923
879
  }
924
- async updatePlanTask(e, { taskId: t, status: s }) {
925
- return this.api.patch(`/memory/plans/${e}/task`, { task_id: t, status: s });
880
+ async updatePlanTask(e, { taskId: t, status: n }) {
881
+ return this.api.patch(`/memory/plans/${e}/task`, { task_id: t, status: n });
926
882
  }
927
883
  async completePlan(e, { graduate: t = !1 } = {}) {
928
884
  return this.api.post(`/memory/plans/${e}/complete`, { graduate: t });
@@ -930,11 +886,11 @@ class V {
930
886
  async failPlan(e, t) {
931
887
  return this.api.post(`/memory/plans/${e}/fail`, { reason: t });
932
888
  }
933
- async link(e, t, s = "RELATED") {
889
+ async link(e, t, n = "RELATED") {
934
890
  return this.api.post("/memory/link", {
935
891
  source_id: e,
936
892
  target_id: t,
937
- link_type: s
893
+ link_type: n
938
894
  });
939
895
  }
940
896
  async enrich(e, t = []) {
@@ -964,9 +920,9 @@ class V {
964
920
  * @param {string} [query] - Original query that produced these results.
965
921
  * @returns {Promise<{updated: number, edges_strengthened: number, outcome: string}>}
966
922
  */
967
- async feedback(e, t, s = null) {
968
- const n = { item_ids: e, outcome: t };
969
- return s != null && (n.query = s), this.api.post("/memory/feedback", n);
923
+ async feedback(e, t, n = null) {
924
+ const s = { item_ids: e, outcome: t };
925
+ return n != null && (s.query = n), this.api.post("/memory/feedback", s);
970
926
  }
971
927
  /**
972
928
  * Request grounding for a memory item.
@@ -974,40 +930,40 @@ class V {
974
930
  * The endpoint currently returns HTTP 501 because
975
931
  * CORE-GROUND-ROUTE-CONTRACT-1 is not implemented.
976
932
  */
977
- async ground(e, t, s = null) {
933
+ async ground(e, t, n = null) {
978
934
  return this.api.post(`/memory/${encodeURIComponent(e)}/ground`, {
979
935
  item_id: e,
980
936
  source_url: t,
981
- validation: s
937
+ validation: n
982
938
  });
983
939
  }
984
940
  async clearAll(e = !1) {
985
941
  return this.api.delete(`/memory/clear-all?nuclear=${e}`);
986
942
  }
987
943
  // --- Temporal ---
988
- async getHistory(e, { startTime: t = null, endTime: s = null, limit: n = 100 } = {}) {
989
- let r = `/memory/temporal/${e}/history?limit=${n}`;
990
- return t && (r += `&start_time=${t}`), s && (r += `&end_time=${s}`), this.api.get(r);
944
+ async getHistory(e, { startTime: t = null, endTime: n = null, limit: s = 100 } = {}) {
945
+ let r = `/memory/temporal/${e}/history?limit=${s}`;
946
+ return t && (r += `&start_time=${t}`), n && (r += `&end_time=${n}`), this.api.get(r);
991
947
  }
992
- async timeTravel(e, { query: t = null, limit: s = 100 } = {}) {
993
- let n = `/memory/temporal/at/${e}?limit=${s}`;
994
- return t && (n += `&query=${encodeURIComponent(t)}`), this.api.get(n);
948
+ async timeTravel(e, { query: t = null, limit: n = 100 } = {}) {
949
+ let s = `/memory/temporal/at/${e}?limit=${n}`;
950
+ return t && (s += `&query=${encodeURIComponent(t)}`), this.api.get(s);
995
951
  }
996
952
  async getItemAtTime(e, t) {
997
953
  return this.api.get(`/memory/temporal/${e}/at/${t}`);
998
954
  }
999
- async getChanges(e, { since: t = null, until: s = null, changeType: n = null } = {}) {
955
+ async getChanges(e, { since: t = null, until: n = null, changeType: s = null } = {}) {
1000
956
  let r = `/memory/temporal/${e}/changes`;
1001
957
  const i = [];
1002
- return t && i.push(`since=${t}`), s && i.push(`until=${s}`), n && i.push(`change_type=${n}`), i.length && (r += `?${i.join("&")}`), this.api.get(r);
958
+ return t && i.push(`since=${t}`), n && i.push(`until=${n}`), s && i.push(`change_type=${s}`), i.length && (r += `?${i.join("&")}`), this.api.get(r);
1003
959
  }
1004
- async compareVersions(e, t, s) {
1005
- return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${s}`);
960
+ async compareVersions(e, t, n) {
961
+ return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${n}`);
1006
962
  }
1007
- async rollback(e, { toVersion: t = null, toTime: s = null } = {}) {
1008
- let n = `/memory/temporal/${e}/rollback`;
963
+ async rollback(e, { toVersion: t = null, toTime: n = null } = {}) {
964
+ let s = `/memory/temporal/${e}/rollback`;
1009
965
  const r = [];
1010
- return t !== null && r.push(`to_version=${t}`), s && r.push(`to_time=${s}`), r.length && (n += `?${r.join("&")}`), this.api.post(n);
966
+ return t !== null && r.push(`to_version=${t}`), n && r.push(`to_time=${n}`), r.length && (s += `?${r.join("&")}`), this.api.post(s);
1011
967
  }
1012
968
  // --- Clustering ---
1013
969
  async runClustering(e = 0.1, t = !1) {
@@ -1017,7 +973,7 @@ class V {
1017
973
  return this.api.get("/memory/clustering/stats");
1018
974
  }
1019
975
  }
1020
- class Y {
976
+ class K {
1021
977
  constructor(e) {
1022
978
  this.api = e;
1023
979
  }
@@ -1039,29 +995,29 @@ class Y {
1039
995
  async create({
1040
996
  content: e,
1041
997
  decisionType: t = "inference",
1042
- confidence: s = 0.8,
1043
- sourceTraceId: n = null,
998
+ confidence: n = 0.8,
999
+ sourceTraceId: s = null,
1044
1000
  sourceSessionId: r = null,
1045
1001
  evidenceIds: i = null,
1046
- domain: a = null,
1002
+ domain: o = null,
1047
1003
  tags: c = null,
1048
1004
  rejectedAlternatives: u = null,
1049
- rationale: h = null,
1050
- constraints: y = null,
1005
+ rationale: y = null,
1006
+ constraints: h = null,
1051
1007
  agentId: d = null
1052
1008
  }) {
1053
1009
  return this.api.post("/memory/decisions/create", {
1054
1010
  content: e,
1055
1011
  decision_type: t,
1056
- confidence: s,
1057
- source_trace_id: n,
1012
+ confidence: n,
1013
+ source_trace_id: s,
1058
1014
  source_session_id: r,
1059
1015
  evidence_ids: i,
1060
- domain: a,
1016
+ domain: o,
1061
1017
  tags: c,
1062
1018
  rejected_alternatives: u,
1063
- rationale: h,
1064
- constraints: y,
1019
+ rationale: y,
1020
+ constraints: h,
1065
1021
  agent_id: d
1066
1022
  });
1067
1023
  }
@@ -1126,12 +1082,12 @@ class Y {
1126
1082
  * @param {string[]} [params.tags]
1127
1083
  * @param {string} [params.agentId]
1128
1084
  */
1129
- async createPending({ content: e, requirements: t, domain: s = null, tags: n = null, agentId: r = null }) {
1085
+ async createPending({ content: e, requirements: t, domain: n = null, tags: s = null, agentId: r = null }) {
1130
1086
  return this.api.post("/memory/decisions/pending/create", {
1131
1087
  content: e,
1132
1088
  requirements: t,
1133
- domain: s,
1134
- tags: n,
1089
+ domain: n,
1090
+ tags: s,
1135
1091
  agent_id: r
1136
1092
  });
1137
1093
  }
@@ -1142,10 +1098,10 @@ class Y {
1142
1098
  * @param {string} params.requirementId
1143
1099
  * @param {string} params.memoryId
1144
1100
  */
1145
- async resolveRequirement(e, { requirementId: t, memoryId: s }) {
1101
+ async resolveRequirement(e, { requirementId: t, memoryId: n }) {
1146
1102
  return this.api.post(`/memory/decisions/pending/${e}/resolve`, {
1147
1103
  requirement_id: t,
1148
- memory_id: s
1104
+ memory_id: n
1149
1105
  });
1150
1106
  }
1151
1107
  /**
@@ -1230,8 +1186,8 @@ class Y {
1230
1186
  * @param {string} [options.direction='both'] - causes|effects|both
1231
1187
  * @param {number} [options.maxDepth=3]
1232
1188
  */
1233
- async getCausalChain(e, { direction: t = "both", maxDepth: s = 3 } = {}) {
1234
- return this.api.get(`/memory/decisions/${e}/causal-chain?direction=${t}&max_depth=${s}`);
1189
+ async getCausalChain(e, { direction: t = "both", maxDepth: n = 3 } = {}) {
1190
+ return this.api.get(`/memory/decisions/${e}/causal-chain?direction=${t}&max_depth=${n}`);
1235
1191
  }
1236
1192
  /**
1237
1193
  * Find existing decisions that may conflict with this one.
@@ -1265,7 +1221,7 @@ class Y {
1265
1221
  });
1266
1222
  }
1267
1223
  }
1268
- class X {
1224
+ class H {
1269
1225
  constructor(e) {
1270
1226
  this.api = e;
1271
1227
  }
@@ -1283,11 +1239,11 @@ class X {
1283
1239
  * server auto-populate from scope.resolve_agent_id().
1284
1240
  */
1285
1241
  async createOpinion(e, t = {}) {
1286
- const s = { content: e };
1287
- 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);
1242
+ const n = { content: e };
1243
+ return t.confidence !== void 0 && (n.confidence = t.confidence), t.subject !== void 0 && (n.subject = t.subject), t.subjectType !== void 0 && (n.subject_type = t.subjectType), t.disposition !== void 0 && (n.disposition = t.disposition), t.formedFrom !== void 0 && (n.formed_from = t.formedFrom), t.domain !== void 0 && (n.domain = t.domain), t.agentId !== void 0 && (n.agent_id = t.agentId), this.api.post("/memory/opinions/create", n);
1288
1244
  }
1289
1245
  }
1290
- class Z {
1246
+ class D {
1291
1247
  constructor(e) {
1292
1248
  this.api = e;
1293
1249
  }
@@ -1299,12 +1255,12 @@ class Z {
1299
1255
  async getNeighbors(e, t = {}) {
1300
1256
  return this.api.get(`/memory/${encodeURIComponent(e)}/neighbors`, t);
1301
1257
  }
1302
- async addEdge(e, t, s, n = {}) {
1258
+ async addEdge(e, t, n, s = {}) {
1303
1259
  return this.api.post("/memory/edge", {
1304
1260
  source_id: e,
1305
1261
  target_id: t,
1306
- relation_type: s,
1307
- properties: n
1262
+ relation_type: n,
1263
+ properties: s
1308
1264
  });
1309
1265
  }
1310
1266
  /** @param {{ signal?: AbortSignal }} [options] */
@@ -1327,8 +1283,8 @@ class Z {
1327
1283
  * @param {number} [maxHops=5]
1328
1284
  * @param {{ signal?: AbortSignal }} [options]
1329
1285
  */
1330
- async findShortestPath(e, t, s = 5, n = {}) {
1331
- return this.api.get(`/memory/graph/path?start_id=${encodeURIComponent(e)}&end_id=${encodeURIComponent(t)}&max_hops=${s}`, n);
1286
+ async findShortestPath(e, t, n = 5, s = {}) {
1287
+ return this.api.get(`/memory/graph/path?start_id=${encodeURIComponent(e)}&end_id=${encodeURIComponent(t)}&max_hops=${n}`, s);
1332
1288
  }
1333
1289
  /**
1334
1290
  * Fetch the full knowledge graph.
@@ -1345,9 +1301,9 @@ class Z {
1345
1301
  * @param {string[]} nodeIds
1346
1302
  * @param {{ includeProperties?: boolean, signal?: AbortSignal }} [options]
1347
1303
  */
1348
- async getEdgesBulk(e, { includeProperties: t = !1, signal: s } = {}) {
1349
- const n = t ? "?include_properties=true" : "";
1350
- return this.api.post(`/memory/graph/edges${n}`, { node_ids: e }, s ? { signal: s } : {});
1304
+ async getEdgesBulk(e, { includeProperties: t = !1, signal: n } = {}) {
1305
+ const s = t ? "?include_properties=true" : "";
1306
+ return this.api.post(`/memory/graph/edges${s}`, { node_ids: e }, n ? { signal: n } : {});
1351
1307
  }
1352
1308
  /**
1353
1309
  * Bulk upsert graph nodes and edges, optionally replacing a node-ID prefix.
@@ -1356,9 +1312,9 @@ class Z {
1356
1312
  * @param {Array<Object>} [params.edges=[]] - Edges with source_id, target_id, edge_type, and properties.
1357
1313
  * @param {string|null} [params.deletePrefix=null] - Scoped node-ID prefix to delete before writing.
1358
1314
  */
1359
- async bulkUpsert({ nodes: e = [], edges: t = [], deletePrefix: s = null } = {}) {
1360
- const n = { nodes: e, edges: t };
1361
- return s !== null && (n.delete_prefix = s), this.api.post("/memory/graph/bulk", n);
1315
+ async bulkUpsert({ nodes: e = [], edges: t = [], deletePrefix: n = null } = {}) {
1316
+ const s = { nodes: e, edges: t };
1317
+ return n !== null && (s.delete_prefix = n), this.api.post("/memory/graph/bulk", s);
1362
1318
  }
1363
1319
  /**
1364
1320
  * Get Wikipedia grounding status for an entity node.
@@ -1436,7 +1392,7 @@ class Z {
1436
1392
  );
1437
1393
  }
1438
1394
  }
1439
- class Q {
1395
+ class G {
1440
1396
  constructor(e) {
1441
1397
  this.api = e;
1442
1398
  }
@@ -1444,12 +1400,12 @@ class Q {
1444
1400
  const t = e ? "?include_system=true" : "";
1445
1401
  return this.api.get(`/memory/teams${t}`);
1446
1402
  }
1447
- async create({ name: e, description: t = null, dataClassification: s = "internal", costCenter: n = null, isSystem: r = !1 }) {
1403
+ async create({ name: e, description: t = null, dataClassification: n = "internal", costCenter: s = null, isSystem: r = !1 }) {
1448
1404
  const i = {
1449
1405
  name: e,
1450
1406
  description: t,
1451
- data_classification: s,
1452
- cost_center: n
1407
+ data_classification: n,
1408
+ cost_center: s
1453
1409
  };
1454
1410
  return r && (i.is_system = !0), this.api.post("/memory/teams", i);
1455
1411
  }
@@ -1465,37 +1421,37 @@ class Q {
1465
1421
  async getMembers(e) {
1466
1422
  return this.api.get(`/memory/teams/${e}/members`);
1467
1423
  }
1468
- async addMember(e, t, s = "member") {
1424
+ async addMember(e, t, n = "member") {
1469
1425
  return this.api.post(`/memory/teams/${e}/members`, {
1470
1426
  user_id: t,
1471
- role: s
1427
+ role: n
1472
1428
  });
1473
1429
  }
1474
- async updateMember(e, t, s) {
1475
- return this.api.patch(`/memory/teams/${e}/members/${t}`, { role: s });
1430
+ async updateMember(e, t, n) {
1431
+ return this.api.patch(`/memory/teams/${e}/members/${t}`, { role: n });
1476
1432
  }
1477
1433
  async removeMember(e, t) {
1478
1434
  return this.api.delete(`/memory/teams/${e}/members/${t}`);
1479
1435
  }
1480
1436
  }
1481
- class ee {
1437
+ class N {
1482
1438
  constructor(e) {
1483
1439
  this.api = e;
1484
1440
  }
1485
1441
  async list() {
1486
1442
  return this.api.get("/memory/workspaces");
1487
1443
  }
1488
- async create({ name: e, teamId: t, description: s = null }) {
1444
+ async create({ name: e, teamId: t, description: n = null }) {
1489
1445
  return this.api.post("/memory/workspaces", {
1490
1446
  name: e,
1491
- description: s,
1447
+ description: n,
1492
1448
  team_id: t
1493
1449
  });
1494
1450
  }
1495
- async share(e, { teamId: t, permission: s }) {
1451
+ async share(e, { teamId: t, permission: n }) {
1496
1452
  return this.api.post(`/memory/workspaces/${encodeURIComponent(e)}/share`, {
1497
1453
  team_id: t,
1498
- permission: s
1454
+ permission: n
1499
1455
  });
1500
1456
  }
1501
1457
  async revoke(e, t) {
@@ -1507,7 +1463,7 @@ class ee {
1507
1463
  return this.api.get(`/memory/teams/${encodeURIComponent(e)}/workspaces`);
1508
1464
  }
1509
1465
  }
1510
- class te {
1466
+ class J {
1511
1467
  constructor(e) {
1512
1468
  this.api = e;
1513
1469
  }
@@ -1529,7 +1485,7 @@ class te {
1529
1485
  return this.api.patch("/auth/llm-keys", e);
1530
1486
  }
1531
1487
  }
1532
- class se {
1488
+ class V {
1533
1489
  constructor(e) {
1534
1490
  this.api = e;
1535
1491
  }
@@ -1555,18 +1511,18 @@ class se {
1555
1511
  });
1556
1512
  }
1557
1513
  }
1558
- class ne {
1514
+ class Y {
1559
1515
  constructor(e) {
1560
1516
  this.api = e;
1561
1517
  }
1562
1518
  async getCurrentUser() {
1563
1519
  return this.api.get("/auth/me");
1564
1520
  }
1565
- async createAPIKey(e, t, s = null) {
1521
+ async createAPIKey(e, t, n = null) {
1566
1522
  return this.api.post("/memory/api-keys", {
1567
1523
  name: e,
1568
1524
  scopes: t,
1569
- expires_in_days: s
1525
+ expires_in_days: n
1570
1526
  });
1571
1527
  }
1572
1528
  async listAPIKeys() {
@@ -1576,19 +1532,19 @@ class ne {
1576
1532
  return this.api.delete(`/memory/api-keys/${e}`);
1577
1533
  }
1578
1534
  }
1579
- class re {
1535
+ class X {
1580
1536
  constructor(e) {
1581
1537
  this.api = e;
1582
1538
  }
1583
1539
  async list() {
1584
1540
  return this.api.get("/memory/agents");
1585
1541
  }
1586
- async create({ name: e, description: t = null, agentConfig: s = {}, roles: n = ["user"] }) {
1542
+ async create({ name: e, description: t = null, agentConfig: n = {}, roles: s = ["user"] }) {
1587
1543
  return this.api.post("/memory/agents", {
1588
1544
  name: e,
1589
1545
  description: t,
1590
- agent_config: s,
1591
- roles: n
1546
+ agent_config: n,
1547
+ roles: s
1592
1548
  });
1593
1549
  }
1594
1550
  async get(e) {
@@ -1614,9 +1570,9 @@ class re {
1614
1570
  * @param {string} domain - Domain string (e.g. "python").
1615
1571
  * @returns {Promise<{evaluation: object|null}>}
1616
1572
  */
1617
- async getEvaluation(e, t, s) {
1618
- const n = new URLSearchParams({ dimension: t, domain: s }).toString();
1619
- return this.api.get(`/memory/agents/${e}/evaluation${n ? "?" + n : ""}`);
1573
+ async getEvaluation(e, t, n) {
1574
+ const s = new URLSearchParams({ dimension: t, domain: n }).toString();
1575
+ return this.api.get(`/memory/agents/${e}/evaluation${s ? "?" + s : ""}`);
1620
1576
  }
1621
1577
  /**
1622
1578
  * Get evaluation history for an agent on a given (dimension, domain) slot.
@@ -1630,12 +1586,12 @@ class re {
1630
1586
  * @param {number} [options.limit=20] - Maximum records to return.
1631
1587
  * @returns {Promise<{history: object[]}>}
1632
1588
  */
1633
- async listEvaluationHistory(e, t, s, { limit: n = 20 } = {}) {
1634
- const r = new URLSearchParams({ dimension: t, domain: s, limit: String(n) }).toString();
1589
+ async listEvaluationHistory(e, t, n, { limit: s = 20 } = {}) {
1590
+ const r = new URLSearchParams({ dimension: t, domain: n, limit: String(s) }).toString();
1635
1591
  return this.api.get(`/memory/agents/${e}/evaluation/history${r ? "?" + r : ""}`);
1636
1592
  }
1637
1593
  }
1638
- class ie {
1594
+ class Z {
1639
1595
  constructor(e) {
1640
1596
  this.api = e;
1641
1597
  }
@@ -1649,7 +1605,7 @@ class ie {
1649
1605
  return this.api.get("/usage/tiers");
1650
1606
  }
1651
1607
  }
1652
- class ae {
1608
+ class Q {
1653
1609
  constructor(e) {
1654
1610
  this.api = e;
1655
1611
  }
@@ -1666,7 +1622,7 @@ class ae {
1666
1622
  return this.api.get("/memory/plugins");
1667
1623
  }
1668
1624
  }
1669
- class oe {
1625
+ class ee {
1670
1626
  constructor(e) {
1671
1627
  this.api = e;
1672
1628
  }
@@ -1689,7 +1645,7 @@ class oe {
1689
1645
  return this.api.get("/memory/token-usage/current");
1690
1646
  }
1691
1647
  }
1692
- class ce {
1648
+ class te {
1693
1649
  constructor(e) {
1694
1650
  this.api = e;
1695
1651
  }
@@ -1702,9 +1658,9 @@ class ce {
1702
1658
  * @param {string} [options.endTime] - ISO end time
1703
1659
  * @param {number} [options.limit=100]
1704
1660
  */
1705
- async getHistory(e, { startTime: t = null, endTime: s = null, limit: n = 100 } = {}) {
1706
- let r = `/memory/temporal/${e}/history?limit=${n}`;
1707
- return t && (r += `&start_time=${t}`), s && (r += `&end_time=${s}`), this.api.get(r);
1661
+ async getHistory(e, { startTime: t = null, endTime: n = null, limit: s = 100 } = {}) {
1662
+ let r = `/memory/temporal/${e}/history?limit=${s}`;
1663
+ return t && (r += `&start_time=${t}`), n && (r += `&end_time=${n}`), this.api.get(r);
1708
1664
  }
1709
1665
  // === TIME-TRAVEL QUERIES ===
1710
1666
  /**
@@ -1714,9 +1670,9 @@ class ce {
1714
1670
  * @param {string} [options.query]
1715
1671
  * @param {number} [options.limit=100]
1716
1672
  */
1717
- async timeTravel(e, { query: t = null, limit: s = 100 } = {}) {
1718
- let n = `/memory/temporal/at/${e}?limit=${s}`;
1719
- return t && (n += `&query=${encodeURIComponent(t)}`), this.api.get(n);
1673
+ async timeTravel(e, { query: t = null, limit: n = 100 } = {}) {
1674
+ let s = `/memory/temporal/at/${e}?limit=${n}`;
1675
+ return t && (s += `&query=${encodeURIComponent(t)}`), this.api.get(s);
1720
1676
  }
1721
1677
  /**
1722
1678
  * Get specific item as it existed at timestamp.
@@ -1735,10 +1691,10 @@ class ce {
1735
1691
  * @param {string} [options.until]
1736
1692
  * @param {string} [options.changeType]
1737
1693
  */
1738
- async getChanges(e, { since: t = null, until: s = null, changeType: n = null } = {}) {
1694
+ async getChanges(e, { since: t = null, until: n = null, changeType: s = null } = {}) {
1739
1695
  let r = `/memory/temporal/${e}/changes`;
1740
1696
  const i = [];
1741
- return t && i.push(`since=${t}`), s && i.push(`until=${s}`), n && i.push(`change_type=${n}`), i.length && (r += `?${i.join("&")}`), this.api.get(r);
1697
+ return t && i.push(`since=${t}`), n && i.push(`until=${n}`), s && i.push(`change_type=${s}`), i.length && (r += `?${i.join("&")}`), this.api.get(r);
1742
1698
  }
1743
1699
  // === VERSION COMPARISON ===
1744
1700
  /**
@@ -1747,8 +1703,8 @@ class ce {
1747
1703
  * @param {number} v1
1748
1704
  * @param {number} v2
1749
1705
  */
1750
- async compareVersions(e, t, s) {
1751
- return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${s}`);
1706
+ async compareVersions(e, t, n) {
1707
+ return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${n}`);
1752
1708
  }
1753
1709
  // === ROLLBACK ===
1754
1710
  /**
@@ -1758,10 +1714,10 @@ class ce {
1758
1714
  * @param {number} [options.toVersion]
1759
1715
  * @param {string} [options.toTime]
1760
1716
  */
1761
- async rollback(e, { toVersion: t = null, toTime: s = null } = {}) {
1762
- let n = `/memory/temporal/${e}/rollback`;
1717
+ async rollback(e, { toVersion: t = null, toTime: n = null } = {}) {
1718
+ let s = `/memory/temporal/${e}/rollback`;
1763
1719
  const r = [];
1764
- return t !== null && r.push(`to_version=${t}`), s && r.push(`to_time=${s}`), r.length && (n += `?${r.join("&")}`), this.api.post(n);
1720
+ return t !== null && r.push(`to_version=${t}`), n && r.push(`to_time=${n}`), r.length && (s += `?${r.join("&")}`), this.api.post(s);
1765
1721
  }
1766
1722
  // === AUDIT TRAIL ===
1767
1723
  /**
@@ -1773,10 +1729,10 @@ class ce {
1773
1729
  * @param {string} [options.startTime]
1774
1730
  * @param {string} [options.endTime]
1775
1731
  */
1776
- async getAuditTrail(e, { changeType: t = null, userId: s = null, startTime: n = null, endTime: r = null } = {}) {
1732
+ async getAuditTrail(e, { changeType: t = null, userId: n = null, startTime: s = null, endTime: r = null } = {}) {
1777
1733
  let i = `/memory/temporal/${e}/audit`;
1778
- const a = [];
1779
- return t && a.push(`change_type=${t}`), s && a.push(`user_id=${s}`), n && a.push(`start_time=${n}`), r && a.push(`end_time=${r}`), a.length && (i += `?${a.join("&")}`), this.api.get(i);
1734
+ const o = [];
1735
+ return t && o.push(`change_type=${t}`), n && o.push(`user_id=${n}`), s && o.push(`start_time=${s}`), r && o.push(`end_time=${r}`), o.length && (i += `?${o.join("&")}`), this.api.get(i);
1780
1736
  }
1781
1737
  // === TEMPORAL SEARCH ===
1782
1738
  /**
@@ -1786,12 +1742,12 @@ class ce {
1786
1742
  * @param {string} endTime
1787
1743
  * @param {number} [limit=100]
1788
1744
  */
1789
- async searchDuringRange(e, t, s, n = 100) {
1745
+ async searchDuringRange(e, t, n, s = 100) {
1790
1746
  const r = new URLSearchParams({
1791
1747
  query: e,
1792
1748
  start_time: t,
1793
- end_time: s,
1794
- limit: String(n)
1749
+ end_time: n,
1750
+ limit: String(s)
1795
1751
  }).toString();
1796
1752
  return this.api.get(`/memory/temporal/search/during?${r}`);
1797
1753
  }
@@ -1804,10 +1760,10 @@ class ce {
1804
1760
  * @param {string} [options.reportType='HIPAA']
1805
1761
  * @param {string[]} [options.itemIds]
1806
1762
  */
1807
- async complianceReport(e, t, { reportType: s = "HIPAA", itemIds: n = null } = {}) {
1808
- let r = `/memory/temporal/compliance/report?start_date=${e}&end_date=${t}&report_type=${s}`;
1809
- if (n && n.length)
1810
- for (const i of n)
1763
+ async complianceReport(e, t, { reportType: n = "HIPAA", itemIds: s = null } = {}) {
1764
+ let r = `/memory/temporal/compliance/report?start_date=${e}&end_date=${t}&report_type=${n}`;
1765
+ if (s && s.length)
1766
+ for (const i of s)
1811
1767
  r += `&item_ids=${encodeURIComponent(i)}`;
1812
1768
  return this.api.get(r);
1813
1769
  }
@@ -1835,7 +1791,7 @@ class ce {
1835
1791
  return this.api.get(`/memory/temporal/relationships/${e}/valid-periods`);
1836
1792
  }
1837
1793
  }
1838
- class ue {
1794
+ class ne {
1839
1795
  constructor(e) {
1840
1796
  this.api = e;
1841
1797
  }
@@ -1846,11 +1802,11 @@ class ue {
1846
1802
  * @param {number} [options.topK=100]
1847
1803
  * @param {Object[]} [options.memoryItems] - Direct items to analyze
1848
1804
  */
1849
- async runAnalysis({ query: e = "*", topK: t = 100, memoryItems: s = [] } = {}) {
1805
+ async runAnalysis({ query: e = "*", topK: t = 100, memoryItems: n = [] } = {}) {
1850
1806
  return this.api.post("/memory/governance/run-analysis", {
1851
1807
  query: e,
1852
1808
  top_k: t,
1853
- memory_items: s
1809
+ memory_items: n
1854
1810
  });
1855
1811
  }
1856
1812
  /**
@@ -1860,10 +1816,10 @@ class ue {
1860
1816
  * @param {boolean} [options.autoFixableOnly=false]
1861
1817
  */
1862
1818
  async listViolations({ severity: e = null, autoFixableOnly: t = !1 } = {}) {
1863
- const s = [];
1864
- e && s.push(`severity=${e}`), t && s.push("auto_fixable_only=true");
1865
- const n = s.length ? `?${s.join("&")}` : "";
1866
- return this.api.get(`/memory/governance/violations${n}`);
1819
+ const n = [];
1820
+ e && n.push(`severity=${e}`), t && n.push("auto_fixable_only=true");
1821
+ const s = n.length ? `?${n.join("&")}` : "";
1822
+ return this.api.get(`/memory/governance/violations${s}`);
1867
1823
  }
1868
1824
  /**
1869
1825
  * Get a specific violation by ID.
@@ -1880,12 +1836,12 @@ class ue {
1880
1836
  * @param {string} [params.rationale='']
1881
1837
  * @param {string} [params.decidedBy='human']
1882
1838
  */
1883
- async applyDecision({ violationId: e, action: t = "approve", rationale: s = "", decidedBy: n = "human" }) {
1839
+ async applyDecision({ violationId: e, action: t = "approve", rationale: n = "", decidedBy: s = "human" }) {
1884
1840
  return this.api.post("/memory/governance/apply-decision", {
1885
1841
  violation_id: e,
1886
1842
  action: t,
1887
- rationale: s,
1888
- decided_by: n
1843
+ rationale: n,
1844
+ decided_by: s
1889
1845
  });
1890
1846
  }
1891
1847
  /**
@@ -1904,7 +1860,7 @@ class ue {
1904
1860
  return this.api.get("/memory/governance/summary");
1905
1861
  }
1906
1862
  }
1907
- class le {
1863
+ class se {
1908
1864
  constructor(e) {
1909
1865
  this.api = e;
1910
1866
  }
@@ -1945,7 +1901,7 @@ class le {
1945
1901
  return this.api.post("/memory/evolution/reinforce/opinions");
1946
1902
  }
1947
1903
  }
1948
- class me {
1904
+ class re {
1949
1905
  constructor(e) {
1950
1906
  this.api = e;
1951
1907
  }
@@ -1957,11 +1913,11 @@ class me {
1957
1913
  * @param {string} [params.memoryType='semantic']
1958
1914
  * @param {boolean} [params.useLlm=true]
1959
1915
  */
1960
- async challenge({ assertion: e, memoryType: t = "semantic", useLlm: s = !0 }) {
1916
+ async challenge({ assertion: e, memoryType: t = "semantic", useLlm: n = !0 }) {
1961
1917
  return this.api.post("/memory/reasoning/challenge", {
1962
1918
  assertion: e,
1963
1919
  memory_type: t,
1964
- use_llm: s
1920
+ use_llm: n
1965
1921
  });
1966
1922
  }
1967
1923
  /**
@@ -1974,12 +1930,12 @@ class me {
1974
1930
  * @param {boolean} [params.useWikipedia=true]
1975
1931
  * @param {boolean} [params.useLlm=true]
1976
1932
  */
1977
- async resolve({ existingItemId: e, newFact: t, autoResolve: s = !0, strategy: n = null, useWikipedia: r = !0, useLlm: i = !0 }) {
1933
+ async resolve({ existingItemId: e, newFact: t, autoResolve: n = !0, strategy: s = null, useWikipedia: r = !0, useLlm: i = !0 }) {
1978
1934
  return this.api.post("/memory/reasoning/resolve", {
1979
1935
  existing_item_id: e,
1980
1936
  new_fact: t,
1981
- auto_resolve: s,
1982
- strategy: n,
1937
+ auto_resolve: n,
1938
+ strategy: s,
1983
1939
  use_wikipedia: r,
1984
1940
  use_llm: i
1985
1941
  });
@@ -2043,7 +1999,7 @@ class me {
2043
1999
  });
2044
2000
  }
2045
2001
  }
2046
- class pe {
2002
+ class ie {
2047
2003
  constructor(e) {
2048
2004
  this.api = e;
2049
2005
  }
@@ -2055,12 +2011,12 @@ class pe {
2055
2011
  * @param {number} [params.minQualityScore=0.4]
2056
2012
  * @param {boolean} [params.useLlmDetection=true]
2057
2013
  */
2058
- async extract({ content: e, minSteps: t = 2, minQualityScore: s = 0.4, useLlmDetection: n = !0 }) {
2014
+ async extract({ content: e, minSteps: t = 2, minQualityScore: n = 0.4, useLlmDetection: s = !0 }) {
2059
2015
  return this.api.post("/memory/reasoning/traces/extract", {
2060
2016
  content: e,
2061
2017
  min_steps: t,
2062
- min_quality_score: s,
2063
- use_llm_detection: n
2018
+ min_quality_score: n,
2019
+ use_llm_detection: s
2064
2020
  });
2065
2021
  }
2066
2022
  /**
@@ -2082,11 +2038,11 @@ class pe {
2082
2038
  * @param {string} [params.artifactId]
2083
2039
  * @param {number} [params.limit=10]
2084
2040
  */
2085
- async query({ query: e, artifactId: t = null, limit: s = 10 }) {
2041
+ async query({ query: e, artifactId: t = null, limit: n = 10 }) {
2086
2042
  return this.api.post("/memory/reasoning/traces/query", {
2087
2043
  query: e,
2088
2044
  artifact_id: t,
2089
- limit: s
2045
+ limit: n
2090
2046
  });
2091
2047
  }
2092
2048
  /**
@@ -2097,7 +2053,7 @@ class pe {
2097
2053
  return this.api.get(`/memory/reasoning/traces/${e}`);
2098
2054
  }
2099
2055
  }
2100
- class he {
2056
+ class oe {
2101
2057
  constructor(e) {
2102
2058
  this.api = e;
2103
2059
  }
@@ -2109,11 +2065,11 @@ class he {
2109
2065
  * @param {Array<{docId: string, text: string}>} params.rawChunks
2110
2066
  * @param {Object} [params.params={}]
2111
2067
  */
2112
- async runInference({ registryId: e = "default", rawChunks: t, params: s = {} }) {
2068
+ async runInference({ registryId: e = "default", rawChunks: t, params: n = {} }) {
2113
2069
  return this.api.post("/memory/ontology/inference/run", {
2114
2070
  registry_id: e,
2115
- raw_chunks: t.map((n) => ({ doc_id: n.docId, text: n.text })),
2116
- params: s
2071
+ raw_chunks: t.map((s) => ({ doc_id: s.docId, text: s.text })),
2072
+ params: n
2117
2073
  });
2118
2074
  }
2119
2075
  // === REGISTRY MANAGEMENT ===
@@ -2130,11 +2086,11 @@ class he {
2130
2086
  * @param {string} [params.description='']
2131
2087
  * @param {string} [params.domain='general']
2132
2088
  */
2133
- async createRegistry({ name: e, description: t = "", domain: s = "general" }) {
2089
+ async createRegistry({ name: e, description: t = "", domain: n = "general" }) {
2134
2090
  return this.api.post("/memory/ontology/registries", {
2135
2091
  name: e,
2136
2092
  description: t,
2137
- domain: s
2093
+ domain: n
2138
2094
  });
2139
2095
  }
2140
2096
  /**
@@ -2143,8 +2099,8 @@ class he {
2143
2099
  * @param {string} [version]
2144
2100
  */
2145
2101
  async getSnapshot(e, t = null) {
2146
- let s = `/memory/ontology/registry/${e}/snapshot`;
2147
- return t && (s += `?version=${encodeURIComponent(t)}`), this.api.get(s);
2102
+ let n = `/memory/ontology/registry/${e}/snapshot`;
2103
+ return t && (n += `?version=${encodeURIComponent(t)}`), this.api.get(n);
2148
2104
  }
2149
2105
  /**
2150
2106
  * Apply a changeset to create a new version of the registry.
@@ -2154,11 +2110,11 @@ class he {
2154
2110
  * @param {Object} params.changeset - OntologyIR changeset
2155
2111
  * @param {string} [params.message='']
2156
2112
  */
2157
- async applyChangeset(e, { baseVersion: t = "", changeset: s, message: n = "" }) {
2113
+ async applyChangeset(e, { baseVersion: t = "", changeset: n, message: s = "" }) {
2158
2114
  return this.api.post(`/memory/ontology/registry/${e}/apply`, {
2159
2115
  base_version: t,
2160
- changeset: s,
2161
- message: n
2116
+ changeset: n,
2117
+ message: s
2162
2118
  });
2163
2119
  }
2164
2120
  /**
@@ -2184,10 +2140,10 @@ class he {
2184
2140
  * @param {string} [params.targetVersion='']
2185
2141
  * @param {string} [params.message='']
2186
2142
  */
2187
- async rollbackRegistry(e, { targetVersion: t = "", message: s = "" }) {
2143
+ async rollbackRegistry(e, { targetVersion: t = "", message: n = "" }) {
2188
2144
  return this.api.post(`/memory/ontology/registry/${e}/rollback`, {
2189
2145
  target_version: t,
2190
- message: s
2146
+ message: n
2191
2147
  });
2192
2148
  }
2193
2149
  /**
@@ -2196,8 +2152,8 @@ class he {
2196
2152
  * @param {string} [version]
2197
2153
  */
2198
2154
  async exportRegistry(e, t = null) {
2199
- let s = `/memory/ontology/registry/${e}/export`;
2200
- return t && (s += `?version=${encodeURIComponent(t)}`), this.api.get(s);
2155
+ let n = `/memory/ontology/registry/${e}/export`;
2156
+ return t && (n += `?version=${encodeURIComponent(t)}`), this.api.get(n);
2201
2157
  }
2202
2158
  /**
2203
2159
  * Import data into a registry.
@@ -2206,10 +2162,10 @@ class he {
2206
2162
  * @param {Object} params.data - Complete ontology data to import
2207
2163
  * @param {string} [params.message='']
2208
2164
  */
2209
- async importRegistry(e, { data: t, message: s = "" }) {
2165
+ async importRegistry(e, { data: t, message: n = "" }) {
2210
2166
  return this.api.post(`/memory/ontology/registry/${e}/import`, {
2211
2167
  data: t,
2212
- message: s
2168
+ message: n
2213
2169
  });
2214
2170
  }
2215
2171
  // === ENRICHMENT & GROUNDING ===
@@ -2238,11 +2194,11 @@ class he {
2238
2194
  * @param {string} params.itemId
2239
2195
  * @param {string[]} params.candidates
2240
2196
  */
2241
- async runGrounding({ grounder: e = "wikipedia", itemId: t, candidates: s }) {
2197
+ async runGrounding({ grounder: e = "wikipedia", itemId: t, candidates: n }) {
2242
2198
  return this.api.post("/memory/ontology/grounding/run", {
2243
2199
  grounder: e,
2244
2200
  item_id: t,
2245
- candidates: s
2201
+ candidates: n
2246
2202
  });
2247
2203
  }
2248
2204
  // === TEMPLATES ===
@@ -2278,11 +2234,11 @@ class he {
2278
2234
  * @param {string} params.name
2279
2235
  * @param {string} [params.description='']
2280
2236
  */
2281
- async saveAsTemplate({ registryId: e, name: t, description: s = "" }) {
2237
+ async saveAsTemplate({ registryId: e, name: t, description: n = "" }) {
2282
2238
  return this.api.post("/memory/ontology/templates", {
2283
2239
  registry_id: e,
2284
2240
  name: t,
2285
- description: s
2241
+ description: n
2286
2242
  });
2287
2243
  }
2288
2244
  /**
@@ -2307,12 +2263,12 @@ class he {
2307
2263
  * @param {number} [params.confidence=0.9]
2308
2264
  * @param {boolean} [params.isGlobal=false]
2309
2265
  */
2310
- async createPattern({ name: e, entityType: t, confidence: s = 0.9, isGlobal: n = !1 }) {
2266
+ async createPattern({ name: e, entityType: t, confidence: n = 0.9, isGlobal: s = !1 }) {
2311
2267
  return this.api.post("/memory/ontology/patterns", {
2312
2268
  name: e,
2313
2269
  entity_type: t,
2314
- confidence: s,
2315
- is_global: n
2270
+ confidence: n,
2271
+ is_global: s
2316
2272
  });
2317
2273
  }
2318
2274
  /**
@@ -2351,10 +2307,10 @@ class he {
2351
2307
  * @param {string} params.baseRegistryId
2352
2308
  * @param {string} [params.pinnedVersion]
2353
2309
  */
2354
- async subscribe(e, { baseRegistryId: t, pinnedVersion: s = null }) {
2310
+ async subscribe(e, { baseRegistryId: t, pinnedVersion: n = null }) {
2355
2311
  return this.api.post(`/memory/ontology/registry/${e}/subscribe`, {
2356
2312
  base_registry_id: t,
2357
- pinned_version: s
2313
+ pinned_version: n
2358
2314
  });
2359
2315
  }
2360
2316
  /**
@@ -2472,9 +2428,9 @@ class he {
2472
2428
  * @param {string} [options.kind] missing_in_graph | missing_in_registry | name_conflict_unresolvable
2473
2429
  * @param {number} [options.limit=50]
2474
2430
  */
2475
- async listHitl({ status: e = "open", kind: t = null, limit: s = 50 } = {}) {
2476
- const n = new URLSearchParams({ status: e, limit: String(s) });
2477
- return t && n.set("kind", t), this.api.get(`/memory/ontology/hitl?${n.toString()}`);
2431
+ async listHitl({ status: e = "open", kind: t = null, limit: n = 50 } = {}) {
2432
+ const s = new URLSearchParams({ status: e, limit: String(n) });
2433
+ return t && s.set("kind", t), this.api.get(`/memory/ontology/hitl?${s.toString()}`);
2478
2434
  }
2479
2435
  /**
2480
2436
  * Resolve one ontology HITL queue item (open -> resolved).
@@ -2483,8 +2439,8 @@ class he {
2483
2439
  * @param {('accepted'|'dismissed'|'deferred')} body.action
2484
2440
  * @param {string} [body.note]
2485
2441
  */
2486
- async resolveHitl(e, { action: t, note: s = null }) {
2487
- return this.api.post(`/memory/ontology/hitl/${e}/resolve`, { action: t, note: s });
2442
+ async resolveHitl(e, { action: t, note: n = null }) {
2443
+ return this.api.post(`/memory/ontology/hitl/${e}/resolve`, { action: t, note: n });
2488
2444
  }
2489
2445
  // --- ONTO-CRUD-1 read / audit / migration surface -------------------------
2490
2446
  /**
@@ -2498,9 +2454,9 @@ class he {
2498
2454
  * @param {number} [options.limit=100]
2499
2455
  * @param {string} [options.cursor] opaque keyset continuation token
2500
2456
  */
2501
- async listTypes({ tier: e, layer: t, packId: s, hasIri: n, kind: r, limit: i = 100, cursor: a } = {}) {
2457
+ async listTypes({ tier: e, layer: t, packId: n, hasIri: s, kind: r, limit: i = 100, cursor: o } = {}) {
2502
2458
  const c = { limit: String(i) };
2503
- e !== void 0 && (c.tier = e), t !== void 0 && (c.layer = t), s !== void 0 && (c.pack_id = s), n !== void 0 && (c.has_iri = String(n)), r !== void 0 && (c.kind = r), a !== void 0 && (c.cursor = a);
2459
+ e !== void 0 && (c.tier = e), t !== void 0 && (c.layer = t), n !== void 0 && (c.pack_id = n), s !== void 0 && (c.has_iri = String(s)), r !== void 0 && (c.kind = r), o !== void 0 && (c.cursor = o);
2504
2460
  const u = new URLSearchParams(c).toString();
2505
2461
  return this.api.get(`/memory/ontology/types${u ? "?" + u : ""}`);
2506
2462
  }
@@ -2535,22 +2491,22 @@ class he {
2535
2491
  */
2536
2492
  async declareType(e, {
2537
2493
  kind: t = "entity",
2538
- propertiesSchema: s,
2539
- requiredProperties: n,
2494
+ propertiesSchema: n,
2495
+ requiredProperties: s,
2540
2496
  storageStrategy: r,
2541
2497
  storageSearchable: i,
2542
- iri: a,
2498
+ iri: o,
2543
2499
  wikidataQid: c,
2544
2500
  displayName: u,
2545
- definition: h,
2546
- description: y,
2501
+ definition: y,
2502
+ description: h,
2547
2503
  aliases: d,
2548
2504
  examples: $,
2549
2505
  parentTypes: k,
2550
2506
  tier: g = "confirmed"
2551
2507
  } = {}) {
2552
2508
  const p = { name: e, kind: t, tier: g };
2553
- return s !== void 0 && (p.properties_schema = s), n !== void 0 && (p.required_properties = n), r !== void 0 && (p.storage_strategy = r), i !== void 0 && (p.storage_searchable = i), a !== void 0 && (p.iri = a), c !== void 0 && (p.wikidata_qid = c), u !== void 0 && (p.display_name = u), h !== void 0 && (p.definition = h), y !== void 0 && (p.description = y), d !== void 0 && (p.aliases = d), $ !== void 0 && (p.examples = $), k !== void 0 && (p.parent_types = k), this.api.post("/memory/ontology/types", p);
2509
+ return n !== void 0 && (p.properties_schema = n), s !== void 0 && (p.required_properties = s), r !== void 0 && (p.storage_strategy = r), i !== void 0 && (p.storage_searchable = i), o !== void 0 && (p.iri = o), c !== void 0 && (p.wikidata_qid = c), u !== void 0 && (p.display_name = u), y !== void 0 && (p.definition = y), h !== void 0 && (p.description = h), d !== void 0 && (p.aliases = d), $ !== void 0 && (p.examples = $), k !== void 0 && (p.parent_types = k), this.api.post("/memory/ontology/types", p);
2554
2510
  }
2555
2511
  /**
2556
2512
  * Declare an ontology relation (CORE-MEMTYPE-DECLARE-1; declare-only in P1).
@@ -2581,26 +2537,26 @@ class he {
2581
2537
  */
2582
2538
  async declareRelation(e, {
2583
2539
  domain: t,
2584
- range: s,
2585
- inverseOf: n,
2540
+ range: n,
2541
+ inverseOf: s,
2586
2542
  cardinality: r,
2587
2543
  temporal: i,
2588
- propertiesSchema: a,
2544
+ propertiesSchema: o,
2589
2545
  transitive: c,
2590
2546
  symmetric: u,
2591
- reflexive: h,
2592
- parentRelations: y,
2547
+ reflexive: y,
2548
+ parentRelations: h,
2593
2549
  iri: d,
2594
2550
  wikidataPid: $,
2595
2551
  displayName: k,
2596
2552
  definition: g,
2597
2553
  description: p,
2598
- aliases: b,
2599
- examples: R,
2600
- tier: C = "confirmed"
2554
+ aliases: I,
2555
+ examples: b,
2556
+ tier: v = "confirmed"
2601
2557
  } = {}) {
2602
- const m = { name: e, tier: C };
2603
- return t !== void 0 && (m.domain = t), s !== void 0 && (m.range = s), n !== void 0 && (m.inverse_of = n), r !== void 0 && (m.cardinality = r), i !== void 0 && (m.temporal = i), a !== void 0 && (m.properties_schema = a), c !== void 0 && (m.transitive = c), u !== void 0 && (m.symmetric = u), h !== void 0 && (m.reflexive = h), y !== void 0 && (m.parent_relations = y), d !== void 0 && (m.iri = d), $ !== void 0 && (m.wikidata_pid = $), k !== void 0 && (m.display_name = k), g !== void 0 && (m.definition = g), p !== void 0 && (m.description = p), b !== void 0 && (m.aliases = b), R !== void 0 && (m.examples = R), this.api.post("/memory/ontology/relations", m);
2558
+ const m = { name: e, tier: v };
2559
+ return t !== void 0 && (m.domain = t), n !== void 0 && (m.range = n), s !== void 0 && (m.inverse_of = s), r !== void 0 && (m.cardinality = r), i !== void 0 && (m.temporal = i), o !== void 0 && (m.properties_schema = o), c !== void 0 && (m.transitive = c), u !== void 0 && (m.symmetric = u), y !== void 0 && (m.reflexive = y), h !== void 0 && (m.parent_relations = h), d !== void 0 && (m.iri = d), $ !== void 0 && (m.wikidata_pid = $), k !== void 0 && (m.display_name = k), g !== void 0 && (m.definition = g), p !== void 0 && (m.description = p), I !== void 0 && (m.aliases = I), b !== void 0 && (m.examples = b), this.api.post("/memory/ontology/relations", m);
2604
2560
  }
2605
2561
  /**
2606
2562
  * List ontology relation types, keyset-paginated. Mirror of `listTypes`.
@@ -2612,10 +2568,10 @@ class he {
2612
2568
  * @param {number} [options.limit=100]
2613
2569
  * @param {string} [options.cursor] opaque keyset continuation token
2614
2570
  */
2615
- async listRelations({ tier: e, layer: t, packId: s, hasIri: n, limit: r = 100, cursor: i } = {}) {
2616
- const a = { limit: String(r) };
2617
- e !== void 0 && (a.tier = e), t !== void 0 && (a.layer = t), s !== void 0 && (a.pack_id = s), n !== void 0 && (a.has_iri = String(n)), i !== void 0 && (a.cursor = i);
2618
- const c = new URLSearchParams(a).toString();
2571
+ async listRelations({ tier: e, layer: t, packId: n, hasIri: s, limit: r = 100, cursor: i } = {}) {
2572
+ const o = { limit: String(r) };
2573
+ e !== void 0 && (o.tier = e), t !== void 0 && (o.layer = t), n !== void 0 && (o.pack_id = n), s !== void 0 && (o.has_iri = String(s)), i !== void 0 && (o.cursor = i);
2574
+ const c = new URLSearchParams(o).toString();
2619
2575
  return this.api.get(`/memory/ontology/relations${c ? "?" + c : ""}`);
2620
2576
  }
2621
2577
  /**
@@ -2641,11 +2597,11 @@ class he {
2641
2597
  * @param {string} [options.until] full ISO-8601 upper bound (inclusive)
2642
2598
  * @param {number} [options.limit=200]
2643
2599
  */
2644
- async listAudit({ actor: e, action: t, since: s, until: n, limit: r = 200 } = {}) {
2600
+ async listAudit({ actor: e, action: t, since: n, until: s, limit: r = 200 } = {}) {
2645
2601
  const i = { limit: String(r) };
2646
- e !== void 0 && (i.actor = e), t !== void 0 && (i.action = t), s !== void 0 && (i.since = s), n !== void 0 && (i.until = n);
2647
- const a = new URLSearchParams(i).toString();
2648
- return this.api.get(`/memory/ontology/audit${a ? "?" + a : ""}`);
2602
+ e !== void 0 && (i.actor = e), t !== void 0 && (i.action = t), n !== void 0 && (i.since = n), s !== void 0 && (i.until = s);
2603
+ const o = new URLSearchParams(i).toString();
2604
+ return this.api.get(`/memory/ontology/audit${o ? "?" + o : ""}`);
2649
2605
  }
2650
2606
  /**
2651
2607
  * Full append-only audit trail for one ontology type (oldest-first).
@@ -2668,10 +2624,10 @@ class he {
2668
2624
  * @param {string} [options.packVersion] scope to one installed version; omit for all
2669
2625
  */
2670
2626
  async getPackAudit(e, { packVersion: t = null } = {}) {
2671
- const s = {};
2672
- t !== null && (s.pack_version = t);
2673
- const n = new URLSearchParams(s).toString();
2674
- return this.api.get(`/memory/ontology/packs/${encodeURIComponent(e)}/audit${n ? "?" + n : ""}`);
2627
+ const n = {};
2628
+ t !== null && (n.pack_version = t);
2629
+ const s = new URLSearchParams(n).toString();
2630
+ return this.api.get(`/memory/ontology/packs/${encodeURIComponent(e)}/audit${s ? "?" + s : ""}`);
2675
2631
  }
2676
2632
  /**
2677
2633
  * Reclassify every instance of `fromId` onto `toId`. Both types stay live.
@@ -2688,8 +2644,8 @@ class he {
2688
2644
  * defaults, so an entity migration returns them empty/zero rather than omitting
2689
2645
  * them — callers never branch on kind to read a response.
2690
2646
  */
2691
- async migrateTypeInstances(e, t, { reason: s, batchSize: n = 500, onViolation: r = "refuse" }) {
2692
- const i = { reason: s, batch_size: n };
2647
+ async migrateTypeInstances(e, t, { reason: n, batchSize: s = 500, onViolation: r = "refuse" }) {
2648
+ const i = { reason: n, batch_size: s };
2693
2649
  return r !== "refuse" && (i.on_violation = r), this.api.post(
2694
2650
  `/memory/ontology/types/${encodeURIComponent(e)}/migrate-to/${encodeURIComponent(t)}`,
2695
2651
  i
@@ -2718,11 +2674,11 @@ class he {
2718
2674
  * @param {number} [options.limit=100]
2719
2675
  * @param {string} [options.cursor] opaque keyset continuation token
2720
2676
  */
2721
- async listReviewQueue({ tier: e, assignee: t, source: s, limit: n = 100, cursor: r } = {}) {
2722
- const i = { limit: String(n) };
2723
- e !== void 0 && (i.tier = e), t !== void 0 && (i.assignee = t), s !== void 0 && (i.source = s), r !== void 0 && (i.cursor = r);
2724
- const a = new URLSearchParams(i).toString();
2725
- return this.api.get(`/memory/ontology/queue${a ? "?" + a : ""}`);
2677
+ async listReviewQueue({ tier: e, assignee: t, source: n, limit: s = 100, cursor: r } = {}) {
2678
+ const i = { limit: String(s) };
2679
+ e !== void 0 && (i.tier = e), t !== void 0 && (i.assignee = t), n !== void 0 && (i.source = n), r !== void 0 && (i.cursor = r);
2680
+ const o = new URLSearchParams(i).toString();
2681
+ return this.api.get(`/memory/ontology/queue${o ? "?" + o : ""}`);
2726
2682
  }
2727
2683
  /**
2728
2684
  * Approve one ontology review type.
@@ -2731,8 +2687,8 @@ class he {
2731
2687
  * @param {string} [options.expectedTier] optional optimistic tier precondition
2732
2688
  */
2733
2689
  async approveReviewType(e, { expectedTier: t } = {}) {
2734
- const s = {};
2735
- return t !== void 0 && (s.expected_tier = t), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/approve`, s);
2690
+ const n = {};
2691
+ return t !== void 0 && (n.expected_tier = t), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/approve`, n);
2736
2692
  }
2737
2693
  /**
2738
2694
  * Reject one ontology review type.
@@ -2741,8 +2697,8 @@ class he {
2741
2697
  * @param {string} [options.expectedTier] optional optimistic tier precondition
2742
2698
  */
2743
2699
  async rejectReviewType(e, { expectedTier: t } = {}) {
2744
- const s = {};
2745
- return t !== void 0 && (s.expected_tier = t), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/reject`, s);
2700
+ const n = {};
2701
+ return t !== void 0 && (n.expected_tier = t), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/reject`, n);
2746
2702
  }
2747
2703
  /**
2748
2704
  * Merge one ontology review type into another type.
@@ -2751,9 +2707,9 @@ class he {
2751
2707
  * @param {Object} [options]
2752
2708
  * @param {string} [options.expectedTier] optional optimistic tier precondition
2753
2709
  */
2754
- async mergeReviewType(e, t, { expectedTier: s } = {}) {
2755
- const n = { into_id: t };
2756
- return s !== void 0 && (n.expected_tier = s), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/merge`, n);
2710
+ async mergeReviewType(e, t, { expectedTier: n } = {}) {
2711
+ const s = { into_id: t };
2712
+ return n !== void 0 && (s.expected_tier = n), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/merge`, s);
2757
2713
  }
2758
2714
  /**
2759
2715
  * Edit and promote one ontology review type.
@@ -2762,9 +2718,9 @@ class he {
2762
2718
  * @param {Object} [options]
2763
2719
  * @param {string} [options.expectedTier] optional optimistic tier precondition
2764
2720
  */
2765
- async editPromoteReviewType(e, t, { expectedTier: s } = {}) {
2766
- const n = { edits: t };
2767
- return s !== void 0 && (n.expected_tier = s), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/edit-promote`, n);
2721
+ async editPromoteReviewType(e, t, { expectedTier: n } = {}) {
2722
+ const s = { edits: t };
2723
+ return n !== void 0 && (s.expected_tier = n), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/edit-promote`, s);
2768
2724
  }
2769
2725
  /**
2770
2726
  * Assign or clear the reviewer for one ontology review type.
@@ -2782,12 +2738,12 @@ class he {
2782
2738
  * @param {Object} [options.params] action-specific params
2783
2739
  * @param {string} [options.expectedTier] optional optimistic tier precondition
2784
2740
  */
2785
- async bulkReviewAction(e, t, { params: s, expectedTier: n } = {}) {
2786
- const r = { action: e, ids: t, params: s === void 0 ? {} : s };
2787
- return n !== void 0 && (r.expected_tier = n), this.api.post("/memory/ontology/queue/bulk", r);
2741
+ async bulkReviewAction(e, t, { params: n, expectedTier: s } = {}) {
2742
+ const r = { action: e, ids: t, params: n === void 0 ? {} : n };
2743
+ return s !== void 0 && (r.expected_tier = s), this.api.post("/memory/ontology/queue/bulk", r);
2788
2744
  }
2789
2745
  }
2790
- class ye {
2746
+ class ae {
2791
2747
  constructor(e) {
2792
2748
  this.api = e;
2793
2749
  }
@@ -2811,12 +2767,12 @@ class ye {
2811
2767
  * @param {boolean} [options.sentimentAnalysis]
2812
2768
  * @param {boolean} [options.topicAnalysis]
2813
2769
  */
2814
- async detectBias({ protectedAttributes: e = null, sentimentAnalysis: t = null, topicAnalysis: s = null } = {}) {
2815
- const n = {};
2816
- return e !== null && (n.protected_attributes = e), t !== null && (n.sentiment_analysis = t), s !== null && (n.topic_analysis = s), this.api.post("/memory/analytics/bias", n);
2770
+ async detectBias({ protectedAttributes: e = null, sentimentAnalysis: t = null, topicAnalysis: n = null } = {}) {
2771
+ const s = {};
2772
+ return e !== null && (s.protected_attributes = e), t !== null && (s.sentiment_analysis = t), n !== null && (s.topic_analysis = n), this.api.post("/memory/analytics/bias", s);
2817
2773
  }
2818
2774
  }
2819
- class de {
2775
+ class ce {
2820
2776
  constructor(e) {
2821
2777
  this.api = e;
2822
2778
  }
@@ -2852,7 +2808,7 @@ class de {
2852
2808
  return this.api.get("/memory/inference/rules");
2853
2809
  }
2854
2810
  }
2855
- class ge {
2811
+ class ue {
2856
2812
  constructor(e) {
2857
2813
  this.api = e;
2858
2814
  }
@@ -2899,8 +2855,8 @@ class ge {
2899
2855
  * @param {string} [runId]
2900
2856
  */
2901
2857
  async getState(e, t = null) {
2902
- let s = `/memory/pipeline/${e}/state`;
2903
- return t && (s += `?run_id=${encodeURIComponent(t)}`), this.api.get(s);
2858
+ let n = `/memory/pipeline/${e}/state`;
2859
+ return t && (n += `?run_id=${encodeURIComponent(t)}`), this.api.get(n);
2904
2860
  }
2905
2861
  /**
2906
2862
  * Reset a pipeline, clearing its state.
@@ -2931,11 +2887,11 @@ class ge {
2931
2887
  * @param {string} [params.description='']
2932
2888
  * @param {Object} params.config
2933
2889
  */
2934
- async createConfig({ name: e, description: t = "", config: s }) {
2890
+ async createConfig({ name: e, description: t = "", config: n }) {
2935
2891
  return this.api.post("/memory/pipeline/configs", {
2936
2892
  name: e,
2937
2893
  description: t,
2938
- config: s
2894
+ config: n
2939
2895
  });
2940
2896
  }
2941
2897
  /**
@@ -2953,11 +2909,11 @@ class ge {
2953
2909
  * @param {string} [params.description='']
2954
2910
  * @param {Object} [params.config={}]
2955
2911
  */
2956
- async updateConfig(e, { name: t = "", description: s = "", config: n = {} }) {
2912
+ async updateConfig(e, { name: t = "", description: n = "", config: s = {} }) {
2957
2913
  return this.api.patch(`/memory/pipeline/configs/${e}`, {
2958
2914
  name: t,
2959
- description: s,
2960
- config: n
2915
+ description: n,
2916
+ config: s
2961
2917
  });
2962
2918
  }
2963
2919
  /**
@@ -2968,7 +2924,7 @@ class ge {
2968
2924
  return this.api.delete(`/memory/pipeline/configs/${e}`);
2969
2925
  }
2970
2926
  }
2971
- class fe {
2927
+ class le {
2972
2928
  constructor(e) {
2973
2929
  this.api = e;
2974
2930
  }
@@ -2979,11 +2935,11 @@ class fe {
2979
2935
  * @param {Object} params.payload
2980
2936
  * @param {Object} [params.metadata={}]
2981
2937
  */
2982
- async store({ conversationId: e, payload: t, metadata: s = {} }) {
2938
+ async store({ conversationId: e, payload: t, metadata: n = {} }) {
2983
2939
  return this.api.post("/memory/archive/store", {
2984
2940
  conversation_id: e,
2985
2941
  payload: t,
2986
- metadata: s
2942
+ metadata: n
2987
2943
  });
2988
2944
  }
2989
2945
  /**
@@ -2994,7 +2950,7 @@ class fe {
2994
2950
  return this.api.get(`/memory/archive/${e}`);
2995
2951
  }
2996
2952
  }
2997
- class _e {
2953
+ class me {
2998
2954
  constructor(e) {
2999
2955
  this.api = e;
3000
2956
  }
@@ -3054,8 +3010,8 @@ class _e {
3054
3010
  * @param {number} [options.maxDistance=3]
3055
3011
  * @param {number} [options.minSurprise=0.5]
3056
3012
  */
3057
- async getDiscoveries(e, { maxDistance: t = 3, minSurprise: s = 0.5 } = {}) {
3058
- return this.api.get(`/memory/zettel/${e}/discoveries?max_distance=${t}&min_surprise=${s}`);
3013
+ async getDiscoveries(e, { maxDistance: t = 3, minSurprise: n = 0.5 } = {}) {
3014
+ return this.api.get(`/memory/zettel/${e}/discoveries?max_distance=${t}&min_surprise=${n}`);
3059
3015
  }
3060
3016
  /**
3061
3017
  * Find paths between two notes.
@@ -3063,8 +3019,8 @@ class _e {
3063
3019
  * @param {string} targetId
3064
3020
  * @param {number} [maxPaths=5]
3065
3021
  */
3066
- async getPath(e, t, s = 5) {
3067
- return this.api.get(`/memory/zettel/${e}/path/${t}?max_paths=${s}`);
3022
+ async getPath(e, t, n = 5) {
3023
+ return this.api.get(`/memory/zettel/${e}/path/${t}?max_paths=${n}`);
3068
3024
  }
3069
3025
  // === WIKILINK SUPPORT ===
3070
3026
  /**
@@ -3090,8 +3046,8 @@ class _e {
3090
3046
  * @param {number} [options.depth=2]
3091
3047
  * @param {boolean} [options.includeMetadata=true]
3092
3048
  */
3093
- async getSubgraph(e, { depth: t = 2, includeMetadata: s = !0 } = {}) {
3094
- return this.api.get(`/memory/zettel/${e}/graph?depth=${t}&include_metadata=${s}`);
3049
+ async getSubgraph(e, { depth: t = 2, includeMetadata: n = !0 } = {}) {
3050
+ return this.api.get(`/memory/zettel/${e}/graph?depth=${t}&include_metadata=${n}`);
3095
3051
  }
3096
3052
  // === ADDITIONAL DISCOVERY ===
3097
3053
  /**
@@ -3132,8 +3088,8 @@ class _e {
3132
3088
  * @param {string} value
3133
3089
  * @param {number} [limit=100]
3134
3090
  */
3135
- async findByProperty(e, t, s = 100) {
3136
- return this.api.get(`/memory/zettel/by-property?key=${encodeURIComponent(e)}&value=${encodeURIComponent(t)}&limit=${s}`);
3091
+ async findByProperty(e, t, n = 100) {
3092
+ return this.api.get(`/memory/zettel/by-property?key=${encodeURIComponent(e)}&value=${encodeURIComponent(t)}&limit=${n}`);
3137
3093
  }
3138
3094
  /**
3139
3095
  * Find notes mentioning an entity.
@@ -3149,11 +3105,11 @@ class _e {
3149
3105
  * @param {string} relationType
3150
3106
  * @param {number} [limit=100]
3151
3107
  */
3152
- async queryByRelation(e, t, s = 100) {
3153
- return this.api.get(`/memory/zettel/by-relation/${e}/${t}?limit=${s}`);
3108
+ async queryByRelation(e, t, n = 100) {
3109
+ return this.api.get(`/memory/zettel/by-relation/${e}/${t}?limit=${n}`);
3154
3110
  }
3155
3111
  }
3156
- class $e {
3112
+ class pe {
3157
3113
  constructor(e) {
3158
3114
  this.api = e;
3159
3115
  }
@@ -3168,9 +3124,9 @@ class $e {
3168
3124
  */
3169
3125
  async list(e = {}) {
3170
3126
  const t = Object.fromEntries(
3171
- Object.entries(e).filter(([, n]) => n != null)
3172
- ), s = new URLSearchParams(t).toString();
3173
- return this.api.get(`/memory/procedures/matches${s ? "?" + s : ""}`);
3127
+ Object.entries(e).filter(([, s]) => s != null)
3128
+ ), n = new URLSearchParams(t).toString();
3129
+ return this.api.get(`/memory/procedures/matches${n ? "?" + n : ""}`);
3174
3130
  }
3175
3131
  /**
3176
3132
  * Submit feedback for a procedure match.
@@ -3178,9 +3134,9 @@ class $e {
3178
3134
  * @param {string} feedback - One of "success", "failure", "neutral"
3179
3135
  * @param {string} [note] - Optional explanation
3180
3136
  */
3181
- async submitFeedback(e, t, s = null) {
3182
- const n = { feedback: t };
3183
- return s && (n.note = s), this.api.post(`/memory/procedures/matches/${e}/feedback`, n);
3137
+ async submitFeedback(e, t, n = null) {
3138
+ const s = { feedback: t };
3139
+ return n && (s.note = n), this.api.post(`/memory/procedures/matches/${e}/feedback`, s);
3184
3140
  }
3185
3141
  /**
3186
3142
  * Get aggregated procedure match statistics.
@@ -3189,7 +3145,7 @@ class $e {
3189
3145
  return this.api.get("/memory/procedures/matches/stats");
3190
3146
  }
3191
3147
  }
3192
- class ke {
3148
+ class ye {
3193
3149
  constructor(e) {
3194
3150
  this.api = e;
3195
3151
  }
@@ -3204,9 +3160,9 @@ class ke {
3204
3160
  */
3205
3161
  async list(e = {}) {
3206
3162
  const t = Object.fromEntries(
3207
- Object.entries(e).filter(([, n]) => n != null)
3208
- ), s = new URLSearchParams(t).toString();
3209
- return this.api.get(`/memory/procedures/candidates${s ? "?" + s : ""}`);
3163
+ Object.entries(e).filter(([, s]) => s != null)
3164
+ ), n = new URLSearchParams(t).toString();
3165
+ return this.api.get(`/memory/procedures/candidates${n ? "?" + n : ""}`);
3210
3166
  }
3211
3167
  /**
3212
3168
  * Promote a candidate cluster to a new procedure.
@@ -3220,14 +3176,14 @@ class ke {
3220
3176
  * @returns {Promise<Object>} Response with procedure_id and status
3221
3177
  */
3222
3178
  async promote(e, t = {}) {
3223
- const s = {
3179
+ const n = {
3224
3180
  name: t.name ?? null,
3225
3181
  description: t.description ?? null,
3226
3182
  procedure_type: t.procedure_type ?? "extraction",
3227
3183
  preferred_profile: t.preferred_profile ?? "quick_extract",
3228
3184
  remove_working_items: t.remove_working_items ?? !1
3229
3185
  };
3230
- return this.api.post(`/memory/procedures/candidates/${e}/promote`, s);
3186
+ return this.api.post(`/memory/procedures/candidates/${e}/promote`, n);
3231
3187
  }
3232
3188
  /**
3233
3189
  * Dismiss a candidate cluster from future recommendations.
@@ -3238,7 +3194,7 @@ class ke {
3238
3194
  return this.api.delete(`/memory/procedures/candidates/${e}/dismiss`);
3239
3195
  }
3240
3196
  }
3241
- class we {
3197
+ class he {
3242
3198
  constructor(e) {
3243
3199
  this.api = e;
3244
3200
  }
@@ -3255,9 +3211,9 @@ class we {
3255
3211
  */
3256
3212
  async list(e = {}) {
3257
3213
  const t = Object.fromEntries(
3258
- Object.entries(e).filter(([, n]) => n != null)
3259
- ), s = new URLSearchParams(t).toString();
3260
- return this.api.get(`/memory/procedures/drift${s ? "?" + s : ""}`);
3214
+ Object.entries(e).filter(([, s]) => s != null)
3215
+ ), n = new URLSearchParams(t).toString();
3216
+ return this.api.get(`/memory/procedures/drift${n ? "?" + n : ""}`);
3261
3217
  }
3262
3218
  /**
3263
3219
  * Get a single drift event with full change details.
@@ -3274,8 +3230,8 @@ class we {
3274
3230
  * @returns {Promise<{status: string, event_id: string, resolved: boolean}>}
3275
3231
  */
3276
3232
  async resolve(e, t = null) {
3277
- const s = {};
3278
- return t != null && (s.note = t), this.api.post(`/memory/procedures/drift/${e}/resolve`, s);
3233
+ const n = {};
3234
+ return t != null && (n.note = t), this.api.post(`/memory/procedures/drift/${e}/resolve`, n);
3279
3235
  }
3280
3236
  /**
3281
3237
  * Trigger a drift sweep across all procedures in the workspace.
@@ -3293,7 +3249,7 @@ class we {
3293
3249
  return this.api.get(`/memory/procedures/schemas/${e}`);
3294
3250
  }
3295
3251
  }
3296
- class Ie {
3252
+ class de {
3297
3253
  constructor(e) {
3298
3254
  this.api = e;
3299
3255
  }
@@ -3344,9 +3300,9 @@ class Ie {
3344
3300
  * @param {number} [params.limit=20]
3345
3301
  * @param {string} [params.before] ISO 8601 datetime
3346
3302
  */
3347
- async list({ isHeartbeat: e = null, limit: t = 20, before: s = null } = {}) {
3348
- const n = { limit: t };
3349
- return e !== null && (n.is_heartbeat = e), s !== null && (n.before = s), this.api.get("/memory/summary/list", n);
3303
+ async list({ isHeartbeat: e = null, limit: t = 20, before: n = null } = {}) {
3304
+ const s = { limit: t };
3305
+ return e !== null && (s.is_heartbeat = e), n !== null && (s.before = n), this.api.get("/memory/summary/list", s);
3350
3306
  }
3351
3307
  /** SnapshotDelta between two snapshots. Returns null on 404. */
3352
3308
  async delta({ from: e, to: t }) {
@@ -3355,9 +3311,9 @@ class Ie {
3355
3311
  from: e,
3356
3312
  to: t
3357
3313
  });
3358
- } catch (s) {
3359
- if ((s == null ? void 0 : s.status) === 404) return null;
3360
- throw s;
3314
+ } catch (n) {
3315
+ if ((n == null ? void 0 : n.status) === 404) return null;
3316
+ throw n;
3361
3317
  }
3362
3318
  }
3363
3319
  /** Admin-only delete. Throws on 403/404/500. */
@@ -3365,7 +3321,7 @@ class Ie {
3365
3321
  return this.api.delete(`/memory/summary/${e}`);
3366
3322
  }
3367
3323
  }
3368
- class be {
3324
+ class ge {
3369
3325
  constructor(e) {
3370
3326
  this.api = e;
3371
3327
  }
@@ -3377,13 +3333,13 @@ class be {
3377
3333
  * @returns {Promise<{key: string, token: string, expires_at: string, ttl_remaining_ms: number}|null>}
3378
3334
  */
3379
3335
  async acquire(e, { ttlSeconds: t } = {}) {
3380
- var n, r;
3381
- const s = {};
3382
- t !== void 0 && (s.ttl_seconds = t);
3336
+ var s, r;
3337
+ const n = {};
3338
+ t !== void 0 && (n.ttl_seconds = t);
3383
3339
  try {
3384
- return await this.api.post(`/memory/locks/${e}`, s);
3340
+ return await this.api.post(`/memory/locks/${e}`, n);
3385
3341
  } catch (i) {
3386
- if ((i == null ? void 0 : i.status) === 409 && ((r = (n = i.detail) == null ? void 0 : n.detail) == null ? void 0 : r.reason) === "lock_held")
3342
+ if ((i == null ? void 0 : i.status) === 409 && ((r = (s = i.detail) == null ? void 0 : s.detail) == null ? void 0 : r.reason) === "lock_held")
3387
3343
  return null;
3388
3344
  throw i;
3389
3345
  }
@@ -3396,18 +3352,18 @@ class be {
3396
3352
  * @param {number} [params.ttlSeconds]
3397
3353
  * @returns {Promise<{key: string, token: string, expires_at: string, ttl_remaining_ms: number}|null>}
3398
3354
  */
3399
- async renew(e, t, { ttlSeconds: s } = {}) {
3355
+ async renew(e, t, { ttlSeconds: n } = {}) {
3400
3356
  var r, i;
3401
- const n = {};
3402
- s !== void 0 && (n.ttl_seconds = s);
3357
+ const s = {};
3358
+ n !== void 0 && (s.ttl_seconds = n);
3403
3359
  try {
3404
- return await this.api.post(`/memory/locks/${e}/renew`, n, {
3360
+ return await this.api.post(`/memory/locks/${e}/renew`, s, {
3405
3361
  headers: { "X-Lease-Token": t }
3406
3362
  });
3407
- } catch (a) {
3408
- if ((a == null ? void 0 : a.status) === 409 && ((i = (r = a.detail) == null ? void 0 : r.detail) == null ? void 0 : i.reason) === "not_owner")
3363
+ } catch (o) {
3364
+ if ((o == null ? void 0 : o.status) === 409 && ((i = (r = o.detail) == null ? void 0 : r.detail) == null ? void 0 : i.reason) === "not_owner")
3409
3365
  return null;
3410
- throw a;
3366
+ throw o;
3411
3367
  }
3412
3368
  }
3413
3369
  /**
@@ -3417,19 +3373,19 @@ class be {
3417
3373
  * @returns {Promise<boolean>}
3418
3374
  */
3419
3375
  async release(e, t) {
3420
- var s, n;
3376
+ var n, s;
3421
3377
  try {
3422
3378
  return await this.api.delete(`/memory/locks/${e}`, {
3423
3379
  headers: { "X-Lease-Token": t }
3424
3380
  }), !0;
3425
3381
  } catch (r) {
3426
- if ((r == null ? void 0 : r.status) === 409 && ((n = (s = r.detail) == null ? void 0 : s.detail) == null ? void 0 : n.reason) === "not_owner")
3382
+ if ((r == null ? void 0 : r.status) === 409 && ((s = (n = r.detail) == null ? void 0 : n.detail) == null ? void 0 : s.reason) === "not_owner")
3427
3383
  return !1;
3428
3384
  throw r;
3429
3385
  }
3430
3386
  }
3431
3387
  }
3432
- class Re {
3388
+ class fe {
3433
3389
  constructor(e) {
3434
3390
  this.api = e;
3435
3391
  }
@@ -3450,9 +3406,9 @@ class Re {
3450
3406
  * @param {number} [params.count] How many to allocate (1..100, default 1).
3451
3407
  * @returns {Promise<{name: string, value: number, first: number, count: number}>}
3452
3408
  */
3453
- async allocate(e, { floor: t, count: s } = {}) {
3454
- const n = {};
3455
- return t !== void 0 && (n.floor = t), s !== void 0 && (n.count = s), this.api.post(`/memory/sequences/${e}/next`, n);
3409
+ async allocate(e, { floor: t, count: n } = {}) {
3410
+ const s = {};
3411
+ return t !== void 0 && (s.floor = t), n !== void 0 && (s.count = n), this.api.post(`/memory/sequences/${e}/next`, s);
3456
3412
  }
3457
3413
  /**
3458
3414
  * Read the counter without consuming a number, or null if never allocated.
@@ -3473,7 +3429,7 @@ class Re {
3473
3429
  }
3474
3430
  }
3475
3431
  }
3476
- class Se {
3432
+ class _e {
3477
3433
  constructor(e) {
3478
3434
  this.api = e;
3479
3435
  }
@@ -3502,15 +3458,15 @@ class Se {
3502
3458
  * body shape reaches the route from every client.
3503
3459
  * @returns {Promise<Object>} RecallPack — `{ block, manifest }`.
3504
3460
  */
3505
- async pack({ budgetTokens: e, query: t, sections: s, preset: n } = {}) {
3461
+ async pack({ budgetTokens: e, query: t, sections: n, preset: s } = {}) {
3506
3462
  const r = { budget_tokens: e };
3507
- return t != null && (r.query = t), s != null && (r.sections = s.map(({ name: i, cap_tokens: a, capTokens: c }) => ({
3463
+ return t != null && (r.query = t), n != null && (r.sections = n.map(({ name: i, cap_tokens: o, capTokens: c }) => ({
3508
3464
  name: i,
3509
- cap_tokens: a !== void 0 ? a : c
3510
- }))), n != null && (r.preset = n), this.api.post("/memory/recall/pack", r);
3465
+ cap_tokens: o !== void 0 ? o : c
3466
+ }))), s != null && (r.preset = s), this.api.post("/memory/recall/pack", r);
3511
3467
  }
3512
3468
  }
3513
- class ve {
3469
+ class $e {
3514
3470
  constructor(e) {
3515
3471
  this.api = e;
3516
3472
  }
@@ -3523,11 +3479,11 @@ class ve {
3523
3479
  * @param {string[]} [params.statuses=['active']] Repeatable lifecycle selector.
3524
3480
  * @returns {Promise<Object>} The policy-exchange contract bundle.
3525
3481
  */
3526
- async getBundle({ workflow: e, domain: t, statuses: s = ["active"] } = {}) {
3527
- const n = new URLSearchParams();
3528
- if (e != null && n.append("workflow", e), t != null && n.append("domain", t), Array.isArray(s))
3529
- for (const i of s) n.append("status", i);
3530
- const r = n.toString();
3482
+ async getBundle({ workflow: e, domain: t, statuses: n = ["active"] } = {}) {
3483
+ const s = new URLSearchParams();
3484
+ if (e != null && s.append("workflow", e), t != null && s.append("domain", t), Array.isArray(n))
3485
+ for (const i of n) s.append("status", i);
3486
+ const r = s.toString();
3531
3487
  return this.api.get(`/memory/policy/bundle${r ? "?" + r : ""}`);
3532
3488
  }
3533
3489
  /**
@@ -3539,11 +3495,11 @@ class ve {
3539
3495
  return this.api.post("/memory/policy/events", e);
3540
3496
  }
3541
3497
  }
3542
- class Ae {
3498
+ class Ie {
3543
3499
  constructor(e) {
3544
- this.auth = new N(e);
3545
- const t = new J(this.auth, { fetchFn: e.fetchFn });
3546
- this._api = t, this.memories = new V(t), this.decisions = new Y(t), this.opinions = new X(t), this.graph = new Z(t), this.teams = new Q(t), this.workspaces = new ee(t), this.profiles = new te(t), this.subscriptions = new se(t), this.authAPI = new ne(t), this.agents = new re(t), this.usage = new ie(t), this.insights = new ae(t), this.tokenUsage = new oe(t), this.temporal = new ce(t), this.governance = new ue(t), this.evolution = new le(t), this.reasoning = new me(t), this.reasoningTraces = new pe(t), this.ontology = new he(t), this.analytics = new ye(t), this.validation = new de(t), this.pipeline = new ge(t), this.archive = new fe(t), this.zettelkasten = new _e(t), this.procedureMatches = new $e(t), this.procedureCandidates = new ke(t), this.procedureDrift = new we(t), this.summaries = new Ie(t), this.locks = new be(t), this.sequences = new Re(t), this.recall = new Se(t), this.policy = new ve(t);
3500
+ this.auth = new F(e), this.connection = this.auth.connection;
3501
+ const t = new W(this.auth, { fetchFn: e.fetchFn });
3502
+ this._api = t, this.memories = new B(t), this.decisions = new K(t), this.opinions = new H(t), this.graph = new D(t), this.teams = new G(t), this.workspaces = new N(t), this.profiles = new J(t), this.subscriptions = new V(t), this.authAPI = new Y(t), this.agents = new X(t), this.usage = new Z(t), this.insights = new Q(t), this.tokenUsage = new ee(t), this.temporal = new te(t), this.governance = new ne(t), this.evolution = new se(t), this.reasoning = new re(t), this.reasoningTraces = new ie(t), this.ontology = new oe(t), this.analytics = new ae(t), this.validation = new ce(t), this.pipeline = new ue(t), this.archive = new le(t), this.zettelkasten = new me(t), this.procedureMatches = new pe(t), this.procedureCandidates = new ye(t), this.procedureDrift = new he(t), this.summaries = new de(t), this.locks = new ge(t), this.sequences = new fe(t), this.recall = new _e(t), this.policy = new $e(t);
3547
3503
  }
3548
3504
  setWorkspaceId(e) {
3549
3505
  this.auth.tokenManager.setWorkspaceId(e), this.auth.notifyListeners();
@@ -3570,44 +3526,43 @@ class Ae {
3570
3526
  * @returns {Promise<{ imported: number, failed: number, workspace_id: string }>}
3571
3527
  */
3572
3528
  async importOkf(e) {
3573
- const t = e instanceof Blob ? e : new Blob([e], { type: "application/gzip" }), s = new FormData();
3574
- return s.append("file", t, "smartmemory-okf-import.tar.gz"), this._api.postForm("/memory/okf/import", s);
3529
+ const t = e instanceof Blob ? e : new Blob([e], { type: "application/gzip" }), n = new FormData();
3530
+ return n.append("file", t, "smartmemory-okf-import.tar.gz"), this._api.postForm("/memory/okf/import", n);
3575
3531
  }
3576
3532
  }
3577
3533
  export {
3578
- w as A,
3579
- J as B,
3580
- Y as D,
3581
- le as E,
3582
- ue as G,
3583
- ae as I,
3584
- be as L,
3585
- V as M,
3586
- he as O,
3587
- ge as P,
3588
- me as R,
3589
- Re as S,
3590
- Q as T,
3591
- ie as U,
3592
- de as V,
3593
- ee as W,
3594
- _e as Z,
3595
- re as a,
3596
- ye as b,
3597
- fe as c,
3598
- ne as d,
3599
- N as e,
3600
- Z as f,
3601
- X as g,
3602
- ke as h,
3603
- $e as i,
3604
- te as j,
3605
- pe as k,
3606
- Ae as l,
3607
- se as m,
3608
- ce as n,
3609
- K as o,
3610
- oe as p,
3611
- D as q,
3612
- G as r
3534
+ _ as A,
3535
+ W as B,
3536
+ K as D,
3537
+ se as E,
3538
+ ne as G,
3539
+ Q as I,
3540
+ ge as L,
3541
+ B as M,
3542
+ oe as O,
3543
+ ue as P,
3544
+ re as R,
3545
+ fe as S,
3546
+ G as T,
3547
+ Z as U,
3548
+ ce as V,
3549
+ N as W,
3550
+ me as Z,
3551
+ X as a,
3552
+ ae as b,
3553
+ le as c,
3554
+ Y as d,
3555
+ F as e,
3556
+ D as f,
3557
+ H as g,
3558
+ ye as h,
3559
+ pe as i,
3560
+ J as j,
3561
+ ie as k,
3562
+ Ie as l,
3563
+ V as m,
3564
+ te as n,
3565
+ x as o,
3566
+ ee as p,
3567
+ j as q
3613
3568
  };