@smartmemory/sdk-js 1.4.43 → 1.4.45

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,9 +1,9 @@
1
- var I = (i) => {
2
- throw TypeError(i);
1
+ var I = (a) => {
2
+ throw TypeError(a);
3
3
  };
4
- var $ = (i, e, t) => e.has(i) || I("Cannot " + t);
5
- var p = (i, e, t) => ($(i, e, "read from private field"), t ? t.call(i) : e.get(i)), k = (i, e, t) => e.has(i) ? I("Cannot add the same private member more than once") : e instanceof WeakSet ? e.add(i) : e.set(i, t), w = (i, e, t, s) => ($(i, e, "write to private field"), s ? s.call(i, t) : e.set(i, t), t), S = (i, e, t) => ($(i, e, "access private method"), t);
6
- const R = {
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);
6
+ const U = {
7
7
  access: "smart_memory_auth_token",
8
8
  refresh: "smart_memory_refresh_token",
9
9
  user: "smart_memory_user",
@@ -16,14 +16,14 @@ const R = {
16
16
  tenant: ["tenant_id", "workspace_id", "sm_workspace_id"],
17
17
  team: ["team_id", "sm_team_id"]
18
18
  };
19
- class U {
19
+ class A {
20
20
  /**
21
21
  * @param {Object} options
22
22
  * @param {'localStorage' | 'sessionStorage' | 'memory'} [options.storage='localStorage']
23
23
  * @param {Object} [options.keys] - Custom storage key names
24
24
  */
25
25
  constructor({ storage: e = "localStorage", keys: t = {} } = {}) {
26
- this.storageType = e, this.keys = { ...R, ...t }, this._memory = { access: null, refresh: null, user: null, tenant: null, team: null };
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
29
  return this.storageType === "memory" ? this._memory.access : this._getFromStorage(this.keys.access, h.access);
@@ -114,15 +114,15 @@ class U {
114
114
  try {
115
115
  const s = this.storageType === "localStorage" ? localStorage : sessionStorage, r = this.storageType === "localStorage" ? sessionStorage : localStorage, n = s.getItem(e) || r.getItem(e);
116
116
  if (n != null) return n;
117
- for (const a of t) {
118
- const c = s.getItem(a) || r.getItem(a);
119
- if (c != null) {
120
- this._setInStorage(e, c);
117
+ for (const i of t) {
118
+ const o = s.getItem(i) || r.getItem(i);
119
+ if (o != null) {
120
+ this._setInStorage(e, o);
121
121
  try {
122
- s.removeItem(a), r.removeItem(a);
122
+ s.removeItem(i), r.removeItem(i);
123
123
  } catch {
124
124
  }
125
- return c;
125
+ return o;
126
126
  }
127
127
  }
128
128
  return null;
@@ -148,7 +148,7 @@ class U {
148
148
  return s === "none" || s === "null" || s === "undefined" ? null : t;
149
149
  }
150
150
  }
151
- var m, d, v;
151
+ var l, d, R;
152
152
  class P {
153
153
  /**
154
154
  * @param {Object} options
@@ -159,23 +159,23 @@ class P {
159
159
  * @param {function(string): void} options.onTokenRefreshed
160
160
  * @param {function(): void} options.onRefreshFailed
161
161
  */
162
- constructor({ apiBaseUrl: e, refreshEndpoint: t, tokenManager: s, useCookieAuth: r = !1, onTokenRefreshed: n, onRefreshFailed: a }) {
162
+ constructor({ apiBaseUrl: e, refreshEndpoint: t, tokenManager: s, useCookieAuth: r = !1, onTokenRefreshed: n, onRefreshFailed: i }) {
163
163
  k(this, d);
164
- k(this, m, null);
165
- this.apiBaseUrl = e, this.refreshEndpoint = t, this.tokenManager = s, this.useCookieAuth = r, this.onTokenRefreshed = n, this.onRefreshFailed = a;
164
+ k(this, l, null);
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, m))
169
- return p(this, m);
170
- w(this, m, S(this, d, v).call(this));
168
+ if (p(this, l))
169
+ return p(this, l);
170
+ w(this, l, S(this, d, R).call(this));
171
171
  try {
172
- return await p(this, m);
172
+ return await p(this, l);
173
173
  } finally {
174
- w(this, m, null);
174
+ w(this, l, null);
175
175
  }
176
176
  }
177
177
  }
178
- m = new WeakMap(), d = new WeakSet(), v = async function() {
178
+ l = new WeakMap(), d = new WeakSet(), R = 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");
@@ -230,9 +230,9 @@ class C {
230
230
  }
231
231
  }
232
232
  }
233
- class M {
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 U({
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({
236
236
  storage: e.storage || "localStorage",
237
237
  keys: e.tokenKeys
238
238
  }), this.mode !== "apiKey" ? this.refreshManager = new P({
@@ -376,7 +376,7 @@ class g extends Error {
376
376
  super(e), this.name = "APIError", this.status = t, this.detail = s;
377
377
  }
378
378
  }
379
- class L {
379
+ class q {
380
380
  /**
381
381
  * @param {import('../auth/AuthCore.js').AuthCore} authCore
382
382
  * @param {{ fetchFn?: typeof globalThis.fetch }} [options]
@@ -388,35 +388,35 @@ class L {
388
388
  return this._customFetchFn || globalThis.fetch.bind(globalThis);
389
389
  }
390
390
  async request(e, t = {}) {
391
- var a, c;
391
+ var i, o;
392
392
  const s = `${this.baseURL}${e}`, r = {
393
393
  "Content-Type": "application/json",
394
394
  ...this.auth.getAuthHeaders(t.headers)
395
395
  }, n = this.auth.getRequestOptions({ ...t, headers: r });
396
396
  try {
397
- let o = await this.fetchFn(s, n);
398
- if (o.status === 401 && !t.__isRetry)
397
+ let c = await this.fetchFn(s, n);
398
+ if (c.status === 401 && !t.__isRetry)
399
399
  try {
400
400
  await this.auth.refreshToken();
401
401
  const u = {
402
402
  "Content-Type": "application/json",
403
403
  ...this.auth.getAuthHeaders(t.headers)
404
404
  };
405
- o = await this.fetchFn(
405
+ c = await this.fetchFn(
406
406
  s,
407
407
  this.auth.getRequestOptions({ ...n, headers: u, __isRetry: !0 })
408
408
  );
409
409
  } catch {
410
410
  }
411
- if (o.status === 401)
412
- throw (c = (a = this.auth).clearLocalAuth) == null || c.call(a), new g("Authentication required", 401, "auth_expired");
413
- if (o.status === 204)
411
+ if (c.status === 401)
412
+ throw (o = (i = this.auth).clearLocalAuth) == null || o.call(i), new g("Authentication required", 401, "auth_expired");
413
+ if (c.status === 204)
414
414
  return null;
415
- if (!o.ok)
416
- throw await this._handleError(o);
417
- return await o.json();
418
- } catch (o) {
419
- throw o instanceof g ? o : new g(o.message, 0, "network_error");
415
+ if (!c.ok)
416
+ throw await this._handleError(c);
417
+ return await c.json();
418
+ } catch (c) {
419
+ throw c instanceof g ? c : new g(c.message, 0, "network_error");
420
420
  }
421
421
  }
422
422
  async get(e, t = {}) {
@@ -486,7 +486,7 @@ class L {
486
486
  return typeof (e == null ? void 0 : e.message) == "string" ? e.message : `HTTP ${t}`;
487
487
  }
488
488
  }
489
- class z {
489
+ class M {
490
490
  constructor(e) {
491
491
  this.api = e;
492
492
  }
@@ -496,16 +496,16 @@ class z {
496
496
  metadata: s = null,
497
497
  usePipeline: r = !0,
498
498
  profileName: n = null,
499
- conversationContext: a = null
499
+ conversationContext: i = null
500
500
  }) {
501
- const c = {
501
+ const o = {
502
502
  content: e,
503
503
  memory_type: t,
504
504
  metadata: s,
505
505
  use_pipeline: r,
506
506
  profile_name: n
507
507
  };
508
- return a != null && (c.conversation_context = a), this.api.post("/memory/add", c);
508
+ return i != null && (o.conversation_context = i), this.api.post("/memory/add", o);
509
509
  }
510
510
  async get(e) {
511
511
  const t = await this.api.get(`/memory/${e}`);
@@ -563,17 +563,17 @@ class z {
563
563
  * present only under `cite: true`. Pre-LINEAGE-1 callers who indexed into a
564
564
  * bare array must read `response.results` instead.
565
565
  */
566
- async search(e, { topK: t = 5, enableHybrid: s = !0, memoryType: r = null, expertise: n = !1, cite: a = !1, decompose: c = !1, multiHop: o = !1, maxHops: u = 3, budgetMs: y = 1500, semanticHops: f = !1, includeReference: _ = !1, includeConsolidated: T = !1, consolidationFirst: A = !1 } = {}) {
567
- const l = { query: e, top_k: t, enable_hybrid: s };
568
- return r && (l.memory_type = r), n && (l.expertise = !0), a && (l.cite = !0), c && (l.decompose = !0), o && (l.multi_hop = !0), o && u !== 3 && (l.max_hops = u), o && y !== 1500 && (l.budget_ms = y), o && f && (l.semantic_hops = !0), _ && (l.include_reference = !0), T && (l.include_consolidated = !0), A && (l.consolidation_first = !0), this.api.post("/memory/search", l);
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 } = {}) {
567
+ 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);
569
569
  }
570
570
  async getWorkingContext(e, t, { k: s = 20, maxTokens: r = null, strategy: n = null } = {}) {
571
- const a = {
571
+ const i = {
572
572
  session_id: e,
573
573
  query: t,
574
574
  k: s
575
575
  };
576
- return r != null && (a.max_tokens = r), n != null && (a.strategy = n), this.api.post("/memory/context", a);
576
+ return r != null && (i.max_tokens = r), n != null && (i.strategy = n), this.api.post("/memory/context", i);
577
577
  }
578
578
  async searchAdvanced(e, { algorithm: t = "query_traversal", maxResults: s = 15, useSSG: r = !0 } = {}) {
579
579
  return this.api.post("/memory/search/advanced", {
@@ -612,11 +612,11 @@ class z {
612
612
  conversationId: s = null,
613
613
  sessionDates: r = null,
614
614
  turnsPerChunk: n = 15,
615
- maxChunkChars: a = 12e3,
616
- maxConcurrent: c = 4
615
+ maxChunkChars: i = 12e3,
616
+ maxConcurrent: o = 4
617
617
  } = {}) {
618
- const o = { turns: e, turns_per_chunk: n, max_chunk_chars: a, max_concurrent: c };
619
- return t && (o.session_boundaries = t), s && (o.conversation_id = s), r && (o.session_dates = r), this.api.post("/memory/ingest/conversation", o);
618
+ const c = { turns: e, turns_per_chunk: n, max_chunk_chars: i, max_concurrent: o };
619
+ return t && (c.session_boundaries = t), s && (c.conversation_id = s), r && (c.session_dates = r), this.api.post("/memory/ingest/conversation", c);
620
620
  }
621
621
  async ingestDocument(e, { title: t = null, source: s = null, chunkStrategy: r = null } = {}) {
622
622
  const n = { content: e };
@@ -627,8 +627,8 @@ class z {
627
627
  return t && (r.repo = t), s && (r.commit = s), this.api.post("/memory/code/index", r);
628
628
  }
629
629
  async codeSearch(e, { entityType: t = null, repo: s = null, limit: r = 20, semantic: n = !1 } = {}) {
630
- const a = new URLSearchParams({ query: e, limit: r, semantic: n });
631
- return t && a.append("entity_type", t), s && a.append("repo", s), this.api.get(`/memory/code/search?${a}`);
630
+ const i = new URLSearchParams({ query: e, limit: r, semantic: n });
631
+ return t && i.append("entity_type", t), s && i.append("repo", s), this.api.get(`/memory/code/search?${i}`);
632
632
  }
633
633
  async codeContext(e, { repo: t = null } = {}) {
634
634
  const s = new URLSearchParams({ entity_name: e });
@@ -709,8 +709,8 @@ class z {
709
709
  }
710
710
  async getChanges(e, { since: t = null, until: s = null, changeType: r = null } = {}) {
711
711
  let n = `/memory/temporal/${e}/changes`;
712
- const a = [];
713
- return t && a.push(`since=${t}`), s && a.push(`until=${s}`), r && a.push(`change_type=${r}`), a.length && (n += `?${a.join("&")}`), this.api.get(n);
712
+ const i = [];
713
+ return t && i.push(`since=${t}`), s && i.push(`until=${s}`), r && i.push(`change_type=${r}`), i.length && (n += `?${i.join("&")}`), this.api.get(n);
714
714
  }
715
715
  async compareVersions(e, t, s) {
716
716
  return this.api.post(`/memory/temporal/${e}/compare?v1=${t}&v2=${s}`);
@@ -728,7 +728,7 @@ class z {
728
728
  return this.api.get("/memory/clustering/stats");
729
729
  }
730
730
  }
731
- class E {
731
+ class z {
732
732
  constructor(e) {
733
733
  this.api = e;
734
734
  }
@@ -753,9 +753,9 @@ class E {
753
753
  confidence: s = 0.8,
754
754
  sourceTraceId: r = null,
755
755
  sourceSessionId: n = null,
756
- evidenceIds: a = null,
757
- domain: c = null,
758
- tags: o = null,
756
+ evidenceIds: i = null,
757
+ domain: o = null,
758
+ tags: c = null,
759
759
  rejectedAlternatives: u = null,
760
760
  rationale: y = null,
761
761
  constraints: f = null,
@@ -767,9 +767,9 @@ class E {
767
767
  confidence: s,
768
768
  source_trace_id: r,
769
769
  source_session_id: n,
770
- evidence_ids: a,
771
- domain: c,
772
- tags: o,
770
+ evidence_ids: i,
771
+ domain: o,
772
+ tags: c,
773
773
  rejected_alternatives: u,
774
774
  rationale: y,
775
775
  constraints: f,
@@ -943,7 +943,7 @@ class E {
943
943
  });
944
944
  }
945
945
  }
946
- class x {
946
+ class E {
947
947
  constructor(e) {
948
948
  this.api = e;
949
949
  }
@@ -965,7 +965,7 @@ class x {
965
965
  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);
966
966
  }
967
967
  }
968
- class q {
968
+ class x {
969
969
  constructor(e) {
970
970
  this.api = e;
971
971
  }
@@ -1310,7 +1310,7 @@ class N {
1310
1310
  return this.api.get("/memory/token-usage/current");
1311
1311
  }
1312
1312
  }
1313
- class V {
1313
+ class D {
1314
1314
  constructor(e) {
1315
1315
  this.api = e;
1316
1316
  }
@@ -1358,8 +1358,8 @@ class V {
1358
1358
  */
1359
1359
  async getChanges(e, { since: t = null, until: s = null, changeType: r = null } = {}) {
1360
1360
  let n = `/memory/temporal/${e}/changes`;
1361
- const a = [];
1362
- return t && a.push(`since=${t}`), s && a.push(`until=${s}`), r && a.push(`change_type=${r}`), a.length && (n += `?${a.join("&")}`), this.api.get(n);
1361
+ const i = [];
1362
+ return t && i.push(`since=${t}`), s && i.push(`until=${s}`), r && i.push(`change_type=${r}`), i.length && (n += `?${i.join("&")}`), this.api.get(n);
1363
1363
  }
1364
1364
  // === VERSION COMPARISON ===
1365
1365
  /**
@@ -1395,9 +1395,9 @@ class V {
1395
1395
  * @param {string} [options.endTime]
1396
1396
  */
1397
1397
  async getAuditTrail(e, { changeType: t = null, userId: s = null, startTime: r = null, endTime: n = null } = {}) {
1398
- let a = `/memory/temporal/${e}/audit`;
1399
- const c = [];
1400
- return t && c.push(`change_type=${t}`), s && c.push(`user_id=${s}`), r && c.push(`start_time=${r}`), n && c.push(`end_time=${n}`), c.length && (a += `?${c.join("&")}`), this.api.get(a);
1398
+ let i = `/memory/temporal/${e}/audit`;
1399
+ const o = [];
1400
+ return t && o.push(`change_type=${t}`), s && o.push(`user_id=${s}`), r && o.push(`start_time=${r}`), n && o.push(`end_time=${n}`), o.length && (i += `?${o.join("&")}`), this.api.get(i);
1401
1401
  }
1402
1402
  // === TEMPORAL SEARCH ===
1403
1403
  /**
@@ -1428,8 +1428,8 @@ class V {
1428
1428
  async complianceReport(e, t, { reportType: s = "HIPAA", itemIds: r = null } = {}) {
1429
1429
  let n = `/memory/temporal/compliance/report?start_date=${e}&end_date=${t}&report_type=${s}`;
1430
1430
  if (r && r.length)
1431
- for (const a of r)
1432
- n += `&item_ids=${encodeURIComponent(a)}`;
1431
+ for (const i of r)
1432
+ n += `&item_ids=${encodeURIComponent(i)}`;
1433
1433
  return this.api.get(n);
1434
1434
  }
1435
1435
  // === TEMPORAL RELATIONSHIPS ===
@@ -1456,7 +1456,7 @@ class V {
1456
1456
  return this.api.get(`/memory/temporal/relationships/${e}/valid-periods`);
1457
1457
  }
1458
1458
  }
1459
- class D {
1459
+ class J {
1460
1460
  constructor(e) {
1461
1461
  this.api = e;
1462
1462
  }
@@ -1525,7 +1525,7 @@ class D {
1525
1525
  return this.api.get("/memory/governance/summary");
1526
1526
  }
1527
1527
  }
1528
- class J {
1528
+ class V {
1529
1529
  constructor(e) {
1530
1530
  this.api = e;
1531
1531
  }
@@ -1595,14 +1595,14 @@ class W {
1595
1595
  * @param {boolean} [params.useWikipedia=true]
1596
1596
  * @param {boolean} [params.useLlm=true]
1597
1597
  */
1598
- async resolve({ existingItemId: e, newFact: t, autoResolve: s = !0, strategy: r = null, useWikipedia: n = !0, useLlm: a = !0 }) {
1598
+ async resolve({ existingItemId: e, newFact: t, autoResolve: s = !0, strategy: r = null, useWikipedia: n = !0, useLlm: i = !0 }) {
1599
1599
  return this.api.post("/memory/reasoning/resolve", {
1600
1600
  existing_item_id: e,
1601
1601
  new_fact: t,
1602
1602
  auto_resolve: s,
1603
1603
  strategy: r,
1604
1604
  use_wikipedia: n,
1605
- use_llm: a
1605
+ use_llm: i
1606
1606
  });
1607
1607
  }
1608
1608
  // === CONFLICT QUERIES ===
@@ -2107,8 +2107,188 @@ class Z {
2107
2107
  async resolveHitl(e, { action: t, note: s = null }) {
2108
2108
  return this.api.post(`/memory/ontology/hitl/${e}/resolve`, { action: t, note: s });
2109
2109
  }
2110
+ // --- ONTO-CRUD-1 read / audit / migration surface -------------------------
2111
+ /**
2112
+ * List ontology types, keyset-paginated.
2113
+ * @param {Object} [options]
2114
+ * @param {string} [options.tier] working|proposed|confirmed|retired
2115
+ * @param {string} [options.layer] public|domain|private
2116
+ * @param {string} [options.packId] filter by originating pack id
2117
+ * @param {boolean} [options.hasIri] only types with (or without) an IRI
2118
+ * @param {number} [options.limit=100]
2119
+ * @param {string} [options.cursor] opaque keyset continuation token
2120
+ */
2121
+ async listTypes({ tier: e, layer: t, packId: s, hasIri: r, limit: n = 100, cursor: i } = {}) {
2122
+ const o = { limit: String(n) };
2123
+ e !== void 0 && (o.tier = e), t !== void 0 && (o.layer = t), s !== void 0 && (o.pack_id = s), r !== void 0 && (o.has_iri = String(r)), i !== void 0 && (o.cursor = i);
2124
+ const c = new URLSearchParams(o).toString();
2125
+ return this.api.get(`/memory/ontology/types${c ? "?" + c : ""}`);
2126
+ }
2127
+ /**
2128
+ * List ontology relation types, keyset-paginated. Mirror of `listTypes`.
2129
+ * @param {Object} [options]
2130
+ * @param {string} [options.tier] working|proposed|confirmed|retired
2131
+ * @param {string} [options.layer] public|domain|private
2132
+ * @param {string} [options.packId] filter by originating pack id
2133
+ * @param {boolean} [options.hasIri] only relations with (or without) an IRI
2134
+ * @param {number} [options.limit=100]
2135
+ * @param {string} [options.cursor] opaque keyset continuation token
2136
+ */
2137
+ async listRelations({ tier: e, layer: t, packId: s, hasIri: r, limit: n = 100, cursor: i } = {}) {
2138
+ const o = { limit: String(n) };
2139
+ e !== void 0 && (o.tier = e), t !== void 0 && (o.layer = t), s !== void 0 && (o.pack_id = s), r !== void 0 && (o.has_iri = String(r)), i !== void 0 && (o.cursor = i);
2140
+ const c = new URLSearchParams(o).toString();
2141
+ return this.api.get(`/memory/ontology/relations${c ? "?" + c : ""}`);
2142
+ }
2143
+ /**
2144
+ * Resolve a single ontology type by iri/qid/name.
2145
+ * @param {string} typeId
2146
+ */
2147
+ async getType(e) {
2148
+ return this.api.get(`/memory/ontology/types/${encodeURIComponent(e)}`);
2149
+ }
2150
+ /**
2151
+ * Resolve a single ontology relation type by its identity (iri -> pid -> name).
2152
+ * @param {string} relationId
2153
+ */
2154
+ async getRelation(e) {
2155
+ return this.api.get(`/memory/ontology/relations/${encodeURIComponent(e)}`);
2156
+ }
2157
+ /**
2158
+ * Cross-entity, newest-first ontology audit feed.
2159
+ * @param {Object} [options]
2160
+ * @param {string} [options.actor]
2161
+ * @param {string} [options.action] e.g. migrate, retire
2162
+ * @param {string} [options.since] full ISO-8601 lower bound (inclusive)
2163
+ * @param {string} [options.until] full ISO-8601 upper bound (inclusive)
2164
+ * @param {number} [options.limit=200]
2165
+ */
2166
+ async listAudit({ actor: e, action: t, since: s, until: r, limit: n = 200 } = {}) {
2167
+ const i = { limit: String(n) };
2168
+ e !== void 0 && (i.actor = e), t !== void 0 && (i.action = t), s !== void 0 && (i.since = s), r !== void 0 && (i.until = r);
2169
+ const o = new URLSearchParams(i).toString();
2170
+ return this.api.get(`/memory/ontology/audit${o ? "?" + o : ""}`);
2171
+ }
2172
+ /**
2173
+ * Full append-only audit trail for one ontology type (oldest-first).
2174
+ * @param {string} typeId
2175
+ */
2176
+ async getTypeAudit(e) {
2177
+ return this.api.get(`/memory/ontology/types/${encodeURIComponent(e)}/audit`);
2178
+ }
2179
+ /**
2180
+ * Full append-only audit trail for one ontology relation (oldest-first).
2181
+ * @param {string} relationId
2182
+ */
2183
+ async getRelationAudit(e) {
2184
+ return this.api.get(`/memory/ontology/relations/${encodeURIComponent(e)}/audit`);
2185
+ }
2186
+ /**
2187
+ * Full append-only audit trail for a pack (oldest-first), optionally version-scoped.
2188
+ * @param {string} packId
2189
+ * @param {Object} [options]
2190
+ * @param {string} [options.packVersion] scope to one installed version; omit for all
2191
+ */
2192
+ async getPackAudit(e, { packVersion: t = null } = {}) {
2193
+ const s = {};
2194
+ t !== null && (s.pack_version = t);
2195
+ const r = new URLSearchParams(s).toString();
2196
+ return this.api.get(`/memory/ontology/packs/${encodeURIComponent(e)}/audit${r ? "?" + r : ""}`);
2197
+ }
2198
+ /**
2199
+ * Reclassify every instance of `fromId` onto `toId`. Both types stay live.
2200
+ * @param {string} fromId
2201
+ * @param {string} toId
2202
+ * @param {Object} params
2203
+ * @param {string} params.reason why the migration is being performed (audit evidence)
2204
+ * @param {number} [params.batchSize=500] instance edges rewritten per chunk
2205
+ */
2206
+ async migrateTypeInstances(e, t, { reason: s, batchSize: r = 500 }) {
2207
+ return this.api.post(
2208
+ `/memory/ontology/types/${encodeURIComponent(e)}/migrate-to/${encodeURIComponent(t)}`,
2209
+ { reason: s, batch_size: r }
2210
+ );
2211
+ }
2212
+ // --- ONTO-HITL-CURATE-1 curation queue surface ---------------------------
2213
+ /**
2214
+ * List ontology review queue items, keyset-paginated.
2215
+ * @param {Object} [options]
2216
+ * @param {string} [options.tier] working|proposed
2217
+ * @param {string} [options.assignee] filter by review assignee
2218
+ * @param {string} [options.source] filter by source string
2219
+ * @param {number} [options.limit=100]
2220
+ * @param {string} [options.cursor] opaque keyset continuation token
2221
+ */
2222
+ async listReviewQueue({ tier: e, assignee: t, source: s, limit: r = 100, cursor: n } = {}) {
2223
+ const i = { limit: String(r) };
2224
+ e !== void 0 && (i.tier = e), t !== void 0 && (i.assignee = t), s !== void 0 && (i.source = s), n !== void 0 && (i.cursor = n);
2225
+ const o = new URLSearchParams(i).toString();
2226
+ return this.api.get(`/memory/ontology/queue${o ? "?" + o : ""}`);
2227
+ }
2228
+ /**
2229
+ * Approve one ontology review type.
2230
+ * @param {string} typeId private-layer ontology type name
2231
+ * @param {Object} [options]
2232
+ * @param {string} [options.expectedTier] optional optimistic tier precondition
2233
+ */
2234
+ async approveReviewType(e, { expectedTier: t } = {}) {
2235
+ const s = {};
2236
+ return t !== void 0 && (s.expected_tier = t), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/approve`, s);
2237
+ }
2238
+ /**
2239
+ * Reject one ontology review type.
2240
+ * @param {string} typeId private-layer ontology type name
2241
+ * @param {Object} [options]
2242
+ * @param {string} [options.expectedTier] optional optimistic tier precondition
2243
+ */
2244
+ async rejectReviewType(e, { expectedTier: t } = {}) {
2245
+ const s = {};
2246
+ return t !== void 0 && (s.expected_tier = t), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/reject`, s);
2247
+ }
2248
+ /**
2249
+ * Merge one ontology review type into another type.
2250
+ * @param {string} typeId private-layer ontology type name being reviewed
2251
+ * @param {string} intoId destination type identifier
2252
+ * @param {Object} [options]
2253
+ * @param {string} [options.expectedTier] optional optimistic tier precondition
2254
+ */
2255
+ async mergeReviewType(e, t, { expectedTier: s } = {}) {
2256
+ const r = { into_id: t };
2257
+ return s !== void 0 && (r.expected_tier = s), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/merge`, r);
2258
+ }
2259
+ /**
2260
+ * Edit and promote one ontology review type.
2261
+ * @param {string} typeId private-layer ontology type name being reviewed
2262
+ * @param {Object} edits edit payload accepted by the service
2263
+ * @param {Object} [options]
2264
+ * @param {string} [options.expectedTier] optional optimistic tier precondition
2265
+ */
2266
+ async editPromoteReviewType(e, t, { expectedTier: s } = {}) {
2267
+ const r = { edits: t };
2268
+ return s !== void 0 && (r.expected_tier = s), this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/edit-promote`, r);
2269
+ }
2270
+ /**
2271
+ * Assign or clear the reviewer for one ontology review type.
2272
+ * @param {string} typeId private-layer ontology type name being reviewed
2273
+ * @param {string|null} assignee reviewer identifier, or null to clear assignment
2274
+ */
2275
+ async assignReviewer(e, t) {
2276
+ return this.api.post(`/memory/ontology/queue/${encodeURIComponent(e)}/assign`, { assignee: t });
2277
+ }
2278
+ /**
2279
+ * Apply a curation action to many ontology review types.
2280
+ * @param {string} action approve|reject|merge|edit_promote|assign
2281
+ * @param {string[]} ids private-layer ontology type names to process
2282
+ * @param {Object} [options]
2283
+ * @param {Object} [options.params] action-specific params
2284
+ * @param {string} [options.expectedTier] optional optimistic tier precondition
2285
+ */
2286
+ async bulkReviewAction(e, t, { params: s, expectedTier: r } = {}) {
2287
+ const n = { action: e, ids: t, params: s === void 0 ? {} : s };
2288
+ return r !== void 0 && (n.expected_tier = r), this.api.post("/memory/ontology/queue/bulk", n);
2289
+ }
2110
2290
  }
2111
- class X {
2291
+ class Q {
2112
2292
  constructor(e) {
2113
2293
  this.api = e;
2114
2294
  }
@@ -2137,7 +2317,7 @@ class X {
2137
2317
  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);
2138
2318
  }
2139
2319
  }
2140
- class Q {
2320
+ class X {
2141
2321
  constructor(e) {
2142
2322
  this.api = e;
2143
2323
  }
@@ -2688,9 +2868,9 @@ class ae {
2688
2868
  }
2689
2869
  class ce {
2690
2870
  constructor(e) {
2691
- this.auth = new M(e);
2692
- const t = new L(this.auth, { fetchFn: e.fetchFn });
2693
- this.memories = new z(t), this.decisions = new E(t), this.opinions = new x(t), this.graph = new q(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 V(t), this.governance = new D(t), this.evolution = new J(t), this.reasoning = new W(t), this.reasoningTraces = new Y(t), this.ontology = new Z(t), this.analytics = new X(t), this.validation = new Q(t), this.pipeline = new ee(t), this.archive = new te(t), this.zettelkasten = new se(t), this.procedureMatches = new re(t), this.procedureCandidates = new ne(t), this.procedureDrift = new ie(t), this.summaries = new ae(t);
2871
+ 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);
2694
2874
  }
2695
2875
  setTeamId(e) {
2696
2876
  this.auth.tokenManager.setTeamId(e), this.auth.notifyListeners();
@@ -2701,34 +2881,34 @@ class ce {
2701
2881
  }
2702
2882
  export {
2703
2883
  g as A,
2704
- L as B,
2705
- E as D,
2706
- J as E,
2707
- D as G,
2884
+ q as B,
2885
+ z as D,
2886
+ V as E,
2887
+ J as G,
2708
2888
  G as I,
2709
- z as M,
2889
+ M,
2710
2890
  Z as O,
2711
2891
  ee as P,
2712
2892
  W as R,
2713
2893
  ce as S,
2714
2894
  O as T,
2715
2895
  B as U,
2716
- Q as V,
2896
+ X as V,
2717
2897
  se as Z,
2718
2898
  K as a,
2719
- X as b,
2899
+ Q as b,
2720
2900
  te as c,
2721
2901
  H as d,
2722
- M as e,
2723
- q as f,
2724
- x as g,
2902
+ L as e,
2903
+ x as f,
2904
+ E as g,
2725
2905
  ne as h,
2726
2906
  re as i,
2727
2907
  j,
2728
2908
  Y as k,
2729
2909
  F as l,
2730
- V as m,
2731
- U as n,
2910
+ D as m,
2911
+ A as n,
2732
2912
  N as o,
2733
2913
  P as p,
2734
2914
  C as q
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-C_2OxSk3.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-BWFexoX-.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-C_2OxSk3.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-BWFexoX-.js";
2
2
  const i = {
3
3
  variables: {
4
4
  colorBackground: "transparent",
package/dist/progress.js CHANGED
@@ -38,21 +38,21 @@ function P(r, n, t) {
38
38
  if (s.length === 0)
39
39
  t == null || t(e), e = A();
40
40
  else if (i > 0) {
41
- const a = o.decode(s.subarray(0, i)), c = i + (s[i + 1] === 32 ? 2 : 1), l = o.decode(s.subarray(c));
41
+ const a = o.decode(s.subarray(0, i)), c = i + (s[i + 1] === 32 ? 2 : 1), d = o.decode(s.subarray(c));
42
42
  switch (a) {
43
43
  case "data":
44
44
  e.data = e.data ? e.data + `
45
- ` + l : l;
45
+ ` + d : d;
46
46
  break;
47
47
  case "event":
48
- e.event = l;
48
+ e.event = d;
49
49
  break;
50
50
  case "id":
51
- r(e.id = l);
51
+ r(e.id = d);
52
52
  break;
53
53
  case "retry":
54
- const f = parseInt(l, 10);
55
- isNaN(f) || n(e.retry = f);
54
+ const u = parseInt(d, 10);
55
+ isNaN(u) || n(e.retry = u);
56
56
  break;
57
57
  }
58
58
  }
@@ -79,111 +79,113 @@ var j = function(r, n) {
79
79
  return t;
80
80
  };
81
81
  const k = "text/event-stream", x = 1e3, I = "last-event-id";
82
- function N(r, n) {
83
- var { signal: t, headers: e, onopen: o, onmessage: g, onclose: s, onerror: i, openWhenHidden: a, fetch: c } = n, l = j(n, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
84
- return new Promise((f, E) => {
85
- const y = Object.assign({}, e);
86
- y.accept || (y.accept = k);
87
- let v;
88
- function h() {
89
- v.abort(), document.hidden || O();
82
+ function C(r, n) {
83
+ var { signal: t, headers: e, onopen: o, onmessage: E, onclose: s, onerror: i, openWhenHidden: a, fetch: c } = n, d = j(n, ["signal", "headers", "onopen", "onmessage", "onclose", "onerror", "openWhenHidden", "fetch"]);
84
+ return new Promise((u, S) => {
85
+ const b = Object.assign({}, e);
86
+ b.accept || (b.accept = k);
87
+ let p;
88
+ function y() {
89
+ p.abort(), document.hidden || m();
90
90
  }
91
- a || document.addEventListener("visibilitychange", h);
92
- let d = x, b = 0;
93
- function u() {
94
- document.removeEventListener("visibilitychange", h), window.clearTimeout(b), v.abort();
91
+ a || document.addEventListener("visibilitychange", y);
92
+ let w = x, l = 0;
93
+ function f() {
94
+ document.removeEventListener("visibilitychange", y), window.clearTimeout(l), p.abort();
95
95
  }
96
96
  t == null || t.addEventListener("abort", () => {
97
- u(), f();
97
+ f(), u();
98
98
  });
99
- const w = c ?? window.fetch, m = o ?? $;
100
- async function O() {
99
+ const v = c ?? window.fetch, g = o ?? N;
100
+ async function m() {
101
101
  var T;
102
- v = new AbortController();
102
+ p = new AbortController();
103
103
  try {
104
- const S = await w(r, Object.assign(Object.assign({}, l), { headers: y, signal: v.signal }));
105
- await m(S), await _(S.body, R(P((p) => {
106
- p ? y[I] = p : delete y[I];
107
- }, (p) => {
108
- d = p;
109
- }, g))), s == null || s(), u(), f();
110
- } catch (S) {
111
- if (!v.signal.aborted)
104
+ const O = await v(r, Object.assign(Object.assign({}, d), { headers: b, signal: p.signal }));
105
+ await g(O), await _(O.body, R(P((h) => {
106
+ h ? b[I] = h : delete b[I];
107
+ }, (h) => {
108
+ w = h;
109
+ }, E))), s == null || s(), f(), u();
110
+ } catch (O) {
111
+ if (!p.signal.aborted)
112
112
  try {
113
- const p = (T = i == null ? void 0 : i(S)) !== null && T !== void 0 ? T : d;
114
- window.clearTimeout(b), b = window.setTimeout(O, p);
115
- } catch (p) {
116
- u(), E(p);
113
+ const h = (T = i == null ? void 0 : i(O)) !== null && T !== void 0 ? T : w;
114
+ window.clearTimeout(l), l = window.setTimeout(m, h);
115
+ } catch (h) {
116
+ f(), S(h);
117
117
  }
118
118
  }
119
119
  }
120
- O();
120
+ m();
121
121
  });
122
122
  }
123
- function $(r) {
123
+ function N(r) {
124
124
  const n = r.headers.get("content-type");
125
125
  if (!(n != null && n.startsWith(k)))
126
126
  throw new Error(`Expected content-type to be ${k}, Actual: ${n}`);
127
127
  }
128
- const C = "/memory/progress/stream", H = 3, W = 1e3, q = /* @__PURE__ */ new Set([401, 403, 404]);
128
+ const $ = "/memory/progress/stream", H = 3, W = 1e3, q = /* @__PURE__ */ new Set([401, 403, 404]);
129
129
  function U(r) {
130
130
  const {
131
131
  baseUrl: n = "",
132
132
  token: t,
133
133
  apiKey: e,
134
134
  workspaceId: o,
135
- runId: g,
135
+ runId: E,
136
136
  fromSeq: s,
137
137
  since: i,
138
- onEvent: a,
139
- onError: c,
140
- onReconnect: l
141
- } = r, f = new URLSearchParams();
142
- g !== void 0 && f.set("run_id", g), s !== void 0 && f.set("from_seq", String(s)), i !== void 0 && f.set("since", i);
143
- const E = f.toString(), y = `${n}${C}${E ? "?" + E : ""}`, v = {
138
+ useCookieAuth: a = !1,
139
+ onEvent: c,
140
+ onError: d,
141
+ onReconnect: u
142
+ } = r, S = new URLSearchParams();
143
+ E !== void 0 && S.set("run_id", E), s !== void 0 && S.set("from_seq", String(s)), i !== void 0 && S.set("since", i);
144
+ const b = S.toString(), p = `${n}${$}${b ? "?" + b : ""}`, y = {
144
145
  Accept: "text/event-stream"
145
146
  };
146
- t ? v.Authorization = `Bearer ${t}` : e && (v["X-API-Key"] = e), o && (v["X-Workspace-Id"] = o);
147
- const h = new AbortController();
148
- let d = !1, b = 0;
149
- return N(y, {
150
- headers: v,
151
- signal: h.signal,
147
+ t ? y.Authorization = `Bearer ${t}` : e && (y["X-API-Key"] = e), o && (y["X-Workspace-Id"] = o);
148
+ const w = new AbortController();
149
+ let l = !1, f = 0;
150
+ return C(p, {
151
+ headers: y,
152
+ signal: w.signal,
152
153
  openWhenHidden: !0,
153
- async onopen(u) {
154
- if (u.ok) {
155
- b = 0;
154
+ ...a && !t && !e ? { credentials: "include" } : {},
155
+ async onopen(v) {
156
+ if (v.ok) {
157
+ f = 0;
156
158
  return;
157
159
  }
158
- const w = u.status, m = new Error(`SSE connection failed: HTTP ${w}`);
159
- throw q.has(w) && (d = !0, c(m), h.abort()), m;
160
+ const g = v.status, m = new Error(`SSE connection failed: HTTP ${g}`);
161
+ throw q.has(g) && (l = !0, d(m), w.abort()), m;
160
162
  },
161
- onmessage(u) {
162
- if (d || !u.data) return;
163
- b = 0;
164
- let w;
163
+ onmessage(v) {
164
+ if (l || !v.data) return;
165
+ f = 0;
166
+ let g;
165
167
  try {
166
- w = JSON.parse(u.data);
168
+ g = JSON.parse(v.data);
167
169
  } catch {
168
170
  return;
169
171
  }
170
- a(w);
172
+ c(g);
171
173
  },
172
- onerror(u) {
173
- if (!d) {
174
- if (b += 1, b >= H) {
175
- c(u), d = !0, h.abort();
174
+ onerror(v) {
175
+ if (!l) {
176
+ if (f += 1, f >= H) {
177
+ d(v), l = !0, w.abort();
176
178
  return;
177
179
  }
178
- return l == null || l(), W * b;
180
+ return u == null || u(), W * f;
179
181
  }
180
182
  },
181
183
  onclose() {
182
- d || (d = !0, c(new Error("SSE connection closed by server")));
184
+ l || (l = !0, d(new Error("SSE connection closed by server")));
183
185
  }
184
186
  }), {
185
187
  close() {
186
- d || (d = !0, h.abort());
188
+ l || (l = !0, w.abort());
187
189
  }
188
190
  };
189
191
  }
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-C_2OxSk3.js";
2
+ import { S as x } from "./core-BWFexoX-.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.43",
3
+ "version": "1.4.45",
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",