@motebit/sdk 0.6.11 → 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.
Files changed (74) hide show
  1. package/README.md +15 -110
  2. package/dist/__tests__/appearance-config.test.d.ts +2 -0
  3. package/dist/__tests__/appearance-config.test.d.ts.map +1 -0
  4. package/dist/__tests__/appearance-config.test.js +104 -0
  5. package/dist/__tests__/appearance-config.test.js.map +1 -0
  6. package/dist/__tests__/branded-ids.test.d.ts +2 -0
  7. package/dist/__tests__/branded-ids.test.d.ts.map +1 -0
  8. package/dist/__tests__/branded-ids.test.js +70 -0
  9. package/dist/__tests__/branded-ids.test.js.map +1 -0
  10. package/dist/__tests__/index.test.d.ts +2 -0
  11. package/dist/__tests__/index.test.d.ts.map +1 -0
  12. package/dist/__tests__/index.test.js +194 -0
  13. package/dist/__tests__/index.test.js.map +1 -0
  14. package/dist/__tests__/provider-mode.test.d.ts +2 -0
  15. package/dist/__tests__/provider-mode.test.d.ts.map +1 -0
  16. package/dist/__tests__/provider-mode.test.js +180 -0
  17. package/dist/__tests__/provider-mode.test.js.map +1 -0
  18. package/dist/__tests__/provider-resolver.test.d.ts +2 -0
  19. package/dist/__tests__/provider-resolver.test.d.ts.map +1 -0
  20. package/dist/__tests__/provider-resolver.test.js +353 -0
  21. package/dist/__tests__/provider-resolver.test.js.map +1 -0
  22. package/dist/__tests__/voice-config.test.d.ts +2 -0
  23. package/dist/__tests__/voice-config.test.d.ts.map +1 -0
  24. package/dist/__tests__/voice-config.test.js +98 -0
  25. package/dist/__tests__/voice-config.test.js.map +1 -0
  26. package/dist/appearance-config.d.ts +55 -0
  27. package/dist/appearance-config.d.ts.map +1 -0
  28. package/dist/appearance-config.js +79 -0
  29. package/dist/appearance-config.js.map +1 -0
  30. package/dist/approval-presets.d.ts +16 -0
  31. package/dist/approval-presets.d.ts.map +1 -0
  32. package/dist/approval-presets.js +30 -0
  33. package/dist/approval-presets.js.map +1 -0
  34. package/dist/color-presets.d.ts +14 -0
  35. package/dist/color-presets.d.ts.map +1 -0
  36. package/dist/color-presets.js +17 -0
  37. package/dist/color-presets.js.map +1 -0
  38. package/dist/credential-types-doc.d.ts +73 -0
  39. package/dist/credential-types-doc.d.ts.map +1 -0
  40. package/dist/credential-types-doc.js +2 -0
  41. package/dist/credential-types-doc.js.map +1 -0
  42. package/dist/governance-config.d.ts +19 -0
  43. package/dist/governance-config.d.ts.map +1 -0
  44. package/dist/governance-config.js +15 -0
  45. package/dist/governance-config.js.map +1 -0
  46. package/dist/index.d.ts +97 -1045
  47. package/dist/index.d.ts.map +1 -1
  48. package/dist/index.js +12 -346
  49. package/dist/index.js.map +1 -1
  50. package/dist/models.d.ts +56 -0
  51. package/dist/models.d.ts.map +1 -0
  52. package/dist/models.js +85 -0
  53. package/dist/models.js.map +1 -0
  54. package/dist/provider-mode.d.ts +109 -0
  55. package/dist/provider-mode.d.ts.map +1 -0
  56. package/dist/provider-mode.js +179 -0
  57. package/dist/provider-mode.js.map +1 -0
  58. package/dist/provider-resolver.d.ts +179 -0
  59. package/dist/provider-resolver.d.ts.map +1 -0
  60. package/dist/provider-resolver.js +224 -0
  61. package/dist/provider-resolver.js.map +1 -0
  62. package/dist/risk-labels.d.ts +22 -0
  63. package/dist/risk-labels.d.ts.map +1 -0
  64. package/dist/risk-labels.js +28 -0
  65. package/dist/risk-labels.js.map +1 -0
  66. package/dist/surface-options.d.ts +34 -0
  67. package/dist/surface-options.d.ts.map +1 -0
  68. package/dist/surface-options.js +36 -0
  69. package/dist/surface-options.js.map +1 -0
  70. package/dist/voice-config.d.ts +52 -0
  71. package/dist/voice-config.d.ts.map +1 -0
  72. package/dist/voice-config.js +61 -0
  73. package/dist/voice-config.js.map +1 -0
  74. package/package.json +9 -6
