@mosadd/mcp 3.0.0-alpha.55 → 3.0.0-alpha.57

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 (54) hide show
  1. package/CHANGELOG.md +15 -11
  2. package/README.md +152 -150
  3. package/dist/bin/mcp.js +1 -1
  4. package/dist/{chunk-IWUGKLDX.js → chunk-WEGSITAH.js} +30 -14
  5. package/dist/index.js +1 -1
  6. package/package.json +2 -2
  7. package/src/__tests__/blob-upload.test.ts +93 -93
  8. package/src/__tests__/channel-e2ee.test.ts +62 -62
  9. package/src/__tests__/flota-jawnie.test.ts +2 -2
  10. package/src/__tests__/golden-path.test.ts +139 -139
  11. package/src/__tests__/integration.test.ts +217 -182
  12. package/src/__tests__/label-room-owner.test.ts +22 -0
  13. package/src/__tests__/mdm-e2ee.test.ts +212 -212
  14. package/src/__tests__/mdm-mcp-readable.test.ts +390 -390
  15. package/src/__tests__/mirc-invite.test.ts +112 -112
  16. package/src/__tests__/mtalk.test.ts +122 -122
  17. package/src/__tests__/presence.test.ts +199 -199
  18. package/src/__tests__/server.test.ts +71 -71
  19. package/src/__tests__/tool-count-consistency.test.ts +259 -199
  20. package/src/__tests__/voice-fields.test.ts +24 -0
  21. package/src/bin/login.ts +138 -138
  22. package/src/bin/mcp.ts +145 -145
  23. package/src/config.ts +66 -66
  24. package/src/crypto/channel-e2ee.ts +288 -288
  25. package/src/crypto/mdm-session.ts +842 -842
  26. package/src/index.ts +19 -19
  27. package/src/observability/sentry.ts +79 -79
  28. package/src/providers/blob-upload.ts +162 -162
  29. package/src/providers/memory-voice.ts +79 -79
  30. package/src/providers/supabase-dm.ts +212 -202
  31. package/src/providers/supabase-voice.ts +103 -91
  32. package/src/server.ts +195 -195
  33. package/src/tools/actions.ts +166 -166
  34. package/src/tools/attachments.ts +276 -276
  35. package/src/tools/capabilities.ts +70 -70
  36. package/src/tools/channel-payload.ts +2 -2
  37. package/src/tools/embed.ts +110 -110
  38. package/src/tools/index.ts +181 -181
  39. package/src/tools/knowledge.ts +344 -344
  40. package/src/tools/mail-aliases.ts +25 -25
  41. package/src/tools/mail-provenance.ts +137 -137
  42. package/src/tools/mail.ts +403 -403
  43. package/src/tools/mdm-as-agent.ts +138 -126
  44. package/src/tools/mdm.ts +6 -4
  45. package/src/tools/mirc-edge.ts +196 -196
  46. package/src/tools/mirc-members.ts +287 -287
  47. package/src/tools/mirc-messages.ts +1 -1
  48. package/src/tools/mirc.ts +308 -308
  49. package/src/tools/mroom.ts +221 -221
  50. package/src/tools/mtalk.ts +131 -131
  51. package/src/tools/presence.ts +442 -442
  52. package/src/tools/voice-format.ts +43 -28
  53. package/src/types.ts +121 -121
  54. package/src/voice/floor.ts +132 -132
