@inkeep/agents-api 0.0.0-dev-20260325103346 → 0.0.0-dev-20260325193448
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/.well-known/workflow/v1/manifest.json +86 -86
- package/dist/createApp.d.ts +2 -2
- package/dist/data/db/manageDbClient.d.ts +2 -2
- package/dist/data/db/runDbClient.d.ts +2 -2
- package/dist/data-reconciliation/handlers/agent.d.ts +2 -2
- package/dist/data-reconciliation/handlers/context-configs.d.ts +2 -2
- package/dist/data-reconciliation/handlers/scheduled-triggers.d.ts +2 -2
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/evals/workflow/routes.d.ts +2 -2
- package/dist/domains/manage/routes/authLookup.d.ts +2 -2
- package/dist/domains/manage/routes/availableAgents.d.ts +2 -2
- package/dist/domains/manage/routes/conversations.d.ts +2 -2
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/invitations.d.ts +2 -2
- package/dist/domains/manage/routes/passwordResetLinks.d.ts +2 -2
- package/dist/domains/manage/routes/signoz.d.ts +2 -2
- package/dist/domains/manage/routes/users.d.ts +2 -2
- package/dist/domains/mcp/routes/mcp.d.ts +2 -2
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/handlers/executionHandler.d.ts +1 -1
- package/dist/domains/run/routes/auth.d.ts +2 -2
- package/dist/domains/run/routes/chat.js +7 -2
- package/dist/domains/run/routes/chatDataStream.js +7 -2
- package/dist/domains/run/services/blob-storage/external-file-downloader.d.ts +8 -2
- package/dist/domains/run/services/blob-storage/external-file-downloader.js +24 -21
- package/dist/domains/run/services/blob-storage/file-content-security.d.ts +2 -2
- package/dist/domains/run/services/blob-storage/file-content-security.js +8 -3
- package/dist/domains/run/services/blob-storage/file-security-errors.d.ts +5 -4
- package/dist/domains/run/services/blob-storage/file-security-errors.js +8 -6
- package/dist/domains/run/services/blob-storage/file-upload-helpers.d.ts +8 -1
- package/dist/domains/run/services/blob-storage/file-upload-helpers.js +44 -1
- package/dist/domains/run/services/blob-storage/file-upload.js +15 -4
- package/dist/domains/run/services/blob-storage/file-url-security.d.ts +2 -1
- package/dist/domains/run/services/blob-storage/file-url-security.js +8 -2
- package/dist/domains/run/tools/distill-conversation-history-tool.d.ts +1 -1
- package/dist/domains/run/types/chat.d.ts +16 -19
- package/dist/domains/run/types/chat.js +7 -8
- package/dist/domains/run/utils/message-parts.js +7 -4
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/factory.d.ts +3 -3
- package/dist/index.d.ts +2 -2
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.d.ts +3 -3
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/requirePermission.d.ts +2 -2
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/sessionAuth.d.ts +3 -3
- package/dist/middleware/tenantAccess.d.ts +2 -2
- package/dist/middleware/tracing.d.ts +3 -3
- package/package.json +5 -5
|
@@ -12,18 +12,14 @@
|
|
|
12
12
|
"stepId": "__builtin_response_text"
|
|
13
13
|
}
|
|
14
14
|
},
|
|
15
|
-
"
|
|
16
|
-
"
|
|
17
|
-
"stepId": "step
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
"stepId": "step//./src/domains/evals/workflow/functions/runDatasetItem//executeEvaluatorStep"
|
|
24
|
-
},
|
|
25
|
-
"logStep": {
|
|
26
|
-
"stepId": "step//./src/domains/evals/workflow/functions/runDatasetItem//logStep"
|
|
15
|
+
"node_modules/.pnpm/workflow@4.2.0-beta.68_@nestjs+common@11.1.13_reflect-metadata@0.2.2_rxjs@7.8.2__@nestj_c30ae014a2256b6140edb80852c498d1/node_modules/workflow/dist/stdlib.js": {
|
|
16
|
+
"fetch": {
|
|
17
|
+
"stepId": "step//workflow@4.2.0-beta.68//fetch"
|
|
18
|
+
}
|
|
19
|
+
},
|
|
20
|
+
"src/domains/run/workflow/functions/scheduledTriggerRunner.ts": {
|
|
21
|
+
"startNextIterationStep": {
|
|
22
|
+
"stepId": "step//./src/domains/run/workflow/functions/scheduledTriggerRunner//startNextIterationStep"
|
|
27
23
|
}
|
|
28
24
|
},
|
|
29
25
|
"src/domains/evals/workflow/functions/evaluateConversation.ts": {
|
|
@@ -40,14 +36,18 @@
|
|
|
40
36
|
"stepId": "step//./src/domains/evals/workflow/functions/evaluateConversation//logStep"
|
|
41
37
|
}
|
|
42
38
|
},
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
"stepId": "step
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
39
|
+
"src/domains/evals/workflow/functions/runDatasetItem.ts": {
|
|
40
|
+
"callChatApiStep": {
|
|
41
|
+
"stepId": "step//./src/domains/evals/workflow/functions/runDatasetItem//callChatApiStep"
|
|
42
|
+
},
|
|
43
|
+
"createRelationStep": {
|
|
44
|
+
"stepId": "step//./src/domains/evals/workflow/functions/runDatasetItem//createRelationStep"
|
|
45
|
+
},
|
|
46
|
+
"executeEvaluatorStep": {
|
|
47
|
+
"stepId": "step//./src/domains/evals/workflow/functions/runDatasetItem//executeEvaluatorStep"
|
|
48
|
+
},
|
|
49
|
+
"logStep": {
|
|
50
|
+
"stepId": "step//./src/domains/evals/workflow/functions/runDatasetItem//logStep"
|
|
51
51
|
}
|
|
52
52
|
},
|
|
53
53
|
"src/domains/run/workflow/steps/scheduledTriggerSteps.ts": {
|
|
@@ -99,72 +99,6 @@
|
|
|
99
99
|
}
|
|
100
100
|
},
|
|
101
101
|
"workflows": {
|
|
102
|
-
"src/domains/evals/workflow/functions/runDatasetItem.ts": {
|
|
103
|
-
"_runDatasetItemWorkflow": {
|
|
104
|
-
"workflowId": "workflow//./src/domains/evals/workflow/functions/runDatasetItem//_runDatasetItemWorkflow",
|
|
105
|
-
"graph": {
|
|
106
|
-
"nodes": [
|
|
107
|
-
{
|
|
108
|
-
"id": "start",
|
|
109
|
-
"type": "workflowStart",
|
|
110
|
-
"data": {
|
|
111
|
-
"label": "Start: _runDatasetItemWorkflow",
|
|
112
|
-
"nodeKind": "workflow_start"
|
|
113
|
-
}
|
|
114
|
-
},
|
|
115
|
-
{
|
|
116
|
-
"id": "end",
|
|
117
|
-
"type": "workflowEnd",
|
|
118
|
-
"data": {
|
|
119
|
-
"label": "Return",
|
|
120
|
-
"nodeKind": "workflow_end"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
],
|
|
124
|
-
"edges": [
|
|
125
|
-
{
|
|
126
|
-
"id": "e_start_end",
|
|
127
|
-
"source": "start",
|
|
128
|
-
"target": "end",
|
|
129
|
-
"type": "default"
|
|
130
|
-
}
|
|
131
|
-
]
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
},
|
|
135
|
-
"src/domains/evals/workflow/functions/evaluateConversation.ts": {
|
|
136
|
-
"_evaluateConversationWorkflow": {
|
|
137
|
-
"workflowId": "workflow//./src/domains/evals/workflow/functions/evaluateConversation//_evaluateConversationWorkflow",
|
|
138
|
-
"graph": {
|
|
139
|
-
"nodes": [
|
|
140
|
-
{
|
|
141
|
-
"id": "start",
|
|
142
|
-
"type": "workflowStart",
|
|
143
|
-
"data": {
|
|
144
|
-
"label": "Start: _evaluateConversationWorkflow",
|
|
145
|
-
"nodeKind": "workflow_start"
|
|
146
|
-
}
|
|
147
|
-
},
|
|
148
|
-
{
|
|
149
|
-
"id": "end",
|
|
150
|
-
"type": "workflowEnd",
|
|
151
|
-
"data": {
|
|
152
|
-
"label": "Return",
|
|
153
|
-
"nodeKind": "workflow_end"
|
|
154
|
-
}
|
|
155
|
-
}
|
|
156
|
-
],
|
|
157
|
-
"edges": [
|
|
158
|
-
{
|
|
159
|
-
"id": "e_start_end",
|
|
160
|
-
"source": "start",
|
|
161
|
-
"target": "end",
|
|
162
|
-
"type": "default"
|
|
163
|
-
}
|
|
164
|
-
]
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
},
|
|
168
102
|
"src/domains/run/workflow/functions/scheduledTriggerRunner.ts": {
|
|
169
103
|
"_scheduledTriggerRunnerWorkflow": {
|
|
170
104
|
"workflowId": "workflow//./src/domains/run/workflow/functions/scheduledTriggerRunner//_scheduledTriggerRunnerWorkflow",
|
|
@@ -254,6 +188,72 @@
|
|
|
254
188
|
]
|
|
255
189
|
}
|
|
256
190
|
}
|
|
191
|
+
},
|
|
192
|
+
"src/domains/evals/workflow/functions/evaluateConversation.ts": {
|
|
193
|
+
"_evaluateConversationWorkflow": {
|
|
194
|
+
"workflowId": "workflow//./src/domains/evals/workflow/functions/evaluateConversation//_evaluateConversationWorkflow",
|
|
195
|
+
"graph": {
|
|
196
|
+
"nodes": [
|
|
197
|
+
{
|
|
198
|
+
"id": "start",
|
|
199
|
+
"type": "workflowStart",
|
|
200
|
+
"data": {
|
|
201
|
+
"label": "Start: _evaluateConversationWorkflow",
|
|
202
|
+
"nodeKind": "workflow_start"
|
|
203
|
+
}
|
|
204
|
+
},
|
|
205
|
+
{
|
|
206
|
+
"id": "end",
|
|
207
|
+
"type": "workflowEnd",
|
|
208
|
+
"data": {
|
|
209
|
+
"label": "Return",
|
|
210
|
+
"nodeKind": "workflow_end"
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
],
|
|
214
|
+
"edges": [
|
|
215
|
+
{
|
|
216
|
+
"id": "e_start_end",
|
|
217
|
+
"source": "start",
|
|
218
|
+
"target": "end",
|
|
219
|
+
"type": "default"
|
|
220
|
+
}
|
|
221
|
+
]
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
},
|
|
225
|
+
"src/domains/evals/workflow/functions/runDatasetItem.ts": {
|
|
226
|
+
"_runDatasetItemWorkflow": {
|
|
227
|
+
"workflowId": "workflow//./src/domains/evals/workflow/functions/runDatasetItem//_runDatasetItemWorkflow",
|
|
228
|
+
"graph": {
|
|
229
|
+
"nodes": [
|
|
230
|
+
{
|
|
231
|
+
"id": "start",
|
|
232
|
+
"type": "workflowStart",
|
|
233
|
+
"data": {
|
|
234
|
+
"label": "Start: _runDatasetItemWorkflow",
|
|
235
|
+
"nodeKind": "workflow_start"
|
|
236
|
+
}
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
"id": "end",
|
|
240
|
+
"type": "workflowEnd",
|
|
241
|
+
"data": {
|
|
242
|
+
"label": "Return",
|
|
243
|
+
"nodeKind": "workflow_end"
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
],
|
|
247
|
+
"edges": [
|
|
248
|
+
{
|
|
249
|
+
"id": "e_start_end",
|
|
250
|
+
"source": "start",
|
|
251
|
+
"target": "end",
|
|
252
|
+
"type": "default"
|
|
253
|
+
}
|
|
254
|
+
]
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
257
|
}
|
|
258
258
|
},
|
|
259
259
|
"classes": {}
|
package/dist/createApp.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { AppConfig } from "./types/app.js";
|
|
2
2
|
import "./types/index.js";
|
|
3
3
|
import { Hono } from "hono";
|
|
4
|
-
import * as
|
|
4
|
+
import * as hono_types12 from "hono/types";
|
|
5
5
|
|
|
6
6
|
//#region src/createApp.d.ts
|
|
7
7
|
declare const isWebhookRoute: (path: string) => boolean;
|
|
8
|
-
declare function createAgentsHono(config: AppConfig): Hono<
|
|
8
|
+
declare function createAgentsHono(config: AppConfig): Hono<hono_types12.BlankEnv, hono_types12.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { createAgentsHono, isWebhookRoute };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core2 from "@inkeep/agents-core";
|
|
2
2
|
|
|
3
3
|
//#region src/data/db/manageDbClient.d.ts
|
|
4
|
-
declare const manageDbClient:
|
|
4
|
+
declare const manageDbClient: _inkeep_agents_core2.AgentsManageDatabaseClient;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { manageDbClient as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core3 from "@inkeep/agents-core";
|
|
2
2
|
|
|
3
3
|
//#region src/data/db/runDbClient.d.ts
|
|
4
|
-
declare const runDbClient:
|
|
4
|
+
declare const runDbClient: _inkeep_agents_core3.AgentsRunDatabaseClient;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { runDbClient as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core0 from "@inkeep/agents-core";
|
|
2
2
|
|
|
3
3
|
//#region src/data-reconciliation/handlers/agent.d.ts
|
|
4
|
-
declare const agentHandlers:
|
|
4
|
+
declare const agentHandlers: _inkeep_agents_core0.EntityEffectHandlers<"agent">;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { agentHandlers };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core1 from "@inkeep/agents-core";
|
|
2
2
|
|
|
3
3
|
//#region src/data-reconciliation/handlers/context-configs.d.ts
|
|
4
|
-
declare const contextConfigsHandlers:
|
|
4
|
+
declare const contextConfigsHandlers: _inkeep_agents_core1.EntityEffectHandlers<"context_configs">;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { contextConfigsHandlers };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core0 from "@inkeep/agents-core";
|
|
2
2
|
|
|
3
3
|
//#region src/data-reconciliation/handlers/scheduled-triggers.d.ts
|
|
4
|
-
declare const scheduledTriggersHandlers:
|
|
4
|
+
declare const scheduledTriggersHandlers: _inkeep_agents_core0.EntityEffectHandlers<"scheduled_triggers">;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { scheduledTriggersHandlers };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono11 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono11.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono12 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono12.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types4 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/workflow/routes.d.ts
|
|
5
|
-
declare const workflowRoutes: Hono<
|
|
5
|
+
declare const workflowRoutes: Hono<hono_types4.BlankEnv, hono_types4.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { workflowRoutes };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types6 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/authLookup.d.ts
|
|
6
6
|
declare const authLookupRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types6.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { authLookupRoutes as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono14 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/availableAgents.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono14.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono13 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono13.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono15 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono15.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types1 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/invitations.d.ts
|
|
6
6
|
declare const invitationsRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types1.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { invitationsRoutes as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types9 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/passwordResetLinks.d.ts
|
|
6
6
|
declare const passwordResetLinksRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types9.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { passwordResetLinksRoutes as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types10 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/signoz.d.ts
|
|
6
6
|
declare const app: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types10.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { app as default };
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
2
|
import { Hono } from "hono";
|
|
3
|
-
import * as
|
|
3
|
+
import * as hono_types11 from "hono/types";
|
|
4
4
|
|
|
5
5
|
//#region src/domains/manage/routes/users.d.ts
|
|
6
6
|
declare const usersRoutes: Hono<{
|
|
7
7
|
Variables: ManageAppVariables;
|
|
8
|
-
},
|
|
8
|
+
}, hono_types11.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { usersRoutes as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types7 from "hono/types";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/mcp/routes/mcp.d.ts
|
|
5
|
-
declare const app: Hono<
|
|
5
|
+
declare const app: Hono<hono_types7.BlankEnv, hono_types7.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { AgentConfig, DelegateRelation } from "./agent-types.js";
|
|
2
2
|
import "./Agent.js";
|
|
3
3
|
import { InternalRelation } from "../utils/project.js";
|
|
4
|
-
import * as
|
|
4
|
+
import * as _inkeep_agents_core6 from "@inkeep/agents-core";
|
|
5
5
|
import { CredentialStoreRegistry, FullExecutionContext } from "@inkeep/agents-core";
|
|
6
6
|
import * as ai0 from "ai";
|
|
7
7
|
|
|
@@ -45,7 +45,7 @@ declare function createDelegateToAgentTool({
|
|
|
45
45
|
message: string;
|
|
46
46
|
}, {
|
|
47
47
|
toolCallId: any;
|
|
48
|
-
result:
|
|
48
|
+
result: _inkeep_agents_core6.Message | _inkeep_agents_core6.Task;
|
|
49
49
|
}>;
|
|
50
50
|
/**
|
|
51
51
|
* Parameters for building a transfer relation config
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono16 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/run/routes/auth.d.ts
|
|
5
5
|
declare function getAnonJwtSecret(): Uint8Array;
|
|
6
|
-
declare const app: OpenAPIHono<
|
|
6
|
+
declare const app: OpenAPIHono<hono16.Env, {}, "/">;
|
|
7
7
|
//#endregion
|
|
8
8
|
export { app as default, getAnonJwtSecret };
|
|
@@ -9,7 +9,8 @@ import { handleContextResolution } from "../context/context.js";
|
|
|
9
9
|
import "../context/index.js";
|
|
10
10
|
import { FileContentItemSchema, ImageContentItemSchema } from "../types/chat.js";
|
|
11
11
|
import { extractTextFromParts, getMessagePartsFromOpenAIContent } from "../utils/message-parts.js";
|
|
12
|
-
import {
|
|
12
|
+
import { PdfUrlIngestionError } from "../services/blob-storage/file-security-errors.js";
|
|
13
|
+
import { buildPersistedMessageContent, inlineExternalPdfUrlParts } from "../services/blob-storage/file-upload-helpers.js";
|
|
13
14
|
import { toolApprovalUiBus } from "../session/ToolApprovalUiBus.js";
|
|
14
15
|
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
15
16
|
import { PartSchema, createApiError, createMessage, createOrGetConversation, generateId, getActiveAgentForConversation, getConversationId, setActiveAgentForConversation } from "@inkeep/agents-core";
|
|
@@ -208,7 +209,7 @@ app.openapi(chatCompletionsRoute, async (c) => {
|
|
|
208
209
|
const requestId = `chatcmpl-${Date.now()}`;
|
|
209
210
|
const timestamp = Math.floor(Date.now() / 1e3);
|
|
210
211
|
const lastUserMessage = body.messages.filter((msg) => msg.role === "user").slice(-1)[0];
|
|
211
|
-
const messageParts = z.array(PartSchema).parse(lastUserMessage ? getMessagePartsFromOpenAIContent(lastUserMessage.content) : []);
|
|
212
|
+
const messageParts = await inlineExternalPdfUrlParts(z.array(PartSchema).parse(lastUserMessage ? getMessagePartsFromOpenAIContent(lastUserMessage.content) : []));
|
|
212
213
|
const userMessage = extractTextFromParts(messageParts);
|
|
213
214
|
const agentName = agent.name;
|
|
214
215
|
const messageSpan = trace.getActiveSpan();
|
|
@@ -357,6 +358,10 @@ app.openapi(chatCompletionsRoute, async (c) => {
|
|
|
357
358
|
});
|
|
358
359
|
});
|
|
359
360
|
} catch (error) {
|
|
361
|
+
if (error instanceof PdfUrlIngestionError) throw createApiError({
|
|
362
|
+
code: "bad_request",
|
|
363
|
+
message: error.message
|
|
364
|
+
});
|
|
360
365
|
if (error instanceof HTTPException) throw error;
|
|
361
366
|
logger.error({
|
|
362
367
|
error: error instanceof Error ? error.message : error,
|
|
@@ -9,7 +9,8 @@ import { handleContextResolution } from "../context/context.js";
|
|
|
9
9
|
import "../context/index.js";
|
|
10
10
|
import { VercelMessageSchema } from "../types/chat.js";
|
|
11
11
|
import { extractTextFromParts, getMessagePartsFromVercelContent } from "../utils/message-parts.js";
|
|
12
|
-
import {
|
|
12
|
+
import { PdfUrlIngestionError } from "../services/blob-storage/file-security-errors.js";
|
|
13
|
+
import { buildPersistedMessageContent, inlineExternalPdfUrlParts } from "../services/blob-storage/file-upload-helpers.js";
|
|
13
14
|
import { pendingToolApprovalManager } from "../session/PendingToolApprovalManager.js";
|
|
14
15
|
import { toolApprovalUiBus } from "../session/ToolApprovalUiBus.js";
|
|
15
16
|
import { OpenAPIHono, z } from "@hono/zod-openapi";
|
|
@@ -182,7 +183,7 @@ app.openapi(chatDataStreamRoute, async (c) => {
|
|
|
182
183
|
credentialStores: c.get("credentialStores")
|
|
183
184
|
});
|
|
184
185
|
const lastUserMessage = body.messages.filter((m) => m.role === "user").slice(-1)[0];
|
|
185
|
-
const messageParts = z.array(PartSchema).parse(getMessagePartsFromVercelContent(lastUserMessage?.content, lastUserMessage?.parts));
|
|
186
|
+
const messageParts = await inlineExternalPdfUrlParts(z.array(PartSchema).parse(getMessagePartsFromVercelContent(lastUserMessage?.content, lastUserMessage?.parts)));
|
|
186
187
|
const userText = extractTextFromParts(messageParts) || "";
|
|
187
188
|
logger.info({
|
|
188
189
|
userText,
|
|
@@ -353,6 +354,10 @@ app.openapi(chatDataStreamRoute, async (c) => {
|
|
|
353
354
|
return stream(c, (stream$1) => stream$1.pipe(dataStream.pipeThrough(new JsonToSseTransformStream()).pipeThrough(new TextEncoderStream())));
|
|
354
355
|
});
|
|
355
356
|
} catch (error) {
|
|
357
|
+
if (error instanceof PdfUrlIngestionError) throw createApiError({
|
|
358
|
+
code: "bad_request",
|
|
359
|
+
message: error.message
|
|
360
|
+
});
|
|
356
361
|
if (error instanceof HTTPException) throw error;
|
|
357
362
|
logger.error({
|
|
358
363
|
error,
|
|
@@ -1,7 +1,13 @@
|
|
|
1
|
+
import { LookupAddress } from "node:dns";
|
|
2
|
+
|
|
1
3
|
//#region src/domains/run/services/blob-storage/external-file-downloader.d.ts
|
|
2
|
-
|
|
4
|
+
type LookupCallback = (error: Error | null, address: string | LookupAddress[], family?: number) => void;
|
|
5
|
+
declare function forwardLookupResult(hostname: string, address: string | LookupAddress[], family: number | undefined, callback: LookupCallback): void;
|
|
6
|
+
declare function downloadExternalFile(url: string, options?: {
|
|
7
|
+
expectedMimeType?: string;
|
|
8
|
+
}): Promise<{
|
|
3
9
|
data: Uint8Array;
|
|
4
10
|
mimeType: string;
|
|
5
11
|
}>;
|
|
6
12
|
//#endregion
|
|
7
|
-
export { downloadExternalFile };
|
|
13
|
+
export { downloadExternalFile, forwardLookupResult };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { EXTERNAL_FETCH_TIMEOUT_MS, MAX_EXTERNAL_REDIRECTS, MAX_FILE_BYTES } from "./file-security-constants.js";
|
|
2
2
|
import { BlockedConnectionToPrivateIpError, BlockedExternalFileExceedingError, BlockedExternalFileLargerThanError, ExternalFileResponseBodyEmptyError, FailedToDownloadError, FileSecurityError, RedirectMissingLocationError, TimedOutDownloadingError, TooManyRedirectsError, UnableToResolveHostError, UnexpectedRedirectStateError } from "./file-security-errors.js";
|
|
3
|
-
import {
|
|
3
|
+
import { resolveDownloadedFileMimeType } from "./file-content-security.js";
|
|
4
4
|
import { isBlockedIpAddress, validateExternalFileUrl, validateUrlResolvesToPublicIp } from "./file-url-security.js";
|
|
5
5
|
import { retryWithBackoff } from "@inkeep/agents-core";
|
|
6
6
|
import { lookup } from "node:dns";
|
|
@@ -13,28 +13,31 @@ const externalImageDispatcher = new Agent({ connect: { lookup(hostname, options,
|
|
|
13
13
|
callback(new UnableToResolveHostError(hostname, { cause: error }), "", 0);
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
return;
|
|
25
|
-
}
|
|
26
|
-
callback(null, selected.address, selected.family);
|
|
16
|
+
forwardLookupResult(hostname, address, family, callback);
|
|
17
|
+
});
|
|
18
|
+
} } });
|
|
19
|
+
const MAX_EXTERNAL_FETCH_ATTEMPTS = 3;
|
|
20
|
+
function forwardLookupResult(hostname, address, family, callback) {
|
|
21
|
+
if (Array.isArray(address)) {
|
|
22
|
+
if (!address[0]) {
|
|
23
|
+
callback(new UnableToResolveHostError(hostname), "", 0);
|
|
27
24
|
return;
|
|
28
25
|
}
|
|
29
|
-
|
|
30
|
-
|
|
26
|
+
const blocked = address.find((candidate) => isBlockedIpAddress(candidate.address));
|
|
27
|
+
if (blocked) {
|
|
28
|
+
callback(new BlockedConnectionToPrivateIpError(blocked.address), "", 0);
|
|
31
29
|
return;
|
|
32
30
|
}
|
|
33
|
-
callback(null, address
|
|
34
|
-
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
|
|
31
|
+
callback(null, address);
|
|
32
|
+
return;
|
|
33
|
+
}
|
|
34
|
+
if (isBlockedIpAddress(address)) {
|
|
35
|
+
callback(new BlockedConnectionToPrivateIpError(address), "", 0);
|
|
36
|
+
return;
|
|
37
|
+
}
|
|
38
|
+
callback(null, address, family);
|
|
39
|
+
}
|
|
40
|
+
async function downloadExternalFile(url, options) {
|
|
38
41
|
let currentUrl = validateExternalFileUrl(url);
|
|
39
42
|
await validateUrlResolvesToPublicIp(currentUrl);
|
|
40
43
|
for (let redirectCount = 0; redirectCount <= MAX_EXTERNAL_REDIRECTS; redirectCount++) {
|
|
@@ -54,7 +57,7 @@ async function downloadExternalFile(url) {
|
|
|
54
57
|
const data = await readResponseBytesWithLimit(response, MAX_FILE_BYTES);
|
|
55
58
|
return {
|
|
56
59
|
data,
|
|
57
|
-
mimeType: await
|
|
60
|
+
mimeType: await resolveDownloadedFileMimeType(data, headerContentType, options?.expectedMimeType)
|
|
58
61
|
};
|
|
59
62
|
}
|
|
60
63
|
throw new UnexpectedRedirectStateError(toSanitizedUrl(url));
|
|
@@ -138,4 +141,4 @@ function toSanitizedUrl(url) {
|
|
|
138
141
|
}
|
|
139
142
|
|
|
140
143
|
//#endregion
|
|
141
|
-
export { downloadExternalFile };
|
|
144
|
+
export { downloadExternalFile, forwardLookupResult };
|
|
@@ -13,6 +13,6 @@ declare function normalizeInlineFileBytes(file: {
|
|
|
13
13
|
data: Uint8Array;
|
|
14
14
|
mimeType: string;
|
|
15
15
|
}>;
|
|
16
|
-
declare function
|
|
16
|
+
declare function resolveDownloadedFileMimeType(data: Uint8Array, headerContentType: string, expectedMimeType?: string): Promise<string>;
|
|
17
17
|
//#endregion
|
|
18
|
-
export { normalizeInlineFileBytes, normalizeInlineImageBytes,
|
|
18
|
+
export { normalizeInlineFileBytes, normalizeInlineImageBytes, resolveDownloadedFileMimeType };
|
|
@@ -19,10 +19,15 @@ async function normalizeInlineFileBytes(file) {
|
|
|
19
19
|
};
|
|
20
20
|
throw new BlockedInlineUnsupportedFileBytesError(file.mimeType || "unknown");
|
|
21
21
|
}
|
|
22
|
-
async function
|
|
22
|
+
async function resolveDownloadedFileMimeType(data, headerContentType, expectedMimeType) {
|
|
23
|
+
const expected = expectedMimeType?.split(";")[0]?.trim().toLowerCase();
|
|
24
|
+
if (expected === "application/pdf") {
|
|
25
|
+
if (looksLikePdf(data)) return "application/pdf";
|
|
26
|
+
throw new BlockedExternalUnsupportedBytesError(headerContentType || expected || "unknown");
|
|
27
|
+
}
|
|
23
28
|
const sniffedMime = await sniffAllowedImageMimeType(data);
|
|
24
29
|
if (sniffedMime) return sniffedMime;
|
|
25
|
-
throw new BlockedExternalUnsupportedBytesError(headerContentType || "unknown");
|
|
30
|
+
throw new BlockedExternalUnsupportedBytesError(headerContentType || expected || "unknown");
|
|
26
31
|
}
|
|
27
32
|
function validateInlineFileSize(data) {
|
|
28
33
|
if (data.length > MAX_FILE_BYTES) throw new BlockedInlineFileExceedingError(MAX_FILE_BYTES);
|
|
@@ -52,4 +57,4 @@ function looksLikePdf(data) {
|
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
//#endregion
|
|
55
|
-
export { normalizeInlineFileBytes, normalizeInlineImageBytes,
|
|
60
|
+
export { normalizeInlineFileBytes, normalizeInlineImageBytes, resolveDownloadedFileMimeType };
|