@aithos/sdk 0.1.0-alpha.5 → 0.1.0-alpha.51

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 (67) hide show
  1. package/README.md +245 -7
  2. package/dist/src/apps.d.ts +224 -0
  3. package/dist/src/apps.js +432 -0
  4. package/dist/src/assets.d.ts +209 -0
  5. package/dist/src/assets.js +534 -0
  6. package/dist/src/auth-api.d.ts +219 -0
  7. package/dist/src/auth-api.js +248 -0
  8. package/dist/src/auth.d.ts +543 -0
  9. package/dist/src/auth.js +937 -31
  10. package/dist/src/compute.d.ts +464 -6
  11. package/dist/src/compute.js +746 -20
  12. package/dist/src/data-schema-contacts-v1.d.ts +14 -0
  13. package/dist/src/data-schema-contacts-v1.js +28 -0
  14. package/dist/src/data.d.ts +342 -0
  15. package/dist/src/data.js +1002 -0
  16. package/dist/src/endpoints.d.ts +25 -0
  17. package/dist/src/endpoints.js +7 -0
  18. package/dist/src/ethos.d.ts +85 -0
  19. package/dist/src/ethos.js +463 -7
  20. package/dist/src/index.d.ts +17 -6
  21. package/dist/src/index.js +25 -3
  22. package/dist/src/internal/delegate-bundle.js +7 -2
  23. package/dist/src/internal/envelope.d.ts +93 -0
  24. package/dist/src/internal/envelope.js +59 -0
  25. package/dist/src/mandates.d.ts +111 -2
  26. package/dist/src/mandates.js +150 -7
  27. package/dist/src/react/AithosAsset.d.ts +66 -0
  28. package/dist/src/react/AithosAsset.js +67 -0
  29. package/dist/src/react/context.d.ts +29 -0
  30. package/dist/src/react/context.js +31 -0
  31. package/dist/src/react/index.d.ts +29 -0
  32. package/dist/src/react/index.js +31 -0
  33. package/dist/src/react/use-aithos-asset.d.ts +39 -0
  34. package/dist/src/react/use-aithos-asset.js +118 -0
  35. package/dist/src/react/use-transcribe-pending.d.ts +21 -0
  36. package/dist/src/react/use-transcribe-pending.js +47 -0
  37. package/dist/src/sdk.d.ts +10 -0
  38. package/dist/src/sdk.js +22 -0
  39. package/dist/src/transcribe-resilience.d.ts +57 -0
  40. package/dist/src/transcribe-resilience.js +203 -0
  41. package/dist/src/web.d.ts +279 -0
  42. package/dist/src/web.js +186 -0
  43. package/dist/test/auth-j3.test.js +32 -1
  44. package/dist/test/canonical-conformance.test.d.ts +2 -0
  45. package/dist/test/canonical-conformance.test.js +86 -0
  46. package/dist/test/compute-delegate-path.test.d.ts +2 -0
  47. package/dist/test/compute-delegate-path.test.js +183 -0
  48. package/dist/test/compute.test.js +4 -0
  49. package/dist/test/endpoints.test.js +30 -1
  50. package/dist/test/envelope-core-conformance.test.d.ts +2 -0
  51. package/dist/test/envelope-core-conformance.test.js +75 -0
  52. package/dist/test/envelope.test.d.ts +2 -0
  53. package/dist/test/envelope.test.js +318 -0
  54. package/dist/test/ethos-first-edition.test.d.ts +2 -0
  55. package/dist/test/ethos-first-edition.test.js +371 -0
  56. package/dist/test/mandates-compute.test.d.ts +2 -0
  57. package/dist/test/mandates-compute.test.js +256 -0
  58. package/dist/test/sdk.test.js +11 -2
  59. package/dist/test/signup-bootstrap.test.d.ts +2 -0
  60. package/dist/test/signup-bootstrap.test.js +311 -0
  61. package/dist/test/transcribe-invoke.test.d.ts +2 -0
  62. package/dist/test/transcribe-invoke.test.js +204 -0
  63. package/dist/test/transcribe.test.d.ts +2 -0
  64. package/dist/test/transcribe.test.js +186 -0
  65. package/dist/test/web.test.d.ts +2 -0
  66. package/dist/test/web.test.js +270 -0
  67. package/package.json +20 -3
