@smartmemory/sdk-js 1.4.45 → 1.4.47

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
- var I = (a) => {
1
+ var R = (a) => {
2
2
  throw TypeError(a);
3
3
  };
4
- var $ = (a, e, t) => e.has(a) || I("Cannot " + t);
5
- var p = (a, e, t) => ($(a, e, "read from private field"), t ? t.call(a) : e.get(a)), k = (a, e, t) => e.has(a) ? I("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, t), w = (a, e, t, s) => ($(a, e, "write to private field"), s ? s.call(a, t) : e.set(a, t), t), S = (a, e, t) => ($(a, e, "access private method"), t);
4
+ var k = (a, e, t) => e.has(a) || R("Cannot " + t);
5
+ var g = (a, e, t) => (k(a, e, "read from private field"), t ? t.call(a) : e.get(a)), w = (a, e, t) => e.has(a) ? R("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(a) : e.set(a, t), b = (a, e, t, s) => (k(a, e, "write to private field"), s ? s.call(a, t) : e.set(a, t), t), S = (a, e, t) => (k(a, e, "access private method"), t);
6
6
  const U = {
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
- }, h = {
12
+ }, y = {
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 A {
19
+ class C {
20
20
  /**
21
21
  * @param {Object} options
22
22
  * @param {'localStorage' | 'sessionStorage' | 'memory'} [options.storage='localStorage']
@@ -26,7 +26,7 @@ class A {
26
26
  this.storageType = e, this.keys = { ...U, ...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, h.access);
29
+ return this.storageType === "memory" ? this._memory.access : this._getFromStorage(this.keys.access, y.access);
30
30
  }
31
31
  setAccessToken(e) {
32
32
  if (this.storageType === "memory") {
@@ -36,7 +36,7 @@ class A {
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, h.refresh);
39
+ return this.storageType === "memory" ? this._memory.refresh : this._getFromStorage(this.keys.refresh, y.refresh);
40
40
  }
41
41
  setRefreshToken(e) {
42
42
  if (this.storageType === "memory") {
@@ -47,7 +47,7 @@ class A {
47
47
  }
48
48
  getUser() {
49
49
  if (this.storageType === "memory") return this._memory.user;
50
- const e = this._getFromStorage(this.keys.user, h.user);
50
+ const e = this._getFromStorage(this.keys.user, y.user);
51
51
  if (!e) return null;
52
52
  try {
53
53
  return JSON.parse(e);
@@ -63,7 +63,7 @@ class A {
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, h.tenant));
66
+ return this.storageType === "memory" ? this._memory.tenant : this._normalizeId(this._getFromStorage(this.keys.tenant, y.tenant));
67
67
  }
68
68
  setTenantId(e) {
69
69
  const t = this._normalizeId(e);
@@ -74,7 +74,7 @@ class A {
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, h.team));
77
+ return this.storageType === "memory" ? this._memory.team : this._normalizeId(this._getFromStorage(this.keys.team, y.team));
78
78
  }
79
79
  setTeamId(e) {
80
80
  const t = this._normalizeId(e);
@@ -94,7 +94,7 @@ class A {
94
94
  localStorage.removeItem(e), sessionStorage.removeItem(e);
95
95
  } catch {
96
96
  }
97
- for (const e of Object.values(h))
97
+ for (const e of Object.values(y))
98
98
  for (const t of e)
99
99
  try {
100
100
  localStorage.removeItem(t), sessionStorage.removeItem(t);
@@ -148,7 +148,7 @@ class A {
148
148
  return s === "none" || s === "null" || s === "undefined" ? null : t;
149
149
  }
150
150
  }
151
- var l, d, R;
151
+ var l, f, v;
152
152
  class P {
153
153
  /**
154
154
  * @param {Object} options
@@ -160,22 +160,22 @@ class P {
160
160
  * @param {function(): void} options.onRefreshFailed
161
161
  */
162
162
  constructor({ apiBaseUrl: e, refreshEndpoint: t, tokenManager: s, useCookieAuth: r = !1, onTokenRefreshed: n, onRefreshFailed: i }) {
163
- k(this, d);
164
- k(this, l, null);
163
+ w(this, f);
164
+ w(this, l, null);
165
165
  this.apiBaseUrl = e, this.refreshEndpoint = t, this.tokenManager = s, this.useCookieAuth = r, this.onTokenRefreshed = n, this.onRefreshFailed = i;
166
166
  }
167
167
  async refresh() {
168
- if (p(this, l))
169
- return p(this, l);
170
- w(this, l, S(this, d, R).call(this));
168
+ if (g(this, l))
169
+ return g(this, l);
170
+ b(this, l, S(this, f, v).call(this));
171
171
  try {
172
- return await p(this, l);
172
+ return await g(this, l);
173
173
  } finally {
174
- w(this, l, null);
174
+ b(this, l, null);
175
175
  }
176
176
  }
177
177
  }
178
- l = new WeakMap(), d = new WeakSet(), R = async function() {
178
+ l = new WeakMap(), f = new WeakSet(), v = 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");
@@ -190,8 +190,8 @@ l = new WeakMap(), d = new WeakSet(), R = async function() {
190
190
  const r = await s.json();
191
191
  return this.tokenManager.setAccessToken(r.access_token), r.refresh_token && this.tokenManager.setRefreshToken(r.refresh_token), this.onTokenRefreshed(r.access_token), r.access_token;
192
192
  };
193
- const b = "smart_memory_sso_redirect";
194
- class C {
193
+ const I = "smart_memory_sso_redirect";
194
+ class q {
195
195
  /**
196
196
  * @param {Object} options
197
197
  * @param {string} options.webAppUrl - Web app URL for login redirect
@@ -216,15 +216,15 @@ class C {
216
216
  }
217
217
  storeRedirect(e) {
218
218
  try {
219
- sessionStorage.setItem(b, e);
219
+ sessionStorage.setItem(I, e);
220
220
  } catch (t) {
221
221
  console.warn("Failed to store redirect URL:", t);
222
222
  }
223
223
  }
224
224
  getAndClearRedirect() {
225
225
  try {
226
- const e = sessionStorage.getItem(b);
227
- return sessionStorage.removeItem(b), e;
226
+ const e = sessionStorage.getItem(I);
227
+ return sessionStorage.removeItem(I), e;
228
228
  } catch {
229
229
  return null;
230
230
  }
@@ -232,7 +232,7 @@ class C {
232
232
  }
233
233
  class L {
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 A({
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 C({
236
236
  storage: e.storage || "localStorage",
237
237
  keys: e.tokenKeys
238
238
  }), this.mode !== "apiKey" ? this.refreshManager = new P({
@@ -247,7 +247,7 @@ class L {
247
247
  onRefreshFailed: () => {
248
248
  this.clearLocalAuth();
249
249
  }
250
- }) : this.refreshManager = null, this.mode === "sso" && (this.ssoManager = new C({
250
+ }) : this.refreshManager = null, this.mode === "sso" && (this.ssoManager = new q({
251
251
  webAppUrl: e.webAppUrl,
252
252
  allowedHosts: e.allowedRedirectHosts || [],
253
253
  tokenManager: this.tokenManager
@@ -366,7 +366,7 @@ class L {
366
366
  this.tokenManager.setTenantId(e), this.notifyListeners();
367
367
  }
368
368
  }
369
- class g extends Error {
369
+ class h extends Error {
370
370
  /**
371
371
  * @param {string} message - Error message
372
372
  * @param {number} [status=0] - HTTP status code (0 for network errors)
@@ -376,7 +376,10 @@ class g extends Error {
376
376
  super(e), this.name = "APIError", this.status = t, this.detail = s;
377
377
  }
378
378
  }
379
- class q {
379
+ function d(a) {
380
+ return typeof FormData < "u" && a instanceof FormData;
381
+ }
382
+ class M {
380
383
  /**
381
384
  * @param {import('../auth/AuthCore.js').AuthCore} authCore
382
385
  * @param {{ fetchFn?: typeof globalThis.fetch }} [options]
@@ -390,7 +393,7 @@ class q {
390
393
  async request(e, t = {}) {
391
394
  var i, o;
392
395
  const s = `${this.baseURL}${e}`, r = {
393
- "Content-Type": "application/json",
396
+ ...d(t.body) ? {} : { "Content-Type": "application/json" },
394
397
  ...this.auth.getAuthHeaders(t.headers)
395
398
  }, n = this.auth.getRequestOptions({ ...t, headers: r });
396
399
  try {
@@ -399,7 +402,7 @@ class q {
399
402
  try {
400
403
  await this.auth.refreshToken();
401
404
  const u = {
402
- "Content-Type": "application/json",
405
+ ...d(t.body) ? {} : { "Content-Type": "application/json" },
403
406
  ...this.auth.getAuthHeaders(t.headers)
404
407
  };
405
408
  c = await this.fetchFn(
@@ -409,14 +412,14 @@ class q {
409
412
  } catch {
410
413
  }
411
414
  if (c.status === 401)
412
- throw (o = (i = this.auth).clearLocalAuth) == null || o.call(i), new g("Authentication required", 401, "auth_expired");
415
+ throw (o = (i = this.auth).clearLocalAuth) == null || o.call(i), new h("Authentication required", 401, "auth_expired");
413
416
  if (c.status === 204)
414
417
  return null;
415
418
  if (!c.ok)
416
419
  throw await this._handleError(c);
417
420
  return await c.json();
418
421
  } catch (c) {
419
- throw c instanceof g ? c : new g(c.message, 0, "network_error");
422
+ throw c instanceof h ? c : new h(c.message, 0, "network_error");
420
423
  }
421
424
  }
422
425
  async get(e, t = {}) {
@@ -429,6 +432,43 @@ class q {
429
432
  body: JSON.stringify(t)
430
433
  });
431
434
  }
435
+ async requestBinary(e, t = {}) {
436
+ var i, o;
437
+ const s = `${this.baseURL}${e}`, r = {
438
+ ...d(t.body) ? {} : { "Content-Type": "application/json" },
439
+ ...this.auth.getAuthHeaders(t.headers)
440
+ }, n = this.auth.getRequestOptions({ ...t, headers: r });
441
+ try {
442
+ let c = await this.fetchFn(s, n);
443
+ if (c.status === 401 && !t.__isRetry)
444
+ try {
445
+ await this.auth.refreshToken();
446
+ const u = {
447
+ ...d(t.body) ? {} : { "Content-Type": "application/json" },
448
+ ...this.auth.getAuthHeaders(t.headers)
449
+ };
450
+ c = await this.fetchFn(
451
+ s,
452
+ this.auth.getRequestOptions({ ...n, headers: u, __isRetry: !0 })
453
+ );
454
+ } catch {
455
+ }
456
+ if (c.status === 401)
457
+ throw (o = (i = this.auth).clearLocalAuth) == null || o.call(i), new h("Authentication required", 401, "auth_expired");
458
+ if (!c.ok)
459
+ throw await this._handleError(c);
460
+ return await c.arrayBuffer();
461
+ } catch (c) {
462
+ throw c instanceof h ? c : new h(c.message, 0, "network_error");
463
+ }
464
+ }
465
+ async postForm(e, t, s = {}) {
466
+ return this.request(e, {
467
+ ...s,
468
+ method: "POST",
469
+ body: t
470
+ });
471
+ }
432
472
  async put(e, t, s = {}) {
433
473
  return this.request(e, {
434
474
  ...s,
@@ -456,7 +496,7 @@ class q {
456
496
  } catch {
457
497
  t = { message: `HTTP ${e.status}` };
458
498
  }
459
- return new g(
499
+ return new h(
460
500
  this._extractMessage(t, e.status),
461
501
  e.status,
462
502
  t
@@ -486,7 +526,7 @@ class q {
486
526
  return typeof (e == null ? void 0 : e.message) == "string" ? e.message : `HTTP ${t}`;
487
527
  }
488
528
  }
489
- class M {
529
+ class z {
490
530
  constructor(e) {
491
531
  this.api = e;
492
532
  }
@@ -563,9 +603,9 @@ class M {
563
603
  * present only under `cite: true`. Pre-LINEAGE-1 callers who indexed into a
564
604
  * bare array must read `response.results` instead.
565
605
  */
566
- async search(e, { topK: t = 5, enableHybrid: s = !0, memoryType: r = null, expertise: n = !1, cite: i = !1, decompose: o = !1, multiHop: c = !1, maxHops: u = 3, budgetMs: y = 1500, semanticHops: f = !1, includeReference: _ = !1, includeConsolidated: v = !1, consolidationFirst: T = !1 } = {}) {
606
+ async search(e, { topK: t = 5, enableHybrid: s = !0, memoryType: r = null, expertise: n = !1, cite: i = !1, decompose: o = !1, multiHop: c = !1, maxHops: u = 3, budgetMs: p = 1500, semanticHops: _ = !1, includeReference: $ = !1, includeConsolidated: T = !1, consolidationFirst: A = !1 } = {}) {
567
607
  const m = { query: e, top_k: t, enable_hybrid: s };
568
- return r && (m.memory_type = r), n && (m.expertise = !0), i && (m.cite = !0), o && (m.decompose = !0), c && (m.multi_hop = !0), c && u !== 3 && (m.max_hops = u), c && y !== 1500 && (m.budget_ms = y), c && f && (m.semantic_hops = !0), _ && (m.include_reference = !0), v && (m.include_consolidated = !0), T && (m.consolidation_first = !0), this.api.post("/memory/search", m);
608
+ return r && (m.memory_type = r), n && (m.expertise = !0), i && (m.cite = !0), o && (m.decompose = !0), c && (m.multi_hop = !0), c && u !== 3 && (m.max_hops = u), c && p !== 1500 && (m.budget_ms = p), c && _ && (m.semantic_hops = !0), $ && (m.include_reference = !0), T && (m.include_consolidated = !0), A && (m.consolidation_first = !0), this.api.post("/memory/search", m);
569
609
  }
570
610
  async getWorkingContext(e, t, { k: s = 20, maxTokens: r = null, strategy: n = null } = {}) {
571
611
  const i = {
@@ -728,7 +768,7 @@ class M {
728
768
  return this.api.get("/memory/clustering/stats");
729
769
  }
730
770
  }
731
- class z {
771
+ class E {
732
772
  constructor(e) {
733
773
  this.api = e;
734
774
  }
@@ -757,9 +797,9 @@ class z {
757
797
  domain: o = null,
758
798
  tags: c = null,
759
799
  rejectedAlternatives: u = null,
760
- rationale: y = null,
761
- constraints: f = null,
762
- agentId: _ = null
800
+ rationale: p = null,
801
+ constraints: _ = null,
802
+ agentId: $ = null
763
803
  }) {
764
804
  return this.api.post("/memory/decisions/create", {
765
805
  content: e,
@@ -771,9 +811,9 @@ class z {
771
811
  domain: o,
772
812
  tags: c,
773
813
  rejected_alternatives: u,
774
- rationale: y,
775
- constraints: f,
776
- agent_id: _
814
+ rationale: p,
815
+ constraints: _,
816
+ agent_id: $
777
817
  });
778
818
  }
779
819
  /**
@@ -943,7 +983,7 @@ class z {
943
983
  });
944
984
  }
945
985
  }
946
- class E {
986
+ class O {
947
987
  constructor(e) {
948
988
  this.api = e;
949
989
  }
@@ -1088,7 +1128,7 @@ class x {
1088
1128
  );
1089
1129
  }
1090
1130
  }
1091
- class O {
1131
+ class F {
1092
1132
  constructor(e) {
1093
1133
  this.api = e;
1094
1134
  }
@@ -1150,7 +1190,7 @@ class j {
1150
1190
  return this.api.patch("/auth/llm-keys", e);
1151
1191
  }
1152
1192
  }
1153
- class F {
1193
+ class H {
1154
1194
  constructor(e) {
1155
1195
  this.api = e;
1156
1196
  }
@@ -1176,7 +1216,7 @@ class F {
1176
1216
  });
1177
1217
  }
1178
1218
  }
1179
- class H {
1219
+ class B {
1180
1220
  constructor(e) {
1181
1221
  this.api = e;
1182
1222
  }
@@ -1256,7 +1296,7 @@ class K {
1256
1296
  return this.api.get(`/memory/agents/${e}/evaluation/history${n ? "?" + n : ""}`);
1257
1297
  }
1258
1298
  }
1259
- class B {
1299
+ class G {
1260
1300
  constructor(e) {
1261
1301
  this.api = e;
1262
1302
  }
@@ -1270,7 +1310,7 @@ class B {
1270
1310
  return this.api.get("/usage/tiers");
1271
1311
  }
1272
1312
  }
1273
- class G {
1313
+ class D {
1274
1314
  constructor(e) {
1275
1315
  this.api = e;
1276
1316
  }
@@ -1310,7 +1350,7 @@ class N {
1310
1350
  return this.api.get("/memory/token-usage/current");
1311
1351
  }
1312
1352
  }
1313
- class D {
1353
+ class J {
1314
1354
  constructor(e) {
1315
1355
  this.api = e;
1316
1356
  }
@@ -1456,7 +1496,7 @@ class D {
1456
1496
  return this.api.get(`/memory/temporal/relationships/${e}/valid-periods`);
1457
1497
  }
1458
1498
  }
1459
- class J {
1499
+ class V {
1460
1500
  constructor(e) {
1461
1501
  this.api = e;
1462
1502
  }
@@ -1525,7 +1565,7 @@ class J {
1525
1565
  return this.api.get("/memory/governance/summary");
1526
1566
  }
1527
1567
  }
1528
- class V {
1568
+ class W {
1529
1569
  constructor(e) {
1530
1570
  this.api = e;
1531
1571
  }
@@ -1566,7 +1606,7 @@ class V {
1566
1606
  return this.api.post("/memory/evolution/reinforce/opinions");
1567
1607
  }
1568
1608
  }
1569
- class W {
1609
+ class Y {
1570
1610
  constructor(e) {
1571
1611
  this.api = e;
1572
1612
  }
@@ -1664,7 +1704,7 @@ class W {
1664
1704
  });
1665
1705
  }
1666
1706
  }
1667
- class Y {
1707
+ class Z {
1668
1708
  constructor(e) {
1669
1709
  this.api = e;
1670
1710
  }
@@ -1718,7 +1758,7 @@ class Y {
1718
1758
  return this.api.get(`/memory/reasoning/traces/${e}`);
1719
1759
  }
1720
1760
  }
1721
- class Z {
1761
+ class Q {
1722
1762
  constructor(e) {
1723
1763
  this.api = e;
1724
1764
  }
@@ -2288,7 +2328,7 @@ class Z {
2288
2328
  return r !== void 0 && (n.expected_tier = r), this.api.post("/memory/ontology/queue/bulk", n);
2289
2329
  }
2290
2330
  }
2291
- class Q {
2331
+ class X {
2292
2332
  constructor(e) {
2293
2333
  this.api = e;
2294
2334
  }
@@ -2317,7 +2357,7 @@ class Q {
2317
2357
  return e !== null && (r.protected_attributes = e), t !== null && (r.sentiment_analysis = t), s !== null && (r.topic_analysis = s), this.api.post("/memory/analytics/bias", r);
2318
2358
  }
2319
2359
  }
2320
- class X {
2360
+ class ee {
2321
2361
  constructor(e) {
2322
2362
  this.api = e;
2323
2363
  }
@@ -2353,7 +2393,7 @@ class X {
2353
2393
  return this.api.get("/memory/inference/rules");
2354
2394
  }
2355
2395
  }
2356
- class ee {
2396
+ class te {
2357
2397
  constructor(e) {
2358
2398
  this.api = e;
2359
2399
  }
@@ -2469,7 +2509,7 @@ class ee {
2469
2509
  return this.api.delete(`/memory/pipeline/configs/${e}`);
2470
2510
  }
2471
2511
  }
2472
- class te {
2512
+ class se {
2473
2513
  constructor(e) {
2474
2514
  this.api = e;
2475
2515
  }
@@ -2495,7 +2535,7 @@ class te {
2495
2535
  return this.api.get(`/memory/archive/${e}`);
2496
2536
  }
2497
2537
  }
2498
- class se {
2538
+ class re {
2499
2539
  constructor(e) {
2500
2540
  this.api = e;
2501
2541
  }
@@ -2654,7 +2694,7 @@ class se {
2654
2694
  return this.api.get(`/memory/zettel/by-relation/${e}/${t}?limit=${s}`);
2655
2695
  }
2656
2696
  }
2657
- class re {
2697
+ class ne {
2658
2698
  constructor(e) {
2659
2699
  this.api = e;
2660
2700
  }
@@ -2690,7 +2730,7 @@ class re {
2690
2730
  return this.api.get("/memory/procedures/matches/stats");
2691
2731
  }
2692
2732
  }
2693
- class ne {
2733
+ class ie {
2694
2734
  constructor(e) {
2695
2735
  this.api = e;
2696
2736
  }
@@ -2739,7 +2779,7 @@ class ne {
2739
2779
  return this.api.delete(`/memory/procedures/candidates/${e}/dismiss`);
2740
2780
  }
2741
2781
  }
2742
- class ie {
2782
+ class ae {
2743
2783
  constructor(e) {
2744
2784
  this.api = e;
2745
2785
  }
@@ -2794,7 +2834,7 @@ class ie {
2794
2834
  return this.api.get(`/memory/procedures/schemas/${e}`);
2795
2835
  }
2796
2836
  }
2797
- class ae {
2837
+ class oe {
2798
2838
  constructor(e) {
2799
2839
  this.api = e;
2800
2840
  }
@@ -2866,11 +2906,11 @@ class ae {
2866
2906
  return this.api.delete(`/memory/summary/${e}`);
2867
2907
  }
2868
2908
  }
2869
- class ce {
2909
+ class me {
2870
2910
  constructor(e) {
2871
2911
  this.auth = new L(e);
2872
- const t = new q(this.auth, { fetchFn: e.fetchFn });
2873
- this.memories = new M(t), this.decisions = new z(t), this.opinions = new E(t), this.graph = new x(t), this.teams = new O(t), this.profiles = new j(t), this.subscriptions = new F(t), this.authAPI = new H(t), this.agents = new K(t), this.usage = new B(t), this.insights = new G(t), this.tokenUsage = new N(t), this.temporal = new D(t), this.governance = new J(t), this.evolution = new V(t), this.reasoning = new W(t), this.reasoningTraces = new Y(t), this.ontology = new Z(t), this.analytics = new Q(t), this.validation = new X(t), this.pipeline = new ee(t), this.archive = new te(t), this.zettelkasten = new se(t), this.procedureMatches = new re(t), this.procedureCandidates = new ne(t), this.procedureDrift = new ie(t), this.summaries = new ae(t);
2912
+ const t = new M(this.auth, { fetchFn: e.fetchFn });
2913
+ this._api = t, this.memories = new z(t), this.decisions = new E(t), this.opinions = new O(t), this.graph = new x(t), this.teams = new F(t), this.profiles = new j(t), this.subscriptions = new H(t), this.authAPI = new B(t), this.agents = new K(t), this.usage = new G(t), this.insights = new D(t), this.tokenUsage = new N(t), this.temporal = new J(t), this.governance = new V(t), this.evolution = new W(t), this.reasoning = new Y(t), this.reasoningTraces = new Z(t), this.ontology = new Q(t), this.analytics = new X(t), this.validation = new ee(t), this.pipeline = new te(t), this.archive = new se(t), this.zettelkasten = new re(t), this.procedureMatches = new ne(t), this.procedureCandidates = new ie(t), this.procedureDrift = new ae(t), this.summaries = new oe(t);
2874
2914
  }
2875
2915
  setTeamId(e) {
2876
2916
  this.auth.tokenManager.setTeamId(e), this.auth.notifyListeners();
@@ -2878,38 +2918,54 @@ class ce {
2878
2918
  getTeamId() {
2879
2919
  return this.auth.tokenManager.getTeamId();
2880
2920
  }
2921
+ /**
2922
+ * Export the current workspace as a gzipped OKF bundle.
2923
+ * @returns {Promise<ArrayBuffer>}
2924
+ */
2925
+ async exportOkf() {
2926
+ return this._api.requestBinary("/memory/okf/export", { method: "GET" });
2927
+ }
2928
+ /**
2929
+ * Import a gzipped OKF bundle into the current workspace.
2930
+ * @param {Blob | ArrayBuffer | Uint8Array} archive
2931
+ * @returns {Promise<{ imported: number, failed: number, workspace_id: string }>}
2932
+ */
2933
+ async importOkf(e) {
2934
+ const t = e instanceof Blob ? e : new Blob([e], { type: "application/gzip" }), s = new FormData();
2935
+ return s.append("file", t, "smartmemory-okf-import.tar.gz"), this._api.postForm("/memory/okf/import", s);
2936
+ }
2881
2937
  }
2882
2938
  export {
2883
- g as A,
2884
- q as B,
2885
- z as D,
2886
- V as E,
2887
- J as G,
2888
- G as I,
2889
- M,
2890
- Z as O,
2891
- ee as P,
2892
- W as R,
2893
- ce as S,
2894
- O as T,
2895
- B as U,
2896
- X as V,
2897
- se as Z,
2939
+ h as A,
2940
+ M as B,
2941
+ E as D,
2942
+ W as E,
2943
+ V as G,
2944
+ D as I,
2945
+ z as M,
2946
+ Q as O,
2947
+ te as P,
2948
+ Y as R,
2949
+ me as S,
2950
+ F as T,
2951
+ G as U,
2952
+ ee as V,
2953
+ re as Z,
2898
2954
  K as a,
2899
- Q as b,
2900
- te as c,
2901
- H as d,
2955
+ X as b,
2956
+ se as c,
2957
+ B as d,
2902
2958
  L as e,
2903
2959
  x as f,
2904
- E as g,
2905
- ne as h,
2906
- re as i,
2960
+ O as g,
2961
+ ie as h,
2962
+ ne as i,
2907
2963
  j,
2908
- Y as k,
2909
- F as l,
2910
- D as m,
2911
- A as n,
2964
+ Z as k,
2965
+ H as l,
2966
+ J as m,
2967
+ C as n,
2912
2968
  N as o,
2913
2969
  P as p,
2914
- C as q
2970
+ q
2915
2971
  };
package/dist/core.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as e, a as r, d as A, e as I, B as P, D as n, f as o, I as t, M as i, j as g, p as M, q as h, S as m, l as S, T as f, n as p, U as l } from "./core-BWFexoX-.js";
1
+ import { A as e, a as r, d as A, e as I, B as P, D as n, f as o, I as t, M as i, j as g, p as M, q as h, S as m, l as S, T as f, n as p, U as l } from "./core-BNt44Xql.js";
2
2
  export {
3
3
  e as APIError,
4
4
  r as AgentAPI,
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as f, a as u, b as A, c as b, d as P, e as h, D as I, E as g, G as x, f as p, I as w, M as m, O as k, g as v, P as T, h as B, i as y, j as C, R as E, k as S, S as R, l as F, T as M, m as L, n as O, o as G, U, V as $, Z as D } from "./core-BWFexoX-.js";
1
+ import { A as f, a as u, b as A, c as b, d as P, e as h, D as I, E as g, G as x, f as p, I as w, M as m, O as k, g as v, P as T, h as B, i as y, j as C, R as E, k as S, S as R, l as F, T as M, m as L, n as O, o as G, U, V as $, Z as D } from "./core-BNt44Xql.js";
2
2
  const i = {
3
3
  variables: {
4
4
  colorBackground: "transparent",
package/dist/react.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import h, { createContext as d, useRef as y, useState as v, useEffect as b, useCallback as c, useContext as f } from "react";
2
- import { S as x } from "./core-BWFexoX-.js";
2
+ import { S as x } from "./core-BNt44Xql.js";
3
3
  const m = d(null), g = d(null);
4
4
  function U({ children: e, ...r }) {
5
5
  const n = y(null);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@smartmemory/sdk-js",
3
- "version": "1.4.45",
3
+ "version": "1.4.47",
4
4
  "description": "Unified JavaScript SDK for SmartMemory API — auth + API client for all frontends",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",