@inkeep/agents-run-api 0.29.3 → 0.29.4
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 +98 -340
- package/dist/index.js +93 -333
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -4,7 +4,7 @@ import { dbClient_default } from './chunk-TRNLEUK2.js';
|
|
|
4
4
|
import { env } from './chunk-Z4TYO3W3.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, generateId, commonGetErrorResponses, loggerFactory,
|
|
7
|
+
import { getTracer, HeadersScopeSchema, getRequestExecutionContext, createApiError, getAgentWithDefaultSubAgent, contextValidationMiddleware, getConversationId, getFullAgent, createOrGetConversation, getActiveAgentForConversation, setActiveAgentForConversation, getSubAgentById, handleContextResolution, createMessage, generateId, commonGetErrorResponses, loggerFactory, createDefaultCredentialStores, CredentialStoreRegistry, listTaskIdsByContextId, getTask, getLedgerArtifacts, upsertLedgerArtifact, createTask, updateTask, setSpanWithError, updateConversation, handleApiError, TaskState, setActiveAgentForThread, getConversation, getAgentById, getRelatedAgentsForAgent, getExternalAgentsForSubAgent, getTeamAgentsForSubAgent, getToolsForAgent, getDataComponentsForAgent, getArtifactComponentsForAgent, dbResultToMcpTool, validateAndGetApiKey, verifyServiceToken, validateTargetAgent, getProject, ContextResolver, CredentialStuffer, MCPServerType, getCredentialReference, McpClient, getFunctionToolsForSubAgent, getFunction, getContextConfigById, getFullAgentDefinition, TemplateEngine, agentHasArtifactComponents, MCPTransportType, SPAN_KEYS, headers, generateServiceToken } 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,7 @@ 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 { createUIMessageStream, JsonToSseTransformStream,
|
|
19
|
+
import { createUIMessageStream, JsonToSseTransformStream, parsePartialJson, generateObject, tool, streamText, generateText, streamObject } from 'ai';
|
|
20
20
|
import { createAnthropic, anthropic } from '@ai-sdk/anthropic';
|
|
21
21
|
import { createGateway, gateway } from '@ai-sdk/gateway';
|
|
22
22
|
import { createGoogleGenerativeAI, google } from '@ai-sdk/google';
|
|
@@ -289,10 +289,10 @@ var extractContextFromTeamAgentToken = async (token, baseUrl, expectedSubAgentId
|
|
|
289
289
|
}
|
|
290
290
|
});
|
|
291
291
|
};
|
|
292
|
-
function setupOpenAPIRoutes(
|
|
293
|
-
|
|
292
|
+
function setupOpenAPIRoutes(app6) {
|
|
293
|
+
app6.get("/openapi.json", (c) => {
|
|
294
294
|
try {
|
|
295
|
-
const document =
|
|
295
|
+
const document = app6.getOpenAPIDocument({
|
|
296
296
|
openapi: "3.0.0",
|
|
297
297
|
info: {
|
|
298
298
|
title: "Inkeep Agents Run API",
|
|
@@ -313,7 +313,7 @@ function setupOpenAPIRoutes(app7) {
|
|
|
313
313
|
return c.json({ error: "Failed to generate OpenAPI document", details: errorDetails }, 500);
|
|
314
314
|
}
|
|
315
315
|
});
|
|
316
|
-
|
|
316
|
+
app6.get(
|
|
317
317
|
"/docs",
|
|
318
318
|
swaggerUI({
|
|
319
319
|
url: "/openapi.json",
|
|
@@ -664,7 +664,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
664
664
|
}
|
|
665
665
|
}
|
|
666
666
|
};
|
|
667
|
-
return streamSSE(c, async (
|
|
667
|
+
return streamSSE(c, async (stream2) => {
|
|
668
668
|
try {
|
|
669
669
|
const initialTask = {
|
|
670
670
|
id: task.id,
|
|
@@ -676,7 +676,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
676
676
|
artifacts: [],
|
|
677
677
|
kind: "task"
|
|
678
678
|
};
|
|
679
|
-
await
|
|
679
|
+
await stream2.writeSSE({
|
|
680
680
|
data: JSON.stringify({
|
|
681
681
|
jsonrpc: "2.0",
|
|
682
682
|
result: initialTask,
|
|
@@ -694,7 +694,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
694
694
|
(part) => part.kind === "data" && part.data && typeof part.data === "object" && part.data.type === "transfer"
|
|
695
695
|
);
|
|
696
696
|
if (transferPart && transferPart.kind === "data" && transferPart.data) {
|
|
697
|
-
await
|
|
697
|
+
await stream2.writeSSE({
|
|
698
698
|
data: JSON.stringify({
|
|
699
699
|
jsonrpc: "2.0",
|
|
700
700
|
result: {
|
|
@@ -728,7 +728,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
728
728
|
contextId: params.message.contextId,
|
|
729
729
|
kind: "message"
|
|
730
730
|
};
|
|
731
|
-
await
|
|
731
|
+
await stream2.writeSSE({
|
|
732
732
|
data: JSON.stringify({
|
|
733
733
|
jsonrpc: "2.0",
|
|
734
734
|
result: messageResponse,
|
|
@@ -743,7 +743,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
743
743
|
},
|
|
744
744
|
artifacts: result.artifacts
|
|
745
745
|
};
|
|
746
|
-
await
|
|
746
|
+
await stream2.writeSSE({
|
|
747
747
|
data: JSON.stringify({
|
|
748
748
|
jsonrpc: "2.0",
|
|
749
749
|
result: completedTask,
|
|
@@ -752,7 +752,7 @@ async function handleMessageStream(c, agent, request) {
|
|
|
752
752
|
});
|
|
753
753
|
} catch (error) {
|
|
754
754
|
console.error("Error in stream execution:", error);
|
|
755
|
-
await
|
|
755
|
+
await stream2.writeSSE({
|
|
756
756
|
data: JSON.stringify({
|
|
757
757
|
jsonrpc: "2.0",
|
|
758
758
|
error: {
|
|
@@ -884,7 +884,7 @@ async function handleTasksResubscribe(c, agent, request) {
|
|
|
884
884
|
id: request.id
|
|
885
885
|
});
|
|
886
886
|
}
|
|
887
|
-
return streamSSE(c, async (
|
|
887
|
+
return streamSSE(c, async (stream2) => {
|
|
888
888
|
try {
|
|
889
889
|
const task = {
|
|
890
890
|
id: params.taskId,
|
|
@@ -896,7 +896,7 @@ async function handleTasksResubscribe(c, agent, request) {
|
|
|
896
896
|
artifacts: [],
|
|
897
897
|
kind: "task"
|
|
898
898
|
};
|
|
899
|
-
await
|
|
899
|
+
await stream2.writeSSE({
|
|
900
900
|
data: JSON.stringify({
|
|
901
901
|
jsonrpc: "2.0",
|
|
902
902
|
result: task,
|
|
@@ -905,7 +905,7 @@ async function handleTasksResubscribe(c, agent, request) {
|
|
|
905
905
|
});
|
|
906
906
|
} catch (error) {
|
|
907
907
|
console.error("Error in task resubscription:", error);
|
|
908
|
-
await
|
|
908
|
+
await stream2.writeSSE({
|
|
909
909
|
data: JSON.stringify({
|
|
910
910
|
jsonrpc: "2.0",
|
|
911
911
|
error: {
|
|
@@ -9444,8 +9444,8 @@ async function executeTransfer({
|
|
|
9444
9444
|
return { success: true, targetSubAgentId };
|
|
9445
9445
|
}
|
|
9446
9446
|
var SSEStreamHelper = class {
|
|
9447
|
-
constructor(
|
|
9448
|
-
this.stream =
|
|
9447
|
+
constructor(stream2, requestId2, timestamp) {
|
|
9448
|
+
this.stream = stream2;
|
|
9449
9449
|
this.requestId = requestId2;
|
|
9450
9450
|
this.timestamp = timestamp;
|
|
9451
9451
|
__publicField(this, "isTextStreaming", false);
|
|
@@ -9611,8 +9611,8 @@ ${errorMessage}`);
|
|
|
9611
9611
|
await this.writeDone();
|
|
9612
9612
|
}
|
|
9613
9613
|
};
|
|
9614
|
-
function createSSEStreamHelper(
|
|
9615
|
-
return new SSEStreamHelper(
|
|
9614
|
+
function createSSEStreamHelper(stream2, requestId2, timestamp) {
|
|
9615
|
+
return new SSEStreamHelper(stream2, requestId2, timestamp);
|
|
9616
9616
|
}
|
|
9617
9617
|
var _VercelDataStreamHelper = class _VercelDataStreamHelper {
|
|
9618
9618
|
// 10 minutes max lifetime
|
|
@@ -9759,12 +9759,12 @@ var _VercelDataStreamHelper = class _VercelDataStreamHelper {
|
|
|
9759
9759
|
async streamData(data) {
|
|
9760
9760
|
await this.writeContent(JSON.stringify(data));
|
|
9761
9761
|
}
|
|
9762
|
-
async mergeStream(
|
|
9762
|
+
async mergeStream(stream2) {
|
|
9763
9763
|
if (this.isCompleted) {
|
|
9764
9764
|
console.warn("Attempted to merge stream to completed stream");
|
|
9765
9765
|
return;
|
|
9766
9766
|
}
|
|
9767
|
-
this.writer.merge(
|
|
9767
|
+
this.writer.merge(stream2);
|
|
9768
9768
|
}
|
|
9769
9769
|
/**
|
|
9770
9770
|
* Clean up all memory allocations
|
|
@@ -10702,9 +10702,9 @@ app2.openapi(chatCompletionsRoute, async (c) => {
|
|
|
10702
10702
|
"database.operation": "insert"
|
|
10703
10703
|
});
|
|
10704
10704
|
}
|
|
10705
|
-
return streamSSE(c, async (
|
|
10705
|
+
return streamSSE(c, async (stream2) => {
|
|
10706
10706
|
try {
|
|
10707
|
-
const sseHelper = createSSEStreamHelper(
|
|
10707
|
+
const sseHelper = createSSEStreamHelper(stream2, requestId2, timestamp);
|
|
10708
10708
|
await sseHelper.writeRole();
|
|
10709
10709
|
logger21.info({ subAgentId }, "Starting execution");
|
|
10710
10710
|
const emitOperationsHeader = c.req.header("x-emit-operations");
|
|
@@ -10741,7 +10741,7 @@ app2.openapi(chatCompletionsRoute, async (c) => {
|
|
|
10741
10741
|
"Error during streaming execution"
|
|
10742
10742
|
);
|
|
10743
10743
|
try {
|
|
10744
|
-
const sseHelper = createSSEStreamHelper(
|
|
10744
|
+
const sseHelper = createSSEStreamHelper(stream2, requestId2, timestamp);
|
|
10745
10745
|
await sseHelper.writeOperation(
|
|
10746
10746
|
errorOp(
|
|
10747
10747
|
"Sorry, I was unable to process your request at this time. Please try again.",
|
|
@@ -10965,7 +10965,7 @@ app3.openapi(chatDataStreamRoute, async (c) => {
|
|
|
10965
10965
|
c.header("x-accel-buffering", "no");
|
|
10966
10966
|
return stream(
|
|
10967
10967
|
c,
|
|
10968
|
-
(
|
|
10968
|
+
(stream2) => stream2.pipe(
|
|
10969
10969
|
dataStream.pipeThrough(new JsonToSseTransformStream()).pipeThrough(new TextEncoderStream())
|
|
10970
10970
|
)
|
|
10971
10971
|
);
|
|
@@ -10979,249 +10979,10 @@ app3.openapi(chatDataStreamRoute, async (c) => {
|
|
|
10979
10979
|
}
|
|
10980
10980
|
});
|
|
10981
10981
|
var chatDataStream_default = app3;
|
|
10982
|
-
var logger23 = getLogger("dataComponentPreview");
|
|
10983
|
-
var app4 = new OpenAPIHono();
|
|
10984
|
-
var generatePreviewRoute = createRoute({
|
|
10985
|
-
method: "post",
|
|
10986
|
-
path: "/:tenantId/projects/:projectId/data-components/:id/generate-render",
|
|
10987
|
-
tags: ["Data Component Preview"],
|
|
10988
|
-
summary: "Generate Component Render",
|
|
10989
|
-
description: "Generate a React/Tailwind component render using AI based on the data component schema",
|
|
10990
|
-
request: {
|
|
10991
|
-
params: z.object({
|
|
10992
|
-
tenantId: z.string(),
|
|
10993
|
-
projectId: z.string(),
|
|
10994
|
-
id: z.string()
|
|
10995
|
-
}),
|
|
10996
|
-
body: {
|
|
10997
|
-
content: {
|
|
10998
|
-
"application/json": {
|
|
10999
|
-
schema: z.object({
|
|
11000
|
-
instructions: z.string().optional().describe("Custom instructions for modifying the component"),
|
|
11001
|
-
existingCode: z.string().optional().describe("Existing component code to modify")
|
|
11002
|
-
})
|
|
11003
|
-
}
|
|
11004
|
-
}
|
|
11005
|
-
}
|
|
11006
|
-
},
|
|
11007
|
-
responses: {
|
|
11008
|
-
200: {
|
|
11009
|
-
description: "Streaming component code generation",
|
|
11010
|
-
headers: z.object({
|
|
11011
|
-
"Content-Type": z.string().default("text/plain; charset=utf-8"),
|
|
11012
|
-
"Cache-Control": z.string().default("no-cache"),
|
|
11013
|
-
Connection: z.string().default("keep-alive")
|
|
11014
|
-
}),
|
|
11015
|
-
content: {
|
|
11016
|
-
"text/plain": {
|
|
11017
|
-
schema: z.string().describe("Streaming generated component code")
|
|
11018
|
-
}
|
|
11019
|
-
}
|
|
11020
|
-
},
|
|
11021
|
-
...commonGetErrorResponses
|
|
11022
|
-
}
|
|
11023
|
-
});
|
|
11024
|
-
app4.openapi(generatePreviewRoute, async (c) => {
|
|
11025
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
11026
|
-
const body = c.req.valid("json");
|
|
11027
|
-
const { instructions, existingCode } = body;
|
|
11028
|
-
logger23.info(
|
|
11029
|
-
{
|
|
11030
|
-
tenantId,
|
|
11031
|
-
projectId,
|
|
11032
|
-
dataComponentId: id,
|
|
11033
|
-
hasInstructions: !!instructions,
|
|
11034
|
-
hasExistingCode: !!existingCode
|
|
11035
|
-
},
|
|
11036
|
-
"Generating component preview"
|
|
11037
|
-
);
|
|
11038
|
-
const dataComponent = await getDataComponent(dbClient_default)({
|
|
11039
|
-
scopes: { tenantId, projectId },
|
|
11040
|
-
dataComponentId: id
|
|
11041
|
-
});
|
|
11042
|
-
if (!dataComponent) {
|
|
11043
|
-
throw createApiError({
|
|
11044
|
-
code: "not_found",
|
|
11045
|
-
message: "Data component not found"
|
|
11046
|
-
});
|
|
11047
|
-
}
|
|
11048
|
-
const project = await getProject(dbClient_default)({
|
|
11049
|
-
scopes: { tenantId, projectId }
|
|
11050
|
-
});
|
|
11051
|
-
if (!project?.models?.base) {
|
|
11052
|
-
throw createApiError({
|
|
11053
|
-
code: "bad_request",
|
|
11054
|
-
message: "Project base model configuration is required"
|
|
11055
|
-
});
|
|
11056
|
-
}
|
|
11057
|
-
const prompt = buildGenerationPrompt(dataComponent, instructions, existingCode);
|
|
11058
|
-
try {
|
|
11059
|
-
const modelConfig = ModelFactory.prepareGenerationConfig(project.models.base);
|
|
11060
|
-
const renderSchema = z.object({
|
|
11061
|
-
component: z.string().describe("The React component code"),
|
|
11062
|
-
mockData: z.any().describe("Sample data matching the props schema")
|
|
11063
|
-
});
|
|
11064
|
-
const result = streamObject({
|
|
11065
|
-
...modelConfig,
|
|
11066
|
-
prompt,
|
|
11067
|
-
schema: renderSchema,
|
|
11068
|
-
temperature: 0.7
|
|
11069
|
-
});
|
|
11070
|
-
c.header("Content-Type", "text/plain; charset=utf-8");
|
|
11071
|
-
c.header("Cache-Control", "no-cache");
|
|
11072
|
-
c.header("Connection", "keep-alive");
|
|
11073
|
-
const existingData = existingCode && dataComponent.render && typeof dataComponent.render === "object" && "mockData" in dataComponent.render ? dataComponent.render.mockData : null;
|
|
11074
|
-
return stream(c, async (stream3) => {
|
|
11075
|
-
try {
|
|
11076
|
-
for await (const partialObject of result.partialObjectStream) {
|
|
11077
|
-
const outputObject = instructions && existingData ? { ...partialObject, mockData: existingData } : partialObject;
|
|
11078
|
-
await stream3.write(JSON.stringify(outputObject) + "\n");
|
|
11079
|
-
}
|
|
11080
|
-
} catch (error) {
|
|
11081
|
-
logger23.error(
|
|
11082
|
-
{ error, tenantId, projectId, dataComponentId: id },
|
|
11083
|
-
"Error streaming preview generation"
|
|
11084
|
-
);
|
|
11085
|
-
await stream3.write(
|
|
11086
|
-
JSON.stringify({ component: "// Error generating component preview", mockData: {} }) + "\n"
|
|
11087
|
-
);
|
|
11088
|
-
}
|
|
11089
|
-
});
|
|
11090
|
-
} catch (error) {
|
|
11091
|
-
logger23.error(
|
|
11092
|
-
{ error, tenantId, projectId, dataComponentId: id },
|
|
11093
|
-
"Error generating component preview"
|
|
11094
|
-
);
|
|
11095
|
-
throw createApiError({
|
|
11096
|
-
code: "internal_server_error",
|
|
11097
|
-
message: "Failed to generate component preview"
|
|
11098
|
-
});
|
|
11099
|
-
}
|
|
11100
|
-
});
|
|
11101
|
-
function buildGenerationPrompt(dataComponent, instructions, existingCode) {
|
|
11102
|
-
const propsSchema = dataComponent.props || {};
|
|
11103
|
-
const propsJson = JSON.stringify(propsSchema, null, 2);
|
|
11104
|
-
const componentName = sanitizeComponentName(dataComponent.name);
|
|
11105
|
-
if (instructions && existingCode) {
|
|
11106
|
-
return `You are an expert React and Tailwind CSS developer. You need to modify an existing React component based on specific instructions.
|
|
11107
|
-
|
|
11108
|
-
COMPONENT DETAILS:
|
|
11109
|
-
- Original Name: ${dataComponent.name}
|
|
11110
|
-
- Component Function Name: ${componentName}
|
|
11111
|
-
- Description: ${dataComponent.description}
|
|
11112
|
-
- Props Schema (JSON Schema): ${propsJson}
|
|
11113
|
-
|
|
11114
|
-
EXISTING COMPONENT CODE:
|
|
11115
|
-
\`\`\`jsx
|
|
11116
|
-
${existingCode}
|
|
11117
|
-
\`\`\`
|
|
11118
|
-
|
|
11119
|
-
MODIFICATION INSTRUCTIONS:
|
|
11120
|
-
${instructions}
|
|
11121
|
-
|
|
11122
|
-
REQUIREMENTS:
|
|
11123
|
-
1. Modify the existing component code according to the instructions
|
|
11124
|
-
2. Keep using Tailwind CSS SEMANTIC COLOR CLASSES (bg-background, text-foreground, etc.)
|
|
11125
|
-
3. Maintain the balanced spacing and design principles from the original
|
|
11126
|
-
4. Keep using lucide-react icons where appropriate
|
|
11127
|
-
5. DO NOT include export statements - just the imports and function
|
|
11128
|
-
6. DO NOT include TypeScript type annotations
|
|
11129
|
-
7. Component name should remain: ${componentName}
|
|
11130
|
-
8. DO NOT regenerate sample data - keep the same data structure
|
|
11131
|
-
|
|
11132
|
-
OUTPUT FORMAT:
|
|
11133
|
-
You need to generate only one thing:
|
|
11134
|
-
1. "component": The modified React component code as a string
|
|
11135
|
-
|
|
11136
|
-
Return ONLY the component field, the mockData field will be reused from the existing render.
|
|
11137
|
-
|
|
11138
|
-
EXAMPLE OUTPUT:
|
|
11139
|
-
{
|
|
11140
|
-
"component": "import { Mail, User } from 'lucide-react';\\n\\nfunction ${componentName}(props) {\\n // Modified component code here\\n}"
|
|
11141
|
-
}
|
|
11142
|
-
|
|
11143
|
-
Focus on making the requested changes while maintaining the component's quality and design principles.`;
|
|
11144
|
-
}
|
|
11145
|
-
return `You are an expert React and Tailwind CSS developer. Generate a beautiful, modern React component for displaying data and sample data to preview it.
|
|
11146
|
-
|
|
11147
|
-
COMPONENT DETAILS:
|
|
11148
|
-
- Original Name: ${dataComponent.name}
|
|
11149
|
-
- Component Function Name: ${componentName}
|
|
11150
|
-
- Description: ${dataComponent.description}
|
|
11151
|
-
- Props Schema (JSON Schema): ${propsJson}
|
|
11152
|
-
|
|
11153
|
-
REQUIREMENTS:
|
|
11154
|
-
1. Create a React functional component (JSX, not TypeScript)
|
|
11155
|
-
2. Use Tailwind CSS SEMANTIC COLOR CLASSES (these automatically adapt to light/dark mode):
|
|
11156
|
-
- Background: bg-background, bg-card, bg-muted, bg-muted/40, bg-accent, bg-primary
|
|
11157
|
-
- Text: text-foreground, text-muted-foreground, text-card-foreground, text-primary-foreground
|
|
11158
|
-
- Borders: border-border, border-input, border-muted
|
|
11159
|
-
- DO NOT use direct colors like bg-white, bg-gray-800, text-gray-900, etc.
|
|
11160
|
-
- DO NOT use dark: prefix - semantic classes handle dark mode automatically
|
|
11161
|
-
3. Make it balanced - comfortable but efficient:
|
|
11162
|
-
- Use moderate padding: p-4, px-4 py-3 (balanced, not cramped or excessive)
|
|
11163
|
-
- Use appropriate text sizes: text-sm for body, text-base for headings, text-xs for captions
|
|
11164
|
-
- Use balanced spacing: gap-2.5, gap-3, space-y-2, mt-2, mb-3
|
|
11165
|
-
- Aim for a clean, professional look with good readability
|
|
11166
|
-
4. Design for embedding - this component blends into existing content:
|
|
11167
|
-
- DO NOT add redundant titles or headers unless they're part of the actual data schema
|
|
11168
|
-
- Focus on displaying the data directly and elegantly
|
|
11169
|
-
- Assume the component is part of a larger conversation or content flow
|
|
11170
|
-
- If the schema has a "title" or "name" property, display it as data, not as a wrapper heading
|
|
11171
|
-
5. Use LUCIDE-REACT ICONS to enhance UI aesthetics:
|
|
11172
|
-
- Import icons from lucide-react: import { User, Mail, Clock } from 'lucide-react'
|
|
11173
|
-
- Use icons with size-4 or size-5 classes for balanced visibility
|
|
11174
|
-
- Place icons inline with text or as visual indicators
|
|
11175
|
-
- Example: <User className="size-4" /> or <Mail className="size-4 text-muted-foreground" />
|
|
11176
|
-
- Common useful icons: User, Mail, Calendar, Clock, Check, X, Star, Heart, Settings, Search, etc.
|
|
11177
|
-
6. The component should accept props that match the JSON Schema properties
|
|
11178
|
-
7. Make it visually appealing and professional - clean with good whitespace
|
|
11179
|
-
8. Use semantic HTML elements
|
|
11180
|
-
9. Make it responsive and accessible
|
|
11181
|
-
10. You can import icons from 'lucide-react' at the top
|
|
11182
|
-
11. DO NOT include export statements - just the imports and function
|
|
11183
|
-
12. DO NOT include TypeScript type annotations
|
|
11184
|
-
13. Component name should be exactly: ${componentName}
|
|
11185
|
-
|
|
11186
|
-
AVAILABLE SEMANTIC COLOR CLASSES:
|
|
11187
|
-
- Backgrounds: bg-background, bg-foreground, bg-card, bg-popover, bg-primary, bg-secondary, bg-muted, bg-accent, bg-destructive
|
|
11188
|
-
- Text: text-foreground, text-background, text-card-foreground, text-popover-foreground, text-primary-foreground, text-secondary-foreground, text-muted-foreground, text-accent-foreground, text-destructive
|
|
11189
|
-
- Borders: border-border, border-input, border-ring
|
|
11190
|
-
- You can use opacity modifiers: bg-muted/40, bg-accent/10, etc.
|
|
11191
|
-
|
|
11192
|
-
OUTPUT FORMAT:
|
|
11193
|
-
You need to generate two things:
|
|
11194
|
-
1. "component": The complete React component code as a string
|
|
11195
|
-
2. "mockData": Realistic sample data that matches the props schema (as a JSON object)
|
|
11196
|
-
|
|
11197
|
-
EXAMPLE OUTPUT (for a user profile schema with name, email, role):
|
|
11198
|
-
{
|
|
11199
|
-
"component": "import { Mail, User } from 'lucide-react';\\n\\nfunction ${componentName}(props) {\\n return (\\n <div className=\\"p-4 rounded-lg border border-border bg-card\\">\\n <div className=\\"flex items-center gap-2.5 mb-2\\">\\n <User className=\\"size-4 text-muted-foreground\\" />\\n <span className=\\"text-base font-medium text-foreground\\">{props.name}</span>\\n </div>\\n <div className=\\"flex items-center gap-2 text-sm text-muted-foreground\\">\\n <Mail className=\\"size-4\\" />\\n <span>{props.email}</span>\\n </div>\\n <div className=\\"text-xs text-muted-foreground mt-2\\">Role: {props.role}</div>\\n </div>\\n );\\n}",
|
|
11200
|
-
"mockData": {
|
|
11201
|
-
"name": "Sarah Chen",
|
|
11202
|
-
"email": "sarah.chen@example.com",
|
|
11203
|
-
"role": "Product Manager"
|
|
11204
|
-
}
|
|
11205
|
-
}
|
|
11206
|
-
|
|
11207
|
-
REMEMBER:
|
|
11208
|
-
- ONLY use semantic color classes (bg-card, text-foreground, etc.)
|
|
11209
|
-
- NO direct colors (bg-white, text-gray-900, etc.)
|
|
11210
|
-
- NO dark: prefix needed - semantic classes adapt automatically
|
|
11211
|
-
- Use balanced spacing (p-4, gap-2.5/gap-3, text-sm for body, text-base for headings)
|
|
11212
|
-
- Use lucide-react icons where appropriate for better UI
|
|
11213
|
-
- NO redundant titles - just display the actual data from props
|
|
11214
|
-
- Design for embedding - this blends into existing content, not a standalone card
|
|
11215
|
-
- Make the sample data realistic and useful for previewing the component`;
|
|
11216
|
-
}
|
|
11217
|
-
function sanitizeComponentName(name) {
|
|
11218
|
-
return name.split(/\s+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join("").replace(/[^a-zA-Z0-9]/g, "");
|
|
11219
|
-
}
|
|
11220
|
-
var dataComponentPreview_default = app4;
|
|
11221
10982
|
function createMCPSchema(schema) {
|
|
11222
10983
|
return schema;
|
|
11223
10984
|
}
|
|
11224
|
-
var
|
|
10985
|
+
var logger23 = getLogger("mcp");
|
|
11225
10986
|
var _MockResponseSingleton = class _MockResponseSingleton {
|
|
11226
10987
|
constructor() {
|
|
11227
10988
|
__publicField(this, "mockRes");
|
|
@@ -11276,21 +11037,21 @@ var createSpoofInitMessage = (mcpProtocolVersion) => ({
|
|
|
11276
11037
|
id: 0
|
|
11277
11038
|
});
|
|
11278
11039
|
var spoofTransportInitialization = async (transport, req, sessionId, mcpProtocolVersion) => {
|
|
11279
|
-
|
|
11040
|
+
logger23.info({ sessionId }, "Spoofing initialization message to set transport state");
|
|
11280
11041
|
const spoofInitMessage = createSpoofInitMessage(mcpProtocolVersion);
|
|
11281
11042
|
const mockRes = MockResponseSingleton.getInstance().getMockResponse();
|
|
11282
11043
|
try {
|
|
11283
11044
|
await transport.handleRequest(req, mockRes, spoofInitMessage);
|
|
11284
|
-
|
|
11045
|
+
logger23.info({ sessionId }, "Successfully spoofed initialization");
|
|
11285
11046
|
} catch (spoofError) {
|
|
11286
|
-
|
|
11047
|
+
logger23.warn({ sessionId, error: spoofError }, "Spoof initialization failed, continuing anyway");
|
|
11287
11048
|
}
|
|
11288
11049
|
};
|
|
11289
11050
|
var validateSession = async (req, res, body, tenantId, projectId, agentId) => {
|
|
11290
11051
|
const sessionId = req.headers["mcp-session-id"];
|
|
11291
|
-
|
|
11052
|
+
logger23.info({ sessionId }, "Received MCP session ID");
|
|
11292
11053
|
if (!sessionId) {
|
|
11293
|
-
|
|
11054
|
+
logger23.info({ body }, "Missing session ID");
|
|
11294
11055
|
res.writeHead(400).end(
|
|
11295
11056
|
JSON.stringify({
|
|
11296
11057
|
jsonrpc: "2.0",
|
|
@@ -11316,7 +11077,7 @@ var validateSession = async (req, res, body, tenantId, projectId, agentId) => {
|
|
|
11316
11077
|
scopes: { tenantId, projectId },
|
|
11317
11078
|
conversationId: sessionId
|
|
11318
11079
|
});
|
|
11319
|
-
|
|
11080
|
+
logger23.info(
|
|
11320
11081
|
{
|
|
11321
11082
|
sessionId,
|
|
11322
11083
|
conversationFound: !!conversation,
|
|
@@ -11327,7 +11088,7 @@ var validateSession = async (req, res, body, tenantId, projectId, agentId) => {
|
|
|
11327
11088
|
"Conversation lookup result"
|
|
11328
11089
|
);
|
|
11329
11090
|
if (!conversation || conversation.metadata?.sessionData?.sessionType !== "mcp" || conversation.metadata?.sessionData?.agentId !== agentId) {
|
|
11330
|
-
|
|
11091
|
+
logger23.info(
|
|
11331
11092
|
{ sessionId, conversationId: conversation?.id },
|
|
11332
11093
|
"MCP session not found or invalid"
|
|
11333
11094
|
);
|
|
@@ -11388,7 +11149,7 @@ var executeAgentQuery = async (executionContext, conversationId, query, defaultS
|
|
|
11388
11149
|
requestId: requestId2,
|
|
11389
11150
|
sseHelper: mcpStreamHelper
|
|
11390
11151
|
});
|
|
11391
|
-
|
|
11152
|
+
logger23.info(
|
|
11392
11153
|
{ result },
|
|
11393
11154
|
`Execution completed: ${result.success ? "success" : "failed"} after ${result.iterations} iterations`
|
|
11394
11155
|
);
|
|
@@ -11472,7 +11233,7 @@ var getServer = async (headers2, executionContext, conversationId, credentialSto
|
|
|
11472
11233
|
dbClient: dbClient_default,
|
|
11473
11234
|
credentialStores
|
|
11474
11235
|
});
|
|
11475
|
-
|
|
11236
|
+
logger23.info(
|
|
11476
11237
|
{
|
|
11477
11238
|
tenantId,
|
|
11478
11239
|
projectId,
|
|
@@ -11501,8 +11262,8 @@ var getServer = async (headers2, executionContext, conversationId, credentialSto
|
|
|
11501
11262
|
);
|
|
11502
11263
|
return server;
|
|
11503
11264
|
};
|
|
11504
|
-
var
|
|
11505
|
-
|
|
11265
|
+
var app4 = new OpenAPIHono();
|
|
11266
|
+
app4.use("/", async (c, next) => {
|
|
11506
11267
|
if (c.req.method === "POST") {
|
|
11507
11268
|
return contextValidationMiddleware(dbClient_default)(c, next);
|
|
11508
11269
|
}
|
|
@@ -11534,7 +11295,7 @@ var validateRequestParameters = (c) => {
|
|
|
11534
11295
|
};
|
|
11535
11296
|
var handleInitializationRequest = async (body, executionContext, validatedContext, req, res, c, credentialStores) => {
|
|
11536
11297
|
const { tenantId, projectId, agentId } = executionContext;
|
|
11537
|
-
|
|
11298
|
+
logger23.info({ body }, "Received initialization request");
|
|
11538
11299
|
const sessionId = getConversationId();
|
|
11539
11300
|
const activeSpan = trace.getActiveSpan();
|
|
11540
11301
|
if (activeSpan) {
|
|
@@ -11590,7 +11351,7 @@ var handleInitializationRequest = async (body, executionContext, validatedContex
|
|
|
11590
11351
|
}
|
|
11591
11352
|
}
|
|
11592
11353
|
});
|
|
11593
|
-
|
|
11354
|
+
logger23.info(
|
|
11594
11355
|
{ sessionId, conversationId: conversation.id },
|
|
11595
11356
|
"Created MCP session as conversation"
|
|
11596
11357
|
);
|
|
@@ -11599,9 +11360,9 @@ var handleInitializationRequest = async (body, executionContext, validatedContex
|
|
|
11599
11360
|
});
|
|
11600
11361
|
const server = await getServer(validatedContext, executionContext, sessionId, credentialStores);
|
|
11601
11362
|
await server.connect(transport);
|
|
11602
|
-
|
|
11363
|
+
logger23.info({ sessionId }, "Server connected for initialization");
|
|
11603
11364
|
res.setHeader("Mcp-Session-Id", sessionId);
|
|
11604
|
-
|
|
11365
|
+
logger23.info(
|
|
11605
11366
|
{
|
|
11606
11367
|
sessionId,
|
|
11607
11368
|
bodyMethod: body?.method,
|
|
@@ -11610,7 +11371,7 @@ var handleInitializationRequest = async (body, executionContext, validatedContex
|
|
|
11610
11371
|
"About to handle initialization request"
|
|
11611
11372
|
);
|
|
11612
11373
|
await transport.handleRequest(req, res, body);
|
|
11613
|
-
|
|
11374
|
+
logger23.info({ sessionId }, "Successfully handled initialization request");
|
|
11614
11375
|
return toFetchResponse(res);
|
|
11615
11376
|
});
|
|
11616
11377
|
};
|
|
@@ -11637,8 +11398,8 @@ var handleExistingSessionRequest = async (body, executionContext, validatedConte
|
|
|
11637
11398
|
sessionId,
|
|
11638
11399
|
conversation.metadata?.session_data?.mcpProtocolVersion
|
|
11639
11400
|
);
|
|
11640
|
-
|
|
11641
|
-
|
|
11401
|
+
logger23.info({ sessionId }, "Server connected and transport initialized");
|
|
11402
|
+
logger23.info(
|
|
11642
11403
|
{
|
|
11643
11404
|
sessionId,
|
|
11644
11405
|
bodyKeys: Object.keys(body || {}),
|
|
@@ -11652,9 +11413,9 @@ var handleExistingSessionRequest = async (body, executionContext, validatedConte
|
|
|
11652
11413
|
);
|
|
11653
11414
|
try {
|
|
11654
11415
|
await transport.handleRequest(req, res, body);
|
|
11655
|
-
|
|
11416
|
+
logger23.info({ sessionId }, "Successfully handled MCP request");
|
|
11656
11417
|
} catch (transportError) {
|
|
11657
|
-
|
|
11418
|
+
logger23.error(
|
|
11658
11419
|
{
|
|
11659
11420
|
sessionId,
|
|
11660
11421
|
error: transportError,
|
|
@@ -11671,7 +11432,7 @@ var createErrorResponse = (code, message, id = null) => ({
|
|
|
11671
11432
|
error: { code, message },
|
|
11672
11433
|
id
|
|
11673
11434
|
});
|
|
11674
|
-
|
|
11435
|
+
app4.openapi(
|
|
11675
11436
|
createRoute({
|
|
11676
11437
|
method: "post",
|
|
11677
11438
|
path: "/",
|
|
@@ -11705,13 +11466,13 @@ app5.openapi(
|
|
|
11705
11466
|
}
|
|
11706
11467
|
const { executionContext } = paramValidation;
|
|
11707
11468
|
const body = c.get("requestBody") || {};
|
|
11708
|
-
|
|
11469
|
+
logger23.info({ body, bodyKeys: Object.keys(body || {}) }, "Parsed request body");
|
|
11709
11470
|
const isInitRequest = body.method === "initialize";
|
|
11710
11471
|
const { req, res } = toReqRes(c.req.raw);
|
|
11711
11472
|
const validatedContext = c.get("validatedContext") || {};
|
|
11712
11473
|
const credentialStores = c.get("credentialStores");
|
|
11713
|
-
|
|
11714
|
-
|
|
11474
|
+
logger23.info({ validatedContext }, "Validated context");
|
|
11475
|
+
logger23.info({ req }, "request");
|
|
11715
11476
|
if (isInitRequest) {
|
|
11716
11477
|
return await handleInitializationRequest(
|
|
11717
11478
|
body,
|
|
@@ -11733,7 +11494,7 @@ app5.openapi(
|
|
|
11733
11494
|
);
|
|
11734
11495
|
}
|
|
11735
11496
|
} catch (e) {
|
|
11736
|
-
|
|
11497
|
+
logger23.error(
|
|
11737
11498
|
{
|
|
11738
11499
|
error: e instanceof Error ? e.message : e,
|
|
11739
11500
|
stack: e instanceof Error ? e.stack : void 0
|
|
@@ -11744,8 +11505,8 @@ app5.openapi(
|
|
|
11744
11505
|
}
|
|
11745
11506
|
}
|
|
11746
11507
|
);
|
|
11747
|
-
|
|
11748
|
-
|
|
11508
|
+
app4.get("/", async (c) => {
|
|
11509
|
+
logger23.info({}, "Received GET MCP request");
|
|
11749
11510
|
return c.json(
|
|
11750
11511
|
{
|
|
11751
11512
|
jsonrpc: "2.0",
|
|
@@ -11758,8 +11519,8 @@ app5.get("/", async (c) => {
|
|
|
11758
11519
|
{ status: 405 }
|
|
11759
11520
|
);
|
|
11760
11521
|
});
|
|
11761
|
-
|
|
11762
|
-
|
|
11522
|
+
app4.delete("/", async (c) => {
|
|
11523
|
+
logger23.info({}, "Received DELETE MCP request");
|
|
11763
11524
|
return c.json(
|
|
11764
11525
|
{
|
|
11765
11526
|
jsonrpc: "2.0",
|
|
@@ -11769,15 +11530,15 @@ app5.delete("/", async (c) => {
|
|
|
11769
11530
|
{ status: 405 }
|
|
11770
11531
|
);
|
|
11771
11532
|
});
|
|
11772
|
-
var mcp_default =
|
|
11533
|
+
var mcp_default = app4;
|
|
11773
11534
|
|
|
11774
11535
|
// src/app.ts
|
|
11775
|
-
var
|
|
11536
|
+
var logger24 = getLogger("agents-run-api");
|
|
11776
11537
|
function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
11777
|
-
const
|
|
11778
|
-
|
|
11779
|
-
|
|
11780
|
-
|
|
11538
|
+
const app6 = new OpenAPIHono();
|
|
11539
|
+
app6.use("*", otel());
|
|
11540
|
+
app6.use("*", requestId());
|
|
11541
|
+
app6.use("*", async (c, next) => {
|
|
11781
11542
|
c.set("serverConfig", serverConfig);
|
|
11782
11543
|
c.set("credentialStores", credentialStores);
|
|
11783
11544
|
if (sandboxConfig) {
|
|
@@ -11785,18 +11546,18 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11785
11546
|
}
|
|
11786
11547
|
return next();
|
|
11787
11548
|
});
|
|
11788
|
-
|
|
11549
|
+
app6.use("*", async (c, next) => {
|
|
11789
11550
|
if (c.req.header("content-type")?.includes("application/json")) {
|
|
11790
11551
|
try {
|
|
11791
11552
|
const body = await c.req.json();
|
|
11792
11553
|
c.set("requestBody", body);
|
|
11793
11554
|
} catch (error) {
|
|
11794
|
-
|
|
11555
|
+
logger24.debug({ error }, "Failed to parse JSON body, continuing without parsed body");
|
|
11795
11556
|
}
|
|
11796
11557
|
}
|
|
11797
11558
|
return next();
|
|
11798
11559
|
});
|
|
11799
|
-
|
|
11560
|
+
app6.use("*", async (c, next) => {
|
|
11800
11561
|
const reqId = c.get("requestId");
|
|
11801
11562
|
let bag = propagation.getBaggage(context.active());
|
|
11802
11563
|
if (!bag) {
|
|
@@ -11809,7 +11570,7 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11809
11570
|
}
|
|
11810
11571
|
return next();
|
|
11811
11572
|
});
|
|
11812
|
-
|
|
11573
|
+
app6.onError(async (err, c) => {
|
|
11813
11574
|
const isExpectedError = err instanceof HTTPException;
|
|
11814
11575
|
const status = isExpectedError ? err.status : 500;
|
|
11815
11576
|
const requestId2 = c.get("requestId") || "unknown";
|
|
@@ -11842,8 +11603,8 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11842
11603
|
if (!isExpectedError) {
|
|
11843
11604
|
const errorMessage = err instanceof Error ? err.message : String(err);
|
|
11844
11605
|
const errorStack = err instanceof Error ? err.stack : void 0;
|
|
11845
|
-
if (
|
|
11846
|
-
|
|
11606
|
+
if (logger24) {
|
|
11607
|
+
logger24.error(
|
|
11847
11608
|
{
|
|
11848
11609
|
error: err,
|
|
11849
11610
|
message: errorMessage,
|
|
@@ -11855,8 +11616,8 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11855
11616
|
);
|
|
11856
11617
|
}
|
|
11857
11618
|
} else {
|
|
11858
|
-
if (
|
|
11859
|
-
|
|
11619
|
+
if (logger24) {
|
|
11620
|
+
logger24.error(
|
|
11860
11621
|
{
|
|
11861
11622
|
error: err,
|
|
11862
11623
|
path: c.req.path,
|
|
@@ -11873,8 +11634,8 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11873
11634
|
const response = err.getResponse();
|
|
11874
11635
|
return response;
|
|
11875
11636
|
} catch (responseError) {
|
|
11876
|
-
if (
|
|
11877
|
-
|
|
11637
|
+
if (logger24) {
|
|
11638
|
+
logger24.error({ error: responseError }, "Error while handling HTTPException response");
|
|
11878
11639
|
}
|
|
11879
11640
|
}
|
|
11880
11641
|
}
|
|
@@ -11890,7 +11651,7 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11890
11651
|
...instance && { instance }
|
|
11891
11652
|
});
|
|
11892
11653
|
});
|
|
11893
|
-
|
|
11654
|
+
app6.use(
|
|
11894
11655
|
"*",
|
|
11895
11656
|
cors({
|
|
11896
11657
|
origin: "*",
|
|
@@ -11901,14 +11662,14 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11901
11662
|
maxAge: 86400
|
|
11902
11663
|
})
|
|
11903
11664
|
);
|
|
11904
|
-
|
|
11905
|
-
|
|
11906
|
-
|
|
11907
|
-
|
|
11908
|
-
|
|
11665
|
+
app6.use("/tenants/*", apiKeyAuth());
|
|
11666
|
+
app6.use("/agents/*", apiKeyAuth());
|
|
11667
|
+
app6.use("/v1/*", apiKeyAuth());
|
|
11668
|
+
app6.use("/api/*", apiKeyAuth());
|
|
11669
|
+
app6.use("*", async (c, next) => {
|
|
11909
11670
|
const executionContext = c.get("executionContext");
|
|
11910
11671
|
if (!executionContext) {
|
|
11911
|
-
|
|
11672
|
+
logger24.debug({}, "Empty execution context");
|
|
11912
11673
|
return next();
|
|
11913
11674
|
}
|
|
11914
11675
|
const { tenantId, projectId, agentId } = executionContext;
|
|
@@ -11917,7 +11678,7 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11917
11678
|
if (requestBody) {
|
|
11918
11679
|
conversationId = requestBody.conversationId;
|
|
11919
11680
|
if (!conversationId) {
|
|
11920
|
-
|
|
11681
|
+
logger24.debug({ requestBody }, "No conversation ID found in request body");
|
|
11921
11682
|
}
|
|
11922
11683
|
}
|
|
11923
11684
|
const entries = Object.fromEntries(
|
|
@@ -11932,7 +11693,7 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11932
11693
|
})
|
|
11933
11694
|
);
|
|
11934
11695
|
if (!Object.keys(entries).length) {
|
|
11935
|
-
|
|
11696
|
+
logger24.debug({}, "Empty entries for baggage");
|
|
11936
11697
|
return next();
|
|
11937
11698
|
}
|
|
11938
11699
|
const bag = Object.entries(entries).reduce(
|
|
@@ -11942,7 +11703,7 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11942
11703
|
const ctxWithBag = propagation.setBaggage(context.active(), bag);
|
|
11943
11704
|
return await context.with(ctxWithBag, async () => await next());
|
|
11944
11705
|
});
|
|
11945
|
-
|
|
11706
|
+
app6.openapi(
|
|
11946
11707
|
createRoute({
|
|
11947
11708
|
method: "get",
|
|
11948
11709
|
path: "/health",
|
|
@@ -11959,30 +11720,29 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
|
|
|
11959
11720
|
return c.body(null, 204);
|
|
11960
11721
|
}
|
|
11961
11722
|
);
|
|
11962
|
-
|
|
11963
|
-
|
|
11964
|
-
|
|
11965
|
-
|
|
11966
|
-
|
|
11967
|
-
|
|
11968
|
-
app7.use("/tenants/*", async (_c, next) => {
|
|
11723
|
+
app6.route("/v1/chat", chat_default);
|
|
11724
|
+
app6.route("/api", chatDataStream_default);
|
|
11725
|
+
app6.route("/v1/mcp", mcp_default);
|
|
11726
|
+
app6.route("/agents", agents_default);
|
|
11727
|
+
setupOpenAPIRoutes(app6);
|
|
11728
|
+
app6.use("/tenants/*", async (_c, next) => {
|
|
11969
11729
|
await next();
|
|
11970
11730
|
await flushBatchProcessor();
|
|
11971
11731
|
});
|
|
11972
|
-
|
|
11732
|
+
app6.use("/agents/*", async (_c, next) => {
|
|
11973
11733
|
await next();
|
|
11974
11734
|
await flushBatchProcessor();
|
|
11975
11735
|
});
|
|
11976
|
-
|
|
11736
|
+
app6.use("/v1/*", async (_c, next) => {
|
|
11977
11737
|
await next();
|
|
11978
11738
|
await flushBatchProcessor();
|
|
11979
11739
|
});
|
|
11980
|
-
|
|
11740
|
+
app6.use("/api/*", async (_c, next) => {
|
|
11981
11741
|
await next();
|
|
11982
11742
|
await flushBatchProcessor();
|
|
11983
11743
|
});
|
|
11984
11744
|
const baseApp = new Hono();
|
|
11985
|
-
baseApp.route("/",
|
|
11745
|
+
baseApp.route("/", app6);
|
|
11986
11746
|
return baseApp;
|
|
11987
11747
|
}
|
|
11988
11748
|
|
|
@@ -11998,8 +11758,8 @@ var defaultConfig = {
|
|
|
11998
11758
|
};
|
|
11999
11759
|
var defaultStores = createDefaultCredentialStores();
|
|
12000
11760
|
var defaultRegistry = new CredentialStoreRegistry(defaultStores);
|
|
12001
|
-
var
|
|
12002
|
-
var index_default =
|
|
11761
|
+
var app5 = createExecutionHono(defaultConfig, defaultRegistry);
|
|
11762
|
+
var index_default = app5;
|
|
12003
11763
|
function createExecutionApp(config) {
|
|
12004
11764
|
const serverConfig = config?.serverConfig ?? defaultConfig;
|
|
12005
11765
|
const stores = config?.credentialStores ?? defaultStores;
|