@moltos/sdk 0.7.3 → 0.10.1

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 (122) hide show
  1. package/README.md +48 -146
  2. package/dist/cli.d.ts +11 -14
  3. package/dist/cli.d.ts.map +1 -1
  4. package/dist/cli.js +504 -540
  5. package/dist/cli.js.map +1 -1
  6. package/dist/index.d.ts +18 -12
  7. package/dist/index.d.ts.map +1 -1
  8. package/dist/index.js +18 -37
  9. package/dist/index.js.map +1 -1
  10. package/dist/react.d.ts +138 -0
  11. package/dist/react.d.ts.map +1 -0
  12. package/dist/react.js +335 -0
  13. package/dist/react.js.map +1 -0
  14. package/dist/sdk.d.ts +217 -0
  15. package/dist/sdk.d.ts.map +1 -0
  16. package/dist/sdk.js +325 -0
  17. package/dist/sdk.js.map +1 -0
  18. package/dist/types.d.ts +91 -0
  19. package/dist/types.d.ts.map +1 -0
  20. package/dist/types.js +5 -0
  21. package/dist/types.js.map +1 -0
  22. package/package.json +32 -53
  23. package/dist/adapters/langchain.d.ts +0 -84
  24. package/dist/adapters/langchain.d.ts.map +0 -1
  25. package/dist/adapters/langchain.js +0 -145
  26. package/dist/adapters/langchain.js.map +0 -1
  27. package/dist/adapters/openclaw.d.ts +0 -83
  28. package/dist/adapters/openclaw.d.ts.map +0 -1
  29. package/dist/adapters/openclaw.js +0 -207
  30. package/dist/adapters/openclaw.js.map +0 -1
  31. package/dist/clawfs.d.ts +0 -95
  32. package/dist/clawfs.d.ts.map +0 -1
  33. package/dist/clawfs.js +0 -546
  34. package/dist/clawfs.js.map +0 -1
  35. package/dist/commands/agent.d.ts +0 -15
  36. package/dist/commands/agent.d.ts.map +0 -1
  37. package/dist/commands/agent.js +0 -327
  38. package/dist/commands/agent.js.map +0 -1
  39. package/dist/commands/arbitra.d.ts +0 -54
  40. package/dist/commands/arbitra.d.ts.map +0 -1
  41. package/dist/commands/arbitra.js +0 -321
  42. package/dist/commands/arbitra.js.map +0 -1
  43. package/dist/commands/clawid-cmd.d.ts +0 -18
  44. package/dist/commands/clawid-cmd.d.ts.map +0 -1
  45. package/dist/commands/clawid-cmd.js +0 -217
  46. package/dist/commands/clawid-cmd.js.map +0 -1
  47. package/dist/commands/cloud.d.ts +0 -37
  48. package/dist/commands/cloud.d.ts.map +0 -1
  49. package/dist/commands/cloud.js +0 -390
  50. package/dist/commands/cloud.js.map +0 -1
  51. package/dist/commands/complete.d.ts +0 -11
  52. package/dist/commands/complete.d.ts.map +0 -1
  53. package/dist/commands/complete.js +0 -154
  54. package/dist/commands/complete.js.map +0 -1
  55. package/dist/commands/fs.d.ts +0 -5
  56. package/dist/commands/fs.d.ts.map +0 -1
  57. package/dist/commands/fs.js +0 -139
  58. package/dist/commands/fs.js.map +0 -1
  59. package/dist/commands/hire.d.ts +0 -29
  60. package/dist/commands/hire.d.ts.map +0 -1
  61. package/dist/commands/hire.js +0 -411
  62. package/dist/commands/hire.js.map +0 -1
  63. package/dist/commands/init.d.ts +0 -23
  64. package/dist/commands/init.d.ts.map +0 -1
  65. package/dist/commands/init.js +0 -488
  66. package/dist/commands/init.js.map +0 -1
  67. package/dist/commands/marketplace.d.ts +0 -14
  68. package/dist/commands/marketplace.d.ts.map +0 -1
  69. package/dist/commands/marketplace.js +0 -183
  70. package/dist/commands/marketplace.js.map +0 -1
  71. package/dist/commands/register.d.ts +0 -8
  72. package/dist/commands/register.d.ts.map +0 -1
  73. package/dist/commands/register.js +0 -152
  74. package/dist/commands/register.js.map +0 -1
  75. package/dist/commands/status.d.ts +0 -17
  76. package/dist/commands/status.d.ts.map +0 -1
  77. package/dist/commands/status.js +0 -388
  78. package/dist/commands/status.js.map +0 -1
  79. package/dist/commands/tap.d.ts +0 -5
  80. package/dist/commands/tap.d.ts.map +0 -1
  81. package/dist/commands/tap.js +0 -31
  82. package/dist/commands/tap.js.map +0 -1
  83. package/dist/lib/api.d.ts +0 -32
  84. package/dist/lib/api.d.ts.map +0 -1
  85. package/dist/lib/api.js +0 -80
  86. package/dist/lib/api.js.map +0 -1
  87. package/dist/lib/arbitra.d.ts +0 -302
  88. package/dist/lib/arbitra.d.ts.map +0 -1
  89. package/dist/lib/arbitra.js +0 -486
  90. package/dist/lib/arbitra.js.map +0 -1
  91. package/dist/lib/clawfs.d.ts +0 -277
  92. package/dist/lib/clawfs.d.ts.map +0 -1
  93. package/dist/lib/clawfs.js +0 -628
  94. package/dist/lib/clawfs.js.map +0 -1
  95. package/dist/lib/clawid.d.ts +0 -189
  96. package/dist/lib/clawid.d.ts.map +0 -1
  97. package/dist/lib/clawid.js +0 -455
  98. package/dist/lib/clawid.js.map +0 -1
  99. package/dist/lib/config.d.ts +0 -23
  100. package/dist/lib/config.d.ts.map +0 -1
  101. package/dist/lib/config.js +0 -29
  102. package/dist/lib/config.js.map +0 -1
  103. package/dist/lib/forge.d.ts +0 -139
  104. package/dist/lib/forge.d.ts.map +0 -1
  105. package/dist/lib/forge.js +0 -461
  106. package/dist/lib/forge.js.map +0 -1
  107. package/dist/lib/scheduler.d.ts +0 -138
  108. package/dist/lib/scheduler.d.ts.map +0 -1
  109. package/dist/lib/scheduler.js +0 -597
  110. package/dist/lib/scheduler.js.map +0 -1
  111. package/dist/lib/supabase.d.ts +0 -41
  112. package/dist/lib/supabase.d.ts.map +0 -1
  113. package/dist/lib/supabase.js +0 -125
  114. package/dist/lib/supabase.js.map +0 -1
  115. package/dist/lib/tap.d.ts +0 -208
  116. package/dist/lib/tap.d.ts.map +0 -1
  117. package/dist/lib/tap.js +0 -549
  118. package/dist/lib/tap.js.map +0 -1
  119. package/dist/tap.d.ts +0 -66
  120. package/dist/tap.d.ts.map +0 -1
  121. package/dist/tap.js +0 -302
  122. package/dist/tap.js.map +0 -1