package/src/config.ts CHANGED
@@ -1,66 +1,66 @@
1
- /**
2
- * Local session config for the mosadd CLI (`mosadd login`).
3
- *
4
- * Stores the authenticated session at `~/.mosadd/session.json` so the MCP
5
- * server can pick up credentials without the user pasting an expiring JWT
6
- * from mosadd.com DevTools into env vars. Env vars still take precedence.
7
- *
8
- * The file holds a Supabase session (BYOK): the project URL + anon key (both
9
- * public, RLS-gated) and the user's access/refresh tokens.
10
- */
11
-
12
- import { homedir } from "node:os";
13
- import { join } from "node:path";
14
- import { mkdirSync, readFileSync, writeFileSync, rmSync, existsSync, chmodSync } from "node:fs";
15
-
16
- export interface MosaddSession {
17
- url: string;
18
- anonKey: string;
19
- accessToken: string;
20
- refreshToken?: string;
21
- /** Unix seconds when the access token expires. */
22
- expiresAt?: number;
23
- email?: string;
24
- }
25
-
26
- export function configDir(): string {
27
- return join(homedir(), ".mosadd");
28
- }
29
-
30
- export function sessionPath(): string {
31
- return join(configDir(), "session.json");
32
- }
33
-
34
- export function loadSession(): MosaddSession | null {
35
- try {
36
- const raw = readFileSync(sessionPath(), "utf8");
37
- const s = JSON.parse(raw) as MosaddSession;
38
- if (s && typeof s.url === "string" && typeof s.anonKey === "string") return s;
39
- return null;
40
- } catch {
41
- return null;
42
- }
43
- }
44
-
45
- export function saveSession(session: MosaddSession): void {
46
- mkdirSync(configDir(), { recursive: true });
47
- writeFileSync(sessionPath(), JSON.stringify(session, null, 2), "utf8");
48
- // Best-effort tighten perms (no-op on platforms that ignore it).
49
- try {
50
- chmodSync(sessionPath(), 0o600);
51
- } catch {
52
- /* ignore */
53
- }
54
- }
55
-
56
- export function clearSession(): boolean {
57
- if (!existsSync(sessionPath())) return false;
58
- rmSync(sessionPath());
59
- return true;
60
- }
61
-
62
- /** True if the stored token is past (or within 30s of) its expiry. */
63
- export function isSessionExpired(session: MosaddSession): boolean {
64
- if (!session.expiresAt) return false;
65
- return Date.now() / 1000 >= session.expiresAt - 30;
66
- }
1
+ /**
2
+ * Local session config for the mosadd CLI (`mosadd login`).
3
+ *
4
+ * Stores the authenticated session at `~/.mosadd/session.json` so the MCP
5
+ * server can pick up credentials without the user pasting an expiring JWT
6
+ * from mosadd.com DevTools into env vars. Env vars still take precedence.
7
+ *
8
+ * The file holds a Supabase session (BYOK): the project URL + anon key (both
9
+ * public, RLS-gated) and the user's access/refresh tokens.
10
+ */
11
+
12
+ import { homedir } from "node:os";
13
+ import { join } from "node:path";
14
+ import { mkdirSync, readFileSync, writeFileSync, rmSync, existsSync, chmodSync } from "node:fs";
15
+
16
+ export interface MosaddSession {
17
+ url: string;
18
+ anonKey: string;
19
+ accessToken: string;
20
+ refreshToken?: string;
21
+ /** Unix seconds when the access token expires. */
22
+ expiresAt?: number;
23
+ email?: string;
24
+ }
25
+
26
+ export function configDir(): string {
27
+ return join(homedir(), ".mosadd");
28
+ }
29
+
30
+ export function sessionPath(): string {
31
+ return join(configDir(), "session.json");
32
+ }
33
+
34
+ export function loadSession(): MosaddSession | null {
35
+ try {
36
+ const raw = readFileSync(sessionPath(), "utf8");
37
+ const s = JSON.parse(raw) as MosaddSession;
38
+ if (s && typeof s.url === "string" && typeof s.anonKey === "string") return s;
39
+ return null;
40
+ } catch {
41
+ return null;
42
+ }
43
+ }
44
+
45
+ export function saveSession(session: MosaddSession): void {
46
+ mkdirSync(configDir(), { recursive: true });
47
+ writeFileSync(sessionPath(), JSON.stringify(session, null, 2), "utf8");
48
+ // Best-effort tighten perms (no-op on platforms that ignore it).
49
+ try {
50
+ chmodSync(sessionPath(), 0o600);
51
+ } catch {
52
+ /* ignore */
53
+ }
54
+ }
55
+
56
+ export function clearSession(): boolean {
57
+ if (!existsSync(sessionPath())) return false;
58
+ rmSync(sessionPath());
59
+ return true;
60
+ }
61
+
62
+ /** True if the stored token is past (or within 30s of) its expiry. */
63
+ export function isSessionExpired(session: MosaddSession): boolean {
64
+ if (!session.expiresAt) return false;
65
+ return Date.now() / 1000 >= session.expiresAt - 30;
66
+ }