@xnetjs/cli 0.0.12 → 0.1.1
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/dist/cli.js +17 -6
- package/package.json +10 -10
package/dist/cli.js
CHANGED
|
@@ -484,7 +484,8 @@ import {
|
|
|
484
484
|
Git,
|
|
485
485
|
handleBridgeRun,
|
|
486
486
|
mcpConfigFor,
|
|
487
|
-
NodeCommandRunner
|
|
487
|
+
NodeCommandRunner,
|
|
488
|
+
openAiChatAgent
|
|
488
489
|
} from "@xnetjs/devkit";
|
|
489
490
|
function buildBridgeServer(options, runner = new NodeCommandRunner()) {
|
|
490
491
|
const command = options.agent ?? "claude";
|
|
@@ -492,7 +493,7 @@ function buildBridgeServer(options, runner = new NodeCommandRunner()) {
|
|
|
492
493
|
const args = buildAgentArgs(command, {
|
|
493
494
|
...options.mcpConfigPath ? { mcpConfigPath: options.mcpConfigPath } : {}
|
|
494
495
|
});
|
|
495
|
-
const agent = cliChatAgent(runner, { command, cwd, args });
|
|
496
|
+
const agent = options.upstream ? openAiChatAgent({ baseUrl: options.upstream, model: options.upstreamModel ?? "llama3.2" }) : cliChatAgent(runner, { command, cwd, args });
|
|
496
497
|
const run = options.code ? (request) => handleBridgeRun(
|
|
497
498
|
{
|
|
498
499
|
git: new Git(runner, cwd),
|
|
@@ -509,15 +510,22 @@ function buildBridgeServer(options, runner = new NodeCommandRunner()) {
|
|
|
509
510
|
...run ? { run } : {},
|
|
510
511
|
...options.host ? { host: options.host } : {},
|
|
511
512
|
...options.port !== void 0 ? { port: options.port } : {},
|
|
512
|
-
...options.allowOrigin ? { allowedOrigins: options.allowOrigin } : {}
|
|
513
|
+
...options.allowOrigin ? { allowedOrigins: options.allowOrigin } : {},
|
|
514
|
+
...options.token ? { pairingToken: options.token } : {}
|
|
513
515
|
});
|
|
514
516
|
}
|
|
515
517
|
function registerBridgeCommand(program2) {
|
|
516
518
|
const bridge = program2.command("bridge").description("Run the local agent bridge for XNet's AI chat panel");
|
|
517
519
|
bridge.command("serve").description("Serve the agent bridge on loopback (default :31416), driving your own agent CLI").option("--agent <command>", "Agent CLI to drive (claude, codex, \u2026)", "claude").option("--host <host>", "Loopback host (default 127.0.0.1)").option("--port <n>", `Port (default ${DEFAULT_BRIDGE_PORT})`, parseIntOption2).option(
|
|
518
520
|
"--allow-origin <origin...>",
|
|
519
|
-
"Browser origins permitted (e.g. https://
|
|
520
|
-
).option(
|
|
521
|
+
"Browser origins permitted (e.g. https://app.xnet.fyi for the web deployment)"
|
|
522
|
+
).option(
|
|
523
|
+
"--token <token>",
|
|
524
|
+
"Pin the pairing code browsers must present (default: a random per-launch code)"
|
|
525
|
+
).option("--cwd <dir>", "Working directory the agent runs in (default current dir)").option(
|
|
526
|
+
"--upstream <url>",
|
|
527
|
+
"Front a raw OpenAI-compatible server (e.g. http://localhost:11434 for Ollama) instead of a CLI"
|
|
528
|
+
).option("--upstream-model <id>", "Model id to request from --upstream (default llama3.2)").option("--code", "Enable POST /run agentic code tasks (worktree \u2192 gate \u2192 checkpoint/PR)").option("--mcp", "Give the agent XNet's workspace tools via `xnet mcp serve`").option(
|
|
521
529
|
"--mcp-api-url <url>",
|
|
522
530
|
"xNet local API URL the MCP server talks to (default http://127.0.0.1:31415)"
|
|
523
531
|
).action(async (options) => {
|
|
@@ -542,7 +550,10 @@ function registerBridgeCommand(program2) {
|
|
|
542
550
|
console.error(
|
|
543
551
|
`xNet agent bridge listening on ${handle.url} (agent: ${options.agent ?? "claude"}${options.mcp ? ", workspace tools enabled" : ""})`
|
|
544
552
|
);
|
|
545
|
-
console.error(
|
|
553
|
+
console.error(`Pairing code: ${handle.pairingToken}`);
|
|
554
|
+
console.error(
|
|
555
|
+
'In XNet, open the AI panel, select "Local bridge", and paste the pairing code.'
|
|
556
|
+
);
|
|
546
557
|
const shutdown = () => {
|
|
547
558
|
void handle.stop().then(() => process.exit(0));
|
|
548
559
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@xnetjs/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"description": "xNet CLI - Schema migrations, diagnostics, and development tools",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -31,15 +31,15 @@
|
|
|
31
31
|
"dependencies": {
|
|
32
32
|
"chalk": "^5.3.0",
|
|
33
33
|
"commander": "^12.0.0",
|
|
34
|
-
"@xnetjs/core": "0.
|
|
35
|
-
"@xnetjs/crypto": "0.
|
|
36
|
-
"@xnetjs/data": "0.
|
|
37
|
-
"@xnetjs/devkit": "0.0
|
|
38
|
-
"@xnetjs/identity": "0.
|
|
39
|
-
"@xnetjs/plugins": "0.
|
|
40
|
-
"@xnetjs/runtime": "0.1
|
|
41
|
-
"@xnetjs/sqlite": "0.
|
|
42
|
-
"@xnetjs/sync": "0.
|
|
34
|
+
"@xnetjs/core": "0.9.0",
|
|
35
|
+
"@xnetjs/crypto": "0.9.0",
|
|
36
|
+
"@xnetjs/data": "0.9.0",
|
|
37
|
+
"@xnetjs/devkit": "1.0.0",
|
|
38
|
+
"@xnetjs/identity": "0.9.0",
|
|
39
|
+
"@xnetjs/plugins": "0.9.0",
|
|
40
|
+
"@xnetjs/runtime": "0.2.1",
|
|
41
|
+
"@xnetjs/sqlite": "0.9.0",
|
|
42
|
+
"@xnetjs/sync": "0.9.0"
|
|
43
43
|
},
|
|
44
44
|
"devDependencies": {
|
|
45
45
|
"tsup": "^8.0.0",
|