@cybermem/cli 0.8.7 → 0.9.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.
@@ -1,5 +1,17 @@
1
- FROM node:20-alpine
1
+ # Builder stage for native modules
2
+ FROM node:20-alpine AS builder
2
3
  WORKDIR /app
4
+ RUN apk add --no-cache python3 make g++
5
+ COPY package.json ./
6
+ RUN npm install
7
+
8
+ # Production stage
9
+ FROM node:20-alpine AS runner
10
+ WORKDIR /app
11
+ RUN apk add --no-cache libc6-compat
12
+ COPY --from=builder /app/node_modules ./node_modules
3
13
  COPY server.js .
14
+ COPY package.json .
15
+
4
16
  EXPOSE 3001
5
17
  CMD ["node", "server.js"]
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "cybermem-auth-sidecar",
3
+ "version": "0.1.0",
4
+ "description": "Auth sidecar for CyberMem",
5
+ "main": "server.js",
6
+ "dependencies": {
7
+ "sqlite3": "5.1.7"
8
+ }
9
+ }
@@ -11,10 +11,37 @@
11
11
  const http = require("http");
12
12
  const crypto = require("crypto");
13
13
  const path = require("path");
14
+ const sqlite3 = require("sqlite3").verbose();
14
15
 
15
16
  const PORT = process.env.PORT || 3001;
16
17
  const DB_PATH = process.env.OM_DB_PATH || "/data/openmemory.sqlite";
17
18
 
19
+ // Ensure schema exists
20
+ function initSchema() {
21
+ const db = new sqlite3.Database(DB_PATH);
22
+ db.serialize(() => {
23
+ db.run(
24
+ `
25
+ CREATE TABLE IF NOT EXISTS access_keys (
26
+ key_id TEXT PRIMARY KEY,
27
+ key_hash TEXT UNIQUE NOT NULL,
28
+ user_id TEXT NOT NULL,
29
+ name TEXT,
30
+ is_active INTEGER DEFAULT 1,
31
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP
32
+ )
33
+ `,
34
+ (err) => {
35
+ if (err) console.error("SCHEMA ERROR:", err.message);
36
+ else console.log("Schema verified for access_keys");
37
+ db.close();
38
+ },
39
+ );
40
+ });
41
+ }
42
+
43
+ initSchema();
44
+
18
45
  // Hash token using same PBKDF2 as CLI (for verification)
19
46
  function hashToken(token) {
20
47
  return new Promise((resolve, reject) => {
@@ -33,7 +60,6 @@ function hashToken(token) {
33
60
  // Verify token against SQLite access_keys table
34
61
  async function verifyToken(token) {
35
62
  try {
36
- const sqlite3 = require("sqlite3").verbose();
37
63
  const db = new sqlite3.Database(DB_PATH);
38
64
 
39
65
  const tokenHash = await hashToken(token);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cybermem/cli",
3
- "version": "0.8.7",
3
+ "version": "0.9.0",
4
4
  "description": "CyberMem — Universal Long-Term Memory for AI Agents",
5
5
  "homepage": "https://cybermem.dev",
6
6
  "repository": {
@@ -1,5 +1,17 @@
1
- FROM node:20-alpine
1
+ # Builder stage for native modules
2
+ FROM node:20-alpine AS builder
2
3
  WORKDIR /app
4
+ RUN apk add --no-cache python3 make g++
5
+ COPY package.json ./
6
+ RUN npm install
7
+
8
+ # Production stage
9
+ FROM node:20-alpine AS runner
10
+ WORKDIR /app
11
+ RUN apk add --no-cache libc6-compat
12
+ COPY --from=builder /app/node_modules ./node_modules
3
13
  COPY server.js .
14
+ COPY package.json .
15
+
4
16
  EXPOSE 3001
5
17
  CMD ["node", "server.js"]
@@ -0,0 +1,9 @@
1
+ {
2
+ "name": "cybermem-auth-sidecar",
3
+ "version": "0.1.0",
4
+ "description": "Auth sidecar for CyberMem",
5
+ "main": "server.js",
6
+ "dependencies": {
7
+ "sqlite3": "5.1.7"
8
+ }
9
+ }
@@ -11,10 +11,37 @@
11
11
  const http = require("http");
12
12
  const crypto = require("crypto");
13
13
  const path = require("path");
14
+ const sqlite3 = require("sqlite3").verbose();
14
15
 
15
16
  const PORT = process.env.PORT || 3001;
16
17
  const DB_PATH = process.env.OM_DB_PATH || "/data/openmemory.sqlite";
17
18
 
19
+ // Ensure schema exists
20
+ function initSchema() {
21
+ const db = new sqlite3.Database(DB_PATH);
22
+ db.serialize(() => {
23
+ db.run(
24
+ `
25
+ CREATE TABLE IF NOT EXISTS access_keys (
26
+ key_id TEXT PRIMARY KEY,
27
+ key_hash TEXT UNIQUE NOT NULL,
28
+ user_id TEXT NOT NULL,
29
+ name TEXT,
30
+ is_active INTEGER DEFAULT 1,
31
+ created_at DATETIME DEFAULT CURRENT_TIMESTAMP
32
+ )
33
+ `,
34
+ (err) => {
35
+ if (err) console.error("SCHEMA ERROR:", err.message);
36
+ else console.log("Schema verified for access_keys");
37
+ db.close();
38
+ },
39
+ );
40
+ });
41
+ }
42
+
43
+ initSchema();
44
+
18
45
  // Hash token using same PBKDF2 as CLI (for verification)
19
46
  function hashToken(token) {
20
47
  return new Promise((resolve, reject) => {
@@ -33,7 +60,6 @@ function hashToken(token) {
33
60
  // Verify token against SQLite access_keys table
34
61
  async function verifyToken(token) {
35
62
  try {
36
- const sqlite3 = require("sqlite3").verbose();
37
63
  const db = new sqlite3.Database(DB_PATH);
38
64
 
39
65
  const tokenHash = await hashToken(token);