myceliumail 1.0.4 → 1.0.6
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 +13 -0
- package/CODEX_SETUP.md +36 -0
- package/README.md +20 -1
- package/dist/bin/myceliumail.js +4 -0
- package/dist/bin/myceliumail.js.map +1 -1
- 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/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/storage/local.d.ts.map +1 -1
- package/dist/storage/local.js +5 -2
- package/dist/storage/local.js.map +1 -1
- package/dist/storage/supabase.d.ts +3 -3
- package/dist/storage/supabase.d.ts.map +1 -1
- package/dist/storage/supabase.js +56 -5
- package/dist/storage/supabase.js.map +1 -1
- 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/storage.ts +74 -27
- package/package.json +1 -1
- package/src/bin/myceliumail.ts +4 -0
- package/src/commands/export.ts +212 -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/storage/local.ts +5 -2
- package/src/storage/supabase.ts +67 -5
package/src/storage/supabase.ts
CHANGED
|
@@ -221,7 +221,7 @@ export async function getInbox(agentId: string, options?: InboxOptions): Promise
|
|
|
221
221
|
}
|
|
222
222
|
|
|
223
223
|
/**
|
|
224
|
-
* Get a specific message
|
|
224
|
+
* Get a specific message (supports partial ID lookup)
|
|
225
225
|
*/
|
|
226
226
|
export async function getMessage(id: string): Promise<Message | null> {
|
|
227
227
|
const client = createClient();
|
|
@@ -230,6 +230,52 @@ export async function getMessage(id: string): Promise<Message | null> {
|
|
|
230
230
|
return local.getMessage(id);
|
|
231
231
|
}
|
|
232
232
|
|
|
233
|
+
// For partial IDs, fetch recent messages and filter client-side
|
|
234
|
+
// (PostgreSQL UUID type doesn't support LIKE operator)
|
|
235
|
+
if (id.length < 36) {
|
|
236
|
+
const results = await supabaseRequest<Array<{
|
|
237
|
+
id: string;
|
|
238
|
+
from_agent: string;
|
|
239
|
+
to_agent: string;
|
|
240
|
+
subject: string;
|
|
241
|
+
message: string;
|
|
242
|
+
encrypted: boolean;
|
|
243
|
+
read: boolean;
|
|
244
|
+
created_at: string;
|
|
245
|
+
}>>(client, `/agent_messages?order=created_at.desc&limit=100`);
|
|
246
|
+
|
|
247
|
+
const r = results.find(row => row.id.startsWith(id));
|
|
248
|
+
if (!r) return null;
|
|
249
|
+
|
|
250
|
+
// Parse encrypted message
|
|
251
|
+
let ciphertext, nonce, senderPublicKey, body = r.message;
|
|
252
|
+
if (r.encrypted && r.message) {
|
|
253
|
+
try {
|
|
254
|
+
const enc = JSON.parse(r.message);
|
|
255
|
+
ciphertext = enc.ciphertext;
|
|
256
|
+
nonce = enc.nonce;
|
|
257
|
+
senderPublicKey = enc.sender_public_key;
|
|
258
|
+
body = '';
|
|
259
|
+
} catch { }
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return {
|
|
263
|
+
id: r.id,
|
|
264
|
+
sender: r.from_agent,
|
|
265
|
+
recipient: r.to_agent,
|
|
266
|
+
subject: r.subject || '',
|
|
267
|
+
body,
|
|
268
|
+
encrypted: r.encrypted,
|
|
269
|
+
ciphertext,
|
|
270
|
+
nonce,
|
|
271
|
+
senderPublicKey,
|
|
272
|
+
read: r.read,
|
|
273
|
+
archived: false,
|
|
274
|
+
createdAt: new Date(r.created_at),
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
// Full UUID - exact match
|
|
233
279
|
const results = await supabaseRequest<Array<{
|
|
234
280
|
id: string;
|
|
235
281
|
from_agent: string;
|
|
@@ -274,7 +320,7 @@ export async function getMessage(id: string): Promise<Message | null> {
|
|
|
274
320
|
}
|
|
275
321
|
|
|
276
322
|
/**
|
|
277
|
-
* Mark message as read
|
|
323
|
+
* Mark message as read (supports partial ID)
|
|
278
324
|
*/
|
|
279
325
|
export async function markAsRead(id: string, agentId?: string): Promise<boolean> {
|
|
280
326
|
const client = createClient();
|
|
@@ -283,8 +329,16 @@ export async function markAsRead(id: string, agentId?: string): Promise<boolean>
|
|
|
283
329
|
return local.markAsRead(id, agentId);
|
|
284
330
|
}
|
|
285
331
|
|
|
332
|
+
// For partial IDs, resolve full UUID first
|
|
333
|
+
let fullId = id;
|
|
334
|
+
if (id.length < 36) {
|
|
335
|
+
const msg = await getMessage(id);
|
|
336
|
+
if (!msg) return false;
|
|
337
|
+
fullId = msg.id;
|
|
338
|
+
}
|
|
339
|
+
|
|
286
340
|
try {
|
|
287
|
-
await supabaseRequest(client, `/agent_messages?id=eq.${
|
|
341
|
+
await supabaseRequest(client, `/agent_messages?id=eq.${fullId}`, {
|
|
288
342
|
method: 'PATCH',
|
|
289
343
|
body: JSON.stringify({ read: true }),
|
|
290
344
|
});
|
|
@@ -295,7 +349,7 @@ export async function markAsRead(id: string, agentId?: string): Promise<boolean>
|
|
|
295
349
|
}
|
|
296
350
|
|
|
297
351
|
/**
|
|
298
|
-
* Archive a message
|
|
352
|
+
* Archive a message (supports partial ID)
|
|
299
353
|
*/
|
|
300
354
|
export async function archiveMessage(id: string): Promise<boolean> {
|
|
301
355
|
const client = createClient();
|
|
@@ -304,8 +358,16 @@ export async function archiveMessage(id: string): Promise<boolean> {
|
|
|
304
358
|
return local.archiveMessage(id);
|
|
305
359
|
}
|
|
306
360
|
|
|
361
|
+
// For partial IDs, resolve full UUID first
|
|
362
|
+
let fullId = id;
|
|
363
|
+
if (id.length < 36) {
|
|
364
|
+
const msg = await getMessage(id);
|
|
365
|
+
if (!msg) return false;
|
|
366
|
+
fullId = msg.id;
|
|
367
|
+
}
|
|
368
|
+
|
|
307
369
|
try {
|
|
308
|
-
await supabaseRequest(client, `/agent_messages?id=eq.${
|
|
370
|
+
await supabaseRequest(client, `/agent_messages?id=eq.${fullId}`, {
|
|
309
371
|
method: 'PATCH',
|
|
310
372
|
body: JSON.stringify({ archived: true }),
|
|
311
373
|
});
|