shopstack 0.2.2 → 0.2.4

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
@@ -63,12 +63,14 @@ Configure any stdio MCP client to run:
63
63
 
64
64
  The MCP server can start and poll verified signup, manage local profiles,
65
65
  create developer-owned users, list/connect Link, and create/poll/message/cancel
66
- checkouts. It exposes status, activity, and the latest bounded mechanical intent
67
- phase. It deliberately has no card-input or payment-approval tool.
66
+ checkouts. Checkout creation returns the exact live-view URL as a clickable MCP
67
+ resource; `get_live_view` replaces a lost one-time link for an active checkout.
68
+ It exposes status, activity, and the latest bounded mechanical intent phase. It
69
+ deliberately has no card-input or payment-approval tool.
68
70
 
69
71
  The canonical agent skill ships as `SKILL.md` in this package. After
70
72
  publication it is available at
71
- `https://unpkg.com/shopstack@0.2.2/SKILL.md` with the release-pinned package.
73
+ `https://unpkg.com/shopstack@0.2.4/SKILL.md` with the release-pinned package.
72
74
 
73
75
  ## Connections
74
76
 
@@ -119,6 +121,13 @@ is view-only unless the model explicitly requests human assistance; while that
119
121
  request is active, one owner viewer can use **Take control** and **Return
120
122
  control**. **Stop** is always available and never approves payment.
121
123
 
124
+ Treat the printed URL as opaque and open it exactly as returned, including its
125
+ `#token=...` fragment. If that fragment is lost while the checkout is active,
126
+ run `shopstack checkout view CHECKOUT_ID` to receive a replacement URL. The
127
+ replacement disconnects an older viewer session but does not restart checkout.
128
+ Omit `model_handle` to use the production GLM route. Set it to `qwen` only when
129
+ you explicitly need the fixed Qwen comparison route.
130
+
122
131
  When no provider is selected, the checkout runs normally until the payment
123
132
  form, then asks for card details through a no-echo terminal prompt. Card data is
124
133
  sent only to the protected payment-details endpoint. The CLI separately shows
package/SKILL.md CHANGED
@@ -131,11 +131,17 @@ The optional `live_view_url` is a private owner-viewer capability. Show it only
131
131
  to the initiating user. Do not store it in browser storage, analytics, logs,
132
132
  model context, or ordinary messages.
133
133
 
134
+ Present `live_view_url` exactly as returned, including its fragment; never
135
+ construct a viewer URL from the checkout ID. MCP returns it as a clickable
136
+ resource link. If it is lost while the checkout is active, call
137
+ `get_live_view` (or `shopstack checkout view CHECKOUT_ID`) once and present the
138
+ replacement verbatim.
139
+
134
140
  ## Respond at typed boundaries
135
141
 
136
142
  - Use `GET/POST /v1/checkout/{id}/messages` only for ordinary missing information.
137
143
  - Use protected SDK/CLI payment input when `required_input.type` is `payment_card`.
138
- - Use only the dedicated payment-approval endpoint from a separately scoped trusted backend.
144
+ - Use only the dedicated payment-approval endpoint with the owning user's credential.
139
145
  - MCP and messages cannot approve payment and expose no approval tool.
140
146
  - Never infer approval from a user's conversational message.
141
147
  - Cancel with the typed cancellation operation if the user withdraws the request.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "shopstack",
3
- "version": "0.2.2",
3
+ "version": "0.2.4",
4
4
  "description": "Production Shopstack SDK and CLI for agentic checkout.",
5
5
  "type": "module",
6
6
  "exports": {
@@ -26,8 +26,8 @@
26
26
  "check": "npm run format:check && npm run test:coverage",
27
27
  "format:check": "prettier --check .",
28
28
  "shopstack": "node ./bin/shopstack",
29
- "test": "node --test test",
30
- "test:coverage": "node --test --experimental-test-coverage test",
29
+ "test": "node --test test/*.test.js",
30
+ "test:coverage": "node --test --experimental-test-coverage test/*.test.js",
31
31
  "prepublishOnly": "npm run check"
32
32
  },