@@ -0,0 +1,186 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright 2026 Mathieu Colla
3
+ // Unit tests for the transcription low-level API (sdk.compute.{prepare,
4
+ // start,getStatus,listPending}Transcribe) with a mock fetch. A real
5
+ // BrowserIdentity signs the envelopes, so any signing/canonicalization
6
+ // regression surfaces here too.
7
+ import { strict as assert } from "node:assert";
8
+ import { describe, it } from "node:test";
9
+ import { createBrowserIdentity } from "@aithos/protocol-client";
10
+ import { AithosAuth, AithosSDK, memoryKeyStore, noopStore, } from "../src/index.js";
11
+ import { serializeRecoveryFile } from "../src/internal/recovery-file.js";
12
+ const APP_DID = "did:aithos:app:test";
13
+ async function makeSdk(fetchImpl) {
14
+ const id = createBrowserIdentity("test-handle", "Test User");
15
+ const auth = new AithosAuth({
16
+ authBaseUrl: "https://auth.test",
17
+ fetch: (() => {
18
+ throw new Error("auth not used in compute tests");
19
+ }),
20
+ sessionStore: noopStore(),
21
+ keyStore: memoryKeyStore(),
22
+ });
23
+ const { text } = serializeRecoveryFile(id);
24
+ await auth.signInWithRecovery({ file: text });
25
+ return new AithosSDK({
26
+ auth,
27
+ appDid: APP_DID,
28
+ endpoints: { compute: "https://compute.example.test" },
29
+ fetch: fetchImpl,
30
+ });
31
+ }
32
+ function jsonRpc(result) {
33
+ return new Response(JSON.stringify({ result }), {
34
+ status: 200,
35
+ headers: { "content-type": "application/json" },
36
+ });
37
+ }
38
+ function bodyParams(init) {
39
+ return JSON.parse(init?.body).params;
40
+ }
41
+ function bodyMethod(init) {
42
+ return JSON.parse(init?.body).method;
43
+ }
44
+ describe("compute.prepareTranscribe", () => {
45
+ it("posts transcribe_prepare with app_did + content_type and maps the result", async () => {
46
+ let method;
47
+ let params;
48
+ const sdk = await makeSdk(async (_url, init) => {
49
+ method = bodyMethod(init);
50
+ params = bodyParams(init);
51
+ return jsonRpc({
52
+ job_id: "tj_ABC",
53
+ upload_url: "https://s3.example/upload?sig=1",
54
+ s3_object_key: "uploads/2026/05/tj_ABC.webm",
55
+ expires_at: 1717000000,
56
+ });
57
+ });
58
+ const out = await sdk.compute.prepareTranscribe({
59
+ contentType: "audio/webm",
60
+ durationSecEstimate: 120,
61
+ });
62
+ assert.equal(method, "aithos.compute_transcribe_prepare");
63
+ assert.equal(params?.app_did, APP_DID);
64
+ assert.equal(params?.content_type, "audio/webm");
65
+ assert.equal(params?.duration_sec_estimate, 120);
66
+ assert.ok(params._envelope, "must carry an envelope");
67
+ assert.deepEqual(out, {
68
+ jobId: "tj_ABC",
69
+ uploadUrl: "https://s3.example/upload?sig=1",
70
+ s3ObjectKey: "uploads/2026/05/tj_ABC.webm",
71
+ expiresAt: 1717000000,
72
+ });
73
+ });
74
+ });
75
+ describe("compute.startTranscribe", () => {
76
+ it("posts transcribe_start with the wire params and maps the result", async () => {
77
+ let method;
78
+ let params;
79
+ const sdk = await makeSdk(async (_url, init) => {
80
+ method = bodyMethod(init);
81
+ params = bodyParams(init);
82
+ return jsonRpc({
83
+ job_id: "tj_ABC",
84
+ status: "running",
85
+ estimated_credits: 240,
86
+ walletBalance: 49_760,
87
+ fundedBy: "purchase",
88
+ });
89
+ });
90
+ const out = await sdk.compute.startTranscribe({
91
+ jobId: "tj_ABC",
92
+ model: "transcribe:aws-fr-standard",
93
+ durationSec: 120,
94
+ languageCode: "fr-FR",
95
+ diarization: false,
96
+ idempotencyKey: "ik_1",
97
+ });
98
+ assert.equal(method, "aithos.compute_transcribe_start");
99
+ assert.equal(params?.job_id, "tj_ABC");
100
+ assert.equal(params?.model, "transcribe:aws-fr-standard");
101
+ assert.equal(params?.duration_sec, 120);
102
+ assert.equal(params?.language_code, "fr-FR");
103
+ assert.equal(params?.diarization, false);
104
+ assert.equal(params?.idempotency_key, "ik_1");
105
+ assert.ok(typeof params?.mandate_id === "string" && params.mandate_id.length > 0);
106
+ assert.deepEqual(out, {
107
+ jobId: "tj_ABC",
108
+ status: "running",
109
+ estimatedCredits: 240,
110
+ walletBalance: 49_760,
111
+ fundedBy: "purchase",
112
+ });
113
+ });
114
+ });
115
+ describe("compute.getTranscribeStatus", () => {
116
+ it("maps a running response", async () => {
117
+ const sdk = await makeSdk(async () => jsonRpc({ job_id: "tj_ABC", status: "running", elapsed_sec: 12 }));
118
+ const out = await sdk.compute.getTranscribeStatus({ jobId: "tj_ABC" });
119
+ assert.deepEqual(out, { jobId: "tj_ABC", status: "running", elapsedSec: 12 });
120
+ });
121
+ it("maps a completed response (duration_sec_actual -> durationSec)", async () => {
122
+ const sdk = await makeSdk(async () => jsonRpc({
123
+ job_id: "tj_ABC",
124
+ status: "completed",
125
+ text: "Bonjour le monde",
126
+ segments: [{ start_sec: 0, end_sec: 1.4, text: "Bonjour le monde" }],
127
+ words: [{ start_sec: 0, end_sec: 0.4, content: "Bonjour", confidence: 0.99 }],
128
+ duration_sec_actual: 127,
129
+ language_code: "fr-FR",
130
+ creditsCharged: 254,
131
+ walletBalance: 49_746,
132
+ auditId: "audit_1",
133
+ fundedBy: "purchase",
134
+ }));
135
+ const out = await sdk.compute.getTranscribeStatus({ jobId: "tj_ABC" });
136
+ assert.equal(out.status, "completed");
137
+ if (out.status !== "completed")
138
+ return;
139
+ assert.equal(out.text, "Bonjour le monde");
140
+ assert.equal(out.durationSec, 127);
141
+ assert.equal(out.languageCode, "fr-FR");
142
+ assert.equal(out.creditsCharged, 254);
143
+ assert.equal(out.auditId, "audit_1");
144
+ assert.equal(out.fundedBy, "purchase");
145
+ assert.equal(out.segments.length, 1);
146
+ assert.equal(out.words[0]?.content, "Bonjour");
147
+ });
148
+ it("maps a failed response", async () => {
149
+ const sdk = await makeSdk(async () => jsonRpc({
150
+ job_id: "tj_ABC",
151
+ status: "failed",
152
+ error: { code: "transcribe_provider_error", message: "boom" },
153
+ }));
154
+ const out = await sdk.compute.getTranscribeStatus({ jobId: "tj_ABC" });
155
+ assert.equal(out.status, "failed");
156
+ if (out.status !== "failed")
157
+ return;
158
+ assert.equal(out.error.code, "transcribe_provider_error");
159
+ assert.equal(out.error.message, "boom");
160
+ });
161
+ });
162
+ describe("compute.listPendingTranscribes", () => {
163
+ it("forwards include_completed and maps job summaries", async () => {
164
+ let params;
165
+ const sdk = await makeSdk(async (_url, init) => {
166
+ params = bodyParams(init);
167
+ return jsonRpc({
168
+ jobs: [
169
+ { job_id: "tj_1", status: "running", created_at: 1717000000, estimated_credits: 240 },
170
+ { job_id: "tj_2", status: "completed", created_at: 1717000100, creditsCharged: 250 },
171
+ ],
172
+ });
173
+ });
174
+ const out = await sdk.compute.listPendingTranscribes({ includeCompleted: true });
175
+ assert.equal(params?.include_completed, true);
176
+ assert.equal(out.jobs.length, 2);
177
+ assert.deepEqual(out.jobs[0], {
178
+ jobId: "tj_1",
179
+ status: "running",
180
+ createdAt: 1717000000,
181
+ estimatedCredits: 240,
182
+ });
183
+ assert.equal(out.jobs[1]?.creditsCharged, 250);
184
+ });
185
+ });
186
+ //# sourceMappingURL=transcribe.test.js.map
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=web.test.d.ts.map
@@ -0,0 +1,270 @@
1
+ // SPDX-License-Identifier: Apache-2.0
2
+ // Copyright 2026 Mathieu Colla
3
+ // Unit tests for sdk.web.extract with a mock fetch.
4
+ //
5
+ // Mirrors test/compute.test.ts: real BrowserIdentity (synchronous Ed25519)
6
+ // so the envelope-signing path runs for real and any
7
+ // signature/canonicalization regression surfaces here.
8
+ import { strict as assert } from "node:assert";
9
+ import { describe, it } from "node:test";
10
+ import { createBrowserIdentity } from "@aithos/protocol-client";
11
+ import { AithosAuth, AithosSDK, AithosSDKError, memoryKeyStore, noopStore, } from "../src/index.js";
12
+ import { serializeRecoveryFile } from "../src/internal/recovery-file.js";
13
+ const APP_DID = "did:aithos:app:test";
14
+ async function makeSdk(fetchImpl) {
15
+ const id = createBrowserIdentity("test-handle", "Test User");
16
+ const auth = new AithosAuth({
17
+ authBaseUrl: "https://auth.test",
18
+ fetch: (() => {
19
+ throw new Error("auth not used in web tests");
20
+ }),
21
+ sessionStore: noopStore(),
22
+ keyStore: memoryKeyStore(),
23
+ });
24
+ const { text } = serializeRecoveryFile(id);
25
+ await auth.signInWithRecovery({ file: text });
26
+ return new AithosSDK({
27
+ auth,
28
+ appDid: APP_DID,
29
+ endpoints: { web: "https://extract.example.test" },
30
+ fetch: fetchImpl,
31
+ });
32
+ }
33
+ const HAPPY_RESULT = {
34
+ data: {
35
+ url: "https://example.com",
36
+ final_url: "https://example.com/",
37
+ fetched_at: "2026-05-13T05:30:00.000Z",
38
+ render_ms: 1234,
39
+ meta: {
40
+ title: "Example",
41
+ description: null,
42
+ lang: "en",
43
+ charset: "UTF-8",
44
+ viewport: null,
45
+ canonical: null,
46
+ og: {},
47
+ },
48
+ structure: { headings: [], sections: [], nav_links: [], forms: [] },
49
+ content: {
50
+ main_html: "<main>hi</main>",
51
+ main_text: "hi",
52
+ images: [],
53
+ links: { internal: [], external: [] },
54
+ },
55
+ styles: { css: "", inline_styles_count: 0 },
56
+ visual_signature: {
57
+ colors: {
58
+ palette: [],
59
+ background: "#ffffff",
60
+ text: "#000000",
61
+ primary: null,
62
+ link: null,
63
+ },
64
+ typography: {
65
+ heading_font: null,
66
+ body_font: "sans-serif",
67
+ size_scale: [],
68
+ base_size_px: 16,
69
+ base_line_height: 1.5,
70
+ },
71
+ radii: { button: null, input: null, card: null },
72
+ spacing: { base_unit_px: null, common_gaps_px: [] },
73
+ layout: { max_content_width_px: null, mode: "block" },
74
+ components: { buttons: [], inputs: [], cards: [] },
75
+ },
76
+ logo: null,
77
+ },
78
+ creditsCharged: 1,
79
+ walletBalance: 99_999,
80
+ auditId: "audit-web-1",
81
+ };
82
+ describe("web.extract — happy path", () => {
83
+ it("posts to ${web}/v1/invoke with a JSON-RPC envelope and parses the result", async () => {
84
+ let capturedUrl;
85
+ let capturedInit;
86
+ const fakeFetch = async (input, init) => {
87
+ capturedUrl = typeof input === "string" ? input : input.toString();
88
+ capturedInit = init;
89
+ return new Response(JSON.stringify({ result: HAPPY_RESULT }), {
90
+ status: 200,
91
+ headers: { "content-type": "application/json" },
92
+ });
93
+ };
94
+ const sdk = await makeSdk(fakeFetch);
95
+ const out = await sdk.web.extract({ url: "https://example.com" });
96
+ assert.deepEqual(out, HAPPY_RESULT);
97
+ assert.equal(capturedUrl, "https://extract.example.test/v1/invoke");
98
+ assert.equal(capturedInit?.method, "POST");
99
+ const headers = capturedInit?.headers;
100
+ assert.equal(headers["content-type"], "application/json");
101
+ const body = JSON.parse(capturedInit?.body);
102
+ assert.equal(body.jsonrpc, "2.0");
103
+ assert.equal(body.method, "aithos.web_extract");
104
+ assert.equal(body.params.url, "https://example.com");
105
+ assert.equal(body.params.app_did, APP_DID);
106
+ assert.ok(typeof body.params.mandate_id === "string");
107
+ assert.ok(body.params.mandate_id.length > 0);
108
+ assert.ok(body.params._envelope, "request must carry a signed envelope");
109
+ });
110
+ it("forwards waitUntil and timeoutMs as snake_case-free params", async () => {
111
+ let capturedBody;
112
+ const fakeFetch = async (_input, init) => {
113
+ capturedBody = JSON.parse(init.body);
114
+ return new Response(JSON.stringify({ result: HAPPY_RESULT }), {
115
+ status: 200,
116
+ headers: { "content-type": "application/json" },
117
+ });
118
+ };
119
+ const sdk = await makeSdk(fakeFetch);
120
+ await sdk.web.extract({
121
+ url: "https://example.com",
122
+ waitUntil: "domcontentloaded",
123
+ timeoutMs: 5000,
124
+ });
125
+ assert.equal(capturedBody?.params.waitUntil, "domcontentloaded");
126
+ assert.equal(capturedBody?.params.timeoutMs, 5000);
127
+ });
128
+ });
129
+ describe("web.extract — error mapping", () => {
130
+ it("propagates -32071 insufficient_balance as AithosSDKError with data", async () => {
131
+ const fakeFetch = async () => new Response(JSON.stringify({
132
+ error: {
133
+ code: -32071,
134
+ message: "Insufficient balance",
135
+ data: { required: 1, available: 0 },
136
+ },
137
+ }), { status: 200, headers: { "content-type": "application/json" } });
138
+ const sdk = await makeSdk(fakeFetch);
139
+ await assert.rejects(() => sdk.web.extract({ url: "https://example.com" }), (err) => {
140
+ assert.ok(err instanceof AithosSDKError);
141
+ assert.equal(err.code, "-32071");
142
+ const data = err.data;
143
+ assert.equal(data?.required, 1);
144
+ assert.equal(data?.available, 0);
145
+ return true;
146
+ });
147
+ });
148
+ it("propagates -32042 scope mismatch as AithosSDKError", async () => {
149
+ const fakeFetch = async () => new Response(JSON.stringify({
150
+ error: {
151
+ code: -32042,
152
+ message: "mandate does not carry the web.extract scope",
153
+ data: {
154
+ mandate_id: "mandate:abc",
155
+ required_scope: "web.extract",
156
+ },
157
+ },
158
+ }), { status: 200, headers: { "content-type": "application/json" } });
159
+ const sdk = await makeSdk(fakeFetch);
160
+ await assert.rejects(() => sdk.web.extract({ url: "https://example.com" }), (err) => {
161
+ assert.ok(err instanceof AithosSDKError);
162
+ assert.equal(err.code, "-32042");
163
+ return true;
164
+ });
165
+ });
166
+ it("rejects HTTP transport errors as AithosSDKError code=http", async () => {
167
+ const fakeFetch = async () => new Response("upstream is down", { status: 502 });
168
+ const sdk = await makeSdk(fakeFetch);
169
+ await assert.rejects(() => sdk.web.extract({ url: "https://example.com" }), (err) => {
170
+ assert.ok(err instanceof AithosSDKError);
171
+ assert.equal(err.code, "http");
172
+ return true;
173
+ });
174
+ });
175
+ });
176
+ describe("web.extract — endpoint default", () => {
177
+ it("defaults to https://extract.aithos.be when no override is given", async () => {
178
+ let capturedUrl;
179
+ const fakeFetch = async (input) => {
180
+ capturedUrl = typeof input === "string" ? input : input.toString();
181
+ return new Response(JSON.stringify({ result: HAPPY_RESULT }), {
182
+ status: 200,
183
+ headers: { "content-type": "application/json" },
184
+ });
185
+ };
186
+ const id = createBrowserIdentity("test-handle", "Test User");
187
+ const auth = new AithosAuth({
188
+ authBaseUrl: "https://auth.test",
189
+ fetch: (() => {
190
+ throw new Error("auth not used");
191
+ }),
192
+ sessionStore: noopStore(),
193
+ keyStore: memoryKeyStore(),
194
+ });
195
+ const { text } = serializeRecoveryFile(id);
196
+ await auth.signInWithRecovery({ file: text });
197
+ const sdk = new AithosSDK({
198
+ auth,
199
+ appDid: APP_DID,
200
+ fetch: fakeFetch,
201
+ });
202
+ await sdk.web.extract({ url: "https://example.com" });
203
+ assert.equal(capturedUrl, "https://extract.aithos.be/v1/invoke");
204
+ });
205
+ });
206
+ describe("web.fetchAsset — happy path", () => {
207
+ it("posts to ${web}/v1/invoke with method aithos.web_fetch_asset", async () => {
208
+ let capturedUrl;
209
+ let capturedInit;
210
+ const fakeResult = {
211
+ data: {
212
+ url: "https://example.com/logo.png",
213
+ final_url: "https://example.com/logo.png",
214
+ content_type: "image/png",
215
+ size_bytes: 4096,
216
+ base64: "aGVsbG8K",
217
+ },
218
+ creditsCharged: 1,
219
+ walletBalance: 99_998,
220
+ auditId: "audit-asset-1",
221
+ };
222
+ const fakeFetch = async (input, init) => {
223
+ capturedUrl = typeof input === "string" ? input : input.toString();
224
+ capturedInit = init;
225
+ return new Response(JSON.stringify({ result: fakeResult }), {
226
+ status: 200,
227
+ headers: { "content-type": "application/json" },
228
+ });
229
+ };
230
+ const sdk = await makeSdk(fakeFetch);
231
+ const out = await sdk.web.fetchAsset({ url: "https://example.com/logo.png" });
232
+ assert.deepEqual(out, fakeResult);
233
+ assert.equal(capturedUrl, "https://extract.example.test/v1/invoke");
234
+ const body = JSON.parse(capturedInit?.body);
235
+ assert.equal(body.method, "aithos.web_fetch_asset");
236
+ assert.equal(body.params.url, "https://example.com/logo.png");
237
+ assert.equal(body.params.app_did, APP_DID);
238
+ assert.ok(typeof body.params.mandate_id === "string");
239
+ assert.ok(body.params._envelope, "request must carry a signed envelope");
240
+ });
241
+ });
242
+ describe("web.fetchAsset — error propagation", () => {
243
+ it("propagates -32071 insufficient_balance as AithosSDKError", async () => {
244
+ const fakeFetch = async () => new Response(JSON.stringify({
245
+ error: {
246
+ code: -32071,
247
+ message: "Insufficient balance",
248
+ data: { required: 1, available: 0 },
249
+ },
250
+ }), { status: 200, headers: { "content-type": "application/json" } });
251
+ const sdk = await makeSdk(fakeFetch);
252
+ await assert.rejects(() => sdk.web.fetchAsset({ url: "https://example.com/logo.png" }), (err) => {
253
+ assert.ok(err instanceof AithosSDKError);
254
+ assert.equal(err.code, "-32071");
255
+ return true;
256
+ });
257
+ });
258
+ it("propagates -32000 upstream fetch failure as AithosSDKError", async () => {
259
+ const fakeFetch = async () => new Response(JSON.stringify({
260
+ error: { code: -32000, message: "Asset fetch failed", data: { reason: "upstream HTTP 404" } },
261
+ }), { status: 200, headers: { "content-type": "application/json" } });
262
+ const sdk = await makeSdk(fakeFetch);
263
+ await assert.rejects(() => sdk.web.fetchAsset({ url: "https://example.com/missing.png" }), (err) => {
264
+ assert.ok(err instanceof AithosSDKError);
265
+ assert.equal(err.code, "-32000");
266
+ return true;
267
+ });
268
+ });
269
+ });
270
+ //# sourceMappingURL=web.test.js.map
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aithos/sdk",
3
- "version": "0.1.0-alpha.5",
3
+ "version": "0.1.0-alpha.51",
4
4
  "description": "Aithos SDK — high-level TypeScript developer kit for building agentic apps on the Aithos protocol. Wraps @aithos/protocol-client and exposes the Aithos compute proxy and wallet (Stripe top-up) endpoints.",
