@inkeep/agents-manage-api 0.39.4 → 0.40.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.
Files changed (123) hide show
  1. package/dist/create-app.d.ts +21 -0
  2. package/dist/create-app.js +144 -0
  3. package/dist/data/agentFull.d.ts +15 -0
  4. package/dist/data/agentFull.js +84 -0
  5. package/dist/data/conversations.d.ts +77 -0
  6. package/dist/data/conversations.js +152 -0
  7. package/dist/data/db/dbClient.d.ts +6 -0
  8. package/dist/data/db/dbClient.js +17 -0
  9. package/dist/env.d.ts +61 -0
  10. package/dist/env.js +55 -0
  11. package/dist/factory.d.ts +17 -2
  12. package/dist/factory.js +35 -2
  13. package/dist/index.d.ts +119 -22
  14. package/dist/index.js +8 -5
  15. package/dist/initialization.d.ts +6 -0
  16. package/dist/initialization.js +79 -0
  17. package/dist/logger.d.ts +2 -0
  18. package/dist/logger.js +3 -0
  19. package/dist/middleware/auth.d.ts +24 -0
  20. package/dist/middleware/auth.js +55 -0
  21. package/dist/middleware/error-handler.d.ts +12 -0
  22. package/dist/middleware/error-handler.js +88 -0
  23. package/dist/middleware/require-permission.d.ts +19 -0
  24. package/dist/middleware/require-permission.js +80 -0
  25. package/dist/middleware/session-auth.d.ts +6 -0
  26. package/dist/middleware/session-auth.js +26 -0
  27. package/dist/middleware/tenant-access.d.ts +12 -0
  28. package/dist/middleware/tenant-access.js +54 -0
  29. package/dist/openapi.d.ts +7 -0
  30. package/dist/openapi.js +157 -0
  31. package/dist/routes/agent.d.ts +9 -0
  32. package/dist/routes/agent.js +244 -0
  33. package/dist/routes/agentFull.d.ts +9 -0
  34. package/dist/routes/agentFull.js +188 -0
  35. package/dist/routes/agentToolRelations.d.ts +9 -0
  36. package/dist/routes/agentToolRelations.js +284 -0
  37. package/dist/routes/apiKeys.d.ts +9 -0
  38. package/dist/routes/apiKeys.js +217 -0
  39. package/dist/routes/artifactComponents.d.ts +9 -0
  40. package/dist/routes/artifactComponents.js +204 -0
  41. package/dist/routes/cliAuth.d.ts +9 -0
  42. package/dist/routes/cliAuth.js +60 -0
  43. package/dist/routes/contextConfigs.d.ts +9 -0
  44. package/dist/routes/contextConfigs.js +175 -0
  45. package/dist/routes/conversations.d.ts +7 -0
  46. package/dist/routes/conversations.js +59 -0
  47. package/dist/routes/credentialStores.d.ts +9 -0
  48. package/dist/routes/credentialStores.js +81 -0
  49. package/dist/routes/credentials.d.ts +9 -0
  50. package/dist/routes/credentials.js +204 -0
  51. package/dist/routes/dataComponents.d.ts +9 -0
  52. package/dist/routes/dataComponents.js +188 -0
  53. package/dist/routes/externalAgents.d.ts +9 -0
  54. package/dist/routes/externalAgents.js +195 -0
  55. package/dist/routes/functionTools.d.ts +9 -0
  56. package/dist/routes/functionTools.js +252 -0
  57. package/dist/routes/functions.d.ts +9 -0
  58. package/dist/routes/functions.js +281 -0
  59. package/dist/routes/index.d.ts +7 -0
  60. package/dist/routes/index.js +54 -0
  61. package/dist/routes/invitations.d.ts +9 -0
  62. package/dist/routes/invitations.js +41 -0
  63. package/dist/routes/mcp.d.ts +7 -0
  64. package/dist/routes/mcp.js +45 -0
  65. package/dist/routes/mcpCatalog.d.ts +13 -0
  66. package/dist/routes/mcpCatalog.js +454 -0
  67. package/dist/routes/oauth.d.ts +10 -0
  68. package/dist/routes/oauth.js +314 -0
  69. package/dist/routes/playgroundToken.d.ts +9 -0
  70. package/dist/routes/playgroundToken.js +108 -0
  71. package/dist/routes/projectFull.d.ts +9 -0
  72. package/dist/routes/projectFull.js +193 -0
  73. package/dist/routes/projects.d.ts +9 -0
  74. package/dist/routes/projects.js +188 -0
  75. package/dist/routes/shared.d.ts +93 -0
  76. package/dist/routes/shared.js +44 -0
  77. package/dist/routes/signoz.d.ts +10 -0
  78. package/dist/routes/signoz.js +155 -0
  79. package/dist/routes/subAgentArtifactComponents.d.ts +9 -0
  80. package/dist/routes/subAgentArtifactComponents.js +198 -0
  81. package/dist/routes/subAgentDataComponents.d.ts +9 -0
  82. package/dist/routes/subAgentDataComponents.js +197 -0
  83. package/dist/routes/subAgentExternalAgentRelations.d.ts +9 -0
  84. package/dist/routes/subAgentExternalAgentRelations.js +213 -0
  85. package/dist/routes/subAgentRelations.d.ts +9 -0
  86. package/dist/routes/subAgentRelations.js +259 -0
  87. package/dist/routes/subAgentTeamAgentRelations.d.ts +9 -0
  88. package/dist/routes/subAgentTeamAgentRelations.js +213 -0
  89. package/dist/routes/subAgentToolRelations.d.ts +9 -0
  90. package/dist/routes/subAgentToolRelations.js +284 -0
  91. package/dist/routes/subAgents.d.ts +9 -0
  92. package/dist/routes/subAgents.js +210 -0
  93. package/dist/routes/thirdPartyMCPServers.d.ts +14 -0
  94. package/dist/routes/thirdPartyMCPServers.js +72 -0
  95. package/dist/routes/tools.d.ts +9 -0
  96. package/dist/routes/tools.js +256 -0
  97. package/dist/routes/userOrganizations.d.ts +9 -0
  98. package/dist/routes/userOrganizations.js +58 -0
  99. package/dist/sso-helpers.d.ts +20 -0
  100. package/dist/sso-helpers.js +51 -0
  101. package/dist/types/app.d.ts +47 -0
  102. package/dist/types/app.js +1 -0
  103. package/dist/utils/cors.d.ts +33 -0
  104. package/dist/utils/cors.js +98 -0
  105. package/dist/utils/oauth-service.d.ts +71 -0
  106. package/dist/utils/oauth-service.js +106 -0
  107. package/dist/utils/signoz-helpers.d.ts +9 -0
  108. package/dist/utils/signoz-helpers.js +33 -0
  109. package/dist/utils/temp-api-keys.d.ts +17 -0
  110. package/dist/utils/temp-api-keys.js +26 -0
  111. package/package.json +6 -13
  112. package/dist/chunk-VBDAOXYI.js +0 -832
  113. package/dist/chunk-VBDAOXYI.js.map +0 -1
  114. package/dist/factory2.d.ts +0 -41
  115. package/dist/factory2.d.ts.map +0 -1
  116. package/dist/factory2.js +0 -37085
  117. package/dist/factory2.js.map +0 -1
  118. package/dist/index.d.ts.map +0 -1
  119. package/dist/index.js.map +0 -1
  120. package/dist/nodefs.js +0 -27
  121. package/dist/nodefs.js.map +0 -1
  122. package/dist/opfs-ahp.js +0 -368
  123. package/dist/opfs-ahp.js.map +0 -1
