@inkeep/agents-api 0.0.0-dev-20260211172526 → 0.0.0-dev-20260211213109
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/flow.cjs +44 -44
- package/dist/.well-known/workflow/v1/flow.cjs.debug.json +2 -2
- package/dist/.well-known/workflow/v1/manifest.debug.json +5 -5
- package/dist/.well-known/workflow/v1/step.cjs +536 -338
- package/dist/.well-known/workflow/v1/step.cjs.debug.json +2 -2
- package/dist/createApp.d.ts +2 -2
- package/dist/createApp.js +12 -1
- package/dist/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/routes/index.d.ts +2 -2
- package/dist/domains/evals/services/EvaluationService.d.ts +0 -5
- package/dist/domains/evals/services/EvaluationService.js +2 -51
- 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/mcp.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/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/services/TriggerService.js +105 -12
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/domains/work-apps/index.d.ts +13 -0
- package/dist/domains/work-apps/index.js +23 -0
- package/dist/factory.d.ts +263 -263
- package/dist/index.d.ts +262 -262
- package/dist/middleware/cors.d.ts +6 -1
- package/dist/middleware/cors.js +27 -1
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/index.d.ts +3 -2
- package/dist/middleware/index.js +3 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.js +16 -1
- package/dist/middleware/projectAccess.d.ts +2 -2
- package/dist/middleware/projectConfig.d.ts +3 -3
- package/dist/middleware/runAuth.d.ts +4 -4
- package/dist/middleware/runAuth.js +71 -1
- package/dist/middleware/tenantAccess.d.ts +2 -2
- package/dist/middleware/tracing.d.ts +3 -3
- package/dist/middleware/workAppsAuth.d.ts +7 -0
- package/dist/middleware/workAppsAuth.js +30 -0
- package/dist/openapi.d.ts +5 -0
- package/dist/openapi.js +6 -1
- package/package.json +5 -5
- package/dist/_virtual/rolldown_runtime.js +0 -7
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"stepFiles": [
|
|
3
|
-
"/home/runner/work/agents/agents/agents-api/src/domains/evals/workflow/functions/
|
|
4
|
-
"/home/runner/work/agents/agents/agents-api/src/domains/evals/workflow/functions/
|
|
3
|
+
"/home/runner/work/agents/agents/agents-api/src/domains/evals/workflow/functions/runDatasetItem.ts",
|
|
4
|
+
"/home/runner/work/agents/agents/agents-api/src/domains/evals/workflow/functions/evaluateConversation.ts"
|
|
5
5
|
]
|
|
6
6
|
}
|
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_types13 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_types13.BlankEnv, hono_types13.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { createAgentsHono, isWebhookRoute };
|
package/dist/createApp.js
CHANGED
|
@@ -7,12 +7,14 @@ import { flushBatchProcessor } from "./instrumentation.js";
|
|
|
7
7
|
import { manageRoutes } from "./domains/manage/index.js";
|
|
8
8
|
import mcp_default from "./domains/mcp/routes/mcp.js";
|
|
9
9
|
import { runRoutes } from "./domains/run/index.js";
|
|
10
|
-
import {
|
|
10
|
+
import { workAppsRoutes } from "./domains/work-apps/index.js";
|
|
11
|
+
import { authCorsConfig, defaultCorsConfig, playgroundCorsConfig, runCorsConfig, signozCorsConfig, workAppsCorsConfig } from "./middleware/cors.js";
|
|
11
12
|
import { errorHandler } from "./middleware/errorHandler.js";
|
|
12
13
|
import { manageApiKeyAuth } from "./middleware/manageAuth.js";
|
|
13
14
|
import { manageRefMiddleware, oauthRefMiddleware, runRefMiddleware, writeProtectionMiddleware } from "./middleware/ref.js";
|
|
14
15
|
import { runApiKeyAuth, runApiKeyAuthExcept } from "./middleware/runAuth.js";
|
|
15
16
|
import { requireTenantAccess } from "./middleware/tenantAccess.js";
|
|
17
|
+
import { workAppsAuth } from "./middleware/workAppsAuth.js";
|
|
16
18
|
import "./middleware/index.js";
|
|
17
19
|
import { branchScopedDbMiddleware } from "./middleware/branchScopedDb.js";
|
|
18
20
|
import { evalApiKeyAuth } from "./middleware/evalsAuth.js";
|
|
@@ -52,9 +54,11 @@ function createAgentsHono(config) {
|
|
|
52
54
|
app.use("/run/*", cors(runCorsConfig));
|
|
53
55
|
app.use("/manage/tenants/*/playground/token", cors(playgroundCorsConfig));
|
|
54
56
|
app.use("/manage/tenants/*/signoz/*", cors(signozCorsConfig));
|
|
57
|
+
app.use("/work-apps/*", cors(workAppsCorsConfig));
|
|
55
58
|
app.use("*", async (c, next) => {
|
|
56
59
|
if (auth && c.req.path.startsWith("/api/auth/")) return next();
|
|
57
60
|
if (c.req.path.startsWith("/run/")) return next();
|
|
61
|
+
if (c.req.path.startsWith("/work-apps/")) return next();
|
|
58
62
|
if (c.req.path.includes("/playground/token")) return next();
|
|
59
63
|
if (c.req.path.includes("/signoz/")) return next();
|
|
60
64
|
if (c.req.path.includes("/work-apps/github/")) return next();
|
|
@@ -69,6 +73,10 @@ function createAgentsHono(config) {
|
|
|
69
73
|
c.set("auth", auth);
|
|
70
74
|
await next();
|
|
71
75
|
});
|
|
76
|
+
app.use("/work-apps/*", async (c, next) => {
|
|
77
|
+
c.set("auth", auth);
|
|
78
|
+
await next();
|
|
79
|
+
});
|
|
72
80
|
app.use("/run/*", async (c, next) => {
|
|
73
81
|
if (sandboxConfig) c.set("sandboxConfig", sandboxConfig);
|
|
74
82
|
await next();
|
|
@@ -185,6 +193,9 @@ function createAgentsHono(config) {
|
|
|
185
193
|
});
|
|
186
194
|
app.route("/evals", evalRoutes);
|
|
187
195
|
app.route("/work-apps/github", githubRoutes);
|
|
196
|
+
app.use("/work-apps/slack/workspaces/*", workAppsAuth);
|
|
197
|
+
app.use("/work-apps/slack/users/*", workAppsAuth);
|
|
198
|
+
app.route("/work-apps", workAppsRoutes);
|
|
188
199
|
app.route("/mcp", mcp_default);
|
|
189
200
|
setupOpenAPIRoutes(app);
|
|
190
201
|
app.use("/run/*", async (_c, next) => {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono17 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/datasetTriggers.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono17.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 hono18 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/evals/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono18.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -43,11 +43,6 @@ declare class EvaluationService {
|
|
|
43
43
|
* Extract messages from dataset item input
|
|
44
44
|
*/
|
|
45
45
|
private extractMessagesFromDatasetItem;
|
|
46
|
-
/**
|
|
47
|
-
* Parse SSE (Server-Sent Events) response from chat API
|
|
48
|
-
* Handles text deltas, error operations, and other data operations
|
|
49
|
-
*/
|
|
50
|
-
private parseSSEResponse;
|
|
51
46
|
/**
|
|
52
47
|
* Run an evaluation job based on an evaluation job config
|
|
53
48
|
* Filters conversations based on jobFilters and runs evaluations with configured evaluators
|
|
@@ -3,7 +3,7 @@ import { env } from "../../../env.js";
|
|
|
3
3
|
import manageDbClient_default from "../../../data/db/manageDbClient.js";
|
|
4
4
|
import manageDbPool_default from "../../../data/db/manageDbPool.js";
|
|
5
5
|
import runDbClient_default from "../../../data/db/runDbClient.js";
|
|
6
|
-
import { ModelFactory, createEvaluationResult, createEvaluationRun, filterConversationsForJob, generateId, getConversationHistory, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluatorById, getFullAgent, getProjectScopedRef, resolveRef, updateEvaluationResult, withRef } from "@inkeep/agents-core";
|
|
6
|
+
import { ModelFactory, createEvaluationResult, createEvaluationRun, filterConversationsForJob, generateId, getConversationHistory, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluatorById, getFullAgent, getProjectScopedRef, parseSSEResponse, resolveRef, updateEvaluationResult, withRef } from "@inkeep/agents-core";
|
|
7
7
|
import { generateObject, generateText } from "ai";
|
|
8
8
|
import { z } from "zod";
|
|
9
9
|
|
|
@@ -105,8 +105,7 @@ var EvaluationService = class {
|
|
|
105
105
|
error: `Chat API error: ${response.status} ${response.statusText}`
|
|
106
106
|
};
|
|
107
107
|
}
|
|
108
|
-
const
|
|
109
|
-
const parseResult = this.parseSSEResponse(responseText);
|
|
108
|
+
const parseResult = parseSSEResponse(await response.text());
|
|
110
109
|
if (parseResult.error) {
|
|
111
110
|
logger.error({
|
|
112
111
|
datasetItemId: datasetItem.id,
|
|
@@ -314,54 +313,6 @@ Generate the next user message:`;
|
|
|
314
313
|
return null;
|
|
315
314
|
}
|
|
316
315
|
/**
|
|
317
|
-
* Parse SSE (Server-Sent Events) response from chat API
|
|
318
|
-
* Handles text deltas, error operations, and other data operations
|
|
319
|
-
*/
|
|
320
|
-
parseSSEResponse(sseText) {
|
|
321
|
-
let textContent = "";
|
|
322
|
-
let hasError = false;
|
|
323
|
-
let errorMessage = "";
|
|
324
|
-
const lines = sseText.split("\n").filter((line) => line.startsWith("data: "));
|
|
325
|
-
for (const line of lines) try {
|
|
326
|
-
const data = JSON.parse(line.slice(6));
|
|
327
|
-
if (data.object === "chat.completion.chunk" && data.choices?.[0]?.delta) {
|
|
328
|
-
const delta = data.choices[0].delta;
|
|
329
|
-
if (delta.content) textContent += delta.content;
|
|
330
|
-
if (delta.content && typeof delta.content === "string") try {
|
|
331
|
-
const parsedContent = JSON.parse(delta.content);
|
|
332
|
-
if (parsedContent.type === "data-operation" && parsedContent.data?.type === "error") {
|
|
333
|
-
hasError = true;
|
|
334
|
-
errorMessage = parsedContent.data.message || "Unknown error occurred";
|
|
335
|
-
logger.warn({
|
|
336
|
-
errorMessage,
|
|
337
|
-
errorData: parsedContent.data
|
|
338
|
-
}, "Received error operation from chat API");
|
|
339
|
-
}
|
|
340
|
-
} catch {}
|
|
341
|
-
} else if (data.type === "text-delta" && data.delta) textContent += data.delta;
|
|
342
|
-
else if (data.type === "data-operation" && data.data?.type === "error") {
|
|
343
|
-
hasError = true;
|
|
344
|
-
errorMessage = data.data.message || "Unknown error occurred";
|
|
345
|
-
logger.warn({
|
|
346
|
-
errorMessage,
|
|
347
|
-
errorData: data.data
|
|
348
|
-
}, "Received error operation from chat API");
|
|
349
|
-
} else if (data.type === "error") {
|
|
350
|
-
hasError = true;
|
|
351
|
-
errorMessage = data.message || "Unknown error occurred";
|
|
352
|
-
logger.warn({
|
|
353
|
-
errorMessage,
|
|
354
|
-
errorData: data
|
|
355
|
-
}, "Received error event from chat API");
|
|
356
|
-
} else if (data.content) textContent += typeof data.content === "string" ? data.content : JSON.stringify(data.content);
|
|
357
|
-
} catch {}
|
|
358
|
-
if (hasError) return {
|
|
359
|
-
text: textContent.trim(),
|
|
360
|
-
error: errorMessage
|
|
361
|
-
};
|
|
362
|
-
return { text: textContent.trim() };
|
|
363
|
-
}
|
|
364
|
-
/**
|
|
365
316
|
* Run an evaluation job based on an evaluation job config
|
|
366
317
|
* Filters conversations based on jobFilters and runs evaluations with configured evaluators
|
|
367
318
|
*/
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono9 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/availableAgents.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono9.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/conversations.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono15.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 hono16 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono16.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_types10 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_types10.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { invitationsRoutes 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/manage/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,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_types11 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_types11.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_types12 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_types12.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { usersRoutes as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { AgentConfig, DelegateRelation } from "./Agent.js";
|
|
2
2
|
import { InternalRelation } from "../utils/project.js";
|
|
3
|
-
import * as
|
|
3
|
+
import * as _inkeep_agents_core1 from "@inkeep/agents-core";
|
|
4
4
|
import { CredentialStoreRegistry, FullExecutionContext } from "@inkeep/agents-core";
|
|
5
5
|
import * as ai0 from "ai";
|
|
6
6
|
|
|
@@ -44,7 +44,7 @@ declare function createDelegateToAgentTool({
|
|
|
44
44
|
message: string;
|
|
45
45
|
}, {
|
|
46
46
|
toolCallId: any;
|
|
47
|
-
result:
|
|
47
|
+
result: _inkeep_agents_core1.Message | _inkeep_agents_core1.Task;
|
|
48
48
|
}>;
|
|
49
49
|
/**
|
|
50
50
|
* Parameters for building a transfer relation config
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { __require } from "../../../_virtual/rolldown_runtime.js";
|
|
2
1
|
import { getLogger as getLogger$1 } from "../../../logger.js";
|
|
3
2
|
import { env } from "../../../env.js";
|
|
4
3
|
import manageDbPool_default from "../../../data/db/manageDbPool.js";
|
|
@@ -12,10 +11,19 @@ import { SpanStatusCode, context, propagation } from "@opentelemetry/api";
|
|
|
12
11
|
import Ajv from "ajv";
|
|
13
12
|
|
|
14
13
|
//#region src/domains/run/services/TriggerService.ts
|
|
15
|
-
let
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
14
|
+
let _waitUntil;
|
|
15
|
+
let _waitUntilResolved = false;
|
|
16
|
+
async function getWaitUntil() {
|
|
17
|
+
if (_waitUntilResolved) return _waitUntil;
|
|
18
|
+
_waitUntilResolved = true;
|
|
19
|
+
if (!process.env.VERCEL) return void 0;
|
|
20
|
+
try {
|
|
21
|
+
_waitUntil = (await import("@vercel/functions")).waitUntil;
|
|
22
|
+
} catch (e) {
|
|
23
|
+
console.error("[TriggerService] Failed to import @vercel/functions:", e);
|
|
24
|
+
}
|
|
25
|
+
return _waitUntil;
|
|
26
|
+
}
|
|
19
27
|
const logger = getLogger$1("TriggerService");
|
|
20
28
|
const ajv = new Ajv({ allErrors: true });
|
|
21
29
|
const credentialCache = /* @__PURE__ */ new Map();
|
|
@@ -320,7 +328,7 @@ async function dispatchExecution(params) {
|
|
|
320
328
|
invocationId,
|
|
321
329
|
conversationId
|
|
322
330
|
}, "Trigger invocation created");
|
|
323
|
-
const
|
|
331
|
+
const safeExecutionPromise = executeAgentAsync({
|
|
324
332
|
tenantId,
|
|
325
333
|
projectId,
|
|
326
334
|
agentId,
|
|
@@ -330,9 +338,7 @@ async function dispatchExecution(params) {
|
|
|
330
338
|
userMessage: userMessageText,
|
|
331
339
|
messageParts,
|
|
332
340
|
resolvedRef
|
|
333
|
-
})
|
|
334
|
-
if (waitUntil) waitUntil(executionPromise);
|
|
335
|
-
else executionPromise.catch((error) => {
|
|
341
|
+
}).catch(async (error) => {
|
|
336
342
|
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
337
343
|
const errorStack = error instanceof Error ? error.stack : void 0;
|
|
338
344
|
logger.error({
|
|
@@ -344,7 +350,45 @@ async function dispatchExecution(params) {
|
|
|
344
350
|
triggerId,
|
|
345
351
|
invocationId
|
|
346
352
|
}, "Background trigger execution failed");
|
|
353
|
+
try {
|
|
354
|
+
await updateTriggerInvocationStatus(runDbClient_default)({
|
|
355
|
+
scopes: {
|
|
356
|
+
tenantId,
|
|
357
|
+
projectId,
|
|
358
|
+
agentId
|
|
359
|
+
},
|
|
360
|
+
triggerId,
|
|
361
|
+
invocationId,
|
|
362
|
+
data: {
|
|
363
|
+
status: "failed",
|
|
364
|
+
errorMessage
|
|
365
|
+
}
|
|
366
|
+
});
|
|
367
|
+
} catch (updateError) {
|
|
368
|
+
const updateErrorMessage = updateError instanceof Error ? updateError.message : String(updateError);
|
|
369
|
+
logger.error({
|
|
370
|
+
err: updateErrorMessage,
|
|
371
|
+
invocationId
|
|
372
|
+
}, "Failed to update invocation status to failed");
|
|
373
|
+
}
|
|
347
374
|
});
|
|
375
|
+
const waitUntil = await getWaitUntil();
|
|
376
|
+
if (waitUntil) {
|
|
377
|
+
logger.info({
|
|
378
|
+
tenantId,
|
|
379
|
+
projectId,
|
|
380
|
+
agentId,
|
|
381
|
+
triggerId,
|
|
382
|
+
invocationId
|
|
383
|
+
}, "Calling waitUntil with execution promise");
|
|
384
|
+
waitUntil(safeExecutionPromise);
|
|
385
|
+
} else logger.warn({
|
|
386
|
+
tenantId,
|
|
387
|
+
projectId,
|
|
388
|
+
agentId,
|
|
389
|
+
triggerId,
|
|
390
|
+
invocationId
|
|
391
|
+
}, "waitUntil is NOT available — background execution will be abandoned on serverless");
|
|
348
392
|
logger.info({
|
|
349
393
|
tenantId,
|
|
350
394
|
projectId,
|
|
@@ -364,20 +408,69 @@ async function dispatchExecution(params) {
|
|
|
364
408
|
*/
|
|
365
409
|
async function executeAgentAsync(params) {
|
|
366
410
|
const { tenantId, projectId, agentId, triggerId, invocationId, conversationId, userMessage, messageParts, resolvedRef } = params;
|
|
411
|
+
logger.info({
|
|
412
|
+
tenantId,
|
|
413
|
+
projectId,
|
|
414
|
+
agentId,
|
|
415
|
+
triggerId,
|
|
416
|
+
invocationId
|
|
417
|
+
}, "executeAgentAsync: started, loading project");
|
|
367
418
|
const project = await withRef(manageDbPool_default, resolvedRef, async (db) => {
|
|
368
419
|
return await getFullProjectWithRelationIds(db)({ scopes: {
|
|
369
420
|
tenantId,
|
|
370
421
|
projectId
|
|
371
422
|
} });
|
|
372
423
|
});
|
|
373
|
-
|
|
424
|
+
logger.info({
|
|
425
|
+
tenantId,
|
|
426
|
+
projectId,
|
|
427
|
+
agentId,
|
|
428
|
+
triggerId,
|
|
429
|
+
invocationId,
|
|
430
|
+
hasProject: !!project
|
|
431
|
+
}, "executeAgentAsync: project loaded");
|
|
432
|
+
if (!project) {
|
|
433
|
+
logger.error({
|
|
434
|
+
tenantId,
|
|
435
|
+
projectId,
|
|
436
|
+
agentId,
|
|
437
|
+
triggerId,
|
|
438
|
+
invocationId
|
|
439
|
+
}, "Project not found for trigger execution");
|
|
440
|
+
throw new Error(`Project ${projectId} not found`);
|
|
441
|
+
}
|
|
374
442
|
const agent = project.agents?.[agentId];
|
|
375
|
-
if (!agent)
|
|
443
|
+
if (!agent) {
|
|
444
|
+
logger.error({
|
|
445
|
+
tenantId,
|
|
446
|
+
projectId,
|
|
447
|
+
agentId,
|
|
448
|
+
triggerId,
|
|
449
|
+
invocationId
|
|
450
|
+
}, "Agent not found in project for trigger execution");
|
|
451
|
+
throw new Error(`Agent ${agentId} not found in project`);
|
|
452
|
+
}
|
|
376
453
|
const defaultSubAgentId = agent.defaultSubAgentId;
|
|
377
|
-
if (!defaultSubAgentId)
|
|
454
|
+
if (!defaultSubAgentId) {
|
|
455
|
+
logger.error({
|
|
456
|
+
tenantId,
|
|
457
|
+
projectId,
|
|
458
|
+
agentId,
|
|
459
|
+
triggerId,
|
|
460
|
+
invocationId
|
|
461
|
+
}, "Agent has no default sub-agent configured");
|
|
462
|
+
throw new Error(`Agent ${agentId} has no default sub-agent configured`);
|
|
463
|
+
}
|
|
378
464
|
const agentName = agent.name;
|
|
379
465
|
const baggage = propagation.createBaggage().setEntry("conversation.id", { value: conversationId }).setEntry("tenant.id", { value: tenantId }).setEntry("project.id", { value: projectId }).setEntry("agent.id", { value: agentId }).setEntry("agent.name", { value: agentName });
|
|
380
466
|
const ctxWithBaggage = propagation.setBaggage(context.active(), baggage);
|
|
467
|
+
logger.info({
|
|
468
|
+
tenantId,
|
|
469
|
+
projectId,
|
|
470
|
+
agentId,
|
|
471
|
+
triggerId,
|
|
472
|
+
invocationId
|
|
473
|
+
}, "executeAgentAsync: starting tracer span");
|
|
381
474
|
return tracer.startActiveSpan("trigger.execute_async", {
|
|
382
475
|
root: true,
|
|
383
476
|
attributes: {
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core3 from "@inkeep/agents-core";
|
|
2
2
|
import { BreakdownComponentDef, ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown } from "@inkeep/agents-core";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/run/utils/token-estimator.d.ts
|
|
@@ -17,7 +17,7 @@ interface AssembleResult {
|
|
|
17
17
|
/** The assembled prompt string */
|
|
18
18
|
prompt: string;
|
|
19
19
|
/** Token breakdown for each component */
|
|
20
|
-
breakdown:
|
|
20
|
+
breakdown: _inkeep_agents_core3.ContextBreakdown;
|
|
21
21
|
}
|
|
22
22
|
//#endregion
|
|
23
23
|
export { AssembleResult, type BreakdownComponentDef, type ContextBreakdown, calculateBreakdownTotal, createEmptyBreakdown, estimateTokens };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
+
import { WorkAppsVariables } from "@inkeep/agents-work-apps/slack";
|
|
3
|
+
|
|
4
|
+
//#region src/domains/work-apps/index.d.ts
|
|
5
|
+
|
|
6
|
+
declare function createWorkAppsRoutes(): OpenAPIHono<{
|
|
7
|
+
Variables: WorkAppsVariables;
|
|
8
|
+
}, {}, "/">;
|
|
9
|
+
declare const workAppsRoutes: OpenAPIHono<{
|
|
10
|
+
Variables: WorkAppsVariables;
|
|
11
|
+
}, {}, "/">;
|
|
12
|
+
//#endregion
|
|
13
|
+
export { createWorkAppsRoutes, workAppsRoutes };
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
+
import { slackRoutes } from "@inkeep/agents-work-apps/slack";
|
|
3
|
+
|
|
4
|
+
//#region src/domains/work-apps/index.ts
|
|
5
|
+
/**
|
|
6
|
+
* Work Apps Domain
|
|
7
|
+
*
|
|
8
|
+
* Modular integration layer for third-party work applications (Slack, GitHub, etc.)
|
|
9
|
+
* Work app implementations are in @inkeep/agents-work-apps package.
|
|
10
|
+
*
|
|
11
|
+
* Each work app is mounted as a sub-route:
|
|
12
|
+
* - /work-apps/slack/* - Slack workspace installation, user linking, commands
|
|
13
|
+
* - /work-apps/github/* - GitHub integration (mounted separately in createApp)
|
|
14
|
+
*/
|
|
15
|
+
function createWorkAppsRoutes() {
|
|
16
|
+
const app = new OpenAPIHono();
|
|
17
|
+
app.route("/slack", slackRoutes);
|
|
18
|
+
return app;
|
|
19
|
+
}
|
|
20
|
+
const workAppsRoutes = createWorkAppsRoutes();
|
|
21
|
+
|
|
22
|
+
//#endregion
|
|
23
|
+
export { createWorkAppsRoutes, workAppsRoutes };
|