@inkeep/agents-cli 0.41.2 → 0.43.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 (41) hide show
  1. package/README.md +13 -20
  2. package/dist/api.js +8 -8
  3. package/dist/commands/init.js +19 -39
  4. package/dist/commands/list-agents.js +1 -1
  5. package/dist/commands/login.js +4 -4
  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 +185 -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/profile-manager.js +1 -1
  39. package/dist/utils/profiles/types.js +6 -9
  40. package/dist/utils/templates.js +3 -5
  41. package/package.json +7 -8
@@ -12,6 +12,7 @@ import { generateProjectFile } from "./components/project-generator.js";
12
12
  import { generateStatusComponentFile } from "./components/status-component-generator.js";
13
13
  import { generateSubAgentFile } from "./components/sub-agent-generator.js";
14
14
  import { ComponentRegistry, registerAllComponents } from "./utils/component-registry.js";
15
+ import { generateTriggerFile } from "./components/trigger-generator.js";
15
16
  import { mkdirSync, writeFileSync } from "node:fs";
16
17
  import { dirname, join } from "node:path";
17
18
  import chalk from "chalk";
@@ -33,7 +34,7 @@ function ensureDir(filePath) {
33
34
  * Check if an agent is complete enough for code generation
34
35
  * An agent needs a name, defaultSubAgentId, and at least one sub-agent
35
36
  */
36
- function isAgentComplete(agentId, agentData) {
37
+ function isAgentComplete(agentData) {
37
38
  if (!agentData.name) return {
38
39
  complete: false,
39
40
  reason: "missing name"
@@ -102,7 +103,7 @@ async function introspectGenerate(project, paths, environment, debug, options =
102
103
  generatedFiles.push(functionFile);
103
104
  functionToolsGenerated.add(toolId);
104
105
  }
105
- if (project.agents) for (const [agentId, agentData] of Object.entries(project.agents)) {
106
+ if (project.agents) for (const agentData of Object.values(project.agents)) {
106
107
  const agentFunctionTools = agentData.functionTools;
107
108
  const agentFunctions = agentData.functions;
108
109
  if (agentFunctionTools) for (const [toolId, toolData] of Object.entries(agentFunctionTools)) {
@@ -126,7 +127,7 @@ async function introspectGenerate(project, paths, environment, debug, options =
126
127
  }
127
128
  }
128
129
  if (project.functions) {
129
- for (const [funcId, funcData] of Object.entries(project.functions)) if (!functionToolsGenerated.has(funcId)) {
130
+ for (const funcId of Object.keys(project.functions)) if (!functionToolsGenerated.has(funcId)) {
130
131
  if (!(Object.values(project.functionTools || {}).some((ft) => ft.functionId === funcId) || Object.values(project.agents || {}).some((agent) => Object.values(agent.functionTools || {}).some((ft) => ft.functionId === funcId))) && debug) console.log(chalk.yellow(`⚠️ Skipping orphaned function '${funcId}' - no functionTool references it`));
131
132
  }
132
133
  }
@@ -182,7 +183,7 @@ async function introspectGenerate(project, paths, environment, debug, options =
182
183
  }
183
184
  const completeAgentIds = /* @__PURE__ */ new Set();
184
185
  if (project.agents) for (const [agentId, agentData] of Object.entries(project.agents)) {
185
- const completeness = isAgentComplete(agentId, agentData);
186
+ const completeness = isAgentComplete(agentData);
186
187
  if (completeness.complete) completeAgentIds.add(agentId);
187
188
  else {
188
189
  skippedAgents.push({
@@ -196,7 +197,7 @@ async function introspectGenerate(project, paths, environment, debug, options =
196
197
  let totalSubAgents = 0;
197
198
  for (const [agentId, agentData] of Object.entries(project.agents)) {
198
199
  if (!completeAgentIds.has(agentId)) continue;
199
- if (agentData.subAgents) for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) totalSubAgents++;
200
+ if (agentData.subAgents) for (const _subAgentId of Object.keys(agentData.subAgents)) totalSubAgents++;
200
201
  }
201
202
  if (totalSubAgents > 0) for (const [agentId, agentData] of Object.entries(project.agents)) {
202
203
  if (!completeAgentIds.has(agentId)) continue;
@@ -219,6 +220,13 @@ async function introspectGenerate(project, paths, environment, debug, options =
219
220
  ensureDir(agentFile);
220
221
  writeFileSync(agentFile, agentContent, "utf-8");
221
222
  generatedFiles.push(agentFile);
223
+ if (agentData.triggers && Object.keys(agentData.triggers).length > 0) for (const [triggerId, triggerData] of Object.entries(agentData.triggers)) {
224
+ const triggerFile = join(paths.agentsDir, "triggers", `${triggerId}.ts`);
225
+ const triggerContent = generateTriggerFile(triggerId, triggerData, style, registry);
226
+ ensureDir(triggerFile);
227
+ writeFileSync(triggerFile, triggerContent, "utf-8");
228
+ generatedFiles.push(triggerFile);
229
+ }
222
230
  }
223
231
  const projectDataForGenerator = {
224
232
  ...project,
@@ -251,7 +259,7 @@ async function introspectGenerate(project, paths, environment, debug, options =
251
259
  */
252
260
  function findContextConfigData(project, contextId) {
253
261
  if (project.agents) {
254
- for (const [agentId, agentData] of Object.entries(project.agents)) if (agentData.contextConfig) {
262
+ for (const agentData of Object.values(project.agents)) if (agentData.contextConfig) {
255
263
  if (agentData.contextConfig.id === contextId) return agentData.contextConfig;
256
264
  }
257
265
  }
@@ -261,7 +269,7 @@ function findContextConfigData(project, contextId) {
261
269
  */
262
270
  function findStatusComponentData(project, statusId) {
263
271
  if (project.agents) {
264
- for (const [agentId, agentData] of Object.entries(project.agents)) if (agentData.statusUpdates && agentData.statusUpdates.statusComponents) for (const statusComp of agentData.statusUpdates.statusComponents) {
272
+ for (const agentData of Object.values(project.agents)) if (agentData.statusUpdates?.statusComponents) for (const statusComp of agentData.statusUpdates.statusComponents) {
265
273
  let compId;
266
274
  if (typeof statusComp === "string") compId = statusComp;
267
275
  else if (typeof statusComp === "object" && statusComp) compId = statusComp.type;
@@ -54,7 +54,7 @@ async function mergeComponentsWithLLM(request) {
54
54
  let relativePath = "";
55
55
  for (let i = 0; i < upLevels; i++) relativePath += "../";
56
56
  relativePath += toParts.slice(commonLength).join("/");
57
- return relativePath.startsWith("../") ? relativePath : "./" + relativePath;
57
+ return relativePath.startsWith("../") ? relativePath : `./${relativePath}`;
58
58
  }
59
59
  const componentsToExportList = componentsToExport && componentsToExport.length > 0 ? componentsToExport.map((c) => `- ${c.variableName} (${c.reason})`).join("\n") : "";
60
60
  const prompt = `You are a TypeScript code expert tasked with intelligently merging component updates.
@@ -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();