nexarch 0.4.8 → 0.4.9
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.
|
@@ -20,7 +20,7 @@ function parseToolText(result) {
|
|
|
20
20
|
const text = result.content?.[0]?.text ?? "{}";
|
|
21
21
|
return JSON.parse(text);
|
|
22
22
|
}
|
|
23
|
-
function
|
|
23
|
+
function getStoredAgentId() {
|
|
24
24
|
try {
|
|
25
25
|
const identityPath = join(homedir(), ".nexarch", "identity.json");
|
|
26
26
|
const parsed = JSON.parse(readFileSync(identityPath, "utf8"));
|
|
@@ -29,8 +29,14 @@ function getDefaultAgentId() {
|
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
catch {
|
|
32
|
-
//
|
|
32
|
+
// ignore
|
|
33
33
|
}
|
|
34
|
+
return null;
|
|
35
|
+
}
|
|
36
|
+
function getDefaultAgentId() {
|
|
37
|
+
const stored = getStoredAgentId();
|
|
38
|
+
if (stored)
|
|
39
|
+
return stored;
|
|
34
40
|
const osUser = process.env.USERNAME || process.env.USER || "unknown";
|
|
35
41
|
const host = process.env.HOSTNAME || "unknown-host";
|
|
36
42
|
return `nexarch-cli:${osUser}@${host}`;
|
|
@@ -45,7 +51,9 @@ function parseCsv(value) {
|
|
|
45
51
|
}
|
|
46
52
|
export async function agentIdentify(args) {
|
|
47
53
|
const asJson = parseFlag(args, "--json");
|
|
48
|
-
const
|
|
54
|
+
const explicitAgentId = parseOptionValue(args, "--agent-id");
|
|
55
|
+
const storedAgentId = getStoredAgentId();
|
|
56
|
+
const agentId = explicitAgentId ?? storedAgentId ?? getDefaultAgentId();
|
|
49
57
|
const looksLikeUuid = /^[0-9a-f]{8}-[0-9a-f]{4}-[1-5][0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}$/i.test(agentId);
|
|
50
58
|
const provider = parseOptionValue(args, "--provider");
|
|
51
59
|
const model = parseOptionValue(args, "--model");
|
|
@@ -61,6 +69,9 @@ export async function agentIdentify(args) {
|
|
|
61
69
|
if (looksLikeUuid) {
|
|
62
70
|
throw new Error(`agent-identify expects the stable agent id (e.g. nexarch-cli:user@host), not a graph entity UUID (${agentId}). Re-run using --agent-id \"${getDefaultAgentId()}\" or omit --agent-id.`);
|
|
63
71
|
}
|
|
72
|
+
if (explicitAgentId && storedAgentId && explicitAgentId !== storedAgentId) {
|
|
73
|
+
throw new Error(`--agent-id \"${explicitAgentId}\" does not match the registered local agent id \"${storedAgentId}\". Omit --agent-id, or use --agent-id \"${storedAgentId}\" to avoid creating duplicates.`);
|
|
74
|
+
}
|
|
64
75
|
const creds = requireCredentials();
|
|
65
76
|
await mcpInitialize({ companyId: creds.companyId });
|
|
66
77
|
const tools = await mcpListTools({ companyId: creds.companyId });
|
|
@@ -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.9";
|
|
9
9
|
const AGENT_ENTITY_TYPE = "agent";
|
|
10
10
|
const TECH_COMPONENT_ENTITY_TYPE = "technology_component";
|
|
11
11
|
function parseFlag(args, flag) {
|
package/dist/lib/mcp.js
CHANGED
|
@@ -68,7 +68,7 @@ export async function mcpInitialize(options = {}) {
|
|
|
68
68
|
return callMcpRpc("initialize", {
|
|
69
69
|
protocolVersion: "2024-11-05",
|
|
70
70
|
capabilities: {},
|
|
71
|
-
clientInfo: { name: "nexarch-cli", version: "0.4.
|
|
71
|
+
clientInfo: { name: "nexarch-cli", version: "0.4.9" },
|
|
72
72
|
}, options);
|
|
73
73
|
}
|
|
74
74
|
export async function mcpListTools(options = {}) {
|