33
33
  "engines": {
package/src/cli.js CHANGED
@@ -4,7 +4,9 @@ import { createInterface } from "node:readline/promises";
4
4
  import { ShopstackClient } from "./client.js";
5
5
  import { ConfigStore } from "./config.js";
6
6
 
7
- const VERSION = "0.2.2";
7
+ const VERSION = JSON.parse(
8
+ await readFile(new URL("../package.json", import.meta.url), "utf8"),
9
+ ).version;
8
10
 
9
11
  const HELP = `Shopstack CLI ${VERSION}
10
12
 
@@ -40,6 +42,8 @@ Checkout:
40
42
  # Create, monitor, and complete a checkout interactively.
41
43
  shopstack checkout get CHECKOUT_ID
42
44
  # Read the canonical current checkout state.
45
+ shopstack checkout view CHECKOUT_ID
46
+ # Replace and return the active checkout's private owner live-view URL.
43
47
  shopstack checkout cancel CHECKOUT_ID
44
48
  # Cancel a checkout that has not reached a terminal state.
45
49
 
@@ -542,13 +546,18 @@ export async function runCli(args, supplied = {}) {
542
546
  return;
543
547
  }
544
548
 
545
- if (group === "checkout" && (action === "get" || action === "cancel")) {
549
+ if (
550
+ group === "checkout" &&
551
+ (action === "get" || action === "view" || action === "cancel")
552
+ ) {
546
553
  if (rest.length !== 1) throw new Error("A checkout ID is required.");
547
554
  const { client } = await activeClient(dependencies, "user");
548
555
  const result =
549
556
  action === "get"
550
557
  ? await client.getCheckout(rest[0])
551
- : await client.cancelCheckout(rest[0]);
558
+ : action === "view"
559
+ ? await client.createLiveView(rest[0])
560
+ : await client.cancelCheckout(rest[0]);
552
561
  writeJson(dependencies.stdout, result);
553
562
  return;
554
563
  }
package/src/client.d.ts CHANGED
@@ -78,6 +78,10 @@ export interface CheckoutUpdateSubscription {
78
78
  presentation_revision: number;
79
79
  }
80
80
 
81
+ export interface LiveViewCapability {
82
+ live_view_url: string;
83
+ }
84
+
81
85
  export interface AccountSignupStarted {
82
86
  id: string;
83
87
  account_type: "personal" | "developer";
@@ -200,6 +204,10 @@ export class ShopstackClient {
200
204
  options?: { idempotencyKey?: string },
201
205
  ): Promise<Checkout>;
202
206
  getCheckout(checkoutId: string): Promise<Checkout>;
207
+ createLiveView(
208
+ checkoutId: string,
209
+ options?: { idempotencyKey?: string },
210
+ ): Promise<LiveViewCapability>;
203
211
  createCheckoutUpdateSubscription(
204
212
  checkoutId: string,
205
213
  ): Promise<CheckoutUpdateSubscription>;
package/src/client.js CHANGED
@@ -444,6 +444,16 @@ export class ShopstackClient {
444
444
  return this.request(`/checkout/${encodeURIComponent(checkoutId)}`);
445
445
  }
446
446
 
447
+ createLiveView(checkoutId, { idempotencyKey: key } = {}) {
448
+ return this.request(
449
+ `/checkout/${encodeURIComponent(checkoutId)}/live-view`,
450
+ {
451
+ idempotencyKey: key ?? idempotencyKey("live-view"),
452
+ method: "POST",
453
+ },
454
+ );
455
+ }
456
+
447
457
  createCheckoutUpdateSubscription(checkoutId) {
448
458
  return this.request(`/checkout/${encodeURIComponent(checkoutId)}/updates`, {
449
459
  method: "POST",