@01.software/cli 0.10.4 → 0.10.6

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.
@@ -15,6 +15,75 @@ var MCP_CONSOLE_SERVICE_AUDIENCE = "https://api.01.software/internal/mcp";
15
15
  var MCP_CONSOLE_SERVICE_SCOPE = "console:mcp_proxy";
16
16
  var MCP_SERVICE_TOKEN_LIFETIME_SECONDS = 60;
17
17
 
18
+ // src/resource-inventory.ts
19
+ var MCP_RESOURCE_INVENTORY = [
20
+ { uri: "config://app", label: "config", registeredName: "app-config" },
21
+ {
22
+ uri: "collections://schema",
23
+ label: "collections-schema",
24
+ registeredName: "collections-schema"
25
+ },
26
+ {
27
+ uri: "docs://sdk/getting-started",
28
+ label: "getting-started",
29
+ registeredName: "docs-getting-started"
30
+ },
31
+ { uri: "docs://sdk/guides", label: "guides", registeredName: "docs-guides" },
32
+ { uri: "docs://sdk/api", label: "api", registeredName: "docs-api" },
33
+ {
34
+ uri: "docs://sdk/query-builder",
35
+ label: "query-builder",
36
+ registeredName: "docs-query-builder"
37
+ },
38
+ {
39
+ uri: "docs://sdk/react-query",
40
+ label: "react-query",
41
+ registeredName: "docs-react-query"
42
+ },
43
+ {
44
+ uri: "docs://sdk/server-api",
45
+ label: "server-api",
46
+ registeredName: "docs-server-api"
47
+ },
48
+ {
49
+ uri: "docs://sdk/customer-auth",
50
+ label: "customer-auth",
51
+ registeredName: "docs-customer-auth"
52
+ },
53
+ {
54
+ uri: "docs://sdk/browser-vs-server",
55
+ label: "browser-vs-server",
56
+ registeredName: "docs-browser-vs-server"
57
+ },
58
+ {
59
+ uri: "docs://sdk/file-upload",
60
+ label: "file-upload",
61
+ registeredName: "docs-file-upload"
62
+ },
63
+ {
64
+ uri: "docs://sdk/webhook",
65
+ label: "webhook",
66
+ registeredName: "docs-webhook"
67
+ },
68
+ {
69
+ uri: "docs://sdk/product-detail",
70
+ label: "product-detail",
71
+ registeredName: "docs-product-detail"
72
+ }
73
+ ];
74
+ var MCP_RESOURCE_LABELS = MCP_RESOURCE_INVENTORY.map(
75
+ (resource) => resource.label
76
+ );
77
+ function mcpResourceUri(registeredName) {
78
+ const resource = MCP_RESOURCE_INVENTORY.find(
79
+ (entry) => entry.registeredName === registeredName
80
+ );
81
+ if (!resource) {
82
+ throw new Error(`Unknown MCP resource inventory entry: ${registeredName}`);
83
+ }
84
+ return resource.uri;
85
+ }
86
+
18
87
  // src/server.ts
19
88
  import { McpServer } from "@modelcontextprotocol/sdk/server/mcp.js";
20
89
 
@@ -91,9 +160,8 @@ function parseJsonWhere(where) {
91
160
  }
92
161
  }
93
162
 
94
- // ../../packages/contracts/dist/index.js
163
+ // ../../packages/contracts/src/tenant/index.ts
95
164
  import { z } from "zod";
96
- import { z as z2 } from "zod";
97
165
  var tenantFieldConfigStateSchema = z.object({
98
166
  hiddenFields: z.array(z.string()),
99
167
  isHidden: z.boolean()
@@ -242,12 +310,47 @@ var collectionSchemaResponseSchema = z.object({
242
310
  fields: z.array(collectionFieldSchema)
243
311
  }).strict()
244
312
  }).strict();
313
+
314
+ // ../../packages/contracts/src/ecommerce/index.ts
315
+ import { z as z2 } from "zod";
245
316
  var transactionStatusSchema = z2.enum([
246
317
  "pending",
247
318
  "paid",
248
319
  "failed",
249
320
  "canceled"
250
321
  ]);
