Repository navigation
[DO NOT MERGE before enterprise #2520 is deployed] feat(shop): data calls in the SDKs, the CLI and the MCP package - #244
Merged
Merged
Conversation
The core side of Shop G3.1 (CONTRATO-G3 §7A item 2), over the enterprise routes /v1/shop/agent/data-calls (key: draft, read; run is always person_required) and the research's task_kind data_service. - TS: cs.dataCalls / session.dataCalls (create, get, execute) and dataCallOutcome; session.research.create takes taskKind and criteria.dataService. Types in @codespar/types. - Python: cs.research and cs.data_calls (async and sync) with data_call_outcome; the same names and states. - CLI: derived shop create-data-calls / get-data-calls / data-calls-execute; these commands exit with the outcome (0 confirmed, 10 pending, 20 refused, 30 failure, 40 uncertain); every other command keeps exit 1. - MCP package: codespar_shop_data_call_draft / _status and the data_service research; no run tool. - OpenAPI snapshot: the three data-call operations and the research body, from the enterprise routes (served once deployed). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…nswers it The API's view follows lane B's state map: error.code names the provider's, the mandate's or the Wallet's code. The snapshot picks up the draft route's 409 idempotency_key_reused. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ected action and resumes by id
A key still never runs a data call; the API's person_required now carries
next_action (the call's card on the dashboard, behind the person's
sign-in, only the id in the url).
- TS: execute throws DataCallNeedsPersonError with nextAction;
nextActionOfError; get answers { data_call, next_action } (create too).
- Python: next_action_of(ApiError); get answers the same read.
- CLI: a data-call command refused with the protected action exits 10
(pending) and prints the url; create/get print it while pending.
- MCP package: codespar_shop_data_call_request_authorization answers the
link for the person; still no tool runs a call.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Baaitxfwpx5yJ8xhz6nNhT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Baaitxfwpx5yJ8xhz6nNhT
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Baaitxfwpx5yJ8xhz6nNhT
…0.11.8 for the data-call changes npm versions are immutable, so changed packages carry a new version. No release here: publishing is a tag push, done separately. The CLI's floor on the SDK rises to the version that exports dataCallOutcome and nextActionOfError. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Baaitxfwpx5yJ8xhz6nNhT
…e (0.11.8) Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Baaitxfwpx5yJ8xhz6nNhT
…s) into feat/shop-data-calls - Versions move past what main already holds or npm already has: sdk 0.16.31 (main is 0.16.30, npm 0.16.29), cli 0.22.8 with the SDK floor at ^0.16.31 (npm has 0.22.7); mcp 0.5.21 and types 0.11.8 stay (npm 0.5.20, 0.11.7). - The OpenAPI snapshot is the document served today (2026-11-17, 390 operations, G1 research body included) plus the three data-call operations and the research body's data_service, taken from enterprise #2520 at 3bcd53dcb built with buildOpenApiSpec. Nothing else of #2520 differs from the served document except routes that #2520 is behind main on. - src/generated/ regenerated from it (393 operations); the CLI's pinned commands keep both sides (data calls, then capabilities, in document order). - No PR code uses zod; the zod 4 move needs no source change here. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… v0.7 served) `npm run sdk:spec:refresh` against https://api.codespar.dev/openapi.json after enterprise #2535 (740313cae) was served: 397 operations (was 393). It adds the offer image route of #2535 and the OAuth consent routes already in production from other PRs, and picks up description-only changes in triggers and webhook-endpoints. Generated files only; no hand-written code changes. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The refreshed snapshot adds GET /v1/shop/agent/offers/{id}/image/{n} (enterprise
#2535, key scope shop:purchases:read). The CLI derives it as `shop
offers-image`, after `shop data-calls-execute`. The OAuth routes the refresh
also brought are outside /v1 and derive no command. Pinned in the resource
commands test and named in the 0.22.8 changelog.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Shop data calls in the SDKs, the CLI and the MCP package.
A data call is a per-call data service found by a research of
task_kind: "data_service". An API key drafts one from an offer and reads it. It never runs one: running it is the person's authorization. While the call waits for the person, the API answersnext_action, a link to the call's card on the dashboard behind the person's own sign-in.Status (2026-11-17)
POST /v1/shop/agent/data-calls(agent_id,offer_id,idempotency_key; answersdata_call,next_actionandidempotent_replay);GET /v1/shop/agent/data-calls/{id}(data_call,next_action);POST /v1/shop/agent/data-calls/{id}/execute(always 403person_required, witherror.details.next_action);POST /v1/shop/agent/research,task_kind: "data_service", thedatasource andcriteria.data_service { params, sku? }.spec-freshnessis red until then, and it says exactly that: the served document lacks those three operations and the research change. Nothing else differs. It is not a required check;ciis green.buildOpenApiSpec).src/generated/is regenerated from it (393 operations).@codespar/sdk0.16.31,@codespar/cli0.22.8 (SDK floor ^0.16.31),@codespar/mcp0.5.21,@codespar/types0.11.8. The Python changelog stays "Unreleased" (codespar0.16.2 on PyPI). Nothing is published here. Publishing happens after merge and after #2520 is deployed, withspec:checkgreen against the served document.What changes
cs.dataCallsandsession.dataCalls:create,get({ data_call, next_action }) andexecute. A key'sexecutethrowsDataCallNeedsPersonErrorwithnextAction.dataCallOutcome(view)turns the four states into one word.session.research.createtakestaskKindandcriteria.dataService.@codespar/types.cs.researchandcs.data_calls(async and sync), withdata_call_outcomeandnext_action_of.shop create-data-calls,shop get-data-callsandshop data-calls-execute.codespar_shop_data_call_draft,codespar_shop_data_call_request_authorization(answers the person's link) andcodespar_shop_data_call_status. No tool runs a call.Tests
cigreen (build, typecheck, lint, the unit suites, audit gate), plus gitleaks, kit-templates and the example validations.🤖 Generated with Claude Code