nexarch 0.2.0 → 0.2.2
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.
|
@@ -112,37 +112,52 @@ 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
|
|
115
|
+
// Upsert provider, model, client, and (optionally) framework as first-class graph entities
|
|
116
116
|
const providerExternalKey = `org:provider:${provider.toLowerCase().replace(/[^a-z0-9]+/g, "_")}`;
|
|
117
117
|
const modelExternalKey = `model:${model.toLowerCase().replace(/[^a-z0-9]+/g, "_")}`;
|
|
118
118
|
const clientExternalKey = `tool:client:${client.toLowerCase().replace(/[^a-z0-9]+/g, "_")}`;
|
|
119
|
+
const frameworkExternalKey = framework
|
|
120
|
+
? `technology_component:framework:${framework.toLowerCase().replace(/[^a-z0-9]+/g, "_")}`
|
|
121
|
+
: null;
|
|
119
122
|
const agentExternalKey = `agent:${agentId}`;
|
|
123
|
+
const identityEntities = [
|
|
124
|
+
{
|
|
125
|
+
externalKey: providerExternalKey,
|
|
126
|
+
entityTypeCode: "organisation",
|
|
127
|
+
entitySubtypeCode: "org_partner",
|
|
128
|
+
name: provider,
|
|
129
|
+
description: `AI provider: ${provider}`,
|
|
130
|
+
confidence: 1,
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
externalKey: modelExternalKey,
|
|
134
|
+
entityTypeCode: "model",
|
|
135
|
+
entitySubtypeCode: "model_llm",
|
|
136
|
+
name: model,
|
|
137
|
+
description: `Large language model: ${model}`,
|
|
138
|
+
confidence: 1,
|
|
139
|
+
},
|
|
140
|
+
{
|
|
141
|
+
externalKey: clientExternalKey,
|
|
142
|
+
entityTypeCode: "tool",
|
|
143
|
+
name: client,
|
|
144
|
+
description: `AI agent client: ${client}`,
|
|
145
|
+
confidence: 1,
|
|
146
|
+
},
|
|
147
|
+
];
|
|
148
|
+
if (framework && frameworkExternalKey) {
|
|
149
|
+
identityEntities.push({
|
|
150
|
+
externalKey: frameworkExternalKey,
|
|
151
|
+
entityTypeCode: "technology_component",
|
|
152
|
+
entitySubtypeCode: "tool_agent_runtime",
|
|
153
|
+
name: framework,
|
|
154
|
+
description: `Agent framework: ${framework}`,
|
|
155
|
+
confidence: 1,
|
|
156
|
+
attributes: { kind: "agent_framework", framework },
|
|
157
|
+
});
|
|
158
|
+
}
|
|
120
159
|
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
|
-
],
|
|
160
|
+
entities: identityEntities,
|
|
146
161
|
agentContext: {
|
|
147
162
|
agentId,
|
|
148
163
|
agentRunId: `agent-identify-entities-${Date.now()}`,
|
|
@@ -160,28 +175,37 @@ export async function agentIdentify(args) {
|
|
|
160
175
|
: undefined,
|
|
161
176
|
dryRun: false,
|
|
162
177
|
}, { companyId: creds.companyId });
|
|
163
|
-
// Wire relationships: uses_model, uses, accountable_for
|
|
178
|
+
// Wire relationships: uses_model, uses (client), accountable_for (provider), runs_on (framework)
|
|
179
|
+
const identityRelationships = [
|
|
180
|
+
{
|
|
181
|
+
relationshipTypeCode: "uses_model",
|
|
182
|
+
fromEntityExternalKey: agentExternalKey,
|
|
183
|
+
toEntityExternalKey: modelExternalKey,
|
|
184
|
+
confidence: 1,
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
relationshipTypeCode: "uses",
|
|
188
|
+
fromEntityExternalKey: agentExternalKey,
|
|
189
|
+
toEntityExternalKey: clientExternalKey,
|
|
190
|
+
confidence: 1,
|
|
191
|
+
},
|
|
192
|
+
{
|
|
193
|
+
relationshipTypeCode: "offers",
|
|
194
|
+
fromEntityExternalKey: providerExternalKey,
|
|
195
|
+
toEntityExternalKey: modelExternalKey,
|
|
196
|
+
confidence: 1,
|
|
197
|
+
},
|
|
198
|
+
];
|
|
199
|
+
if (framework && frameworkExternalKey) {
|
|
200
|
+
identityRelationships.push({
|
|
201
|
+
relationshipTypeCode: "runs_on",
|
|
202
|
+
fromEntityExternalKey: agentExternalKey,
|
|
203
|
+
toEntityExternalKey: frameworkExternalKey,
|
|
204
|
+
confidence: 1,
|
|
205
|
+
});
|
|
206
|
+
}
|
|
164
207
|
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
|
-
],
|
|
208
|
+
relationships: identityRelationships,
|
|
185
209
|
agentContext: {
|
|
186
210
|
agentId,
|
|
187
211
|
agentRunId: `agent-identify-rels-${Date.now()}`,
|
|
@@ -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.2.
|
|
7
|
+
const CLI_VERSION = "0.2.2";
|
|
8
8
|
const AGENT_ENTITY_TYPE = "agent";
|
|
9
9
|
const TECH_COMPONENT_ENTITY_TYPE = "technology_component";
|
|
10
10
|
function parseFlag(args, flag) {
|
|
@@ -473,6 +473,22 @@ export async function initAgent(args) {
|
|
|
473
473
|
confidence: 0.95,
|
|
474
474
|
attributes: { source: "nexarch-cli-init-agent", kind: "runtime", createdAt: nowIso },
|
|
475
475
|
},
|
|
476
|
+
// Host runs on its OS — gives the host entity its own OS relationship
|
|
477
|
+
{
|
|
478
|
+
relationshipTypeCode: "runs_on",
|
|
479
|
+
fromEntityExternalKey: hostExternalKey,
|
|
480
|
+
toEntityExternalKey: osExternalKey,
|
|
481
|
+
confidence: 0.95,
|
|
482
|
+
attributes: { source: "nexarch-cli-init-agent", kind: "host_os", createdAt: nowIso },
|
|
483
|
+
},
|
|
484
|
+
// Company org is accountable_for the agent
|
|
485
|
+
{
|
|
486
|
+
relationshipTypeCode: "accountable_for",
|
|
487
|
+
fromEntityExternalKey: `org:${creds.companyId}`,
|
|
488
|
+
toEntityExternalKey: agentExternalKey,
|
|
489
|
+
confidence: 1,
|
|
490
|
+
attributes: { source: "nexarch-cli-init-agent", kind: "org_agent", createdAt: nowIso },
|
|
491
|
+
},
|
|
476
492
|
],
|
|
477
493
|
agentContext: {
|
|
478
494
|
agentId,
|
|
@@ -718,6 +718,15 @@ export async function initProject(args) {
|
|
|
718
718
|
addRel(pickRelationshipType(r.entityTypeCode, sp.entityType), sp.externalKey, r.canonicalExternalRef);
|
|
719
719
|
}
|
|
720
720
|
}
|
|
721
|
+
// Company org is accountable_for the top-level project entity
|
|
722
|
+
const orgExternalKey = `org:${creds.companyId}`;
|
|
723
|
+
addRel("accountable_for", orgExternalKey, projectExternalKey, 1);
|
|
724
|
+
// Also accountable_for any sub-package applications
|
|
725
|
+
for (const sp of subPackages) {
|
|
726
|
+
if (sp.externalKey && sp.entityType === "application") {
|
|
727
|
+
addRel("accountable_for", orgExternalKey, sp.externalKey, 1);
|
|
728
|
+
}
|
|
729
|
+
}
|
|
721
730
|
if (!asJson)
|
|
722
731
|
console.log(`\nWriting to graph…`);
|
|
723
732
|
// Upsert entities
|
package/dist/lib/mcp.js
CHANGED
|
@@ -62,7 +62,7 @@ export async function mcpInitialize(options = {}) {
|
|
|
62
62
|
return callMcpRpc("initialize", {
|
|
63
63
|
protocolVersion: "2024-11-05",
|
|
64
64
|
capabilities: {},
|
|
65
|
-
clientInfo: { name: "nexarch-cli", version: "0.
|
|
65
|
+
clientInfo: { name: "nexarch-cli", version: "0.2.2" },
|
|
66
66
|
}, options);
|
|
67
67
|
}
|
|
68
68
|
export async function mcpListTools(options = {}) {
|