@xiashe/cli 0.1.2 → 0.1.5
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 +3 -1
- package/bin/xiashe.mjs +20 -10
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -18,12 +18,14 @@ xiashe skills list
|
|
|
18
18
|
xiashe skills install copywriting --connection MaxClaw-1 --watch
|
|
19
19
|
xiashe agent issue --name "Local WorkBuddy"
|
|
20
20
|
xiashe agent connect --token "<token>" --name "Local WorkBuddy"
|
|
21
|
-
xiashe agent
|
|
21
|
+
xiashe agent run --ack
|
|
22
22
|
xiashe chat send --chat "New Chat" --content "帮我处理这个文件" --file ./report.pdf --agent "Local WorkBuddy"
|
|
23
23
|
```
|
|
24
24
|
|
|
25
25
|
Local state is stored in `~/.xiashe/config.json`.
|
|
26
26
|
|
|
27
|
+
`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.
|
|
28
|
+
|
|
27
29
|
Production defaults:
|
|
28
30
|
|
|
29
31
|
- Convex: `https://api.xiashe.chat`
|
package/bin/xiashe.mjs
CHANGED
|
@@ -39,6 +39,7 @@ const EXIT_NETWORK = 4;
|
|
|
39
39
|
const EXIT_RUNTIME = 5;
|
|
40
40
|
const COMMAND_NAME = process.env.XIASHE_CLI_NAME || 'xiashe';
|
|
41
41
|
const PRODUCT_NAME = process.env.XIASHE_PRODUCT_NAME || (COMMAND_NAME === 'agentpie' ? 'AgentPie' : 'XiaShe');
|
|
42
|
+
const PRODUCT_ENV = COMMAND_NAME === 'agentpie' ? 'global' : 'cn';
|
|
42
43
|
|
|
43
44
|
function usage() {
|
|
44
45
|
const c = COMMAND_NAME;
|
|
@@ -50,7 +51,7 @@ Usage:
|
|
|
50
51
|
${c} whoami
|
|
51
52
|
|
|
52
53
|
${c} config path|get|set <key> <value>|use <profile>
|
|
53
|
-
${c} env use
|
|
54
|
+
${c} env use ${PRODUCT_ENV}
|
|
54
55
|
|
|
55
56
|
${c} connections list
|
|
56
57
|
${c} claw pair --connection <id-or-name>
|
|
@@ -64,8 +65,8 @@ Usage:
|
|
|
64
65
|
${c} skills claim <one-time-token>
|
|
65
66
|
|
|
66
67
|
${c} agent issue [--name <name>] [--kind <kind>] [--json]
|
|
67
|
-
${c} agent connect --token <token> [--name <name>] [--kind <kind>]
|
|
68
|
-
${c} agent heartbeat
|
|
68
|
+
${c} agent connect --token <token> [--name <name>] [--kind <kind>] [--webhook-url <https-url>] [--webhook-token <secret>]
|
|
69
|
+
${c} agent heartbeat [--webhook-url <https-url>] [--webhook-token <secret>|--disable-webhook]
|
|
69
70
|
${c} agent list
|
|
70
71
|
${c} agent revoke --agent <id-or-name>
|
|
71
72
|
${c} agent run [--once] [--ack] [--idle-ms <ms>] [--busy-ms <ms>] [--max-idle-ms <ms>]
|
|
@@ -87,8 +88,6 @@ Global flags:
|
|
|
87
88
|
--profile <name> Local config profile. Default: active profile.
|
|
88
89
|
--convex-url <url> Convex deployment URL.
|
|
89
90
|
--actions-url <url> ${PRODUCT_NAME} action site URL.
|
|
90
|
-
--market <cn|intl> Skill market.
|
|
91
|
-
--locale <zh-CN|en> Catalog locale.
|
|
92
91
|
--json Print JSON output.
|
|
93
92
|
--timeout-ms <ms> HTTP timeout. Default: 20000.
|
|
94
93
|
--help Show help.
|
|
@@ -329,11 +328,15 @@ async function cmdConfig(sub, args, global) {
|
|
|
329
328
|
async function cmdEnv(sub, args, global) {
|
|
330
329
|
const flags = parseFlags(args);
|
|
331
330
|
if (sub !== 'use') {
|
|
332
|
-
fail(
|
|
331
|
+
fail(`Usage: ${COMMAND_NAME} env use ${PRODUCT_ENV}`, EXIT_USAGE);
|
|
333
332
|
}
|
|
334
333
|
const envName = requireArg(flags._[0], 'environment');
|
|
334
|
+
const normalized = String(envName || '').toLowerCase();
|
|
335
|
+
if (normalized !== PRODUCT_ENV && !(PRODUCT_ENV === 'global' && normalized === 'intl')) {
|
|
336
|
+
fail(`${PRODUCT_NAME} only supports the ${PRODUCT_ENV} environment.`, EXIT_USAGE);
|
|
337
|
+
}
|
|
335
338
|
const loaded = await loadProfile({ profile: global.profile || undefined });
|
|
336
|
-
const defaults = await useEnvironment(
|
|
339
|
+
const defaults = await useEnvironment(PRODUCT_ENV, loaded.profileName);
|
|
337
340
|
print({ ok: true, profile: loaded.profileName, ...defaults }, global);
|
|
338
341
|
}
|
|
339
342
|
|
|
@@ -645,6 +648,8 @@ async function cmdAgent(sub, args, global) {
|
|
|
645
648
|
agentName: flags.name || flags['agent-name'] || 'XiaShe CLI Agent',
|
|
646
649
|
agentKind: flags.kind || 'cli',
|
|
647
650
|
agentRef: flags.ref || `${osName()} ${process.cwd()}`,
|
|
651
|
+
webhookUrl: flags['webhook-url'] || undefined,
|
|
652
|
+
webhookAuthToken: flags['webhook-token'] || flags['webhook-auth-token'] || undefined,
|
|
648
653
|
transport: flags.transport || 'npx'
|
|
649
654
|
});
|
|
650
655
|
await saveAgentSession(profileName, claim);
|
|
@@ -654,6 +659,11 @@ async function cmdAgent(sub, args, global) {
|
|
|
654
659
|
if (sub === 'heartbeat') {
|
|
655
660
|
const result = await client.agentHeartbeat({
|
|
656
661
|
status: flags.status || 'online',
|
|
662
|
+
agentName: flags.name || flags['agent-name'] || undefined,
|
|
663
|
+
agentRef: flags.ref || undefined,
|
|
664
|
+
webhookUrl: flags['webhook-url'] || undefined,
|
|
665
|
+
webhookAuthToken: flags['webhook-token'] || flags['webhook-auth-token'] || undefined,
|
|
666
|
+
webhookMode: flags['disable-webhook'] ? 'disabled' : flags['webhook-url'] ? 'notify' : undefined,
|
|
657
667
|
capabilities: parseCsv(flags.capabilities || 'chat,files,tasks,skills')
|
|
658
668
|
});
|
|
659
669
|
print(result, global);
|
|
@@ -713,9 +723,9 @@ async function cmdAgent(sub, args, global) {
|
|
|
713
723
|
}
|
|
714
724
|
|
|
715
725
|
async function cmdAgentReceiver(flags, client, global) {
|
|
716
|
-
const idleMs = numericFlag(flags, 'idle-ms',
|
|
717
|
-
const busyMs = numericFlag(flags, 'busy-ms',
|
|
718
|
-
const maxIdleMs = numericFlag(flags, 'max-idle-ms',
|
|
726
|
+
const idleMs = numericFlag(flags, 'idle-ms', 30_000);
|
|
727
|
+
const busyMs = numericFlag(flags, 'busy-ms', 10_000);
|
|
728
|
+
const maxIdleMs = numericFlag(flags, 'max-idle-ms', 120_000);
|
|
719
729
|
const deadline = Date.now() + numericFlag(flags, 'timeout-ms', 24 * 60 * 60_000);
|
|
720
730
|
const capabilities = parseCsv(flags.capabilities || 'chat,files,tasks,skills');
|
|
721
731
|
const seenTasks = new Set();
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiashe/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.5",
|
|
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.6"
|
|
14
14
|
},
|
|
15
15
|
"engines": {
|
|
16
16
|
"node": ">=20"
|