@itpay/cli 2.1.40 → 2.1.41

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.
Files changed (148) hide show
  1. package/README.md +5 -12
  2. package/dist/src/client/backend.js +2 -38
  3. package/dist/src/client/http.js +0 -2
  4. package/dist/src/commands/buy.js +58 -17
  5. package/dist/src/commands/cart.js +15 -17
  6. package/dist/src/commands/catalog.js +14 -39
  7. package/dist/src/commands/checkout.js +5 -146
  8. package/dist/src/commands/checkout_handoff.js +61 -11
  9. package/dist/src/commands/docs.js +18 -7
  10. package/dist/src/commands/guidance.js +134 -1
  11. package/dist/src/commands/install.js +3 -6
  12. package/dist/src/commands/order.js +3 -34
  13. package/dist/src/commands/orders.js +9 -4
  14. package/dist/src/commands/pay.js +1 -1
  15. package/dist/src/commands/readyz.js +1 -1
  16. package/dist/src/commands/refund.js +57 -13
  17. package/dist/src/commands/services.js +1068 -14
  18. package/dist/src/commands/skill.js +5 -8
  19. package/dist/src/commands/vault.js +20 -27
  20. package/dist/src/commands/vault_handoff.js +0 -18
  21. package/dist/src/main.js +43 -330
  22. package/dist/src/render/markdown.js +3 -0
  23. package/dist/src/render/qr.js +1 -1
  24. package/dist/src/state/cart_session.js +1 -4
  25. package/dist/src/state/client_context.js +0 -72
  26. package/dist/src/state/config.js +14 -44
  27. package/dist/src/state/device_authority.js +41 -141
  28. package/docs/agent/buyer/cart-checkout.json +6 -8
  29. package/docs/agent/buyer/catalog-list.json +9 -29
  30. package/docs/agent/buyer/identity-and-sessions.json +9 -26
  31. package/docs/agent/buyer/install-and-setup.json +9 -10
  32. package/docs/agent/buyer/orders-refunds.json +9 -25
  33. package/docs/agent/buyer/payment-flow.json +4 -6
  34. package/docs/agent/buyer/purchased-content.json +4 -18
  35. package/docs/agent/buyer/quickstart.json +17 -26
  36. package/docs/agent/buyer/render-hosts.json +12 -23
  37. package/docs/agent/buyer/service-feedback.json +3 -4
  38. package/docs/cli-reference/agent-types.md +2 -7
  39. package/docs/cli-reference/commands/buy.md +1 -2
  40. package/docs/cli-reference/commands/cart/add.md +1 -5
  41. package/docs/cli-reference/commands/cart/clear.md +1 -1
  42. package/docs/cli-reference/commands/cart/index.md +1 -1
  43. package/docs/cli-reference/commands/cart/next.md +1 -5
  44. package/docs/cli-reference/commands/cart/remove.md +1 -1
  45. package/docs/cli-reference/commands/cart/show.md +1 -1
  46. package/docs/cli-reference/commands/catalog/index.md +1 -1
  47. package/docs/cli-reference/commands/catalog/list.md +2 -2
  48. package/docs/cli-reference/commands/checkout.md +2 -12
  49. package/docs/cli-reference/commands/device.md +11 -18
  50. package/docs/cli-reference/commands/docs/index.md +1 -1
  51. package/docs/cli-reference/commands/docs/list.md +1 -1
  52. package/docs/cli-reference/commands/docs/search.md +1 -1
  53. package/docs/cli-reference/commands/docs/show.md +1 -1
  54. package/docs/cli-reference/commands/install.md +6 -8
  55. package/docs/cli-reference/commands/next.md +1 -1
  56. package/docs/cli-reference/commands/order.md +1 -1
  57. package/docs/cli-reference/commands/pay.md +1 -1
  58. package/docs/cli-reference/commands/readyz.md +11 -11
  59. package/docs/cli-reference/commands/refund/cancel.md +1 -1
  60. package/docs/cli-reference/commands/refund/create.md +1 -1
  61. package/docs/cli-reference/commands/refund/get.md +2 -2
  62. package/docs/cli-reference/commands/refund/index.md +1 -1
  63. package/docs/cli-reference/commands/refund/list.md +1 -1
  64. package/docs/cli-reference/commands/refund/watch.md +1 -1
  65. package/docs/cli-reference/commands/services/action.md +3 -24
  66. package/docs/cli-reference/commands/services/checkout.md +2 -17
  67. package/docs/cli-reference/commands/services/events.md +1 -1
  68. package/docs/cli-reference/commands/services/get.md +2 -4
  69. package/docs/cli-reference/commands/services/index.md +3 -4
  70. package/docs/cli-reference/commands/services/invoke.md +4 -6
  71. package/docs/cli-reference/commands/services/list.md +1 -1
  72. package/docs/cli-reference/commands/services/next.md +12 -78
  73. package/docs/cli-reference/commands/services/quote.md +4 -4
  74. package/docs/cli-reference/commands/services/read-result.md +6 -17
  75. package/docs/cli-reference/commands/services/start.md +3 -5
  76. package/docs/cli-reference/commands/vault/access.md +1 -5
  77. package/docs/cli-reference/conventions.md +6 -4
  78. package/docs/cli-reference/index.md +1 -10
  79. package/docs/skill-bundle-rollout/01-mcp-authentication.md +134 -0
  80. package/docs/skill-bundle-rollout/02-platform-bundle-repositories.md +210 -0
  81. package/docs/skill-bundle-rollout/03-platform-publishing.md +161 -0
  82. package/docs/skill-bundle-rollout/04-first-wave-platforms.md +69 -0
  83. package/docs/skill-bundle-rollout/05-sync-operations.md +62 -0
  84. package/docs/skill-bundle-rollout/README.md +151 -0
  85. package/package.json +12 -20
  86. package/skills/itpay/SKILL.md +102 -110
  87. package/assets/sell-preview/index.html +0 -6
  88. package/assets/sell-preview/preview.js +0 -9
  89. package/bin/darwin-amd64/itpay-sell +0 -0
  90. package/bin/darwin-arm64/itpay-sell +0 -0
  91. package/bin/linux-amd64/itpay-sell +0 -0
  92. package/bin/linux-arm64/itpay-sell +0 -0
  93. package/bin/windows-amd64/itpay-sell.exe +0 -0
  94. package/dist/src/commands/aftercare.js +0 -12
  95. package/dist/src/commands/presentation.js +0 -153
  96. package/dist/src/commands/rail_catalog.js +0 -1
  97. package/dist/src/commands/services/actions.js +0 -133
  98. package/dist/src/commands/services/commerce.js +0 -197
  99. package/dist/src/commands/services/lifecycle.js +0 -418
  100. package/dist/src/commands/services/results.js +0 -130
  101. package/dist/src/render/browser.js +0 -65
  102. package/dist/src/render/checkout_handoff.js +0 -101
  103. package/dist/src/render/checkout_plan.js +0 -47
  104. package/dist/src/sell/commands.js +0 -80
  105. package/dist/src/sell/contract.js +0 -86
  106. package/dist/src/sell/local.js +0 -260
  107. package/dist/src/sell/mcp.js +0 -49
  108. package/dist/src/sell/preview.js +0 -70
  109. package/dist/src/sell/sync.js +0 -145
  110. package/dist/src/services/adapter.js +0 -1
  111. package/dist/src/services/presentation.js +0 -198
  112. package/dist/src/services/rail/actions.js +0 -51
  113. package/dist/src/services/rail/adapter.js +0 -27
  114. package/dist/src/services/rail/aftercare.js +0 -45
  115. package/dist/src/services/rail/catalog.js +0 -261
  116. package/dist/src/services/rail/checkout.js +0 -19
  117. package/dist/src/services/rail/fulfillment.js +0 -76
  118. package/dist/src/services/rail/guide.js +0 -110
  119. package/dist/src/services/rail/invocation.js +0 -54
  120. package/dist/src/services/rail/page.js +0 -76
  121. package/dist/src/services/rail/pagination.js +0 -6
  122. package/dist/src/services/rail/query.js +0 -71
  123. package/dist/src/services/rail/readers.js +0 -107
  124. package/dist/src/services/rail/reading.js +0 -125
  125. package/dist/src/services/rail/recovery.js +0 -51
  126. package/dist/src/services/rail/results.js +0 -378
  127. package/dist/src/services/rail/review.js +0 -268
  128. package/dist/src/services/rail/saved.js +0 -49
  129. package/dist/src/services/rail/wait.js +0 -11
  130. package/dist/src/services/registry.js +0 -31
  131. package/dist/src/services/schema.js +0 -21
  132. package/dist/src/services/shared/envelope.js +0 -184
  133. package/dist/src/services/shared/input.js +0 -39
  134. package/dist/src/services/shared/pagination.js +0 -28
  135. package/dist/src/services/shared/platform.js +0 -365
  136. package/dist/src/services/shared/refund.js +0 -40
  137. package/dist/src/services/shared/workflow.js +0 -28
  138. package/dist/src/state/account_auth.js +0 -347
  139. package/dist/src/state/task_journal.js +0 -90
  140. package/docs/agent/buyer/rail-booking.json +0 -176
  141. package/docs/agent/buyer/rail-fast-checkout.json +0 -48
  142. package/docs/cli-reference/commands/aftercare.md +0 -15
  143. package/docs/cli-reference/commands/auth.md +0 -96
  144. package/docs/cli-reference/commands/sell.md +0 -1364
  145. package/docs/cli-reference/commands/services/page.md +0 -71
  146. package/docs/cli-reference/commands/services/run.md +0 -152
  147. package/docs/sell.md +0 -84
  148. /package/bin/{itp.mjs → itp} +0 -0
