@inkeep/agents-cli 0.41.1 → 0.42.0

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 (42) hide show
  1. package/README.md +13 -20
  2. package/dist/api.js +8 -8
  3. package/dist/commands/init.js +79 -53
  4. package/dist/commands/list-agents.js +1 -1
  5. package/dist/commands/login.js +3 -3
  6. package/dist/commands/profile.js +7 -26
  7. package/dist/commands/pull-v3/component-parser.js +0 -2
  8. package/dist/commands/pull-v3/component-updater.js +122 -64
  9. package/dist/commands/pull-v3/components/agent-generator.js +17 -3
  10. package/dist/commands/pull-v3/components/artifact-component-generator.js +7 -7
  11. package/dist/commands/pull-v3/components/context-config-generator.js +6 -6
  12. package/dist/commands/pull-v3/components/credential-generator.js +4 -4
  13. package/dist/commands/pull-v3/components/data-component-generator.js +4 -4
  14. package/dist/commands/pull-v3/components/environment-generator.js +10 -7
  15. package/dist/commands/pull-v3/components/function-tool-generator.js +5 -7
  16. package/dist/commands/pull-v3/components/mcp-tool-generator.js +5 -5
  17. package/dist/commands/pull-v3/components/project-generator.js +4 -4
  18. package/dist/commands/pull-v3/components/status-component-generator.js +6 -6
  19. package/dist/commands/pull-v3/components/trigger-generator.js +114 -0
  20. package/dist/commands/pull-v3/index.js +25 -30
  21. package/dist/commands/pull-v3/introspect-generator.js +15 -7
  22. package/dist/commands/pull-v3/llm-content-merger.js +1 -1
  23. package/dist/commands/pull-v3/new-component-generator.js +5 -16
  24. package/dist/commands/pull-v3/project-comparator.js +49 -49
  25. package/dist/commands/pull-v3/project-validator.js +5 -4
  26. package/dist/commands/pull-v3/targeted-typescript-placeholders.js +2 -2
  27. package/dist/commands/pull-v3/utils/component-registry.js +9 -7
  28. package/dist/commands/pull-v3/utils/component-tracker.js +1 -1
  29. package/dist/commands/pull-v3/utils/generator-utils.js +2 -2
  30. package/dist/commands/push.js +9 -9
  31. package/dist/commands/status.js +4 -8
  32. package/dist/index.js +2 -2
  33. package/dist/utils/ci-environment.js +4 -6
  34. package/dist/utils/cli-pipeline.js +8 -12
  35. package/dist/utils/config.js +17 -25
  36. package/dist/utils/json-comparison.js +3 -3
  37. package/dist/utils/profile-config.js +4 -6
  38. package/dist/utils/profiles/index.js +2 -2
  39. package/dist/utils/profiles/profile-manager.js +1 -1
  40. package/dist/utils/profiles/types.js +21 -7
  41. package/dist/utils/templates.js +3 -5
  42. package/package.json +8 -7
@@ -75,10 +75,9 @@ function generateComponentContent(componentType, componentId, componentData, com
75
75
  case "functionTools": return generateFunctionToolFile(componentId, componentData, defaultStyle);
76
76
  case "credentials": return generateCredentialFile(componentId, componentData, defaultStyle);
77
77
  case "contextConfigs": {
78
- const agentId = componentData._agentId;
79
78
  const cleanComponentData = { ...componentData };
80
79
  delete cleanComponentData._agentId;
81
- return generateContextConfigFile(componentId, cleanComponentData, defaultStyle, componentRegistry, agentId);
80
+ return generateContextConfigFile(componentId, cleanComponentData, defaultStyle, componentRegistry);
82
81
  }
83
82
  default: throw new Error(`No generator for component type: ${componentType}`);
84
83
  }