5
5
  "keywords": [
6
6
  "aithos",
@@ -29,6 +29,10 @@
29
29
  "types": "./dist/src/index.d.ts",
30
30
  "import": "./dist/src/index.js"
31
31
  },
32
+ "./react": {
33
+ "types": "./dist/src/react/index.d.ts",
34
+ "import": "./dist/src/react/index.js"
35
+ },
32
36
  "./package.json": "./package.json"
33
37
  },
34
38
  "main": "./dist/src/index.js",
@@ -52,10 +56,23 @@
52
56
  "node": ">=20"
53
57
  },
54
58
  "peerDependencies": {
55
- "@aithos/protocol-client": ">=0.1.0-alpha.11 <0.2.0"
59
+ "@aithos/assets-crypto": ">=0.1.0-alpha.1 <0.2.0",
60
+ "@aithos/protocol-client": "^0.1.0-alpha.17",
61
+ "@aithos/protocol-core": ">=0.6.3 <0.7.0",
62
+ "react": "^18.0.0 || ^19.0.0"
63
+ },
64
+ "peerDependenciesMeta": {
65
+ "@aithos/assets-crypto": {
66
+ "optional": true
67
+ },
68
+ "react": {
69
+ "optional": true
70
+ }
56
71
  },
57
72
  "devDependencies": {
58
- "@aithos/protocol-client": "^0.1.0-alpha.11",
73
+ "@aithos/assets-crypto": "^0.1.0-alpha.1",
74
+ "@aithos/protocol-client": "^0.1.0-alpha.17",
75
+ "@aithos/protocol-core": ">=0.6.3 <0.7.0",
59
76
  "@types/node": "^24.12.2",
60
77
  "fake-indexeddb": "^6.2.5",
61
78
  "typescript": "^5.9.2"