@@ -0,0 +1,9 @@
1
+ import { BaseAppVariables } from "../types/app.js";
2
+ import { OpenAPIHono } from "@hono/zod-openapi";
3
+
4
+ //#region src/routes/artifactComponents.d.ts
5
+ declare const app: OpenAPIHono<{
6
+ Variables: BaseAppVariables;
7
+ }, {}, "/">;
8
+ //#endregion
9
+ export { app as default };
@@ -0,0 +1,204 @@
1
+ import dbClient_default from "../data/db/dbClient.js";
2
+ import { requirePermission } from "../middleware/require-permission.js";
3
+ import { speakeasyOffsetLimitPagination } from "./shared.js";
4
+ import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
5
+ import { ArtifactComponentApiInsertSchema, ArtifactComponentApiUpdateSchema, ArtifactComponentListResponse, ArtifactComponentResponse, ErrorResponseSchema, PaginationQueryParamsSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createArtifactComponent, deleteArtifactComponent, generateId, getArtifactComponentById, listArtifactComponentsPaginated, updateArtifactComponent, validatePropsAsJsonSchema } from "@inkeep/agents-core";
6
+
7
+ //#region src/routes/artifactComponents.ts
8
+ const app = new OpenAPIHono();
9
+ app.use("/", async (c, next) => {
10
+ if (c.req.method === "POST") return requirePermission({ artifact_component: ["create"] })(c, next);
11
+ return next();
12
+ });
13
+ app.use("/:id", async (c, next) => {
14
+ if (c.req.method === "PATCH") return requirePermission({ artifact_component: ["update"] })(c, next);
15
+ if (c.req.method === "DELETE") return requirePermission({ artifact_component: ["delete"] })(c, next);
16
+ return next();
17
+ });
18
+ app.openapi(createRoute({
19
+ method: "get",
20
+ path: "/",
21
+ summary: "List Artifact Components",
22
+ operationId: "list-artifact-components",
23
+ tags: ["Artifact Component"],
24
+ request: {
25
+ params: TenantProjectParamsSchema,
26
+ query: PaginationQueryParamsSchema
27
+ },
28
+ responses: {
29
+ 200: {
30
+ description: "List of artifact components retrieved successfully",
31
+ content: { "application/json": { schema: ArtifactComponentListResponse } }
32
+ },
33
+ ...commonGetErrorResponses
34
+ },
35
+ ...speakeasyOffsetLimitPagination
36
+ }), async (c) => {
37
+ const { tenantId, projectId } = c.req.valid("param");
38
+ const page = Number(c.req.query("page")) || 1;
39
+ const limit = Math.min(Number(c.req.query("limit")) || 10, 100);
40
+ const result = await listArtifactComponentsPaginated(dbClient_default)({
41
+ scopes: {
42
+ tenantId,
43
+ projectId
44
+ },
45
+ pagination: {
46
+ page,
47
+ limit
48
+ }
49
+ });
50
+ return c.json(result);
51
+ });
52
+ app.openapi(createRoute({
53
+ method: "get",
54
+ path: "/{id}",
55
+ summary: "Get Artifact Component",
56
+ operationId: "get-artifact-component-by-id",
57
+ tags: ["Artifact Component"],
58
+ request: { params: TenantProjectIdParamsSchema },
59
+ responses: {
60
+ 200: {
61
+ description: "Artifact component found",
62
+ content: { "application/json": { schema: ArtifactComponentResponse } }
63
+ },
64
+ ...commonGetErrorResponses
65
+ }
66
+ }), async (c) => {
67
+ const { tenantId, projectId, id } = c.req.valid("param");
68
+ const artifactComponent = await getArtifactComponentById(dbClient_default)({
69
+ scopes: {
70
+ tenantId,
71
+ projectId
72
+ },
73
+ id
74
+ });
75
+ if (!artifactComponent) throw createApiError({
76
+ code: "not_found",
77
+ message: "Artifact component not found"
78
+ });
79
+ return c.json({ data: artifactComponent });
80
+ });
81
+ app.openapi(createRoute({
82
+ method: "post",
83
+ path: "/",
84
+ summary: "Create Artifact Component",
85
+ operationId: "create-artifact-component",
86
+ tags: ["Artifact Component"],
87
+ request: {
88
+ params: TenantProjectParamsSchema,
89
+ body: { content: { "application/json": { schema: ArtifactComponentApiInsertSchema } } }
90
+ },
91
+ responses: {
92
+ 201: {
93
+ description: "Artifact component created successfully",
94
+ content: { "application/json": { schema: ArtifactComponentResponse } }
95
+ },
96
+ ...commonGetErrorResponses
97
+ }
98
+ }), async (c) => {
99
+ const { tenantId, projectId } = c.req.valid("param");
100
+ const body = c.req.valid("json");
101
+ if (body.props !== null && body.props !== void 0) {
102
+ const propsValidation = validatePropsAsJsonSchema(body.props);
103
+ if (!propsValidation.isValid) throw createApiError({
104
+ code: "bad_request",
105
+ message: `Invalid props schema: ${propsValidation.errors.map((e) => `${e.field}: ${e.message}`).join(", ")}`
106
+ });
107
+ }
108
+ const finalId = body.id ? String(body.id) : generateId();
109
+ const componentData = {
110
+ tenantId,
111
+ projectId,
112
+ id: finalId,
113
+ name: String(body.name),
114
+ description: String(body.description),
115
+ props: body.props ?? null
116
+ };
117
+ try {
118
+ const artifactComponent = await createArtifactComponent(dbClient_default)({ ...componentData });
119
+ return c.json({ data: artifactComponent }, 201);
120
+ } catch (error) {
121
+ if (error?.cause?.code === "23505") throw createApiError({
122
+ code: "conflict",
123
+ message: `Artifact component with ID '${finalId}' already exists`
124
+ });
125
+ throw error;
126
+ }
127
+ });
128
+ app.openapi(createRoute({
129
+ method: "put",
130
+ path: "/{id}",
131
+ summary: "Update Artifact Component",
132
+ operationId: "update-artifact-component",
133
+ tags: ["Artifact Component"],
134
+ request: {
135
+ params: TenantProjectIdParamsSchema,
136
+ body: { content: { "application/json": { schema: ArtifactComponentApiUpdateSchema } } }
137
+ },
138
+ responses: {
139
+ 200: {
140
+ description: "Artifact component updated successfully",
141
+ content: { "application/json": { schema: ArtifactComponentResponse } }
142
+ },
143
+ ...commonGetErrorResponses
144
+ }
145
+ }), async (c) => {
146
+ const { tenantId, projectId, id } = c.req.valid("param");
147
+ const body = c.req.valid("json");
148
+ if (body.props !== void 0 && body.props !== null) {
149
+ const propsValidation = validatePropsAsJsonSchema(body.props);
150
+ if (!propsValidation.isValid) throw createApiError({
151
+ code: "bad_request",
152
+ message: `Invalid props schema: ${propsValidation.errors.map((e) => `${e.field}: ${e.message}`).join(", ")}`
153
+ });
154
+ }
155
+ const updateData = {};
156
+ if (body.name !== void 0) updateData.name = String(body.name);
157
+ if (body.description !== void 0) updateData.description = String(body.description);
158
+ if (body.props !== void 0) updateData.props = body.props ?? null;
159
+ const updatedArtifactComponent = await updateArtifactComponent(dbClient_default)({
160
+ scopes: {
161
+ tenantId,
162
+ projectId
163
+ },
164
+ id,
165
+ data: updateData
166
+ });
167
+ if (!updatedArtifactComponent) throw createApiError({
168
+ code: "not_found",
169
+ message: "Artifact component not found"
170
+ });
171
+ return c.json({ data: updatedArtifactComponent });
172
+ });
173
+ app.openapi(createRoute({
174
+ method: "delete",
175
+ path: "/{id}",
176
+ summary: "Delete Artifact Component",
177
+ operationId: "delete-artifact-component",
178
+ tags: ["Artifact Component"],
179
+ request: { params: TenantProjectIdParamsSchema },
180
+ responses: {
181
+ 204: { description: "Artifact component deleted successfully" },
182
+ 404: {
183
+ description: "Artifact component not found",
184
+ content: { "application/json": { schema: ErrorResponseSchema } }
185
+ }
186
+ }
187
+ }), async (c) => {
188
+ const { tenantId, projectId, id } = c.req.valid("param");
189
+ if (!await deleteArtifactComponent(dbClient_default)({
190
+ scopes: {
191
+ tenantId,
192
+ projectId
193
+ },
194
+ id
195
+ })) throw createApiError({
196
+ code: "not_found",
197
+ message: "Artifact component not found"
198
+ });
199
+ return c.body(null, 204);
200
+ });
201
+ var artifactComponents_default = app;
202
+
203
+ //#endregion
204
+ export { artifactComponents_default as default };
@@ -0,0 +1,9 @@
1
+ import { AppVariables } from "../create-app.js";
2
+ import { OpenAPIHono } from "@hono/zod-openapi";
3
+
4
+ //#region src/routes/cliAuth.d.ts
5
+ declare const cliAuthRoutes: OpenAPIHono<{
6
+ Variables: AppVariables;
7
+ }, {}, "/">;
8
+ //#endregion
9
+ export { cliAuthRoutes as default };
@@ -0,0 +1,60 @@
1
+ import dbClient_default from "../data/db/dbClient.js";
2
+ import { sessionAuth } from "../middleware/session-auth.js";
3
+ import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
4
+ import { getUserOrganizations } from "@inkeep/agents-core";
5
+
6
+ //#region src/routes/cliAuth.ts
7
+ const cliAuthRoutes = new OpenAPIHono();
8
+ const CLIMeResponseSchema = z.object({
9
+ user: z.object({
10
+ id: z.string(),
11
+ email: z.string(),
12
+ name: z.string().nullable()
13
+ }),
14
+ organization: z.object({
15
+ id: z.string(),
16
+ name: z.string(),
17
+ slug: z.string(),
18
+ role: z.string()
19
+ })
20
+ });
21
+ cliAuthRoutes.openapi(createRoute({
22
+ method: "get",
23
+ path: "/me",
24
+ tags: ["cli"],
25
+ summary: "Get CLI user info",
26
+ description: "Get the current authenticated user and their organization for CLI usage",
27
+ middleware: [sessionAuth()],
28
+ responses: {
29
+ 200: {
30
+ description: "User info with organization",
31
+ content: { "application/json": { schema: CLIMeResponseSchema } }
32
+ },
33
+ 401: { description: "Not authenticated" },
34
+ 404: { description: "User has no organization" }
35
+ }
36
+ }), async (c) => {
37
+ const user = c.get("user");
38
+ const userId = c.get("userId");
39
+ if (!user || !userId) return c.json({ error: "Not authenticated" }, 401);
40
+ const organizations = await getUserOrganizations(dbClient_default)(userId);
41
+ if (organizations.length === 0) return c.json({ error: "User has no organization" }, 404);
42
+ const org = organizations[0];
43
+ return c.json({
44
+ user: {
45
+ id: user.id,
46
+ email: user.email,
47
+ name: user.name || null
48
+ },
49
+ organization: {
50
+ id: org.organizationId,
51
+ name: org.organizationName || "",
52
+ slug: org.organizationSlug || "",
53
+ role: org.role
54
+ }
55
+ });
56
+ });
57
+ var cliAuth_default = cliAuthRoutes;
58
+
59
+ //#endregion
60
+ export { cliAuth_default as default };
@@ -0,0 +1,9 @@
1
+ import { BaseAppVariables } from "../types/app.js";
2
+ import { OpenAPIHono } from "@hono/zod-openapi";
3
+
4
+ //#region src/routes/contextConfigs.d.ts
5
+ declare const app: OpenAPIHono<{
6
+ Variables: BaseAppVariables;
7
+ }, {}, "/">;
8
+ //#endregion
9
+ export { app as default };
@@ -0,0 +1,175 @@
1
+ import dbClient_default from "../data/db/dbClient.js";
2
+ import { requirePermission } from "../middleware/require-permission.js";
3
+ import { speakeasyOffsetLimitPagination } from "./shared.js";
4
+ import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
5
+ import { ContextConfigApiInsertSchema, ContextConfigApiUpdateSchema, ContextConfigListResponse, ContextConfigResponse, PaginationQueryParamsSchema, TenantProjectAgentIdParamsSchema, TenantProjectAgentParamsSchema, commonDeleteErrorResponses, commonGetErrorResponses, commonUpdateErrorResponses, createApiError, createContextConfig, deleteContextConfig, getContextConfigById, listContextConfigsPaginated, updateContextConfig } from "@inkeep/agents-core";
6
+
7
+ //#region src/routes/contextConfigs.ts
8
+ const app = new OpenAPIHono();
9
+ app.use("/", async (c, next) => {
10
+ if (c.req.method === "POST") return requirePermission({ context_config: ["create"] })(c, next);
11
+ return next();
12
+ });
13
+ app.use("/:id", async (c, next) => {
14
+ if (c.req.method === "PUT") return requirePermission({ context_config: ["update"] })(c, next);
15
+ if (c.req.method === "DELETE") return requirePermission({ context_config: ["delete"] })(c, next);
16
+ return next();
17
+ });
18
+ app.openapi(createRoute({
19
+ method: "get",
20
+ path: "/",
21
+ summary: "List Context Configurations",
22
+ operationId: "list-context-configs",
23
+ tags: ["Context Config"],
24
+ request: {
25
+ params: TenantProjectAgentParamsSchema,
26
+ query: PaginationQueryParamsSchema
27
+ },
28
+ responses: {
29
+ 200: {
30
+ description: "List of context configurations retrieved successfully",
31
+ content: { "application/json": { schema: ContextConfigListResponse } }
32
+ },
33
+ ...commonGetErrorResponses
34
+ },
35
+ ...speakeasyOffsetLimitPagination
36
+ }), async (c) => {
37
+ const { tenantId, projectId, agentId } = c.req.valid("param");
38
+ const page = Number(c.req.query("page")) || 1;
39
+ const limit = Math.min(Number(c.req.query("limit")) || 10, 100);
40
+ const result = await listContextConfigsPaginated(dbClient_default)({
41
+ scopes: {
42
+ tenantId,
43
+ projectId,
44
+ agentId
45
+ },
46
+ pagination: {
47
+ page,
48
+ limit
49
+ }
50
+ });
51
+ return c.json(result);
52
+ });
53
+ app.openapi(createRoute({
54
+ method: "get",
55
+ path: "/{id}",
56
+ summary: "Get Context Configuration",
57
+ operationId: "get-context-config-by-id",
58
+ tags: ["Context Config"],
59
+ request: { params: TenantProjectAgentIdParamsSchema },
60
+ responses: {
61
+ 200: {
62
+ description: "Context configuration found",
63
+ content: { "application/json": { schema: ContextConfigResponse } }
64
+ },
65
+ ...commonGetErrorResponses
66
+ }
67
+ }), async (c) => {
68
+ const { tenantId, projectId, agentId, id } = c.req.valid("param");
69
+ const contextConfig = await getContextConfigById(dbClient_default)({
70
+ scopes: {
71
+ tenantId,
72
+ projectId,
73
+ agentId
74
+ },
75
+ id
76
+ });
77
+ if (!contextConfig) throw createApiError({
78
+ code: "not_found",
79
+ message: "Context configuration not found"
80
+ });
81
+ return c.json({ data: contextConfig });
82
+ });
83
+ app.openapi(createRoute({
84
+ method: "post",
85
+ path: "/",
86
+ summary: "Create Context Configuration",
87
+ operationId: "create-context-config",
88
+ tags: ["Context Config"],
89
+ request: {
90
+ params: TenantProjectAgentParamsSchema,
91
+ body: { content: { "application/json": { schema: ContextConfigApiInsertSchema } } }
92
+ },
93
+ responses: {
94
+ 201: {
95
+ description: "Context configuration created successfully",
96
+ content: { "application/json": { schema: ContextConfigResponse } }
97
+ },
98
+ ...commonGetErrorResponses
99
+ }
100
+ }), async (c) => {
101
+ const { tenantId, projectId, agentId } = c.req.valid("param");
102
+ const configData = {
103
+ tenantId,
104
+ projectId,
105
+ agentId,
106
+ ...c.req.valid("json")
107
+ };
108
+ const contextConfig = await createContextConfig(dbClient_default)(configData);
109
+ return c.json({ data: contextConfig }, 201);
110
+ });
111
+ app.openapi(createRoute({
112
+ method: "put",
113
+ path: "/{id}",
114
+ summary: "Update Context Configuration",
115
+ operationId: "update-context-config",
116
+ tags: ["Context Config"],
117
+ request: {
118
+ params: TenantProjectAgentIdParamsSchema,
119
+ body: { content: { "application/json": { schema: ContextConfigApiUpdateSchema } } }
120
+ },
121
+ responses: {
122
+ 200: {
123
+ description: "Context configuration updated successfully",
124
+ content: { "application/json": { schema: ContextConfigResponse } }
125
+ },
126
+ ...commonUpdateErrorResponses
127
+ }
128
+ }), async (c) => {
129
+ const { tenantId, projectId, agentId, id } = c.req.valid("param");
130
+ const body = c.req.valid("json");
131
+ const updatedContextConfig = await updateContextConfig(dbClient_default)({
132
+ scopes: {
133
+ tenantId,
134
+ projectId,
135
+ agentId
136
+ },
137
+ id,
138
+ data: body
139
+ });
140
+ if (!updatedContextConfig) throw createApiError({
141
+ code: "not_found",
142
+ message: "Context configuration not found"
143
+ });
144
+ return c.json({ data: updatedContextConfig });
145
+ });
146
+ app.openapi(createRoute({
147
+ method: "delete",
148
+ path: "/{id}",
149
+ summary: "Delete Context Configuration",
150
+ operationId: "delete-context-config",
151
+ tags: ["Context Config"],
152
+ request: { params: TenantProjectAgentIdParamsSchema },
153
+ responses: {
154
+ 204: { description: "Context configuration deleted successfully" },
155
+ ...commonDeleteErrorResponses
156
+ }
157
+ }), async (c) => {
158
+ const { tenantId, projectId, agentId, id } = c.req.valid("param");
159
+ if (!await deleteContextConfig(dbClient_default)({
160
+ scopes: {
161
+ tenantId,
162
+ projectId,
163
+ agentId
164
+ },
165
+ id
166
+ })) throw createApiError({
167
+ code: "not_found",
168
+ message: "Context configuration not found"
169
+ });
170
+ return c.body(null, 204);
171
+ });
172
+ var contextConfigs_default = app;
173
+
174
+ //#endregion
175
+ export { contextConfigs_default as default };
@@ -0,0 +1,7 @@
1
+ import { OpenAPIHono } from "@hono/zod-openapi";
2
+ import * as hono5 from "hono";
3
+
4
+ //#region src/routes/conversations.d.ts
5
+ declare const app: OpenAPIHono<hono5.Env, {}, "/">;
6
+ //#endregion
7
+ export { app as default };
@@ -0,0 +1,59 @@
1
+ import dbClient_default from "../data/db/dbClient.js";
2
+ import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
3
+ import { TenantProjectIdParamsSchema, commonGetErrorResponses, createApiError, formatMessagesForLLMContext, getConversationHistory } from "@inkeep/agents-core";
4
+
5
+ //#region src/routes/conversations.ts
6
+ const app = new OpenAPIHono();
7
+ const ConversationQueryParamsSchema = z.object({
8
+ limit: z.coerce.number().min(1).max(200).default(20).optional(),
9
+ includeInternal: z.coerce.boolean().default(false).optional()
10
+ });
11
+ const ConversationWithFormattedMessagesResponse = z.object({ data: z.object({
12
+ messages: z.array(z.any()),
13
+ formatted: z.object({ llmContext: z.string() })
14
+ }) }).openapi("ConversationWithFormattedMessagesResponse");
15
+ app.openapi(createRoute({
16
+ method: "get",
17
+ path: "/{id}",
18
+ summary: "Get Conversation",
19
+ operationId: "get-conversation",
20
+ tags: ["Conversations"],
21
+ request: {
22
+ params: TenantProjectIdParamsSchema,
23
+ query: ConversationQueryParamsSchema
24
+ },
25
+ responses: {
26
+ 200: {
27
+ description: "Conversation found with formatted messages for LLM use",
28
+ content: { "application/json": { schema: ConversationWithFormattedMessagesResponse } }
29
+ },
30
+ ...commonGetErrorResponses
31
+ }
32
+ }), async (c) => {
33
+ const { tenantId, projectId, id } = c.req.valid("param");
34
+ const { limit = 20, includeInternal = true } = c.req.valid("query");
35
+ const messages = await getConversationHistory(dbClient_default)({
36
+ scopes: {
37
+ tenantId,
38
+ projectId
39
+ },
40
+ conversationId: id,
41
+ options: {
42
+ limit,
43
+ includeInternal
44
+ }
45
+ });
46
+ if (!messages || messages.length === 0) throw createApiError({
47
+ code: "not_found",
48
+ message: "Conversation not found"
49
+ });
50
+ const llmContext = formatMessagesForLLMContext(messages);
51
+ return c.json({ data: {
52
+ messages,
53
+ formatted: { llmContext }
54
+ } });
55
+ });
56
+ var conversations_default = app;
57
+
58
+ //#endregion
59
+ export { conversations_default as default };
@@ -0,0 +1,9 @@
1
+ import { PublicAppVariables } from "../types/app.js";
2
+ import { OpenAPIHono } from "@hono/zod-openapi";
3
+
4
+ //#region src/routes/credentialStores.d.ts
5
+ declare const app: OpenAPIHono<{
6
+ Variables: PublicAppVariables;
7
+ }, {}, "/">;
8
+ //#endregion
9
+ export { app as default };
@@ -0,0 +1,81 @@
1
+ import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
2
+ import { CreateCredentialInStoreRequestSchema, CreateCredentialInStoreResponseSchema, CredentialStoreListResponseSchema, TenantProjectIdParamsSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError } from "@inkeep/agents-core";
3
+
4
+ //#region src/routes/credentialStores.ts
5
+ const app = new OpenAPIHono();
6
+ app.openapi(createRoute({
7
+ method: "get",
8
+ path: "/",
9
+ summary: "List Credential Stores",
10
+ operationId: "list-credential-stores",
11
+ tags: ["Credential Store"],
12
+ request: { params: TenantProjectParamsSchema },
13
+ responses: {
14
+ 200: {
15
+ description: "List of credential stores retrieved successfully",
16
+ content: { "application/json": { schema: CredentialStoreListResponseSchema } }
17
+ },
18
+ ...commonGetErrorResponses
19
+ }
20
+ }), async (c) => {
21
+ const allStores = c.get("credentialStores").getAll();
22
+ const storeStatuses = await Promise.all(allStores.map(async (store) => {
23
+ const { available, reason } = await store.checkAvailability();
24
+ return {
25
+ id: store.id,
26
+ type: store.type,
27
+ available,
28
+ reason: reason || null
29
+ };
30
+ }));
31
+ return c.json({ data: storeStatuses });
32
+ });
33
+ app.openapi(createRoute({
34
+ method: "post",
35
+ path: "/{id}/credentials",
36
+ summary: "Create Credential in Store",
37
+ operationId: "create-credential-in-store",
38
+ tags: ["Credential Store"],
39
+ request: {
40
+ params: TenantProjectIdParamsSchema,
41
+ body: { content: { "application/json": { schema: CreateCredentialInStoreRequestSchema } } }
42
+ },
43
+ responses: {
44
+ 201: {
45
+ description: "Credential created successfully",
46
+ content: { "application/json": { schema: CreateCredentialInStoreResponseSchema } }
47
+ },
48
+ ...commonGetErrorResponses
49
+ }
50
+ }), async (c) => {
51
+ const { id: storeId } = c.req.param();
52
+ const { key, value, metadata } = await c.req.json();
53
+ const store = c.get("credentialStores").get(storeId);
54
+ if (!store) throw createApiError({
55
+ code: "not_found",
56
+ message: `Credential store '${storeId}' not found`
57
+ });
58
+ try {
59
+ const { available, reason } = await store.checkAvailability();
60
+ if (!available) throw createApiError({
61
+ code: "internal_server_error",
62
+ message: `Credential store '${storeId}' is not available: ${reason}`
63
+ });
64
+ await store.set(key, value, metadata ?? {});
65
+ return c.json({ data: {
66
+ key,
67
+ storeId,
68
+ createdAt: (/* @__PURE__ */ new Date()).toISOString()
69
+ } }, 201);
70
+ } catch (error) {
71
+ console.error(`Error setting credential in store ${storeId}:`, error);
72
+ throw createApiError({
73
+ code: "internal_server_error",
74
+ message: `Failed to store credential: ${error instanceof Error ? error.message : "Unknown error"}`
75
+ });
76
+ }
77
+ });
78
+ var credentialStores_default = app;
79
+
80
+ //#endregion
81
+ export { credentialStores_default as default };
@@ -0,0 +1,9 @@
1
+ import { AppVariablesWithCredentials } from "../types/app.js";
2
+ import { OpenAPIHono } from "@hono/zod-openapi";
3
+
4
+ //#region src/routes/credentials.d.ts
5
+ declare const app: OpenAPIHono<{
6
+ Variables: AppVariablesWithCredentials;
7
+ }, {}, "/">;
8
+ //#endregion
9
+ export { app as default };