@xiashe/cli 0.1.10 → 0.1.12

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/README.md CHANGED
@@ -23,7 +23,8 @@ xiashe chat send --chat "New Chat" --content "帮我处理这个文件" --file .
23
23
  xiashe skills publish draft . --source xiashe
24
24
  xiashe skills publish doctor "<submission-id>"
25
25
  xiashe skills publish submit "<submission-id>"
26
- xiashe payment doctor
26
+ # This checks only that the bridge CLI is present; it does not query a wallet.
27
+ xiashe payment bridge-info
27
28
  # After the Agent shows the Skill and purpose and the user explicitly agrees:
28
29
  xiashe payment pay --resource-url "https://<actions-site>/payment/alipay-ai-collect?orderId=<id>" --intent-summary "使用付费 Skill:<name>" --confirm
29
30
  xiashe payment status --resource-url "https://<actions-site>/payment/alipay-ai-collect?orderId=<id>"
@@ -47,10 +48,10 @@ Production defaults:
47
48
 
48
49
  `xiashe payment` is the shell-capable Agent path for Alipay AI Pay. It delegates only to the official local `alipay-bot` supplied by `@alipay/agent-payment`; it does not implement or expose `Payment-Needed` / `Payment-Proof` itself.
49
50
 
50
- - `xiashe payment doctor` checks whether the local wallet is enabled.
51
- - `xiashe payment pay` requires an HTTPS AI-Collect resource URL, a visible purchase-purpose summary, and `--confirm`. The command then waits for the user to approve in Alipay App.
52
- - `xiashe payment status` returns a normalized status only. No wallet protocol payload or proof is printed.
51
+ - `xiashe payment bridge-info` checks that the official buyer CLI is available without querying the wallet. `payment doctor` remains a manual diagnostic only.
52
+ - `xiashe payment pay` requests the resource once, saves its exact 402 request in a private local file, and passes that file plus one stable session id to the official buyer CLI. It requires an HTTPS AI-Collect resource URL, a visible purchase-purpose summary, and `--confirm`.
53
+ - `xiashe payment status` resumes the same local attempt with its official query credential and returns a normalized status only. No wallet protocol payload or proof is printed.
53
54
 
54
55
  An Agent must never add `--confirm` before the user has explicitly agreed to the displayed purpose. If the wallet is unavailable, obtain permission before running the official `@alipay/agent-payment` setup, then run `payment doctor` again.
55
56
 
56
- For a clean Codex Task, the XiaShe MCP response provides a version-pinned ephemeral command such as `npx -y @xiashe/cli@0.1.10 payment doctor`. No global `xiashe` installation is required for that path.
57
+ For a clean Codex Task, the XiaShe MCP response provides a version-pinned ephemeral command such as `npx -y @xiashe/cli@0.1.12 payment bridge-info`. No global `xiashe` installation is required for that path. The Agent must run the subsequent payment command in the foreground and must not expect a QR code: this is an Alipay App-confirmation flow.
package/bin/xiashe.mjs CHANGED
@@ -36,6 +36,7 @@ const {
36
36
  decodeMcpToolResult,
37
37
  nowIso,
38
38
  checkAlipayWallet,
39
+ getAlipayWalletBridgeInfo,
39
40
  payAlipay402Resource,
40
41
  queryAlipay402Resource
41
42
  } = sdk;
@@ -95,8 +96,8 @@ Usage:
95
96
  ${c} files upload <path>
96
97
  ${c} files list
97
98
 
98
- ${c} payment doctor
99
- ${c} payment pay --resource-url <https-url> --intent-summary <text> --confirm
99
+ ${c} payment bridge-info|doctor
100
+ ${c} payment pay --resource-url <https-url> --intent-summary <text> --confirm [--wallet-timeout-ms <ms>]
100
101
  ${c} payment status --resource-url <https-url>
101
102
 
102
103
  ${c} ops doctor
@@ -126,7 +127,8 @@ function parseGlobal(argv) {
126
127
  actionsUrl: '',
127
128
  market: '',
128
129
  locale: '',
129
- timeoutMs: 20_000
130
+ timeoutMs: 20_000,
131
+ timeoutMsExplicit: false
130
132
  };
131
133
  for (let i = 0; i < argv.length; i += 1) {
132
134
  const value = argv[i];
@@ -173,6 +175,7 @@ function parseGlobal(argv) {
173
175
  if (!Number.isFinite(global.timeoutMs) || global.timeoutMs < 1000) {
174
176
  fail('Invalid --timeout-ms value.', EXIT_USAGE);
175
177
  }
178
+ global.timeoutMsExplicit = true;
176
179
  i += 1;
177
180
  continue;
178
181
  }
@@ -1143,6 +1146,18 @@ async function cmdFiles(sub, args, global) {
1143
1146
 
1144
1147
  async function cmdPayment(sub, args, global) {
1145
1148
  const flags = parseFlags(args);
1149
+ if (sub === 'bridge-info' || sub === 'bridge' || sub === 'prepare') {
1150
+ const result = await getAlipayWalletBridgeInfo({ timeoutMs: global.timeoutMs });
1151
+ print(result, global);
1152
+ return;
1153
+ }
1154
+ const walletTimeoutValue = flags['wallet-timeout-ms'] ?? flags.walletTimeoutMs ?? (global.timeoutMsExplicit ? global.timeoutMs : undefined);
1155
+ const walletTimeoutMs = walletTimeoutValue === undefined
1156
+ ? undefined
1157
+ : numericFlag({ walletTimeoutMs: walletTimeoutValue }, 'walletTimeoutMs', 0);
1158
+ if (walletTimeoutValue !== undefined && !walletTimeoutMs) {
1159
+ fail('Invalid --wallet-timeout-ms value.', EXIT_USAGE);
1160
+ }
1146
1161
  if (sub === 'doctor' || sub === 'wallet' || sub === 'wallet-status') {
1147
1162
  const result = await checkAlipayWallet({ timeoutMs: global.timeoutMs });
1148
1163
  print(result, global);
@@ -1155,7 +1170,7 @@ async function cmdPayment(sub, args, global) {
1155
1170
  resourceUrl,
1156
1171
  intentSummary,
1157
1172
  confirm: flags.confirm === true
1158
- }, { timeoutMs: global.timeoutMs });
1173
+ }, walletTimeoutMs ? { timeoutMs: walletTimeoutMs } : {});
1159
1174
  print(result, global);
1160
1175
  return;
1161
1176
  }
@@ -1165,7 +1180,7 @@ async function cmdPayment(sub, args, global) {
1165
1180
  print(result, global);
1166
1181
  return;
1167
1182
  }
1168
- fail(`Usage: ${COMMAND_NAME} payment doctor|pay|status`, EXIT_USAGE);
1183
+ fail(`Usage: ${COMMAND_NAME} payment bridge-info|doctor|pay|status`, EXIT_USAGE);
1169
1184
  }
1170
1185
 
1171
1186
  async function cmdOps(sub, args, global) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiashe/cli",
3
- "version": "0.1.10",
3
+ "version": "0.1.12",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "xiashe": "bin/xiashe.mjs"
@@ -10,7 +10,7 @@
10
10
  "README.md"
11
11
  ],
12
12
  "dependencies": {
13
- "@xiashe/sdk": "0.1.10"
13
+ "@xiashe/sdk": "0.1.12"
14
14
  },
15
15
  "engines": {
16
16
  "node": ">=20"