@motebit/sdk 0.7.0 → 0.8.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.
- package/README.md +1 -1
- package/dist/__tests__/appearance-config.test.d.ts +2 -0
- package/dist/__tests__/appearance-config.test.d.ts.map +1 -0
- package/dist/__tests__/appearance-config.test.js +104 -0
- package/dist/__tests__/appearance-config.test.js.map +1 -0
- package/dist/__tests__/branded-ids.test.d.ts +2 -0
- package/dist/__tests__/branded-ids.test.d.ts.map +1 -0
- package/dist/__tests__/branded-ids.test.js +70 -0
- package/dist/__tests__/branded-ids.test.js.map +1 -0
- package/dist/__tests__/index.test.d.ts +2 -0
- package/dist/__tests__/index.test.d.ts.map +1 -0
- package/dist/__tests__/index.test.js +194 -0
- package/dist/__tests__/index.test.js.map +1 -0
- package/dist/__tests__/provider-mode.test.d.ts +2 -0
- package/dist/__tests__/provider-mode.test.d.ts.map +1 -0
- package/dist/__tests__/provider-mode.test.js +180 -0
- package/dist/__tests__/provider-mode.test.js.map +1 -0
- package/dist/__tests__/provider-resolver.test.d.ts +2 -0
- package/dist/__tests__/provider-resolver.test.d.ts.map +1 -0
- package/dist/__tests__/provider-resolver.test.js +353 -0
- package/dist/__tests__/provider-resolver.test.js.map +1 -0
- package/dist/__tests__/voice-config.test.d.ts +2 -0
- package/dist/__tests__/voice-config.test.d.ts.map +1 -0
- package/dist/__tests__/voice-config.test.js +98 -0
- package/dist/__tests__/voice-config.test.js.map +1 -0
- package/dist/appearance-config.d.ts +55 -0
- package/dist/appearance-config.d.ts.map +1 -0
- package/dist/appearance-config.js +79 -0
- package/dist/appearance-config.js.map +1 -0
- package/dist/credential-types-doc.d.ts +73 -0
- package/dist/credential-types-doc.d.ts.map +1 -0
- package/dist/credential-types-doc.js +2 -0
- package/dist/credential-types-doc.js.map +1 -0
- package/dist/governance-config.d.ts +5 -0
- package/dist/governance-config.d.ts.map +1 -1
- package/dist/governance-config.js +8 -1
- package/dist/governance-config.js.map +1 -1
- package/dist/index.d.ts +55 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +10 -4
- package/dist/index.js.map +1 -1
- package/dist/models.d.ts +44 -14
- package/dist/models.d.ts.map +1 -1
- package/dist/models.js +55 -18
- package/dist/models.js.map +1 -1
- package/dist/provider-mode.d.ts +109 -0
- package/dist/provider-mode.d.ts.map +1 -0
- package/dist/provider-mode.js +179 -0
- package/dist/provider-mode.js.map +1 -0
- package/dist/provider-resolver.d.ts +179 -0
- package/dist/provider-resolver.d.ts.map +1 -0
- package/dist/provider-resolver.js +224 -0
- package/dist/provider-resolver.js.map +1 -0
- package/dist/risk-labels.d.ts +22 -0
- package/dist/risk-labels.d.ts.map +1 -0
- package/dist/risk-labels.js +28 -0
- package/dist/risk-labels.js.map +1 -0
- package/dist/surface-options.d.ts +34 -0
- package/dist/surface-options.d.ts.map +1 -0
- package/dist/surface-options.js +36 -0
- package/dist/surface-options.js.map +1 -0
- package/dist/voice-config.d.ts +52 -0
- package/dist/voice-config.d.ts.map +1 -0
- package/dist/voice-config.js +61 -0
- package/dist/voice-config.js.map +1 -0
- package/package.json +7 -7
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared option lists for surface settings UIs.
|
|
3
|
+
*
|
|
4
|
+
* These are the dropdown / radio / chip options every surface needs
|
|
5
|
+
* to render the same choices the same way: the six OpenAI TTS voices,
|
|
6
|
+
* and the three theme preferences.
|
|
7
|
+
*
|
|
8
|
+
* Previously each surface redeclared these inline. Now there's one
|
|
9
|
+
* source — a new TTS voice added here shows up in every settings tab.
|
|
10
|
+
*
|
|
11
|
+
* The shapes are intentionally presentation-neutral: a key + label
|
|
12
|
+
* pair. Each surface layers its own visual styling (chip vs radio vs
|
|
13
|
+
* dropdown) on top. The key is what gets persisted; the label is what
|
|
14
|
+
* the user sees.
|
|
15
|
+
*/
|
|
16
|
+
export interface TtsVoiceOption {
|
|
17
|
+
key: string;
|
|
18
|
+
label: string;
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* OpenAI TTS voices. Reference: https://platform.openai.com/docs/guides/text-to-speech/voice-options
|
|
22
|
+
*
|
|
23
|
+
* These map 1:1 onto the `VoiceConfig.ttsVoice` field. Surfaces with
|
|
24
|
+
* non-OpenAI TTS providers can supplement this list with their own
|
|
25
|
+
* voice options, but the default catalogue lives here.
|
|
26
|
+
*/
|
|
27
|
+
export declare const TTS_VOICE_OPTIONS: TtsVoiceOption[];
|
|
28
|
+
export type ThemePreference = "light" | "dark" | "system";
|
|
29
|
+
export interface ThemeOption {
|
|
30
|
+
key: ThemePreference;
|
|
31
|
+
label: string;
|
|
32
|
+
}
|
|
33
|
+
export declare const THEME_OPTIONS: ThemeOption[];
|
|
34
|
+
//# sourceMappingURL=surface-options.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-options.d.ts","sourceRoot":"","sources":["../src/surface-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAIH,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,MAAM,CAAC;IACZ,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,EAAE,cAAc,EAO7C,CAAC;AAIF,MAAM,MAAM,eAAe,GAAG,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE1D,MAAM,WAAW,WAAW;IAC1B,GAAG,EAAE,eAAe,CAAC;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,aAAa,EAAE,WAAW,EAItC,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared option lists for surface settings UIs.
|
|
3
|
+
*
|
|
4
|
+
* These are the dropdown / radio / chip options every surface needs
|
|
5
|
+
* to render the same choices the same way: the six OpenAI TTS voices,
|
|
6
|
+
* and the three theme preferences.
|
|
7
|
+
*
|
|
8
|
+
* Previously each surface redeclared these inline. Now there's one
|
|
9
|
+
* source — a new TTS voice added here shows up in every settings tab.
|
|
10
|
+
*
|
|
11
|
+
* The shapes are intentionally presentation-neutral: a key + label
|
|
12
|
+
* pair. Each surface layers its own visual styling (chip vs radio vs
|
|
13
|
+
* dropdown) on top. The key is what gets persisted; the label is what
|
|
14
|
+
* the user sees.
|
|
15
|
+
*/
|
|
16
|
+
/**
|
|
17
|
+
* OpenAI TTS voices. Reference: https://platform.openai.com/docs/guides/text-to-speech/voice-options
|
|
18
|
+
*
|
|
19
|
+
* These map 1:1 onto the `VoiceConfig.ttsVoice` field. Surfaces with
|
|
20
|
+
* non-OpenAI TTS providers can supplement this list with their own
|
|
21
|
+
* voice options, but the default catalogue lives here.
|
|
22
|
+
*/
|
|
23
|
+
export const TTS_VOICE_OPTIONS = [
|
|
24
|
+
{ key: "alloy", label: "Alloy" },
|
|
25
|
+
{ key: "echo", label: "Echo" },
|
|
26
|
+
{ key: "fable", label: "Fable" },
|
|
27
|
+
{ key: "onyx", label: "Onyx" },
|
|
28
|
+
{ key: "nova", label: "Nova" },
|
|
29
|
+
{ key: "shimmer", label: "Shimmer" },
|
|
30
|
+
];
|
|
31
|
+
export const THEME_OPTIONS = [
|
|
32
|
+
{ key: "light", label: "Light" },
|
|
33
|
+
{ key: "dark", label: "Dark" },
|
|
34
|
+
{ key: "system", label: "System" },
|
|
35
|
+
];
|
|
36
|
+
//# sourceMappingURL=surface-options.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"surface-options.js","sourceRoot":"","sources":["../src/surface-options.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AASH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,iBAAiB,GAAqB;IACjD,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IAChC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAC9B,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IAChC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAC9B,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAC9B,EAAE,GAAG,EAAE,SAAS,EAAE,KAAK,EAAE,SAAS,EAAE;CACrC,CAAC;AAWF,MAAM,CAAC,MAAM,aAAa,GAAkB;IAC1C,EAAE,GAAG,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;IAChC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;IAC9B,EAAE,GAAG,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;CACnC,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
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
|
+
/**
|
|
16
|
+
* The canonical voice configuration. Narrow, descriptive, surface-agnostic.
|
|
17
|
+
*
|
|
18
|
+
* - `enabled`: master on/off for the voice pipeline (VAD + STT + TTS).
|
|
19
|
+
* - `autoSend`: after a transcription lands, auto-submit without a manual
|
|
20
|
+
* press. Off means the user edits/approves the transcript first.
|
|
21
|
+
* - `speakResponses`: read agent replies aloud via the TTS backend.
|
|
22
|
+
* - `ttsVoice`: opaque voice identifier — the specific string space depends
|
|
23
|
+
* on the TTS provider (OpenAI voices, platform voices, …).
|
|
24
|
+
* - `neuralVad`: opt into ML-based VAD where the platform supports it
|
|
25
|
+
* (currently iOS via Silero). Absent/false uses the default RMS VAD.
|
|
26
|
+
*/
|
|
27
|
+
export interface VoiceConfig {
|
|
28
|
+
enabled: boolean;
|
|
29
|
+
autoSend: boolean;
|
|
30
|
+
speakResponses: boolean;
|
|
31
|
+
ttsVoice: string;
|
|
32
|
+
neuralVad?: boolean;
|
|
33
|
+
}
|
|
34
|
+
/** Default voice config — voice off, sensible behavior when it's turned on. */
|
|
35
|
+
export declare const DEFAULT_VOICE_CONFIG: VoiceConfig;
|
|
36
|
+
/**
|
|
37
|
+
* Normalize any of the historical surface-specific voice shapes onto the
|
|
38
|
+
* canonical `VoiceConfig`. Unknown fields are ignored. Missing fields fall
|
|
39
|
+
* back to `DEFAULT_VOICE_CONFIG`.
|
|
40
|
+
*
|
|
41
|
+
* Accepted legacy keys:
|
|
42
|
+
* - web: `{ttsVoice, autoSend, voiceResponse}`
|
|
43
|
+
* - mobile: `{voiceEnabled, voiceAutoSend, voiceResponseEnabled, neuralVadEnabled, ttsVoice}`
|
|
44
|
+
* - desktop: `{ttsVoice, voiceAutoSend, voiceResponseEnabled}`
|
|
45
|
+
* - spatial: `{voiceEnabled, ttsVoice}`
|
|
46
|
+
*
|
|
47
|
+
* The function is intentionally defensive — it operates on `unknown` because
|
|
48
|
+
* the typical caller is reading from `localStorage` / `AsyncStorage` / a
|
|
49
|
+
* Tauri JSON config, all of which return untyped blobs.
|
|
50
|
+
*/
|
|
51
|
+
export declare function migrateVoiceConfig(raw: unknown): VoiceConfig;
|
|
52
|
+
//# sourceMappingURL=voice-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"voice-config.d.ts","sourceRoot":"","sources":["../src/voice-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;GAaG;AAEH;;;;;;;;;;;GAWG;AACH,MAAM,WAAW,WAAW;IAC1B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,OAAO,CAAC;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,+EAA+E;AAC/E,eAAO,MAAM,oBAAoB,EAAE,WAMlC,CAAC;AAEF;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,EAAE,OAAO,GAAG,WAAW,CAuB5D"}
|
|
@@ -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
|
+
//# sourceMappingUR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,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.
|
|
4
|
-
"description": "Motebit
|
|
3
|
+
"version": "0.8.0",
|
|
4
|
+
"description": "Motebit product development kit — shared types, config schemas, normalization, and adapters for Motebit surfaces. Re-exports @motebit/protocol.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
7
7
|
"types": "./dist/index.d.ts",
|
|
@@ -12,10 +12,10 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"files": [
|
|
15
|
-
"dist
|
|
16
|
-
"dist
|
|
17
|
-
"dist
|
|
18
|
-
"dist
|
|
15
|
+
"dist/**/*.js",
|
|
16
|
+
"dist/**/*.js.map",
|
|
17
|
+
"dist/**/*.d.ts",
|
|
18
|
+
"dist/**/*.d.ts.map",
|
|
19
19
|
"LICENSE",
|
|
20
20
|
"README.md"
|
|
21
21
|
],
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"access": "public"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@motebit/protocol": "0.
|
|
49
|
+
"@motebit/protocol": "0.8.0"
|
|
50
50
|
},
|
|
51
51
|
"devDependencies": {
|
|
52
52
|
"@types/node": "^22.0.0",
|