@motebit/sdk 0.7.0 → 1.0.0

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 (44) hide show
  1. package/LICENSE +198 -18
  2. package/NOTICE +19 -0
  3. package/README.md +52 -5
  4. package/dist/appearance-config.d.ts +55 -0
  5. package/dist/appearance-config.d.ts.map +1 -0
  6. package/dist/appearance-config.js +79 -0
  7. package/dist/appearance-config.js.map +1 -0
  8. package/dist/credential-types-doc.d.ts +73 -0
  9. package/dist/credential-types-doc.d.ts.map +1 -0
  10. package/dist/credential-types-doc.js +2 -0
  11. package/dist/credential-types-doc.js.map +1 -0
  12. package/dist/governance-config.d.ts +5 -0
  13. package/dist/governance-config.d.ts.map +1 -1
  14. package/dist/governance-config.js +8 -1
  15. package/dist/governance-config.js.map +1 -1
  16. package/dist/index.d.ts +66 -4
  17. package/dist/index.d.ts.map +1 -1
  18. package/dist/index.js +10 -4
  19. package/dist/index.js.map +1 -1
  20. package/dist/models.d.ts +52 -14
  21. package/dist/models.d.ts.map +1 -1
  22. package/dist/models.js +59 -19
  23. package/dist/models.js.map +1 -1
  24. package/dist/provider-mode.d.ts +69 -0
  25. package/dist/provider-mode.d.ts.map +1 -0
  26. package/dist/provider-mode.js +60 -0
  27. package/dist/provider-mode.js.map +1 -0
  28. package/dist/provider-resolver.d.ts +179 -0
  29. package/dist/provider-resolver.d.ts.map +1 -0
  30. package/dist/provider-resolver.js +224 -0
  31. package/dist/provider-resolver.js.map +1 -0
  32. package/dist/risk-labels.d.ts +22 -0
  33. package/dist/risk-labels.d.ts.map +1 -0
  34. package/dist/risk-labels.js +28 -0
  35. package/dist/risk-labels.js.map +1 -0
  36. package/dist/surface-options.d.ts +34 -0
  37. package/dist/surface-options.d.ts.map +1 -0
  38. package/dist/surface-options.js +36 -0
  39. package/dist/surface-options.js.map +1 -0
  40. package/dist/voice-config.d.ts +52 -0
  41. package/dist/voice-config.d.ts.map +1 -0
  42. package/dist/voice-config.js +61 -0
  43. package/dist/voice-config.js.map +1 -0
  44. package/package.json +13 -10