322
+ var entityIdSchema = z2.union([z2.string(), z2.number()]).transform(String);
323
+ var createOrderItemSchema = z2.object({
324
+ product: entityIdSchema,
325
+ variant: entityIdSchema,
326
+ option: entityIdSchema,
327
+ quantity: z2.number().int().positive("quantity must be a positive integer"),
328
+ unitPrice: z2.number().optional(),
329
+ totalPrice: z2.number().optional()
330
+ });
331
+ var createOrderSchema = z2.object({
332
+ pgPaymentId: z2.string().min(1).optional(),
333
+ orderNumber: z2.string().min(1, "orderNumber is required"),
334
+ customer: entityIdSchema.optional(),
335
+ customerSnapshot: z2.object({
336
+ name: z2.string().optional(),
337
+ email: z2.string().email("Invalid email format"),
338
+ phone: z2.string().optional()
339
+ }),
340
+ shippingAddress: z2.object({
341
+ postalCode: z2.string().optional(),
342
+ address: z2.string().optional(),
343
+ detailAddress: z2.string().optional(),
344
+ deliveryMessage: z2.string().optional(),
345
+ recipientName: z2.string().optional(),
346
+ phone: z2.string().optional()
347
+ }),
348
+ orderItems: z2.array(createOrderItemSchema).min(1, "At least one order item is required").max(100, "Maximum 100 items per order"),
349
+ totalAmount: z2.number().nonnegative("totalAmount must be non-negative"),
350
+ shippingAmount: z2.number().min(0).optional(),
351
+ discountCode: z2.string().optional()
352
+ });
353
+ var CreateOrderSchema = createOrderSchema;
251
354
  var updateTransactionSchema = z2.object({
252
355
  pgPaymentId: z2.string().min(1, "pgPaymentId is required").describe("PG payment ID (required)"),
253
356
  status: transactionStatusSchema.describe(
@@ -282,6 +385,7 @@ var confirmPaymentSchema = z2.object({
282
385
  ]).optional(),
283
386
  metadata: z2.record(z2.string(), z2.unknown()).optional()
284
387
  }).strict();
388
+ var ConfirmPaymentSchema = confirmPaymentSchema;
285
389
  var returnReasonSchema = z2.enum([
286
390
  "change_of_mind",
287
391
  "defective",
@@ -308,6 +412,8 @@ var returnWithRefundSchema = z2.object({
308
412
  refundReceiptUrl: z2.string().optional().describe("Refund receipt URL (optional)")
309
413
  }).strict();
310
414
  var ReturnWithRefundSchema = returnWithRefundSchema;
415
+
416
+ // ../../packages/contracts/src/mcp/index.ts
311
417
  var MCP_TOOL_CONTRACT = {
312
418
  "query-collection": {
313
419
  consoleRole: "tenant-viewer",
@@ -409,6 +515,11 @@ var MCP_TOOL_CONTRACT = {
409
515
  oauthScope: "mcp:write",
410
516
  readOnly: false
411
517
  },
518
+ "confirm-payment": {
519
+ consoleRole: "tenant-admin",
520
+ oauthScope: "mcp:write",
521
+ readOnly: false
522
+ },
412
523
  "update-order": {
413
524
  consoleRole: "tenant-admin",
414
525
  oauthScope: "mcp:write",
@@ -659,6 +770,14 @@ var TOOL_POLICY_MANIFEST = {
659
770
  consoleSurface: "POST /api/orders",
660
771
  annotationPolicy: DESTRUCTIVE_NON_IDEMPOTENT_MUTATION_ANNOTATION
661
772
  },
773
+ "confirm-payment": {
774
+ category: "mutation-transaction",
775
+ oauthScope: MCP_SCOPES.write,
776
+ consoleRole: "tenant-admin",
777
+ consoleSurface: "POST /api/orders/confirm-payment",
778
+ annotationPolicy: DESTRUCTIVE_IDEMPOTENT_MUTATION_ANNOTATION,
779
+ exemptionReason: REASON_IDEMPOTENT_DESTRUCTIVE_UPDATE
780
+ },
662
781
  "update-order": {
663
782
  category: "mutation-order",
664
783
  oauthScope: MCP_SCOPES.write,
@@ -752,7 +871,15 @@ var TOOL_POLICY_MANIFEST = {
752
871
  annotationPolicy: READ_ONLY_ANNOTATION
753
872
  }
754
873
  };
755
- function evaluateToolPolicy(toolName, scopes) {
874
+ var CONSOLE_ROLE_RANK = {
875
+ "tenant-viewer": 0,
876
+ "tenant-editor": 1,
877
+ "tenant-admin": 2
878
+ };
879
+ function hasRequiredConsoleRole(tenantRole, requiredRole) {
880
+ return CONSOLE_ROLE_RANK[tenantRole] >= CONSOLE_ROLE_RANK[requiredRole];
881
+ }
882
+ function evaluateToolPolicy(toolName, scopes, tenantRole) {
756
883
  if (!isMcpToolName(toolName)) {
757
884
  return {
758
885
  allowed: false,
@@ -768,6 +895,13 @@ function evaluateToolPolicy(toolName, scopes) {
768
895
  message: `Tool ${toolName} requires ${entry.oauthScope}`
769
896
  };
770
897
  }
898
+ if (!hasRequiredConsoleRole(tenantRole, entry.consoleRole)) {
899
+ return {
900
+ allowed: false,
901
+ reason: "insufficient_role",
902
+ message: `Tool ${toolName} requires ${entry.consoleRole}`
903
+ };
904
+ }
771
905
  return { allowed: true, entry };
772
906
  }
773
907
 
@@ -1260,25 +1394,7 @@ async function getOrder({
1260
1394
  }
1261
1395
 
1262
1396
  // src/tools/create-order.ts
1263
- import { z as z6 } from "zod";
1264
- var schema4 = {
1265
- pgPaymentId: z6.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1266
- orderNumber: z6.string().min(1).describe("Unique order number (required)"),
1267
- customerSnapshot: z6.object({
1268
- name: z6.string().optional().describe("Customer name"),
1269
- email: z6.string().describe("Customer email (required)"),
1270
- phone: z6.string().optional().describe("Customer phone")
1271
- }).describe("Customer snapshot at time of order (required)"),
1272
- shippingAddress: z6.record(z6.string(), z6.unknown()).describe(
1273
- "Shipping address object (required). Fields: postalCode, address1, address2, deliveryMessage, recipientName, phone"
1274
- ),
1275
- orderItems: z6.array(z6.record(z6.string(), z6.unknown())).describe(
1276
- "Array of order item objects (required). Each: { product, variant, option, quantity, unitPrice?, totalPrice? }"
1277
- ),
1278
- totalAmount: z6.number().nonnegative().describe("Total order amount (required, min 0)"),
1279
- shippingAmount: z6.number().nonnegative().optional().describe("Shipping amount (optional, default 0)"),
1280
- discountCode: z6.string().optional().describe("Discount code to apply (optional)")
1281
- };
1397
+ var schema4 = CreateOrderSchema.shape;
1282
1398
  var metadata4 = {
1283
1399
  name: "create-order",
1284
1400
  description: "Create a new order with products and shipping information. Supports idempotency.",
@@ -1292,9 +1408,8 @@ var metadata4 = {
1292
1408
  async function createOrder(params) {
1293
1409
  try {
1294
1410
  const client = getClient();
1295
- const result = await client.commerce.orders.create(
1296
- params
1297
- );
1411
+ const parsed = CreateOrderSchema.parse(params);
1412
+ const result = await client.commerce.orders.create(parsed);
1298
1413
  return toolSuccess({ data: result });
1299
1414
  } catch (error) {
1300
1415
  return toolError(error);
@@ -1302,10 +1417,10 @@ async function createOrder(params) {
1302
1417
  }
1303
1418
 
1304
1419
  // src/tools/update-order.ts
1305
- import { z as z7 } from "zod";
1420
+ import { z as z6 } from "zod";
1306
1421
  var schema5 = {
1307
- orderNumber: z7.string().min(1).describe("Order number (required)"),
1308
- status: z7.enum([
1422
+ orderNumber: z6.string().min(1).describe("Order number (required)"),
1423
+ status: z6.enum([
1309
1424
  "pending",
1310
1425
  "paid",
1311
1426
  "failed",
@@ -1342,15 +1457,15 @@ async function updateOrder({
1342
1457
  }
1343
1458
 
1344
1459
  // src/tools/checkout.ts
1345
- import { z as z8 } from "zod";
1460
+ import { z as z7 } from "zod";
1346
1461
  var schema6 = {
1347
- cartId: z8.string().min(1).describe("Cart ID to convert to order (required)"),
1348
- pgPaymentId: z8.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1349
- orderNumber: z8.string().min(1).describe("Unique order number (required)"),
1350
- customerSnapshot: z8.record(z8.string(), z8.unknown()).describe(
1462
+ cartId: z7.string().min(1).describe("Cart ID to convert to order (required)"),
1463
+ pgPaymentId: z7.string().optional().describe("PG payment ID (optional \u2014 omit for free orders)"),
1464
+ orderNumber: z7.string().min(1).describe("Unique order number (required)"),
1465
+ customerSnapshot: z7.record(z7.string(), z7.unknown()).describe(
1351
1466
  "Customer snapshot object (required). Fields: { name?, email, phone? }"
1352
1467
  ),
1353
- discountCode: z8.string().optional().describe("Discount code to apply (optional)")
1468
+ discountCode: z7.string().optional().describe("Discount code to apply (optional)")
1354
1469
  };
1355
1470
  var metadata6 = {
1356
1471
  name: "checkout",
@@ -1375,17 +1490,17 @@ async function checkout(params) {
1375
1490
  }
1376
1491
 
1377
1492
  // src/tools/create-fulfillment.ts
1378
- import { z as z9 } from "zod";
1493
+ import { z as z8 } from "zod";
1379
1494
  var schema7 = {
1380
- orderNumber: z9.string().min(1).describe("Order number (required)"),
1381
- carrier: z9.string().optional().describe("Shipping carrier name (optional)"),
1382
- trackingNumber: z9.string().optional().describe(
1495
+ orderNumber: z8.string().min(1).describe("Order number (required)"),
1496
+ carrier: z8.string().optional().describe("Shipping carrier name (optional)"),
1497
+ trackingNumber: z8.string().optional().describe(
1383
1498
  'Tracking number (optional). Setting carrier + tracking triggers "shipped" status'
1384
1499
  ),
1385
- items: z9.array(
1386
- z9.object({
1387
- orderItem: z9.string().min(1).describe("Order item ID"),
1388
- quantity: z9.number().int().positive().describe("Quantity to fulfill")
1500
+ items: z8.array(
1501
+ z8.object({
1502
+ orderItem: z8.string().min(1).describe("Order item ID"),
1503
+ quantity: z8.number().int().positive().describe("Quantity to fulfill")
1389
1504
  })
1390
1505
  ).describe("Array of items to fulfill (required)")
1391
1506
  };
@@ -1420,16 +1535,16 @@ async function createFulfillment({
1420
1535
  }
1421
1536
 
1422
1537
  // src/tools/update-fulfillment.ts
1423
- import { z as z10 } from "zod";
1538
+ import { z as z9 } from "zod";
1424
1539
  var schema8 = {
1425
- fulfillmentId: z10.string().min(1).describe("Fulfillment ID (required)"),
1426
- status: z10.enum(["packed", "shipped", "delivered", "failed"]).describe(
1540
+ fulfillmentId: z9.string().min(1).describe("Fulfillment ID (required)"),
1541
+ status: z9.enum(["packed", "shipped", "delivered", "failed"]).describe(
1427
1542
  "New fulfillment status (required). FSM: pending\u2192packed/shipped/failed, packed\u2192shipped/failed, shipped\u2192delivered/failed"
1428
1543
  ),
1429
- carrier: z10.string().optional().describe(
1544
+ carrier: z9.string().optional().describe(
1430
1545
  "Shipping carrier (optional, changeable only in pending/packed status)"
1431
1546
  ),
1432
- trackingNumber: z10.string().optional().describe(
1547
+ trackingNumber: z9.string().optional().describe(
1433
1548
  "Tracking number (optional, changeable only in pending/packed status)"
1434
1549
  )
1435
1550
  };
@@ -1500,21 +1615,44 @@ async function updateTransaction({
1500
1615
  }
1501
1616
  }
1502
1617
 
1618
+ // src/tools/confirm-payment.ts
1619
+ var schema10 = ConfirmPaymentSchema.shape;
1620
+ var metadata10 = {
1621
+ name: "confirm-payment",
1622
+ description: "Confirm a provider-verified ecommerce payment through the generic payment confirmation flow.",
1623
+ annotations: {
1624
+ title: "Confirm payment",
1625
+ readOnlyHint: false,
1626
+ destructiveHint: true,
1627
+ idempotentHint: true
1628
+ }
1629
+ };
1630
+ async function confirmPayment(params) {
1631
+ try {
1632
+ const client = getClient();
1633
+ const parsed = ConfirmPaymentSchema.parse(params);
1634
+ const result = await client.commerce.orders.confirmPayment(parsed);
1635
+ return toolSuccess({ data: result });
1636
+ } catch (error) {
1637
+ return toolError(error);
1638
+ }
1639
+ }
1640
+
1503
1641
  // src/tools/create-return.ts
1504
- import { z as z11 } from "zod";
1505
- var schema10 = {
1506
- orderNumber: z11.string().min(1).describe("Order number (required)"),
1507
- reason: z11.enum(["change_of_mind", "defective", "wrong_delivery", "damaged", "other"]).optional().describe("Return reason (optional)"),
1508
- reasonDetail: z11.string().optional().describe("Detailed reason text (optional)"),
1509
- returnItems: z11.array(
1510
- z11.object({
1511
- orderItem: z11.string().min(1).describe("Order item ID"),
1512
- quantity: z11.number().int().positive().describe("Quantity to return")
1642
+ import { z as z10 } from "zod";
1643
+ var schema11 = {
1644
+ orderNumber: z10.string().min(1).describe("Order number (required)"),
1645
+ reason: z10.enum(["change_of_mind", "defective", "wrong_delivery", "damaged", "other"]).optional().describe("Return reason (optional)"),
1646
+ reasonDetail: z10.string().optional().describe("Detailed reason text (optional)"),
1647
+ returnItems: z10.array(
1648
+ z10.object({
1649
+ orderItem: z10.string().min(1).describe("Order item ID"),
1650
+ quantity: z10.number().int().positive().describe("Quantity to return")
1513
1651
  })
1514
1652
  ).describe("Array of products to return (required)"),
1515
- refundAmount: z11.number().nonnegative().describe("Refund amount (required, min 0)")
1653
+ refundAmount: z10.number().nonnegative().describe("Refund amount (required, min 0)")
1516
1654
  };
1517
- var metadata10 = {
1655
+ var metadata11 = {
1518
1656
  name: "create-return",
1519
1657
  description: "Create a return request for an order. Only works for delivered/confirmed orders. Updates order status to return_requested.",
1520
1658
  annotations: {
@@ -1547,14 +1685,14 @@ async function createReturn({
1547
1685
  }
1548
1686
 
1549
1687
  // src/tools/update-return.ts
1550
- import { z as z12 } from "zod";
1551
- var schema11 = {
1552
- returnId: z12.string().min(1).describe("Return ID (required)"),
1553
- status: z12.enum(["processing", "approved", "rejected", "completed"]).describe(
1688
+ import { z as z11 } from "zod";
1689
+ var schema12 = {
1690
+ returnId: z11.string().min(1).describe("Return ID (required)"),
1691
+ status: z11.enum(["processing", "approved", "rejected", "completed"]).describe(
1554
1692
  "New return status (required). Valid transitions: requested\u2192processing/rejected, processing\u2192approved/rejected, approved\u2192completed"
1555
1693
  )
1556
1694
  };
1557
- var metadata11 = {
1695
+ var metadata12 = {
1558
1696
  name: "update-return",
1559
1697
  description: "Update return status with FSM validation. Restores inventory on completion, reverts order status on rejection.",
1560
1698
  annotations: {
@@ -1578,8 +1716,8 @@ async function updateReturn({
1578
1716
  }
1579
1717
 
1580
1718
  // src/tools/return-with-refund.ts
1581
- var schema12 = ReturnWithRefundSchema.shape;
1582
- var metadata12 = {
1719
+ var schema13 = ReturnWithRefundSchema.shape;
1720
+ var metadata13 = {
1583
1721
  name: "return-with-refund",
1584
1722
  description: "Combined return + refund operation. Creates return, restores stock, cancels transaction, updates order status.",
1585
1723
  annotations: {
@@ -1619,15 +1757,15 @@ async function returnWithRefund({
1619
1757
  }
1620
1758
 
1621
1759
  // src/tools/add-cart-item.ts
1622
- import { z as z13 } from "zod";
1623
- var schema13 = {
1624
- cartId: z13.string().min(1).describe("Cart ID (required)"),
1625
- product: z13.string().min(1).describe("Product ID (required)"),
1626
- variant: z13.string().min(1).describe("Product variant ID (required)"),
1627
- option: z13.string().min(1).describe("Product option ID (required)"),
1628
- quantity: z13.number().int().positive().describe("Quantity to add (required, positive integer)")
1760
+ import { z as z12 } from "zod";
1761
+ var schema14 = {
1762
+ cartId: z12.string().min(1).describe("Cart ID (required)"),
1763
+ product: z12.string().min(1).describe("Product ID (required)"),
1764
+ variant: z12.string().min(1).describe("Product variant ID (required)"),
1765
+ option: z12.string().min(1).describe("Product option ID (required)"),
1766
+ quantity: z12.number().int().positive().describe("Quantity to add (required, positive integer)")
1629
1767
  };
1630
- var metadata13 = {
1768
+ var metadata14 = {
1631
1769
  name: "add-cart-item",
1632
1770
  description: "Add a product to cart. Validates stock, merges quantity if item already exists, recalculates totals.",
1633
1771
  annotations: {
@@ -1660,12 +1798,12 @@ async function addCartItem({
1660
1798
  }
1661
1799
 
1662
1800
  // src/tools/update-cart-item.ts
1663
- import { z as z14 } from "zod";
1664
- var schema14 = {
1665
- cartItemId: z14.string().min(1).describe("Cart item ID (required)"),
1666
- quantity: z14.number().int().positive().describe("New quantity (required, positive integer)")
1801
+ import { z as z13 } from "zod";
1802
+ var schema15 = {
1803
+ cartItemId: z13.string().min(1).describe("Cart item ID (required)"),
1804
+ quantity: z13.number().int().positive().describe("New quantity (required, positive integer)")
1667
1805
  };
1668
- var metadata14 = {
1806
+ var metadata15 = {
1669
1807
  name: "update-cart-item",
1670
1808
  description: "Update cart item quantity. Validates stock availability, recalculates cart totals.",
1671
1809
  annotations: {
@@ -1689,11 +1827,11 @@ async function updateCartItem({
1689
1827
  }
1690
1828
 
1691
1829
  // src/tools/remove-cart-item.ts
1692
- import { z as z15 } from "zod";
1693
- var schema15 = {
1694
- cartItemId: z15.string().min(1).describe("Cart item ID to remove (required)")
1830
+ import { z as z14 } from "zod";
1831
+ var schema16 = {
1832
+ cartItemId: z14.string().min(1).describe("Cart item ID to remove (required)")
1695
1833
  };
1696
- var metadata15 = {
1834
+ var metadata16 = {
1697
1835
  name: "remove-cart-item",
1698
1836
  description: "Remove an item from cart. Recalculates cart totals after removal.",
1699
1837
  annotations: {
@@ -1716,12 +1854,12 @@ async function removeCartItem({
1716
1854
  }
1717
1855
 
1718
1856
  // src/tools/apply-discount.ts
1719
- import { z as z16 } from "zod";
1720
- var schema16 = {
1721
- cartId: z16.string().min(1).describe("Cart ID (required)"),
1722
- discountCode: z16.string().describe("Discount code to apply (required)")
1857
+ import { z as z15 } from "zod";
1858
+ var schema17 = {
1859
+ cartId: z15.string().min(1).describe("Cart ID (required)"),
1860
+ discountCode: z15.string().describe("Discount code to apply (required)")
1723
1861
  };
1724
- var metadata16 = {
1862
+ var metadata17 = {
1725
1863
  name: "apply-discount",
1726
1864
  description: "Apply a discount code to a cart. Validates the code, updates cart totals, and sets free shipping if applicable.",
1727
1865
  annotations: {
@@ -1745,11 +1883,11 @@ async function applyDiscount({
1745
1883
  }
1746
1884
 
1747
1885
  // src/tools/remove-discount.ts
1748
- import { z as z17 } from "zod";
1749
- var schema17 = {
1750
- cartId: z17.string().min(1).describe("Cart ID (required)")
1886
+ import { z as z16 } from "zod";
1887
+ var schema18 = {
1888
+ cartId: z16.string().min(1).describe("Cart ID (required)")
1751
1889
  };
1752
- var metadata17 = {
1890
+ var metadata18 = {
1753
1891
  name: "remove-discount",
1754
1892
  description: "Remove the applied discount code from a cart and recalculate totals.",
1755
1893
  annotations: {
@@ -1772,11 +1910,11 @@ async function removeDiscount({
1772
1910
  }
1773
1911
 
1774
1912
  // src/tools/clear-cart.ts
1775
- import { z as z18 } from "zod";
1776
- var schema18 = {
1777
- cartId: z18.string().min(1).describe("Cart ID (required)")
1913
+ import { z as z17 } from "zod";
1914
+ var schema19 = {
1915
+ cartId: z17.string().min(1).describe("Cart ID (required)")
1778
1916
  };
1779
- var metadata18 = {
1917
+ var metadata19 = {
1780
1918
  name: "clear-cart",
1781
1919
  description: "Remove all items from a cart, reset discount and amounts. Shipping fee is preserved.",
1782
1920
  annotations: {
@@ -1799,12 +1937,12 @@ async function clearCart({
1799
1937
  }
1800
1938
 
1801
1939
  // src/tools/validate-discount.ts
1802
- import { z as z19 } from "zod";
1803
- var schema19 = {
1804
- code: z19.string().describe("Discount code to validate (required)"),
1805
- orderAmount: z19.number().describe("Order amount for validation (required)")
1940
+ import { z as z18 } from "zod";
1941
+ var schema20 = {
1942
+ code: z18.string().describe("Discount code to validate (required)"),
1943
+ orderAmount: z18.number().describe("Order amount for validation (required)")
1806
1944
  };
1807
- var metadata19 = {
1945
+ var metadata20 = {
1808
1946
  name: "validate-discount",
1809
1947
  description: "Validate a discount code. Checks active status, date range, usage limits, minimum order amount, and calculates discount.",
1810
1948
  annotations: {
@@ -1831,13 +1969,13 @@ async function validateDiscount({
1831
1969
  }
1832
1970
 
1833
1971
  // src/tools/calculate-shipping.ts
1834
- import { z as z20 } from "zod";
1835
- var schema20 = {
1836
- shippingPolicyId: z20.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
1837
- orderAmount: z20.number().describe("Order amount for fee calculation (required)"),
1838
- postalCode: z20.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
1972
+ import { z as z19 } from "zod";
1973
+ var schema21 = {
1974
+ shippingPolicyId: z19.string().optional().describe("Shipping policy ID (uses default policy if omitted)"),
1975
+ orderAmount: z19.number().describe("Order amount for fee calculation (required)"),
1976
+ postalCode: z19.string().optional().describe("Postal code for Jeju surcharge detection (63000-63644)")
1839
1977
  };
1840
- var metadata20 = {
1978
+ var metadata21 = {
1841
1979
  name: "calculate-shipping",
1842
1980
  description: "Calculate shipping fee based on order amount and postal code. Supports free shipping threshold and Jeju surcharge.",
1843
1981
  annotations: {
@@ -1866,18 +2004,18 @@ async function calculateShipping({
1866
2004
  }
1867
2005
 
1868
2006
  // src/tools/stock-check.ts
1869
- import { z as z21 } from "zod";
1870
- var schema21 = {
1871
- items: z21.array(
1872
- z21.object({
1873
- variantId: z21.string().describe("Product variant ID"),
1874
- quantity: z21.number().int().positive().describe("Requested quantity")
2007
+ import { z as z20 } from "zod";
2008
+ var schema22 = {
2009
+ items: z20.array(
2010
+ z20.object({
2011
+ variantId: z20.string().describe("Product variant ID"),
2012
+ quantity: z20.number().int().positive().describe("Requested quantity")
1875
2013
  })
1876
2014
  ).describe(
1877
2015
  "Array of items to check stock for (required, max 100). Each: { variantId, quantity }"
1878
2016
  )
1879
2017
  };
1880
- var metadata21 = {
2018
+ var metadata22 = {
1881
2019
  name: "stock-check",
1882
2020
  description: "Batch check product option stock availability. Returns per-item availability and an allAvailable flag.",
1883
2021
  annotations: {
@@ -1900,12 +2038,12 @@ async function stockCheck({
1900
2038
  }
1901
2039
 
1902
2040
  // src/tools/product-detail.ts
1903
- import { z as z22 } from "zod";
1904
- var schema22 = {
1905
- slug: z22.string().optional().describe("Product slug (one of slug or id required)"),
1906
- id: z22.string().optional().describe("Product id (one of slug or id required)")
2041
+ import { z as z21 } from "zod";
2042
+ var schema23 = {
2043
+ slug: z21.string().optional().describe("Product slug (one of slug or id required)"),
2044
+ id: z21.string().optional().describe("Product id (one of slug or id required)")
1907
2045
  };
1908
- var metadata22 = {
2046
+ var metadata23 = {
1909
2047
  name: "product-detail",
1910
2048
  description: "Fetch full product detail by slug or id. Returns one resolver-ready product with variants, option slugs, option value slugs/media, brand, categories, tags, images, videos, and listing rollup, or null if missing/unpublished/wrong tenant/feature disabled.",
1911
2049
  annotations: {
@@ -1933,66 +2071,66 @@ async function productDetail({
1933
2071
  }
1934
2072
 
1935
2073
  // src/tools/product-upsert.ts
1936
- import { z as z23 } from "zod";
1937
- var optionValueSchema = z23.object({
1938
- id: z23.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
1939
- value: z23.string().describe("Display label (e.g. Black, S)"),
1940
- slug: z23.string().optional().describe(
2074
+ import { z as z22 } from "zod";
2075
+ var optionValueSchema = z22.object({
2076
+ id: z22.string().optional().describe("Stable existing option-value ID for rename-safe updates"),
2077
+ value: z22.string().describe("Display label (e.g. Black, S)"),
2078
+ slug: z22.string().optional().describe(
1941
2079
  "Optional compatibility value token. The server generates one from value on create when omitted; not canonical identity."
1942
2080
  ),
1943
- swatchColor: z23.string().nullable().optional(),
1944
- thumbnail: z23.string().nullable().optional(),
1945
- images: z23.array(z23.string()).optional(),
1946
- metadata: z23.unknown().optional()
2081
+ swatchColor: z22.string().nullable().optional(),
2082
+ thumbnail: z22.string().nullable().optional(),
2083
+ images: z22.array(z22.string()).optional(),
2084
+ metadata: z22.unknown().optional()
1947
2085
  });
1948
- var optionSchema = z23.object({
1949
- id: z23.string().optional().describe("Stable existing option ID for rename-safe updates"),
1950
- title: z23.string().describe("Option name (e.g. Color, Size)"),
1951
- slug: z23.string().optional().describe(
2086
+ var optionSchema = z22.object({
2087
+ id: z22.string().optional().describe("Stable existing option ID for rename-safe updates"),
2088
+ title: z22.string().describe("Option name (e.g. Color, Size)"),
2089
+ slug: z22.string().optional().describe(
1952
2090
  "Optional compatibility option token. The server generates one from title on create when omitted; not canonical identity."
1953
2091
  ),
1954
- values: z23.array(optionValueSchema).describe("Allowed option values")
2092
+ values: z22.array(optionValueSchema).describe("Allowed option values")
1955
2093
  });
1956
- var variantOptionValueSchema = z23.object({
1957
- valueSlug: z23.string().optional(),
1958
- valueId: z23.string().optional(),
1959
- value: z23.string().optional()
2094
+ var variantOptionValueSchema = z22.object({
2095
+ valueSlug: z22.string().optional(),
2096
+ valueId: z22.string().optional(),
2097
+ value: z22.string().optional()
1960
2098
  });
1961
- var variantSchema = z23.object({
1962
- id: z23.string().optional().describe("Existing variant ID for updates"),
1963
- optionValues: z23.union([
1964
- z23.record(z23.string(), z23.union([z23.string(), variantOptionValueSchema])),
1965
- z23.array(z23.string())
2099
+ var variantSchema = z22.object({
2100
+ id: z22.string().optional().describe("Existing variant ID for updates"),
2101
+ optionValues: z22.union([
2102
+ z22.record(z22.string(), z22.union([z22.string(), variantOptionValueSchema])),
2103
+ z22.array(z22.string())
1966
2104
  ]).optional().describe(
1967
2105
  "Option-value selection. Prefer stable option-value IDs, either as an array or object values using { valueId }. Slug maps and exact { OptionTitle: ValueLabel } maps remain compatibility-only and fail when labels are ambiguous."
1968
2106
  ),
1969
- sku: z23.string().nullable().optional(),
1970
- title: z23.string().nullable().optional(),
1971
- price: z23.number().nonnegative().describe("Selling price (KRW, min 0)"),
1972
- compareAtPrice: z23.number().nonnegative().nullable().optional(),
1973
- stock: z23.number().int().nonnegative().optional(),
1974
- isUnlimited: z23.boolean().optional(),
1975
- weight: z23.number().nonnegative().nullable().optional(),
1976
- requiresShipping: z23.boolean().optional(),
1977
- barcode: z23.string().nullable().optional(),
1978
- externalId: z23.string().nullable().optional(),
1979
- isActive: z23.boolean().optional(),
1980
- thumbnail: z23.string().nullable().optional(),
1981
- images: z23.array(z23.string()).optional(),
1982
- metadata: z23.unknown().optional()
2107
+ sku: z22.string().nullable().optional(),
2108
+ title: z22.string().nullable().optional(),
2109
+ price: z22.number().nonnegative().describe("Selling price (KRW, min 0)"),
2110
+ compareAtPrice: z22.number().nonnegative().nullable().optional(),
2111
+ stock: z22.number().int().nonnegative().optional(),
2112
+ isUnlimited: z22.boolean().optional(),
2113
+ weight: z22.number().nonnegative().nullable().optional(),
2114
+ requiresShipping: z22.boolean().optional(),
2115
+ barcode: z22.string().nullable().optional(),
2116
+ externalId: z22.string().nullable().optional(),
2117
+ isActive: z22.boolean().optional(),
2118
+ thumbnail: z22.string().nullable().optional(),
2119
+ images: z22.array(z22.string()).optional(),
2120
+ metadata: z22.unknown().optional()
1983
2121
  });
1984
- var schema23 = {
1985
- product: z23.record(z23.string(), z23.unknown()).describe(
2122
+ var schema24 = {
2123
+ product: z22.record(z22.string(), z22.unknown()).describe(
1986
2124
  "Product fields. Include `id` to update an existing product; omit for create (then `title` is required)."
1987
2125
  ),
1988
- options: z23.array(optionSchema).optional().describe(
2126
+ options: z22.array(optionSchema).optional().describe(
1989
2127
  "Option definitions. Include stable option/value IDs when updating or renaming existing rows. Slugs are optional compatibility metadata generated from title/value on create when omitted; omitted options on an existing product are deleted (with their values)."
1990
2128
  ),
1991
- variants: z23.array(variantSchema).optional().describe(
2129
+ variants: z22.array(variantSchema).optional().describe(
1992
2130
  "Variant rows. Prefer stable option-value IDs in optionValues. Slug/title maps are compatibility inputs. Omitted variants on an existing product are deleted, unless referenced by an active cart or non-terminal order \u2014 those are soft-deactivated (isActive: false)."
1993
2131
  )
1994
2132
  };
1995
- var metadata23 = {
2133
+ var metadata24 = {
1996
2134
  name: "product-upsert",
1997
2135
  description: "Atomically create or update a product together with its options, option-values, and variants in a single transaction. Mirrors Shopify productSet semantics. Any failure rolls back the entire write.",
1998
2136
  annotations: {
@@ -2029,8 +2167,8 @@ async function getCollectionSchema(collection) {
2029
2167
  }
2030
2168
 
2031
2169
  // src/tools/get-collection-schema.ts
2032
- var schema24 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2033
- var metadata24 = {
2170
+ var schema25 = createCollectionSchemaToolInputSchema(SERVER_COLLECTIONS3).shape;
2171
+ var metadata25 = {
2034
2172
  name: "get-collection-schema",
2035
2173
  description: "Get the authoritative tenant-aware collection schema from console. Use this before create/update to understand writable fields, hidden fields, required metadata, and collection-level visibility.",
2036
2174
  annotations: {
@@ -2081,8 +2219,8 @@ async function getTenantFeatureProgress(feature, includeEvidence = false) {
2081
2219
  }
2082
2220
 
2083
2221
  // src/tools/get-tenant-context.ts
2084
- var schema25 = tenantContextToolInputSchema.shape;
2085
- var metadata25 = {
2222
+ var schema26 = tenantContextToolInputSchema.shape;
2223
+ var metadata26 = {
2086
2224
  name: "get-tenant-context",
2087
2225
  description: "Get current tenant features, active collections, and field visibility. Call this at the start of every session. Use includeCounts=true to also get per-collection document counts for setup diagnostics.",
2088
2226
  annotations: {
@@ -2159,8 +2297,8 @@ async function handler({
2159
2297
  }
2160
2298
 
2161
2299
  // src/tools/check-feature-progress.ts
2162
- var schema26 = tenantFeatureProgressInputSchema.shape;
2163
- var metadata26 = {
2300
+ var schema27 = tenantFeatureProgressInputSchema.shape;
2301
+ var metadata27 = {
2164
2302
  name: "check-feature-progress",
2165
2303
  description: "Check tenant implementation progress for a supported feature. Start with feature=ecommerce to inspect catalog, cart, checkout, payment result, webhook, and operations readiness without mutating tenant data.",
2166
2304
  annotations: {
@@ -2183,7 +2321,7 @@ async function handler2({
2183
2321
  }
2184
2322
 
2185
2323
  // src/tools/list-configurable-fields.ts
2186
- import { z as z24 } from "zod";
2324
+ import { z as z23 } from "zod";
2187
2325
 
2188
2326
  // src/lib/field-config.ts
2189
2327
  async function fetchFieldConfigs() {
@@ -2206,12 +2344,12 @@ function invalidateFieldConfigCache() {
2206
2344
  }
2207
2345
 
2208
2346
  // src/tools/list-configurable-fields.ts
2209
- var schema27 = {
2210
- collection: z24.string().optional().describe(
2347
+ var schema28 = {
2348
+ collection: z23.string().optional().describe(
2211
2349
  "Filter by collection slug (optional \u2014 returns all if omitted). Use this filter to reduce response size when you know which collection to check."
2212
2350
  )
2213
2351
  };
2214
- var metadata27 = {
2352
+ var metadata28 = {
2215
2353
  name: "list-configurable-fields",
2216
2354
  description: "List all configurable fields for tenant collections with current visibility state. Shows which fields can be shown/hidden and their current status. Returns all collections including inactive features \u2014 cross-reference with get-tenant-context for active features. Response includes ~300 fields across 47 collections \u2014 use collection filter when possible.",
2217
2355
  annotations: {
@@ -2242,17 +2380,17 @@ async function listConfigurableFields(params) {
2242
2380
  }
2243
2381
 
2244
2382
  // src/tools/update-field-config.ts
2245
- import { z as z25 } from "zod";
2246
- var schema28 = {
2247
- collection: z25.string().min(1).describe("Collection slug (required)"),
2248
- hiddenFields: z25.array(z25.string().min(1).max(200)).max(300).describe(
2383
+ import { z as z24 } from "zod";
2384
+ var schema29 = {
2385
+ collection: z24.string().min(1).describe("Collection slug (required)"),
2386
+ hiddenFields: z24.array(z24.string().min(1).max(200)).max(300).describe(
2249
2387
  "Fields to hide (required). This is a FULL REPLACE \u2014 fields NOT in this list will be shown. Pass [] to show all fields. Use list-configurable-fields first to see available field paths."
2250
2388
  ),
2251
- isHidden: z25.boolean().optional().describe(
2389
+ isHidden: z24.boolean().optional().describe(
2252
2390
  "Hide the entire collection from Admin Panel (optional). When true, individual hiddenFields are irrelevant."
2253
2391
  )
2254
2392
  };
2255
- var metadata28 = {
2393
+ var metadata29 = {
2256
2394
  name: "update-field-config",
2257
2395
  description: "Update field visibility configuration for a tenant collection. Hidden fields are removed from the Admin Panel UI. IMPORTANT: hiddenFields is a full replace, not a merge. Always call list-configurable-fields first to see current state.",
2258
2396
  annotations: {
@@ -2280,7 +2418,7 @@ async function updateFieldConfig(params) {
2280
2418
  }
2281
2419
 
2282
2420
  // src/tools/sdk-get-recipe.ts
2283
- import { z as z26 } from "zod";
2421
+ import { z as z25 } from "zod";
2284
2422
 
2285
2423
  // src/lib/sdk-recipes.ts
2286
2424
  var recipes = {
@@ -2721,8 +2859,8 @@ function getRecipe(goal, runtime = "both") {
2721
2859
  }
2722
2860
 
2723
2861
  // src/tools/sdk-get-recipe.ts
2724
- var schema29 = {
2725
- goal: z26.enum([
2862
+ var schema30 = {
2863
+ goal: z25.enum([
2726
2864
  "fetch-list",
2727
2865
  "fetch-by-id",
2728
2866
  "create-item",
@@ -2734,11 +2872,11 @@ var schema29 = {
2734
2872
  "file-upload",
2735
2873
  "bulk-operations"
2736
2874
  ]).describe("What the user wants to accomplish"),
2737
- runtime: z26.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2738
- collection: z26.string().optional().describe("Specific collection name if applicable"),
2739
- includeExample: z26.boolean().default(true).describe("Whether to include a full code example")
2875
+ runtime: z25.enum(["browser", "server", "both"]).default("both").describe("Target runtime environment"),
2876
+ collection: z25.string().optional().describe("Specific collection name if applicable"),
2877
+ includeExample: z25.boolean().default(true).describe("Whether to include a full code example")
2740
2878
  };
2741
- var metadata29 = {
2879
+ var metadata30 = {
2742
2880
  name: "sdk-get-recipe",
2743
2881
  description: "Get a complete SDK code recipe for a specific task. Returns recommended approach, code example, and related documentation links. Use this FIRST when the user asks how to do something with the SDK.",
2744
2882
  annotations: {
@@ -2781,7 +2919,7 @@ function handler3({
2781
2919
  }
2782
2920
 
2783
2921
  // src/tools/sdk-search-docs.ts
2784
- import { z as z27 } from "zod";
2922
+ import { z as z26 } from "zod";
2785
2923
 
2786
2924
  // src/lib/sdk-doc-index.ts
2787
2925
  var docIndex = [
@@ -2909,8 +3047,19 @@ var docIndex = [
2909
3047
  // Webhooks
2910
3048
  {
2911
3049
  title: "Webhooks",
2912
- keywords: ["webhook", "hmac", "signature", "WEBHOOK_SECRET", "server-to-server", "event"],
2913
- summary: "Tenant webhooks deliver server-to-server events such as password reset tokens. Signed with HMAC-SHA256 using PAYLOAD_SECRET.",
3050
+ keywords: [
3051
+ "webhook",
3052
+ "hmac",
3053
+ "signature",
3054
+ "WEBHOOK_SECRET",
3055
+ "server-to-server",
3056
+ "event",
3057
+ "order",
3058
+ "orderChanged",
3059
+ "collection.orderChanged",
3060
+ "isOrderChangedWebhookEvent"
3061
+ ],
3062
+ summary: "Tenant webhooks deliver signed server-to-server events via WEBHOOK_SECRET, including customer password reset and semantic order changes with collection.orderChanged / isOrderChangedWebhookEvent.",
2914
3063
  resourceUri: "docs://sdk/webhook"
2915
3064
  },
2916
3065
  // Order API
@@ -2956,11 +3105,11 @@ function searchDocs(query, limit = 5) {
2956
3105
  }
2957
3106
 
2958
3107
  // src/tools/sdk-search-docs.ts
2959
- var schema30 = {
2960
- query: z27.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
2961
- limit: z27.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
3108
+ var schema31 = {
3109
+ query: z26.string().min(2).describe('Search keyword or phrase (e.g. "infinite scroll", "webhook", "customer login")'),
3110
+ limit: z26.number().min(1).max(10).default(5).describe("Maximum results to return (1-10, default: 5)")
2962
3111
  };
2963
- var metadata30 = {
3112
+ var metadata31 = {
2964
3113
  name: "sdk-search-docs",
2965
3114
  description: "Search SDK documentation by keyword. Returns matching topics with summaries and resource links. Use when looking for specific SDK features or patterns.",
2966
3115
  annotations: {
@@ -2995,9 +3144,9 @@ function handler4({
2995
3144
  }
2996
3145
 
2997
3146
  // src/tools/sdk-get-auth-setup.ts
2998
- import { z as z28 } from "zod";
2999
- var schema31 = {
3000
- scenario: z28.enum([
3147
+ import { z as z27 } from "zod";
3148
+ var schema32 = {
3149
+ scenario: z27.enum([
3001
3150
  "browser-client",
3002
3151
  "server-client",
3003
3152
  "customer-auth",
@@ -3006,7 +3155,7 @@ var schema31 = {
3006
3155
  "webhook-verification"
3007
3156
  ]).describe("Authentication scenario")
3008
3157
  };
3009
- var metadata31 = {
3158
+ var metadata32 = {
3010
3159
  name: "sdk-get-auth-setup",
3011
3160
  description: "Get the current authentication setup for a specific scenario. Returns env var names, code snippets, and security notes.",
3012
3161
  annotations: {
@@ -3130,13 +3279,19 @@ export SOFTWARE_SECRET_KEY=sk01_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx`,
3130
3279
  envVars: ["WEBHOOK_SECRET"],
3131
3280
  code: `import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
3132
3281
 
3282
+ function getWebhookSecret(): string {
3283
+ const secret = process.env.WEBHOOK_SECRET
3284
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
3285
+ return secret
3286
+ }
3287
+
3133
3288
  const customerAuthHandler = createCustomerAuthWebhookHandler({
3134
3289
  passwordReset: sendPasswordResetEmail,
3135
3290
  })
3136
3291
 
3137
3292
  export async function POST(request: Request) {
3138
3293
  return handleWebhook(request, customerAuthHandler, {
3139
- secret: process.env.WEBHOOK_SECRET!,
3294
+ secret: getWebhookSecret(),
3140
3295
  })
3141
3296
  }`,
3142
3297
  notes: [
@@ -3162,14 +3317,14 @@ function handler5({
3162
3317
  }
3163
3318
 
3164
3319
  // src/tools/sdk-get-collection-pattern.ts
3165
- import { z as z29 } from "zod";
3320
+ import { z as z28 } from "zod";
3166
3321
  import { COLLECTIONS, SERVER_COLLECTIONS as SERVER_COLLECTIONS4 } from "@01.software/sdk";
3167
- var schema32 = {
3168
- collection: z29.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3169
- operation: z29.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3170
- surface: z29.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3322
+ var schema33 = {
3323
+ collection: z28.enum(SERVER_COLLECTIONS4).describe("Collection name"),
3324
+ operation: z28.enum(["read", "write", "full-crud"]).default("read").describe("What operations are needed"),
3325
+ surface: z28.enum(["query-builder", "react-query", "server-api"]).default("query-builder").describe("Preferred API surface")
3171
3326
  };
3172
- var metadata32 = {
3327
+ var metadata33 = {
3173
3328
  name: "sdk-get-collection-pattern",
3174
3329
  description: "Get the recommended CRUD pattern for a specific collection. Returns code examples for the chosen API surface and operation type.",
3175
3330
  annotations: {
@@ -3365,14 +3520,14 @@ function handler6({
3365
3520
  }
3366
3521
 
3367
3522
  // src/prompts/sdk-usage-guide.ts
3368
- import { z as z30 } from "zod";
3369
- var schema33 = {
3370
- goal: z30.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3371
- runtime: z30.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3372
- surface: z30.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3373
- collection: z30.string().optional().describe("Specific collection if relevant")
3523
+ import { z as z29 } from "zod";
3524
+ var schema34 = {
3525
+ goal: z29.string().describe('What the user wants to accomplish (e.g., "query product list", "create order")'),
3526
+ runtime: z29.enum(["browser", "server"]).optional().describe("Target runtime: browser (React/Next.js client) or server (Node.js)"),
3527
+ surface: z29.enum(["query-builder", "react-query", "customer-api", "server-api"]).optional().describe("Preferred API surface"),
3528
+ collection: z29.string().optional().describe("Specific collection if relevant")
3374
3529
  };
3375
- var metadata33 = {
3530
+ var metadata34 = {
3376
3531
  name: "sdk-usage-guide",
3377
3532
  title: "SDK Usage Guide",
3378
3533
  description: "Provides guidance on how to perform a specific task using the 01.software SDK",
@@ -3543,14 +3698,14 @@ const { allAvailable } = await client.commerce.product.stockCheck({
3543
3698
  }
3544
3699
 
3545
3700
  // src/prompts/collection-query-help.ts
3546
- import { z as z31 } from "zod";
3701
+ import { z as z30 } from "zod";
3547
3702
  import { COLLECTIONS as COLLECTIONS2, SERVER_COLLECTIONS as SERVER_COLLECTIONS5 } from "@01.software/sdk";
3548
- var schema34 = {
3549
- collection: z31.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3550
- operation: z31.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3551
- filters: z31.string().optional().describe("Filter conditions (JSON string, optional)")
3703
+ var schema35 = {
3704
+ collection: z30.enum(SERVER_COLLECTIONS5).describe("Collection name"),
3705
+ operation: z30.enum(["find", "create", "update", "delete"]).describe("Operation to perform (find, create, update, delete)"),
3706
+ filters: z30.string().optional().describe("Filter conditions (JSON string, optional)")
3552
3707
  };
3553
- var metadata34 = {
3708
+ var metadata35 = {
3554
3709
  name: "collection-query-help",
3555
3710
  title: "Collection Query Help",
3556
3711
  description: "Provides guidance on how to write queries for a specific collection",
@@ -3647,16 +3802,16 @@ ${operation === "find" ? `- Use \`where\` option for filtering (Payload query sy
3647
3802
  }
3648
3803
 
3649
3804
  // src/prompts/order-flow-guide.ts
3650
- import { z as z32 } from "zod";
3651
- var schema35 = {
3652
- scenario: z32.enum([
3805
+ import { z as z31 } from "zod";
3806
+ var schema36 = {
3807
+ scenario: z31.enum([
3653
3808
  "simple-order",
3654
3809
  "cart-checkout",
3655
3810
  "return-refund",
3656
3811
  "fulfillment-tracking"
3657
3812
  ]).describe("Order flow scenario")
3658
3813
  };
3659
- var metadata35 = {
3814
+ var metadata36 = {
3660
3815
  name: "order-flow-guide",
3661
3816
  title: "Order Flow Guide",
3662
3817
  description: "Provides step-by-step guidance for ecommerce order flows including creation, checkout, returns, and fulfillment.",
@@ -3671,9 +3826,10 @@ var SCENARIOS = {
3671
3826
  - Provide: orderNumber, customerSnapshot (email required), shippingAddress, orderItems, totalAmount
3672
3827
  - Optional: pgPaymentId (omit for free orders), shippingAmount, discountCode
3673
3828
 
3674
- 2. **Payment Confirmation** \u2192 \`update-transaction\` tool
3675
- - Confirm provider payment with pgPaymentId, paymentKey, and amount
3676
- - Stock is automatically adjusted (stock -= qty, reservedStock += qty)
3829
+ 2. **Payment Confirmation** \u2192 ServerClient \`commerce.orders.confirmPayment()\`
3830
+ - Confirm provider payment with pgPaymentId, provider name, and amount
3831
+ - Successful confirmation transitions the order to \`paid\`
3832
+ - Paid orders reserve sellable quantity (reservedStock += qty); physical stock is decremented on delivery
3677
3833
 
3678
3834
  3. **Fulfillment** \u2192 \`create-fulfillment\` tool
3679
3835
  - Provide carrier + trackingNumber for shipped status
@@ -3693,18 +3849,20 @@ const client = createServerClient({
3693
3849
  const order = await client.commerce.orders.create({
3694
3850
  orderNumber: 'ORD-240101-001',
3695
3851
  customerSnapshot: { email: 'user@example.com', name: 'John' },
3696
- shippingAddress: { postalCode: '06000', address1: '123 Main St' },
3852
+ shippingAddress: { postalCode: '06000', address: '123 Main St' },
3697
3853
  orderItems: [{ product: 'prod-id', variant: 'var-id', option: 'opt-id', quantity: 2 }],
3698
3854
  totalAmount: 59800,
3699
3855
  pgPaymentId: 'pay_xxx' // omit for free orders
3700
3856
  })
3701
3857
 
3702
3858
  // 2. After payment confirmed by provider
3703
- await client.commerce.orders.updateTransaction({
3859
+ await client.commerce.orders.confirmPayment({
3860
+ orderNumber: 'ORD-240101-001',
3704
3861
  pgPaymentId: 'pay_xxx',
3705
- status: 'paid',
3706
- paymentKey: 'payment_key_xxx',
3707
- amount: 59800
3862
+ pgProvider: 'provider',
3863
+ amount: 59800,
3864
+ paymentMethod: 'card',
3865
+ confirmationSource: 'provider_api_confirm'
3708
3866
  })
3709
3867
 
3710
3868
  // 3. Ship items
@@ -3723,7 +3881,7 @@ await client.commerce.orders.createFulfillment({
3723
3881
  2. **Apply Discount** (optional) \u2192 \`apply-discount\` tool
3724
3882
  3. **Calculate Shipping** \u2192 \`calculate-shipping\` tool
3725
3883
  4. **Checkout** \u2192 \`checkout\` tool (converts cart to order)
3726
- 5. **Payment** \u2192 \`update-transaction\` for provider-verified paid transitions
3884
+ 5. **Payment** \u2192 ServerClient \`commerce.orders.confirmPayment()\` for provider-verified paid transitions
3727
3885
 
3728
3886
  ### Key Points
3729
3887
  - Cart has a customer linked \u2014 auto-copied to order on checkout
@@ -3836,14 +3994,14 @@ ${SCENARIOS[scenario] || "Unknown scenario."}
3836
3994
  - \`checkout\`
3837
3995
  - \`create-fulfillment\`, \`update-fulfillment\`
3838
3996
  - \`create-return\`, \`update-return\`, \`return-with-refund\`
3839
- - \`update-transaction\`
3997
+ - \`confirm-payment\`, \`update-transaction\`
3840
3998
  - \`validate-discount\`, \`calculate-shipping\``;
3841
3999
  }
3842
4000
 
3843
4001
  // src/prompts/feature-setup-guide.ts
3844
- import { z as z33 } from "zod";
3845
- var schema36 = {
3846
- feature: z33.enum([
4002
+ import { z as z32 } from "zod";
4003
+ var schema37 = {
4004
+ feature: z32.enum([
3847
4005
  "ecommerce",
3848
4006
  "customers",
3849
4007
  "articles",
@@ -3858,7 +4016,7 @@ var schema36 = {
3858
4016
  "community"
3859
4017
  ]).describe("Feature to get setup guide for")
3860
4018
  };
3861
- var metadata36 = {
4019
+ var metadata37 = {
3862
4020
  name: "feature-setup-guide",
3863
4021
  title: "Feature Setup Guide",
3864
4022
  description: "Setup checklist and remediation guide for a tenant feature. Load with check-feature-progress and get-tenant-context to diagnose setup gaps.",
@@ -3907,7 +4065,6 @@ customer-addresses
3907
4065
  ### Optional Collections
3908
4066
 
3909
4067
  - customer-groups \u2014 Console/server-scoped segmentation for VIP coupons and campaigns. Use \`createServerClient().collections.from('customer-groups')\`.
3910
- - customer-profile-lists \u2014 Public profile display/ranking lists for storefronts. Browser reads may use \`client.collections.from('customer-profile-lists')\`.
3911
4068
 
3912
4069
  ### Config
3913
4070
 
@@ -4048,7 +4205,9 @@ comments, reactions, bookmarks, reports, community-bans
4048
4205
 
4049
4206
  ### Optional Collections
4050
4207
 
4051
- post-categories, customer-profile-lists`
4208
+ post-categories, customer-profile-lists
4209
+
4210
+ - \`customer-profile-lists\` is Community-owned public profile curation. It composes \`customer-profiles\`, so effective Community access also requires Customers.`
4052
4211
  };
4053
4212
  function featureSetupGuide({
4054
4213
  feature
@@ -4065,7 +4224,7 @@ ${FEATURES[feature] || "Unknown feature."}
4065
4224
  }
4066
4225
 
4067
4226
  // src/resources/(config)/app.ts
4068
- var metadata37 = {
4227
+ var metadata38 = {
4069
4228
  name: "app-config",
4070
4229
  title: "Application Config",
4071
4230
  description: "01.software SDK and MCP server configuration information"
@@ -4109,7 +4268,7 @@ The hosted HTTP MCP endpoint at https://mcp.01.software/mcp exposes only these O
4109
4268
  - \`sdk-get-auth-setup\` - Get framework-specific auth setup guidance
4110
4269
  - \`sdk-get-collection-pattern\` - Get collection-specific usage patterns
4111
4270
 
4112
- ## Local CLI Stdio Surface (30)
4271
+ ## Local CLI Stdio Surface (33)
4113
4272
 
4114
4273
  For trusted local server-key workflows, start the stdio server:
4115
4274
 
@@ -4117,7 +4276,7 @@ For trusted local server-key workflows, start the stdio server:
4117
4276
  npx @01.software/cli mcp
4118
4277
  \`\`\`
4119
4278
 
4120
- Local stdio can expose generic read, order, return, cart, validation, stock, schema, tenant context, feature progress, field config, and guidance tools. Generic collection write tools (create/update/delete/update-many/delete-many) are intentionally absent on every transport; use the SDK server client for generic writes.
4279
+ Local stdio can expose generic read, order, payment confirmation, return, cart, validation, stock, schema, tenant context, feature progress, field config, and guidance tools. Generic collection write tools (create/update/delete/update-many/delete-many) are intentionally absent on every transport; use the SDK server client for generic writes.
4121
4280
 
4122
4281
  ## Rate Limits
4123
4282
 
@@ -4131,7 +4290,7 @@ Rate limits depend on your tenant plan:
4131
4290
 
4132
4291
  // src/resources/(collections)/schema.ts
4133
4292
  import { COLLECTIONS as COLLECTIONS3 } from "@01.software/sdk";
4134
- var metadata38 = {
4293
+ var metadata39 = {
4135
4294
  name: "collections-schema",
4136
4295
  title: "Collection Schema Info",
4137
4296
  description: "Available collections and their schema information"
@@ -4161,12 +4320,7 @@ var COLLECTIONS_BY_CATEGORY = {
4161
4320
  "shipping-policies",
4162
4321
  "shipping-zones"
4163
4322
  ],
4164
- Customers: [
4165
- "customers",
4166
- "customer-profiles",
4167
- "customer-profile-lists",
4168
- "customer-addresses"
4169
- ],
4323
+ Customers: ["customers", "customer-profiles", "customer-addresses"],
4170
4324
  Carts: ["carts", "cart-items"],
4171
4325
  Discounts: ["discounts"],
4172
4326
  Documents: ["documents", "document-categories", "document-types"],
@@ -4182,7 +4336,8 @@ var COLLECTIONS_BY_CATEGORY = {
4182
4336
  "reactions",
4183
4337
  "reaction-types",
4184
4338
  "bookmarks",
4185
- "post-categories"
4339
+ "post-categories",
4340
+ "customer-profile-lists"
4186
4341
  ],
4187
4342
  Playlists: [
4188
4343
  "playlists",
@@ -4272,7 +4427,7 @@ Total available collections: ${COLLECTIONS3.length}`;
4272
4427
  }
4273
4428
 
4274
4429
  // src/resources/(docs)/getting-started.ts
4275
- var metadata39 = {
4430
+ var metadata40 = {
4276
4431
  name: "docs-getting-started",
4277
4432
  title: "Getting Started",
4278
4433
  description: "01.software SDK getting started guide"
@@ -4333,7 +4488,7 @@ const result = await client.collections.from('products').find({
4333
4488
  }
4334
4489
 
4335
4490
  // src/resources/(docs)/guides.ts
4336
- var metadata40 = {
4491
+ var metadata41 = {
4337
4492
  name: "docs-guides",
4338
4493
  title: "Guides",
4339
4494
  description: "01.software SDK usage guides"
@@ -4546,7 +4701,7 @@ For more implementation guidance, see the [SDK Guide](/developers/sdk).`;
4546
4701
  }
4547
4702
 
4548
4703
  // src/resources/(docs)/api.ts
4549
- var metadata41 = {
4704
+ var metadata42 = {
4550
4705
  name: "docs-api",
4551
4706
  title: "API Reference",
4552
4707
  description: "01.software SDK API reference documentation"
@@ -4829,7 +4984,7 @@ For more details, see the [API documentation](/developers/api).`;
4829
4984
  }
4830
4985
 
4831
4986
  // src/resources/(docs)/query-builder.ts
4832
- var metadata42 = {
4987
+ var metadata43 = {
4833
4988
  name: "docs-query-builder",
4834
4989
  title: "Query Builder",
4835
4990
  description: "01.software SDK Query Builder API reference (client.collections.from)"
@@ -5023,7 +5178,7 @@ console.log(result.hasNextPage) // true
5023
5178
  }
5024
5179
 
5025
5180
  // src/resources/(docs)/react-query.ts
5026
- var metadata43 = {
5181
+ var metadata44 = {
5027
5182
  name: "docs-react-query",
5028
5183
  title: "React Query Hooks",
5029
5184
  description: "01.software SDK React Query hooks reference (@01.software/sdk/query)"
@@ -5255,7 +5410,7 @@ export function ProductList() {
5255
5410
  }
5256
5411
 
5257
5412
  // src/resources/(docs)/server-api.ts
5258
- var metadata44 = {
5413
+ var metadata45 = {
5259
5414
  name: "docs-server-api",
5260
5415
  title: "Server-side API",
5261
5416
  description: "01.software SDK server-side API reference (client.commerce) for orders, fulfillments, returns, carts, and validation"
@@ -5293,16 +5448,16 @@ const order = await client.commerce.orders.create({
5293
5448
  recipientName: 'John Doe',
5294
5449
  phone: '+821012345678',
5295
5450
  postalCode: '06234',
5296
- address1: '123 Main St',
5297
- address2: 'Apt 4B',
5451
+ address: '123 Main St',
5452
+ detailAddress: 'Apt 4B',
5298
5453
  deliveryMessage?: 'Leave at door',
5299
5454
  },
5300
5455
  orderItems: [
5301
- { product: 'product-id', variant: 'variant-id', option: 'option-id', quantity: 2, unitPrice: 29900 }
5456
+ { product: 'product-id', variant: 'variant-id', option: 'option-id', quantity: 2 }
5302
5457
  ],
5303
5458
  totalAmount: 59800,
5304
5459
  shippingAmount?: 3000,
5305
- pgPaymentId?: 'toss-payment-id', // omit for free orders
5460
+ pgPaymentId?: 'provider-payment-id', // omit for free orders
5306
5461
  })
5307
5462
  \`\`\`
5308
5463
 
@@ -5314,7 +5469,7 @@ const order = await client.commerce.orders.checkout({
5314
5469
  cartId: 'cart-id',
5315
5470
  orderNumber: 'ORD-20240101-0001',
5316
5471
  customerSnapshot: { name: 'John Doe', email: 'john@example.com' },
5317
- pgPaymentId?: 'toss-payment-id',
5472
+ pgPaymentId?: 'provider-payment-id',
5318
5473
  })
5319
5474
  \`\`\`
5320
5475
 
@@ -5407,24 +5562,45 @@ const result = await client.commerce.orders.returnWithRefund({
5407
5562
  { orderItem: 'order-item-id', quantity: 1 }
5408
5563
  ],
5409
5564
  refundAmount: 29900,
5410
- pgPaymentId: 'toss-payment-id', // required
5411
- paymentKey: 'toss-payment-key', // required for provider refund
5565
+ pgPaymentId: 'provider-payment-id', // required
5566
+ paymentKey: 'provider-payment-key', // required for provider refund
5412
5567
  refundReceiptUrl?: 'https://...',
5413
5568
  })
5414
5569
  \`\`\`
5415
5570
 
5416
5571
  ## Transaction API
5417
5572
 
5573
+ ### confirmPayment()
5574
+ Confirm a provider-verified payment and transition the order to paid. Verify the
5575
+ payment with the provider first, then call this endpoint with the provider name,
5576
+ amount, and an idempotency event ID when available.
5577
+
5578
+ \`\`\`typescript
5579
+ const result = await client.commerce.orders.confirmPayment({
5580
+ orderNumber: 'ORD-20240101-0001',
5581
+ pgPaymentId: 'provider-payment-id',
5582
+ pgProvider: 'provider-name',
5583
+ amount: 29900,
5584
+ currency: 'KRW',
5585
+ paymentMethod: 'card',
5586
+ providerStatus: 'PAID',
5587
+ providerEventId: 'provider-event-id',
5588
+ confirmationSource: 'provider_api_confirm',
5589
+ })
5590
+ \`\`\`
5591
+
5418
5592
  ### updateTransaction()
5419
- Confirm or annotate a transaction. Paid transitions require provider
5420
- verification; non-financial annotations can still update pending transactions.
5593
+ Lower-level transaction update path. Prefer \`confirmPayment()\` for normal paid
5594
+ transitions. Use this only for compatibility paths that still require direct
5595
+ transaction annotation after provider verification, or for non-paid pending
5596
+ transaction updates.
5421
5597
 
5422
5598
  \`\`\`typescript
5423
5599
  const tx = await client.commerce.orders.updateTransaction({
5424
- pgPaymentId: 'toss-payment-id',
5425
- status: 'paid', // pending | paid | failed | canceled
5426
- paymentKey: 'toss-payment-key', // required when status is paid
5427
- amount: 29900, // required when status is paid
5600
+ pgPaymentId: 'provider-payment-id',
5601
+ status: 'failed', // pending | paid | failed | canceled
5602
+ paymentMethod: 'card',
5603
+ receiptUrl: 'https://...',
5428
5604
  })
5429
5605
  \`\`\`
5430
5606
 
@@ -5517,7 +5693,7 @@ const result = await client.commerce.shipping.calculate({
5517
5693
  }
5518
5694
 
5519
5695
  // src/resources/(docs)/customer-auth.ts
5520
- var metadata45 = {
5696
+ var metadata46 = {
5521
5697
  name: "docs-customer-auth",
5522
5698
  title: "Customer Auth API",
5523
5699
  description: "01.software SDK Customer Auth API reference (client.customer)"
@@ -5695,7 +5871,7 @@ async function loadProfile() {
5695
5871
  }
5696
5872
 
5697
5873
  // src/resources/(docs)/browser-vs-server.ts
5698
- var metadata46 = {
5874
+ var metadata47 = {
5699
5875
  name: "docs-browser-vs-server",
5700
5876
  title: "Client vs ServerClient",
5701
5877
  description: "When to use Client (createClient) vs ServerClient (createServerClient) in the 01.software SDK"
@@ -5861,7 +6037,7 @@ export function ProductList() {
5861
6037
  }
5862
6038
 
5863
6039
  // src/resources/(docs)/file-upload.ts
5864
- var metadata47 = {
6040
+ var metadata48 = {
5865
6041
  name: "docs-file-upload",
5866
6042
  title: "File Upload",
5867
6043
  description: "01.software SDK file upload patterns using the images collection"
@@ -6012,7 +6188,7 @@ The platform stores files in Cloudflare R2 and serves via CDN (\`cdn.01.software
6012
6188
  }
6013
6189
 
6014
6190
  // src/resources/(docs)/webhook.ts
6015
- var metadata48 = {
6191
+ var metadata49 = {
6016
6192
  name: "docs-webhook",
6017
6193
  title: "Webhooks",
6018
6194
  description: "01.software SDK webhook verification and event handling"
@@ -6029,6 +6205,12 @@ Use the SDK \`handleWebhook\` helper to verify signatures. For customer auth eve
6029
6205
  \`\`\`typescript
6030
6206
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
6031
6207
 
6208
+ function getWebhookSecret(): string {
6209
+ const secret = process.env.WEBHOOK_SECRET
6210
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6211
+ return secret
6212
+ }
6213
+
6032
6214
  const handler = createCustomerAuthWebhookHandler({
6033
6215
  passwordReset: async (data) => {
6034
6216
  await sendPasswordResetEmail(data)
@@ -6037,7 +6219,7 @@ const handler = createCustomerAuthWebhookHandler({
6037
6219
 
6038
6220
  export async function POST(request: Request) {
6039
6221
  return handleWebhook(request, handler, {
6040
- secret: process.env.WEBHOOK_SECRET!,
6222
+ secret: getWebhookSecret(),
6041
6223
  })
6042
6224
  }
6043
6225
  \`\`\`
@@ -6050,6 +6232,12 @@ export async function POST(request: Request) {
6050
6232
  // app/api/webhooks/route.ts
6051
6233
  import { handleWebhook, createCustomerAuthWebhookHandler } from '@01.software/sdk/webhook'
6052
6234
 
6235
+ function getWebhookSecret(): string {
6236
+ const secret = process.env.WEBHOOK_SECRET
6237
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6238
+ return secret
6239
+ }
6240
+
6053
6241
  const customerAuthHandler = createCustomerAuthWebhookHandler({
6054
6242
  passwordReset: sendPasswordResetEmail,
6055
6243
  })
@@ -6060,7 +6248,7 @@ export async function POST(request: Request) {
6060
6248
 
6061
6249
  await customerAuthHandler(event)
6062
6250
  }, {
6063
- secret: process.env.WEBHOOK_SECRET!,
6251
+ secret: getWebhookSecret(),
6064
6252
  })
6065
6253
  }
6066
6254
  \`\`\`
@@ -6079,6 +6267,51 @@ All webhook events share this envelope:
6079
6267
 
6080
6268
  ## Event Types
6081
6269
 
6270
+ ### Collection Order Changed
6271
+
6272
+ Admin Panel manual ordering is delivered as a semantic collection update:
6273
+
6274
+ - \`operation\` remains \`"update"\` for compatibility.
6275
+ - \`eventType\` is \`"collection.orderChanged"\`.
6276
+ - \`change.scope\` identifies collection-level ordering versus join ordering.
6277
+ - SDK handlers should use \`isOrderChangedWebhookEvent()\` from \`@01.software/sdk/webhook\`.
6278
+ - Route on public semantics such as \`change.scope.collection\`, \`change.scope.field\`, and \`change.moved.id\`.
6279
+ - Do not branch on hidden Payload order fields or private backing collections; diagnostic fields may still be present.
6280
+ - Customer group member ordering is currently unsupported and does not emit a semantic order-change webhook.
6281
+
6282
+ \`\`\`typescript
6283
+ import { handleWebhook, isOrderChangedWebhookEvent } from '@01.software/sdk/webhook'
6284
+
6285
+ function getWebhookSecret(): string {
6286
+ const secret = process.env.WEBHOOK_SECRET
6287
+ if (!secret) throw new Error('WEBHOOK_SECRET is required')
6288
+ return secret
6289
+ }
6290
+
6291
+ export async function POST(request: Request) {
6292
+ return handleWebhook(
6293
+ request,
6294
+ async (event) => {
6295
+ if (isOrderChangedWebhookEvent(event)) {
6296
+ if (event.change.scope.kind === 'join') {
6297
+ console.log('Join order changed', {
6298
+ collection: event.change.scope.collection,
6299
+ field: event.change.scope.field,
6300
+ parentId: event.change.scope.id,
6301
+ movedCollection: event.change.moved.collection,
6302
+ movedId: event.change.moved.id,
6303
+ })
6304
+ }
6305
+ return
6306
+ }
6307
+
6308
+ console.log('Content changed', event.collection, event.operation)
6309
+ },
6310
+ { secret: getWebhookSecret() },
6311
+ )
6312
+ }
6313
+ \`\`\`
6314
+
6082
6315
  ### Customer Password Reset
6083
6316
 
6084
6317
  Dispatched when a customer calls \`client.customer.forgotPassword(email)\`.
@@ -6126,7 +6359,7 @@ Configure webhook URLs in the 01.software console under Tenant Settings > Webhoo
6126
6359
  }
6127
6360
 
6128
6361
  // src/resources/(docs)/product-detail.ts
6129
- var metadata49 = {
6362
+ var metadata50 = {
6130
6363
  name: "docs-product-detail",
6131
6364
  title: "Product Detail Helper",
6132
6365
  description: "01.software SDK commerce.product.detail helper guide"
@@ -6218,7 +6451,23 @@ Log \`client.lastRequestId\` against backend logs \u2014 the endpoint records th
6218
6451
 
6219
6452
  // src/server.ts
6220
6453
  var REGISTERED_TOOLS_BY_SERVER = /* @__PURE__ */ new WeakMap();
6221
- function registerTool(server, schema37, meta, handler21) {
6454
+ function hasToolPolicy(toolName) {
6455
+ return Object.prototype.hasOwnProperty.call(TOOL_POLICY_MANIFEST, toolName);
6456
+ }
6457
+ function runtimeAnnotationsFor(meta) {
6458
+ if (!hasToolPolicy(meta.name)) {
6459
+ throw new Error(`No tool-policy entry for registered MCP tool ${meta.name}`);
6460
+ }
6461
+ const policy = TOOL_POLICY_MANIFEST[meta.name];
6462
+ return {
6463
+ title: meta.annotations?.title,
6464
+ readOnlyHint: policy.annotationPolicy.readOnly,
6465
+ destructiveHint: policy.annotationPolicy.destructive,
6466
+ idempotentHint: policy.annotationPolicy.idempotent,
6467
+ openWorldHint: policy.annotationPolicy.openWorld
6468
+ };
6469
+ }
6470
+ function registerTool(server, schema38, meta, handler21) {
6222
6471
  let registered = REGISTERED_TOOLS_BY_SERVER.get(server);
6223
6472
  if (!registered) {
6224
6473
  registered = /* @__PURE__ */ new Set();
@@ -6229,16 +6478,20 @@ function registerTool(server, schema37, meta, handler21) {
6229
6478
  meta.name,
6230
6479
  {
6231
6480
  description: meta.description,
6232
- inputSchema: schema37,
6233
- annotations: meta.annotations
6481
+ inputSchema: schema38,
6482
+ annotations: runtimeAnnotationsFor(meta)
6234
6483
  },
6235
6484
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6236
6485
  async (params) => {
6237
6486
  const ctx = tenantAuthContext();
6238
6487
  if (ctx) {
6239
- const decision = evaluateToolPolicy(meta.name, ctx.scopes);
6488
+ const decision = evaluateToolPolicy(
6489
+ meta.name,
6490
+ ctx.scopes,
6491
+ ctx.tenantRole
6492
+ );
6240
6493
  if (!decision.allowed) {
6241
- const status = decision.reason === "insufficient_scope" ? 403 : 500;
6494
+ const status = decision.reason === "insufficient_scope" || decision.reason === "insufficient_role" ? 403 : 500;
6242
6495
  return {
6243
6496
  content: [
6244
6497
  {
@@ -6275,13 +6528,13 @@ function registerTool(server, schema37, meta, handler21) {
6275
6528
  }
6276
6529
  );
6277
6530
  }
6278
- function registerPrompt(server, schema37, meta, handler21) {
6531
+ function registerPrompt(server, schema38, meta, handler21) {
6279
6532
  server.registerPrompt(
6280
6533
  meta.name,
6281
6534
  {
6282
6535
  title: meta.title,
6283
6536
  description: meta.description,
6284
- argsSchema: schema37
6537
+ argsSchema: schema38
6285
6538
  },
6286
6539
  // eslint-disable-next-line @typescript-eslint/no-explicit-any
6287
6540
  (params) => ({
@@ -6353,211 +6606,232 @@ function createServer(options = {}) {
6353
6606
  server,
6354
6607
  schema10,
6355
6608
  metadata10,
6356
- createReturn
6609
+ confirmPayment
6357
6610
  );
6358
6611
  registerTool(
6359
6612
  server,
6360
6613
  schema11,
6361
6614
  metadata11,
6362
- updateReturn
6615
+ createReturn
6363
6616
  );
6364
6617
  registerTool(
6365
6618
  server,
6366
6619
  schema12,
6367
6620
  metadata12,
6368
- returnWithRefund
6621
+ updateReturn
6369
6622
  );
6370
- registerTool(server, schema13, metadata13, addCartItem);
6371
6623
  registerTool(
6372
6624
  server,
6373
- schema14,
6374
- metadata14,
6375
- updateCartItem
6625
+ schema13,
6626
+ metadata13,
6627
+ returnWithRefund
6376
6628
  );
6629
+ registerTool(server, schema14, metadata14, addCartItem);
6377
6630
  registerTool(
6378
6631
  server,
6379
6632
  schema15,
6380
6633
  metadata15,
6381
- removeCartItem
6634
+ updateCartItem
6382
6635
  );
6383
6636
  registerTool(
6384
6637
  server,
6385
6638
  schema16,
6386
6639
  metadata16,
6387
- applyDiscount
6640
+ removeCartItem
6388
6641
  );
6389
6642
  registerTool(
6390
6643
  server,
6391
6644
  schema17,
6392
6645
  metadata17,
6393
- removeDiscount
6646
+ applyDiscount
6394
6647
  );
6395
- registerTool(server, schema18, metadata18, clearCart);
6396
6648
  registerTool(
6397
6649
  server,
6398
- schema19,
6399
- metadata19,
6400
- validateDiscount
6650
+ schema18,
6651
+ metadata18,
6652
+ removeDiscount
6401
6653
  );
6654
+ registerTool(server, schema19, metadata19, clearCart);
6402
6655
  registerTool(
6403
6656
  server,
6404
6657
  schema20,
6405
6658
  metadata20,
6659
+ validateDiscount
6660
+ );
6661
+ registerTool(
6662
+ server,
6663
+ schema21,
6664
+ metadata21,
6406
6665
  calculateShipping
6407
6666
  );
6408
- registerTool(server, schema21, metadata21, stockCheck);
6409
- registerTool(server, schema22, metadata22, productDetail);
6667
+ registerTool(server, schema22, metadata22, stockCheck);
6410
6668
  registerTool(
6411
6669
  server,
6412
6670
  schema23,
6413
6671
  metadata23,
6672
+ productDetail
6673
+ );
6674
+ registerTool(
6675
+ server,
6676
+ schema24,
6677
+ metadata24,
6414
6678
  productUpsert
6415
6679
  );
6416
6680
  }
6417
- registerTool(
6418
- server,
6419
- schema24,
6420
- metadata24,
6421
- getCollectionSchemaTool
6422
- );
6423
6681
  registerTool(
6424
6682
  server,
6425
6683
  schema25,
6426
6684
  metadata25,
6427
- handler
6685
+ getCollectionSchemaTool
6428
6686
  );
6429
6687
  registerTool(
6430
6688
  server,
6431
6689
  schema26,
6432
6690
  metadata26,
6433
- handler2
6691
+ handler
6434
6692
  );
6435
6693
  registerTool(
6436
6694
  server,
6437
6695
  schema27,
6438
6696
  metadata27,
6439
- listConfigurableFields
6697
+ handler2
6440
6698
  );
6441
6699
  registerTool(
6442
6700
  server,
6443
6701
  schema28,
6444
6702
  metadata28,
6445
- updateFieldConfig
6703
+ listConfigurableFields
6446
6704
  );
6447
6705
  registerTool(
6448
6706
  server,
6449
6707
  schema29,
6450
6708
  metadata29,
6451
- handler3
6709
+ updateFieldConfig
6452
6710
  );
6453
6711
  registerTool(
6454
6712
  server,
6455
6713
  schema30,
6456
6714
  metadata30,
6457
- handler4
6715
+ handler3
6458
6716
  );
6459
6717
  registerTool(
6460
6718
  server,
6461
6719
  schema31,
6462
6720
  metadata31,
6463
- handler5
6721
+ handler4
6464
6722
  );
6465
6723
  registerTool(
6466
6724
  server,
6467
6725
  schema32,
6468
6726
  metadata32,
6469
- handler6
6727
+ handler5
6470
6728
  );
6471
- registerPrompt(
6729
+ registerTool(
6472
6730
  server,
6473
6731
  schema33,
6474
6732
  metadata33,
6475
- sdkUsageGuide
6733
+ handler6
6476
6734
  );
6477
6735
  registerPrompt(
6478
6736
  server,
6479
6737
  schema34,
6480
6738
  metadata34,
6481
- collectionQueryHelp
6739
+ sdkUsageGuide
6482
6740
  );
6483
6741
  registerPrompt(
6484
6742
  server,
6485
6743
  schema35,
6486
6744
  metadata35,
6487
- orderFlowGuide
6745
+ collectionQueryHelp
6488
6746
  );
6489
6747
  registerPrompt(
6490
6748
  server,
6491
6749
  schema36,
6492
6750
  metadata36,
6751
+ orderFlowGuide
6752
+ );
6753
+ registerPrompt(
6754
+ server,
6755
+ schema37,
6756
+ metadata37,
6493
6757
  featureSetupGuide
6494
6758
  );
6495
6759
  registerStaticResource(
6496
6760
  server,
6497
- "config://app",
6498
- metadata37,
6761
+ mcpResourceUri("app-config"),
6762
+ metadata38,
6499
6763
  handler7
6500
6764
  );
6501
6765
  registerStaticResource(
6502
6766
  server,
6503
- "collections://schema",
6504
- metadata38,
6767
+ mcpResourceUri("collections-schema"),
6768
+ metadata39,
6505
6769
  handler8
6506
6770
  );
6507
6771
  registerStaticResource(
6508
6772
  server,
6509
- "docs://sdk/getting-started",
6510
- metadata39,
6773
+ mcpResourceUri("docs-getting-started"),
6774
+ metadata40,
6511
6775
  handler9
6512
6776
  );
6513
- registerStaticResource(server, "docs://sdk/guides", metadata40, handler10);
6514
- registerStaticResource(server, "docs://sdk/api", metadata41, handler11);
6515
6777
  registerStaticResource(
6516
6778
  server,
6517
- "docs://sdk/query-builder",
6779
+ mcpResourceUri("docs-guides"),
6780
+ metadata41,
6781
+ handler10
6782
+ );
6783
+ registerStaticResource(
6784
+ server,
6785
+ mcpResourceUri("docs-api"),
6518
6786
  metadata42,
6519
- handler12
6787
+ handler11
6520
6788
  );
6521
6789
  registerStaticResource(
6522
6790
  server,
6523
- "docs://sdk/react-query",
6791
+ mcpResourceUri("docs-query-builder"),
6524
6792
  metadata43,
6525
- handler13
6793
+ handler12
6526
6794
  );
6527
6795
  registerStaticResource(
6528
6796
  server,
6529
- "docs://sdk/server-api",
6797
+ mcpResourceUri("docs-react-query"),
6530
6798
  metadata44,
6531
- handler14
6799
+ handler13
6532
6800
  );
6533
6801
  registerStaticResource(
6534
6802
  server,
6535
- "docs://sdk/customer-auth",
6803
+ mcpResourceUri("docs-server-api"),
6536
6804
  metadata45,
6537
- handler15
6805
+ handler14
6538
6806
  );
6539
6807
  registerStaticResource(
6540
6808
  server,
6541
- "docs://sdk/browser-vs-server",
6809
+ mcpResourceUri("docs-customer-auth"),
6542
6810
  metadata46,
6543
- handler16
6811
+ handler15
6544
6812
  );
6545
6813
  registerStaticResource(
6546
6814
  server,
6547
- "docs://sdk/file-upload",
6815
+ mcpResourceUri("docs-browser-vs-server"),
6548
6816
  metadata47,
6549
- handler17
6817
+ handler16
6550
6818
  );
6551
6819
  registerStaticResource(
6552
6820
  server,
6553
- "docs://sdk/webhook",
6821
+ mcpResourceUri("docs-file-upload"),
6554
6822
  metadata48,
6555
- handler18
6823
+ handler17
6556
6824
  );
6557
6825
  registerStaticResource(
6558
6826
  server,
6559
- "docs://sdk/product-detail",
6827
+ mcpResourceUri("docs-webhook"),
6560
6828
  metadata49,
6829
+ handler18
6830
+ );
6831
+ registerStaticResource(
6832
+ server,
6833
+ mcpResourceUri("docs-product-detail"),
6834
+ metadata50,
6561
6835
  handler19
6562
6836
  );
6563
6837
  return server;
@@ -6860,7 +7134,7 @@ schema, context, field-config, and guidance tools:
6860
7134
  npx @01.software/cli mcp
6861
7135
 
6862
7136
  Prompts (4): sdk-usage-guide, collection-query-help, order-flow-guide, feature-setup-guide
6863
- Resources (12): config, collections-schema, getting-started, guides, api, query-builder, react-query, server-api, customer-auth, browser-vs-server, file-upload, webhook
7137
+ Resources (${MCP_RESOURCE_LABELS.length}): ${MCP_RESOURCE_LABELS.join(", ")}
6864
7138
 
6865
7139
 
6866
7140
  Links