memoryblock 0.1.3 → 0.1.4

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.
Files changed (3) hide show
  1. package/README.md +21 -25
  2. package/bin/mblk.js +88 -0
  3. package/package.json +8 -4
package/README.md CHANGED
@@ -90,23 +90,33 @@ Adding a new adapter is one file. See [adapter docs](https://docs.memoryblock.io
90
90
 
91
91
  ## Quick Start
92
92
 
93
- **Requirements:** [Bun](https://bun.sh) 1.0 and an API key from any supported provider.
93
+ Memoryblock is built natively for [Bun](https://bun.sh) for maximum performance, but we package a smart installer so you can get started using whatever you already have!
94
94
 
95
+ ### 1. Install memoryblock
96
+
97
+ **- Option A: Bun (Recommended)**
98
+ If you already use Bun, this is the absolute fastest way to install:
99
+ ```bash
100
+ bun install -g memoryblock
101
+ ```
102
+
103
+ **- Option B: Node.js / NPM**
95
104
  ```bash
96
- # clone and set up
97
- git clone https://github.com/memoryblock-io/memoryblock.git
98
- cd memoryblock
99
- pnpm dev:onboard -gl
105
+ npm install -g memoryblock
106
+ ```
100
107
 
101
- # run the setup wizard
108
+ ### 2. Setup your ecosystem
109
+ Run the setup wizard to verify your local environment and enter your initial provider API keys:
110
+ ```bash
102
111
  mblk init
112
+ ```
103
113
 
104
- # start your first block
114
+ ### 3. Deploy your first block
115
+ That's it! You can now start your very first personal assistant block:
116
+ ```bash
105
117
  mblk start home
106
118
  ```
107
119
 
108
- That's it. The wizard handles credentials, verification, and creating your first block.
109
-
110
120
  ### Web Dashboard
111
121
 
112
122
  ```bash
@@ -171,23 +181,8 @@ Channels are how your blocks talk to the outside world. The CLI, messaging platf
171
181
 
172
182
  Supported and upcoming channels are documented in [channels](https://docs.memoryblock.io/channels/).
173
183
 
174
- ## Architecture
175
-
176
- ```
177
- packages/
178
- ├── core/ # engine, CLI, schemas, monitor loop
179
- ├── adapters/ # LLM provider adapters
180
- ├── channels/ # messaging channel transports
181
- ├── api/ # HTTP + WebSocket server
182
- ├── web/ # static web dashboard
183
- ├── tools/ # base tool registry and schema helpers
184
- ├── daemon/ # background process management
185
- └── plugins/ # extensible capability modules
186
- ```
187
-
188
- It's a pnpm monorepo. Every package builds independently with `tsc`. No bundlers, no magic.
189
-
190
184
  ## Community & Support
185
+
191
186
  - **Contributing**: We welcome PRs! See [CONTRIBUTING.md](.github/CONTRIBUTING.md).
192
187
  - **Support**: If you find `memoryblock` useful, please consider [sponsoring the project](https://github.com/sponsors/mgks) or giving it a star ⭐.
193
188
 
@@ -200,6 +195,7 @@ It's a pnpm monorepo. Every package builds independently with `tsc`. No bundlers
200
195
  * [**@memoryblock/daemon**](https://www.npmjs.com/package/@memoryblock/daemon) - Background daemon manager.
201
196
  * [**@memoryblock/api**](https://www.npmjs.com/package/@memoryblock/api) - Core REST and WebSocket API server.
202
197
  * [**@memoryblock/cli**](https://www.npmjs.com/package/@memoryblock/cli) - Command-line interface.
198
+ * [**@memoryblock/types**](https://www.npmjs.com/package/@memoryblock/types) - Core TypeScript definitions and schemas.
203
199
 
204
200
  **Integrations & Tooling**
205
201
  * [**@memoryblock/adapters**](https://www.npmjs.com/package/@memoryblock/adapters) - LLM adapters (OpenAI, Anthropic, Bedrock, etc).
package/bin/mblk.js ADDED
@@ -0,0 +1,88 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * memoryblock - Auto-Bootstrap CLI Wrapper
4
+ *
5
+ * Ensures the end-user has a flawless zero-configuration setup.
6
+ * Automatically checks and installs Bun (the high-performance runtime)
7
+ * and the @memoryblock/cli ecosystem tools if they are missing.
8
+ */
9
+ const { execSync, spawnSync } = require('child_process');
10
+ const path = require('path');
11
+ const fs = require('fs');
12
+ const os = require('os');
13
+
14
+ // Helper to silently run commands
15
+ const run = (cmd) => {
16
+ try {
17
+ return execSync(cmd, { stdio: 'pipe' }).toString().trim();
18
+ } catch {
19
+ return null;
20
+ }
21
+ };
22
+
23
+ const localBun = path.join(os.homedir(), '.bun', 'bin', 'bun');
24
+ const bunGlobalRoot = path.join(os.homedir(), '.bun', 'install', 'global', 'node_modules');
25
+ const cliScriptBun = path.join(bunGlobalRoot, '@memoryblock/cli', 'bin', 'mblk.js');
26
+
27
+ // 0ms Fast-Path: If everything is already installed natively, skip ALL slow checks!
28
+ if (fs.existsSync(localBun) && fs.existsSync(cliScriptBun)) {
29
+ const result = spawnSync(localBun, [cliScriptBun, ...process.argv.slice(2)], { stdio: 'inherit' });
30
+ process.exit(result.status ?? 1);
31
+ }
32
+
33
+ // Check package managers (Slow Path)
34
+ let bunPath = run('command -v bun');
35
+ const hasNpm = !!run('command -v npm');
36
+ const hasBunFn = !!run('command -v bun');
37
+
38
+ // 1. Install Bun if completely missing
39
+ if (!hasBunFn && !fs.existsSync(localBun)) {
40
+ console.log('\n⚡ \x1b[1mmemoryblock\x1b[0m is powered by \x1b[33mBun\x1b[0m for extreme performance.');
41
+ console.log(' Installing the lightweight engine automatically...\n');
42
+ try {
43
+ execSync('curl -fsSL https://bun.sh/install | bash', { stdio: 'inherit' });
44
+ bunPath = localBun;
45
+ console.log('\n✅ Bun installed successfully!');
46
+ } catch (e) {
47
+ console.error('\n❌ Failed to automatically install Bun. Please run: curl -fsSL https://bun.sh/install | bash');
48
+ process.exit(1);
49
+ }
50
+ }
51
+ if (!bunPath) bunPath = localBun;
52
+
53
+ // 2. Identify global path & manager
54
+ const npmGlobalRoot = hasNpm ? run('npm root -g') : null;
55
+ let cliScript = cliScriptBun;
56
+
57
+ // 3. Install @memoryblock/cli if missing
58
+ // (We also gracefully check if NPM already downloaded it first so we don't redownload)
59
+ if (!fs.existsSync(cliScript) && npmGlobalRoot) {
60
+ const npmScript = path.join(npmGlobalRoot, '@memoryblock/cli', 'bin', 'mblk.js');
61
+ if (fs.existsSync(npmScript)) cliScript = npmScript;
62
+ }
63
+
64
+ if (!fs.existsSync(cliScript)) {
65
+ console.log('\n📦 Downloading memoryblock terminal interface tools...\n');
66
+ try {
67
+ execSync(`${bunPath} install -g @memoryblock/cli@latest`, { stdio: 'inherit' });
68
+ cliScript = path.join(bunGlobalRoot, '@memoryblock/cli', 'bin', 'mblk.js');
69
+ } catch (e) {
70
+ if (hasNpm) {
71
+ console.log('\n⚠️ Bun global install tripped. Falling back to NPM...\n');
72
+ try {
73
+ execSync('npm install -g @memoryblock/cli@latest', { stdio: 'inherit' });
74
+ cliScript = path.join(npmGlobalRoot, '@memoryblock/cli', 'bin', 'mblk.js');
75
+ } catch (err) {
76
+ console.error('\n❌ Failed to sync @memoryblock/cli. Please run manually: npm install -g @memoryblock/cli');
77
+ process.exit(1);
78
+ }
79
+ } else {
80
+ console.error(`\n❌ Failed to sync @memoryblock/cli. Please run manually: ${bunPath} install -g @memoryblock/cli`);
81
+ process.exit(1);
82
+ }
83
+ }
84
+ }
85
+
86
+ // 4. Hand-off execution seamlessly to Bun, passing all CLI arguments
87
+ const result = spawnSync(bunPath, [cliScript, ...process.argv.slice(2)], { stdio: 'inherit' });
88
+ process.exit(result.status ?? 1);
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "memoryblock",
3
- "version": "0.1.3",
3
+ "version": "0.1.4",
4
4
  "type": "module",
5
5
  "description": "Deploy isolated, multi-agent AI assistants on your local machine with extreme resource efficiency.",
6
6
  "files": [
7
- "dist/"
7
+ "dist/",
8
+ "bin/"
8
9
  ],
10
+ "bin": {
11
+ "mblk": "./bin/mblk.js"
12
+ },
9
13
  "exports": {
10
14
  ".": {
11
15
  "types": "./dist/index.d.ts",
@@ -17,8 +21,8 @@
17
21
  "dev": "tsc -p tsconfig.json --watch"
18
22
  },
19
23
  "dependencies": {
20
- "@memoryblock/locale": "^0.1.3",
21
- "@memoryblock/types": "^0.1.3",
24
+ "@memoryblock/locale": "^0.1.4",
25
+ "@memoryblock/types": "^0.1.4",
22
26
  "chalk": "^5.4.0"
23
27
  },
24
28
  "engines": {