@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
package/LICENSE CHANGED
@@ -1,26 +1,206 @@
1
- MIT License
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
2
4
 
3
- Copyright (c) 2026 Motebit
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
4
6
 
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
7
+ 1. Definitions.
11
8
 
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
14
11
 
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
22
14
 
23
- "Motebit" is a trademark of Motebit, Inc. The MIT License grants rights to
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for describing the origin of the Work and
141
+ reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright 2026 Motebit, Inc.
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
202
+
203
+ "Motebit" is a trademark of Motebit, Inc. The Apache License grants rights to
24
204
  this software, not to any Motebit trademarks, logos, or branding. You may not
25
205
  use Motebit branding in a way that suggests endorsement or affiliation without
26
206
  written permission.
package/NOTICE ADDED
@@ -0,0 +1,19 @@
1
+ Motebit
2
+ Copyright 2026 Motebit, Inc.
3
+
4
+ This product includes software developed at Motebit, Inc. (https://motebit.com).
5
+
6
+ The permissive-floor packages (the protocol, SDK, cryptographic primitives,
7
+ platform-attestation verifier leaves, scaffolding CLI, and GitHub Action) are
8
+ licensed under the Apache License, Version 2.0. See LICENSE files in each
9
+ `packages/*/` subdirectory and in `spec/` for the full license text.
10
+
11
+ The remaining packages, apps, and services are licensed under the Business
12
+ Source License 1.1 and convert to the Apache License, Version 2.0 four years
13
+ after each version's first public release. See `LICENSE` at the repository
14
+ root and `LICENSING.md` for the full license boundary.
15
+
16
+ "Motebit" is a trademark of Motebit, Inc. The licenses granted here cover
17
+ this software only, not Motebit trademarks, logos, or branding. Use of
18
+ Motebit branding in a way that suggests endorsement or affiliation requires
19
+ written permission.
package/README.md CHANGED
@@ -1,8 +1,12 @@
1
1
  # @motebit/sdk
2
2
 
3
- Product types for building on the Motebit runtime — state vectors, creature behavior, rendering spec, memory graph, AI provider interface.
3
+ The developer contract for building Motebit-powered agents, services, and integrations. Apache-2.0, zero runtime dependencies.
4
4
 
5
- Re-exports all types from [`@motebit/protocol`](https://www.npmjs.com/package/@motebit/protocol) for convenience. If you only need protocol types (identity, receipts, credentials, settlement), use `@motebit/protocol` directly (MIT licensed).
5
+ ## Why this exists
6
+
7
+ `@motebit/sdk` is the **permissive-floor boundary** between the open protocol and your application. It re-exports everything in [`@motebit/protocol`](https://www.npmjs.com/package/@motebit/protocol) (identity, receipts, credentials, settlement, trust algebra) and adds the product vocabulary the reference runtime consumes: state vectors, behavior cues, memory graph, rendering spec, AI provider interfaces. Binding to the SDK instead of the runtime keeps your code portable across surfaces (desktop, mobile, spatial, cloud) and across alternative runtimes.
8
+
9
+ If you only need the protocol core, depend on `@motebit/protocol` directly — both are Apache-2.0.
6
10
 
7
11
  ## Install
8
12
 
@@ -10,6 +14,45 @@ Re-exports all types from [`@motebit/protocol`](https://www.npmjs.com/package/@m
10
14
  npm install @motebit/sdk
11
15
  ```
12
16
 
17
+ ## Example
18
+
19
+ ```ts
20
+ import type { IntelligenceProvider, ContextPack, AIResponse, MotebitState } from "@motebit/sdk";
21
+ import { TrustMode, BatteryMode } from "@motebit/sdk";
22
+
23
+ // Swap in any AI backend by implementing one interface.
24
+ class MyProvider implements IntelligenceProvider {
25
+ async generate(ctx: ContextPack): Promise<AIResponse> {
26
+ // Call your model + tool-use loop, then return the four required fields.
27
+ return {
28
+ text: "...",
29
+ confidence: 0.8,
30
+ memory_candidates: [],
31
+ state_updates: { attention: 0.9 },
32
+ };
33
+ }
34
+ async estimateConfidence() {
35
+ return 0.8;
36
+ }
37
+ async extractMemoryCandidates(_r: AIResponse) {
38
+ return [];
39
+ }
40
+ }
41
+
42
+ // State vector — the motebit's self-model, bounded by species constraints.
43
+ const state: MotebitState = {
44
+ attention: 0.7,
45
+ processing: 0.2,
46
+ confidence: 0.9,
47
+ affect_valence: 0.3,
48
+ affect_arousal: 0.15,
49
+ social_distance: 0.4,
50
+ curiosity: 0.6,
51
+ trust_mode: TrustMode.Guarded,
52
+ battery_mode: BatteryMode.Normal,
53
+ };
54
+ ```
55
+
13
56
  ## What's included
14
57
 
15
58
  Everything from `@motebit/protocol` (re-exported), plus:
@@ -24,10 +67,14 @@ Everything from `@motebit/protocol` (re-exported), plus:
24
67
 
25
68
  ## Related
26
69
 
27
- - [`@motebit/protocol`](https://www.npmjs.com/package/@motebit/protocol) — network protocol types (MIT, zero deps)
28
- - [`@motebit/verify`](https://www.npmjs.com/package/@motebit/verify) — signature verification (MIT, zero deps)
70
+ - [`@motebit/protocol`](https://www.npmjs.com/package/@motebit/protocol) — the protocol subset (Apache-2.0, zero deps)
71
+ - [`@motebit/crypto`](https://www.npmjs.com/package/@motebit/crypto) — sign and verify every Motebit artifact (Apache-2.0, zero deps)
72
+ - [`@motebit/verifier`](https://www.npmjs.com/package/@motebit/verifier) — offline third-party verifier library (Apache-2.0)
29
73
  - [`create-motebit`](https://www.npmjs.com/package/create-motebit) — scaffold a signed agent identity
74
+ - [`motebit`](https://www.npmjs.com/package/motebit) — reference runtime and operator console
30
75
 
31
76
  ## License
32
77
 
33
- MIT
78
+ Apache-2.0 — see [LICENSE](./LICENSE).
79
+
80
+ "Motebit" is a trademark. The Apache License grants rights to this software, not to any Motebit trademarks, logos, or branding. You may not use Motebit branding in a way that suggests endorsement or affiliation without written permission.
@@ -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,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;QAAE,OAAO,EAAE,GAAG,yBAAyB,EAAE,CAAC;IACpF,MAAM,GAAG,GAAG,GAA8B,CAAC;IAE3C,MAAM,KAAK,GAAG,CAAC,CAAU,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;IACjE,MAAM,KAAK,GAAG,CAAC,CAAU,EAAe,EAAE,CAAC,OAAO,CAAC,KAAK,QAAQ,CAAC;IAEjE,mEAAmE;IACnE,sEAAsE;IACtE,MAAM,WAAW,GACf,CAAC,KAAK,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC;QACtD,CAAC,KAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,SAAS,CAAC;QAC5C,CAAC,KAAK,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,qBAAqB,CAAC,CAAC,CAAC,SAAS,CAAC;QAC1E,yBAAyB,CAAC,WAAW,CAAC;IAExC,gEAAgE;IAChE,gDAAgD;IAChD,IAAI,SAA6B,CAAC;IAClC,IAAI,gBAAoC,CAAC;IACzC,IAAI,KAAK,CAAC,GAAG,CAAC,SAAS,CAAC;QAAE,SAAS,GAAG,GAAG,CAAC,SAAS,CAAC;IACpD,IAAI,KAAK,CAAC,GAAG,CAAC,gBAAgB,CAAC;QAAE,gBAAgB,GAAG,GAAG,CAAC,gBAAgB,CAAC;IACzE,MAAM,aAAa,GAAG,GAAG,CAAC,iBAAsE,CAAC;IACjG,IAAI,SAAS,KAAK,SAAS,IAAI,aAAa,IAAI,IAAI,IAAI,KAAK,CAAC,aAAa,CAAC,GAAG,CAAC,EAAE,CAAC;QACjF,SAAS,GAAG,aAAa,CAAC,GAAG,CAAC;IAChC,CAAC;IACD,IAAI,gBAAgB,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,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":""}
@@ -9,6 +9,11 @@ export interface GovernanceConfig {
9
9
  approvalPreset: ApprovalPreset;
10
10
  persistenceThreshold: number;
11
11
  rejectSecrets: boolean;
12
+ /** Max tool calls in a single agentic turn. */
12
13
  maxCallsPerTurn: number;
14
+ /** Max memories the MemoryGovernor will persist in a single turn. */
15
+ maxMemoriesPerTurn: number;
13
16
  }
17
+ /** Default governance config — matches `DEFAULT_MEMORY_GOVERNANCE` in policy. */
18
+ export declare const DEFAULT_GOVERNANCE_CONFIG: GovernanceConfig;
14
19
  //# sourceMappingURL=governance-config.d.ts.map
@@ -1 +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,eAAe,EAAE,MAAM,CAAC;CACzB"}
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"}
@@ -4,5 +4,12 @@
4
4
  * Canonical source — imported by surfaces that persist governance settings.
5
5
  * Platform-specific persistence (localStorage, Tauri, AsyncStorage) stays in each app.
6
6
  */
7
- export {};
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
+ };
8
15
  //# sourceMappingURL=governance-config.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"governance-config.js","sourceRoot":"","sources":["../src/governance-config.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}
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"}