@motebit/sdk 0.1.0 → 0.5.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/LICENSE CHANGED
@@ -20,7 +20,7 @@ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
20
  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  SOFTWARE.
22
22
 
23
- "Motebit" is a trademark of Daniel Hakim. The MIT License grants rights to
23
+ "Motebit" is a trademark of Motebit, Inc. The MIT License grants rights to
24
24
  this software, not to any Motebit trademarks, logos, or branding. You may not
25
25
  use Motebit branding in a way that suggests endorsement or affiliation without
26
26
  written permission.
package/README.md CHANGED
@@ -1,8 +1,8 @@
1
1
  # @motebit/sdk
2
2
 
3
- Core types for the motebit protocol.
3
+ Core protocol types for the motebit agent identity standard.
4
4
 
5
- Zero dependencies. Pure TypeScript interfaces, enums, and type definitions for building on the motebit identity and agent protocol.
5
+ Zero dependencies. Pure TypeScript interfaces, enums, branded ID types, and utility functions for building on the motebit protocol.
6
6
 
7
7
  ## Install
8
8
 
@@ -10,29 +10,20 @@ Zero dependencies. Pure TypeScript interfaces, enums, and type definitions for b
10
10
  npm install @motebit/sdk
11
11
  ```
12
12
 
13
- ## What's included
14
-
15
- | Category | Types |
16
- |----------|-------|
17
- | **Identity** | `MotebitIdentity`, `MotebitType`, `AgentTrustLevel`, `AgentTrustRecord` |
18
- | **State vector** | `MotebitState`, `TrustMode`, `BatteryMode` |
19
- | **Behavior** | `BehaviorCues`, `SPECIES_CONSTRAINTS` |
20
- | **Memory** | `MemoryNode`, `MemoryEdge`, `MemoryCandidate`, `MemoryType`, `RelationType`, `SensitivityLevel` |
21
- | **Policy** | `PolicyDecision`, `ToolRiskProfile`, `RiskLevel`, `DataClass`, `SideEffect`, `TurnContext`, `InjectionWarning`, `ToolAuditEntry` |
22
- | **Tools** | `ToolDefinition`, `ToolResult`, `ToolHandler`, `ToolRegistry` |
23
- | **AI provider** | `ContextPack`, `AIResponse`, `IntelligenceProvider`, `ConversationMessage`, `ToolCall` |
24
- | **Events** | `EventLogEntry`, `EventType` |
25
- | **Sync** | `SyncCursor`, `ConflictEdge`, `SyncConversation`, `SyncConversationMessage`, `ConversationSyncResult` |
26
- | **Plans** | `Plan`, `PlanStep`, `PlanStatus`, `StepStatus` |
27
- | **Agent protocol** | `AgentTask`, `AgentTaskStatus`, `ExecutionReceipt`, `AgentCapabilities` |
28
- | **Render** | `RenderSpec`, `GeometrySpec`, `MaterialSpec`, `LightingSpec` |
29
- | **Privacy** | `AuditRecord`, `ExportManifest` |
30
-
31
13
  ## Usage
32
14
 
33
15
  ```typescript
34
- import { MotebitState, TrustMode, RiskLevel, ExecutionReceipt } from "@motebit/sdk";
16
+ import {
17
+ type MotebitState,
18
+ type ExecutionReceipt,
19
+ type AgentTask,
20
+ TrustMode,
21
+ BatteryMode,
22
+ AgentTrustLevel,
23
+ RiskLevel,
24
+ } from "@motebit/sdk";
35
25
 
26
+ // Typed agent state vector
36
27
  const state: MotebitState = {
37
28
  attention: 0.7,
38
29
  processing: 0.3,
@@ -44,8 +35,94 @@ const state: MotebitState = {
44
35
  trust_mode: TrustMode.Guarded,
45
36
  battery_mode: BatteryMode.Normal,
46
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);
47
76
  ```
48
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` |
119
+
120
+ ## Related
121
+
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
125
+
49
126
  ## License
50
127
 
51
- MIT. Motebit is a trademark of Daniel Hakim.
128
+ MIT. Motebit is a trademark of Motebit, Inc.