@inkeep/agents-cli 0.0.0-dev-20251105034049 → 0.0.0-dev-20251105201335
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/index.js +263 -213
- package/package.json +4 -4
package/dist/index.js
CHANGED
|
@@ -234778,7 +234778,7 @@ function formatStatusUpdates(statusUpdatesConfig, style, indentLevel, registry2,
|
|
|
234778
234778
|
if (statusComponentIds.length > 0) {
|
|
234779
234779
|
lines.push(`${indent}${indentation}statusComponents: [`);
|
|
234780
234780
|
for (const statusCompId of statusComponentIds) {
|
|
234781
|
-
const statusCompVar = registry2?.getVariableName(statusCompId, "
|
|
234781
|
+
const statusCompVar = registry2?.getVariableName(statusCompId, "statusComponents");
|
|
234782
234782
|
lines.push(`${indent}${indentation}${indentation}${statusCompVar || "undefined"}.config,`);
|
|
234783
234783
|
}
|
|
234784
234784
|
lines.push(`${indent}${indentation}],`);
|
|
@@ -234787,7 +234787,7 @@ function formatStatusUpdates(statusUpdatesConfig, style, indentLevel, registry2,
|
|
|
234787
234787
|
if (statusUpdatesConfig.prompt) {
|
|
234788
234788
|
if (hasTemplateVariables(statusUpdatesConfig.prompt) && contextConfigData && agentId && registry2) {
|
|
234789
234789
|
const contextConfigId = contextConfigData.id;
|
|
234790
|
-
const contextVarName = registry2.getVariableName(contextConfigId, "
|
|
234790
|
+
const contextVarName = registry2.getVariableName(contextConfigId, "contextConfigs");
|
|
234791
234791
|
if (!contextVarName) {
|
|
234792
234792
|
throw new Error(`Failed to resolve context config variable name for: ${contextConfigId}`);
|
|
234793
234793
|
}
|
|
@@ -234862,7 +234862,7 @@ function generateAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, regi
|
|
|
234862
234862
|
const semi = semicolons ? ";" : "";
|
|
234863
234863
|
let agentVarName = toCamelCase(agentId);
|
|
234864
234864
|
if (registry2) {
|
|
234865
|
-
const registryVarName = registry2.getVariableName(agentId, "
|
|
234865
|
+
const registryVarName = registry2.getVariableName(agentId, "agents");
|
|
234866
234866
|
if (registryVarName) {
|
|
234867
234867
|
agentVarName = registryVarName;
|
|
234868
234868
|
}
|
|
@@ -234877,7 +234877,7 @@ function generateAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, regi
|
|
|
234877
234877
|
if (agentData.prompt !== void 0 && agentData.prompt !== null) {
|
|
234878
234878
|
if (hasTemplateVariables(agentData.prompt) && contextConfigData && registry2) {
|
|
234879
234879
|
const contextConfigId = contextConfigData.id;
|
|
234880
|
-
const contextVarName = registry2.getVariableName(contextConfigId, "
|
|
234880
|
+
const contextVarName = registry2.getVariableName(contextConfigId, "contextConfigs");
|
|
234881
234881
|
if (!contextVarName) {
|
|
234882
234882
|
throw new Error(`Failed to resolve context config variable name for: ${contextConfigId}`);
|
|
234883
234883
|
}
|
|
@@ -234937,7 +234937,7 @@ function generateAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, regi
|
|
|
234937
234937
|
if (!registry2) {
|
|
234938
234938
|
throw new Error("Registry is required for defaultSubAgent generation");
|
|
234939
234939
|
}
|
|
234940
|
-
const defaultSubAgentVar = registry2.getVariableName(agentData.defaultSubAgentId, "
|
|
234940
|
+
const defaultSubAgentVar = registry2.getVariableName(agentData.defaultSubAgentId, "subAgents");
|
|
234941
234941
|
if (!defaultSubAgentVar) {
|
|
234942
234942
|
throw new Error(
|
|
234943
234943
|
`Failed to resolve variable name for default sub-agent: ${agentData.defaultSubAgentId}`
|
|
@@ -234950,22 +234950,14 @@ function generateAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, regi
|
|
|
234950
234950
|
throw new Error("Registry is required for subAgents generation");
|
|
234951
234951
|
}
|
|
234952
234952
|
const subAgentIds = Object.keys(agentData.subAgents);
|
|
234953
|
-
const subAgentsArray = registry2.formatReferencesForCode(subAgentIds, "
|
|
234953
|
+
const subAgentsArray = registry2.formatReferencesForCode(subAgentIds, "subAgents", style, 2);
|
|
234954
234954
|
if (!subAgentsArray) {
|
|
234955
234955
|
throw new Error(`Failed to resolve variable names for sub-agents: ${subAgentIds.join(", ")}`);
|
|
234956
234956
|
}
|
|
234957
234957
|
lines.push(`${indentation}subAgents: () => ${subAgentsArray},`);
|
|
234958
234958
|
}
|
|
234959
|
-
if (agentData.contextConfig) {
|
|
234960
|
-
|
|
234961
|
-
if (registry2) {
|
|
234962
|
-
const allComponents = registry2.getAllComponents();
|
|
234963
|
-
const contextConfigComponent = allComponents.find((comp) => comp.type === "contextConfig");
|
|
234964
|
-
if (contextConfigComponent) {
|
|
234965
|
-
contextConfigVar = contextConfigComponent.name;
|
|
234966
|
-
} else {
|
|
234967
|
-
}
|
|
234968
|
-
}
|
|
234959
|
+
if (agentData.contextConfig && registry2 && agentData.contextConfig.id) {
|
|
234960
|
+
const contextConfigVar = registry2.getVariableName(agentData.contextConfig.id, "contextConfigs");
|
|
234969
234961
|
if (contextConfigVar) {
|
|
234970
234962
|
lines.push(`${indentation}contextConfig: ${contextConfigVar},`);
|
|
234971
234963
|
} else {
|
|
@@ -235004,25 +234996,25 @@ function generateAgentImports(agentId, agentData, style = DEFAULT_STYLE, registr
|
|
|
235004
234996
|
if (agentData.subAgents && typeof agentData.subAgents === "object") {
|
|
235005
234997
|
const subAgentIds = Object.keys(agentData.subAgents);
|
|
235006
234998
|
referencedComponents.push(
|
|
235007
|
-
...subAgentIds.map((id) => ({ id, type: "
|
|
234999
|
+
...subAgentIds.map((id) => ({ id, type: "subAgents" }))
|
|
235008
235000
|
);
|
|
235009
235001
|
}
|
|
235010
235002
|
if (agentData.statusUpdates && agentData.statusUpdates.statusComponents && Array.isArray(agentData.statusUpdates.statusComponents)) {
|
|
235011
235003
|
for (const comp of agentData.statusUpdates.statusComponents) {
|
|
235012
235004
|
if (typeof comp === "string") {
|
|
235013
|
-
referencedComponents.push({ id: comp, type: "
|
|
235005
|
+
referencedComponents.push({ id: comp, type: "statusComponents" });
|
|
235014
235006
|
} else if (typeof comp === "object" && comp) {
|
|
235015
235007
|
const statusId = comp.id || comp.type || comp.name;
|
|
235016
|
-
if (statusId) referencedComponents.push({ id: statusId, type: "
|
|
235008
|
+
if (statusId) referencedComponents.push({ id: statusId, type: "statusComponents" });
|
|
235017
235009
|
}
|
|
235018
235010
|
}
|
|
235019
235011
|
}
|
|
235020
235012
|
if (agentData.contextConfig) {
|
|
235021
235013
|
const contextConfigId = agentData.contextConfig.id;
|
|
235022
|
-
referencedComponents.push({ id: contextConfigId, type: "
|
|
235014
|
+
referencedComponents.push({ id: contextConfigId, type: "contextConfigs" });
|
|
235023
235015
|
}
|
|
235024
235016
|
if (agentData.defaultSubAgentId) {
|
|
235025
|
-
referencedComponents.push({ id: agentData.defaultSubAgentId, type: "
|
|
235017
|
+
referencedComponents.push({ id: agentData.defaultSubAgentId, type: "subAgents" });
|
|
235026
235018
|
}
|
|
235027
235019
|
const componentImports = registry2.getImportsForFile(currentFilePath, referencedComponents);
|
|
235028
235020
|
imports.push(...componentImports);
|
|
@@ -235290,7 +235282,7 @@ function generateContextConfigDefinition(contextId, contextData, style = DEFAULT
|
|
|
235290
235282
|
if (!registry2) {
|
|
235291
235283
|
throw new Error("Registry is required for context config variable name generation");
|
|
235292
235284
|
}
|
|
235293
|
-
const varName = registry2.getVariableName(contextId, "
|
|
235285
|
+
const varName = registry2.getVariableName(contextId, "contextConfigs");
|
|
235294
235286
|
if (!varName) {
|
|
235295
235287
|
throw new Error(`Failed to resolve variable name for context config: ${contextId}`);
|
|
235296
235288
|
}
|
|
@@ -235398,7 +235390,7 @@ function generateContextConfigFile(contextId, contextData, style = DEFAULT_STYLE
|
|
|
235398
235390
|
if (!registry2) {
|
|
235399
235391
|
throw new Error("Registry is required for context config variable name generation");
|
|
235400
235392
|
}
|
|
235401
|
-
const varName = registry2.getVariableName(contextId, "
|
|
235393
|
+
const varName = registry2.getVariableName(contextId, "contextConfigs");
|
|
235402
235394
|
if (!varName) {
|
|
235403
235395
|
throw new Error(`Failed to resolve variable name for context config: ${contextId}`);
|
|
235404
235396
|
}
|
|
@@ -235787,7 +235779,7 @@ function generateEnvironmentFile(environmentName, environmentData, style = DEFAU
|
|
|
235787
235779
|
const credentialRefs = [];
|
|
235788
235780
|
imports.push(`import { registerEnvironmentSettings } from ${q}@inkeep/agents-sdk${q}${semi}`);
|
|
235789
235781
|
for (const credentialId of environmentData.credentials) {
|
|
235790
|
-
const credentialComponent = registry2.get(credentialId, "
|
|
235782
|
+
const credentialComponent = registry2.get(credentialId, "credentials");
|
|
235791
235783
|
if (credentialComponent) {
|
|
235792
235784
|
const relativePath = `../credentials/${credentialId}`;
|
|
235793
235785
|
imports.push(`import { ${credentialComponent.name} } from ${q}${relativePath}${q}${semi}`);
|
|
@@ -235804,7 +235796,7 @@ function generateEnvironmentFile(environmentName, environmentData, style = DEFAU
|
|
|
235804
235796
|
const credentialId = environmentData.credentials[i];
|
|
235805
235797
|
const credentialVarName = credentialRefs[i];
|
|
235806
235798
|
const isLast = i === credentialRefs.length - 1;
|
|
235807
|
-
const validKey = registry2.getVariableName(credentialId, "
|
|
235799
|
+
const validKey = registry2.getVariableName(credentialId, "credentials");
|
|
235808
235800
|
lines.push(
|
|
235809
235801
|
`${indentation}${indentation}${validKey}: ${credentialVarName}${isLast ? "" : ","}`
|
|
235810
235802
|
);
|
|
@@ -235854,7 +235846,7 @@ function generateExternalAgentDefinition(agentId, agentData, style = DEFAULT_STY
|
|
|
235854
235846
|
const semi = semicolons ? ";" : "";
|
|
235855
235847
|
let agentVarName = toCamelCase(agentId);
|
|
235856
235848
|
if (registry2) {
|
|
235857
|
-
const registryVarName = registry2.getVariableName(agentId, "
|
|
235849
|
+
const registryVarName = registry2.getVariableName(agentId, "externalAgents");
|
|
235858
235850
|
if (registryVarName) {
|
|
235859
235851
|
agentVarName = registryVarName;
|
|
235860
235852
|
}
|
|
@@ -235880,7 +235872,7 @@ function generateExternalAgentDefinition(agentId, agentData, style = DEFAULT_STY
|
|
|
235880
235872
|
if (!registry2) {
|
|
235881
235873
|
throw new Error("Registry is required for credentialReference generation");
|
|
235882
235874
|
}
|
|
235883
|
-
const credentialVar = registry2.getVariableName(agentData.credentialReference, "
|
|
235875
|
+
const credentialVar = registry2.getVariableName(agentData.credentialReference, "credentials");
|
|
235884
235876
|
if (!credentialVar) {
|
|
235885
235877
|
throw new Error(
|
|
235886
235878
|
`Failed to resolve variable name for credential reference: ${agentData.credentialReference}`
|
|
@@ -235925,7 +235917,7 @@ function generateExternalAgentImports(agentId, agentData, style = DEFAULT_STYLE,
|
|
|
235925
235917
|
}
|
|
235926
235918
|
const currentFilePath = `external-agents/${agentId}.ts`;
|
|
235927
235919
|
const credentialRefs = [
|
|
235928
|
-
{ id: agentData.credentialReference, type: "
|
|
235920
|
+
{ id: agentData.credentialReference, type: "credentials" }
|
|
235929
235921
|
];
|
|
235930
235922
|
const componentImports = registry2.getImportsForFile(currentFilePath, credentialRefs);
|
|
235931
235923
|
imports.push(...componentImports);
|
|
@@ -236097,7 +236089,13 @@ function generateMcpToolDefinition(toolId, toolData, style = DEFAULT_STYLE7, reg
|
|
|
236097
236089
|
lines.push(`export const ${toolVarName} = mcpTool({`);
|
|
236098
236090
|
lines.push(`${indentation}id: ${formatString7(toolId, q)},`);
|
|
236099
236091
|
lines.push(`${indentation}name: ${formatString7(toolData.name, q)},`);
|
|
236100
|
-
|
|
236092
|
+
if (toolData.config?.mcp && typeof toolData.config.mcp === "object") {
|
|
236093
|
+
const mcpConfig = toolData.config.mcp;
|
|
236094
|
+
lines.push(`${indentation}serverUrl: ${formatString7(mcpConfig.server?.url, q)},`);
|
|
236095
|
+
if (mcpConfig.transport) {
|
|
236096
|
+
lines.push(`${indentation}transport: ${JSON.stringify(mcpConfig.transport, null, 2)},`);
|
|
236097
|
+
}
|
|
236098
|
+
}
|
|
236101
236099
|
if (toolData.description) {
|
|
236102
236100
|
lines.push(`${indentation}description: ${formatString7(toolData.description, q, true)},`);
|
|
236103
236101
|
}
|
|
@@ -236120,7 +236118,7 @@ function generateMcpToolDefinition(toolId, toolData, style = DEFAULT_STYLE7, reg
|
|
|
236120
236118
|
lines.push(`${indentation}credential: ${toolData.credential},`);
|
|
236121
236119
|
}
|
|
236122
236120
|
} else if (toolData.credentialReferenceId && registry2) {
|
|
236123
|
-
const validKey = registry2.getVariableName(toolData.credentialReferenceId, "
|
|
236121
|
+
const validKey = registry2.getVariableName(toolData.credentialReferenceId, "credentials");
|
|
236124
236122
|
lines.push(
|
|
236125
236123
|
`${indentation}credential: envSettings.getEnvironmentCredential(${formatString7(validKey, q)}),`
|
|
236126
236124
|
);
|
|
@@ -236219,32 +236217,32 @@ function generateProjectDefinition(projectId, projectData, style = DEFAULT_STYLE
|
|
|
236219
236217
|
lines.push(`${indentation}},`);
|
|
236220
236218
|
}
|
|
236221
236219
|
if (shouldInclude(projectData.agents)) {
|
|
236222
|
-
const agentsArray = registry2 ? registry2.formatReferencesForCode(projectData.agents, "
|
|
236220
|
+
const agentsArray = registry2 ? registry2.formatReferencesForCode(projectData.agents, "agents", style, 2) : "[]";
|
|
236223
236221
|
lines.push(`${indentation}agents: () => ${agentsArray},`);
|
|
236224
236222
|
}
|
|
236225
236223
|
if (shouldInclude(projectData.tools)) {
|
|
236226
|
-
const toolsArray = registry2 ? registry2.formatReferencesForCode(projectData.tools, "
|
|
236224
|
+
const toolsArray = registry2 ? registry2.formatReferencesForCode(projectData.tools, "tools", style, 2) : "[]";
|
|
236227
236225
|
lines.push(`${indentation}tools: () => ${toolsArray},`);
|
|
236228
236226
|
}
|
|
236229
236227
|
if (shouldInclude(projectData.externalAgents)) {
|
|
236230
|
-
const externalAgentsArray = registry2 ? registry2.formatReferencesForCode(projectData.externalAgents, "
|
|
236228
|
+
const externalAgentsArray = registry2 ? registry2.formatReferencesForCode(projectData.externalAgents, "externalAgents", style, 2) : "[]";
|
|
236231
236229
|
lines.push(`${indentation}externalAgents: () => ${externalAgentsArray},`);
|
|
236232
236230
|
}
|
|
236233
236231
|
if (shouldInclude(projectData.dataComponents)) {
|
|
236234
|
-
const dataComponentsArray = registry2 ? registry2.formatReferencesForCode(projectData.dataComponents, "
|
|
236232
|
+
const dataComponentsArray = registry2 ? registry2.formatReferencesForCode(projectData.dataComponents, "dataComponents", style, 2) : "[]";
|
|
236235
236233
|
lines.push(`${indentation}dataComponents: () => ${dataComponentsArray},`);
|
|
236236
236234
|
}
|
|
236237
236235
|
if (shouldInclude(projectData.artifactComponents)) {
|
|
236238
236236
|
const artifactComponentsArray = registry2 ? registry2.formatReferencesForCode(
|
|
236239
236237
|
projectData.artifactComponents,
|
|
236240
|
-
"
|
|
236238
|
+
"artifactComponents",
|
|
236241
236239
|
style,
|
|
236242
236240
|
2
|
|
236243
236241
|
) : "[]";
|
|
236244
236242
|
lines.push(`${indentation}artifactComponents: () => ${artifactComponentsArray},`);
|
|
236245
236243
|
}
|
|
236246
236244
|
if (shouldInclude(projectData.credentialReferences)) {
|
|
236247
|
-
const credentialReferencesArray = registry2 ? registry2.formatReferencesForCode(projectData.credentialReferences, "
|
|
236245
|
+
const credentialReferencesArray = registry2 ? registry2.formatReferencesForCode(projectData.credentialReferences, "credentials", style, 2) : "[]";
|
|
236248
236246
|
lines.push(`${indentation}credentialReferences: () => ${credentialReferencesArray},`);
|
|
236249
236247
|
}
|
|
236250
236248
|
removeTrailingComma(lines);
|
|
@@ -236265,7 +236263,7 @@ function generateProjectImports(projectId, projectData, style = DEFAULT_STYLE, r
|
|
|
236265
236263
|
agentIds = Object.keys(projectData.agents);
|
|
236266
236264
|
}
|
|
236267
236265
|
for (const agentId of agentIds) {
|
|
236268
|
-
referencedComponents.push({ id: agentId, type: "
|
|
236266
|
+
referencedComponents.push({ id: agentId, type: "agents" });
|
|
236269
236267
|
}
|
|
236270
236268
|
}
|
|
236271
236269
|
if (projectData.tools) {
|
|
@@ -236276,11 +236274,11 @@ function generateProjectImports(projectId, projectData, style = DEFAULT_STYLE, r
|
|
|
236276
236274
|
toolIds = Object.keys(projectData.tools);
|
|
236277
236275
|
}
|
|
236278
236276
|
for (const toolId of toolIds) {
|
|
236279
|
-
let componentType = "
|
|
236280
|
-
if (registry2 && registry2.get(toolId, "
|
|
236281
|
-
componentType = "
|
|
236282
|
-
} else if (registry2 && registry2.get(toolId, "
|
|
236283
|
-
componentType = "
|
|
236277
|
+
let componentType = "tools";
|
|
236278
|
+
if (registry2 && registry2.get(toolId, "functionTools")) {
|
|
236279
|
+
componentType = "functionTools";
|
|
236280
|
+
} else if (registry2 && registry2.get(toolId, "tools")) {
|
|
236281
|
+
componentType = "tools";
|
|
236284
236282
|
}
|
|
236285
236283
|
referencedComponents.push({ id: toolId, type: componentType });
|
|
236286
236284
|
}
|
|
@@ -236293,7 +236291,7 @@ function generateProjectImports(projectId, projectData, style = DEFAULT_STYLE, r
|
|
|
236293
236291
|
extAgentIds = Object.keys(projectData.externalAgents);
|
|
236294
236292
|
}
|
|
236295
236293
|
for (const extAgentId of extAgentIds) {
|
|
236296
|
-
referencedComponents.push({ id: extAgentId, type: "
|
|
236294
|
+
referencedComponents.push({ id: extAgentId, type: "externalAgents" });
|
|
236297
236295
|
}
|
|
236298
236296
|
}
|
|
236299
236297
|
if (projectData.dataComponents) {
|
|
@@ -236304,7 +236302,7 @@ function generateProjectImports(projectId, projectData, style = DEFAULT_STYLE, r
|
|
|
236304
236302
|
dataCompIds = Object.keys(projectData.dataComponents);
|
|
236305
236303
|
}
|
|
236306
236304
|
for (const dataCompId of dataCompIds) {
|
|
236307
|
-
referencedComponents.push({ id: dataCompId, type: "
|
|
236305
|
+
referencedComponents.push({ id: dataCompId, type: "dataComponents" });
|
|
236308
236306
|
}
|
|
236309
236307
|
}
|
|
236310
236308
|
if (projectData.artifactComponents) {
|
|
@@ -236315,7 +236313,7 @@ function generateProjectImports(projectId, projectData, style = DEFAULT_STYLE, r
|
|
|
236315
236313
|
artifactCompIds = Object.keys(projectData.artifactComponents);
|
|
236316
236314
|
}
|
|
236317
236315
|
for (const artifactCompId of artifactCompIds) {
|
|
236318
|
-
referencedComponents.push({ id: artifactCompId, type: "
|
|
236316
|
+
referencedComponents.push({ id: artifactCompId, type: "artifactComponents" });
|
|
236319
236317
|
}
|
|
236320
236318
|
}
|
|
236321
236319
|
if (projectData.credentialReferences) {
|
|
@@ -236326,7 +236324,7 @@ function generateProjectImports(projectId, projectData, style = DEFAULT_STYLE, r
|
|
|
236326
236324
|
credIds = Object.keys(projectData.credentialReferences);
|
|
236327
236325
|
}
|
|
236328
236326
|
for (const credId of credIds) {
|
|
236329
|
-
referencedComponents.push({ id: credId, type: "
|
|
236327
|
+
referencedComponents.push({ id: credId, type: "credentials" });
|
|
236330
236328
|
}
|
|
236331
236329
|
}
|
|
236332
236330
|
if (referencedComponents.length > 0) {
|
|
@@ -236498,7 +236496,7 @@ function generateSubAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, r
|
|
|
236498
236496
|
const semi = semicolons ? ";" : "";
|
|
236499
236497
|
let agentVarName = toCamelCase(agentId);
|
|
236500
236498
|
if (registry2) {
|
|
236501
|
-
const registryVarName = registry2.getVariableName(agentId, "
|
|
236499
|
+
const registryVarName = registry2.getVariableName(agentId, "subAgents");
|
|
236502
236500
|
if (registryVarName) {
|
|
236503
236501
|
agentVarName = registryVarName;
|
|
236504
236502
|
}
|
|
@@ -236510,7 +236508,7 @@ function generateSubAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, r
|
|
|
236510
236508
|
lines.push(`${indentation}description: ${formatString(agentData.description, q, true)},`);
|
|
236511
236509
|
if (agentData.prompt !== void 0 && agentData.prompt !== null) {
|
|
236512
236510
|
if (hasTemplateVariables(agentData.prompt) && parentAgentId && registry2 && contextConfigData) {
|
|
236513
|
-
const contextVarName = registry2.getVariableName(contextConfigData.id, "
|
|
236511
|
+
const contextVarName = registry2.getVariableName(contextConfigData.id, "contextConfigs");
|
|
236514
236512
|
if (!contextVarName) {
|
|
236515
236513
|
throw new Error(
|
|
236516
236514
|
`Failed to resolve context config variable name for: ${contextConfigData.id}`
|
|
@@ -236575,13 +236573,13 @@ function generateSubAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, r
|
|
|
236575
236573
|
}
|
|
236576
236574
|
for (const toolRelation of agentData.canUse) {
|
|
236577
236575
|
const toolId = toolRelation.toolId;
|
|
236578
|
-
let toolVarName = registry2.getVariableName(toolId, "
|
|
236576
|
+
let toolVarName = registry2.getVariableName(toolId, "tools");
|
|
236579
236577
|
if (!toolVarName) {
|
|
236580
|
-
toolVarName = registry2.getVariableName(toolId, "
|
|
236578
|
+
toolVarName = registry2.getVariableName(toolId, "functionTools");
|
|
236581
236579
|
}
|
|
236582
236580
|
if (!toolVarName) {
|
|
236583
236581
|
throw new Error(
|
|
236584
|
-
`Failed to resolve variable name for tool: ${toolId} (tried both '
|
|
236582
|
+
`Failed to resolve variable name for tool: ${toolId} (tried both 'tools' and 'functionTools' types)`
|
|
236585
236583
|
);
|
|
236586
236584
|
}
|
|
236587
236585
|
const hasToolSelection = toolRelation.toolSelection && toolRelation.toolSelection.length > 0;
|
|
@@ -236627,19 +236625,19 @@ function generateSubAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, r
|
|
|
236627
236625
|
let hasHeaders = false;
|
|
236628
236626
|
if (typeof delegateRelation === "string") {
|
|
236629
236627
|
targetAgentId = delegateRelation;
|
|
236630
|
-
targetType = "
|
|
236628
|
+
targetType = "subAgents";
|
|
236631
236629
|
hasHeaders = false;
|
|
236632
236630
|
} else if (delegateRelation && typeof delegateRelation === "object") {
|
|
236633
236631
|
hasHeaders = delegateRelation.headers && Object.keys(delegateRelation.headers).length > 0;
|
|
236634
236632
|
if (delegateRelation.externalAgentId) {
|
|
236635
236633
|
targetAgentId = delegateRelation.externalAgentId;
|
|
236636
|
-
targetType = "
|
|
236634
|
+
targetType = "externalAgents";
|
|
236637
236635
|
} else if (delegateRelation.agentId) {
|
|
236638
236636
|
targetAgentId = delegateRelation.agentId;
|
|
236639
|
-
targetType = "
|
|
236637
|
+
targetType = "agents";
|
|
236640
236638
|
} else if (delegateRelation.subAgentId) {
|
|
236641
236639
|
targetAgentId = delegateRelation.subAgentId;
|
|
236642
|
-
targetType = "
|
|
236640
|
+
targetType = "subAgents";
|
|
236643
236641
|
} else {
|
|
236644
236642
|
throw new Error(
|
|
236645
236643
|
`Delegate relation missing agentId, subAgentId, or externalAgentId: ${JSON.stringify(delegateRelation)}`
|
|
@@ -236686,7 +236684,7 @@ function generateSubAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, r
|
|
|
236686
236684
|
}
|
|
236687
236685
|
const transferArray = registry2.formatReferencesForCode(
|
|
236688
236686
|
agentData.canTransferTo,
|
|
236689
|
-
"
|
|
236687
|
+
"subAgents",
|
|
236690
236688
|
style,
|
|
236691
236689
|
2
|
|
236692
236690
|
);
|
|
@@ -236703,7 +236701,7 @@ function generateSubAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, r
|
|
|
236703
236701
|
}
|
|
236704
236702
|
const dataComponentsArray = registry2.formatReferencesForCode(
|
|
236705
236703
|
agentData.dataComponents,
|
|
236706
|
-
"
|
|
236704
|
+
"dataComponents",
|
|
236707
236705
|
style,
|
|
236708
236706
|
2
|
|
236709
236707
|
);
|
|
@@ -236720,7 +236718,7 @@ function generateSubAgentDefinition(agentId, agentData, style = DEFAULT_STYLE, r
|
|
|
236720
236718
|
}
|
|
236721
236719
|
const artifactComponentsArray = registry2.formatReferencesForCode(
|
|
236722
236720
|
agentData.artifactComponents,
|
|
236723
|
-
"
|
|
236721
|
+
"artifactComponents",
|
|
236724
236722
|
style,
|
|
236725
236723
|
2
|
|
236726
236724
|
);
|
|
@@ -236751,7 +236749,7 @@ function generateSubAgentImports(agentId, agentData, style = DEFAULT_STYLE, regi
|
|
|
236751
236749
|
const importStatement = registry2.getImportStatement(
|
|
236752
236750
|
currentFilePath,
|
|
236753
236751
|
contextConfigId,
|
|
236754
|
-
"
|
|
236752
|
+
"contextConfigs"
|
|
236755
236753
|
);
|
|
236756
236754
|
if (importStatement) {
|
|
236757
236755
|
imports.push(importStatement);
|
|
@@ -236764,11 +236762,11 @@ function generateSubAgentImports(agentId, agentData, style = DEFAULT_STYLE, regi
|
|
|
236764
236762
|
for (const toolRelation of agentData.canUse) {
|
|
236765
236763
|
const toolId = toolRelation.toolId;
|
|
236766
236764
|
if (toolId) {
|
|
236767
|
-
let componentType = "
|
|
236768
|
-
if (registry2.get(toolId, "
|
|
236769
|
-
componentType = "
|
|
236770
|
-
} else if (registry2.get(toolId, "
|
|
236771
|
-
componentType = "
|
|
236765
|
+
let componentType = "tools";
|
|
236766
|
+
if (registry2.get(toolId, "functionTools")) {
|
|
236767
|
+
componentType = "functionTools";
|
|
236768
|
+
} else if (registry2.get(toolId, "tools")) {
|
|
236769
|
+
componentType = "tools";
|
|
236772
236770
|
}
|
|
236773
236771
|
referencedComponents.push({ id: toolId, type: componentType });
|
|
236774
236772
|
}
|
|
@@ -236777,17 +236775,17 @@ function generateSubAgentImports(agentId, agentData, style = DEFAULT_STYLE, regi
|
|
|
236777
236775
|
if (Array.isArray(agentData.canDelegateTo)) {
|
|
236778
236776
|
for (const delegateRelation of agentData.canDelegateTo) {
|
|
236779
236777
|
let targetId;
|
|
236780
|
-
let targetType = "
|
|
236778
|
+
let targetType = "agents";
|
|
236781
236779
|
if (delegateRelation && typeof delegateRelation === "object") {
|
|
236782
236780
|
if (delegateRelation.externalAgentId) {
|
|
236783
236781
|
targetId = delegateRelation.externalAgentId;
|
|
236784
|
-
targetType = "
|
|
236782
|
+
targetType = "externalAgents";
|
|
236785
236783
|
} else if (delegateRelation.agentId) {
|
|
236786
236784
|
targetId = delegateRelation.agentId;
|
|
236787
|
-
targetType = "
|
|
236785
|
+
targetType = "agents";
|
|
236788
236786
|
} else if (delegateRelation.subAgentId) {
|
|
236789
236787
|
targetId = delegateRelation.subAgentId;
|
|
236790
|
-
targetType = "
|
|
236788
|
+
targetType = "subAgents";
|
|
236791
236789
|
}
|
|
236792
236790
|
}
|
|
236793
236791
|
if (targetId) {
|
|
@@ -236798,21 +236796,21 @@ function generateSubAgentImports(agentId, agentData, style = DEFAULT_STYLE, regi
|
|
|
236798
236796
|
if (Array.isArray(agentData.canTransferTo)) {
|
|
236799
236797
|
for (const transferId of agentData.canTransferTo) {
|
|
236800
236798
|
if (typeof transferId === "string") {
|
|
236801
|
-
referencedComponents.push({ id: transferId, type: "
|
|
236799
|
+
referencedComponents.push({ id: transferId, type: "subAgents" });
|
|
236802
236800
|
}
|
|
236803
236801
|
}
|
|
236804
236802
|
}
|
|
236805
236803
|
if (Array.isArray(agentData.dataComponents)) {
|
|
236806
236804
|
for (const dataCompId of agentData.dataComponents) {
|
|
236807
236805
|
if (typeof dataCompId === "string") {
|
|
236808
|
-
referencedComponents.push({ id: dataCompId, type: "
|
|
236806
|
+
referencedComponents.push({ id: dataCompId, type: "dataComponents" });
|
|
236809
236807
|
}
|
|
236810
236808
|
}
|
|
236811
236809
|
}
|
|
236812
236810
|
if (Array.isArray(agentData.artifactComponents)) {
|
|
236813
236811
|
for (const artifactCompId of agentData.artifactComponents) {
|
|
236814
236812
|
if (typeof artifactCompId === "string") {
|
|
236815
|
-
referencedComponents.push({ id: artifactCompId, type: "
|
|
236813
|
+
referencedComponents.push({ id: artifactCompId, type: "artifactComponents" });
|
|
236816
236814
|
}
|
|
236817
236815
|
}
|
|
236818
236816
|
}
|
|
@@ -236856,59 +236854,62 @@ function registerAllComponents(project, registry2) {
|
|
|
236856
236854
|
registry2.register(project.id, "project", "index.ts");
|
|
236857
236855
|
if (project.credentialReferences) {
|
|
236858
236856
|
for (const credId of Object.keys(project.credentialReferences)) {
|
|
236859
|
-
registry2.register(credId, "
|
|
236857
|
+
registry2.register(credId, "credentials", `credentials/${credId}.ts`);
|
|
236860
236858
|
}
|
|
236861
236859
|
}
|
|
236862
236860
|
if (project.tools) {
|
|
236863
236861
|
for (const toolId of Object.keys(project.tools)) {
|
|
236864
|
-
registry2.register(toolId, "
|
|
236862
|
+
registry2.register(toolId, "tools", `tools/${toolId}.ts`);
|
|
236865
236863
|
}
|
|
236866
236864
|
}
|
|
236867
236865
|
const processedFunctionIds = /* @__PURE__ */ new Set();
|
|
236868
236866
|
if (project.functions) {
|
|
236869
236867
|
for (const funcId of Object.keys(project.functions)) {
|
|
236870
|
-
registry2.register(funcId, "
|
|
236868
|
+
registry2.register(funcId, "functionTools", `tools/functions/${funcId}.ts`);
|
|
236871
236869
|
processedFunctionIds.add(funcId);
|
|
236872
236870
|
}
|
|
236873
236871
|
}
|
|
236874
236872
|
if (project.functionTools) {
|
|
236875
236873
|
for (const funcToolId of Object.keys(project.functionTools)) {
|
|
236876
236874
|
if (!processedFunctionIds.has(funcToolId)) {
|
|
236877
|
-
registry2.register(funcToolId, "
|
|
236875
|
+
registry2.register(funcToolId, "functionTools", `tools/functions/${funcToolId}.ts`);
|
|
236878
236876
|
}
|
|
236879
236877
|
}
|
|
236880
236878
|
}
|
|
236881
236879
|
if (project.dataComponents) {
|
|
236882
236880
|
for (const componentId of Object.keys(project.dataComponents)) {
|
|
236883
|
-
registry2.register(componentId, "
|
|
236881
|
+
registry2.register(componentId, "dataComponents", `data-components/${componentId}.ts`);
|
|
236884
236882
|
}
|
|
236885
236883
|
}
|
|
236886
236884
|
if (project.artifactComponents) {
|
|
236887
236885
|
for (const componentId of Object.keys(project.artifactComponents)) {
|
|
236888
|
-
registry2.register(componentId, "
|
|
236886
|
+
registry2.register(componentId, "artifactComponents", `artifact-components/${componentId}.ts`);
|
|
236889
236887
|
}
|
|
236890
236888
|
}
|
|
236891
236889
|
if (project.externalAgents) {
|
|
236892
236890
|
for (const extAgentId of Object.keys(project.externalAgents)) {
|
|
236893
|
-
registry2.register(extAgentId, "
|
|
236891
|
+
registry2.register(extAgentId, "externalAgents", `external-agents/${extAgentId}.ts`);
|
|
236894
236892
|
}
|
|
236895
236893
|
}
|
|
236896
236894
|
const statusComponents = extractStatusComponents(project);
|
|
236897
236895
|
for (const statusId of Object.keys(statusComponents)) {
|
|
236898
|
-
registry2.register(statusId, "
|
|
236896
|
+
registry2.register(statusId, "statusComponents", `status-components/${statusId}.ts`);
|
|
236899
236897
|
}
|
|
236900
236898
|
if (project.agents) {
|
|
236901
236899
|
for (const agentId of Object.keys(project.agents)) {
|
|
236902
|
-
|
|
236900
|
+
console.log(`\u{1F527} Registering agent: ${agentId}`);
|
|
236901
|
+
registry2.register(agentId, "agents", `agents/${agentId}.ts`);
|
|
236903
236902
|
}
|
|
236904
236903
|
}
|
|
236905
236904
|
const subAgents2 = extractSubAgents(project);
|
|
236905
|
+
console.log(`\u{1F527} Found subAgents:`, Object.keys(subAgents2));
|
|
236906
236906
|
for (const subAgentId of Object.keys(subAgents2)) {
|
|
236907
|
-
|
|
236907
|
+
console.log(`\u{1F527} Registering subAgent: ${subAgentId}`);
|
|
236908
|
+
registry2.register(subAgentId, "subAgents", `agents/sub-agents/${subAgentId}.ts`);
|
|
236908
236909
|
}
|
|
236909
236910
|
const contextConfigs2 = extractContextConfigs(project);
|
|
236910
236911
|
for (const contextId of Object.keys(contextConfigs2)) {
|
|
236911
|
-
registry2.register(contextId, "
|
|
236912
|
+
registry2.register(contextId, "contextConfigs", `context-configs/${contextId}.ts`);
|
|
236912
236913
|
}
|
|
236913
236914
|
}
|
|
236914
236915
|
function extractStatusComponents(project) {
|
|
@@ -237013,6 +237014,9 @@ var init_component_registry = __esm({
|
|
|
237013
237014
|
} else {
|
|
237014
237015
|
const baseName = this.toCamelCase(id);
|
|
237015
237016
|
const uniqueName = this.ensureUniqueName(baseName, type);
|
|
237017
|
+
console.log(
|
|
237018
|
+
`\u{1F527} Registry: ${type}:${id} -> baseName: "${baseName}" -> uniqueName: "${uniqueName}"`
|
|
237019
|
+
);
|
|
237016
237020
|
name = uniqueName;
|
|
237017
237021
|
actualExportName = uniqueName;
|
|
237018
237022
|
}
|
|
@@ -237187,26 +237191,36 @@ var init_component_registry = __esm({
|
|
|
237187
237191
|
*/
|
|
237188
237192
|
getTypePrefix(type) {
|
|
237189
237193
|
switch (type) {
|
|
237190
|
-
case "
|
|
237194
|
+
case "agents":
|
|
237191
237195
|
return "agent";
|
|
237192
|
-
case "
|
|
237196
|
+
case "subAgents":
|
|
237193
237197
|
return "sub";
|
|
237194
|
-
case "
|
|
237198
|
+
case "externalAgents":
|
|
237195
237199
|
return "ext";
|
|
237196
|
-
case "
|
|
237200
|
+
case "tools":
|
|
237197
237201
|
return "tool";
|
|
237198
|
-
case "
|
|
237202
|
+
case "functionTools":
|
|
237199
237203
|
return "func";
|
|
237200
|
-
case "
|
|
237204
|
+
case "functions":
|
|
237205
|
+
return "func";
|
|
237206
|
+
case "dataComponents":
|
|
237201
237207
|
return "data";
|
|
237202
|
-
case "
|
|
237208
|
+
case "artifactComponents":
|
|
237203
237209
|
return "artifact";
|
|
237204
|
-
case "
|
|
237205
|
-
return "cred";
|
|
237206
|
-
case "statusComponent":
|
|
237210
|
+
case "statusComponents":
|
|
237207
237211
|
return "status";
|
|
237208
|
-
case "
|
|
237212
|
+
case "environments":
|
|
237213
|
+
return "env";
|
|
237214
|
+
case "credentials":
|
|
237215
|
+
return "cred";
|
|
237216
|
+
case "contextConfigs":
|
|
237209
237217
|
return "context";
|
|
237218
|
+
case "fetchDefinitions":
|
|
237219
|
+
return "fetch";
|
|
237220
|
+
case "headers":
|
|
237221
|
+
return "header";
|
|
237222
|
+
case "models":
|
|
237223
|
+
return "model";
|
|
237210
237224
|
case "project":
|
|
237211
237225
|
return "project";
|
|
237212
237226
|
default:
|
|
@@ -237235,13 +237249,14 @@ var init_component_registry = __esm({
|
|
|
237235
237249
|
* Get all components for debugging
|
|
237236
237250
|
*/
|
|
237237
237251
|
getAllComponents() {
|
|
237238
|
-
return Array.from(this.
|
|
237252
|
+
return Array.from(this.componentsByTypeAndId.values());
|
|
237239
237253
|
}
|
|
237240
237254
|
/**
|
|
237241
237255
|
* Clear all components (for testing)
|
|
237242
237256
|
*/
|
|
237243
237257
|
clear() {
|
|
237244
237258
|
this.components.clear();
|
|
237259
|
+
this.componentsByTypeAndId.clear();
|
|
237245
237260
|
this.usedNames.clear();
|
|
237246
237261
|
}
|
|
237247
237262
|
};
|
|
@@ -237327,7 +237342,7 @@ async function introspectGenerate(project, paths, environment, debug, options =
|
|
|
237327
237342
|
generatedFiles.push(artifactFile);
|
|
237328
237343
|
}
|
|
237329
237344
|
}
|
|
237330
|
-
const registeredStatusComponents = registry2.getAllComponents().filter((c) => c.type === "
|
|
237345
|
+
const registeredStatusComponents = registry2.getAllComponents().filter((c) => c.type === "statusComponents");
|
|
237331
237346
|
if (registeredStatusComponents.length > 0) {
|
|
237332
237347
|
for (const statusComp of registeredStatusComponents) {
|
|
237333
237348
|
const statusData = findStatusComponentData(project, statusComp.id);
|
|
@@ -237354,7 +237369,7 @@ async function introspectGenerate(project, paths, environment, debug, options =
|
|
|
237354
237369
|
generatedFiles.push(extAgentFile);
|
|
237355
237370
|
}
|
|
237356
237371
|
}
|
|
237357
|
-
const registeredContextConfigs = registry2.getAllComponents().filter((c) => c.type === "
|
|
237372
|
+
const registeredContextConfigs = registry2.getAllComponents().filter((c) => c.type === "contextConfigs");
|
|
237358
237373
|
if (registeredContextConfigs.length > 0) {
|
|
237359
237374
|
for (const contextComp of registeredContextConfigs) {
|
|
237360
237375
|
const contextData = findContextConfigData(project, contextComp.id);
|
|
@@ -237531,7 +237546,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237531
237546
|
if (project.agents) {
|
|
237532
237547
|
Object.keys(project.agents).forEach((agentId) => {
|
|
237533
237548
|
changes.push({
|
|
237534
|
-
componentType: "
|
|
237549
|
+
componentType: "agents",
|
|
237535
237550
|
componentId: agentId,
|
|
237536
237551
|
changeType: "added"
|
|
237537
237552
|
});
|
|
@@ -237540,7 +237555,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237540
237555
|
if (project.tools) {
|
|
237541
237556
|
Object.keys(project.tools).forEach((toolId) => {
|
|
237542
237557
|
changes.push({
|
|
237543
|
-
componentType: "
|
|
237558
|
+
componentType: "tools",
|
|
237544
237559
|
componentId: toolId,
|
|
237545
237560
|
changeType: "added"
|
|
237546
237561
|
});
|
|
@@ -237549,7 +237564,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237549
237564
|
if (project.functionTools) {
|
|
237550
237565
|
Object.keys(project.functionTools).forEach((toolId) => {
|
|
237551
237566
|
changes.push({
|
|
237552
|
-
componentType: "
|
|
237567
|
+
componentType: "functionTools",
|
|
237553
237568
|
componentId: toolId,
|
|
237554
237569
|
changeType: "added"
|
|
237555
237570
|
});
|
|
@@ -237558,7 +237573,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237558
237573
|
if (project.functions) {
|
|
237559
237574
|
Object.keys(project.functions).forEach((funcId) => {
|
|
237560
237575
|
changes.push({
|
|
237561
|
-
componentType: "
|
|
237576
|
+
componentType: "functions",
|
|
237562
237577
|
componentId: funcId,
|
|
237563
237578
|
changeType: "added"
|
|
237564
237579
|
});
|
|
@@ -237567,7 +237582,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237567
237582
|
if (project.dataComponents) {
|
|
237568
237583
|
Object.keys(project.dataComponents).forEach((componentId) => {
|
|
237569
237584
|
changes.push({
|
|
237570
|
-
componentType: "
|
|
237585
|
+
componentType: "dataComponents",
|
|
237571
237586
|
componentId,
|
|
237572
237587
|
changeType: "added"
|
|
237573
237588
|
});
|
|
@@ -237576,7 +237591,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237576
237591
|
if (project.artifactComponents) {
|
|
237577
237592
|
Object.keys(project.artifactComponents).forEach((componentId) => {
|
|
237578
237593
|
changes.push({
|
|
237579
|
-
componentType: "
|
|
237594
|
+
componentType: "artifactComponents",
|
|
237580
237595
|
componentId,
|
|
237581
237596
|
changeType: "added"
|
|
237582
237597
|
});
|
|
@@ -237587,7 +237602,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237587
237602
|
if (agentData.subAgents) {
|
|
237588
237603
|
Object.keys(agentData.subAgents).forEach((subAgentId) => {
|
|
237589
237604
|
changes.push({
|
|
237590
|
-
componentType: "
|
|
237605
|
+
componentType: "subAgents",
|
|
237591
237606
|
componentId: subAgentId,
|
|
237592
237607
|
changeType: "added"
|
|
237593
237608
|
});
|
|
@@ -237598,7 +237613,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237598
237613
|
const statusComponents = extractStatusComponentIds(project);
|
|
237599
237614
|
statusComponents.forEach((componentId) => {
|
|
237600
237615
|
changes.push({
|
|
237601
|
-
componentType: "
|
|
237616
|
+
componentType: "statusComponents",
|
|
237602
237617
|
componentId,
|
|
237603
237618
|
changeType: "added"
|
|
237604
237619
|
});
|
|
@@ -237611,7 +237626,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237611
237626
|
return;
|
|
237612
237627
|
}
|
|
237613
237628
|
changes.push({
|
|
237614
|
-
componentType: "
|
|
237629
|
+
componentType: "contextConfigs",
|
|
237615
237630
|
componentId: contextConfigId,
|
|
237616
237631
|
changeType: "added"
|
|
237617
237632
|
});
|
|
@@ -237621,7 +237636,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237621
237636
|
if (project.externalAgents) {
|
|
237622
237637
|
Object.keys(project.externalAgents).forEach((extAgentId) => {
|
|
237623
237638
|
changes.push({
|
|
237624
|
-
componentType: "
|
|
237639
|
+
componentType: "externalAgents",
|
|
237625
237640
|
componentId: extAgentId,
|
|
237626
237641
|
changeType: "added"
|
|
237627
237642
|
});
|
|
@@ -237630,7 +237645,7 @@ function createNewProjectComparison(project, debug) {
|
|
|
237630
237645
|
if (project.credentialReferences) {
|
|
237631
237646
|
Object.keys(project.credentialReferences).forEach((credId) => {
|
|
237632
237647
|
changes.push({
|
|
237633
|
-
componentType: "
|
|
237648
|
+
componentType: "credentials",
|
|
237634
237649
|
componentId: credId,
|
|
237635
237650
|
changeType: "added"
|
|
237636
237651
|
});
|
|
@@ -237704,7 +237719,7 @@ function compareAgents(localAgents, remoteAgents, debug) {
|
|
|
237704
237719
|
remoteIds.filter((id) => !localIds.includes(id)).forEach((id) => {
|
|
237705
237720
|
const agent = remoteAgents[id];
|
|
237706
237721
|
changes.push({
|
|
237707
|
-
componentType: "
|
|
237722
|
+
componentType: "agents",
|
|
237708
237723
|
componentId: id,
|
|
237709
237724
|
changeType: "added",
|
|
237710
237725
|
summary: `New agent: ${agent.name || id}`
|
|
@@ -237713,7 +237728,7 @@ function compareAgents(localAgents, remoteAgents, debug) {
|
|
|
237713
237728
|
localIds.filter((id) => !remoteIds.includes(id)).forEach((id) => {
|
|
237714
237729
|
const agent = localAgents[id];
|
|
237715
237730
|
changes.push({
|
|
237716
|
-
componentType: "
|
|
237731
|
+
componentType: "agents",
|
|
237717
237732
|
componentId: id,
|
|
237718
237733
|
changeType: "deleted",
|
|
237719
237734
|
summary: `Removed agent: ${agent.name || id}`
|
|
@@ -237725,7 +237740,7 @@ function compareAgents(localAgents, remoteAgents, debug) {
|
|
|
237725
237740
|
if (fieldChanges.length > 0) {
|
|
237726
237741
|
const summary = generateAgentChangeSummary(fieldChanges);
|
|
237727
237742
|
changes.push({
|
|
237728
|
-
componentType: "
|
|
237743
|
+
componentType: "agents",
|
|
237729
237744
|
componentId: id,
|
|
237730
237745
|
changeType: "modified",
|
|
237731
237746
|
changedFields: fieldChanges,
|
|
@@ -237758,7 +237773,7 @@ function compareSubAgents(localAgents, remoteAgents, debug) {
|
|
|
237758
237773
|
remoteIds.filter((id) => !localIds.includes(id)).forEach((id) => {
|
|
237759
237774
|
const subAgent = remoteSubAgents[id];
|
|
237760
237775
|
changes.push({
|
|
237761
|
-
componentType: "
|
|
237776
|
+
componentType: "subAgents",
|
|
237762
237777
|
componentId: id,
|
|
237763
237778
|
changeType: "added",
|
|
237764
237779
|
summary: `New subAgent: ${subAgent.name || id}`
|
|
@@ -237767,7 +237782,7 @@ function compareSubAgents(localAgents, remoteAgents, debug) {
|
|
|
237767
237782
|
localIds.filter((id) => !remoteIds.includes(id)).forEach((id) => {
|
|
237768
237783
|
const subAgent = localSubAgents[id];
|
|
237769
237784
|
changes.push({
|
|
237770
|
-
componentType: "
|
|
237785
|
+
componentType: "subAgents",
|
|
237771
237786
|
componentId: id,
|
|
237772
237787
|
changeType: "deleted",
|
|
237773
237788
|
summary: `Removed subAgent: ${subAgent.name || id}`
|
|
@@ -237779,7 +237794,7 @@ function compareSubAgents(localAgents, remoteAgents, debug) {
|
|
|
237779
237794
|
if (fieldChanges.length > 0) {
|
|
237780
237795
|
const summary = generateSubAgentChangeSummary(fieldChanges);
|
|
237781
237796
|
changes.push({
|
|
237782
|
-
componentType: "
|
|
237797
|
+
componentType: "subAgents",
|
|
237783
237798
|
componentId: id,
|
|
237784
237799
|
changeType: "modified",
|
|
237785
237800
|
changedFields: fieldChanges,
|
|
@@ -237805,10 +237820,10 @@ function generateSubAgentChangeSummary(fieldChanges) {
|
|
|
237805
237820
|
}
|
|
237806
237821
|
}
|
|
237807
237822
|
function compareTools(localTools, remoteTools, debug) {
|
|
237808
|
-
return compareComponentMaps("
|
|
237823
|
+
return compareComponentMaps("tools", localTools, remoteTools, debug);
|
|
237809
237824
|
}
|
|
237810
237825
|
function compareFunctionTools(localFunctionTools, remoteFunctionTools, debug) {
|
|
237811
|
-
return compareComponentMaps("
|
|
237826
|
+
return compareComponentMaps("functionTools", localFunctionTools, remoteFunctionTools, debug);
|
|
237812
237827
|
}
|
|
237813
237828
|
function compareFunctions(localFunctions, remoteFunctions, debug) {
|
|
237814
237829
|
const cleanLocalFunctions = {};
|
|
@@ -237829,28 +237844,28 @@ function compareFunctions(localFunctions, remoteFunctions, debug) {
|
|
|
237829
237844
|
dependencies: func.dependencies
|
|
237830
237845
|
};
|
|
237831
237846
|
}
|
|
237832
|
-
return compareComponentMaps("
|
|
237847
|
+
return compareComponentMaps("functions", cleanLocalFunctions, cleanRemoteFunctions, debug);
|
|
237833
237848
|
}
|
|
237834
237849
|
function compareDataComponents(localDataComponents, remoteDataComponents, debug) {
|
|
237835
|
-
return compareComponentMaps("
|
|
237850
|
+
return compareComponentMaps("dataComponents", localDataComponents, remoteDataComponents, debug);
|
|
237836
237851
|
}
|
|
237837
237852
|
function compareArtifactComponents(localArtifactComponents, remoteArtifactComponents, debug) {
|
|
237838
237853
|
return compareComponentMaps(
|
|
237839
|
-
"
|
|
237854
|
+
"artifactComponents",
|
|
237840
237855
|
localArtifactComponents,
|
|
237841
237856
|
remoteArtifactComponents,
|
|
237842
237857
|
debug
|
|
237843
237858
|
);
|
|
237844
237859
|
}
|
|
237845
237860
|
function compareCredentials(localCredentials, remoteCredentials, debug) {
|
|
237846
|
-
return compareComponentMaps("
|
|
237861
|
+
return compareComponentMaps("credentials", localCredentials, remoteCredentials, debug);
|
|
237847
237862
|
}
|
|
237848
237863
|
function compareExternalAgents(localExternalAgents, remoteExternalAgents, debug) {
|
|
237849
|
-
return compareComponentMaps("
|
|
237864
|
+
return compareComponentMaps("externalAgents", localExternalAgents, remoteExternalAgents, debug);
|
|
237850
237865
|
}
|
|
237851
237866
|
function compareStatusComponents(localStatusComponents, remoteStatusComponents, debug) {
|
|
237852
237867
|
return compareComponentMaps(
|
|
237853
|
-
"
|
|
237868
|
+
"statusComponents",
|
|
237854
237869
|
localStatusComponents,
|
|
237855
237870
|
remoteStatusComponents,
|
|
237856
237871
|
debug
|
|
@@ -237896,7 +237911,7 @@ function compareProjectFields(localProject, remoteProject, debug) {
|
|
|
237896
237911
|
if (fieldChanges.length > 0) {
|
|
237897
237912
|
const summary = `Project ${field} updated`;
|
|
237898
237913
|
changes.push({
|
|
237899
|
-
componentType: "
|
|
237914
|
+
componentType: "contextConfigs",
|
|
237900
237915
|
// Use contextConfig as catch-all for project-level changes
|
|
237901
237916
|
componentId: `project-${field}`,
|
|
237902
237917
|
changeType: "modified",
|
|
@@ -238218,14 +238233,14 @@ function generateAgentChangeSummary(fieldChanges) {
|
|
|
238218
238233
|
function generateComponentSummary(componentType, changeType, component) {
|
|
238219
238234
|
const name = component?.name || component?.id || "unnamed";
|
|
238220
238235
|
const action = changeType === "added" ? "Added" : "Removed";
|
|
238221
|
-
if (componentType === "
|
|
238236
|
+
if (componentType === "tools") {
|
|
238222
238237
|
const toolType = component?.config?.type || "unknown type";
|
|
238223
238238
|
return `${action} ${toolType} tool: ${name}`;
|
|
238224
238239
|
}
|
|
238225
238240
|
return `${action} ${componentType}: ${name}`;
|
|
238226
238241
|
}
|
|
238227
238242
|
function generateComponentChangeSummary(componentType, fieldChanges) {
|
|
238228
|
-
if (componentType === "
|
|
238243
|
+
if (componentType === "tools") {
|
|
238229
238244
|
const configChanges = fieldChanges.filter((c) => c.field.startsWith("config"));
|
|
238230
238245
|
if (configChanges.length > 0) {
|
|
238231
238246
|
return `Configuration updated (${configChanges.length} changes)`;
|
|
@@ -238279,26 +238294,8 @@ function extractStatusComponentsFromProject(project) {
|
|
|
238279
238294
|
}
|
|
238280
238295
|
function groupChangesByType(changes) {
|
|
238281
238296
|
const result = createEmptyComponentChanges();
|
|
238282
|
-
const typeMapping = {
|
|
238283
|
-
agent: "agents",
|
|
238284
|
-
subAgent: "subAgents",
|
|
238285
|
-
tool: "tools",
|
|
238286
|
-
functionTool: "functionTools",
|
|
238287
|
-
function: "functions",
|
|
238288
|
-
dataComponent: "dataComponents",
|
|
238289
|
-
artifactComponent: "artifactComponents",
|
|
238290
|
-
statusComponent: "statusComponents",
|
|
238291
|
-
environment: "environments",
|
|
238292
|
-
contextConfig: "contextConfigs",
|
|
238293
|
-
fetchDefinition: "fetchDefinitions",
|
|
238294
|
-
header: "headers",
|
|
238295
|
-
credential: "credentials",
|
|
238296
|
-
externalAgent: "externalAgents",
|
|
238297
|
-
models: "models"
|
|
238298
|
-
};
|
|
238299
238297
|
changes.forEach((change) => {
|
|
238300
|
-
const
|
|
238301
|
-
const group = result[groupKey];
|
|
238298
|
+
const group = result[change.componentType];
|
|
238302
238299
|
if (group && !group[change.changeType].includes(change.componentId)) {
|
|
238303
238300
|
group[change.changeType].push(change.componentId);
|
|
238304
238301
|
}
|
|
@@ -238341,14 +238338,14 @@ function compareContextConfigs(localProject, remoteProject, localRegistry, debug
|
|
|
238341
238338
|
}
|
|
238342
238339
|
if (!localContextConfig && remoteContextConfig) {
|
|
238343
238340
|
changes.push({
|
|
238344
|
-
componentType: "
|
|
238341
|
+
componentType: "contextConfigs",
|
|
238345
238342
|
componentId: contextId,
|
|
238346
238343
|
changeType: "added",
|
|
238347
238344
|
summary: `Added contextConfig for agent: ${agentId}`
|
|
238348
238345
|
});
|
|
238349
238346
|
} else if (localContextConfig && !remoteContextConfig) {
|
|
238350
238347
|
changes.push({
|
|
238351
|
-
componentType: "
|
|
238348
|
+
componentType: "contextConfigs",
|
|
238352
238349
|
componentId: contextId,
|
|
238353
238350
|
changeType: "deleted",
|
|
238354
238351
|
summary: `Removed contextConfig for agent: ${agentId}`
|
|
@@ -238358,7 +238355,7 @@ function compareContextConfigs(localProject, remoteProject, localRegistry, debug
|
|
|
238358
238355
|
const filteredChanges = fieldChanges.filter((change) => change.field !== "id");
|
|
238359
238356
|
if (filteredChanges.length > 0) {
|
|
238360
238357
|
changes.push({
|
|
238361
|
-
componentType: "
|
|
238358
|
+
componentType: "contextConfigs",
|
|
238362
238359
|
componentId: contextId,
|
|
238363
238360
|
changeType: "modified",
|
|
238364
238361
|
changedFields: filteredChanges,
|
|
@@ -238409,14 +238406,14 @@ function compareFetchDefinitions(localProject, remoteProject, debug) {
|
|
|
238409
238406
|
const { local, remote } = configs;
|
|
238410
238407
|
if (!local && remote) {
|
|
238411
238408
|
changes.push({
|
|
238412
|
-
componentType: "
|
|
238409
|
+
componentType: "fetchDefinitions",
|
|
238413
238410
|
componentId: fetchId,
|
|
238414
238411
|
changeType: "added",
|
|
238415
238412
|
summary: `Added fetchDefinition: ${fetchId}`
|
|
238416
238413
|
});
|
|
238417
238414
|
} else if (local && !remote) {
|
|
238418
238415
|
changes.push({
|
|
238419
|
-
componentType: "
|
|
238416
|
+
componentType: "fetchDefinitions",
|
|
238420
238417
|
componentId: fetchId,
|
|
238421
238418
|
changeType: "deleted",
|
|
238422
238419
|
summary: `Removed fetchDefinition: ${fetchId}`
|
|
@@ -238426,7 +238423,7 @@ function compareFetchDefinitions(localProject, remoteProject, debug) {
|
|
|
238426
238423
|
const remoteStr = JSON.stringify(remote, null, 2);
|
|
238427
238424
|
if (localStr !== remoteStr) {
|
|
238428
238425
|
changes.push({
|
|
238429
|
-
componentType: "
|
|
238426
|
+
componentType: "fetchDefinitions",
|
|
238430
238427
|
componentId: fetchId,
|
|
238431
238428
|
changeType: "modified",
|
|
238432
238429
|
summary: `Modified fetchDefinition: ${fetchId}`
|
|
@@ -238523,8 +238520,8 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238523
238520
|
const variableName = match2[1];
|
|
238524
238521
|
const functionName = match2[2];
|
|
238525
238522
|
const componentId = match2[3];
|
|
238526
|
-
const componentType =
|
|
238527
|
-
if (componentType) {
|
|
238523
|
+
const componentType = FUNCTION_NAME_TO_TYPE[functionName];
|
|
238524
|
+
if (componentType && VALID_COMPONENT_TYPES.has(componentType)) {
|
|
238528
238525
|
const lineNumber = content.substring(0, match2.index).split("\n").length;
|
|
238529
238526
|
components.push({
|
|
238530
238527
|
id: componentId,
|
|
@@ -238540,8 +238537,8 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238540
238537
|
const variableName = match2[1];
|
|
238541
238538
|
const functionName = match2[2];
|
|
238542
238539
|
const componentId = match2[3];
|
|
238543
|
-
const componentType =
|
|
238544
|
-
if (componentType) {
|
|
238540
|
+
const componentType = FUNCTION_NAME_TO_TYPE[functionName];
|
|
238541
|
+
if (componentType && VALID_COMPONENT_TYPES.has(componentType) && componentType === "statusComponents") {
|
|
238545
238542
|
const lineNumber = content.substring(0, match2.index).split("\n").length;
|
|
238546
238543
|
components.push({
|
|
238547
238544
|
id: componentId,
|
|
@@ -238557,8 +238554,8 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238557
238554
|
const variableName = match2[1];
|
|
238558
238555
|
const functionName = match2[2];
|
|
238559
238556
|
const componentId = match2[3];
|
|
238560
|
-
const componentType =
|
|
238561
|
-
if (componentType && componentType === "
|
|
238557
|
+
const componentType = FUNCTION_NAME_TO_TYPE[functionName];
|
|
238558
|
+
if (VALID_COMPONENT_TYPES.has(componentType) && componentType === "functionTools") {
|
|
238562
238559
|
const lineNumber = content.substring(0, match2.index).split("\n").length;
|
|
238563
238560
|
components.push({
|
|
238564
238561
|
id: componentId,
|
|
@@ -238574,8 +238571,8 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238574
238571
|
const variableName = match2[1];
|
|
238575
238572
|
const functionName = match2[2];
|
|
238576
238573
|
const componentId = match2[3];
|
|
238577
|
-
const componentType =
|
|
238578
|
-
if (componentType && exportedVariables.has(variableName)) {
|
|
238574
|
+
const componentType = FUNCTION_NAME_TO_TYPE[functionName];
|
|
238575
|
+
if (VALID_COMPONENT_TYPES.has(componentType) && exportedVariables.has(variableName)) {
|
|
238579
238576
|
const lineNumber = content.substring(0, match2.index).split("\n").length;
|
|
238580
238577
|
components.push({
|
|
238581
238578
|
id: componentId,
|
|
@@ -238592,8 +238589,8 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238592
238589
|
const variableName = match2[1];
|
|
238593
238590
|
const functionName = match2[2];
|
|
238594
238591
|
const componentId = match2[3];
|
|
238595
|
-
const componentType =
|
|
238596
|
-
if (componentType && exportedVariables.has(variableName)) {
|
|
238592
|
+
const componentType = FUNCTION_NAME_TO_TYPE[functionName];
|
|
238593
|
+
if (componentType && VALID_COMPONENT_TYPES.has(componentType) && componentType === "statusComponents" && exportedVariables.has(variableName)) {
|
|
238597
238594
|
const lineNumber = content.substring(0, match2.index).split("\n").length;
|
|
238598
238595
|
components.push({
|
|
238599
238596
|
id: componentId,
|
|
@@ -238610,8 +238607,8 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238610
238607
|
const variableName = match2[1];
|
|
238611
238608
|
const functionName = match2[2];
|
|
238612
238609
|
const componentId = match2[3];
|
|
238613
|
-
const componentType =
|
|
238614
|
-
if (componentType && componentType === "
|
|
238610
|
+
const componentType = FUNCTION_NAME_TO_TYPE[functionName];
|
|
238611
|
+
if (VALID_COMPONENT_TYPES.has(componentType) && componentType === "functionTools" && exportedVariables.has(variableName)) {
|
|
238615
238612
|
const lineNumber = content.substring(0, match2.index).split("\n").length;
|
|
238616
238613
|
components.push({
|
|
238617
238614
|
id: componentId,
|
|
@@ -238628,8 +238625,8 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238628
238625
|
const variableName = match2[1];
|
|
238629
238626
|
const functionName = match2[2];
|
|
238630
238627
|
const componentId = match2[3];
|
|
238631
|
-
const componentType =
|
|
238632
|
-
if (componentType && !exportedVariables.has(variableName)) {
|
|
238628
|
+
const componentType = FUNCTION_NAME_TO_TYPE[functionName];
|
|
238629
|
+
if (VALID_COMPONENT_TYPES.has(componentType) && !exportedVariables.has(variableName)) {
|
|
238633
238630
|
const lineNumber = content.substring(0, match2.index).split("\n").length;
|
|
238634
238631
|
components.push({
|
|
238635
238632
|
id: componentId,
|
|
@@ -238646,8 +238643,8 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238646
238643
|
const variableName = match2[1];
|
|
238647
238644
|
const functionName = match2[2];
|
|
238648
238645
|
const componentId = match2[3];
|
|
238649
|
-
const componentType =
|
|
238650
|
-
if (componentType && !exportedVariables.has(variableName)) {
|
|
238646
|
+
const componentType = FUNCTION_NAME_TO_TYPE[functionName];
|
|
238647
|
+
if (componentType && VALID_COMPONENT_TYPES.has(componentType) && componentType === "statusComponents" && !exportedVariables.has(variableName)) {
|
|
238651
238648
|
const lineNumber = content.substring(0, match2.index).split("\n").length;
|
|
238652
238649
|
components.push({
|
|
238653
238650
|
id: componentId,
|
|
@@ -238664,8 +238661,8 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238664
238661
|
const variableName = match2[1];
|
|
238665
238662
|
const functionName = match2[2];
|
|
238666
238663
|
const componentId = match2[3];
|
|
238667
|
-
const componentType =
|
|
238668
|
-
if (componentType && componentType === "
|
|
238664
|
+
const componentType = FUNCTION_NAME_TO_TYPE[functionName];
|
|
238665
|
+
if (componentType && VALID_COMPONENT_TYPES.has(componentType) && componentType === "functionTools" && !exportedVariables.has(variableName)) {
|
|
238669
238666
|
const lineNumber = content.substring(0, match2.index).split("\n").length;
|
|
238670
238667
|
components.push({
|
|
238671
238668
|
id: componentId,
|
|
@@ -238678,8 +238675,8 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238678
238675
|
});
|
|
238679
238676
|
}
|
|
238680
238677
|
}
|
|
238681
|
-
const
|
|
238682
|
-
for (const funcName of
|
|
238678
|
+
const functionNames = Object.keys(FUNCTION_NAME_TO_TYPE);
|
|
238679
|
+
for (const funcName of functionNames) {
|
|
238683
238680
|
const inlineIdPattern = new RegExp(
|
|
238684
238681
|
`(?<!(?:export\\s+)?const\\s+\\w+\\s*=\\s*)\\b${funcName}\\s*\\(\\s*\\{[^}]*?id:\\s*['"\`]([^'"\`]+)['"\`]`,
|
|
238685
238682
|
"gs"
|
|
@@ -238687,7 +238684,7 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238687
238684
|
let inlineMatch;
|
|
238688
238685
|
while ((inlineMatch = inlineIdPattern.exec(content)) !== null) {
|
|
238689
238686
|
const componentId = inlineMatch[1];
|
|
238690
|
-
const componentType =
|
|
238687
|
+
const componentType = FUNCTION_NAME_TO_TYPE[funcName];
|
|
238691
238688
|
const lineNumber = content.substring(0, inlineMatch.index).split("\n").length;
|
|
238692
238689
|
components.push({
|
|
238693
238690
|
id: componentId,
|
|
@@ -238706,7 +238703,7 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238706
238703
|
);
|
|
238707
238704
|
while ((inlineMatch = inlineNamePattern.exec(content)) !== null) {
|
|
238708
238705
|
const componentId = inlineMatch[1];
|
|
238709
|
-
const componentType =
|
|
238706
|
+
const componentType = FUNCTION_NAME_TO_TYPE[funcName];
|
|
238710
238707
|
const lineNumber = content.substring(0, inlineMatch.index).split("\n").length;
|
|
238711
238708
|
components.push({
|
|
238712
238709
|
id: componentId,
|
|
@@ -238732,7 +238729,7 @@ function parseFileForComponents(filePath, projectRoot, debug = false) {
|
|
|
238732
238729
|
const lineNumber = content.substring(0, envMatch.index).split("\n").length;
|
|
238733
238730
|
components.push({
|
|
238734
238731
|
id: credentialId,
|
|
238735
|
-
type: "
|
|
238732
|
+
type: "credentials",
|
|
238736
238733
|
filePath: relativePath,
|
|
238737
238734
|
variableName: credentialKey,
|
|
238738
238735
|
// Use the key name as variable name
|
|
@@ -238770,10 +238767,6 @@ function scanProjectForComponents(projectRoot, debug = false) {
|
|
|
238770
238767
|
scanDirectory(projectRoot);
|
|
238771
238768
|
return allComponents;
|
|
238772
238769
|
}
|
|
238773
|
-
function generateVariableName(componentId, componentType) {
|
|
238774
|
-
const camelCase = componentId.toLowerCase().replace(/[-_](.)/g, (_, char) => char.toUpperCase()).replace(/[^a-zA-Z0-9]/g, "").replace(/^[0-9]/, "_$&");
|
|
238775
|
-
return camelCase || `${componentType}Component`;
|
|
238776
|
-
}
|
|
238777
238770
|
function buildComponentRegistryFromParsing(projectRoot, debug = false) {
|
|
238778
238771
|
const registry2 = new ComponentRegistry();
|
|
238779
238772
|
const allComponents = scanProjectForComponents(projectRoot, debug);
|
|
@@ -238804,12 +238797,12 @@ function buildComponentRegistryFromParsing(projectRoot, debug = false) {
|
|
|
238804
238797
|
component.isInline
|
|
238805
238798
|
);
|
|
238806
238799
|
} else {
|
|
238807
|
-
const generatedName = generateVariableName(component.id, component.type);
|
|
238808
238800
|
registry2.register(
|
|
238809
238801
|
component.id,
|
|
238810
238802
|
component.type,
|
|
238811
238803
|
component.filePath,
|
|
238812
|
-
|
|
238804
|
+
void 0,
|
|
238805
|
+
// Let registry handle naming with conflict resolution
|
|
238813
238806
|
true
|
|
238814
238807
|
// isInline = true
|
|
238815
238808
|
);
|
|
@@ -238832,28 +238825,42 @@ function getAllLocalComponentIds(projectRoot) {
|
|
|
238832
238825
|
const allComponents = scanProjectForComponents(projectRoot, false);
|
|
238833
238826
|
return new Set(allComponents.map((comp) => comp.id));
|
|
238834
238827
|
}
|
|
238835
|
-
var
|
|
238828
|
+
var VALID_COMPONENT_TYPES, FUNCTION_NAME_TO_TYPE;
|
|
238836
238829
|
var init_component_parser = __esm({
|
|
238837
238830
|
"src/commands/pull-v3/component-parser.ts"() {
|
|
238838
238831
|
"use strict";
|
|
238839
238832
|
init_esm_shims();
|
|
238840
238833
|
init_component_registry();
|
|
238841
|
-
|
|
238834
|
+
VALID_COMPONENT_TYPES = /* @__PURE__ */ new Set([
|
|
238835
|
+
"project",
|
|
238836
|
+
"agents",
|
|
238837
|
+
"subAgents",
|
|
238838
|
+
"tools",
|
|
238839
|
+
"functionTools",
|
|
238840
|
+
"dataComponents",
|
|
238841
|
+
"artifactComponents",
|
|
238842
|
+
"statusComponents",
|
|
238843
|
+
"externalAgents",
|
|
238844
|
+
"credentials",
|
|
238845
|
+
"contextConfigs",
|
|
238846
|
+
"fetchDefinitions",
|
|
238847
|
+
"headers"
|
|
238848
|
+
]);
|
|
238849
|
+
FUNCTION_NAME_TO_TYPE = {
|
|
238842
238850
|
project: "project",
|
|
238843
|
-
agent: "
|
|
238844
|
-
subAgent: "
|
|
238845
|
-
tool: "
|
|
238846
|
-
|
|
238847
|
-
|
|
238848
|
-
|
|
238849
|
-
|
|
238850
|
-
|
|
238851
|
-
|
|
238852
|
-
|
|
238853
|
-
|
|
238854
|
-
|
|
238855
|
-
|
|
238856
|
-
headers: "headers"
|
|
238851
|
+
agent: "agents",
|
|
238852
|
+
subAgent: "subAgents",
|
|
238853
|
+
tool: "tools",
|
|
238854
|
+
functionTool: "functionTools",
|
|
238855
|
+
dataComponent: "dataComponents",
|
|
238856
|
+
artifactComponent: "artifactComponents",
|
|
238857
|
+
statusComponent: "statusComponents",
|
|
238858
|
+
externalAgent: "externalAgents",
|
|
238859
|
+
credential: "credentials",
|
|
238860
|
+
contextConfig: "contextConfigs",
|
|
238861
|
+
fetchDefinition: "fetchDefinitions",
|
|
238862
|
+
header: "headers",
|
|
238863
|
+
mcpTool: "tools"
|
|
238857
238864
|
};
|
|
238858
238865
|
}
|
|
238859
238866
|
});
|
|
@@ -239851,9 +239858,6 @@ import chalk13 from "chalk";
|
|
|
239851
239858
|
function toKebabCase(id) {
|
|
239852
239859
|
return id.replace(/([a-z])([A-Z])/g, "$1-$2").toLowerCase().replace(/[_]/g, "-");
|
|
239853
239860
|
}
|
|
239854
|
-
function generateVariableName2(componentId) {
|
|
239855
|
-
return componentId.toLowerCase().replace(/[-_](.)/g, (_, char) => char.toUpperCase()).replace(/[^a-zA-Z0-9]/g, "").replace(/^[0-9]/, "_$&");
|
|
239856
|
-
}
|
|
239857
239861
|
function determineNewFilePath(componentType, componentId, paths) {
|
|
239858
239862
|
const fileName = `${toKebabCase(componentId)}.ts`;
|
|
239859
239863
|
switch (componentType) {
|
|
@@ -240000,23 +240004,20 @@ async function createNewComponents(comparison, remoteProject, localRegistry, pat
|
|
|
240000
240004
|
(tempDirName ? targetPaths.projectRoot : paths.projectRoot) + "/",
|
|
240001
240005
|
""
|
|
240002
240006
|
);
|
|
240003
|
-
let
|
|
240007
|
+
let explicitVariableName;
|
|
240004
240008
|
if (componentType === "contextConfigs") {
|
|
240005
240009
|
const contextResult = findContextConfigData2(remoteProject, componentId);
|
|
240006
240010
|
if (contextResult) {
|
|
240007
|
-
|
|
240008
|
-
} else {
|
|
240009
|
-
variableName = generateVariableName2(componentId);
|
|
240011
|
+
explicitVariableName = `${toCamelCase(contextResult.agentId)}Context`;
|
|
240010
240012
|
}
|
|
240011
|
-
} else {
|
|
240012
|
-
variableName = generateVariableName2(componentId);
|
|
240013
240013
|
}
|
|
240014
240014
|
localRegistry.register(
|
|
240015
240015
|
componentId,
|
|
240016
|
-
componentType
|
|
240017
|
-
//
|
|
240016
|
+
componentType,
|
|
240017
|
+
// componentType now matches ComponentType directly
|
|
240018
240018
|
relativePath,
|
|
240019
|
-
|
|
240019
|
+
explicitVariableName,
|
|
240020
|
+
// Only provide explicit name for contextConfigs, undefined for others
|
|
240020
240021
|
false
|
|
240021
240022
|
// isInline = false (new exported component)
|
|
240022
240023
|
);
|
|
@@ -240103,7 +240104,12 @@ async function createNewComponents(comparison, remoteProject, localRegistry, pat
|
|
|
240103
240104
|
}
|
|
240104
240105
|
writeFileSync6(filePath, content, "utf8");
|
|
240105
240106
|
const registryEntry = localRegistry.get(componentId, componentType);
|
|
240106
|
-
|
|
240107
|
+
if (!registryEntry) {
|
|
240108
|
+
throw new Error(
|
|
240109
|
+
`Component ${componentId} (${componentType}) was not registered in the registry`
|
|
240110
|
+
);
|
|
240111
|
+
}
|
|
240112
|
+
const variableName = registryEntry.name;
|
|
240107
240113
|
results.push({
|
|
240108
240114
|
componentId,
|
|
240109
240115
|
componentType,
|
|
@@ -240231,12 +240237,12 @@ async function generateProjectIndex(projectRoot, remoteProject, localRegistry, p
|
|
|
240231
240237
|
const registryComponents = localRegistry.getAllComponents();
|
|
240232
240238
|
const projectDataWithRegistry = {
|
|
240233
240239
|
...remoteProject,
|
|
240234
|
-
agents: registryComponents.filter((c) => c.type === "
|
|
240235
|
-
tools: registryComponents.filter((c) => c.type === "
|
|
240236
|
-
externalAgents: registryComponents.filter((c) => c.type === "
|
|
240237
|
-
dataComponents: registryComponents.filter((c) => c.type === "
|
|
240238
|
-
artifactComponents: registryComponents.filter((c) => c.type === "
|
|
240239
|
-
credentialReferences: registryComponents.filter((c) => c.type === "
|
|
240240
|
+
agents: registryComponents.filter((c) => c.type === "agents").map((c) => c.id),
|
|
240241
|
+
tools: registryComponents.filter((c) => c.type === "tools").map((c) => c.id),
|
|
240242
|
+
externalAgents: registryComponents.filter((c) => c.type === "externalAgents").map((c) => c.id),
|
|
240243
|
+
dataComponents: registryComponents.filter((c) => c.type === "dataComponents").map((c) => c.id),
|
|
240244
|
+
artifactComponents: registryComponents.filter((c) => c.type === "artifactComponents").map((c) => c.id),
|
|
240245
|
+
credentialReferences: registryComponents.filter((c) => c.type === "credentials").map((c) => c.id)
|
|
240240
240246
|
};
|
|
240241
240247
|
const content = generateProjectFile(
|
|
240242
240248
|
projectId,
|
|
@@ -240571,6 +240577,28 @@ async function pullV3Command(options) {
|
|
|
240571
240577
|
const { buildComponentRegistryFromParsing: buildComponentRegistryFromParsing2 } = await Promise.resolve().then(() => (init_component_parser(), component_parser_exports));
|
|
240572
240578
|
const localRegistry = buildComponentRegistryFromParsing2(paths.projectRoot, options.debug);
|
|
240573
240579
|
s.message("Component registry built");
|
|
240580
|
+
if (options.debug) {
|
|
240581
|
+
console.log(chalk14.cyan("\n\u{1F50D} Component Registry Debug:"));
|
|
240582
|
+
const allComponents = localRegistry.getAllComponents();
|
|
240583
|
+
console.log(chalk14.gray(" Total components registered:"), allComponents.length);
|
|
240584
|
+
const nameGroups = /* @__PURE__ */ new Map();
|
|
240585
|
+
for (const comp of allComponents) {
|
|
240586
|
+
if (!nameGroups.has(comp.name)) {
|
|
240587
|
+
nameGroups.set(comp.name, []);
|
|
240588
|
+
}
|
|
240589
|
+
nameGroups.get(comp.name).push(comp);
|
|
240590
|
+
}
|
|
240591
|
+
for (const [varName, components] of nameGroups.entries()) {
|
|
240592
|
+
if (components.length > 1) {
|
|
240593
|
+
console.log(chalk14.red(` \u274C Variable name conflict: "${varName}"`));
|
|
240594
|
+
for (const comp of components) {
|
|
240595
|
+
console.log(chalk14.gray(` - ${comp.type}:${comp.id} -> ${comp.filePath}`));
|
|
240596
|
+
}
|
|
240597
|
+
} else {
|
|
240598
|
+
console.log(chalk14.gray(` \u2705 ${varName} (${components[0].type}:${components[0].id})`));
|
|
240599
|
+
}
|
|
240600
|
+
}
|
|
240601
|
+
}
|
|
240574
240602
|
s.start("Comparing projects for changes...");
|
|
240575
240603
|
const comparison = await compareProjects(
|
|
240576
240604
|
localProject,
|
|
@@ -240613,6 +240641,28 @@ async function pullV3Command(options) {
|
|
|
240613
240641
|
options.env || "development",
|
|
240614
240642
|
tempDirName
|
|
240615
240643
|
);
|
|
240644
|
+
if (options.debug) {
|
|
240645
|
+
console.log(chalk14.cyan("\n\u{1F50D} Component Registry After Generation:"));
|
|
240646
|
+
const allComponents = localRegistry.getAllComponents();
|
|
240647
|
+
console.log(chalk14.gray(" Total components registered:"), allComponents.length);
|
|
240648
|
+
const nameGroups = /* @__PURE__ */ new Map();
|
|
240649
|
+
for (const comp of allComponents) {
|
|
240650
|
+
if (!nameGroups.has(comp.name)) {
|
|
240651
|
+
nameGroups.set(comp.name, []);
|
|
240652
|
+
}
|
|
240653
|
+
nameGroups.get(comp.name).push(comp);
|
|
240654
|
+
}
|
|
240655
|
+
for (const [varName, components] of nameGroups.entries()) {
|
|
240656
|
+
if (components.length > 1) {
|
|
240657
|
+
console.log(chalk14.red(` \u274C Variable name conflict: "${varName}"`));
|
|
240658
|
+
for (const comp of components) {
|
|
240659
|
+
console.log(chalk14.gray(` - ${comp.type}:${comp.id} -> ${comp.filePath}`));
|
|
240660
|
+
}
|
|
240661
|
+
} else {
|
|
240662
|
+
console.log(chalk14.gray(` \u2705 ${varName} (${components[0].type}:${components[0].id})`));
|
|
240663
|
+
}
|
|
240664
|
+
}
|
|
240665
|
+
}
|
|
240616
240666
|
const successful = newComponentResults.filter((r) => r.success);
|
|
240617
240667
|
console.log(chalk14.green(`\u2705 Added ${successful.length} new components to temp directory`));
|
|
240618
240668
|
s.message("New component files created");
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-cli",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20251105201335",
|
|
4
4
|
"description": "Inkeep CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"ts-morph": "^26.0.0",
|
|
50
50
|
"tsx": "^4.20.5",
|
|
51
51
|
"open": "^10.2.0",
|
|
52
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
53
|
-
"@inkeep/agents-sdk": "^0.0.0-dev-
|
|
52
|
+
"@inkeep/agents-core": "^0.0.0-dev-20251105201335",
|
|
53
|
+
"@inkeep/agents-sdk": "^0.0.0-dev-20251105201335"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@types/degit": "^2.8.6",
|
|
@@ -63,7 +63,7 @@
|
|
|
63
63
|
"vitest": "^3.2.4"
|
|
64
64
|
},
|
|
65
65
|
"peerDependencies": {
|
|
66
|
-
"@inkeep/agents-manage-ui": "0.0.0-dev-
|
|
66
|
+
"@inkeep/agents-manage-ui": "0.0.0-dev-20251105201335",
|
|
67
67
|
"zod": "^4.1.11"
|
|
68
68
|
},
|
|
69
69
|
"engines": {
|