@aithos/sdk 0.1.0-alpha.21 → 0.1.0-alpha.24
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 +36 -0
- package/dist/src/compute.d.ts +0 -149
- package/dist/src/compute.js +0 -76
- package/dist/src/endpoints.d.ts +9 -0
- package/dist/src/endpoints.js +5 -0
- package/dist/src/index.d.ts +4 -2
- package/dist/src/index.js +2 -1
- package/dist/src/sdk.d.ts +3 -0
- package/dist/src/sdk.js +9 -0
- package/dist/src/web.d.ts +279 -0
- package/dist/src/web.js +186 -0
- package/dist/test/compute.test.js +4 -162
- package/dist/test/endpoints.test.js +20 -1
- package/dist/test/web.test.d.ts +2 -0
- package/dist/test/web.test.js +270 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -100,11 +100,47 @@ network — they fail fast with a precise `AithosSDKError`:
|
|
|
100
100
|
set — useful for agents that only consume tokens (e.g. creative
|
|
101
101
|
assistants) without seeing any of your data.
|
|
102
102
|
|
|
103
|
+
## Extracting webpages without an LLM
|
|
104
|
+
|
|
105
|
+
`sdk.web` is a token-priced primitive that lets your agent read a
|
|
106
|
+
public webpage and get back cleaned HTML, purged CSS and a
|
|
107
|
+
deterministic visual signature — all computed server-side without an
|
|
108
|
+
LLM in the loop. Pricing is a flat **1 microcredit** per successful
|
|
109
|
+
extraction (refunded on failure), versus ~30 mc for a comparable
|
|
110
|
+
LLM-based extraction.
|
|
111
|
+
|
|
112
|
+
```ts
|
|
113
|
+
import { AithosSDK } from "@aithos/sdk";
|
|
114
|
+
|
|
115
|
+
const sdk = new AithosSDK({ auth, appDid });
|
|
116
|
+
|
|
117
|
+
const { data, creditsCharged } = await sdk.web.extract({
|
|
118
|
+
url: "https://example.com",
|
|
119
|
+
});
|
|
120
|
+
|
|
121
|
+
console.log(data.meta.title); // "Example Domain"
|
|
122
|
+
console.log(data.visual_signature.colors.primary); // "#0078d4"
|
|
123
|
+
console.log(data.styles.css.length); // purged + minified CSS
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
Owners can mint a mandate for delegate-only extraction:
|
|
127
|
+
|
|
128
|
+
```ts
|
|
129
|
+
import { WEB_EXTRACT_SCOPE } from "@aithos/sdk";
|
|
130
|
+
|
|
131
|
+
await sdk.mandates.create({
|
|
132
|
+
appDid: "did:aithos:app:my-agent",
|
|
133
|
+
scopes: [WEB_EXTRACT_SCOPE],
|
|
134
|
+
// ...
|
|
135
|
+
});
|
|
136
|
+
```
|
|
137
|
+
|
|
103
138
|
## What lives where
|
|
104
139
|
|
|
105
140
|
| Namespace | Purpose |
|
|
106
141
|
| ---------------- | ------------------------------------------------------------------------------------------ |
|
|
107
142
|
| `sdk.compute` | Bedrock invocation through the Aithos compute proxy (signed envelope, wallet enforcement). |
|
|
143
|
+
| `sdk.web` | Webpage extraction without an LLM through the web extractor proxy (1 mc / call). |
|
|
108
144
|
| `sdk.wallet` | Stripe Checkout sessions for credit-pack top-ups, balance helpers. |
|
|
109
145
|
| `sdk.ethos` | Ethos-zone composition / parsing — re-exported from `@aithos/protocol-client`. |
|
|
110
146
|
| `sdk.onboarding` | First-run identity / DID flows — re-exported. |
|
package/dist/src/compute.d.ts
CHANGED
|
@@ -192,119 +192,6 @@ export interface InvokeSegmentationResult {
|
|
|
192
192
|
readonly walletBalance: number;
|
|
193
193
|
readonly auditId: string;
|
|
194
194
|
}
|
|
195
|
-
/**
|
|
196
|
-
* Models accepted by `invokeUrlFetch`. These are the Anthropic-API-direct
|
|
197
|
-
* model aliases — the proxy resolves them to the canonical API model id
|
|
198
|
-
* (`claude-haiku-4-5-20251001`, etc.) at dispatch time.
|
|
199
|
-
*
|
|
200
|
-
* Bedrock's compute_invoke supports the same names but routes through
|
|
201
|
-
* Bedrock; url_fetch routes through `api.anthropic.com` directly because
|
|
202
|
-
* the `web_fetch` server-side tool isn't exposed via Bedrock.
|
|
203
|
-
*/
|
|
204
|
-
export type UrlFetchModelId = "claude-haiku-4-5" | "claude-sonnet-4-6" | "claude-opus-4-6";
|
|
205
|
-
export interface InvokeUrlFetchArgs {
|
|
206
|
-
/**
|
|
207
|
-
* Mandate ID under which this call should be attributed.
|
|
208
|
-
*
|
|
209
|
-
* - **Owner sessions**: optional. The owner's own DID is used as a
|
|
210
|
-
* sentinel "self" mandate id; the proxy skips all mandate checks
|
|
211
|
-
* for owner-signed envelopes.
|
|
212
|
-
* - **Delegate sessions**: required. Must reference an imported
|
|
213
|
-
* mandate bundle that carries the `compute.url_fetch` scope (NOT
|
|
214
|
-
* the same scope as `compute.invoke` — see the protocol spec).
|
|
215
|
-
*/
|
|
216
|
-
readonly mandateId?: string;
|
|
217
|
-
/**
|
|
218
|
-
* Anthropic model alias. Default `"claude-haiku-4-5"` — fastest and
|
|
219
|
-
* cheapest model that supports `web_fetch`. Bump to Sonnet 4.6 for
|
|
220
|
-
* deeper reasoning over the fetched content; Opus 4.6 for the
|
|
221
|
-
* heaviest analyses (priced accordingly via reconcile). Opus 4.7 is
|
|
222
|
-
* provisioned but commercially gated — see the docstring on
|
|
223
|
-
* InvokeBedrockArgs.model for the unlock path.
|
|
224
|
-
*/
|
|
225
|
-
readonly model?: UrlFetchModelId;
|
|
226
|
-
/**
|
|
227
|
-
* User prompt — should normally contain the URL(s) the caller wants
|
|
228
|
-
* the model to fetch and analyze. Example:
|
|
229
|
-
* "Voici l'URL https://tata.com — résume le service, identifie
|
|
230
|
-
* le style du site et la couleur primaire. Renvoie en JSON."
|
|
231
|
-
*/
|
|
232
|
-
readonly prompt: string;
|
|
233
|
-
/** Optional system prompt (Anthropic-style separate field). */
|
|
234
|
-
readonly system?: string;
|
|
235
|
-
/** Cap on output tokens. Default 2048. */
|
|
236
|
-
readonly maxTokens?: number;
|
|
237
|
-
/** Sampling temperature. Default model-dependent. */
|
|
238
|
-
readonly temperature?: number;
|
|
239
|
-
/**
|
|
240
|
-
* Maximum number of `web_fetch` invocations the model is allowed to
|
|
241
|
-
* make in this call. Default 5; range [1, 10].
|
|
242
|
-
*/
|
|
243
|
-
readonly maxFetches?: number;
|
|
244
|
-
/**
|
|
245
|
-
* Maximum tokens of fetched content Anthropic will inject per fetch.
|
|
246
|
-
* Default 100_000; range [1000, 200_000]. Pages larger than this
|
|
247
|
-
* are truncated server-side.
|
|
248
|
-
*/
|
|
249
|
-
readonly maxContentTokens?: number;
|
|
250
|
-
/**
|
|
251
|
-
* When `true` (default), the response carries citation spans tying
|
|
252
|
-
* generated text back to fetched documents — useful for displaying
|
|
253
|
-
* "selon X, …" footnotes in the UI without post-processing.
|
|
254
|
-
*/
|
|
255
|
-
readonly citations?: boolean;
|
|
256
|
-
/**
|
|
257
|
-
* Optional domain allowlist — if set, the model can only fetch from
|
|
258
|
-
* these domains. Mutually exclusive with `blockedDomains`.
|
|
259
|
-
*/
|
|
260
|
-
readonly allowedDomains?: readonly string[];
|
|
261
|
-
/**
|
|
262
|
-
* Optional domain blocklist. Mutually exclusive with `allowedDomains`.
|
|
263
|
-
*/
|
|
264
|
-
readonly blockedDomains?: readonly string[];
|
|
265
|
-
/** Idempotency key for retries (generated if omitted). */
|
|
266
|
-
readonly idempotencyKey?: string;
|
|
267
|
-
/** Abort signal to cancel the request. */
|
|
268
|
-
readonly signal?: AbortSignal;
|
|
269
|
-
}
|
|
270
|
-
/**
|
|
271
|
-
* Single citation projection — flattened from Anthropic's wire shape so
|
|
272
|
-
* consumers can render `{cited_text}` next to `{url}` without parsing
|
|
273
|
-
* vendor-specific block types.
|
|
274
|
-
*/
|
|
275
|
-
export interface UrlFetchCitation {
|
|
276
|
-
readonly url: string;
|
|
277
|
-
readonly citedText: string;
|
|
278
|
-
readonly documentTitle?: string;
|
|
279
|
-
readonly startCharIndex?: number;
|
|
280
|
-
readonly endCharIndex?: number;
|
|
281
|
-
}
|
|
282
|
-
/** Per-fetch metadata in the order the model performed the fetches. */
|
|
283
|
-
export interface UrlFetchMetadata {
|
|
284
|
-
readonly url: string;
|
|
285
|
-
readonly retrievedAt?: string;
|
|
286
|
-
readonly title?: string;
|
|
287
|
-
}
|
|
288
|
-
export interface InvokeUrlFetchResult {
|
|
289
|
-
/** Final assistant text — typically a JSON string when the prompt asked for structure. */
|
|
290
|
-
readonly content: string;
|
|
291
|
-
/** Citation spans (empty when `citations: false` or no fetches succeeded). */
|
|
292
|
-
readonly citations: readonly UrlFetchCitation[];
|
|
293
|
-
/** Per-URL fetch metadata. */
|
|
294
|
-
readonly urlsFetched: readonly UrlFetchMetadata[];
|
|
295
|
-
readonly stopReason: "end_turn" | "max_tokens" | "tool_use" | "stop_sequence" | "pause_turn" | "refusal";
|
|
296
|
-
readonly usage: {
|
|
297
|
-
readonly inputTokens: number;
|
|
298
|
-
readonly outputTokens: number;
|
|
299
|
-
readonly webFetchInvocations: number;
|
|
300
|
-
};
|
|
301
|
-
/** Microcredits charged after reconcile (already net of any refund). */
|
|
302
|
-
readonly creditsCharged: number;
|
|
303
|
-
/** Wallet balance after the debit + reconcile. */
|
|
304
|
-
readonly walletBalance: number;
|
|
305
|
-
/** Audit log id for traceability. */
|
|
306
|
-
readonly auditId: string;
|
|
307
|
-
}
|
|
308
195
|
export interface ComputeNamespaceDeps {
|
|
309
196
|
readonly auth: AithosAuth;
|
|
310
197
|
readonly appDid: string;
|
|
@@ -392,41 +279,5 @@ export declare class ComputeNamespace {
|
|
|
392
279
|
* Pricing: flat 5 000 mc per call (~$0.005 — Florence-2 is cheap).
|
|
393
280
|
*/
|
|
394
281
|
invokeSegmentation(args: InvokeSegmentationArgs): Promise<InvokeSegmentationResult>;
|
|
395
|
-
/**
|
|
396
|
-
* Fetch one or more URLs and have Claude analyze the content. Routes
|
|
397
|
-
* through `api.anthropic.com` with the `web_fetch` server-side tool —
|
|
398
|
-
* NOT through Bedrock — because Bedrock does not expose Anthropic's
|
|
399
|
-
* server-side tools (web_fetch, web_search, etc.). The proxy hides
|
|
400
|
-
* this multi-backend detail from the SDK consumer; the wallet,
|
|
401
|
-
* envelope, and mandate-scope contracts are unchanged.
|
|
402
|
-
*
|
|
403
|
-
* Typical use:
|
|
404
|
-
* ```ts
|
|
405
|
-
* const r = await sdk.compute.invokeUrlFetch({
|
|
406
|
-
* prompt: "Voici l'URL https://tata.com — résume le service, " +
|
|
407
|
-
* "identifie le style et la couleur primaire. JSON.",
|
|
408
|
-
* });
|
|
409
|
-
* console.log(r.content);
|
|
410
|
-
* for (const c of r.citations) console.log(c.url, "→", c.citedText);
|
|
411
|
-
* ```
|
|
412
|
-
*
|
|
413
|
-
* Mandate scope: requires `compute.url_fetch` (distinct from
|
|
414
|
-
* `compute.invoke` — see {@link InvokeUrlFetchArgs.mandateId}).
|
|
415
|
-
*
|
|
416
|
-
* Pricing: same Claude 4.x rates as Bedrock (Anthropic's direct API
|
|
417
|
-
* and Bedrock list prices are identical). Default Haiku 4.5 ≈
|
|
418
|
-
* $0.001/1k input + $0.005/1k output. The proxy pre-debits a
|
|
419
|
-
* conservative upper bound (`maxFetches × maxContentTokens × input
|
|
420
|
-
* rate + maxTokens × output rate`) and reconciles down to the actual
|
|
421
|
-
* usage Anthropic reports — so the wallet is always charged the
|
|
422
|
-
* exact post-call cost.
|
|
423
|
-
*
|
|
424
|
-
* @throws {AithosSDKError} on protocol errors. Notable codes:
|
|
425
|
-
* `sdk_no_signer`, `sdk_no_delegate_for_mandate`, `network`,
|
|
426
|
-
* `http`, `empty`, plus proxy codes `-32042` (mandate scope
|
|
427
|
-
* missing), `-32070`/`-32071` (wallet), `-32074` (fetch blocked
|
|
428
|
-
* by robots.txt / domain filter), `-32050` (rate limit).
|
|
429
|
-
*/
|
|
430
|
-
invokeUrlFetch(args: InvokeUrlFetchArgs): Promise<InvokeUrlFetchResult>;
|
|
431
282
|
}
|
|
432
283
|
//# sourceMappingURL=compute.d.ts.map
|
package/dist/src/compute.js
CHANGED
|
@@ -234,82 +234,6 @@ export class ComputeNamespace {
|
|
|
234
234
|
signal: args.signal,
|
|
235
235
|
});
|
|
236
236
|
}
|
|
237
|
-
/**
|
|
238
|
-
* Fetch one or more URLs and have Claude analyze the content. Routes
|
|
239
|
-
* through `api.anthropic.com` with the `web_fetch` server-side tool —
|
|
240
|
-
* NOT through Bedrock — because Bedrock does not expose Anthropic's
|
|
241
|
-
* server-side tools (web_fetch, web_search, etc.). The proxy hides
|
|
242
|
-
* this multi-backend detail from the SDK consumer; the wallet,
|
|
243
|
-
* envelope, and mandate-scope contracts are unchanged.
|
|
244
|
-
*
|
|
245
|
-
* Typical use:
|
|
246
|
-
* ```ts
|
|
247
|
-
* const r = await sdk.compute.invokeUrlFetch({
|
|
248
|
-
* prompt: "Voici l'URL https://tata.com — résume le service, " +
|
|
249
|
-
* "identifie le style et la couleur primaire. JSON.",
|
|
250
|
-
* });
|
|
251
|
-
* console.log(r.content);
|
|
252
|
-
* for (const c of r.citations) console.log(c.url, "→", c.citedText);
|
|
253
|
-
* ```
|
|
254
|
-
*
|
|
255
|
-
* Mandate scope: requires `compute.url_fetch` (distinct from
|
|
256
|
-
* `compute.invoke` — see {@link InvokeUrlFetchArgs.mandateId}).
|
|
257
|
-
*
|
|
258
|
-
* Pricing: same Claude 4.x rates as Bedrock (Anthropic's direct API
|
|
259
|
-
* and Bedrock list prices are identical). Default Haiku 4.5 ≈
|
|
260
|
-
* $0.001/1k input + $0.005/1k output. The proxy pre-debits a
|
|
261
|
-
* conservative upper bound (`maxFetches × maxContentTokens × input
|
|
262
|
-
* rate + maxTokens × output rate`) and reconciles down to the actual
|
|
263
|
-
* usage Anthropic reports — so the wallet is always charged the
|
|
264
|
-
* exact post-call cost.
|
|
265
|
-
*
|
|
266
|
-
* @throws {AithosSDKError} on protocol errors. Notable codes:
|
|
267
|
-
* `sdk_no_signer`, `sdk_no_delegate_for_mandate`, `network`,
|
|
268
|
-
* `http`, `empty`, plus proxy codes `-32042` (mandate scope
|
|
269
|
-
* missing), `-32070`/`-32071` (wallet), `-32074` (fetch blocked
|
|
270
|
-
* by robots.txt / domain filter), `-32050` (rate limit).
|
|
271
|
-
*/
|
|
272
|
-
async invokeUrlFetch(args) {
|
|
273
|
-
const { endpoints, fetch: fetchImpl } = this.#deps;
|
|
274
|
-
const choice = this.#resolveSigner(args.mandateId);
|
|
275
|
-
const url = computeInvokeUrl(endpoints);
|
|
276
|
-
const idempotencyKey = args.idempotencyKey ?? generateIdempotencyKey();
|
|
277
|
-
const model = args.model ?? "claude-haiku-4-5";
|
|
278
|
-
const params = {
|
|
279
|
-
app_did: this.#deps.appDid,
|
|
280
|
-
mandate_id: this.#resolveMandateIdForWire(args.mandateId, choice),
|
|
281
|
-
model,
|
|
282
|
-
prompt: args.prompt,
|
|
283
|
-
idempotency_key: idempotencyKey,
|
|
284
|
-
};
|
|
285
|
-
if (args.system !== undefined)
|
|
286
|
-
params.system = args.system;
|
|
287
|
-
if (args.maxTokens !== undefined)
|
|
288
|
-
params.max_tokens = args.maxTokens;
|
|
289
|
-
if (args.temperature !== undefined)
|
|
290
|
-
params.temperature = args.temperature;
|
|
291
|
-
if (args.maxFetches !== undefined)
|
|
292
|
-
params.max_fetches = args.maxFetches;
|
|
293
|
-
if (args.maxContentTokens !== undefined) {
|
|
294
|
-
params.max_content_tokens = args.maxContentTokens;
|
|
295
|
-
}
|
|
296
|
-
if (args.citations !== undefined)
|
|
297
|
-
params.citations = args.citations;
|
|
298
|
-
if (args.allowedDomains !== undefined && args.allowedDomains.length > 0) {
|
|
299
|
-
params.allowed_domains = args.allowedDomains;
|
|
300
|
-
}
|
|
301
|
-
if (args.blockedDomains !== undefined && args.blockedDomains.length > 0) {
|
|
302
|
-
params.blocked_domains = args.blockedDomains;
|
|
303
|
-
}
|
|
304
|
-
return await this.#signAndPost({
|
|
305
|
-
url,
|
|
306
|
-
method: "aithos.compute_invoke_url_fetch",
|
|
307
|
-
params,
|
|
308
|
-
choice,
|
|
309
|
-
fetchImpl,
|
|
310
|
-
signal: args.signal,
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
237
|
/**
|
|
314
238
|
* Resolve the active signer (owner takes precedence over delegate).
|
|
315
239
|
*
|
package/dist/src/endpoints.d.ts
CHANGED
|
@@ -10,11 +10,20 @@ export interface AithosSdkEndpoints {
|
|
|
10
10
|
* suffixes a fixed path to it.
|
|
11
11
|
*/
|
|
12
12
|
readonly wallet: string;
|
|
13
|
+
/**
|
|
14
|
+
* Web extractor proxy base URL — `aithos.web_extract`. Default
|
|
15
|
+
* `https://extract.aithos.be`. Same JSON-RPC + signed-envelope shape
|
|
16
|
+
* as the compute proxy, distinct audience so a mandate can hold one
|
|
17
|
+
* scope without the other.
|
|
18
|
+
*/
|
|
19
|
+
readonly web: string;
|
|
13
20
|
}
|
|
14
21
|
/** Production defaults. */
|
|
15
22
|
export declare const DEFAULT_SDK_ENDPOINTS: AithosSdkEndpoints;
|
|
16
23
|
/** Compose the full compute-invoke URL: `${compute}/v1/invoke`. */
|
|
17
24
|
export declare function computeInvokeUrl(endpoints: AithosSdkEndpoints): string;
|
|
25
|
+
/** Compose the full web-extract URL: `${web}/v1/invoke`. */
|
|
26
|
+
export declare function webInvokeUrl(endpoints: AithosSdkEndpoints): string;
|
|
18
27
|
/** Compose the full top-up-checkout URL: `${wallet}/v1/wallet/topup/checkout`. */
|
|
19
28
|
export declare function walletTopupCheckoutUrl(endpoints: AithosSdkEndpoints): string;
|
|
20
29
|
/**
|
package/dist/src/endpoints.js
CHANGED
|
@@ -4,11 +4,16 @@
|
|
|
4
4
|
export const DEFAULT_SDK_ENDPOINTS = {
|
|
5
5
|
compute: "https://compute.aithos.be",
|
|
6
6
|
wallet: "https://wallet.aithos.be",
|
|
7
|
+
web: "https://extract.aithos.be",
|
|
7
8
|
};
|
|
8
9
|
/** Compose the full compute-invoke URL: `${compute}/v1/invoke`. */
|
|
9
10
|
export function computeInvokeUrl(endpoints) {
|
|
10
11
|
return `${trimSlash(endpoints.compute)}/v1/invoke`;
|
|
11
12
|
}
|
|
13
|
+
/** Compose the full web-extract URL: `${web}/v1/invoke`. */
|
|
14
|
+
export function webInvokeUrl(endpoints) {
|
|
15
|
+
return `${trimSlash(endpoints.web)}/v1/invoke`;
|
|
16
|
+
}
|
|
12
17
|
/** Compose the full top-up-checkout URL: `${wallet}/v1/wallet/topup/checkout`. */
|
|
13
18
|
export function walletTopupCheckoutUrl(endpoints) {
|
|
14
19
|
return `${trimSlash(endpoints.wallet)}/v1/wallet/topup/checkout`;
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,14 +1,16 @@
|
|
|
1
|
-
export declare const VERSION = "0.1.0-alpha.
|
|
1
|
+
export declare const VERSION = "0.1.0-alpha.23";
|
|
2
2
|
export { AithosSDK } from "./sdk.js";
|
|
3
3
|
export type { AithosSDKConfig } from "./types.js";
|
|
4
4
|
export { AithosSDKError } from "./types.js";
|
|
5
5
|
export { AithosRpcError } from "@aithos/protocol-client";
|
|
6
6
|
export type { AithosSdkEndpoints } from "./endpoints.js";
|
|
7
7
|
export { DEFAULT_SDK_ENDPOINTS } from "./endpoints.js";
|
|
8
|
-
export type { ComputeMessage, ImageAspectRatio, ImageModelId, InvokeBedrockArgs, InvokeBedrockResult, InvokeBedrockVisionArgs, InvokeBedrockVisionResult, InvokeImageArgs, InvokeImageImage, InvokeImageResult, InvokeSegmentationArgs, InvokeSegmentationResult,
|
|
8
|
+
export type { ComputeMessage, ImageAspectRatio, ImageModelId, InvokeBedrockArgs, InvokeBedrockResult, InvokeBedrockVisionArgs, InvokeBedrockVisionResult, InvokeImageArgs, InvokeImageImage, InvokeImageResult, InvokeSegmentationArgs, InvokeSegmentationResult, SegmentPolygon, StopReason, } from "./compute.js";
|
|
9
9
|
export { ComputeNamespace } from "./compute.js";
|
|
10
10
|
export type { CreditPackId, CreateTopupSessionArgs, CreateTopupSessionResult, GetBalanceArgs, GetBalanceResult, } from "./wallet.js";
|
|
11
11
|
export { WalletNamespace } from "./wallet.js";
|
|
12
|
+
export type { ComponentStyle, ExtractArgs, ExtractContent, ExtractData, ExtractForm, ExtractFormField, ExtractHeading, ExtractIconDeclaration, ExtractImage, ExtractLink, ExtractLogo, ExtractMeta, ExtractResult, ExtractSection, ExtractStructure, ExtractStyles, FetchAssetArgs, FetchAssetResult, PaletteEntry, VisualSignature, WebNamespaceDeps, } from "./web.js";
|
|
13
|
+
export { WebNamespace, WEB_EXTRACT_SCOPE } from "./web.js";
|
|
12
14
|
export { AithosAuth, DEFAULT_API_BASE_URL, DEFAULT_AUTH_BASE_URL, } from "./auth.js";
|
|
13
15
|
export type { AithosAuthConfig, AithosSession, CompleteSsoFirstLoginInput, CompleteSsoFirstLoginResult, DelegateInfo, ImportMandateInput, OwnerInfo, SignInInput, SignInWithGoogleOptions, SignInWithRecoveryInput, SignUpInput, SignUpResult, } from "./auth.js";
|
|
14
16
|
export { DEFAULT_SESSION_STORAGE_KEY, defaultSessionStore, localStorageStore, noopStore, sessionStorageStore, type AithosSessionStore, } from "./session-store.js";
|
package/dist/src/index.js
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
// Public types specific to the SDK (`AithosSDKConfig`, `AithosSDKError`)
|
|
18
18
|
// are exported from here. Endpoint config (`AithosSdkEndpoints`,
|
|
19
19
|
// `DEFAULT_SDK_ENDPOINTS`) likewise.
|
|
20
|
-
export const VERSION = "0.1.0-alpha.
|
|
20
|
+
export const VERSION = "0.1.0-alpha.23";
|
|
21
21
|
export { AithosSDK } from "./sdk.js";
|
|
22
22
|
export { AithosSDKError } from "./types.js";
|
|
23
23
|
// Re-export protocol-client's JSON-RPC error type so consumers can
|
|
@@ -27,6 +27,7 @@ export { AithosRpcError } from "@aithos/protocol-client";
|
|
|
27
27
|
export { DEFAULT_SDK_ENDPOINTS } from "./endpoints.js";
|
|
28
28
|
export { ComputeNamespace } from "./compute.js";
|
|
29
29
|
export { WalletNamespace } from "./wallet.js";
|
|
30
|
+
export { WebNamespace, WEB_EXTRACT_SCOPE } from "./web.js";
|
|
30
31
|
// Sign-up, sign-in, sign-in-with-Google. Lives outside the AithosSDK
|
|
31
32
|
// class because the auth flow runs *before* the user has a
|
|
32
33
|
// BrowserIdentity (sign-up creates one, sign-in restores it from the
|
package/dist/src/sdk.d.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { type AithosSdkEndpoints } from "./endpoints.js";
|
|
|
4
4
|
import { EthosNamespace } from "./ethos.js";
|
|
5
5
|
import { MandatesNamespace } from "./mandates.js";
|
|
6
6
|
import { WalletNamespace } from "./wallet.js";
|
|
7
|
+
import { WebNamespace } from "./web.js";
|
|
7
8
|
export interface AithosSDKConfig {
|
|
8
9
|
/**
|
|
9
10
|
* The {@link AithosAuth} instance the SDK reads sign-in state from.
|
|
@@ -44,6 +45,8 @@ export declare class AithosSDK {
|
|
|
44
45
|
readonly ethos: EthosNamespace;
|
|
45
46
|
/** Mandate lifecycle namespace — create / list / revoke. */
|
|
46
47
|
readonly mandates: MandatesNamespace;
|
|
48
|
+
/** Web extraction namespace — aithos.web_extract through the web extractor proxy. */
|
|
49
|
+
readonly web: WebNamespace;
|
|
47
50
|
constructor(config: AithosSDKConfig);
|
|
48
51
|
/** DID of the currently signed-in owner, or null if no owner is loaded. */
|
|
49
52
|
get userDid(): string | null;
|
package/dist/src/sdk.js
CHANGED
|
@@ -5,6 +5,7 @@ import { resolveEndpoints } from "./endpoints.js";
|
|
|
5
5
|
import { EthosNamespace } from "./ethos.js";
|
|
6
6
|
import { MandatesNamespace } from "./mandates.js";
|
|
7
7
|
import { WalletNamespace } from "./wallet.js";
|
|
8
|
+
import { WebNamespace } from "./web.js";
|
|
8
9
|
export class AithosSDK {
|
|
9
10
|
/** Resolved endpoint configuration (defaults + caller overrides). */
|
|
10
11
|
endpoints;
|
|
@@ -20,6 +21,8 @@ export class AithosSDK {
|
|
|
20
21
|
ethos;
|
|
21
22
|
/** Mandate lifecycle namespace — create / list / revoke. */
|
|
22
23
|
mandates;
|
|
24
|
+
/** Web extraction namespace — aithos.web_extract through the web extractor proxy. */
|
|
25
|
+
web;
|
|
23
26
|
constructor(config) {
|
|
24
27
|
if (!config.auth) {
|
|
25
28
|
throw new TypeError("AithosSDK: config.auth is required");
|
|
@@ -53,6 +56,12 @@ export class AithosSDK {
|
|
|
53
56
|
endpoints: this.endpoints,
|
|
54
57
|
fetch: fetchImpl,
|
|
55
58
|
});
|
|
59
|
+
this.web = new WebNamespace({
|
|
60
|
+
auth: config.auth,
|
|
61
|
+
appDid: config.appDid,
|
|
62
|
+
endpoints: this.endpoints,
|
|
63
|
+
fetch: fetchImpl,
|
|
64
|
+
});
|
|
56
65
|
}
|
|
57
66
|
/** DID of the currently signed-in owner, or null if no owner is loaded. */
|
|
58
67
|
get userDid() {
|