engrams 0.1.0 → 0.2.1
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 +11 -3
- package/dist/cli.js +1136 -51
- package/dist/http.js +16 -4
- package/dist/index.js +1136 -51
- package/package.json +4 -2
package/dist/http.js
CHANGED
|
@@ -28,12 +28,14 @@ var memories = sqliteTable("memories", {
|
|
|
28
28
|
hasPiiFlag: integer("has_pii_flag").notNull().default(0),
|
|
29
29
|
entityType: text("entity_type"),
|
|
30
30
|
entityName: text("entity_name"),
|
|
31
|
-
structuredData: text("structured_data")
|
|
31
|
+
structuredData: text("structured_data"),
|
|
32
|
+
updatedAt: text("updated_at")
|
|
32
33
|
});
|
|
33
34
|
var memoryConnections = sqliteTable("memory_connections", {
|
|
34
35
|
sourceMemoryId: text("source_memory_id").notNull().references(() => memories.id),
|
|
35
36
|
targetMemoryId: text("target_memory_id").notNull().references(() => memories.id),
|
|
36
|
-
relationship: text("relationship").notNull()
|
|
37
|
+
relationship: text("relationship").notNull(),
|
|
38
|
+
updatedAt: text("updated_at")
|
|
37
39
|
});
|
|
38
40
|
var memoryEvents = sqliteTable("memory_events", {
|
|
39
41
|
id: text("id").primaryKey(),
|
|
@@ -75,6 +77,16 @@ var require2 = createRequire(import.meta.url);
|
|
|
75
77
|
// ../core/dist/embeddings.js
|
|
76
78
|
var CACHE_TTL_MS = 5 * 60 * 1e3;
|
|
77
79
|
|
|
80
|
+
// ../core/dist/credentials.js
|
|
81
|
+
import { resolve } from "path";
|
|
82
|
+
import { homedir } from "os";
|
|
83
|
+
var ENGRAMS_DIR = resolve(homedir(), ".engrams");
|
|
84
|
+
var CRED_PATH = resolve(ENGRAMS_DIR, "credentials.json");
|
|
85
|
+
var CONFIG_PATH = resolve(ENGRAMS_DIR, "config.json");
|
|
86
|
+
|
|
87
|
+
// ../core/dist/sync.js
|
|
88
|
+
import { createClient } from "@libsql/client";
|
|
89
|
+
|
|
78
90
|
// src/http.ts
|
|
79
91
|
function generateId() {
|
|
80
92
|
return randomBytes(16).toString("hex");
|
|
@@ -87,12 +99,12 @@ function json(res, data, status = 200) {
|
|
|
87
99
|
res.end(JSON.stringify(data));
|
|
88
100
|
}
|
|
89
101
|
function parseBody(req) {
|
|
90
|
-
return new Promise((
|
|
102
|
+
return new Promise((resolve2, reject) => {
|
|
91
103
|
let body = "";
|
|
92
104
|
req.on("data", (chunk) => body += chunk);
|
|
93
105
|
req.on("end", () => {
|
|
94
106
|
try {
|
|
95
|
-
|
|
107
|
+
resolve2(body ? JSON.parse(body) : {});
|
|
96
108
|
} catch {
|
|
97
109
|
reject(new Error("Invalid JSON"));
|
|
98
110
|
}
|