@weftlabs/sdk 0.31.0 → 0.32.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.
- package/dist/facilitator/middleware/index.js +1 -1
- package/dist/facilitator/middleware/index.js.map +1 -1
- package/dist/facilitator/middleware/index.mjs +1 -1
- package/dist/facilitator/middleware/index.mjs.map +1 -1
- package/dist/index.d.mts +808 -156
- package/dist/index.d.ts +808 -156
- package/dist/index.js +495 -45
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +495 -45
- package/dist/index.mjs.map +1 -1
- package/dist/server.js +1 -1
- package/dist/server.js.map +1 -1
- package/dist/server.mjs +1 -1
- package/dist/server.mjs.map +1 -1
- package/docs/FetchApi.md +1 -1
- package/docs/FetchResponse.md +3 -1
- package/docs/GetPurchaseIdParameter.md +30 -0
- package/docs/Purchase.md +2 -0
- package/docs/PurchasesApi.md +3 -3
- package/docs/SearchApi.md +2 -2
- package/docs/SearchCompactAccess.md +39 -0
- package/docs/SearchCompactAccessPrice.md +38 -0
- package/docs/SearchCompactNextCall.md +39 -0
- package/docs/SearchCompactResult.md +63 -0
- package/docs/SearchCompactResultAttribution.md +37 -0
- package/docs/SearchCompactResultBlockedScopesInner.md +34 -0
- package/docs/SearchCompactResultOperation.md +36 -0
- package/docs/SearchCompactResultProvider.md +34 -0
- package/docs/SearchRequest.md +2 -0
- package/docs/SearchResponse.md +6 -0
- package/docs/SearchWeftFetchCompatibility.md +2 -0
- package/package.json +13 -11
package/docs/FetchApi.md
CHANGED
|
@@ -14,7 +14,7 @@ All URIs are relative to *https://weft.network*
|
|
|
14
14
|
|
|
15
15
|
Pay-and-fetch any URL (x402/MPP proxy)
|
|
16
16
|
|
|
17
|
-
Universal x402/MPP fetch proxy. The caller provides a target `url`, a merchant-principal `max_cost_usd` ceiling, and optional `method` / `body` / `headers`. Weft: 1. Issues the request. 2. On `402 Payment Required`, selects a supported x402 or MPP challenge. 3. Compares the asking price to `max_cost_usd` and the buyer\'s policy (`max_tx_usd`, daily/weekly limits). 4. If refill is allowed and an eligible mainnet MPP challenge finds its Tempo token short, creates or adopts a buyer-owned Base-to-Tempo refill and returns `409 FUNDING_PENDING` with `details.reason=funding_active`. If an overlapping payment invalidates the balance observation before a bridge is created, the same retryable response carries `details.reason=balance_changed`. The caller retries the identical fetch after `details.retry_after_seconds`; that later request obtains a fresh challenge and reruns rail selection and all payment controls. 5. Authorizes payment from the buyer\'s wallet on the selected rail. 6. Replays the request with the protocol-specific payment credential. 7. Streams the upstream artifact back, base64-encoded under `body_base64`, with `paid_usd`, `held_usd`, `payment_status`, `tx_hash`, and `
|
|
17
|
+
Universal x402/MPP fetch proxy. The caller provides a target `url`, a merchant-principal `max_cost_usd` ceiling, and optional `method` / `body` / `headers`. Weft: 1. Issues the request. 2. On `402 Payment Required`, selects a supported x402 or MPP challenge. 3. Compares the asking price to `max_cost_usd` and the buyer\'s policy (`max_tx_usd`, daily/weekly limits). 4. If refill is allowed and an eligible mainnet MPP challenge finds its Tempo token short, creates or adopts a buyer-owned Base-to-Tempo refill and returns `409 FUNDING_PENDING` with `details.reason=funding_active`. If an overlapping payment invalidates the balance observation before a bridge is created, the same retryable response carries `details.reason=balance_changed`. The caller retries the identical fetch after `details.retry_after_seconds`; that later request obtains a fresh challenge and reruns rail selection and all payment controls. 5. Authorizes payment from the buyer\'s wallet on the selected rail. 6. Replays the request with the protocol-specific payment credential. 7. Streams the upstream artifact back, base64-encoded under `body_base64`, with `paid_usd`, `held_usd`, `payment_status`, `tx_hash`, `protocol`, and `purchase_id`. `paid_usd` is \"0.00\" until the charge is CONFIRMED settled — a signed-but- unsettled hold (the common case for x402, which settles asynchronously) reports its amount in `held_usd` instead, never in `paid_usd`. `purchase_id` is the id that `GET /api/v1/purchases/{id}` accepts, so a caller can read how a pending charge ends. **Opt-in safety controls:** `allow_tempo_refill: false` prevents this request from creating, adopting, or enqueueing a Base-to-Tempo bridge. A Tempo shortfall returns `402 INSUFFICIENT_BALANCE`; unrelated bridges and their jobs remain unchanged. `access_method_id` is advisory and does not enforce a payment rail. `max_total_cost_usd` is an all-in ceiling covering merchant principal, network gas, provider fees, and prerequisite buyer-paid operations. It disables refill; explicitly combining it with `allow_tempo_refill: true` returns `422 INCOMPATIBLE_FETCH_CONTROLS`. Current wallet integrations provide no supported binding all-in fee guarantee. Therefore all-in requests return `402 TOTAL_COST_UNVERIFIABLE` before payment preparation, approval, reservation, or refill. This also refuses recovery of older payments and SIWX wallet signing; it admits no positive paid route. Increasing the ceiling does not resolve missing fee authority. Omitted controls preserve existing behavior. Ordinary non-402 merchant responses retain `MERCHANT_RETURNED_NON_402`. Stored-result replay is historical payment information, not a new bounded authorization. Errors are structured with a stable `error` code, and each error response carries the buyer\'s `policy`, `balance`, and a `dashboard_url` so a CLI can render an actionable message without a second round-trip. Account-scoped: the bearer must be a buyer-scoped API key, an OAuth access token carrying `fetch`, or a claimed `wbt_*` bearer. **Forwarded headers:** the caller\'s `headers` are passed through to the upstream, except a denylist of hop-by-hop and Weft-internal headers (`host`, `authorization`, `cookie`, `proxy-authorization`, `x-forwarded-*`, `x-real-ip`, `x-payment`, `connection`, `upgrade`). Up to 32 headers, 4 KB of combined value bytes.
|
|
18
18
|
|
|
19
19
|
### Example
|
|
20
20
|
|
package/docs/FetchResponse.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
|
|
2
2
|
# FetchResponse
|
|
3
3
|
|
|
4
|
-
Successful fetch envelope. `body_base64` is the upstream artifact bytes, base64-encoded. `paid_usd`, `held_usd`, `payment_status`, `tx_hash`, and `protocol` describe the payment and settlement state. To retrieve a SIWX-protected result, use HTTPS GET with `max_cost_usd: \"0\"`. Weft signs a fresh, resource-bound challenge with the same buyer wallet. Retrieval never falls back to payment and returns `not_required`, zero paid amount, and null held amount and transaction hash. Polls are fresh, including with repeated idempotency keys. A rejected or unsafe challenge returns `SIWX_RETRIEVAL_FAILED`. Providers must support smart-wallet signatures. Auth-only challenges also use this path; positive-budget purchases retain payment behavior. `paid_usd` is \"0.00\" (never the nominal charge amount) until the charge is CONFIRMED settled on-chain — a signed-but-unsettled hold reports its amount in `held_usd` instead. This is a deliberate honesty fix: earlier versions of this endpoint returned the nominal amount in `paid_usd` unconditionally, even when the charge never settled. **Money string format.** Every USD amount on this surface is exact to the micro-dollar and never narrower than two decimals: a whole-cent amount renders \"0.50\", a sub-cent amount keeps its real precision (\"0.000892\"), and zero renders \"0.00\". Amounts are never rounded — an agent reconciling its own spend reads the truth, not a display value. Parse these as decimals; do NOT compare them as strings against a bare zero literal.
|
|
4
|
+
Successful fetch envelope. `body_base64` is the upstream artifact bytes, base64-encoded. `paid_usd`, `held_usd`, `payment_status`, `tx_hash`, and `protocol` describe the payment and settlement state. `purchase_id` names the payment for a later status read. To retrieve a SIWX-protected result, use HTTPS GET with `max_cost_usd: \"0\"`. Weft signs a fresh, resource-bound challenge with the same buyer wallet. Retrieval never falls back to payment and returns `not_required`, zero paid amount, and null held amount and transaction hash. Polls are fresh, including with repeated idempotency keys. A rejected or unsafe challenge returns `SIWX_RETRIEVAL_FAILED`. Providers must support smart-wallet signatures. Auth-only challenges also use this path; positive-budget purchases retain payment behavior. `paid_usd` is \"0.00\" (never the nominal charge amount) until the charge is CONFIRMED settled on-chain — a signed-but-unsettled hold reports its amount in `held_usd` instead. This is a deliberate honesty fix: earlier versions of this endpoint returned the nominal amount in `paid_usd` unconditionally, even when the charge never settled. **Money string format.** Every USD amount on this surface is exact to the micro-dollar and never narrower than two decimals: a whole-cent amount renders \"0.50\", a sub-cent amount keeps its real precision (\"0.000892\"), and zero renders \"0.00\". Amounts are never rounded — an agent reconciling its own spend reads the truth, not a display value. Parse these as decimals; do NOT compare them as strings against a bare zero literal.
|
|
5
5
|
|
|
6
6
|
## Properties
|
|
7
7
|
|
|
@@ -16,6 +16,7 @@ Name | Type
|
|
|
16
16
|
`txHash` | string
|
|
17
17
|
`protocol` | string
|
|
18
18
|
`artifactId` | number
|
|
19
|
+
`purchaseId` | string
|
|
19
20
|
|
|
20
21
|
## Example
|
|
21
22
|
|
|
@@ -33,6 +34,7 @@ const example = {
|
|
|
33
34
|
"txHash": null,
|
|
34
35
|
"protocol": null,
|
|
35
36
|
"artifactId": null,
|
|
37
|
+
"purchaseId": pur_4V3n9mQ0b7XyK2sLpR8tWc1d,
|
|
36
38
|
} satisfies FetchResponse
|
|
37
39
|
|
|
38
40
|
console.log(example)
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
|
|
2
|
+
# GetPurchaseIdParameter
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
|
|
10
|
+
## Example
|
|
11
|
+
|
|
12
|
+
```typescript
|
|
13
|
+
import type { GetPurchaseIdParameter } from '@weftlabs/sdk'
|
|
14
|
+
|
|
15
|
+
// TODO: Update the object below with actual values
|
|
16
|
+
const example = {
|
|
17
|
+
} satisfies GetPurchaseIdParameter
|
|
18
|
+
|
|
19
|
+
console.log(example)
|
|
20
|
+
|
|
21
|
+
// Convert the instance to a JSON string
|
|
22
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
23
|
+
console.log(exampleJSON)
|
|
24
|
+
|
|
25
|
+
// Parse the JSON string back to an object
|
|
26
|
+
const exampleParsed = JSON.parse(exampleJSON) as GetPurchaseIdParameter
|
|
27
|
+
console.log(exampleParsed)
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
package/docs/Purchase.md
CHANGED
|
@@ -7,6 +7,7 @@
|
|
|
7
7
|
Name | Type
|
|
8
8
|
------------ | -------------
|
|
9
9
|
`id` | number
|
|
10
|
+
`purchaseId` | string
|
|
10
11
|
`status` | string
|
|
11
12
|
`amountUsd` | string
|
|
12
13
|
`recipientAddress` | string
|
|
@@ -31,6 +32,7 @@ import type { Purchase } from '@weftlabs/sdk'
|
|
|
31
32
|
// TODO: Update the object below with actual values
|
|
32
33
|
const example = {
|
|
33
34
|
"id": null,
|
|
35
|
+
"purchaseId": pur_4V3n9mQ0b7XyK2sLpR8tWc1d,
|
|
34
36
|
"status": null,
|
|
35
37
|
"amountUsd": null,
|
|
36
38
|
"recipientAddress": null,
|
package/docs/PurchasesApi.md
CHANGED
|
@@ -33,8 +33,8 @@ async function example() {
|
|
|
33
33
|
const api = new PurchasesApi(config);
|
|
34
34
|
|
|
35
35
|
const body = {
|
|
36
|
-
//
|
|
37
|
-
id:
|
|
36
|
+
// GetPurchaseIdParameter | The opaque `purchase_id` (`pur_…`) that fetch returns, or the legacy integer `id`. Both resolve only within the caller\'s own purchases. New callers should store and send `purchase_id`.
|
|
37
|
+
id: ...,
|
|
38
38
|
} satisfies GetPurchaseRequest;
|
|
39
39
|
|
|
40
40
|
try {
|
|
@@ -54,7 +54,7 @@ example().catch(console.error);
|
|
|
54
54
|
|
|
55
55
|
| Name | Type | Description | Notes |
|
|
56
56
|
|------------- | ------------- | ------------- | -------------|
|
|
57
|
-
| **id** |
|
|
57
|
+
| **id** | [](.md) | The opaque `purchase_id` (`pur_…`) that fetch returns, or the legacy integer `id`. Both resolve only within the caller\'s own purchases. New callers should store and send `purchase_id`. | [Defaults to `undefined`] |
|
|
58
58
|
|
|
59
59
|
### Return type
|
|
60
60
|
|
package/docs/SearchApi.md
CHANGED
|
@@ -14,7 +14,7 @@ All URIs are relative to *https://weft.network*
|
|
|
14
14
|
|
|
15
15
|
Search the Weft index
|
|
16
16
|
|
|
17
|
-
Semantic search over the Weft index of paid agent resources. The request body is the weft-search-platform `/v1/search` contract: a free-text `query`, optional `max_results`, and optional structured `filters` (price / price_atomic / type / protocol — the canonical FilterSpec v1 vocabulary, vendored verbatim from the platform). Price is a dual representation of one constraint: `price` in USD decimal strings (the reasoning form) XOR `price_atomic` in integer micro-USD (the settlement form) — mutually exclusive, set at most one. Account-scoped: the bearer token must be a buyer-scoped API key, an OAuth token carrying `search`, or a pending or claimed `wbt_*` bootstrap bearer. Pending bootstrap access uses an anonymous bootstrap identity; after claim, the promoted bearer uses its bound User. Rejection, cancellation, expiry, and revocation end bootstrap search. Bootstrap search is limited to 60 requests per credential and 120 per IP each hour before native credential promotion. Response negotiation: `Accept: application/json` (default) returns the structured envelope; `Accept: text/markdown` returns a rendered Markdown digest of the same results — useful for piping into a chat UI or LLM prompt.
|
|
17
|
+
Semantic search over the Weft index of paid agent resources. The request body is the weft-search-platform `/v1/search` contract: a free-text `query`, optional `max_results`, and optional structured `filters` (price / price_atomic / type / protocol — the canonical FilterSpec v1 vocabulary, vendored verbatim from the platform). Price is a dual representation of one constraint: `price` in USD decimal strings (the reasoning form) XOR `price_atomic` in integer micro-USD (the settlement form) — mutually exclusive, set at most one. Account-scoped: the bearer token must be a buyer-scoped API key, an OAuth token carrying `search`, or a pending or claimed `wbt_*` bootstrap bearer. Pending bootstrap access uses an anonymous bootstrap identity; after claim, the promoted bearer uses its bound User. Rejection, cancellation, expiry, and revocation end bootstrap search. Bootstrap search is limited to 60 requests per credential and 120 per IP each hour before native credential promotion. Response negotiation: `Accept: application/json` (default) returns the structured envelope; `Accept: text/markdown` returns a rendered Markdown digest of the same results — useful for piping into a chat UI or LLM prompt. Compact view: send `view: \"compact\"` to get the agent view of the hosted MCP `weft_search` tool. Each result is a small contract for the next paid call (below 2,000 JSON bytes): typed inputs, the request recipe, one access method with price, attribution, a ready `next_call` to `POST /api/v1/fetch` when the request is determined, and the authenticated `contract_url` for the full contract. Use it when you give search results to a model. The compact rows are in `compact_results`; `results` is empty. The compact view is JSON only and needs the curated search backend.
|
|
18
18
|
|
|
19
19
|
### Example
|
|
20
20
|
|
|
@@ -78,7 +78,7 @@ example().catch(console.error);
|
|
|
78
78
|
| **401** | Unauthorized — missing or non-buyer-scoped API key | - |
|
|
79
79
|
| **403** | The OAuth access token authenticated but lacks the `search` scope (RFC 6750 `insufficient_scope`). Carries a `WWW-Authenticate: Bearer error=\"insufficient_scope\", scope=\"search\"` header. `wk_` API keys are unscoped and never see this. | - |
|
|
80
80
|
| **406** | The requested response format is not JSON or Markdown. | - |
|
|
81
|
-
| **422** | Invalid request — empty/missing `query`, out-of-range `max_results`, an unknown top-level parameter,
|
|
81
|
+
| **422** | Invalid request — empty/missing `query`, out-of-range `max_results`, an unknown top-level parameter, invalid `filters` (unknown filter key/operator, bad enum value, or a sub-filter without exactly one operator), or an invalid `view` (unknown value, `Accept: text/markdown`, or a backend without the compact view). See the `error` code. | - |
|
|
82
82
|
| **429** | Bootstrap search rate limit exceeded | - |
|
|
83
83
|
| **502** | Search service unavailable | - |
|
|
84
84
|
| **500** | Internal server error | - |
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
# SearchCompactAccess
|
|
3
|
+
|
|
4
|
+
The recommended access method for this operation.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`id` | string
|
|
11
|
+
`protocol` | string
|
|
12
|
+
`weftFetch` | { [key: string]: any; }
|
|
13
|
+
`price` | [SearchCompactAccessPrice](SearchCompactAccessPrice.md)
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { SearchCompactAccess } from '@weftlabs/sdk'
|
|
19
|
+
|
|
20
|
+
// TODO: Update the object below with actual values
|
|
21
|
+
const example = {
|
|
22
|
+
"id": null,
|
|
23
|
+
"protocol": null,
|
|
24
|
+
"weftFetch": null,
|
|
25
|
+
"price": null,
|
|
26
|
+
} satisfies SearchCompactAccess
|
|
27
|
+
|
|
28
|
+
console.log(example)
|
|
29
|
+
|
|
30
|
+
// Convert the instance to a JSON string
|
|
31
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
32
|
+
console.log(exampleJSON)
|
|
33
|
+
|
|
34
|
+
// Parse the JSON string back to an object
|
|
35
|
+
const exampleParsed = JSON.parse(exampleJSON) as SearchCompactAccess
|
|
36
|
+
console.log(exampleParsed)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
|
|
2
|
+
# SearchCompactAccessPrice
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`kind` | string
|
|
10
|
+
`indexedUsd` | string
|
|
11
|
+
`unit` | string
|
|
12
|
+
`hint` | string
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { SearchCompactAccessPrice } from '@weftlabs/sdk'
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"kind": null,
|
|
22
|
+
"indexedUsd": null,
|
|
23
|
+
"unit": null,
|
|
24
|
+
"hint": null,
|
|
25
|
+
} satisfies SearchCompactAccessPrice
|
|
26
|
+
|
|
27
|
+
console.log(example)
|
|
28
|
+
|
|
29
|
+
// Convert the instance to a JSON string
|
|
30
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
31
|
+
console.log(exampleJSON)
|
|
32
|
+
|
|
33
|
+
// Parse the JSON string back to an object
|
|
34
|
+
const exampleParsed = JSON.parse(exampleJSON) as SearchCompactAccessPrice
|
|
35
|
+
console.log(exampleParsed)
|
|
36
|
+
```
|
|
37
|
+
|
|
38
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
# SearchCompactNextCall
|
|
3
|
+
|
|
4
|
+
A ready paid call, present when the request is determined and the Weft fetch runtime can pay the access method. Replace each `{name}` listed in `fill` in `body` (and add `max_cost_usd` or `body` when they are listed), then send `body` as the JSON body of `POST /api/v1/fetch` with an `Idempotency-Key` header. `body` uses the wire field names (`max_cost_usd`, `search_id`); an SDK fetch call may name them differently, so map each field and keep the attribution fields.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`method` | string
|
|
11
|
+
`path` | string
|
|
12
|
+
`body` | { [key: string]: any; }
|
|
13
|
+
`fill` | Array<string>
|
|
14
|
+
|
|
15
|
+
## Example
|
|
16
|
+
|
|
17
|
+
```typescript
|
|
18
|
+
import type { SearchCompactNextCall } from '@weftlabs/sdk'
|
|
19
|
+
|
|
20
|
+
// TODO: Update the object below with actual values
|
|
21
|
+
const example = {
|
|
22
|
+
"method": null,
|
|
23
|
+
"path": null,
|
|
24
|
+
"body": null,
|
|
25
|
+
"fill": null,
|
|
26
|
+
} satisfies SearchCompactNextCall
|
|
27
|
+
|
|
28
|
+
console.log(example)
|
|
29
|
+
|
|
30
|
+
// Convert the instance to a JSON string
|
|
31
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
32
|
+
console.log(exampleJSON)
|
|
33
|
+
|
|
34
|
+
// Parse the JSON string back to an object
|
|
35
|
+
const exampleParsed = JSON.parse(exampleJSON) as SearchCompactNextCall
|
|
36
|
+
console.log(exampleParsed)
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
|
|
2
|
+
# SearchCompactResult
|
|
3
|
+
|
|
4
|
+
One row of the compact agent view: the minimum contract for the next paid call, below 2,000 JSON bytes. It is the hosted MCP `weft_search` projection with REST references: `contract_url` replaces the MCP `weft_contract` call, and `next_call` is a `POST /api/v1/fetch` request instead of an MCP `weft_fetch` call. To stay in the budget, the row drops optional fields in a fixed order (optional inputs, helper docs, the example, the description, then summaries) and `contract_detail` says what is left out. In the last resort the row keeps the operation id, readiness states, the `weft_fetch` state, `contract_url` and the search id, and can lose the input names, the request recipe and price. The full contract at `contract_url` is always complete. The search id is the envelope `query_trace_id`; each row also carries it in `attribution` or in `next_call.body`.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`provider` | [SearchCompactResultProvider](SearchCompactResultProvider.md)
|
|
11
|
+
`operation` | [SearchCompactResultOperation](SearchCompactResultOperation.md)
|
|
12
|
+
`inputs` | { [key: string]: any; }
|
|
13
|
+
`request` | { [key: string]: any; }
|
|
14
|
+
`example` | any
|
|
15
|
+
`access` | [SearchCompactAccess](SearchCompactAccess.md)
|
|
16
|
+
`attribution` | [SearchCompactResultAttribution](SearchCompactResultAttribution.md)
|
|
17
|
+
`output` | { [key: string]: any; }
|
|
18
|
+
`docs` | [SearchHelperDocs](SearchHelperDocs.md)
|
|
19
|
+
`contractUrl` | string
|
|
20
|
+
`contractDetail` | string
|
|
21
|
+
`completion` | string
|
|
22
|
+
`blockedScopes` | [Array<SearchCompactResultBlockedScopesInner>](SearchCompactResultBlockedScopesInner.md)
|
|
23
|
+
`contractGaps` | Array<string>
|
|
24
|
+
`readiness` | [{ [key: string]: SearchCompactResultBlockedScopesInner; }](SearchCompactResultBlockedScopesInner.md)
|
|
25
|
+
`nextCall` | [SearchCompactNextCall](SearchCompactNextCall.md)
|
|
26
|
+
|
|
27
|
+
## Example
|
|
28
|
+
|
|
29
|
+
```typescript
|
|
30
|
+
import type { SearchCompactResult } from '@weftlabs/sdk'
|
|
31
|
+
|
|
32
|
+
// TODO: Update the object below with actual values
|
|
33
|
+
const example = {
|
|
34
|
+
"provider": null,
|
|
35
|
+
"operation": null,
|
|
36
|
+
"inputs": null,
|
|
37
|
+
"request": null,
|
|
38
|
+
"example": null,
|
|
39
|
+
"access": null,
|
|
40
|
+
"attribution": null,
|
|
41
|
+
"output": null,
|
|
42
|
+
"docs": null,
|
|
43
|
+
"contractUrl": null,
|
|
44
|
+
"contractDetail": null,
|
|
45
|
+
"completion": null,
|
|
46
|
+
"blockedScopes": null,
|
|
47
|
+
"contractGaps": null,
|
|
48
|
+
"readiness": null,
|
|
49
|
+
"nextCall": null,
|
|
50
|
+
} satisfies SearchCompactResult
|
|
51
|
+
|
|
52
|
+
console.log(example)
|
|
53
|
+
|
|
54
|
+
// Convert the instance to a JSON string
|
|
55
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
56
|
+
console.log(exampleJSON)
|
|
57
|
+
|
|
58
|
+
// Parse the JSON string back to an object
|
|
59
|
+
const exampleParsed = JSON.parse(exampleJSON) as SearchCompactResult
|
|
60
|
+
console.log(exampleParsed)
|
|
61
|
+
```
|
|
62
|
+
|
|
63
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
|
|
2
|
+
# SearchCompactResultAttribution
|
|
3
|
+
|
|
4
|
+
Labels to send with the paid fetch so the purchase links to this search. Left out when `next_call.body` already carries them.
|
|
5
|
+
|
|
6
|
+
## Properties
|
|
7
|
+
|
|
8
|
+
Name | Type
|
|
9
|
+
------------ | -------------
|
|
10
|
+
`searchId` | string
|
|
11
|
+
`operationId` | string
|
|
12
|
+
`accessMethodId` | string
|
|
13
|
+
|
|
14
|
+
## Example
|
|
15
|
+
|
|
16
|
+
```typescript
|
|
17
|
+
import type { SearchCompactResultAttribution } from '@weftlabs/sdk'
|
|
18
|
+
|
|
19
|
+
// TODO: Update the object below with actual values
|
|
20
|
+
const example = {
|
|
21
|
+
"searchId": null,
|
|
22
|
+
"operationId": null,
|
|
23
|
+
"accessMethodId": null,
|
|
24
|
+
} satisfies SearchCompactResultAttribution
|
|
25
|
+
|
|
26
|
+
console.log(example)
|
|
27
|
+
|
|
28
|
+
// Convert the instance to a JSON string
|
|
29
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
30
|
+
console.log(exampleJSON)
|
|
31
|
+
|
|
32
|
+
// Parse the JSON string back to an object
|
|
33
|
+
const exampleParsed = JSON.parse(exampleJSON) as SearchCompactResultAttribution
|
|
34
|
+
console.log(exampleParsed)
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
# SearchCompactResultBlockedScopesInner
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`scope` | string
|
|
10
|
+
`state` | string
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { SearchCompactResultBlockedScopesInner } from '@weftlabs/sdk'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"scope": null,
|
|
20
|
+
"state": null,
|
|
21
|
+
} satisfies SearchCompactResultBlockedScopesInner
|
|
22
|
+
|
|
23
|
+
console.log(example)
|
|
24
|
+
|
|
25
|
+
// Convert the instance to a JSON string
|
|
26
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
27
|
+
console.log(exampleJSON)
|
|
28
|
+
|
|
29
|
+
// Parse the JSON string back to an object
|
|
30
|
+
const exampleParsed = JSON.parse(exampleJSON) as SearchCompactResultBlockedScopesInner
|
|
31
|
+
console.log(exampleParsed)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
# SearchCompactResultOperation
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`id` | string
|
|
10
|
+
`name` | string
|
|
11
|
+
`description` | string
|
|
12
|
+
|
|
13
|
+
## Example
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
import type { SearchCompactResultOperation } from '@weftlabs/sdk'
|
|
17
|
+
|
|
18
|
+
// TODO: Update the object below with actual values
|
|
19
|
+
const example = {
|
|
20
|
+
"id": null,
|
|
21
|
+
"name": null,
|
|
22
|
+
"description": null,
|
|
23
|
+
} satisfies SearchCompactResultOperation
|
|
24
|
+
|
|
25
|
+
console.log(example)
|
|
26
|
+
|
|
27
|
+
// Convert the instance to a JSON string
|
|
28
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
29
|
+
console.log(exampleJSON)
|
|
30
|
+
|
|
31
|
+
// Parse the JSON string back to an object
|
|
32
|
+
const exampleParsed = JSON.parse(exampleJSON) as SearchCompactResultOperation
|
|
33
|
+
console.log(exampleParsed)
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
|
|
2
|
+
# SearchCompactResultProvider
|
|
3
|
+
|
|
4
|
+
|
|
5
|
+
## Properties
|
|
6
|
+
|
|
7
|
+
Name | Type
|
|
8
|
+
------------ | -------------
|
|
9
|
+
`id` | string
|
|
10
|
+
`name` | string
|
|
11
|
+
|
|
12
|
+
## Example
|
|
13
|
+
|
|
14
|
+
```typescript
|
|
15
|
+
import type { SearchCompactResultProvider } from '@weftlabs/sdk'
|
|
16
|
+
|
|
17
|
+
// TODO: Update the object below with actual values
|
|
18
|
+
const example = {
|
|
19
|
+
"id": null,
|
|
20
|
+
"name": null,
|
|
21
|
+
} satisfies SearchCompactResultProvider
|
|
22
|
+
|
|
23
|
+
console.log(example)
|
|
24
|
+
|
|
25
|
+
// Convert the instance to a JSON string
|
|
26
|
+
const exampleJSON: string = JSON.stringify(example)
|
|
27
|
+
console.log(exampleJSON)
|
|
28
|
+
|
|
29
|
+
// Parse the JSON string back to an object
|
|
30
|
+
const exampleParsed = JSON.parse(exampleJSON) as SearchCompactResultProvider
|
|
31
|
+
console.log(exampleParsed)
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
[[Back to top]](#) [[Back to API list]](../README.md#api-endpoints) [[Back to Model list]](../README.md#models) [[Back to README]](../README.md)
|
package/docs/SearchRequest.md
CHANGED
|
@@ -9,6 +9,7 @@ Name | Type
|
|
|
9
9
|
`query` | string
|
|
10
10
|
`maxResults` | number
|
|
11
11
|
`filters` | [SearchFilterSpec](SearchFilterSpec.md)
|
|
12
|
+
`view` | string
|
|
12
13
|
|
|
13
14
|
## Example
|
|
14
15
|
|
|
@@ -20,6 +21,7 @@ const example = {
|
|
|
20
21
|
"query": send email from an agent,
|
|
21
22
|
"maxResults": null,
|
|
22
23
|
"filters": null,
|
|
24
|
+
"view": null,
|
|
23
25
|
} satisfies SearchRequest
|
|
24
26
|
|
|
25
27
|
console.log(example)
|
package/docs/SearchResponse.md
CHANGED
|
@@ -25,6 +25,9 @@ Name | Type
|
|
|
25
25
|
`reason` | string
|
|
26
26
|
`suggestion` | string
|
|
27
27
|
`results` | [Array<SearchResult>](SearchResult.md)
|
|
28
|
+
`view` | string
|
|
29
|
+
`compactResults` | [Array<SearchCompactResult>](SearchCompactResult.md)
|
|
30
|
+
`omittedResults` | number
|
|
28
31
|
|
|
29
32
|
## Example
|
|
30
33
|
|
|
@@ -51,6 +54,9 @@ const example = {
|
|
|
51
54
|
"reason": null,
|
|
52
55
|
"suggestion": null,
|
|
53
56
|
"results": null,
|
|
57
|
+
"view": null,
|
|
58
|
+
"compactResults": null,
|
|
59
|
+
"omittedResults": null,
|
|
54
60
|
} satisfies SearchResponse
|
|
55
61
|
|
|
56
62
|
console.log(example)
|
|
@@ -9,6 +9,7 @@ Name | Type
|
|
|
9
9
|
`state` | string
|
|
10
10
|
`reason` | string
|
|
11
11
|
`contractVersion` | number
|
|
12
|
+
`coverage` | string
|
|
12
13
|
|
|
13
14
|
## Example
|
|
14
15
|
|
|
@@ -20,6 +21,7 @@ const example = {
|
|
|
20
21
|
"state": null,
|
|
21
22
|
"reason": null,
|
|
22
23
|
"contractVersion": null,
|
|
24
|
+
"coverage": null,
|
|
23
25
|
} satisfies SearchWeftFetchCompatibility
|
|
24
26
|
|
|
25
27
|
console.log(example)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@weftlabs/sdk",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.1",
|
|
4
4
|
"description": "Unified Weft SDK for the Weft API and x402 Facilitator",
|
|
5
5
|
"main": "./dist/index.js",
|
|
6
6
|
"module": "./dist/index.mjs",
|
|
@@ -66,18 +66,19 @@
|
|
|
66
66
|
"@x402/core": "^2.24.0"
|
|
67
67
|
},
|
|
68
68
|
"devDependencies": {
|
|
69
|
-
"@types/node": "^26.6.
|
|
70
|
-
"@typescript
|
|
71
|
-
"@typescript-eslint/
|
|
72
|
-
"@
|
|
73
|
-
"
|
|
69
|
+
"@types/node": "^26.6.4",
|
|
70
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
71
|
+
"@typescript-eslint/eslint-plugin": "^8.71.1",
|
|
72
|
+
"@typescript-eslint/parser": "^8.71.1",
|
|
73
|
+
"@x402/core": "2.28.0",
|
|
74
|
+
"eslint": "^10.12.0",
|
|
74
75
|
"express": "^5.2.1",
|
|
75
76
|
"fast-check": "^4.10.2",
|
|
76
|
-
"hono": "^4.13.
|
|
77
|
-
"prettier": "3.9.
|
|
77
|
+
"hono": "^4.13.13",
|
|
78
|
+
"prettier": "3.9.9",
|
|
78
79
|
"tsup": "^8.5.1",
|
|
79
|
-
"typescript": "
|
|
80
|
-
"vitest": "^
|
|
80
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
81
|
+
"vitest": "^5.0.3"
|
|
81
82
|
},
|
|
82
83
|
"files": [
|
|
83
84
|
"dist",
|
|
@@ -92,7 +93,8 @@
|
|
|
92
93
|
"esbuild": "^0.28.1"
|
|
93
94
|
},
|
|
94
95
|
"scripts": {
|
|
95
|
-
"build": "tsup",
|
|
96
|
+
"build": "pnpm run typecheck && tsup",
|
|
97
|
+
"typecheck": "tsc --noEmit",
|
|
96
98
|
"test": "vitest run",
|
|
97
99
|
"test:unit": "vitest run",
|
|
98
100
|
"lint": "eslint --fix",
|