feat!: upgrade @omnixhq/ucp-js-sdk to v2.0.0 with catalog and cart capabilities#38
Merged
Conversation
…adapters - Rate-limit WebhookVerifier re-fetch on unknown kid to prevent DoS via forged signatures with random kid values (60s cooldown, configurable) - Extract duplicated tool-lookup-and-execute logic from openai, anthropic, and mcp adapters into shared findAndExecuteTool() in catch-errors.ts - Preserve non-JSON response body context in http.ts error messages instead of silently swallowing parse failures - Wrap identity-linking token endpoint JSON parse in try-catch and include error response body in UCPOAuthError messages for debuggability
- Extract parseResponseBody() in http.ts to read body as text first, preserving raw content for non-JSON error messages instead of losing it to consumed body streams - Fix unsafe `any` return from JSON.parse and res.json() (lint error) - Wrap OAuth metadata res.json() in try-catch in UCPClient.ts to surface clear error when endpoint returns non-JSON - Replace inline import type with top-level import in catch-errors.ts
- Make parseMessages fallback try common field names (content, text, message) before defaulting to 'Unknown error' — handles servers that use non-spec field names - Fix mock server error responses to use spec-correct `content` field and include `code` in messages array - Add scripts/runtime-review.ts: comprehensive runtime integration test covering connect, all adapters, full checkout flow, error handling, webhook verification, idempotency keys, and immutability
…pabilities
Add CatalogCapability (search + getProduct) and CartCapability (create, get,
update, cancel) with full agent tool support and spec-compliant REST paths.
- Catalog uses split capability detection (catalog.search + catalog.lookup)
with extensions pattern matching checkout's fulfillment/discount model
- Cart uses plural /carts paths and POST /carts/{id}/cancel per spec
- Re-export all new SDK v2.0.0 schemas (catalog, cart, amount, error types)
- Agent tools: search_catalog, get_product, create_cart, get_cart, update_cart,
cancel_cart with JSON Schema parameters and execute functions
- 382 tests passing, 91%+ coverage
BREAKING CHANGE: CardPaymentInstrumentSchema removed (replaced by
CardPaymentInstrumentAvailableCardPaymentInstrumentSchema).
TotalTypeEnumSchema removed (no replacement in SDK v2.0.0).
UcpReverseDomainNameSchema renamed to ReverseDomainNameSchema.
29e26c2 to
51830b1
Compare
- schemas.ts: only import schemas needed for aliases; use direct
`export { ... } from '@omnixhq/ucp-js-sdk'` for pass-throughs
- index.ts: replace 200-line schema listing with `export * from './schemas.js'`
Each schema now appears once instead of three times.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
@omnixhq/ucp-js-sdkfrom1.1.0to2.0.0search+getProduct) with split capability detection (dev.ucp.shopping.catalog.search/dev.ucp.shopping.catalog.lookup)create,get,update,cancel) with spec-compliant/cartspaths andPOST /carts/{id}/cancelsearch_catalog,get_product,create_cart,get_cart,update_cart,cancel_cartBreaking Changes
CardPaymentInstrumentSchemaCardPaymentInstrumentAvailableCardPaymentInstrumentSchemaTotalTypeEnumSchemaUcpReverseDomainNameSchemaReverseDomainNameSchemaNew Files
src/capabilities/catalog.ts— CatalogCapability with extensions patternsrc/capabilities/cart.ts— CartCapability (CRUD + cancel)src/types/catalog.ts— Product, Variant, DetailOptionValue, SearchFilters, Paginationsrc/types/cart.ts— Cart, CartCreatePayload, CartUpdatePayloadsrc/capabilities/catalog.test.ts— 17 testssrc/capabilities/cart.test.ts— 26 testsTest plan
npm run typecheck— cleannpm run lint— cleannpm test— 382 tests pass (91%+ coverage)npm run build— clean dual ESM + CJSnpm run check:exports— all green (attw)npm run check:publish— all good (publint)npx api-extractor run --local— API baseline updated