@omnixhq/ucp-client 2.2.0 → 2.4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +40 -8
- package/dist/adapters/anthropic.d.cts +1 -1
- package/dist/adapters/anthropic.d.ts +1 -1
- package/dist/adapters/langchain.d.cts +1 -1
- package/dist/adapters/langchain.d.ts +1 -1
- package/dist/adapters/mcp.d.cts +1 -1
- package/dist/adapters/mcp.d.ts +1 -1
- package/dist/adapters/openai.d.cts +1 -1
- package/dist/adapters/openai.d.ts +1 -1
- package/dist/adapters/vercel-ai.d.cts +1 -1
- package/dist/adapters/vercel-ai.d.ts +1 -1
- package/dist/catch-errors-C8MBfxB5.d.ts +4774 -0
- package/dist/catch-errors-C8MBfxB5.d.ts.map +1 -0
- package/dist/catch-errors-CO8dAo6Q.d.cts +4774 -0
- package/dist/catch-errors-CO8dAo6Q.d.cts.map +1 -0
- package/dist/errors-C1XqxNmZ.cjs.map +1 -1
- package/dist/errors-DX7yw6Gl.js.map +1 -1
- package/dist/index.cjs +260 -144
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +3 -10382
- package/dist/index.d.cts.map +1 -1
- package/dist/index.d.ts +3 -10382
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +239 -143
- package/dist/index.js.map +1 -1
- package/package.json +42 -3
- package/dist/catch-errors-BoytVKBJ.d.cts +0 -446
- package/dist/catch-errors-BoytVKBJ.d.cts.map +0 -1
- package/dist/catch-errors-lijeGf45.d.ts +0 -446
- package/dist/catch-errors-lijeGf45.d.ts.map +0 -1
package/README.md
CHANGED
|
@@ -16,10 +16,26 @@ Every AI agent that wants to buy something from a UCP store needs to discover ca
|
|
|
16
16
|
|
|
17
17
|
## Install
|
|
18
18
|
|
|
19
|
+
Two release channels track the two UCP spec tracks:
|
|
20
|
+
|
|
21
|
+
### Stable (recommended)
|
|
22
|
+
|
|
23
|
+
Based on the stable UCP spec (`@omnixhq/ucp-js-sdk@latest`). Supports checkout, fulfillment, discount, order, and identity linking.
|
|
24
|
+
|
|
19
25
|
```bash
|
|
20
26
|
npm install @omnixhq/ucp-client
|
|
21
27
|
```
|
|
22
28
|
|
|
29
|
+
### Draft
|
|
30
|
+
|
|
31
|
+
Based on the draft UCP spec (`@omnixhq/ucp-js-sdk@next`). Includes everything in stable plus capabilities still being finalized in the spec (catalog, cart, and others as they land).
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
npm install @omnixhq/ucp-client@next
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
> **Note:** Draft builds track the spec draft and may have breaking changes between releases. Use stable in production.
|
|
38
|
+
|
|
23
39
|
## Quick Start
|
|
24
40
|
|
|
25
41
|
```typescript
|
|
@@ -137,13 +153,13 @@ All five adapters (`openai`, `anthropic`, `mcp`, `vercel-ai`, `langchain`) suppo
|
|
|
137
153
|
|
|
138
154
|
The tools you get depend on what the server declares:
|
|
139
155
|
|
|
140
|
-
| Server declares | Tools you get
|
|
141
|
-
| --------------------------------- |
|
|
142
|
-
| `dev.ucp.shopping.checkout` | `create_checkout`, `get_checkout`, `update_checkout`, `complete_checkout`, `cancel_checkout`
|
|
143
|
-
| `dev.ucp.shopping.fulfillment` | + `set_fulfillment`, `select_destination`, `select_fulfillment_option`
|
|
144
|
-
| `dev.ucp.shopping.discount` | + `apply_discount_codes`
|
|
145
|
-
| `dev.ucp.shopping.order` | + `get_order`, `update_order`
|
|
146
|
-
| `dev.ucp.common.identity_linking` | + `get_authorization_url`, `exchange_auth_code`, `refresh_access_token`, `revoke_token`
|
|
156
|
+
| Server declares | Tools you get |
|
|
157
|
+
| --------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------ |
|
|
158
|
+
| `dev.ucp.shopping.checkout` | `create_checkout`, `get_checkout`, `update_checkout`, `complete_checkout`, `cancel_checkout` |
|
|
159
|
+
| `dev.ucp.shopping.fulfillment` | + `set_fulfillment`, `select_destination`, `select_fulfillment_option`, `create_fulfillment_method`, `update_fulfillment_method`, `update_fulfillment_group` |
|
|
160
|
+
| `dev.ucp.shopping.discount` | + `apply_discount_codes` |
|
|
161
|
+
| `dev.ucp.shopping.order` | + `get_order`, `update_order`, `update_order_line_item` |
|
|
162
|
+
| `dev.ucp.common.identity_linking` | + `get_authorization_url`, `exchange_auth_code`, `refresh_access_token`, `revoke_token` |
|
|
147
163
|
|
|
148
164
|
Connect to a different server → get different tools. Your agent code stays the same.
|
|
149
165
|
|
|
@@ -200,7 +216,23 @@ const client = await UCPClient.connect(config);
|
|
|
200
216
|
const valid = await verifyRequestSignature(rawBody, signature, client.signingKeys);
|
|
201
217
|
```
|
|
202
218
|
|
|
203
|
-
|
|
219
|
+
### Parsing webhook payloads
|
|
220
|
+
|
|
221
|
+
After verifying the signature, parse the raw body into a typed `WebhookEvent` with `parseWebhookEvent`. Throws `UCPError` with code `INVALID_WEBHOOK_PAYLOAD` if the body is not valid JSON or doesn't match the UCP order event schema.
|
|
222
|
+
|
|
223
|
+
```typescript
|
|
224
|
+
import { createWebhookVerifier, parseWebhookEvent } from '@omnixhq/ucp-client';
|
|
225
|
+
|
|
226
|
+
const verifier = createWebhookVerifier('https://store.example.com');
|
|
227
|
+
|
|
228
|
+
// In your webhook handler:
|
|
229
|
+
const valid = await verifier.verify(rawBody, req.headers['request-signature']);
|
|
230
|
+
if (!valid) return res.status(401).send('Invalid signature');
|
|
231
|
+
|
|
232
|
+
const event = parseWebhookEvent(rawBody);
|
|
233
|
+
// event.event_id, event.created_time, event.order
|
|
234
|
+
console.log(event.order.id);
|
|
235
|
+
```
|
|
204
236
|
|
|
205
237
|
## Framework adapters
|
|
206
238
|
|
package/dist/adapters/mcp.d.cts
CHANGED
package/dist/adapters/mcp.d.ts
CHANGED