@inkeep/agents-run-api 0.0.0-dev-20250912195514 → 0.0.0-dev-20250912203816
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 +37 -13
- package/dist/index.js +35 -14
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -6236,6 +6236,40 @@ ${output}`;
|
|
|
6236
6236
|
}
|
|
6237
6237
|
};
|
|
6238
6238
|
|
|
6239
|
+
// src/utils/model-resolver.ts
|
|
6240
|
+
init_dbClient();
|
|
6241
|
+
async function resolveModelConfig(graphId, agent) {
|
|
6242
|
+
if (agent.models?.base?.model) {
|
|
6243
|
+
return {
|
|
6244
|
+
base: agent.models.base,
|
|
6245
|
+
structuredOutput: agent.models.structuredOutput || agent.models.base,
|
|
6246
|
+
summarizer: agent.models.summarizer || agent.models.base
|
|
6247
|
+
};
|
|
6248
|
+
}
|
|
6249
|
+
const graph = await agentsCore.getAgentGraph(dbClient_default)({
|
|
6250
|
+
scopes: { tenantId: agent.tenantId, projectId: agent.projectId },
|
|
6251
|
+
graphId
|
|
6252
|
+
});
|
|
6253
|
+
if (graph?.models?.base?.model) {
|
|
6254
|
+
return {
|
|
6255
|
+
base: graph.models.base,
|
|
6256
|
+
structuredOutput: agent.models?.structuredOutput || graph.models.structuredOutput || graph.models.base,
|
|
6257
|
+
summarizer: agent.models?.summarizer || graph.models.summarizer || graph.models.base
|
|
6258
|
+
};
|
|
6259
|
+
}
|
|
6260
|
+
const project = await agentsCore.getProject(dbClient_default)({
|
|
6261
|
+
scopes: { tenantId: agent.tenantId, projectId: agent.projectId }
|
|
6262
|
+
});
|
|
6263
|
+
if (project?.models?.base?.model) {
|
|
6264
|
+
return {
|
|
6265
|
+
base: project.models.base,
|
|
6266
|
+
structuredOutput: agent.models?.structuredOutput || project.models.structuredOutput || project.models.base,
|
|
6267
|
+
summarizer: agent.models?.summarizer || project.models.summarizer || project.models.base
|
|
6268
|
+
};
|
|
6269
|
+
}
|
|
6270
|
+
throw new Error("Base model configuration is required. Please configure models at the project level.");
|
|
6271
|
+
}
|
|
6272
|
+
|
|
6239
6273
|
// src/agents/generateTaskHandler.ts
|
|
6240
6274
|
function parseEmbeddedJson(data) {
|
|
6241
6275
|
return traverse__default.default(data).map(function(x) {
|
|
@@ -6518,7 +6552,7 @@ var createTaskHandlerConfig = async (params) => {
|
|
|
6518
6552
|
if (!agent) {
|
|
6519
6553
|
throw new Error(`Agent not found: ${params.agentId}`);
|
|
6520
6554
|
}
|
|
6521
|
-
const effectiveModels =
|
|
6555
|
+
const effectiveModels = await resolveModelConfig(params.graphId, agent);
|
|
6522
6556
|
const effectiveConversationHistoryConfig = agent.conversationHistoryConfig || { mode: "full" };
|
|
6523
6557
|
return {
|
|
6524
6558
|
tenantId: params.tenantId,
|
|
@@ -6530,7 +6564,7 @@ var createTaskHandlerConfig = async (params) => {
|
|
|
6530
6564
|
name: agent.name,
|
|
6531
6565
|
description: agent.description,
|
|
6532
6566
|
prompt: agent.prompt,
|
|
6533
|
-
models: effectiveModels
|
|
6567
|
+
models: effectiveModels,
|
|
6534
6568
|
conversationHistoryConfig: effectiveConversationHistoryConfig || null,
|
|
6535
6569
|
stopWhen: agent.stopWhen || null,
|
|
6536
6570
|
createdAt: agent.createdAt,
|
|
@@ -8917,17 +8951,7 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
8917
8951
|
origin: "*",
|
|
8918
8952
|
// public API
|
|
8919
8953
|
allowMethods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
|
8920
|
-
allowHeaders: [
|
|
8921
|
-
"Content-Type",
|
|
8922
|
-
"Authorization",
|
|
8923
|
-
"X-Inkeep-Tenant-Id",
|
|
8924
|
-
"X-Inkeep-Project-Id",
|
|
8925
|
-
"X-Inkeep-Graph-Id",
|
|
8926
|
-
"X-Inkeep-Agent-Id",
|
|
8927
|
-
"Accept",
|
|
8928
|
-
"Origin",
|
|
8929
|
-
"X-Requested-With"
|
|
8930
|
-
],
|
|
8954
|
+
allowHeaders: ["*"],
|
|
8931
8955
|
exposeHeaders: ["Content-Length"],
|
|
8932
8956
|
maxAge: 86400
|
|
8933
8957
|
})
|
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { BaggageSpanProcessor, ALLOW_ALL_BAGGAGE_KEYS } from '@opentelemetry/bag
|
|
|
4
4
|
import { OTLPTraceExporter } from '@opentelemetry/exporter-trace-otlp-proto';
|
|
5
5
|
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
6
6
|
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-node';
|
|
7
|
-
import { getLogger as getLogger$1, getTracer, HeadersScopeSchema, getRequestExecutionContext, getAgentGraphWithDefaultAgent, contextValidationMiddleware, getFullGraph, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getAgentById, handleContextResolution, createMessage, commonGetErrorResponses, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, getAgentGraph, createTask, updateTask, updateConversation, handleApiError, setSpanWithError, TaskState, setActiveAgentForThread, getConversation, getRelatedAgentsForGraph, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, validateAndGetApiKey, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getContextConfigById, getFullGraphDefinition, TemplateEngine, graphHasArtifactComponents, MCPTransportType, getExternalAgent } from '@inkeep/agents-core';
|
|
7
|
+
import { getLogger as getLogger$1, getTracer, HeadersScopeSchema, getRequestExecutionContext, getAgentGraphWithDefaultAgent, contextValidationMiddleware, getFullGraph, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getAgentById, handleContextResolution, createMessage, commonGetErrorResponses, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, getAgentGraph, createTask, updateTask, updateConversation, handleApiError, setSpanWithError, TaskState, setActiveAgentForThread, getConversation, getRelatedAgentsForGraph, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, validateAndGetApiKey, getProject, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getContextConfigById, getFullGraphDefinition, TemplateEngine, graphHasArtifactComponents, MCPTransportType, getExternalAgent } from '@inkeep/agents-core';
|
|
8
8
|
import { Hono } from 'hono';
|
|
9
9
|
import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
|
|
10
10
|
import { trace, propagation, context, SpanStatusCode } from '@opentelemetry/api';
|
|
@@ -5913,6 +5913,37 @@ ${output}`;
|
|
|
5913
5913
|
});
|
|
5914
5914
|
}
|
|
5915
5915
|
};
|
|
5916
|
+
async function resolveModelConfig(graphId, agent) {
|
|
5917
|
+
if (agent.models?.base?.model) {
|
|
5918
|
+
return {
|
|
5919
|
+
base: agent.models.base,
|
|
5920
|
+
structuredOutput: agent.models.structuredOutput || agent.models.base,
|
|
5921
|
+
summarizer: agent.models.summarizer || agent.models.base
|
|
5922
|
+
};
|
|
5923
|
+
}
|
|
5924
|
+
const graph = await getAgentGraph(dbClient_default)({
|
|
5925
|
+
scopes: { tenantId: agent.tenantId, projectId: agent.projectId },
|
|
5926
|
+
graphId
|
|
5927
|
+
});
|
|
5928
|
+
if (graph?.models?.base?.model) {
|
|
5929
|
+
return {
|
|
5930
|
+
base: graph.models.base,
|
|
5931
|
+
structuredOutput: agent.models?.structuredOutput || graph.models.structuredOutput || graph.models.base,
|
|
5932
|
+
summarizer: agent.models?.summarizer || graph.models.summarizer || graph.models.base
|
|
5933
|
+
};
|
|
5934
|
+
}
|
|
5935
|
+
const project = await getProject(dbClient_default)({
|
|
5936
|
+
scopes: { tenantId: agent.tenantId, projectId: agent.projectId }
|
|
5937
|
+
});
|
|
5938
|
+
if (project?.models?.base?.model) {
|
|
5939
|
+
return {
|
|
5940
|
+
base: project.models.base,
|
|
5941
|
+
structuredOutput: agent.models?.structuredOutput || project.models.structuredOutput || project.models.base,
|
|
5942
|
+
summarizer: agent.models?.summarizer || project.models.summarizer || project.models.base
|
|
5943
|
+
};
|
|
5944
|
+
}
|
|
5945
|
+
throw new Error("Base model configuration is required. Please configure models at the project level.");
|
|
5946
|
+
}
|
|
5916
5947
|
|
|
5917
5948
|
// src/agents/generateTaskHandler.ts
|
|
5918
5949
|
function parseEmbeddedJson(data) {
|
|
@@ -6196,7 +6227,7 @@ var createTaskHandlerConfig = async (params) => {
|
|
|
6196
6227
|
if (!agent) {
|
|
6197
6228
|
throw new Error(`Agent not found: ${params.agentId}`);
|
|
6198
6229
|
}
|
|
6199
|
-
const effectiveModels =
|
|
6230
|
+
const effectiveModels = await resolveModelConfig(params.graphId, agent);
|
|
6200
6231
|
const effectiveConversationHistoryConfig = agent.conversationHistoryConfig || { mode: "full" };
|
|
6201
6232
|
return {
|
|
6202
6233
|
tenantId: params.tenantId,
|
|
@@ -6208,7 +6239,7 @@ var createTaskHandlerConfig = async (params) => {
|
|
|
6208
6239
|
name: agent.name,
|
|
6209
6240
|
description: agent.description,
|
|
6210
6241
|
prompt: agent.prompt,
|
|
6211
|
-
models: effectiveModels
|
|
6242
|
+
models: effectiveModels,
|
|
6212
6243
|
conversationHistoryConfig: effectiveConversationHistoryConfig || null,
|
|
6213
6244
|
stopWhen: agent.stopWhen || null,
|
|
6214
6245
|
createdAt: agent.createdAt,
|
|
@@ -8577,17 +8608,7 @@ function createExecutionHono(serverConfig, credentialStores) {
|
|
|
8577
8608
|
origin: "*",
|
|
8578
8609
|
// public API
|
|
8579
8610
|
allowMethods: ["GET", "POST", "PUT", "DELETE", "OPTIONS"],
|
|
8580
|
-
allowHeaders: [
|
|
8581
|
-
"Content-Type",
|
|
8582
|
-
"Authorization",
|
|
8583
|
-
"X-Inkeep-Tenant-Id",
|
|
8584
|
-
"X-Inkeep-Project-Id",
|
|
8585
|
-
"X-Inkeep-Graph-Id",
|
|
8586
|
-
"X-Inkeep-Agent-Id",
|
|
8587
|
-
"Accept",
|
|
8588
|
-
"Origin",
|
|
8589
|
-
"X-Requested-With"
|
|
8590
|
-
],
|
|
8611
|
+
allowHeaders: ["*"],
|
|
8591
8612
|
exposeHeaders: ["Content-Length"],
|
|
8592
8613
|
maxAge: 86400
|
|
8593
8614
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20250912203816",
|
|
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",
|
|
@@ -44,7 +44,7 @@
|
|
|
44
44
|
"traverse": "^0.6.11",
|
|
45
45
|
"ts-pattern": "^5.7.1",
|
|
46
46
|
"zod": "^4.1.5",
|
|
47
|
-
"@inkeep/agents-core": "^0.0.0-dev-
|
|
47
|
+
"@inkeep/agents-core": "^0.0.0-dev-20250912203816"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@hono/vite-dev-server": "^0.20.1",
|