@memoryblock/daemon 0.1.0-beta → 0.1.1-beta

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,35 @@
1
+ # @memoryblock/daemon
2
+
3
+ Background daemon manager for **memoryblock**.
4
+
5
+ This package handles:
6
+ - Block lifecycle (start, stop, status, reset)
7
+ - Daemon process persistence
8
+ - Logs handling
9
+
10
+ ## The `memoryblock` Ecosystem
11
+
12
+ **memoryblock** is a highly modular system. Here are the official packages:
13
+
14
+ **The Core**
15
+ * [**memoryblock**](https://www.npmjs.com/package/memoryblock) - The core engine interface and types.
16
+ * [**@memoryblock/daemon**](https://www.npmjs.com/package/@memoryblock/daemon) - Background daemon manager.
17
+ * [**@memoryblock/api**](https://www.npmjs.com/package/@memoryblock/api) - Core REST and WebSocket API server.
18
+
19
+ **Integrations & Tooling**
20
+ * [**@memoryblock/adapters**](https://www.npmjs.com/package/@memoryblock/adapters) - LLM adapters (OpenAI, Anthropic, Bedrock, etc).
21
+ * [**@memoryblock/channels**](https://www.npmjs.com/package/@memoryblock/channels) - Communication channels (CLI, Telegram, Web).
22
+ * [**@memoryblock/tools**](https://www.npmjs.com/package/@memoryblock/tools) - Standard tool definitions and schemas.
23
+ * [**@memoryblock/locale**](https://www.npmjs.com/package/@memoryblock/locale) - Localization strings and formatting.
24
+ * [**@memoryblock/web**](https://www.npmjs.com/package/@memoryblock/web) - Front-end dashboard and Web UI.
25
+
26
+ **Plugins**
27
+ * [**@memoryblock/plugin-installer**](https://www.npmjs.com/package/@memoryblock/plugin-installer) - Plugin installer and registry manager.
28
+ * [**@memoryblock/plugin-agents**](https://www.npmjs.com/package/@memoryblock/plugin-agents) - Secondary AI agents orchestrator.
29
+ * [**@memoryblock/plugin-aws**](https://www.npmjs.com/package/@memoryblock/plugin-aws) - AWS integrations.
30
+ * [**@memoryblock/plugin-fetch-webpage**](https://www.npmjs.com/package/@memoryblock/plugin-fetch-webpage) - Web content fetching and parsing.
31
+ * [**@memoryblock/plugin-web-search**](https://www.npmjs.com/package/@memoryblock/plugin-web-search) - Web search capabilities.
32
+
33
+ ## License
34
+
35
+ Distributed under the MIT License. See `LICENSE` for more information.
package/package.json CHANGED
@@ -1,7 +1,11 @@
1
1
  {
2
2
  "name": "@memoryblock/daemon",
3
- "version": "0.1.0-beta",
3
+ "version": "0.1.1-beta",
4
4
  "type": "module",
5
+ "description": "Background daemon manager for memoryblock.",
6
+ "files": [
7
+ "dist/"
8
+ ],
5
9
  "main": "./dist/index.js",
6
10
  "types": "./dist/index.d.ts",
7
11
  "exports": {
@@ -10,10 +14,39 @@
10
14
  "import": "./dist/index.js"
11
15
  }
12
16
  },
13
- "dependencies": {
14
- "memoryblock": "0.1.0-beta"
15
- },
16
17
  "scripts": {
17
18
  "build": "tsc -p tsconfig.json"
18
- }
19
+ },
20
+ "dependencies": {
21
+ "memoryblock": "^0.1.1-beta"
22
+ },
23
+ "keywords": [
24
+ "memoryblock",
25
+ "mblk",
26
+ "ai-agent",
27
+ "assistants",
28
+ "agents",
29
+ "automation",
30
+ "multi-agent",
31
+ "agentic-framework",
32
+ "daemon",
33
+ "background",
34
+ "process",
35
+ "service",
36
+ "manager"
37
+ ],
38
+ "author": {
39
+ "name": "Ghazi",
40
+ "url": "https://mgks.dev"
41
+ },
42
+ "repository": {
43
+ "type": "git",
44
+ "url": "git+https://github.com/memoryblock-io/memoryblock.git"
45
+ },
46
+ "bugs": {
47
+ "url": "https://github.com/memoryblock-io/memoryblock/issues"
48
+ },
49
+ "homepage": "https://memoryblock.io",
50
+ "funding": "https://github.com/sponsors/mgks",
51
+ "license": "MIT"
19
52
  }
package/src/index.ts DELETED
@@ -1,57 +0,0 @@
1
- import { spawn } from 'node:child_process';
2
- import { join } from 'node:path';
3
- import { promises as fsp } from 'node:fs';
4
-
5
- /**
6
- * Spawns a background daemon for a memoryblock.
7
- * Detaches the process and writes its PID to blockPath/daemon.pid
8
- */
9
- export async function spawnDaemon(blockName: string, _channel: string, blockPath: string): Promise<number> {
10
- const scriptPath = process.argv[1];
11
-
12
- const out = await fsp.open(join(blockPath, 'daemon-debug.log'), 'a');
13
-
14
- // Always use 'multi' so the daemon initializes ALL available channels
15
- // (web, telegram, etc.) and auto-routes messages via MultiChannelManager
16
- const child = spawn(process.execPath, [
17
- scriptPath, 'start', blockName, '--channel', 'multi'
18
- ], {
19
- detached: true,
20
- stdio: ['ignore', out.fd, out.fd], // Pipe to debug log
21
- env: { ...process.env, MBLK_IS_DAEMON: '1' } // Preserve authentication keys and mark as daemon
22
- });
23
-
24
- child.unref(); // Prevent parent from waiting for child
25
- await out.close();
26
-
27
- if (child.pid) {
28
- await fsp.writeFile(join(blockPath, 'daemon.pid'), child.pid.toString());
29
- return child.pid;
30
- }
31
- throw new Error('Failed to spawn daemon process');
32
- }
33
-
34
- /**
35
- * Reads daemon.pid for a block and sends SIGTERM.
36
- */
37
- export async function killDaemon(blockPath: string): Promise<boolean> {
38
- try {
39
- const pidPath = join(blockPath, 'daemon.pid');
40
- const pidStr = await fsp.readFile(pidPath, 'utf8');
41
- const pid = parseInt(pidStr.trim(), 10);
42
-
43
- if (pid && !isNaN(pid)) {
44
- try {
45
- process.kill(pid); // Send SIGTERM
46
- } catch (kErr: any) {
47
- // If ESRCH (No such process), process mapping is dead but file exists.
48
- if (kErr.code !== 'ESRCH') throw kErr;
49
- }
50
- await fsp.unlink(pidPath).catch(() => {});
51
- return true;
52
- }
53
- } catch {
54
- // PID file doesn't exist
55
- }
56
- return false;
57
- }
package/tsconfig.json DELETED
@@ -1,10 +0,0 @@
1
- {
2
- "extends": "../../tsconfig.json",
3
- "compilerOptions": {
4
- "outDir": "dist",
5
- "rootDir": "src"
6
- },
7
- "include": [
8
- "src"
9
- ]
10
- }