@@ -1,48 +0,0 @@
1
- {
2
- "schema_version": "itp.agent_doc.v1",
3
- "role": "buyer_agent",
4
- "product_scope": "itpay_rail",
5
- "topic": "rail-fast-checkout",
6
- "title": "Rail Fast Checkout — Delegated Purchase Supplement",
7
- "purpose": "Short delegated-purchase supplement to rail-booking; host presentation differences only.",
8
- "when_to_use": [
9
- "The buyer delegated railway selection and a current bookable result is available. Read rail-booking first."
10
- ],
11
- "steps": [
12
- {
13
- "step": "read_full_flow",
14
- "command": "Use the rail-booking guide already read for this request",
15
- "notes": [
16
- "Use the current query result and booking_template; this topic does not replace the railway guide.",
17
- "Before first querying, follow the single endpoint-understanding brief in rail-booking (meaning/category/evidence/unknowns and Exact/Smart choice). Use reliable route knowledge or one short lookup if merely probable. With current results, continue from their facts; do not restart to backfill a brief."
18
- ]
19
- },
20
- {
21
- "step": "continue_delegated_booking",
22
- "command": "Use the current result’s booking_template and returned next action",
23
- "notes": [
24
- "Select under the buyer’s unchanged rules. Required human terms still require real consent. Continue the same booking execution.",
25
- "Copy the complete plan template into one booking; raw legs are single-leg compatibility only, multi-leg purchases require the complete selections template; one whole quote and official payment entry, separate issuance. Use the returned full review JSON; only missing real agreement requires asking."
26
- ]
27
- },
28
- {
29
- "step": "present_host_handoff",
30
- "command": "Use the current Host handoff",
31
- "notes": [
32
- "Show only the supported official entry. Read itpay order <order_id> --json after payment for authoritative status; issuing is not issued."
33
- ]
34
- }
35
- ],
36
- "never": [
37
- "Never invent consent, identity or a seat code.",
38
- "Never duplicate a purchase or repeat an unknown-outcome payment.",
39
- "Never show an internal command to the human.",
40
- "When a failure has no applicable next, interaction, recovery or complete new-query template, stop; never guess undeclared fields, duplicate a booking, split a journey into separate payments or claim an unverified cause."
41
- ],
42
- "search_terms": [
43
- "fast checkout",
44
- "快速下单",
45
- "一键购票",
46
- "rail checkout recipe"
47
- ]
48
- }
@@ -1,15 +0,0 @@
1
- # `itpay aftercare`
2
-
3
- Railway manual refund/change intake; ordinary service refunds retain `itpay refund`.
4
-
5
- ```sh
6
- itpay aftercare list --order <order_id> --json
7
- itpay aftercare create --order <order_id> --input-json <file> --json
8
- itpay aftercare get <case_id> --json
9
- itpay aftercare respond <case_id> --input-json <file> --json
10
- itpay aftercare cancel <case_id> --input-json <file> --json
11
- ```
12
-
13
- `list` returns the complete current JSON templates, original safe journey and available ticket targets. Indices start at zero. Use user-selected targets; do not guess supplier IDs or money. Only real scope consent sets `user_confirmed_scope=true`.
14
-
15
- `get` shows original immutable request, history, supplier facts and separate money state. Pending/manual intake does not authorize financial execution. A current change proposal must be explicitly accepted using its returned revision; the original purchase consent is insufficient. Fees are coordinated manually, with no automatic payment link. Cancellation cannot undo supplier or money operations already started. Platform content locks remain; safe remaining-ticket status is a separate authorized read.
@@ -1,96 +0,0 @@
1
- # Account login
2
-
3
- `itpay auth` binds the enrolled Agent Device to a real ItPay account through an official authorization handoff. It is used by Path A (trial exhausted → log in → keep querying) and any time a command returns `login_required`. Path B purchases do **not** require running `itpay auth login` first — account authentication can happen inside the protected checkout instead.
4
-
5
- ## Syntax
6
-
7
- ```bash
8
- itpay auth login [--json]
9
- itpay auth status [--json]
10
- ```
11
-
12
- Both commands require an enrolled Agent Device and use the current `--agent-type` and Backend (`ITPAY_BACKEND_URL`). The Agent never receives an account bearer token; binding reuses the stable device-account ownership mechanism.
13
-
14
- ## `itpay auth login`
15
-
16
- Creates one official authorization request bound to this Backend, Device and Agent Instance, then stops. Repeating `auth login` while a valid request is open returns the same request — it does not rotate the QR code or create parallel sessions.
17
-
18
- ```json
19
- {
20
- "status": "auth_pending",
21
- "result": {
22
- "dashboard_auth_session_id": "das_...",
23
- "expires_at": "2026-09-20T12:34:56Z",
24
- "methods": ["phone", "email", "alipay", "wechat"]
25
- },
26
- "handoff": {
27
- "url": "https://dev.itpay.ai/signin?dashboard_auth_session_id=das_...&start_token=...",
28
- "qr_local_path": "...",
29
- "qr_image_url": "...",
30
- "markdown": "..."
31
- },
32
- "instruction": "把官方授权页或二维码交给用户。用户在页面内选择手机号验证码、邮箱或钱包完成登录;不要替用户输入手机号或验证码。",
33
- "next": {
34
- "command": "itpay auth status --json",
35
- "reason": "用户完成页面登录后确认绑定",
36
- "poll_after_ms": 5000
37
- },
38
- "recovery": []
39
- }
40
- ```
41
-
42
- - `handoff.url` is the official sign-in page carrying this authorization request. The page offers phone-code verification, email verification, and wallet options — the user chooses; the Agent must not deep-link a single wallet and call it universal authorization.
43
- - The URL's `start_token` is valid only inside the official page handoff. Never log it, echo it in chat, or send it to another host.
44
- - When the user already finished login before `auth login` runs, the command returns `authenticated` directly.
45
-
46
- ## `itpay auth status`
47
-
48
- Polls the open authorization request, then performs the device binding. Safe to run repeatedly and concurrently: only the requester Device/Instance can complete the binding.
49
-
50
- ```json
51
- {
52
- "status": "auth_pending",
53
- "result": { "dashboard_auth_session_id": "das_...", "expires_at": "..." },
54
- "instruction": "用户仍在官方页面完成登录;保留当前 handoff,不要生成新二维码。",
55
- "next": { "command": "itpay auth status --json", "poll_after_ms": 5000 },
56
- "recovery": []
57
- }
58
- ```
59
-
60
- ```json
61
- {
62
- "status": "authenticated",
63
- "result": {
64
- "buyer_id": "buyer_...",
65
- "bound": true,
66
- "query_quota": [
67
- { "service_id": "itpay-rail-exact", "policy": "free_registered", "remaining": null },
68
- { "service_id": "itpay-rail-smart", "policy": "free_registered", "remaining": null }
69
- ]
70
- },
71
- "instruction": "登录与绑定已完成,告知用户可继续之前的查询;已注册账号查询不消耗试用次数,仍受正常限流。",
72
- "next": { "command": "itpay services run <service_id> --execution <pending_execution_id> --json", "reason": "恢复被额度暂停的原查询" },
73
- "recovery": []
74
- }
75
- ```
76
-
77
- Terminal and error states:
78
-
79
- | `status` | Meaning | Agent action |
80
- | --- | --- | --- |
81
- | `authenticated` | Device bound to a real account | Resume the original intent (a quota-blocked execution, the user's request) unchanged |
82
- | `auth_pending` | User has not finished the page | Keep the same handoff; poll with `poll_after_ms` |
83
- | `auth_expired` | Session expired before completion | Offer to start `itpay auth login` again; prior query input is still preserved server-side |
84
- | `login_required` | No open request, not bound | Run `itpay auth login` |
85
- | `auth_cancelled` / `auth_denied` | User declined or closed the page | Respect the refusal; do not silently re-open; the pending query stays resumable |
86
- | `auth_session_missing` | Saved authorization session no longer exists (404/410) | `auth status` stays read-only; an explicit `auth login` may create one new official session |
87
- | `auth_status_unknown` | Transport or temporary server failure while reading status | Keep the same saved session and reread later; do not open a second login |
88
-
89
- ## Rules
90
-
91
- - The human's phone number and SMS code are entered only on the official page — never through chat or CLI input. A `buyer_id`, a typed phone string, or a passenger phone is **not** proof of phone verification.
92
- - Verified email OR verified mainland phone both establish a valid login; the user picks on the page. Phone verification is not a prerequisite for registered free search — a verified email alone is sufficient.
93
- - Login never grants Vault content, passenger history, or another Agent's authority. Other devices/platforms enroll and authorize separately.
94
- - After `authenticated`, server-side identity is re-read; an anonymous execution blocked at the quota step resumes with `services run <service> --execution <id> --json` — no new execution, no re-asked itinerary.
95
- - Refusing or cancelling login deletes nothing: saved results and purchase options remain usable.
96
- - Seller authoring uses `itpay sell auth` separately.