@xiashe/cli 0.1.9 → 0.1.10

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
@@ -17,12 +17,16 @@ node packages/xiashe-cli/bin/xiashe.mjs login --email you@example.com --password
17
17
  xiashe skills list
18
18
  xiashe skills install copywriting --connection MaxClaw-1 --watch
19
19
  xiashe agent issue --name "Local WorkBuddy"
20
- xiashe agent connect --token "<token>" --name "Local WorkBuddy"
20
+ xiashe agent connect --token "<token>" --name "Local WorkBuddy" --transport npx
21
21
  xiashe agent run --ack
22
22
  xiashe chat send --chat "New Chat" --content "帮我处理这个文件" --file ./report.pdf --agent "Local WorkBuddy"
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
27
+ # After the Agent shows the Skill and purpose and the user explicitly agrees:
28
+ xiashe payment pay --resource-url "https://<actions-site>/payment/alipay-ai-collect?orderId=<id>" --intent-summary "使用付费 Skill:<name>" --confirm
29
+ xiashe payment status --resource-url "https://<actions-site>/payment/alipay-ai-collect?orderId=<id>"
26
30
  ```
27
31
 
28
32
  Local state is stored in `~/.xiashe/config.json`.
@@ -31,8 +35,22 @@ Local state is stored in `~/.xiashe/config.json`.
31
35
 
32
36
  `xiashe agent run --ack` is the recommended lightweight receiver for shell-capable Agents. It sends cheap heartbeats and only lists/executes work when the backend reports pending tasks or transfers. Default cadence is about 30s while idle, 10s while work is active, and up to 2 minutes after long idle periods.
33
37
 
38
+ Supported transport labels are `a2a`, `mcp`, `http`, `npx`, `claw`, and `manual`. The label is advisory for routing and diagnostics; the runtime token, task lease, ack, and complete events remain the source of truth.
39
+
34
40
  Production defaults:
35
41
 
36
42
  - Convex: `https://api.xiashe.chat`
37
43
  - Actions: `https://actions.xiashe.chat`
38
44
  - Relay: `https://relay.xiashe.chat`
45
+
46
+ ## Alipay AI Pay local bridge
47
+
48
+ `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
+ - `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.
53
+
54
+ 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
+ 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.
package/bin/xiashe.mjs CHANGED
@@ -34,7 +34,10 @@ const {
34
34
  postJson,
35
35
  mcpCall,
36
36
  decodeMcpToolResult,
37
- nowIso
37
+ nowIso,
38
+ checkAlipayWallet,
39
+ payAlipay402Resource,
40
+ queryAlipay402Resource
38
41
  } = sdk;
39
42
 
40
43
  const EXIT_USAGE = 2;
@@ -75,7 +78,7 @@ Usage:
75
78
  ${c} skills publish release <submission-id>
76
79
 
77
80
  ${c} agent issue [--name <name>] [--kind <kind>] [--json]
78
- ${c} agent connect --token <token> [--name <name>] [--kind <kind>] [--webhook-url <https-url>] [--webhook-token <secret>]
81
+ ${c} agent connect --token <token> [--name <name>] [--kind <kind>] [--transport a2a|mcp|http|npx|claw|manual] [--webhook-url <https-url>] [--webhook-token <secret>]
79
82
  ${c} agent heartbeat [--webhook-url <https-url>] [--webhook-token <secret>|--disable-webhook]
80
83
  ${c} agent list
81
84
  ${c} agent revoke --agent <id-or-name>
@@ -92,6 +95,10 @@ Usage:
92
95
  ${c} files upload <path>
93
96
  ${c} files list
94
97
 
98
+ ${c} payment doctor
99
+ ${c} payment pay --resource-url <https-url> --intent-summary <text> --confirm
100
+ ${c} payment status --resource-url <https-url>
101
+
95
102
  ${c} ops doctor
96
103
 
97
104
  Global flags:
@@ -600,6 +607,21 @@ async function cmdSkillPublish(flags, client, global) {
600
607
  );
601
608
  return;
602
609
  }
