Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@aitytech/agentkits-memory",
"version": "2.2.1",
"version": "2.2.2",
"type": "module",
"description": "Persistent memory system for AI coding assistants via MCP. Works with Claude Code, Cursor, Copilot, Windsurf, Cline.",
"main": "dist/index.js",
Expand Down
37 changes: 31 additions & 6 deletions src/cli/web-viewer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2923,12 +2923,37 @@ function handleRequest(

const server = http.createServer(handleRequest);

server.listen(PORT, () => {
console.log(`\n AgentKits Memory Viewer\n`);
console.log(` Local: http://localhost:${PORT}`);
console.log(` Database: ${dbPath}\n`);
console.log(` Press Ctrl+C to stop\n`);
});
/** Try to listen on the given port; on EADDRINUSE, pick a random available port. */
function startServer(port: number) {
server.listen(port, () => {
const addr = server.address();
const actualPort = typeof addr === 'object' && addr ? addr.port : port;
console.log(`\n AgentKits Memory Viewer\n`);
console.log(` Local: http://localhost:${actualPort}`);
console.log(` Database: ${dbPath}\n`);
console.log(` Press Ctrl+C to stop\n`);
});

server.on('error', (err: NodeJS.ErrnoException) => {
if (err.code === 'EADDRINUSE') {
console.log(` Port ${port} is in use, finding an available port...`);
// Listen on port 0 to let the OS assign a random available port
server.listen(0, () => {
const addr = server.address();
const actualPort = typeof addr === 'object' && addr ? addr.port : 0;
console.log(`\n AgentKits Memory Viewer\n`);
console.log(` Local: http://localhost:${actualPort}`);
console.log(` Database: ${dbPath}\n`);
console.log(` Press Ctrl+C to stop\n`);
});
} else {
console.error(` Failed to start server: ${err.message}`);
process.exit(1);
}
});
}

startServer(PORT);

// Graceful shutdown: close server, DB, and embeddings service on SIGINT/SIGTERM
function cleanup() {
Expand Down