@itpay/cli 2.1.1 → 2.1.3
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/bin/darwin-amd64/itpay-sell +0 -0
- package/bin/darwin-arm64/itpay-sell +0 -0
- package/bin/linux-amd64/itpay-sell +0 -0
- package/bin/linux-arm64/itpay-sell +0 -0
- package/bin/windows-amd64/itpay-sell.exe +0 -0
- package/dist/src/commands/readyz.js +1 -1
- package/dist/src/commands/services.js +9 -0
- package/dist/src/sell/contract.js +3 -1
- package/dist/src/state/account_auth.js +8 -2
- package/dist/src/state/config.js +2 -2
- package/docs/cli-reference/commands/sell.md +25 -3
- package/docs/sell.md +31 -3
- package/package.json +3 -2
|
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
|
-
?
|
|
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")
|
|
@@ -8,7 +8,7 @@ export const SELL_GUIDE = {
|
|
|
8
8
|
"Use the authenticated user's existing merchant. KYB and payout changes remain in the dashboard.",
|
|
9
9
|
"Resolve every API against its declared method, Content-Type, parameters, response schema and locked version. Ask for missing inputs; never guess credentials or change contracts.",
|
|
10
10
|
"Only saved versions may run. A run is not a saved version. Local evidence cannot grant platform test approval.",
|
|
11
|
-
"
|
|
11
|
+
"Use the platform node catalog and validator for supported pricing, quotas, confirmation and durable fulfillment. Every paid success path must cross payment and delivery gates.",
|
|
12
12
|
"Use own credentials for local requests. Platform-managed credentials stay on the platform. Mark execution location honestly.",
|
|
13
13
|
"Present side effects before live tests. Unknown results stop automatic retries. Local payment/refund/delivery gates are simulated, never real funds.",
|
|
14
14
|
"Show the exact workflow and version before user confirmation. Preview price, delivery and current terms before explicit submission approval.",
|
|
@@ -44,6 +44,8 @@ export const SELL_OPERATIONS = [
|
|
|
44
44
|
{ command: "pricing get", method: "GET", path: `${draft}/workflow`, scope: read, fields: {}, description: "Read the current price and refund policy" },
|
|
45
45
|
{ command: "pricing set", method: "PUT", path: `${draft}/pricing`, scope: write, fields: { expected_revision: "number", pricing: "object", policy: "object" }, description: "Set per-call price and platform refund policy" },
|
|
46
46
|
{ command: "verify", method: "POST", path: `${draft}/validation-runs`, scope: test, fields: { workflow_version_id: "string", expected_semantic_revision: "number", expected_fixture_revision: "number" }, description: "Start platform verification for an explicitly saved version", confirmation: true },
|
|
47
|
+
{ command: "tests start-checkout", method: "POST", path: `${draft}/live-checkout-tests`, scope: test, fields: { expected_revision: "number", agent_instance_id: "string" }, description: "Dev admin only: freeze one success fixture into a private real-checkout test bound to your registered Agent. Payment still requires user confirmation; this does not publish the service.", confirmation: true },
|
|
48
|
+
{ command: "tests accept-checkout", method: "POST", path: `${draft}/live-checkout-tests/{execution_id}/accept`, scope: test, fields: {}, description: "Record server-observed issued tickets and completed delivery as evidence for the exact tested revision. Never synthesizes payment or issuance.", confirmation: true },
|
|
47
49
|
{ command: "runs get", method: "GET", path: `${draft}/validation-runs/{run_id}`, scope: read, fields: {}, description: "Inspect platform test nodes and diagnostics" },
|
|
48
50
|
{ command: "runs confirm", method: "POST", path: `${draft}/validation-runs/{run_id}/confirm`, scope: test, fields: { risk_hash: "string" }, description: "Confirm the exact disclosed platform test side effects", confirmation: true },
|
|
49
51
|
{ command: "submission preview", method: "GET", path: `${org}/guide`, scope: read, fields: { draft_id: "string" }, description: "Read publication readiness and required agreements" },
|
|
@@ -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
|
-
|
|
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
|
|
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);
|
package/dist/src/state/config.js
CHANGED
|
@@ -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.
|
|
19
|
-
export const API_CONTRACT_REVISION = "sha256:
|
|
18
|
+
export const CLI_VERSION = "2.1.3";
|
|
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";
|
|
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
|
-
-
|
|
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/
|
|
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,25 @@ Options:
|
|
|
1339
1340
|
|
|
1340
1341
|
## Seller login and dev
|
|
1341
1342
|
|
|
1342
|
-
Use `ITPAY_BACKEND_URL=https://dev.itpay.ai itpay sell auth login
|
|
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.
|
|
1344
|
+
|
|
1345
|
+
## Private dev live checkout acceptance
|
|
1346
|
+
|
|
1347
|
+
`itpay sell tests start-checkout --merchant-id <merchant> --draft-id <draft> --input-json <file> --confirm --json`
|
|
1348
|
+
|
|
1349
|
+
Requires the dev server in live Provider mode, an account-scoped platform admin session,
|
|
1350
|
+
and an active enrolled Agent already bound to the same buyer. The JSON contains
|
|
1351
|
+
`expected_revision` and `agent_instance_id`. Save exactly one success fixture first.
|
|
1352
|
+
This queues a private canary execution; it does not publish a service or pay for a ticket.
|
|
1353
|
+
Disclose the live query side effects before using `--confirm`.
|
|
1354
|
+
|
|
1355
|
+
Resume the returned `service_execution_id` using the normal workflow commands through
|
|
1356
|
+
that Agent. The user confirms the route and submits passenger details in the protected
|
|
1357
|
+
Checkout page. Only a verified payment callback permits supplier creation/payment.
|
|
1358
|
+
|
|
1359
|
+
`itpay sell tests accept-checkout --merchant-id <merchant> --draft-id <draft> --execution-id <execution> --confirm --json`
|
|
1360
|
+
|
|
1361
|
+
Records server-observed completed delivery and issued tickets for the exact frozen
|
|
1362
|
+
workflow, fixture and dependency hashes. Pending, partial, manual-recovery, unpaid or
|
|
1363
|
+
changed tests cannot pass. No payment or issuance assertions are accepted as input.
|
|
1364
|
+
Then use the normal submission and admin review flow; this test alone is not publication.
|
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
|
-
-
|
|
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/
|
|
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,25 @@ 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
|
|
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.
|
|
64
|
+
|
|
65
|
+
## Private dev live checkout acceptance
|
|
66
|
+
|
|
67
|
+
`itpay sell tests start-checkout --merchant-id <merchant> --draft-id <draft> --input-json <file> --confirm --json`
|
|
68
|
+
|
|
69
|
+
Requires the dev server in live Provider mode, an account-scoped platform admin session,
|
|
70
|
+
and an active enrolled Agent already bound to the same buyer. The JSON contains
|
|
71
|
+
`expected_revision` and `agent_instance_id`. Save exactly one success fixture first.
|
|
72
|
+
This queues a private canary execution; it does not publish a service or pay for a ticket.
|
|
73
|
+
Disclose the live query side effects before using `--confirm`.
|
|
74
|
+
|
|
75
|
+
Resume the returned `service_execution_id` using the normal workflow commands through
|
|
76
|
+
that Agent. The user confirms the route and submits passenger details in the protected
|
|
77
|
+
Checkout page. Only a verified payment callback permits supplier creation/payment.
|
|
78
|
+
|
|
79
|
+
`itpay sell tests accept-checkout --merchant-id <merchant> --draft-id <draft> --execution-id <execution> --confirm --json`
|
|
80
|
+
|
|
81
|
+
Records server-observed completed delivery and issued tickets for the exact frozen
|
|
82
|
+
workflow, fixture and dependency hashes. Pending, partial, manual-recovery, unpaid or
|
|
83
|
+
changed tests cannot pass. No payment or issuance assertions are accepted as input.
|
|
84
|
+
Then use the normal submission and admin review flow; this test alone is not publication.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@itpay/cli",
|
|
3
|
-
"version": "2.1.
|
|
3
|
+
"version": "2.1.3",
|
|
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",
|