@llmnative/agentico 0.28.3 → 0.30.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +326 -241
- package/dist/index.mjs.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +39 -11
- package/dist/server.mjs.map +1 -1
- package/dist/types/backend/agenticoBackend.d.ts +10 -0
- package/dist/types/i18n/types.d.ts +7 -2
- package/dist/types/index.d.ts +1 -1
- package/dist/types/presentation/AgenticoConnectionsSettings.d.ts +1 -1
- package/dist/types/presentation/hostName.d.ts +1 -0
- package/dist/types/server/connections.d.ts +2 -0
- package/dist/types/server/memories.d.ts +14 -1
- package/dist/types/server/server.d.ts +3 -0
- package/package.json +4 -4
package/dist/server.mjs
CHANGED
|
@@ -113,6 +113,12 @@ function S(e) {
|
|
|
113
113
|
let i = await a(e), s = i.providers.find((e) => e.id === t);
|
|
114
114
|
s && (await n.delete(y(e, t, r)), s.accounts = s.accounts.filter((e) => e.id !== r), s.accounts.length || (i.providers = i.providers.filter((e) => e.id !== t)), await o(i));
|
|
115
115
|
},
|
|
116
|
+
async renameAccount(e, t, n, r) {
|
|
117
|
+
let i = await a(e), s = i.providers.find((e) => e.id === t)?.accounts.find((e) => e.id === n);
|
|
118
|
+
if (!s) return;
|
|
119
|
+
let c = String(r ?? "").trim().slice(0, 100);
|
|
120
|
+
c ? s.label = c : delete s.label, await o(i);
|
|
121
|
+
},
|
|
116
122
|
async orderAccounts(e, t, n) {
|
|
117
123
|
let r = await a(e), i = r.providers.find((e) => e.id === t);
|
|
118
124
|
if (!i) return;
|
|
@@ -275,19 +281,24 @@ function O(e) {
|
|
|
275
281
|
return m;
|
|
276
282
|
},
|
|
277
283
|
async update(e, r, i) {
|
|
278
|
-
let a = await u.of(e, i);
|
|
279
|
-
if (r.key?.trim()) {
|
|
280
|
-
let t = await
|
|
281
|
-
|
|
282
|
-
|
|
284
|
+
let a = await u.of(e, i), o = r.apiUrl?.trim() ? D(r.apiUrl, !0) : a.apiUrl;
|
|
285
|
+
if (r.key?.trim() || o !== a.apiUrl) {
|
|
286
|
+
let t = r.key?.trim() || await n.get(E(e));
|
|
287
|
+
if (!t) throw new T("not-found", "KEY_NOT_FOUND");
|
|
288
|
+
let i = await u.check({
|
|
289
|
+
apiUrl: o,
|
|
290
|
+
key: t
|
|
283
291
|
});
|
|
284
|
-
if (!
|
|
285
|
-
await n.set(E(e), r.key.trim());
|
|
292
|
+
if (!i.ok) throw new T(i.error === "invalid" ? "invalid" : i.error, i.error.toUpperCase());
|
|
293
|
+
r.key?.trim() && await n.set(E(e), r.key.trim());
|
|
286
294
|
}
|
|
287
|
-
let
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
295
|
+
let s = {
|
|
296
|
+
...a,
|
|
297
|
+
apiUrl: o
|
|
298
|
+
};
|
|
299
|
+
typeof r.name == "string" && r.name.trim() && (s.name = r.name.trim().slice(0, 100)), r.mcpUrl === null || r.mcpUrl === "" ? delete s.mcpUrl : typeof r.mcpUrl == "string" && (s.mcpUrl = D(r.mcpUrl, !1)), await t.put(C, s);
|
|
300
|
+
let { createdAt: c, ...l } = s;
|
|
301
|
+
return l;
|
|
291
302
|
},
|
|
292
303
|
async remove(e, r, i) {
|
|
293
304
|
let a = await u.of(e, i);
|
|
@@ -322,6 +333,20 @@ function O(e) {
|
|
|
322
333
|
createdAt: e.createdAt ?? a()
|
|
323
334
|
});
|
|
324
335
|
},
|
|
336
|
+
async namespaces(e, t) {
|
|
337
|
+
await u.of(e, t);
|
|
338
|
+
let { record: n, key: r } = await l(e), i = await s(n.apiUrl, r, "GET", "/ns");
|
|
339
|
+
if (!i.ok) throw new T(i.status === 401 || i.status === 403 ? "rejected" : "unreachable", `MEMORY_${i.status}`);
|
|
340
|
+
return ((await i.json().catch(() => ({}))).namespaces ?? []).filter((e) => typeof e.namespace == "string").map((e) => {
|
|
341
|
+
let t = e.system && typeof e.system == "object" ? e.system : {};
|
|
342
|
+
return {
|
|
343
|
+
namespace: e.namespace,
|
|
344
|
+
documents: Number(e.documentCount) || 0,
|
|
345
|
+
memories: Number(e.memoryCount) || 0,
|
|
346
|
+
...typeof t.createdAt == "string" ? { createdAt: t.createdAt } : {}
|
|
347
|
+
};
|
|
348
|
+
}).sort((e, t) => e.namespace.localeCompare(t.namespace));
|
|
349
|
+
},
|
|
325
350
|
async keyOf(e) {
|
|
326
351
|
return n.get(E(e));
|
|
327
352
|
},
|
|
@@ -843,6 +868,7 @@ function ie(e) {
|
|
|
843
868
|
return await o.orderAccounts(e, b, Array.isArray(n) ? n.map(String) : []), $(200, { ok: !0 });
|
|
844
869
|
}
|
|
845
870
|
if (b && x === "accounts" && S && C === "DELETE") return await o.removeAccount(e, b, S), $(200, { ok: !0 });
|
|
871
|
+
if (b && x === "accounts" && S && S !== "order" && C === "PATCH") return await o.renameAccount(e, b, S, String((await f(t)).label ?? "")), $(200, { ok: !0 });
|
|
846
872
|
}
|
|
847
873
|
if (y === "ai" && b === "complete" && C === "POST") {
|
|
848
874
|
let e = await f(t), n = String(e.provider ?? ""), a = await o.complete(M(w, r.tenant), n, e.request).catch((e) => {
|
|
@@ -990,10 +1016,12 @@ function ie(e) {
|
|
|
990
1016
|
by: r.user.id
|
|
991
1017
|
}), $(201, { memory: a });
|
|
992
1018
|
}
|
|
1019
|
+
if (b && x === "namespaces" && C === "GET") return $(200, { namespaces: await s.namespaces(b, e) });
|
|
993
1020
|
if (b && C === "PATCH") {
|
|
994
1021
|
let n = await f(t);
|
|
995
1022
|
return $(200, { memory: await s.update(b, {
|
|
996
1023
|
...typeof n.name == "string" ? { name: n.name } : {},
|
|
1024
|
+
...typeof n.apiUrl == "string" ? { apiUrl: n.apiUrl } : {},
|
|
997
1025
|
...n.mcpUrl === null || typeof n.mcpUrl == "string" ? { mcpUrl: n.mcpUrl } : {},
|
|
998
1026
|
...typeof n.key == "string" ? { key: n.key } : {}
|
|
999
1027
|
}, e) });
|