shopstack 0.3.1 → 0.3.3

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 CHANGED
@@ -6,9 +6,9 @@ guest restaurant reservations.
6
6
  ## Install
7
7
 
8
8
  ```bash
9
- npm install shopstack@0.3.1
9
+ npm install shopstack@0.3.3
10
10
  # or
11
- npm install -g shopstack@0.3.1
11
+ npm install -g shopstack@0.3.3
12
12
  ```
13
13
 
14
14
  Node.js 18 or newer is required.
@@ -18,7 +18,7 @@ WebSocket (Node.js 22 or newer). It reads the authenticated checkout resource
18
18
  after each notification. Older runtimes, or a failed socket connection, use the
19
19
  bounded HTTP update wait. The one-time socket token is never placed in a URL.
20
20
 
21
- This preview release pairs `shopstack@0.3.1` with `shopstack-mcp@0.2.1`.
21
+ This preview release pairs `shopstack@0.3.3` with `shopstack-mcp@0.2.3`.
22
22
  Both packages use the `preview` distribution tag. The `latest` versions are
23
23
  unchanged. Use the exact versions above to install this release.
24
24
 
@@ -79,7 +79,7 @@ Configure any stdio MCP client to run:
79
79
  "mcpServers": {
80
80
  "shopstack": {
81
81
  "command": "npx",
82
- "args": ["-y", "shopstack-mcp@0.2.1"],
82
+ "args": ["-y", "shopstack-mcp@0.2.3"],
83
83
  "env": {
84
84
  "SHOPSTACK_API_URL": "https://shopstack-release-preview.shopstack.workers.dev/v1",
85
85
  "SHOPSTACK_CONFIG_FILE": "/absolute/private/path/shopstack-config.json"
@@ -110,7 +110,7 @@ one MCP server and three focused skills:
110
110
  - `shopstack-checkout` for checkout creation and monitoring;
111
111
  - `shopstack-onboarding` for verified signup and private local profiles.
112
112
 
113
- The plugin pins `shopstack-mcp@0.2.1`, which installs the matching
113
+ The plugin pins `shopstack-mcp@0.2.3`, which installs the matching
114
114
  reservation-capable `shopstack` client. Configure the API address
115
115
  before starting the plugin or use a profile already bound to that API. The existing top-level
116
116
  `SKILL.md` remains in the npm client package for compatibility.
@@ -122,8 +122,12 @@ shopstack connect list
122
122
  shopstack connect link
123
123
  ```
124
124
 
125
- Link is currently the only persistent payment provider. Connecting it is
126
- optional.
125
+ Link is currently the only persistent payment provider. Connecting it in advance
126
+ is optional. Select `payment_provider: "link"` to prepare the cart first; at card
127
+ issuance Shopstack returns the Link sign-in or approval URL and waits. After Link
128
+ responds, checkout resumes automatically. No “done” message is needed. The CLI
129
+ keeps watching; MCP agents use `wait_checkout_update` with the latest
130
+ `presentation_revision`. Final order approval is still a separate step.
127
131
 
128
132
  ## Run a guest reservation
129
133
 
@@ -199,7 +203,7 @@ form, then asks for card details through a no-echo terminal prompt. Card data is
199
203
  sent only to the protected payment-details endpoint. The CLI separately shows
200
204
  the exact final amount and asks for approval before Shopstack can submit.
201
205
 
202
- To use an active Link connection, add `"payment_provider": "link"` to the
206
+ To use Link, with or without a prior connection, add `"payment_provider": "link"` to the
203
207
  request.
204
208
 
205
209
  Card values are never accepted as command-line flags.
package/SKILL.md CHANGED
@@ -19,8 +19,8 @@ chat to fix an environment mismatch.
19
19
  For the JavaScript client and CLI:
20
20
 
21
21
  ```bash
22
- npm install shopstack@0.3.1
23
- npm install -g shopstack@0.3.1
22
+ npm install shopstack@0.3.3
23
+ npm install -g shopstack@0.3.3
24
24
  ```
25
25
 
26
26
  For MCP clients, configure the local stdio server:
@@ -30,7 +30,7 @@ For MCP clients, configure the local stdio server:
30
30
  "mcpServers": {
31
31
  "shopstack": {
32
32
  "command": "npx",
33
- "args": ["-y", "shopstack-mcp@0.2.1"]
33
+ "args": ["-y", "shopstack-mcp@0.2.3"]
34
34
  }
35
35
  }
36
36
  }
@@ -113,7 +113,18 @@ shopstack connect list
113
113
  shopstack connect link
114
114
  ```
115
115
 
116
- Include `payment_provider: "link"` only when the active user's Link connection reports checkout-ready. Otherwise omit `payment_provider`. Shopstack will run until card entry and request one protected checkout-scoped card through the SDK or no-echo CLI prompt.
116
+ When the user chooses Link, include `payment_provider: "link"` even if Link is
117
+ not connected. Shopstack prepares the merchant checkout first. At card
118
+ issuance, `required_input.type: "link"` supplies the exact sign-in or approval
119
+ URL, amount, currency, and an optional verification phrase. Show those values
120
+ and keep monitoring. Shopstack polls Link and resumes automatically; never ask
121
+ the user to send a completion message. Link credential approval does not grant
122
+ Shopstack final order approval.
123
+
124
+ Omit `payment_provider` when the user wants to supply a card directly.
125
+ Shopstack then requests protected checkout-scoped card input at the payment
126
+ form through the SDK, CLI prompt, or live viewer. Connecting Link in advance
127
+ with the commands above is optional.
117
128
 
118
129
  Never put card data in MCP arguments, natural-language messages, model output, logs, or ordinary CLI flags.
119
130
 
@@ -150,20 +161,25 @@ Run it with:
150
161
  shopstack checkout run --file checkout.json
151
162
  ```
152
163
 
153
- Or create with MCP, then call `poll_checkout`. Display these authoritative fields to the user when they change:
164
+ Or create with MCP, read with `poll_checkout`, and monitor changes with
165
+ `wait_checkout_update` using the latest `presentation_revision`. Display these
166
+ authoritative fields to the user when they change:
154
167
 
155
168
  - `status`: one of exactly `queued`, `started`, `help_required`, `approval_required`, `submitting`, `complete`, `failed`, `cancelled`;
156
169
  - `activity`: bounded present-tense display text;
157
170
  - `intent.name`, `intent.phase`, and `intent.updated_at`: bounded mechanical action progress with no arguments or reasoning;
158
- - `required_input`: a typed handoff such as protected payment-card input;
171
+ - `required_input`: a typed handoff for Link or protected payment-card input;
159
172
  - `approval`: the exact amount-bound approval request when present.
160
173
 
161
- Poll every two seconds for `queued`, `started`, and `submitting`; every five seconds for `help_required` and `approval_required`; stop at `complete`, `failed`, or `cancelled`.
174
+ Keep calling `wait_checkout_update` while Link sign-in or approval is pending;
175
+ an unchanged response is not a failure. Stop at `complete`, `failed`, or
176
+ `cancelled`. The CLI monitor follows changes automatically.
162
177
 
163
178
  ## Respond at typed boundaries
164
179
 
165
180
  - Use `GET/POST /v1/checkout/{id}/messages` only for ordinary missing information.
166
181
  - Use protected SDK/CLI payment input when `required_input.type` is `payment_card`.
182
+ - Show the exact URL and keep monitoring when `required_input.type` is `link`.
167
183
  - Use only the dedicated payment-approval endpoint from a separately scoped trusted backend.
168
184
  - MCP and messages cannot approve payment and expose no approval tool.
169
185
  - Never infer approval from a user's conversational message.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopstack",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
4
4
  "description": "Shopstack API client and command-line checkout and reservation tools.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -2670,7 +2670,7 @@
2670
2670
  },
2671
2671
  "payment_provider": {
2672
2672
  "$ref": "#/components/schemas/PaymentProvider",
2673
- "description": "Optional. Select Link only when this user has an active Link connection; otherwise the checkout requests protected one-checkout card input at the payment form."
2673
+ "description": "Optional. Select Link without connecting first. At card issuance the checkout returns a Link login or approval URL in required_input and waits. Omission requests protected one-checkout card input instead. Link approval does not approve final order submission."
2674
2674
  },
2675
2675
  "external_reference": {
2676
2676
  "type": "string",
@@ -2790,14 +2790,62 @@
2790
2790
  }
2791
2791
  },
2792
2792
  "RequiredInput": {
2793
+ "oneOf": [
2794
+ {
2795
+ "type": "object",
2796
+ "additionalProperties": false,
2797
+ "required": [
2798
+ "type"
2799
+ ],
2800
+ "properties": {
2801
+ "type": {
2802
+ "const": "payment_card"
2803
+ }
2804
+ }
2805
+ },
2806
+ {
2807
+ "$ref": "#/components/schemas/LinkRequiredInput"
2808
+ }
2809
+ ]
2810
+ },
2811
+ "LinkRequiredInput": {
2793
2812
  "type": "object",
2794
2813
  "additionalProperties": false,
2814
+ "description": "Owner-private Link login or credential approval. Open the exact URL or approve in Link. This does not approve Shopstack order submission. The checkout resumes automatically after Link responds.",
2795
2815
  "required": [
2796
- "type"
2816
+ "type",
2817
+ "action",
2818
+ "url",
2819
+ "amount_cents",
2820
+ "currency"
2797
2821
  ],
2798
2822
  "properties": {
2799
2823
  "type": {
2800
- "const": "payment_card"
2824
+ "const": "link"
2825
+ },
2826
+ "action": {
2827
+ "enum": [
2828
+ "connect",
2829
+ "approve"
2830
+ ]
2831
+ },
2832
+ "url": {
2833
+ "type": "string",
2834
+ "format": "uri",
2835
+ "maxLength": 2048
2836
+ },
2837
+ "phrase": {
2838
+ "type": "string",
2839
+ "minLength": 1,
2840
+ "maxLength": 100
2841
+ },
2842
+ "amount_cents": {
2843
+ "type": "integer",
2844
+ "minimum": 1,
2845
+ "maximum": 500000
2846
+ },
2847
+ "currency": {
2848
+ "$ref": "#/components/schemas/Currency"
2801
2849
  }
2802
2850
  }
2803
2851
  },
package/src/cli.js CHANGED
@@ -649,6 +649,17 @@ export async function runCli(args, supplied = {}) {
649
649
  `[${checkout.status}]${intent} ${checkout.activity ?? ""}`.trimEnd() +
650
650
  "\n",
651
651
  );
652
+ if (checkout.required_input?.type === "link") {
653
+ const input = checkout.required_input;
654
+ dependencies.stderr.write(
655
+ `${input.action === "connect" ? "Connect Link" : "Approve in Link"}: ${input.url}\n` +
656
+ `Amount: ${input.currency} ${(input.amount_cents / 100).toFixed(2)}\n` +
657
+ (input.action === "connect" && input.phrase
658
+ ? `Code: ${input.phrase}\n`
659
+ : "") +
660
+ "The checkout resumes automatically. Final order approval is separate.\n",
661
+ );
662
+ }
652
663
  },
653
664
  approve: async (approval) => {
654
665
  const summary = [
package/src/client.d.ts CHANGED
@@ -138,7 +138,17 @@ export interface Checkout {
138
138
  item_url: string;
139
139
  /** Present this exact owner-only URL verbatim. Never reconstruct its token. */
140
140
  live_view_url?: string;
141
- required_input?: { type: "payment_card" };
141
+ required_input?:
142
+ | { type: "payment_card" }
143
+ | {
144
+ type: "link";
145
+ action: "connect" | "approve";
146
+ /** Owner-private Link URL. Present it verbatim; never reconstruct it. */
147
+ url: string;
148
+ phrase?: string;
149
+ amount_cents: number;
150
+ currency: string;
151
+ };
142
152
  approval?: PaymentApproval;
143
153
  result?: Record<string, unknown>;
144
154
  failure?: Record<string, unknown>;
package/src/client.js CHANGED
@@ -576,7 +576,7 @@ export class ShopstackClient {
576
576
  current.intent?.name,
577
577
  current.intent?.phase,
578
578
  current.intent?.updated_at,
579
- current.required_input?.type,
579
+ current.required_input,
580
580
  current.approval?.id,
581
581
  ]);
582
582
  if (fingerprint === progressFingerprint) return;
@@ -597,6 +597,12 @@ export class ShopstackClient {
597
597
  }
598
598
  checkout = await this.getCheckout(checkout.id);
599
599
  await publishProgress(checkout);
600
+ if (
601
+ checkout.required_input?.type === "link" &&
602
+ typeof options.onProgress !== "function"
603
+ ) {
604
+ return checkout;
605
+ }
600
606
  if (
601
607
  checkout.required_input?.type === "payment_card" &&
602
608
  handledPaymentRevision !== checkout.revision