@itpay/cli 2.1.3 → 2.1.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.
@@ -408,7 +408,7 @@ export async function runServicesCheckout(backend, config, serviceExecutionID, c
408
408
  if (missingInput.length > 0 && !readModel.workflow_entry && readModel.execution.next_action !== "create_checkout") {
409
409
  throw new CommandContractError("capability_input_invalid", `missing required capability input: ${missingInput.join(", ")}`, "补齐付费 capability 的 required_input;本次没有创建 quote、Checkout 或订单。", [{ command: checkoutCommand(serviceExecutionID, capability, lockedInput), reason: "提交完整且会被锁定的服务输入" }]);
410
410
  }
411
- if (capability.delivery_email_required && String(deliveryContact.email ?? "").trim() === "") {
411
+ if (capability.delivery_email_required && readModel.workflow_entry?.capability_id !== capability.capability_id && String(deliveryContact.email ?? "").trim() === "") {
412
412
  throw new CommandContractError("delivery_email_required", "delivery email is required before creating this service checkout", "该 capability 的交付链接会发送到用户邮箱;先向用户说明用途并询问邮箱,不要代填。", [{
413
413
  command: `itpay services checkout ${serviceExecutionID} --capability ${capability.capability_id}${formatInputOptions(lockedInput)} --email <email> --json`,
414
414
  reason: "使用用户提供的邮箱创建 Checkout",
@@ -500,14 +500,14 @@ export async function runServicesQuote(backend, serviceExecutionID, capabilityID
500
500
  const selectionBacked = model.execution.status === "human_action_approved" &&
501
501
  model.allowed_actions?.some((action) => action.type === "prepare_quote" && action.capability_id === capabilityID);
502
502
  const missingInput = missingRequiredInput(capability.input_schema, input);
503
- if (missingInput.length > 0 && !selectionBacked) {
503
+ if (missingInput.length > 0 && !selectionBacked && model.workflow_entry?.capability_id !== capability.capability_id) {
504
504
  throw new CommandContractError("capability_input_invalid", `missing required capability input: ${missingInput.join(", ")}`, "补齐付费 capability 输入;本次没有创建 Quote、Cart 或 Checkout。", [{ command: quoteCommand(serviceExecutionID, capability, input), reason: "提交完整且会被锁定的输入" }]);
505
505
  }
506
506
  const deliveryContact = {
507
507
  ...(options.deliveryContact ?? {}),
508
508
  ...(options.email ? { email: options.email } : {}),
509
509
  };
510
- if (capability.delivery_email_required && String(deliveryContact.email ?? "").trim() === "") {
510
+ if (capability.delivery_email_required && model.workflow_entry?.capability_id !== capability.capability_id && String(deliveryContact.email ?? "").trim() === "") {
511
511
  throw new CommandContractError("delivery_email_required", "delivery email is required before preparing this service quote", "交付链接会发送到用户邮箱;说明用途并询问邮箱,不要代填。", [{ command: quoteCommand(serviceExecutionID, capability, input), reason: "使用用户提供的邮箱创建报价" }]);
512
512
  }
513
513
  const quote = await backend.prepareServiceQuote(serviceExecutionID, {
@@ -559,6 +559,8 @@ export async function runServicesGet(backend, serviceExecutionID, options = {})
559
559
  ...(execution.current_capability_id ? { current_capability_id: execution.current_capability_id } : {}),
560
560
  updated_at: execution.updated_at,
561
561
  timeline,
562
+ ...(response.workflow ? { workflow: response.workflow } : {}),
563
+ ...(response.rail_booking ? { rail_booking: response.rail_booking } : {}),
562
564
  ...(response.events.length > timeline.length ? { timeline_truncated: true } : {}),
563
565
  ...(deliveryMode ? { delivery_mode: deliveryMode } : {}),
564
566
  ...(lockedRefund ? {
@@ -590,6 +592,8 @@ export async function runServicesGet(backend, serviceExecutionID, options = {})
590
592
  export async function runServicesNext(backend, serviceExecutionID, options = {}) {
591
593
  const response = await backend.getServiceExecution(serviceExecutionID);
592
594
  const envelope = servicesNextEnvelope(response);
595
+ if (response.rail_booking)
596
+ envelope.result = { ...envelope.result, rail_booking: response.rail_booking };
593
597
  writeCommandEnvelope(envelope, {
594
598
  ...(options.jsonOutput !== undefined ? { jsonOutput: options.jsonOutput } : {}),
595
599
  ...(options.output ? { output: options.output } : {}),
@@ -15,7 +15,7 @@ import { OperationJournal } from "./operation_journal.js";
15
15
  export const DEFAULT_BASE_URL = "https://app.itpay.ai";
16
16
  export const DEV_BASE_URL = "https://dev.itpay.ai";
17
17
  export const SANDBOX_BASE_URL = "https://sandbox.itpay.ai";
18
- export const CLI_VERSION = "2.1.3";
18
+ export const CLI_VERSION = "2.1.4";
19
19
  export const API_CONTRACT_REVISION = "sha256:7f8e09ecee0ab32e3eed3690341fa5bbf6d955dbb464fd79ce0e340667b1085e";
20
20
  const CART_SESSION_DEFAULT_DIR = ".itpay-v3";
21
21
  const CART_SESSION_FILENAME = "cart.json";
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itpay/cli",
3
- "version": "2.1.3",
3
+ "version": "2.1.4",
4
4
  "description": "The ItPay CLI for services, orders, and human-authorized purchased content.",
5
5
  "type": "module",
6
6
  "bin": {