@@ -0,0 +1,61 @@
1
+ /**
2
+ * Canonical voice configuration shape.
3
+ *
4
+ * Every surface (web, mobile, desktop, spatial) has historically carried its
5
+ * own voice config — with drifted field names (`voiceResponse` vs
6
+ * `voiceResponseEnabled` vs `speakResponses`, `autoSend` vs `voiceAutoSend`)
7
+ * and different subsets of the feature set. This module is the authoritative
8
+ * vocabulary. Surfaces may keep UI-internal state in their own shapes, but
9
+ * anything crossing the SDK boundary — sync, import/export, cross-surface
10
+ * helpers — speaks `VoiceConfig`.
11
+ *
12
+ * Migration helpers are provided for the legacy shapes so each surface can
13
+ * normalize on load without inventing its own migration one-offs.
14
+ */
15
+ /** Default voice config — voice off, sensible behavior when it's turned on. */
16
+ export const DEFAULT_VOICE_CONFIG = {
17
+ enabled: false,
18
+ autoSend: true,
19
+ speakResponses: true,
20
+ ttsVoice: "alloy",
21
+ neuralVad: true,
22
+ };
23
+ /**
24
+ * Normalize any of the historical surface-specific voice shapes onto the
25
+ * canonical `VoiceConfig`. Unknown fields are ignored. Missing fields fall
26
+ * back to `DEFAULT_VOICE_CONFIG`.
27
+ *
28
+ * Accepted legacy keys:
29
+ * - web: `{ttsVoice, autoSend, voiceResponse}`
30
+ * - mobile: `{voiceEnabled, voiceAutoSend, voiceResponseEnabled, neuralVadEnabled, ttsVoice}`
31
+ * - desktop: `{ttsVoice, voiceAutoSend, voiceResponseEnabled}`
32
+ * - spatial: `{voiceEnabled, ttsVoice}`
33
+ *
34
+ * The function is intentionally defensive — it operates on `unknown` because
35
+ * the typical caller is reading from `localStorage` / `AsyncStorage` / a
36
+ * Tauri JSON config, all of which return untyped blobs.
37
+ */
38
+ export function migrateVoiceConfig(raw) {
39
+ if (raw == null || typeof raw !== "object")
40
+ return { ...DEFAULT_VOICE_CONFIG };
41
+ const obj = raw;
42
+ const pick = (keys, isType) => {
43
+ for (const key of keys) {
44
+ const v = obj[key];
45
+ if (isType(v))
46
+ return v;
47
+ }
48
+ return undefined;
49
+ };
50
+ const isBool = (v) => typeof v === "boolean";
51
+ const isStr = (v) => typeof v === "string";
52
+ return {
53
+ enabled: pick(["enabled", "voiceEnabled"], isBool) ?? DEFAULT_VOICE_CONFIG.enabled,
54
+ autoSend: pick(["autoSend", "voiceAutoSend"], isBool) ?? DEFAULT_VOICE_CONFIG.autoSend,
55
+ speakResponses: pick(["speakResponses", "voiceResponse", "voiceResponseEnabled"], isBool) ??
56
+ DEFAULT_VOICE_CONFIG.speakResponses,
57
+ ttsVoice: pick(["ttsVoice"], isStr) ?? DEFAULT_VOICE_CONFIG.ttsVoice,
58
+ neuralVad: pick(["neuralVad", "neuralVadEnabled"], isBool),
59
+ };
60
+ }
61
+ //# sourceMappingURL=voice-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-config.js","sourceRoot":"","sources":["../src/voice-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAsBH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,oBAAoB,GAAgB;IAC/C,OAAO,EAAE,KAAK;IACd,QAAQ,EAAE,IAAI;IACd,cAAc,EAAE,IAAI;IACpB,QAAQ,EAAE,OAAO;IACjB,SAAS,EAAE,IAAI;CAChB,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,MAAM,UAAU,kBAAkB,CAAC,GAAY;IAC7C,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,EAAE,GAAG,oBAAoB,EAAE,CAAC;IAC/E,MAAM,GAAG,GAAG,GAA8B,CAAC;IAE3C,MAAM,IAAI,GAAG,CAAI,IAAc,EAAE,MAA8B,EAAiB,EAAE;QAChF,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;YACnB,IAAI,MAAM,CAAC,CAAC,CAAC;gBAAE,OAAO,CAAC,CAAC;QAC1B,CAAC;QACD,OAAO,SAAS,CAAC;IACnB,CAAC,CAAC;IACF,MAAM,MAAM,GAAG,CAAC,CAAU,EAAgB,EAAE,CAAC,OAAO,CAAC,KAAK,SAAS,CAAC;IACpE,MAAM,KAAK,GAAG,CAAC,CAAU,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;IAEjE,OAAO;QACL,OAAO,EAAE,IAAI,CAAC,CAAC,SAAS,EAAE,cAAc,CAAC,EAAE,MAAM,CAAC,IAAI,oBAAoB,CAAC,OAAO;QAClF,QAAQ,EAAE,IAAI,CAAC,CAAC,UAAU,EAAE,eAAe,CAAC,EAAE,MAAM,CAAC,IAAI,oBAAoB,CAAC,QAAQ;QACtF,cAAc,EACZ,IAAI,CAAC,CAAC,gBAAgB,EAAE,eAAe,EAAE,sBAAsB,CAAC,EAAE,MAAM,CAAC;YACzE,oBAAoB,CAAC,cAAc;QACrC,QAAQ,EAAE,IAAI,CAAC,CAAC,UAAU,CAAC,EAAE,KAAK,CAAC,IAAI,oBAAoB,CAAC,QAAQ;QACpE,SAAS,EAAE,IAAI,CAAC,CAAC,WAAW,EAAE,kBAAkB,CAAC,EAAE,MAAM,CAAC;KAC3D,CAAC;AACJ,CAAC"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@motebit/sdk",
3
- "version": "0.7.0",
4
- "description": "Motebit types protocol (re-exported) + product (state vectors, behavior, rendering, memory graph, AI provider). Zero-dep type vocabulary for the motebit ecosystem.",
3
+ "version": "1.0.0",
4
+ "description": "Developer contract for building Motebit-powered agents, services, and integrations stable types, adapter interfaces, governance config. Re-exports @motebit/protocol.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
7
7
  "types": "./dist/index.d.ts",
@@ -12,15 +12,16 @@
12
12
  }
13
13
  },
14
14
  "files": [
15
- "dist/*.js",
16
- "dist/*.js.map",
17
- "dist/*.d.ts",
18
- "dist/*.d.ts.map",
15
+ "dist/**/*.js",
16
+ "dist/**/*.js.map",
17
+ "dist/**/*.d.ts",
18
+ "dist/**/*.d.ts.map",
19
19
  "LICENSE",
20
+ "NOTICE",
20
21
  "README.md"
21
22
  ],
22
23
  "sideEffects": false,
23
- "license": "MIT",
24
+ "license": "Apache-2.0",
24
25
  "keywords": [
25
26
  "motebit",
26
27
  "agent",
@@ -46,7 +47,7 @@
46
47
  "access": "public"
47
48
  },
48
49
  "dependencies": {
49
- "@motebit/protocol": "0.7.0"
50
+ "@motebit/protocol": "1.0.0"
50
51
  },
51
52
  "devDependencies": {
52
53
  "@types/node": "^22.0.0",
@@ -54,14 +55,16 @@
54
55
  "vitest": "^2.1.0"
55
56
  },
56
57
  "engines": {
57
- "node": ">=18"
58
+ "node": ">=20"
58
59
  },
59
60
  "scripts": {
60
61
  "build": "tsc -b",
61
62
  "test": "vitest run",
62
63
  "test:coverage": "vitest run --coverage",
63
64
  "typecheck": "tsc --noEmit",
64
- "lint": "eslint src/",
65
+ "lint": "eslint --parser-options=project:tsconfig.eslint.json src/",
66
+ "lint:pack": "publint --strict && attw --pack --profile esm-only",
67
+ "api:extract": "api-extractor run --local",
65
68
  "clean": "rm -rf dist .turbo *.tsbuildinfo"
66
69
  }
67
70
  }