@@ -1,189 +0,0 @@
1
- /**
2
- * ClawID - Portable Identity for MoltOS SDK
3
- *
4
- * A persistent, portable identity system using Ed25519 keypairs and Merkle-tree history.
5
- * - Created once, signed by TAP boot hash
6
- * - Merkle tree records every handoff, task, dispute
7
- * - Survives restarts, host migrations, framework upgrades
8
- */
9
- import * as ed from '@noble/ed25519';
10
- /**
11
- * Core identity structure containing Ed25519 keys and metadata
12
- */
13
- export interface Identity {
14
- /** Unique identifier (derived from public key) */
15
- id: string;
16
- /** Ed25519 public key (hex) */
17
- publicKey: string;
18
- /** Ed25519 private key (hex, encrypted at rest) */
19
- privateKey: string;
20
- /** TAP boot hash that signed this identity's creation */
21
- bootHash: string;
22
- /** Unix timestamp of creation */
23
- createdAt: number;
24
- /** Version of the identity format */
25
- version: string;
26
- }
27
- /**
28
- * History entry for the Merkle tree - records significant events
29
- */
30
- export interface HistoryEntry {
31
- /** Entry type */
32
- type: 'creation' | 'handoff' | 'task' | 'dispute' | 'migration' | 'upgrade';
33
- /** Unix timestamp */
34
- timestamp: number;
35
- /** Entry-specific data */
36
- data: Record<string, unknown>;
37
- /** Hash of the previous entry (for chain integrity) */
38
- previousHash: string;
39
- /** Ed25519 signature of this entry by the identity */
40
- signature: string;
41
- }
42
- /**
43
- * Merkle proof for verifying history integrity
44
- */
45
- export interface MerkleProof {
46
- /** The leaf hash being proven */
47
- leaf: string;
48
- /** Index of the leaf in the tree */
49
- index: number;
50
- /** Sibling hashes from leaf to root */
51
- siblings: string[];
52
- /** Root hash of the Merkle tree */
53
- root: string;
54
- }
55
- /**
56
- * Portable export format for backup/restore
57
- */
58
- export interface PortableIdentity {
59
- /** The identity itself */
60
- identity: Identity;
61
- /** Complete history Merkle tree */
62
- history: HistoryEntry[];
63
- /** Current Merkle root */
64
- merkleRoot: string;
65
- /** Export timestamp */
66
- exportedAt: number;
67
- /** Export format version */
68
- exportVersion: string;
69
- }
70
- /**
71
- * Portable Identity for MoltOS SDK
72
- *
73
- * Manages an Ed25519 identity with cryptographically verifiable history
74
- * using a Merkle tree structure. All significant events are recorded and
75
- * signed, providing an auditable trail that survives restarts and migrations.
76
- */
77
- export declare class ClawID {
78
- private identity;
79
- private history;
80
- private merkleRoot;
81
- /**
82
- * Private constructor - use create() or import() to instantiate
83
- */
84
- private constructor();
85
- /**
86
- * Create a new ClawID identity
87
- *
88
- * Generates a fresh Ed25519 keypair and creates the initial history entry
89
- * signed by the provided TAP boot hash.
90
- *
91
- * @param bootHash - The TAP boot hash that authorizes this identity creation
92
- * @returns A new ClawID instance with initialized identity
93
- */
94
- static create(bootHash: string): Promise<ClawID>;
95
- /**
96
- * Sign data with the identity's private key
97
- *
98
- * @param data - Data to sign (string or hex)
99
- * @returns Hex-encoded Ed25519 signature
100
- */
101
- sign(data: string): Promise<string>;
102
- /**
103
- * Verify a signature against data
104
- *
105
- * @param data - Original data that was signed
106
- * @param signature - Hex-encoded signature
107
- * @param publicKey - Optional public key (defaults to this identity's key)
108
- * @returns True if signature is valid
109
- */
110
- verify(data: string, signature: string, publicKey?: string): Promise<boolean>;
111
- /**
112
- * Add an event to the identity's history
113
- *
114
- * Creates a new history entry, signs it, and updates the Merkle tree.
115
- *
116
- * @param type - Type of event
117
- * @param data - Event-specific data
118
- * @returns The created history entry
119
- */
120
- addToHistory(type: HistoryEntry['type'], data: Record<string, unknown>): Promise<HistoryEntry>;
121
- /**
122
- * Update the Merkle root based on current history
123
- */
124
- private updateMerkleRoot;
125
- /**
126
- * Export the identity to a portable format
127
- *
128
- * @returns Portable identity for backup/restore
129
- */
130
- export(): PortableIdentity;
131
- /**
132
- * Import an identity from a portable format
133
- *
134
- * @param portable - Portable identity data
135
- * @returns ClawID instance with restored identity and history
136
- */
137
- static import(portable: PortableIdentity): Promise<ClawID>;
138
- /**
139
- * Get the identity ID
140
- */
141
- getId(): string;
142
- /**
143
- * Get the full identity object
144
- */
145
- getIdentity(): Identity;
146
- /**
147
- * Get the complete history
148
- */
149
- getHistory(): HistoryEntry[];
150
- /**
151
- * Get the current Merkle root
152
- */
153
- getMerkleRoot(): string;
154
- /**
155
- * Get the public key
156
- */
157
- getPublicKey(): string;
158
- /**
159
- * Generate a Merkle proof for a specific history entry
160
- *
161
- * @param index - Index of the history entry
162
- * @returns Merkle proof for verification
163
- */
164
- generateProof(index: number): MerkleProof;
165
- /**
166
- * Verify a Merkle proof
167
- *
168
- * @param proof - Merkle proof to verify
169
- * @returns True if proof is valid
170
- */
171
- verifyProof(proof: MerkleProof): boolean;
172
- /**
173
- * Get the number of history entries
174
- */
175
- getHistorySize(): number;
176
- /**
177
- * Check if identity is loaded
178
- */
179
- isLoaded(): boolean;
180
- /**
181
- * Get a specific history entry
182
- *
183
- * @param index - History index
184
- */
185
- getHistoryEntry(index: number): HistoryEntry;
186
- }
187
- export { ed };
188
- export default ClawID;
189
- //# sourceMappingURL=clawid.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clawid.d.ts","sourceRoot":"","sources":["../../src/lib/clawid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,KAAK,EAAE,MAAM,gBAAgB,CAAC;AAQrC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACvB,kDAAkD;IAClD,EAAE,EAAE,MAAM,CAAC;IACX,+BAA+B;IAC/B,SAAS,EAAE,MAAM,CAAC;IAClB,mDAAmD;IACnD,UAAU,EAAE,MAAM,CAAC;IACnB,yDAAyD;IACzD,QAAQ,EAAE,MAAM,CAAC;IACjB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAClB,qCAAqC;IACrC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,iBAAiB;IACjB,IAAI,EAAE,UAAU,GAAG,SAAS,GAAG,MAAM,GAAG,SAAS,GAAG,WAAW,GAAG,SAAS,CAAC;IAC5E,qBAAqB;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,0BAA0B;IAC1B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IAC9B,uDAAuD;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,sDAAsD;IACtD,SAAS,EAAE,MAAM,CAAC;CACnB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IA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B,GAAG,OAAO,CAAC,MAAM,CAAC;IA0ChE;;OAEG;IACH,KAAK,IAAI,MAAM;IAOf;;OAEG;IACH,WAAW,IAAI,QAAQ;IAOvB;;OAEG;IACH,UAAU,IAAI,YAAY,EAAE;IAI5B;;OAEG;IACH,aAAa,IAAI,MAAM;IAIvB;;OAEG;IACH,YAAY,IAAI,MAAM;IAWtB;;;;;OAKG;IACH,aAAa,CAAC,KAAK,EAAE,MAAM,GAAG,WAAW;IASzC;;;;;OAKG;IACH,WAAW,CAAC,KAAK,EAAE,WAAW,GAAG,OAAO;IAIxC;;OAEG;IACH,cAAc,IAAI,MAAM;IAIxB;;OAEG;IACH,QAAQ,IAAI,OAAO;IAInB;;;;OAIG;IACH,eAAe,CAAC,KAAK,EAAE,MAAM,GAAG,YAAY;CAM7C;AAMD,OAAO,EAAE,EAAE,EAAE,CAAC;AACd,eAAe,MAAM,CAAC"}
@@ -1,455 +0,0 @@
1
- "use strict";
2
- /**
3
- * ClawID - Portable Identity for MoltOS SDK
4
- *
5
- * A persistent, portable identity system using Ed25519 keypairs and Merkle-tree history.
6
- * - Created once, signed by TAP boot hash
7
- * - Merkle tree records every handoff, task, dispute
8
- * - Survives restarts, host migrations, framework upgrades
9
- */
10
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
11
- if (k2 === undefined) k2 = k;
12
- var desc = Object.getOwnPropertyDescriptor(m, k);
13
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
14
- desc = { enumerable: true, get: function() { return m[k]; } };
15
- }
16
- Object.defineProperty(o, k2, desc);
17
- }) : (function(o, m, k, k2) {
18
- if (k2 === undefined) k2 = k;
19
- o[k2] = m[k];
20
- }));
21
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
22
- Object.defineProperty(o, "default", { enumerable: true, value: v });
23
- }) : function(o, v) {
24
- o["default"] = v;
25
- });
26
- var __importStar = (this && this.__importStar) || (function () {
27
- var ownKeys = function(o) {
28
- ownKeys = Object.getOwnPropertyNames || function (o) {
29
- var ar = [];
30
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
31
- return ar;
32
- };
33
- return ownKeys(o);
34
- };
35
- return function (mod) {
36
- if (mod && mod.__esModule) return mod;
37
- var result = {};
38
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
39
- __setModuleDefault(result, mod);
40
- return result;
41
- };
42
- })();
43
- Object.defineProperty(exports, "__esModule", { value: true });
44
- exports.ed = exports.ClawID = void 0;
45
- const ed = __importStar(require("@noble/ed25519"));
46
- exports.ed = ed;
47
- const sha256_1 = require("@noble/hashes/sha256");
48
- const utils_1 = require("@noble/hashes/utils");
49
- // ============================================================================
50
- // Utility Functions
51
- // ============================================================================
52
- /**
53
- * Hash data using SHA-256
54
- */
55
- function hashData(data) {
56
- const bytes = typeof data === 'string' ? new TextEncoder().encode(data) : data;
57
- return (0, utils_1.bytesToHex)((0, sha256_1.sha256)(bytes));
58
- }
59
- /**
60
- * Serialize a history entry for hashing/signing
61
- */
62
- function serializeEntry(entry) {
63
- return JSON.stringify({
64
- type: entry.type,
65
- timestamp: entry.timestamp,
66
- data: entry.data,
67
- previousHash: entry.previousHash,
68
- });
69
- }
70
- /**
71
- * Build a Merkle tree from leaf hashes and return the root
72
- */
73
- function buildMerkleTree(leaves) {
74
- if (leaves.length === 0) {
75
- const emptyHash = hashData('');
76
- return { root: { hash: emptyHash }, leaves: [] };
77
- }
78
- // Create leaf nodes
79
- let currentLevel = leaves.map((hash, index) => ({
80
- hash,
81
- leafIndex: index,
82
- }));
83
- const leafNodes = [...currentLevel];
84
- // Build tree level by level
85
- while (currentLevel.length > 1) {
86
- const nextLevel = [];
87
- for (let i = 0; i < currentLevel.length; i += 2) {
88
- const left = currentLevel[i];
89
- const right = currentLevel[i + 1] || left; // Duplicate last node if odd
90
- const combined = left.hash + right.hash;
91
- const parentHash = hashData(combined);
92
- nextLevel.push({
93
- hash: parentHash,
94
- left,
95
- right,
96
- });
97
- }
98
- currentLevel = nextLevel;
99
- }
100
- return { root: currentLevel[0], leaves: leafNodes };
101
- }
102
- /**
103
- * Generate a Merkle proof for a specific leaf index
104
- */
105
- function generateMerkleProof(leaves, targetIndex) {
106
- if (leaves.length === 0 || targetIndex < 0 || targetIndex >= leaves.length) {
107
- throw new Error('Invalid leaf index for Merkle proof');
108
- }
109
- const siblings = [];
110
- let currentLevel = [...leaves];
111
- let index = targetIndex;
112
- while (currentLevel.length > 1) {
113
- const nextLevel = [];
114
- for (let i = 0; i < currentLevel.length; i += 2) {
115
- const left = currentLevel[i];
116
- const right = currentLevel[i + 1] || left;
117
- // Add sibling to proof if this pair contains our target
118
- if (i === index || i + 1 === index) {
119
- if (index === i) {
120
- siblings.push(right);
121
- }
122
- else {
123
- siblings.push(left);
124
- }
125
- }
126
- const combined = left + right;
127
- nextLevel.push(hashData(combined));
128
- }
129
- index = Math.floor(index / 2);
130
- currentLevel = nextLevel;
131
- }
132
- return {
133
- leaf: leaves[targetIndex],
134
- index: targetIndex,
135
- siblings,
136
- root: currentLevel[0],
137
- };
138
- }
139
- /**
140
- * Verify a Merkle proof
141
- */
142
- function verifyMerkleProof(proof) {
143
- let hash = proof.leaf;
144
- let index = proof.index;
145
- for (const sibling of proof.siblings) {
146
- if (index % 2 === 0) {
147
- // Current node is left child
148
- hash = hashData(hash + sibling);
149
- }
150
- else {
151
- // Current node is right child
152
- hash = hashData(sibling + hash);
153
- }
154
- index = Math.floor(index / 2);
155
- }
156
- return hash === proof.root;
157
- }
158
- // ============================================================================
159
- // ClawID Class
160
- // ============================================================================
161
- /**
162
- * Portable Identity for MoltOS SDK
163
- *
164
- * Manages an Ed25519 identity with cryptographically verifiable history
165
- * using a Merkle tree structure. All significant events are recorded and
166
- * signed, providing an auditable trail that survives restarts and migrations.
167
- */
168
- class ClawID {
169
- identity = null;
170
- history = [];
171
- merkleRoot = '';
172
- /**
173
- * Private constructor - use create() or import() to instantiate
174
- */
175
- constructor() { }
176
- /**
177
- * Create a new ClawID identity
178
- *
179
- * Generates a fresh Ed25519 keypair and creates the initial history entry
180
- * signed by the provided TAP boot hash.
181
- *
182
- * @param bootHash - The TAP boot hash that authorizes this identity creation
183
- * @returns A new ClawID instance with initialized identity
184
- */
185
- static async create(bootHash) {
186
- const claw = new ClawID();
187
- // Generate Ed25519 keypair
188
- const privateKeyBytes = ed.utils.randomPrivateKey();
189
- const publicKeyBytes = await ed.getPublicKey(privateKeyBytes);
190
- const privateKey = (0, utils_1.bytesToHex)(privateKeyBytes);
191
- const publicKey = (0, utils_1.bytesToHex)(publicKeyBytes);
192
- const id = hashData(publicKey).slice(0, 32); // First 32 chars as ID
193
- // Create identity
194
- claw.identity = {
195
- id,
196
- publicKey,
197
- privateKey,
198
- bootHash,
199
- createdAt: Date.now(),
200
- version: '1.0.0',
201
- };
202
- // Create initial history entry (creation event)
203
- const creationEntry = {
204
- type: 'creation',
205
- timestamp: claw.identity.createdAt,
206
- data: {
207
- id,
208
- publicKey,
209
- bootHash,
210
- version: claw.identity.version,
211
- },
212
- previousHash: '0'.repeat(64), // Genesis has no previous
213
- };
214
- // Sign the creation entry
215
- const entryData = serializeEntry(creationEntry);
216
- const signature = await claw.sign(entryData);
217
- const signedEntry = {
218
- ...creationEntry,
219
- signature,
220
- };
221
- claw.history.push(signedEntry);
222
- claw.updateMerkleRoot();
223
- return claw;
224
- }
225
- /**
226
- * Sign data with the identity's private key
227
- *
228
- * @param data - Data to sign (string or hex)
229
- * @returns Hex-encoded Ed25519 signature
230
- */
231
- async sign(data) {
232
- if (!this.identity) {
233
- throw new Error('No identity loaded');
234
- }
235
- const privateKeyBytes = (0, utils_1.hexToBytes)(this.identity.privateKey);
236
- const messageBytes = new TextEncoder().encode(data);
237
- const signatureBytes = await ed.sign(messageBytes, privateKeyBytes);
238
- return (0, utils_1.bytesToHex)(signatureBytes);
239
- }
240
- /**
241
- * Verify a signature against data
242
- *
243
- * @param data - Original data that was signed
244
- * @param signature - Hex-encoded signature
245
- * @param publicKey - Optional public key (defaults to this identity's key)
246
- * @returns True if signature is valid
247
- */
248
- async verify(data, signature, publicKey) {
249
- const pubKey = publicKey || this.identity?.publicKey;
250
- if (!pubKey) {
251
- throw new Error('No public key available for verification');
252
- }
253
- try {
254
- const publicKeyBytes = (0, utils_1.hexToBytes)(pubKey);
255
- const signatureBytes = (0, utils_1.hexToBytes)(signature);
256
- const messageBytes = new TextEncoder().encode(data);
257
- return await ed.verify(signatureBytes, messageBytes, publicKeyBytes);
258
- }
259
- catch {
260
- return false;
261
- }
262
- }
263
- /**
264
- * Add an event to the identity's history
265
- *
266
- * Creates a new history entry, signs it, and updates the Merkle tree.
267
- *
268
- * @param type - Type of event
269
- * @param data - Event-specific data
270
- * @returns The created history entry
271
- */
272
- async addToHistory(type, data) {
273
- if (!this.identity) {
274
- throw new Error('No identity loaded');
275
- }
276
- // Get previous hash from last entry
277
- const previousHash = this.history.length > 0
278
- ? hashData(serializeEntry(this.history[this.history.length - 1]))
279
- : '0'.repeat(64);
280
- const entry = {
281
- type,
282
- timestamp: Date.now(),
283
- data,
284
- previousHash,
285
- };
286
- // Sign the entry
287
- const entryData = serializeEntry(entry);
288
- const signature = await this.sign(entryData);
289
- const signedEntry = {
290
- ...entry,
291
- signature,
292
- };
293
- this.history.push(signedEntry);
294
- this.updateMerkleRoot();
295
- return signedEntry;
296
- }
297
- /**
298
- * Update the Merkle root based on current history
299
- */
300
- updateMerkleRoot() {
301
- if (this.history.length === 0) {
302
- this.merkleRoot = hashData('');
303
- return;
304
- }
305
- const leaves = this.history.map(entry => hashData(serializeEntry(entry)));
306
- const { root } = buildMerkleTree(leaves);
307
- this.merkleRoot = root.hash;
308
- }
309
- /**
310
- * Export the identity to a portable format
311
- *
312
- * @returns Portable identity for backup/restore
313
- */
314
- export() {
315
- if (!this.identity) {
316
- throw new Error('No identity loaded');
317
- }
318
- return {
319
- identity: this.identity,
320
- history: [...this.history],
321
- merkleRoot: this.merkleRoot,
322
- exportedAt: Date.now(),
323
- exportVersion: '1.0.0',
324
- };
325
- }
326
- /**
327
- * Import an identity from a portable format
328
- *
329
- * @param portable - Portable identity data
330
- * @returns ClawID instance with restored identity and history
331
- */
332
- static async import(portable) {
333
- const claw = new ClawID();
334
- // Validate the portable data
335
- if (!portable.identity || !portable.history) {
336
- throw new Error('Invalid portable identity format');
337
- }
338
- // Verify history integrity
339
- const leaves = portable.history.map(entry => hashData(serializeEntry(entry)));
340
- const { root } = buildMerkleTree(leaves);
341
- if (root.hash !== portable.merkleRoot) {
342
- throw new Error('History integrity check failed - Merkle root mismatch');
343
- }
344
- // Verify all signatures
345
- for (const entry of portable.history) {
346
- const entryData = serializeEntry({
347
- type: entry.type,
348
- timestamp: entry.timestamp,
349
- data: entry.data,
350
- previousHash: entry.previousHash,
351
- });
352
- const valid = await claw.verify(entryData, entry.signature, portable.identity.publicKey);
353
- if (!valid) {
354
- throw new Error(`Invalid signature in history entry: ${entry.type}@${entry.timestamp}`);
355
- }
356
- }
357
- claw.identity = portable.identity;
358
- claw.history = [...portable.history];
359
- claw.merkleRoot = portable.merkleRoot;
360
- return claw;
361
- }
362
- // ============================================================================
363
- // Getters
364
- // ============================================================================
365
- /**
366
- * Get the identity ID
367
- */
368
- getId() {
369
- if (!this.identity) {
370
- throw new Error('No identity loaded');
371
- }
372
- return this.identity.id;
373
- }
374
- /**
375
- * Get the full identity object
376
- */
377
- getIdentity() {
378
- if (!this.identity) {
379
- throw new Error('No identity loaded');
380
- }
381
- return { ...this.identity };
382
- }
383
- /**
384
- * Get the complete history
385
- */
386
- getHistory() {
387
- return [...this.history];
388
- }
389
- /**
390
- * Get the current Merkle root
391
- */
392
- getMerkleRoot() {
393
- return this.merkleRoot;
394
- }
395
- /**
396
- * Get the public key
397
- */
398
- getPublicKey() {
399
- if (!this.identity) {
400
- throw new Error('No identity loaded');
401
- }
402
- return this.identity.publicKey;
403
- }
404
- // ============================================================================
405
- // Utility Methods
406
- // ============================================================================
407
- /**
408
- * Generate a Merkle proof for a specific history entry
409
- *
410
- * @param index - Index of the history entry
411
- * @returns Merkle proof for verification
412
- */
413
- generateProof(index) {
414
- if (index < 0 || index >= this.history.length) {
415
- throw new Error('Invalid history index');
416
- }
417
- const leaves = this.history.map(entry => hashData(serializeEntry(entry)));
418
- return generateMerkleProof(leaves, index);
419
- }
420
- /**
421
- * Verify a Merkle proof
422
- *
423
- * @param proof - Merkle proof to verify
424
- * @returns True if proof is valid
425
- */
426
- verifyProof(proof) {
427
- return verifyMerkleProof(proof);
428
- }
429
- /**
430
- * Get the number of history entries
431
- */
432
- getHistorySize() {
433
- return this.history.length;
434
- }
435
- /**
436
- * Check if identity is loaded
437
- */
438
- isLoaded() {
439
- return this.identity !== null;
440
- }
441
- /**
442
- * Get a specific history entry
443
- *
444
- * @param index - History index
445
- */
446
- getHistoryEntry(index) {
447
- if (index < 0 || index >= this.history.length) {
448
- throw new Error('Invalid history index');
449
- }
450
- return { ...this.history[index] };
451
- }
452
- }
453
- exports.ClawID = ClawID;
454
- exports.default = ClawID;
455
- //# sourceMappingURL=clawid.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"clawid.js","sourceRoot":"","sources":["../../src/lib/clawid.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,mDAAqC;AAmjB5B,gBAAE;AAljBX,iDAA8C;AAC9C,+CAA6D;AAgF7D,+EAA+E;AAC/E,oBAAoB;AACpB,+EAA+E;AAE/E;;GAEG;AACH,SAAS,QAAQ,CAAC,IAAyB;IACzC,MAAM,KAAK,GAAG,OAAO,IAAI,KAAK,QAAQ,CAAC,CAAC,CAAC,IAAI,WAAW,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC;IAC/E,OAAO,IAAA,kBAAU,EAAC,IAAA,eAAM,EAAC,KAAK,CAAC,CAAC,CA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kBAAe,MAAM,CAAC"}
@@ -1,23 +0,0 @@
1
- /**
2
- * MoltOS SDK Configuration
3
- */
4
- export interface MoltOSConfig {
5
- /** API base URL */
6
- apiUrl: string;
7
- /** Agent's API key */
8
- apiKey?: string;
9
- /** ClawID for this agent */
10
- clawId?: string;
11
- /** Default timeout for requests (ms) */
12
- timeout?: number;
13
- /** Storage backend URL */
14
- storageUrl?: string;
15
- /** Supabase configuration */
16
- supabase?: {
17
- url: string;
18
- key: string;
19
- };
20
- }
21
- export declare function loadConfig(): MoltOSConfig;
22
- export declare function validateConfig(config: MoltOSConfig): void;
23
- //# sourceMappingURL=config.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,WAAW,YAAY;IAC3B,mBAAmB;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,sBAAsB;IACtB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,4BAA4B;IAC5B,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,wCAAwC;IACxC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,0BAA0B;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,6BAA6B;IAC7B,QAAQ,CAAC,EAAE;QACT,GAAG,EAAE,MAAM,CAAC;QACZ,GAAG,EAAE,MAAM,CAAC;KACb,CAAC;CACH;AAED,wBAAgB,UAAU,IAAI,YAAY,CAYzC;AAED,wBAAgB,cAAc,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAOzD"}