nexarch 0.1.13 → 0.1.15
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.
|
@@ -48,7 +48,7 @@ export async function agentIdentify(args) {
|
|
|
48
48
|
await mcpInitialize({ companyId: creds.companyId });
|
|
49
49
|
const tools = await mcpListTools({ companyId: creds.companyId });
|
|
50
50
|
const toolNames = new Set(tools.map((t) => t.name));
|
|
51
|
-
const required = ["nexarch_upsert_entities"];
|
|
51
|
+
const required = ["nexarch_upsert_entities", "nexarch_upsert_relationships"];
|
|
52
52
|
const missing = required.filter((name) => !toolNames.has(name));
|
|
53
53
|
if (missing.length) {
|
|
54
54
|
throw new Error(`missing required MCP tools: ${missing.join(", ")}`);
|
|
@@ -112,6 +112,93 @@ export async function agentIdentify(args) {
|
|
|
112
112
|
const upsert = parseToolText(upsertRaw);
|
|
113
113
|
const failed = Number(upsert.summary?.failed ?? 0) > 0;
|
|
114
114
|
const firstResult = upsert.results?.[0];
|
|
115
|
+
// Upsert provider, model, and client as first-class graph entities
|
|
116
|
+
const providerExternalKey = `org:provider:${provider.toLowerCase().replace(/[^a-z0-9]+/g, "_")}`;
|
|
117
|
+
const modelExternalKey = `model:${model.toLowerCase().replace(/[^a-z0-9]+/g, "_")}`;
|
|
118
|
+
const clientExternalKey = `tool:client:${client.toLowerCase().replace(/[^a-z0-9]+/g, "_")}`;
|
|
119
|
+
const agentExternalKey = `agent:${agentId}`;
|
|
120
|
+
await callMcpTool("nexarch_upsert_entities", {
|
|
121
|
+
entities: [
|
|
122
|
+
{
|
|
123
|
+
externalKey: providerExternalKey,
|
|
124
|
+
entityTypeCode: "organisation",
|
|
125
|
+
entitySubtypeCode: "org_partner",
|
|
126
|
+
name: provider,
|
|
127
|
+
description: `AI provider: ${provider}`,
|
|
128
|
+
confidence: 1,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
externalKey: modelExternalKey,
|
|
132
|
+
entityTypeCode: "model",
|
|
133
|
+
entitySubtypeCode: "model_llm",
|
|
134
|
+
name: model,
|
|
135
|
+
description: `Large language model: ${model}`,
|
|
136
|
+
confidence: 1,
|
|
137
|
+
},
|
|
138
|
+
{
|
|
139
|
+
externalKey: clientExternalKey,
|
|
140
|
+
entityTypeCode: "tool",
|
|
141
|
+
name: client,
|
|
142
|
+
description: `AI agent client: ${client}`,
|
|
143
|
+
confidence: 1,
|
|
144
|
+
},
|
|
145
|
+
],
|
|
146
|
+
agentContext: {
|
|
147
|
+
agentId,
|
|
148
|
+
agentRunId: `agent-identify-entities-${Date.now()}`,
|
|
149
|
+
repoRef: "nexarch-cli/agent-identify",
|
|
150
|
+
observedAt: nowIso,
|
|
151
|
+
source: "nexarch-cli",
|
|
152
|
+
model,
|
|
153
|
+
provider,
|
|
154
|
+
},
|
|
155
|
+
policyContext: policyBundleHash
|
|
156
|
+
? {
|
|
157
|
+
policyBundleHash,
|
|
158
|
+
alignmentSummary: { score: 1, violations: [], waivers: [] },
|
|
159
|
+
}
|
|
160
|
+
: undefined,
|
|
161
|
+
dryRun: false,
|
|
162
|
+
}, { companyId: creds.companyId });
|
|
163
|
+
// Wire relationships: uses_model, uses, accountable_for
|
|
164
|
+
await callMcpTool("nexarch_upsert_relationships", {
|
|
165
|
+
relationships: [
|
|
166
|
+
{
|
|
167
|
+
relationshipTypeCode: "uses_model",
|
|
168
|
+
fromEntityExternalKey: agentExternalKey,
|
|
169
|
+
toEntityExternalKey: modelExternalKey,
|
|
170
|
+
confidence: 1,
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
relationshipTypeCode: "uses",
|
|
174
|
+
fromEntityExternalKey: agentExternalKey,
|
|
175
|
+
toEntityExternalKey: clientExternalKey,
|
|
176
|
+
confidence: 1,
|
|
177
|
+
},
|
|
178
|
+
{
|
|
179
|
+
relationshipTypeCode: "accountable_for",
|
|
180
|
+
fromEntityExternalKey: providerExternalKey,
|
|
181
|
+
toEntityExternalKey: agentExternalKey,
|
|
182
|
+
confidence: 1,
|
|
183
|
+
},
|
|
184
|
+
],
|
|
185
|
+
agentContext: {
|
|
186
|
+
agentId,
|
|
187
|
+
agentRunId: `agent-identify-rels-${Date.now()}`,
|
|
188
|
+
repoRef: "nexarch-cli/agent-identify",
|
|
189
|
+
observedAt: nowIso,
|
|
190
|
+
source: "nexarch-cli",
|
|
191
|
+
model,
|
|
192
|
+
provider,
|
|
193
|
+
},
|
|
194
|
+
policyContext: policyBundleHash
|
|
195
|
+
? {
|
|
196
|
+
policyBundleHash,
|
|
197
|
+
alignmentSummary: { score: 1, violations: [], waivers: [] },
|
|
198
|
+
}
|
|
199
|
+
: undefined,
|
|
200
|
+
dryRun: false,
|
|
201
|
+
}, { companyId: creds.companyId });
|
|
115
202
|
const output = {
|
|
116
203
|
ok: !failed,
|
|
117
204
|
detail: failed ? `failed (${upsert.errors?.[0]?.error ?? "unknown"})` : `agent ${firstResult?.action ?? "updated"}`,
|
|
@@ -4,7 +4,7 @@ import { join } from "path";
|
|
|
4
4
|
import process from "process";
|
|
5
5
|
import { requireCredentials } from "../lib/credentials.js";
|
|
6
6
|
import { callMcpTool, mcpInitialize, mcpListTools } from "../lib/mcp.js";
|
|
7
|
-
const CLI_VERSION = "0.1.
|
|
7
|
+
const CLI_VERSION = "0.1.15";
|
|
8
8
|
const AGENT_ENTITY_TYPE = "agent";
|
|
9
9
|
const TECH_COMPONENT_ENTITY_TYPE = "technology_component";
|
|
10
10
|
function parseFlag(args, flag) {
|