velixar 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/README.md ADDED
@@ -0,0 +1,60 @@
1
+ # Velixar JavaScript SDK
2
+
3
+ Persistent memory infrastructure for AI applications.
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ npm install velixar
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ ```typescript
14
+ import Velixar from 'velixar';
15
+
16
+ const v = new Velixar({ apiKey: 'vlx_your_key' });
17
+
18
+ // Store a memory
19
+ const { id } = await v.store('User prefers dark mode');
20
+
21
+ // Search memories
22
+ const { memories } = await v.search('preferences');
23
+
24
+ // Get specific memory
25
+ const { memory } = await v.get(id);
26
+
27
+ // Delete memory
28
+ await v.delete(id);
29
+ ```
30
+
31
+ ## With User Context
32
+
33
+ ```typescript
34
+ // Store per-user memories
35
+ await v.store('Loves TypeScript', { userId: 'user_123' });
36
+
37
+ // Search user's memories
38
+ const results = await v.search('programming', {
39
+ userId: 'user_123',
40
+ limit: 5
41
+ });
42
+ ```
43
+
44
+ ## Error Handling
45
+
46
+ ```typescript
47
+ import { Velixar, VelixarError } from 'velixar';
48
+
49
+ try {
50
+ await v.store('content');
51
+ } catch (e) {
52
+ if (e instanceof VelixarError) {
53
+ console.log(e.status, e.message);
54
+ }
55
+ }
56
+ ```
57
+
58
+ ## License
59
+
60
+ MIT
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Velixar JavaScript SDK - Persistent memory for AI applications.
3
+ */
4
+ interface Memory {
5
+ id: string;
6
+ content: string;
7
+ tier?: number;
8
+ type?: string;
9
+ tags?: string[];
10
+ metadata?: Record<string, unknown>;
11
+ createdAt?: string;
12
+ updatedAt?: string;
13
+ }
14
+ interface SearchResult {
15
+ memories: Memory[];
16
+ count: number;
17
+ }
18
+ interface VelixarConfig {
19
+ apiKey: string;
20
+ baseUrl?: string;
21
+ }
22
+ declare class VelixarError extends Error {
23
+ status: number;
24
+ constructor(status: number, message: string);
25
+ }
26
+ declare class Velixar {
27
+ private apiKey;
28
+ private baseUrl;
29
+ constructor(config: VelixarConfig);
30
+ private request;
31
+ /** Store a memory */
32
+ store(content: string, options?: {
33
+ userId?: string;
34
+ tier?: number;
35
+ type?: string;
36
+ tags?: string[];
37
+ metadata?: Record<string, unknown>;
38
+ }): Promise<{
39
+ id: string;
40
+ }>;
41
+ /** Search memories */
42
+ search(query: string, options?: {
43
+ userId?: string;
44
+ limit?: number;
45
+ }): Promise<SearchResult>;
46
+ /** Get a memory by ID */
47
+ get(id: string): Promise<{
48
+ memory: Memory;
49
+ }>;
50
+ /** Delete a memory */
51
+ delete(id: string): Promise<{
52
+ deleted: boolean;
53
+ }>;
54
+ }
55
+
56
+ export { type Memory, type SearchResult, Velixar, type VelixarConfig, VelixarError, Velixar as default };
@@ -0,0 +1,56 @@
1
+ /**
2
+ * Velixar JavaScript SDK - Persistent memory for AI applications.
3
+ */
4
+ interface Memory {
5
+ id: string;
6
+ content: string;
7
+ tier?: number;
8
+ type?: string;
9
+ tags?: string[];
10
+ metadata?: Record<string, unknown>;
11
+ createdAt?: string;
12
+ updatedAt?: string;
13
+ }
14
+ interface SearchResult {
15
+ memories: Memory[];
16
+ count: number;
17
+ }
18
+ interface VelixarConfig {
19
+ apiKey: string;
20
+ baseUrl?: string;
21
+ }
22
+ declare class VelixarError extends Error {
23
+ status: number;
24
+ constructor(status: number, message: string);
25
+ }
26
+ declare class Velixar {
27
+ private apiKey;
28
+ private baseUrl;
29
+ constructor(config: VelixarConfig);
30
+ private request;
31
+ /** Store a memory */
32
+ store(content: string, options?: {
33
+ userId?: string;
34
+ tier?: number;
35
+ type?: string;
36
+ tags?: string[];
37
+ metadata?: Record<string, unknown>;
38
+ }): Promise<{
39
+ id: string;
40
+ }>;
41
+ /** Search memories */
42
+ search(query: string, options?: {
43
+ userId?: string;
44
+ limit?: number;
45
+ }): Promise<SearchResult>;
46
+ /** Get a memory by ID */
47
+ get(id: string): Promise<{
48
+ memory: Memory;
49
+ }>;
50
+ /** Delete a memory */
51
+ delete(id: string): Promise<{
52
+ deleted: boolean;
53
+ }>;
54
+ }
55
+
56
+ export { type Memory, type SearchResult, Velixar, type VelixarConfig, VelixarError, Velixar as default };
package/dist/index.js ADDED
@@ -0,0 +1,83 @@
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
+ Velixar: () => Velixar,
24
+ VelixarError: () => VelixarError,
25
+ default: () => index_default
26
+ });
27
+ module.exports = __toCommonJS(index_exports);
28
+ var VelixarError = class extends Error {
29
+ constructor(status, message) {
30
+ super(message);
31
+ this.status = status;
32
+ this.name = "VelixarError";
33
+ }
34
+ };
35
+ var Velixar = class {
36
+ constructor(config) {
37
+ this.apiKey = config.apiKey;
38
+ this.baseUrl = config.baseUrl || "https://api.velixar.ai/v1";
39
+ }
40
+ async request(path, options = {}) {
41
+ const res = await fetch(`${this.baseUrl}${path}`, {
42
+ ...options,
43
+ headers: {
44
+ "Authorization": `Bearer ${this.apiKey}`,
45
+ "Content-Type": "application/json",
46
+ ...options.headers
47
+ }
48
+ });
49
+ const data = await res.json();
50
+ if (!res.ok) {
51
+ throw new VelixarError(res.status, data.error || "Request failed");
52
+ }
53
+ return data;
54
+ }
55
+ /** Store a memory */
56
+ async store(content, options) {
57
+ return this.request("/memory", {
58
+ method: "POST",
59
+ body: JSON.stringify({ content, ...options })
60
+ });
61
+ }
62
+ /** Search memories */
63
+ async search(query, options) {
64
+ const params = new URLSearchParams({ q: query });
65
+ if (options?.userId) params.set("user_id", options.userId);
66
+ if (options?.limit) params.set("limit", String(options.limit));
67
+ return this.request(`/memory/search?${params}`);
68
+ }
69
+ /** Get a memory by ID */
70
+ async get(id) {
71
+ return this.request(`/memory/${id}`);
72
+ }
73
+ /** Delete a memory */
74
+ async delete(id) {
75
+ return this.request(`/memory/${id}`, { method: "DELETE" });
76
+ }
77
+ };
78
+ var index_default = Velixar;
79
+ // Annotate the CommonJS export names for ESM import in node:
80
+ 0 && (module.exports = {
81
+ Velixar,
82
+ VelixarError
83
+ });
package/dist/index.mjs ADDED
@@ -0,0 +1,57 @@
1
+ // src/index.ts
2
+ var VelixarError = class extends Error {
3
+ constructor(status, message) {
4
+ super(message);
5
+ this.status = status;
6
+ this.name = "VelixarError";
7
+ }
8
+ };
9
+ var Velixar = class {
10
+ constructor(config) {
11
+ this.apiKey = config.apiKey;
12
+ this.baseUrl = config.baseUrl || "https://api.velixar.ai/v1";
13
+ }
14
+ async request(path, options = {}) {
15
+ const res = await fetch(`${this.baseUrl}${path}`, {
16
+ ...options,
17
+ headers: {
18
+ "Authorization": `Bearer ${this.apiKey}`,
19
+ "Content-Type": "application/json",
20
+ ...options.headers
21
+ }
22
+ });
23
+ const data = await res.json();
24
+ if (!res.ok) {
25
+ throw new VelixarError(res.status, data.error || "Request failed");
26
+ }
27
+ return data;
28
+ }
29
+ /** Store a memory */
30
+ async store(content, options) {
31
+ return this.request("/memory", {
32
+ method: "POST",
33
+ body: JSON.stringify({ content, ...options })
34
+ });
35
+ }
36
+ /** Search memories */
37
+ async search(query, options) {
38
+ const params = new URLSearchParams({ q: query });
39
+ if (options?.userId) params.set("user_id", options.userId);
40
+ if (options?.limit) params.set("limit", String(options.limit));
41
+ return this.request(`/memory/search?${params}`);
42
+ }
43
+ /** Get a memory by ID */
44
+ async get(id) {
45
+ return this.request(`/memory/${id}`);
46
+ }
47
+ /** Delete a memory */
48
+ async delete(id) {
49
+ return this.request(`/memory/${id}`, { method: "DELETE" });
50
+ }
51
+ };
52
+ var index_default = Velixar;
53
+ export {
54
+ Velixar,
55
+ VelixarError,
56
+ index_default as default
57
+ };
package/package.json ADDED
@@ -0,0 +1,34 @@
1
+ {
2
+ "name": "velixar",
3
+ "version": "0.1.0",
4
+ "description": "Persistent memory infrastructure for AI applications",
5
+ "main": "dist/index.js",
6
+ "module": "dist/index.mjs",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "import": "./dist/index.mjs",
11
+ "require": "./dist/index.js",
12
+ "types": "./dist/index.d.ts"
13
+ }
14
+ },
15
+ "files": ["dist"],
16
+ "scripts": {
17
+ "build": "tsup src/index.ts --format cjs,esm --dts",
18
+ "test": "vitest",
19
+ "prepublishOnly": "npm run build"
20
+ },
21
+ "keywords": ["ai", "memory", "llm", "langchain", "vector", "rag"],
22
+ "author": "Velixar <sdk@velixar.ai>",
23
+ "license": "MIT",
24
+ "repository": {
25
+ "type": "git",
26
+ "url": "https://github.com/velixar/velixar-js"
27
+ },
28
+ "homepage": "https://velixar.ai",
29
+ "devDependencies": {
30
+ "tsup": "^8.0.0",
31
+ "typescript": "^5.0.0",
32
+ "vitest": "^1.0.0"
33
+ }
34
+ }