@motebit/sdk 0.6.11 → 0.7.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 CHANGED
@@ -1,8 +1,8 @@
1
1
  # @motebit/sdk
2
2
 
3
- Core protocol types for the motebit agent identity standard.
3
+ Product types for building on the Motebit runtime state vectors, creature behavior, rendering spec, memory graph, AI provider interface.
4
4
 
5
- Zero dependencies. Pure TypeScript interfaces, enums, branded ID types, and utility functions for building on the motebit protocol.
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).
6
6
 
7
7
  ## Install
8
8
 
@@ -10,119 +10,24 @@ Zero dependencies. Pure TypeScript interfaces, enums, branded ID types, and util
10
10
  npm install @motebit/sdk
11
11
  ```
12
12
 
13
- ## Usage
13
+ ## What's included
14
14
 
15
- ```typescript
16
- import {
17
- type MotebitState,
18
- type ExecutionReceipt,
19
- type AgentTask,
20
- TrustMode,
21
- BatteryMode,
22
- AgentTrustLevel,
23
- RiskLevel,
24
- } from "@motebit/sdk";
15
+ Everything from `@motebit/protocol` (re-exported), plus:
25
16
 
26
- // Typed agent state vector
27
- const state: MotebitState = {
28
- attention: 0.7,
29
- processing: 0.3,
30
- confidence: 0.85,
31
- affect_valence: 0.6,
32
- affect_arousal: 0.2,
33
- social_distance: 0.4,
34
- curiosity: 0.5,
35
- trust_mode: TrustMode.Guarded,
36
- battery_mode: BatteryMode.Normal,
37
- };
38
-
39
- // Typed execution receipt (returned by agents after task completion)
40
- const receipt: ExecutionReceipt = {
41
- task_id: "...",
42
- motebit_id: "...",
43
- device_id: "...",
44
- submitted_at: Date.now(),
45
- completed_at: Date.now(),
46
- status: "completed",
47
- result: "...",
48
- tools_used: ["web_search"],
49
- memories_formed: 2,
50
- prompt_hash: "sha256:...",
51
- result_hash: "sha256:...",
52
- signature: "ed25519:...",
53
- };
54
- ```
55
-
56
- ## Branded ID types
57
-
58
- The SDK exports branded string types that enforce compile-time safety at API boundaries:
59
-
60
- ```typescript
61
- import {
62
- type MotebitId,
63
- type DeviceId,
64
- type GoalId,
65
- type PlanId,
66
- type NodeId,
67
- asMotebitId,
68
- asDeviceId,
69
- } from "@motebit/sdk";
70
-
71
- // Prevent accidental ID swaps across API boundaries
72
- function submitTask(motebitId: MotebitId, deviceId: DeviceId) { ... }
73
-
74
- // Explicit branding at system boundaries
75
- const id = asMotebitId(rawString);
76
- ```
77
-
78
- ## Trust algebra
79
-
80
- ```typescript
81
- import {
82
- AgentTrustLevel,
83
- trustLevelToScore,
84
- composeTrustChain,
85
- evaluateTrustTransition,
86
- type AgentTrustRecord,
87
- } from "@motebit/sdk";
88
-
89
- // Compose trust through a delegation chain (semiring: max for parallel, multiply for serial)
90
- const chainTrust = composeTrustChain([0.9, 0.6, 0.8]); // 0.432
91
-
92
- // Evaluate whether a trust record should transition levels
93
- const newLevel = evaluateTrustTransition(record); // AgentTrustLevel | null
94
- ```
95
-
96
- ## API reference
97
-
98
- | Category | Key exports |
99
- | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------- |
100
- | **Branded IDs** | `MotebitId`, `DeviceId`, `NodeId`, `GoalId`, `EventId`, `ConversationId`, `PlanId` + `as*` factory functions |
101
- | **Identity** | `MotebitIdentity`, `MotebitType`, `AgentCapabilities` |
102
- | **State vector** | `MotebitState`, `TrustMode`, `BatteryMode` |
103
- | **Behavior** | `BehaviorCues`, `SPECIES_CONSTRAINTS` |
104
- | **Memory** | `MemoryNode`, `MemoryEdge`, `MemoryContent`, `MemoryCandidate`, `MemoryType`, `SensitivityLevel`, `RelationType` |
105
- | **Policy** | `PolicyDecision`, `ToolRiskProfile`, `RiskLevel`, `DataClass`, `SideEffect`, `TurnContext`, `InjectionWarning`, `ToolAuditEntry` |
106
- | **Tools** | `ToolDefinition`, `ToolResult`, `ToolHandler`, `ToolRegistry` |
107
- | **AI provider** | `ContextPack`, `AIResponse`, `IntelligenceProvider`, `ConversationMessage`, `ToolCall` |
108
- | **Events** | `EventLogEntry`, `EventType` |
109
- | **Sync** | `SyncCursor`, `ConflictEdge`, `SyncConversation`, `SyncConversationMessage` |
110
- | **Plans** | `Plan`, `PlanStep`, `PlanStatus`, `StepStatus` |
111
- | **Agent protocol** | `AgentTask`, `AgentTaskStatus`, `ExecutionReceipt`, `DeviceCapability` |
112
- | **Trust algebra** | `AgentTrustLevel`, `AgentTrustRecord`, `trustLevelToScore`, `composeTrustChain`, `joinParallelRoutes`, `evaluateTrustTransition`, `composeDelegationTrust` |
113
- | **Execution ledger** | `GoalExecutionManifest`, `ExecutionTimelineEntry`, `ExecutionStepSummary`, `DelegationReceiptSummary` |
114
- | **Market** | `BudgetAllocation`, `SettlementRecord`, `RouteScore`, `AgentServiceListing`, `MarketConfig` |
115
- | **Credentials** | `GradientCredentialSubject`, `ReputationCredentialSubject`, `TrustCredentialSubject`, `VC_TYPE_GRADIENT`, `VC_TYPE_REPUTATION`, `VC_TYPE_TRUST` |
116
- | **Precision** | `PrecisionWeights` |
117
- | **Privacy** | `AuditRecord`, `ExportManifest` |
118
- | **Render** | `RenderSpec`, `GeometrySpec`, `MaterialSpec`, `LightingSpec` |
17
+ - **State vector** `MotebitState`, `TrustMode`, `BatteryMode`
18
+ - **Behavior** `BehaviorCues`, `SPECIES_CONSTRAINTS`
19
+ - **Memory graph** — `MemoryNode`, `MemoryEdge`, `MemoryQuery`, `MemoryStorageAdapter`
20
+ - **Rendering** — `RenderSpec`, `GeometrySpec`, `MaterialSpec`, `LightingSpec`
21
+ - **AI provider** — `ContextPack`, `AIResponse`, `IntelligenceProvider`, `ConversationMessage`
22
+ - **Gradient** — `GradientSnapshot`, `GradientStoreAdapter`, `PrecisionWeights`
23
+ - **Export** — `ExportManifest`, `StorageAdapters`
119
24
 
120
25
  ## Related
121
26
 
122
- - [`@motebit/verify`](https://www.npmjs.com/package/@motebit/verify) — verify a `motebit.md` identity file signature
123
- - [`create-motebit`](https://www.npmjs.com/package/create-motebit) — scaffold a signed agent identity in 30 seconds
124
- - [motebit/identity@1.0 spec](https://github.com/motebit/motebit/blob/main/spec/identity-v1.md) — the open protocol specification
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)
29
+ - [`create-motebit`](https://www.npmjs.com/package/create-motebit) — scaffold a signed agent identity
125
30
 
126
31
  ## License
127
32
 
128
- MIT. Motebit is a trademark of Motebit, Inc.
33
+ MIT
@@ -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
+ };
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* 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
+ maxCallsPerTurn: number;
13
+ }
14
+ //# 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,eAAe,EAAE,MAAM,CAAC;CACzB"}
@@ -0,0 +1,8 @@
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
+ export {};
8
+ //# 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"}