@inkeep/agents-run-api 0.14.15 → 0.15.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.
- package/dist/index.cjs +132 -9
- package/dist/index.js +132 -9
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -2524,7 +2524,7 @@ var ArtifactParser = _ArtifactParser;
|
|
|
2524
2524
|
// src/services/GraphSession.ts
|
|
2525
2525
|
var logger9 = agentsCore.getLogger("GraphSession");
|
|
2526
2526
|
var GraphSession = class {
|
|
2527
|
-
//
|
|
2527
|
+
// Whether to send data operations
|
|
2528
2528
|
constructor(sessionId, messageId, graphId, tenantId, projectId, contextId) {
|
|
2529
2529
|
this.sessionId = sessionId;
|
|
2530
2530
|
this.messageId = messageId;
|
|
@@ -2553,6 +2553,8 @@ var GraphSession = class {
|
|
|
2553
2553
|
__publicField(this, "artifactService");
|
|
2554
2554
|
// Session-scoped ArtifactService instance
|
|
2555
2555
|
__publicField(this, "artifactParser");
|
|
2556
|
+
// Session-scoped ArtifactParser instance
|
|
2557
|
+
__publicField(this, "isEmitOperations", false);
|
|
2556
2558
|
logger9.debug({ sessionId, messageId, graphId }, "GraphSession created");
|
|
2557
2559
|
if (tenantId && projectId) {
|
|
2558
2560
|
toolSessionManager.createSessionWithId(
|
|
@@ -2581,6 +2583,78 @@ var GraphSession = class {
|
|
|
2581
2583
|
});
|
|
2582
2584
|
}
|
|
2583
2585
|
}
|
|
2586
|
+
/**
|
|
2587
|
+
* Enable emit operations to send data operations
|
|
2588
|
+
*/
|
|
2589
|
+
enableEmitOperations() {
|
|
2590
|
+
this.isEmitOperations = true;
|
|
2591
|
+
logger9.info(
|
|
2592
|
+
{ sessionId: this.sessionId },
|
|
2593
|
+
"\u{1F50D} DEBUG: Emit operations enabled for GraphSession"
|
|
2594
|
+
);
|
|
2595
|
+
}
|
|
2596
|
+
/**
|
|
2597
|
+
* Send data operation to stream when emit operations is enabled
|
|
2598
|
+
*/
|
|
2599
|
+
async sendDataOperation(event) {
|
|
2600
|
+
try {
|
|
2601
|
+
const streamHelper = getStreamHelper(this.sessionId);
|
|
2602
|
+
if (streamHelper) {
|
|
2603
|
+
const formattedOperation = {
|
|
2604
|
+
type: event.eventType,
|
|
2605
|
+
label: this.generateEventLabel(event),
|
|
2606
|
+
details: {
|
|
2607
|
+
timestamp: event.timestamp,
|
|
2608
|
+
agentId: event.agentId,
|
|
2609
|
+
data: event.data
|
|
2610
|
+
}
|
|
2611
|
+
};
|
|
2612
|
+
await streamHelper.writeOperation(formattedOperation);
|
|
2613
|
+
}
|
|
2614
|
+
} catch (error) {
|
|
2615
|
+
logger9.error(
|
|
2616
|
+
{
|
|
2617
|
+
sessionId: this.sessionId,
|
|
2618
|
+
eventType: event.eventType,
|
|
2619
|
+
error: error instanceof Error ? error.message : error
|
|
2620
|
+
},
|
|
2621
|
+
"\u274C DEBUG: Failed to send data operation"
|
|
2622
|
+
);
|
|
2623
|
+
}
|
|
2624
|
+
}
|
|
2625
|
+
/**
|
|
2626
|
+
* Generate human-readable labels for events
|
|
2627
|
+
*/
|
|
2628
|
+
generateEventLabel(event) {
|
|
2629
|
+
switch (event.eventType) {
|
|
2630
|
+
case "agent_generate":
|
|
2631
|
+
return `Agent ${event.agentId} generating response`;
|
|
2632
|
+
case "agent_reasoning":
|
|
2633
|
+
return `Agent ${event.agentId} reasoning through request`;
|
|
2634
|
+
case "tool_execution": {
|
|
2635
|
+
const toolData = event.data;
|
|
2636
|
+
return `Tool execution: ${toolData.toolName || "unknown"}`;
|
|
2637
|
+
}
|
|
2638
|
+
case "transfer": {
|
|
2639
|
+
const transferData = event.data;
|
|
2640
|
+
return `Agent transfer: ${transferData.fromAgent} \u2192 ${transferData.targetAgent}`;
|
|
2641
|
+
}
|
|
2642
|
+
case "delegation_sent": {
|
|
2643
|
+
const delegationData = event.data;
|
|
2644
|
+
return `Task delegated: ${delegationData.fromAgent} \u2192 ${delegationData.targetAgent}`;
|
|
2645
|
+
}
|
|
2646
|
+
case "delegation_returned": {
|
|
2647
|
+
const returnData = event.data;
|
|
2648
|
+
return `Task completed: ${returnData.targetAgent} \u2192 ${returnData.fromAgent}`;
|
|
2649
|
+
}
|
|
2650
|
+
case "artifact_saved": {
|
|
2651
|
+
const artifactData = event.data;
|
|
2652
|
+
return `Artifact saved: ${artifactData.artifactType || "unknown type"}`;
|
|
2653
|
+
}
|
|
2654
|
+
default:
|
|
2655
|
+
return `${event.eventType} event`;
|
|
2656
|
+
}
|
|
2657
|
+
}
|
|
2584
2658
|
/**
|
|
2585
2659
|
* Initialize status updates for this session
|
|
2586
2660
|
*/
|
|
@@ -2626,6 +2700,14 @@ var GraphSession = class {
|
|
|
2626
2700
|
* Record an event in the session and trigger status updates if configured
|
|
2627
2701
|
*/
|
|
2628
2702
|
recordEvent(eventType, agentId, data) {
|
|
2703
|
+
if (this.isEmitOperations) {
|
|
2704
|
+
this.sendDataOperation({
|
|
2705
|
+
timestamp: Date.now(),
|
|
2706
|
+
eventType,
|
|
2707
|
+
agentId,
|
|
2708
|
+
data
|
|
2709
|
+
});
|
|
2710
|
+
}
|
|
2629
2711
|
if (this.isEnded) {
|
|
2630
2712
|
logger9.debug(
|
|
2631
2713
|
{
|
|
@@ -3509,7 +3591,10 @@ Make it specific and relevant.`;
|
|
|
3509
3591
|
}
|
|
3510
3592
|
}
|
|
3511
3593
|
}
|
|
3512
|
-
agentsCore.setSpanWithError(
|
|
3594
|
+
agentsCore.setSpanWithError(
|
|
3595
|
+
generationSpan,
|
|
3596
|
+
lastError instanceof Error ? lastError : new Error(String(lastError))
|
|
3597
|
+
);
|
|
3513
3598
|
throw new Error(
|
|
3514
3599
|
`Artifact name/description generation failed after ${maxRetries} attempts: ${lastError?.message}`
|
|
3515
3600
|
);
|
|
@@ -3670,6 +3755,23 @@ var GraphSessionManager = class {
|
|
|
3670
3755
|
);
|
|
3671
3756
|
}
|
|
3672
3757
|
}
|
|
3758
|
+
/**
|
|
3759
|
+
* Enable emit operations for a session to send data operations
|
|
3760
|
+
*/
|
|
3761
|
+
enableEmitOperations(sessionId) {
|
|
3762
|
+
const session = this.sessions.get(sessionId);
|
|
3763
|
+
if (session) {
|
|
3764
|
+
session.enableEmitOperations();
|
|
3765
|
+
} else {
|
|
3766
|
+
logger9.error(
|
|
3767
|
+
{
|
|
3768
|
+
sessionId,
|
|
3769
|
+
availableSessions: Array.from(this.sessions.keys())
|
|
3770
|
+
},
|
|
3771
|
+
"Session not found for emit operations enablement"
|
|
3772
|
+
);
|
|
3773
|
+
}
|
|
3774
|
+
}
|
|
3673
3775
|
/**
|
|
3674
3776
|
* Get an existing session
|
|
3675
3777
|
*/
|
|
@@ -4255,7 +4357,7 @@ var ResponseFormatter = class {
|
|
|
4255
4357
|
function agentInitializingOp(sessionId, graphId) {
|
|
4256
4358
|
return {
|
|
4257
4359
|
type: "agent_initializing",
|
|
4258
|
-
|
|
4360
|
+
details: {
|
|
4259
4361
|
sessionId,
|
|
4260
4362
|
graphId
|
|
4261
4363
|
}
|
|
@@ -4264,7 +4366,7 @@ function agentInitializingOp(sessionId, graphId) {
|
|
|
4264
4366
|
function completionOp(agentId, iterations) {
|
|
4265
4367
|
return {
|
|
4266
4368
|
type: "completion",
|
|
4267
|
-
|
|
4369
|
+
details: {
|
|
4268
4370
|
agent: agentId,
|
|
4269
4371
|
iteration: iterations
|
|
4270
4372
|
}
|
|
@@ -7128,7 +7230,11 @@ var Agent = class {
|
|
|
7128
7230
|
return null;
|
|
7129
7231
|
}
|
|
7130
7232
|
const contextConfig = await agentsCore.getContextConfigById(dbClient_default)({
|
|
7131
|
-
scopes: {
|
|
7233
|
+
scopes: {
|
|
7234
|
+
tenantId: this.config.tenantId,
|
|
7235
|
+
projectId: this.config.projectId,
|
|
7236
|
+
graphId: this.config.graphId
|
|
7237
|
+
},
|
|
7132
7238
|
id: this.config.contextConfigId
|
|
7133
7239
|
});
|
|
7134
7240
|
if (!contextConfig) {
|
|
@@ -9392,12 +9498,23 @@ var ExecutionHandler = class {
|
|
|
9392
9498
|
* @returns
|
|
9393
9499
|
*/
|
|
9394
9500
|
async execute(params) {
|
|
9395
|
-
const {
|
|
9501
|
+
const {
|
|
9502
|
+
executionContext,
|
|
9503
|
+
conversationId,
|
|
9504
|
+
userMessage,
|
|
9505
|
+
initialAgentId,
|
|
9506
|
+
requestId: requestId2,
|
|
9507
|
+
sseHelper,
|
|
9508
|
+
emitOperations
|
|
9509
|
+
} = params;
|
|
9396
9510
|
const { tenantId, projectId, graphId, apiKey, baseUrl } = executionContext;
|
|
9397
9511
|
registerStreamHelper(requestId2, sseHelper);
|
|
9398
9512
|
graphSessionManager.createSession(requestId2, graphId, tenantId, projectId, conversationId);
|
|
9513
|
+
if (emitOperations) {
|
|
9514
|
+
graphSessionManager.enableEmitOperations(requestId2);
|
|
9515
|
+
}
|
|
9399
9516
|
logger21.info(
|
|
9400
|
-
{ sessionId: requestId2, graphId, conversationId },
|
|
9517
|
+
{ sessionId: requestId2, graphId, conversationId, emitOperations },
|
|
9401
9518
|
"Created GraphSession for message execution"
|
|
9402
9519
|
);
|
|
9403
9520
|
let graphConfig = null;
|
|
@@ -10024,6 +10141,8 @@ app2.openapi(chatCompletionsRoute, async (c) => {
|
|
|
10024
10141
|
const sseHelper = createSSEStreamHelper(stream2, requestId2, timestamp);
|
|
10025
10142
|
await sseHelper.writeRole();
|
|
10026
10143
|
logger22.info({ agentId }, "Starting execution");
|
|
10144
|
+
const emitOperationsHeader = c.req.header("x-emit-operations");
|
|
10145
|
+
const emitOperations = emitOperationsHeader === "true";
|
|
10027
10146
|
const executionHandler = new ExecutionHandler();
|
|
10028
10147
|
const result = await executionHandler.execute({
|
|
10029
10148
|
executionContext,
|
|
@@ -10031,7 +10150,8 @@ app2.openapi(chatCompletionsRoute, async (c) => {
|
|
|
10031
10150
|
userMessage,
|
|
10032
10151
|
initialAgentId: agentId,
|
|
10033
10152
|
requestId: requestId2,
|
|
10034
|
-
sseHelper
|
|
10153
|
+
sseHelper,
|
|
10154
|
+
emitOperations
|
|
10035
10155
|
});
|
|
10036
10156
|
logger22.info(
|
|
10037
10157
|
{ result },
|
|
@@ -10243,6 +10363,8 @@ app3.openapi(chatDataStreamRoute, async (c) => {
|
|
|
10243
10363
|
execute: async ({ writer }) => {
|
|
10244
10364
|
const streamHelper = createVercelStreamHelper(writer);
|
|
10245
10365
|
try {
|
|
10366
|
+
const emitOperationsHeader = c.req.header("x-emit-operations");
|
|
10367
|
+
const emitOperations = emitOperationsHeader === "true";
|
|
10246
10368
|
const executionHandler = new ExecutionHandler();
|
|
10247
10369
|
const result = await executionHandler.execute({
|
|
10248
10370
|
executionContext,
|
|
@@ -10250,7 +10372,8 @@ app3.openapi(chatDataStreamRoute, async (c) => {
|
|
|
10250
10372
|
userMessage: userText,
|
|
10251
10373
|
initialAgentId: agentId,
|
|
10252
10374
|
requestId: `chatds-${Date.now()}`,
|
|
10253
|
-
sseHelper: streamHelper
|
|
10375
|
+
sseHelper: streamHelper,
|
|
10376
|
+
emitOperations
|
|
10254
10377
|
});
|
|
10255
10378
|
if (!result.success) {
|
|
10256
10379
|
await streamHelper.writeOperation(errorOp("Unable to process request", "system"));
|
package/dist/index.js
CHANGED
|
@@ -2048,7 +2048,7 @@ var ArtifactParser = _ArtifactParser;
|
|
|
2048
2048
|
// src/services/GraphSession.ts
|
|
2049
2049
|
var logger8 = getLogger("GraphSession");
|
|
2050
2050
|
var GraphSession = class {
|
|
2051
|
-
//
|
|
2051
|
+
// Whether to send data operations
|
|
2052
2052
|
constructor(sessionId, messageId, graphId, tenantId, projectId, contextId) {
|
|
2053
2053
|
this.sessionId = sessionId;
|
|
2054
2054
|
this.messageId = messageId;
|
|
@@ -2077,6 +2077,8 @@ var GraphSession = class {
|
|
|
2077
2077
|
__publicField(this, "artifactService");
|
|
2078
2078
|
// Session-scoped ArtifactService instance
|
|
2079
2079
|
__publicField(this, "artifactParser");
|
|
2080
|
+
// Session-scoped ArtifactParser instance
|
|
2081
|
+
__publicField(this, "isEmitOperations", false);
|
|
2080
2082
|
logger8.debug({ sessionId, messageId, graphId }, "GraphSession created");
|
|
2081
2083
|
if (tenantId && projectId) {
|
|
2082
2084
|
toolSessionManager.createSessionWithId(
|
|
@@ -2105,6 +2107,78 @@ var GraphSession = class {
|
|
|
2105
2107
|
});
|
|
2106
2108
|
}
|
|
2107
2109
|
}
|
|
2110
|
+
/**
|
|
2111
|
+
* Enable emit operations to send data operations
|
|
2112
|
+
*/
|
|
2113
|
+
enableEmitOperations() {
|
|
2114
|
+
this.isEmitOperations = true;
|
|
2115
|
+
logger8.info(
|
|
2116
|
+
{ sessionId: this.sessionId },
|
|
2117
|
+
"\u{1F50D} DEBUG: Emit operations enabled for GraphSession"
|
|
2118
|
+
);
|
|
2119
|
+
}
|
|
2120
|
+
/**
|
|
2121
|
+
* Send data operation to stream when emit operations is enabled
|
|
2122
|
+
*/
|
|
2123
|
+
async sendDataOperation(event) {
|
|
2124
|
+
try {
|
|
2125
|
+
const streamHelper = getStreamHelper(this.sessionId);
|
|
2126
|
+
if (streamHelper) {
|
|
2127
|
+
const formattedOperation = {
|
|
2128
|
+
type: event.eventType,
|
|
2129
|
+
label: this.generateEventLabel(event),
|
|
2130
|
+
details: {
|
|
2131
|
+
timestamp: event.timestamp,
|
|
2132
|
+
agentId: event.agentId,
|
|
2133
|
+
data: event.data
|
|
2134
|
+
}
|
|
2135
|
+
};
|
|
2136
|
+
await streamHelper.writeOperation(formattedOperation);
|
|
2137
|
+
}
|
|
2138
|
+
} catch (error) {
|
|
2139
|
+
logger8.error(
|
|
2140
|
+
{
|
|
2141
|
+
sessionId: this.sessionId,
|
|
2142
|
+
eventType: event.eventType,
|
|
2143
|
+
error: error instanceof Error ? error.message : error
|
|
2144
|
+
},
|
|
2145
|
+
"\u274C DEBUG: Failed to send data operation"
|
|
2146
|
+
);
|
|
2147
|
+
}
|
|
2148
|
+
}
|
|
2149
|
+
/**
|
|
2150
|
+
* Generate human-readable labels for events
|
|
2151
|
+
*/
|
|
2152
|
+
generateEventLabel(event) {
|
|
2153
|
+
switch (event.eventType) {
|
|
2154
|
+
case "agent_generate":
|
|
2155
|
+
return `Agent ${event.agentId} generating response`;
|
|
2156
|
+
case "agent_reasoning":
|
|
2157
|
+
return `Agent ${event.agentId} reasoning through request`;
|
|
2158
|
+
case "tool_execution": {
|
|
2159
|
+
const toolData = event.data;
|
|
2160
|
+
return `Tool execution: ${toolData.toolName || "unknown"}`;
|
|
2161
|
+
}
|
|
2162
|
+
case "transfer": {
|
|
2163
|
+
const transferData = event.data;
|
|
2164
|
+
return `Agent transfer: ${transferData.fromAgent} \u2192 ${transferData.targetAgent}`;
|
|
2165
|
+
}
|
|
2166
|
+
case "delegation_sent": {
|
|
2167
|
+
const delegationData = event.data;
|
|
2168
|
+
return `Task delegated: ${delegationData.fromAgent} \u2192 ${delegationData.targetAgent}`;
|
|
2169
|
+
}
|
|
2170
|
+
case "delegation_returned": {
|
|
2171
|
+
const returnData = event.data;
|
|
2172
|
+
return `Task completed: ${returnData.targetAgent} \u2192 ${returnData.fromAgent}`;
|
|
2173
|
+
}
|
|
2174
|
+
case "artifact_saved": {
|
|
2175
|
+
const artifactData = event.data;
|
|
2176
|
+
return `Artifact saved: ${artifactData.artifactType || "unknown type"}`;
|
|
2177
|
+
}
|
|
2178
|
+
default:
|
|
2179
|
+
return `${event.eventType} event`;
|
|
2180
|
+
}
|
|
2181
|
+
}
|
|
2108
2182
|
/**
|
|
2109
2183
|
* Initialize status updates for this session
|
|
2110
2184
|
*/
|
|
@@ -2150,6 +2224,14 @@ var GraphSession = class {
|
|
|
2150
2224
|
* Record an event in the session and trigger status updates if configured
|
|
2151
2225
|
*/
|
|
2152
2226
|
recordEvent(eventType, agentId, data) {
|
|
2227
|
+
if (this.isEmitOperations) {
|
|
2228
|
+
this.sendDataOperation({
|
|
2229
|
+
timestamp: Date.now(),
|
|
2230
|
+
eventType,
|
|
2231
|
+
agentId,
|
|
2232
|
+
data
|
|
2233
|
+
});
|
|
2234
|
+
}
|
|
2153
2235
|
if (this.isEnded) {
|
|
2154
2236
|
logger8.debug(
|
|
2155
2237
|
{
|
|
@@ -3033,7 +3115,10 @@ Make it specific and relevant.`;
|
|
|
3033
3115
|
}
|
|
3034
3116
|
}
|
|
3035
3117
|
}
|
|
3036
|
-
setSpanWithError(
|
|
3118
|
+
setSpanWithError(
|
|
3119
|
+
generationSpan,
|
|
3120
|
+
lastError instanceof Error ? lastError : new Error(String(lastError))
|
|
3121
|
+
);
|
|
3037
3122
|
throw new Error(
|
|
3038
3123
|
`Artifact name/description generation failed after ${maxRetries} attempts: ${lastError?.message}`
|
|
3039
3124
|
);
|
|
@@ -3194,6 +3279,23 @@ var GraphSessionManager = class {
|
|
|
3194
3279
|
);
|
|
3195
3280
|
}
|
|
3196
3281
|
}
|
|
3282
|
+
/**
|
|
3283
|
+
* Enable emit operations for a session to send data operations
|
|
3284
|
+
*/
|
|
3285
|
+
enableEmitOperations(sessionId) {
|
|
3286
|
+
const session = this.sessions.get(sessionId);
|
|
3287
|
+
if (session) {
|
|
3288
|
+
session.enableEmitOperations();
|
|
3289
|
+
} else {
|
|
3290
|
+
logger8.error(
|
|
3291
|
+
{
|
|
3292
|
+
sessionId,
|
|
3293
|
+
availableSessions: Array.from(this.sessions.keys())
|
|
3294
|
+
},
|
|
3295
|
+
"Session not found for emit operations enablement"
|
|
3296
|
+
);
|
|
3297
|
+
}
|
|
3298
|
+
}
|
|
3197
3299
|
/**
|
|
3198
3300
|
* Get an existing session
|
|
3199
3301
|
*/
|
|
@@ -3777,7 +3879,7 @@ var ResponseFormatter = class {
|
|
|
3777
3879
|
function agentInitializingOp(sessionId, graphId) {
|
|
3778
3880
|
return {
|
|
3779
3881
|
type: "agent_initializing",
|
|
3780
|
-
|
|
3882
|
+
details: {
|
|
3781
3883
|
sessionId,
|
|
3782
3884
|
graphId
|
|
3783
3885
|
}
|
|
@@ -3786,7 +3888,7 @@ function agentInitializingOp(sessionId, graphId) {
|
|
|
3786
3888
|
function completionOp(agentId, iterations) {
|
|
3787
3889
|
return {
|
|
3788
3890
|
type: "completion",
|
|
3789
|
-
|
|
3891
|
+
details: {
|
|
3790
3892
|
agent: agentId,
|
|
3791
3893
|
iteration: iterations
|
|
3792
3894
|
}
|
|
@@ -6635,7 +6737,11 @@ var Agent = class {
|
|
|
6635
6737
|
return null;
|
|
6636
6738
|
}
|
|
6637
6739
|
const contextConfig = await getContextConfigById(dbClient_default)({
|
|
6638
|
-
scopes: {
|
|
6740
|
+
scopes: {
|
|
6741
|
+
tenantId: this.config.tenantId,
|
|
6742
|
+
projectId: this.config.projectId,
|
|
6743
|
+
graphId: this.config.graphId
|
|
6744
|
+
},
|
|
6639
6745
|
id: this.config.contextConfigId
|
|
6640
6746
|
});
|
|
6641
6747
|
if (!contextConfig) {
|
|
@@ -8885,12 +8991,23 @@ var ExecutionHandler = class {
|
|
|
8885
8991
|
* @returns
|
|
8886
8992
|
*/
|
|
8887
8993
|
async execute(params) {
|
|
8888
|
-
const {
|
|
8994
|
+
const {
|
|
8995
|
+
executionContext,
|
|
8996
|
+
conversationId,
|
|
8997
|
+
userMessage,
|
|
8998
|
+
initialAgentId,
|
|
8999
|
+
requestId: requestId2,
|
|
9000
|
+
sseHelper,
|
|
9001
|
+
emitOperations
|
|
9002
|
+
} = params;
|
|
8889
9003
|
const { tenantId, projectId, graphId, apiKey, baseUrl } = executionContext;
|
|
8890
9004
|
registerStreamHelper(requestId2, sseHelper);
|
|
8891
9005
|
graphSessionManager.createSession(requestId2, graphId, tenantId, projectId, conversationId);
|
|
9006
|
+
if (emitOperations) {
|
|
9007
|
+
graphSessionManager.enableEmitOperations(requestId2);
|
|
9008
|
+
}
|
|
8892
9009
|
logger20.info(
|
|
8893
|
-
{ sessionId: requestId2, graphId, conversationId },
|
|
9010
|
+
{ sessionId: requestId2, graphId, conversationId, emitOperations },
|
|
8894
9011
|
"Created GraphSession for message execution"
|
|
8895
9012
|
);
|
|
8896
9013
|
let graphConfig = null;
|
|
@@ -9516,6 +9633,8 @@ app2.openapi(chatCompletionsRoute, async (c) => {
|
|
|
9516
9633
|
const sseHelper = createSSEStreamHelper(stream2, requestId2, timestamp);
|
|
9517
9634
|
await sseHelper.writeRole();
|
|
9518
9635
|
logger21.info({ agentId }, "Starting execution");
|
|
9636
|
+
const emitOperationsHeader = c.req.header("x-emit-operations");
|
|
9637
|
+
const emitOperations = emitOperationsHeader === "true";
|
|
9519
9638
|
const executionHandler = new ExecutionHandler();
|
|
9520
9639
|
const result = await executionHandler.execute({
|
|
9521
9640
|
executionContext,
|
|
@@ -9523,7 +9642,8 @@ app2.openapi(chatCompletionsRoute, async (c) => {
|
|
|
9523
9642
|
userMessage,
|
|
9524
9643
|
initialAgentId: agentId,
|
|
9525
9644
|
requestId: requestId2,
|
|
9526
|
-
sseHelper
|
|
9645
|
+
sseHelper,
|
|
9646
|
+
emitOperations
|
|
9527
9647
|
});
|
|
9528
9648
|
logger21.info(
|
|
9529
9649
|
{ result },
|
|
@@ -9731,6 +9851,8 @@ app3.openapi(chatDataStreamRoute, async (c) => {
|
|
|
9731
9851
|
execute: async ({ writer }) => {
|
|
9732
9852
|
const streamHelper = createVercelStreamHelper(writer);
|
|
9733
9853
|
try {
|
|
9854
|
+
const emitOperationsHeader = c.req.header("x-emit-operations");
|
|
9855
|
+
const emitOperations = emitOperationsHeader === "true";
|
|
9734
9856
|
const executionHandler = new ExecutionHandler();
|
|
9735
9857
|
const result = await executionHandler.execute({
|
|
9736
9858
|
executionContext,
|
|
@@ -9738,7 +9860,8 @@ app3.openapi(chatDataStreamRoute, async (c) => {
|
|
|
9738
9860
|
userMessage: userText,
|
|
9739
9861
|
initialAgentId: agentId,
|
|
9740
9862
|
requestId: `chatds-${Date.now()}`,
|
|
9741
|
-
sseHelper: streamHelper
|
|
9863
|
+
sseHelper: streamHelper,
|
|
9864
|
+
emitOperations
|
|
9742
9865
|
});
|
|
9743
9866
|
if (!result.success) {
|
|
9744
9867
|
await streamHelper.writeOperation(errorOp("Unable to process request", "system"));
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.15.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",
|
|
@@ -51,7 +51,7 @@
|
|
|
51
51
|
"traverse": "^0.6.11",
|
|
52
52
|
"ts-pattern": "^5.7.1",
|
|
53
53
|
"zod": "^4.1.11",
|
|
54
|
-
"@inkeep/agents-core": "^0.
|
|
54
|
+
"@inkeep/agents-core": "^0.15.0"
|
|
55
55
|
},
|
|
56
56
|
"optionalDependencies": {
|
|
57
57
|
"keytar": "^7.9.0"
|