@smartmemory/sdk-js 1.4.64 → 1.4.85

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,22 +1,22 @@
1
1
  var P = (a) => {
2
2
  throw TypeError(a);
3
3
  };
4
- var T = (a, e, t) => e.has(a) || P("Cannot " + t);
5
- var R = (a, e, t) => (T(a, e, "read from private field"), t ? t.call(a) : e.get(a)), v = (a, e, t) => e.has(a) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, t), A = (a, e, t, s) => (T(a, e, "write to private field"), s ? s.call(a, t) : e.set(a, t), t), q = (a, e, t) => (T(a, e, "access private method"), t);
4
+ var v = (a, e, t) => e.has(a) || P("Cannot " + t);
5
+ var I = (a, e, t) => (v(a, e, "read from private field"), t ? t.call(a) : e.get(a)), A = (a, e, t) => e.has(a) ? P("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, t), T = (a, e, t, n) => (v(a, e, "write to private field"), n ? n.call(a, t) : e.set(a, t), t), q = (a, e, t) => (v(a, e, "access private method"), t);
6
6
  const M = {
7
7
  access: "smart_memory_auth_token",
8
8
  refresh: "smart_memory_refresh_token",
9
9
  user: "smart_memory_user",
10
10
  tenant: "smart_memory_tenant_id",
11
11
  team: "smart_memory_team_id"
12
- }, w = {
12
+ }, k = {
13
13
  access: ["access_token", "sm_token"],
14
14
  refresh: ["refresh_token", "sm_refresh_token"],
15
15
  user: ["sm_user"],
16
16
  tenant: ["tenant_id", "workspace_id", "sm_workspace_id"],
17
17
  team: ["team_id", "sm_team_id"]
18
18
  };
19
- class z {
19
+ class x {
20
20
  /**
21
21
  * @param {Object} options
22
22
  * @param {'localStorage' | 'sessionStorage' | 'memory'} [options.storage='localStorage']
@@ -26,7 +26,7 @@ class z {
26
26
  this.storageType = e, this.keys = { ...M, ...t }, this._memory = { access: null, refresh: null, user: null, tenant: null, team: null };
27
27
  }
28
28
  getAccessToken() {
29
- return this.storageType === "memory" ? this._memory.access : this._getFromStorage(this.keys.access, w.access);
29
+ return this.storageType === "memory" ? this._memory.access : this._getFromStorage(this.keys.access, k.access);
30
30
  }
31
31
  setAccessToken(e) {
32
32
  if (this.storageType === "memory") {
@@ -36,7 +36,7 @@ class z {
36
36
  this._setInStorage(this.keys.access, e);
37
37
  }
38
38
  getRefreshToken() {
39
- return this.storageType === "memory" ? this._memory.refresh : this._getFromStorage(this.keys.refresh, w.refresh);
39
+ return this.storageType === "memory" ? this._memory.refresh : this._getFromStorage(this.keys.refresh, k.refresh);
40
40
  }
41
41
  setRefreshToken(e) {
42
42
  if (this.storageType === "memory") {
@@ -47,7 +47,7 @@ class z {
47
47
  }
48
48
  getUser() {
49
49
  if (this.storageType === "memory") return this._memory.user;
50
- const e = this._getFromStorage(this.keys.user, w.user);
50
+ const e = this._getFromStorage(this.keys.user, k.user);
51
51
  if (!e) return null;
52
52
  try {
53
53
  return JSON.parse(e);
@@ -63,7 +63,7 @@ class z {
63
63
  this._setInStorage(this.keys.user, e ? JSON.stringify(e) : null);
64
64
  }
65
65
  getTenantId() {
66
- return this.storageType === "memory" ? this._memory.tenant : this._normalizeId(this._getFromStorage(this.keys.tenant, w.tenant));
66
+ return this.storageType === "memory" ? this._memory.tenant : this._normalizeId(this._getFromStorage(this.keys.tenant, k.tenant));
67
67
  }
68
68
  setTenantId(e) {
69
69
  const t = this._normalizeId(e);
@@ -74,7 +74,7 @@ class z {
74
74
  this._setInStorage(this.keys.tenant, t);
75
75
  }
76
76
  getTeamId() {
77
- return this.storageType === "memory" ? this._memory.team : this._normalizeId(this._getFromStorage(this.keys.team, w.team));
77
+ return this.storageType === "memory" ? this._memory.team : this._normalizeId(this._getFromStorage(this.keys.team, k.team));
78
78
  }
79
79
  setTeamId(e) {
80
80
  const t = this._normalizeId(e);
@@ -94,7 +94,7 @@ class z {
94
94
  localStorage.removeItem(e), sessionStorage.removeItem(e);
95
95
  } catch {
96
96
  }
97
- for (const e of Object.values(w))
97
+ for (const e of Object.values(k))
98
98
  for (const t of e)
99
99
  try {
100
100
  localStorage.removeItem(t), sessionStorage.removeItem(t);
@@ -112,14 +112,14 @@ class z {
112
112
  /** @private */
113
113
  _getFromStorage(e, t = []) {
114
114
  try {
115
- const s = this.storageType === "localStorage" ? localStorage : sessionStorage, n = this.storageType === "localStorage" ? sessionStorage : localStorage, r = s.getItem(e) || n.getItem(e);
115
+ const n = this.storageType === "localStorage" ? localStorage : sessionStorage, s = this.storageType === "localStorage" ? sessionStorage : localStorage, r = n.getItem(e) || s.getItem(e);
116
116
  if (r != null) return r;
117
117
  for (const i of t) {
118
- const c = s.getItem(i) || n.getItem(i);
118
+ const c = n.getItem(i) || s.getItem(i);
119
119
  if (c != null) {
120
120
  this._setInStorage(e, c);
121
121
  try {
122
- s.removeItem(i), n.removeItem(i);
122
+ n.removeItem(i), s.removeItem(i);
123
123
  } catch {
124
124
  }
125
125
  return c;
@@ -133,10 +133,10 @@ class z {
133
133
  /** @private */
134
134
  _setInStorage(e, t) {
135
135
  try {
136
- const s = this.storageType === "localStorage" ? localStorage : sessionStorage, n = this.storageType === "localStorage" ? sessionStorage : localStorage;
137
- t != null ? (s.setItem(e, t), n.removeItem(e)) : (s.removeItem(e), n.removeItem(e));
138
- } catch (s) {
139
- console.error("Failed to write to storage:", s);
136
+ const n = this.storageType === "localStorage" ? localStorage : sessionStorage, s = this.storageType === "localStorage" ? sessionStorage : localStorage;
137
+ t != null ? (n.setItem(e, t), s.removeItem(e)) : (n.removeItem(e), s.removeItem(e));
138
+ } catch (n) {
139
+ console.error("Failed to write to storage:", n);
140
140
  }
141
141
  }
142
142
  /** @private */
@@ -144,12 +144,12 @@ class z {
144
144
  if (e == null) return null;
145
145
  const t = String(e).trim();
146
146
  if (!t) return null;
147
- const s = t.toLowerCase();
148
- return s === "none" || s === "null" || s === "undefined" ? null : t;
147
+ const n = t.toLowerCase();
148
+ return n === "none" || n === "null" || n === "undefined" ? null : t;
149
149
  }
150
150
  }
151
- var f, U, L;
152
- class E {
151
+ var g, S, E;
152
+ class z {
153
153
  /**
154
154
  * @param {Object} options
155
155
  * @param {string} options.apiBaseUrl
@@ -159,47 +159,47 @@ class E {
159
159
  * @param {function(string): void} options.onTokenRefreshed
160
160
  * @param {function(): void} options.onRefreshFailed
161
161
  */
162
- constructor({ apiBaseUrl: e, refreshEndpoint: t, tokenManager: s, useCookieAuth: n = !1, onTokenRefreshed: r, onRefreshFailed: i }) {
163
- v(this, U);
164
- v(this, f, null);
165
- this.apiBaseUrl = e, this.refreshEndpoint = t, this.tokenManager = s, this.useCookieAuth = n, this.onTokenRefreshed = r, this.onRefreshFailed = i;
162
+ constructor({ apiBaseUrl: e, refreshEndpoint: t, tokenManager: n, useCookieAuth: s = !1, onTokenRefreshed: r, onRefreshFailed: i }) {
163
+ A(this, S);
164
+ A(this, g, null);
165
+ this.apiBaseUrl = e, this.refreshEndpoint = t, this.tokenManager = n, this.useCookieAuth = s, this.onTokenRefreshed = r, this.onRefreshFailed = i;
166
166
  }
167
167
  async refresh() {
168
- if (R(this, f))
169
- return R(this, f);
170
- A(this, f, q(this, U, L).call(this));
168
+ if (I(this, g))
169
+ return I(this, g);
170
+ T(this, g, q(this, S, E).call(this));
171
171
  try {
172
- return await R(this, f);
172
+ return await I(this, g);
173
173
  } finally {
174
- A(this, f, null);
174
+ T(this, g, null);
175
175
  }
176
176
  }
177
177
  }
178
- f = new WeakMap(), U = new WeakSet(), L = async function() {
178
+ g = new WeakMap(), S = new WeakSet(), E = async function() {
179
179
  const e = this.tokenManager.getRefreshToken();
180
180
  if (!e && !this.useCookieAuth)
181
181
  throw this.onRefreshFailed(), new Error("No refresh token");
182
- const t = JSON.stringify(e ? { refresh_token: e } : {}), s = await fetch(`${this.apiBaseUrl}${this.refreshEndpoint}`, {
182
+ const t = JSON.stringify(e ? { refresh_token: e } : {}), n = await fetch(`${this.apiBaseUrl}${this.refreshEndpoint}`, {
183
183
  ...this.useCookieAuth ? { credentials: "include" } : {},
184
184
  method: "POST",
185
185
  headers: { "Content-Type": "application/json" },
186
186
  body: t
187
187
  });
188
- if (!s.ok)
189
- throw this.onRefreshFailed(), new Error(`Refresh failed: ${s.status}`);
190
- const n = await s.json();
191
- return this.tokenManager.setAccessToken(n.access_token), n.refresh_token && this.tokenManager.setRefreshToken(n.refresh_token), this.onTokenRefreshed(n.access_token), n.access_token;
188
+ if (!n.ok)
189
+ throw this.onRefreshFailed(), new Error(`Refresh failed: ${n.status}`);
190
+ const s = await n.json();
191
+ return this.tokenManager.setAccessToken(s.access_token), s.refresh_token && this.tokenManager.setRefreshToken(s.refresh_token), this.onTokenRefreshed(s.access_token), s.access_token;
192
192
  };
193
193
  const C = "smart_memory_sso_redirect";
194
- class x {
194
+ class F {
195
195
  /**
196
196
  * @param {Object} options
197
197
  * @param {string} options.webAppUrl - Web app URL for login redirect
198
198
  * @param {string[]} [options.allowedHosts=[]] - Allowed redirect hostnames
199
199
  * @param {import('./TokenManager.js').TokenManager} options.tokenManager
200
200
  */
201
- constructor({ webAppUrl: e, allowedHosts: t = [], tokenManager: s }) {
202
- this.webAppUrl = e, this.allowedHosts = t, this.tokenManager = s;
201
+ constructor({ webAppUrl: e, allowedHosts: t = [], tokenManager: n }) {
202
+ this.webAppUrl = e, this.allowedHosts = t, this.tokenManager = n;
203
203
  }
204
204
  getLoginUrl(e) {
205
205
  const t = e || `${window.location.origin}/auth/callback`;
@@ -230,24 +230,24 @@ class x {
230
230
  }
231
231
  }
232
232
  }
233
- class F {
233
+ class O {
234
234
  constructor(e) {
235
- this.mode = e.mode, this.apiBaseUrl = e.apiBaseUrl, this.endpoints = e.endpoints || {}, this.listeners = /* @__PURE__ */ new Set(), this.useCookieAuth = e.useCookieAuth ?? this.mode === "sso", this.apiKey = e.apiKey || null, this.apiKey && (this.mode = "apiKey"), this.tokenManager = new z({
235
+ this.mode = e.mode, this.apiBaseUrl = e.apiBaseUrl, this.endpoints = e.endpoints || {}, this.listeners = /* @__PURE__ */ new Set(), this.useCookieAuth = e.useCookieAuth ?? this.mode === "sso", this.apiKey = e.apiKey || null, this.apiKey && (this.mode = "apiKey"), this.tokenManager = new x({
236
236
  storage: e.storage || "localStorage",
237
237
  keys: e.tokenKeys
238
- }), this.mode !== "apiKey" ? this.refreshManager = new E({
238
+ }), this.mode !== "apiKey" ? this.refreshManager = new z({
239
239
  apiBaseUrl: this.apiBaseUrl,
240
240
  refreshEndpoint: this.endpoints.refresh || "/auth/refresh",
241
241
  tokenManager: this.tokenManager,
242
242
  useCookieAuth: this.useCookieAuth,
243
243
  onTokenRefreshed: (t) => {
244
- var s;
245
- this.currentToken = t, this.notifyListeners(), (s = e.onTokenRefresh) == null || s.call(e, t);
244
+ var n;
245
+ this.currentToken = t, this.notifyListeners(), (n = e.onTokenRefresh) == null || n.call(e, t);
246
246
  },
247
247
  onRefreshFailed: () => {
248
248
  this.clearLocalAuth();
249
249
  }
250
- }) : this.refreshManager = null, this.mode === "sso" && (this.ssoManager = new x({
250
+ }) : this.refreshManager = null, this.mode === "sso" && (this.ssoManager = new F({
251
251
  webAppUrl: e.webAppUrl,
252
252
  allowedHosts: e.allowedRedirectHosts || [],
253
253
  tokenManager: this.tokenManager
@@ -266,14 +266,14 @@ class F {
266
266
  return this.tokenManager.getTenantId();
267
267
  }
268
268
  hasRole(e) {
269
- var t, s;
270
- return ((s = (t = this.currentUser) == null ? void 0 : t.roles) == null ? void 0 : s.includes(e)) || !1;
269
+ var t, n;
270
+ return ((n = (t = this.currentUser) == null ? void 0 : t.roles) == null ? void 0 : n.includes(e)) || !1;
271
271
  }
272
272
  getAuthHeaders(e = {}) {
273
273
  const t = { ...e };
274
274
  this.currentToken && (t.Authorization = this.currentToken.startsWith("Bearer ") ? this.currentToken : `Bearer ${this.currentToken}`);
275
- const s = this.tokenManager.getTeamId();
276
- return s && (t["X-Workspace-Id"] = s), t;
275
+ const n = this.tokenManager.getTeamId();
276
+ return n && (t["X-Workspace-Id"] = n), t;
277
277
  }
278
278
  getRequestOptions(e = {}) {
279
279
  return this.useCookieAuth ? { credentials: "include", ...e } : { ...e };
@@ -292,8 +292,8 @@ class F {
292
292
  this.listeners.forEach((t) => {
293
293
  try {
294
294
  t(e);
295
- } catch (s) {
296
- console.error("Auth listener error:", s);
295
+ } catch (n) {
296
+ console.error("Auth listener error:", n);
297
297
  }
298
298
  });
299
299
  }
@@ -342,11 +342,11 @@ class F {
342
342
  let t = await fetch(
343
343
  e,
344
344
  this.getRequestOptions({ method: "GET", headers: this.getAuthHeaders() })
345
- ), s = !1;
345
+ ), n = !1;
346
346
  if (!t.ok && (this.currentToken || this.tokenManager.getTeamId()) && (t = await fetch(
347
347
  e,
348
348
  this.getRequestOptions({ method: "GET", headers: {} })
349
- ), s = t.ok), !t.ok && t.status === 401 && this.refreshManager)
349
+ ), n = t.ok), !t.ok && t.status === 401 && this.refreshManager)
350
350
  try {
351
351
  await this.refreshManager.refresh(), t = await fetch(
352
352
  e,
@@ -355,10 +355,10 @@ class F {
355
355
  } catch {
356
356
  }
357
357
  if (!t.ok) return !1;
358
- const n = await t.json();
359
- this.currentUser = n, this.tokenManager.setUser(n);
360
- const r = (n == null ? void 0 : n.default_team_id) || this.tokenManager.getTeamId() || null;
361
- return r && (this.tokenManager.setTeamId(r), this.tokenManager.setTenantId((n == null ? void 0 : n.tenant_id) || r)), s && (this.tokenManager.setAccessToken(null), this.currentToken = null, n != null && n.default_team_id && this.tokenManager.setTeamId(n.default_team_id)), this.notifyListeners(), !0;
358
+ const s = await t.json();
359
+ this.currentUser = s, this.tokenManager.setUser(s);
360
+ const r = (s == null ? void 0 : s.default_team_id) || this.tokenManager.getTeamId() || null;
361
+ return r && (this.tokenManager.setTeamId(r), this.tokenManager.setTenantId((s == null ? void 0 : s.tenant_id) || r)), n && (this.tokenManager.setAccessToken(null), this.currentToken = null, s != null && s.default_team_id && this.tokenManager.setTeamId(s.default_team_id)), this.notifyListeners(), !0;
362
362
  } catch {
363
363
  return !1;
364
364
  }
@@ -367,20 +367,23 @@ class F {
367
367
  this.tokenManager.setTenantId(e), this.notifyListeners();
368
368
  }
369
369
  }
370
- class k extends Error {
370
+ class $ extends Error {
371
371
  /**
372
372
  * @param {string} message - Error message
373
373
  * @param {number} [status=0] - HTTP status code (0 for network errors)
374
374
  * @param {Object|null} [detail=null] - Error detail from API response
375
375
  */
376
- constructor(e, t = 0, s = null) {
377
- super(e), this.name = "APIError", this.status = t, this.detail = s;
376
+ constructor(e, t = 0, n = null) {
377
+ super(e), this.name = "APIError", this.status = t, this.detail = n;
378
378
  }
379
379
  }
380
- function S(a) {
380
+ function R(a) {
381
381
  return typeof FormData < "u" && a instanceof FormData;
382
382
  }
383
- class O {
383
+ function L(a) {
384
+ return (a == null ? void 0 : a.name) === "AbortError";
385
+ }
386
+ class j {
384
387
  /**
385
388
  * @param {import('../auth/AuthCore.js').AuthCore} authCore
386
389
  * @param {{ fetchFn?: typeof globalThis.fetch }} [options]
@@ -391,95 +394,105 @@ class O {
391
394
  get fetchFn() {
392
395
  return this._customFetchFn || globalThis.fetch.bind(globalThis);
393
396
  }
397
+ /**
398
+ * Issue an authenticated request.
399
+ *
400
+ * `options` is forwarded to `fetch` (via `AuthCore.getRequestOptions`), so any standard
401
+ * `RequestInit` key applies — notably `signal`, which cancels an in-flight request.
402
+ * An aborted request rejects with the original `AbortError`, not an `APIError`.
403
+ *
404
+ * @param {string} endpoint - Path appended to the client's base URL.
405
+ * @param {RequestInit & { signal?: AbortSignal }} [options]
406
+ */
394
407
  async request(e, t = {}) {
395
408
  var i, c;
396
- const s = `${this.baseURL}${e}`, n = {
397
- ...S(t.body) ? {} : { "Content-Type": "application/json" },
409
+ const n = `${this.baseURL}${e}`, s = {
410
+ ...R(t.body) ? {} : { "Content-Type": "application/json" },
398
411
  ...this.auth.getAuthHeaders(t.headers)
399
- }, r = this.auth.getRequestOptions({ ...t, headers: n });
412
+ }, r = this.auth.getRequestOptions({ ...t, headers: s });
400
413
  try {
401
- let o = await this.fetchFn(s, r);
414
+ let o = await this.fetchFn(n, r);
402
415
  if (o.status === 401 && !t.__isRetry)
403
416
  try {
404
417
  await this.auth.refreshToken();
405
- const h = {
406
- ...S(t.body) ? {} : { "Content-Type": "application/json" },
418
+ const m = {
419
+ ...R(t.body) ? {} : { "Content-Type": "application/json" },
407
420
  ...this.auth.getAuthHeaders(t.headers)
408
421
  };
409
422
  o = await this.fetchFn(
410
- s,
411
- this.auth.getRequestOptions({ ...r, headers: h, __isRetry: !0 })
423
+ n,
424
+ this.auth.getRequestOptions({ ...r, headers: m, __isRetry: !0 })
412
425
  );
413
426
  } catch {
414
427
  }
415
428
  if (o.status === 401)
416
- throw (c = (i = this.auth).clearLocalAuth) == null || c.call(i), new k("Authentication required", 401, "auth_expired");
429
+ throw (c = (i = this.auth).clearLocalAuth) == null || c.call(i), new $("Authentication required", 401, "auth_expired");
417
430
  if (o.status === 204)
418
431
  return null;
419
432
  if (!o.ok)
420
433
  throw await this._handleError(o);
421
434
  return await o.json();
422
435
  } catch (o) {
423
- throw o instanceof k ? o : new k(o.message, 0, "network_error");
436
+ throw o instanceof $ || L(o) ? o : new $(o.message, 0, "network_error");
424
437
  }
425
438
  }
426
439
  async get(e, t = {}) {
427
440
  return this.request(e, { ...t, method: "GET" });
428
441
  }
429
- async post(e, t, s = {}) {
442
+ async post(e, t, n = {}) {
430
443
  return this.request(e, {
431
- ...s,
444
+ ...n,
432
445
  method: "POST",
433
446
  body: JSON.stringify(t)
434
447
  });
435
448
  }
436
449
  async requestBinary(e, t = {}) {
437
450
  var i, c;
438
- const s = `${this.baseURL}${e}`, n = {
439
- ...S(t.body) ? {} : { "Content-Type": "application/json" },
451
+ const n = `${this.baseURL}${e}`, s = {
452
+ ...R(t.body) ? {} : { "Content-Type": "application/json" },
440
453
  ...this.auth.getAuthHeaders(t.headers)
441
- }, r = this.auth.getRequestOptions({ ...t, headers: n });
454
+ }, r = this.auth.getRequestOptions({ ...t, headers: s });
442
455
  try {
443
- let o = await this.fetchFn(s, r);
456
+ let o = await this.fetchFn(n, r);
444
457
  if (o.status === 401 && !t.__isRetry)
445
458
  try {
446
459
  await this.auth.refreshToken();
447
- const h = {
448
- ...S(t.body) ? {} : { "Content-Type": "application/json" },
460
+ const m = {
461
+ ...R(t.body) ? {} : { "Content-Type": "application/json" },
449
462
  ...this.auth.getAuthHeaders(t.headers)
450
463
  };
451
464
  o = await this.fetchFn(
452
- s,
453
- this.auth.getRequestOptions({ ...r, headers: h, __isRetry: !0 })
465
+ n,
466
+ this.auth.getRequestOptions({ ...r, headers: m, __isRetry: !0 })
454
467
  );
455
468
  } catch {
456
469
  }
457
470
  if (o.status === 401)
458
- throw (c = (i = this.auth).clearLocalAuth) == null || c.call(i), new k("Authentication required", 401, "auth_expired");
471
+ throw (c = (i = this.auth).clearLocalAuth) == null || c.call(i), new $("Authentication required", 401, "auth_expired");
459
472
  if (!o.ok)
460
473
  throw await this._handleError(o);
461
474
  return await o.arrayBuffer();
462
475
  } catch (o) {
463
- throw o instanceof k ? o : new k(o.message, 0, "network_error");
476
+ throw o instanceof $ || L(o) ? o : new $(o.message, 0, "network_error");
464
477
  }
465
478
  }
466
- async postForm(e, t, s = {}) {
479
+ async postForm(e, t, n = {}) {
467
480
  return this.request(e, {
468
- ...s,
481
+ ...n,
469
482
  method: "POST",
470
483
  body: t
471
484
  });
472
485
  }
473
- async put(e, t, s = {}) {
486
+ async put(e, t, n = {}) {
474
487
  return this.request(e, {
475
- ...s,
488
+ ...n,
476
489
  method: "PUT",
477
490
  body: JSON.stringify(t)
478
491
  });
479
492
  }
480
- async patch(e, t, s = {}) {
493
+ async patch(e, t, n = {}) {
481
494
  return this.request(e, {
482
- ...s,
495
+ ...n,
483
496
  method: "PATCH",
484
497
  body: JSON.stringify(t)
485
498
  });
@@ -489,15 +502,15 @@ class O {
489
502
  }
490
503
  /** @private */
491
504
  async _handleError(e) {
492
- var n, r;
505
+ var s, r;
493
506
  let t;
494
- const s = (r = (n = e.headers) == null ? void 0 : n.get) == null ? void 0 : r.call(n, "content-type");
507
+ const n = (r = (s = e.headers) == null ? void 0 : s.get) == null ? void 0 : r.call(s, "content-type");
495
508
  try {
496
- s != null && s.includes("application/json") ? t = await e.json() : t = { message: await e.text() };
509
+ n != null && n.includes("application/json") ? t = await e.json() : t = { message: await e.text() };
497
510
  } catch {
498
511
  t = { message: `HTTP ${e.status}` };
499
512
  }
500
- return new k(
513
+ return new $(
501
514
  this._extractMessage(t, e.status),
502
515
  e.status,
503
516
  t
@@ -516,18 +529,18 @@ class O {
516
529
  * @private
517
530
  */
518
531
  _extractMessage(e, t) {
519
- var n;
520
- const s = e == null ? void 0 : e.detail;
521
- if (typeof s == "string") return s;
522
- if (s && typeof s == "object") {
523
- if (typeof s.message == "string") return s.message;
524
- if (typeof s.code == "string") return s.code;
525
- if (Array.isArray(s) && typeof ((n = s[0]) == null ? void 0 : n.msg) == "string") return s[0].msg;
532
+ var s;
533
+ const n = e == null ? void 0 : e.detail;
534
+ if (typeof n == "string") return n;
535
+ if (n && typeof n == "object") {
536
+ if (typeof n.message == "string") return n.message;
537
+ if (typeof n.code == "string") return n.code;
538
+ if (Array.isArray(n) && typeof ((s = n[0]) == null ? void 0 : s.msg) == "string") return n[0].msg;
526
539
  }
527
540
  return typeof (e == null ? void 0 : e.message) == "string" ? e.message : `HTTP ${t}`;
528
541
  }
529
542
  }
530
- class j {
543
+ class B {
531
544
  constructor(e) {
532
545
  this.api = e;
533
546
  }
@@ -554,8 +567,8 @@ class j {
554
567
  async create({
555
568
  content: e,
556
569
  memoryType: t = "semantic",
557
- metadata: s = null,
558
- usePipeline: n = !0,
570
+ metadata: n = null,
571
+ usePipeline: s = !0,
559
572
  profileName: r = null,
560
573
  conversationContext: i = null,
561
574
  embed: c = null
@@ -563,8 +576,8 @@ class j {
563
576
  const o = {
564
577
  content: e,
565
578
  memory_type: t,
566
- metadata: s,
567
- use_pipeline: n,
579
+ metadata: n,
580
+ use_pipeline: s,
568
581
  profile_name: r
569
582
  };
570
583
  return i != null && (o.conversation_context = i), c != null && (o.embed = c), this.api.post("/memory/add", o);
@@ -589,11 +602,11 @@ class j {
589
602
  async update(e, t) {
590
603
  return this.api.patch(`/memory/${encodeURIComponent(e)}`, t);
591
604
  }
592
- async supersede(e, { content: t, memoryType: s, metadata: n = {}, reason: r }) {
605
+ async supersede(e, { content: t, memoryType: n, metadata: s = {}, reason: r }) {
593
606
  return this.api.post(`/memory/${encodeURIComponent(e)}/supersede`, {
594
607
  content: t,
595
- memory_type: s,
596
- metadata: n,
608
+ memory_type: n,
609
+ metadata: s,
597
610
  reason: r
598
611
  });
599
612
  }
@@ -613,10 +626,10 @@ class j {
613
626
  * @throws 400 if `newItemId` equals `id`; 404 if either item is missing *or*
614
627
  * out of scope (deliberately indistinguishable); 409 if the store declined.
615
628
  */
616
- async supersedeLink(e, t, s = null) {
629
+ async supersedeLink(e, t, n = null) {
617
630
  return this.api.post(`/memory/${encodeURIComponent(e)}/supersede-link`, {
618
631
  new_item_id: t,
619
- reason: s
632
+ reason: n
620
633
  });
621
634
  }
622
635
  async delete(e) {
@@ -641,12 +654,12 @@ class j {
641
654
  async list({
642
655
  limit: e = 50,
643
656
  offset: t = 0,
644
- type: s = null,
645
- metadataKey: n = null,
657
+ type: n = null,
658
+ metadataKey: s = null,
646
659
  metadataValue: r = null
647
660
  } = {}) {
648
661
  const i = new URLSearchParams({ limit: e, offset: t });
649
- return s && i.append("memory_type", s), n != null && i.append("metadata_key", n), r != null && i.append("metadata_value", r), this.api.get(`/memory/list?${i}`);
662
+ return n && i.append("memory_type", n), s != null && i.append("metadata_key", s), r != null && i.append("metadata_value", r), this.api.get(`/memory/list?${i}`);
650
663
  }
651
664
  /**
652
665
  * Search for memory items.
@@ -680,6 +693,14 @@ class j {
680
693
  * with no replacement, so it is a separate lifecycle state from superseded and is
681
694
  * NOT covered by includeSuperseded. Both are inert when asOfDate is set, which
682
695
  * retains those rows regardless.
696
+ * @param {boolean} [options.includeArchived=false] - Keep archived items visible in
697
+ * results (CORE-ARCHIVED-RECALL-1). Archived items are memories the decay/prune
698
+ * evolvers retired, or the source an episodic-to-semantic promotion replaced.
699
+ * Third sibling of the two above and not covered by either: an archived item has
700
+ * no replacement and no version chain. Also inert when asOfDate is set. Note this
701
+ * default CHANGED behaviour rather than preserving it — before
702
+ * CORE-ARCHIVED-RECALL-1 the server read `archived` on no search path at all, so
703
+ * archived items were returned ranked exactly like live ones.
683
704
  * @param {boolean} [options.cite=false] - When true (RECALL-CITATIONS-1), the
684
705
  * envelope gains a `citations` array of `{n, item_id, item_type, preview, score, footnote_marker}`.
685
706
  * Empty `citations: []` when no results — distinguishes "no results" from "no citations requested".
@@ -696,9 +717,9 @@ class j {
696
717
  * result marked `'unresolved'` is PRESENT-DAY content and must not be rendered
697
718
  * as a historical belief.
698
719
  */
699
- async search(e, { topK: t = 5, enableHybrid: s = !0, memoryType: n = null, expertise: r = !1, cite: i = !1, decompose: c = !1, multiHop: o = !1, maxHops: h = 3, budgetMs: y = 1500, semanticHops: p = !1, includeReference: d = !1, includeConsolidated: _ = !1, consolidationFirst: $ = !1, asOfDate: g = null, asOfStrict: u = !1, includeSuperseded: b = !1, includeRetracted: I = !1 } = {}) {
700
- const l = { query: e, top_k: t, enable_hybrid: s };
701
- return n && (l.memory_type = n), r && (l.expertise = !0), i && (l.cite = !0), c && (l.decompose = !0), o && (l.multi_hop = !0), o && h !== 3 && (l.max_hops = h), o && y !== 1500 && (l.budget_ms = y), o && p && (l.semantic_hops = !0), d && (l.include_reference = !0), _ && (l.include_consolidated = !0), $ && (l.consolidation_first = !0), g && (l.as_of_date = g instanceof Date ? g.toISOString() : g), u && (l.as_of_strict = !0), b && (l.include_superseded = !0), I && (l.include_retracted = !0), this.api.post("/memory/search", l);
720
+ async search(e, { topK: t = 5, enableHybrid: n = !0, memoryType: s = null, expertise: r = !1, cite: i = !1, decompose: c = !1, multiHop: o = !1, maxHops: m = 3, budgetMs: h = 1500, semanticHops: y = !1, includeReference: p = !1, includeConsolidated: f = !1, consolidationFirst: _ = !1, asOfDate: d = null, asOfStrict: l = !1, includeSuperseded: w = !1, includeRetracted: b = !1, includeArchived: U = !1 } = {}) {
721
+ const u = { query: e, top_k: t, enable_hybrid: n };
722
+ return s && (u.memory_type = s), r && (u.expertise = !0), i && (u.cite = !0), c && (u.decompose = !0), o && (u.multi_hop = !0), o && m !== 3 && (u.max_hops = m), o && h !== 1500 && (u.budget_ms = h), o && y && (u.semantic_hops = !0), p && (u.include_reference = !0), f && (u.include_consolidated = !0), _ && (u.consolidation_first = !0), d && (u.as_of_date = d instanceof Date ? d.toISOString() : d), l && (u.as_of_strict = !0), w && (u.include_superseded = !0), b && (u.include_retracted = !0), U && (u.include_archived = !0), this.api.post("/memory/search", u);
702
723
  }
703
724
  /**
704
725
  * Get the complete audit answer for one memory (PLAT-AUDITABLE-MEMORY-1).
@@ -716,28 +737,28 @@ class j {
716
737
  async explain(e) {
717
738
  return this.api.get(`/memory/${encodeURIComponent(e)}/explain`);
718
739
  }
719
- async getWorkingContext(e, t, { k: s = 20, maxTokens: n = null, strategy: r = null } = {}) {
740
+ async getWorkingContext(e, t, { k: n = 20, maxTokens: s = null, strategy: r = null } = {}) {
720
741
  const i = {
721
742
  session_id: e,
722
743
  query: t,
723
- k: s
744
+ k: n
724
745
  };
725
- return n != null && (i.max_tokens = n), r != null && (i.strategy = r), this.api.post("/memory/context", i);
746
+ return s != null && (i.max_tokens = s), r != null && (i.strategy = r), this.api.post("/memory/context", i);
726
747
  }
727
- async searchAdvanced(e, { algorithm: t = "query_traversal", maxResults: s = 15, useSSG: n = !0 } = {}) {
748
+ async searchAdvanced(e, { algorithm: t = "query_traversal", maxResults: n = 15, useSSG: s = !0 } = {}) {
728
749
  return this.api.post("/memory/search/advanced", {
729
750
  query: e,
730
751
  algorithm: t,
731
- max_results: s,
732
- use_ssg: n
752
+ max_results: n,
753
+ use_ssg: s
733
754
  });
734
755
  }
735
- async ingest(e, { profileName: t = null, extractorName: s = "llm", context: n = {} } = {}) {
756
+ async ingest(e, { profileName: t = null, extractorName: n = "llm", context: s = {} } = {}) {
736
757
  return this.api.post("/memory/ingest", {
737
758
  content: e,
738
759
  profile_name: t,
739
- extractor_name: s,
740
- context: n
760
+ extractor_name: n,
761
+ context: s
741
762
  });
742
763
  }
743
764
  async getLineage(e) {
@@ -755,13 +776,13 @@ class j {
755
776
  * endpoints return slightly different item shapes, so migrate deliberately rather
756
777
  * than by find-and-replace.
757
778
  */
758
- async searchByMetadata(e, t, { memoryType: s = null, limit: n = 25 } = {}) {
779
+ async searchByMetadata(e, t, { memoryType: n = null, limit: s = 25 } = {}) {
759
780
  const r = new URLSearchParams({
760
781
  metadata_key: e,
761
782
  metadata_value: t,
762
- limit: n
783
+ limit: s
763
784
  });
764
- return s && r.append("memory_type", s), this.api.get(`/memory/by-metadata?${r}`);
785
+ return n && r.append("memory_type", n), this.api.get(`/memory/by-metadata?${r}`);
765
786
  }
766
787
  async getNeighbors(e) {
767
788
  return this.api.get(`/memory/${encodeURIComponent(e)}/neighbors`);
@@ -771,43 +792,71 @@ class j {
771
792
  }
772
793
  async ingestConversation(e, {
773
794
  sessionBoundaries: t = null,
774
- conversationId: s = null,
775
- sessionDates: n = null,
795
+ conversationId: n = null,
796
+ sessionDates: s = null,
776
797
  turnsPerChunk: r = 15,
777
798
  maxChunkChars: i = 12e3,
778
799
  maxConcurrent: c = 4
779
800
  } = {}) {
780
801
  const o = { turns: e, turns_per_chunk: r, max_chunk_chars: i, max_concurrent: c };
781
- return t && (o.session_boundaries = t), s && (o.conversation_id = s), n && (o.session_dates = n), this.api.post("/memory/ingest/conversation", o);
802
+ return t && (o.session_boundaries = t), n && (o.conversation_id = n), s && (o.session_dates = s), this.api.post("/memory/ingest/conversation", o);
782
803
  }
783
- async ingestDocument(e, { title: t = null, source: s = null, chunkStrategy: n = null } = {}) {
804
+ async ingestDocument(e, { title: t = null, source: n = null, chunkStrategy: s = null } = {}) {
784
805
  const r = { content: e };
785
- return t && (r.title = t), s && (r.source = s), n && (r.chunk_strategy = n), this.api.post("/memory/ingest/document", r);
806
+ return t && (r.title = t), n && (r.source = n), s && (r.chunk_strategy = s), this.api.post("/memory/ingest/document", r);
786
807
  }
787
- async codeIndex(e, { repo: t = null, commit: s = null } = {}) {
788
- const n = { path: e };
789
- return t && (n.repo = t), s && (n.commit = s), this.api.post("/memory/code/index", n);
790
- }
791
- async codeSearch(e, { entityType: t = null, repo: s = null, limit: n = 20, semantic: r = !1 } = {}) {
792
- const i = new URLSearchParams({ query: e, limit: n, semantic: r });
793
- return t && i.append("entity_type", t), s && i.append("repo", s), this.api.get(`/memory/code/search?${i}`);
808
+ /**
809
+ * Import a ChatGPT or Claude conversation export (DIST-CHAT-IMPORT-1).
810
+ *
811
+ * Conversations run through the normal conversation pipeline, so entities and
812
+ * relations are extracted exactly as for a live conversation. Items land with
813
+ * origin `import:chatgpt_export` / `import:claude_export` — tier 1, so they are
814
+ * recallable, and dedupe-eligible, so re-uploading a later export updates the
815
+ * overlap rather than duplicating it.
816
+ *
817
+ * @param {Blob|File} file - The vendor .zip as downloaded, or its conversations.json.
818
+ * @param {object} [options]
819
+ * @param {string} [options.sourceFormat='auto'] - 'auto' | 'chatgpt' | 'claude'.
820
+ * @param {number} [options.maxConversations=25] - Cap on conversations ingested (1-200).
821
+ * The import is synchronous and each conversation runs the full pipeline, so this
822
+ * bound is real. Longest conversations are kept first.
823
+ * @returns {Promise<object>} `{ source_format, conversations_imported,
824
+ * conversations_failed, turns_imported, items_created, warnings }`. Always check
825
+ * `warnings` — a non-empty list means something was capped, skipped, or degraded
826
+ * even though the call succeeded.
827
+ */
828
+ async importChatExport(e, { sourceFormat: t = "auto", maxConversations: n = 25 } = {}) {
829
+ const s = new FormData();
830
+ 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);
831
+ }
832
+ /** List supported chat-export formats and how a user obtains each export. */
833
+ async chatExportFormats() {
834
+ return this.api.get("/memory/import/chat-export/formats");
835
+ }
836
+ async codeIndex(e, { repo: t = null, commit: n = null } = {}) {
837
+ const s = { path: e };
838
+ return t && (s.repo = t), n && (s.commit = n), this.api.post("/memory/code/index", s);
839
+ }
840
+ async codeSearch(e, { entityType: t = null, repo: n = null, limit: s = 20, semantic: r = !1 } = {}) {
841
+ const i = new URLSearchParams({ query: e, limit: s, semantic: r });
842
+ return t && i.append("entity_type", t), n && i.append("repo", n), this.api.get(`/memory/code/search?${i}`);
794
843
  }
795
844
  async codeContext(e, { repo: t = null } = {}) {
796
- const s = new URLSearchParams({ entity_name: e });
797
- return t && s.append("repo", t), this.api.get(`/memory/code/context?${s}`);
845
+ const n = new URLSearchParams({ entity_name: e });
846
+ return t && n.append("repo", t), this.api.get(`/memory/code/context?${n}`);
798
847
  }
799
848
  async codeDeadCode(e) {
800
849
  return this.api.get(`/memory/code/dead-code?repo=${encodeURIComponent(e)}`);
801
850
  }
802
- async codeDependencies(e, { direction: t = "both", repo: s = null } = {}) {
803
- const n = new URLSearchParams({ entity_name: e, direction: t });
804
- return s && n.append("repo", s), this.api.get(`/memory/code/dependencies?${n}`);
851
+ async codeDependencies(e, { direction: t = "both", repo: n = null } = {}) {
852
+ const s = new URLSearchParams({ entity_name: e, direction: t });
853
+ return n && s.append("repo", n), this.api.get(`/memory/code/dependencies?${s}`);
805
854
  }
806
855
  async getPlan(e) {
807
856
  return this.api.get(`/memory/plans/${e}`);
808
857
  }
809
- async updatePlanTask(e, { taskId: t, status: s }) {
810
- return this.api.patch(`/memory/plans/${e}/task`, { task_id: t, status: s });
858
+ async updatePlanTask(e, { taskId: t, status: n }) {
859
+ return this.api.patch(`/memory/plans/${e}/task`, { task_id: t, status: n });
811
860
  }
812
861
  async completePlan(e, { graduate: t = !1 } = {}) {
813
862
  return this.api.post(`/memory/plans/${e}/complete`, { graduate: t });
@@ -815,11 +864,11 @@ class j {
815
864
  async failPlan(e, t) {
816
865
  return this.api.post(`/memory/plans/${e}/fail`, { reason: t });
817
866
  }
818
- async link(e, t, s = "RELATED") {
867
+ async link(e, t, n = "RELATED") {
819
868
  return this.api.post("/memory/link", {
820
869
  source_id: e,
821
870
  target_id: t,
822
- link_type: s
871
+ link_type: n
823
872
  });
824
873
  }
825
874
  async enrich(e, t = []) {
@@ -843,44 +892,44 @@ class j {
843
892
  * @param {string} [query] - Original query that produced these results.
844
893
  * @returns {Promise<{updated: number, edges_strengthened: number, outcome: string}>}
845
894
  */
846
- async feedback(e, t, s = null) {
847
- const n = { item_ids: e, outcome: t };
848
- return s != null && (n.query = s), this.api.post("/memory/feedback", n);
895
+ async feedback(e, t, n = null) {
896
+ const s = { item_ids: e, outcome: t };
897
+ return n != null && (s.query = n), this.api.post("/memory/feedback", s);
849
898
  }
850
- async ground(e, t, s = null) {
899
+ async ground(e, t, n = null) {
851
900
  return this.api.post(`/memory/${encodeURIComponent(e)}/ground`, {
852
901
  item_id: e,
853
902
  source_url: t,
854
- validation: s
903
+ validation: n
855
904
  });
856
905
  }
857
906
  async clearAll(e = !1) {
858
907
  return this.api.delete(`/memory/clear-all?nuclear=${e}`);
859
908
  }
860
909
  // --- Temporal ---
861
- async getHistory(e, { startTime: t = null, endTime: s = null, limit: n = 100 } = {}) {
862
- let r = `/memory/temporal/${e}/history?limit=${n}`;
863
- return t && (r += `&start_time=${t}`), s && (r += `&end_time=${s}`), this.api.get(r);
910
+ async getHistory(e, { startTime: t = null, endTime: n = null, limit: s = 100 } = {}) {
911
+ let r = `/memory/temporal/${e}/history?limit=${s}`;
912
+ return t && (r += `&start_time=${t}`), n && (r += `&end_time=${n}`), this.api.get(r);
864
913
  }
865
- async timeTravel(e, { query: t = null, limit: s = 100 } = {}) {
866
- let n = `/memory/temporal/at/${e}?limit=${s}`;
867
- return t && (n += `&query=${encodeURIComponent(t)}`), this.api.get(n);
914
+ async timeTravel(e, { query: t = null, limit: n = 100 } = {}) {
915
+ let s = `/memory/temporal/at/${e}?limit=${n}`;
916
+ return t && (s += `&query=${encodeURIComponent(t)}`), this.api.get(s);
868
917
  }
869
918
  async getItemAtTime(e, t) {
870
919
  return this.api.get(`/memory/temporal/${e}/at/${t}`);
871
920
  }
872
- async getChanges(e, { since: t = null, until: s = null, changeType: n = null } = {}) {
921
+ async getChanges(e, { since: t = null, until: n = null, changeType: s = null } = {}) {
873
922
  let r = `/memory/temporal/${e}/changes`;
874
923
  const i = [];
875
- 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);
924
+ 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);
876
925
  }
877
- async compareVersions(e, t, s) {
878
- return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${s}`);
926
+ async compareVersions(e, t, n) {
927
+ return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${n}`);
879
928
  }
880
- async rollback(e, { toVersion: t = null, toTime: s = null } = {}) {
881
- let n = `/memory/temporal/${e}/rollback`;
929
+ async rollback(e, { toVersion: t = null, toTime: n = null } = {}) {
930
+ let s = `/memory/temporal/${e}/rollback`;
882
931
  const r = [];
883
- return t !== null && r.push(`to_version=${t}`), s && r.push(`to_time=${s}`), r.length && (n += `?${r.join("&")}`), this.api.post(n);
932
+ return t !== null && r.push(`to_version=${t}`), n && r.push(`to_time=${n}`), r.length && (s += `?${r.join("&")}`), this.api.post(s);
884
933
  }
885
934
  // --- Clustering ---
886
935
  async runClustering(e = 0.1, t = !1) {
@@ -912,30 +961,30 @@ class H {
912
961
  async create({
913
962
  content: e,
914
963
  decisionType: t = "inference",
915
- confidence: s = 0.8,
916
- sourceTraceId: n = null,
964
+ confidence: n = 0.8,
965
+ sourceTraceId: s = null,
917
966
  sourceSessionId: r = null,
918
967
  evidenceIds: i = null,
919
968
  domain: c = null,
920
969
  tags: o = null,
921
- rejectedAlternatives: h = null,
922
- rationale: y = null,
923
- constraints: p = null,
924
- agentId: d = null
970
+ rejectedAlternatives: m = null,
971
+ rationale: h = null,
972
+ constraints: y = null,
973
+ agentId: p = null
925
974
  }) {
926
975
  return this.api.post("/memory/decisions/create", {
927
976
  content: e,
928
977
  decision_type: t,
929
- confidence: s,
930
- source_trace_id: n,
978
+ confidence: n,
979
+ source_trace_id: s,
931
980
  source_session_id: r,
932
981
  evidence_ids: i,
933
982
  domain: c,
934
983
  tags: o,
935
- rejected_alternatives: h,
936
- rationale: y,
937
- constraints: p,
938
- agent_id: d
984
+ rejected_alternatives: m,
985
+ rationale: h,
986
+ constraints: y,
987
+ agent_id: p
939
988
  });
940
989
  }
941
990
  /**
@@ -981,12 +1030,12 @@ class H {
981
1030
  * @param {string[]} [params.tags]
982
1031
  * @param {string} [params.agentId]
983
1032
  */
984
- async createPending({ content: e, requirements: t, domain: s = null, tags: n = null, agentId: r = null }) {
1033
+ async createPending({ content: e, requirements: t, domain: n = null, tags: s = null, agentId: r = null }) {
985
1034
  return this.api.post("/memory/decisions/pending/create", {
986
1035
  content: e,
987
1036
  requirements: t,
988
- domain: s,
989
- tags: n,
1037
+ domain: n,
1038
+ tags: s,
990
1039
  agent_id: r
991
1040
  });
992
1041
  }
@@ -997,10 +1046,10 @@ class H {
997
1046
  * @param {string} params.requirementId
998
1047
  * @param {string} params.memoryId
999
1048
  */
1000
- async resolveRequirement(e, { requirementId: t, memoryId: s }) {
1049
+ async resolveRequirement(e, { requirementId: t, memoryId: n }) {
1001
1050
  return this.api.post(`/memory/decisions/pending/${e}/resolve`, {
1002
1051
  requirement_id: t,
1003
- memory_id: s
1052
+ memory_id: n
1004
1053
  });
1005
1054
  }
1006
1055
  /**
@@ -1073,8 +1122,8 @@ class H {
1073
1122
  * @param {string} [options.direction='both'] - causes|effects|both
1074
1123
  * @param {number} [options.maxDepth=3]
1075
1124
  */
1076
- async getCausalChain(e, { direction: t = "both", maxDepth: s = 3 } = {}) {
1077
- return this.api.get(`/memory/decisions/${e}/causal-chain?direction=${t}&max_depth=${s}`);
1125
+ async getCausalChain(e, { direction: t = "both", maxDepth: n = 3 } = {}) {
1126
+ return this.api.get(`/memory/decisions/${e}/causal-chain?direction=${t}&max_depth=${n}`);
1078
1127
  }
1079
1128
  /**
1080
1129
  * Find existing decisions that may conflict with this one.
@@ -1108,7 +1157,7 @@ class H {
1108
1157
  });
1109
1158
  }
1110
1159
  }
1111
- class B {
1160
+ class K {
1112
1161
  constructor(e) {
1113
1162
  this.api = e;
1114
1163
  }
@@ -1126,30 +1175,37 @@ class B {
1126
1175
  * server auto-populate from scope.resolve_agent_id().
1127
1176
  */
1128
1177
  async createOpinion(e, t = {}) {
1129
- const s = { content: e };
1130
- 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);
1178
+ const n = { content: e };
1179
+ 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);
1131
1180
  }
1132
1181
  }
1133
- class K {
1182
+ class G {
1134
1183
  constructor(e) {
1135
1184
  this.api = e;
1136
1185
  }
1137
- async getNeighbors(e) {
1138
- return this.api.get(`/memory/${e}/neighbors`);
1186
+ /**
1187
+ * Fetch a memory item's graph neighbours.
1188
+ * @param {string} itemId
1189
+ * @param {{ signal?: AbortSignal }} [options]
1190
+ */
1191
+ async getNeighbors(e, t = {}) {
1192
+ return this.api.get(`/memory/${encodeURIComponent(e)}/neighbors`, t);
1139
1193
  }
1140
- async addEdge(e, t, s, n = {}) {
1194
+ async addEdge(e, t, n, s = {}) {
1141
1195
  return this.api.post("/memory/edge", {
1142
1196
  source_id: e,
1143
1197
  target_id: t,
1144
- relation_type: s,
1145
- properties: n
1198
+ relation_type: n,
1199
+ properties: s
1146
1200
  });
1147
1201
  }
1148
- async getHealth() {
1149
- return this.api.get("/memory/graph/health");
1202
+ /** @param {{ signal?: AbortSignal }} [options] */
1203
+ async getHealth(e = {}) {
1204
+ return this.api.get("/memory/graph/health", e);
1150
1205
  }
1151
- async getInferenceRules() {
1152
- return this.api.get("/memory/inference/rules");
1206
+ /** @param {{ signal?: AbortSignal }} [options] */
1207
+ async getInferenceRules(e = {}) {
1208
+ return this.api.get("/memory/inference/rules", e);
1153
1209
  }
1154
1210
  async runInference({ dryRun: e = !1 } = {}) {
1155
1211
  return this.api.post("/memory/inference", {
@@ -1161,24 +1217,29 @@ class K {
1161
1217
  * @param {string} startId
1162
1218
  * @param {string} endId
1163
1219
  * @param {number} [maxHops=5]
1220
+ * @param {{ signal?: AbortSignal }} [options]
1164
1221
  */
1165
- async findShortestPath(e, t, s = 5) {
1166
- return this.api.get(`/memory/graph/path?start_id=${encodeURIComponent(e)}&end_id=${encodeURIComponent(t)}&max_hops=${s}`);
1222
+ async findShortestPath(e, t, n = 5, s = {}) {
1223
+ return this.api.get(`/memory/graph/path?start_id=${encodeURIComponent(e)}&end_id=${encodeURIComponent(t)}&max_hops=${n}`, s);
1167
1224
  }
1168
1225
  /**
1169
1226
  * Fetch the full knowledge graph.
1170
1227
  * @param {number} [limit] - Optional client hint; backend enforces hard cap.
1228
+ * @param {{ signal?: AbortSignal }} [options]
1171
1229
  */
1172
- async getFullGraph(e) {
1173
- return e == null ? this.api.get("/memory/graph/full") : this.api.get(`/memory/graph/full?limit=${encodeURIComponent(e)}`);
1230
+ async getFullGraph(e, t = {}) {
1231
+ return e == null ? this.api.get("/memory/graph/full", t) : this.api.get(`/memory/graph/full?limit=${encodeURIComponent(e)}`, t);
1174
1232
  }
1175
1233
  /**
1176
1234
  * Fetch edges for multiple node IDs in bulk.
1235
+ *
1236
+ * A POST, but a read — it mutates nothing, so unlike the writes below it takes a signal.
1177
1237
  * @param {string[]} nodeIds
1238
+ * @param {{ includeProperties?: boolean, signal?: AbortSignal }} [options]
1178
1239
  */
1179
- async getEdgesBulk(e, { includeProperties: t = !1 } = {}) {
1240
+ async getEdgesBulk(e, { includeProperties: t = !1, signal: n } = {}) {
1180
1241
  const s = t ? "?include_properties=true" : "";
1181
- return this.api.post(`/memory/graph/edges${s}`, { node_ids: e });
1242
+ return this.api.post(`/memory/graph/edges${s}`, { node_ids: e }, n ? { signal: n } : {});
1182
1243
  }
1183
1244
  /**
1184
1245
  * Bulk upsert graph nodes and edges, optionally replacing a node-ID prefix.
@@ -1187,16 +1248,17 @@ class K {
1187
1248
  * @param {Array<Object>} [params.edges=[]] - Edges with source_id, target_id, edge_type, and properties.
1188
1249
  * @param {string|null} [params.deletePrefix=null] - Scoped node-ID prefix to delete before writing.
1189
1250
  */
1190
- async bulkUpsert({ nodes: e = [], edges: t = [], deletePrefix: s = null } = {}) {
1191
- const n = { nodes: e, edges: t };
1192
- return s !== null && (n.delete_prefix = s), this.api.post("/memory/graph/bulk", n);
1251
+ async bulkUpsert({ nodes: e = [], edges: t = [], deletePrefix: n = null } = {}) {
1252
+ const s = { nodes: e, edges: t };
1253
+ return n !== null && (s.delete_prefix = n), this.api.post("/memory/graph/bulk", s);
1193
1254
  }
1194
1255
  /**
1195
1256
  * Get Wikipedia grounding status for an entity node.
1196
1257
  * @param {string} nodeId
1258
+ * @param {{ signal?: AbortSignal }} [options]
1197
1259
  */
1198
- async getGroundingStatus(e) {
1199
- return this.api.get(`/memory/graph/nodes/${encodeURIComponent(e)}/grounding`);
1260
+ async getGroundingStatus(e, t = {}) {
1261
+ return this.api.get(`/memory/graph/nodes/${encodeURIComponent(e)}/grounding`, t);
1200
1262
  }
1201
1263
  /**
1202
1264
  * Update an entity node's label or type. Triggers ontology self-learning.
@@ -1223,9 +1285,10 @@ class K {
1223
1285
  /**
1224
1286
  * Get links for a memory item.
1225
1287
  * @param {string} itemId
1288
+ * @param {{ signal?: AbortSignal }} [options]
1226
1289
  */
1227
- async getLinks(e) {
1228
- return this.api.get(`/memory/${encodeURIComponent(e)}/links`);
1290
+ async getLinks(e, t = {}) {
1291
+ return this.api.get(`/memory/${encodeURIComponent(e)}/links`, t);
1229
1292
  }
1230
1293
  /**
1231
1294
  * Merge unambiguous single-token entity aliases ("Hudson") into their
@@ -1265,7 +1328,7 @@ class K {
1265
1328
  );
1266
1329
  }
1267
1330
  }
1268
- class G {
1331
+ class D {
1269
1332
  constructor(e) {
1270
1333
  this.api = e;
1271
1334
  }
@@ -1273,12 +1336,12 @@ class G {
1273
1336
  const t = e ? "?include_system=true" : "";
1274
1337
  return this.api.get(`/memory/teams${t}`);
1275
1338
  }
1276
- async create({ name: e, description: t = null, dataClassification: s = "internal", costCenter: n = null, isSystem: r = !1 }) {
1339
+ async create({ name: e, description: t = null, dataClassification: n = "internal", costCenter: s = null, isSystem: r = !1 }) {
1277
1340
  const i = {
1278
1341
  name: e,
1279
1342
  description: t,
1280
- data_classification: s,
1281
- cost_center: n
1343
+ data_classification: n,
1344
+ cost_center: s
1282
1345
  };
1283
1346
  return r && (i.is_system = !0), this.api.post("/memory/teams", i);
1284
1347
  }
@@ -1294,20 +1357,20 @@ class G {
1294
1357
  async getMembers(e) {
1295
1358
  return this.api.get(`/memory/teams/${e}/members`);
1296
1359
  }
1297
- async addMember(e, t, s = "member") {
1360
+ async addMember(e, t, n = "member") {
1298
1361
  return this.api.post(`/memory/teams/${e}/members`, {
1299
1362
  user_id: t,
1300
- role: s
1363
+ role: n
1301
1364
  });
1302
1365
  }
1303
- async updateMember(e, t, s) {
1304
- return this.api.patch(`/memory/teams/${e}/members/${t}`, { role: s });
1366
+ async updateMember(e, t, n) {
1367
+ return this.api.patch(`/memory/teams/${e}/members/${t}`, { role: n });
1305
1368
  }
1306
1369
  async removeMember(e, t) {
1307
1370
  return this.api.delete(`/memory/teams/${e}/members/${t}`);
1308
1371
  }
1309
1372
  }
1310
- class D {
1373
+ class N {
1311
1374
  constructor(e) {
1312
1375
  this.api = e;
1313
1376
  }
@@ -1329,7 +1392,7 @@ class D {
1329
1392
  return this.api.patch("/auth/llm-keys", e);
1330
1393
  }
1331
1394
  }
1332
- class N {
1395
+ class J {
1333
1396
  constructor(e) {
1334
1397
  this.api = e;
1335
1398
  }
@@ -1355,18 +1418,18 @@ class N {
1355
1418
  });
1356
1419
  }
1357
1420
  }
1358
- class J {
1421
+ class W {
1359
1422
  constructor(e) {
1360
1423
  this.api = e;
1361
1424
  }
1362
1425
  async getCurrentUser() {
1363
1426
  return this.api.get("/auth/me");
1364
1427
  }
1365
- async createAPIKey(e, t, s = null) {
1428
+ async createAPIKey(e, t, n = null) {
1366
1429
  return this.api.post("/memory/api-keys", {
1367
1430
  name: e,
1368
1431
  scopes: t,
1369
- expires_in_days: s
1432
+ expires_in_days: n
1370
1433
  });
1371
1434
  }
1372
1435
  async listAPIKeys() {
@@ -1376,19 +1439,19 @@ class J {
1376
1439
  return this.api.delete(`/memory/api-keys/${e}`);
1377
1440
  }
1378
1441
  }
1379
- class W {
1442
+ class V {
1380
1443
  constructor(e) {
1381
1444
  this.api = e;
1382
1445
  }
1383
1446
  async list() {
1384
1447
  return this.api.get("/memory/agents");
1385
1448
  }
1386
- async create({ name: e, description: t = null, agentConfig: s = {}, roles: n = ["user"] }) {
1449
+ async create({ name: e, description: t = null, agentConfig: n = {}, roles: s = ["user"] }) {
1387
1450
  return this.api.post("/memory/agents", {
1388
1451
  name: e,
1389
1452
  description: t,
1390
- agent_config: s,
1391
- roles: n
1453
+ agent_config: n,
1454
+ roles: s
1392
1455
  });
1393
1456
  }
1394
1457
  async get(e) {
@@ -1414,9 +1477,9 @@ class W {
1414
1477
  * @param {string} domain - Domain string (e.g. "python").
1415
1478
  * @returns {Promise<{evaluation: object|null}>}
1416
1479
  */
1417
- async getEvaluation(e, t, s) {
1418
- const n = new URLSearchParams({ dimension: t, domain: s }).toString();
1419
- return this.api.get(`/memory/agents/${e}/evaluation${n ? "?" + n : ""}`);
1480
+ async getEvaluation(e, t, n) {
1481
+ const s = new URLSearchParams({ dimension: t, domain: n }).toString();
1482
+ return this.api.get(`/memory/agents/${e}/evaluation${s ? "?" + s : ""}`);
1420
1483
  }
1421
1484
  /**
1422
1485
  * Get evaluation history for an agent on a given (dimension, domain) slot.
@@ -1430,12 +1493,12 @@ class W {
1430
1493
  * @param {number} [options.limit=20] - Maximum records to return.
1431
1494
  * @returns {Promise<{history: object[]}>}
1432
1495
  */
1433
- async listEvaluationHistory(e, t, s, { limit: n = 20 } = {}) {
1434
- const r = new URLSearchParams({ dimension: t, domain: s, limit: String(n) }).toString();
1496
+ async listEvaluationHistory(e, t, n, { limit: s = 20 } = {}) {
1497
+ const r = new URLSearchParams({ dimension: t, domain: n, limit: String(s) }).toString();
1435
1498
  return this.api.get(`/memory/agents/${e}/evaluation/history${r ? "?" + r : ""}`);
1436
1499
  }
1437
1500
  }
1438
- class V {
1501
+ class Y {
1439
1502
  constructor(e) {
1440
1503
  this.api = e;
1441
1504
  }
@@ -1449,7 +1512,7 @@ class V {
1449
1512
  return this.api.get("/usage/tiers");
1450
1513
  }
1451
1514
  }
1452
- class Y {
1515
+ class X {
1453
1516
  constructor(e) {
1454
1517
  this.api = e;
1455
1518
  }
@@ -1466,7 +1529,7 @@ class Y {
1466
1529
  return this.api.get("/memory/plugins");
1467
1530
  }
1468
1531
  }
1469
- class X {
1532
+ class Z {
1470
1533
  constructor(e) {
1471
1534
  this.api = e;
1472
1535
  }
@@ -1489,7 +1552,7 @@ class X {
1489
1552
  return this.api.get("/memory/token-usage/current");
1490
1553
  }
1491
1554
  }
1492
- class Z {
1555
+ class Q {
1493
1556
  constructor(e) {
1494
1557
  this.api = e;
1495
1558
  }
@@ -1502,9 +1565,9 @@ class Z {
1502
1565
  * @param {string} [options.endTime] - ISO end time
1503
1566
  * @param {number} [options.limit=100]
1504
1567
  */
1505
- async getHistory(e, { startTime: t = null, endTime: s = null, limit: n = 100 } = {}) {
1506
- let r = `/memory/temporal/${e}/history?limit=${n}`;
1507
- return t && (r += `&start_time=${t}`), s && (r += `&end_time=${s}`), this.api.get(r);
1568
+ async getHistory(e, { startTime: t = null, endTime: n = null, limit: s = 100 } = {}) {
1569
+ let r = `/memory/temporal/${e}/history?limit=${s}`;
1570
+ return t && (r += `&start_time=${t}`), n && (r += `&end_time=${n}`), this.api.get(r);
1508
1571
  }
1509
1572
  // === TIME-TRAVEL QUERIES ===
1510
1573
  /**
@@ -1514,9 +1577,9 @@ class Z {
1514
1577
  * @param {string} [options.query]
1515
1578
  * @param {number} [options.limit=100]
1516
1579
  */
1517
- async timeTravel(e, { query: t = null, limit: s = 100 } = {}) {
1518
- let n = `/memory/temporal/at/${e}?limit=${s}`;
1519
- return t && (n += `&query=${encodeURIComponent(t)}`), this.api.get(n);
1580
+ async timeTravel(e, { query: t = null, limit: n = 100 } = {}) {
1581
+ let s = `/memory/temporal/at/${e}?limit=${n}`;
1582
+ return t && (s += `&query=${encodeURIComponent(t)}`), this.api.get(s);
1520
1583
  }
1521
1584
  /**
1522
1585
  * Get specific item as it existed at timestamp.
@@ -1535,10 +1598,10 @@ class Z {
1535
1598
  * @param {string} [options.until]
1536
1599
  * @param {string} [options.changeType]
1537
1600
  */
1538
- async getChanges(e, { since: t = null, until: s = null, changeType: n = null } = {}) {
1601
+ async getChanges(e, { since: t = null, until: n = null, changeType: s = null } = {}) {
1539
1602
  let r = `/memory/temporal/${e}/changes`;
1540
1603
  const i = [];
1541
- 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);
1604
+ 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);
1542
1605
  }
1543
1606
  // === VERSION COMPARISON ===
1544
1607
  /**
@@ -1547,8 +1610,8 @@ class Z {
1547
1610
  * @param {number} v1
1548
1611
  * @param {number} v2
1549
1612
  */
1550
- async compareVersions(e, t, s) {
1551
- return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${s}`);
1613
+ async compareVersions(e, t, n) {
1614
+ return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${n}`);
1552
1615
  }
1553
1616
  // === ROLLBACK ===
1554
1617
  /**
@@ -1558,10 +1621,10 @@ class Z {
1558
1621
  * @param {number} [options.toVersion]
1559
1622
  * @param {string} [options.toTime]
1560
1623
  */
1561
- async rollback(e, { toVersion: t = null, toTime: s = null } = {}) {
1562
- let n = `/memory/temporal/${e}/rollback`;
1624
+ async rollback(e, { toVersion: t = null, toTime: n = null } = {}) {
1625
+ let s = `/memory/temporal/${e}/rollback`;
1563
1626
  const r = [];
1564
- return t !== null && r.push(`to_version=${t}`), s && r.push(`to_time=${s}`), r.length && (n += `?${r.join("&")}`), this.api.post(n);
1627
+ return t !== null && r.push(`to_version=${t}`), n && r.push(`to_time=${n}`), r.length && (s += `?${r.join("&")}`), this.api.post(s);
1565
1628
  }
1566
1629
  // === AUDIT TRAIL ===
1567
1630
  /**
@@ -1573,10 +1636,10 @@ class Z {
1573
1636
  * @param {string} [options.startTime]
1574
1637
  * @param {string} [options.endTime]
1575
1638
  */
1576
- async getAuditTrail(e, { changeType: t = null, userId: s = null, startTime: n = null, endTime: r = null } = {}) {
1639
+ async getAuditTrail(e, { changeType: t = null, userId: n = null, startTime: s = null, endTime: r = null } = {}) {
1577
1640
  let i = `/memory/temporal/${e}/audit`;
1578
1641
  const c = [];
1579
- return t && c.push(`change_type=${t}`), s && c.push(`user_id=${s}`), n && c.push(`start_time=${n}`), r && c.push(`end_time=${r}`), c.length && (i += `?${c.join("&")}`), this.api.get(i);
1642
+ return t && c.push(`change_type=${t}`), n && c.push(`user_id=${n}`), s && c.push(`start_time=${s}`), r && c.push(`end_time=${r}`), c.length && (i += `?${c.join("&")}`), this.api.get(i);
1580
1643
  }
1581
1644
  // === TEMPORAL SEARCH ===
1582
1645
  /**
@@ -1586,12 +1649,12 @@ class Z {
1586
1649
  * @param {string} endTime
1587
1650
  * @param {number} [limit=100]
1588
1651
  */
1589
- async searchDuringRange(e, t, s, n = 100) {
1652
+ async searchDuringRange(e, t, n, s = 100) {
1590
1653
  const r = new URLSearchParams({
1591
1654
  query: e,
1592
1655
  start_time: t,
1593
- end_time: s,
1594
- limit: String(n)
1656
+ end_time: n,
1657
+ limit: String(s)
1595
1658
  }).toString();
1596
1659
  return this.api.get(`/memory/temporal/search/during?${r}`);
1597
1660
  }
@@ -1604,10 +1667,10 @@ class Z {
1604
1667
  * @param {string} [options.reportType='HIPAA']
1605
1668
  * @param {string[]} [options.itemIds]
1606
1669
  */
1607
- async complianceReport(e, t, { reportType: s = "HIPAA", itemIds: n = null } = {}) {
1608
- let r = `/memory/temporal/compliance/report?start_date=${e}&end_date=${t}&report_type=${s}`;
1609
- if (n && n.length)
1610
- for (const i of n)
1670
+ async complianceReport(e, t, { reportType: n = "HIPAA", itemIds: s = null } = {}) {
1671
+ let r = `/memory/temporal/compliance/report?start_date=${e}&end_date=${t}&report_type=${n}`;
1672
+ if (s && s.length)
1673
+ for (const i of s)
1611
1674
  r += `&item_ids=${encodeURIComponent(i)}`;
1612
1675
  return this.api.get(r);
1613
1676
  }
@@ -1635,7 +1698,7 @@ class Z {
1635
1698
  return this.api.get(`/memory/temporal/relationships/${e}/valid-periods`);
1636
1699
  }
1637
1700
  }
1638
- class Q {
1701
+ class ee {
1639
1702
  constructor(e) {
1640
1703
  this.api = e;
1641
1704
  }
@@ -1646,11 +1709,11 @@ class Q {
1646
1709
  * @param {number} [options.topK=100]
1647
1710
  * @param {Object[]} [options.memoryItems] - Direct items to analyze
1648
1711
  */
1649
- async runAnalysis({ query: e = "*", topK: t = 100, memoryItems: s = [] } = {}) {
1712
+ async runAnalysis({ query: e = "*", topK: t = 100, memoryItems: n = [] } = {}) {
1650
1713
  return this.api.post("/memory/governance/run-analysis", {
1651
1714
  query: e,
1652
1715
  top_k: t,
1653
- memory_items: s
1716
+ memory_items: n
1654
1717
  });
1655
1718
  }
1656
1719
  /**
@@ -1660,10 +1723,10 @@ class Q {
1660
1723
  * @param {boolean} [options.autoFixableOnly=false]
1661
1724
  */
1662
1725
  async listViolations({ severity: e = null, autoFixableOnly: t = !1 } = {}) {
1663
- const s = [];
1664
- e && s.push(`severity=${e}`), t && s.push("auto_fixable_only=true");
1665
- const n = s.length ? `?${s.join("&")}` : "";
1666
- return this.api.get(`/memory/governance/violations${n}`);
1726
+ const n = [];
1727
+ e && n.push(`severity=${e}`), t && n.push("auto_fixable_only=true");
1728
+ const s = n.length ? `?${n.join("&")}` : "";
1729
+ return this.api.get(`/memory/governance/violations${s}`);
1667
1730
  }
1668
1731
  /**
1669
1732
  * Get a specific violation by ID.
@@ -1680,12 +1743,12 @@ class Q {
1680
1743
  * @param {string} [params.rationale='']
1681
1744
  * @param {string} [params.decidedBy='human']
1682
1745
  */
1683
- async applyDecision({ violationId: e, action: t = "approve", rationale: s = "", decidedBy: n = "human" }) {
1746
+ async applyDecision({ violationId: e, action: t = "approve", rationale: n = "", decidedBy: s = "human" }) {
1684
1747
  return this.api.post("/memory/governance/apply-decision", {
1685
1748
  violation_id: e,
1686
1749
  action: t,
1687
- rationale: s,
1688
- decided_by: n
1750
+ rationale: n,
1751
+ decided_by: s
1689
1752
  });
1690
1753
  }
1691
1754
  /**
@@ -1704,7 +1767,7 @@ class Q {
1704
1767
  return this.api.get("/memory/governance/summary");
1705
1768
  }
1706
1769
  }
1707
- class ee {
1770
+ class te {
1708
1771
  constructor(e) {
1709
1772
  this.api = e;
1710
1773
  }
@@ -1745,7 +1808,7 @@ class ee {
1745
1808
  return this.api.post("/memory/evolution/reinforce/opinions");
1746
1809
  }
1747
1810
  }
1748
- class te {
1811
+ class ne {
1749
1812
  constructor(e) {
1750
1813
  this.api = e;
1751
1814
  }
@@ -1757,11 +1820,11 @@ class te {
1757
1820
  * @param {string} [params.memoryType='semantic']
1758
1821
  * @param {boolean} [params.useLlm=true]
1759
1822
  */
1760
- async challenge({ assertion: e, memoryType: t = "semantic", useLlm: s = !0 }) {
1823
+ async challenge({ assertion: e, memoryType: t = "semantic", useLlm: n = !0 }) {
1761
1824
  return this.api.post("/memory/reasoning/challenge", {
1762
1825
  assertion: e,
1763
1826
  memory_type: t,
1764
- use_llm: s
1827
+ use_llm: n
1765
1828
  });
1766
1829
  }
1767
1830
  /**
@@ -1774,12 +1837,12 @@ class te {
1774
1837
  * @param {boolean} [params.useWikipedia=true]
1775
1838
  * @param {boolean} [params.useLlm=true]
1776
1839
  */
1777
- async resolve({ existingItemId: e, newFact: t, autoResolve: s = !0, strategy: n = null, useWikipedia: r = !0, useLlm: i = !0 }) {
1840
+ async resolve({ existingItemId: e, newFact: t, autoResolve: n = !0, strategy: s = null, useWikipedia: r = !0, useLlm: i = !0 }) {
1778
1841
  return this.api.post("/memory/reasoning/resolve", {
1779
1842
  existing_item_id: e,
1780
1843
  new_fact: t,
1781
- auto_resolve: s,
1782
- strategy: n,
1844
+ auto_resolve: n,
1845
+ strategy: s,
1783
1846
  use_wikipedia: r,
1784
1847
  use_llm: i
1785
1848
  });
@@ -1855,12 +1918,12 @@ class se {
1855
1918
  * @param {number} [params.minQualityScore=0.4]
1856
1919
  * @param {boolean} [params.useLlmDetection=true]
1857
1920
  */
1858
- async extract({ content: e, minSteps: t = 2, minQualityScore: s = 0.4, useLlmDetection: n = !0 }) {
1921
+ async extract({ content: e, minSteps: t = 2, minQualityScore: n = 0.4, useLlmDetection: s = !0 }) {
1859
1922
  return this.api.post("/memory/reasoning/traces/extract", {
1860
1923
  content: e,
1861
1924
  min_steps: t,
1862
- min_quality_score: s,
1863
- use_llm_detection: n
1925
+ min_quality_score: n,
1926
+ use_llm_detection: s
1864
1927
  });
1865
1928
  }
1866
1929
  /**
@@ -1882,11 +1945,11 @@ class se {
1882
1945
  * @param {string} [params.artifactId]
1883
1946
  * @param {number} [params.limit=10]
1884
1947
  */
1885
- async query({ query: e, artifactId: t = null, limit: s = 10 }) {
1948
+ async query({ query: e, artifactId: t = null, limit: n = 10 }) {
1886
1949
  return this.api.post("/memory/reasoning/traces/query", {
1887
1950
  query: e,
1888
1951
  artifact_id: t,
1889
- limit: s
1952
+ limit: n
1890
1953
  });
1891
1954
  }
1892
1955
  /**
@@ -1897,7 +1960,7 @@ class se {
1897
1960
  return this.api.get(`/memory/reasoning/traces/${e}`);
1898
1961
  }
1899
1962
  }
1900
- class ne {
1963
+ class re {
1901
1964
  constructor(e) {
1902
1965
  this.api = e;
1903
1966
  }
@@ -1909,11 +1972,11 @@ class ne {
1909
1972
  * @param {Array<{docId: string, text: string}>} params.rawChunks
1910
1973
  * @param {Object} [params.params={}]
1911
1974
  */
1912
- async runInference({ registryId: e = "default", rawChunks: t, params: s = {} }) {
1975
+ async runInference({ registryId: e = "default", rawChunks: t, params: n = {} }) {
1913
1976
  return this.api.post("/memory/ontology/inference/run", {
1914
1977
  registry_id: e,
1915
- raw_chunks: t.map((n) => ({ doc_id: n.docId, text: n.text })),
1916
- params: s
1978
+ raw_chunks: t.map((s) => ({ doc_id: s.docId, text: s.text })),
1979
+ params: n
1917
1980
  });
1918
1981
  }
1919
1982
  // === REGISTRY MANAGEMENT ===
@@ -1930,11 +1993,11 @@ class ne {
1930
1993
  * @param {string} [params.description='']
1931
1994
  * @param {string} [params.domain='general']
1932
1995
  */
1933
- async createRegistry({ name: e, description: t = "", domain: s = "general" }) {
1996
+ async createRegistry({ name: e, description: t = "", domain: n = "general" }) {
1934
1997
  return this.api.post("/memory/ontology/registries", {
1935
1998
  name: e,
1936
1999
  description: t,
1937
- domain: s
2000
+ domain: n
1938
2001
  });
1939
2002
  }
1940
2003
  /**
@@ -1943,8 +2006,8 @@ class ne {
1943
2006
  * @param {string} [version]
1944
2007
  */
1945
2008
  async getSnapshot(e, t = null) {
1946
- let s = `/memory/ontology/registry/${e}/snapshot`;
1947
- return t && (s += `?version=${encodeURIComponent(t)}`), this.api.get(s);
2009
+ let n = `/memory/ontology/registry/${e}/snapshot`;
2010
+ return t && (n += `?version=${encodeURIComponent(t)}`), this.api.get(n);
1948
2011
  }
1949
2012
  /**
1950
2013
  * Apply a changeset to create a new version of the registry.
@@ -1954,11 +2017,11 @@ class ne {
1954
2017
  * @param {Object} params.changeset - OntologyIR changeset
1955
2018
  * @param {string} [params.message='']
1956
2019
  */
1957
- async applyChangeset(e, { baseVersion: t = "", changeset: s, message: n = "" }) {
2020
+ async applyChangeset(e, { baseVersion: t = "", changeset: n, message: s = "" }) {
1958
2021
  return this.api.post(`/memory/ontology/registry/${e}/apply`, {
1959
2022
  base_version: t,
1960
- changeset: s,
1961
- message: n
2023
+ changeset: n,
2024
+ message: s
1962
2025
  });
1963
2026
  }
1964
2027
  /**
@@ -1984,10 +2047,10 @@ class ne {
1984
2047
  * @param {string} [params.targetVersion='']
1985
2048
  * @param {string} [params.message='']
1986
2049
  */
1987
- async rollbackRegistry(e, { targetVersion: t = "", message: s = "" }) {
2050
+ async rollbackRegistry(e, { targetVersion: t = "", message: n = "" }) {
1988
2051
  return this.api.post(`/memory/ontology/registry/${e}/rollback`, {
1989
2052
  target_version: t,
1990
- message: s
2053
+ message: n
1991
2054
  });
1992
2055
  }
1993
2056
  /**
@@ -1996,8 +2059,8 @@ class ne {
1996
2059
  * @param {string} [version]
1997
2060
  */
1998
2061
  async exportRegistry(e, t = null) {
1999
- let s = `/memory/ontology/registry/${e}/export`;
2000
- return t && (s += `?version=${encodeURIComponent(t)}`), this.api.get(s);
2062
+ let n = `/memory/ontology/registry/${e}/export`;
2063
+ return t && (n += `?version=${encodeURIComponent(t)}`), this.api.get(n);
2001
2064
  }
2002
2065
  /**
2003
2066
  * Import data into a registry.
@@ -2006,10 +2069,10 @@ class ne {
2006
2069
  * @param {Object} params.data - Complete ontology data to import
2007
2070
  * @param {string} [params.message='']
2008
2071
  */
2009
- async importRegistry(e, { data: t, message: s = "" }) {
2072
+ async importRegistry(e, { data: t, message: n = "" }) {
2010
2073
  return this.api.post(`/memory/ontology/registry/${e}/import`, {
2011
2074
  data: t,
2012
- message: s
2075
+ message: n
2013
2076
  });
2014
2077
  }
2015
2078
  // === ENRICHMENT & GROUNDING ===
@@ -2038,11 +2101,11 @@ class ne {
2038
2101
  * @param {string} params.itemId
2039
2102
  * @param {string[]} params.candidates
2040
2103
  */
2041
- async runGrounding({ grounder: e = "wikipedia", itemId: t, candidates: s }) {
2104
+ async runGrounding({ grounder: e = "wikipedia", itemId: t, candidates: n }) {
2042
2105
  return this.api.post("/memory/ontology/grounding/run", {
2043
2106
  grounder: e,
2044
2107
  item_id: t,
2045
- candidates: s
2108
+ candidates: n
2046
2109
  });
2047
2110
  }
2048
2111
  // === TEMPLATES ===
@@ -2078,11 +2141,11 @@ class ne {
2078
2141
  * @param {string} params.name
2079
2142
  * @param {string} [params.description='']
2080
2143
  */
2081
- async saveAsTemplate({ registryId: e, name: t, description: s = "" }) {
2144
+ async saveAsTemplate({ registryId: e, name: t, description: n = "" }) {
2082
2145
  return this.api.post("/memory/ontology/templates", {
2083
2146
  registry_id: e,
2084
2147
  name: t,
2085
- description: s
2148
+ description: n
2086
2149
  });
2087
2150
  }
2088
2151
  /**
@@ -2107,12 +2170,12 @@ class ne {
2107
2170
  * @param {number} [params.confidence=0.9]
2108
2171
  * @param {boolean} [params.isGlobal=false]
2109
2172
  */
2110
- async createPattern({ name: e, entityType: t, confidence: s = 0.9, isGlobal: n = !1 }) {
2173
+ async createPattern({ name: e, entityType: t, confidence: n = 0.9, isGlobal: s = !1 }) {
2111
2174
  return this.api.post("/memory/ontology/patterns", {
2112
2175
  name: e,
2113
2176
  entity_type: t,
2114
- confidence: s,
2115
- is_global: n
2177
+ confidence: n,
2178
+ is_global: s
2116
2179
  });
2117
2180
  }
2118
2181
  /**
@@ -2151,10 +2214,10 @@ class ne {
2151
2214
  * @param {string} params.baseRegistryId
2152
2215
  * @param {string} [params.pinnedVersion]
2153
2216
  */
2154
- async subscribe(e, { baseRegistryId: t, pinnedVersion: s = null }) {
2217
+ async subscribe(e, { baseRegistryId: t, pinnedVersion: n = null }) {
2155
2218
  return this.api.post(`/memory/ontology/registry/${e}/subscribe`, {
2156
2219
  base_registry_id: t,
2157
- pinned_version: s
2220
+ pinned_version: n
2158
2221
  });
2159
2222
  }
2160
2223
  /**
@@ -2272,9 +2335,9 @@ class ne {
2272
2335
  * @param {string} [options.kind] missing_in_graph | missing_in_registry | name_conflict_unresolvable
2273
2336
  * @param {number} [options.limit=50]
2274
2337
  */
2275
- async listHitl({ status: e = "open", kind: t = null, limit: s = 50 } = {}) {
2276
- const n = new URLSearchParams({ status: e, limit: String(s) });
2277
- return t && n.set("kind", t), this.api.get(`/memory/ontology/hitl?${n.toString()}`);
2338
+ async listHitl({ status: e = "open", kind: t = null, limit: n = 50 } = {}) {
2339
+ const s = new URLSearchParams({ status: e, limit: String(n) });
2340
+ return t && s.set("kind", t), this.api.get(`/memory/ontology/hitl?${s.toString()}`);
2278
2341
  }
2279
2342
  /**
2280
2343
  * Resolve one ontology HITL queue item (open -> resolved).
@@ -2283,8 +2346,8 @@ class ne {
2283
2346
  * @param {('accepted'|'dismissed'|'deferred')} body.action
2284
2347
  * @param {string} [body.note]
2285
2348
  */
2286
- async resolveHitl(e, { action: t, note: s = null }) {
2287
- return this.api.post(`/memory/ontology/hitl/${e}/resolve`, { action: t, note: s });
2349
+ async resolveHitl(e, { action: t, note: n = null }) {
2350
+ return this.api.post(`/memory/ontology/hitl/${e}/resolve`, { action: t, note: n });
2288
2351
  }
2289
2352
  // --- ONTO-CRUD-1 read / audit / migration surface -------------------------
2290
2353
  /**
@@ -2298,11 +2361,11 @@ class ne {
2298
2361
  * @param {number} [options.limit=100]
2299
2362
  * @param {string} [options.cursor] opaque keyset continuation token
2300
2363
  */
2301
- async listTypes({ tier: e, layer: t, packId: s, hasIri: n, kind: r, limit: i = 100, cursor: c } = {}) {
2364
+ async listTypes({ tier: e, layer: t, packId: n, hasIri: s, kind: r, limit: i = 100, cursor: c } = {}) {
2302
2365
  const o = { limit: String(i) };
2303
- e !== void 0 && (o.tier = e), t !== void 0 && (o.layer = t), s !== void 0 && (o.pack_id = s), n !== void 0 && (o.has_iri = String(n)), r !== void 0 && (o.kind = r), c !== void 0 && (o.cursor = c);
2304
- const h = new URLSearchParams(o).toString();
2305
- return this.api.get(`/memory/ontology/types${h ? "?" + h : ""}`);
2366
+ 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)), r !== void 0 && (o.kind = r), c !== void 0 && (o.cursor = c);
2367
+ const m = new URLSearchParams(o).toString();
2368
+ return this.api.get(`/memory/ontology/types${m ? "?" + m : ""}`);
2306
2369
  }
2307
2370
  /**
2308
2371
  * Declare an ontology class (CORE-MEMTYPE-DECLARE-1).
@@ -2335,22 +2398,22 @@ class ne {
2335
2398
  */
2336
2399
  async declareType(e, {
2337
2400
  kind: t = "entity",
2338
- propertiesSchema: s,
2339
- requiredProperties: n,
2401
+ propertiesSchema: n,
2402
+ requiredProperties: s,
2340
2403
  storageStrategy: r,
2341
2404
  storageSearchable: i,
2342
2405
  iri: c,
2343
2406
  wikidataQid: o,
2344
- displayName: h,
2345
- definition: y,
2346
- description: p,
2347
- aliases: d,
2348
- examples: _,
2349
- parentTypes: $,
2350
- tier: g = "confirmed"
2407
+ displayName: m,
2408
+ definition: h,
2409
+ description: y,
2410
+ aliases: p,
2411
+ examples: f,
2412
+ parentTypes: _,
2413
+ tier: d = "confirmed"
2351
2414
  } = {}) {
2352
- const u = { name: e, kind: t, tier: g };
2353
- return s !== void 0 && (u.properties_schema = s), n !== void 0 && (u.required_properties = n), r !== void 0 && (u.storage_strategy = r), i !== void 0 && (u.storage_searchable = i), c !== void 0 && (u.iri = c), o !== void 0 && (u.wikidata_qid = o), h !== void 0 && (u.display_name = h), y !== void 0 && (u.definition = y), p !== void 0 && (u.description = p), d !== void 0 && (u.aliases = d), _ !== void 0 && (u.examples = _), $ !== void 0 && (u.parent_types = $), this.api.post("/memory/ontology/types", u);
2415
+ const l = { name: e, kind: t, tier: d };
2416
+ return n !== void 0 && (l.properties_schema = n), s !== void 0 && (l.required_properties = s), r !== void 0 && (l.storage_strategy = r), i !== void 0 && (l.storage_searchable = i), c !== void 0 && (l.iri = c), o !== void 0 && (l.wikidata_qid = o), m !== void 0 && (l.display_name = m), h !== void 0 && (l.definition = h), y !== void 0 && (l.description = y), p !== void 0 && (l.aliases = p), f !== void 0 && (l.examples = f), _ !== void 0 && (l.parent_types = _), this.api.post("/memory/ontology/types", l);
2354
2417
  }
2355
2418
  /**
2356
2419
  * Declare an ontology relation (CORE-MEMTYPE-DECLARE-1; declare-only in P1).
@@ -2381,26 +2444,26 @@ class ne {
2381
2444
  */
2382
2445
  async declareRelation(e, {
2383
2446
  domain: t,
2384
- range: s,
2385
- inverseOf: n,
2447
+ range: n,
2448
+ inverseOf: s,
2386
2449
  cardinality: r,
2387
2450
  temporal: i,
2388
2451
  propertiesSchema: c,
2389
2452
  transitive: o,
2390
- symmetric: h,
2391
- reflexive: y,
2392
- parentRelations: p,
2393
- iri: d,
2394
- wikidataPid: _,
2395
- displayName: $,
2396
- definition: g,
2397
- description: u,
2398
- aliases: b,
2399
- examples: I,
2400
- tier: l = "confirmed"
2453
+ symmetric: m,
2454
+ reflexive: h,
2455
+ parentRelations: y,
2456
+ iri: p,
2457
+ wikidataPid: f,
2458
+ displayName: _,
2459
+ definition: d,
2460
+ description: l,
2461
+ aliases: w,
2462
+ examples: b,
2463
+ tier: U = "confirmed"
2401
2464
  } = {}) {
2402
- const m = { name: e, tier: l };
2403
- 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), c !== void 0 && (m.properties_schema = c), o !== void 0 && (m.transitive = o), h !== void 0 && (m.symmetric = h), y !== void 0 && (m.reflexive = y), p !== void 0 && (m.parent_relations = p), d !== void 0 && (m.iri = d), _ !== void 0 && (m.wikidata_pid = _), $ !== void 0 && (m.display_name = $), g !== void 0 && (m.definition = g), u !== void 0 && (m.description = u), b !== void 0 && (m.aliases = b), I !== void 0 && (m.examples = I), this.api.post("/memory/ontology/relations", m);
2465
+ const u = { name: e, tier: U };
2466
+ return t !== void 0 && (u.domain = t), n !== void 0 && (u.range = n), s !== void 0 && (u.inverse_of = s), r !== void 0 && (u.cardinality = r), i !== void 0 && (u.temporal = i), c !== void 0 && (u.properties_schema = c), o !== void 0 && (u.transitive = o), m !== void 0 && (u.symmetric = m), h !== void 0 && (u.reflexive = h), y !== void 0 && (u.parent_relations = y), p !== void 0 && (u.iri = p), f !== void 0 && (u.wikidata_pid = f), _ !== void 0 && (u.display_name = _), d !== void 0 && (u.definition = d), l !== void 0 && (u.description = l), w !== void 0 && (u.aliases = w), b !== void 0 && (u.examples = b), this.api.post("/memory/ontology/relations", u);
2404
2467
  }
2405
2468
  /**
2406
2469
  * List ontology relation types, keyset-paginated. Mirror of `listTypes`.
@@ -2412,9 +2475,9 @@ class ne {
2412
2475
  * @param {number} [options.limit=100]
2413
2476
  * @param {string} [options.cursor] opaque keyset continuation token
2414
2477
  */
2415
- async listRelations({ tier: e, layer: t, packId: s, hasIri: n, limit: r = 100, cursor: i } = {}) {
2478
+ async listRelations({ tier: e, layer: t, packId: n, hasIri: s, limit: r = 100, cursor: i } = {}) {
2416
2479
  const c = { limit: String(r) };
2417
- 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)), i !== void 0 && (c.cursor = i);
2480
+ 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)), i !== void 0 && (c.cursor = i);
2418
2481
  const o = new URLSearchParams(c).toString();
2419
2482
  return this.api.get(`/memory/ontology/relations${o ? "?" + o : ""}`);
2420
2483
  }
@@ -2441,9 +2504,9 @@ class ne {
2441
2504
  * @param {string} [options.until] full ISO-8601 upper bound (inclusive)
2442
2505
  * @param {number} [options.limit=200]
2443
2506
  */
2444
- async listAudit({ actor: e, action: t, since: s, until: n, limit: r = 200 } = {}) {
2507
+ async listAudit({ actor: e, action: t, since: n, until: s, limit: r = 200 } = {}) {
2445
2508
  const i = { limit: String(r) };
2446
- e !== void 0 && (i.actor = e), t !== void 0 && (i.action = t), s !== void 0 && (i.since = s), n !== void 0 && (i.until = n);
2509
+ e !== void 0 && (i.actor = e), t !== void 0 && (i.action = t), n !== void 0 && (i.since = n), s !== void 0 && (i.until = s);
2447
2510
  const c = new URLSearchParams(i).toString();
2448
2511
  return this.api.get(`/memory/ontology/audit${c ? "?" + c : ""}`);
2449
2512
  }
@@ -2468,10 +2531,10 @@ class ne {
2468
2531
  * @param {string} [options.packVersion] scope to one installed version; omit for all
2469
2532
  */
2470
2533
  async getPackAudit(e, { packVersion: t = null } = {}) {
2471
- const s = {};
2472
- t !== null && (s.pack_version = t);
2473
- const n = new URLSearchParams(s).toString();
2474
- return this.api.get(`/memory/ontology/packs/${encodeURIComponent(e)}/audit${n ? "?" + n : ""}`);
2534
+ const n = {};
2535
+ t !== null && (n.pack_version = t);
2536
+ const s = new URLSearchParams(n).toString();
2537
+ return this.api.get(`/memory/ontology/packs/${encodeURIComponent(e)}/audit${s ? "?" + s : ""}`);
2475
2538
  }
2476
2539
  /**
2477
2540
  * Reclassify every instance of `fromId` onto `toId`. Both types stay live.
@@ -2488,8 +2551,8 @@ class ne {
2488
2551
  * defaults, so an entity migration returns them empty/zero rather than omitting
2489
2552
  * them — callers never branch on kind to read a response.
2490
2553
  */
2491
- async migrateTypeInstances(e, t, { reason: s, batchSize: n = 500, onViolation: r = "refuse" }) {
2492
- const i = { reason: s, batch_size: n };
2554
+ async migrateTypeInstances(e, t, { reason: n, batchSize: s = 500, onViolation: r = "refuse" }) {
2555
+ const i = { reason: n, batch_size: s };
2493
2556
  return r !== "refuse" && (i.on_violation = r), this.api.post(
2494
2557
  `/memory/ontology/types/${encodeURIComponent(e)}/migrate-to/${encodeURIComponent(t)}`,
2495
2558
  i
@@ -2518,9 +2581,9 @@ class ne {
2518
2581
  * @param {number} [options.limit=100]
2519
2582
  * @param {string} [options.cursor] opaque keyset continuation token
2520
2583
  */
2521
- async listReviewQueue({ tier: e, assignee: t, source: s, limit: n = 100, cursor: r } = {}) {
2522
- const i = { limit: String(n) };
2523
- e !== void 0 && (i.tier = e), t !== void 0 && (i.assignee = t), s !== void 0 && (i.source = s), r !== void 0 && (i.cursor = r);
2584
+ async listReviewQueue({ tier: e, assignee: t, source: n, limit: s = 100, cursor: r } = {}) {
2585
+ const i = { limit: String(s) };
2586
+ e !== void 0 && (i.tier = e), t !== void 0 && (i.assignee = t), n !== void 0 && (i.source = n), r !== void 0 && (i.cursor = r);
2524
2587
  const c = new URLSearchParams(i).toString();
2525
2588
  return this.api.get(`/memory/ontology/queue${c ? "?" + c : ""}`);
2526
2589
  }
@@ -2531,8 +2594,8 @@ class ne {
2531
2594
  * @param {string} [options.expectedTier] optional optimistic tier precondition
2532
2595
  */
2533
2596
  async approveReviewType(e, { expectedTier: t } = {}) {
2534
- const s = {};
2535
- return t !== void 0 && (s.expected_tier = t), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/approve`, s);
2597
+ const n = {};
2598
+ return t !== void 0 && (n.expected_tier = t), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/approve`, n);
2536
2599
  }
2537
2600
  /**
2538
2601
  * Reject one ontology review type.
@@ -2541,8 +2604,8 @@ class ne {
2541
2604
  * @param {string} [options.expectedTier] optional optimistic tier precondition
2542
2605
  */
2543
2606
  async rejectReviewType(e, { expectedTier: t } = {}) {
2544
- const s = {};
2545
- return t !== void 0 && (s.expected_tier = t), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/reject`, s);
2607
+ const n = {};
2608
+ return t !== void 0 && (n.expected_tier = t), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/reject`, n);
2546
2609
  }
2547
2610
  /**
2548
2611
  * Merge one ontology review type into another type.
@@ -2551,9 +2614,9 @@ class ne {
2551
2614
  * @param {Object} [options]
2552
2615
  * @param {string} [options.expectedTier] optional optimistic tier precondition
2553
2616
  */
2554
- async mergeReviewType(e, t, { expectedTier: s } = {}) {
2555
- const n = { into_id: t };
2556
- return s !== void 0 && (n.expected_tier = s), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/merge`, n);
2617
+ async mergeReviewType(e, t, { expectedTier: n } = {}) {
2618
+ const s = { into_id: t };
2619
+ return n !== void 0 && (s.expected_tier = n), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/merge`, s);
2557
2620
  }
2558
2621
  /**
2559
2622
  * Edit and promote one ontology review type.
@@ -2562,9 +2625,9 @@ class ne {
2562
2625
  * @param {Object} [options]
2563
2626
  * @param {string} [options.expectedTier] optional optimistic tier precondition
2564
2627
  */
2565
- async editPromoteReviewType(e, t, { expectedTier: s } = {}) {
2566
- const n = { edits: t };
2567
- return s !== void 0 && (n.expected_tier = s), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/edit-promote`, n);
2628
+ async editPromoteReviewType(e, t, { expectedTier: n } = {}) {
2629
+ const s = { edits: t };
2630
+ return n !== void 0 && (s.expected_tier = n), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/edit-promote`, s);
2568
2631
  }
2569
2632
  /**
2570
2633
  * Assign or clear the reviewer for one ontology review type.
@@ -2582,12 +2645,12 @@ class ne {
2582
2645
  * @param {Object} [options.params] action-specific params
2583
2646
  * @param {string} [options.expectedTier] optional optimistic tier precondition
2584
2647
  */
2585
- async bulkReviewAction(e, t, { params: s, expectedTier: n } = {}) {
2586
- const r = { action: e, ids: t, params: s === void 0 ? {} : s };
2587
- return n !== void 0 && (r.expected_tier = n), this.api.post("/memory/ontology/queue/bulk", r);
2648
+ async bulkReviewAction(e, t, { params: n, expectedTier: s } = {}) {
2649
+ const r = { action: e, ids: t, params: n === void 0 ? {} : n };
2650
+ return s !== void 0 && (r.expected_tier = s), this.api.post("/memory/ontology/queue/bulk", r);
2588
2651
  }
2589
2652
  }
2590
- class re {
2653
+ class ie {
2591
2654
  constructor(e) {
2592
2655
  this.api = e;
2593
2656
  }
@@ -2611,12 +2674,12 @@ class re {
2611
2674
  * @param {boolean} [options.sentimentAnalysis]
2612
2675
  * @param {boolean} [options.topicAnalysis]
2613
2676
  */
2614
- async detectBias({ protectedAttributes: e = null, sentimentAnalysis: t = null, topicAnalysis: s = null } = {}) {
2615
- const n = {};
2616
- 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);
2677
+ async detectBias({ protectedAttributes: e = null, sentimentAnalysis: t = null, topicAnalysis: n = null } = {}) {
2678
+ const s = {};
2679
+ 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);
2617
2680
  }
2618
2681
  }
2619
- class ie {
2682
+ class ae {
2620
2683
  constructor(e) {
2621
2684
  this.api = e;
2622
2685
  }
@@ -2652,7 +2715,7 @@ class ie {
2652
2715
  return this.api.get("/memory/inference/rules");
2653
2716
  }
2654
2717
  }
2655
- class ae {
2718
+ class oe {
2656
2719
  constructor(e) {
2657
2720
  this.api = e;
2658
2721
  }
@@ -2699,8 +2762,8 @@ class ae {
2699
2762
  * @param {string} [runId]
2700
2763
  */
2701
2764
  async getState(e, t = null) {
2702
- let s = `/memory/pipeline/${e}/state`;
2703
- return t && (s += `?run_id=${encodeURIComponent(t)}`), this.api.get(s);
2765
+ let n = `/memory/pipeline/${e}/state`;
2766
+ return t && (n += `?run_id=${encodeURIComponent(t)}`), this.api.get(n);
2704
2767
  }
2705
2768
  /**
2706
2769
  * Reset a pipeline, clearing its state.
@@ -2731,11 +2794,11 @@ class ae {
2731
2794
  * @param {string} [params.description='']
2732
2795
  * @param {Object} params.config
2733
2796
  */
2734
- async createConfig({ name: e, description: t = "", config: s }) {
2797
+ async createConfig({ name: e, description: t = "", config: n }) {
2735
2798
  return this.api.post("/memory/pipeline/configs", {
2736
2799
  name: e,
2737
2800
  description: t,
2738
- config: s
2801
+ config: n
2739
2802
  });
2740
2803
  }
2741
2804
  /**
@@ -2753,11 +2816,11 @@ class ae {
2753
2816
  * @param {string} [params.description='']
2754
2817
  * @param {Object} [params.config={}]
2755
2818
  */
2756
- async updateConfig(e, { name: t = "", description: s = "", config: n = {} }) {
2819
+ async updateConfig(e, { name: t = "", description: n = "", config: s = {} }) {
2757
2820
  return this.api.patch(`/memory/pipeline/configs/${e}`, {
2758
2821
  name: t,
2759
- description: s,
2760
- config: n
2822
+ description: n,
2823
+ config: s
2761
2824
  });
2762
2825
  }
2763
2826
  /**
@@ -2768,7 +2831,7 @@ class ae {
2768
2831
  return this.api.delete(`/memory/pipeline/configs/${e}`);
2769
2832
  }
2770
2833
  }
2771
- class oe {
2834
+ class ce {
2772
2835
  constructor(e) {
2773
2836
  this.api = e;
2774
2837
  }
@@ -2779,11 +2842,11 @@ class oe {
2779
2842
  * @param {Object} params.payload
2780
2843
  * @param {Object} [params.metadata={}]
2781
2844
  */
2782
- async store({ conversationId: e, payload: t, metadata: s = {} }) {
2845
+ async store({ conversationId: e, payload: t, metadata: n = {} }) {
2783
2846
  return this.api.post("/memory/archive/store", {
2784
2847
  conversation_id: e,
2785
2848
  payload: t,
2786
- metadata: s
2849
+ metadata: n
2787
2850
  });
2788
2851
  }
2789
2852
  /**
@@ -2794,7 +2857,7 @@ class oe {
2794
2857
  return this.api.get(`/memory/archive/${e}`);
2795
2858
  }
2796
2859
  }
2797
- class ce {
2860
+ class ue {
2798
2861
  constructor(e) {
2799
2862
  this.api = e;
2800
2863
  }
@@ -2854,8 +2917,8 @@ class ce {
2854
2917
  * @param {number} [options.maxDistance=3]
2855
2918
  * @param {number} [options.minSurprise=0.5]
2856
2919
  */
2857
- async getDiscoveries(e, { maxDistance: t = 3, minSurprise: s = 0.5 } = {}) {
2858
- return this.api.get(`/memory/zettel/${e}/discoveries?max_distance=${t}&min_surprise=${s}`);
2920
+ async getDiscoveries(e, { maxDistance: t = 3, minSurprise: n = 0.5 } = {}) {
2921
+ return this.api.get(`/memory/zettel/${e}/discoveries?max_distance=${t}&min_surprise=${n}`);
2859
2922
  }
2860
2923
  /**
2861
2924
  * Find paths between two notes.
@@ -2863,8 +2926,8 @@ class ce {
2863
2926
  * @param {string} targetId
2864
2927
  * @param {number} [maxPaths=5]
2865
2928
  */
2866
- async getPath(e, t, s = 5) {
2867
- return this.api.get(`/memory/zettel/${e}/path/${t}?max_paths=${s}`);
2929
+ async getPath(e, t, n = 5) {
2930
+ return this.api.get(`/memory/zettel/${e}/path/${t}?max_paths=${n}`);
2868
2931
  }
2869
2932
  // === WIKILINK SUPPORT ===
2870
2933
  /**
@@ -2890,8 +2953,8 @@ class ce {
2890
2953
  * @param {number} [options.depth=2]
2891
2954
  * @param {boolean} [options.includeMetadata=true]
2892
2955
  */
2893
- async getSubgraph(e, { depth: t = 2, includeMetadata: s = !0 } = {}) {
2894
- return this.api.get(`/memory/zettel/${e}/graph?depth=${t}&include_metadata=${s}`);
2956
+ async getSubgraph(e, { depth: t = 2, includeMetadata: n = !0 } = {}) {
2957
+ return this.api.get(`/memory/zettel/${e}/graph?depth=${t}&include_metadata=${n}`);
2895
2958
  }
2896
2959
  // === ADDITIONAL DISCOVERY ===
2897
2960
  /**
@@ -2932,8 +2995,8 @@ class ce {
2932
2995
  * @param {string} value
2933
2996
  * @param {number} [limit=100]
2934
2997
  */
2935
- async findByProperty(e, t, s = 100) {
2936
- return this.api.get(`/memory/zettel/by-property?key=${encodeURIComponent(e)}&value=${encodeURIComponent(t)}&limit=${s}`);
2998
+ async findByProperty(e, t, n = 100) {
2999
+ return this.api.get(`/memory/zettel/by-property?key=${encodeURIComponent(e)}&value=${encodeURIComponent(t)}&limit=${n}`);
2937
3000
  }
2938
3001
  /**
2939
3002
  * Find notes mentioning an entity.
@@ -2949,11 +3012,11 @@ class ce {
2949
3012
  * @param {string} relationType
2950
3013
  * @param {number} [limit=100]
2951
3014
  */
2952
- async queryByRelation(e, t, s = 100) {
2953
- return this.api.get(`/memory/zettel/by-relation/${e}/${t}?limit=${s}`);
3015
+ async queryByRelation(e, t, n = 100) {
3016
+ return this.api.get(`/memory/zettel/by-relation/${e}/${t}?limit=${n}`);
2954
3017
  }
2955
3018
  }
2956
- class ue {
3019
+ class le {
2957
3020
  constructor(e) {
2958
3021
  this.api = e;
2959
3022
  }
@@ -2968,9 +3031,9 @@ class ue {
2968
3031
  */
2969
3032
  async list(e = {}) {
2970
3033
  const t = Object.fromEntries(
2971
- Object.entries(e).filter(([, n]) => n != null)
2972
- ), s = new URLSearchParams(t).toString();
2973
- return this.api.get(`/memory/procedures/matches${s ? "?" + s : ""}`);
3034
+ Object.entries(e).filter(([, s]) => s != null)
3035
+ ), n = new URLSearchParams(t).toString();
3036
+ return this.api.get(`/memory/procedures/matches${n ? "?" + n : ""}`);
2974
3037
  }
2975
3038
  /**
2976
3039
  * Submit feedback for a procedure match.
@@ -2978,9 +3041,9 @@ class ue {
2978
3041
  * @param {string} feedback - One of "success", "failure", "neutral"
2979
3042
  * @param {string} [note] - Optional explanation
2980
3043
  */
2981
- async submitFeedback(e, t, s = null) {
2982
- const n = { feedback: t };
2983
- return s && (n.note = s), this.api.post(`/memory/procedures/matches/${e}/feedback`, n);
3044
+ async submitFeedback(e, t, n = null) {
3045
+ const s = { feedback: t };
3046
+ return n && (s.note = n), this.api.post(`/memory/procedures/matches/${e}/feedback`, s);
2984
3047
  }
2985
3048
  /**
2986
3049
  * Get aggregated procedure match statistics.
@@ -2989,7 +3052,7 @@ class ue {
2989
3052
  return this.api.get("/memory/procedures/matches/stats");
2990
3053
  }
2991
3054
  }
2992
- class le {
3055
+ class me {
2993
3056
  constructor(e) {
2994
3057
  this.api = e;
2995
3058
  }
@@ -3004,9 +3067,9 @@ class le {
3004
3067
  */
3005
3068
  async list(e = {}) {
3006
3069
  const t = Object.fromEntries(
3007
- Object.entries(e).filter(([, n]) => n != null)
3008
- ), s = new URLSearchParams(t).toString();
3009
- return this.api.get(`/memory/procedures/candidates${s ? "?" + s : ""}`);
3070
+ Object.entries(e).filter(([, s]) => s != null)
3071
+ ), n = new URLSearchParams(t).toString();
3072
+ return this.api.get(`/memory/procedures/candidates${n ? "?" + n : ""}`);
3010
3073
  }
3011
3074
  /**
3012
3075
  * Promote a candidate cluster to a new procedure.
@@ -3020,14 +3083,14 @@ class le {
3020
3083
  * @returns {Promise<Object>} Response with procedure_id and status
3021
3084
  */
3022
3085
  async promote(e, t = {}) {
3023
- const s = {
3086
+ const n = {
3024
3087
  name: t.name ?? null,
3025
3088
  description: t.description ?? null,
3026
3089
  procedure_type: t.procedure_type ?? "extraction",
3027
3090
  preferred_profile: t.preferred_profile ?? "quick_extract",
3028
3091
  remove_working_items: t.remove_working_items ?? !1
3029
3092
  };
3030
- return this.api.post(`/memory/procedures/candidates/${e}/promote`, s);
3093
+ return this.api.post(`/memory/procedures/candidates/${e}/promote`, n);
3031
3094
  }
3032
3095
  /**
3033
3096
  * Dismiss a candidate cluster from future recommendations.
@@ -3038,7 +3101,7 @@ class le {
3038
3101
  return this.api.delete(`/memory/procedures/candidates/${e}/dismiss`);
3039
3102
  }
3040
3103
  }
3041
- class me {
3104
+ class he {
3042
3105
  constructor(e) {
3043
3106
  this.api = e;
3044
3107
  }
@@ -3055,9 +3118,9 @@ class me {
3055
3118
  */
3056
3119
  async list(e = {}) {
3057
3120
  const t = Object.fromEntries(
3058
- Object.entries(e).filter(([, n]) => n != null)
3059
- ), s = new URLSearchParams(t).toString();
3060
- return this.api.get(`/memory/procedures/drift${s ? "?" + s : ""}`);
3121
+ Object.entries(e).filter(([, s]) => s != null)
3122
+ ), n = new URLSearchParams(t).toString();
3123
+ return this.api.get(`/memory/procedures/drift${n ? "?" + n : ""}`);
3061
3124
  }
3062
3125
  /**
3063
3126
  * Get a single drift event with full change details.
@@ -3074,8 +3137,8 @@ class me {
3074
3137
  * @returns {Promise<{status: string, event_id: string, resolved: boolean}>}
3075
3138
  */
3076
3139
  async resolve(e, t = null) {
3077
- const s = {};
3078
- return t != null && (s.note = t), this.api.post(`/memory/procedures/drift/${e}/resolve`, s);
3140
+ const n = {};
3141
+ return t != null && (n.note = t), this.api.post(`/memory/procedures/drift/${e}/resolve`, n);
3079
3142
  }
3080
3143
  /**
3081
3144
  * Trigger a drift sweep across all procedures in the workspace.
@@ -3093,7 +3156,7 @@ class me {
3093
3156
  return this.api.get(`/memory/procedures/schemas/${e}`);
3094
3157
  }
3095
3158
  }
3096
- class he {
3159
+ class ye {
3097
3160
  constructor(e) {
3098
3161
  this.api = e;
3099
3162
  }
@@ -3144,9 +3207,9 @@ class he {
3144
3207
  * @param {number} [params.limit=20]
3145
3208
  * @param {string} [params.before] ISO 8601 datetime
3146
3209
  */
3147
- async list({ isHeartbeat: e = null, limit: t = 20, before: s = null } = {}) {
3148
- const n = { limit: t };
3149
- return e !== null && (n.is_heartbeat = e), s !== null && (n.before = s), this.api.get("/memory/summary/list", n);
3210
+ async list({ isHeartbeat: e = null, limit: t = 20, before: n = null } = {}) {
3211
+ const s = { limit: t };
3212
+ return e !== null && (s.is_heartbeat = e), n !== null && (s.before = n), this.api.get("/memory/summary/list", s);
3150
3213
  }
3151
3214
  /** SnapshotDelta between two snapshots. Returns null on 404. */
3152
3215
  async delta({ from: e, to: t }) {
@@ -3155,9 +3218,9 @@ class he {
3155
3218
  from: e,
3156
3219
  to: t
3157
3220
  });
3158
- } catch (s) {
3159
- if ((s == null ? void 0 : s.status) === 404) return null;
3160
- throw s;
3221
+ } catch (n) {
3222
+ if ((n == null ? void 0 : n.status) === 404) return null;
3223
+ throw n;
3161
3224
  }
3162
3225
  }
3163
3226
  /** Admin-only delete. Throws on 403/404/500. */
@@ -3165,7 +3228,7 @@ class he {
3165
3228
  return this.api.delete(`/memory/summary/${e}`);
3166
3229
  }
3167
3230
  }
3168
- class ye {
3231
+ class pe {
3169
3232
  constructor(e) {
3170
3233
  this.api = e;
3171
3234
  }
@@ -3177,13 +3240,13 @@ class ye {
3177
3240
  * @returns {Promise<{key: string, token: string, expires_at: string, ttl_remaining_ms: number}|null>}
3178
3241
  */
3179
3242
  async acquire(e, { ttlSeconds: t } = {}) {
3180
- var n, r;
3181
- const s = {};
3182
- t !== void 0 && (s.ttl_seconds = t);
3243
+ var s, r;
3244
+ const n = {};
3245
+ t !== void 0 && (n.ttl_seconds = t);
3183
3246
  try {
3184
- return await this.api.post(`/memory/locks/${e}`, s);
3247
+ return await this.api.post(`/memory/locks/${e}`, n);
3185
3248
  } catch (i) {
3186
- if ((i == null ? void 0 : i.status) === 409 && ((r = (n = i.detail) == null ? void 0 : n.detail) == null ? void 0 : r.reason) === "lock_held")
3249
+ if ((i == null ? void 0 : i.status) === 409 && ((r = (s = i.detail) == null ? void 0 : s.detail) == null ? void 0 : r.reason) === "lock_held")
3187
3250
  return null;
3188
3251
  throw i;
3189
3252
  }
@@ -3196,12 +3259,12 @@ class ye {
3196
3259
  * @param {number} [params.ttlSeconds]
3197
3260
  * @returns {Promise<{key: string, token: string, expires_at: string, ttl_remaining_ms: number}|null>}
3198
3261
  */
3199
- async renew(e, t, { ttlSeconds: s } = {}) {
3262
+ async renew(e, t, { ttlSeconds: n } = {}) {
3200
3263
  var r, i;
3201
- const n = {};
3202
- s !== void 0 && (n.ttl_seconds = s);
3264
+ const s = {};
3265
+ n !== void 0 && (s.ttl_seconds = n);
3203
3266
  try {
3204
- return await this.api.post(`/memory/locks/${e}/renew`, n, {
3267
+ return await this.api.post(`/memory/locks/${e}/renew`, s, {
3205
3268
  headers: { "X-Lease-Token": t }
3206
3269
  });
3207
3270
  } catch (c) {
@@ -3217,19 +3280,19 @@ class ye {
3217
3280
  * @returns {Promise<boolean>}
3218
3281
  */
3219
3282
  async release(e, t) {
3220
- var s, n;
3283
+ var n, s;
3221
3284
  try {
3222
3285
  return await this.api.delete(`/memory/locks/${e}`, {
3223
3286
  headers: { "X-Lease-Token": t }
3224
3287
  }), !0;
3225
3288
  } catch (r) {
3226
- if ((r == null ? void 0 : r.status) === 409 && ((n = (s = r.detail) == null ? void 0 : s.detail) == null ? void 0 : n.reason) === "not_owner")
3289
+ if ((r == null ? void 0 : r.status) === 409 && ((s = (n = r.detail) == null ? void 0 : n.detail) == null ? void 0 : s.reason) === "not_owner")
3227
3290
  return !1;
3228
3291
  throw r;
3229
3292
  }
3230
3293
  }
3231
3294
  }
3232
- class pe {
3295
+ class de {
3233
3296
  constructor(e) {
3234
3297
  this.api = e;
3235
3298
  }
@@ -3250,9 +3313,9 @@ class pe {
3250
3313
  * @param {number} [params.count] How many to allocate (1..100, default 1).
3251
3314
  * @returns {Promise<{name: string, value: number, first: number, count: number}>}
3252
3315
  */
3253
- async allocate(e, { floor: t, count: s } = {}) {
3254
- const n = {};
3255
- return t !== void 0 && (n.floor = t), s !== void 0 && (n.count = s), this.api.post(`/memory/sequences/${e}/next`, n);
3316
+ async allocate(e, { floor: t, count: n } = {}) {
3317
+ const s = {};
3318
+ return t !== void 0 && (s.floor = t), n !== void 0 && (s.count = n), this.api.post(`/memory/sequences/${e}/next`, s);
3256
3319
  }
3257
3320
  /**
3258
3321
  * Read the counter without consuming a number, or null if never allocated.
@@ -3275,9 +3338,75 @@ class pe {
3275
3338
  }
3276
3339
  class ge {
3277
3340
  constructor(e) {
3278
- this.auth = new F(e);
3279
- const t = new O(this.auth, { fetchFn: e.fetchFn });
3280
- this._api = t, this.memories = new j(t), this.decisions = new H(t), this.opinions = new B(t), this.graph = new K(t), this.teams = new G(t), this.profiles = new D(t), this.subscriptions = new N(t), this.authAPI = new J(t), this.agents = new W(t), this.usage = new V(t), this.insights = new Y(t), this.tokenUsage = new X(t), this.temporal = new Z(t), this.governance = new Q(t), this.evolution = new ee(t), this.reasoning = new te(t), this.reasoningTraces = new se(t), this.ontology = new ne(t), this.analytics = new re(t), this.validation = new ie(t), this.pipeline = new ae(t), this.archive = new oe(t), this.zettelkasten = new ce(t), this.procedureMatches = new ue(t), this.procedureCandidates = new le(t), this.procedureDrift = new me(t), this.summaries = new he(t), this.locks = new ye(t), this.sequences = new pe(t);
3341
+ this.api = e;
3342
+ }
3343
+ /**
3344
+ * Assemble one priority-ordered context block within a token budget.
3345
+ * @param {Object} params
3346
+ * @param {number} params.budgetTokens Token budget for the packed block.
3347
+ * @param {string} [params.query] Query to rank items by relevance; omit for
3348
+ * tier + recency ranking.
3349
+ * @param {Array<Object>} [params.sections] Overrides the default section
3350
+ * list/order/caps. Each entry is `{ name, cap_tokens }` on the wire;
3351
+ * callers may pass either `cap_tokens` or camelCase `capTokens` and it
3352
+ * will be normalized to `cap_tokens`.
3353
+ * @param {string} [params.preset] Named section set, used instead of
3354
+ * `sections`. `'wakeup'` is the session-start L1 card (active plan, anchors,
3355
+ * workspace topics, last-session headline) — pass it with a small budget
3356
+ * (~300 tokens); the default sections go degenerate at that size, and the card
3357
+ * is content-bounded so a typical workspace renders far under it. Passing
3358
+ * both `preset` and `sections` is rejected with a 400.
3359
+ *
3360
+ * `null` and `undefined` are treated identically for both optional params and
3361
+ * omitted from the wire body. `null` is what you get from `JSON.parse`, from a
3362
+ * default-valued config object, or from a caller spreading a partially-filled
3363
+ * options object — and `sections: null` previously reached `null.map(...)` and
3364
+ * threw. Omitting also matches the Python SDK and the MCP remote backend, so one
3365
+ * body shape reaches the route from every client.
3366
+ * @returns {Promise<Object>} RecallPack — `{ block, manifest }`.
3367
+ */
3368
+ async pack({ budgetTokens: e, query: t, sections: n, preset: s } = {}) {
3369
+ const r = { budget_tokens: e };
3370
+ return t != null && (r.query = t), n != null && (r.sections = n.map(({ name: i, cap_tokens: c, capTokens: o }) => ({
3371
+ name: i,
3372
+ cap_tokens: c !== void 0 ? c : o
3373
+ }))), s != null && (r.preset = s), this.api.post("/memory/recall/pack", r);
3374
+ }
3375
+ }
3376
+ class fe {
3377
+ constructor(e) {
3378
+ this.api = e;
3379
+ }
3380
+ /**
3381
+ * Compile active workspace decisions into a Stratum policy bundle.
3382
+ *
3383
+ * @param {Object} [params]
3384
+ * @param {string} [params.workflow] Workflow selector echoed by the bundle.
3385
+ * @param {string} [params.domain] Exact source-decision domain filter.
3386
+ * @param {string[]} [params.statuses=['active']] Repeatable lifecycle selector.
3387
+ * @returns {Promise<Object>} The policy-exchange contract bundle.
3388
+ */
3389
+ async getBundle({ workflow: e, domain: t, statuses: n = ["active"] } = {}) {
3390
+ const s = new URLSearchParams();
3391
+ if (e != null && s.append("workflow", e), t != null && s.append("domain", t), Array.isArray(n))
3392
+ for (const i of n) s.append("status", i);
3393
+ const r = s.toString();
3394
+ return this.api.get(`/memory/policy/bundle${r ? "?" + r : ""}`);
3395
+ }
3396
+ /**
3397
+ * Record an idempotent Stratum enforcement event without reshaping contract fields.
3398
+ * @param {Object} event Enforcement event using the contract's snake_case keys.
3399
+ * @returns {Promise<Object>} `{ event_id, item_id, created, edges }`.
3400
+ */
3401
+ async recordEnforcementEvent(e) {
3402
+ return this.api.post("/memory/policy/events", e);
3403
+ }
3404
+ }
3405
+ class $e {
3406
+ constructor(e) {
3407
+ this.auth = new O(e);
3408
+ const t = new j(this.auth, { fetchFn: e.fetchFn });
3409
+ this._api = t, this.memories = new B(t), this.decisions = new H(t), this.opinions = new K(t), this.graph = new G(t), this.teams = new D(t), this.profiles = new N(t), this.subscriptions = new J(t), this.authAPI = new W(t), this.agents = new V(t), this.usage = new Y(t), this.insights = new X(t), this.tokenUsage = new Z(t), this.temporal = new Q(t), this.governance = new ee(t), this.evolution = new te(t), this.reasoning = new ne(t), this.reasoningTraces = new se(t), this.ontology = new re(t), this.analytics = new ie(t), this.validation = new ae(t), this.pipeline = new oe(t), this.archive = new ce(t), this.zettelkasten = new ue(t), this.procedureMatches = new le(t), this.procedureCandidates = new me(t), this.procedureDrift = new he(t), this.summaries = new ye(t), this.locks = new pe(t), this.sequences = new de(t), this.recall = new ge(t), this.policy = new fe(t);
3281
3410
  }
3282
3411
  setTeamId(e) {
3283
3412
  this.auth.tokenManager.setTeamId(e), this.auth.notifyListeners();
@@ -3298,43 +3427,43 @@ class ge {
3298
3427
  * @returns {Promise<{ imported: number, failed: number, workspace_id: string }>}
3299
3428
  */
3300
3429
  async importOkf(e) {
3301
- const t = e instanceof Blob ? e : new Blob([e], { type: "application/gzip" }), s = new FormData();
3302
- return s.append("file", t, "smartmemory-okf-import.tar.gz"), this._api.postForm("/memory/okf/import", s);
3430
+ const t = e instanceof Blob ? e : new Blob([e], { type: "application/gzip" }), n = new FormData();
3431
+ return n.append("file", t, "smartmemory-okf-import.tar.gz"), this._api.postForm("/memory/okf/import", n);
3303
3432
  }
3304
3433
  }
3305
3434
  export {
3306
- k as A,
3307
- O as B,
3435
+ $ as A,
3436
+ j as B,
3308
3437
  H as D,
3309
- ee as E,
3310
- Q as G,
3311
- Y as I,
3312
- ye as L,
3313
- j as M,
3314
- ne as O,
3315
- ae as P,
3316
- te as R,
3317
- pe as S,
3318
- G as T,
3319
- V as U,
3320
- ie as V,
3321
- ce as Z,
3322
- W as a,
3323
- re as b,
3324
- oe as c,
3325
- J as d,
3326
- F as e,
3327
- K as f,
3328
- B as g,
3329
- le as h,
3330
- ue as i,
3331
- D as j,
3438
+ te as E,
3439
+ ee as G,
3440
+ X as I,
3441
+ pe as L,
3442
+ B as M,
3443
+ re as O,
3444
+ oe as P,
3445
+ ne as R,
3446
+ de as S,
3447
+ D as T,
3448
+ Y as U,
3449
+ ae as V,
3450
+ ue as Z,
3451
+ V as a,
3452
+ ie as b,
3453
+ ce as c,
3454
+ W as d,
3455
+ O as e,
3456
+ G as f,
3457
+ K as g,
3458
+ me as h,
3459
+ le as i,
3460
+ N as j,
3332
3461
  se as k,
3333
- ge as l,
3334
- N as m,
3335
- Z as n,
3336
- z as o,
3337
- X as p,
3338
- E as q,
3339
- x as r
3462
+ $e as l,
3463
+ J as m,
3464
+ Q as n,
3465
+ x as o,
3466
+ Z as p,
3467
+ z as q,
3468
+ F as r
3340
3469
  };