@xiashe/cli 0.1.9 → 0.1.11
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 +19 -1
- package/bin/xiashe.mjs +68 -4
- package/package.json +2 -2
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.11 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 [--wallet-timeout-ms <ms>]
|
|
100
|
+
${c} payment status --resource-url <https-url>
|
|
101
|
+
|
|
95
102
|
${c} ops doctor
|
|
96
103
|
|
|
97
104
|
Global flags:
|
|
@@ -119,7 +126,8 @@ function parseGlobal(argv) {
|
|
|
119
126
|
actionsUrl: '',
|
|
120
127
|
market: '',
|
|
121
128
|
locale: '',
|
|
122
|
-
timeoutMs: 20_000
|
|
129
|
+
timeoutMs: 20_000,
|
|
130
|
+
timeoutMsExplicit: false
|
|
123
131
|
};
|
|
124
132
|
for (let i = 0; i < argv.length; i += 1) {
|
|
125
133
|
const value = argv[i];
|
|
@@ -166,6 +174,7 @@ function parseGlobal(argv) {
|
|
|
166
174
|
if (!Number.isFinite(global.timeoutMs) || global.timeoutMs < 1000) {
|
|
167
175
|
fail('Invalid --timeout-ms value.', EXIT_USAGE);
|
|
168
176
|
}
|
|
177
|
+
global.timeoutMsExplicit = true;
|
|
169
178
|
i += 1;
|
|
170
179
|
continue;
|
|
171
180
|
}
|
|
@@ -600,6 +609,21 @@ async function cmdSkillPublish(flags, client, global) {
|
|
|
600
609
|
);
|
|
601
610
|
return;
|
|
602
611
|
}
|
|
612
|
+
if (result.searchable || result.skillCatalogId) {
|
|
613
|
+
print(
|
|
614
|
+
[
|
|
615
|
+
`Published searchable Skill listing: ${result.skillCatalogId || result.submissionId}`,
|
|
616
|
+
`Submission: ${result.submissionId}`,
|
|
617
|
+
`Name: ${printableDraft.name}`,
|
|
618
|
+
`Market: ${printableDraft.market}`,
|
|
619
|
+
`Source fingerprint: ${printableDraft.packageSha256 || 'not attached'}`,
|
|
620
|
+
'',
|
|
621
|
+
'No extra creator login is required. Continue with Red Skill upload and Agent Ack verification.'
|
|
622
|
+
].join('\n'),
|
|
623
|
+
global
|
|
624
|
+
);
|
|
625
|
+
return;
|
|
626
|
+
}
|
|
603
627
|
print(
|
|
604
628
|
[
|
|
605
629
|
`Created Skill submission draft: ${result.submissionId}`,
|
|
@@ -635,7 +659,12 @@ async function cmdSkillPublish(flags, client, global) {
|
|
|
635
659
|
print(result, global);
|
|
636
660
|
return;
|
|
637
661
|
}
|
|
638
|
-
print(
|
|
662
|
+
print(
|
|
663
|
+
result.searchable
|
|
664
|
+
? `Published searchable Skill listing: ${result.skillCatalogId || submissionId}`
|
|
665
|
+
: `Submitted Skill for review: ${submissionId}`,
|
|
666
|
+
global
|
|
667
|
+
);
|
|
639
668
|
return;
|
|
640
669
|
}
|
|
641
670
|
if (action === 'admin-list') {
|
|
@@ -1114,6 +1143,40 @@ async function cmdFiles(sub, args, global) {
|
|
|
1114
1143
|
fail(`Unknown files command: ${sub}`, EXIT_USAGE);
|
|
1115
1144
|
}
|
|
1116
1145
|
|
|
1146
|
+
async function cmdPayment(sub, args, global) {
|
|
1147
|
+
const flags = parseFlags(args);
|
|
1148
|
+
const walletTimeoutValue = flags['wallet-timeout-ms'] ?? flags.walletTimeoutMs ?? (global.timeoutMsExplicit ? global.timeoutMs : undefined);
|
|
1149
|
+
const walletTimeoutMs = walletTimeoutValue === undefined
|
|
1150
|
+
? undefined
|
|
1151
|
+
: numericFlag({ walletTimeoutMs: walletTimeoutValue }, 'walletTimeoutMs', 0);
|
|
1152
|
+
if (walletTimeoutValue !== undefined && !walletTimeoutMs) {
|
|
1153
|
+
fail('Invalid --wallet-timeout-ms value.', EXIT_USAGE);
|
|
1154
|
+
}
|
|
1155
|
+
if (sub === 'doctor' || sub === 'wallet' || sub === 'wallet-status') {
|
|
1156
|
+
const result = await checkAlipayWallet({ timeoutMs: global.timeoutMs });
|
|
1157
|
+
print(result, global);
|
|
1158
|
+
return;
|
|
1159
|
+
}
|
|
1160
|
+
if (sub === 'pay') {
|
|
1161
|
+
const resourceUrl = requireArg(flags['resource-url'] || flags.resourceUrl || flags.r, '--resource-url');
|
|
1162
|
+
const intentSummary = requireArg(flags['intent-summary'] || flags.intentSummary || flags.i, '--intent-summary');
|
|
1163
|
+
const result = await payAlipay402Resource({
|
|
1164
|
+
resourceUrl,
|
|
1165
|
+
intentSummary,
|
|
1166
|
+
confirm: flags.confirm === true
|
|
1167
|
+
}, walletTimeoutMs ? { timeoutMs: walletTimeoutMs } : {});
|
|
1168
|
+
print(result, global);
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
if (sub === 'status') {
|
|
1172
|
+
const resourceUrl = requireArg(flags['resource-url'] || flags.resourceUrl || flags.r, '--resource-url');
|
|
1173
|
+
const result = await queryAlipay402Resource({ resourceUrl }, { timeoutMs: global.timeoutMs });
|
|
1174
|
+
print(result, global);
|
|
1175
|
+
return;
|
|
1176
|
+
}
|
|
1177
|
+
fail(`Usage: ${COMMAND_NAME} payment doctor|pay|status`, EXIT_USAGE);
|
|
1178
|
+
}
|
|
1179
|
+
|
|
1117
1180
|
async function cmdOps(sub, args, global) {
|
|
1118
1181
|
const flags = parseFlags(args);
|
|
1119
1182
|
const { client } = await makeClient(global);
|
|
@@ -1328,6 +1391,7 @@ async function main() {
|
|
|
1328
1391
|
if (command === 'agent' || command === 'agents') return await cmdAgent(sub, args, global);
|
|
1329
1392
|
if (command === 'chat' || command === 'chats') return await cmdChat(sub, args, global);
|
|
1330
1393
|
if (command === 'files' || command === 'file') return await cmdFiles(sub, args, global);
|
|
1394
|
+
if (command === 'payment' || command === 'payments') return await cmdPayment(sub, args, global);
|
|
1331
1395
|
if (command === 'ops') return await cmdOps(sub, args, global);
|
|
1332
1396
|
fail(`Unknown command: ${command}\n\n${usage()}`, EXIT_USAGE);
|
|
1333
1397
|
} catch (error) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiashe/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.11",
|
|
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.
|
|
13
|
+
"@xiashe/sdk": "0.1.11"
|
|
14
14
|
},
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=20"
|