@inkeep/agents-run-api 0.39.0 → 0.39.1
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.cjs +21 -1
- package/dist/index.js +21 -1
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -32,6 +32,7 @@ var swaggerUi = require('@hono/swagger-ui');
|
|
|
32
32
|
var streaming = require('hono/streaming');
|
|
33
33
|
var ai = require('ai');
|
|
34
34
|
var jmespath = require('jmespath');
|
|
35
|
+
var schemaConversion = require('@inkeep/agents-core/utils/schema-conversion');
|
|
35
36
|
var Ajv = require('ajv');
|
|
36
37
|
var zod = require('zod');
|
|
37
38
|
var destr = require('destr');
|
|
@@ -14433,6 +14434,19 @@ var Phase1Config = class _Phase1Config {
|
|
|
14433
14434
|
const firstItem = tools[0];
|
|
14434
14435
|
return "usageGuidelines" in firstItem && !("config" in firstItem);
|
|
14435
14436
|
}
|
|
14437
|
+
normalizeSchema(inputSchema) {
|
|
14438
|
+
if (!inputSchema || typeof inputSchema !== "object") {
|
|
14439
|
+
return inputSchema || {};
|
|
14440
|
+
}
|
|
14441
|
+
if (schemaConversion.isZodSchema(inputSchema)) {
|
|
14442
|
+
try {
|
|
14443
|
+
return schemaConversion.convertZodToJsonSchema(inputSchema);
|
|
14444
|
+
} catch (error) {
|
|
14445
|
+
return {};
|
|
14446
|
+
}
|
|
14447
|
+
}
|
|
14448
|
+
return inputSchema;
|
|
14449
|
+
}
|
|
14436
14450
|
assemble(templates, config) {
|
|
14437
14451
|
const systemPromptTemplate = templates.get("system-prompt");
|
|
14438
14452
|
if (!systemPromptTemplate) {
|
|
@@ -14449,7 +14463,11 @@ var Phase1Config = class _Phase1Config {
|
|
|
14449
14463
|
}
|
|
14450
14464
|
const agentContextSection = this.generateAgentContextSection(config.prompt);
|
|
14451
14465
|
systemPrompt = systemPrompt.replace("{{AGENT_CONTEXT_SECTION}}", agentContextSection);
|
|
14452
|
-
const
|
|
14466
|
+
const rawToolData = this.isToolDataArray(config.tools) ? config.tools : _Phase1Config.convertMcpToolsToToolData(config.tools);
|
|
14467
|
+
const toolData = rawToolData.map((tool4) => ({
|
|
14468
|
+
...tool4,
|
|
14469
|
+
inputSchema: this.normalizeSchema(tool4.inputSchema)
|
|
14470
|
+
}));
|
|
14453
14471
|
const hasArtifactComponents = config.artifactComponents && config.artifactComponents.length > 0;
|
|
14454
14472
|
const artifactsSection = this.generateArtifactsSection(
|
|
14455
14473
|
templates,
|
|
@@ -19656,6 +19674,8 @@ var ExecutionHandler = class {
|
|
|
19656
19674
|
throw error;
|
|
19657
19675
|
} finally {
|
|
19658
19676
|
span.end();
|
|
19677
|
+
await new Promise((resolve2) => setImmediate(resolve2));
|
|
19678
|
+
await flushBatchProcessor();
|
|
19659
19679
|
}
|
|
19660
19680
|
});
|
|
19661
19681
|
}
|
package/dist/index.js
CHANGED
|
@@ -17,6 +17,7 @@ import { swaggerUI } from '@hono/swagger-ui';
|
|
|
17
17
|
import { streamSSE, stream } from 'hono/streaming';
|
|
18
18
|
import { createUIMessageStream, JsonToSseTransformStream, parsePartialJson, generateObject, tool, streamText, generateText, streamObject } from 'ai';
|
|
19
19
|
import jmespath from 'jmespath';
|
|
20
|
+
import { isZodSchema, convertZodToJsonSchema } from '@inkeep/agents-core/utils/schema-conversion';
|
|
20
21
|
import Ajv from 'ajv';
|
|
21
22
|
import { randomUUID } from 'crypto';
|
|
22
23
|
import { z } from 'zod';
|
|
@@ -6781,6 +6782,19 @@ var Phase1Config = class _Phase1Config {
|
|
|
6781
6782
|
const firstItem = tools[0];
|
|
6782
6783
|
return "usageGuidelines" in firstItem && !("config" in firstItem);
|
|
6783
6784
|
}
|
|
6785
|
+
normalizeSchema(inputSchema) {
|
|
6786
|
+
if (!inputSchema || typeof inputSchema !== "object") {
|
|
6787
|
+
return inputSchema || {};
|
|
6788
|
+
}
|
|
6789
|
+
if (isZodSchema(inputSchema)) {
|
|
6790
|
+
try {
|
|
6791
|
+
return convertZodToJsonSchema(inputSchema);
|
|
6792
|
+
} catch (error) {
|
|
6793
|
+
return {};
|
|
6794
|
+
}
|
|
6795
|
+
}
|
|
6796
|
+
return inputSchema;
|
|
6797
|
+
}
|
|
6784
6798
|
assemble(templates, config) {
|
|
6785
6799
|
const systemPromptTemplate = templates.get("system-prompt");
|
|
6786
6800
|
if (!systemPromptTemplate) {
|
|
@@ -6797,7 +6811,11 @@ var Phase1Config = class _Phase1Config {
|
|
|
6797
6811
|
}
|
|
6798
6812
|
const agentContextSection = this.generateAgentContextSection(config.prompt);
|
|
6799
6813
|
systemPrompt = systemPrompt.replace("{{AGENT_CONTEXT_SECTION}}", agentContextSection);
|
|
6800
|
-
const
|
|
6814
|
+
const rawToolData = this.isToolDataArray(config.tools) ? config.tools : _Phase1Config.convertMcpToolsToToolData(config.tools);
|
|
6815
|
+
const toolData = rawToolData.map((tool4) => ({
|
|
6816
|
+
...tool4,
|
|
6817
|
+
inputSchema: this.normalizeSchema(tool4.inputSchema)
|
|
6818
|
+
}));
|
|
6801
6819
|
const hasArtifactComponents = config.artifactComponents && config.artifactComponents.length > 0;
|
|
6802
6820
|
const artifactsSection = this.generateArtifactsSection(
|
|
6803
6821
|
templates,
|
|
@@ -11985,6 +12003,8 @@ var ExecutionHandler = class {
|
|
|
11985
12003
|
throw error;
|
|
11986
12004
|
} finally {
|
|
11987
12005
|
span.end();
|
|
12006
|
+
await new Promise((resolve) => setImmediate(resolve));
|
|
12007
|
+
await flushBatchProcessor();
|
|
11988
12008
|
}
|
|
11989
12009
|
});
|
|
11990
12010
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.39.
|
|
3
|
+
"version": "0.39.1",
|
|
4
4
|
"description": "Agents Run API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -53,7 +53,7 @@
|
|
|
53
53
|
"pino": "^9.11.0",
|
|
54
54
|
"traverse": "^0.6.11",
|
|
55
55
|
"ts-pattern": "^5.7.1",
|
|
56
|
-
"@inkeep/agents-core": "^0.39.
|
|
56
|
+
"@inkeep/agents-core": "^0.39.1"
|
|
57
57
|
},
|
|
58
58
|
"peerDependencies": {
|
|
59
59
|
"@hono/zod-openapi": "^1.1.5",
|