@@ -0,0 +1,98 @@
1
+ import { describe, it, expect } from "vitest";
2
+ import { DEFAULT_VOICE_CONFIG, migrateVoiceConfig } from "../voice-config.js";
3
+ describe("migrateVoiceConfig", () => {
4
+ it("returns a fresh default when input is null", () => {
5
+ const result = migrateVoiceConfig(null);
6
+ expect(result).toEqual(DEFAULT_VOICE_CONFIG);
7
+ // fresh copy, not the frozen default reference
8
+ expect(result).not.toBe(DEFAULT_VOICE_CONFIG);
9
+ });
10
+ it("returns a fresh default when input is undefined", () => {
11
+ expect(migrateVoiceConfig(undefined)).toEqual(DEFAULT_VOICE_CONFIG);
12
+ });
13
+ it("returns a fresh default when input is a primitive", () => {
14
+ expect(migrateVoiceConfig("not an object")).toEqual(DEFAULT_VOICE_CONFIG);
15
+ expect(migrateVoiceConfig(42)).toEqual(DEFAULT_VOICE_CONFIG);
16
+ expect(migrateVoiceConfig(true)).toEqual(DEFAULT_VOICE_CONFIG);
17
+ });
18
+ it("normalizes the canonical shape as-is", () => {
19
+ const input = {
20
+ enabled: true,
21
+ autoSend: false,
22
+ speakResponses: true,
23
+ ttsVoice: "nova",
24
+ neuralVad: false,
25
+ };
26
+ expect(migrateVoiceConfig(input)).toEqual(input);
27
+ });
28
+ it("migrates the web legacy shape {ttsVoice, autoSend, voiceResponse}", () => {
29
+ const result = migrateVoiceConfig({
30
+ ttsVoice: "echo",
31
+ autoSend: false,
32
+ voiceResponse: false,
33
+ });
34
+ expect(result.ttsVoice).toBe("echo");
35
+ expect(result.autoSend).toBe(false);
36
+ expect(result.speakResponses).toBe(false);
37
+ // `enabled` and `neuralVad` absent → defaults
38
+ expect(result.enabled).toBe(DEFAULT_VOICE_CONFIG.enabled);
39
+ });
40
+ it("migrates the mobile legacy shape with voiceEnabled + voiceAutoSend + voiceResponseEnabled + neuralVadEnabled", () => {
41
+ const result = migrateVoiceConfig({
42
+ voiceEnabled: true,
43
+ voiceAutoSend: true,
44
+ voiceResponseEnabled: true,
45
+ neuralVadEnabled: false,
46
+ ttsVoice: "fable",
47
+ });
48
+ expect(result).toEqual({
49
+ enabled: true,
50
+ autoSend: true,
51
+ speakResponses: true,
52
+ ttsVoice: "fable",
53
+ neuralVad: false,
54
+ });
55
+ });
56
+ it("migrates the desktop legacy shape {ttsVoice, voiceAutoSend, voiceResponseEnabled}", () => {
57
+ const result = migrateVoiceConfig({
58
+ ttsVoice: "onyx",
59
+ voiceAutoSend: false,
60
+ voiceResponseEnabled: true,
61
+ });
62
+ expect(result.ttsVoice).toBe("onyx");
63
+ expect(result.autoSend).toBe(false);
64
+ expect(result.speakResponses).toBe(true);
65
+ });
66
+ it("prefers the canonical key when both canonical and legacy keys are present", () => {
67
+ const result = migrateVoiceConfig({
68
+ enabled: true,
69
+ voiceEnabled: false,
70
+ speakResponses: true,
71
+ voiceResponseEnabled: false,
72
+ });
73
+ expect(result.enabled).toBe(true);
74
+ expect(result.speakResponses).toBe(true);
75
+ });
76
+ it("falls back to default when a field has the wrong type", () => {
77
+ const result = migrateVoiceConfig({
78
+ enabled: "yes", // wrong type
79
+ ttsVoice: 42, // wrong type
80
+ });
81
+ expect(result.enabled).toBe(DEFAULT_VOICE_CONFIG.enabled);
82
+ expect(result.ttsVoice).toBe(DEFAULT_VOICE_CONFIG.ttsVoice);
83
+ });
84
+ it("leaves neuralVad undefined when not provided (opt-in)", () => {
85
+ const result = migrateVoiceConfig({ enabled: true });
86
+ expect(result.neuralVad).toBeUndefined();
87
+ });
88
+ it("ignores unknown keys", () => {
89
+ const result = migrateVoiceConfig({
90
+ enabled: true,
91
+ foo: "bar",
92
+ baz: [1, 2, 3],
93
+ });
94
+ expect(result).not.toHaveProperty("foo");
95
+ expect(result).not.toHaveProperty("baz");
96
+ });
97
+ });
98
+ //# sourceMappingURL=voice-config.test.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"voice-config.test.js","sourceRoot":"","sources":["../../src/__tests__/voice-config.test.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,EAAE,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,MAAM,oBAAoB,CAAC;AAE9E,QAAQ,CAAC,oBAAoB,EA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C,EAAE,CAAC,CAAC;SACf,CAAC,CAAC;QACH,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;QACzC,MAAM,CAAC,MAAM,CAAC,CAAC,GAAG,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC3C,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
@@ -0,0 +1,55 @@
1
+ /**
2
+ * Canonical appearance / theme configuration shape.
3
+ *
4
+ * Every surface (web, mobile, desktop, spatial) has historically carried its
5
+ * own appearance config — with drifted field names (`preset` vs
6
+ * `colorPreset`, web's `SoulColorConfig` vs mobile's flat fields vs
7
+ * desktop's Tauri snake_case `interior_color_preset` + `custom_soul_color`)
8
+ * and different subsets of the feature set. This module is the
9
+ * authoritative vocabulary. Surfaces may keep UI-internal state in their
10
+ * own shapes, but anything crossing the SDK boundary — sync, import/export,
11
+ * cross-surface helpers — speaks `AppearanceConfig`.
12
+ *
13
+ * Migration helpers are provided for the legacy shapes so each surface can
14
+ * normalize on load without inventing its own migration one-offs.
15
+ */
16
+ /**
17
+ * The canonical appearance configuration. Narrow, descriptive, surface-agnostic.
18
+ *
19
+ * - `colorPreset`: opaque preset identifier — the specific string space depends
20
+ * on the surface (`"moonlight"`, `"amber"`, `"rose"`, …) plus the special
21
+ * value `"custom"` which means "render from `customHue` + `customSaturation`".
22
+ * - `customHue`: 0-360, only meaningful when `colorPreset === "custom"`.
23
+ * - `customSaturation`: 0-1, only meaningful when `colorPreset === "custom"`.
24
+ * - `theme`: master light/dark/system theme. Optional because some surfaces
25
+ * (web, spatial) derive it from the OS without exposing a setting.
26
+ */
27
+ export interface AppearanceConfig {
28
+ colorPreset: string;
29
+ customHue?: number;
30
+ customSaturation?: number;
31
+ theme?: "light" | "dark" | "system";
32
+ }
33
+ /** Default appearance — moonlight preset, no custom override, system theme. */
34
+ export declare const DEFAULT_APPEARANCE_CONFIG: AppearanceConfig;
35
+ /**
36
+ * Normalize any of the historical surface-specific appearance shapes onto
37
+ * the canonical `AppearanceConfig`. Unknown fields are ignored. Missing
38
+ * fields fall back to `DEFAULT_APPEARANCE_CONFIG`.
39
+ *
40
+ * Accepted legacy keys:
41
+ * - web: `{preset, customHue?, customSaturation?}` (the field is
42
+ * `preset`, not `colorPreset`, in `SoulColorConfig`).
43
+ * - mobile: `{colorPreset, customHue, customSaturation, theme}` flat
44
+ * on `MobileSettings`.
45
+ * - desktop: `{interior_color_preset, custom_soul_color: {hue, saturation}}`
46
+ * snake_case in the Tauri JSON config.
47
+ * - spatial: `{colorPreset, customHue, customSaturation}` flat on
48
+ * `SpatialSettings`.
49
+ *
50
+ * The function is intentionally defensive — it operates on `unknown` because
51
+ * the typical caller is reading from `localStorage` / `AsyncStorage` / a
52
+ * Tauri JSON config, all of which return untyped blobs.
53
+ */
54
+ export declare function migrateAppearanceConfig(raw: unknown): AppearanceConfig;
55
+ //# sourceMappingURL=appearance-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appearance-config.d.ts","sourceRoot":"","sources":["../src/appearance-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH;;;;;;;;;;GAUG;AACH,MAAM,WAAW,gBAAgB;IAC/B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,KAAK,CAAC,EAAE,OAAO,GAAG,MAAM,GAAG,QAAQ,CAAC;CACrC;AAED,+EAA+E;AAC/E,eAAO,MAAM,yBAAyB,EAAE,gBAKvC,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,OAAO,GAAG,gBAAgB,CAwCtE"}
@@ -0,0 +1,79 @@
1
+ /**
2
+ * Canonical appearance / theme configuration shape.
3
+ *
4
+ * Every surface (web, mobile, desktop, spatial) has historically carried its
5
+ * own appearance config — with drifted field names (`preset` vs
6
+ * `colorPreset`, web's `SoulColorConfig` vs mobile's flat fields vs
7
+ * desktop's Tauri snake_case `interior_color_preset` + `custom_soul_color`)
8
+ * and different subsets of the feature set. This module is the
9
+ * authoritative vocabulary. Surfaces may keep UI-internal state in their
10
+ * own shapes, but anything crossing the SDK boundary — sync, import/export,
11
+ * cross-surface helpers — speaks `AppearanceConfig`.
12
+ *
13
+ * Migration helpers are provided for the legacy shapes so each surface can
14
+ * normalize on load without inventing its own migration one-offs.
15
+ */
16
+ /** Default appearance — moonlight preset, no custom override, system theme. */
17
+ export const DEFAULT_APPEARANCE_CONFIG = {
18
+ colorPreset: "moonlight",
19
+ customHue: 220,
20
+ customSaturation: 0.7,
21
+ theme: "system",
22
+ };
23
+ /**
24
+ * Normalize any of the historical surface-specific appearance shapes onto
25
+ * the canonical `AppearanceConfig`. Unknown fields are ignored. Missing
26
+ * fields fall back to `DEFAULT_APPEARANCE_CONFIG`.
27
+ *
28
+ * Accepted legacy keys:
29
+ * - web: `{preset, customHue?, customSaturation?}` (the field is
30
+ * `preset`, not `colorPreset`, in `SoulColorConfig`).
31
+ * - mobile: `{colorPreset, customHue, customSaturation, theme}` flat
32
+ * on `MobileSettings`.
33
+ * - desktop: `{interior_color_preset, custom_soul_color: {hue, saturation}}`
34
+ * snake_case in the Tauri JSON config.
35
+ * - spatial: `{colorPreset, customHue, customSaturation}` flat on
36
+ * `SpatialSettings`.
37
+ *
38
+ * The function is intentionally defensive — it operates on `unknown` because
39
+ * the typical caller is reading from `localStorage` / `AsyncStorage` / a
40
+ * Tauri JSON config, all of which return untyped blobs.
41
+ */
42
+ export function migrateAppearanceConfig(raw) {
43
+ if (raw == null || typeof raw !== "object")
44
+ return { ...DEFAULT_APPEARANCE_CONFIG };
45
+ const obj = raw;
46
+ const isStr = (v) => typeof v === "string";
47
+ const isNum = (v) => typeof v === "number";
48
+ // Color preset: prefer canonical `colorPreset`, fall back to web's
49
+ // legacy `preset`, then desktop's snake_case `interior_color_preset`.
50
+ const colorPreset = (isStr(obj.colorPreset) ? obj.colorPreset : undefined) ??
51
+ (isStr(obj.preset) ? obj.preset : undefined) ??
52
+ (isStr(obj.interior_color_preset) ? obj.interior_color_preset : undefined) ??
53
+ DEFAULT_APPEARANCE_CONFIG.colorPreset;
54
+ // Custom hue/saturation: canonical first, then desktop's nested
55
+ // `custom_soul_color: {hue, saturation}` shape.
56
+ let customHue;
57
+ let customSaturation;
58
+ if (isNum(obj.customHue))
59
+ customHue = obj.customHue;
60
+ if (isNum(obj.customSaturation))
61
+ customSaturation = obj.customSaturation;
62
+ const desktopCustom = obj.custom_soul_color;
63
+ if (customHue === undefined && desktopCustom != null && isNum(desktopCustom.hue)) {
64
+ customHue = desktopCustom.hue;
65
+ }
66
+ if (customSaturation === undefined && desktopCustom != null && isNum(desktopCustom.saturation)) {
67
+ customSaturation = desktopCustom.saturation;
68
+ }
69
+ // Theme: canonical key only — no surface uses an alternative name.
70
+ const themeRaw = obj.theme;
71
+ const theme = themeRaw === "light" || themeRaw === "dark" || themeRaw === "system" ? themeRaw : undefined;
72
+ return {
73
+ colorPreset,
74
+ customHue: customHue ?? DEFAULT_APPEARANCE_CONFIG.customHue,
75
+ customSaturation: customSaturation ?? DEFAULT_APPEARANCE_CONFIG.customSaturation,
76
+ theme: theme ?? DEFAULT_APPEARANCE_CONFIG.theme,
77
+ };
78
+ }
79
+ //# sourceMappingURL=appearance-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"appearance-config.js","sourceRoot":"","sources":["../src/appearance-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAoBH,+EAA+E;AAC/E,MAAM,CAAC,MAAM,yBAAyB,GAAqB;IACzD,WAAW,EAAE,WAAW;IACxB,SAAS,EAAE,GAAG;IACd,gBAAgB,EAAE,GAAG;IACrB,KAAK,EAAE,QAAQ;CAChB,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,uBAAuB,CAAC,GAAY;IAClD,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BAAgB,KAAK,SAAS,IAAI,aAAa,IAAI,IAAI,IAAI,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/F,gBAAgB,GAAG,aAAa,CAAC,UAAU,CAAC;IAC9C,CAAC;IAED,mEAAmE;IACnE,MAAM,QAAQ,GAAG,GAAG,CAAC,KAAK,CAAC;IAC3B,MAAM,KAAK,GACT,QAAQ,KAAK,OAAO,IAAI,QAAQ,KAAK,MAAM,IAAI,QAAQ,KAAK,QAAQ,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,SAAS,CAAC;IAE9F,OAAO;QACL,WAAW;QACX,SAAS,EAAE,SAAS,IAAI,yBAAyB,CAAC,SAAS;QAC3D,gBAAgB,EAAE,gBAAgB,IAAI,yBAAyB,CAAC,gBAAgB;QAChF,KAAK,EAAE,KAAK,IAAI,yBAAyB,CAAC,KAAK;KAChD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,16 @@
1
+ /**
2
+ * Shared approval presets for tool governance.
3
+ *
4
+ * Canonical source — imported by all surfaces (web, desktop, mobile).
5
+ * Each preset defines the risk thresholds for automatic tool approval.
6
+ */
7
+ export type ApprovalPreset = "cautious" | "balanced" | "autonomous";
8
+ export interface ApprovalPresetConfig {
9
+ label: string;
10
+ description: string;
11
+ maxRiskLevel: number;
12
+ requireApprovalAbove: number;
13
+ denyAbove: number;
14
+ }
15
+ export declare const APPROVAL_PRESET_CONFIGS: Record<string, ApprovalPresetConfig>;
16
+ //# sourceMappingURL=approval-presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-presets.d.ts","sourceRoot":"","sources":["../src/approval-presets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,MAAM,MAAM,cAAc,GAAG,UAAU,GAAG,UAAU,GAAG,YAAY,CAAC;AAEpE,MAAM,WAAW,oBAAoB;IACnC,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,EAAE,MAAM,CAAC;IACpB,YAAY,EAAE,MAAM,CAAC;IACrB,oBAAoB,EAAE,MAAM,CAAC;IAC7B,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,eAAO,MAAM,uBAAuB,EAAE,MAAM,CAAC,MAAM,EAAE,oBAAoB,CAsBxE,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * Shared approval presets for tool governance.
3
+ *
4
+ * Canonical source — imported by all surfaces (web, desktop, mobile).
5
+ * Each preset defines the risk thresholds for automatic tool approval.
6
+ */
7
+ export const APPROVAL_PRESET_CONFIGS = {
8
+ cautious: {
9
+ label: "Cautious",
10
+ description: "Approve everything above read-only",
11
+ maxRiskLevel: 3,
12
+ requireApprovalAbove: 0,
13
+ denyAbove: 3,
14
+ },
15
+ balanced: {
16
+ label: "Balanced",
17
+ description: "Auto-allow low risk, approve medium",
18
+ maxRiskLevel: 3,
19
+ requireApprovalAbove: 1,
20
+ denyAbove: 3,
21
+ },
22
+ autonomous: {
23
+ label: "Autonomous",
24
+ description: "Auto-allow most, deny only dangerous",
25
+ maxRiskLevel: 4,
26
+ requireApprovalAbove: 3,
27
+ denyAbove: 4,
28
+ },
29
+ };
30
+ //# sourceMappingURL=approval-presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"approval-presets.js","sourceRoot":"","sources":["../src/approval-presets.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAYH,MAAM,CAAC,MAAM,uBAAuB,GAAyC;IAC3E,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,oCAAoC;QACjD,YAAY,EAAE,CAAC;QACf,oBAAoB,EAAE,CAAC;QACvB,SAAS,EAAE,CAAC;KACb;IACD,QAAQ,EAAE;QACR,KAAK,EAAE,UAAU;QACjB,WAAW,EAAE,qCAAqC;QAClD,YAAY,EAAE,CAAC;QACf,oBAAoB,EAAE,CAAC;QACvB,SAAS,EAAE,CAAC;KACb;IACD,UAAU,EAAE;QACV,KAAK,EAAE,YAAY;QACnB,WAAW,EAAE,sCAAsC;QACnD,YAAY,EAAE,CAAC;QACf,oBAAoB,EAAE,CAAC;QACvB,SAAS,EAAE,CAAC;KACb;CACF,CAAC"}
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Shared color presets for the creature's interior.
3
+ *
4
+ * Canonical source — imported by all surfaces (web, desktop, mobile, spatial).
5
+ * The InteriorColor shape matches @motebit/render-engine but is defined inline
6
+ * here so the SDK stays Layer 0 with zero non-protocol deps.
7
+ */
8
+ /** Interior color of the droplet creature — tint (glass absorption) + glow (emissive). */
9
+ export interface InteriorColor {
10
+ tint: [number, number, number];
11
+ glow: [number, number, number];
12
+ }
13
+ export declare const COLOR_PRESETS: Record<string, InteriorColor>;
14
+ //# sourceMappingURL=color-presets.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-presets.d.ts","sourceRoot":"","sources":["../src/color-presets.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,0FAA0F;AAC1F,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAC/B,IAAI,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;CAChC;AAED,eAAO,MAAM,aAAa,EAAE,MAAM,CAAC,MAAM,EAAE,aAAa,CAQvD,CAAC"}
@@ -0,0 +1,17 @@
1
+ /**
2
+ * Shared color presets for the creature's interior.
3
+ *
4
+ * Canonical source — imported by all surfaces (web, desktop, mobile, spatial).
5
+ * The InteriorColor shape matches @motebit/render-engine but is defined inline
6
+ * here so the SDK stays Layer 0 with zero non-protocol deps.
7
+ */
8
+ export const COLOR_PRESETS = {
9
+ moonlight: { tint: [0.95, 0.95, 1.0], glow: [0.8, 0.85, 1.0] },
10
+ amber: { tint: [1.0, 0.85, 0.6], glow: [0.9, 0.7, 0.3] },
11
+ rose: { tint: [1.0, 0.82, 0.88], glow: [0.9, 0.5, 0.6] },
12
+ violet: { tint: [0.88, 0.8, 1.0], glow: [0.6, 0.4, 0.9] },
13
+ cyan: { tint: [0.8, 0.95, 1.0], glow: [0.3, 0.8, 0.9] },
14
+ ember: { tint: [1.0, 0.75, 0.65], glow: [0.9, 0.35, 0.2] },
15
+ sage: { tint: [0.82, 0.95, 0.85], glow: [0.4, 0.75, 0.5] },
16
+ };
17
+ //# sourceMappingURL=color-presets.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"color-presets.js","sourceRoot":"","sources":["../src/color-presets.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAQH,MAAM,CAAC,MAAM,aAAa,GAAkC;IAC1D,SAAS,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE;IAC9D,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IACxD,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IACxD,MAAM,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IACzD,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EAAE;IACvD,KAAK,EAAE,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE;IAC1D,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,EAAE,IAAI,EAAE,CAAC,GAAG,EAAE,IAAI,EAAE,GAAG,CAAC,EAAE;CAC3D,CAAC"}
@@ -0,0 +1,73 @@
1
+ /**
2
+ * @fileoverview Credential-shaped type family (documentation module).
3
+ *
4
+ * The monorepo has four "Credential/Verifier"-shaped types that are easy to
5
+ * confuse at a glance but are deliberately distinct. They are complementary,
6
+ * not duplicates. Each addresses a different side of the trust boundary.
7
+ *
8
+ * Naming convention:
9
+ * - `Source` → supplies a credential (outbound)
10
+ * - `Verifier` → checks something (identity of a remote, or validity of a token)
11
+ * - `Adapter` → persistent storage
12
+ *
13
+ * ──────────────────────────────────────────────────────────────────────────
14
+ * 1. CredentialSource (OUTBOUND — supply)
15
+ * Location: `@motebit/mcp-client`
16
+ * Shape: `getCredential(CredentialRequest) → string | null`
17
+ * Role: Per-call credential supplier used when WE call a third-party
18
+ * MCP server. Resolved per HTTP request via custom `fetch`
19
+ * injection so per-tool, per-scope credentials are possible.
20
+ * Known implementations:
21
+ * - StaticCredentialSource (wraps a static bearer token)
22
+ * - KeyringCredentialSource (reads from OS keyring per call)
23
+ * - VaultCredentialSource (reads from an external vault per call)
24
+ * - OAuthCredentialSource (OAuth 2.0 lifecycle with refresh-ahead)
25
+ *
26
+ * ──────────────────────────────────────────────────────────────────────────
27
+ * 2. ServerVerifier (OUTBOUND — check remote identity)
28
+ * Location: `@motebit/mcp-client`
29
+ * Shape: `verify(config, tools) → VerificationResult`
30
+ * Role: Verifies the identity / integrity of a third-party MCP server
31
+ * we are connecting TO. Runs automatically during `connect()`
32
+ * after tool discovery. Fail-closed.
33
+ * Known implementations:
34
+ * - ManifestPinningVerifier (fail-closed on manifest change)
35
+ * - AdvisoryManifestVerifier (accepts, revokes trust on change)
36
+ * - TlsCertificateVerifier (pins TLS cert SHA-256 fingerprint)
37
+ * - CompositeServerVerifier (chains multiple verifiers)
38
+ *
39
+ * ──────────────────────────────────────────────────────────────────────────
40
+ * 3. InboundCredentialVerifier (INBOUND — check presented token)
41
+ * Location: `@motebit/mcp-server`
42
+ * Shape: `verify(token: string) → Promise<boolean>`
43
+ * Role: Checks inbound non-motebit bearer tokens when WE ARE the MCP
44
+ * server and a third party is calling us. Motebit-to-motebit
45
+ * signed-token auth is a separate, untouched path.
46
+ * Known implementations:
47
+ * - StaticTokenVerifier (constant-string comparison)
48
+ *
49
+ * (Previously named `CredentialVerifier` — renamed to make the direction
50
+ * explicit and avoid collision with the two outbound types above.)
51
+ *
52
+ * ──────────────────────────────────────────────────────────────────────────
53
+ * 4. CredentialStoreAdapter (STORAGE — persist)
54
+ * Location: `@motebit/protocol`
55
+ * Role: Persistent credential storage. The "where credentials live
56
+ * at rest" boundary — separate from how they are supplied on
57
+ * the wire (CredentialSource) or how tokens are checked at
58
+ * either end (ServerVerifier / InboundCredentialVerifier).
59
+ *
60
+ * ──────────────────────────────────────────────────────────────────────────
61
+ * Quick mental model:
62
+ *
63
+ * WE CALL OUT WE ARE CALLED
64
+ * ─────────── ─────────────
65
+ * Supply CredentialSource —
66
+ * Check peer ServerVerifier InboundCredentialVerifier
67
+ * Store CredentialStoreAdapter CredentialStoreAdapter
68
+ *
69
+ * If you find yourself reaching for "CredentialVerifier" without a direction
70
+ * qualifier, stop and pick the specific type above.
71
+ */
72
+ export {};
73
+ //# sourceMappingURL=credential-types-doc.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-types-doc.d.ts","sourceRoot":"","sources":["../src/credential-types-doc.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsEG;AACH,OAAO,EAAE,CAAC"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=credential-types-doc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"credential-types-doc.js","sourceRoot":"","sources":["../src/credential-types-doc.ts"],"names":[],"mappings":""}
@@ -0,0 +1,19 @@
1
+ /**
2
+ * Shared governance configuration schema.
3
+ *
4
+ * Canonical source — imported by surfaces that persist governance settings.
5
+ * Platform-specific persistence (localStorage, Tauri, AsyncStorage) stays in each app.
6
+ */
7
+ import type { ApprovalPreset } from "./approval-presets.js";
8
+ export interface GovernanceConfig {
9
+ approvalPreset: ApprovalPreset;
10
+ persistenceThreshold: number;
11
+ rejectSecrets: boolean;
12
+ /** Max tool calls in a single agentic turn. */
13
+ maxCallsPerTurn: number;
14
+ /** Max memories the MemoryGovernor will persist in a single turn. */
15
+ maxMemoriesPerTurn: number;
16
+ }
17
+ /** Default governance config — matches `DEFAULT_MEMORY_GOVERNANCE` in policy. */
18
+ export declare const DEFAULT_GOVERNANCE_CONFIG: GovernanceConfig;
19
+ //# sourceMappingURL=governance-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance-config.d.ts","sourceRoot":"","sources":["../src/governance-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAC;AAE5D,MAAM,WAAW,gBAAgB;IAC/B,cAAc,EAAE,cAAc,CAAC;IAC/B,oBAAoB,EAAE,MAAM,CAAC;IAC7B,aAAa,EAAE,OAAO,CAAC;IACvB,+CAA+C;IAC/C,eAAe,EAAE,MAAM,CAAC;IACxB,qEAAqE;IACrE,kBAAkB,EAAE,MAAM,CAAC;CAC5B;AAED,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,EAAE,gBAMvC,CAAC"}
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Shared governance configuration schema.
3
+ *
4
+ * Canonical source — imported by surfaces that persist governance settings.
5
+ * Platform-specific persistence (localStorage, Tauri, AsyncStorage) stays in each app.
6
+ */
7
+ /** Default governance config — matches `DEFAULT_MEMORY_GOVERNANCE` in policy. */
8
+ export const DEFAULT_GOVERNANCE_CONFIG = {
9
+ approvalPreset: "balanced",
10
+ persistenceThreshold: 0.5,
11
+ rejectSecrets: true,
12
+ maxCallsPerTurn: 10,
13
+ maxMemoriesPerTurn: 5,
14
+ };
15
+ //# sourceMappingURL=governance-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"governance-config.js","sourceRoot":"","sources":["../src/governance-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAcH,iFAAiF;AACjF,MAAM,CAAC,MAAM,yBAAyB,GAAqB;IACzD,cAAc,EAAE,UAAU;IAC1B,oBAAoB,EAAE,GAAG;IACzB,aAAa,EAAE,IAAI;IACnB,eAAe,EAAE,EAAE;IACnB,kBAAkB,EAAE,CAAC;CACtB,CAAC"}