korely-memory 0.1.7 → 0.1.9
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/README.md +79 -0
- package/dist/ai-sdk.cjs +361 -0
- package/dist/ai-sdk.d.cts +156 -0
- package/dist/ai-sdk.d.ts +156 -0
- package/dist/ai-sdk.js +334 -0
- package/dist/index.cjs +21 -9
- package/dist/index.d.cts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +18 -6
- package/package.json +25 -2
package/dist/index.js
CHANGED
|
@@ -53,7 +53,7 @@ var QuotaExceededError = class _QuotaExceededError extends APIError {
|
|
|
53
53
|
};
|
|
54
54
|
|
|
55
55
|
// src/client.ts
|
|
56
|
-
var VERSION = "0.1.
|
|
56
|
+
var VERSION = "0.1.9";
|
|
57
57
|
var REGIONS = { eu: "https://api.korely.ai" };
|
|
58
58
|
function coerceContent(content) {
|
|
59
59
|
if (typeof content === "string") return content;
|
|
@@ -76,6 +76,9 @@ function coerceContent(content) {
|
|
|
76
76
|
return String(content);
|
|
77
77
|
}
|
|
78
78
|
function seg(value, what) {
|
|
79
|
+
if (value != null && typeof value !== "string" && !(typeof value === "number" && Number.isInteger(value))) {
|
|
80
|
+
throw new KorelyError(`${what} must be a string id, not ${Array.isArray(value) ? "an array" : `a ${typeof value}`}.`);
|
|
81
|
+
}
|
|
79
82
|
const s = value == null ? "" : String(value);
|
|
80
83
|
if (!s) throw new KorelyError(`${what} is empty.`);
|
|
81
84
|
return encodeURIComponent(s);
|
|
@@ -140,6 +143,11 @@ function refuseAMismatchedPair(apiKey, baseUrl) {
|
|
|
140
143
|
}
|
|
141
144
|
var Korely = class {
|
|
142
145
|
constructor(opts = {}) {
|
|
146
|
+
if (opts && Object.prototype.hasOwnProperty.call(opts, "base_url")) {
|
|
147
|
+
throw new KorelyError(
|
|
148
|
+
"Unknown option base_url: the JavaScript SDK takes baseUrl (new Korely({ baseUrl: 'https://...' })) or the KORELY_BASE_URL env var."
|
|
149
|
+
);
|
|
150
|
+
}
|
|
143
151
|
const envKey = typeof process !== "undefined" ? process.env?.KORELY_API_KEY : void 0;
|
|
144
152
|
const key = opts.apiKey ?? envKey;
|
|
145
153
|
if (!key) {
|
|
@@ -527,13 +535,17 @@ var Korely = class {
|
|
|
527
535
|
* GET /v1/context: one call that assembles a prompt-ready context block
|
|
528
536
|
* (profile + relevant facts + memories) within a token budget.
|
|
529
537
|
*/
|
|
530
|
-
async getContext(opts) {
|
|
538
|
+
async getContext(opts, extra = {}) {
|
|
539
|
+
const o = typeof opts === "string" ? { ...extra, query: opts } : opts;
|
|
540
|
+
if (!o || typeof o.query !== "string" || !o.query.trim()) {
|
|
541
|
+
throw new KorelyError("getContext needs a query.");
|
|
542
|
+
}
|
|
531
543
|
return this.request("GET", "/v1/context", {
|
|
532
544
|
params: {
|
|
533
|
-
query:
|
|
534
|
-
user_id:
|
|
535
|
-
agent_id:
|
|
536
|
-
token_budget:
|
|
545
|
+
query: o.query,
|
|
546
|
+
user_id: o.user_id,
|
|
547
|
+
agent_id: o.agent_id,
|
|
548
|
+
token_budget: o.token_budget ?? 800
|
|
537
549
|
}
|
|
538
550
|
});
|
|
539
551
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "korely-memory",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.9",
|
|
4
4
|
"description": "JavaScript / TypeScript SDK for Korely Agents: memory for AI agents with bi-temporal typed facts.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"ai",
|
|
@@ -9,7 +9,9 @@
|
|
|
9
9
|
"llm",
|
|
10
10
|
"rag",
|
|
11
11
|
"knowledge-graph",
|
|
12
|
-
"typescript"
|
|
12
|
+
"typescript",
|
|
13
|
+
"vercel-ai-sdk",
|
|
14
|
+
"ai-sdk"
|
|
13
15
|
],
|
|
14
16
|
"homepage": "https://korely.ai/agents",
|
|
15
17
|
"repository": {
|
|
@@ -31,6 +33,18 @@
|
|
|
31
33
|
"types": "./dist/index.d.ts",
|
|
32
34
|
"import": "./dist/index.js",
|
|
33
35
|
"require": "./dist/index.cjs"
|
|
36
|
+
},
|
|
37
|
+
"./ai-sdk": {
|
|
38
|
+
"types": "./dist/ai-sdk.d.ts",
|
|
39
|
+
"import": "./dist/ai-sdk.js",
|
|
40
|
+
"require": "./dist/ai-sdk.cjs"
|
|
41
|
+
}
|
|
42
|
+
},
|
|
43
|
+
"typesVersions": {
|
|
44
|
+
"*": {
|
|
45
|
+
"ai-sdk": [
|
|
46
|
+
"./dist/ai-sdk.d.ts"
|
|
47
|
+
]
|
|
34
48
|
}
|
|
35
49
|
},
|
|
36
50
|
"files": [
|
|
@@ -48,8 +62,17 @@
|
|
|
48
62
|
"prepublishOnly": "npm run build"
|
|
49
63
|
},
|
|
50
64
|
"dependencies": {},
|
|
65
|
+
"peerDependencies": {
|
|
66
|
+
"ai": "^5.0.0 || ^6.0.0 || ^7.0.0"
|
|
67
|
+
},
|
|
68
|
+
"peerDependenciesMeta": {
|
|
69
|
+
"ai": {
|
|
70
|
+
"optional": true
|
|
71
|
+
}
|
|
72
|
+
},
|
|
51
73
|
"devDependencies": {
|
|
52
74
|
"@types/node": "^22.9.0",
|
|
75
|
+
"ai": "^7.0.127",
|
|
53
76
|
"tsup": "^8.3.5",
|
|
54
77
|
"typescript": "^5.6.3"
|
|
55
78
|
}
|