@memextend/webui 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.
@@ -0,0 +1,7 @@
1
+ export interface ServerConfig {
2
+ port: number;
3
+ host: string;
4
+ }
5
+ export declare function createServer(config?: ServerConfig): Promise<import("express-serve-static-core").Express>;
6
+ export declare function startServer(config?: ServerConfig): Promise<void>;
7
+ //# sourceMappingURL=server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAuBA,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd;AAED,wBAAsB,YAAY,CAAC,MAAM,GAAE,YAAgD,wDAqD1F;AAED,wBAAsB,WAAW,CAAC,MAAM,GAAE,YAAgD,iBAWzF"}
package/dist/server.js ADDED
@@ -0,0 +1,84 @@
1
+ // apps/webui/src/server.ts
2
+ // Copyright (c) 2026 ZodTTD LLC. MIT License.
3
+ import express from 'express';
4
+ import { join, dirname } from 'path';
5
+ import { fileURLToPath } from 'url';
6
+ import { homedir } from 'os';
7
+ import { existsSync } from 'fs';
8
+ import { memoriesRouter } from './api/memories.js';
9
+ import { projectsRouter } from './api/projects.js';
10
+ import { searchRouter } from './api/search.js';
11
+ import { statsRouter } from './api/stats.js';
12
+ import { configRouter } from './api/config.js';
13
+ const __filename = fileURLToPath(import.meta.url);
14
+ const __dirname = dirname(__filename);
15
+ // Configuration
16
+ const MEMEXTEND_DIR = join(homedir(), '.memextend');
17
+ const DB_PATH = join(MEMEXTEND_DIR, 'memextend.db');
18
+ const VECTORS_PATH = join(MEMEXTEND_DIR, 'vectors');
19
+ const MODELS_PATH = join(MEMEXTEND_DIR, 'models');
20
+ export async function createServer(config = { port: 3333, host: 'localhost' }) {
21
+ const app = express();
22
+ // Middleware
23
+ app.use(express.json());
24
+ // CORS for local development
25
+ app.use((req, res, next) => {
26
+ res.header('Access-Control-Allow-Origin', '*');
27
+ res.header('Access-Control-Allow-Methods', 'GET, POST, PUT, DELETE, OPTIONS');
28
+ res.header('Access-Control-Allow-Headers', 'Content-Type, Authorization');
29
+ if (req.method === 'OPTIONS') {
30
+ res.sendStatus(200);
31
+ return;
32
+ }
33
+ next();
34
+ });
35
+ // Check if memextend is initialized
36
+ if (!existsSync(DB_PATH)) {
37
+ console.error('Error: memextend not initialized. Run `memextend init` first.');
38
+ process.exit(1);
39
+ }
40
+ // Store paths in app locals for routes to access
41
+ app.locals.dbPath = DB_PATH;
42
+ app.locals.vectorsPath = VECTORS_PATH;
43
+ app.locals.modelsPath = MODELS_PATH;
44
+ app.locals.memextendDir = MEMEXTEND_DIR;
45
+ // API routes
46
+ app.use('/api/memories', memoriesRouter);
47
+ app.use('/api/projects', projectsRouter);
48
+ app.use('/api/search', searchRouter);
49
+ app.use('/api/stats', statsRouter);
50
+ app.use('/api/config', configRouter);
51
+ // Serve static files
52
+ const publicDir = join(__dirname, 'public');
53
+ app.use(express.static(publicDir));
54
+ // SPA fallback - serve index.html for all other routes
55
+ app.get('*', (req, res) => {
56
+ res.sendFile(join(publicDir, 'index.html'));
57
+ });
58
+ // Error handler
59
+ app.use((err, req, res, next) => {
60
+ console.error('Server error:', err);
61
+ res.status(500).json({ error: err.message });
62
+ });
63
+ return app;
64
+ }
65
+ export async function startServer(config = { port: 3333, host: 'localhost' }) {
66
+ const app = await createServer(config);
67
+ return new Promise((resolve) => {
68
+ app.listen(config.port, config.host, () => {
69
+ console.log(`\n memextend Web UI\n`);
70
+ console.log(` Server running at http://${config.host}:${config.port}`);
71
+ console.log(` Press Ctrl+C to stop\n`);
72
+ resolve();
73
+ });
74
+ });
75
+ }
76
+ // Run if executed directly
77
+ const isMainModule = process.argv[1] && (process.argv[1].endsWith('server.js') ||
78
+ process.argv[1].endsWith('server.ts'));
79
+ if (isMainModule) {
80
+ const port = parseInt(process.env.PORT || '3333', 10);
81
+ const host = process.env.HOST || 'localhost';
82
+ startServer({ port, host }).catch(console.error);
83
+ }
84
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"server.js","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,2BAA2B;AAC3B,8CAA8C;AAE9C,OAAO,OAA4C,MAAM,SAAS,CAAC;AACnE,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AACrC,OAAO,EAAE,aAAa,EAAE,MAAM,KAAK,CAAC;AACpC,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,UAAU,EAAY,MAAM,IAAI,CAAC;AAC1C,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,MAAM,mBAAmB,CAAC;AACnD,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAE/C,MAAM,UAAU,GAAG,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAClD,MAAM,SAAS,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;AAEtC,gBAAgB;AAChB,MAAM,aAAa,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,YAAY,CAAC,CAAC;AACpD,MAAM,OAAO,GAAG,IAAI,CAAC,aAAa,EAAE,cAAc,CAAC,CAAC;AACpD,MAAM,YAAY,GAAG,IAAI,CAAC,aAAa,EAAE,SAAS,CAAC,CAAC;AACpD,MAAM,WAAW,GAAG,IAAI,CAAC,aAAa,EAAE,QAAQ,CAAC,CAAC;AAOlD,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,SAAuB,EAAE,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE;IACzF,MAAM,GAAG,GAAG,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G,CAAC,0BAA0B,CAAC,CAAC;YACxC,OAAO,EAAE,CAAC;QACZ,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAED,2BAA2B;AAC3B,MAAM,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CACtC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC;IACrC,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,WAAW,CAAC,CACtC,CAAC;AAEF,IAAI,YAAY,EAAE,CAAC;IACjB,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,MAAM,EAAE,EAAE,CAAC,CAAC;IACtD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,IAAI,WAAW,CAAC;IAC7C,WAAW,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;AACnD,CAAC"}
package/package.json ADDED
@@ -0,0 +1,47 @@
1
+ {
2
+ "name": "@memextend/webui",
3
+ "version": "0.1.0",
4
+ "description": "Web UI for memextend - view and manage your AI memory",
5
+ "author": "ZodTTD LLC <repo@zodttd.com>",
6
+ "license": "MIT",
7
+ "type": "module",
8
+ "main": "dist/server.js",
9
+ "scripts": {
10
+ "build": "tsc && cp -r src/public dist/",
11
+ "start": "node dist/server.js",
12
+ "dev": "tsc && cp -r src/public dist/ && node dist/server.js"
13
+ },
14
+ "dependencies": {
15
+ "@memextend/core": "^0.1.0",
16
+ "express": "^4.18.2"
17
+ },
18
+ "devDependencies": {
19
+ "@types/express": "^4.17.21"
20
+ },
21
+ "repository": {
22
+ "type": "git",
23
+ "url": "https://github.com/zodttd/memextend.git",
24
+ "directory": "apps/webui"
25
+ },
26
+ "bugs": {
27
+ "url": "https://github.com/zodttd/memextend/issues"
28
+ },
29
+ "homepage": "https://github.com/zodttd/memextend#readme",
30
+ "keywords": [
31
+ "memextend",
32
+ "webui",
33
+ "ai-memory",
34
+ "dashboard",
35
+ "memory-management"
36
+ ],
37
+ "files": [
38
+ "dist",
39
+ "README.md"
40
+ ],
41
+ "engines": {
42
+ "node": ">=18.0.0"
43
+ },
44
+ "publishConfig": {
45
+ "access": "public"
46
+ }
47
+ }