@inkeep/agents-cli 0.51.0 → 0.53.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 (76) hide show
  1. package/dist/agents-cli/package.js +6 -0
  2. package/dist/commands/config.js +1 -1
  3. package/dist/commands/dev.js +1 -1
  4. package/dist/commands/init.js +1 -1
  5. package/dist/commands/{pull-v3 → pull-v4}/component-parser.js +6 -12
  6. package/dist/commands/{pull-v3/utils → pull-v4}/component-registry.js +1 -1
  7. package/dist/commands/pull-v4/generators/agent-generator.js +258 -0
  8. package/dist/commands/pull-v4/generators/artifact-component-generator.js +69 -0
  9. package/dist/commands/pull-v4/generators/context-config-generator.js +264 -0
  10. package/dist/commands/pull-v4/generators/credential-generator.js +30 -0
  11. package/dist/commands/pull-v4/generators/data-component-generator.js +50 -0
  12. package/dist/commands/pull-v4/generators/environment-generator.js +123 -0
  13. package/dist/commands/pull-v4/generators/external-agent-generator.js +56 -0
  14. package/dist/commands/pull-v4/generators/function-tool-generator.js +48 -0
  15. package/dist/commands/pull-v4/generators/mcp-tool-generator.js +91 -0
  16. package/dist/commands/pull-v4/generators/project-generator.js +125 -0
  17. package/dist/commands/{pull-v3/components → pull-v4/generators}/skill-generator.js +1 -1
  18. package/dist/commands/pull-v4/generators/status-component-generator.js +35 -0
  19. package/dist/commands/pull-v4/generators/sub-agent-generator.js +269 -0
  20. package/dist/commands/pull-v4/generators/trigger-generator.js +58 -0
  21. package/dist/commands/pull-v4/introspect/index.js +365 -0
  22. package/dist/commands/pull-v4/introspect/test-helpers.js +143 -0
  23. package/dist/commands/pull-v4/introspect-generator.js +706 -0
  24. package/dist/commands/pull-v4/module-merge.js +405 -0
  25. package/dist/commands/pull-v4/utils.js +235 -0
  26. package/dist/commands/push.js +1 -1
  27. package/dist/commands/update.js +2 -2
  28. package/dist/index.js +18 -44
  29. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/array.js +18 -0
  30. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/base.js +180 -0
  31. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/character.js +8 -0
  32. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/css.js +12 -0
  33. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/json.js +60 -0
  34. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/line.js +37 -0
  35. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/sentence.js +31 -0
  36. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/diff/word.js +118 -0
  37. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/index.js +11 -0
  38. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/patch/create.js +141 -0
  39. package/dist/node_modules/.pnpm/diff@8.0.3/node_modules/diff/libesm/util/string.js +63 -0
  40. package/dist/utils/ci-environment.js +1 -1
  41. package/dist/utils/config.js +1 -1
  42. package/dist/utils/environment-loader.js +1 -1
  43. package/dist/utils/file-finder.js +1 -1
  44. package/dist/utils/mcp-runner.js +1 -1
  45. package/dist/utils/profile-config.js +1 -1
  46. package/dist/utils/profiles/profile-manager.js +1 -1
  47. package/dist/utils/project-directory.js +1 -1
  48. package/dist/utils/project-loader.js +1 -1
  49. package/dist/utils/version-check.js +6 -15
  50. package/package.json +5 -7
  51. package/dist/commands/pull-v3/component-updater.js +0 -768
  52. package/dist/commands/pull-v3/components/agent-generator.js +0 -255
  53. package/dist/commands/pull-v3/components/artifact-component-generator.js +0 -143
  54. package/dist/commands/pull-v3/components/context-config-generator.js +0 -190
  55. package/dist/commands/pull-v3/components/credential-generator.js +0 -89
  56. package/dist/commands/pull-v3/components/data-component-generator.js +0 -102
  57. package/dist/commands/pull-v3/components/environment-generator.js +0 -173
  58. package/dist/commands/pull-v3/components/external-agent-generator.js +0 -75
  59. package/dist/commands/pull-v3/components/function-tool-generator.js +0 -92
  60. package/dist/commands/pull-v3/components/mcp-tool-generator.js +0 -86
  61. package/dist/commands/pull-v3/components/project-generator.js +0 -157
  62. package/dist/commands/pull-v3/components/status-component-generator.js +0 -92
  63. package/dist/commands/pull-v3/components/sub-agent-generator.js +0 -295
  64. package/dist/commands/pull-v3/components/trigger-generator.js +0 -185
  65. package/dist/commands/pull-v3/index.js +0 -510
  66. package/dist/commands/pull-v3/introspect-generator.js +0 -286
  67. package/dist/commands/pull-v3/llm-content-merger.js +0 -192
  68. package/dist/commands/pull-v3/new-component-generator.js +0 -279
  69. package/dist/commands/pull-v3/project-comparator.js +0 -914
  70. package/dist/commands/pull-v3/project-index-generator.js +0 -32
  71. package/dist/commands/pull-v3/project-validator.js +0 -358
  72. package/dist/commands/pull-v3/targeted-typescript-placeholders.js +0 -173
  73. package/dist/commands/pull-v3/utils/component-tracker.js +0 -165
  74. package/dist/commands/pull-v3/utils/generator-utils.js +0 -146
  75. package/dist/commands/pull-v3/utils/model-provider-detector.js +0 -50
  76. package/dist/utils/url.js +0 -26
