@xiashe/cli 0.1.40 → 0.1.41
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 +16 -3
- package/bin/xiashe.mjs +46 -2
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -36,8 +36,8 @@ xiashe skills list
|
|
|
36
36
|
xiashe skills install copywriting --connection MaxClaw-1 --watch
|
|
37
37
|
xiashe agent issue --name "Local WorkBuddy"
|
|
38
38
|
xiashe agent connect --token "<token>" --name "Local WorkBuddy" --transport npx
|
|
39
|
-
xiashe agent run --
|
|
40
|
-
xiashe chat send --chat "New Chat" --content "
|
|
39
|
+
xiashe agent run --executor codex --workdir ./workspace
|
|
40
|
+
xiashe chat send --chat "New Chat" --content "请整理工作目录中的报告" --agent "Local WorkBuddy"
|
|
41
41
|
xiashe skills publish draft . --source xiashe
|
|
42
42
|
xiashe skills publish doctor "<submission-id>"
|
|
43
43
|
xiashe skills publish submit "<submission-id>"
|
|
@@ -84,7 +84,20 @@ Fixed-number acquisition is included in 0.1.36. Source 0.1.37 adds controlled ru
|
|
|
84
84
|
|
|
85
85
|
`skills publish draft` reads `.xiashe/xiashe.skill.json` when present. If the local CLI is not signed in, it can create or reuse the XiaShe Store draft with that registry public token; creator login is only required when the registry token is missing or rejected.
|
|
86
86
|
|
|
87
|
-
`xiashe agent run
|
|
87
|
+
`xiashe agent run` executes one received text task at a time with the installed Codex CLI, then submits its final answer to the originating chat. `--ack` remains accepted for command compatibility. `agent receiver --ack` retains the manual receiver behavior and does not invoke a model. Install and authenticate a current Codex CLI first; real acceptance used Codex CLI 0.160.1. Host authentication and model availability are separate from XiaShe login.
|
|
88
|
+
|
|
89
|
+
```bash
|
|
90
|
+
# Verify the actual host/model without claiming tasks or calling SaaS:
|
|
91
|
+
xiashe agent run --check --workdir ./workspace
|
|
92
|
+
# Use a specific binary or host model when needed:
|
|
93
|
+
xiashe agent run --codex-bin /absolute/path/to/codex --model <supported-model> --workdir ./workspace
|
|
94
|
+
# Receive and execute at most one task:
|
|
95
|
+
xiashe agent run --once --workdir ./workspace --task-timeout-ms 900000
|
|
96
|
+
```
|
|
97
|
+
|
|
98
|
+
Codex runs with the workspace-write sandbox, and XiaShe/Convex environment credentials are removed from its environment. Each task has a private durable receipt under `~/.xiashe/agent-tasks` (`~/.agentpie/agent-tasks` for AgentPie). A lost completion response resends only the saved answer. Interrupted execution is failed instead of replayed; if an orphan executor is still alive, reconcile that process before restarting. Cancellation, lease loss, timeout and host failures stop execution and cannot produce a success answer. `Ctrl-C` stops the worker and its active executor.
|
|
99
|
+
|
|
100
|
+
The automatic adapter currently supports text tasks and local workspace files. Incoming transfer attachments are explicitly rejected and `files.receive` is advertised as disabled; generated local files are not automatically uploaded. Other Agent products must use the manual receiver or their existing scoped runtime MCP integration, and require their own real acceptance. Gateway discovery and transport labels do not certify execution, package verification, service authorization or model access.
|
|
88
101
|
|
|
89
102
|
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.
|
|
90
103
|
|
package/bin/xiashe.mjs
CHANGED
|
@@ -28,6 +28,9 @@ const sdk = await import(sdkEntry);
|
|
|
28
28
|
|
|
29
29
|
const {
|
|
30
30
|
VERSION,
|
|
31
|
+
configDir,
|
|
32
|
+
runAgentTaskCycle,
|
|
33
|
+
createCodexTaskExecutor,
|
|
31
34
|
probeRuntimeGateway,
|
|
32
35
|
runtimeSetupTemplate,
|
|
33
36
|
DEFAULTS,
|
|
@@ -173,7 +176,7 @@ ${` ${c} access <number> deliver|prepare|start|prompt|describe_action|execute|a
|
|
|
173
176
|
${c} agent heartbeat [--webhook-url <https-url>] [--webhook-token <secret>|--disable-webhook]
|
|
174
177
|
${c} agent list
|
|
175
178
|
${c} agent revoke --agent <id-or-name>
|
|
176
|
-
${c} agent run [--once] [--ack] [--idle-ms <ms>] [--busy-ms <ms>] [--max-idle-ms <ms>]
|
|
179
|
+
${c} agent run [--check] [--executor codex] [--model <model>] [--codex-bin <path>] [--workdir <directory>] [--task-timeout-ms <ms>] [--once] [--ack] [--idle-ms <ms>] [--busy-ms <ms>] [--max-idle-ms <ms>]
|
|
177
180
|
${c} agent tasks list|watch|ack <taskId>|complete <taskId> [--content <text>]
|
|
178
181
|
${c} agent transfers list|accept <transferId>|complete <transferId>|fail <transferId>
|
|
179
182
|
${c} agent task create --agent <id-or-name> --chat <id-or-title> --content <text>
|
|
@@ -1247,7 +1250,11 @@ async function cmdAgent(sub, args, global) {
|
|
|
1247
1250
|
return;
|
|
1248
1251
|
}
|
|
1249
1252
|
if (sub === 'run' || sub === 'receiver' || sub === 'loop') {
|
|
1250
|
-
|
|
1253
|
+
if (sub === 'run' || sub === 'loop') {
|
|
1254
|
+
await cmdAgentExecutor(flags, client, global);
|
|
1255
|
+
} else {
|
|
1256
|
+
await cmdAgentReceiver(flags, client, global);
|
|
1257
|
+
}
|
|
1251
1258
|
return;
|
|
1252
1259
|
}
|
|
1253
1260
|
if (sub === 'list' || sub === 'agents' || !sub) {
|
|
@@ -1299,6 +1306,43 @@ async function cmdAgent(sub, args, global) {
|
|
|
1299
1306
|
fail(`Unknown agent command: ${sub}`, EXIT_USAGE);
|
|
1300
1307
|
}
|
|
1301
1308
|
|
|
1309
|
+
async function cmdAgentExecutor(flags, client, global) {
|
|
1310
|
+
const executor = flags.executor || 'codex';
|
|
1311
|
+
if (executor !== 'codex') fail('Supported executor: codex. Use agent receiver for manual hosts.', EXIT_USAGE);
|
|
1312
|
+
const directory = path.join(configDir(), 'agent-tasks');
|
|
1313
|
+
const execute = createCodexTaskExecutor({
|
|
1314
|
+
workdir: flags.workdir || process.cwd(), directory: path.join(directory, 'output'), model: flags.model,
|
|
1315
|
+
command: flags['codex-bin'] || 'codex', timeoutMs: numericFlag(flags, 'task-timeout-ms', 15 * 60_000)
|
|
1316
|
+
});
|
|
1317
|
+
if (flags.check) {
|
|
1318
|
+
const result = await execute({ prompt: 'This is a local host readiness check. Reply with exactly XIASHE_HOST_READY. Do not use tools or change files.' });
|
|
1319
|
+
if (result.trim() !== 'XIASHE_HOST_READY') fail('Host readiness response was invalid.', EXIT_RUNTIME);
|
|
1320
|
+
print({ ok: true, executor, hostExecutionVerified: true, workdir: path.resolve(flags.workdir || process.cwd()), businessCalls: 0 }, global);
|
|
1321
|
+
return;
|
|
1322
|
+
}
|
|
1323
|
+
const controller = new AbortController();
|
|
1324
|
+
const stop = () => controller.abort();
|
|
1325
|
+
process.once('SIGINT', stop); process.once('SIGTERM', stop);
|
|
1326
|
+
const deadline = Date.now() + numericFlag(flags, 'timeout-ms', 24 * 60 * 60_000);
|
|
1327
|
+
try {
|
|
1328
|
+
while (Date.now() < deadline && !controller.signal.aborted) {
|
|
1329
|
+
try {
|
|
1330
|
+
await runAgentTaskCycle(client, { directory: path.join(directory, 'receipts'), execute, signal: controller.signal,
|
|
1331
|
+
onEvent: event => console.log(JSON.stringify(event)) });
|
|
1332
|
+
} catch (error) {
|
|
1333
|
+
if (flags.once) throw error;
|
|
1334
|
+
console.error(`${PRODUCT_NAME} agent executor: ${error.message}. Saved results will be retried.`);
|
|
1335
|
+
}
|
|
1336
|
+
if (flags.once || controller.signal.aborted) return;
|
|
1337
|
+
await new Promise(resolve => {
|
|
1338
|
+
const done = () => { clearTimeout(timer); controller.signal.removeEventListener('abort', done); resolve(); };
|
|
1339
|
+
const timer = setTimeout(done, numericFlag(flags, 'idle-ms', 30_000));
|
|
1340
|
+
controller.signal.addEventListener('abort', done, { once: true });
|
|
1341
|
+
});
|
|
1342
|
+
}
|
|
1343
|
+
} finally { process.removeListener('SIGINT', stop); process.removeListener('SIGTERM', stop); }
|
|
1344
|
+
}
|
|
1345
|
+
|
|
1302
1346
|
async function cmdAgentReceiver(flags, client, global) {
|
|
1303
1347
|
const idleMs = numericFlag(flags, 'idle-ms', 30_000);
|
|
1304
1348
|
const busyMs = numericFlag(flags, 'busy-ms', 10_000);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xiashe/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.41",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"bin": {
|
|
6
6
|
"xiashe": "bin/xiashe.mjs"
|
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
"lib"
|
|
13
13
|
],
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"@xiashe/sdk": "0.1.
|
|
15
|
+
"@xiashe/sdk": "0.1.41"
|
|
16
16
|
},
|
|
17
17
|
"engines": {
|
|
18
18
|
"node": ">=20"
|