@inkeep/agents-run-api 0.27.0 → 0.28.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 +17 -17
- package/dist/index.js +17 -17
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -12408,10 +12408,10 @@ var logger27 = agentsCore.getLogger("dataComponentPreview");
|
|
|
12408
12408
|
var app4 = new zodOpenapi.OpenAPIHono();
|
|
12409
12409
|
var generatePreviewRoute = zodOpenapi.createRoute({
|
|
12410
12410
|
method: "post",
|
|
12411
|
-
path: "/:tenantId/projects/:projectId/data-components/:id/generate-
|
|
12411
|
+
path: "/:tenantId/projects/:projectId/data-components/:id/generate-render",
|
|
12412
12412
|
tags: ["Data Component Preview"],
|
|
12413
|
-
summary: "Generate Component
|
|
12414
|
-
description: "Generate a React/Tailwind component
|
|
12413
|
+
summary: "Generate Component Render",
|
|
12414
|
+
description: "Generate a React/Tailwind component render using AI based on the data component schema",
|
|
12415
12415
|
request: {
|
|
12416
12416
|
params: z6.z.object({
|
|
12417
12417
|
tenantId: z6.z.string(),
|
|
@@ -12482,24 +12482,24 @@ app4.openapi(generatePreviewRoute, async (c) => {
|
|
|
12482
12482
|
const prompt = buildGenerationPrompt(dataComponent, instructions, existingCode);
|
|
12483
12483
|
try {
|
|
12484
12484
|
const modelConfig = ModelFactory.prepareGenerationConfig(project.models.base);
|
|
12485
|
-
const
|
|
12486
|
-
|
|
12487
|
-
|
|
12485
|
+
const renderSchema = z6.z.object({
|
|
12486
|
+
component: z6.z.string().describe("The React component code"),
|
|
12487
|
+
mockData: z6.z.any().describe("Sample data matching the props schema")
|
|
12488
12488
|
});
|
|
12489
12489
|
const result = ai.streamObject({
|
|
12490
12490
|
...modelConfig,
|
|
12491
12491
|
prompt,
|
|
12492
|
-
schema:
|
|
12492
|
+
schema: renderSchema,
|
|
12493
12493
|
temperature: 0.7
|
|
12494
12494
|
});
|
|
12495
12495
|
c.header("Content-Type", "text/plain; charset=utf-8");
|
|
12496
12496
|
c.header("Cache-Control", "no-cache");
|
|
12497
12497
|
c.header("Connection", "keep-alive");
|
|
12498
|
-
const existingData = existingCode && dataComponent.
|
|
12498
|
+
const existingData = existingCode && dataComponent.render && typeof dataComponent.render === "object" && "mockData" in dataComponent.render ? dataComponent.render.mockData : null;
|
|
12499
12499
|
return streaming.stream(c, async (stream3) => {
|
|
12500
12500
|
try {
|
|
12501
12501
|
for await (const partialObject of result.partialObjectStream) {
|
|
12502
|
-
const outputObject = instructions && existingData ? { ...partialObject,
|
|
12502
|
+
const outputObject = instructions && existingData ? { ...partialObject, mockData: existingData } : partialObject;
|
|
12503
12503
|
await stream3.write(JSON.stringify(outputObject) + "\n");
|
|
12504
12504
|
}
|
|
12505
12505
|
} catch (error) {
|
|
@@ -12508,7 +12508,7 @@ app4.openapi(generatePreviewRoute, async (c) => {
|
|
|
12508
12508
|
"Error streaming preview generation"
|
|
12509
12509
|
);
|
|
12510
12510
|
await stream3.write(
|
|
12511
|
-
JSON.stringify({
|
|
12511
|
+
JSON.stringify({ component: "// Error generating component preview", mockData: {} }) + "\n"
|
|
12512
12512
|
);
|
|
12513
12513
|
}
|
|
12514
12514
|
});
|
|
@@ -12556,13 +12556,13 @@ REQUIREMENTS:
|
|
|
12556
12556
|
|
|
12557
12557
|
OUTPUT FORMAT:
|
|
12558
12558
|
You need to generate only one thing:
|
|
12559
|
-
1. "
|
|
12559
|
+
1. "component": The modified React component code as a string
|
|
12560
12560
|
|
|
12561
|
-
Return ONLY the
|
|
12561
|
+
Return ONLY the component field, the mockData field will be reused from the existing render.
|
|
12562
12562
|
|
|
12563
12563
|
EXAMPLE OUTPUT:
|
|
12564
12564
|
{
|
|
12565
|
-
"
|
|
12565
|
+
"component": "import { Mail, User } from 'lucide-react';\\n\\nfunction ${componentName}(props) {\\n // Modified component code here\\n}"
|
|
12566
12566
|
}
|
|
12567
12567
|
|
|
12568
12568
|
Focus on making the requested changes while maintaining the component's quality and design principles.`;
|
|
@@ -12616,13 +12616,13 @@ AVAILABLE SEMANTIC COLOR CLASSES:
|
|
|
12616
12616
|
|
|
12617
12617
|
OUTPUT FORMAT:
|
|
12618
12618
|
You need to generate two things:
|
|
12619
|
-
1. "
|
|
12620
|
-
2. "
|
|
12619
|
+
1. "component": The complete React component code as a string
|
|
12620
|
+
2. "mockData": Realistic sample data that matches the props schema (as a JSON object)
|
|
12621
12621
|
|
|
12622
12622
|
EXAMPLE OUTPUT (for a user profile schema with name, email, role):
|
|
12623
12623
|
{
|
|
12624
|
-
"
|
|
12625
|
-
"
|
|
12624
|
+
"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}",
|
|
12625
|
+
"mockData": {
|
|
12626
12626
|
"name": "Sarah Chen",
|
|
12627
12627
|
"email": "sarah.chen@example.com",
|
|
12628
12628
|
"role": "Product Manager"
|
package/dist/index.js
CHANGED
|
@@ -10913,10 +10913,10 @@ var logger23 = getLogger("dataComponentPreview");
|
|
|
10913
10913
|
var app4 = new OpenAPIHono();
|
|
10914
10914
|
var generatePreviewRoute = createRoute({
|
|
10915
10915
|
method: "post",
|
|
10916
|
-
path: "/:tenantId/projects/:projectId/data-components/:id/generate-
|
|
10916
|
+
path: "/:tenantId/projects/:projectId/data-components/:id/generate-render",
|
|
10917
10917
|
tags: ["Data Component Preview"],
|
|
10918
|
-
summary: "Generate Component
|
|
10919
|
-
description: "Generate a React/Tailwind component
|
|
10918
|
+
summary: "Generate Component Render",
|
|
10919
|
+
description: "Generate a React/Tailwind component render using AI based on the data component schema",
|
|
10920
10920
|
request: {
|
|
10921
10921
|
params: z.object({
|
|
10922
10922
|
tenantId: z.string(),
|
|
@@ -10987,24 +10987,24 @@ app4.openapi(generatePreviewRoute, async (c) => {
|
|
|
10987
10987
|
const prompt = buildGenerationPrompt(dataComponent, instructions, existingCode);
|
|
10988
10988
|
try {
|
|
10989
10989
|
const modelConfig = ModelFactory.prepareGenerationConfig(project.models.base);
|
|
10990
|
-
const
|
|
10991
|
-
|
|
10992
|
-
|
|
10990
|
+
const renderSchema = z.object({
|
|
10991
|
+
component: z.string().describe("The React component code"),
|
|
10992
|
+
mockData: z.any().describe("Sample data matching the props schema")
|
|
10993
10993
|
});
|
|
10994
10994
|
const result = streamObject({
|
|
10995
10995
|
...modelConfig,
|
|
10996
10996
|
prompt,
|
|
10997
|
-
schema:
|
|
10997
|
+
schema: renderSchema,
|
|
10998
10998
|
temperature: 0.7
|
|
10999
10999
|
});
|
|
11000
11000
|
c.header("Content-Type", "text/plain; charset=utf-8");
|
|
11001
11001
|
c.header("Cache-Control", "no-cache");
|
|
11002
11002
|
c.header("Connection", "keep-alive");
|
|
11003
|
-
const existingData = existingCode && dataComponent.
|
|
11003
|
+
const existingData = existingCode && dataComponent.render && typeof dataComponent.render === "object" && "mockData" in dataComponent.render ? dataComponent.render.mockData : null;
|
|
11004
11004
|
return stream(c, async (stream3) => {
|
|
11005
11005
|
try {
|
|
11006
11006
|
for await (const partialObject of result.partialObjectStream) {
|
|
11007
|
-
const outputObject = instructions && existingData ? { ...partialObject,
|
|
11007
|
+
const outputObject = instructions && existingData ? { ...partialObject, mockData: existingData } : partialObject;
|
|
11008
11008
|
await stream3.write(JSON.stringify(outputObject) + "\n");
|
|
11009
11009
|
}
|
|
11010
11010
|
} catch (error) {
|
|
@@ -11013,7 +11013,7 @@ app4.openapi(generatePreviewRoute, async (c) => {
|
|
|
11013
11013
|
"Error streaming preview generation"
|
|
11014
11014
|
);
|
|
11015
11015
|
await stream3.write(
|
|
11016
|
-
JSON.stringify({
|
|
11016
|
+
JSON.stringify({ component: "// Error generating component preview", mockData: {} }) + "\n"
|
|
11017
11017
|
);
|
|
11018
11018
|
}
|
|
11019
11019
|
});
|
|
@@ -11061,13 +11061,13 @@ REQUIREMENTS:
|
|
|
11061
11061
|
|
|
11062
11062
|
OUTPUT FORMAT:
|
|
11063
11063
|
You need to generate only one thing:
|
|
11064
|
-
1. "
|
|
11064
|
+
1. "component": The modified React component code as a string
|
|
11065
11065
|
|
|
11066
|
-
Return ONLY the
|
|
11066
|
+
Return ONLY the component field, the mockData field will be reused from the existing render.
|
|
11067
11067
|
|
|
11068
11068
|
EXAMPLE OUTPUT:
|
|
11069
11069
|
{
|
|
11070
|
-
"
|
|
11070
|
+
"component": "import { Mail, User } from 'lucide-react';\\n\\nfunction ${componentName}(props) {\\n // Modified component code here\\n}"
|
|
11071
11071
|
}
|
|
11072
11072
|
|
|
11073
11073
|
Focus on making the requested changes while maintaining the component's quality and design principles.`;
|
|
@@ -11121,13 +11121,13 @@ AVAILABLE SEMANTIC COLOR CLASSES:
|
|
|
11121
11121
|
|
|
11122
11122
|
OUTPUT FORMAT:
|
|
11123
11123
|
You need to generate two things:
|
|
11124
|
-
1. "
|
|
11125
|
-
2. "
|
|
11124
|
+
1. "component": The complete React component code as a string
|
|
11125
|
+
2. "mockData": Realistic sample data that matches the props schema (as a JSON object)
|
|
11126
11126
|
|
|
11127
11127
|
EXAMPLE OUTPUT (for a user profile schema with name, email, role):
|
|
11128
11128
|
{
|
|
11129
|
-
"
|
|
11130
|
-
"
|
|
11129
|
+
"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}",
|
|
11130
|
+
"mockData": {
|
|
11131
11131
|
"name": "Sarah Chen",
|
|
11132
11132
|
"email": "sarah.chen@example.com",
|
|
11133
11133
|
"role": "Product Manager"
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-run-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Agents Run API for Inkeep Agent Framework - handles chat, agent execution, and streaming",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -52,7 +52,7 @@
|
|
|
52
52
|
"traverse": "^0.6.11",
|
|
53
53
|
"ts-pattern": "^5.7.1",
|
|
54
54
|
"zod": "^4.1.11",
|
|
55
|
-
"@inkeep/agents-core": "^0.
|
|
55
|
+
"@inkeep/agents-core": "^0.28.0"
|
|
56
56
|
},
|
|
57
57
|
"optionalDependencies": {
|
|
58
58
|
"keytar": "^7.9.0"
|