@inkeep/agents-cli 0.0.0-dev-20251219064936 → 0.0.0-dev-20251219083419

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.
Files changed (2) hide show
  1. package/dist/index.js +101 -13
  2. package/package.json +4 -4
package/dist/index.js CHANGED
@@ -193560,13 +193560,19 @@ function registerAllComponents(project, registry$1) {
193560
193560
  registry$1.register(project.id, "project", "index.ts");
193561
193561
  if (project.credentialReferences) for (const credId of Object.keys(project.credentialReferences)) registry$1.register(credId, "credentials", `credentials/${credId}.ts`);
193562
193562
  if (project.tools) for (const toolId of Object.keys(project.tools)) registry$1.register(toolId, "tools", `tools/${toolId}.ts`);
193563
- const processedFunctionIds = /* @__PURE__ */ new Set();
193564
- if (project.functions) for (const funcId of Object.keys(project.functions)) {
193565
- registry$1.register(funcId, "functionTools", `tools/functions/${funcId}.ts`);
193566
- processedFunctionIds.add(funcId);
193563
+ const registeredFunctionToolIds = /* @__PURE__ */ new Set();
193564
+ if (project.functionTools) for (const funcToolId of Object.keys(project.functionTools)) {
193565
+ registry$1.register(funcToolId, "functionTools", `tools/functions/${funcToolId}.ts`);
193566
+ registeredFunctionToolIds.add(funcToolId);
193567
193567
  }
193568
- if (project.functionTools) {
193569
- for (const funcToolId of Object.keys(project.functionTools)) if (!processedFunctionIds.has(funcToolId)) registry$1.register(funcToolId, "functionTools", `tools/functions/${funcToolId}.ts`);
193568
+ if (project.agents) for (const agentData of Object.values(project.agents)) {
193569
+ const agentFunctionTools = agentData.functionTools;
193570
+ if (agentFunctionTools) {
193571
+ for (const funcToolId of Object.keys(agentFunctionTools)) if (!registeredFunctionToolIds.has(funcToolId)) {
193572
+ registry$1.register(funcToolId, "functionTools", `tools/functions/${funcToolId}.ts`);
193573
+ registeredFunctionToolIds.add(funcToolId);
193574
+ }
193575
+ }
193570
193576
  }
193571
193577
  if (project.dataComponents) for (const componentId of Object.keys(project.dataComponents)) registry$1.register(componentId, "dataComponents", `data-components/${componentId}.ts`);
193572
193578
  if (project.artifactComponents) for (const componentId of Object.keys(project.artifactComponents)) registry$1.register(componentId, "artifactComponents", `artifact-components/${componentId}.ts`);
@@ -194343,6 +194349,25 @@ function ensureDir(filePath) {
194343
194349
  mkdirSync(dirname(filePath), { recursive: true });
194344
194350
  }
194345
194351
  /**
194352
+ * Check if an agent is complete enough for code generation
194353
+ * An agent needs a name, defaultSubAgentId, and at least one sub-agent
194354
+ */
194355
+ function isAgentComplete(agentId, agentData) {
194356
+ if (!agentData.name) return {
194357
+ complete: false,
194358
+ reason: "missing name"
194359
+ };
194360
+ if (!agentData.defaultSubAgentId) return {
194361
+ complete: false,
194362
+ reason: "missing defaultSubAgentId (no sub-agents configured)"
194363
+ };
194364
+ if (!agentData.subAgents || Object.keys(agentData.subAgents).length === 0) return {
194365
+ complete: false,
194366
+ reason: "no sub-agents defined"
194367
+ };
194368
+ return { complete: true };
194369
+ }
194370
+ /**
194346
194371
  * Generate all files from scratch using deterministic generation
194347
194372
  */
194348
194373
  async function introspectGenerate(project, paths, environment$1, debug$5, options = {}) {
@@ -194352,6 +194377,7 @@ async function introspectGenerate(project, paths, environment$1, debug$5, option
194352
194377
  ...DEFAULT_STYLE,
194353
194378
  ...options.codeStyle
194354
194379
  };
194380
+ const skippedAgents = [];
194355
194381
  const registry$1 = new ComponentRegistry();
194356
194382
  try {
194357
194383
  registerAllComponents(project, registry$1);
@@ -194376,12 +194402,52 @@ async function introspectGenerate(project, paths, environment$1, debug$5, option
194376
194402
  ensureDir(envIndexFile);
194377
194403
  writeFileSync(envIndexFile, envIndexContent, "utf-8");
194378
194404
  generatedFiles.push(envIndexFile);
194379
- if (project.functions) for (const [funcId, funcData] of Object.entries(project.functions)) {
194380
- const functionFile = join(paths.toolsDir, "functions", `${funcId}.ts`);
194381
- const functionContent = generateFunctionToolFile(funcId, funcData, style);
194405
+ const functionToolsGenerated = /* @__PURE__ */ new Set();
194406
+ if (project.functionTools) for (const [toolId, toolData] of Object.entries(project.functionTools)) {
194407
+ const functionId = toolData.functionId;
194408
+ const funcData = functionId ? project.functions?.[functionId] : void 0;
194409
+ const mergedData = {
194410
+ name: toolData.name,
194411
+ description: toolData.description,
194412
+ inputSchema: funcData?.inputSchema,
194413
+ executeCode: funcData?.executeCode,
194414
+ execute: funcData?.executeCode,
194415
+ dependencies: funcData?.dependencies
194416
+ };
194417
+ const functionFile = join(paths.toolsDir, "functions", `${toolId}.ts`);
194418
+ const functionContent = generateFunctionToolFile(toolId, mergedData, style);
194382
194419
  ensureDir(functionFile);
194383
194420
  writeFileSync(functionFile, functionContent, "utf-8");
194384
194421
  generatedFiles.push(functionFile);
194422
+ functionToolsGenerated.add(toolId);
194423
+ }
194424
+ if (project.agents) for (const [agentId, agentData] of Object.entries(project.agents)) {
194425
+ const agentFunctionTools = agentData.functionTools;
194426
+ const agentFunctions = agentData.functions;
194427
+ if (agentFunctionTools) for (const [toolId, toolData] of Object.entries(agentFunctionTools)) {
194428
+ if (functionToolsGenerated.has(toolId)) continue;
194429
+ const functionId = toolData.functionId;
194430
+ const funcData = functionId ? agentFunctions?.[functionId] || project.functions?.[functionId] : void 0;
194431
+ const mergedData = {
194432
+ name: toolData.name,
194433
+ description: toolData.description,
194434
+ inputSchema: funcData?.inputSchema,
194435
+ executeCode: funcData?.executeCode,
194436
+ execute: funcData?.executeCode,
194437
+ dependencies: funcData?.dependencies
194438
+ };
194439
+ const functionFile = join(paths.toolsDir, "functions", `${toolId}.ts`);
194440
+ const functionContent = generateFunctionToolFile(toolId, mergedData, style);
194441
+ ensureDir(functionFile);
194442
+ writeFileSync(functionFile, functionContent, "utf-8");
194443
+ generatedFiles.push(functionFile);
194444
+ functionToolsGenerated.add(toolId);
194445
+ }
194446
+ }
194447
+ if (project.functions) {
194448
+ for (const [funcId, funcData] of Object.entries(project.functions)) if (!functionToolsGenerated.has(funcId)) {
194449
+ if (!(Object.values(project.functionTools || {}).some((ft$1) => ft$1.functionId === funcId) || Object.values(project.agents || {}).some((agent) => Object.values(agent.functionTools || {}).some((ft$1) => ft$1.functionId === funcId))) && debug$5) console.log(chalk.yellow(`⚠️ Skipping orphaned function '${funcId}' - no functionTool references it`));
194450
+ }
194385
194451
  }
194386
194452
  if (project.tools) for (const [toolId, toolData] of Object.entries(project.tools)) {
194387
194453
  const toolFile = join(paths.toolsDir, `${toolId}.ts`);
@@ -194433,11 +194499,27 @@ async function introspectGenerate(project, paths, environment$1, debug$5, option
194433
194499
  generatedFiles.push(contextFile);
194434
194500
  }
194435
194501
  }
194502
+ const completeAgentIds = /* @__PURE__ */ new Set();
194503
+ if (project.agents) for (const [agentId, agentData] of Object.entries(project.agents)) {
194504
+ const completeness = isAgentComplete(agentId, agentData);
194505
+ if (completeness.complete) completeAgentIds.add(agentId);
194506
+ else {
194507
+ skippedAgents.push({
194508
+ id: agentId,
194509
+ reason: completeness.reason || "incomplete"
194510
+ });
194511
+ if (debug$5) console.log(chalk.yellow(`⚠️ Skipping incomplete agent '${agentId}': ${completeness.reason}`));
194512
+ }
194513
+ }
194436
194514
  if (project.agents && Object.keys(project.agents).length > 0) {
194437
194515
  let totalSubAgents = 0;
194438
- for (const [agentId, agentData] of Object.entries(project.agents)) if (agentData.subAgents) for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) totalSubAgents++;
194439
- if (totalSubAgents > 0) {
194440
- for (const [agentId, agentData] of Object.entries(project.agents)) if (agentData.subAgents) {
194516
+ for (const [agentId, agentData] of Object.entries(project.agents)) {
194517
+ if (!completeAgentIds.has(agentId)) continue;
194518
+ if (agentData.subAgents) for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) totalSubAgents++;
194519
+ }
194520
+ if (totalSubAgents > 0) for (const [agentId, agentData] of Object.entries(project.agents)) {
194521
+ if (!completeAgentIds.has(agentId)) continue;
194522
+ if (agentData.subAgents) {
194441
194523
  const contextConfigData = agentData.contextConfig?.id ? findContextConfigData(project, agentData.contextConfig.id) : void 0;
194442
194524
  for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) {
194443
194525
  const subAgentFile = join(paths.agentsDir, "sub-agents", `${subAgentId}.ts`);
@@ -194450,6 +194532,7 @@ async function introspectGenerate(project, paths, environment$1, debug$5, option
194450
194532
  }
194451
194533
  }
194452
194534
  if (project.agents) for (const [agentId, agentData] of Object.entries(project.agents)) {
194535
+ if (!completeAgentIds.has(agentId)) continue;
194453
194536
  const agentFile = join(paths.agentsDir, `${agentId}.ts`);
194454
194537
  const agentContent = generateAgentFile(agentId, agentData, style, registry$1, agentData.contextConfig?.id ? findContextConfigData(project, agentData.contextConfig.id) : void 0, project.models);
194455
194538
  ensureDir(agentFile);
@@ -194458,7 +194541,7 @@ async function introspectGenerate(project, paths, environment$1, debug$5, option
194458
194541
  }
194459
194542
  const projectDataForGenerator = {
194460
194543
  ...project,
194461
- agents: project.agents ? Object.keys(project.agents) : [],
194544
+ agents: project.agents ? Object.keys(project.agents).filter((id) => completeAgentIds.has(id)) : [],
194462
194545
  tools: project.tools ? Object.keys(project.tools) : [],
194463
194546
  externalAgents: project.externalAgents ? Object.keys(project.externalAgents) : [],
194464
194547
  dataComponents: project.dataComponents ? Object.keys(project.dataComponents) : [],
@@ -194471,6 +194554,11 @@ async function introspectGenerate(project, paths, environment$1, debug$5, option
194471
194554
  writeFileSync(projectFile, projectContent, "utf-8");
194472
194555
  generatedFiles.push(projectFile);
194473
194556
  if (debug$5) console.log(chalk.green(`✅ Generated ${generatedFiles.length} files`));
194557
+ if (skippedAgents.length > 0) {
194558
+ console.log(chalk.yellow(`\n⚠️ Skipped ${skippedAgents.length} incomplete agent(s):`));
194559
+ for (const { id, reason } of skippedAgents) console.log(chalk.yellow(` • ${id}: ${reason}`));
194560
+ console.log(chalk.gray(" To fix: Add at least one sub-agent to each agent in the UI and set it as default."));
194561
+ }
194474
194562
  } catch (error$1) {
194475
194563
  console.error(chalk.red("\n❌ Introspect regeneration failed:"));
194476
194564
  console.error(chalk.red(` Error: ${error$1 instanceof Error ? error$1.message : "Unknown error"}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@inkeep/agents-cli",
3
- "version": "0.0.0-dev-20251219064936",
3
+ "version": "0.0.0-dev-20251219083419",
4
4
  "description": "Inkeep CLI tool",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -55,8 +55,8 @@
55
55
  "tsx": "^4.20.5",
56
56
  "open": "^10.2.0",
57
57
  "yaml": "^2.7.0",
58
- "@inkeep/agents-sdk": "^0.0.0-dev-20251219064936",
59
- "@inkeep/agents-core": "^0.0.0-dev-20251219064936"
58
+ "@inkeep/agents-core": "^0.0.0-dev-20251219083419",
59
+ "@inkeep/agents-sdk": "^0.0.0-dev-20251219083419"
60
60
  },
61
61
  "devDependencies": {
62
62
  "@types/degit": "^2.8.6",
@@ -69,7 +69,7 @@
69
69
  "vitest": "^3.2.4"
70
70
  },
71
71
  "peerDependencies": {
72
- "@inkeep/agents-manage-ui": "0.0.0-dev-20251219064936",
72
+ "@inkeep/agents-manage-ui": "0.0.0-dev-20251219083419",
73
73
  "zod": "^4.1.11"
74
74
  },
75
75
  "publishConfig": {