@inkeep/agents-cli 0.14.9 → 0.14.10
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 +245 -207
- package/package.json +3 -2
package/dist/index.js
CHANGED
|
@@ -5,10 +5,16 @@ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
|
5
5
|
var __getOwnPropNames = Object.getOwnPropertyNames;
|
|
6
6
|
var __getProtoOf = Object.getPrototypeOf;
|
|
7
7
|
var __hasOwnProp = Object.prototype.hasOwnProperty;
|
|
8
|
+
var __require = /* @__PURE__ */ ((x2) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x2, {
|
|
9
|
+
get: (a, b2) => (typeof require !== "undefined" ? require : a)[b2]
|
|
10
|
+
}) : x2)(function(x2) {
|
|
11
|
+
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
12
|
+
throw Error('Dynamic require of "' + x2 + '" is not supported');
|
|
13
|
+
});
|
|
8
14
|
var __esm = (fn, res) => function __init() {
|
|
9
15
|
return fn && (res = (0, fn[__getOwnPropNames(fn)[0]])(fn = 0)), res;
|
|
10
16
|
};
|
|
11
|
-
var __commonJS = (cb, mod) => function
|
|
17
|
+
var __commonJS = (cb, mod) => function __require2() {
|
|
12
18
|
return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
|
|
13
19
|
};
|
|
14
20
|
var __export = (target, all) => {
|
|
@@ -2246,7 +2252,7 @@ var init_schemas = __esm({
|
|
|
2246
2252
|
});
|
|
2247
2253
|
ModelSettingsSchema = z.object({
|
|
2248
2254
|
model: z.string().optional(),
|
|
2249
|
-
providerOptions: z.record(z.string(), z.
|
|
2255
|
+
providerOptions: z.record(z.string(), z.any()).optional()
|
|
2250
2256
|
});
|
|
2251
2257
|
ModelSchema = z.object({
|
|
2252
2258
|
base: ModelSettingsSchema.optional(),
|
|
@@ -21330,7 +21336,7 @@ ${error.message}`
|
|
|
21330
21336
|
var env2 = parseEnv2();
|
|
21331
21337
|
|
|
21332
21338
|
// src/index.ts
|
|
21333
|
-
import { readFileSync as
|
|
21339
|
+
import { readFileSync as readFileSync4 } from "fs";
|
|
21334
21340
|
import { dirname as dirname5, join as join10 } from "path";
|
|
21335
21341
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
21336
21342
|
import { Command } from "commander";
|
|
@@ -21966,7 +21972,7 @@ ${table.toString()}`);
|
|
|
21966
21972
|
// src/commands/pull.ts
|
|
21967
21973
|
init_esm_shims();
|
|
21968
21974
|
init_api();
|
|
21969
|
-
import { existsSync as existsSync6, mkdirSync, readFileSync as
|
|
21975
|
+
import { existsSync as existsSync6, mkdirSync, readFileSync as readFileSync3, writeFileSync as writeFileSync4 } from "fs";
|
|
21970
21976
|
import { dirname as dirname4, join as join7, resolve as resolve4 } from "path";
|
|
21971
21977
|
import chalk7 from "chalk";
|
|
21972
21978
|
import ora5 from "ora";
|
|
@@ -22011,7 +22017,7 @@ init_tsx_loader();
|
|
|
22011
22017
|
|
|
22012
22018
|
// src/commands/pull.llm-generate.ts
|
|
22013
22019
|
init_esm_shims();
|
|
22014
|
-
import { writeFileSync as writeFileSync3 } from "fs";
|
|
22020
|
+
import { readFileSync as readFileSync2, writeFileSync as writeFileSync3 } from "fs";
|
|
22015
22021
|
import { join as join6 } from "path";
|
|
22016
22022
|
import { anthropic, createAnthropic } from "@ai-sdk/anthropic";
|
|
22017
22023
|
import { createOpenAI, openai } from "@ai-sdk/openai";
|
|
@@ -22113,6 +22119,28 @@ function calculateTokenSavings(originalData, processedData) {
|
|
|
22113
22119
|
}
|
|
22114
22120
|
|
|
22115
22121
|
// src/commands/pull.llm-generate.ts
|
|
22122
|
+
function getTypeDefinitions() {
|
|
22123
|
+
try {
|
|
22124
|
+
const sdkPackagePath = __require.resolve("@inkeep/agents-sdk/package.json");
|
|
22125
|
+
const sdkPackageDir = join6(sdkPackagePath, "..");
|
|
22126
|
+
const sdkDtsPath = join6(sdkPackageDir, "dist/index.d.ts");
|
|
22127
|
+
const dtsContent = readFileSync2(sdkDtsPath, "utf-8");
|
|
22128
|
+
return `
|
|
22129
|
+
TYPESCRIPT TYPE DEFINITIONS (from @inkeep/agents-sdk):
|
|
22130
|
+
|
|
22131
|
+
The following is the complete type definition file from '@inkeep/agents-sdk'.
|
|
22132
|
+
|
|
22133
|
+
---START OF TYPE DEFINITIONS---
|
|
22134
|
+
${dtsContent}
|
|
22135
|
+
---END OF TYPE DEFINITIONS---
|
|
22136
|
+
`;
|
|
22137
|
+
} catch (error) {
|
|
22138
|
+
console.warn("Could not read type definitions:", error);
|
|
22139
|
+
return `
|
|
22140
|
+
// Type definitions from @inkeep/agents-sdk could not be loaded.
|
|
22141
|
+
`;
|
|
22142
|
+
}
|
|
22143
|
+
}
|
|
22116
22144
|
function createModel(config) {
|
|
22117
22145
|
if (!config.model) {
|
|
22118
22146
|
throw new Error("Model configuration is required for pull command");
|
|
@@ -22137,16 +22165,160 @@ function createModel(config) {
|
|
|
22137
22165
|
throw new Error(`Unsupported provider: ${provider}`);
|
|
22138
22166
|
}
|
|
22139
22167
|
}
|
|
22168
|
+
var PROJECT_JSON_EXAMPLE = `
|
|
22169
|
+
---START OF PROJECT JSON EXAMPLE---
|
|
22170
|
+
{
|
|
22171
|
+
"id": "my-project",
|
|
22172
|
+
"name": "My Project",
|
|
22173
|
+
"description": "test test",
|
|
22174
|
+
"models": {
|
|
22175
|
+
"base": {
|
|
22176
|
+
"model": "anthropic/claude-opus-4-1-20250805",
|
|
22177
|
+
"providerOptions": {
|
|
22178
|
+
"temperature": 0.7,
|
|
22179
|
+
"maxTokens": 2096
|
|
22180
|
+
}
|
|
22181
|
+
},
|
|
22182
|
+
"structuredOutput": {
|
|
22183
|
+
"model": "openai/gpt-4.1-mini-2025-04-14",
|
|
22184
|
+
"providerOptions": {
|
|
22185
|
+
"temperature": 0.4,
|
|
22186
|
+
"maxTokens": 2048
|
|
22187
|
+
}
|
|
22188
|
+
},
|
|
22189
|
+
"summarizer": {
|
|
22190
|
+
"model": "openai/gpt-5-nano-2025-08-07",
|
|
22191
|
+
"providerOptions": {
|
|
22192
|
+
"temperature": 0.8,
|
|
22193
|
+
"maxTokens": 1024
|
|
22194
|
+
}
|
|
22195
|
+
}
|
|
22196
|
+
},
|
|
22197
|
+
"stopWhen": {
|
|
22198
|
+
"transferCountIs": 10,
|
|
22199
|
+
"stepCountIs": 24
|
|
22200
|
+
},
|
|
22201
|
+
"graphs": {
|
|
22202
|
+
"customer-service": {
|
|
22203
|
+
"id": "customer-service",
|
|
22204
|
+
"name": "customer-service",
|
|
22205
|
+
"description": "respond to customer service requests",
|
|
22206
|
+
"defaultAgentId": "router",
|
|
22207
|
+
"agents": {
|
|
22208
|
+
"refund-agent": {
|
|
22209
|
+
"id": "refund-agent",
|
|
22210
|
+
"name": "Refund Agent",
|
|
22211
|
+
"description": "This agent is responsible for refunding customer orders",
|
|
22212
|
+
"prompt": "Refund customer orders based on the following criteria:
|
|
22213
|
+
- Order is under $100
|
|
22214
|
+
- Order was placed in the last 30 days
|
|
22215
|
+
- Customer has no other refunds in the last 30 days",
|
|
22216
|
+
"models": {
|
|
22217
|
+
"base": {
|
|
22218
|
+
"model": "google/gemini-2.5-flash"
|
|
22219
|
+
}
|
|
22220
|
+
},
|
|
22221
|
+
"stopWhen": {
|
|
22222
|
+
"stepCountIs": 24
|
|
22223
|
+
},
|
|
22224
|
+
"canTransferTo": ["router"],
|
|
22225
|
+
"canDelegateTo": [],
|
|
22226
|
+
"dataComponents": [],
|
|
22227
|
+
"artifactComponents": [],
|
|
22228
|
+
"canUse": []
|
|
22229
|
+
},
|
|
22230
|
+
"router": {
|
|
22231
|
+
"id": "router",
|
|
22232
|
+
"name": "Router",
|
|
22233
|
+
"description": "Routing incoming requests",
|
|
22234
|
+
"prompt": "You route incoming requests to the correect agent",
|
|
22235
|
+
"models": null,
|
|
22236
|
+
"stopWhen": {
|
|
22237
|
+
"stepCountIs": 24
|
|
22238
|
+
},
|
|
22239
|
+
"canTransferTo": ["refund-agent"],
|
|
22240
|
+
"canDelegateTo": [],
|
|
22241
|
+
"dataComponents": [],
|
|
22242
|
+
"artifactComponents": [],
|
|
22243
|
+
"canUse": []
|
|
22244
|
+
}
|
|
22245
|
+
},
|
|
22246
|
+
"createdAt": "2025-10-05T16:40:22.655Z",
|
|
22247
|
+
"updatedAt": "2025-10-05T16:43:26.813Z",
|
|
22248
|
+
"models": {
|
|
22249
|
+
"base": {
|
|
22250
|
+
"model": "anthropic/claude-sonnet-4-20250514",
|
|
22251
|
+
"providerOptions": {
|
|
22252
|
+
"temperature": 0.5
|
|
22253
|
+
}
|
|
22254
|
+
}
|
|
22255
|
+
},
|
|
22256
|
+
"statusUpdates": {
|
|
22257
|
+
"numEvents": 10,
|
|
22258
|
+
"timeInSeconds": 13
|
|
22259
|
+
},
|
|
22260
|
+
"stopWhen": {
|
|
22261
|
+
"transferCountIs": 5
|
|
22262
|
+
}
|
|
22263
|
+
}
|
|
22264
|
+
},
|
|
22265
|
+
"tools": {},
|
|
22266
|
+
"dataComponents": {
|
|
22267
|
+
"listorders": {
|
|
22268
|
+
"id": "listorders",
|
|
22269
|
+
"name": "ListOrders",
|
|
22270
|
+
"description": "Display a list of customer orders",
|
|
22271
|
+
"props": {
|
|
22272
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
22273
|
+
"type": "object",
|
|
22274
|
+
"description": "An object containing a list of orders.",
|
|
22275
|
+
"properties": {
|
|
22276
|
+
"orders": {
|
|
22277
|
+
"type": "array",
|
|
22278
|
+
"description": "A list of order objects.",
|
|
22279
|
+
"items": {
|
|
22280
|
+
"type": "object",
|
|
22281
|
+
"description": "An individual order with identifying and creation details.",
|
|
22282
|
+
"properties": {
|
|
22283
|
+
"id": {
|
|
22284
|
+
"type": "string",
|
|
22285
|
+
"description": "Unique identifier for the order."
|
|
22286
|
+
},
|
|
22287
|
+
"name": {
|
|
22288
|
+
"type": "string",
|
|
22289
|
+
"description": "Human-readable name or label for the order."
|
|
22290
|
+
},
|
|
22291
|
+
"createdAt": {
|
|
22292
|
+
"type": "string",
|
|
22293
|
+
"format": "date-time",
|
|
22294
|
+
"description": "Timestamp when the order was created, in ISO 8601 format."
|
|
22295
|
+
}
|
|
22296
|
+
},
|
|
22297
|
+
"required": ["id", "name", "createdAt"]
|
|
22298
|
+
}
|
|
22299
|
+
}
|
|
22300
|
+
},
|
|
22301
|
+
"required": ["orders"]
|
|
22302
|
+
}
|
|
22303
|
+
}
|
|
22304
|
+
},
|
|
22305
|
+
"artifactComponents": {},
|
|
22306
|
+
"credentialReferences": {},
|
|
22307
|
+
"createdAt": "2025-10-05T16:25:10.238Z",
|
|
22308
|
+
"updatedAt": "2025-10-05T16:27:27.777Z"
|
|
22309
|
+
}
|
|
22310
|
+
---END OF PROJECT JSON EXAMPLE---
|
|
22311
|
+
`;
|
|
22140
22312
|
var NAMING_CONVENTION_RULES = `
|
|
22141
22313
|
CRITICAL NAMING CONVENTION RULES (Apply to ALL imports/exports):
|
|
22142
|
-
- File
|
|
22143
|
-
-
|
|
22314
|
+
- File names ALWAYS use the exact original ID. IDs are made of file safe characters (e.g., '../tools/inkeep_facts', '../data-components/user-profile')
|
|
22315
|
+
- Name of consts and variables, especially ones that are exported ones, MUST be camelCase versions of the ID, unless the ID is random/UUID then take it verbatim.
|
|
22144
22316
|
- Conversion rules for import/export names:
|
|
22145
22317
|
- IDs with underscores: 'inkeep_facts' \u2192 inkeepFacts
|
|
22146
22318
|
- IDs with hyphens: 'weather-api' \u2192 weatherApi
|
|
22147
22319
|
- IDs with both: 'my_weather-api' \u2192 myWeatherApi
|
|
22148
22320
|
- Random/UUID IDs: Keep as-is (e.g., 'fUI2riwrBVJ6MepT8rjx0' \u2192 fUI2riwrBVJ6MepT8rjx0)
|
|
22149
|
-
- IDs starting with uppercase: Make first letter lowercase unless it's an acronym
|
|
22321
|
+
- IDs starting with uppercase: Make first letter lowercase unless it's an acronym or random or UUID
|
|
22150
22322
|
- The ID field in the exported object keeps the original format
|
|
22151
22323
|
- Examples:
|
|
22152
22324
|
- Tool: import { inkeepFacts } from '../tools/inkeep_facts'; export const inkeepFacts = mcpTool({ id: 'inkeep_facts', ... })
|
|
@@ -22154,6 +22326,8 @@ CRITICAL NAMING CONVENTION RULES (Apply to ALL imports/exports):
|
|
|
22154
22326
|
- Graph: import { myGraph } from './graphs/my-graph'; export const myGraph = agentGraph({ id: 'my-graph', ... })
|
|
22155
22327
|
`;
|
|
22156
22328
|
var IMPORT_INSTRUCTIONS = `
|
|
22329
|
+
CRITICAL: All imports MUST be alphabetically sorted (both named imports and path names)
|
|
22330
|
+
|
|
22157
22331
|
CRITICAL IMPORT PATTERNS:
|
|
22158
22332
|
- Tools: Import from '../tools/{toolId}' (individual files)
|
|
22159
22333
|
- Data components: Import from '../data-components/{componentId}' (individual files)
|
|
@@ -22161,16 +22335,15 @@ CRITICAL IMPORT PATTERNS:
|
|
|
22161
22335
|
- Graphs: Import from './graphs/{graphId}' (individual files)
|
|
22162
22336
|
|
|
22163
22337
|
NEVER use barrel imports from directories:
|
|
22164
|
-
\u274C WRONG: import {
|
|
22338
|
+
\u274C WRONG: import { ordersList, refundApproval } from '../data-components';
|
|
22165
22339
|
\u2705 CORRECT:
|
|
22166
|
-
import {
|
|
22167
|
-
import {
|
|
22340
|
+
import { ordersList } from '../data-components/orders-list';
|
|
22341
|
+
import { refundApproval } from '../data-components/refund-approval';
|
|
22168
22342
|
|
|
22169
|
-
EXAMPLES:
|
|
22343
|
+
EXAMPLES:
|
|
22170
22344
|
// Multiple data components - each from individual file:
|
|
22171
|
-
import {
|
|
22172
|
-
import {
|
|
22173
|
-
import { fact } from '../data-components/fact';
|
|
22345
|
+
import { ordersList } from '../data-components/orders-list';
|
|
22346
|
+
import { refundApproval } from '../data-components/refund-approval';
|
|
22174
22347
|
|
|
22175
22348
|
// Tools - each from individual file:
|
|
22176
22349
|
import { inkeepFacts } from '../tools/inkeep_facts';
|
|
@@ -22227,67 +22400,35 @@ async function generateIndexFile(projectData, outputPath, modelSettings) {
|
|
|
22227
22400
|
const model = createModel(modelSettings);
|
|
22228
22401
|
const promptTemplate = `Generate a TypeScript index.ts file for an Inkeep project with the following data:
|
|
22229
22402
|
|
|
22230
|
-
PROJECT DATA:
|
|
22403
|
+
PROJECT JSON DATA:
|
|
22231
22404
|
{{DATA}}
|
|
22232
22405
|
|
|
22233
|
-
${NAMING_CONVENTION_RULES}
|
|
22234
22406
|
|
|
22235
|
-
|
|
22236
|
-
- Tools: Import from './tools/{toolId}' (individual files)
|
|
22237
|
-
- Data components: Import from './data-components/{componentId}' (individual files)
|
|
22238
|
-
- Artifact components: Import from './artifact-components/{componentId}' (individual files)
|
|
22239
|
-
- Graphs: Import from './graphs/{graphId}' (individual files)
|
|
22407
|
+
${getTypeDefinitions()}
|
|
22240
22408
|
|
|
22241
|
-
|
|
22242
|
-
|
|
22243
|
-
|
|
22244
|
-
import { ambiguity } from './data-components/ambiguity';
|
|
22245
|
-
import { fact } from './data-components/fact';
|
|
22409
|
+
${NAMING_CONVENTION_RULES}
|
|
22410
|
+
|
|
22411
|
+
${IMPORT_INSTRUCTIONS}
|
|
22246
22412
|
|
|
22247
|
-
EXAMPLES:
|
|
22248
|
-
// Multiple data components - each from individual file:
|
|
22249
|
-
import { ambiguity } from './data-components/ambiguity';
|
|
22250
|
-
import { clarifyingquestion } from './data-components/clarifyingquestion';
|
|
22251
|
-
import { fact } from './data-components/fact';
|
|
22252
22413
|
|
|
22253
22414
|
REQUIREMENTS:
|
|
22254
22415
|
1. Import the project function from '@inkeep/agents-sdk'
|
|
22255
|
-
2.
|
|
22256
|
-
|
|
22257
|
-
|
|
22258
|
-
|
|
22259
|
-
|
|
22260
|
-
|
|
22261
|
-
|
|
22262
|
-
- id: project ID
|
|
22263
|
-
- name: project name
|
|
22264
|
-
- description: project description (if provided)
|
|
22265
|
-
- models: model configuration (if provided)
|
|
22266
|
-
- stopWhen: stop configuration (if provided)
|
|
22267
|
-
- graphs: arrow function returning array of imported graphs
|
|
22268
|
-
- tools: arrow function returning array of imported tools by their IDs (if any)
|
|
22269
|
-
- dataComponents: arrow function returning array of imported data components (if any)
|
|
22270
|
-
- artifactComponents: arrow function returning array of imported artifact components (if any)
|
|
22271
|
-
|
|
22272
|
-
EXAMPLE (note: tools are imported and referenced by ID, not name):
|
|
22416
|
+
2. The project object should include all required properties and any optional properties (according to the type definitions) that are present in the project data
|
|
22417
|
+
|
|
22418
|
+
PROJECT JSON EXAMPLE:
|
|
22419
|
+
${PROJECT_JSON_EXAMPLE}
|
|
22420
|
+
|
|
22421
|
+
|
|
22422
|
+
EXAMPLE OUTPUT:
|
|
22273
22423
|
import { project } from '@inkeep/agents-sdk';
|
|
22274
|
-
import { weatherForecast } from './data-components/weather-forecast';
|
|
22275
|
-
import { basicGraph } from './graphs/basic-graph'; // Note: 'basic-graph' becomes camelCase 'basicGraph'
|
|
22276
|
-
import { myGraphId } from './graphs/my-graph-id'; // Note: 'my-graph-id' becomes camelCase 'myGraphId'
|
|
22277
|
-
import { weatherGraph } from './graphs/weather-graph';
|
|
22278
|
-
import { fUI2riwrBVJ6MepT8rjx0 } from './tools/fUI2riwrBVJ6MepT8rjx0';
|
|
22279
|
-
import { fdxgfv9HL7SXlfynPx8hf } from './tools/fdxgfv9HL7SXlfynPx8hf';
|
|
22280
22424
|
|
|
22281
|
-
export const
|
|
22282
|
-
id: '
|
|
22283
|
-
name: '
|
|
22284
|
-
description: '
|
|
22425
|
+
export const myProject = project({
|
|
22426
|
+
id: 'my-project',
|
|
22427
|
+
name: 'My Project',
|
|
22428
|
+
description: 'test test',
|
|
22285
22429
|
models: {
|
|
22286
22430
|
base: { model: 'gpt-4o-mini' }
|
|
22287
|
-
}
|
|
22288
|
-
graphs: () => [basicGraph, myGraphId, weatherGraph],
|
|
22289
|
-
tools: () => [fUI2riwrBVJ6MepT8rjx0, fdxgfv9HL7SXlfynPx8hf],
|
|
22290
|
-
dataComponents: () => [weatherForecast]
|
|
22431
|
+
}
|
|
22291
22432
|
});
|
|
22292
22433
|
|
|
22293
22434
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
@@ -22308,71 +22449,40 @@ GRAPH DATA:
|
|
|
22308
22449
|
|
|
22309
22450
|
GRAPH ID: ${graphId}
|
|
22310
22451
|
|
|
22452
|
+
${getTypeDefinitions()}
|
|
22453
|
+
|
|
22311
22454
|
IMPORTANT CONTEXT:
|
|
22312
|
-
-
|
|
22313
|
-
- Data components are imported from individual files in '../data-components' directory
|
|
22314
|
-
- Artifact components are imported from individual files in '../artifact-components' directory
|
|
22315
|
-
- CRITICAL: Tool files are named by their IDs (e.g., '../tools/fUI2riwrBVJ6MepT8rjx0')
|
|
22316
|
-
- CRITICAL: Import tools using their IDs as both file name and variable name
|
|
22317
|
-
- Agents reference these resources by their imported variable names
|
|
22455
|
+
- Agents reference resources (tools, components) by their imported variable names
|
|
22318
22456
|
- The 'tools' field in agents contains tool IDs that must match the imported variable names
|
|
22319
22457
|
|
|
22320
22458
|
${NAMING_CONVENTION_RULES}
|
|
22321
22459
|
|
|
22460
|
+
${IMPORT_INSTRUCTIONS}
|
|
22461
|
+
|
|
22322
22462
|
REQUIREMENTS:
|
|
22323
|
-
1. Import { agent, agentGraph } from '@inkeep/agents-sdk'
|
|
22324
|
-
2.
|
|
22325
|
-
3.
|
|
22326
|
-
4. Import artifact components from '../artifact-components/{componentId}' following naming convention rules
|
|
22327
|
-
5. Define each agent using the agent() function with:
|
|
22328
|
-
- id, name, description, prompt
|
|
22329
|
-
- canUse: arrow function returning array of imported tool variables (using their IDs)
|
|
22330
|
-
- selectedTools: if present, maps tool ID variable to selected tool names
|
|
22331
|
-
- dataComponents: arrow function returning array of imported component configs
|
|
22332
|
-
- artifactComponents: arrow function returning array of imported component configs
|
|
22333
|
-
- canTransferTo/canDelegateTo: arrow functions returning agent variables
|
|
22334
|
-
6. Create the graph using agentGraph() with proper structure
|
|
22463
|
+
1. Import { agent, agentGraph } from '@inkeep/agents-sdk'
|
|
22464
|
+
2. Define each agent using the agent() function following the type definitions provided above
|
|
22465
|
+
3. Create the graph using agentGraph() with proper structure
|
|
22335
22466
|
- IMPORTANT: If description is null, undefined, or empty string, omit the description field entirely
|
|
22336
|
-
|
|
22337
|
-
7. CRITICAL: Export the graph with proper camelCase naming:
|
|
22338
|
-
- Convert graph IDs with hyphens to camelCase (e.g., 'basic-graph' becomes 'basicGraph')
|
|
22339
|
-
- Remove hyphens and capitalize the letter after each hyphen
|
|
22340
|
-
- First letter should be lowercase
|
|
22341
|
-
8. Ensure all imports are sorted alphabetically
|
|
22342
|
-
9. CRITICAL: For multi-line strings (especially prompts), ALWAYS use template literals with backticks:
|
|
22467
|
+
4. CRITICAL: For multi-line strings (especially prompts), ALWAYS use template literals with backticks:
|
|
22343
22468
|
- Single-line strings: use regular quotes 'short string'
|
|
22344
22469
|
- Multi-line strings: MUST use template literals starting and ending with backticks
|
|
22345
22470
|
- IMPORTANT: ANY placeholder that starts with < and ends with > MUST be wrapped in template literals (backticks)
|
|
22346
22471
|
- Placeholders contain multi-line content and require template literals
|
|
22347
22472
|
- This prevents TypeScript syntax errors with newlines and special characters
|
|
22348
22473
|
|
|
22349
|
-
|
|
22350
|
-
// Tool with underscore ID 'inkeep_facts':
|
|
22351
|
-
import { inkeepFacts } from '../tools/inkeep_facts'; // camelCase import, exact ID in path
|
|
22352
|
-
|
|
22353
|
-
// Tool with hyphen ID 'weather-api':
|
|
22354
|
-
import { weatherApi } from '../tools/weather-api'; // camelCase import, exact ID in path
|
|
22355
|
-
|
|
22356
|
-
// Data component with hyphen ID 'user-profile':
|
|
22357
|
-
import { userProfile } from '../data-components/user-profile'; // camelCase import, exact ID in path
|
|
22358
|
-
|
|
22359
|
-
// Random ID (no conversion needed):
|
|
22360
|
-
import { fUI2riwrBVJ6MepT8rjx0 } from '../tools/fUI2riwrBVJ6MepT8rjx0';
|
|
22361
|
-
|
|
22362
|
-
// PLACEHOLDER HANDLING EXAMPLES:
|
|
22474
|
+
PLACEHOLDER HANDLING EXAMPLES:
|
|
22363
22475
|
// CORRECT - Placeholder wrapped in template literals:
|
|
22364
22476
|
prompt: \`<{{agents.facts.prompt.abc12345}}>\`
|
|
22365
22477
|
|
|
22366
22478
|
// INCORRECT - Placeholder wrapped in single quotes (causes syntax errors):
|
|
22367
22479
|
prompt: '<{{agents.facts.prompt.abc12345}}>'
|
|
22368
22480
|
|
|
22369
|
-
${IMPORT_INSTRUCTIONS}
|
|
22370
|
-
|
|
22371
22481
|
FULL EXAMPLE:
|
|
22372
22482
|
import { agent, agentGraph } from '@inkeep/agents-sdk';
|
|
22373
22483
|
import { userProfile } from '../data-components/user-profile';
|
|
22374
|
-
import {
|
|
22375
|
-
import {
|
|
22484
|
+
import { searchTool } from '../tools/search-tool';
|
|
22485
|
+
import { weatherTool } from '../tools/weather-tool';
|
|
22376
22486
|
|
|
22377
22487
|
const routerAgent = agent({
|
|
22378
22488
|
id: 'router',
|
|
@@ -22398,7 +22508,6 @@ Follow these rules:
|
|
|
22398
22508
|
dataComponents: () => [userProfile.config]
|
|
22399
22509
|
});
|
|
22400
22510
|
|
|
22401
|
-
// Example: Graph ID 'support-graph' becomes 'supportGraph'
|
|
22402
22511
|
export const supportGraph = agentGraph({
|
|
22403
22512
|
id: 'support-graph',
|
|
22404
22513
|
name: 'Support Graph',
|
|
@@ -22407,15 +22516,6 @@ export const supportGraph = agentGraph({
|
|
|
22407
22516
|
agents: () => [routerAgent, qaAgent]
|
|
22408
22517
|
});
|
|
22409
22518
|
|
|
22410
|
-
// Example without description (when null or undefined):
|
|
22411
|
-
export const weatherGraph = agentGraph({
|
|
22412
|
-
id: 'weather-graph',
|
|
22413
|
-
name: 'Weather Graph',
|
|
22414
|
-
// description is omitted when null, undefined, or empty
|
|
22415
|
-
defaultAgent: routerAgent,
|
|
22416
|
-
agents: () => [routerAgent, qaAgent]
|
|
22417
|
-
});
|
|
22418
|
-
|
|
22419
22519
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
22420
22520
|
if (debug) {
|
|
22421
22521
|
console.log(`
|
|
@@ -22512,36 +22612,26 @@ TOOL DATA:
|
|
|
22512
22612
|
|
|
22513
22613
|
TOOL ID: ${toolId}
|
|
22514
22614
|
|
|
22615
|
+
${getTypeDefinitions()}
|
|
22616
|
+
|
|
22515
22617
|
${NAMING_CONVENTION_RULES}
|
|
22516
22618
|
|
|
22619
|
+
${IMPORT_INSTRUCTIONS}
|
|
22620
|
+
|
|
22517
22621
|
REQUIREMENTS:
|
|
22518
|
-
1. Import mcpTool from '@inkeep/agents-sdk'
|
|
22622
|
+
1. Import mcpTool from '@inkeep/agents-sdk'
|
|
22519
22623
|
2. CRITICAL: Always include serverUrl property (required by SDK) extracted from config.mcp.server.url
|
|
22520
22624
|
3. CRITICAL: Use individual properties supported by mcpTool - do NOT use nested config object
|
|
22521
22625
|
4. Extract configuration properties and map them to mcpTool's expected properties (serverUrl, transport, etc.)
|
|
22522
|
-
5.
|
|
22523
|
-
6.
|
|
22524
|
-
7.
|
|
22525
|
-
8.
|
|
22526
|
-
9. TRANSPORT CONFIG: If config.mcp.transport exists, extract it as a transport property (not nested in config)
|
|
22527
|
-
10. NO CONFIG OBJECT: mcpTool does not accept a 'config' property - use individual properties only
|
|
22528
|
-
|
|
22529
|
-
EXAMPLE FOR TOOL WITH UNDERSCORE ID:
|
|
22530
|
-
import { mcpTool } from '@inkeep/agents-sdk';
|
|
22626
|
+
5. CRITICAL: If credentialReferenceId exists in tool data, add it as a credential property using envSettings.getEnvironmentSetting()
|
|
22627
|
+
6. Convert credentialReferenceId to credential key format by replacing hyphens with underscores for the getEnvironmentSetting() call (e.g., 'inkeep-api-credential' becomes 'inkeep_api_credential')
|
|
22628
|
+
7. TRANSPORT CONFIG: If config.mcp.transport exists, extract it as a transport property (not nested in config)
|
|
22629
|
+
8. NO CONFIG OBJECT: mcpTool does not accept a 'config' property - use individual properties only
|
|
22531
22630
|
|
|
22532
|
-
|
|
22533
|
-
export const inkeepFacts = mcpTool({
|
|
22534
|
-
id: 'inkeep_facts', // Keep original ID here
|
|
22535
|
-
name: 'Inkeep Facts',
|
|
22536
|
-
serverUrl: 'https://facts.inkeep.com/mcp'
|
|
22537
|
-
});
|
|
22538
|
-
|
|
22539
|
-
EXAMPLE FOR TOOL WITH CREDENTIAL REFERENCE:
|
|
22540
|
-
import { mcpTool } from '@inkeep/agents-sdk';
|
|
22631
|
+
EXAMPLE WITH CREDENTIAL REFERENCE:
|
|
22541
22632
|
import { envSettings } from '../environments';
|
|
22633
|
+
import { mcpTool } from '@inkeep/agents-sdk';
|
|
22542
22634
|
|
|
22543
|
-
// Tool with credential reference - note credentialReferenceId 'inkeep-api-credential' becomes 'inkeep_api_credential'
|
|
22544
|
-
// IMPORTANT: Use individual properties only, no nested config object
|
|
22545
22635
|
export const inkeepFacts = mcpTool({
|
|
22546
22636
|
id: 'inkeep_facts',
|
|
22547
22637
|
name: 'inkeep_facts',
|
|
@@ -22549,10 +22639,9 @@ export const inkeepFacts = mcpTool({
|
|
|
22549
22639
|
credential: envSettings.getEnvironmentSetting('inkeep_api_credential')
|
|
22550
22640
|
});
|
|
22551
22641
|
|
|
22552
|
-
EXAMPLE
|
|
22642
|
+
EXAMPLE WITH TRANSPORT CONFIG:
|
|
22553
22643
|
import { mcpTool } from '@inkeep/agents-sdk';
|
|
22554
22644
|
|
|
22555
|
-
// Tool with transport config - extract transport from config.mcp.transport
|
|
22556
22645
|
export const transportTool = mcpTool({
|
|
22557
22646
|
id: 'transport_tool',
|
|
22558
22647
|
name: 'Transport Tool',
|
|
@@ -22562,27 +22651,6 @@ export const transportTool = mcpTool({
|
|
|
22562
22651
|
}
|
|
22563
22652
|
});
|
|
22564
22653
|
|
|
22565
|
-
EXAMPLE FOR TOOL WITH HYPHEN ID:
|
|
22566
|
-
import { mcpTool } from '@inkeep/agents-sdk';
|
|
22567
|
-
|
|
22568
|
-
// Tool ID 'weather-api' becomes export name 'weatherApi'
|
|
22569
|
-
export const weatherApi = mcpTool({
|
|
22570
|
-
id: 'weather-api', // Keep original ID here
|
|
22571
|
-
name: 'Weather API',
|
|
22572
|
-
serverUrl: 'npx',
|
|
22573
|
-
args: ['-y', '@modelcontextprotocol/server-weather']
|
|
22574
|
-
});
|
|
22575
|
-
|
|
22576
|
-
EXAMPLE FOR RANDOM ID:
|
|
22577
|
-
import { mcpTool } from '@inkeep/agents-sdk';
|
|
22578
|
-
|
|
22579
|
-
// If tool ID is 'fUI2riwrBVJ6MepT8rjx0', export name is 'fUI2riwrBVJ6MepT8rjx0'
|
|
22580
|
-
export const fUI2riwrBVJ6MepT8rjx0 = mcpTool({
|
|
22581
|
-
id: 'fUI2riwrBVJ6MepT8rjx0',
|
|
22582
|
-
name: 'Weather Forecast',
|
|
22583
|
-
serverUrl: 'https://weather-forecast-mcp.vercel.app/mcp'
|
|
22584
|
-
});
|
|
22585
|
-
|
|
22586
22654
|
Generate ONLY the TypeScript code without any markdown or explanations.`;
|
|
22587
22655
|
const text2 = await generateTextWithPlaceholders(model, toolData, promptTemplate, {
|
|
22588
22656
|
temperature: 0.1,
|
|
@@ -22601,34 +22669,20 @@ DATA COMPONENT DATA:
|
|
|
22601
22669
|
|
|
22602
22670
|
COMPONENT ID: ${componentId}
|
|
22603
22671
|
|
|
22672
|
+
${getTypeDefinitions()}
|
|
22673
|
+
|
|
22604
22674
|
${NAMING_CONVENTION_RULES}
|
|
22605
22675
|
|
|
22676
|
+
${IMPORT_INSTRUCTIONS}
|
|
22677
|
+
|
|
22606
22678
|
REQUIREMENTS:
|
|
22607
22679
|
1. Import dataComponent from '@inkeep/agents-sdk'
|
|
22608
22680
|
2. Create the data component using dataComponent()
|
|
22609
22681
|
3. Include all properties from the component data INCLUDING the 'id' property
|
|
22610
|
-
4. Export following naming convention rules (camelCase version of ID)
|
|
22611
|
-
5. CRITICAL: All imports must be alphabetically sorted to comply with Biome linting
|
|
22612
|
-
|
|
22613
|
-
EXAMPLE WITH UNDERSCORE ID:
|
|
22614
|
-
import { dataComponent } from '@inkeep/agents-sdk';
|
|
22615
|
-
|
|
22616
|
-
// Component ID 'user_profile' becomes export name 'userProfile'
|
|
22617
|
-
export const userProfile = dataComponent({
|
|
22618
|
-
id: 'user_profile',
|
|
22619
|
-
name: 'User Profile',
|
|
22620
|
-
description: 'User profile information',
|
|
22621
|
-
props: {
|
|
22622
|
-
userId: { type: 'string', required: true },
|
|
22623
|
-
email: { type: 'string', required: true },
|
|
22624
|
-
preferences: { type: 'object' }
|
|
22625
|
-
}
|
|
22626
|
-
});
|
|
22627
22682
|
|
|
22628
|
-
EXAMPLE
|
|
22683
|
+
EXAMPLE:
|
|
22629
22684
|
import { dataComponent } from '@inkeep/agents-sdk';
|
|
22630
22685
|
|
|
22631
|
-
// Component ID 'weather-data' becomes export name 'weatherData'
|
|
22632
22686
|
export const weatherData = dataComponent({
|
|
22633
22687
|
id: 'weather-data',
|
|
22634
22688
|
name: 'Weather Data',
|
|
@@ -22657,37 +22711,21 @@ ARTIFACT COMPONENT DATA:
|
|
|
22657
22711
|
|
|
22658
22712
|
COMPONENT ID: ${componentId}
|
|
22659
22713
|
|
|
22714
|
+
${getTypeDefinitions()}
|
|
22715
|
+
|
|
22660
22716
|
${NAMING_CONVENTION_RULES}
|
|
22661
22717
|
|
|
22718
|
+
${IMPORT_INSTRUCTIONS}
|
|
22719
|
+
|
|
22662
22720
|
REQUIREMENTS:
|
|
22663
22721
|
1. Import artifactComponent from '@inkeep/agents-sdk'
|
|
22664
22722
|
2. Create the artifact component using artifactComponent()
|
|
22665
22723
|
3. Include summaryProps and fullProps from the component data
|
|
22666
|
-
4.
|
|
22667
|
-
5. Include the 'id' property to preserve the original component ID
|
|
22668
|
-
6. CRITICAL: All imports must be alphabetically sorted to comply with Biome linting
|
|
22669
|
-
|
|
22670
|
-
EXAMPLE WITH UNDERSCORE ID:
|
|
22671
|
-
import { artifactComponent } from '@inkeep/agents-sdk';
|
|
22672
|
-
|
|
22673
|
-
// Component ID 'pdf_export' becomes export name 'pdfExport'
|
|
22674
|
-
export const pdfExport = artifactComponent({
|
|
22675
|
-
id: 'pdf_export',
|
|
22676
|
-
name: 'PDF Export',
|
|
22677
|
-
description: 'Export data as PDF',
|
|
22678
|
-
summaryProps: {
|
|
22679
|
-
filename: { type: 'string', required: true }
|
|
22680
|
-
},
|
|
22681
|
-
fullProps: {
|
|
22682
|
-
filename: { type: 'string', required: true },
|
|
22683
|
-
content: { type: 'object', required: true }
|
|
22684
|
-
}
|
|
22685
|
-
});
|
|
22724
|
+
4. Include the 'id' property to preserve the original component ID
|
|
22686
22725
|
|
|
22687
|
-
EXAMPLE
|
|
22726
|
+
EXAMPLE:
|
|
22688
22727
|
import { artifactComponent } from '@inkeep/agents-sdk';
|
|
22689
22728
|
|
|
22690
|
-
// Component ID 'order-summary' becomes export name 'orderSummary'
|
|
22691
22729
|
export const orderSummary = artifactComponent({
|
|
22692
22730
|
id: 'order-summary',
|
|
22693
22731
|
name: 'Order Summary',
|
|
@@ -22756,11 +22794,11 @@ export const ${environment} = registerEnvironmentSettings({
|
|
|
22756
22794
|
}
|
|
22757
22795
|
async function updateEnvironmentIndex(environmentsDir, environment) {
|
|
22758
22796
|
const indexPath = join6(environmentsDir, "index.ts");
|
|
22759
|
-
const { readFileSync:
|
|
22797
|
+
const { readFileSync: readFileSync5, existsSync: existsSync9 } = await import("fs");
|
|
22760
22798
|
const existingEnvironments = [];
|
|
22761
22799
|
let existingContent = "";
|
|
22762
22800
|
if (existsSync9(indexPath)) {
|
|
22763
|
-
existingContent =
|
|
22801
|
+
existingContent = readFileSync5(indexPath, "utf-8");
|
|
22764
22802
|
const importRegex = /import\s+{\s*(\w+)\s*}\s+from\s+['"]\.\/([\w-]+)\.env['"];?/g;
|
|
22765
22803
|
let match;
|
|
22766
22804
|
while ((match = importRegex.exec(existingContent)) !== null) {
|
|
@@ -22858,7 +22896,7 @@ async function verifyGeneratedFiles(projectDir, originalProjectData, debug = fal
|
|
|
22858
22896
|
const toolPath = join7(projectDir, "tools", "inkeep_facts.ts");
|
|
22859
22897
|
const envPath = join7(projectDir, "environments", "development.env.ts");
|
|
22860
22898
|
if (existsSync6(toolPath)) {
|
|
22861
|
-
const toolContent =
|
|
22899
|
+
const toolContent = readFileSync3(toolPath, "utf8");
|
|
22862
22900
|
if (!toolContent.includes("credential:")) {
|
|
22863
22901
|
structuralWarnings.push("Tool file may be missing credential reference");
|
|
22864
22902
|
}
|
|
@@ -22885,7 +22923,7 @@ async function verifyGeneratedFiles(projectDir, originalProjectData, debug = fal
|
|
|
22885
22923
|
structuralErrors.push("Tool file inkeep_facts.ts not found");
|
|
22886
22924
|
}
|
|
22887
22925
|
if (existsSync6(envPath)) {
|
|
22888
|
-
const envContent =
|
|
22926
|
+
const envContent = readFileSync3(envPath, "utf8");
|
|
22889
22927
|
if (!envContent.includes("inkeep_api_credential")) {
|
|
22890
22928
|
structuralWarnings.push("Environment file may be missing credential definition");
|
|
22891
22929
|
}
|
|
@@ -23617,7 +23655,7 @@ async function pushCommand(options) {
|
|
|
23617
23655
|
var __filename2 = fileURLToPath2(import.meta.url);
|
|
23618
23656
|
var __dirname2 = dirname5(__filename2);
|
|
23619
23657
|
var packageJsonPath = join10(__dirname2, "..", "package.json");
|
|
23620
|
-
var packageJson = JSON.parse(
|
|
23658
|
+
var packageJson = JSON.parse(readFileSync4(packageJsonPath, "utf-8"));
|
|
23621
23659
|
var program = new Command();
|
|
23622
23660
|
program.name("inkeep").description("CLI tool for Inkeep Agent Framework").version(packageJson.version);
|
|
23623
23661
|
program.command("add [template]").description("Add a new template to the project").option("--target-path <path>", "Target path to add the template to").option("--config <path>", "Path to configuration file").action(async (template, options) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-cli",
|
|
3
|
-
"version": "0.14.
|
|
3
|
+
"version": "0.14.10",
|
|
4
4
|
"description": "Inkeep CLI tool",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -45,7 +45,8 @@
|
|
|
45
45
|
"recast": "^0.23.0",
|
|
46
46
|
"ts-morph": "^26.0.0",
|
|
47
47
|
"tsx": "^4.20.5",
|
|
48
|
-
"@inkeep/agents-
|
|
48
|
+
"@inkeep/agents-sdk": "^0.14.10",
|
|
49
|
+
"@inkeep/agents-core": "^0.14.10"
|
|
49
50
|
},
|
|
50
51
|
"devDependencies": {
|
|
51
52
|
"@types/degit": "^2.8.6",
|