@inkeep/agents-run-api 0.29.2 → 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.
Files changed (3) hide show
  1. package/dist/index.cjs +174 -345
  2. package/dist/index.js +169 -338
  3. package/package.json +2 -2
package/dist/index.cjs CHANGED
@@ -358,8 +358,8 @@ async function getConversationScopedArtifacts(params) {
358
358
  });
359
359
  referenceArtifacts.push(...artifacts);
360
360
  }
361
- const logger30 = (await Promise.resolve().then(() => (init_logger(), logger_exports))).getLogger("conversations");
362
- logger30.debug(
361
+ const logger29 = (await Promise.resolve().then(() => (init_logger(), logger_exports))).getLogger("conversations");
362
+ logger29.debug(
363
363
  {
364
364
  conversationId,
365
365
  visibleMessages: visibleMessages.length,
@@ -371,8 +371,8 @@ async function getConversationScopedArtifacts(params) {
371
371
  );
372
372
  return referenceArtifacts;
373
373
  } catch (error) {
374
- const logger30 = (await Promise.resolve().then(() => (init_logger(), logger_exports))).getLogger("conversations");
375
- logger30.error(
374
+ const logger29 = (await Promise.resolve().then(() => (init_logger(), logger_exports))).getLogger("conversations");
375
+ logger29.error(
376
376
  {
377
377
  error: error instanceof Error ? error.message : "Unknown error",
378
378
  conversationId
@@ -413,14 +413,14 @@ const execute = ${executeCode}
413
413
  })();
414
414
  `;
415
415
  }
416
- function parseExecutionResult(stdout, functionId, logger30) {
416
+ function parseExecutionResult(stdout, functionId, logger29) {
417
417
  try {
418
418
  const outputLines = stdout.split("\n").filter((line) => line.trim());
419
419
  const resultLine = outputLines[outputLines.length - 1];
420
420
  return JSON.parse(resultLine);
421
421
  } catch (parseError) {
422
- if (logger30) {
423
- logger30.warn(
422
+ if (logger29) {
423
+ logger29.warn(
424
424
  {
425
425
  functionId,
426
426
  stdout,
@@ -1712,10 +1712,10 @@ var extractContextFromTeamAgentToken = async (token, baseUrl, expectedSubAgentId
1712
1712
 
1713
1713
  // src/openapi.ts
1714
1714
  init_env();
1715
- function setupOpenAPIRoutes(app7) {
1716
- app7.get("/openapi.json", (c) => {
1715
+ function setupOpenAPIRoutes(app6) {
1716
+ app6.get("/openapi.json", (c) => {
1717
1717
  try {
1718
- const document = app7.getOpenAPIDocument({
1718
+ const document = app6.getOpenAPIDocument({
1719
1719
  openapi: "3.0.0",
1720
1720
  info: {
1721
1721
  title: "Inkeep Agents Run API",
@@ -1736,7 +1736,7 @@ function setupOpenAPIRoutes(app7) {
1736
1736
  return c.json({ error: "Failed to generate OpenAPI document", details: errorDetails }, 500);
1737
1737
  }
1738
1738
  });
1739
- app7.get(
1739
+ app6.get(
1740
1740
  "/docs",
1741
1741
  swaggerUi.swaggerUI({
1742
1742
  url: "/openapi.json",
@@ -2091,7 +2091,7 @@ async function handleMessageStream(c, agent, request) {
2091
2091
  }
2092
2092
  }
2093
2093
  };
2094
- return streaming.streamSSE(c, async (stream3) => {
2094
+ return streaming.streamSSE(c, async (stream2) => {
2095
2095
  try {
2096
2096
  const initialTask = {
2097
2097
  id: task.id,
@@ -2103,7 +2103,7 @@ async function handleMessageStream(c, agent, request) {
2103
2103
  artifacts: [],
2104
2104
  kind: "task"
2105
2105
  };
2106
- await stream3.writeSSE({
2106
+ await stream2.writeSSE({
2107
2107
  data: JSON.stringify({
2108
2108
  jsonrpc: "2.0",
2109
2109
  result: initialTask,
@@ -2121,7 +2121,7 @@ async function handleMessageStream(c, agent, request) {
2121
2121
  (part) => part.kind === "data" && part.data && typeof part.data === "object" && part.data.type === "transfer"
2122
2122
  );
2123
2123
  if (transferPart && transferPart.kind === "data" && transferPart.data) {
2124
- await stream3.writeSSE({
2124
+ await stream2.writeSSE({
2125
2125
  data: JSON.stringify({
2126
2126
  jsonrpc: "2.0",
2127
2127
  result: {
@@ -2155,7 +2155,7 @@ async function handleMessageStream(c, agent, request) {
2155
2155
  contextId: params.message.contextId,
2156
2156
  kind: "message"
2157
2157
  };
2158
- await stream3.writeSSE({
2158
+ await stream2.writeSSE({
2159
2159
  data: JSON.stringify({
2160
2160
  jsonrpc: "2.0",
2161
2161
  result: messageResponse,
@@ -2170,7 +2170,7 @@ async function handleMessageStream(c, agent, request) {
2170
2170
  },
2171
2171
  artifacts: result.artifacts
2172
2172
  };
2173
- await stream3.writeSSE({
2173
+ await stream2.writeSSE({
2174
2174
  data: JSON.stringify({
2175
2175
  jsonrpc: "2.0",
2176
2176
  result: completedTask,
@@ -2179,7 +2179,7 @@ async function handleMessageStream(c, agent, request) {
2179
2179
  });
2180
2180
  } catch (error) {
2181
2181
  console.error("Error in stream execution:", error);
2182
- await stream3.writeSSE({
2182
+ await stream2.writeSSE({
2183
2183
  data: JSON.stringify({
2184
2184
  jsonrpc: "2.0",
2185
2185
  error: {
@@ -2311,7 +2311,7 @@ async function handleTasksResubscribe(c, agent, request) {
2311
2311
  id: request.id
2312
2312
  });
2313
2313
  }
2314
- return streaming.streamSSE(c, async (stream3) => {
2314
+ return streaming.streamSSE(c, async (stream2) => {
2315
2315
  try {
2316
2316
  const task = {
2317
2317
  id: params.taskId,
@@ -2323,7 +2323,7 @@ async function handleTasksResubscribe(c, agent, request) {
2323
2323
  artifacts: [],
2324
2324
  kind: "task"
2325
2325
  };
2326
- await stream3.writeSSE({
2326
+ await stream2.writeSSE({
2327
2327
  data: JSON.stringify({
2328
2328
  jsonrpc: "2.0",
2329
2329
  result: task,
@@ -2332,7 +2332,7 @@ async function handleTasksResubscribe(c, agent, request) {
2332
2332
  });
2333
2333
  } catch (error) {
2334
2334
  console.error("Error in task resubscription:", error);
2335
- await stream3.writeSSE({
2335
+ await stream2.writeSSE({
2336
2336
  data: JSON.stringify({
2337
2337
  jsonrpc: "2.0",
2338
2338
  error: {
@@ -10123,10 +10123,19 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
10123
10123
  subAgentId: relation.id
10124
10124
  }
10125
10125
  });
10126
- const enhancedDescription = generateDescriptionWithTransfers(
10126
+ const relatedAgentTeamAgentRelations = await agentsCore.getTeamAgentsForSubAgent(dbClient_default)({
10127
+ scopes: {
10128
+ tenantId: config.tenantId,
10129
+ projectId: config.projectId,
10130
+ agentId: config.agentId,
10131
+ subAgentId: relation.id
10132
+ }
10133
+ });
10134
+ const enhancedDescription = generateDescriptionWithRelationData(
10127
10135
  relation.description || "",
10128
10136
  relatedAgentRelations.data,
10129
- relatedAgentExternalAgentRelations.data
10137
+ relatedAgentExternalAgentRelations.data,
10138
+ relatedAgentTeamAgentRelations.data
10130
10139
  );
10131
10140
  return { ...relation, description: enhancedDescription };
10132
10141
  }
@@ -10136,6 +10145,67 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
10136
10145
  return relation;
10137
10146
  })
10138
10147
  );
10148
+ const enhancedTeamRelations = await Promise.all(
10149
+ teamRelations.data.map(async (relation) => {
10150
+ try {
10151
+ const teamAgentWithDefault = await agentsCore.getAgentWithDefaultSubAgent(dbClient_default)({
10152
+ scopes: {
10153
+ tenantId: config.tenantId,
10154
+ projectId: config.projectId,
10155
+ agentId: relation.targetAgentId
10156
+ }
10157
+ });
10158
+ if (teamAgentWithDefault?.defaultSubAgent) {
10159
+ const defaultSubAgent = teamAgentWithDefault.defaultSubAgent;
10160
+ const relatedAgentRelations = await agentsCore.getRelatedAgentsForAgent(dbClient_default)({
10161
+ scopes: {
10162
+ tenantId: config.tenantId,
10163
+ projectId: config.projectId,
10164
+ agentId: relation.targetAgentId
10165
+ },
10166
+ subAgentId: defaultSubAgent.id
10167
+ });
10168
+ const relatedAgentExternalAgentRelations = await agentsCore.getExternalAgentsForSubAgent(
10169
+ dbClient_default
10170
+ )({
10171
+ scopes: {
10172
+ tenantId: config.tenantId,
10173
+ projectId: config.projectId,
10174
+ agentId: relation.targetAgentId,
10175
+ subAgentId: defaultSubAgent.id
10176
+ }
10177
+ });
10178
+ const relatedAgentTeamAgentRelations = await agentsCore.getTeamAgentsForSubAgent(dbClient_default)({
10179
+ scopes: {
10180
+ tenantId: config.tenantId,
10181
+ projectId: config.projectId,
10182
+ agentId: relation.targetAgentId,
10183
+ subAgentId: defaultSubAgent.id
10184
+ }
10185
+ });
10186
+ const enhancedDescription = generateDescriptionWithRelationData(
10187
+ teamAgentWithDefault.description || "",
10188
+ relatedAgentRelations.data,
10189
+ relatedAgentExternalAgentRelations.data,
10190
+ relatedAgentTeamAgentRelations.data
10191
+ );
10192
+ return {
10193
+ ...relation,
10194
+ targetAgent: {
10195
+ ...relation.targetAgent,
10196
+ description: enhancedDescription
10197
+ }
10198
+ };
10199
+ }
10200
+ } catch (error) {
10201
+ logger20.warn(
10202
+ { targetAgentId: relation.targetAgentId, error },
10203
+ "Failed to enhance team agent description"
10204
+ );
10205
+ }
10206
+ return relation;
10207
+ })
10208
+ );
10139
10209
  const prompt = "prompt" in config.agentSchema ? config.agentSchema.prompt : "";
10140
10210
  const models = "models" in config.agentSchema ? config.agentSchema.models : void 0;
10141
10211
  const stopWhen = "stopWhen" in config.agentSchema ? config.agentSchema.stopWhen : void 0;
@@ -10216,7 +10286,7 @@ var createTaskHandler = (config, credentialStoreRegistry) => {
10216
10286
  relationType: "delegate"
10217
10287
  }
10218
10288
  })),
10219
- ...teamRelations.data.map((relation) => ({
10289
+ ...enhancedTeamRelations.map((relation) => ({
10220
10290
  type: "team",
10221
10291
  config: {
10222
10292
  id: relation.targetAgent.id,
@@ -10478,11 +10548,12 @@ function createAgentCard({
10478
10548
  }
10479
10549
  };
10480
10550
  }
10481
- function generateDescriptionWithTransfers(baseDescription, internalRelations, externalRelations) {
10551
+ function generateDescriptionWithRelationData(baseDescription, internalRelations, externalRelations, teamRelations) {
10482
10552
  const transfers = [...internalRelations.filter((rel) => rel.relationType === "transfer")];
10483
10553
  const delegates = [
10484
10554
  ...internalRelations.filter((rel) => rel.relationType === "delegate"),
10485
- ...externalRelations.map((data) => data.externalAgent)
10555
+ ...externalRelations.map((data) => data.externalAgent),
10556
+ ...teamRelations.map((data) => data.targetAgent)
10486
10557
  ];
10487
10558
  if (transfers.length === 0 && delegates.length === 0) {
10488
10559
  return baseDescription;
@@ -10861,8 +10932,8 @@ async function executeTransfer({
10861
10932
  init_dbClient();
10862
10933
  init_logger();
10863
10934
  var SSEStreamHelper = class {
10864
- constructor(stream3, requestId2, timestamp) {
10865
- this.stream = stream3;
10935
+ constructor(stream2, requestId2, timestamp) {
10936
+ this.stream = stream2;
10866
10937
  this.requestId = requestId2;
10867
10938
  this.timestamp = timestamp;
10868
10939
  __publicField(this, "isTextStreaming", false);
@@ -11028,8 +11099,8 @@ ${errorMessage}`);
11028
11099
  await this.writeDone();
11029
11100
  }
11030
11101
  };
11031
- function createSSEStreamHelper(stream3, requestId2, timestamp) {
11032
- return new SSEStreamHelper(stream3, requestId2, timestamp);
11102
+ function createSSEStreamHelper(stream2, requestId2, timestamp) {
11103
+ return new SSEStreamHelper(stream2, requestId2, timestamp);
11033
11104
  }
11034
11105
  var _VercelDataStreamHelper = class _VercelDataStreamHelper {
11035
11106
  // 10 minutes max lifetime
@@ -11176,12 +11247,12 @@ var _VercelDataStreamHelper = class _VercelDataStreamHelper {
11176
11247
  async streamData(data) {
11177
11248
  await this.writeContent(JSON.stringify(data));
11178
11249
  }
11179
- async mergeStream(stream3) {
11250
+ async mergeStream(stream2) {
11180
11251
  if (this.isCompleted) {
11181
11252
  console.warn("Attempted to merge stream to completed stream");
11182
11253
  return;
11183
11254
  }
11184
- this.writer.merge(stream3);
11255
+ this.writer.merge(stream2);
11185
11256
  }
11186
11257
  /**
11187
11258
  * Clean up all memory allocations
@@ -12120,9 +12191,9 @@ app2.openapi(chatCompletionsRoute, async (c) => {
12120
12191
  "database.operation": "insert"
12121
12192
  });
12122
12193
  }
12123
- return streaming.streamSSE(c, async (stream3) => {
12194
+ return streaming.streamSSE(c, async (stream2) => {
12124
12195
  try {
12125
- const sseHelper = createSSEStreamHelper(stream3, requestId2, timestamp);
12196
+ const sseHelper = createSSEStreamHelper(stream2, requestId2, timestamp);
12126
12197
  await sseHelper.writeRole();
12127
12198
  logger25.info({ subAgentId }, "Starting execution");
12128
12199
  const emitOperationsHeader = c.req.header("x-emit-operations");
@@ -12159,7 +12230,7 @@ app2.openapi(chatCompletionsRoute, async (c) => {
12159
12230
  "Error during streaming execution"
12160
12231
  );
12161
12232
  try {
12162
- const sseHelper = createSSEStreamHelper(stream3, requestId2, timestamp);
12233
+ const sseHelper = createSSEStreamHelper(stream2, requestId2, timestamp);
12163
12234
  await sseHelper.writeOperation(
12164
12235
  errorOp(
12165
12236
  "Sorry, I was unable to process your request at this time. Please try again.",
@@ -12387,7 +12458,7 @@ app3.openapi(chatDataStreamRoute, async (c) => {
12387
12458
  c.header("x-accel-buffering", "no");
12388
12459
  return streaming.stream(
12389
12460
  c,
12390
- (stream3) => stream3.pipe(
12461
+ (stream2) => stream2.pipe(
12391
12462
  dataStream.pipeThrough(new ai.JsonToSseTransformStream()).pipeThrough(new TextEncoderStream())
12392
12463
  )
12393
12464
  );
@@ -12401,247 +12472,6 @@ app3.openapi(chatDataStreamRoute, async (c) => {
12401
12472
  }
12402
12473
  });
12403
12474
  var chatDataStream_default = app3;
12404
- init_dbClient();
12405
- init_logger();
12406
- var logger27 = agentsCore.getLogger("dataComponentPreview");
12407
- var app4 = new zodOpenapi.OpenAPIHono();
12408
- var generatePreviewRoute = zodOpenapi.createRoute({
12409
- method: "post",
12410
- path: "/:tenantId/projects/:projectId/data-components/:id/generate-render",
12411
- tags: ["Data Component Preview"],
12412
- summary: "Generate Component Render",
12413
- description: "Generate a React/Tailwind component render using AI based on the data component schema",
12414
- request: {
12415
- params: z6.z.object({
12416
- tenantId: z6.z.string(),
12417
- projectId: z6.z.string(),
12418
- id: z6.z.string()
12419
- }),
12420
- body: {
12421
- content: {
12422
- "application/json": {
12423
- schema: z6.z.object({
12424
- instructions: z6.z.string().optional().describe("Custom instructions for modifying the component"),
12425
- existingCode: z6.z.string().optional().describe("Existing component code to modify")
12426
- })
12427
- }
12428
- }
12429
- }
12430
- },
12431
- responses: {
12432
- 200: {
12433
- description: "Streaming component code generation",
12434
- headers: z6.z.object({
12435
- "Content-Type": z6.z.string().default("text/plain; charset=utf-8"),
12436
- "Cache-Control": z6.z.string().default("no-cache"),
12437
- Connection: z6.z.string().default("keep-alive")
12438
- }),
12439
- content: {
12440
- "text/plain": {
12441
- schema: z6.z.string().describe("Streaming generated component code")
12442
- }
12443
- }
12444
- },
12445
- ...agentsCore.commonGetErrorResponses
12446
- }
12447
- });
12448
- app4.openapi(generatePreviewRoute, async (c) => {
12449
- const { tenantId, projectId, id } = c.req.valid("param");
12450
- const body = c.req.valid("json");
12451
- const { instructions, existingCode } = body;
12452
- logger27.info(
12453
- {
12454
- tenantId,
12455
- projectId,
12456
- dataComponentId: id,
12457
- hasInstructions: !!instructions,
12458
- hasExistingCode: !!existingCode
12459
- },
12460
- "Generating component preview"
12461
- );
12462
- const dataComponent = await agentsCore.getDataComponent(dbClient_default)({
12463
- scopes: { tenantId, projectId },
12464
- dataComponentId: id
12465
- });
12466
- if (!dataComponent) {
12467
- throw agentsCore.createApiError({
12468
- code: "not_found",
12469
- message: "Data component not found"
12470
- });
12471
- }
12472
- const project = await agentsCore.getProject(dbClient_default)({
12473
- scopes: { tenantId, projectId }
12474
- });
12475
- if (!project?.models?.base) {
12476
- throw agentsCore.createApiError({
12477
- code: "bad_request",
12478
- message: "Project base model configuration is required"
12479
- });
12480
- }
12481
- const prompt = buildGenerationPrompt(dataComponent, instructions, existingCode);
12482
- try {
12483
- const modelConfig = ModelFactory.prepareGenerationConfig(project.models.base);
12484
- const renderSchema = z6.z.object({
12485
- component: z6.z.string().describe("The React component code"),
12486
- mockData: z6.z.any().describe("Sample data matching the props schema")
12487
- });
12488
- const result = ai.streamObject({
12489
- ...modelConfig,
12490
- prompt,
12491
- schema: renderSchema,
12492
- temperature: 0.7
12493
- });
12494
- c.header("Content-Type", "text/plain; charset=utf-8");
12495
- c.header("Cache-Control", "no-cache");
12496
- c.header("Connection", "keep-alive");
12497
- const existingData = existingCode && dataComponent.render && typeof dataComponent.render === "object" && "mockData" in dataComponent.render ? dataComponent.render.mockData : null;
12498
- return streaming.stream(c, async (stream3) => {
12499
- try {
12500
- for await (const partialObject of result.partialObjectStream) {
12501
- const outputObject = instructions && existingData ? { ...partialObject, mockData: existingData } : partialObject;
12502
- await stream3.write(JSON.stringify(outputObject) + "\n");
12503
- }
12504
- } catch (error) {
12505
- logger27.error(
12506
- { error, tenantId, projectId, dataComponentId: id },
12507
- "Error streaming preview generation"
12508
- );
12509
- await stream3.write(
12510
- JSON.stringify({ component: "// Error generating component preview", mockData: {} }) + "\n"
12511
- );
12512
- }
12513
- });
12514
- } catch (error) {
12515
- logger27.error(
12516
- { error, tenantId, projectId, dataComponentId: id },
12517
- "Error generating component preview"
12518
- );
12519
- throw agentsCore.createApiError({
12520
- code: "internal_server_error",
12521
- message: "Failed to generate component preview"
12522
- });
12523
- }
12524
- });
12525
- function buildGenerationPrompt(dataComponent, instructions, existingCode) {
12526
- const propsSchema = dataComponent.props || {};
12527
- const propsJson = JSON.stringify(propsSchema, null, 2);
12528
- const componentName = sanitizeComponentName(dataComponent.name);
12529
- if (instructions && existingCode) {
12530
- return `You are an expert React and Tailwind CSS developer. You need to modify an existing React component based on specific instructions.
12531
-
12532
- COMPONENT DETAILS:
12533
- - Original Name: ${dataComponent.name}
12534
- - Component Function Name: ${componentName}
12535
- - Description: ${dataComponent.description}
12536
- - Props Schema (JSON Schema): ${propsJson}
12537
-
12538
- EXISTING COMPONENT CODE:
12539
- \`\`\`jsx
12540
- ${existingCode}
12541
- \`\`\`
12542
-
12543
- MODIFICATION INSTRUCTIONS:
12544
- ${instructions}
12545
-
12546
- REQUIREMENTS:
12547
- 1. Modify the existing component code according to the instructions
12548
- 2. Keep using Tailwind CSS SEMANTIC COLOR CLASSES (bg-background, text-foreground, etc.)
12549
- 3. Maintain the balanced spacing and design principles from the original
12550
- 4. Keep using lucide-react icons where appropriate
12551
- 5. DO NOT include export statements - just the imports and function
12552
- 6. DO NOT include TypeScript type annotations
12553
- 7. Component name should remain: ${componentName}
12554
- 8. DO NOT regenerate sample data - keep the same data structure
12555
-
12556
- OUTPUT FORMAT:
12557
- You need to generate only one thing:
12558
- 1. "component": The modified React component code as a string
12559
-
12560
- Return ONLY the component field, the mockData field will be reused from the existing render.
12561
-
12562
- EXAMPLE OUTPUT:
12563
- {
12564
- "component": "import { Mail, User } from 'lucide-react';\\n\\nfunction ${componentName}(props) {\\n // Modified component code here\\n}"
12565
- }
12566
-
12567
- Focus on making the requested changes while maintaining the component's quality and design principles.`;
12568
- }
12569
- 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.
12570
-
12571
- COMPONENT DETAILS:
12572
- - Original Name: ${dataComponent.name}
12573
- - Component Function Name: ${componentName}
12574
- - Description: ${dataComponent.description}
12575
- - Props Schema (JSON Schema): ${propsJson}
12576
-
12577
- REQUIREMENTS:
12578
- 1. Create a React functional component (JSX, not TypeScript)
12579
- 2. Use Tailwind CSS SEMANTIC COLOR CLASSES (these automatically adapt to light/dark mode):
12580
- - Background: bg-background, bg-card, bg-muted, bg-muted/40, bg-accent, bg-primary
12581
- - Text: text-foreground, text-muted-foreground, text-card-foreground, text-primary-foreground
12582
- - Borders: border-border, border-input, border-muted
12583
- - DO NOT use direct colors like bg-white, bg-gray-800, text-gray-900, etc.
12584
- - DO NOT use dark: prefix - semantic classes handle dark mode automatically
12585
- 3. Make it balanced - comfortable but efficient:
12586
- - Use moderate padding: p-4, px-4 py-3 (balanced, not cramped or excessive)
12587
- - Use appropriate text sizes: text-sm for body, text-base for headings, text-xs for captions
12588
- - Use balanced spacing: gap-2.5, gap-3, space-y-2, mt-2, mb-3
12589
- - Aim for a clean, professional look with good readability
12590
- 4. Design for embedding - this component blends into existing content:
12591
- - DO NOT add redundant titles or headers unless they're part of the actual data schema
12592
- - Focus on displaying the data directly and elegantly
12593
- - Assume the component is part of a larger conversation or content flow
12594
- - If the schema has a "title" or "name" property, display it as data, not as a wrapper heading
12595
- 5. Use LUCIDE-REACT ICONS to enhance UI aesthetics:
12596
- - Import icons from lucide-react: import { User, Mail, Clock } from 'lucide-react'
12597
- - Use icons with size-4 or size-5 classes for balanced visibility
12598
- - Place icons inline with text or as visual indicators
12599
- - Example: <User className="size-4" /> or <Mail className="size-4 text-muted-foreground" />
12600
- - Common useful icons: User, Mail, Calendar, Clock, Check, X, Star, Heart, Settings, Search, etc.
12601
- 6. The component should accept props that match the JSON Schema properties
12602
- 7. Make it visually appealing and professional - clean with good whitespace
12603
- 8. Use semantic HTML elements
12604
- 9. Make it responsive and accessible
12605
- 10. You can import icons from 'lucide-react' at the top
12606
- 11. DO NOT include export statements - just the imports and function
12607
- 12. DO NOT include TypeScript type annotations
12608
- 13. Component name should be exactly: ${componentName}
12609
-
12610
- AVAILABLE SEMANTIC COLOR CLASSES:
12611
- - Backgrounds: bg-background, bg-foreground, bg-card, bg-popover, bg-primary, bg-secondary, bg-muted, bg-accent, bg-destructive
12612
- - 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
12613
- - Borders: border-border, border-input, border-ring
12614
- - You can use opacity modifiers: bg-muted/40, bg-accent/10, etc.
12615
-
12616
- OUTPUT FORMAT:
12617
- You need to generate two things:
12618
- 1. "component": The complete React component code as a string
12619
- 2. "mockData": Realistic sample data that matches the props schema (as a JSON object)
12620
-
12621
- EXAMPLE OUTPUT (for a user profile schema with name, email, role):
12622
- {
12623
- "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}",
12624
- "mockData": {
12625
- "name": "Sarah Chen",
12626
- "email": "sarah.chen@example.com",
12627
- "role": "Product Manager"
12628
- }
12629
- }
12630
-
12631
- REMEMBER:
12632
- - ONLY use semantic color classes (bg-card, text-foreground, etc.)
12633
- - NO direct colors (bg-white, text-gray-900, etc.)
12634
- - NO dark: prefix needed - semantic classes adapt automatically
12635
- - Use balanced spacing (p-4, gap-2.5/gap-3, text-sm for body, text-base for headings)
12636
- - Use lucide-react icons where appropriate for better UI
12637
- - NO redundant titles - just display the actual data from props
12638
- - Design for embedding - this blends into existing content, not a standalone card
12639
- - Make the sample data realistic and useful for previewing the component`;
12640
- }
12641
- function sanitizeComponentName(name) {
12642
- return name.split(/\s+/).map((word) => word.charAt(0).toUpperCase() + word.slice(1).toLowerCase()).join("").replace(/[^a-zA-Z0-9]/g, "");
12643
- }
12644
- var dataComponentPreview_default = app4;
12645
12475
 
12646
12476
  // src/routes/mcp.ts
12647
12477
  init_dbClient();
@@ -12649,7 +12479,7 @@ init_logger();
12649
12479
  function createMCPSchema(schema) {
12650
12480
  return schema;
12651
12481
  }
12652
- var logger28 = agentsCore.getLogger("mcp");
12482
+ var logger27 = agentsCore.getLogger("mcp");
12653
12483
  var _MockResponseSingleton = class _MockResponseSingleton {
12654
12484
  constructor() {
12655
12485
  __publicField(this, "mockRes");
@@ -12704,21 +12534,21 @@ var createSpoofInitMessage = (mcpProtocolVersion) => ({
12704
12534
  id: 0
12705
12535
  });
12706
12536
  var spoofTransportInitialization = async (transport, req, sessionId, mcpProtocolVersion) => {
12707
- logger28.info({ sessionId }, "Spoofing initialization message to set transport state");
12537
+ logger27.info({ sessionId }, "Spoofing initialization message to set transport state");
12708
12538
  const spoofInitMessage = createSpoofInitMessage(mcpProtocolVersion);
12709
12539
  const mockRes = MockResponseSingleton.getInstance().getMockResponse();
12710
12540
  try {
12711
12541
  await transport.handleRequest(req, mockRes, spoofInitMessage);
12712
- logger28.info({ sessionId }, "Successfully spoofed initialization");
12542
+ logger27.info({ sessionId }, "Successfully spoofed initialization");
12713
12543
  } catch (spoofError) {
12714
- logger28.warn({ sessionId, error: spoofError }, "Spoof initialization failed, continuing anyway");
12544
+ logger27.warn({ sessionId, error: spoofError }, "Spoof initialization failed, continuing anyway");
12715
12545
  }
12716
12546
  };
12717
12547
  var validateSession = async (req, res, body, tenantId, projectId, agentId) => {
12718
12548
  const sessionId = req.headers["mcp-session-id"];
12719
- logger28.info({ sessionId }, "Received MCP session ID");
12549
+ logger27.info({ sessionId }, "Received MCP session ID");
12720
12550
  if (!sessionId) {
12721
- logger28.info({ body }, "Missing session ID");
12551
+ logger27.info({ body }, "Missing session ID");
12722
12552
  res.writeHead(400).end(
12723
12553
  JSON.stringify({
12724
12554
  jsonrpc: "2.0",
@@ -12744,7 +12574,7 @@ var validateSession = async (req, res, body, tenantId, projectId, agentId) => {
12744
12574
  scopes: { tenantId, projectId },
12745
12575
  conversationId: sessionId
12746
12576
  });
12747
- logger28.info(
12577
+ logger27.info(
12748
12578
  {
12749
12579
  sessionId,
12750
12580
  conversationFound: !!conversation,
@@ -12755,7 +12585,7 @@ var validateSession = async (req, res, body, tenantId, projectId, agentId) => {
12755
12585
  "Conversation lookup result"
12756
12586
  );
12757
12587
  if (!conversation || conversation.metadata?.sessionData?.sessionType !== "mcp" || conversation.metadata?.sessionData?.agentId !== agentId) {
12758
- logger28.info(
12588
+ logger27.info(
12759
12589
  { sessionId, conversationId: conversation?.id },
12760
12590
  "MCP session not found or invalid"
12761
12591
  );
@@ -12816,7 +12646,7 @@ var executeAgentQuery = async (executionContext, conversationId, query, defaultS
12816
12646
  requestId: requestId2,
12817
12647
  sseHelper: mcpStreamHelper
12818
12648
  });
12819
- logger28.info(
12649
+ logger27.info(
12820
12650
  { result },
12821
12651
  `Execution completed: ${result.success ? "success" : "failed"} after ${result.iterations} iterations`
12822
12652
  );
@@ -12900,7 +12730,7 @@ var getServer = async (headers2, executionContext, conversationId, credentialSto
12900
12730
  dbClient: dbClient_default,
12901
12731
  credentialStores
12902
12732
  });
12903
- logger28.info(
12733
+ logger27.info(
12904
12734
  {
12905
12735
  tenantId,
12906
12736
  projectId,
@@ -12929,8 +12759,8 @@ var getServer = async (headers2, executionContext, conversationId, credentialSto
12929
12759
  );
12930
12760
  return server;
12931
12761
  };
12932
- var app5 = new zodOpenapi.OpenAPIHono();
12933
- app5.use("/", async (c, next) => {
12762
+ var app4 = new zodOpenapi.OpenAPIHono();
12763
+ app4.use("/", async (c, next) => {
12934
12764
  if (c.req.method === "POST") {
12935
12765
  return agentsCore.contextValidationMiddleware(dbClient_default)(c, next);
12936
12766
  }
@@ -12962,7 +12792,7 @@ var validateRequestParameters = (c) => {
12962
12792
  };
12963
12793
  var handleInitializationRequest = async (body, executionContext, validatedContext, req, res, c, credentialStores) => {
12964
12794
  const { tenantId, projectId, agentId } = executionContext;
12965
- logger28.info({ body }, "Received initialization request");
12795
+ logger27.info({ body }, "Received initialization request");
12966
12796
  const sessionId = agentsCore.getConversationId();
12967
12797
  const activeSpan = api.trace.getActiveSpan();
12968
12798
  if (activeSpan) {
@@ -13018,7 +12848,7 @@ var handleInitializationRequest = async (body, executionContext, validatedContex
13018
12848
  }
13019
12849
  }
13020
12850
  });
13021
- logger28.info(
12851
+ logger27.info(
13022
12852
  { sessionId, conversationId: conversation.id },
13023
12853
  "Created MCP session as conversation"
13024
12854
  );
@@ -13027,9 +12857,9 @@ var handleInitializationRequest = async (body, executionContext, validatedContex
13027
12857
  });
13028
12858
  const server = await getServer(validatedContext, executionContext, sessionId, credentialStores);
13029
12859
  await server.connect(transport);
13030
- logger28.info({ sessionId }, "Server connected for initialization");
12860
+ logger27.info({ sessionId }, "Server connected for initialization");
13031
12861
  res.setHeader("Mcp-Session-Id", sessionId);
13032
- logger28.info(
12862
+ logger27.info(
13033
12863
  {
13034
12864
  sessionId,
13035
12865
  bodyMethod: body?.method,
@@ -13038,7 +12868,7 @@ var handleInitializationRequest = async (body, executionContext, validatedContex
13038
12868
  "About to handle initialization request"
13039
12869
  );
13040
12870
  await transport.handleRequest(req, res, body);
13041
- logger28.info({ sessionId }, "Successfully handled initialization request");
12871
+ logger27.info({ sessionId }, "Successfully handled initialization request");
13042
12872
  return fetchToNode.toFetchResponse(res);
13043
12873
  });
13044
12874
  };
@@ -13065,8 +12895,8 @@ var handleExistingSessionRequest = async (body, executionContext, validatedConte
13065
12895
  sessionId,
13066
12896
  conversation.metadata?.session_data?.mcpProtocolVersion
13067
12897
  );
13068
- logger28.info({ sessionId }, "Server connected and transport initialized");
13069
- logger28.info(
12898
+ logger27.info({ sessionId }, "Server connected and transport initialized");
12899
+ logger27.info(
13070
12900
  {
13071
12901
  sessionId,
13072
12902
  bodyKeys: Object.keys(body || {}),
@@ -13080,9 +12910,9 @@ var handleExistingSessionRequest = async (body, executionContext, validatedConte
13080
12910
  );
13081
12911
  try {
13082
12912
  await transport.handleRequest(req, res, body);
13083
- logger28.info({ sessionId }, "Successfully handled MCP request");
12913
+ logger27.info({ sessionId }, "Successfully handled MCP request");
13084
12914
  } catch (transportError) {
13085
- logger28.error(
12915
+ logger27.error(
13086
12916
  {
13087
12917
  sessionId,
13088
12918
  error: transportError,
@@ -13099,7 +12929,7 @@ var createErrorResponse = (code, message, id = null) => ({
13099
12929
  error: { code, message },
13100
12930
  id
13101
12931
  });
13102
- app5.openapi(
12932
+ app4.openapi(
13103
12933
  zodOpenapi.createRoute({
13104
12934
  method: "post",
13105
12935
  path: "/",
@@ -13133,13 +12963,13 @@ app5.openapi(
13133
12963
  }
13134
12964
  const { executionContext } = paramValidation;
13135
12965
  const body = c.get("requestBody") || {};
13136
- logger28.info({ body, bodyKeys: Object.keys(body || {}) }, "Parsed request body");
12966
+ logger27.info({ body, bodyKeys: Object.keys(body || {}) }, "Parsed request body");
13137
12967
  const isInitRequest = body.method === "initialize";
13138
12968
  const { req, res } = fetchToNode.toReqRes(c.req.raw);
13139
12969
  const validatedContext = c.get("validatedContext") || {};
13140
12970
  const credentialStores = c.get("credentialStores");
13141
- logger28.info({ validatedContext }, "Validated context");
13142
- logger28.info({ req }, "request");
12971
+ logger27.info({ validatedContext }, "Validated context");
12972
+ logger27.info({ req }, "request");
13143
12973
  if (isInitRequest) {
13144
12974
  return await handleInitializationRequest(
13145
12975
  body,
@@ -13161,7 +12991,7 @@ app5.openapi(
13161
12991
  );
13162
12992
  }
13163
12993
  } catch (e) {
13164
- logger28.error(
12994
+ logger27.error(
13165
12995
  {
13166
12996
  error: e instanceof Error ? e.message : e,
13167
12997
  stack: e instanceof Error ? e.stack : void 0
@@ -13172,8 +13002,8 @@ app5.openapi(
13172
13002
  }
13173
13003
  }
13174
13004
  );
13175
- app5.get("/", async (c) => {
13176
- logger28.info({}, "Received GET MCP request");
13005
+ app4.get("/", async (c) => {
13006
+ logger27.info({}, "Received GET MCP request");
13177
13007
  return c.json(
13178
13008
  {
13179
13009
  jsonrpc: "2.0",
@@ -13186,8 +13016,8 @@ app5.get("/", async (c) => {
13186
13016
  { status: 405 }
13187
13017
  );
13188
13018
  });
13189
- app5.delete("/", async (c) => {
13190
- logger28.info({}, "Received DELETE MCP request");
13019
+ app4.delete("/", async (c) => {
13020
+ logger27.info({}, "Received DELETE MCP request");
13191
13021
  return c.json(
13192
13022
  {
13193
13023
  jsonrpc: "2.0",
@@ -13197,15 +13027,15 @@ app5.delete("/", async (c) => {
13197
13027
  { status: 405 }
13198
13028
  );
13199
13029
  });
13200
- var mcp_default = app5;
13030
+ var mcp_default = app4;
13201
13031
 
13202
13032
  // src/app.ts
13203
- var logger29 = agentsCore.getLogger("agents-run-api");
13033
+ var logger28 = agentsCore.getLogger("agents-run-api");
13204
13034
  function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13205
- const app7 = new zodOpenapi.OpenAPIHono();
13206
- app7.use("*", otel.otel());
13207
- app7.use("*", requestId.requestId());
13208
- app7.use("*", async (c, next) => {
13035
+ const app6 = new zodOpenapi.OpenAPIHono();
13036
+ app6.use("*", otel.otel());
13037
+ app6.use("*", requestId.requestId());
13038
+ app6.use("*", async (c, next) => {
13209
13039
  c.set("serverConfig", serverConfig);
13210
13040
  c.set("credentialStores", credentialStores);
13211
13041
  if (sandboxConfig) {
@@ -13213,18 +13043,18 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13213
13043
  }
13214
13044
  return next();
13215
13045
  });
13216
- app7.use("*", async (c, next) => {
13046
+ app6.use("*", async (c, next) => {
13217
13047
  if (c.req.header("content-type")?.includes("application/json")) {
13218
13048
  try {
13219
13049
  const body = await c.req.json();
13220
13050
  c.set("requestBody", body);
13221
13051
  } catch (error) {
13222
- logger29.debug({ error }, "Failed to parse JSON body, continuing without parsed body");
13052
+ logger28.debug({ error }, "Failed to parse JSON body, continuing without parsed body");
13223
13053
  }
13224
13054
  }
13225
13055
  return next();
13226
13056
  });
13227
- app7.use("*", async (c, next) => {
13057
+ app6.use("*", async (c, next) => {
13228
13058
  const reqId = c.get("requestId");
13229
13059
  let bag = api.propagation.getBaggage(api.context.active());
13230
13060
  if (!bag) {
@@ -13237,7 +13067,7 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13237
13067
  }
13238
13068
  return next();
13239
13069
  });
13240
- app7.onError(async (err, c) => {
13070
+ app6.onError(async (err, c) => {
13241
13071
  const isExpectedError = err instanceof httpException.HTTPException;
13242
13072
  const status = isExpectedError ? err.status : 500;
13243
13073
  const requestId2 = c.get("requestId") || "unknown";
@@ -13270,8 +13100,8 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13270
13100
  if (!isExpectedError) {
13271
13101
  const errorMessage = err instanceof Error ? err.message : String(err);
13272
13102
  const errorStack = err instanceof Error ? err.stack : void 0;
13273
- if (logger29) {
13274
- logger29.error(
13103
+ if (logger28) {
13104
+ logger28.error(
13275
13105
  {
13276
13106
  error: err,
13277
13107
  message: errorMessage,
@@ -13283,8 +13113,8 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13283
13113
  );
13284
13114
  }
13285
13115
  } else {
13286
- if (logger29) {
13287
- logger29.error(
13116
+ if (logger28) {
13117
+ logger28.error(
13288
13118
  {
13289
13119
  error: err,
13290
13120
  path: c.req.path,
@@ -13301,8 +13131,8 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13301
13131
  const response = err.getResponse();
13302
13132
  return response;
13303
13133
  } catch (responseError) {
13304
- if (logger29) {
13305
- logger29.error({ error: responseError }, "Error while handling HTTPException response");
13134
+ if (logger28) {
13135
+ logger28.error({ error: responseError }, "Error while handling HTTPException response");
13306
13136
  }
13307
13137
  }
13308
13138
  }
@@ -13318,7 +13148,7 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13318
13148
  ...instance && { instance }
13319
13149
  });
13320
13150
  });
13321
- app7.use(
13151
+ app6.use(
13322
13152
  "*",
13323
13153
  cors.cors({
13324
13154
  origin: "*",
@@ -13329,14 +13159,14 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13329
13159
  maxAge: 86400
13330
13160
  })
13331
13161
  );
13332
- app7.use("/tenants/*", apiKeyAuth());
13333
- app7.use("/agents/*", apiKeyAuth());
13334
- app7.use("/v1/*", apiKeyAuth());
13335
- app7.use("/api/*", apiKeyAuth());
13336
- app7.use("*", async (c, next) => {
13162
+ app6.use("/tenants/*", apiKeyAuth());
13163
+ app6.use("/agents/*", apiKeyAuth());
13164
+ app6.use("/v1/*", apiKeyAuth());
13165
+ app6.use("/api/*", apiKeyAuth());
13166
+ app6.use("*", async (c, next) => {
13337
13167
  const executionContext = c.get("executionContext");
13338
13168
  if (!executionContext) {
13339
- logger29.debug({}, "Empty execution context");
13169
+ logger28.debug({}, "Empty execution context");
13340
13170
  return next();
13341
13171
  }
13342
13172
  const { tenantId, projectId, agentId } = executionContext;
@@ -13345,7 +13175,7 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13345
13175
  if (requestBody) {
13346
13176
  conversationId = requestBody.conversationId;
13347
13177
  if (!conversationId) {
13348
- logger29.debug({ requestBody }, "No conversation ID found in request body");
13178
+ logger28.debug({ requestBody }, "No conversation ID found in request body");
13349
13179
  }
13350
13180
  }
13351
13181
  const entries = Object.fromEntries(
@@ -13360,7 +13190,7 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13360
13190
  })
13361
13191
  );
13362
13192
  if (!Object.keys(entries).length) {
13363
- logger29.debug({}, "Empty entries for baggage");
13193
+ logger28.debug({}, "Empty entries for baggage");
13364
13194
  return next();
13365
13195
  }
13366
13196
  const bag = Object.entries(entries).reduce(
@@ -13370,7 +13200,7 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13370
13200
  const ctxWithBag = api.propagation.setBaggage(api.context.active(), bag);
13371
13201
  return await api.context.with(ctxWithBag, async () => await next());
13372
13202
  });
13373
- app7.openapi(
13203
+ app6.openapi(
13374
13204
  zodOpenapi.createRoute({
13375
13205
  method: "get",
13376
13206
  path: "/health",
@@ -13387,30 +13217,29 @@ function createExecutionHono(serverConfig, credentialStores, sandboxConfig) {
13387
13217
  return c.body(null, 204);
13388
13218
  }
13389
13219
  );
13390
- app7.route("/v1/chat", chat_default);
13391
- app7.route("/api", chatDataStream_default);
13392
- app7.route("/v1/mcp", mcp_default);
13393
- app7.route("/agents", agents_default);
13394
- app7.route("/v1", dataComponentPreview_default);
13395
- setupOpenAPIRoutes(app7);
13396
- app7.use("/tenants/*", async (_c, next) => {
13220
+ app6.route("/v1/chat", chat_default);
13221
+ app6.route("/api", chatDataStream_default);
13222
+ app6.route("/v1/mcp", mcp_default);
13223
+ app6.route("/agents", agents_default);
13224
+ setupOpenAPIRoutes(app6);
13225
+ app6.use("/tenants/*", async (_c, next) => {
13397
13226
  await next();
13398
13227
  await flushBatchProcessor();
13399
13228
  });
13400
- app7.use("/agents/*", async (_c, next) => {
13229
+ app6.use("/agents/*", async (_c, next) => {
13401
13230
  await next();
13402
13231
  await flushBatchProcessor();
13403
13232
  });
13404
- app7.use("/v1/*", async (_c, next) => {
13233
+ app6.use("/v1/*", async (_c, next) => {
13405
13234
  await next();
13406
13235
  await flushBatchProcessor();
13407
13236
  });
13408
- app7.use("/api/*", async (_c, next) => {
13237
+ app6.use("/api/*", async (_c, next) => {
13409
13238
  await next();
13410
13239
  await flushBatchProcessor();
13411
13240
  });
13412
13241
  const baseApp = new hono.Hono();
13413
- baseApp.route("/", app7);
13242
+ baseApp.route("/", app6);
13414
13243
  return baseApp;
13415
13244
  }
13416
13245
 
@@ -13426,8 +13255,8 @@ var defaultConfig = {
13426
13255
  };
13427
13256
  var defaultStores = agentsCore.createDefaultCredentialStores();
13428
13257
  var defaultRegistry = new agentsCore.CredentialStoreRegistry(defaultStores);
13429
- var app6 = createExecutionHono(defaultConfig, defaultRegistry);
13430
- var index_default = app6;
13258
+ var app5 = createExecutionHono(defaultConfig, defaultRegistry);
13259
+ var index_default = app5;
13431
13260
  function createExecutionApp(config) {
13432
13261
  const serverConfig = config?.serverConfig ?? defaultConfig;
13433
13262
  const stores = config?.credentialStores ?? defaultStores;