@@ -1,165 +0,0 @@
1
- //#region src/commands/pull-v3/utils/component-tracker.ts
2
- var ComponentTracker = class {
3
- components = /* @__PURE__ */ new Map();
4
- usedNames = /* @__PURE__ */ new Set();
5
- /**
6
- * Register a component in the tracker
7
- */
8
- register(info) {
9
- const uniqueName = this.ensureUniqueName(info.name, info.type);
10
- const uniqueExportName = this.ensureUniqueName(info.exportName, info.type);
11
- const updatedInfo = {
12
- ...info,
13
- name: uniqueName,
14
- exportName: uniqueExportName
15
- };
16
- this.components.set(info.id, updatedInfo);
17
- this.usedNames.add(uniqueName);
18
- this.usedNames.add(uniqueExportName);
19
- }
20
- /**
21
- * Ensure a variable name is unique across the project
22
- */
23
- ensureUniqueName(baseName, type) {
24
- let uniqueName = baseName;
25
- let counter = 1;
26
- while (this.usedNames.has(uniqueName)) {
27
- if (counter === 1) uniqueName = `${this.getTypePrefix(type)}${baseName.charAt(0).toUpperCase() + baseName.slice(1)}`;
28
- else uniqueName = `${baseName}${counter}`;
29
- counter++;
30
- if (counter > 100) {
31
- uniqueName = `${baseName}_${Date.now()}`;
32
- break;
33
- }
34
- }
35
- return uniqueName;
36
- }
37
- /**
38
- * Get type prefix for uniqueness resolution
39
- */
40
- getTypePrefix(type) {
41
- switch (type) {
42
- case "agent": return "agent";
43
- case "subAgent": return "sub";
44
- case "externalAgent": return "ext";
45
- case "tool": return "tool";
46
- case "functionTool": return "func";
47
- case "dataComponent": return "data";
48
- case "artifactComponent": return "artifact";
49
- case "credential": return "cred";
50
- case "statusComponent": return "status";
51
- case "contextConfig": return "context";
52
- default: return "comp";
53
- }
54
- }
55
- /**
56
- * Get component info by ID
57
- */
58
- get(id) {
59
- return this.components.get(id);
60
- }
61
- /**
62
- * Check if component exists
63
- */
64
- has(id) {
65
- return this.components.has(id);
66
- }
67
- /**
68
- * Get all components of a specific type
69
- */
70
- getByType(type) {
71
- return Array.from(this.components.values()).filter((c) => c.type === type);
72
- }
73
- /**
74
- * Extract IDs from mixed array (objects with id property or strings)
75
- */
76
- extractIds(references) {
77
- if (!Array.isArray(references)) return [];
78
- return references.map((ref) => {
79
- if (typeof ref === "string") return ref;
80
- if (typeof ref === "object" && ref) {
81
- if (ref.id) return ref.id;
82
- if (ref.type) return ref.type;
83
- if (ref.name) return ref.name;
84
- console.warn("ComponentTracker: Skipping reference without clear ID:", ref);
85
- return null;
86
- }
87
- return null;
88
- }).filter(Boolean);
89
- }
90
- /**
91
- * Resolve references to import statements and variable names
92
- */
93
- resolveReferences(references, currentFilePath) {
94
- const ids = this.extractIds(references);
95
- const imports = [];
96
- const variableNames = [];
97
- for (const id of ids) {
98
- const component = this.get(id);
99
- if (component) {
100
- const importPath = this.getRelativeImportPath(currentFilePath, component.filePath);
101
- imports.push(`import { ${component.exportName} } from '${importPath}';`);
102
- variableNames.push(component.name);
103
- } else variableNames.push(id);
104
- }
105
- return {
106
- imports,
107
- variableNames
108
- };
109
- }
110
- /**
111
- * Generate formatted array of variable names for code generation
112
- */
113
- formatReferencesForCode(references, style, indentLevel) {
114
- const ids = this.extractIds(references);
115
- const variableNames = [];
116
- for (const id of ids) {
117
- const component = this.get(id);
118
- if (component) variableNames.push(component.name);
119
- else variableNames.push(id);
120
- }
121
- if (variableNames.length === 0) return "[]";
122
- const { indentation } = style;
123
- const indent = indentation.repeat(indentLevel);
124
- if (variableNames.length === 1) return `[${variableNames[0]}]`;
125
- const lines = ["["];
126
- for (const name of variableNames) lines.push(`${indent}${name},`);
127
- if (lines.length > 1 && lines[lines.length - 1].endsWith(",")) lines[lines.length - 1] = lines[lines.length - 1].slice(0, -1);
128
- lines.push(`${indentation.repeat(indentLevel - 1)}]`);
129
- return lines.join("\n");
130
- }
131
- /**
132
- * Calculate relative import path between files
133
- */
134
- getRelativeImportPath(fromPath, toPath) {
135
- const fromParts = fromPath.replace(".ts", "").split("/");
136
- const toParts = toPath.replace(".ts", "").split("/");
137
- fromParts.pop();
138
- let relativePath = "";
139
- for (let i = 0; i < fromParts.length; i++) relativePath += "../";
140
- relativePath += toParts.join("/");
141
- if (relativePath.startsWith("../")) return relativePath;
142
- return `./${relativePath}`;
143
- }
144
- /**
145
- * Get all components as a list
146
- */
147
- getAllComponents() {
148
- return Array.from(this.components.values());
149
- }
150
- /**
151
- * Clear all registered components
152
- */
153
- clear() {
154
- this.components.clear();
155
- }
156
- };
157
- /**
158
- * Convert kebab-case or snake_case to camelCase
159
- */
160
- function toCamelCase(str) {
161
- return str.toLowerCase().replace(/[-_](.)/g, (_, char) => char.toUpperCase()).replace(/[^a-zA-Z0-9]/g, "").replace(/^[0-9]/, "_$&");
162
- }
163
-
164
- //#endregion
165
- export { ComponentTracker, toCamelCase };
@@ -1,146 +0,0 @@
1
- //#region src/commands/pull-v3/utils/generator-utils.ts
2
- const DEFAULT_STYLE = {
3
- quotes: "single",
4
- semicolons: true,
5
- indentation: " "
6
- };
7
- /**
8
- * Convert kebab-case or snake_case to camelCase for variable names
9
- */
10
- function toCamelCase(str) {
11
- const result = str.replace(/[-_](.)/g, (_, char) => char.toUpperCase()).replace(/[^a-zA-Z0-9]/g, "").replace(/^[0-9]/, "_$&");
12
- return result.charAt(0).toLowerCase() + result.slice(1);
13
- }
14
- /**
15
- * Format a string value with proper quoting and multiline handling
16
- */
17
- function formatString(str, quote = "'", multiline = false) {
18
- if (!str && str !== "") return `${quote}${quote}`;
19
- if (multiline && (str.includes("\n") || str.length > 80)) return `\`${str.replace(/`/g, "\\`")}\``;
20
- return `${quote}${str.replace(new RegExp(quote, "g"), `\\${quote}`)}${quote}`;
21
- }
22
- /**
23
- * Check if a string contains template variables like {{user.name}}
24
- */
25
- function hasTemplateVariables(str) {
26
- return /\{\{[^}]+\}\}/.test(str);
27
- }
28
- /**
29
- * Determine if a variable path exists in headers schema
30
- */
31
- function isHeadersVariable(variablePath, contextConfigData) {
32
- if (!contextConfigData?.headersSchema?.schema) return false;
33
- const schemaStr = JSON.stringify(contextConfigData.headersSchema.schema);
34
- return schemaStr.includes(`"${variablePath}"`) || schemaStr.includes(variablePath.split(".")[0]);
35
- }
36
- /**
37
- * Determine if a variable path exists in context variables
38
- */
39
- function isContextVariable(variablePath, contextConfigData) {
40
- if (!contextConfigData?.contextVariables) return false;
41
- const topLevelVar = variablePath.split(".")[0];
42
- return Object.keys(contextConfigData.contextVariables).includes(topLevelVar);
43
- }
44
- /**
45
- * Format prompt strings with appropriate context.toTemplate() or headers.toTemplate() based on actual schema structure
46
- */
47
- function formatPromptWithContext(str, contextVarName, headersVarName, contextConfigData, quote = "'", multiline = false) {
48
- if (!str && str !== "") return `${quote}${quote}`;
49
- if (hasTemplateVariables(str)) return `\`${str.replace(/\{\{([^}]+)\}\}/g, (_match, variablePath) => {
50
- if (isContextVariable(variablePath, contextConfigData)) return `\${${contextVarName}.toTemplate("${variablePath}")}`;
51
- if (isHeadersVariable(variablePath, contextConfigData)) return `\${${headersVarName}.toTemplate("${variablePath}")}`;
52
- return `\${${contextVarName}.toTemplate("${variablePath}")}`;
53
- }).replace(/`/g, "\\`")}\``;
54
- return formatString(str, quote, multiline);
55
- }
56
- /**
57
- * Format prompt strings with headers.toTemplate() only (for backwards compatibility)
58
- */
59
- function formatPromptWithHeaders(str, headersVarName, quote = "'", multiline = false) {
60
- if (!str && str !== "") return `${quote}${quote}`;
61
- if (hasTemplateVariables(str)) return `\`${str.replace(/\{\{([^}]+)\}\}/g, `\${${headersVarName}.toTemplate("$1")}`).replace(/`/g, "\\`")}\``;
62
- return formatString(str, quote, multiline);
63
- }
64
- /**
65
- * Format array of references (tools, agents, components) with proper indentation
66
- */
67
- function formatReferencesArray(references, style, indentLevel) {
68
- let refArray;
69
- if (Array.isArray(references)) refArray = references.map((item) => {
70
- if (typeof item === "string") return toCamelCase(item);
71
- if (typeof item === "object" && item && item.id) return toCamelCase(item.id);
72
- return toCamelCase(String(item));
73
- });
74
- else if (references && typeof references === "object") refArray = Object.keys(references).map((key) => toCamelCase(key));
75
- else return "[]";
76
- if (!refArray || refArray.length === 0) return "[]";
77
- const { indentation } = style;
78
- const indent = indentation.repeat(indentLevel);
79
- if (refArray.length === 1) return `[${refArray[0]}]`;
80
- const lines = ["["];
81
- for (const ref of refArray) lines.push(`${indent}${ref},`);
82
- if (lines.length > 1 && lines[lines.length - 1].endsWith(",")) lines[lines.length - 1] = lines[lines.length - 1].slice(0, -1);
83
- lines.push(`${indentation.repeat(indentLevel - 1)}]`);
84
- return lines.join("\n");
85
- }
86
- /**
87
- * Format object properties as JavaScript object literal
88
- */
89
- function formatObject(obj, style, indentLevel) {
90
- if (!obj || typeof obj !== "object") return "{}";
91
- const { quotes, indentation } = style;
92
- const q = quotes === "single" ? "'" : "\"";
93
- const indent = indentation.repeat(indentLevel);
94
- const lines = ["{"];
95
- for (const [key, value] of Object.entries(obj)) {
96
- if (value === null || value === void 0) continue;
97
- const formattedKey = /^[a-zA-Z_$][a-zA-Z0-9_$]*$/.test(key) ? key : formatString(key, q);
98
- if (typeof value === "string") lines.push(`${indent}${formattedKey}: ${formatString(value, q)},`);
99
- else if (typeof value === "object") lines.push(`${indent}${formattedKey}: ${formatObject(value, style, indentLevel + 1)},`);
100
- else lines.push(`${indent}${formattedKey}: ${JSON.stringify(value)},`);
101
- }
102
- if (lines.length > 1 && lines[lines.length - 1].endsWith(",")) lines[lines.length - 1] = lines[lines.length - 1].slice(0, -1);
103
- lines.push(`${indentation.repeat(indentLevel - 1)}}`);
104
- return lines.join("\n");
105
- }
106
- /**
107
- * Remove trailing comma from the last line in an array of lines
108
- */
109
- function removeTrailingComma(lines) {
110
- if (lines.length > 0 && lines[lines.length - 1].endsWith(",")) lines[lines.length - 1] = lines[lines.length - 1].slice(0, -1);
111
- }
112
- /**
113
- * Generate standard import statement with proper quoting and semicolons
114
- */
115
- function generateImport(imports, from, style) {
116
- const { quotes, semicolons } = style;
117
- const q = quotes === "single" ? "'" : "\"";
118
- const semi = semicolons ? ";" : "";
119
- if (imports.length === 1) return `import { ${imports[0]} } from ${q}${from}${q}${semi}`;
120
- return `import { ${imports.join(", ")} } from ${q}${from}${q}${semi}`;
121
- }
122
- /**
123
- * Check if a value is truthy and should be included in output
124
- */
125
- function shouldInclude(value) {
126
- if (value === null || value === void 0) return false;
127
- if (Array.isArray(value) && value.length === 0) return false;
128
- if (typeof value === "object" && Object.keys(value).length === 0) return false;
129
- return true;
130
- }
131
- /**
132
- * Generate complete file content with imports and definitions
133
- */
134
- function generateFileContent(imports, definitions) {
135
- const content = [];
136
- if (imports.length > 0) content.push(imports.join("\n"));
137
- if (definitions.length > 0) {
138
- if (content.length > 0) content.push("");
139
- content.push(definitions.join("\n\n"));
140
- }
141
- content.push("");
142
- return content.join("\n");
143
- }
144
-
145
- //#endregion
146
- export { DEFAULT_STYLE, formatObject, formatPromptWithContext, formatPromptWithHeaders, formatReferencesArray, formatString, generateFileContent, generateImport, hasTemplateVariables, removeTrailingComma, shouldInclude, toCamelCase };
@@ -1,50 +0,0 @@
1
- import { anthropic } from "@ai-sdk/anthropic";
2
- import { google } from "@ai-sdk/google";
3
- import { openai } from "@ai-sdk/openai";
4
-
5
- //#region src/commands/pull-v3/utils/model-provider-detector.ts
6
- /**
7
- * Model Provider Detector - Detect available API keys and select appropriate models
8
- */
9
- const PROVIDER_CONFIGS = [
10
- {
11
- name: "anthropic",
12
- envVars: ["ANTHROPIC_API_KEY"],
13
- model: "claude-sonnet-4-5"
14
- },
15
- {
16
- name: "openai",
17
- envVars: ["OPENAI_API_KEY"],
18
- model: "gpt-5.1"
19
- },
20
- {
21
- name: "google",
22
- envVars: ["GOOGLE_GENERATIVE_AI_API_KEY"],
23
- model: "gemini-2.5-flash"
24
- },
25
- {
26
- name: "azure",
27
- envVars: ["AZURE_API_KEY"],
28
- model: ""
29
- }
30
- ];
31
- /**
32
- * Get a model instance for LLM content merging
33
- * Returns first available provider or throws if none available
34
- */
35
- function getAvailableModel() {
36
- for (const config of PROVIDER_CONFIGS) if (config.envVars.some((envVar) => {
37
- const value = process.env[envVar];
38
- return value && value.trim() !== "";
39
- })) switch (config.name) {
40
- case "anthropic": return anthropic(config.model);
41
- case "openai": return openai(config.model);
42
- case "google": return google(config.model);
43
- case "azure": continue;
44
- default: throw new Error(`Unknown provider: ${config.name}`);
45
- }
46
- throw new Error("No API keys detected. Please set ANTHROPIC_API_KEY, OPENAI_API_KEY, GOOGLE_GENERATIVE_AI_API_KEY, or AZURE_API_KEY");
47
- }
48
-
49
- //#endregion
50
- export { getAvailableModel };
package/dist/utils/url.js DELETED
@@ -1,26 +0,0 @@
1
- //#region src/utils/url.ts
2
- /**
3
- * Normalizes a base URL by removing trailing slashes and validating format
4
- * @param url The URL to normalize
5
- * @returns The normalized URL
6
- * @throws Error if URL is invalid
7
- */
8
- function normalizeBaseUrl(url) {
9
- const trimmedUrl = url.trim();
10
- if (!trimmedUrl.match(/^https?:\/\//i)) throw new Error(`Invalid URL format: ${url}. Must start with http:// or https://`);
11
- return trimmedUrl.replace(/\/+$/, "");
12
- }
13
- /**
14
- * Constructs an agent view URL for the management UI
15
- * @param manageUiUrl The base management UI URL
16
- * @param tenantId The tenant ID
17
- * @param projectId The project ID
18
- * @param agentId The agent ID
19
- * @returns The complete agent view URL
20
- */
21
- function buildAgentViewUrl(manageUiUrl, tenantId, projectId, agentId) {
22
- return `${normalizeBaseUrl(manageUiUrl || "http://localhost:3000")}/${tenantId}/projects/${projectId}/agents/${agentId}`;
23
- }
24
-
25
- //#endregion
26
- export { buildAgentViewUrl, normalizeBaseUrl };