nexarch 0.4.1 → 0.4.3
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/commands/init-agent.js +18 -7
- package/dist/commands/login.js +15 -0
- package/dist/index.js +0 -18
- package/dist/lib/mcp.js +8 -2
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import process from "process";
|
|
|
5
5
|
import { requireCredentials } from "../lib/credentials.js";
|
|
6
6
|
import { fetchAgentRegistryOrThrow } from "../lib/agent-registry.js";
|
|
7
7
|
import { callMcpTool, mcpInitialize, mcpListTools } from "../lib/mcp.js";
|
|
8
|
-
const CLI_VERSION = "0.4.
|
|
8
|
+
const CLI_VERSION = "0.4.3";
|
|
9
9
|
const AGENT_ENTITY_TYPE = "agent";
|
|
10
10
|
const TECH_COMPONENT_ENTITY_TYPE = "technology_component";
|
|
11
11
|
function parseFlag(args, flag) {
|
|
@@ -24,6 +24,19 @@ function parseToolText(result) {
|
|
|
24
24
|
const text = result.content?.[0]?.text ?? "{}";
|
|
25
25
|
return JSON.parse(text);
|
|
26
26
|
}
|
|
27
|
+
function renderChecksTable(checks) {
|
|
28
|
+
const headers = ["Status", "Check", "Details"];
|
|
29
|
+
const rows = checks.map((check) => [
|
|
30
|
+
check.ok ? "✓" : "x",
|
|
31
|
+
check.name,
|
|
32
|
+
check.detail?.trim() || "-",
|
|
33
|
+
]);
|
|
34
|
+
const widths = headers.map((h, i) => Math.max(h.length, ...rows.map((r) => r[i].length)));
|
|
35
|
+
const hr = `+${widths.map((w) => "-".repeat(w + 2)).join("+")}+`;
|
|
36
|
+
const formatRow = (cells) => `| ${cells.map((cell, i) => cell.padEnd(widths[i])).join(" | ")} |`;
|
|
37
|
+
const lines = [hr, formatRow(headers), hr, ...rows.map(formatRow), hr];
|
|
38
|
+
return lines.join("\n");
|
|
39
|
+
}
|
|
27
40
|
function getDefaultAgentId() {
|
|
28
41
|
const osUser = process.env.USERNAME || process.env.USER || userInfo().username || "unknown";
|
|
29
42
|
const host = hostname() || "unknown-host";
|
|
@@ -739,11 +752,7 @@ export async function initAgent(args) {
|
|
|
739
752
|
}
|
|
740
753
|
console.log(`Using integration registry release v${registry.release.version}.`);
|
|
741
754
|
console.log("Running agent onboarding handshake…\n");
|
|
742
|
-
|
|
743
|
-
console.log(`${check.ok ? "✓" : "✗"} ${check.name}`);
|
|
744
|
-
if (check.detail)
|
|
745
|
-
console.log(` ${check.detail}`);
|
|
746
|
-
}
|
|
755
|
+
console.log(renderChecksTable(checks));
|
|
747
756
|
if (registration.graphEntityId) {
|
|
748
757
|
console.log(`\nRegistered graph entity: ${registration.graphEntityId}`);
|
|
749
758
|
}
|
|
@@ -764,7 +773,9 @@ export async function initAgent(args) {
|
|
|
764
773
|
console.log(`📝 Nexarch registration instructions updated in: ${r.path}`);
|
|
765
774
|
}
|
|
766
775
|
}
|
|
767
|
-
console.log("\n
|
|
776
|
+
console.log("\n➡ Next step (required): complete agent identity in your coding agent");
|
|
777
|
+
console.log(" Paste this and fill in real values:");
|
|
778
|
+
console.log(`\nrun npx nexarch@latest agent identify --agent-id \"${agentId}\" --provider \"<provider>\" --model \"<model>\" --client \"<client>\" --framework \"<openclaw|n8n|m365-agent-framework|other>\" --tool-version \"<tool-version>\" --capabilities \"<capability1,capability2>\" --json\n`);
|
|
768
779
|
}
|
|
769
780
|
else {
|
|
770
781
|
console.log("⚠ Handshake/registration completed with issues.");
|
package/dist/commands/login.js
CHANGED
|
@@ -5,6 +5,20 @@ import { execFile } from "child_process";
|
|
|
5
5
|
import { saveCredentials } from "../lib/credentials.js";
|
|
6
6
|
const NEXARCH_URL = "https://nexarch.ai";
|
|
7
7
|
const LOGIN_TIMEOUT_MS = 5 * 60 * 1000;
|
|
8
|
+
function printLoginBanner() {
|
|
9
|
+
const logo = String.raw `
|
|
10
|
+
###### ######
|
|
11
|
+
####### ######
|
|
12
|
+
######### ###### ##
|
|
13
|
+
################## #####
|
|
14
|
+
##### ########## ######
|
|
15
|
+
###### ####### ######
|
|
16
|
+
##### #### #############
|
|
17
|
+
###### ## ###############
|
|
18
|
+
`;
|
|
19
|
+
console.log(logo);
|
|
20
|
+
console.log("NEXARCH CLI login\n");
|
|
21
|
+
}
|
|
8
22
|
function generateState() {
|
|
9
23
|
return randomBytes(16).toString("hex");
|
|
10
24
|
}
|
|
@@ -115,6 +129,7 @@ function getArgValue(args, flag) {
|
|
|
115
129
|
return v;
|
|
116
130
|
}
|
|
117
131
|
export async function login(args) {
|
|
132
|
+
printLoginBanner();
|
|
118
133
|
const state = generateState();
|
|
119
134
|
const port = await findFreePort();
|
|
120
135
|
const requestedCompany = getArgValue(args, "--company");
|
package/dist/index.js
CHANGED
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { homedir } from "os";
|
|
3
|
-
import { readFileSync } from "fs";
|
|
4
|
-
import { join } from "path";
|
|
5
2
|
import { login } from "./commands/login.js";
|
|
6
3
|
import { logout } from "./commands/logout.js";
|
|
7
4
|
import { status } from "./commands/status.js";
|
|
@@ -44,17 +41,6 @@ async function main() {
|
|
|
44
41
|
await agentIdentify(subArgs);
|
|
45
42
|
return;
|
|
46
43
|
}
|
|
47
|
-
if (subcommand === "prompt") {
|
|
48
|
-
const filePath = join(homedir(), ".nexarch", "agent-bootstrap.md");
|
|
49
|
-
try {
|
|
50
|
-
process.stdout.write(readFileSync(filePath, "utf8") + "\n");
|
|
51
|
-
}
|
|
52
|
-
catch {
|
|
53
|
-
console.error("No bootstrap file found. Run 'nexarch setup' (or 'nexarch init-agent') first.");
|
|
54
|
-
process.exit(1);
|
|
55
|
-
}
|
|
56
|
-
return;
|
|
57
|
-
}
|
|
58
44
|
}
|
|
59
45
|
const handler = commands[command ?? ""];
|
|
60
46
|
if (!handler) {
|
|
@@ -74,10 +60,6 @@ Usage:
|
|
|
74
60
|
Options: --agent-id <id> --bind-to-external-key <key>
|
|
75
61
|
--bind-relationship-type <code> --redact-hostname
|
|
76
62
|
--json --strict
|
|
77
|
-
nexarch agent prompt
|
|
78
|
-
Print bootstrap instructions for a Claude Code agent to complete
|
|
79
|
-
its registration (written by init-agent). Tell Claude:
|
|
80
|
-
"run npx nexarch agent prompt and follow the instructions"
|
|
81
63
|
nexarch agent identify
|
|
82
64
|
Capture richer coding-agent identity metadata
|
|
83
65
|
Options: --agent-id <id> --provider <provider> --model <model>
|
package/dist/lib/mcp.js
CHANGED
|
@@ -33,7 +33,13 @@ async function callMcpRpc(method, params = {}, options = {}) {
|
|
|
33
33
|
const raw = Buffer.concat(chunks).toString("utf-8");
|
|
34
34
|
const json = JSON.parse(raw);
|
|
35
35
|
if (json.error) {
|
|
36
|
-
|
|
36
|
+
const detail = json.error.data &&
|
|
37
|
+
typeof json.error.data === "object" &&
|
|
38
|
+
"detail" in json.error.data &&
|
|
39
|
+
typeof json.error.data.detail === "string"
|
|
40
|
+
? json.error.data.detail
|
|
41
|
+
: null;
|
|
42
|
+
reject(new Error(detail ? `${json.error.message} (${detail})` : json.error.message));
|
|
37
43
|
}
|
|
38
44
|
else if (json.result !== undefined) {
|
|
39
45
|
resolve(json.result);
|
|
@@ -62,7 +68,7 @@ export async function mcpInitialize(options = {}) {
|
|
|
62
68
|
return callMcpRpc("initialize", {
|
|
63
69
|
protocolVersion: "2024-11-05",
|
|
64
70
|
capabilities: {},
|
|
65
|
-
clientInfo: { name: "nexarch-cli", version: "0.4.
|
|
71
|
+
clientInfo: { name: "nexarch-cli", version: "0.4.3" },
|
|
66
72
|
}, options);
|
|
67
73
|
}
|
|
68
74
|
export async function mcpListTools(options = {}) {
|