@itpay/cli 2.1.1 → 2.1.2

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.
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -8,7 +8,7 @@ export async function runReadyz(backend, options = {}) {
8
8
  status: response.status,
9
9
  result: { backend: "available", backend_url: backendURL, environment, ...(options.agentType ? { agent_type: options.agentType } : {}) },
10
10
  instruction: environment === "development"
11
- ? "ItPay sandbox 可用。先完整读取内置 Skill,再根据用户意图选择新服务、已购内容、订单或退款入口;后续必须执行返回的完整命令并保持同一 sandbox Backend。"
11
+ ? `ItPay 开发环境 ${backendURL} 可用。先完整读取内置 Skill,再根据用户意图选择新服务、已购内容、订单或退款入口;后续必须执行返回的完整命令并保持同一 Backend。`
12
12
  : "ItPay 可用。先完整读取内置 Skill,再根据用户意图选择新服务、已购内容、订单或退款入口;不要默认开始购买。",
13
13
  next: { command: "itpay skill show itpay --json", reason: "加载完整操作与安全规则" },
14
14
  recovery: [],
@@ -666,6 +666,15 @@ function servicesNextEnvelope(model) {
666
666
  recovery: [],
667
667
  };
668
668
  }
669
+ if (state === "human_action" && model.workflow?.human_action) {
670
+ return {
671
+ status: "confirmation_required",
672
+ result: { service_execution_id: id, service_id: execution.service_id, human_action: model.workflow.human_action },
673
+ instruction: "请展示待确认的位置,请用户明确确认后,按 input_schema 填写 --input 字段。继续同一执行,不重新查询;这一步不是购买确认。",
674
+ next: { command: `itpay services action ${id} --action ${model.workflow.human_action.action_type} --actor-type human --status approved --input <key=value> --json`, reason: "用户确认后继续当前查询" },
675
+ recovery: [],
676
+ };
677
+ }
669
678
  const recovery = state === "recovery_required" || state === "failed";
670
679
  let command = `itpay services next ${id} --json`;
671
680
  if (state === "payment")
@@ -49,9 +49,15 @@ async function accountAuth(action, baseURL, env, fetcher, backend) {
49
49
  const response = await request('/v1/dashboard/auth-sessions', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ provider: 'alipay', return_to: backend ? '/' : '/seller' }) });
50
50
  const result = await response.json();
51
51
  const url = new URL(result.start_url, baseURL);
52
- if (url.origin !== new URL(baseURL).origin)
52
+ const sameOrigin = url.origin === new URL(baseURL).origin;
53
+ const alipay = url.origin === 'https://openauth.alipay.com' && url.pathname === '/oauth2/publicAppAuthorize.htm' && !url.username && !url.password;
54
+ if (!sameOrigin && !alipay)
53
55
  throw new Error('Unexpected authorization origin');
