@inkeep/agents-cli 0.21.1 → 0.22.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.
- package/dist/index.js +379 -59
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -234088,10 +234088,10 @@ function maskSensitiveConfig(config) {
|
|
|
234088
234088
|
if (!config) return config;
|
|
234089
234089
|
const masked = { ...config };
|
|
234090
234090
|
if (masked.agentsManageApiKey) {
|
|
234091
|
-
masked.agentsManageApiKey =
|
|
234091
|
+
masked.agentsManageApiKey = `***${masked.agentsManageApiKey.slice(-4)}`;
|
|
234092
234092
|
}
|
|
234093
234093
|
if (masked.agentsRunApiKey) {
|
|
234094
|
-
masked.agentsRunApiKey =
|
|
234094
|
+
masked.agentsRunApiKey = `***${masked.agentsRunApiKey.slice(-4)}`;
|
|
234095
234095
|
}
|
|
234096
234096
|
return masked;
|
|
234097
234097
|
}
|
|
@@ -234535,6 +234535,9 @@ function isJsonSchemaPath(path3) {
|
|
|
234535
234535
|
if (path3.includes("dataComponents") && path3.endsWith("props")) {
|
|
234536
234536
|
return true;
|
|
234537
234537
|
}
|
|
234538
|
+
if (path3.includes("statusComponents") && path3.endsWith("detailsSchema")) {
|
|
234539
|
+
return true;
|
|
234540
|
+
}
|
|
234538
234541
|
return false;
|
|
234539
234542
|
}
|
|
234540
234543
|
function updateTracker(tracker, placeholder, value) {
|
|
@@ -234613,7 +234616,7 @@ function restorePlaceholders(generatedCode, replacements) {
|
|
|
234613
234616
|
const sortedPlaceholders = Object.keys(replacements).sort((a, b2) => b2.length - a.length);
|
|
234614
234617
|
for (const placeholder of sortedPlaceholders) {
|
|
234615
234618
|
let originalValue = replacements[placeholder];
|
|
234616
|
-
originalValue = originalValue.replace(/`/g, "\\`");
|
|
234619
|
+
originalValue = originalValue.replace(/\\/g, "\\\\").replace(/`/g, "\\`").replace(/\$\{/g, "\\${");
|
|
234617
234620
|
const escapedPlaceholder = placeholder.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
234618
234621
|
const regex = new RegExp(escapedPlaceholder, "g");
|
|
234619
234622
|
restoredCode = restoredCode.replace(regex, originalValue);
|
|
@@ -234653,6 +234656,7 @@ __export(pull_llm_generate_exports, {
|
|
|
234653
234656
|
generateDataComponentFile: () => generateDataComponentFile,
|
|
234654
234657
|
generateEnvironmentFiles: () => generateEnvironmentFiles,
|
|
234655
234658
|
generateIndexFile: () => generateIndexFile,
|
|
234659
|
+
generateStatusComponentFile: () => generateStatusComponentFile,
|
|
234656
234660
|
generateTextWithPlaceholders: () => generateTextWithPlaceholders,
|
|
234657
234661
|
generateToolFile: () => generateToolFile,
|
|
234658
234662
|
generateTypeScriptFileWithLLM: () => generateTypeScriptFileWithLLM,
|
|
@@ -234818,22 +234822,48 @@ ${NAMING_CONVENTION_RULES}
|
|
|
234818
234822
|
${IMPORT_INSTRUCTIONS}
|
|
234819
234823
|
|
|
234820
234824
|
REQUIREMENTS:
|
|
234821
|
-
1.
|
|
234825
|
+
1. IMPORTS (CRITICAL):
|
|
234826
|
+
- ALWAYS import { agent, subAgent } from '@inkeep/agents-sdk'
|
|
234827
|
+
- ALWAYS import { z } from 'zod' when using ANY Zod schemas (responseSchema, headersSchema, etc.)
|
|
234828
|
+
- ALWAYS import { contextConfig, fetchDefinition, headers } from '@inkeep/agents-core' when agent has contextConfig
|
|
234829
|
+
- Import status components from '../status-components/' when needed
|
|
234822
234830
|
2. Define each agent using the agent() function following the type definitions provided above
|
|
234823
234831
|
3. Create the agent using agent() with proper structure
|
|
234824
234832
|
- IMPORTANT: If description is null, undefined, or empty string, omit the description field entirely
|
|
234825
|
-
4. CRITICAL:
|
|
234826
|
-
-
|
|
234827
|
-
-
|
|
234833
|
+
4. CRITICAL: Template Literals vs Raw Code:
|
|
234834
|
+
- For STRING VALUES: ALWAYS use template literals with backticks: \`string content\`
|
|
234835
|
+
- This includes: prompt, description, query, url, method, body, defaultValue, etc.
|
|
234836
|
+
- This prevents TypeScript syntax errors with apostrophes (user's, don't, etc.)
|
|
234828
234837
|
- IMPORTANT: ANY placeholder that starts with < and ends with > MUST be wrapped in template literals (backticks)
|
|
234829
|
-
-
|
|
234830
|
-
|
|
234831
|
-
-
|
|
234832
|
-
-
|
|
234838
|
+
- For object keys: use quotes only for keys with hyphens ('Content-Type'), omit for simple identifiers (Authorization)
|
|
234839
|
+
|
|
234840
|
+
EXCEPTION - Schema Fields (NO template literals):
|
|
234841
|
+
- headersSchema: z.object({ ... }) (raw Zod code, NOT a string)
|
|
234842
|
+
- responseSchema: z.object({ ... }) (raw Zod code, NOT a string)
|
|
234843
|
+
- These are TypeScript expressions, not string values
|
|
234844
|
+
|
|
234845
|
+
Examples:
|
|
234846
|
+
\u2705 prompt: \`You are a helpful assistant.\` (string value, use backticks)
|
|
234847
|
+
\u2705 query: \`query GetData { field }\` (string value, use backticks)
|
|
234848
|
+
\u2705 responseSchema: z.object({ name: z.string() }) (Zod code, NO backticks)
|
|
234849
|
+
\u2705 headersSchema: z.object({ 'inkeep_api_key': z.string() }) (Zod code, NO backticks)
|
|
234850
|
+
\u274C responseSchema: \`z.object({ name: z.string() })\` (WRONG - don't wrap Zod in backticks)
|
|
234851
|
+
|
|
234833
234852
|
- convert template literals to use the appropriate headers schema or context config toTemplate method. a template literal is a substring that starts with {{ and ends with }}.
|
|
234834
234853
|
- if you see a template literal with {{headers.}}, convert it to use the headers schema toTemplate method.
|
|
234835
234854
|
- if you see a template literal with {{contextVariableKey.field_name}}, convert it to use the context config toTemplate method.
|
|
234836
|
-
|
|
234855
|
+
5. For contextConfig (CRITICAL):
|
|
234856
|
+
- NEVER use plain objects for contextConfig
|
|
234857
|
+
- ALWAYS use helper functions: headers(), fetchDefinition(), contextConfig()
|
|
234858
|
+
- Create separate const variables for each helper before the agent definition
|
|
234859
|
+
- Pattern: const myHeaders = headers({ schema: z.object({ api_key: z.string() }) });
|
|
234860
|
+
- Pattern: const myFetch = fetchDefinition({ id: '...', fetchConfig: {...}, responseSchema: z.object({...}) });
|
|
234861
|
+
- Pattern: const myContext = contextConfig({ headers: myHeaders, contextVariables: { data: myFetch } });
|
|
234862
|
+
- Then use: export const myAgent = agent({ contextConfig: myContext });
|
|
234863
|
+
- Use myHeaders.toTemplate('key_name') for header interpolation in fetch configs
|
|
234864
|
+
- Use myContext.toTemplate('variable.field') for context variable interpolation
|
|
234865
|
+
|
|
234866
|
+
7. If you are writing zod schemas make them clean. For example if you see z.union([z.string(), z.null()]) write it as z.string().nullable()
|
|
234837
234867
|
|
|
234838
234868
|
PLACEHOLDER HANDLING EXAMPLES:
|
|
234839
234869
|
// CORRECT - Placeholder wrapped in template literals:
|
|
@@ -234848,6 +234878,8 @@ import { contextConfig, fetchDefinition, headers } from '@inkeep/agents-core';
|
|
|
234848
234878
|
import { userProfile } from '../data-components/user-profile';
|
|
234849
234879
|
import { searchTool } from '../tools/search-tool';
|
|
234850
234880
|
import { weatherTool } from '../tools/weather-tool';
|
|
234881
|
+
import { toolSummary } from '../status-components/tool-summary';
|
|
234882
|
+
import { progressStatus } from '../status-components/progress-status';
|
|
234851
234883
|
import { z } from 'zod';
|
|
234852
234884
|
|
|
234853
234885
|
const supportAgentHeaders = headers({
|
|
@@ -234912,7 +234944,16 @@ export const supportAgent = agent({
|
|
|
234912
234944
|
name: 'Support Agent',
|
|
234913
234945
|
description: 'Multi-agent support system', // Only include if description has a value
|
|
234914
234946
|
defaultSubAgent: routerAgent,
|
|
234915
|
-
subAgents: () => [routerAgent, qaAgent]
|
|
234947
|
+
subAgents: () => [routerAgent, qaAgent],
|
|
234948
|
+
models: {
|
|
234949
|
+
base: { model: 'gpt-4' },
|
|
234950
|
+
summarizer: { model: 'gpt-4' },
|
|
234951
|
+
},
|
|
234952
|
+
statusUpdates: {
|
|
234953
|
+
numEvents: 3,
|
|
234954
|
+
timeInSeconds: 15,
|
|
234955
|
+
statusComponents: [toolSummary.config, progressStatus.config],
|
|
234956
|
+
},
|
|
234916
234957
|
});
|
|
234917
234958
|
|
|
234918
234959
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
@@ -235196,6 +235237,75 @@ Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
|
235196
235237
|
});
|
|
235197
235238
|
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
235198
235239
|
}
|
|
235240
|
+
async function generateStatusComponentFile(componentData, componentId, outputPath, modelSettings) {
|
|
235241
|
+
const model = createModel(modelSettings);
|
|
235242
|
+
const promptTemplate = `Generate a TypeScript file for an Inkeep status component.
|
|
235243
|
+
|
|
235244
|
+
STATUS COMPONENT DATA:
|
|
235245
|
+
{{DATA}}
|
|
235246
|
+
|
|
235247
|
+
COMPONENT ID: ${componentId}
|
|
235248
|
+
|
|
235249
|
+
${getTypeDefinitions()}
|
|
235250
|
+
|
|
235251
|
+
${NAMING_CONVENTION_RULES}
|
|
235252
|
+
|
|
235253
|
+
${IMPORT_INSTRUCTIONS}
|
|
235254
|
+
|
|
235255
|
+
REQUIREMENTS:
|
|
235256
|
+
1. Import statusComponent from '@inkeep/agents-sdk'
|
|
235257
|
+
2. Import z from 'zod' for schema definitions
|
|
235258
|
+
3. Create the status component using statusComponent()
|
|
235259
|
+
4. Export following naming convention rules (camelCase version of ID)
|
|
235260
|
+
5. Use 'type' field as the identifier (like 'tool_summary')
|
|
235261
|
+
6. CRITICAL: All imports must be alphabetically sorted to comply with Biome linting
|
|
235262
|
+
7. If you are writing zod schemas make them clean. For example if you see z.union([z.string(), z.null()]) write it as z.string().nullable()
|
|
235263
|
+
8. The statusComponent() function handles conversion to .config automatically
|
|
235264
|
+
|
|
235265
|
+
EXAMPLE:
|
|
235266
|
+
import { statusComponent } from '@inkeep/agents-sdk';
|
|
235267
|
+
import { z } from 'zod';
|
|
235268
|
+
|
|
235269
|
+
export const toolSummary = statusComponent({
|
|
235270
|
+
type: 'tool_summary',
|
|
235271
|
+
description: 'Summary of tool calls and their purpose',
|
|
235272
|
+
detailsSchema: z.object({
|
|
235273
|
+
tool_name: z.string().describe('Name of tool used'),
|
|
235274
|
+
summary: z.string().describe('What was discovered or accomplished'),
|
|
235275
|
+
}),
|
|
235276
|
+
});
|
|
235277
|
+
|
|
235278
|
+
EXAMPLE WITH HYPHEN TYPE:
|
|
235279
|
+
import { statusComponent } from '@inkeep/agents-sdk';
|
|
235280
|
+
import { z } from 'zod';
|
|
235281
|
+
|
|
235282
|
+
// Component type 'search-progress' becomes export name 'searchProgress'
|
|
235283
|
+
export const searchProgress = statusComponent({
|
|
235284
|
+
type: 'search-progress',
|
|
235285
|
+
description: 'Progress of search operation',
|
|
235286
|
+
detailsSchema: z.object({
|
|
235287
|
+
query: z.string().describe('Search query being executed'),
|
|
235288
|
+
results_found: z.number().describe('Number of results found'),
|
|
235289
|
+
time_elapsed: z.number().optional().describe('Time elapsed in milliseconds'),
|
|
235290
|
+
}),
|
|
235291
|
+
});
|
|
235292
|
+
|
|
235293
|
+
EXAMPLE WITHOUT DETAILS SCHEMA:
|
|
235294
|
+
import { statusComponent } from '@inkeep/agents-sdk';
|
|
235295
|
+
|
|
235296
|
+
export const simpleStatus = statusComponent({
|
|
235297
|
+
type: 'simple_status',
|
|
235298
|
+
description: 'A simple status with no additional details',
|
|
235299
|
+
});
|
|
235300
|
+
|
|
235301
|
+
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
235302
|
+
const text2 = await generateTextWithPlaceholders(model, componentData, promptTemplate, {
|
|
235303
|
+
temperature: 0.1,
|
|
235304
|
+
maxOutputTokens: 4e3,
|
|
235305
|
+
abortSignal: AbortSignal.timeout(6e4)
|
|
235306
|
+
});
|
|
235307
|
+
writeFileSync3(outputPath, cleanGeneratedCode(text2));
|
|
235308
|
+
}
|
|
235199
235309
|
async function generateEnvironmentFiles(environmentsDir, credentials, environment = "development") {
|
|
235200
235310
|
const generateCredentialCode = (cred) => {
|
|
235201
235311
|
const params = [
|
|
@@ -235642,6 +235752,18 @@ function collectAllEntities(projectData) {
|
|
|
235642
235752
|
entities.push({ id: compId, type: "artifactComponent" });
|
|
235643
235753
|
}
|
|
235644
235754
|
}
|
|
235755
|
+
if (projectData.agents) {
|
|
235756
|
+
for (const [_agentId, agentData] of Object.entries(projectData.agents)) {
|
|
235757
|
+
const agentObj = agentData;
|
|
235758
|
+
if (agentObj.statusUpdates?.statusComponents) {
|
|
235759
|
+
for (const statusComp of agentObj.statusUpdates.statusComponents) {
|
|
235760
|
+
if (statusComp.type) {
|
|
235761
|
+
entities.push({ id: statusComp.type, type: "statusComponent" });
|
|
235762
|
+
}
|
|
235763
|
+
}
|
|
235764
|
+
}
|
|
235765
|
+
}
|
|
235766
|
+
}
|
|
235645
235767
|
if (projectData.credentialReferences) {
|
|
235646
235768
|
for (const credId of Object.keys(projectData.credentialReferences)) {
|
|
235647
235769
|
entities.push({ id: credId, type: "credential" });
|
|
@@ -235661,6 +235783,7 @@ var init_variable_name_registry = __esm({
|
|
|
235661
235783
|
// Usually no suffix needed
|
|
235662
235784
|
dataComponentSuffix: null,
|
|
235663
235785
|
artifactComponentSuffix: null,
|
|
235786
|
+
statusComponentSuffix: null,
|
|
235664
235787
|
credentialSuffix: null
|
|
235665
235788
|
};
|
|
235666
235789
|
VariableNameGenerator = class {
|
|
@@ -235674,6 +235797,7 @@ var init_variable_name_registry = __esm({
|
|
|
235674
235797
|
tools: /* @__PURE__ */ new Map(),
|
|
235675
235798
|
dataComponents: /* @__PURE__ */ new Map(),
|
|
235676
235799
|
artifactComponents: /* @__PURE__ */ new Map(),
|
|
235800
|
+
statusComponents: /* @__PURE__ */ new Map(),
|
|
235677
235801
|
credentials: /* @__PURE__ */ new Map(),
|
|
235678
235802
|
usedNames: /* @__PURE__ */ new Map()
|
|
235679
235803
|
};
|
|
@@ -235785,6 +235909,8 @@ var init_variable_name_registry = __esm({
|
|
|
235785
235909
|
return this.conventions.dataComponentSuffix || "";
|
|
235786
235910
|
case "artifactComponent":
|
|
235787
235911
|
return this.conventions.artifactComponentSuffix || "";
|
|
235912
|
+
case "statusComponent":
|
|
235913
|
+
return this.conventions.statusComponentSuffix || "";
|
|
235788
235914
|
case "credential":
|
|
235789
235915
|
return this.conventions.credentialSuffix || "";
|
|
235790
235916
|
default:
|
|
@@ -235806,6 +235932,8 @@ var init_variable_name_registry = __esm({
|
|
|
235806
235932
|
return this.registry.dataComponents;
|
|
235807
235933
|
case "artifactComponent":
|
|
235808
235934
|
return this.registry.artifactComponents;
|
|
235935
|
+
case "statusComponent":
|
|
235936
|
+
return this.registry.statusComponents;
|
|
235809
235937
|
case "credential":
|
|
235810
235938
|
return this.registry.credentials;
|
|
235811
235939
|
default:
|
|
@@ -236120,6 +236248,7 @@ function displayPlanSummary(plan) {
|
|
|
236120
236248
|
tool: [],
|
|
236121
236249
|
dataComponent: [],
|
|
236122
236250
|
artifactComponent: [],
|
|
236251
|
+
statusComponent: [],
|
|
236123
236252
|
environment: []
|
|
236124
236253
|
};
|
|
236125
236254
|
for (const file of plan.files) {
|
|
@@ -236172,6 +236301,15 @@ function displayPlanSummary(plan) {
|
|
|
236172
236301
|
}
|
|
236173
236302
|
}
|
|
236174
236303
|
}
|
|
236304
|
+
if (filesByType.statusComponent.length > 0) {
|
|
236305
|
+
console.log(chalk7.gray("\n Status Components:"));
|
|
236306
|
+
for (const file of filesByType.statusComponent) {
|
|
236307
|
+
console.log(chalk7.gray(` \u2022 ${file.path}`));
|
|
236308
|
+
for (const entity of file.entities) {
|
|
236309
|
+
console.log(chalk7.gray(` - ${entity.variableName}`));
|
|
236310
|
+
}
|
|
236311
|
+
}
|
|
236312
|
+
}
|
|
236175
236313
|
if (filesByType.environment.length > 0) {
|
|
236176
236314
|
console.log(chalk7.gray("\n Environments:"));
|
|
236177
236315
|
for (const file of filesByType.environment) {
|
|
@@ -236193,7 +236331,9 @@ function displayPatternSummary(patterns) {
|
|
|
236193
236331
|
console.log(chalk7.gray(` \u2022 Agent suffix: "${patterns.namingConventions.agentSuffix}"`));
|
|
236194
236332
|
console.log(chalk7.gray(` \u2022 SubAgent suffix: "${patterns.namingConventions.subAgentSuffix}"`));
|
|
236195
236333
|
if (patterns.examples.mappings && patterns.examples.mappings.length > 0) {
|
|
236196
|
-
console.log(
|
|
236334
|
+
console.log(
|
|
236335
|
+
chalk7.gray(` Found ${patterns.examples.mappings.length} existing variable mappings`)
|
|
236336
|
+
);
|
|
236197
236337
|
}
|
|
236198
236338
|
}
|
|
236199
236339
|
function displayRecommendedPattern() {
|
|
@@ -236300,10 +236440,7 @@ async function generatePlan(projectData, patterns, modelSettings, createModel2)
|
|
|
236300
236440
|
nameGenerator.generateVariableName(entity.id, entity.type);
|
|
236301
236441
|
}
|
|
236302
236442
|
const model = createModel2(modelSettings);
|
|
236303
|
-
const promptTemplate = createPlanningPromptTemplate(
|
|
236304
|
-
nameGenerator.getRegistry(),
|
|
236305
|
-
allEntities
|
|
236306
|
-
);
|
|
236443
|
+
const promptTemplate = createPlanningPromptTemplate(nameGenerator.getRegistry(), allEntities);
|
|
236307
236444
|
const promptData = {
|
|
236308
236445
|
projectData,
|
|
236309
236446
|
patterns
|
|
@@ -236353,28 +236490,42 @@ CRITICAL RULES:
|
|
|
236353
236490
|
1. TOOL TYPES - VERY IMPORTANT:
|
|
236354
236491
|
- **Function Tools** (type: "function"): ALWAYS define INLINE within agent files using "inlineContent" array
|
|
236355
236492
|
- **MCP Tools** (type: "mcp"): Create separate files in tools/ directory
|
|
236356
|
-
- VALID FILE TYPES: Only use these exact types: "agent", "tool", "dataComponent", "artifactComponent", "environment", "index"
|
|
236493
|
+
- VALID FILE TYPES: Only use these exact types: "agent", "tool", "dataComponent", "artifactComponent", "statusComponent", "environment", "index"
|
|
236357
236494
|
- NEVER create file type "functionTool" - function tools go in "inlineContent" of agent files
|
|
236358
236495
|
|
|
236359
|
-
2.
|
|
236496
|
+
2. STATUS COMPONENTS - VERY IMPORTANT:
|
|
236497
|
+
- **Status Components**: ALWAYS create separate files in status-components/ directory
|
|
236498
|
+
- Status components are found in agent.statusUpdates.statusComponents array
|
|
236499
|
+
- Each status component should get its own file
|
|
236500
|
+
- Agents must import status components from status-components/ directory
|
|
236501
|
+
- Status components are NEVER inlined in agent files
|
|
236502
|
+
|
|
236503
|
+
3. File Structure:
|
|
236360
236504
|
- If patterns show "toolsLocation": "inline", ALL tools should be in "inlineContent" of agent files
|
|
236361
236505
|
- If patterns show "toolsLocation": "separate", MCP tools get separate files, function tools still inline
|
|
236362
236506
|
- Follow the detected file naming convention (kebab-case, camelCase, or snake_case)
|
|
236363
236507
|
|
|
236364
|
-
|
|
236508
|
+
4. Variable Names:
|
|
236365
236509
|
- MUST use the exact variable names from the mappings above
|
|
236366
236510
|
- If ID "weather" is used by both agent and subAgent, they will have different variable names
|
|
236367
236511
|
- Do NOT generate new variable names - use what's provided
|
|
236368
236512
|
|
|
236369
|
-
|
|
236513
|
+
5. File Placement:
|
|
236370
236514
|
- agents/ directory: Agent files (with function tools in "inlineContent")
|
|
236371
236515
|
- tools/ directory: MCP tool files only
|
|
236372
236516
|
- data-components/ directory: Data component files
|
|
236373
236517
|
- artifact-components/ directory: Artifact component files
|
|
236518
|
+
- status-components/ directory: Status component files
|
|
236374
236519
|
- environments/ directory: Environment/credential files
|
|
236375
236520
|
- index.ts: Main project file
|
|
236376
236521
|
|
|
236377
|
-
|
|
236522
|
+
6. File Paths (CRITICAL):
|
|
236523
|
+
- Paths MUST be relative to the project root directory
|
|
236524
|
+
- DO NOT include the project name in the path
|
|
236525
|
+
- CORRECT: "agents/weather-agent.ts", "tools/inkeep-facts.ts", "status-components/tool-summary.ts"
|
|
236526
|
+
- WRONG: "my-project/agents/weather-agent.ts", "project-name/tools/inkeep-facts.ts"
|
|
236527
|
+
|
|
236528
|
+
7. Dependencies:
|
|
236378
236529
|
- Each file should list which variables it needs to import from other files
|
|
236379
236530
|
- Imports should use relative paths
|
|
236380
236531
|
- Respect detected import style (named vs default)
|
|
@@ -236429,6 +236580,20 @@ OUTPUT FORMAT (JSON):
|
|
|
236429
236580
|
"dependencies": [],
|
|
236430
236581
|
"inlineContent": null
|
|
236431
236582
|
},
|
|
236583
|
+
{
|
|
236584
|
+
"path": "status-components/tool-summary.ts",
|
|
236585
|
+
"type": "statusComponent",
|
|
236586
|
+
"entities": [
|
|
236587
|
+
{
|
|
236588
|
+
"id": "tool_summary",
|
|
236589
|
+
"variableName": "toolSummary",
|
|
236590
|
+
"entityType": "statusComponent",
|
|
236591
|
+
"exportName": "toolSummary"
|
|
236592
|
+
}
|
|
236593
|
+
],
|
|
236594
|
+
"dependencies": [],
|
|
236595
|
+
"inlineContent": null
|
|
236596
|
+
},
|
|
236432
236597
|
{
|
|
236433
236598
|
"path": "index.ts",
|
|
236434
236599
|
"type": "index",
|
|
@@ -236466,6 +236631,7 @@ function formatVariableMappings(registry2, allEntities) {
|
|
|
236466
236631
|
tool: [],
|
|
236467
236632
|
dataComponent: [],
|
|
236468
236633
|
artifactComponent: [],
|
|
236634
|
+
statusComponent: [],
|
|
236469
236635
|
credential: []
|
|
236470
236636
|
};
|
|
236471
236637
|
for (const entity of allEntities) {
|
|
@@ -236500,6 +236666,8 @@ function getRegistryMap(registry2, entityType) {
|
|
|
236500
236666
|
return registry2.dataComponents;
|
|
236501
236667
|
case "artifactComponent":
|
|
236502
236668
|
return registry2.artifactComponents;
|
|
236669
|
+
case "statusComponent":
|
|
236670
|
+
return registry2.statusComponents;
|
|
236503
236671
|
case "credential":
|
|
236504
236672
|
return registry2.credentials;
|
|
236505
236673
|
default:
|
|
@@ -236582,6 +236750,21 @@ function generateDefaultPlan(registry2) {
|
|
|
236582
236750
|
dependencies: []
|
|
236583
236751
|
});
|
|
236584
236752
|
}
|
|
236753
|
+
for (const [compId, variableName] of registry2.statusComponents.entries()) {
|
|
236754
|
+
files.push({
|
|
236755
|
+
path: `status-components/${kebabCase(compId)}.ts`,
|
|
236756
|
+
type: "statusComponent",
|
|
236757
|
+
entities: [
|
|
236758
|
+
{
|
|
236759
|
+
id: compId,
|
|
236760
|
+
variableName,
|
|
236761
|
+
entityType: "statusComponent",
|
|
236762
|
+
exportName: variableName
|
|
236763
|
+
}
|
|
236764
|
+
],
|
|
236765
|
+
dependencies: []
|
|
236766
|
+
});
|
|
236767
|
+
}
|
|
236585
236768
|
files.push({
|
|
236586
236769
|
path: "index.ts",
|
|
236587
236770
|
type: "index",
|
|
@@ -236617,14 +236800,18 @@ async function generateFilesFromPlan(plan, projectData, dirs, modelSettings, deb
|
|
|
236617
236800
|
(fileInfo, index2) => generateFile(fileInfo, projectData, plan, dirs, modelSettings, debug).then(() => {
|
|
236618
236801
|
if (debug) {
|
|
236619
236802
|
const elapsed = ((Date.now() - startTime) / 1e3).toFixed(1);
|
|
236620
|
-
console.log(
|
|
236803
|
+
console.log(
|
|
236804
|
+
`[DEBUG] \u2713 Completed ${index2 + 1}/${plan.files.length}: ${fileInfo.path} (${elapsed}s elapsed)`
|
|
236805
|
+
);
|
|
236621
236806
|
}
|
|
236622
236807
|
})
|
|
236623
236808
|
);
|
|
236624
236809
|
await Promise.all(tasks2);
|
|
236625
236810
|
const totalTime = ((Date.now() - startTime) / 1e3).toFixed(1);
|
|
236626
236811
|
if (debug) {
|
|
236627
|
-
console.log(
|
|
236812
|
+
console.log(
|
|
236813
|
+
`[DEBUG] All files generated in ${totalTime}s (${plan.files.length} files in parallel)`
|
|
236814
|
+
);
|
|
236628
236815
|
}
|
|
236629
236816
|
}
|
|
236630
236817
|
async function generateFile(fileInfo, projectData, plan, dirs, modelSettings, debug) {
|
|
@@ -236662,7 +236849,9 @@ async function generateFile(fileInfo, projectData, plan, dirs, modelSettings, de
|
|
|
236662
236849
|
writeFileSync4(outputPath, cleanedCode);
|
|
236663
236850
|
const totalDuration = ((Date.now() - fileStartTime) / 1e3).toFixed(1);
|
|
236664
236851
|
if (debug) {
|
|
236665
|
-
console.log(
|
|
236852
|
+
console.log(
|
|
236853
|
+
`[DEBUG] \u2713 Completed: ${fileInfo.path} (LLM: ${llmDuration}s, Total: ${totalDuration}s)`
|
|
236854
|
+
);
|
|
236666
236855
|
}
|
|
236667
236856
|
} catch (error) {
|
|
236668
236857
|
console.error(`[ERROR] Failed to generate ${fileInfo.path}:`, error.message);
|
|
@@ -236701,6 +236890,21 @@ function extractDataForFile(fileInfo, projectData) {
|
|
|
236701
236890
|
}
|
|
236702
236891
|
return {};
|
|
236703
236892
|
}
|
|
236893
|
+
case "statusComponent": {
|
|
236894
|
+
const statusType = fileInfo.entities[0]?.id;
|
|
236895
|
+
if (statusType && projectData.agents) {
|
|
236896
|
+
for (const agentData of Object.values(projectData.agents)) {
|
|
236897
|
+
const agent = agentData;
|
|
236898
|
+
if (agent.statusUpdates?.statusComponents) {
|
|
236899
|
+
const found = agent.statusUpdates.statusComponents.find(
|
|
236900
|
+
(sc) => sc.type === statusType
|
|
236901
|
+
);
|
|
236902
|
+
if (found) return found;
|
|
236903
|
+
}
|
|
236904
|
+
}
|
|
236905
|
+
}
|
|
236906
|
+
return {};
|
|
236907
|
+
}
|
|
236704
236908
|
case "environment":
|
|
236705
236909
|
return projectData.credentialReferences || {};
|
|
236706
236910
|
default:
|
|
@@ -236756,11 +236960,13 @@ CRITICAL RULES:
|
|
|
236756
236960
|
return createDataComponentPrompt(fileData, context, registryInfo, commonInstructions);
|
|
236757
236961
|
case "artifactComponent":
|
|
236758
236962
|
return createArtifactComponentPrompt(fileData, context, registryInfo, commonInstructions);
|
|
236963
|
+
case "statusComponent":
|
|
236964
|
+
return createStatusComponentPrompt(fileData, context, registryInfo, commonInstructions);
|
|
236759
236965
|
default:
|
|
236760
236966
|
throw new Error(`Unknown file type: ${fileInfo.type}`);
|
|
236761
236967
|
}
|
|
236762
236968
|
}
|
|
236763
|
-
function createIndexPrompt(
|
|
236969
|
+
function createIndexPrompt(_projectData, context, _registryInfo, commonInstructions) {
|
|
236764
236970
|
const importMappings = generateImportMappings(context.plan);
|
|
236765
236971
|
return `Generate index.ts for Inkeep project.
|
|
236766
236972
|
|
|
@@ -236787,7 +236993,7 @@ export const myProject = project({
|
|
|
236787
236993
|
|
|
236788
236994
|
Generate ONLY the TypeScript code without markdown.`;
|
|
236789
236995
|
}
|
|
236790
|
-
function createAgentPrompt(
|
|
236996
|
+
function createAgentPrompt(_agentData, context, _registryInfo, commonInstructions) {
|
|
236791
236997
|
const inlineTools = context.fileInfo.inlineContent || [];
|
|
236792
236998
|
const hasInlineTools = inlineTools.length > 0;
|
|
236793
236999
|
return `Generate TypeScript file for Inkeep agent.
|
|
@@ -236841,17 +237047,62 @@ const calculateBMI = functionTool({
|
|
|
236841
237047
|
` : ""}
|
|
236842
237048
|
|
|
236843
237049
|
IMPORTS (CRITICAL - MUST BE FIRST):
|
|
236844
|
-
ALWAYS import these
|
|
236845
|
-
import { agent, subAgent, functionTool } from '@inkeep/agents-sdk';
|
|
237050
|
+
ALWAYS import these at the TOP of the file:
|
|
237051
|
+
- import { agent, subAgent, functionTool } from '@inkeep/agents-sdk';
|
|
237052
|
+
- import { z } from 'zod'; (REQUIRED when using ANY Zod schemas like responseSchema, headersSchema)
|
|
237053
|
+
- import { contextConfig, fetchDefinition, headers } from '@inkeep/agents-core'; (REQUIRED when agent has contextConfig)
|
|
237054
|
+
- import status components from '../status-components/' when needed
|
|
236846
237055
|
|
|
236847
237056
|
SUBAGENT AND AGENT API (CRITICAL):
|
|
236848
237057
|
- Use 'canUse' (NOT 'tools') - must be a FUNCTION returning array
|
|
236849
237058
|
- Use 'canDelegateTo' - must be a FUNCTION returning array
|
|
236850
237059
|
- Use 'dataComponents' - must be a FUNCTION returning array
|
|
236851
237060
|
- Use 'subAgents' in agent() - must be a FUNCTION returning array
|
|
236852
|
-
|
|
237061
|
+
|
|
237062
|
+
CONTEXT CONFIG (CRITICAL - NO PLAIN OBJECTS):
|
|
237063
|
+
- NEVER use plain objects for contextConfig
|
|
237064
|
+
- ALWAYS use helper functions: headers(), fetchDefinition(), contextConfig()
|
|
237065
|
+
- Create separate const variables for each helper before the agent definition
|
|
237066
|
+
- Pattern:
|
|
237067
|
+
const myHeaders = headers({ schema: z.object({ api_key: z.string() }) });
|
|
237068
|
+
const myFetch = fetchDefinition({ id: '...', fetchConfig: {...}, responseSchema: z.object({...}) });
|
|
237069
|
+
const myContext = contextConfig({ headers: myHeaders, contextVariables: { data: myFetch } });
|
|
237070
|
+
export const myAgent = agent({ contextConfig: myContext });
|
|
237071
|
+
- Use myHeaders.toTemplate('key_name') for header values in fetchConfig
|
|
237072
|
+
- Use myContext.toTemplate('variable.field') for prompt interpolation
|
|
237073
|
+
|
|
237074
|
+
STRING LITERALS (CRITICAL - MUST FOLLOW):
|
|
237075
|
+
- For STRING VALUES: ALWAYS use template literals (backticks \`)
|
|
237076
|
+
- This includes: prompt, description, query, url, method, body, defaultValue, etc.
|
|
237077
|
+
- Template literals prevent syntax errors with apostrophes (don't, user's, it's)
|
|
237078
|
+
- For object keys that are identifiers (no hyphens), omit quotes: Authorization not 'Authorization'
|
|
237079
|
+
- For object keys with hyphens, use quotes: 'Content-Type'
|
|
237080
|
+
|
|
237081
|
+
EXCEPTION - Schema Fields (NO template literals):
|
|
237082
|
+
- headersSchema: z.object({ ... }) (raw Zod code, NOT a string)
|
|
237083
|
+
- responseSchema: z.object({ ... }) (raw Zod code, NOT a string)
|
|
237084
|
+
- These are TypeScript expressions, not string values
|
|
237085
|
+
|
|
237086
|
+
CORRECT EXAMPLES:
|
|
237087
|
+
\u2705 prompt: \`You are a helpful assistant.\` (string value)
|
|
237088
|
+
\u2705 query: \`query GetData { field }\` (string value)
|
|
237089
|
+
\u2705 responseSchema: z.object({ name: z.string() }) (Zod code, NO backticks)
|
|
237090
|
+
\u2705 headersSchema: z.object({ 'inkeep_api_key': z.string() }) (Zod code, NO backticks)
|
|
237091
|
+
|
|
237092
|
+
WRONG EXAMPLES:
|
|
237093
|
+
\u274C prompt: 'You are a helpful assistant.' (use backticks not single quotes)
|
|
237094
|
+
\u274C responseSchema: \`z.object({ name: z.string() })\` (don't wrap Zod in backticks)
|
|
237095
|
+
|
|
237096
|
+
STATUS COMPONENTS (CRITICAL):
|
|
237097
|
+
- Status components are ALWAYS imported from '../status-components/' directory
|
|
237098
|
+
- In statusUpdates.statusComponents array, use statusComponent.config to get the config object
|
|
237099
|
+
- NEVER inline status component definitions in the agent file
|
|
237100
|
+
- Example: import { toolSummary } from '../status-components/tool-summary'
|
|
237101
|
+
- Then use: statusComponents: [toolSummary.config]
|
|
236853
237102
|
|
|
236854
237103
|
\u2705 CORRECT:
|
|
237104
|
+
import { toolSummary } from '../status-components/tool-summary';
|
|
237105
|
+
|
|
236855
237106
|
const weatherSubAgent = subAgent({
|
|
236856
237107
|
id: 'weather',
|
|
236857
237108
|
name: 'Weather Sub',
|
|
@@ -236868,7 +237119,12 @@ const weatherAgent = agent({
|
|
|
236868
237119
|
id: 'weather',
|
|
236869
237120
|
name: 'Weather Agent',
|
|
236870
237121
|
defaultSubAgent: weatherSubAgent,
|
|
236871
|
-
subAgents: () => [weatherSubAgent] // FUNCTION returning array
|
|
237122
|
+
subAgents: () => [weatherSubAgent], // FUNCTION returning array
|
|
237123
|
+
statusUpdates: {
|
|
237124
|
+
numEvents: 1,
|
|
237125
|
+
timeInSeconds: 1,
|
|
237126
|
+
statusComponents: [toolSummary.config] // Use .config
|
|
237127
|
+
}
|
|
236872
237128
|
});
|
|
236873
237129
|
|
|
236874
237130
|
\u274C WRONG:
|
|
@@ -236877,10 +237133,11 @@ string', // NO - use backticks for multi-line
|
|
|
236877
237133
|
tools: [tool1, tool2], // NO - use 'canUse' not 'tools'
|
|
236878
237134
|
canUse: [tool1, tool2], // NO - must be a function
|
|
236879
237135
|
subAgents: [weatherSubAgent], // NO - must be a function
|
|
237136
|
+
statusComponents: [{ type: '...', ... }], // NO - import from files
|
|
236880
237137
|
|
|
236881
237138
|
Generate ONLY the TypeScript code without markdown.`;
|
|
236882
237139
|
}
|
|
236883
|
-
function createToolPrompt(
|
|
237140
|
+
function createToolPrompt(_toolData, _context, _registryInfo, commonInstructions) {
|
|
236884
237141
|
return `Generate TypeScript file for Inkeep tool.
|
|
236885
237142
|
|
|
236886
237143
|
TOOL DATA:
|
|
@@ -236896,7 +237153,7 @@ REQUIREMENTS:
|
|
|
236896
237153
|
|
|
236897
237154
|
Generate ONLY the TypeScript code without markdown.`;
|
|
236898
237155
|
}
|
|
236899
|
-
function createDataComponentPrompt(
|
|
237156
|
+
function createDataComponentPrompt(_componentData, _context, _registryInfo, commonInstructions) {
|
|
236900
237157
|
return `Generate TypeScript file for Inkeep data component.
|
|
236901
237158
|
|
|
236902
237159
|
COMPONENT DATA:
|
|
@@ -236952,7 +237209,7 @@ REQUIREMENTS:
|
|
|
236952
237209
|
|
|
236953
237210
|
Generate ONLY the TypeScript code without markdown.`;
|
|
236954
237211
|
}
|
|
236955
|
-
function createArtifactComponentPrompt(
|
|
237212
|
+
function createArtifactComponentPrompt(_componentData, _context, _registryInfo, commonInstructions) {
|
|
236956
237213
|
return `Generate TypeScript file for Inkeep artifact component.
|
|
236957
237214
|
|
|
236958
237215
|
COMPONENT DATA:
|
|
@@ -236969,7 +237226,38 @@ REQUIREMENTS:
|
|
|
236969
237226
|
|
|
236970
237227
|
Generate ONLY the TypeScript code without markdown.`;
|
|
236971
237228
|
}
|
|
236972
|
-
function
|
|
237229
|
+
function createStatusComponentPrompt(_componentData, _context, _registryInfo, commonInstructions) {
|
|
237230
|
+
return `Generate TypeScript file for Inkeep status component.
|
|
237231
|
+
|
|
237232
|
+
COMPONENT DATA:
|
|
237233
|
+
{{DATA}}
|
|
237234
|
+
|
|
237235
|
+
${commonInstructions}
|
|
237236
|
+
|
|
237237
|
+
REQUIREMENTS:
|
|
237238
|
+
1. Import statusComponent from '@inkeep/agents-sdk'
|
|
237239
|
+
2. Import z from 'zod' for schema definitions if detailsSchema is present
|
|
237240
|
+
3. Use exact variable name from registry
|
|
237241
|
+
4. Convert any JSON Schema in detailsSchema to Zod schema
|
|
237242
|
+
5. Use 'type' field as the identifier
|
|
237243
|
+
6. The statusComponent() function handles .config conversion automatically
|
|
237244
|
+
|
|
237245
|
+
EXAMPLE:
|
|
237246
|
+
import { statusComponent } from '@inkeep/agents-sdk';
|
|
237247
|
+
import { z } from 'zod';
|
|
237248
|
+
|
|
237249
|
+
export const toolSummary = statusComponent({
|
|
237250
|
+
type: 'tool_summary',
|
|
237251
|
+
description: 'Summary of tool calls',
|
|
237252
|
+
detailsSchema: z.object({
|
|
237253
|
+
tool_name: z.string().describe('Name of tool used'),
|
|
237254
|
+
summary: z.string().describe('What was accomplished'),
|
|
237255
|
+
}),
|
|
237256
|
+
});
|
|
237257
|
+
|
|
237258
|
+
Generate ONLY the TypeScript code without markdown.`;
|
|
237259
|
+
}
|
|
237260
|
+
function formatRegistryForFile(fileInfo, _registry) {
|
|
236973
237261
|
let result = "Entities in this file:\n";
|
|
236974
237262
|
for (const entity of fileInfo.entities) {
|
|
236975
237263
|
result += ` - ${entity.entityType} "${entity.id}" \u2192 variable: ${entity.variableName}
|
|
@@ -237635,9 +237923,7 @@ async function configGetCommand(key, options) {
|
|
|
237635
237923
|
if (!existsSync(configPath)) {
|
|
237636
237924
|
console.error(chalk2.red("No configuration file found."));
|
|
237637
237925
|
console.log(
|
|
237638
|
-
chalk2.gray(
|
|
237639
|
-
'Run "inkeep init" to create one, or specify a config file with --config'
|
|
237640
|
-
)
|
|
237926
|
+
chalk2.gray('Run "inkeep init" to create one, or specify a config file with --config')
|
|
237641
237927
|
);
|
|
237642
237928
|
process.exit(1);
|
|
237643
237929
|
}
|
|
@@ -238264,7 +238550,9 @@ async function detectCurrentProject(debug = false) {
|
|
|
238264
238550
|
if (typeof value.getId === "function") {
|
|
238265
238551
|
const projectId = value.getId();
|
|
238266
238552
|
if (debug) {
|
|
238267
|
-
console.log(
|
|
238553
|
+
console.log(
|
|
238554
|
+
chalk8.gray(` \u2022 Project detected: ${projectId} (from export: ${exportKey})`)
|
|
238555
|
+
);
|
|
238268
238556
|
}
|
|
238269
238557
|
return projectId;
|
|
238270
238558
|
}
|
|
@@ -238282,7 +238570,7 @@ async function detectCurrentProject(debug = false) {
|
|
|
238282
238570
|
try {
|
|
238283
238571
|
const content = readFileSync5(indexPath, "utf-8");
|
|
238284
238572
|
const projectIdMatch = content.match(/project\s*\(\s*\{\s*id\s*:\s*['"]([^'"]+)['"]/);
|
|
238285
|
-
if (projectIdMatch
|
|
238573
|
+
if (projectIdMatch?.[1]) {
|
|
238286
238574
|
const projectId = projectIdMatch[1];
|
|
238287
238575
|
if (debug) {
|
|
238288
238576
|
console.log(chalk8.gray(` \u2022 Project ID extracted from static parse: ${projectId}`));
|
|
@@ -238315,7 +238603,7 @@ async function verifyGeneratedFiles(projectDir, originalProjectData, debug = fal
|
|
|
238315
238603
|
errors.push("index.ts does not contain a project() call");
|
|
238316
238604
|
}
|
|
238317
238605
|
const projectIdMatch = indexContent.match(/project\s*\(\s*\{\s*id\s*:\s*['"]([^'"]+)['"]/);
|
|
238318
|
-
if (projectIdMatch
|
|
238606
|
+
if (projectIdMatch?.[1]) {
|
|
238319
238607
|
const extractedProjectId = projectIdMatch[1];
|
|
238320
238608
|
if (extractedProjectId !== originalProjectData.id) {
|
|
238321
238609
|
warnings.push(
|
|
@@ -238332,31 +238620,36 @@ async function verifyGeneratedFiles(projectDir, originalProjectData, debug = fal
|
|
|
238332
238620
|
const agentsDir = join9(projectDir, "agents");
|
|
238333
238621
|
const expectedAgents = Object.keys(originalProjectData.agents || {});
|
|
238334
238622
|
for (const agentId of expectedAgents) {
|
|
238335
|
-
const
|
|
238623
|
+
const kebabCaseId = agentId.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
238624
|
+
const agentPath = join9(agentsDir, `${kebabCaseId}.ts`);
|
|
238336
238625
|
if (!existsSync8(agentPath)) {
|
|
238337
|
-
errors.push(`Agent file not found: agents/${
|
|
238626
|
+
errors.push(`Agent file not found: agents/${kebabCaseId}.ts`);
|
|
238338
238627
|
} else if (debug) {
|
|
238339
|
-
console.log(chalk8.gray(` \u2713 Agent file exists: agents/${
|
|
238628
|
+
console.log(chalk8.gray(` \u2713 Agent file exists: agents/${kebabCaseId}.ts`));
|
|
238340
238629
|
}
|
|
238341
238630
|
}
|
|
238342
238631
|
const toolsDir = join9(projectDir, "tools");
|
|
238343
238632
|
const expectedTools = Object.keys(originalProjectData.tools || {});
|
|
238344
238633
|
for (const toolId of expectedTools) {
|
|
238345
|
-
const
|
|
238634
|
+
const kebabCaseId = toolId.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
238635
|
+
const toolPath = join9(toolsDir, `${kebabCaseId}.ts`);
|
|
238346
238636
|
if (!existsSync8(toolPath)) {
|
|
238347
|
-
errors.push(`Tool file not found: tools/${
|
|
238637
|
+
errors.push(`Tool file not found: tools/${kebabCaseId}.ts`);
|
|
238348
238638
|
} else if (debug) {
|
|
238349
|
-
console.log(chalk8.gray(` \u2713 Tool file exists: tools/${
|
|
238639
|
+
console.log(chalk8.gray(` \u2713 Tool file exists: tools/${kebabCaseId}.ts`));
|
|
238350
238640
|
}
|
|
238351
238641
|
}
|
|
238352
238642
|
const dataComponentsDir = join9(projectDir, "data-components");
|
|
238353
238643
|
const expectedDataComponents = Object.keys(originalProjectData.dataComponents || {});
|
|
238354
238644
|
for (const componentId of expectedDataComponents) {
|
|
238355
|
-
const
|
|
238645
|
+
const kebabCaseId = componentId.replace(/([a-z])([A-Z])/g, "$1-$2").replace(/[\s_]+/g, "-").toLowerCase();
|
|
238646
|
+
const componentPath = join9(dataComponentsDir, `${kebabCaseId}.ts`);
|
|
238356
238647
|
if (!existsSync8(componentPath)) {
|
|
238357
|
-
errors.push(`Data component file not found: data-components/${
|
|
238648
|
+
errors.push(`Data component file not found: data-components/${kebabCaseId}.ts`);
|
|
238358
238649
|
} else if (debug) {
|
|
238359
|
-
console.log(
|
|
238650
|
+
console.log(
|
|
238651
|
+
chalk8.gray(` \u2713 Data component file exists: data-components/${kebabCaseId}.ts`)
|
|
238652
|
+
);
|
|
238360
238653
|
}
|
|
238361
238654
|
}
|
|
238362
238655
|
const environmentsDir = join9(projectDir, "environments");
|
|
@@ -238382,8 +238675,12 @@ async function verifyGeneratedFiles(projectDir, originalProjectData, debug = fal
|
|
|
238382
238675
|
if (debug) {
|
|
238383
238676
|
console.log(chalk8.gray("\n\u{1F50D} Verification Summary:"));
|
|
238384
238677
|
console.log(chalk8.gray(` \u2022 index.ts: ${existsSync8(indexPath) ? "\u2713" : "\u2717"}`));
|
|
238385
|
-
console.log(
|
|
238386
|
-
|
|
238678
|
+
console.log(
|
|
238679
|
+
chalk8.gray(` \u2022 Agent files: ${expectedAgents.length}/${expectedAgents.length} found`)
|
|
238680
|
+
);
|
|
238681
|
+
console.log(
|
|
238682
|
+
chalk8.gray(` \u2022 Tool files: ${expectedTools.length}/${expectedTools.length} found`)
|
|
238683
|
+
);
|
|
238387
238684
|
console.log(
|
|
238388
238685
|
chalk8.gray(
|
|
238389
238686
|
` \u2022 Data component files: ${expectedDataComponents.length}/${expectedDataComponents.length} found`
|
|
@@ -238439,12 +238736,14 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
|
|
|
238439
238736
|
const toolsDir = join9(projectRoot, "tools");
|
|
238440
238737
|
const dataComponentsDir = join9(projectRoot, "data-components");
|
|
238441
238738
|
const artifactComponentsDir = join9(projectRoot, "artifact-components");
|
|
238739
|
+
const statusComponentsDir = join9(projectRoot, "status-components");
|
|
238442
238740
|
const environmentsDir = join9(projectRoot, "environments");
|
|
238443
238741
|
ensureDirectoryExists(projectRoot);
|
|
238444
238742
|
ensureDirectoryExists(agentsDir);
|
|
238445
238743
|
ensureDirectoryExists(toolsDir);
|
|
238446
238744
|
ensureDirectoryExists(dataComponentsDir);
|
|
238447
238745
|
ensureDirectoryExists(artifactComponentsDir);
|
|
238746
|
+
ensureDirectoryExists(statusComponentsDir);
|
|
238448
238747
|
ensureDirectoryExists(environmentsDir);
|
|
238449
238748
|
return {
|
|
238450
238749
|
projectRoot,
|
|
@@ -238452,6 +238751,7 @@ function createProjectStructure(projectDir, projectId, useCurrentDirectory = fal
|
|
|
238452
238751
|
toolsDir,
|
|
238453
238752
|
dataComponentsDir,
|
|
238454
238753
|
artifactComponentsDir,
|
|
238754
|
+
statusComponentsDir,
|
|
238455
238755
|
environmentsDir
|
|
238456
238756
|
};
|
|
238457
238757
|
}
|
|
@@ -238628,6 +238928,11 @@ async function pullProjectCommand(options) {
|
|
|
238628
238928
|
}, 0);
|
|
238629
238929
|
const dataComponentCount = Object.keys(projectData.dataComponents || {}).length;
|
|
238630
238930
|
const artifactComponentCount = Object.keys(projectData.artifactComponents || {}).length;
|
|
238931
|
+
const statusComponentCount = Object.values(projectData.agents || {}).reduce((total, agent) => {
|
|
238932
|
+
const agentObj = agent;
|
|
238933
|
+
const statusComponents = agentObj.statusUpdates?.statusComponents || [];
|
|
238934
|
+
return total + statusComponents.length;
|
|
238935
|
+
}, 0);
|
|
238631
238936
|
console.log(chalk8.cyan("\n\u{1F4CA} Project Summary:"));
|
|
238632
238937
|
console.log(chalk8.gray(` \u2022 Name: ${projectData.name}`));
|
|
238633
238938
|
console.log(chalk8.gray(` \u2022 Description: ${projectData.description || "No description"}`));
|
|
@@ -238640,6 +238945,9 @@ async function pullProjectCommand(options) {
|
|
|
238640
238945
|
if (artifactComponentCount > 0) {
|
|
238641
238946
|
console.log(chalk8.gray(` \u2022 Artifact Components: ${artifactComponentCount}`));
|
|
238642
238947
|
}
|
|
238948
|
+
if (statusComponentCount > 0) {
|
|
238949
|
+
console.log(chalk8.gray(` \u2022 Status Components: ${statusComponentCount}`));
|
|
238950
|
+
}
|
|
238643
238951
|
const credentialReferences2 = projectData.credentialReferences || {};
|
|
238644
238952
|
const credentialCount = Object.keys(credentialReferences2).length;
|
|
238645
238953
|
if (credentialCount > 0) {
|
|
@@ -238738,13 +239046,19 @@ async function pullProjectCommand(options) {
|
|
|
238738
239046
|
if (options.debug) {
|
|
238739
239047
|
console.log(chalk8.gray("\n\u{1F4CD} Plan saved to .inkeep/generation-plan.json"));
|
|
238740
239048
|
}
|
|
239049
|
+
const statusComponentsCount = Object.values(projectData.agents || {}).reduce((total, agent) => {
|
|
239050
|
+
const agentObj = agent;
|
|
239051
|
+
const statusComponents = agentObj.statusUpdates?.statusComponents || [];
|
|
239052
|
+
return total + statusComponents.length;
|
|
239053
|
+
}, 0);
|
|
238741
239054
|
const fileCount = {
|
|
238742
239055
|
agents: Object.keys(projectData.agents || {}).length,
|
|
238743
239056
|
tools: Object.keys(projectData.tools || {}).length,
|
|
238744
239057
|
dataComponents: Object.keys(projectData.dataComponents || {}).length,
|
|
238745
|
-
artifactComponents: Object.keys(projectData.artifactComponents || {}).length
|
|
239058
|
+
artifactComponents: Object.keys(projectData.artifactComponents || {}).length,
|
|
239059
|
+
statusComponents: statusComponentsCount
|
|
238746
239060
|
};
|
|
238747
|
-
const totalFiles = fileCount.agents + fileCount.tools + fileCount.dataComponents + fileCount.artifactComponents + 5;
|
|
239061
|
+
const totalFiles = fileCount.agents + fileCount.tools + fileCount.dataComponents + fileCount.artifactComponents + fileCount.statusComponents + 5;
|
|
238748
239062
|
spinner.succeed(`Project files generated (${totalFiles} files created)`);
|
|
238749
239063
|
spinner.start("Verifying generated files...");
|
|
238750
239064
|
try {
|
|
@@ -238801,6 +239115,9 @@ async function pullProjectCommand(options) {
|
|
|
238801
239115
|
if (fileCount.artifactComponents > 0) {
|
|
238802
239116
|
console.log(chalk8.gray(` \u251C\u2500\u2500 artifact-components/ (${fileCount.artifactComponents} files)`));
|
|
238803
239117
|
}
|
|
239118
|
+
if (fileCount.statusComponents > 0) {
|
|
239119
|
+
console.log(chalk8.gray(` \u251C\u2500\u2500 status-components/ (${fileCount.statusComponents} files)`));
|
|
239120
|
+
}
|
|
238804
239121
|
console.log(chalk8.gray(" \u2514\u2500\u2500 environments/ (4 files)"));
|
|
238805
239122
|
console.log(chalk8.cyan("\n\u{1F4DD} Next steps:"));
|
|
238806
239123
|
console.log(chalk8.gray(` \u2022 cd ${dirs.projectRoot}`));
|
|
@@ -238964,9 +239281,12 @@ async function pushCommand(options) {
|
|
|
238964
239281
|
console.log(chalk9.gray(` \u2022 Size: ${JSON.stringify(projectDefinition).length} bytes`));
|
|
238965
239282
|
const agentCount = Object.keys(projectDefinition.agents || {}).length;
|
|
238966
239283
|
const toolCount = Object.keys(projectDefinition.tools || {}).length;
|
|
238967
|
-
const subAgentCount = Object.values(projectDefinition.agents || {}).reduce(
|
|
238968
|
-
|
|
238969
|
-
|
|
239284
|
+
const subAgentCount = Object.values(projectDefinition.agents || {}).reduce(
|
|
239285
|
+
(total, agent) => {
|
|
239286
|
+
return total + Object.keys(agent.subAgents || {}).length;
|
|
239287
|
+
},
|
|
239288
|
+
0
|
|
239289
|
+
);
|
|
238970
239290
|
console.log(chalk9.cyan("\n\u{1F4CA} Project Data Summary:"));
|
|
238971
239291
|
console.log(chalk9.gray(` \u2022 Agent: ${agentCount}`));
|
|
238972
239292
|
console.log(chalk9.gray(` \u2022 Tools: ${toolCount}`));
|
|
@@ -239088,7 +239408,7 @@ program.command("chat [agent-id]").description(
|
|
|
239088
239408
|
const config = options.config || options.configFilePath;
|
|
239089
239409
|
await chatCommandEnhanced2(agentId, { ...options, config });
|
|
239090
239410
|
});
|
|
239091
|
-
program.command("list-agent").description("List all available
|
|
239411
|
+
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) => {
|
|
239092
239412
|
const config = options.config || options.configFilePath;
|
|
239093
239413
|
await listAgentsCommand({ ...options, config });
|
|
239094
239414
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.22.0",
|
|
4
4
|
"description": "Inkeep CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -46,8 +46,8 @@
|
|
|
46
46
|
"recast": "^0.23.0",
|
|
47
47
|
"ts-morph": "^26.0.0",
|
|
48
48
|
"tsx": "^4.20.5",
|
|
49
|
-
"@inkeep/agents-core": "^0.
|
|
50
|
-
"@inkeep/agents-sdk": "^0.
|
|
49
|
+
"@inkeep/agents-core": "^0.22.0",
|
|
50
|
+
"@inkeep/agents-sdk": "^0.22.0"
|
|
51
51
|
},
|
|
52
52
|
"devDependencies": {
|
|
53
53
|
"@types/degit": "^2.8.6",
|