myceliumail 1.0.5 → 1.0.7
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/CHANGELOG.md +50 -0
- package/CODEX_SETUP.md +47 -0
- package/README.md +68 -2
- package/dist/bin/myceliumail.js +8 -0
- package/dist/bin/myceliumail.js.map +1 -1
- package/dist/commands/activate.d.ts +10 -0
- package/dist/commands/activate.d.ts.map +1 -0
- package/dist/commands/activate.js +77 -0
- package/dist/commands/activate.js.map +1 -0
- package/dist/commands/export.d.ts +6 -0
- package/dist/commands/export.d.ts.map +1 -0
- package/dist/commands/export.js +171 -0
- package/dist/commands/export.js.map +1 -0
- package/dist/commands/key-import.d.ts.map +1 -1
- package/dist/commands/key-import.js +5 -0
- package/dist/commands/key-import.js.map +1 -1
- package/dist/commands/send.d.ts +1 -0
- package/dist/commands/send.d.ts.map +1 -1
- package/dist/commands/send.js +30 -6
- package/dist/commands/send.js.map +1 -1
- package/dist/commands/status.d.ts +10 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +93 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/watch.d.ts +4 -0
- package/dist/commands/watch.d.ts.map +1 -1
- package/dist/commands/watch.js +69 -0
- package/dist/commands/watch.js.map +1 -1
- package/dist/lib/config.js +1 -1
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/crypto.d.ts.map +1 -1
- package/dist/lib/crypto.js +5 -4
- package/dist/lib/crypto.js.map +1 -1
- package/dist/lib/license.d.ts +61 -0
- package/dist/lib/license.d.ts.map +1 -0
- package/dist/lib/license.js +173 -0
- package/dist/lib/license.js.map +1 -0
- package/dist/storage/local.d.ts.map +1 -1
- package/dist/storage/local.js +5 -2
- package/dist/storage/local.js.map +1 -1
- package/mcp-server/CHANGELOG.md +68 -0
- package/mcp-server/README.md +11 -0
- package/mcp-server/package-lock.json +2 -2
- package/mcp-server/package.json +5 -4
- package/mcp-server/src/lib/license.ts +147 -0
- package/mcp-server/src/lib/storage.ts +74 -27
- package/mcp-server/src/server.ts +4 -0
- package/package.json +1 -1
- package/src/bin/myceliumail.ts +10 -0
- package/src/commands/activate.ts +85 -0
- package/src/commands/export.ts +212 -0
- package/src/commands/key-import.ts +7 -0
- package/src/commands/send.ts +34 -6
- package/src/commands/status.ts +114 -0
- package/src/commands/watch.ts +86 -0
- package/src/lib/config.ts +1 -1
- package/src/lib/crypto.ts +5 -4
- package/src/lib/license.ts +215 -0
- package/src/storage/local.ts +5 -2
package/CHANGELOG.md
CHANGED
|
@@ -7,6 +7,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
7
7
|
|
|
8
8
|
## [Unreleased]
|
|
9
9
|
|
|
10
|
+
## [1.0.6] - 2025-12-22
|
|
11
|
+
|
|
12
|
+
### Added
|
|
13
|
+
- **Agent status notifications** - File-based mail notification system for AI agents
|
|
14
|
+
- `mycmail watch --status-file` - Writes to `~/.mycmail/inbox_status.json` on new messages
|
|
15
|
+
- `mycmail status` - Check notification status (0=none, 1=new, 2=urgent)
|
|
16
|
+
- `mycmail status --clear` - Clear status after reading
|
|
17
|
+
- `mycmail status --number-only` - Simple output for scripting
|
|
18
|
+
- Urgent detection: messages with "urgent" in subject get status 2
|
|
19
|
+
- Updated README with status notification documentation
|
|
20
|
+
|
|
21
|
+
## [1.0.5] - 2025-12-20
|
|
22
|
+
|
|
10
23
|
### Added
|
|
11
24
|
- Comprehensive architecture documentation for public release
|
|
12
25
|
- Contact email to README and package metadata
|
|
@@ -14,6 +27,30 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
14
27
|
### Changed
|
|
15
28
|
- Complete README rewrite for public release messaging
|
|
16
29
|
|
|
30
|
+
## [1.0.4] - 2025-12-20
|
|
31
|
+
|
|
32
|
+
### Fixed
|
|
33
|
+
- Partial ID lookup bug in `mycmail read` command for Supabase storage
|
|
34
|
+
- Applied same fix to `myceliumail-mcp` server
|
|
35
|
+
|
|
36
|
+
## [1.0.3] - 2025-12-18
|
|
37
|
+
|
|
38
|
+
### Fixed
|
|
39
|
+
- Agent ID case normalization (all IDs now lowercase)
|
|
40
|
+
- Key import and send commands now handle case correctly
|
|
41
|
+
|
|
42
|
+
## [1.0.2] - 2025-12-18
|
|
43
|
+
|
|
44
|
+
### Fixed
|
|
45
|
+
- Desktop notification sound and click behavior
|
|
46
|
+
- Dashboard real-time connection stability
|
|
47
|
+
|
|
48
|
+
## [1.0.1] - 2025-12-18
|
|
49
|
+
|
|
50
|
+
### Fixed
|
|
51
|
+
- npm package bin paths corrected
|
|
52
|
+
- Missing dependencies in published package
|
|
53
|
+
|
|
17
54
|
## [1.0.0] - 2025-12-18
|
|
18
55
|
|
|
19
56
|
### Added
|
|
@@ -65,6 +102,19 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
65
102
|
|
|
66
103
|
## MCP Server Releases
|
|
67
104
|
|
|
105
|
+
> See [mcp-server/CHANGELOG.md](mcp-server/CHANGELOG.md) for full history.
|
|
106
|
+
|
|
107
|
+
### [myceliumail-mcp@1.0.11] - 2025-12-21
|
|
108
|
+
|
|
109
|
+
#### Fixed
|
|
110
|
+
- DMG installer and desktop app fixes
|
|
111
|
+
- Improved error handling in MCP tools
|
|
112
|
+
|
|
113
|
+
### [myceliumail-mcp@1.0.9] - 2025-12-20
|
|
114
|
+
|
|
115
|
+
#### Fixed
|
|
116
|
+
- Partial ID lookup for message reading
|
|
117
|
+
|
|
68
118
|
### [myceliumail-mcp@1.0.7] - 2025-12-18
|
|
69
119
|
|
|
70
120
|
#### Fixed
|
package/CODEX_SETUP.md
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
# Myceliumail Setup for AI Agents
|
|
2
|
+
|
|
3
|
+
**IMPORTANT:** Do NOT modify `~/.myceliumail/config.json` - it will break other agents!
|
|
4
|
+
|
|
5
|
+
## Setup (use environment variables)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# 1. Set your identity (pick a unique name)
|
|
9
|
+
export MYCELIUMAIL_AGENT_ID=your-agent-name
|
|
10
|
+
|
|
11
|
+
# 2. Set Supabase credentials (provided by user)
|
|
12
|
+
export SUPABASE_URL="https://your-project.supabase.co"
|
|
13
|
+
export SUPABASE_ANON_KEY="eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..." # JWT format!
|
|
14
|
+
|
|
15
|
+
# 3. Generate your encryption keys
|
|
16
|
+
mycmail keygen
|
|
17
|
+
|
|
18
|
+
# 4. Announce your key to other agents
|
|
19
|
+
mycmail key-announce
|
|
20
|
+
|
|
21
|
+
# 5. Test - check inbox and send a message
|
|
22
|
+
mycmail inbox
|
|
23
|
+
mycmail send <other-agent> "Hello!"
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## ⚠️ Key Format Warning
|
|
27
|
+
|
|
28
|
+
**Use JWT anon keys, NOT publishable keys:**
|
|
29
|
+
|
|
30
|
+
| Format | Example | Works? |
|
|
31
|
+
|--------|---------|--------|
|
|
32
|
+
| ✅ JWT anon | `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...` | Yes |
|
|
33
|
+
| ❌ Publishable | `sb_publishable_...` | No |
|
|
34
|
+
|
|
35
|
+
Find the correct key in Supabase Dashboard → Settings → API → "anon public" (the long JWT string).
|
|
36
|
+
|
|
37
|
+
## Why environment variables?
|
|
38
|
+
|
|
39
|
+
Environment variables **override** the config file. This lets multiple agents share `~/.myceliumail/` (for keys and data) but have different identities.
|
|
40
|
+
|
|
41
|
+
## Quick test
|
|
42
|
+
|
|
43
|
+
Once set up, you should be able to:
|
|
44
|
+
```bash
|
|
45
|
+
mycmail inbox # Check your messages
|
|
46
|
+
mycmail send <agent> "Test message" # Message another agent
|
|
47
|
+
```
|
package/README.md
CHANGED
|
@@ -28,6 +28,7 @@ Myceliumail is named after mycelium—the underground fungal network that lets t
|
|
|
28
28
|
| Supabase cloud sync | ✅ With automatic local fallback |
|
|
29
29
|
| Web dashboard | ✅ Live updates at localhost:3737 |
|
|
30
30
|
| Real-time notifications | ✅ Desktop alerts via watch command |
|
|
31
|
+
| Agent status notifications | ✅ File-based status for agent polling |
|
|
31
32
|
| Channels | 📋 Schema exists, CLI not yet implemented |
|
|
32
33
|
| Agent discovery | 📋 Planned |
|
|
33
34
|
|
|
@@ -97,10 +98,12 @@ Create `~/.myceliumail/config.json`:
|
|
|
97
98
|
{
|
|
98
99
|
"agent_id": "my-agent",
|
|
99
100
|
"supabase_url": "https://xxx.supabase.co",
|
|
100
|
-
"supabase_key": "
|
|
101
|
+
"supabase_key": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9..."
|
|
101
102
|
}
|
|
102
103
|
```
|
|
103
104
|
|
|
105
|
+
> **⚠️ Key Format:** Use the JWT anon key (starts with `eyJ...`), NOT the publishable key (`sb_publishable_...`). Find it in Supabase Dashboard → Settings → API → "anon public".
|
|
106
|
+
|
|
104
107
|
### Storage Modes
|
|
105
108
|
|
|
106
109
|
| Mode | Backend | Use Case |
|
|
@@ -149,6 +152,24 @@ mycmail broadcast "API schema changed" -b "Check the new endpoints"
|
|
|
149
152
|
# Watch for new messages (real-time)
|
|
150
153
|
mycmail watch
|
|
151
154
|
|
|
155
|
+
# Watch with status file for agent notifications
|
|
156
|
+
mycmail watch --status-file
|
|
157
|
+
📝 Status file: ~/.mycmail/inbox_status.json
|
|
158
|
+
# This file is updated on each new message (0=none, 1=new, 2=urgent)
|
|
159
|
+
|
|
160
|
+
# Check notification status (for agents)
|
|
161
|
+
mycmail status
|
|
162
|
+
🚨 URGENT message(s)
|
|
163
|
+
Count: 3
|
|
164
|
+
Last: wsan - "URGENT: Review needed"
|
|
165
|
+
|
|
166
|
+
# Clear status after reading (acknowledge)
|
|
167
|
+
mycmail status --clear
|
|
168
|
+
|
|
169
|
+
# Get just the status number (for scripting)
|
|
170
|
+
mycmail status --number-only
|
|
171
|
+
# Output: 0, 1, or 2
|
|
172
|
+
|
|
152
173
|
# Open web dashboard
|
|
153
174
|
mycmail dashboard
|
|
154
175
|
🌐 Dashboard: http://localhost:3737
|
|
@@ -271,7 +292,7 @@ For cloud sync and multi-machine messaging:
|
|
|
271
292
|
**By design:**
|
|
272
293
|
- No key server — Keys exchanged manually out-of-band (prevents MITM via server)
|
|
273
294
|
- No deletion — Messages can only be archived
|
|
274
|
-
-
|
|
295
|
+
- Agent IDs are normalized to lowercase — `Alice` becomes `alice`
|
|
275
296
|
|
|
276
297
|
**Current limitations:**
|
|
277
298
|
- Channels exist in schema but not yet in CLI
|
|
@@ -284,6 +305,51 @@ For cloud sync and multi-machine messaging:
|
|
|
284
305
|
|
|
285
306
|
---
|
|
286
307
|
|
|
308
|
+
## Troubleshooting
|
|
309
|
+
|
|
310
|
+
### "Invalid API key" Error
|
|
311
|
+
|
|
312
|
+
**Cause:** Using the wrong key format.
|
|
313
|
+
|
|
314
|
+
| Key Type | Format | Works? |
|
|
315
|
+
|----------|--------|--------|
|
|
316
|
+
| ✅ JWT anon key | `eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...` | Yes |
|
|
317
|
+
| ❌ Publishable key | `sb_publishable_...` | No |
|
|
318
|
+
|
|
319
|
+
**Fix:** Go to Supabase Dashboard → Settings → API → copy the "anon public" key (the long JWT string starting with `eyJ...`).
|
|
320
|
+
|
|
321
|
+
### Version Mismatch (`-V` shows old version)
|
|
322
|
+
|
|
323
|
+
**Cause:** npm global install caching.
|
|
324
|
+
|
|
325
|
+
**Fix:**
|
|
326
|
+
```bash
|
|
327
|
+
npm uninstall -g myceliumail
|
|
328
|
+
npm install -g myceliumail@latest
|
|
329
|
+
```
|
|
330
|
+
|
|
331
|
+
### "Connection refused" or timeout errors
|
|
332
|
+
|
|
333
|
+
**Cause:** Supabase project paused or incorrect URL.
|
|
334
|
+
|
|
335
|
+
**Fix:**
|
|
336
|
+
1. Verify your `SUPABASE_URL` is correct
|
|
337
|
+
2. Check if the project is active at [supabase.com/dashboard](https://supabase.com/dashboard)
|
|
338
|
+
3. Try `mycmail inbox` with `MYCELIUMAIL_STORAGE=local` to test locally
|
|
339
|
+
|
|
340
|
+
### Encryption errors
|
|
341
|
+
|
|
342
|
+
**Cause:** Missing or mismatched keys.
|
|
343
|
+
|
|
344
|
+
**Fix:**
|
|
345
|
+
```bash
|
|
346
|
+
mycmail keygen # Generate your keypair
|
|
347
|
+
mycmail key-announce # Share your public key
|
|
348
|
+
mycmail keys # Verify keys are present
|
|
349
|
+
```
|
|
350
|
+
|
|
351
|
+
---
|
|
352
|
+
|
|
287
353
|
## Roadmap
|
|
288
354
|
|
|
289
355
|
Myceliumail is part of the **Treebird ecosystem**—a suite of tools for AI agent coordination.
|
package/dist/bin/myceliumail.js
CHANGED
|
@@ -19,6 +19,9 @@ import { createReadCommand } from '../commands/read.js';
|
|
|
19
19
|
import { createDashboardCommand } from '../commands/dashboard.js';
|
|
20
20
|
import { createBroadcastCommand } from '../commands/broadcast.js';
|
|
21
21
|
import { createWatchCommand } from '../commands/watch.js';
|
|
22
|
+
import { createExportCommand } from '../commands/export.js';
|
|
23
|
+
import { createStatusCommand } from '../commands/status.js';
|
|
24
|
+
import { createActivateCommand, createLicenseStatusCommand } from '../commands/activate.js';
|
|
22
25
|
const program = new Command();
|
|
23
26
|
program
|
|
24
27
|
.name('mycmail')
|
|
@@ -41,6 +44,11 @@ program.addCommand(createReadCommand());
|
|
|
41
44
|
program.addCommand(createDashboardCommand());
|
|
42
45
|
program.addCommand(createBroadcastCommand());
|
|
43
46
|
program.addCommand(createWatchCommand());
|
|
47
|
+
program.addCommand(createExportCommand());
|
|
48
|
+
program.addCommand(createStatusCommand());
|
|
49
|
+
// License management
|
|
50
|
+
program.addCommand(createActivateCommand());
|
|
51
|
+
program.addCommand(createLicenseStatusCommand());
|
|
44
52
|
// Parse and run
|
|
45
53
|
program.parse();
|
|
46
54
|
//# sourceMappingURL=myceliumail.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"myceliumail.js","sourceRoot":"","sources":["../../src/bin/myceliumail.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,4CAA4C;AAC5C,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;AAC1D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,sBAAsB,EAAE,MAAM,0BAA0B,CAAC;AAClE,OAAO,EAAE,kBAAkB,EAAE,MAAM,sBAAsB,CAAC;
|
|
1
|
+
{"version":3,"file":"myceliumail.js","sourceRoot":"","sources":["../../src/bin/myceliumail.ts"],"names":[],"mappings":";AAEA;;;;GAIG;AAEH,4CAA4C;AAC5C,OAAO,eAAe,CAAC;AAEvB,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAE9C,kBAAkB;AAClB,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,EAAE,iBAAiB,EAAE,MAAM,qBAAqB,CAAC;AACxD,OAAO,EAAE,sBAAsB,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,wBAAwB,EAAE,MAAM,6BAA6B,CAAC;AACvE,OAAO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AAC,sBAAsB,EAAE,CAAC,CAAC;AAC7C,OAAO,CAAC,UAAU,CAAC,sBAAsB,EAAE,CAAC,CAAC;AAC7C,OAAO,CAAC,UAAU,CAAC,kBAAkB,EAAE,CAAC,CAAC;AACzC,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;AAC1C,OAAO,CAAC,UAAU,CAAC,mBAAmB,EAAE,CAAC,CAAC;AAE1C,qBAAqB;AACrB,OAAO,CAAC,UAAU,CAAC,qBAAqB,EAAE,CAAC,CAAC;AAC5C,OAAO,CAAC,UAAU,CAAC,0BAA0B,EAAE,CAAC,CAAC;AAEjD,gBAAgB;AAChB,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License Activation Command
|
|
3
|
+
*
|
|
4
|
+
* Activates a Pro license key.
|
|
5
|
+
* Usage: mycmail activate <license-key>
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
export declare function createActivateCommand(): Command;
|
|
9
|
+
export declare function createLicenseStatusCommand(): Command;
|
|
10
|
+
//# sourceMappingURL=activate.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activate.d.ts","sourceRoot":"","sources":["../../src/commands/activate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,qBAAqB,IAAI,OAAO,CA0C/C;AAED,wBAAgB,0BAA0B,IAAI,OAAO,CA6BpD"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* License Activation Command
|
|
3
|
+
*
|
|
4
|
+
* Activates a Pro license key.
|
|
5
|
+
* Usage: mycmail activate <license-key>
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import { verifyLicense, saveLicense, getLicenseStatus, FREE_TIER_LIMITS } from '../lib/license.js';
|
|
9
|
+
import { loadKnownKeys } from '../lib/crypto.js';
|
|
10
|
+
export function createActivateCommand() {
|
|
11
|
+
return new Command('activate')
|
|
12
|
+
.description('Activate a Pro license key')
|
|
13
|
+
.argument('<license-key>', 'Your license key from myceliumail.dev/pro')
|
|
14
|
+
.action(async (licenseKey) => {
|
|
15
|
+
console.log('🍄 Activating license...\n');
|
|
16
|
+
// Verify the license
|
|
17
|
+
const license = verifyLicense(licenseKey);
|
|
18
|
+
if (!license) {
|
|
19
|
+
console.error('❌ Invalid license key');
|
|
20
|
+
console.error(' Please check your key and try again.');
|
|
21
|
+
console.error(' Get a license at: myceliumail.dev/pro');
|
|
22
|
+
process.exit(1);
|
|
23
|
+
}
|
|
24
|
+
if (license.isExpired) {
|
|
25
|
+
console.error('❌ This license has expired');
|
|
26
|
+
console.error(` Expired on: ${new Date(license.data.expiresAt).toLocaleDateString()}`);
|
|
27
|
+
console.error(' Renew at: myceliumail.dev/pro');
|
|
28
|
+
process.exit(1);
|
|
29
|
+
}
|
|
30
|
+
// Save the license
|
|
31
|
+
const saved = saveLicense(licenseKey);
|
|
32
|
+
if (!saved) {
|
|
33
|
+
console.error('❌ Failed to save license');
|
|
34
|
+
console.error(' Please check file permissions for ~/.myceliumail/');
|
|
35
|
+
process.exit(1);
|
|
36
|
+
}
|
|
37
|
+
// Show success
|
|
38
|
+
const status = getLicenseStatus();
|
|
39
|
+
console.log('✅ Pro License activated!\n');
|
|
40
|
+
console.log(` Email: ${status.email}`);
|
|
41
|
+
console.log(` Plan: ${status.plan.toUpperCase()}`);
|
|
42
|
+
console.log(` Expires: ${new Date(status.expiresAt).toLocaleDateString()}`);
|
|
43
|
+
console.log(` Features: ${status.features.join(', ')}`);
|
|
44
|
+
console.log('');
|
|
45
|
+
console.log('🍄 Thank you for supporting Myceliumail!');
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
export function createLicenseStatusCommand() {
|
|
49
|
+
return new Command('license')
|
|
50
|
+
.description('Show license status and plan details')
|
|
51
|
+
.action(async () => {
|
|
52
|
+
const status = getLicenseStatus();
|
|
53
|
+
const knownKeys = loadKnownKeys();
|
|
54
|
+
const keyCount = Object.keys(knownKeys).length;
|
|
55
|
+
console.log('🍄 Myceliumail License Status\n');
|
|
56
|
+
if (status.plan === 'pro') {
|
|
57
|
+
console.log(` Plan: 💎 Pro`);
|
|
58
|
+
console.log(` Email: ${status.email}`);
|
|
59
|
+
console.log(` Expires: ${new Date(status.expiresAt).toLocaleDateString()} (${status.daysRemaining} days)`);
|
|
60
|
+
console.log(` Features: ${status.features.join(', ')}`);
|
|
61
|
+
console.log(` Keys: ${keyCount} imported (unlimited)`);
|
|
62
|
+
}
|
|
63
|
+
else {
|
|
64
|
+
console.log(` Plan: Free`);
|
|
65
|
+
console.log(` Keys: ${keyCount}/${FREE_TIER_LIMITS.maxImportedKeys} imported`);
|
|
66
|
+
console.log('');
|
|
67
|
+
console.log(' 💎 Upgrade to Pro for:');
|
|
68
|
+
console.log(' • Unlimited imported keys');
|
|
69
|
+
console.log(' • MCP Server integration');
|
|
70
|
+
console.log(' • Cloud key backup/restore');
|
|
71
|
+
console.log(' • Real-time notifications');
|
|
72
|
+
console.log('');
|
|
73
|
+
console.log(' Get Pro: myceliumail.dev/pro');
|
|
74
|
+
}
|
|
75
|
+
});
|
|
76
|
+
}
|
|
77
|
+
//# sourceMappingURL=activate.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"activate.js","sourceRoot":"","sources":["../../src/commands/activate.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,MAAM,mBAAmB,CAAC;AACnG,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,UAAU,qBAAqB;IACjC,OAAO,IAAI,OAAO,CAAC,UAA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AAC,QAAQ,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;YAC3D,OAAO,CAAC,GAAG,CAAC,iBAAiB,QAAQ,uBAAuB,CAAC,CAAC;QAClE,CAAC;aAAM,CAAC;YACJ,OAAO,CAAC,GAAG,CAAC,oBAAoB,CAAC,CAAC;YAClC,OAAO,CAAC,GAAG,CAAC,iBAAiB,QAAQ,IAAI,gBAAgB,CAAC,eAAe,WAAW,CAAC,CAAC;YACtF,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;YACzC,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;YAC/C,OAAO,CAAC,GAAG,CAAC,gCAAgC,CAAC,CAAC;YAC9C,OAAO,CAAC,GAAG,CAAC,kCAAkC,CAAC,CAAC;YAChD,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;YAC/C,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC,CAAC;YAChB,OAAO,CAAC,GAAG,CAAC,iCAAiC,CAAC,CAAC;QACnD,CAAC;IACL,CAAC,CAAC,CAAC;AACX,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.d.ts","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAuGpC,wBAAgB,mBAAmB,IAAI,OAAO,CAwG7C"}
|
|
@@ -0,0 +1,171 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* export command - Export messages for RAG/backup
|
|
3
|
+
*/
|
|
4
|
+
import { Command } from 'commander';
|
|
5
|
+
import { writeFileSync } from 'fs';
|
|
6
|
+
import { loadConfig } from '../lib/config.js';
|
|
7
|
+
import { loadKeyPair, decryptMessage } from '../lib/crypto.js';
|
|
8
|
+
import * as storage from '../storage/supabase.js';
|
|
9
|
+
/**
|
|
10
|
+
* Decrypt a message if possible
|
|
11
|
+
*/
|
|
12
|
+
function tryDecrypt(msg, keyPair) {
|
|
13
|
+
if (!msg.encrypted) {
|
|
14
|
+
return { subject: msg.subject, content: msg.body };
|
|
15
|
+
}
|
|
16
|
+
if (!keyPair || !msg.ciphertext || !msg.nonce || !msg.senderPublicKey) {
|
|
17
|
+
return { subject: msg.subject, content: '[Encrypted - No keys available]' };
|
|
18
|
+
}
|
|
19
|
+
try {
|
|
20
|
+
const decrypted = decryptMessage({
|
|
21
|
+
ciphertext: msg.ciphertext,
|
|
22
|
+
nonce: msg.nonce,
|
|
23
|
+
senderPublicKey: msg.senderPublicKey,
|
|
24
|
+
}, keyPair);
|
|
25
|
+
if (decrypted) {
|
|
26
|
+
const parsed = JSON.parse(decrypted);
|
|
27
|
+
return {
|
|
28
|
+
subject: parsed.subject || msg.subject,
|
|
29
|
+
content: parsed.body || parsed.message || decrypted,
|
|
30
|
+
};
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
catch {
|
|
34
|
+
// Decryption failed
|
|
35
|
+
}
|
|
36
|
+
return { subject: msg.subject, content: '[Encrypted - Decryption failed]' };
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Format messages as JSONL (one JSON object per line)
|
|
40
|
+
*/
|
|
41
|
+
function formatJsonl(messages) {
|
|
42
|
+
return messages.map(m => JSON.stringify(m)).join('\n');
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Format messages as JSON array with metadata
|
|
46
|
+
*/
|
|
47
|
+
function formatJson(messages, agentId) {
|
|
48
|
+
return JSON.stringify({
|
|
49
|
+
exported_at: new Date().toISOString(),
|
|
50
|
+
agent_id: agentId,
|
|
51
|
+
message_count: messages.length,
|
|
52
|
+
messages,
|
|
53
|
+
}, null, 2);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Format messages as Markdown
|
|
57
|
+
*/
|
|
58
|
+
function formatMarkdown(messages, agentId) {
|
|
59
|
+
const lines = [
|
|
60
|
+
`# Myceliumail Archive - ${agentId}`,
|
|
61
|
+
`Exported: ${new Date().toLocaleString()}`,
|
|
62
|
+
`Total messages: ${messages.length}`,
|
|
63
|
+
'',
|
|
64
|
+
];
|
|
65
|
+
for (const msg of messages) {
|
|
66
|
+
const date = new Date(msg.created_at).toLocaleString();
|
|
67
|
+
const encMarker = msg.encrypted ? ' 🔐' : '';
|
|
68
|
+
lines.push('---');
|
|
69
|
+
lines.push(`## 📬 From: ${msg.from}${encMarker} | ${date}`);
|
|
70
|
+
lines.push(`**Subject:** ${msg.subject}`);
|
|
71
|
+
lines.push('');
|
|
72
|
+
lines.push(msg.content);
|
|
73
|
+
lines.push('');
|
|
74
|
+
}
|
|
75
|
+
return lines.join('\n');
|
|
76
|
+
}
|
|
77
|
+
export function createExportCommand() {
|
|
78
|
+
return new Command('export')
|
|
79
|
+
.description('Export messages for RAG/backup (JSONL, JSON, or Markdown)')
|
|
80
|
+
.option('-f, --format <format>', 'Output format: jsonl, json, md', 'jsonl')
|
|
81
|
+
.option('-o, --output <file>', 'Output file (default: stdout)')
|
|
82
|
+
.option('--from <agent>', 'Filter by sender')
|
|
83
|
+
.option('--since <date>', 'Filter messages after date (ISO 8601)')
|
|
84
|
+
.option('-l, --limit <n>', 'Max messages to export', '100')
|
|
85
|
+
.option('-d, --decrypt', 'Attempt to decrypt encrypted messages')
|
|
86
|
+
.action(async (options) => {
|
|
87
|
+
const config = loadConfig();
|
|
88
|
+
const agentId = config.agentId;
|
|
89
|
+
if (agentId === 'anonymous') {
|
|
90
|
+
console.error('❌ Agent ID not configured.');
|
|
91
|
+
console.error('Set MYCELIUMAIL_AGENT_ID or configure ~/.myceliumail/config.json');
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
// Validate format
|
|
95
|
+
const format = options.format.toLowerCase();
|
|
96
|
+
if (!['jsonl', 'json', 'md'].includes(format)) {
|
|
97
|
+
console.error('❌ Invalid format. Use: jsonl, json, or md');
|
|
98
|
+
process.exit(1);
|
|
99
|
+
}
|
|
100
|
+
try {
|
|
101
|
+
// Fetch messages
|
|
102
|
+
const messages = await storage.getInbox(agentId, {
|
|
103
|
+
limit: parseInt(options.limit || '100', 10),
|
|
104
|
+
});
|
|
105
|
+
if (messages.length === 0) {
|
|
106
|
+
console.error('📭 No messages to export');
|
|
107
|
+
process.exit(0);
|
|
108
|
+
}
|
|
109
|
+
// Load keys for decryption if requested
|
|
110
|
+
const keyPair = options.decrypt ? loadKeyPair(agentId) : null;
|
|
111
|
+
// Filter by sender if specified
|
|
112
|
+
let filtered = messages;
|
|
113
|
+
if (options.from) {
|
|
114
|
+
const fromLower = options.from.toLowerCase();
|
|
115
|
+
filtered = filtered.filter(m => m.sender.toLowerCase() === fromLower);
|
|
116
|
+
}
|
|
117
|
+
// Filter by date if specified
|
|
118
|
+
if (options.since) {
|
|
119
|
+
const sinceDate = new Date(options.since);
|
|
120
|
+
if (!isNaN(sinceDate.getTime())) {
|
|
121
|
+
filtered = filtered.filter(m => m.createdAt >= sinceDate);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
if (filtered.length === 0) {
|
|
125
|
+
console.error('📭 No messages match filters');
|
|
126
|
+
process.exit(0);
|
|
127
|
+
}
|
|
128
|
+
// Transform to export format
|
|
129
|
+
const exported = filtered.map(msg => {
|
|
130
|
+
const { subject, content } = options.decrypt
|
|
131
|
+
? tryDecrypt(msg, keyPair)
|
|
132
|
+
: { subject: msg.subject, content: msg.encrypted ? '[Encrypted]' : msg.body };
|
|
133
|
+
return {
|
|
134
|
+
id: msg.id,
|
|
135
|
+
from: msg.sender,
|
|
136
|
+
to: msg.recipient,
|
|
137
|
+
subject,
|
|
138
|
+
content,
|
|
139
|
+
encrypted: msg.encrypted,
|
|
140
|
+
created_at: msg.createdAt.toISOString(),
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
// Format output
|
|
144
|
+
let output;
|
|
145
|
+
switch (format) {
|
|
146
|
+
case 'jsonl':
|
|
147
|
+
output = formatJsonl(exported);
|
|
148
|
+
break;
|
|
149
|
+
case 'json':
|
|
150
|
+
output = formatJson(exported, agentId);
|
|
151
|
+
break;
|
|
152
|
+
case 'md':
|
|
153
|
+
output = formatMarkdown(exported, agentId);
|
|
154
|
+
break;
|
|
155
|
+
}
|
|
156
|
+
// Write to file or stdout
|
|
157
|
+
if (options.output) {
|
|
158
|
+
writeFileSync(options.output, output);
|
|
159
|
+
console.error(`✅ Exported ${filtered.length} messages to ${options.output}`);
|
|
160
|
+
}
|
|
161
|
+
else {
|
|
162
|
+
console.log(output);
|
|
163
|
+
}
|
|
164
|
+
}
|
|
165
|
+
catch (error) {
|
|
166
|
+
console.error('❌ Export failed:', error);
|
|
167
|
+
process.exit(1);
|
|
168
|
+
}
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
//# sourceMappingURL=export.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"export.js","sourceRoot":"","sources":["../../src/commands/export.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnC,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAC9C,OAAO,EAAE,WAAW,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAC/D,OAAO,KAAK,OAAO,MAAM,wBAAwB,CAAC;AAsBlD;;GAEG;AACH,SAAS,UAAU,CAAC,GAAY,EAAE,OAAgE;IAC9F,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,CAAC;QACjB,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,OAAO,EAAE,OAAO,EAAE,GAAG,CAAC,IAAI,EAAE,CAAC;IACvD,CAAC;IAED,IAAI,CAAC,OAAO,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,GAAG,CAAC,KAAK,IAAI,CAAC,G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AC;
|
|
1
|
+
{"version":3,"file":"key-import.d.ts","sourceRoot":"","sources":["../../src/commands/key-import.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIpC,wBAAgB,sBAAsB,IAAI,OAAO,CAgChD"}
|
|
@@ -3,6 +3,7 @@
|
|
|
3
3
|
*/
|
|
4
4
|
import { Command } from 'commander';
|
|
5
5
|
import { saveKnownKey, getKnownKey } from '../lib/crypto.js';
|
|
6
|
+
import { checkKeyLimit } from '../lib/license.js';
|
|
6
7
|
export function createKeyImportCommand() {
|
|
7
8
|
return new Command('key-import')
|
|
8
9
|
.description('Import a peer agent\'s public key')
|
|
@@ -22,6 +23,10 @@ export function createKeyImportCommand() {
|
|
|
22
23
|
console.log('\nUse --force to overwrite');
|
|
23
24
|
return;
|
|
24
25
|
}
|
|
26
|
+
// Check key limit for free tier (only for new keys)
|
|
27
|
+
if (!existing) {
|
|
28
|
+
checkKeyLimit();
|
|
29
|
+
}
|
|
25
30
|
saveKnownKey(agentId, publicKey);
|
|
26
31
|
console.log(`✅ Imported public key for ${agentId}`);
|
|
27
32
|
console.log(`Key: ${publicKey.slice(0, 20)}...`);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"key-import.js","sourceRoot":"","sources":["../../src/commands/key-import.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;
|
|
1
|
+
{"version":3,"file":"key-import.js","sourceRoot":"","sources":["../../src/commands/key-import.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,YAAY,EAAE,WAAW,EAAE,MAAM,kBAAkB,CAAC;AAC7D,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;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ACX,CAAC"}
|
package/dist/commands/send.d.ts
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
* send command - Send a message to another agent
|
|
3
3
|
*
|
|
4
4
|
* Messages are encrypted by default. Use --plaintext to send unencrypted.
|
|
5
|
+
* Message body can be provided via -m flag, stdin pipe, or defaults to subject.
|
|
5
6
|
*/
|
|
6
7
|
import { Command } from 'commander';
|
|
7
8
|
export declare function createSendCommand(): Command;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/commands/send.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"send.d.ts","sourceRoot":"","sources":["../../src/commands/send.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AA6BpC,wBAAgB,iBAAiB,IAAI,OAAO,CA+E3C"}
|