@inkeep/agents-run-api 0.23.5 → 0.24.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.
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import { dbClient_default } from './chunk-IBMWBEXH.js';
|
|
2
|
-
import { createMessage, getConversationHistory } from '@inkeep/agents-core';
|
|
3
|
-
import { nanoid } from 'nanoid';
|
|
2
|
+
import { createMessage, generateId, getConversationHistory } from '@inkeep/agents-core';
|
|
4
3
|
|
|
5
4
|
function createDefaultConversationHistoryConfig(mode = "full") {
|
|
6
5
|
return {
|
|
@@ -35,7 +34,7 @@ async function saveA2AMessageResponse(response, params) {
|
|
|
35
34
|
return null;
|
|
36
35
|
}
|
|
37
36
|
return await createMessage(dbClient_default)({
|
|
38
|
-
id:
|
|
37
|
+
id: generateId(),
|
|
39
38
|
tenantId: params.tenantId,
|
|
40
39
|
projectId: params.projectId,
|
|
41
40
|
conversationId: params.conversationId,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { createDefaultConversationHistoryConfig, getConversationScopedArtifacts, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-
|
|
1
|
+
export { createDefaultConversationHistoryConfig, getConversationScopedArtifacts, getFormattedConversationHistory, getFullConversationContext, getScopedHistory, getUserFacingHistory, saveA2AMessageResponse } from './chunk-XLUE6U2L.js';
|
package/dist/index.cjs
CHANGED
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, '__esModule', { value: true });
|
|
|
4
4
|
|
|
5
5
|
var agentsCore = require('@inkeep/agents-core');
|
|
6
6
|
var z6 = require('zod');
|
|
7
|
-
var nanoid = require('nanoid');
|
|
8
7
|
var child_process = require('child_process');
|
|
9
8
|
var crypto = require('crypto');
|
|
10
9
|
var fs = require('fs');
|
|
@@ -192,7 +191,7 @@ async function saveA2AMessageResponse(response, params) {
|
|
|
192
191
|
return null;
|
|
193
192
|
}
|
|
194
193
|
return await agentsCore.createMessage(dbClient_default)({
|
|
195
|
-
id:
|
|
194
|
+
id: agentsCore.generateId(),
|
|
196
195
|
tenantId: params.tenantId,
|
|
197
196
|
projectId: params.projectId,
|
|
198
197
|
conversationId: params.conversationId,
|
|
@@ -1704,7 +1703,7 @@ async function handleMessageSend(c, agent, request) {
|
|
|
1704
1703
|
const executionContext = agentsCore.getRequestExecutionContext(c);
|
|
1705
1704
|
const { agentId } = executionContext;
|
|
1706
1705
|
const task = {
|
|
1707
|
-
id:
|
|
1706
|
+
id: agentsCore.generateId(),
|
|
1708
1707
|
input: {
|
|
1709
1708
|
parts: params.message.parts.map((part) => ({
|
|
1710
1709
|
kind: part.kind,
|
|
@@ -1797,7 +1796,7 @@ async function handleMessageSend(c, agent, request) {
|
|
|
1797
1796
|
const messageText = params.message.parts.filter((part) => part.kind === "text" && "text" in part && part.text).map((part) => part.text).join(" ");
|
|
1798
1797
|
try {
|
|
1799
1798
|
const messageData = {
|
|
1800
|
-
id:
|
|
1799
|
+
id: agentsCore.generateId(),
|
|
1801
1800
|
tenantId: agent.tenantId,
|
|
1802
1801
|
projectId: agent.projectId,
|
|
1803
1802
|
conversationId: effectiveContextId,
|
|
@@ -1879,7 +1878,7 @@ async function handleMessageSend(c, agent, request) {
|
|
|
1879
1878
|
},
|
|
1880
1879
|
artifacts: [
|
|
1881
1880
|
{
|
|
1882
|
-
artifactId:
|
|
1881
|
+
artifactId: agentsCore.generateId(),
|
|
1883
1882
|
parts: [
|
|
1884
1883
|
{
|
|
1885
1884
|
kind: "data",
|
|
@@ -1908,7 +1907,7 @@ async function handleMessageSend(c, agent, request) {
|
|
|
1908
1907
|
if (params.configuration?.blocking === false) {
|
|
1909
1908
|
const taskResponse = {
|
|
1910
1909
|
id: task.id,
|
|
1911
|
-
contextId: params.message.contextId ||
|
|
1910
|
+
contextId: params.message.contextId || agentsCore.generateId(),
|
|
1912
1911
|
status: taskStatus,
|
|
1913
1912
|
artifacts: result.artifacts,
|
|
1914
1913
|
kind: "task"
|
|
@@ -1920,7 +1919,7 @@ async function handleMessageSend(c, agent, request) {
|
|
|
1920
1919
|
});
|
|
1921
1920
|
}
|
|
1922
1921
|
const messageResponse = {
|
|
1923
|
-
messageId:
|
|
1922
|
+
messageId: agentsCore.generateId(),
|
|
1924
1923
|
parts: result.artifacts?.[0]?.parts || [
|
|
1925
1924
|
{
|
|
1926
1925
|
kind: "text",
|
|
@@ -1965,7 +1964,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
1965
1964
|
});
|
|
1966
1965
|
}
|
|
1967
1966
|
const task = {
|
|
1968
|
-
id:
|
|
1967
|
+
id: agentsCore.generateId(),
|
|
1969
1968
|
input: {
|
|
1970
1969
|
parts: params.message.parts.map((part) => ({
|
|
1971
1970
|
kind: part.kind,
|
|
@@ -1986,7 +1985,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
1986
1985
|
try {
|
|
1987
1986
|
const initialTask = {
|
|
1988
1987
|
id: task.id,
|
|
1989
|
-
contextId: params.message.contextId ||
|
|
1988
|
+
contextId: params.message.contextId || agentsCore.generateId(),
|
|
1990
1989
|
status: {
|
|
1991
1990
|
state: agentsCore.TaskState.Working,
|
|
1992
1991
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -2034,7 +2033,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
2034
2033
|
}
|
|
2035
2034
|
}
|
|
2036
2035
|
const messageResponse = {
|
|
2037
|
-
messageId:
|
|
2036
|
+
messageId: agentsCore.generateId(),
|
|
2038
2037
|
parts: result.artifacts?.[0]?.parts || [
|
|
2039
2038
|
{
|
|
2040
2039
|
kind: "text",
|
|
@@ -2100,14 +2099,14 @@ async function handleTasksGet(c, _agent, request) {
|
|
|
2100
2099
|
const params = request.params;
|
|
2101
2100
|
const task = {
|
|
2102
2101
|
id: params.id,
|
|
2103
|
-
contextId:
|
|
2102
|
+
contextId: agentsCore.generateId(),
|
|
2104
2103
|
status: {
|
|
2105
2104
|
state: agentsCore.TaskState.Completed,
|
|
2106
2105
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
2107
2106
|
},
|
|
2108
2107
|
artifacts: [
|
|
2109
2108
|
{
|
|
2110
|
-
artifactId:
|
|
2109
|
+
artifactId: agentsCore.generateId(),
|
|
2111
2110
|
parts: [
|
|
2112
2111
|
{
|
|
2113
2112
|
kind: "text",
|
|
@@ -2206,7 +2205,7 @@ async function handleTasksResubscribe(c, agent, request) {
|
|
|
2206
2205
|
try {
|
|
2207
2206
|
const task = {
|
|
2208
2207
|
id: params.taskId,
|
|
2209
|
-
contextId:
|
|
2208
|
+
contextId: agentsCore.generateId(),
|
|
2210
2209
|
status: {
|
|
2211
2210
|
state: agentsCore.TaskState.Completed,
|
|
2212
2211
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -2463,7 +2462,7 @@ var _ToolSessionManager = class _ToolSessionManager {
|
|
|
2463
2462
|
* Create a new tool session for an agent execution
|
|
2464
2463
|
*/
|
|
2465
2464
|
createSession(tenantId, projectId, contextId, taskId) {
|
|
2466
|
-
const sessionId =
|
|
2465
|
+
const sessionId = agentsCore.generateId();
|
|
2467
2466
|
return this.createSessionWithId(sessionId, tenantId, projectId, contextId, taskId);
|
|
2468
2467
|
}
|
|
2469
2468
|
/**
|
|
@@ -5562,7 +5561,7 @@ function errorOp(message, subAgentId, severity = "error", code) {
|
|
|
5562
5561
|
};
|
|
5563
5562
|
}
|
|
5564
5563
|
function generateToolId() {
|
|
5565
|
-
return `tool_${
|
|
5564
|
+
return `tool_${agentsCore.generateId(8)}`;
|
|
5566
5565
|
}
|
|
5567
5566
|
|
|
5568
5567
|
// src/utils/artifact-component-schema.ts
|
|
@@ -6672,7 +6671,7 @@ function createDelegateToAgentTool({
|
|
|
6672
6671
|
description: generateDelegateToolDescription(delegateConfig.config),
|
|
6673
6672
|
inputSchema: z6__default.default.object({ message: z6__default.default.string() }),
|
|
6674
6673
|
execute: async (input, context) => {
|
|
6675
|
-
const delegationId = `del_${
|
|
6674
|
+
const delegationId = `del_${agentsCore.generateId()}`;
|
|
6676
6675
|
const activeSpan = api.trace.getActiveSpan();
|
|
6677
6676
|
if (activeSpan) {
|
|
6678
6677
|
activeSpan.setAttributes({
|
|
@@ -6769,7 +6768,7 @@ function createDelegateToAgentTool({
|
|
|
6769
6768
|
const messageToSend = {
|
|
6770
6769
|
role: "agent",
|
|
6771
6770
|
parts: [{ text: input.message, kind: "text" }],
|
|
6772
|
-
messageId:
|
|
6771
|
+
messageId: agentsCore.generateId(),
|
|
6773
6772
|
kind: "message",
|
|
6774
6773
|
contextId,
|
|
6775
6774
|
metadata: {
|
|
@@ -6784,7 +6783,7 @@ function createDelegateToAgentTool({
|
|
|
6784
6783
|
};
|
|
6785
6784
|
logger14.info({ messageToSend }, "messageToSend");
|
|
6786
6785
|
await agentsCore.createMessage(dbClient_default)({
|
|
6787
|
-
id:
|
|
6786
|
+
id: agentsCore.generateId(),
|
|
6788
6787
|
tenantId,
|
|
6789
6788
|
projectId,
|
|
6790
6789
|
conversationId: contextId,
|
|
@@ -9999,7 +9998,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
9999
9998
|
},
|
|
10000
9999
|
artifacts: [
|
|
10001
10000
|
{
|
|
10002
|
-
artifactId:
|
|
10001
|
+
artifactId: agentsCore.generateId(),
|
|
10003
10002
|
parts: [
|
|
10004
10003
|
{
|
|
10005
10004
|
kind: "data",
|
|
@@ -10032,7 +10031,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
10032
10031
|
status: { state: agentsCore.TaskState.Completed },
|
|
10033
10032
|
artifacts: [
|
|
10034
10033
|
{
|
|
10035
|
-
artifactId:
|
|
10034
|
+
artifactId: agentsCore.generateId(),
|
|
10036
10035
|
parts
|
|
10037
10036
|
}
|
|
10038
10037
|
]
|
|
@@ -11375,7 +11374,7 @@ var ExecutionHandler = class {
|
|
|
11375
11374
|
"ai.subAgent.name": currentAgentId
|
|
11376
11375
|
});
|
|
11377
11376
|
await agentsCore.createMessage(dbClient_default)({
|
|
11378
|
-
id:
|
|
11377
|
+
id: agentsCore.generateId(),
|
|
11379
11378
|
tenantId,
|
|
11380
11379
|
projectId,
|
|
11381
11380
|
conversationId,
|
|
@@ -11765,7 +11764,7 @@ app2.openapi(chatCompletionsRoute, async (c) => {
|
|
|
11765
11764
|
});
|
|
11766
11765
|
}
|
|
11767
11766
|
await agentsCore.createMessage(dbClient_default)({
|
|
11768
|
-
id:
|
|
11767
|
+
id: agentsCore.generateId(),
|
|
11769
11768
|
tenantId,
|
|
11770
11769
|
projectId,
|
|
11771
11770
|
conversationId,
|
|
@@ -11998,7 +11997,7 @@ app3.openapi(chatDataStreamRoute, async (c) => {
|
|
|
11998
11997
|
});
|
|
11999
11998
|
}
|
|
12000
11999
|
await agentsCore.createMessage(dbClient_default)({
|
|
12001
|
-
id:
|
|
12000
|
+
id: agentsCore.generateId(),
|
|
12002
12001
|
tenantId,
|
|
12003
12002
|
projectId,
|
|
12004
12003
|
conversationId,
|
|
@@ -12454,7 +12453,7 @@ var processUserMessage = async (tenantId, projectId, conversationId, query) => {
|
|
|
12454
12453
|
});
|
|
12455
12454
|
}
|
|
12456
12455
|
await agentsCore.createMessage(dbClient_default)({
|
|
12457
|
-
id:
|
|
12456
|
+
id: agentsCore.generateId(),
|
|
12458
12457
|
tenantId,
|
|
12459
12458
|
projectId,
|
|
12460
12459
|
conversationId,
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { flushBatchProcessor } from './chunk-TVLDBLRZ.js';
|
|
2
|
-
import { getFormattedConversationHistory, createDefaultConversationHistoryConfig, saveA2AMessageResponse } from './chunk-
|
|
2
|
+
import { getFormattedConversationHistory, createDefaultConversationHistoryConfig, saveA2AMessageResponse } from './chunk-XLUE6U2L.js';
|
|
3
3
|
import { dbClient_default } from './chunk-IBMWBEXH.js';
|
|
4
4
|
import { env } from './chunk-LHCIBW34.js';
|
|
5
5
|
import { getLogger } from './chunk-A2S7GSHL.js';
|
|
6
6
|
import { __publicField } from './chunk-PKBMQBKP.js';
|
|
7
|
-
import { getTracer, HeadersScopeSchema, getRequestExecutionContext, createApiError, getAgentWithDefaultSubAgent, contextValidationMiddleware, getConversationId, getFullAgent, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getSubAgentById, handleContextResolution, createMessage, commonGetErrorResponses, loggerFactory, getDataComponent, getProject, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, upsertLedgerArtifact, createTask, updateTask, setSpanWithError, updateConversation, handleApiError, TaskState, setActiveAgentForThread, getConversation, getAgentById, getRelatedAgentsForAgent, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, dbResultToMcpTool, validateAndGetApiKey, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getFunctionToolsForSubAgent, getFunction, getContextConfigById, getFullAgentDefinition, TemplateEngine, agentHasArtifactComponents, MCPTransportType, SPAN_KEYS, getExternalAgent } from '@inkeep/agents-core';
|
|
7
|
+
import { getTracer, HeadersScopeSchema, getRequestExecutionContext, createApiError, getAgentWithDefaultSubAgent, contextValidationMiddleware, getConversationId, getFullAgent, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getSubAgentById, handleContextResolution, createMessage, generateId, commonGetErrorResponses, loggerFactory, getDataComponent, getProject, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, upsertLedgerArtifact, createTask, updateTask, setSpanWithError, updateConversation, handleApiError, TaskState, setActiveAgentForThread, getConversation, getAgentById, getRelatedAgentsForAgent, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, dbResultToMcpTool, validateAndGetApiKey, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getFunctionToolsForSubAgent, getFunction, getContextConfigById, getFullAgentDefinition, TemplateEngine, agentHasArtifactComponents, MCPTransportType, SPAN_KEYS, getExternalAgent } from '@inkeep/agents-core';
|
|
8
8
|
import { otel } from '@hono/otel';
|
|
9
9
|
import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
|
|
10
10
|
import { trace, propagation, context, SpanStatusCode } from '@opentelemetry/api';
|
|
@@ -16,7 +16,6 @@ import { createMiddleware } from 'hono/factory';
|
|
|
16
16
|
import { swaggerUI } from '@hono/swagger-ui';
|
|
17
17
|
import z5, { z } from 'zod';
|
|
18
18
|
import { streamSSE, stream } from 'hono/streaming';
|
|
19
|
-
import { nanoid } from 'nanoid';
|
|
20
19
|
import { createUIMessageStream, JsonToSseTransformStream, streamObject, parsePartialJson, generateObject, tool, streamText, generateText } from 'ai';
|
|
21
20
|
import { createAnthropic, anthropic } from '@ai-sdk/anthropic';
|
|
22
21
|
import { createGateway, gateway } from '@ai-sdk/gateway';
|
|
@@ -278,7 +277,7 @@ async function handleMessageSend(c, agent, request) {
|
|
|
278
277
|
const executionContext = getRequestExecutionContext(c);
|
|
279
278
|
const { agentId } = executionContext;
|
|
280
279
|
const task = {
|
|
281
|
-
id:
|
|
280
|
+
id: generateId(),
|
|
282
281
|
input: {
|
|
283
282
|
parts: params.message.parts.map((part) => ({
|
|
284
283
|
kind: part.kind,
|
|
@@ -371,7 +370,7 @@ async function handleMessageSend(c, agent, request) {
|
|
|
371
370
|
const messageText = params.message.parts.filter((part) => part.kind === "text" && "text" in part && part.text).map((part) => part.text).join(" ");
|
|
372
371
|
try {
|
|
373
372
|
const messageData = {
|
|
374
|
-
id:
|
|
373
|
+
id: generateId(),
|
|
375
374
|
tenantId: agent.tenantId,
|
|
376
375
|
projectId: agent.projectId,
|
|
377
376
|
conversationId: effectiveContextId,
|
|
@@ -453,7 +452,7 @@ async function handleMessageSend(c, agent, request) {
|
|
|
453
452
|
},
|
|
454
453
|
artifacts: [
|
|
455
454
|
{
|
|
456
|
-
artifactId:
|
|
455
|
+
artifactId: generateId(),
|
|
457
456
|
parts: [
|
|
458
457
|
{
|
|
459
458
|
kind: "data",
|
|
@@ -482,7 +481,7 @@ async function handleMessageSend(c, agent, request) {
|
|
|
482
481
|
if (params.configuration?.blocking === false) {
|
|
483
482
|
const taskResponse = {
|
|
484
483
|
id: task.id,
|
|
485
|
-
contextId: params.message.contextId ||
|
|
484
|
+
contextId: params.message.contextId || generateId(),
|
|
486
485
|
status: taskStatus,
|
|
487
486
|
artifacts: result.artifacts,
|
|
488
487
|
kind: "task"
|
|
@@ -494,7 +493,7 @@ async function handleMessageSend(c, agent, request) {
|
|
|
494
493
|
});
|
|
495
494
|
}
|
|
496
495
|
const messageResponse = {
|
|
497
|
-
messageId:
|
|
496
|
+
messageId: generateId(),
|
|
498
497
|
parts: result.artifacts?.[0]?.parts || [
|
|
499
498
|
{
|
|
500
499
|
kind: "text",
|
|
@@ -539,7 +538,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
539
538
|
});
|
|
540
539
|
}
|
|
541
540
|
const task = {
|
|
542
|
-
id:
|
|
541
|
+
id: generateId(),
|
|
543
542
|
input: {
|
|
544
543
|
parts: params.message.parts.map((part) => ({
|
|
545
544
|
kind: part.kind,
|
|
@@ -560,7 +559,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
560
559
|
try {
|
|
561
560
|
const initialTask = {
|
|
562
561
|
id: task.id,
|
|
563
|
-
contextId: params.message.contextId ||
|
|
562
|
+
contextId: params.message.contextId || generateId(),
|
|
564
563
|
status: {
|
|
565
564
|
state: TaskState.Working,
|
|
566
565
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -608,7 +607,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
608
607
|
}
|
|
609
608
|
}
|
|
610
609
|
const messageResponse = {
|
|
611
|
-
messageId:
|
|
610
|
+
messageId: generateId(),
|
|
612
611
|
parts: result.artifacts?.[0]?.parts || [
|
|
613
612
|
{
|
|
614
613
|
kind: "text",
|
|
@@ -674,14 +673,14 @@ async function handleTasksGet(c, _agent, request) {
|
|
|
674
673
|
const params = request.params;
|
|
675
674
|
const task = {
|
|
676
675
|
id: params.id,
|
|
677
|
-
contextId:
|
|
676
|
+
contextId: generateId(),
|
|
678
677
|
status: {
|
|
679
678
|
state: TaskState.Completed,
|
|
680
679
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
681
680
|
},
|
|
682
681
|
artifacts: [
|
|
683
682
|
{
|
|
684
|
-
artifactId:
|
|
683
|
+
artifactId: generateId(),
|
|
685
684
|
parts: [
|
|
686
685
|
{
|
|
687
686
|
kind: "text",
|
|
@@ -780,7 +779,7 @@ async function handleTasksResubscribe(c, agent, request) {
|
|
|
780
779
|
try {
|
|
781
780
|
const task = {
|
|
782
781
|
id: params.taskId,
|
|
783
|
-
contextId:
|
|
782
|
+
contextId: generateId(),
|
|
784
783
|
status: {
|
|
785
784
|
state: TaskState.Completed,
|
|
786
785
|
timestamp: (/* @__PURE__ */ new Date()).toISOString()
|
|
@@ -1029,7 +1028,7 @@ var _ToolSessionManager = class _ToolSessionManager {
|
|
|
1029
1028
|
* Create a new tool session for an agent execution
|
|
1030
1029
|
*/
|
|
1031
1030
|
createSession(tenantId, projectId, contextId, taskId) {
|
|
1032
|
-
const sessionId =
|
|
1031
|
+
const sessionId = generateId();
|
|
1033
1032
|
return this.createSessionWithId(sessionId, tenantId, projectId, contextId, taskId);
|
|
1034
1033
|
}
|
|
1035
1034
|
/**
|
|
@@ -4105,7 +4104,7 @@ function errorOp(message, subAgentId, severity = "error", code) {
|
|
|
4105
4104
|
};
|
|
4106
4105
|
}
|
|
4107
4106
|
function generateToolId() {
|
|
4108
|
-
return `tool_${
|
|
4107
|
+
return `tool_${generateId(8)}`;
|
|
4109
4108
|
}
|
|
4110
4109
|
var logger11 = getLogger("DataComponentSchema");
|
|
4111
4110
|
function jsonSchemaToZod(jsonSchema) {
|
|
@@ -5202,7 +5201,7 @@ function createDelegateToAgentTool({
|
|
|
5202
5201
|
description: generateDelegateToolDescription(delegateConfig.config),
|
|
5203
5202
|
inputSchema: z5.object({ message: z5.string() }),
|
|
5204
5203
|
execute: async (input, context) => {
|
|
5205
|
-
const delegationId = `del_${
|
|
5204
|
+
const delegationId = `del_${generateId()}`;
|
|
5206
5205
|
const activeSpan = trace.getActiveSpan();
|
|
5207
5206
|
if (activeSpan) {
|
|
5208
5207
|
activeSpan.setAttributes({
|
|
@@ -5299,7 +5298,7 @@ function createDelegateToAgentTool({
|
|
|
5299
5298
|
const messageToSend = {
|
|
5300
5299
|
role: "agent",
|
|
5301
5300
|
parts: [{ text: input.message, kind: "text" }],
|
|
5302
|
-
messageId:
|
|
5301
|
+
messageId: generateId(),
|
|
5303
5302
|
kind: "message",
|
|
5304
5303
|
contextId,
|
|
5305
5304
|
metadata: {
|
|
@@ -5314,7 +5313,7 @@ function createDelegateToAgentTool({
|
|
|
5314
5313
|
};
|
|
5315
5314
|
logger13.info({ messageToSend }, "messageToSend");
|
|
5316
5315
|
await createMessage(dbClient_default)({
|
|
5317
|
-
id:
|
|
5316
|
+
id: generateId(),
|
|
5318
5317
|
tenantId,
|
|
5319
5318
|
projectId,
|
|
5320
5319
|
conversationId: contextId,
|
|
@@ -7343,7 +7342,7 @@ var Agent = class {
|
|
|
7343
7342
|
inputSchema: tool3.inputSchema || tool3.parameters || {},
|
|
7344
7343
|
usageGuidelines: name.startsWith("transfer_to_") || name.startsWith("delegate_to_") ? `Use this tool to ${name.startsWith("transfer_to_") ? "transfer" : "delegate"} to another agent when appropriate.` : "Use this tool when appropriate for the task at hand."
|
|
7345
7344
|
}));
|
|
7346
|
-
const { getConversationScopedArtifacts } = await import('./conversations-
|
|
7345
|
+
const { getConversationScopedArtifacts } = await import('./conversations-H2TSLD3U.js');
|
|
7347
7346
|
const historyConfig = this.config.conversationHistoryConfig ?? createDefaultConversationHistoryConfig();
|
|
7348
7347
|
const referenceArtifacts = await getConversationScopedArtifacts({
|
|
7349
7348
|
tenantId: this.config.tenantId,
|
|
@@ -8527,7 +8526,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8527
8526
|
},
|
|
8528
8527
|
artifacts: [
|
|
8529
8528
|
{
|
|
8530
|
-
artifactId:
|
|
8529
|
+
artifactId: generateId(),
|
|
8531
8530
|
parts: [
|
|
8532
8531
|
{
|
|
8533
8532
|
kind: "data",
|
|
@@ -8560,7 +8559,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
8560
8559
|
status: { state: TaskState.Completed },
|
|
8561
8560
|
artifacts: [
|
|
8562
8561
|
{
|
|
8563
|
-
artifactId:
|
|
8562
|
+
artifactId: generateId(),
|
|
8564
8563
|
parts
|
|
8565
8564
|
}
|
|
8566
8565
|
]
|
|
@@ -9889,7 +9888,7 @@ var ExecutionHandler = class {
|
|
|
9889
9888
|
"ai.subAgent.name": currentAgentId
|
|
9890
9889
|
});
|
|
9891
9890
|
await createMessage(dbClient_default)({
|
|
9892
|
-
id:
|
|
9891
|
+
id: generateId(),
|
|
9893
9892
|
tenantId,
|
|
9894
9893
|
projectId,
|
|
9895
9894
|
conversationId,
|
|
@@ -10278,7 +10277,7 @@ app2.openapi(chatCompletionsRoute, async (c) => {
|
|
|
10278
10277
|
});
|
|
10279
10278
|
}
|
|
10280
10279
|
await createMessage(dbClient_default)({
|
|
10281
|
-
id:
|
|
10280
|
+
id: generateId(),
|
|
10282
10281
|
tenantId,
|
|
10283
10282
|
projectId,
|
|
10284
10283
|
conversationId,
|
|
@@ -10507,7 +10506,7 @@ app3.openapi(chatDataStreamRoute, async (c) => {
|
|
|
10507
10506
|
});
|
|
10508
10507
|
}
|
|
10509
10508
|
await createMessage(dbClient_default)({
|
|
10510
|
-
id:
|
|
10509
|
+
id: generateId(),
|
|
10511
10510
|
tenantId,
|
|
10512
10511
|
projectId,
|
|
10513
10512
|
conversationId,
|
|
@@ -10957,7 +10956,7 @@ var processUserMessage = async (tenantId, projectId, conversationId, query) => {
|
|
|
10957
10956
|
});
|
|
10958
10957
|
}
|
|
10959
10958
|
await createMessage(dbClient_default)({
|
|
10960
|
-
id:
|
|
10959
|
+
id: generateId(),
|
|
10961
10960
|
tenantId,
|
|
10962
10961
|
projectId,
|
|
10963
10962
|
conversationId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
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",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"traverse": "^0.6.11",
|
|
53
53
|
"ts-pattern": "^5.7.1",
|
|
54
54
|
"zod": "^4.1.11",
|
|
55
|
-
"@inkeep/agents-core": "^0.
|
|
55
|
+
"@inkeep/agents-core": "^0.24.0"
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
58
|
"keytar": "^7.9.0"
|