@@ -132,7 +131,7 @@ async function createNewComponents(comparison, remoteProject, localRegistry, pat
132
131
  const addedComponents = changes.added || [];
133
132
  for (const componentId of addedComponents) {
134
133
  if (localRegistry.get(componentId, componentType)) continue;
135
- const relativePath = determineNewFilePath(componentType, componentId, targetPaths).replace((tempDirName ? targetPaths.projectRoot : paths.projectRoot) + "/", "");
134
+ const relativePath = determineNewFilePath(componentType, componentId, targetPaths).replace(`${tempDirName ? targetPaths.projectRoot : paths.projectRoot}/`, "");
136
135
  let explicitVariableName;
137
136
  if (componentType === "contextConfigs") {
138
137
  const contextResult = findContextConfigData(remoteProject, componentId);
@@ -192,18 +191,8 @@ async function createNewComponents(comparison, remoteProject, localRegistry, pat
192
191
  });
193
192
  continue;
194
193
  }
195
- try {
196
- mkdirSync(dirname(filePath), { recursive: true });
197
- } catch (dirError) {
198
- throw dirError;
199
- }
200
- let content;
201
- try {
202
- content = generateComponentContent(componentType, componentId, componentData, localRegistry);
203
- } catch (genError) {
204
- throw genError;
205
- }
206
- writeFileSync(filePath, content, "utf8");
194
+ mkdirSync(dirname(filePath), { recursive: true });
195
+ writeFileSync(filePath, generateComponentContent(componentType, componentId, componentData, localRegistry), "utf8");
207
196
  const registryEntry = localRegistry.get(componentId, componentType);
208
197
  if (!registryEntry) throw new Error(`Component ${componentId} (${componentType}) was not registered in the registry`);
209
198
  const variableName = registryEntry.name;
@@ -259,7 +248,7 @@ async function createNewComponents(comparison, remoteProject, localRegistry, pat
259
248
  */
260
249
  function findStatusComponentData(project, statusId) {
261
250
  if (project.agents) {
262
- for (const [agentId, agentData] of Object.entries(project.agents)) if (agentData.statusUpdates && agentData.statusUpdates.statusComponents) for (const statusComp of agentData.statusUpdates.statusComponents) {
251
+ for (const agentData of Object.values(project.agents)) if (agentData.statusUpdates?.statusComponents) for (const statusComp of agentData.statusUpdates.statusComponents) {
263
252
  let compId;
264
253
  if (typeof statusComp === "string") compId = statusComp;
265
254
  else if (typeof statusComp === "object" && statusComp) compId = statusComp.type;
@@ -5,10 +5,10 @@ import chalk from "chalk";
5
5
  /**
6
6
  * Compare two projects and classify all changes using direct component comparison
7
7
  */
8
- async function compareProjects(localProject, remoteProject, localRegistry, debug = false) {
8
+ async function compareProjects(localProject, remoteProject, debug = false) {
9
9
  if (debug) console.log(chalk.gray("\nšŸ” Comparing local and remote projects..."));
10
- if (!localProject) return createNewProjectComparison(remoteProject, debug);
11
- const changes = compareComponentsDirectly(localProject, remoteProject, localRegistry, debug);
10
+ if (!localProject) return createNewProjectComparison(remoteProject);
11
+ const changes = compareComponentsDirectly(localProject, remoteProject);
12
12
  const componentChanges = groupChangesByType(changes);
13
13
  return {
14
14
  hasChanges: changes.length > 0,
@@ -21,7 +21,7 @@ async function compareProjects(localProject, remoteProject, localRegistry, debug
21
21
  /**
22
22
  * Handle new project case (everything is added)
23
23
  */
24
- function createNewProjectComparison(project, debug) {
24
+ function createNewProjectComparison(project) {
25
25
  const changes = [];
26
26
  if (project.agents) Object.keys(project.agents).forEach((agentId) => {
27
27
  changes.push({
@@ -65,7 +65,7 @@ function createNewProjectComparison(project, debug) {
65
65
  changeType: "added"
66
66
  });
67
67
  });
68
- if (project.agents) Object.entries(project.agents).forEach(([agentId, agentData]) => {
68
+ if (project.agents) Object.values(project.agents).forEach((agentData) => {
69
69
  if (agentData.subAgents) Object.keys(agentData.subAgents).forEach((subAgentId) => {
70
70
  changes.push({
71
71
  componentType: "subAgents",
@@ -81,7 +81,7 @@ function createNewProjectComparison(project, debug) {
81
81
  changeType: "added"
82
82
  });
83
83
  });
84
- if (project.agents) Object.entries(project.agents).forEach(([agentId, agentData]) => {
84
+ if (project.agents) Object.values(project.agents).forEach((agentData) => {
85
85
  if (agentData.contextConfig) {
86
86
  const contextConfigId = agentData.contextConfig.id;
87
87
  if (!contextConfigId) return;
@@ -118,30 +118,30 @@ function createNewProjectComparison(project, debug) {
118
118
  /**
119
119
  * Direct component-by-component comparison
120
120
  */
121
- function compareComponentsDirectly(localProject, remoteProject, localRegistry, debug) {
121
+ function compareComponentsDirectly(localProject, remoteProject) {
122
122
  const changes = [];
123
- changes.push(...compareAgents(localProject.agents || {}, remoteProject.agents || {}, debug));
124
- changes.push(...compareSubAgents(localProject.agents || {}, remoteProject.agents || {}, debug));
125
- changes.push(...compareTools(localProject.tools || {}, remoteProject.tools || {}, debug));
126
- changes.push(...compareFunctionTools(localProject.functionTools || {}, remoteProject.functionTools || {}, debug));
127
- changes.push(...compareFunctions(localProject.functions || {}, remoteProject.functions || {}, debug));
128
- changes.push(...compareDataComponents(localProject.dataComponents || {}, remoteProject.dataComponents || {}, debug));
129
- changes.push(...compareArtifactComponents(localProject.artifactComponents || {}, remoteProject.artifactComponents || {}, debug));
130
- changes.push(...compareCredentials(localProject.credentialReferences || {}, remoteProject.credentialReferences || {}, debug));
131
- changes.push(...compareExternalAgents(localProject.externalAgents || {}, remoteProject.externalAgents || {}, debug));
123
+ changes.push(...compareAgents(localProject.agents || {}, remoteProject.agents || {}));
124
+ changes.push(...compareSubAgents(localProject.agents || {}, remoteProject.agents || {}));
125
+ changes.push(...compareTools(localProject.tools || {}, remoteProject.tools || {}));
126
+ changes.push(...compareFunctionTools(localProject.functionTools || {}, remoteProject.functionTools || {}));
127
+ changes.push(...compareFunctions(localProject.functions || {}, remoteProject.functions || {}));
128
+ changes.push(...compareDataComponents(localProject.dataComponents || {}, remoteProject.dataComponents || {}));
129
+ changes.push(...compareArtifactComponents(localProject.artifactComponents || {}, remoteProject.artifactComponents || {}));
130
+ changes.push(...compareCredentials(localProject.credentialReferences || {}, remoteProject.credentialReferences || {}));
131
+ changes.push(...compareExternalAgents(localProject.externalAgents || {}, remoteProject.externalAgents || {}));
132
132
  const localStatusComponents = extractStatusComponentsFromProject(localProject);
133
133
  const remoteStatusComponents = extractStatusComponentsFromProject(remoteProject);
134
- changes.push(...compareStatusComponents(localStatusComponents, remoteStatusComponents, debug));
135
- changes.push(...compareContextConfigs(localProject, remoteProject, localRegistry, debug));
136
- changes.push(...compareFetchDefinitions(localProject, remoteProject, debug));
137
- changes.push(...compareProjectModels(localProject.models, remoteProject.models, debug));
138
- changes.push(...compareProjectFields(localProject, remoteProject, debug));
134
+ changes.push(...compareStatusComponents(localStatusComponents, remoteStatusComponents));
135
+ changes.push(...compareContextConfigs(localProject, remoteProject));
136
+ changes.push(...compareFetchDefinitions(localProject, remoteProject));
137
+ changes.push(...compareProjectModels(localProject.models, remoteProject.models));
138
+ changes.push(...compareProjectFields(localProject, remoteProject));
139
139
  return changes;
140
140
  }
141
141
  /**
142
142
  * Compare agents between local and remote
143
143
  */
144
- function compareAgents(localAgents, remoteAgents, debug) {
144
+ function compareAgents(localAgents, remoteAgents) {
145
145
  const changes = [];
146
146
  const localIds = Object.keys(localAgents);
147
147
  const remoteIds = Object.keys(remoteAgents);
@@ -182,12 +182,12 @@ function compareAgents(localAgents, remoteAgents, debug) {
182
182
  * Compare subAgents between local and remote
183
183
  * Extracts subAgents from all agents and compares them as separate components
184
184
  */
185
- function compareSubAgents(localAgents, remoteAgents, debug) {
185
+ function compareSubAgents(localAgents, remoteAgents) {
186
186
  const changes = [];
187
187
  const localSubAgents = {};
188
- for (const [agentId, agentData] of Object.entries(localAgents)) if (agentData.subAgents) for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) localSubAgents[subAgentId] = subAgentData;
188
+ for (const agentData of Object.values(localAgents)) if (agentData.subAgents) for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) localSubAgents[subAgentId] = subAgentData;
189
189
  const remoteSubAgents = {};
190
- for (const [agentId, agentData] of Object.entries(remoteAgents)) if (agentData.subAgents) for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) remoteSubAgents[subAgentId] = subAgentData;
190
+ for (const agentData of Object.values(remoteAgents)) if (agentData.subAgents) for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) remoteSubAgents[subAgentId] = subAgentData;
191
191
  const localIds = Object.keys(localSubAgents);
192
192
  const remoteIds = Object.keys(remoteSubAgents);
193
193
  remoteIds.filter((id) => !localIds.includes(id)).forEach((id) => {
@@ -238,19 +238,19 @@ function generateSubAgentChangeSummary(fieldChanges) {
238
238
  /**
239
239
  * Compare tools between local and remote
240
240
  */
241
- function compareTools(localTools, remoteTools, debug) {
242
- return compareComponentMaps("tools", localTools, remoteTools, debug);
241
+ function compareTools(localTools, remoteTools) {
242
+ return compareComponentMaps("tools", localTools, remoteTools);
243
243
  }
244
244
  /**
245
245
  * Compare function tools between local and remote
246
246
  */
247
- function compareFunctionTools(localFunctionTools, remoteFunctionTools, debug) {
248
- return compareComponentMaps("functionTools", localFunctionTools, remoteFunctionTools, debug);
247
+ function compareFunctionTools(localFunctionTools, remoteFunctionTools) {
248
+ return compareComponentMaps("functionTools", localFunctionTools, remoteFunctionTools);
249
249
  }
250
250
  /**
251
251
  * Compare functions between local and remote
252
252
  */
253
- function compareFunctions(localFunctions, remoteFunctions, debug) {
253
+ function compareFunctions(localFunctions, remoteFunctions) {
254
254
  const cleanLocalFunctions = {};
255
255
  const cleanRemoteFunctions = {};
256
256
  for (const [id, func] of Object.entries(localFunctions)) cleanLocalFunctions[id] = {
@@ -265,42 +265,42 @@ function compareFunctions(localFunctions, remoteFunctions, debug) {
265
265
  executeCode: func.executeCode,
266
266
  dependencies: func.dependencies
267
267
  };
268
- return compareComponentMaps("functions", cleanLocalFunctions, cleanRemoteFunctions, debug);
268
+ return compareComponentMaps("functions", cleanLocalFunctions, cleanRemoteFunctions);
269
269
  }
270
270
  /**
271
271
  * Compare data components between local and remote
272
272
  */
273
- function compareDataComponents(localDataComponents, remoteDataComponents, debug) {
274
- return compareComponentMaps("dataComponents", localDataComponents, remoteDataComponents, debug);
273
+ function compareDataComponents(localDataComponents, remoteDataComponents) {
274
+ return compareComponentMaps("dataComponents", localDataComponents, remoteDataComponents);
275
275
  }
276
276
  /**
277
277
  * Compare artifact components between local and remote
278
278
  */
279
- function compareArtifactComponents(localArtifactComponents, remoteArtifactComponents, debug) {
280
- return compareComponentMaps("artifactComponents", localArtifactComponents, remoteArtifactComponents, debug);
279
+ function compareArtifactComponents(localArtifactComponents, remoteArtifactComponents) {
280
+ return compareComponentMaps("artifactComponents", localArtifactComponents, remoteArtifactComponents);
281
281
  }
282
282
  /**
283
283
  * Compare credentials between local and remote
284
284
  */
285
- function compareCredentials(localCredentials, remoteCredentials, debug) {
286
- return compareComponentMaps("credentials", localCredentials, remoteCredentials, debug);
285
+ function compareCredentials(localCredentials, remoteCredentials) {
286
+ return compareComponentMaps("credentials", localCredentials, remoteCredentials);
287
287
  }
288
288
  /**
289
289
  * Compare external agents between local and remote
290
290
  */
291
- function compareExternalAgents(localExternalAgents, remoteExternalAgents, debug) {
292
- return compareComponentMaps("externalAgents", localExternalAgents, remoteExternalAgents, debug);
291
+ function compareExternalAgents(localExternalAgents, remoteExternalAgents) {
292
+ return compareComponentMaps("externalAgents", localExternalAgents, remoteExternalAgents);
293
293
  }
294
294
  /**
295
295
  * Compare status components between local and remote
296
296
  */
297
- function compareStatusComponents(localStatusComponents, remoteStatusComponents, debug) {
298
- return compareComponentMaps("statusComponents", localStatusComponents, remoteStatusComponents, debug);
297
+ function compareStatusComponents(localStatusComponents, remoteStatusComponents) {
298
+ return compareComponentMaps("statusComponents", localStatusComponents, remoteStatusComponents);
299
299
  }
300
300
  /**
301
301
  * Compare project-level models
302
302
  */
303
- function compareProjectModels(localModels, remoteModels, debug) {
303
+ function compareProjectModels(localModels, remoteModels) {
304
304
  const changes = [];
305
305
  const fieldChanges = getDetailedFieldChanges("", localModels, remoteModels);
306
306
  if (fieldChanges.length > 0) {
@@ -333,7 +333,7 @@ function generateModelsChangeSummary(fieldChanges) {
333
333
  /**
334
334
  * Compare project-level fields like name, description, etc.
335
335
  */
336
- function compareProjectFields(localProject, remoteProject, debug) {
336
+ function compareProjectFields(localProject, remoteProject) {
337
337
  const changes = [];
338
338
  for (const field of [
339
339
  "name",
@@ -361,7 +361,7 @@ function compareProjectFields(localProject, remoteProject, debug) {
361
361
  /**
362
362
  * Generic component map comparison with detailed field tracking
363
363
  */
364
- function compareComponentMaps(componentType, localMap, remoteMap, debug) {
364
+ function compareComponentMaps(componentType, localMap, remoteMap) {
365
365
  const changes = [];
366
366
  const localIds = Object.keys(localMap);
367
367
  const remoteIds = Object.keys(remoteMap);
@@ -635,7 +635,7 @@ function formatValue(value) {
635
635
  const keys = Object.keys(value);
636
636
  if (keys.length <= 3) return `{${keys.map((key) => {
637
637
  const val = value[key];
638
- if (typeof val === "string") return `${key}: "${val.length > 15 ? val.substring(0, 12) + "..." : val}"`;
638
+ if (typeof val === "string") return `${key}: "${val.length > 15 ? `${val.substring(0, 12)}...` : val}"`;
639
639
  if (typeof val === "object" && val !== null) return `${key}: {...}`;
640
640
  return `${key}: ${val}`;
641
641
  }).join(", ")}}`;
@@ -811,7 +811,7 @@ function createEmptyComponentChanges() {
811
811
  /**
812
812
  * Compare contextConfig components across agents
813
813
  */
814
- function compareContextConfigs(localProject, remoteProject, localRegistry, debug) {
814
+ function compareContextConfigs(localProject, remoteProject) {
815
815
  const changes = [];
816
816
  new Set([...Object.keys(localProject.agents || {}), ...Object.keys(remoteProject.agents || {})]).forEach((agentId) => {
817
817
  const localAgent = localProject.agents?.[agentId];
@@ -848,7 +848,7 @@ function compareContextConfigs(localProject, remoteProject, localRegistry, debug
848
848
  /**
849
849
  * Compare fetchDefinition components across contextConfigs
850
850
  */
851
- function compareFetchDefinitions(localProject, remoteProject, debug) {
851
+ function compareFetchDefinitions(localProject, remoteProject) {
852
852
  const changes = [];
853
853
  const fetchDefinitions = /* @__PURE__ */ new Map();
854
854
  const extractFetchDefinitions = (contextConfig) => {
@@ -858,13 +858,13 @@ function compareFetchDefinitions(localProject, remoteProject, debug) {
858
858
  });
859
859
  return fetchDefs;
860
860
  };
861
- Object.entries(localProject.agents || {}).forEach(([agentId, agentData]) => {
861
+ Object.values(localProject.agents || {}).forEach((agentData) => {
862
862
  if (agentData.contextConfig) extractFetchDefinitions(agentData.contextConfig).forEach((fetchDef) => {
863
863
  if (!fetchDefinitions.has(fetchDef.id)) fetchDefinitions.set(fetchDef.id, {});
864
864
  fetchDefinitions.get(fetchDef.id).local = fetchDef;
865
865
  });
866
866
  });
867
- Object.entries(remoteProject.agents || {}).forEach(([agentId, agentData]) => {
867
+ Object.values(remoteProject.agents || {}).forEach((agentData) => {
868
868
  if (agentData.contextConfig) extractFetchDefinitions(agentData.contextConfig).forEach((fetchDef) => {
869
869
  if (!fetchDefinitions.has(fetchDef.id)) fetchDefinitions.set(fetchDef.id, {});
870
870
  fetchDefinitions.get(fetchDef.id).remote = fetchDef;
@@ -1,6 +1,6 @@
1
- import { buildComponentRegistryFromParsing } from "./component-parser.js";
2
1
  import { compareProjects } from "./project-comparator.js";
3
2
  import { enrichCanDelegateToWithTypes } from "./index.js";
3
+ import { buildComponentRegistryFromParsing } from "./component-parser.js";
4
4
  import { copyFileSync, existsSync, mkdirSync, readdirSync, rmSync, statSync } from "node:fs";
5
5
  import { dirname, join } from "node:path";
6
6
  import chalk from "chalk";
@@ -145,8 +145,9 @@ async function validateProjectEquivalence(tempDir, remoteProject) {
145
145
  reject(/* @__PURE__ */ new Error("getFullDefinition() timed out after 30 seconds"));
146
146
  }, 3e4);
147
147
  })]);
148
- enrichCanDelegateToWithTypes(tempProjectDefinition, false);
149
- const comparison = await compareProjects(tempProjectDefinition, remoteProject, buildComponentRegistryFromParsing(tempDir, false), true);
148
+ enrichCanDelegateToWithTypes(tempProjectDefinition);
149
+ buildComponentRegistryFromParsing(tempDir, false);
150
+ const comparison = await compareProjects(tempProjectDefinition, remoteProject, true);
150
151
  if (!comparison.hasChanges) return true;
151
152
  let hasMeaningfulDifferences = false;
152
153
  let hasAddedOrDeleted = false;
@@ -332,7 +333,7 @@ function overwriteProjectFiles(originalProjectRoot, tempDirName, tempDir) {
332
333
  mkdirSync(dirname(targetPath), { recursive: true });
333
334
  copyFileSync(sourcePath, targetPath);
334
335
  filesReplaced++;
335
- const relativePath = targetPath.replace(originalProjectRoot + "/", "");
336
+ const relativePath = targetPath.replace(`${originalProjectRoot}/`, "");
336
337
  console.log(chalk.green(` āœ… Replaced: ${relativePath}`));
337
338
  }
338
339
  }
@@ -25,7 +25,7 @@ const MIN_REPLACEMENT_LENGTH = 10;
25
25
  /**
26
26
  * Create targeted placeholders using AST parsing for better accuracy
27
27
  */
28
- function createTargetedTypeScriptPlaceholders(content, debug = false) {
28
+ function createTargetedTypeScriptPlaceholders(content) {
29
29
  const replacements = {};
30
30
  let replacedFields = 0;
31
31
  const originalSize = content.length;
@@ -141,7 +141,7 @@ function createTargetedTypeScriptPlaceholders(content, debug = false) {
141
141
  replacedFields
142
142
  }
143
143
  };
144
- } catch (error) {
144
+ } catch {
145
145
  return {
146
146
  processedContent: content,
147
147
  replacements: {},
@@ -1,6 +1,3 @@
1
- import { existsSync, readFileSync } from "node:fs";
2
- import { join } from "node:path";
3
-
4
1
  //#region src/commands/pull-v3/utils/component-registry.ts
5
2
  var ComponentRegistry = class {
6
3
  components = /* @__PURE__ */ new Map();
@@ -202,6 +199,7 @@ var ComponentRegistry = class {
202
199
  case "fetchDefinitions": return "fetch";
203
200
  case "headers": return "header";
204
201
  case "models": return "model";
202
+ case "triggers": return "trigger";
205
203
  case "project": return "project";
206
204
  default: return "comp";
207
205
  }
@@ -236,7 +234,7 @@ var ComponentRegistry = class {
236
234
  const remainingPath = toFile.slice(commonLength).join("/");
237
235
  relativePath += remainingPath;
238
236
  if (relativePath.startsWith("../")) return relativePath;
239
- return "./" + relativePath;
237
+ return `./${relativePath}`;
240
238
  }
241
239
  /**
242
240
  * Get all components for debugging
@@ -298,6 +296,10 @@ function registerAllComponents(project, registry) {
298
296
  const statusComponents = extractStatusComponents(project);
299
297
  for (const statusId of Object.keys(statusComponents)) registry.register(statusId, "statusComponents", `status-components/${statusId}.ts`);
300
298
  if (project.agents) for (const agentId of Object.keys(project.agents)) registry.register(agentId, "agents", `agents/${agentId}.ts`);
299
+ if (project.agents) for (const agentData of Object.values(project.agents)) {
300
+ const agentTriggers = agentData.triggers;
301
+ if (agentTriggers) for (const triggerId of Object.keys(agentTriggers)) registry.register(triggerId, "triggers", `agents/triggers/${triggerId}.ts`);
302
+ }
301
303
  const subAgents = extractSubAgents(project);
302
304
  for (const subAgentId of Object.keys(subAgents)) registry.register(subAgentId, "subAgents", `agents/sub-agents/${subAgentId}.ts`);
303
305
  const contextConfigs = extractContextConfigs(project);
@@ -309,7 +311,7 @@ function registerAllComponents(project, registry) {
309
311
  function extractStatusComponents(project) {
310
312
  const statusComponents = {};
311
313
  if (project.agents) {
312
- for (const [agentId, agentData] of Object.entries(project.agents)) if (agentData.statusUpdates && agentData.statusUpdates.statusComponents) for (const statusComp of agentData.statusUpdates.statusComponents) {
314
+ for (const agentData of Object.values(project.agents)) if (agentData.statusUpdates?.statusComponents) for (const statusComp of agentData.statusUpdates.statusComponents) {
313
315
  let statusId;
314
316
  if (typeof statusComp === "string") statusId = statusComp;
315
317
  else if (typeof statusComp === "object" && statusComp) statusId = statusComp.type;
@@ -331,7 +333,7 @@ function extractStatusComponents(project) {
331
333
  function extractSubAgents(project) {
332
334
  const subAgents = {};
333
335
  if (project.agents) {
334
- for (const [agentId, agentData] of Object.entries(project.agents)) if (agentData.subAgents) for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) subAgents[subAgentId] = subAgentData;
336
+ for (const agentData of Object.values(project.agents)) if (agentData.subAgents) for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) subAgents[subAgentId] = subAgentData;
335
337
  }
336
338
  return subAgents;
337
339
  }
@@ -354,7 +356,7 @@ function extractContextConfigs(project) {
354
356
  */
355
357
  function findSubAgentWithParent(project, subAgentId) {
356
358
  if (project.agents) {
357
- for (const [agentId, agentData] of Object.entries(project.agents)) if (agentData.subAgents && agentData.subAgents[subAgentId]) {
359
+ for (const [agentId, agentData] of Object.entries(project.agents)) if (agentData.subAgents?.[subAgentId]) {
358
360
  const contextConfigData = agentData.contextConfig?.id ? agentData.contextConfig : void 0;
359
361
  return {
360
362
  subAgentData: agentData.subAgents[subAgentId],
@@ -139,7 +139,7 @@ var ComponentTracker = class {
139
139
  for (let i = 0; i < fromParts.length; i++) relativePath += "../";
140
140
  relativePath += toParts.join("/");
141
141
  if (relativePath.startsWith("../")) return relativePath;
142
- return "./" + relativePath;
142
+ return `./${relativePath}`;
143
143
  }
144
144
  /**
145
145
  * Get all components as a list
@@ -17,7 +17,7 @@ function toCamelCase(str) {
17
17
  function formatString(str, quote = "'", multiline = false) {
18
18
  if (!str && str !== "") return `${quote}${quote}`;
19
19
  if (multiline && (str.includes("\n") || str.length > 80)) return `\`${str.replace(/`/g, "\\`")}\``;
20
- return `${quote}${str.replace(new RegExp(quote, "g"), "\\" + quote)}${quote}`;
20
+ return `${quote}${str.replace(new RegExp(quote, "g"), `\\${quote}`)}${quote}`;
21
21
  }
22
22
  /**
23
23
  * Check if a string contains template variables like {{user.name}}
@@ -46,7 +46,7 @@ function isContextVariable(variablePath, contextConfigData) {
46
46
  */
47
47
  function formatPromptWithContext(str, contextVarName, headersVarName, contextConfigData, quote = "'", multiline = false) {
48
48
  if (!str && str !== "") return `${quote}${quote}`;
49
- if (hasTemplateVariables(str)) return `\`${str.replace(/\{\{([^}]+)\}\}/g, (match, variablePath) => {
49
+ if (hasTemplateVariables(str)) return `\`${str.replace(/\{\{([^}]+)\}\}/g, (_match, variablePath) => {
50
50
  if (isContextVariable(variablePath, contextConfigData)) return `\${${contextVarName}.toTemplate("${variablePath}")}`;
51
51
  if (isHeadersVariable(variablePath, contextConfigData)) return `\${${headersVarName}.toTemplate("${variablePath}")}`;
52
52
  return `\${${contextVarName}.toTemplate("${variablePath}")}`;
@@ -16,7 +16,7 @@ async function pushCommand(options) {
16
16
  await pushAllProjects(options);
17
17
  return;
18
18
  }
19
- const { config, profile } = await initializeCommand({
19
+ const { config } = await initializeCommand({
20
20
  configPath: options.config,
21
21
  profileName: options.profile,
22
22
  tag: options.tag,
@@ -63,7 +63,7 @@ async function pushCommand(options) {
63
63
  const originalTenantId = process.env.INKEEP_TENANT_ID;
64
64
  const originalApiUrl = process.env.INKEEP_API_URL;
65
65
  process.env.INKEEP_TENANT_ID = config.tenantId;
66
- process.env.INKEEP_API_URL = config.agentsManageApiUrl;
66
+ process.env.INKEEP_API_URL = config.agentsApiUrl;
67
67
  s.start("Loading project from index.ts...");
68
68
  const project = await loadProject(projectDir);
69
69
  if (originalTenantId !== void 0) process.env.INKEEP_TENANT_ID = originalTenantId;
@@ -71,7 +71,7 @@ async function pushCommand(options) {
71
71
  if (originalApiUrl !== void 0) process.env.INKEEP_API_URL = originalApiUrl;
72
72
  else delete process.env.INKEEP_API_URL;
73
73
  s.stop("Project loaded successfully");
74
- if (typeof project.setConfig === "function") project.setConfig(config.tenantId, config.agentsManageApiUrl, void 0, config.agentsManageApiKey);
74
+ if (typeof project.setConfig === "function") project.setConfig(config.tenantId, config.agentsApiUrl, void 0, config.agentsApiKey);
75
75
  if (options.env && typeof project.setCredentials === "function") {
76
76
  s.start(`Loading credentials for environment '${options.env}'...`);
77
77
  try {
@@ -244,13 +244,13 @@ async function pushAllProjects(options) {
244
244
  if (projectDirs.length === 0) {
245
245
  const configPattern = options.tag ? `${options.tag}.__inkeep.config.ts__` : "inkeep.config.ts";
246
246
  console.error(chalk.red("No valid projects found."));
247
- console.log(chalk.yellow("\nHint: Projects must have an index.ts file and access to an " + configPattern + " file"));
247
+ console.log(chalk.yellow(`\nHint: Projects must have an index.ts file and access to an ${configPattern} file`));
248
248
  console.log(chalk.yellow(" (either in the same directory or in a parent directory)."));
249
249
  process.exit(1);
250
250
  }
251
251
  console.log(chalk.gray(`Found ${projectDirs.length} project(s) to push:\n`));
252
252
  for (const dir of projectDirs) {
253
- const relativePath = dir === process.cwd() ? "." : dir.replace(process.cwd() + "/", "");
253
+ const relativePath = dir === process.cwd() ? "." : dir.replace(`${process.cwd()}/`, "");
254
254
  console.log(chalk.gray(` • ${relativePath}`));
255
255
  }
256
256
  console.log();
@@ -258,7 +258,7 @@ async function pushAllProjects(options) {
258
258
  const total = projectDirs.length;
259
259
  for (let i = 0; i < projectDirs.length; i++) {
260
260
  const projectDir = projectDirs[i];
261
- const relativePath = projectDir === process.cwd() ? "." : projectDir.replace(process.cwd() + "/", "");
261
+ const relativePath = projectDir === process.cwd() ? "." : projectDir.replace(`${process.cwd()}/`, "");
262
262
  const progress = `[${i + 1}/${total}]`;
263
263
  console.log(chalk.cyan(`${progress} Pushing ${relativePath}...`));
264
264
  const result = await pushSingleProject(projectDir, options);
@@ -274,7 +274,7 @@ async function pushAllProjects(options) {
274
274
  console.log(chalk.red(` āœ— Failed: ${failed}`));
275
275
  console.log(chalk.red("\nFailed projects:"));
276
276
  for (const result of results) if (!result.success) {
277
- const relativePath = result.projectDir === process.cwd() ? "." : result.projectDir.replace(process.cwd() + "/", "");
277
+ const relativePath = result.projectDir === process.cwd() ? "." : result.projectDir.replace(`${process.cwd()}/`, "");
278
278
  console.log(chalk.red(` • ${relativePath}: ${result.error}`));
279
279
  }
280
280
  }
@@ -295,13 +295,13 @@ async function pushSingleProject(projectDir, options) {
295
295
  const originalTenantId = process.env.INKEEP_TENANT_ID;
296
296
  const originalApiUrl = process.env.INKEEP_API_URL;
297
297
  process.env.INKEEP_TENANT_ID = config.tenantId;
298
- process.env.INKEEP_API_URL = config.agentsManageApiUrl;
298
+ process.env.INKEEP_API_URL = config.agentsApiUrl;
299
299
  const project = await loadProject(projectDir);
300
300
  if (originalTenantId !== void 0) process.env.INKEEP_TENANT_ID = originalTenantId;
301
301
  else delete process.env.INKEEP_TENANT_ID;
302
302
  if (originalApiUrl !== void 0) process.env.INKEEP_API_URL = originalApiUrl;
303
303
  else delete process.env.INKEEP_API_URL;
304
- if (typeof project.setConfig === "function") project.setConfig(config.tenantId, config.agentsManageApiUrl, void 0, config.agentsManageApiKey);
304
+ if (typeof project.setConfig === "function") project.setConfig(config.tenantId, config.agentsApiUrl, void 0, config.agentsApiKey);
305
305
  if (options.env && typeof project.setCredentials === "function") {
306
306
  const credentials = await loadEnvironmentCredentials(projectDir, options.env);
307
307
  project.setCredentials(credentials);
@@ -8,9 +8,8 @@ async function statusCommand(options = {}) {
8
8
  const profileManager = new ProfileManager();
9
9
  let profileName;
10
10
  let credentialKey;
11
- let manageApiUrl;
11
+ let agentsApiUrl;
12
12
  let manageUiUrl;
13
- let runApiUrl;
14
13
  let environment;
15
14
  try {
16
15
  if (options.profile) {
@@ -22,17 +21,15 @@ async function statusCommand(options = {}) {
22
21
  }
23
22
  profileName = options.profile;
24
23
  credentialKey = profile.credential;
25
- manageApiUrl = profile.remote.manageApi;
24
+ agentsApiUrl = profile.remote.api;
26
25
  manageUiUrl = profile.remote.manageUi;
27
- runApiUrl = profile.remote.runApi;
28
26
  environment = profile.environment;
29
27
  } else {
30
28
  const activeProfile = profileManager.getActiveProfile();
31
29
  profileName = activeProfile.name;
32
30
  credentialKey = activeProfile.credential;
33
- manageApiUrl = activeProfile.remote.manageApi;
31
+ agentsApiUrl = activeProfile.remote.api;
34
32
  manageUiUrl = activeProfile.remote.manageUi;
35
- runApiUrl = activeProfile.remote.runApi;
36
33
  environment = activeProfile.environment;
37
34
  }
38
35
  } catch {
@@ -77,9 +74,8 @@ async function statusCommand(options = {}) {
77
74
  }
78
75
  }
79
76
  console.log(chalk.bold("Remote:"));
80
- console.log(chalk.gray(` Manage API: ${manageApiUrl}`));
77
+ console.log(chalk.gray(` Agents API: ${agentsApiUrl}`));
81
78
  console.log(chalk.gray(` Manage UI: ${manageUiUrl}`));
82
- console.log(chalk.gray(` Run API: ${runApiUrl}`));
83
79
  console.log();
84
80
  console.log(chalk.bold("Environment:"), environment);
85
81
  console.log();
package/dist/index.js CHANGED
@@ -47,13 +47,13 @@ configCommand.command("set <key> <value>").description("Set a configuration valu
47
47
  configCommand.command("list").description("List all configuration values").option("--config <path>", "Path to configuration file").option("--config-file-path <path>", "Path to configuration file (deprecated, use --config)").action(async (options) => {
48
48
  await configListCommand({ config: options.config || options.configFilePath });
49
49
  });
50
- program.command("push").description("Push a project configuration to the backend").option("--project <project-id>", "Project ID or path to project directory").option("--config <path>", "Path to configuration file").option("--profile <name>", "Profile to use for remote URLs and authentication").option("--tenant-id <id>", "Override tenant ID").option("--agents-manage-api-url <url>", "Override agents manage API URL").option("--agents-run-api-url <url>", "Override agents run API URL").option("--env <environment>", "Environment to use for credential resolution (e.g., development, production)").option("--json", "Generate project data JSON file instead of pushing to backend").option("--all", "Push all projects found in current directory tree").option("--tag <tag>", "Use tagged config file (e.g., --tag prod loads prod.__inkeep.config.ts__)").option("--quiet", "Suppress profile/config logging").action(async (options) => {
50
+ program.command("push").description("Push a project configuration to the backend").option("--project <project-id>", "Project ID or path to project directory").option("--config <path>", "Path to configuration file").option("--profile <name>", "Profile to use for remote URLs and authentication").option("--tenant-id <id>", "Override tenant ID").option("--agents-api-url <url>", "Override agents API URL").option("--env <environment>", "Environment to use for credential resolution (e.g., development, production)").option("--json", "Generate project data JSON file instead of pushing to backend").option("--all", "Push all projects found in current directory tree").option("--tag <tag>", "Use tagged config file (e.g., --tag prod loads prod.__inkeep.config.ts__)").option("--quiet", "Suppress profile/config logging").action(async (options) => {
51
51
  await pushCommand(options);
52
52
  });
53
53
  program.command("pull").description("Pull project configuration with clean, efficient code generation").option("--project <project-id>", "Project ID to pull (or path to project directory). If in project directory, validates against local project ID.").option("--config <path>", "Path to configuration file").option("--profile <name>", "Profile to use for remote URLs and authentication").option("--env <environment>", "Environment file to generate (development, staging, production). Defaults to development").option("--json", "Output project data as JSON instead of generating files").option("--debug", "Enable debug logging").option("--verbose", "Enable verbose logging").option("--force", "Force regeneration even if no changes detected").option("--introspect", "Completely regenerate all files from scratch (no comparison needed)").option("--all", "Pull all projects for current tenant").option("--tag <tag>", "Use tagged config file (e.g., --tag prod loads prod.__inkeep.config.ts__)").option("--quiet", "Suppress profile/config logging").action(async (options) => {
54
54
  await pullV3Command(options);
55
55
  });
56
- program.command("list-agent").description("List all available agents for a specific project").requiredOption("--project <project-id>", "Project ID to list agent for").option("--tenant-id <tenant-id>", "Tenant ID").option("--agents-manage-api-url <url>", "Agents manage API URL").option("--config <path>", "Path to configuration file").option("--config-file-path <path>", "Path to configuration file (deprecated, use --config)").action(async (options) => {
56
+ program.command("list-agent").description("List all available agents for a specific project").requiredOption("--project <project-id>", "Project ID to list agent for").option("--tenant-id <tenant-id>", "Tenant ID").option("--agents-api-url <url>", "Agents API URL").option("--config <path>", "Path to configuration file").option("--config-file-path <path>", "Path to configuration file (deprecated, use --config)").action(async (options) => {
57
57
  const config = options.config || options.configFilePath;
58
58
  await listAgentsCommand({
59
59
  ...options,
@@ -47,23 +47,21 @@ async function detectCIEnvironment() {
47
47
  }
48
48
  function loadCIEnvironmentConfig() {
49
49
  const apiKey = process.env.INKEEP_API_KEY;
50
- const manageApiUrl = process.env.INKEEP_MANAGE_API_URL;
51
- const runApiUrl = process.env.INKEEP_RUN_API_URL;
50
+ const agentsApiUrl = process.env.INKEEP_AGENTS_API_URL;
52
51
  const environment = process.env.INKEEP_ENVIRONMENT || "production";
53
52
  const tenantId = process.env.INKEEP_TENANT_ID;
54
53
  if (!apiKey) return null;
55
54
  return {
56
55
  isCI: true,
57
56
  apiKey,
58
- manageApiUrl: manageApiUrl || "https://manage-api.inkeep.com",
59
- runApiUrl: runApiUrl || "https://run-api.inkeep.com",
57
+ agentsApiUrl: agentsApiUrl || "https://agents-api.inkeep.com",
60
58
  environment,
61
59
  tenantId
62
60
  };
63
61
  }
64
62
  function logCIConfig(config, reason) {
65
63
  console.log(chalk.yellow(`CI mode detected (${reason})`));
66
- console.log(chalk.gray(` Remote: ${config.manageApiUrl}`));
64
+ console.log(chalk.gray(` Remote: ${config.agentsApiUrl}`));
67
65
  console.log(chalk.gray(` Environment: ${config.environment}`));
68
66
  console.log(chalk.gray(` Auth: API key (INKEEP_API_KEY)`));
69
67
  if (config.tenantId) console.log(chalk.gray(` Tenant: ${config.tenantId}`));
@@ -71,7 +69,7 @@ function logCIConfig(config, reason) {
71
69
  function getAuthHeaders(config, isCI = false) {
72
70
  const headers = {};
73
71
  if (isCI && config.apiKey) headers["X-API-Key"] = config.apiKey;
74
- else if (config.accessToken) headers["Authorization"] = `Bearer ${config.accessToken}`;
72
+ else if (config.accessToken) headers.Authorization = `Bearer ${config.accessToken}`;
75
73
  return headers;
76
74
  }
77
75
  function validateCIConfig(config) {