610
+ if (result.searchable || result.skillCatalogId) {
611
+ print(
612
+ [
613
+ `Published searchable Skill listing: ${result.skillCatalogId || result.submissionId}`,
614
+ `Submission: ${result.submissionId}`,
615
+ `Name: ${printableDraft.name}`,
616
+ `Market: ${printableDraft.market}`,
617
+ `Source fingerprint: ${printableDraft.packageSha256 || 'not attached'}`,
618
+ '',
619
+ 'No extra creator login is required. Continue with Red Skill upload and Agent Ack verification.'
620
+ ].join('\n'),
621
+ global
622
+ );
623
+ return;
624
+ }
603
625
  print(
604
626
  [
605
627
  `Created Skill submission draft: ${result.submissionId}`,
@@ -635,7 +657,12 @@ async function cmdSkillPublish(flags, client, global) {
635
657
  print(result, global);
636
658
  return;
637
659
  }
638
- print(`Submitted Skill for review: ${submissionId}`, global);
660
+ print(
661
+ result.searchable
662
+ ? `Published searchable Skill listing: ${result.skillCatalogId || submissionId}`
663
+ : `Submitted Skill for review: ${submissionId}`,
664
+ global
665
+ );
639
666
  return;
640
667
  }
641
668
  if (action === 'admin-list') {
@@ -1114,6 +1141,33 @@ async function cmdFiles(sub, args, global) {
1114
1141
  fail(`Unknown files command: ${sub}`, EXIT_USAGE);
1115
1142
  }
1116
1143
 
1144
+ async function cmdPayment(sub, args, global) {
1145
+ const flags = parseFlags(args);
1146
+ if (sub === 'doctor' || sub === 'wallet' || sub === 'wallet-status') {
1147
+ const result = await checkAlipayWallet({ timeoutMs: global.timeoutMs });
1148
+ print(result, global);
1149
+ return;
1150
+ }
1151
+ if (sub === 'pay') {
1152
+ const resourceUrl = requireArg(flags['resource-url'] || flags.resourceUrl || flags.r, '--resource-url');
1153
+ const intentSummary = requireArg(flags['intent-summary'] || flags.intentSummary || flags.i, '--intent-summary');
1154
+ const result = await payAlipay402Resource({
1155
+ resourceUrl,
1156
+ intentSummary,
1157
+ confirm: flags.confirm === true
1158
+ }, { timeoutMs: global.timeoutMs });
1159
+ print(result, global);
1160
+ return;
1161
+ }
1162
+ if (sub === 'status') {
1163
+ const resourceUrl = requireArg(flags['resource-url'] || flags.resourceUrl || flags.r, '--resource-url');
1164
+ const result = await queryAlipay402Resource({ resourceUrl }, { timeoutMs: global.timeoutMs });
1165
+ print(result, global);
1166
+ return;
1167
+ }
1168
+ fail(`Usage: ${COMMAND_NAME} payment doctor|pay|status`, EXIT_USAGE);
1169
+ }
1170
+
1117
1171
  async function cmdOps(sub, args, global) {
1118
1172
  const flags = parseFlags(args);
1119
1173
  const { client } = await makeClient(global);
@@ -1328,6 +1382,7 @@ async function main() {
1328
1382
  if (command === 'agent' || command === 'agents') return await cmdAgent(sub, args, global);
1329
1383
  if (command === 'chat' || command === 'chats') return await cmdChat(sub, args, global);
1330
1384
  if (command === 'files' || command === 'file') return await cmdFiles(sub, args, global);
1385
+ if (command === 'payment' || command === 'payments') return await cmdPayment(sub, args, global);
1331
1386
  if (command === 'ops') return await cmdOps(sub, args, global);
1332
1387
  fail(`Unknown command: ${command}\n\n${usage()}`, EXIT_USAGE);
1333
1388
  } catch (error) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@xiashe/cli",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
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.9"
13
+ "@xiashe/sdk": "0.1.10"
14
14
  },
15
15
  "engines": {
16
16
  "node": ">=20"