@inkeep/agents-manage-api 0.23.5 → 0.24.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 +8 -105
- package/dist/index.js +9 -106
- package/package.json +2 -2
package/dist/index.cjs
CHANGED
|
@@ -12,8 +12,6 @@ var honoPino = require('hono-pino');
|
|
|
12
12
|
var factory = require('hono/factory');
|
|
13
13
|
var zod = require('zod');
|
|
14
14
|
var swaggerUi = require('@hono/swagger-ui');
|
|
15
|
-
var nanoid = require('nanoid');
|
|
16
|
-
var streaming = require('hono/streaming');
|
|
17
15
|
|
|
18
16
|
var __defProp = Object.defineProperty;
|
|
19
17
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -324,7 +322,7 @@ app.openapi(
|
|
|
324
322
|
const agent = await agentsCore.createAgent(dbClient_default)({
|
|
325
323
|
tenantId,
|
|
326
324
|
projectId,
|
|
327
|
-
id: validatedBody.id ||
|
|
325
|
+
id: validatedBody.id || agentsCore.generateId(),
|
|
328
326
|
name: validatedBody.name,
|
|
329
327
|
defaultSubAgentId: validatedBody.defaultSubAgentId,
|
|
330
328
|
contextConfigId: validatedBody.contextConfigId ?? void 0
|
|
@@ -1041,7 +1039,7 @@ app4.openapi(
|
|
|
1041
1039
|
});
|
|
1042
1040
|
}
|
|
1043
1041
|
}
|
|
1044
|
-
const finalId = body.id ? String(body.id) :
|
|
1042
|
+
const finalId = body.id ? String(body.id) : agentsCore.generateId();
|
|
1045
1043
|
const componentData = {
|
|
1046
1044
|
tenantId,
|
|
1047
1045
|
projectId,
|
|
@@ -1948,101 +1946,6 @@ app8.openapi(
|
|
|
1948
1946
|
return c.body(null, 204);
|
|
1949
1947
|
}
|
|
1950
1948
|
);
|
|
1951
|
-
app8.openapi(
|
|
1952
|
-
zodOpenapi.createRoute({
|
|
1953
|
-
method: "post",
|
|
1954
|
-
path: "/{id}/generate-preview",
|
|
1955
|
-
summary: "Generate Component Preview",
|
|
1956
|
-
operationId: "generate-component-preview",
|
|
1957
|
-
tags: ["Data Component"],
|
|
1958
|
-
request: {
|
|
1959
|
-
params: agentsCore.TenantProjectIdParamsSchema,
|
|
1960
|
-
body: {
|
|
1961
|
-
content: {
|
|
1962
|
-
"application/json": {
|
|
1963
|
-
schema: zod.z.object({
|
|
1964
|
-
instructions: zod.z.string().optional(),
|
|
1965
|
-
existingCode: zod.z.string().optional()
|
|
1966
|
-
})
|
|
1967
|
-
}
|
|
1968
|
-
}
|
|
1969
|
-
}
|
|
1970
|
-
},
|
|
1971
|
-
responses: {
|
|
1972
|
-
200: {
|
|
1973
|
-
description: "Streaming component code generation",
|
|
1974
|
-
content: {
|
|
1975
|
-
"text/plain": {
|
|
1976
|
-
schema: { type: "string" }
|
|
1977
|
-
}
|
|
1978
|
-
}
|
|
1979
|
-
},
|
|
1980
|
-
...agentsCore.commonGetErrorResponses
|
|
1981
|
-
}
|
|
1982
|
-
}),
|
|
1983
|
-
async (c) => {
|
|
1984
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1985
|
-
const body = c.req.valid("json");
|
|
1986
|
-
const runApiUrl = env.AGENTS_RUN_API_URL;
|
|
1987
|
-
const url = `${runApiUrl}/v1/${tenantId}/projects/${projectId}/data-components/${id}/generate-preview`;
|
|
1988
|
-
try {
|
|
1989
|
-
const response = await fetch(url, {
|
|
1990
|
-
method: "POST",
|
|
1991
|
-
headers: {
|
|
1992
|
-
"Content-Type": "application/json"
|
|
1993
|
-
},
|
|
1994
|
-
body: JSON.stringify(body)
|
|
1995
|
-
});
|
|
1996
|
-
if (!response.ok) {
|
|
1997
|
-
throw agentsCore.createApiError({
|
|
1998
|
-
code: "internal_server_error",
|
|
1999
|
-
message: `Failed to generate preview: ${response.statusText}`
|
|
2000
|
-
});
|
|
2001
|
-
}
|
|
2002
|
-
if (!response.body) {
|
|
2003
|
-
throw agentsCore.createApiError({
|
|
2004
|
-
code: "internal_server_error",
|
|
2005
|
-
message: "No response body from preview generation"
|
|
2006
|
-
});
|
|
2007
|
-
}
|
|
2008
|
-
c.header("Content-Type", "text/plain; charset=utf-8");
|
|
2009
|
-
c.header("Cache-Control", "no-cache");
|
|
2010
|
-
c.header("Connection", "keep-alive");
|
|
2011
|
-
return streaming.stream(c, async (stream2) => {
|
|
2012
|
-
const responseBody = response.body;
|
|
2013
|
-
if (!responseBody) {
|
|
2014
|
-
throw agentsCore.createApiError({
|
|
2015
|
-
code: "internal_server_error",
|
|
2016
|
-
message: "Response body is null"
|
|
2017
|
-
});
|
|
2018
|
-
}
|
|
2019
|
-
const reader = responseBody.getReader();
|
|
2020
|
-
const decoder = new TextDecoder();
|
|
2021
|
-
try {
|
|
2022
|
-
while (true) {
|
|
2023
|
-
const { done, value } = await reader.read();
|
|
2024
|
-
if (done) break;
|
|
2025
|
-
const text = decoder.decode(value, { stream: true });
|
|
2026
|
-
await stream2.write(text);
|
|
2027
|
-
}
|
|
2028
|
-
} catch {
|
|
2029
|
-
throw agentsCore.createApiError({
|
|
2030
|
-
code: "internal_server_error",
|
|
2031
|
-
message: "Error streaming preview generation"
|
|
2032
|
-
});
|
|
2033
|
-
}
|
|
2034
|
-
});
|
|
2035
|
-
} catch (error) {
|
|
2036
|
-
if (error instanceof Error && "code" in error) {
|
|
2037
|
-
throw error;
|
|
2038
|
-
}
|
|
2039
|
-
throw agentsCore.createApiError({
|
|
2040
|
-
code: "internal_server_error",
|
|
2041
|
-
message: "Failed to generate component preview"
|
|
2042
|
-
});
|
|
2043
|
-
}
|
|
2044
|
-
}
|
|
2045
|
-
);
|
|
2046
1949
|
var dataComponents_default = app8;
|
|
2047
1950
|
var app9 = new zodOpenapi.OpenAPIHono();
|
|
2048
1951
|
app9.openapi(
|
|
@@ -2162,7 +2065,7 @@ app9.openapi(
|
|
|
2162
2065
|
tenantId,
|
|
2163
2066
|
projectId,
|
|
2164
2067
|
agentId,
|
|
2165
|
-
id: body.id ? String(body.id) :
|
|
2068
|
+
id: body.id ? String(body.id) : agentsCore.generateId(),
|
|
2166
2069
|
name: body.name,
|
|
2167
2070
|
description: body.description,
|
|
2168
2071
|
baseUrl: body.baseUrl,
|
|
@@ -2392,7 +2295,7 @@ app10.openapi(
|
|
|
2392
2295
|
const { tenantId, projectId } = c.req.valid("param");
|
|
2393
2296
|
const functionData = c.req.valid("json");
|
|
2394
2297
|
try {
|
|
2395
|
-
const id = functionData.id ||
|
|
2298
|
+
const id = functionData.id || agentsCore.generateId();
|
|
2396
2299
|
await agentsCore.upsertFunction(dbClient_default)({
|
|
2397
2300
|
data: {
|
|
2398
2301
|
...functionData,
|
|
@@ -2650,7 +2553,7 @@ app11.openapi(
|
|
|
2650
2553
|
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
2651
2554
|
const body = c.req.valid("json");
|
|
2652
2555
|
try {
|
|
2653
|
-
const id = body.id ||
|
|
2556
|
+
const id = body.id || agentsCore.generateId();
|
|
2654
2557
|
const functionTool = await agentsCore.createFunctionTool(dbClient_default)({
|
|
2655
2558
|
scopes: { tenantId, projectId, agentId },
|
|
2656
2559
|
data: {
|
|
@@ -3652,7 +3555,7 @@ app15.openapi(
|
|
|
3652
3555
|
const relationData = {
|
|
3653
3556
|
agentId,
|
|
3654
3557
|
tenantId,
|
|
3655
|
-
id:
|
|
3558
|
+
id: agentsCore.generateId(),
|
|
3656
3559
|
projectId,
|
|
3657
3560
|
sourceSubAgentId: body.sourceSubAgentId,
|
|
3658
3561
|
targetSubAgentId: isExternalAgent ? void 0 : body.targetSubAgentId,
|
|
@@ -3866,7 +3769,7 @@ app16.openapi(
|
|
|
3866
3769
|
async (c) => {
|
|
3867
3770
|
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
3868
3771
|
const body = c.req.valid("json");
|
|
3869
|
-
const subAgentId = body.id ? String(body.id) :
|
|
3772
|
+
const subAgentId = body.id ? String(body.id) : agentsCore.generateId();
|
|
3870
3773
|
const subAgent = await agentsCore.createSubAgent(dbClient_default)({
|
|
3871
3774
|
...body,
|
|
3872
3775
|
id: subAgentId,
|
|
@@ -4396,7 +4299,7 @@ app18.openapi(
|
|
|
4396
4299
|
const body = c.req.valid("json");
|
|
4397
4300
|
const credentialStores = c.get("credentialStores");
|
|
4398
4301
|
logger5.info({ body }, "body");
|
|
4399
|
-
const id = body.id ||
|
|
4302
|
+
const id = body.id || agentsCore.generateId();
|
|
4400
4303
|
const tool = await agentsCore.createTool(dbClient_default)({
|
|
4401
4304
|
tenantId,
|
|
4402
4305
|
projectId,
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { loadEnvironmentFiles, getLogger, createDatabaseClient, commonGetErrorResponses, AgentListResponse, PaginationQueryParamsSchema, TenantProjectParamsSchema, listAgents, AgentResponse, TenantProjectIdParamsSchema, getAgentById, createApiError, ListResponseSchema, getAgentSubAgentInfos, SingleResponseSchema, TenantProjectAgentParamsSchema, AgentWithinContextOfProjectSchema, getFullAgentDefinition, AgentApiInsertSchema, createAgent, AgentApiUpdateSchema, updateAgent, ErrorResponseSchema, deleteAgent, createFullAgentServerSide, getFullAgent, updateFullAgentServerSide, deleteFullAgent, ApiKeyListResponse, listApiKeysPaginated, ApiKeyResponse, getApiKeyById, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, generateApiKey, createApiKey, ApiKeyApiUpdateSchema, updateApiKey, deleteApiKey, ArtifactComponentListResponse, listArtifactComponentsPaginated, ArtifactComponentResponse, getArtifactComponentById, ArtifactComponentApiInsertSchema, validatePropsAsJsonSchema, createArtifactComponent, ArtifactComponentApiUpdateSchema, updateArtifactComponent, deleteArtifactComponent, ContextConfigListResponse, listContextConfigsPaginated, ContextConfigResponse, TenantProjectAgentIdParamsSchema, getContextConfigById, ContextConfigApiInsertSchema, createContextConfig, commonUpdateErrorResponses, ContextConfigApiUpdateSchema, updateContextConfig, commonDeleteErrorResponses, deleteContextConfig, CredentialStoreType, CredentialReferenceListResponse, listCredentialReferencesPaginated, CredentialReferenceApiSelectSchema, CredentialReferenceResponse, getCredentialReferenceWithTools, CredentialReferenceApiInsertSchema, createCredentialReference, CredentialReferenceApiUpdateSchema, updateCredentialReference, getCredentialReferenceById, getCredentialStoreLookupKeyFromRetrievalParams, deleteCredentialReference, DataComponentListResponse, listDataComponentsPaginated, DataComponentResponse, getDataComponent, DataComponentApiInsertSchema, createDataComponent, DataComponentApiUpdateSchema, updateDataComponent, deleteDataComponent, ExternalAgentListResponse, listExternalAgentsPaginated, ExternalAgentResponse, getExternalAgent, ExternalAgentApiInsertSchema, createExternalAgent, ExternalAgentApiUpdateSchema, updateExternalAgent, deleteExternalAgent, FunctionListResponse, listFunctions, FunctionResponse, getFunction, FunctionApiInsertSchema, upsertFunction, FunctionApiUpdateSchema, deleteFunction, FunctionToolApiSelectSchema, listFunctionTools, getFunctionToolById, FunctionToolApiInsertSchema, createFunctionTool, FunctionToolApiUpdateSchema, updateFunctionTool, deleteFunctionTool, ProjectListResponse, TenantParamsSchema, listProjectsPaginated, ProjectResponse, TenantIdParamsSchema, getProject, ProjectApiInsertSchema, createProject, ProjectApiUpdateSchema, updateProject, deleteProject, ArtifactComponentApiSelectSchema, getArtifactComponentsForAgent, getAgentsUsingArtifactComponent, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, getSubAgentById, isArtifactComponentAssociatedWithAgent, associateArtifactComponentWithAgent, RemovedResponseSchema, removeArtifactComponentFromAgent, ExistsResponseSchema, DataComponentApiSelectSchema, getDataComponentsForAgent, getAgentsUsingDataComponent, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, isDataComponentAssociatedWithAgent, associateDataComponentWithAgent, removeDataComponentFromAgent, SubAgentRelationApiSelectSchema, SubAgentRelationQuerySchema, getAgentRelationsBySource, getSubAgentRelationsByTarget, getExternalAgentRelations, listAgentRelations, getAgentRelationById, SubAgentRelationApiInsertSchema, validateExternalAgent, validateInternalSubAgent, createSubAgentRelation, SubAgentRelationApiUpdateSchema, updateAgentRelation, deleteSubAgentRelation, SubAgentListResponse, listSubAgentsPaginated, SubAgentResponse, SubAgentApiInsertSchema, createSubAgent, SubAgentApiUpdateSchema, updateSubAgent, deleteSubAgent, SubAgentToolRelationApiSelectSchema, getAgentToolRelationByAgent, getAgentToolRelationByTool, listAgentToolRelations, getAgentToolRelationById, getAgentsForTool, SubAgentToolRelationApiInsertSchema, createAgentToolRelation, SubAgentToolRelationApiUpdateSchema, updateAgentToolRelation, deleteAgentToolRelation, McpToolSchema, ToolStatusSchema, listTools, dbResultToMcpTool, getToolById, ToolApiInsertSchema, createTool, ToolApiUpdateSchema, updateTool, deleteTool, generateIdFromName, FullProjectDefinitionSchema, createFullProjectServerSide, getFullProject, updateFullProjectServerSide, deleteFullProject, createDefaultCredentialStores, CredentialStoreRegistry, initiateMcpOAuthFlow, exchangeMcpAuthorizationCode, handleApiError } from '@inkeep/agents-core';
|
|
1
|
+
import { loadEnvironmentFiles, getLogger, createDatabaseClient, commonGetErrorResponses, AgentListResponse, PaginationQueryParamsSchema, TenantProjectParamsSchema, listAgents, AgentResponse, TenantProjectIdParamsSchema, getAgentById, createApiError, ListResponseSchema, getAgentSubAgentInfos, SingleResponseSchema, TenantProjectAgentParamsSchema, AgentWithinContextOfProjectSchema, getFullAgentDefinition, AgentApiInsertSchema, createAgent, generateId, AgentApiUpdateSchema, updateAgent, ErrorResponseSchema, deleteAgent, createFullAgentServerSide, getFullAgent, updateFullAgentServerSide, deleteFullAgent, ApiKeyListResponse, listApiKeysPaginated, ApiKeyResponse, getApiKeyById, ApiKeyApiCreationResponseSchema, ApiKeyApiInsertSchema, generateApiKey, createApiKey, ApiKeyApiUpdateSchema, updateApiKey, deleteApiKey, ArtifactComponentListResponse, listArtifactComponentsPaginated, ArtifactComponentResponse, getArtifactComponentById, ArtifactComponentApiInsertSchema, validatePropsAsJsonSchema, createArtifactComponent, ArtifactComponentApiUpdateSchema, updateArtifactComponent, deleteArtifactComponent, ContextConfigListResponse, listContextConfigsPaginated, ContextConfigResponse, TenantProjectAgentIdParamsSchema, getContextConfigById, ContextConfigApiInsertSchema, createContextConfig, commonUpdateErrorResponses, ContextConfigApiUpdateSchema, updateContextConfig, commonDeleteErrorResponses, deleteContextConfig, CredentialStoreType, CredentialReferenceListResponse, listCredentialReferencesPaginated, CredentialReferenceApiSelectSchema, CredentialReferenceResponse, getCredentialReferenceWithTools, CredentialReferenceApiInsertSchema, createCredentialReference, CredentialReferenceApiUpdateSchema, updateCredentialReference, getCredentialReferenceById, getCredentialStoreLookupKeyFromRetrievalParams, deleteCredentialReference, DataComponentListResponse, listDataComponentsPaginated, DataComponentResponse, getDataComponent, DataComponentApiInsertSchema, createDataComponent, DataComponentApiUpdateSchema, updateDataComponent, deleteDataComponent, ExternalAgentListResponse, listExternalAgentsPaginated, ExternalAgentResponse, getExternalAgent, ExternalAgentApiInsertSchema, createExternalAgent, ExternalAgentApiUpdateSchema, updateExternalAgent, deleteExternalAgent, FunctionListResponse, listFunctions, FunctionResponse, getFunction, FunctionApiInsertSchema, upsertFunction, FunctionApiUpdateSchema, deleteFunction, FunctionToolApiSelectSchema, listFunctionTools, getFunctionToolById, FunctionToolApiInsertSchema, createFunctionTool, FunctionToolApiUpdateSchema, updateFunctionTool, deleteFunctionTool, ProjectListResponse, TenantParamsSchema, listProjectsPaginated, ProjectResponse, TenantIdParamsSchema, getProject, ProjectApiInsertSchema, createProject, ProjectApiUpdateSchema, updateProject, deleteProject, ArtifactComponentApiSelectSchema, getArtifactComponentsForAgent, getAgentsUsingArtifactComponent, SubAgentArtifactComponentApiInsertSchema, SubAgentArtifactComponentApiSelectSchema, getSubAgentById, isArtifactComponentAssociatedWithAgent, associateArtifactComponentWithAgent, RemovedResponseSchema, removeArtifactComponentFromAgent, ExistsResponseSchema, DataComponentApiSelectSchema, getDataComponentsForAgent, getAgentsUsingDataComponent, SubAgentDataComponentApiInsertSchema, SubAgentDataComponentApiSelectSchema, isDataComponentAssociatedWithAgent, associateDataComponentWithAgent, removeDataComponentFromAgent, SubAgentRelationApiSelectSchema, SubAgentRelationQuerySchema, getAgentRelationsBySource, getSubAgentRelationsByTarget, getExternalAgentRelations, listAgentRelations, getAgentRelationById, SubAgentRelationApiInsertSchema, validateExternalAgent, validateInternalSubAgent, createSubAgentRelation, SubAgentRelationApiUpdateSchema, updateAgentRelation, deleteSubAgentRelation, SubAgentListResponse, listSubAgentsPaginated, SubAgentResponse, SubAgentApiInsertSchema, createSubAgent, SubAgentApiUpdateSchema, updateSubAgent, deleteSubAgent, SubAgentToolRelationApiSelectSchema, getAgentToolRelationByAgent, getAgentToolRelationByTool, listAgentToolRelations, getAgentToolRelationById, getAgentsForTool, SubAgentToolRelationApiInsertSchema, createAgentToolRelation, SubAgentToolRelationApiUpdateSchema, updateAgentToolRelation, deleteAgentToolRelation, McpToolSchema, ToolStatusSchema, listTools, dbResultToMcpTool, getToolById, ToolApiInsertSchema, createTool, ToolApiUpdateSchema, updateTool, deleteTool, generateIdFromName, FullProjectDefinitionSchema, createFullProjectServerSide, getFullProject, updateFullProjectServerSide, deleteFullProject, createDefaultCredentialStores, CredentialStoreRegistry, initiateMcpOAuthFlow, exchangeMcpAuthorizationCode, handleApiError } from '@inkeep/agents-core';
|
|
2
2
|
import { OpenAPIHono, createRoute, z as z$1 } from '@hono/zod-openapi';
|
|
3
3
|
import { Hono } from 'hono';
|
|
4
4
|
import { cors } from 'hono/cors';
|
|
@@ -8,8 +8,6 @@ import { pinoLogger } from 'hono-pino';
|
|
|
8
8
|
import { createMiddleware } from 'hono/factory';
|
|
9
9
|
import { z } from 'zod';
|
|
10
10
|
import { swaggerUI } from '@hono/swagger-ui';
|
|
11
|
-
import { nanoid } from 'nanoid';
|
|
12
|
-
import { stream } from 'hono/streaming';
|
|
13
11
|
|
|
14
12
|
var __defProp = Object.defineProperty;
|
|
15
13
|
var __defNormalProp = (obj, key, value) => key in obj ? __defProp(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
|
|
@@ -320,7 +318,7 @@ app.openapi(
|
|
|
320
318
|
const agent = await createAgent(dbClient_default)({
|
|
321
319
|
tenantId,
|
|
322
320
|
projectId,
|
|
323
|
-
id: validatedBody.id ||
|
|
321
|
+
id: validatedBody.id || generateId(),
|
|
324
322
|
name: validatedBody.name,
|
|
325
323
|
defaultSubAgentId: validatedBody.defaultSubAgentId,
|
|
326
324
|
contextConfigId: validatedBody.contextConfigId ?? void 0
|
|
@@ -1037,7 +1035,7 @@ app4.openapi(
|
|
|
1037
1035
|
});
|
|
1038
1036
|
}
|
|
1039
1037
|
}
|
|
1040
|
-
const finalId = body.id ? String(body.id) :
|
|
1038
|
+
const finalId = body.id ? String(body.id) : generateId();
|
|
1041
1039
|
const componentData = {
|
|
1042
1040
|
tenantId,
|
|
1043
1041
|
projectId,
|
|
@@ -1944,101 +1942,6 @@ app8.openapi(
|
|
|
1944
1942
|
return c.body(null, 204);
|
|
1945
1943
|
}
|
|
1946
1944
|
);
|
|
1947
|
-
app8.openapi(
|
|
1948
|
-
createRoute({
|
|
1949
|
-
method: "post",
|
|
1950
|
-
path: "/{id}/generate-preview",
|
|
1951
|
-
summary: "Generate Component Preview",
|
|
1952
|
-
operationId: "generate-component-preview",
|
|
1953
|
-
tags: ["Data Component"],
|
|
1954
|
-
request: {
|
|
1955
|
-
params: TenantProjectIdParamsSchema,
|
|
1956
|
-
body: {
|
|
1957
|
-
content: {
|
|
1958
|
-
"application/json": {
|
|
1959
|
-
schema: z.object({
|
|
1960
|
-
instructions: z.string().optional(),
|
|
1961
|
-
existingCode: z.string().optional()
|
|
1962
|
-
})
|
|
1963
|
-
}
|
|
1964
|
-
}
|
|
1965
|
-
}
|
|
1966
|
-
},
|
|
1967
|
-
responses: {
|
|
1968
|
-
200: {
|
|
1969
|
-
description: "Streaming component code generation",
|
|
1970
|
-
content: {
|
|
1971
|
-
"text/plain": {
|
|
1972
|
-
schema: { type: "string" }
|
|
1973
|
-
}
|
|
1974
|
-
}
|
|
1975
|
-
},
|
|
1976
|
-
...commonGetErrorResponses
|
|
1977
|
-
}
|
|
1978
|
-
}),
|
|
1979
|
-
async (c) => {
|
|
1980
|
-
const { tenantId, projectId, id } = c.req.valid("param");
|
|
1981
|
-
const body = c.req.valid("json");
|
|
1982
|
-
const runApiUrl = env.AGENTS_RUN_API_URL;
|
|
1983
|
-
const url = `${runApiUrl}/v1/${tenantId}/projects/${projectId}/data-components/${id}/generate-preview`;
|
|
1984
|
-
try {
|
|
1985
|
-
const response = await fetch(url, {
|
|
1986
|
-
method: "POST",
|
|
1987
|
-
headers: {
|
|
1988
|
-
"Content-Type": "application/json"
|
|
1989
|
-
},
|
|
1990
|
-
body: JSON.stringify(body)
|
|
1991
|
-
});
|
|
1992
|
-
if (!response.ok) {
|
|
1993
|
-
throw createApiError({
|
|
1994
|
-
code: "internal_server_error",
|
|
1995
|
-
message: `Failed to generate preview: ${response.statusText}`
|
|
1996
|
-
});
|
|
1997
|
-
}
|
|
1998
|
-
if (!response.body) {
|
|
1999
|
-
throw createApiError({
|
|
2000
|
-
code: "internal_server_error",
|
|
2001
|
-
message: "No response body from preview generation"
|
|
2002
|
-
});
|
|
2003
|
-
}
|
|
2004
|
-
c.header("Content-Type", "text/plain; charset=utf-8");
|
|
2005
|
-
c.header("Cache-Control", "no-cache");
|
|
2006
|
-
c.header("Connection", "keep-alive");
|
|
2007
|
-
return stream(c, async (stream2) => {
|
|
2008
|
-
const responseBody = response.body;
|
|
2009
|
-
if (!responseBody) {
|
|
2010
|
-
throw createApiError({
|
|
2011
|
-
code: "internal_server_error",
|
|
2012
|
-
message: "Response body is null"
|
|
2013
|
-
});
|
|
2014
|
-
}
|
|
2015
|
-
const reader = responseBody.getReader();
|
|
2016
|
-
const decoder = new TextDecoder();
|
|
2017
|
-
try {
|
|
2018
|
-
while (true) {
|
|
2019
|
-
const { done, value } = await reader.read();
|
|
2020
|
-
if (done) break;
|
|
2021
|
-
const text = decoder.decode(value, { stream: true });
|
|
2022
|
-
await stream2.write(text);
|
|
2023
|
-
}
|
|
2024
|
-
} catch {
|
|
2025
|
-
throw createApiError({
|
|
2026
|
-
code: "internal_server_error",
|
|
2027
|
-
message: "Error streaming preview generation"
|
|
2028
|
-
});
|
|
2029
|
-
}
|
|
2030
|
-
});
|
|
2031
|
-
} catch (error) {
|
|
2032
|
-
if (error instanceof Error && "code" in error) {
|
|
2033
|
-
throw error;
|
|
2034
|
-
}
|
|
2035
|
-
throw createApiError({
|
|
2036
|
-
code: "internal_server_error",
|
|
2037
|
-
message: "Failed to generate component preview"
|
|
2038
|
-
});
|
|
2039
|
-
}
|
|
2040
|
-
}
|
|
2041
|
-
);
|
|
2042
1945
|
var dataComponents_default = app8;
|
|
2043
1946
|
var app9 = new OpenAPIHono();
|
|
2044
1947
|
app9.openapi(
|
|
@@ -2158,7 +2061,7 @@ app9.openapi(
|
|
|
2158
2061
|
tenantId,
|
|
2159
2062
|
projectId,
|
|
2160
2063
|
agentId,
|
|
2161
|
-
id: body.id ? String(body.id) :
|
|
2064
|
+
id: body.id ? String(body.id) : generateId(),
|
|
2162
2065
|
name: body.name,
|
|
2163
2066
|
description: body.description,
|
|
2164
2067
|
baseUrl: body.baseUrl,
|
|
@@ -2388,7 +2291,7 @@ app10.openapi(
|
|
|
2388
2291
|
const { tenantId, projectId } = c.req.valid("param");
|
|
2389
2292
|
const functionData = c.req.valid("json");
|
|
2390
2293
|
try {
|
|
2391
|
-
const id = functionData.id ||
|
|
2294
|
+
const id = functionData.id || generateId();
|
|
2392
2295
|
await upsertFunction(dbClient_default)({
|
|
2393
2296
|
data: {
|
|
2394
2297
|
...functionData,
|
|
@@ -2646,7 +2549,7 @@ app11.openapi(
|
|
|
2646
2549
|
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
2647
2550
|
const body = c.req.valid("json");
|
|
2648
2551
|
try {
|
|
2649
|
-
const id = body.id ||
|
|
2552
|
+
const id = body.id || generateId();
|
|
2650
2553
|
const functionTool = await createFunctionTool(dbClient_default)({
|
|
2651
2554
|
scopes: { tenantId, projectId, agentId },
|
|
2652
2555
|
data: {
|
|
@@ -3648,7 +3551,7 @@ app15.openapi(
|
|
|
3648
3551
|
const relationData = {
|
|
3649
3552
|
agentId,
|
|
3650
3553
|
tenantId,
|
|
3651
|
-
id:
|
|
3554
|
+
id: generateId(),
|
|
3652
3555
|
projectId,
|
|
3653
3556
|
sourceSubAgentId: body.sourceSubAgentId,
|
|
3654
3557
|
targetSubAgentId: isExternalAgent ? void 0 : body.targetSubAgentId,
|
|
@@ -3862,7 +3765,7 @@ app16.openapi(
|
|
|
3862
3765
|
async (c) => {
|
|
3863
3766
|
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
3864
3767
|
const body = c.req.valid("json");
|
|
3865
|
-
const subAgentId = body.id ? String(body.id) :
|
|
3768
|
+
const subAgentId = body.id ? String(body.id) : generateId();
|
|
3866
3769
|
const subAgent = await createSubAgent(dbClient_default)({
|
|
3867
3770
|
...body,
|
|
3868
3771
|
id: subAgentId,
|
|
@@ -4392,7 +4295,7 @@ app18.openapi(
|
|
|
4392
4295
|
const body = c.req.valid("json");
|
|
4393
4296
|
const credentialStores = c.get("credentialStores");
|
|
4394
4297
|
logger5.info({ body }, "body");
|
|
4395
|
-
const id = body.id ||
|
|
4298
|
+
const id = body.id || generateId();
|
|
4396
4299
|
const tool = await createTool(dbClient_default)({
|
|
4397
4300
|
tenantId,
|
|
4398
4301
|
projectId,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/agents-manage-api",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.24.0",
|
|
4
4
|
"description": "Agents Manage API for Inkeep Agent Framework - handles CRUD operations and OAuth",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -23,7 +23,7 @@
|
|
|
23
23
|
"openid-client": "^6.6.4",
|
|
24
24
|
"pino": "^9.7.0",
|
|
25
25
|
"zod": "^4.1.11",
|
|
26
|
-
"@inkeep/agents-core": "^0.
|
|
26
|
+
"@inkeep/agents-core": "^0.24.0"
|
|
27
27
|
},
|
|
28
28
|
"optionalDependencies": {
|
|
29
29
|
"keytar": "^7.9.0"
|