@quorex/sdk 0.1.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/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Quorex
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,100 @@
1
+ # @quorex/sdk
2
+
3
+ Official JavaScript / TypeScript SDK for **Quorex** — the memory layer for AI agents.
4
+ Store, retrieve and inject persistent user context into any LLM in one call.
5
+
6
+ Works in Node 18+, edge/serverless runtimes and the browser. Zero dependencies.
7
+
8
+ ## Install
9
+
10
+ ```bash
11
+ npm install @quorex/sdk
12
+ ```
13
+
14
+ ## Quickstart
15
+
16
+ ```ts
17
+ import { Quorex } from "@quorex/sdk";
18
+
19
+ const qx = new Quorex({ apiKey: "qx_live_..." }); // or set QUOREX_API_KEY
20
+
21
+ // Store a memory for one of your end-users
22
+ await qx.remember("user_123", "I switched to Vue.js, React feels too verbose");
23
+
24
+ // Recall the relevant context before calling your LLM
25
+ const memories = await qx.recall("user_123", "what framework does this user prefer?");
26
+ for (const m of memories) {
27
+ console.log(m.text, m.finalScore);
28
+ }
29
+ ```
30
+
31
+ Get your secret key from the [dashboard](https://quorex.fr) → API Keys.
32
+
33
+ ## Client
34
+
35
+ ```ts
36
+ new Quorex({
37
+ apiKey?: string, // or QUOREX_API_KEY env var
38
+ baseUrl?: string, // default "https://api.quorex.fr"
39
+ timeout?: number, // ms, default 30000
40
+ });
41
+ ```
42
+
43
+ ## API
44
+
45
+ | Method | Description |
46
+ | --- | --- |
47
+ | `remember(userId, text, { action?, metadata?, timestamp? })` | Store a memory → `{ vecId }` |
48
+ | `recall(userId, query, { topK?, threshold? })` | Ranked memories → `Memory[]` |
49
+ | `explain(userId, query, { topK? })` | Memories + score breakdown → `ExplainResult[]` |
50
+ | `forget(userId, vecId)` | Delete one memory → `{ deleted, vecId }` |
51
+ | `purge(userId)` | GDPR — delete all of a user's memories → `number` |
52
+ | `export(userId)` | GDPR — export all data → `ExportResult` |
53
+ | `freeze(userId)` | Stop temporal decay → `boolean` |
54
+ | `stats(userId?)` | Usage stats for the key → `Stats` |
55
+
56
+ ### Examples
57
+
58
+ ```ts
59
+ const r = await qx.remember("user_123", "prefers dark mode", { action: "preference" });
60
+ r.vecId; // 42
61
+
62
+ const explained = await qx.explain("user_123", "ui preference?");
63
+ explained[0].explanation;
64
+ explained[0].scoreBreakdown;
65
+
66
+ await qx.forget("user_123", 42);
67
+ const removed = await qx.purge("user_123");
68
+ const data = await qx.export("user_123");
69
+ await qx.freeze("user_123");
70
+ const usage = await qx.stats();
71
+ ```
72
+
73
+ ## Errors
74
+
75
+ All errors extend `QuorexError` (with a `statusCode`). Catch the specific type:
76
+
77
+ ```ts
78
+ import { Quorex, AuthenticationError, QuorexError } from "@quorex/sdk";
79
+
80
+ try {
81
+ await qx.recall("user_123", "...");
82
+ } catch (e) {
83
+ if (e instanceof AuthenticationError) console.error("Check your API key");
84
+ else if (e instanceof QuorexError) console.error("Quorex error:", e.message);
85
+ }
86
+ ```
87
+
88
+ `AuthenticationError` (401) · `NotFoundError` (404) · `RateLimitError` (429) · `ServerError` (5xx).
89
+
90
+ ## Develop
91
+
92
+ ```bash
93
+ npm install
94
+ npm run build # ESM + CJS + .d.ts in dist/
95
+ npm run typecheck
96
+ ```
97
+
98
+ ## License
99
+
100
+ MIT
package/dist/index.cjs ADDED
@@ -0,0 +1,235 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/index.ts
21
+ var index_exports = {};
22
+ __export(index_exports, {
23
+ AuthenticationError: () => AuthenticationError,
24
+ NotFoundError: () => NotFoundError,
25
+ Quorex: () => Quorex,
26
+ QuorexError: () => QuorexError,
27
+ RateLimitError: () => RateLimitError,
28
+ ServerError: () => ServerError
29
+ });
30
+ module.exports = __toCommonJS(index_exports);
31
+
32
+ // src/errors.ts
33
+ var QuorexError = class extends Error {
34
+ constructor(message, statusCode) {
35
+ super(message);
36
+ this.name = "QuorexError";
37
+ this.statusCode = statusCode;
38
+ Object.setPrototypeOf(this, new.target.prototype);
39
+ }
40
+ };
41
+ var AuthenticationError = class extends QuorexError {
42
+ constructor(message = "Invalid or missing API key.", statusCode = 401) {
43
+ super(message, statusCode);
44
+ this.name = "AuthenticationError";
45
+ }
46
+ };
47
+ var NotFoundError = class extends QuorexError {
48
+ constructor(message = "Resource not found.", statusCode = 404) {
49
+ super(message, statusCode);
50
+ this.name = "NotFoundError";
51
+ }
52
+ };
53
+ var RateLimitError = class extends QuorexError {
54
+ constructor(message = "Rate limit exceeded.", statusCode = 429) {
55
+ super(message, statusCode);
56
+ this.name = "RateLimitError";
57
+ }
58
+ };
59
+ var ServerError = class extends QuorexError {
60
+ constructor(message = "Quorex server error.", statusCode = 500) {
61
+ super(message, statusCode);
62
+ this.name = "ServerError";
63
+ }
64
+ };
65
+
66
+ // src/client.ts
67
+ var DEFAULT_BASE_URL = "https://api.quorex.fr";
68
+ var DEFAULT_TIMEOUT = 3e4;
69
+ var VERSION = "0.1.0";
70
+ function envApiKey() {
71
+ try {
72
+ return typeof process !== "undefined" ? process.env?.QUOREX_API_KEY : void 0;
73
+ } catch {
74
+ return void 0;
75
+ }
76
+ }
77
+ function toMemory(m) {
78
+ return {
79
+ vecId: m?.vec_id ?? null,
80
+ text: m?.text ?? "",
81
+ action: m?.action ?? "",
82
+ timestamp: m?.timestamp ?? null,
83
+ finalScore: m?.final_score ?? null,
84
+ cosineSim: m?.cosine_sim ?? null,
85
+ decayWeight: m?.decay_weight ?? null,
86
+ freqWeight: m?.freq_weight ?? null,
87
+ hoursAgo: m?.hours_ago ?? null,
88
+ reinforcements: m?.reinforcements ?? null,
89
+ meta: m?.meta ?? {}
90
+ };
91
+ }
92
+ var Quorex = class {
93
+ constructor(options = {}) {
94
+ const key = options.apiKey ?? envApiKey();
95
+ if (!key) {
96
+ throw new AuthenticationError(
97
+ "API key is required. Pass { apiKey } or set the QUOREX_API_KEY environment variable."
98
+ );
99
+ }
100
+ this.apiKey = key;
101
+ this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
102
+ this.timeout = options.timeout ?? DEFAULT_TIMEOUT;
103
+ }
104
+ async request(method, path, init = {}) {
105
+ const url = new URL(this.baseUrl + path);
106
+ if (init.query) {
107
+ for (const [k, v] of Object.entries(init.query)) {
108
+ if (v !== void 0 && v !== null) url.searchParams.set(k, String(v));
109
+ }
110
+ }
111
+ const controller = new AbortController();
112
+ const timer = setTimeout(() => controller.abort(), this.timeout);
113
+ let res;
114
+ try {
115
+ res = await fetch(url.toString(), {
116
+ method,
117
+ headers: {
118
+ "Content-Type": "application/json",
119
+ Authorization: `Bearer ${this.apiKey}`,
120
+ "X-Quorex-Client": `quorex-js/${VERSION}`
121
+ },
122
+ body: init.body !== void 0 ? JSON.stringify(init.body) : void 0,
123
+ signal: controller.signal
124
+ });
125
+ } catch (err) {
126
+ clearTimeout(timer);
127
+ if (err?.name === "AbortError") throw new QuorexError("Request timed out.");
128
+ throw new QuorexError(`Network error: ${err?.message ?? String(err)}`);
129
+ }
130
+ clearTimeout(timer);
131
+ return this.handle(res);
132
+ }
133
+ async handle(res) {
134
+ let data = null;
135
+ const text = await res.text();
136
+ if (text) {
137
+ try {
138
+ data = JSON.parse(text);
139
+ } catch {
140
+ data = text;
141
+ }
142
+ }
143
+ if (res.ok) return data;
144
+ const detail = data && (data.detail || data.error) || res.statusText || "Unknown error";
145
+ if (res.status === 401) throw new AuthenticationError(detail, 401);
146
+ if (res.status === 404) throw new NotFoundError(detail, 404);
147
+ if (res.status === 429) throw new RateLimitError(detail, 429);
148
+ if (res.status >= 500) throw new ServerError(detail, res.status);
149
+ throw new QuorexError(`API error (${res.status}): ${detail}`, res.status);
150
+ }
151
+ /** Store a memory for one of your end-users. */
152
+ async remember(userId, text, opts = {}) {
153
+ const data = await this.request("POST", "/sdk/v1/remember", {
154
+ body: {
155
+ user_id: userId,
156
+ text,
157
+ action: opts.action ?? "memory",
158
+ metadata: opts.metadata ?? {},
159
+ timestamp: opts.timestamp ?? Date.now() / 1e3
160
+ }
161
+ });
162
+ return { vecId: data.vec_id };
163
+ }
164
+ /** Retrieve the most relevant memories for a query, ranked by final score. */
165
+ async recall(userId, query, opts = {}) {
166
+ const data = await this.request("POST", "/sdk/v1/recall", {
167
+ body: { user_id: userId, query, top_k: opts.topK ?? 5, threshold: opts.threshold ?? 0.05 }
168
+ });
169
+ return (data.memories ?? []).map(toMemory);
170
+ }
171
+ /** Like recall(), but each result includes a human-readable score breakdown. */
172
+ async explain(userId, query, opts = {}) {
173
+ const data = await this.request("POST", "/sdk/v1/explain", {
174
+ body: { user_id: userId, query, top_k: opts.topK ?? 1 }
175
+ });
176
+ return (data.results ?? []).map((r) => ({
177
+ memory: toMemory(r),
178
+ explanation: r?.explanation ?? "",
179
+ scoreBreakdown: {
180
+ finalScore: r?.score_breakdown?.final_score,
181
+ cosineSim: r?.score_breakdown?.cosine_sim,
182
+ decayWeight: r?.score_breakdown?.decay_weight,
183
+ freqWeight: r?.score_breakdown?.freq_weight,
184
+ reinforcements: r?.score_breakdown?.reinforcements,
185
+ hoursAgo: r?.score_breakdown?.hours_ago
186
+ }
187
+ }));
188
+ }
189
+ /** Delete a single memory by its vector id. */
190
+ async forget(userId, vecId) {
191
+ const data = await this.request("DELETE", "/sdk/v1/forget", {
192
+ body: { user_id: userId, vec_id: vecId }
193
+ });
194
+ return { deleted: data.deleted ?? false, vecId };
195
+ }
196
+ /** GDPR — delete ALL memories for an end-user. Returns the count removed. */
197
+ async purge(userId) {
198
+ const data = await this.request("DELETE", "/sdk/v1/purge", {
199
+ body: { user_id: userId }
200
+ });
201
+ return data.deleted ?? 0;
202
+ }
203
+ /** GDPR — export all memories for an end-user. */
204
+ async export(userId) {
205
+ const data = await this.request("GET", "/sdk/v1/export", { query: { user_id: userId } });
206
+ return {
207
+ userId: data?.user_id ?? userId,
208
+ count: data?.count ?? (data?.memories?.length ?? 0),
209
+ memories: (data?.memories ?? []).map(toMemory)
210
+ };
211
+ }
212
+ /** Stop temporal decay for an end-user (pins their scores in time). */
213
+ async freeze(userId) {
214
+ const data = await this.request("POST", "/sdk/v1/freeze", {
215
+ body: { user_id: userId }
216
+ });
217
+ return data.frozen ?? false;
218
+ }
219
+ /** Usage statistics for the authenticated API key (optionally scoped to one user). */
220
+ async stats(userId) {
221
+ return this.request("GET", "/sdk/v1/stats", {
222
+ query: userId ? { user_id: userId } : void 0
223
+ });
224
+ }
225
+ };
226
+ // Annotate the CommonJS export names for ESM import in node:
227
+ 0 && (module.exports = {
228
+ AuthenticationError,
229
+ NotFoundError,
230
+ Quorex,
231
+ QuorexError,
232
+ RateLimitError,
233
+ ServerError
234
+ });
235
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/index.ts","../src/errors.ts","../src/client.ts"],"sourcesContent":["export { Quorex } from './client'\nexport {\n QuorexError,\n AuthenticationError,\n NotFoundError,\n RateLimitError,\n ServerError,\n} from './errors'\nexport type {\n QuorexOptions,\n Memory,\n StoreResult,\n ForgetResult,\n ScoreBreakdown,\n ExplainResult,\n ExportResult,\n Stats,\n RememberOptions,\n RecallOptions,\n ExplainOptions,\n} from './types'\n","/** Base class for all Quorex SDK errors. */\nexport class QuorexError extends Error {\n statusCode?: number\n constructor(message: string, statusCode?: number) {\n super(message)\n this.name = 'QuorexError'\n this.statusCode = statusCode\n // Restore prototype chain (TS targeting ES5/ES2015 quirk).\n Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n\n/** API key missing, invalid or revoked (HTTP 401). */\nexport class AuthenticationError extends QuorexError {\n constructor(message = 'Invalid or missing API key.', statusCode = 401) {\n super(message, statusCode)\n this.name = 'AuthenticationError'\n }\n}\n\n/** Requested resource does not exist (HTTP 404). */\nexport class NotFoundError extends QuorexError {\n constructor(message = 'Resource not found.', statusCode = 404) {\n super(message, statusCode)\n this.name = 'NotFoundError'\n }\n}\n\n/** Rate limit exceeded (HTTP 429). */\nexport class RateLimitError extends QuorexError {\n constructor(message = 'Rate limit exceeded.', statusCode = 429) {\n super(message, statusCode)\n this.name = 'RateLimitError'\n }\n}\n\n/** Server-side error (HTTP 5xx). */\nexport class ServerError extends QuorexError {\n constructor(message = 'Quorex server error.', statusCode = 500) {\n super(message, statusCode)\n this.name = 'ServerError'\n }\n}\n","import {\n AuthenticationError,\n NotFoundError,\n QuorexError,\n RateLimitError,\n ServerError,\n} from './errors'\nimport type {\n ExplainOptions,\n ExplainResult,\n ExportResult,\n ForgetResult,\n Memory,\n QuorexOptions,\n RecallOptions,\n RememberOptions,\n Stats,\n StoreResult,\n} from './types'\n\nconst DEFAULT_BASE_URL = 'https://api.quorex.fr'\nconst DEFAULT_TIMEOUT = 30_000\nconst VERSION = '0.1.0'\n\nfunction envApiKey(): string | undefined {\n try {\n return typeof process !== 'undefined' ? process.env?.QUOREX_API_KEY : undefined\n } catch {\n return undefined\n }\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nfunction toMemory(m: any): Memory {\n return {\n vecId: m?.vec_id ?? null,\n text: m?.text ?? '',\n action: m?.action ?? '',\n timestamp: m?.timestamp ?? null,\n finalScore: m?.final_score ?? null,\n cosineSim: m?.cosine_sim ?? null,\n decayWeight: m?.decay_weight ?? null,\n freqWeight: m?.freq_weight ?? null,\n hoursAgo: m?.hours_ago ?? null,\n reinforcements: m?.reinforcements ?? null,\n meta: m?.meta ?? {},\n }\n}\n\ninterface RequestInitLite {\n body?: unknown\n query?: Record<string, string | number | undefined | null>\n}\n\n/**\n * Quorex client — the memory layer for AI agents.\n *\n * ```ts\n * import { Quorex } from \"@quorex/sdk\";\n * const qx = new Quorex({ apiKey: \"qx_live_...\" });\n * await qx.remember(\"user_123\", \"prefers Vue.js over React\");\n * const memories = await qx.recall(\"user_123\", \"preferred framework?\");\n * ```\n */\nexport class Quorex {\n private readonly apiKey: string\n private readonly baseUrl: string\n private readonly timeout: number\n\n constructor(options: QuorexOptions = {}) {\n const key = options.apiKey ?? envApiKey()\n if (!key) {\n throw new AuthenticationError(\n 'API key is required. Pass { apiKey } or set the QUOREX_API_KEY environment variable.'\n )\n }\n this.apiKey = key\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, '')\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT\n }\n\n private async request<T>(method: string, path: string, init: RequestInitLite = {}): Promise<T> {\n const url = new URL(this.baseUrl + path)\n if (init.query) {\n for (const [k, v] of Object.entries(init.query)) {\n if (v !== undefined && v !== null) url.searchParams.set(k, String(v))\n }\n }\n\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), this.timeout)\n\n let res: Response\n try {\n res = await fetch(url.toString(), {\n method,\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${this.apiKey}`,\n 'X-Quorex-Client': `quorex-js/${VERSION}`,\n },\n body: init.body !== undefined ? JSON.stringify(init.body) : undefined,\n signal: controller.signal,\n })\n } catch (err: any) {\n clearTimeout(timer)\n if (err?.name === 'AbortError') throw new QuorexError('Request timed out.')\n throw new QuorexError(`Network error: ${err?.message ?? String(err)}`)\n }\n clearTimeout(timer)\n return this.handle<T>(res)\n }\n\n private async handle<T>(res: Response): Promise<T> {\n let data: any = null\n const text = await res.text()\n if (text) {\n try {\n data = JSON.parse(text)\n } catch {\n data = text\n }\n }\n\n if (res.ok) return data as T\n\n const detail: string = (data && (data.detail || data.error)) || res.statusText || 'Unknown error'\n if (res.status === 401) throw new AuthenticationError(detail, 401)\n if (res.status === 404) throw new NotFoundError(detail, 404)\n if (res.status === 429) throw new RateLimitError(detail, 429)\n if (res.status >= 500) throw new ServerError(detail, res.status)\n throw new QuorexError(`API error (${res.status}): ${detail}`, res.status)\n }\n\n /** Store a memory for one of your end-users. */\n async remember(userId: string, text: string, opts: RememberOptions = {}): Promise<StoreResult> {\n const data = await this.request<{ vec_id: number }>('POST', '/sdk/v1/remember', {\n body: {\n user_id: userId,\n text,\n action: opts.action ?? 'memory',\n metadata: opts.metadata ?? {},\n timestamp: opts.timestamp ?? Date.now() / 1000,\n },\n })\n return { vecId: data.vec_id }\n }\n\n /** Retrieve the most relevant memories for a query, ranked by final score. */\n async recall(userId: string, query: string, opts: RecallOptions = {}): Promise<Memory[]> {\n const data = await this.request<{ memories: any[] }>('POST', '/sdk/v1/recall', {\n body: { user_id: userId, query, top_k: opts.topK ?? 5, threshold: opts.threshold ?? 0.05 },\n })\n return (data.memories ?? []).map(toMemory)\n }\n\n /** Like recall(), but each result includes a human-readable score breakdown. */\n async explain(userId: string, query: string, opts: ExplainOptions = {}): Promise<ExplainResult[]> {\n const data = await this.request<{ results: any[] }>('POST', '/sdk/v1/explain', {\n body: { user_id: userId, query, top_k: opts.topK ?? 1 },\n })\n return (data.results ?? []).map((r: any) => ({\n memory: toMemory(r),\n explanation: r?.explanation ?? '',\n scoreBreakdown: {\n finalScore: r?.score_breakdown?.final_score,\n cosineSim: r?.score_breakdown?.cosine_sim,\n decayWeight: r?.score_breakdown?.decay_weight,\n freqWeight: r?.score_breakdown?.freq_weight,\n reinforcements: r?.score_breakdown?.reinforcements,\n hoursAgo: r?.score_breakdown?.hours_ago,\n },\n }))\n }\n\n /** Delete a single memory by its vector id. */\n async forget(userId: string, vecId: number): Promise<ForgetResult> {\n const data = await this.request<{ deleted: boolean }>('DELETE', '/sdk/v1/forget', {\n body: { user_id: userId, vec_id: vecId },\n })\n return { deleted: data.deleted ?? false, vecId }\n }\n\n /** GDPR — delete ALL memories for an end-user. Returns the count removed. */\n async purge(userId: string): Promise<number> {\n const data = await this.request<{ deleted: number }>('DELETE', '/sdk/v1/purge', {\n body: { user_id: userId },\n })\n return data.deleted ?? 0\n }\n\n /** GDPR — export all memories for an end-user. */\n async export(userId: string): Promise<ExportResult> {\n const data = await this.request<any>('GET', '/sdk/v1/export', { query: { user_id: userId } })\n return {\n userId: data?.user_id ?? userId,\n count: data?.count ?? (data?.memories?.length ?? 0),\n memories: (data?.memories ?? []).map(toMemory),\n }\n }\n\n /** Stop temporal decay for an end-user (pins their scores in time). */\n async freeze(userId: string): Promise<boolean> {\n const data = await this.request<{ frozen: boolean }>('POST', '/sdk/v1/freeze', {\n body: { user_id: userId },\n })\n return data.frozen ?? false\n }\n\n /** Usage statistics for the authenticated API key (optionally scoped to one user). */\n async stats(userId?: string): Promise<Stats> {\n return this.request<Stats>('GET', '/sdk/v1/stats', {\n query: userId ? { user_id: userId } : undefined,\n })\n }\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACCO,IAAM,cAAN,cAA0B,MAAM;AAAA,EAErC,YAAY,SAAiB,YAAqB;AAChD,UAAM,OAAO;AACb,SAAK,OAAO;AACZ,SAAK,aAAa;AAElB,WAAO,eAAe,MAAM,WAAW,SAAS;AAAA,EAClD;AACF;AAGO,IAAM,sBAAN,cAAkC,YAAY;AAAA,EACnD,YAAY,UAAU,+BAA+B,aAAa,KAAK;AACrE,UAAM,SAAS,UAAU;AACzB,SAAK,OAAO;AAAA,EACd;AACF;AAGO,IAAM,gBAAN,cAA4B,YAAY;AAAA,EAC7C,YAAY,UAAU,uBAAuB,aAAa,KAAK;AAC7D,UAAM,SAAS,UAAU;AACzB,SAAK,OAAO;AAAA,EACd;AACF;AAGO,IAAM,iBAAN,cAA6B,YAAY;AAAA,EAC9C,YAAY,UAAU,wBAAwB,aAAa,KAAK;AAC9D,UAAM,SAAS,UAAU;AACzB,SAAK,OAAO;AAAA,EACd;AACF;AAGO,IAAM,cAAN,cAA0B,YAAY;AAAA,EAC3C,YAAY,UAAU,wBAAwB,aAAa,KAAK;AAC9D,UAAM,SAAS,UAAU;AACzB,SAAK,OAAO;AAAA,EACd;AACF;;;ACtBA,IAAM,mBAAmB;AACzB,IAAM,kBAAkB;AACxB,IAAM,UAAU;AAEhB,SAAS,YAAgC;AACvC,MAAI;AACF,WAAO,OAAO,YAAY,cAAc,QAAQ,KAAK,iBAAiB;AAAA,EACxE,QAAQ;AACN,WAAO;AAAA,EACT;AACF;AAGA,SAAS,SAAS,GAAgB;AAChC,SAAO;AAAA,IACL,OAA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MAAM,MAAM,QAAiC;AAC3C,UAAM,OAAO,MAAM,KAAK,QAA6B,UAAU,iBAAiB;AAAA,MAC9E,MAAM,EAAE,SAAS,OAAO;AAAA,IAC1B,CAAC;AACD,WAAO,KAAK,WAAW;AAAA,EACzB;AAAA;AAAA,EAGA,MAAM,OAAO,QAAuC;AAClD,UAAM,OAAO,MAAM,KAAK,QAAa,OAAO,kBAAkB,EAAE,OAAO,EAAE,SAAS,OAAO,EAAE,CAAC;AAC5F,WAAO;AAAA,MACL,QAAQ,MAAM,WAAW;AAAA,MACzB,OAAO,MAAM,UAAU,MAAM,UAAU,UAAU;AAAA,MACjD,WAAW,MAAM,YAAY,CAAC,GAAG,IAAI,QAAQ;AAAA,IAC/C;AAAA,EACF;AAAA;AAAA,EAGA,MAAM,OAAO,QAAkC;AAC7C,UAAM,OAAO,MAAM,KAAK,QAA6B,QAAQ,kBAAkB;AAAA,MAC7E,MAAM,EAAE,SAAS,OAAO;AAAA,IAC1B,CAAC;AACD,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA;AAAA,EAGA,MAAM,MAAM,QAAiC;AAC3C,WAAO,KAAK,QAAe,OAAO,iBAAiB;AAAA,MACjD,OAAO,SAAS,EAAE,SAAS,OAAO,IAAI;AAAA,IACxC,CAAC;AAAA,EACH;AACF;","names":[]}
@@ -0,0 +1,123 @@
1
+ interface QuorexOptions {
2
+ /** Secret key (qx_live_...). Falls back to process.env.QUOREX_API_KEY in Node. */
3
+ apiKey?: string;
4
+ /** API base URL. Default "https://api.quorex.fr". */
5
+ baseUrl?: string;
6
+ /** Request timeout in milliseconds. Default 30000. */
7
+ timeout?: number;
8
+ }
9
+ /** A recalled memory with its full re-ranking breakdown. */
10
+ interface Memory {
11
+ vecId: number | null;
12
+ text: string;
13
+ action: string;
14
+ timestamp: number | null;
15
+ finalScore: number | null;
16
+ cosineSim: number | null;
17
+ decayWeight: number | null;
18
+ freqWeight: number | null;
19
+ hoursAgo: number | null;
20
+ reinforcements: number | null;
21
+ meta: Record<string, unknown>;
22
+ }
23
+ interface StoreResult {
24
+ vecId: number;
25
+ }
26
+ interface ForgetResult {
27
+ deleted: boolean;
28
+ vecId: number;
29
+ }
30
+ interface ScoreBreakdown {
31
+ finalScore?: number;
32
+ cosineSim?: number;
33
+ decayWeight?: number;
34
+ freqWeight?: number;
35
+ reinforcements?: number;
36
+ hoursAgo?: number;
37
+ }
38
+ interface ExplainResult {
39
+ memory: Memory;
40
+ explanation: string;
41
+ scoreBreakdown: ScoreBreakdown;
42
+ }
43
+ interface ExportResult {
44
+ userId: string;
45
+ count: number;
46
+ memories: Memory[];
47
+ }
48
+ interface Stats {
49
+ [key: string]: unknown;
50
+ }
51
+ interface RememberOptions {
52
+ /** Category label. Default "memory". */
53
+ action?: string;
54
+ metadata?: Record<string, unknown>;
55
+ /** Unix timestamp in seconds. Defaults to now. */
56
+ timestamp?: number;
57
+ }
58
+ interface RecallOptions {
59
+ topK?: number;
60
+ threshold?: number;
61
+ }
62
+ interface ExplainOptions {
63
+ topK?: number;
64
+ }
65
+
66
+ /**
67
+ * Quorex client — the memory layer for AI agents.
68
+ *
69
+ * ```ts
70
+ * import { Quorex } from "@quorex/sdk";
71
+ * const qx = new Quorex({ apiKey: "qx_live_..." });
72
+ * await qx.remember("user_123", "prefers Vue.js over React");
73
+ * const memories = await qx.recall("user_123", "preferred framework?");
74
+ * ```
75
+ */
76
+ declare class Quorex {
77
+ private readonly apiKey;
78
+ private readonly baseUrl;
79
+ private readonly timeout;
80
+ constructor(options?: QuorexOptions);
81
+ private request;
82
+ private handle;
83
+ /** Store a memory for one of your end-users. */
84
+ remember(userId: string, text: string, opts?: RememberOptions): Promise<StoreResult>;
85
+ /** Retrieve the most relevant memories for a query, ranked by final score. */
86
+ recall(userId: string, query: string, opts?: RecallOptions): Promise<Memory[]>;
87
+ /** Like recall(), but each result includes a human-readable score breakdown. */
88
+ explain(userId: string, query: string, opts?: ExplainOptions): Promise<ExplainResult[]>;
89
+ /** Delete a single memory by its vector id. */
90
+ forget(userId: string, vecId: number): Promise<ForgetResult>;
91
+ /** GDPR — delete ALL memories for an end-user. Returns the count removed. */
92
+ purge(userId: string): Promise<number>;
93
+ /** GDPR — export all memories for an end-user. */
94
+ export(userId: string): Promise<ExportResult>;
95
+ /** Stop temporal decay for an end-user (pins their scores in time). */
96
+ freeze(userId: string): Promise<boolean>;
97
+ /** Usage statistics for the authenticated API key (optionally scoped to one user). */
98
+ stats(userId?: string): Promise<Stats>;
99
+ }
100
+
101
+ /** Base class for all Quorex SDK errors. */
102
+ declare class QuorexError extends Error {
103
+ statusCode?: number;
104
+ constructor(message: string, statusCode?: number);
105
+ }
106
+ /** API key missing, invalid or revoked (HTTP 401). */
107
+ declare class AuthenticationError extends QuorexError {
108
+ constructor(message?: string, statusCode?: number);
109
+ }
110
+ /** Requested resource does not exist (HTTP 404). */
111
+ declare class NotFoundError extends QuorexError {
112
+ constructor(message?: string, statusCode?: number);
113
+ }
114
+ /** Rate limit exceeded (HTTP 429). */
115
+ declare class RateLimitError extends QuorexError {
116
+ constructor(message?: string, statusCode?: number);
117
+ }
118
+ /** Server-side error (HTTP 5xx). */
119
+ declare class ServerError extends QuorexError {
120
+ constructor(message?: string, statusCode?: number);
121
+ }
122
+
123
+ export { AuthenticationError, type ExplainOptions, type ExplainResult, type ExportResult, type ForgetResult, type Memory, NotFoundError, Quorex, QuorexError, type QuorexOptions, RateLimitError, type RecallOptions, type RememberOptions, type ScoreBreakdown, ServerError, type Stats, type StoreResult };
@@ -0,0 +1,123 @@
1
+ interface QuorexOptions {
2
+ /** Secret key (qx_live_...). Falls back to process.env.QUOREX_API_KEY in Node. */
3
+ apiKey?: string;
4
+ /** API base URL. Default "https://api.quorex.fr". */
5
+ baseUrl?: string;
6
+ /** Request timeout in milliseconds. Default 30000. */
7
+ timeout?: number;
8
+ }
9
+ /** A recalled memory with its full re-ranking breakdown. */
10
+ interface Memory {
11
+ vecId: number | null;
12
+ text: string;
13
+ action: string;
14
+ timestamp: number | null;
15
+ finalScore: number | null;
16
+ cosineSim: number | null;
17
+ decayWeight: number | null;
18
+ freqWeight: number | null;
19
+ hoursAgo: number | null;
20
+ reinforcements: number | null;
21
+ meta: Record<string, unknown>;
22
+ }
23
+ interface StoreResult {
24
+ vecId: number;
25
+ }
26
+ interface ForgetResult {
27
+ deleted: boolean;
28
+ vecId: number;
29
+ }
30
+ interface ScoreBreakdown {
31
+ finalScore?: number;
32
+ cosineSim?: number;
33
+ decayWeight?: number;
34
+ freqWeight?: number;
35
+ reinforcements?: number;
36
+ hoursAgo?: number;
37
+ }
38
+ interface ExplainResult {
39
+ memory: Memory;
40
+ explanation: string;
41
+ scoreBreakdown: ScoreBreakdown;
42
+ }
43
+ interface ExportResult {
44
+ userId: string;
45
+ count: number;
46
+ memories: Memory[];
47
+ }
48
+ interface Stats {
49
+ [key: string]: unknown;
50
+ }
51
+ interface RememberOptions {
52
+ /** Category label. Default "memory". */
53
+ action?: string;
54
+ metadata?: Record<string, unknown>;
55
+ /** Unix timestamp in seconds. Defaults to now. */
56
+ timestamp?: number;
57
+ }
58
+ interface RecallOptions {
59
+ topK?: number;
60
+ threshold?: number;
61
+ }
62
+ interface ExplainOptions {
63
+ topK?: number;
64
+ }
65
+
66
+ /**
67
+ * Quorex client — the memory layer for AI agents.
68
+ *
69
+ * ```ts
70
+ * import { Quorex } from "@quorex/sdk";
71
+ * const qx = new Quorex({ apiKey: "qx_live_..." });
72
+ * await qx.remember("user_123", "prefers Vue.js over React");
73
+ * const memories = await qx.recall("user_123", "preferred framework?");
74
+ * ```
75
+ */
76
+ declare class Quorex {
77
+ private readonly apiKey;
78
+ private readonly baseUrl;
79
+ private readonly timeout;
80
+ constructor(options?: QuorexOptions);
81
+ private request;
82
+ private handle;
83
+ /** Store a memory for one of your end-users. */
84
+ remember(userId: string, text: string, opts?: RememberOptions): Promise<StoreResult>;
85
+ /** Retrieve the most relevant memories for a query, ranked by final score. */
86
+ recall(userId: string, query: string, opts?: RecallOptions): Promise<Memory[]>;
87
+ /** Like recall(), but each result includes a human-readable score breakdown. */
88
+ explain(userId: string, query: string, opts?: ExplainOptions): Promise<ExplainResult[]>;
89
+ /** Delete a single memory by its vector id. */
90
+ forget(userId: string, vecId: number): Promise<ForgetResult>;
91
+ /** GDPR — delete ALL memories for an end-user. Returns the count removed. */
92
+ purge(userId: string): Promise<number>;
93
+ /** GDPR — export all memories for an end-user. */
94
+ export(userId: string): Promise<ExportResult>;
95
+ /** Stop temporal decay for an end-user (pins their scores in time). */
96
+ freeze(userId: string): Promise<boolean>;
97
+ /** Usage statistics for the authenticated API key (optionally scoped to one user). */
98
+ stats(userId?: string): Promise<Stats>;
99
+ }
100
+
101
+ /** Base class for all Quorex SDK errors. */
102
+ declare class QuorexError extends Error {
103
+ statusCode?: number;
104
+ constructor(message: string, statusCode?: number);
105
+ }
106
+ /** API key missing, invalid or revoked (HTTP 401). */
107
+ declare class AuthenticationError extends QuorexError {
108
+ constructor(message?: string, statusCode?: number);
109
+ }
110
+ /** Requested resource does not exist (HTTP 404). */
111
+ declare class NotFoundError extends QuorexError {
112
+ constructor(message?: string, statusCode?: number);
113
+ }
114
+ /** Rate limit exceeded (HTTP 429). */
115
+ declare class RateLimitError extends QuorexError {
116
+ constructor(message?: string, statusCode?: number);
117
+ }
118
+ /** Server-side error (HTTP 5xx). */
119
+ declare class ServerError extends QuorexError {
120
+ constructor(message?: string, statusCode?: number);
121
+ }
122
+
123
+ export { AuthenticationError, type ExplainOptions, type ExplainResult, type ExportResult, type ForgetResult, type Memory, NotFoundError, Quorex, QuorexError, type QuorexOptions, RateLimitError, type RecallOptions, type RememberOptions, type ScoreBreakdown, ServerError, type Stats, type StoreResult };
package/dist/index.js ADDED
@@ -0,0 +1,203 @@
1
+ // src/errors.ts
2
+ var QuorexError = class extends Error {
3
+ constructor(message, statusCode) {
4
+ super(message);
5
+ this.name = "QuorexError";
6
+ this.statusCode = statusCode;
7
+ Object.setPrototypeOf(this, new.target.prototype);
8
+ }
9
+ };
10
+ var AuthenticationError = class extends QuorexError {
11
+ constructor(message = "Invalid or missing API key.", statusCode = 401) {
12
+ super(message, statusCode);
13
+ this.name = "AuthenticationError";
14
+ }
15
+ };
16
+ var NotFoundError = class extends QuorexError {
17
+ constructor(message = "Resource not found.", statusCode = 404) {
18
+ super(message, statusCode);
19
+ this.name = "NotFoundError";
20
+ }
21
+ };
22
+ var RateLimitError = class extends QuorexError {
23
+ constructor(message = "Rate limit exceeded.", statusCode = 429) {
24
+ super(message, statusCode);
25
+ this.name = "RateLimitError";
26
+ }
27
+ };
28
+ var ServerError = class extends QuorexError {
29
+ constructor(message = "Quorex server error.", statusCode = 500) {
30
+ super(message, statusCode);
31
+ this.name = "ServerError";
32
+ }
33
+ };
34
+
35
+ // src/client.ts
36
+ var DEFAULT_BASE_URL = "https://api.quorex.fr";
37
+ var DEFAULT_TIMEOUT = 3e4;
38
+ var VERSION = "0.1.0";
39
+ function envApiKey() {
40
+ try {
41
+ return typeof process !== "undefined" ? process.env?.QUOREX_API_KEY : void 0;
42
+ } catch {
43
+ return void 0;
44
+ }
45
+ }
46
+ function toMemory(m) {
47
+ return {
48
+ vecId: m?.vec_id ?? null,
49
+ text: m?.text ?? "",
50
+ action: m?.action ?? "",
51
+ timestamp: m?.timestamp ?? null,
52
+ finalScore: m?.final_score ?? null,
53
+ cosineSim: m?.cosine_sim ?? null,
54
+ decayWeight: m?.decay_weight ?? null,
55
+ freqWeight: m?.freq_weight ?? null,
56
+ hoursAgo: m?.hours_ago ?? null,
57
+ reinforcements: m?.reinforcements ?? null,
58
+ meta: m?.meta ?? {}
59
+ };
60
+ }
61
+ var Quorex = class {
62
+ constructor(options = {}) {
63
+ const key = options.apiKey ?? envApiKey();
64
+ if (!key) {
65
+ throw new AuthenticationError(
66
+ "API key is required. Pass { apiKey } or set the QUOREX_API_KEY environment variable."
67
+ );
68
+ }
69
+ this.apiKey = key;
70
+ this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\/+$/, "");
71
+ this.timeout = options.timeout ?? DEFAULT_TIMEOUT;
72
+ }
73
+ async request(method, path, init = {}) {
74
+ const url = new URL(this.baseUrl + path);
75
+ if (init.query) {
76
+ for (const [k, v] of Object.entries(init.query)) {
77
+ if (v !== void 0 && v !== null) url.searchParams.set(k, String(v));
78
+ }
79
+ }
80
+ const controller = new AbortController();
81
+ const timer = setTimeout(() => controller.abort(), this.timeout);
82
+ let res;
83
+ try {
84
+ res = await fetch(url.toString(), {
85
+ method,
86
+ headers: {
87
+ "Content-Type": "application/json",
88
+ Authorization: `Bearer ${this.apiKey}`,
89
+ "X-Quorex-Client": `quorex-js/${VERSION}`
90
+ },
91
+ body: init.body !== void 0 ? JSON.stringify(init.body) : void 0,
92
+ signal: controller.signal
93
+ });
94
+ } catch (err) {
95
+ clearTimeout(timer);
96
+ if (err?.name === "AbortError") throw new QuorexError("Request timed out.");
97
+ throw new QuorexError(`Network error: ${err?.message ?? String(err)}`);
98
+ }
99
+ clearTimeout(timer);
100
+ return this.handle(res);
101
+ }
102
+ async handle(res) {
103
+ let data = null;
104
+ const text = await res.text();
105
+ if (text) {
106
+ try {
107
+ data = JSON.parse(text);
108
+ } catch {
109
+ data = text;
110
+ }
111
+ }
112
+ if (res.ok) return data;
113
+ const detail = data && (data.detail || data.error) || res.statusText || "Unknown error";
114
+ if (res.status === 401) throw new AuthenticationError(detail, 401);
115
+ if (res.status === 404) throw new NotFoundError(detail, 404);
116
+ if (res.status === 429) throw new RateLimitError(detail, 429);
117
+ if (res.status >= 500) throw new ServerError(detail, res.status);
118
+ throw new QuorexError(`API error (${res.status}): ${detail}`, res.status);
119
+ }
120
+ /** Store a memory for one of your end-users. */
121
+ async remember(userId, text, opts = {}) {
122
+ const data = await this.request("POST", "/sdk/v1/remember", {
123
+ body: {
124
+ user_id: userId,
125
+ text,
126
+ action: opts.action ?? "memory",
127
+ metadata: opts.metadata ?? {},
128
+ timestamp: opts.timestamp ?? Date.now() / 1e3
129
+ }
130
+ });
131
+ return { vecId: data.vec_id };
132
+ }
133
+ /** Retrieve the most relevant memories for a query, ranked by final score. */
134
+ async recall(userId, query, opts = {}) {
135
+ const data = await this.request("POST", "/sdk/v1/recall", {
136
+ body: { user_id: userId, query, top_k: opts.topK ?? 5, threshold: opts.threshold ?? 0.05 }
137
+ });
138
+ return (data.memories ?? []).map(toMemory);
139
+ }
140
+ /** Like recall(), but each result includes a human-readable score breakdown. */
141
+ async explain(userId, query, opts = {}) {
142
+ const data = await this.request("POST", "/sdk/v1/explain", {
143
+ body: { user_id: userId, query, top_k: opts.topK ?? 1 }
144
+ });
145
+ return (data.results ?? []).map((r) => ({
146
+ memory: toMemory(r),
147
+ explanation: r?.explanation ?? "",
148
+ scoreBreakdown: {
149
+ finalScore: r?.score_breakdown?.final_score,
150
+ cosineSim: r?.score_breakdown?.cosine_sim,
151
+ decayWeight: r?.score_breakdown?.decay_weight,
152
+ freqWeight: r?.score_breakdown?.freq_weight,
153
+ reinforcements: r?.score_breakdown?.reinforcements,
154
+ hoursAgo: r?.score_breakdown?.hours_ago
155
+ }
156
+ }));
157
+ }
158
+ /** Delete a single memory by its vector id. */
159
+ async forget(userId, vecId) {
160
+ const data = await this.request("DELETE", "/sdk/v1/forget", {
161
+ body: { user_id: userId, vec_id: vecId }
162
+ });
163
+ return { deleted: data.deleted ?? false, vecId };
164
+ }
165
+ /** GDPR — delete ALL memories for an end-user. Returns the count removed. */
166
+ async purge(userId) {
167
+ const data = await this.request("DELETE", "/sdk/v1/purge", {
168
+ body: { user_id: userId }
169
+ });
170
+ return data.deleted ?? 0;
171
+ }
172
+ /** GDPR — export all memories for an end-user. */
173
+ async export(userId) {
174
+ const data = await this.request("GET", "/sdk/v1/export", { query: { user_id: userId } });
175
+ return {
176
+ userId: data?.user_id ?? userId,
177
+ count: data?.count ?? (data?.memories?.length ?? 0),
178
+ memories: (data?.memories ?? []).map(toMemory)
179
+ };
180
+ }
181
+ /** Stop temporal decay for an end-user (pins their scores in time). */
182
+ async freeze(userId) {
183
+ const data = await this.request("POST", "/sdk/v1/freeze", {
184
+ body: { user_id: userId }
185
+ });
186
+ return data.frozen ?? false;
187
+ }
188
+ /** Usage statistics for the authenticated API key (optionally scoped to one user). */
189
+ async stats(userId) {
190
+ return this.request("GET", "/sdk/v1/stats", {
191
+ query: userId ? { user_id: userId } : void 0
192
+ });
193
+ }
194
+ };
195
+ export {
196
+ AuthenticationError,
197
+ NotFoundError,
198
+ Quorex,
199
+ QuorexError,
200
+ RateLimitError,
201
+ ServerError
202
+ };
203
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/errors.ts","../src/client.ts"],"sourcesContent":["/** Base class for all Quorex SDK errors. */\nexport class QuorexError extends Error {\n statusCode?: number\n constructor(message: string, statusCode?: number) {\n super(message)\n this.name = 'QuorexError'\n this.statusCode = statusCode\n // Restore prototype chain (TS targeting ES5/ES2015 quirk).\n Object.setPrototypeOf(this, new.target.prototype)\n }\n}\n\n/** API key missing, invalid or revoked (HTTP 401). */\nexport class AuthenticationError extends QuorexError {\n constructor(message = 'Invalid or missing API key.', statusCode = 401) {\n super(message, statusCode)\n this.name = 'AuthenticationError'\n }\n}\n\n/** Requested resource does not exist (HTTP 404). */\nexport class NotFoundError extends QuorexError {\n constructor(message = 'Resource not found.', statusCode = 404) {\n super(message, statusCode)\n this.name = 'NotFoundError'\n }\n}\n\n/** Rate limit exceeded (HTTP 429). */\nexport class RateLimitError extends QuorexError {\n constructor(message = 'Rate limit exceeded.', statusCode = 429) {\n super(message, statusCode)\n this.name = 'RateLimitError'\n }\n}\n\n/** Server-side error (HTTP 5xx). */\nexport class ServerError extends QuorexError {\n constructor(message = 'Quorex server error.', statusCode = 500) {\n super(message, statusCode)\n this.name = 'ServerError'\n }\n}\n","import {\n AuthenticationError,\n NotFoundError,\n QuorexError,\n RateLimitError,\n ServerError,\n} from './errors'\nimport type {\n ExplainOptions,\n ExplainResult,\n ExportResult,\n ForgetResult,\n Memory,\n QuorexOptions,\n RecallOptions,\n RememberOptions,\n Stats,\n StoreResult,\n} from './types'\n\nconst DEFAULT_BASE_URL = 'https://api.quorex.fr'\nconst DEFAULT_TIMEOUT = 30_000\nconst VERSION = '0.1.0'\n\nfunction envApiKey(): string | undefined {\n try {\n return typeof process !== 'undefined' ? process.env?.QUOREX_API_KEY : undefined\n } catch {\n return undefined\n }\n}\n\n/* eslint-disable @typescript-eslint/no-explicit-any */\nfunction toMemory(m: any): Memory {\n return {\n vecId: m?.vec_id ?? null,\n text: m?.text ?? '',\n action: m?.action ?? '',\n timestamp: m?.timestamp ?? null,\n finalScore: m?.final_score ?? null,\n cosineSim: m?.cosine_sim ?? null,\n decayWeight: m?.decay_weight ?? null,\n freqWeight: m?.freq_weight ?? null,\n hoursAgo: m?.hours_ago ?? null,\n reinforcements: m?.reinforcements ?? null,\n meta: m?.meta ?? {},\n }\n}\n\ninterface RequestInitLite {\n body?: unknown\n query?: Record<string, string | number | undefined | null>\n}\n\n/**\n * Quorex client — the memory layer for AI agents.\n *\n * ```ts\n * import { Quorex } from \"@quorex/sdk\";\n * const qx = new Quorex({ apiKey: \"qx_live_...\" });\n * await qx.remember(\"user_123\", \"prefers Vue.js over React\");\n * const memories = await qx.recall(\"user_123\", \"preferred framework?\");\n * ```\n */\nexport class Quorex {\n private readonly apiKey: string\n private readonly baseUrl: string\n private readonly timeout: number\n\n constructor(options: QuorexOptions = {}) {\n const key = options.apiKey ?? envApiKey()\n if (!key) {\n throw new AuthenticationError(\n 'API key is required. Pass { apiKey } or set the QUOREX_API_KEY environment variable.'\n )\n }\n this.apiKey = key\n this.baseUrl = (options.baseUrl ?? DEFAULT_BASE_URL).replace(/\\/+$/, '')\n this.timeout = options.timeout ?? DEFAULT_TIMEOUT\n }\n\n private async request<T>(method: string, path: string, init: RequestInitLite = {}): Promise<T> {\n const url = new URL(this.baseUrl + path)\n if (init.query) {\n for (const [k, v] of Object.entries(init.query)) {\n if (v !== undefined && v !== null) url.searchParams.set(k, String(v))\n }\n }\n\n const controller = new AbortController()\n const timer = setTimeout(() => controller.abort(), this.timeout)\n\n let res: Response\n try {\n res = await fetch(url.toString(), {\n method,\n headers: {\n 'Content-Type': 'application/json',\n Authorization: `Bearer ${this.apiKey}`,\n 'X-Quorex-Client': `quorex-js/${VERSION}`,\n },\n body: init.body !== undefined ? JSON.stringify(init.body) : undefined,\n signal: controller.signal,\n })\n } catch (err: any) {\n clearTimeout(timer)\n if (err?.name === 'AbortError') throw new QuorexError('Request timed out.')\n throw new QuorexError(`Network error: ${err?.message ?? String(err)}`)\n }\n clearTimeout(timer)\n return this.handle<T>(res)\n }\n\n private async handle<T>(res: Response): Promise<T> {\n let data: any = null\n const text = await res.text()\n if (text) {\n try {\n data = JSON.parse(text)\n } catch {\n data = text\n }\n }\n\n if (res.ok) return data as T\n\n const detail: string = (data && (data.detail || data.error)) || res.statusText || 'Unknown error'\n if (res.status === 401) throw new AuthenticationError(detail, 401)\n if (res.status === 404) throw new NotFoundError(detail, 404)\n if (res.status === 429) throw new RateLimitError(detail, 429)\n if (res.status >= 500) throw new ServerError(detail, res.status)\n throw new QuorexError(`API error (${res.status}): ${detail}`, res.status)\n }\n\n /** Store a memory for one of your end-users. */\n async remember(userId: string, text: string, opts: RememberOptions = {}): Promise<StoreResult> {\n const data = await this.request<{ vec_id: number }>('POST', '/sdk/v1/remember', {\n body: {\n user_id: userId,\n text,\n action: opts.action ?? 'memory',\n metadata: opts.metadata ?? {},\n timestamp: opts.timestamp ?? Date.now() / 1000,\n },\n })\n return { vecId: data.vec_id }\n }\n\n /** Retrieve the most relevant memories for a query, ranked by final score. */\n async recall(userId: string, query: string, opts: RecallOptions = {}): Promise<Memory[]> {\n const data = await this.request<{ memories: any[] }>('POST', '/sdk/v1/recall', {\n body: { user_id: userId, query, top_k: opts.topK ?? 5, threshold: opts.threshold ?? 0.05 },\n })\n return (data.memories ?? []).map(toMemory)\n }\n\n /** Like recall(), but each result includes a human-readable score breakdown. */\n async explain(userId: string, query: string, opts: ExplainOptions = {}): Promise<ExplainResult[]> {\n const data = await this.request<{ results: any[] }>('POST', '/sdk/v1/explain', {\n body: { user_id: userId, query, top_k: opts.topK ?? 1 },\n })\n return (data.results ?? []).map((r: any) => ({\n memory: toMemory(r),\n explanation: r?.explanation ?? '',\n scoreBreakdown: {\n finalScore: r?.score_breakdown?.final_score,\n cosineSim: r?.score_breakdown?.cosine_sim,\n decayWeight: r?.score_breakdown?.decay_weight,\n freqWeight: r?.score_breakdown?.freq_weight,\n reinforcements: r?.score_breakdown?.reinforcements,\n hoursAgo: r?.score_breakdown?.hours_ago,\n },\n }))\n }\n\n /** Delete a single memory by its vector id. */\n async forget(userId: string, vecId: number): Promise<ForgetResult> {\n const data = await this.request<{ deleted: boolean }>('DELETE', '/sdk/v1/forget', {\n body: { user_id: userId, vec_id: vecId },\n })\n return { deleted: data.deleted ?? false, vecId }\n }\n\n /** GDPR — delete ALL memories for an end-user. Returns the count removed. */\n async purge(userId: string): Promise<number> {\n const data = await this.request<{ deleted: number }>('DELETE', '/sdk/v1/purge', {\n body: { user_id: userId },\n })\n return data.deleted ?? 0\n }\n\n /** GDPR — export all memories for an end-user. */\n async export(userId: string): Promise<ExportResult> {\n const data = await this.request<any>('GET', '/sdk/v1/export', { query: { user_id: userId } })\n return {\n userId: data?.user_id ?? userId,\n count: data?.count ?? (data?.memories?.length ?? 0),\n memories: (data?.memories ?? []).map(toMemory),\n }\n }\n\n /** Stop temporal decay for an end-user (pins their scores in time). */\n async freeze(userId: string): Promise<boolean> {\n const data = await this.request<{ frozen: boolean }>('POST', '/sdk/v1/freeze', {\n body: { user_id: userId },\n })\n return data.frozen ?? false\n }\n\n /** Usage statistics for the authenticated API key (optionally scoped to one user). */\n async stats(userId?: string): Promise<Stats> {\n return this.request<Stats>('GET', '/sdk/v1/stats', {\n query: userId ? { user_id: userId } : undefined,\n })\n }\n}\n"],"mappings":";AACO,IAAM,cAAN,cAA0B,MAAM;AAAA,EAErC,YAAY,SAAiB,YAAqB;AAChD,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ACzB,OAAO,MAAM,UAAU,MAAM,UAAU,UAAU;AAAA,MACjD,WAAW,MAAM,YAAY,CAAC,GAAG,IAAI,QAAQ;AAAA,IAC/C;AAAA,EACF;AAAA;AAAA,EAGA,MAAM,OAAO,QAAkC;AAC7C,UAAM,OAAO,MAAM,KAAK,QAA6B,QAAQ,kBAAkB;AAAA,MAC7E,MAAM,EAAE,SAAS,OAAO;AAAA,IAC1B,CAAC;AACD,WAAO,KAAK,UAAU;AAAA,EACxB;AAAA;AAAA,EAGA,MAAM,MAAM,QAAiC;AAC3C,WAAO,KAAK,QAAe,OAAO,iBAAiB;AAAA,MACjD,OAAO,SAAS,EAAE,SAAS,OAAO,IAAI;AAAA,IACxC,CAAC;AAAA,EACH;AACF;","names":[]}
package/package.json ADDED
@@ -0,0 +1,42 @@
1
+ {
2
+ "name": "@quorex/sdk",
3
+ "version": "0.1.0",
4
+ "description": "Official JavaScript/TypeScript SDK for Quorex — the memory layer for AI agents.",
5
+ "type": "module",
6
+ "main": "./dist/index.cjs",
7
+ "module": "./dist/index.js",
8
+ "types": "./dist/index.d.ts",
9
+ "exports": {
10
+ ".": {
11
+ "types": "./dist/index.d.ts",
12
+ "import": "./dist/index.js",
13
+ "require": "./dist/index.cjs"
14
+ }
15
+ },
16
+ "files": ["dist", "README.md"],
17
+ "sideEffects": false,
18
+ "engines": { "node": ">=18" },
19
+ "scripts": {
20
+ "build": "tsup",
21
+ "typecheck": "tsc --noEmit",
22
+ "test": "vitest run",
23
+ "test:watch": "vitest",
24
+ "prepublishOnly": "npm run build"
25
+ },
26
+ "keywords": ["quorex", "memory", "ai", "llm", "agents", "sdk", "vector", "rag", "context"],
27
+ "homepage": "https://quorex.fr",
28
+ "repository": {
29
+ "type": "git",
30
+ "url": "git+https://github.com/quorex-ai/quorex-js.git"
31
+ },
32
+ "bugs": { "url": "https://github.com/quorex-ai/quorex-js/issues" },
33
+ "author": "Quorex",
34
+ "license": "MIT",
35
+ "publishConfig": { "access": "public" },
36
+ "devDependencies": {
37
+ "@types/node": "^20.0.0",
38
+ "tsup": "^8.0.0",
39
+ "typescript": "^5.4.0",
40
+ "vitest": "^2.0.0"
41
+ }
42
+ }