@01.software/cli 0.11.2 → 0.12.0
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/dist/mcp/.01-cli-mcp-build.json +1 -1
- package/dist/mcp/{chunk-D72PPBDH.js → chunk-CBN6MUZE.js} +127 -20
- package/dist/mcp/chunk-CBN6MUZE.js.map +1 -0
- package/dist/mcp/http.js +1 -1
- package/dist/mcp/stdio.js +1 -1
- package/dist/mcp/vercel.js +126 -19
- package/package.json +2 -2
- package/dist/mcp/chunk-D72PPBDH.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"kind": "01software.cli.mcp-build",
|
|
3
3
|
"version": 1,
|
|
4
|
-
"sourceHash": "
|
|
4
|
+
"sourceHash": "3565c7d38e25024c7bc2cd007944aed179cd476ee55553f188ada1ff0918f0ea",
|
|
5
5
|
"sourceInputs": [
|
|
6
6
|
"apps/mcp/package.json",
|
|
7
7
|
"apps/mcp/tsconfig.json",
|
|
@@ -333,7 +333,6 @@ var productFieldShape = {
|
|
|
333
333
|
weight: z2.number().int().min(0).optional().nullable(),
|
|
334
334
|
minOrderQuantity: z2.number().int().min(1).optional().nullable(),
|
|
335
335
|
maxOrderQuantity: z2.number().int().min(1).optional().nullable(),
|
|
336
|
-
listingPrimaryOption: IdSchema.optional().nullable(),
|
|
337
336
|
isFeatured: z2.boolean().optional(),
|
|
338
337
|
publishedAt: z2.string().optional().nullable(),
|
|
339
338
|
categories: z2.array(IdSchema).optional(),
|
|
@@ -536,6 +535,9 @@ var confirmPaymentSchema = z3.object({
|
|
|
536
535
|
"provider_api_confirm",
|
|
537
536
|
"manual_server"
|
|
538
537
|
]).optional(),
|
|
538
|
+
paymentKey: z3.string().min(1).optional().describe(
|
|
539
|
+
"Optional provider payment key from the client confirm handshake; stored for BFF/provider refund workflows (also accepted as metadata.tossPaymentKey). Local cancel does not read this field."
|
|
540
|
+
),
|
|
539
541
|
metadata: z3.record(z3.string(), z3.unknown()).optional()
|
|
540
542
|
}).strict();
|
|
541
543
|
var ConfirmPaymentSchema = confirmPaymentSchema;
|
|
@@ -588,20 +590,32 @@ var CancelOrderSchema = cancelOrderSchema;
|
|
|
588
590
|
var cancelOrderResponseBaseSchema = {
|
|
589
591
|
orderId: z3.string().min(1)
|
|
590
592
|
};
|
|
591
|
-
var
|
|
593
|
+
var unpaidLocalCancelCommittedResponseFields = {
|
|
592
594
|
refundedAmount: z3.literal(0),
|
|
593
595
|
providerRefunded: z3.literal(false)
|
|
594
596
|
};
|
|
595
|
-
var
|
|
596
|
-
|
|
597
|
-
|
|
597
|
+
var paidLocalCancelCommittedResponseFields = {
|
|
598
|
+
transactionId: z3.string().min(1),
|
|
599
|
+
refundedAmount: z3.literal(0),
|
|
600
|
+
providerRefunded: z3.literal(false),
|
|
601
|
+
refundPending: z3.literal(true)
|
|
598
602
|
};
|
|
599
|
-
var
|
|
603
|
+
var legacyProviderRefundResponseFields = {
|
|
600
604
|
transactionId: z3.string().min(1),
|
|
601
605
|
refundedAmount: z3.number().int().positive(),
|
|
602
606
|
refundSeq: z3.number().int().positive(),
|
|
603
607
|
providerRefunded: z3.literal(true)
|
|
604
608
|
};
|
|
609
|
+
var alreadyCanceledResponseFields = {
|
|
610
|
+
refundedAmount: z3.number().int().nonnegative(),
|
|
611
|
+
providerRefunded: z3.literal(false)
|
|
612
|
+
};
|
|
613
|
+
var alreadyCanceledRefundPendingResponseFields = {
|
|
614
|
+
transactionId: z3.string().min(1),
|
|
615
|
+
refundedAmount: z3.number().int().nonnegative(),
|
|
616
|
+
providerRefunded: z3.literal(false),
|
|
617
|
+
refundPending: z3.literal(true)
|
|
618
|
+
};
|
|
605
619
|
var cancelOrderReconciliationStatusSchema = z3.enum([
|
|
606
620
|
"paid",
|
|
607
621
|
"preparing",
|
|
@@ -616,13 +630,13 @@ var cancelOrderReconciliationStatusSchema = z3.enum([
|
|
|
616
630
|
var cancelOrderResponseSchema = z3.union([
|
|
617
631
|
z3.object({
|
|
618
632
|
...cancelOrderResponseBaseSchema,
|
|
619
|
-
...
|
|
633
|
+
...paidLocalCancelCommittedResponseFields,
|
|
620
634
|
status: z3.literal("canceled"),
|
|
621
635
|
cancelCommitted: z3.literal(true)
|
|
622
636
|
}).strict(),
|
|
623
637
|
z3.object({
|
|
624
638
|
...cancelOrderResponseBaseSchema,
|
|
625
|
-
...
|
|
639
|
+
...unpaidLocalCancelCommittedResponseFields,
|
|
626
640
|
status: z3.literal("canceled"),
|
|
627
641
|
cancelCommitted: z3.literal(true)
|
|
628
642
|
}).strict(),
|
|
@@ -635,12 +649,75 @@ var cancelOrderResponseSchema = z3.union([
|
|
|
635
649
|
}).strict(),
|
|
636
650
|
z3.object({
|
|
637
651
|
...cancelOrderResponseBaseSchema,
|
|
638
|
-
...
|
|
652
|
+
...alreadyCanceledRefundPendingResponseFields,
|
|
653
|
+
status: z3.literal("canceled"),
|
|
654
|
+
cancelCommitted: z3.literal(false),
|
|
655
|
+
alreadyCanceled: z3.literal(true)
|
|
656
|
+
}).strict(),
|
|
657
|
+
z3.object({
|
|
658
|
+
...cancelOrderResponseBaseSchema,
|
|
659
|
+
...legacyProviderRefundResponseFields,
|
|
639
660
|
status: cancelOrderReconciliationStatusSchema,
|
|
640
661
|
cancelCommitted: z3.literal(false),
|
|
641
662
|
reconciliationRequired: z3.literal(true)
|
|
642
663
|
}).strict()
|
|
643
664
|
]);
|
|
665
|
+
var resolveCancelRefundOutcomeSchema = z3.enum(["succeeded", "failed"]);
|
|
666
|
+
var resolveCancelRefundSchema = z3.object({
|
|
667
|
+
orderNumber: z3.string().min(1, "orderNumber is required").describe("Order number whose pending cancel refund is being resolved"),
|
|
668
|
+
idempotencyKey: idempotencyKeySchema.describe(
|
|
669
|
+
"Stable key for this PG refund result report"
|
|
670
|
+
),
|
|
671
|
+
outcome: resolveCancelRefundOutcomeSchema.describe(
|
|
672
|
+
"PG refund result reported by the storefront or BFF"
|
|
673
|
+
),
|
|
674
|
+
refundedAmount: z3.number().int("refundedAmount must be an integer minor-unit amount").nonnegative("refundedAmount must be nonnegative"),
|
|
675
|
+
pgProvider: z3.string().trim().min(1, "pgProvider is required").regex(
|
|
676
|
+
/^[a-z0-9][a-z0-9_-]*$/,
|
|
677
|
+
"pgProvider must be a lowercase provider slug"
|
|
678
|
+
),
|
|
679
|
+
pgRefundId: z3.string().trim().min(1).optional()
|
|
680
|
+
}).strict().superRefine((value, ctx) => {
|
|
681
|
+
if (value.outcome === "succeeded" && value.refundedAmount <= 0) {
|
|
682
|
+
ctx.addIssue({
|
|
683
|
+
code: z3.ZodIssueCode.custom,
|
|
684
|
+
path: ["refundedAmount"],
|
|
685
|
+
message: "refundedAmount must be positive when outcome is succeeded"
|
|
686
|
+
});
|
|
687
|
+
}
|
|
688
|
+
if (value.outcome === "succeeded" && !value.pgRefundId) {
|
|
689
|
+
ctx.addIssue({
|
|
690
|
+
code: z3.ZodIssueCode.custom,
|
|
691
|
+
path: ["pgRefundId"],
|
|
692
|
+
message: "pgRefundId is required when outcome is succeeded"
|
|
693
|
+
});
|
|
694
|
+
}
|
|
695
|
+
if (value.outcome === "failed" && value.refundedAmount !== 0) {
|
|
696
|
+
ctx.addIssue({
|
|
697
|
+
code: z3.ZodIssueCode.custom,
|
|
698
|
+
path: ["refundedAmount"],
|
|
699
|
+
message: "refundedAmount must be 0 when outcome is failed"
|
|
700
|
+
});
|
|
701
|
+
}
|
|
702
|
+
});
|
|
703
|
+
var resolveCancelRefundResponseSchema = z3.union([
|
|
704
|
+
z3.object({
|
|
705
|
+
orderId: z3.string().min(1),
|
|
706
|
+
transactionId: z3.string().min(1),
|
|
707
|
+
refundTransactionId: z3.string().min(1),
|
|
708
|
+
refundedAmount: z3.number().int().positive(),
|
|
709
|
+
refundStatus: z3.literal("succeeded"),
|
|
710
|
+
transactionStatus: z3.literal("refunded")
|
|
711
|
+
}).strict(),
|
|
712
|
+
z3.object({
|
|
713
|
+
orderId: z3.string().min(1),
|
|
714
|
+
transactionId: z3.string().min(1),
|
|
715
|
+
refundTransactionId: z3.string().min(1),
|
|
716
|
+
refundedAmount: z3.literal(0),
|
|
717
|
+
refundStatus: z3.literal("failed"),
|
|
718
|
+
transactionStatus: z3.literal("paid")
|
|
719
|
+
}).strict()
|
|
720
|
+
]);
|
|
644
721
|
|
|
645
722
|
// ../../packages/contracts/src/mcp/index.ts
|
|
646
723
|
var MCP_TOOL_CONTRACT = {
|
|
@@ -4166,7 +4243,7 @@ const order = await client.commerce.orders.checkout({
|
|
|
4166
4243
|
- Requires pgPaymentId and paymentKey for provider-verified refund
|
|
4167
4244
|
|
|
4168
4245
|
### Key Points
|
|
4169
|
-
- Full refund: original transaction \u2192 \`canceled\`
|
|
4246
|
+
- Full refund: original transaction \u2192 \`canceled\` (**return-with-refund only**; order-cancel does NOT cancel the transaction \u2014 it stays \`paid\` until the storefront PG refund resolves it)
|
|
4170
4247
|
- Partial refund: new refund transaction created
|
|
4171
4248
|
- Stock restored: stock += qty, reservedStock -= qty
|
|
4172
4249
|
- Cumulative refunds tracked: refundAmount + order.refundedAmount \u2264 totalAmount
|
|
@@ -4185,23 +4262,24 @@ await client.commerce.orders.returnWithRefund({
|
|
|
4185
4262
|
paymentKey: 'payment_key_xxx'
|
|
4186
4263
|
})
|
|
4187
4264
|
\`\`\``,
|
|
4188
|
-
"order-cancel": `##
|
|
4265
|
+
"order-cancel": `## Local Order Cancellation (PG refund separate)
|
|
4189
4266
|
|
|
4190
4267
|
### Flow
|
|
4191
4268
|
|
|
4192
4269
|
1. **Cancel Order** -> \`cancel-order\` tool
|
|
4193
|
-
- Pending or failed unpaid orders cancel without a
|
|
4194
|
-
- Paid captured orders
|
|
4195
|
-
-
|
|
4196
|
-
-
|
|
4197
|
-
-
|
|
4198
|
-
-
|
|
4270
|
+
- Pending or failed unpaid orders cancel locally without a PG call
|
|
4271
|
+
- Paid captured orders cancel **locally only**: order \`canceled\`, payment transaction stays \`paid\`, reservedStock released
|
|
4272
|
+
- **PG refund is not performed by Console** \u2014 storefront/BFF calls Toss/Portone; webhook sync is a follow-up
|
|
4273
|
+
- \`refundedAmount\` is not incremented on local cancel; new cancels return \`providerRefunded: false\`
|
|
4274
|
+
- \`refundPending: true\` signals storefront PG refund is still required; idempotent retries may return it from server metadata
|
|
4275
|
+
- Legacy inline-PG-cancel rows may still return \`reconciliationRequired: true\` with \`providerRefunded: true\`
|
|
4276
|
+
- Duplicate local success returns \`alreadyCanceled: true\`
|
|
4199
4277
|
|
|
4200
4278
|
### V1 Rejections
|
|
4201
4279
|
- Orders with non-failed fulfillments are rejected
|
|
4202
4280
|
- \`shipped\`, \`delivered\`, \`confirmed\`, and return-axis orders are rejected
|
|
4203
4281
|
- Active returns are rejected; use \`return-with-refund\` after delivery
|
|
4204
|
-
- Partial line-item cancellation
|
|
4282
|
+
- Partial line-item cancellation is not supported in v1
|
|
4205
4283
|
|
|
4206
4284
|
### Code Example
|
|
4207
4285
|
\`\`\`typescript
|
|
@@ -4213,7 +4291,36 @@ await client.commerce.orders.cancelOrder({
|
|
|
4213
4291
|
})
|
|
4214
4292
|
\`\`\`
|
|
4215
4293
|
|
|
4216
|
-
|
|
4294
|
+
### Storefront PG refund (BFF only)
|
|
4295
|
+
|
|
4296
|
+
After \`cancelOrder\`, initiate PG refund **only when all of the following hold**:
|
|
4297
|
+
|
|
4298
|
+
- First response: \`cancelCommitted: true\` **and** \`refundPending: true\`
|
|
4299
|
+
- Idempotent retry: \`alreadyCanceled: true\` **and** \`refundPending: true\` (read from server metadata)
|
|
4300
|
+
- PG lookup confirms the payment is still captured / not yet refunded
|
|
4301
|
+
|
|
4302
|
+
**Never** call PG refund when:
|
|
4303
|
+
|
|
4304
|
+
- \`providerRefunded: true\` (legacy inline-PG-cancel or refund already recorded)
|
|
4305
|
+
- \`reconciliationRequired: true\` (escalate to ops \u2014 do not auto-refund)
|
|
4306
|
+
- \`refundPending\` is absent on an unpaid / never-captured order
|
|
4307
|
+
|
|
4308
|
+
Prefer persisting the first \`cancelOrder\` response; use PG \`getPayment\` before refund when state is uncertain.
|
|
4309
|
+
|
|
4310
|
+
After a PG refund attempt reaches a terminal result, report that exact result back to Console. This is a BFF/server-only operation and requires an \`sk01_\` server API key.
|
|
4311
|
+
|
|
4312
|
+
\`\`\`typescript
|
|
4313
|
+
await client.commerce.orders.resolveCancelRefund({
|
|
4314
|
+
orderNumber: 'ORD-240101-001',
|
|
4315
|
+
idempotencyKey: 'refund-cancel-ORD-240101-001-attempt-1',
|
|
4316
|
+
outcome: 'succeeded',
|
|
4317
|
+
refundedAmount: 59800,
|
|
4318
|
+
pgProvider: 'toss',
|
|
4319
|
+
pgRefundId: 'toss-refund-abc'
|
|
4320
|
+
})
|
|
4321
|
+
\`\`\`
|
|
4322
|
+
|
|
4323
|
+
Use one idempotency key per distinct PG refund attempt/result. For PG refund failure, call \`resolveCancelRefund({ outcome: 'failed', refundedAmount: 0, ... })\` with that attempt key. If a later PG attempt succeeds after a reported failure, use a new key such as \`refund-cancel-ORD-240101-001-attempt-2\`. Reuse the exact same \`idempotencyKey\` only for transport retries of the same reported result; never reuse it for a different order, outcome, provider, amount, or provider refund id.`,
|
|
4217
4324
|
"fulfillment-tracking": `## Fulfillment & Tracking
|
|
4218
4325
|
|
|
4219
4326
|
### Creating Fulfillment
|
|
@@ -7224,4 +7331,4 @@ export {
|
|
|
7224
7331
|
flushMcpTelemetrySummary,
|
|
7225
7332
|
createServer
|
|
7226
7333
|
};
|
|
7227
|
-
//# sourceMappingURL=chunk-
|
|
7334
|
+
//# sourceMappingURL=chunk-CBN6MUZE.js.map
|