@mushi-mushi/core 1.20.0 → 1.20.2

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/CONTRIBUTING.md CHANGED
@@ -70,7 +70,7 @@ packages/
70
70
  react-native/ React Native SDK (MIT)
71
71
  cli/ CLI tool (MIT)
72
72
  mcp/ MCP server for coding agents (MIT)
73
- server/ Supabase Edge Functions (AGPLv3)
73
+ server/ Supabase Edge Functions (AGPLv3; ee/ is commercial)
74
74
  agents/ Agentic fix pipeline (AGPLv3)
75
75
  verify/ Fix verification (AGPLv3)
76
76
  apps/
@@ -211,7 +211,7 @@ chore: bump dependencies
211
211
  ## License
212
212
 
213
213
  - SDK packages are MIT — your contributions will be MIT-licensed
214
- - Server/agents/verify are AGPLv3 — contributions to those packages fall under AGPLv3
214
+ - Server/agents/verify are AGPLv3 — contributions to those packages fall under AGPLv3. A [commercial license](./COMMERCIAL-LICENSE.md) is available for hosted-SaaS use cases that cannot publish modifications. The `packages/server/ee/` directory is source-available but commercial (production use needs a license); contributions there are accepted under the same EE terms.
215
215
 
216
216
  ## Questions?
217
217
 
package/SECURITY.md CHANGED
@@ -113,7 +113,7 @@ What we treat as in-scope attacker capabilities, and what we don't.
113
113
  | Compromised Supabase service-role key | ❌ | Treated as a tier-0 incident; would require key rotation and audit-log forensics. Not defendable in software. |
114
114
  | Compromise of `kensaurus@gmail.com` | ❌ | Treated as a project-fork event; downstream consumers should pin to the last known-good version and follow the new release channel. |
115
115
  | Physical / OS-level attacker on an end-user device | ❌ | Out of scope. |
116
- | Malicious fork using the Mushi name to ship malware | ❌ (technical) ✅ (legal) | The MIT/BSL grant lets the fork exist; the trademark policy (`TRADEMARK.md`) makes shipping it under the Mushi name an infringement we will pursue. |
116
+ | Malicious fork using the Mushi name to ship malware | ❌ (technical) ✅ (legal) | The MIT / AGPLv3 grant lets the fork exist; the trademark policy (`TRADEMARK.md`) makes shipping it under the Mushi name an infringement we will pursue. |
117
117
 
118
118
  ## Data handling and PII
119
119
 
package/dist/index.cjs CHANGED
@@ -42,6 +42,47 @@ function formatBytes(n) {
42
42
  return `${(n / (1024 * 1024)).toFixed(2)} MB`;
43
43
  }
44
44
 
45
+ // src/digest.ts
46
+ function getSubtle() {
47
+ try {
48
+ const g = globalThis;
49
+ const crypto2 = g["crypto"];
50
+ if (crypto2?.subtle) return crypto2.subtle;
51
+ } catch {
52
+ }
53
+ return null;
54
+ }
55
+ function bytesToHex(bytes) {
56
+ return Array.from(bytes).map((b) => b.toString(16).padStart(2, "0")).join("");
57
+ }
58
+ async function sha256Hex(value) {
59
+ const subtle = getSubtle();
60
+ if (subtle) {
61
+ const buffer = await subtle.digest("SHA-256", new TextEncoder().encode(value));
62
+ return bytesToHex(new Uint8Array(buffer));
63
+ }
64
+ const { sha256 } = await import('@noble/hashes/sha2.js');
65
+ return bytesToHex(sha256(new TextEncoder().encode(value)));
66
+ }
67
+ async function hmacSha256Hex(secret, value) {
68
+ const subtle = getSubtle();
69
+ if (subtle) {
70
+ const key = await subtle.importKey(
71
+ "raw",
72
+ new TextEncoder().encode(secret),
73
+ { name: "HMAC", hash: "SHA-256" },
74
+ false,
75
+ ["sign"]
76
+ );
77
+ const buffer = await subtle.sign("HMAC", key, new TextEncoder().encode(value));
78
+ return bytesToHex(new Uint8Array(buffer));
79
+ }
80
+ const { hmac } = await import('@noble/hashes/hmac.js');
81
+ const { sha256 } = await import('@noble/hashes/sha2.js');
82
+ const result = hmac(sha256, new TextEncoder().encode(secret), new TextEncoder().encode(value));
83
+ return bytesToHex(result);
84
+ }
85
+
45
86
  // src/api-client.ts
46
87
  var _credWarningEmitted = false;
47
88
  var MUSHI_USER_TOKEN_HEADER = "X-Mushi-User-Token";
@@ -411,21 +452,6 @@ function createApiClient(options) {
411
452
  }
412
453
  };
413
454
  }
414
- async function sha256Hex(value) {
415
- const buffer = await crypto.subtle.digest("SHA-256", new TextEncoder().encode(value));
416
- return Array.from(new Uint8Array(buffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
417
- }
418
- async function hmacSha256Hex(secret, value) {
419
- const key = await crypto.subtle.importKey(
420
- "raw",
421
- new TextEncoder().encode(secret),
422
- { name: "HMAC", hash: "SHA-256" },
423
- false,
424
- ["sign"]
425
- );
426
- const buffer = await crypto.subtle.sign("HMAC", key, new TextEncoder().encode(value));
427
- return Array.from(new Uint8Array(buffer)).map((b) => b.toString(16).padStart(2, "0")).join("");
428
- }
429
455
  function sleep(ms) {
430
456
  return new Promise((resolve) => setTimeout(resolve, ms));
431
457
  }