54
- const startToken = url.searchParams.get('start_token');
56
+ const fragment = new URLSearchParams(url.hash.replace(/^#dashboard-auth\?/, ''));
57
+ const state = url.searchParams.get('state')?.split('.');
58
+ const startToken = alipay
59
+ ? (state?.length === 2 && state[0] === result.dashboard_auth_session_id ? state[1] : undefined)
60
+ : url.searchParams.get('start_token') || fragment.get('start_token');
55
61
  if (!startToken || !result.poll_token || !result.dashboard_auth_session_id)
56
62
  throw new Error('Incomplete authorization response');
57
63
  save({ baseURL, sessionID: result.dashboard_auth_session_id, pollToken: result.poll_token, startToken }, env, purpose);
@@ -15,8 +15,8 @@ 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.1";
19
- export const API_CONTRACT_REVISION = "sha256:b8593e4d73782a3ddeb5d070df1db572e422dd0aa08083372bc8971b5412b643";
18
+ export const CLI_VERSION = "2.1.2";
19
+ export const API_CONTRACT_REVISION = "sha256:8fc92bcea2b2c5205139382e73295fbabf3ff9b0ae001a7e8d748d3bb6857061";
20
20
  const CART_SESSION_DEFAULT_DIR = ".itpay-v3";
21
21
  const CART_SESSION_FILENAME = "cart.json";
22
22
  const OPERATION_JOURNAL_FILENAME = "operations.json";
@@ -23,7 +23,8 @@ All platform operations accept `--input-json <file>` for their declared fields a
23
23
 
24
24
  ## Invariants
25
25
 
26
- - Current public runtime is synchronous, acyclic, single entry, per-call pricing, one payment node, and delivery on success. Quota, prepaid consumption and async workflows are not publishable.
26
+ - The current runtime accepts bounded, acyclic, single-entry workflows with multiple API nodes. Free queries can use quota and explicit human confirmation; paid workflows use one payment node and either fixed per-call pricing or a trusted pre-payment dynamic quote. Prepaid balance billing remains unsupported.
27
+ - Protected railway fulfillment resumes through the platform booking Owner only after verified payment and Web passenger confirmation. A standalone API probe cannot supply a payment identity or passenger records. Follow the server Guide for actual acceptance and publication blockers; local graph validation is not live ticket-issuance evidence.
27
28
  - Local reports are diagnostics, not platform approval evidence. Platform verification is required; existing valid evidence may be reused. Admin approval never repeats Provider calls.
28
29
  - Every visual view reads the same YAML. Layout is presentation only.
29
30
  - Disclosure/confirmation binds the version being acted on. Do not turn `--confirm` into blanket permission for later changes.
@@ -35,7 +36,7 @@ The local `.itpay-sell` directory contains private fixtures, reports and the enc
35
36
 
36
37
  Local reports never substitute for the platform verification gate. Repeated upload of an unchanged saved version reuses its cloud version; a changed cloud revision or fixture revision requires explicit pull/review.
37
38
 
38
- For repository builds, run `scripts/v3/build-sell-runtime.sh`, build `apps/web/vite.sell-preview.config.ts`, and then build/package `apps/cli`. Packaging rejects missing native binaries or preview assets. `scripts/v3/sync-sell-contract.mjs --check` verifies that the CLI command contracts match the backend/MCP package.
39
+ For CLI repository builds, run `node scripts/fetch-sell-runtime.mjs` to obtain the exact checksummed native runtime in `seller-runtime.lock.json`, then `npm run test:package`. The committed `assets/sell-preview` directory supplies the local Builder. Packaging rejects missing native binaries or preview assets; do not substitute an arbitrary local binary for the locked release.
39
40
 
40
41
  Example local MCP configuration (use the existing authenticated CLI account):
41
42
 
@@ -1339,4 +1340,4 @@ Options:
1339
1340
 
1340
1341
  ## Seller login and dev
1341
1342
 
1342
- Use `ITPAY_BACKEND_URL=https://dev.itpay.ai itpay sell auth login --json` to receive the normal ItPay authorization link. After browser login and required email verification, run `ITPAY_BACKEND_URL=https://dev.itpay.ai itpay sell auth status --json`. The CLI claims its own account session through the standard API and stores it in an owner-only file; never copy tokens or browser cookies. `itpay sell auth logout --json` revokes this session. Keep the same backend prefix on subsequent commands; production, dev, and sandbox state are isolated. Agent device enrollment does not grant Seller organization access.
1343
+ Use `ITPAY_BACKEND_URL=https://dev.itpay.ai itpay sell auth login` to receive the normal ItPay authorization link. After browser login and required email verification, run `ITPAY_BACKEND_URL=https://dev.itpay.ai itpay sell auth status`. The CLI claims its own account session through the standard API and stores it in an owner-only file; never copy tokens or browser cookies. `itpay sell auth logout` revokes this session. Keep the same backend prefix on subsequent commands; production, dev, and sandbox state are isolated. Agent device enrollment does not grant Seller organization access.
package/docs/sell.md CHANGED
@@ -1,5 +1,11 @@
1
1
  # Sell Agent guide
2
2
 
3
+ The railway acceptance release `2.1.2` is published under npm's `next` tag,
4
+ not `latest`. Install this explicit version for dev acceptance and set
5
+ `ITPAY_BACKEND_URL=https://dev.itpay.ai` on every command. Its API contract requires
6
+ the matching dev backend release; do not use it against the older production
7
+ backend. Promote the npm latest tag only after production compatibility is verified.
8
+
3
9
  `itpay sell` is the Seller command namespace. Buyer `services` commands remain separate. Read `itpay sell guide --json` first, authenticate with `itpay sell auth login` and complete the standard ItPay browser login, then run `itpay sell auth status`, then use `sell status` to select the user's existing merchant. An unverified merchant must finish KYB and payout setup in the dashboard.
4
10
 
5
11
  ## Local-first workflow
@@ -23,7 +29,8 @@ All platform operations accept `--input-json <file>` for their declared fields a
23
29
 
24
30
  ## Invariants
25
31
 
26
- - Current public runtime is synchronous, acyclic, single entry, per-call pricing, one payment node, and delivery on success. Quota, prepaid consumption and async workflows are not publishable.
32
+ - The current runtime accepts bounded, acyclic, single-entry workflows with multiple API nodes. Free queries can use quota and explicit human confirmation; paid workflows use one payment node and either fixed per-call pricing or a trusted pre-payment dynamic quote. Prepaid balance billing remains unsupported.
33
+ - Protected railway fulfillment resumes through the platform booking Owner only after verified payment and Web passenger confirmation. A standalone API probe cannot supply a payment identity or passenger records. Follow the server Guide for actual acceptance and publication blockers; local graph validation is not live ticket-issuance evidence.
27
34
  - Local reports are diagnostics, not platform approval evidence. Platform verification is required; existing valid evidence may be reused. Admin approval never repeats Provider calls.
28
35
  - Every visual view reads the same YAML. Layout is presentation only.
29
36
  - Disclosure/confirmation binds the version being acted on. Do not turn `--confirm` into blanket permission for later changes.
@@ -35,7 +42,7 @@ The local `.itpay-sell` directory contains private fixtures, reports and the enc
35
42
 
36
43
  Local reports never substitute for the platform verification gate. Repeated upload of an unchanged saved version reuses its cloud version; a changed cloud revision or fixture revision requires explicit pull/review.
37
44
 
38
- For repository builds, run `scripts/v3/build-sell-runtime.sh`, build `apps/web/vite.sell-preview.config.ts`, and then build/package `apps/cli`. Packaging rejects missing native binaries or preview assets. `scripts/v3/sync-sell-contract.mjs --check` verifies that the CLI command contracts match the backend/MCP package.
45
+ For CLI repository builds, run `node scripts/fetch-sell-runtime.mjs` to obtain the exact checksummed native runtime in `seller-runtime.lock.json`, then `npm run test:package`. The committed `assets/sell-preview` directory supplies the local Builder. Packaging rejects missing native binaries or preview assets; do not substitute an arbitrary local binary for the locked release.
39
46
 
40
47
  Example local MCP configuration (use the existing authenticated CLI account):
41
48
 
@@ -53,4 +60,4 @@ Example local MCP configuration (use the existing authenticated CLI account):
53
60
 
54
61
  ## Seller login and dev
55
62
 
56
- Use `ITPAY_BACKEND_URL=https://dev.itpay.ai itpay sell auth login --json` to receive the normal ItPay authorization link. After browser login and required email verification, run `ITPAY_BACKEND_URL=https://dev.itpay.ai itpay sell auth status --json`. The CLI claims its own account session through the standard API and stores it in an owner-only file; never copy tokens or browser cookies. `itpay sell auth logout --json` revokes this session. Keep the same backend prefix on subsequent commands; production, dev, and sandbox state are isolated. Agent device enrollment does not grant Seller organization access.
63
+ Use `ITPAY_BACKEND_URL=https://dev.itpay.ai itpay sell auth login` to receive the normal ItPay authorization link. After browser login and required email verification, run `ITPAY_BACKEND_URL=https://dev.itpay.ai itpay sell auth status`. The CLI claims its own account session through the standard API and stores it in an owner-only file; never copy tokens or browser cookies. `itpay sell auth logout` revokes this session. Keep the same backend prefix on subsequent commands; production, dev, and sandbox state are isolated. Agent device enrollment does not grant Seller organization access.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@itpay/cli",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "The ItPay CLI for services, orders, and human-authorized purchased content.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -22,7 +22,8 @@
22
22
  "assets/"
23
23
  ],
24
24
  "publishConfig": {
25
- "access": "public"
25
+ "access": "public",
26
+ "tag": "next"
26
27
  },
27
28
  "keywords": [
28
29
  "itpay",