@inkeep/agents-run-api 0.0.0-dev-20250915163022 → 0.0.0-dev-20250915190940
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 +65 -59
- package/dist/index.js +66 -60
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -7710,69 +7710,75 @@ var ExecutionHandler = class {
|
|
|
7710
7710
|
textContent += part.text;
|
|
7711
7711
|
}
|
|
7712
7712
|
}
|
|
7713
|
-
|
|
7714
|
-
|
|
7715
|
-
|
|
7716
|
-
|
|
7717
|
-
|
|
7718
|
-
|
|
7719
|
-
|
|
7720
|
-
|
|
7721
|
-
|
|
7722
|
-
|
|
7723
|
-
|
|
7724
|
-
|
|
7725
|
-
|
|
7726
|
-
|
|
7727
|
-
|
|
7728
|
-
|
|
7729
|
-
|
|
7730
|
-
|
|
7731
|
-
|
|
7732
|
-
|
|
7733
|
-
|
|
7734
|
-
|
|
7735
|
-
|
|
7736
|
-
|
|
7737
|
-
|
|
7738
|
-
|
|
7739
|
-
|
|
7740
|
-
|
|
7741
|
-
|
|
7742
|
-
|
|
7743
|
-
|
|
7744
|
-
|
|
7745
|
-
|
|
7746
|
-
|
|
7747
|
-
|
|
7748
|
-
|
|
7749
|
-
|
|
7750
|
-
|
|
7751
|
-
|
|
7752
|
-
|
|
7753
|
-
|
|
7713
|
+
return tracer.startActiveSpan("execution_handler.execute", {}, async (span) => {
|
|
7714
|
+
try {
|
|
7715
|
+
span.setAttributes({
|
|
7716
|
+
"ai.response.content": textContent || "No response content",
|
|
7717
|
+
"ai.response.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
|
|
7718
|
+
"ai.agent.name": currentAgentId
|
|
7719
|
+
});
|
|
7720
|
+
await agentsCore.createMessage(dbClient_default)({
|
|
7721
|
+
id: nanoid.nanoid(),
|
|
7722
|
+
tenantId,
|
|
7723
|
+
projectId,
|
|
7724
|
+
conversationId,
|
|
7725
|
+
role: "agent",
|
|
7726
|
+
content: {
|
|
7727
|
+
text: textContent || void 0,
|
|
7728
|
+
parts: responseParts.map((part) => ({
|
|
7729
|
+
type: part.kind === "text" ? "text" : "data",
|
|
7730
|
+
text: part.kind === "text" ? part.text : void 0,
|
|
7731
|
+
data: part.kind === "data" ? JSON.stringify(part.data) : void 0
|
|
7732
|
+
}))
|
|
7733
|
+
},
|
|
7734
|
+
visibility: "user-facing",
|
|
7735
|
+
messageType: "chat",
|
|
7736
|
+
agentId: currentAgentId,
|
|
7737
|
+
fromAgentId: currentAgentId,
|
|
7738
|
+
taskId: task.id
|
|
7739
|
+
});
|
|
7740
|
+
const updateTaskStart = Date.now();
|
|
7741
|
+
await agentsCore.updateTask(dbClient_default)({
|
|
7742
|
+
taskId: task.id,
|
|
7743
|
+
data: {
|
|
7744
|
+
status: "completed",
|
|
7745
|
+
metadata: {
|
|
7746
|
+
...task.metadata,
|
|
7747
|
+
completed_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7748
|
+
response: {
|
|
7749
|
+
text: textContent,
|
|
7750
|
+
parts: responseParts,
|
|
7751
|
+
hasText: !!textContent,
|
|
7752
|
+
hasData: responseParts.some((p) => p.kind === "data")
|
|
7753
|
+
}
|
|
7754
|
+
}
|
|
7754
7755
|
}
|
|
7756
|
+
});
|
|
7757
|
+
const updateTaskEnd = Date.now();
|
|
7758
|
+
logger18.info(
|
|
7759
|
+
{ duration: updateTaskEnd - updateTaskStart },
|
|
7760
|
+
"Completed updateTask operation"
|
|
7761
|
+
);
|
|
7762
|
+
await sseHelper.writeOperation(completionOp(currentAgentId, iterations));
|
|
7763
|
+
await sseHelper.complete();
|
|
7764
|
+
logger18.info({}, "Ending GraphSession and cleaning up");
|
|
7765
|
+
graphSessionManager.endSession(requestId2);
|
|
7766
|
+
logger18.info({}, "Cleaning up streamHelper");
|
|
7767
|
+
unregisterStreamHelper(requestId2);
|
|
7768
|
+
let response;
|
|
7769
|
+
if (sseHelper instanceof MCPStreamHelper) {
|
|
7770
|
+
const captured = sseHelper.getCapturedResponse();
|
|
7771
|
+
response = captured.text || "No response content";
|
|
7755
7772
|
}
|
|
7773
|
+
logger18.info({}, "ExecutionHandler returning success");
|
|
7774
|
+
return { success: true, iterations, response };
|
|
7775
|
+
} catch (error) {
|
|
7776
|
+
agentsCore.setSpanWithError(span, error);
|
|
7777
|
+
throw error;
|
|
7778
|
+
} finally {
|
|
7779
|
+
span.end();
|
|
7756
7780
|
}
|
|
7757
7781
|
});
|
|
7758
|
-
const updateTaskEnd = Date.now();
|
|
7759
|
-
logger18.info(
|
|
7760
|
-
{ duration: updateTaskEnd - updateTaskStart },
|
|
7761
|
-
"Completed updateTask operation"
|
|
7762
|
-
);
|
|
7763
|
-
await sseHelper.writeOperation(completionOp(currentAgentId, iterations));
|
|
7764
|
-
await sseHelper.complete();
|
|
7765
|
-
logger18.info({}, "Ending GraphSession and cleaning up");
|
|
7766
|
-
graphSessionManager.endSession(requestId2);
|
|
7767
|
-
logger18.info({}, "Cleaning up streamHelper");
|
|
7768
|
-
unregisterStreamHelper(requestId2);
|
|
7769
|
-
let response;
|
|
7770
|
-
if (sseHelper instanceof MCPStreamHelper) {
|
|
7771
|
-
const captured = sseHelper.getCapturedResponse();
|
|
7772
|
-
response = captured.text || "No response content";
|
|
7773
|
-
}
|
|
7774
|
-
logger18.info({}, "ExecutionHandler returning success");
|
|
7775
|
-
return { success: true, iterations, response };
|
|
7776
7782
|
}
|
|
7777
7783
|
errorCount++;
|
|
7778
7784
|
logger18.warn(
|
package/dist/index.js
CHANGED
|
@@ -8,7 +8,7 @@ import { resourceFromAttributes } from '@opentelemetry/resources';
|
|
|
8
8
|
import { NodeSDK } from '@opentelemetry/sdk-node';
|
|
9
9
|
import { BatchSpanProcessor } from '@opentelemetry/sdk-trace-base';
|
|
10
10
|
import { ATTR_SERVICE_NAME } from '@opentelemetry/semantic-conventions';
|
|
11
|
-
import { getLogger, getTracer, HeadersScopeSchema, getRequestExecutionContext, getAgentGraphWithDefaultAgent, contextValidationMiddleware, getFullGraph, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getAgentById, handleContextResolution, createMessage, commonGetErrorResponses, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, getAgentGraph, createTask, updateTask, updateConversation, handleApiError,
|
|
11
|
+
import { getLogger, getTracer, HeadersScopeSchema, getRequestExecutionContext, getAgentGraphWithDefaultAgent, contextValidationMiddleware, getFullGraph, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getAgentById, handleContextResolution, createMessage, commonGetErrorResponses, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, getAgentGraph, createTask, updateTask, setSpanWithError, updateConversation, handleApiError, TaskState, setActiveAgentForThread, getConversation, getRelatedAgentsForGraph, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, validateAndGetApiKey, getProject, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getContextConfigById, getFullGraphDefinition, TemplateEngine, graphHasArtifactComponents, MCPTransportType, getExternalAgent } from '@inkeep/agents-core';
|
|
12
12
|
import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
|
|
13
13
|
import { trace, propagation, context, SpanStatusCode } from '@opentelemetry/api';
|
|
14
14
|
import { Hono } from 'hono';
|
|
@@ -7378,69 +7378,75 @@ var ExecutionHandler = class {
|
|
|
7378
7378
|
textContent += part.text;
|
|
7379
7379
|
}
|
|
7380
7380
|
}
|
|
7381
|
-
|
|
7382
|
-
|
|
7383
|
-
|
|
7384
|
-
|
|
7385
|
-
|
|
7386
|
-
|
|
7387
|
-
|
|
7388
|
-
|
|
7389
|
-
|
|
7390
|
-
|
|
7391
|
-
|
|
7392
|
-
|
|
7393
|
-
|
|
7394
|
-
|
|
7395
|
-
|
|
7396
|
-
|
|
7397
|
-
|
|
7398
|
-
|
|
7399
|
-
|
|
7400
|
-
|
|
7401
|
-
|
|
7402
|
-
|
|
7403
|
-
|
|
7404
|
-
|
|
7405
|
-
|
|
7406
|
-
|
|
7407
|
-
|
|
7408
|
-
|
|
7409
|
-
|
|
7410
|
-
|
|
7411
|
-
|
|
7412
|
-
|
|
7413
|
-
|
|
7414
|
-
|
|
7415
|
-
|
|
7416
|
-
|
|
7417
|
-
|
|
7418
|
-
|
|
7419
|
-
|
|
7420
|
-
|
|
7421
|
-
|
|
7381
|
+
return tracer.startActiveSpan("execution_handler.execute", {}, async (span) => {
|
|
7382
|
+
try {
|
|
7383
|
+
span.setAttributes({
|
|
7384
|
+
"ai.response.content": textContent || "No response content",
|
|
7385
|
+
"ai.response.timestamp": (/* @__PURE__ */ new Date()).toISOString(),
|
|
7386
|
+
"ai.agent.name": currentAgentId
|
|
7387
|
+
});
|
|
7388
|
+
await createMessage(dbClient_default)({
|
|
7389
|
+
id: nanoid(),
|
|
7390
|
+
tenantId,
|
|
7391
|
+
projectId,
|
|
7392
|
+
conversationId,
|
|
7393
|
+
role: "agent",
|
|
7394
|
+
content: {
|
|
7395
|
+
text: textContent || void 0,
|
|
7396
|
+
parts: responseParts.map((part) => ({
|
|
7397
|
+
type: part.kind === "text" ? "text" : "data",
|
|
7398
|
+
text: part.kind === "text" ? part.text : void 0,
|
|
7399
|
+
data: part.kind === "data" ? JSON.stringify(part.data) : void 0
|
|
7400
|
+
}))
|
|
7401
|
+
},
|
|
7402
|
+
visibility: "user-facing",
|
|
7403
|
+
messageType: "chat",
|
|
7404
|
+
agentId: currentAgentId,
|
|
7405
|
+
fromAgentId: currentAgentId,
|
|
7406
|
+
taskId: task.id
|
|
7407
|
+
});
|
|
7408
|
+
const updateTaskStart = Date.now();
|
|
7409
|
+
await updateTask(dbClient_default)({
|
|
7410
|
+
taskId: task.id,
|
|
7411
|
+
data: {
|
|
7412
|
+
status: "completed",
|
|
7413
|
+
metadata: {
|
|
7414
|
+
...task.metadata,
|
|
7415
|
+
completed_at: (/* @__PURE__ */ new Date()).toISOString(),
|
|
7416
|
+
response: {
|
|
7417
|
+
text: textContent,
|
|
7418
|
+
parts: responseParts,
|
|
7419
|
+
hasText: !!textContent,
|
|
7420
|
+
hasData: responseParts.some((p) => p.kind === "data")
|
|
7421
|
+
}
|
|
7422
|
+
}
|
|
7422
7423
|
}
|
|
7424
|
+
});
|
|
7425
|
+
const updateTaskEnd = Date.now();
|
|
7426
|
+
logger18.info(
|
|
7427
|
+
{ duration: updateTaskEnd - updateTaskStart },
|
|
7428
|
+
"Completed updateTask operation"
|
|
7429
|
+
);
|
|
7430
|
+
await sseHelper.writeOperation(completionOp(currentAgentId, iterations));
|
|
7431
|
+
await sseHelper.complete();
|
|
7432
|
+
logger18.info({}, "Ending GraphSession and cleaning up");
|
|
7433
|
+
graphSessionManager.endSession(requestId2);
|
|
7434
|
+
logger18.info({}, "Cleaning up streamHelper");
|
|
7435
|
+
unregisterStreamHelper(requestId2);
|
|
7436
|
+
let response;
|
|
7437
|
+
if (sseHelper instanceof MCPStreamHelper) {
|
|
7438
|
+
const captured = sseHelper.getCapturedResponse();
|
|
7439
|
+
response = captured.text || "No response content";
|
|
7423
7440
|
}
|
|
7441
|
+
logger18.info({}, "ExecutionHandler returning success");
|
|
7442
|
+
return { success: true, iterations, response };
|
|
7443
|
+
} catch (error) {
|
|
7444
|
+
setSpanWithError(span, error);
|
|
7445
|
+
throw error;
|
|
7446
|
+
} finally {
|
|
7447
|
+
span.end();
|
|
7424
7448
|
}
|
|
7425
7449
|
});
|
|
7426
|
-
const updateTaskEnd = Date.now();
|
|
7427
|
-
logger18.info(
|
|
7428
|
-
{ duration: updateTaskEnd - updateTaskStart },
|
|
7429
|
-
"Completed updateTask operation"
|
|
7430
|
-
);
|
|
7431
|
-
await sseHelper.writeOperation(completionOp(currentAgentId, iterations));
|
|
7432
|
-
await sseHelper.complete();
|
|
7433
|
-
logger18.info({}, "Ending GraphSession and cleaning up");
|
|
7434
|
-
graphSessionManager.endSession(requestId2);
|
|
7435
|
-
logger18.info({}, "Cleaning up streamHelper");
|
|
7436
|
-
unregisterStreamHelper(requestId2);
|
|
7437
|
-
let response;
|
|
7438
|
-
if (sseHelper instanceof MCPStreamHelper) {
|
|
7439
|
-
const captured = sseHelper.getCapturedResponse();
|
|
7440
|
-
response = captured.text || "No response content";
|
|
7441
|
-
}
|
|
7442
|
-
logger18.info({}, "ExecutionHandler returning success");
|
|
7443
|
-
return { success: true, iterations, response };
|
|
7444
7450
|
}
|
|
7445
7451
|
errorCount++;
|
|
7446
7452
|
logger18.warn(
|
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-20250915190940",
|
|
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-20250915190940"
|
|
48
48
|
},
|
|
49
49
|
"devDependencies": {
|
|
50
50
|
"@hono/vite-dev-server": "^0.20.1",
|