Skip to content

feat!: upgrade @omnixhq/ucp-js-sdk to v2.0.0 with catalog and cart capabilities#38

Merged
artemii-karkusha merged 6 commits into
mainfrom
feat/ucp-js-sdk-2.0.0
Apr 11, 2026
Merged

feat!: upgrade @omnixhq/ucp-js-sdk to v2.0.0 with catalog and cart capabilities#38
artemii-karkusha merged 6 commits into
mainfrom
feat/ucp-js-sdk-2.0.0

Conversation

@artemii-karkusha

Copy link
Copy Markdown
Contributor

Summary

  • Upgrade @omnixhq/ucp-js-sdk from 1.1.0 to 2.0.0
  • Add CatalogCapability (search + getProduct) with split capability detection (dev.ucp.shopping.catalog.search / dev.ucp.shopping.catalog.lookup)
  • Add CartCapability (create, get, update, cancel) with spec-compliant /carts paths and POST /carts/{id}/cancel
  • Re-export all new SDK v2.0.0 schemas (catalog, cart, amount, error types — 68 new schemas)
  • Add agent tools: search_catalog, get_product, create_cart, get_cart, update_cart, cancel_cart

Breaking Changes

Removed/Renamed Replacement
CardPaymentInstrumentSchema CardPaymentInstrumentAvailableCardPaymentInstrumentSchema
TotalTypeEnumSchema Removed in SDK v2.0.0 (no replacement)
UcpReverseDomainNameSchema ReverseDomainNameSchema

New Files

  • src/capabilities/catalog.ts — CatalogCapability with extensions pattern
  • src/capabilities/cart.ts — CartCapability (CRUD + cancel)
  • src/types/catalog.ts — Product, Variant, DetailOptionValue, SearchFilters, Pagination
  • src/types/cart.ts — Cart, CartCreatePayload, CartUpdatePayload
  • src/capabilities/catalog.test.ts — 17 tests
  • src/capabilities/cart.test.ts — 26 tests

Test plan

  • npm run typecheck — clean
  • npm run lint — clean
  • npm test — 382 tests pass (91%+ coverage)
  • npm run build — clean dual ESM + CJS
  • npm run check:exports — all green (attw)
  • npm run check:publish — all good (publint)
  • npx api-extractor run --local — API baseline updated
  • UCP spec compliance reviewed (capability names, REST paths, tool names)

…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.
- 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.
@artemii-karkusha artemii-karkusha merged commit 08cba5e into main Apr 11, 2026
7 checks passed
@artemii-karkusha artemii-karkusha deleted the feat/ucp-js-sdk-2.0.0 branch April 11, 2026 01:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant