@inkeep/agents-api 0.0.0-dev-20260212005842 → 0.0.0-dev-20260212033035
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/step.cjs +1888 -1615
- 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/domains/evals/routes/datasetTriggers.d.ts +2 -2
- package/dist/domains/evals/workflow/routes.d.ts +2 -2
- package/dist/domains/manage/routes/agentFull.js +0 -1
- package/dist/domains/manage/routes/availableAgents.d.ts +2 -2
- package/dist/domains/manage/routes/index.d.ts +2 -2
- package/dist/domains/manage/routes/index.js +4 -0
- 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/skills.d.ts +10 -0
- package/dist/domains/manage/routes/skills.js +173 -0
- package/dist/domains/manage/routes/subAgentSkills.d.ts +9 -0
- package/dist/domains/manage/routes/subAgentSkills.js +142 -0
- 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/Agent.d.ts +2 -1
- package/dist/domains/run/agents/Agent.js +26 -2
- package/dist/domains/run/agents/generateTaskHandler.js +3 -1
- package/dist/domains/run/agents/relationTools.d.ts +2 -2
- package/dist/domains/run/agents/types.d.ts +12 -1
- package/dist/domains/run/agents/versions/v1/PromptConfig.d.ts +1 -0
- package/dist/domains/run/agents/versions/v1/PromptConfig.js +26 -1
- package/dist/domains/run/services/BaseCompressor.js +1 -1
- package/dist/domains/run/utils/project.d.ts +8 -2
- package/dist/domains/run/utils/project.js +4 -1
- package/dist/domains/run/utils/token-estimator.d.ts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/middleware/evalsAuth.d.ts +2 -2
- package/dist/middleware/manageAuth.d.ts +2 -2
- package/dist/middleware/projectAccess.d.ts +2 -2
- 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/dist/openapi.d.ts +1 -0
- package/dist/openapi.js +1 -0
- package/dist/templates/v1/prompt/system-prompt.js +1 -1
- package/dist/types/app.d.ts +1 -1
- package/dist/types/index.d.ts +2 -2
- package/package.json +5 -5
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 };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as _inkeep_agents_core0 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_core0.AgentsManageDatabaseClient;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { manageDbClient 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/db/runDbClient.d.ts
|
|
4
|
-
declare const runDbClient:
|
|
4
|
+
declare const runDbClient: _inkeep_agents_core0.AgentsRunDatabaseClient;
|
|
5
5
|
//#endregion
|
|
6
6
|
export { runDbClient as default };
|
|
@@ -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 { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types5 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_types5.BlankEnv, hono_types5.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { workflowRoutes };
|
|
@@ -119,7 +119,6 @@ app.openapi(createRoute({
|
|
|
119
119
|
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
120
120
|
const agentData = c.req.valid("json");
|
|
121
121
|
try {
|
|
122
|
-
logger.info({}, "test agent data");
|
|
123
122
|
const validatedAgentData = AgentWithinContextOfProjectSchema.parse(agentData);
|
|
124
123
|
if (agentId !== validatedAgentData.id) throw createApiError({
|
|
125
124
|
code: "bad_request",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono0 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/availableAgents.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono0.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 hono6 from "hono";
|
|
3
3
|
|
|
4
4
|
//#region src/domains/manage/routes/index.d.ts
|
|
5
|
-
declare const app: OpenAPIHono<
|
|
5
|
+
declare const app: OpenAPIHono<hono6.Env, {}, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -18,11 +18,13 @@ import projectMembers_default from "./projectMembers.js";
|
|
|
18
18
|
import projectPermissions_default from "./projectPermissions.js";
|
|
19
19
|
import projects_default from "./projects.js";
|
|
20
20
|
import ref_default from "./ref.js";
|
|
21
|
+
import skills_default from "./skills.js";
|
|
21
22
|
import subAgentArtifactComponents_default from "./subAgentArtifactComponents.js";
|
|
22
23
|
import subAgentDataComponents_default from "./subAgentDataComponents.js";
|
|
23
24
|
import subAgentExternalAgentRelations_default from "./subAgentExternalAgentRelations.js";
|
|
24
25
|
import subAgentFunctionTools_default from "./subAgentFunctionTools.js";
|
|
25
26
|
import subAgentRelations_default from "./subAgentRelations.js";
|
|
27
|
+
import subAgentSkills_default from "./subAgentSkills.js";
|
|
26
28
|
import subAgents_default from "./subAgents.js";
|
|
27
29
|
import subAgentTeamAgentRelations_default from "./subAgentTeamAgentRelations.js";
|
|
28
30
|
import subAgentToolRelations_default from "./subAgentToolRelations.js";
|
|
@@ -49,6 +51,8 @@ app.route("/projects/:projectId/agents/:agentId/sub-agent-tool-relations", subAg
|
|
|
49
51
|
app.route("/projects/:projectId/agents/:agentId/sub-agent-artifact-components", subAgentArtifactComponents_default);
|
|
50
52
|
app.route("/projects/:projectId/agents/:agentId/sub-agent-data-components", subAgentDataComponents_default);
|
|
51
53
|
app.route("/projects/:projectId/agents/:agentId/sub-agent-function-tools", subAgentFunctionTools_default);
|
|
54
|
+
app.route("/projects/:projectId/skills", skills_default);
|
|
55
|
+
app.route("/projects/:projectId/agents/:agentId/sub-agent-skills", subAgentSkills_default);
|
|
52
56
|
app.route("/projects/:projectId/artifact-components", artifactComponents_default);
|
|
53
57
|
app.route("/projects/:projectId/agents/:agentId/context-configs", contextConfigs_default);
|
|
54
58
|
app.route("/projects/:projectId/conversations", conversations_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,7 +1,7 @@
|
|
|
1
1
|
import { Hono } from "hono";
|
|
2
|
-
import * as
|
|
2
|
+
import * as hono_types2 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_types2.BlankEnv, hono_types2.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_types8 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_types8.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_types4 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_types4.BlankSchema, "/">;
|
|
9
9
|
//#endregion
|
|
10
10
|
export { app as default };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
|
+
import "../../../types/index.js";
|
|
3
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
4
|
+
|
|
5
|
+
//#region src/domains/manage/routes/skills.d.ts
|
|
6
|
+
declare const app: OpenAPIHono<{
|
|
7
|
+
Variables: ManageAppVariables;
|
|
8
|
+
}, {}, "/">;
|
|
9
|
+
//#endregion
|
|
10
|
+
export { app as default };
|
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
2
|
+
import { speakeasyOffsetLimitPagination } from "../../../utils/speakeasy.js";
|
|
3
|
+
import { OpenAPIHono, createRoute } from "@hono/zod-openapi";
|
|
4
|
+
import { PaginationQueryParamsSchema, SkillApiInsertSchema, SkillApiUpdateSchema, SkillListResponse, SkillResponse, TenantProjectIdParamsSchema, TenantProjectParamsSchema, commonGetErrorResponses, createApiError, createSkill, deleteSkill, getSkillById, listSkills, updateSkill } from "@inkeep/agents-core";
|
|
5
|
+
|
|
6
|
+
//#region src/domains/manage/routes/skills.ts
|
|
7
|
+
const app = new OpenAPIHono();
|
|
8
|
+
app.use("/", (c, next) => {
|
|
9
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
10
|
+
return next();
|
|
11
|
+
});
|
|
12
|
+
app.use("/:id", (c, next) => {
|
|
13
|
+
if (c.req.method === "PUT") return requireProjectPermission("edit")(c, next);
|
|
14
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
15
|
+
return next();
|
|
16
|
+
});
|
|
17
|
+
app.openapi(createRoute({
|
|
18
|
+
method: "get",
|
|
19
|
+
path: "/",
|
|
20
|
+
summary: "List Skills",
|
|
21
|
+
operationId: "list-skills",
|
|
22
|
+
tags: ["Skills"],
|
|
23
|
+
request: {
|
|
24
|
+
params: TenantProjectParamsSchema,
|
|
25
|
+
query: PaginationQueryParamsSchema
|
|
26
|
+
},
|
|
27
|
+
responses: {
|
|
28
|
+
200: {
|
|
29
|
+
description: "Skills retrieved successfully",
|
|
30
|
+
content: { "application/json": { schema: SkillListResponse } }
|
|
31
|
+
},
|
|
32
|
+
...commonGetErrorResponses
|
|
33
|
+
},
|
|
34
|
+
...speakeasyOffsetLimitPagination
|
|
35
|
+
}), async (c) => {
|
|
36
|
+
const db = c.get("db");
|
|
37
|
+
const { tenantId, projectId } = c.req.valid("param");
|
|
38
|
+
const { page, limit } = c.req.valid("query");
|
|
39
|
+
const result = await listSkills(db)({
|
|
40
|
+
scopes: {
|
|
41
|
+
tenantId,
|
|
42
|
+
projectId
|
|
43
|
+
},
|
|
44
|
+
pagination: {
|
|
45
|
+
page,
|
|
46
|
+
limit
|
|
47
|
+
}
|
|
48
|
+
});
|
|
49
|
+
return c.json(result);
|
|
50
|
+
});
|
|
51
|
+
app.openapi(createRoute({
|
|
52
|
+
method: "get",
|
|
53
|
+
path: "/{id}",
|
|
54
|
+
summary: "Get Skill",
|
|
55
|
+
operationId: "get-skill",
|
|
56
|
+
tags: ["Skills"],
|
|
57
|
+
request: { params: TenantProjectIdParamsSchema },
|
|
58
|
+
responses: {
|
|
59
|
+
200: {
|
|
60
|
+
description: "Skill found",
|
|
61
|
+
content: { "application/json": { schema: SkillResponse } }
|
|
62
|
+
},
|
|
63
|
+
...commonGetErrorResponses
|
|
64
|
+
}
|
|
65
|
+
}), async (c) => {
|
|
66
|
+
const db = c.get("db");
|
|
67
|
+
const { tenantId, projectId, id } = c.req.valid("param");
|
|
68
|
+
const skill = await getSkillById(db)({
|
|
69
|
+
scopes: {
|
|
70
|
+
tenantId,
|
|
71
|
+
projectId
|
|
72
|
+
},
|
|
73
|
+
skillId: id
|
|
74
|
+
});
|
|
75
|
+
if (!skill) throw createApiError({
|
|
76
|
+
code: "not_found",
|
|
77
|
+
message: "Skill not found"
|
|
78
|
+
});
|
|
79
|
+
return c.json({ data: skill });
|
|
80
|
+
});
|
|
81
|
+
app.openapi(createRoute({
|
|
82
|
+
method: "post",
|
|
83
|
+
path: "/",
|
|
84
|
+
summary: "Create Skill",
|
|
85
|
+
operationId: "create-skill",
|
|
86
|
+
tags: ["Skills"],
|
|
87
|
+
request: {
|
|
88
|
+
params: TenantProjectParamsSchema,
|
|
89
|
+
body: { content: { "application/json": { schema: SkillApiInsertSchema } } }
|
|
90
|
+
},
|
|
91
|
+
responses: {
|
|
92
|
+
201: {
|
|
93
|
+
description: "Skill created successfully",
|
|
94
|
+
content: { "application/json": { schema: SkillResponse } }
|
|
95
|
+
},
|
|
96
|
+
...commonGetErrorResponses
|
|
97
|
+
}
|
|
98
|
+
}), async (c) => {
|
|
99
|
+
const db = c.get("db");
|
|
100
|
+
const { tenantId, projectId } = c.req.valid("param");
|
|
101
|
+
const body = c.req.valid("json");
|
|
102
|
+
const skill = await createSkill(db)({
|
|
103
|
+
...body,
|
|
104
|
+
tenantId,
|
|
105
|
+
projectId
|
|
106
|
+
});
|
|
107
|
+
return c.json({ data: skill }, 201);
|
|
108
|
+
});
|
|
109
|
+
app.openapi(createRoute({
|
|
110
|
+
method: "put",
|
|
111
|
+
path: "/{id}",
|
|
112
|
+
summary: "Update Skill",
|
|
113
|
+
operationId: "update-skill",
|
|
114
|
+
tags: ["Skills"],
|
|
115
|
+
request: {
|
|
116
|
+
params: TenantProjectIdParamsSchema,
|
|
117
|
+
body: { content: { "application/json": { schema: SkillApiUpdateSchema } } }
|
|
118
|
+
},
|
|
119
|
+
responses: {
|
|
120
|
+
200: {
|
|
121
|
+
description: "Skill updated successfully",
|
|
122
|
+
content: { "application/json": { schema: SkillResponse } }
|
|
123
|
+
},
|
|
124
|
+
...commonGetErrorResponses
|
|
125
|
+
}
|
|
126
|
+
}), async (c) => {
|
|
127
|
+
const db = c.get("db");
|
|
128
|
+
const { tenantId, projectId, id } = c.req.valid("param");
|
|
129
|
+
const body = c.req.valid("json");
|
|
130
|
+
const skill = await updateSkill(db)({
|
|
131
|
+
scopes: {
|
|
132
|
+
tenantId,
|
|
133
|
+
projectId
|
|
134
|
+
},
|
|
135
|
+
skillId: id,
|
|
136
|
+
data: body
|
|
137
|
+
});
|
|
138
|
+
if (!skill) throw createApiError({
|
|
139
|
+
code: "not_found",
|
|
140
|
+
message: "Skill not found"
|
|
141
|
+
});
|
|
142
|
+
return c.json({ data: skill });
|
|
143
|
+
});
|
|
144
|
+
app.openapi(createRoute({
|
|
145
|
+
method: "delete",
|
|
146
|
+
path: "/{id}",
|
|
147
|
+
summary: "Delete Skill",
|
|
148
|
+
operationId: "delete-skill",
|
|
149
|
+
tags: ["Skills"],
|
|
150
|
+
request: { params: TenantProjectIdParamsSchema },
|
|
151
|
+
responses: {
|
|
152
|
+
204: { description: "Skill deleted successfully" },
|
|
153
|
+
...commonGetErrorResponses
|
|
154
|
+
}
|
|
155
|
+
}), async (c) => {
|
|
156
|
+
const db = c.get("db");
|
|
157
|
+
const { tenantId, projectId, id } = c.req.valid("param");
|
|
158
|
+
if (!await deleteSkill(db)({
|
|
159
|
+
scopes: {
|
|
160
|
+
tenantId,
|
|
161
|
+
projectId
|
|
162
|
+
},
|
|
163
|
+
skillId: id
|
|
164
|
+
})) throw createApiError({
|
|
165
|
+
code: "not_found",
|
|
166
|
+
message: "Skill not found"
|
|
167
|
+
});
|
|
168
|
+
return c.body(null, 204);
|
|
169
|
+
});
|
|
170
|
+
var skills_default = app;
|
|
171
|
+
|
|
172
|
+
//#endregion
|
|
173
|
+
export { skills_default as default };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ManageAppVariables } from "../../../types/app.js";
|
|
2
|
+
import { OpenAPIHono } from "@hono/zod-openapi";
|
|
3
|
+
|
|
4
|
+
//#region src/domains/manage/routes/subAgentSkills.d.ts
|
|
5
|
+
declare const app: OpenAPIHono<{
|
|
6
|
+
Variables: ManageAppVariables;
|
|
7
|
+
}, {}, "/">;
|
|
8
|
+
//#endregion
|
|
9
|
+
export { app as default };
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
import { requireProjectPermission } from "../../../middleware/projectAccess.js";
|
|
2
|
+
import { OpenAPIHono, createRoute, z } from "@hono/zod-openapi";
|
|
3
|
+
import { SubAgentSkillApiInsertSchema, SubAgentSkillResponse, SubAgentSkillWithIndexArrayResponse, TenantProjectAgentParamsSchema, TenantProjectAgentSubAgentParamsSchema, commonGetErrorResponses, createApiError, deleteSubAgentSkill, getSkillById, getSkillsForSubAgents, getSubAgentById, upsertSubAgentSkill } from "@inkeep/agents-core";
|
|
4
|
+
|
|
5
|
+
//#region src/domains/manage/routes/subAgentSkills.ts
|
|
6
|
+
const app = new OpenAPIHono();
|
|
7
|
+
app.use("/", async (c, next) => {
|
|
8
|
+
if (c.req.method === "POST") return requireProjectPermission("edit")(c, next);
|
|
9
|
+
return next();
|
|
10
|
+
});
|
|
11
|
+
app.use("/agent/:subAgentId/skill/:skillId", async (c, next) => {
|
|
12
|
+
if (c.req.method === "DELETE") return requireProjectPermission("edit")(c, next);
|
|
13
|
+
return next();
|
|
14
|
+
});
|
|
15
|
+
app.openapi(createRoute({
|
|
16
|
+
method: "get",
|
|
17
|
+
path: "/agent/{subAgentId}",
|
|
18
|
+
summary: "List Skills for Sub-Agent",
|
|
19
|
+
operationId: "get-skills-for-subagent",
|
|
20
|
+
tags: ["Skills"],
|
|
21
|
+
request: { params: TenantProjectAgentSubAgentParamsSchema },
|
|
22
|
+
responses: {
|
|
23
|
+
200: {
|
|
24
|
+
description: "Skills retrieved successfully for sub-agent",
|
|
25
|
+
content: { "application/json": { schema: SubAgentSkillWithIndexArrayResponse } }
|
|
26
|
+
},
|
|
27
|
+
...commonGetErrorResponses
|
|
28
|
+
}
|
|
29
|
+
}), async (c) => {
|
|
30
|
+
const { tenantId, projectId, agentId, subAgentId } = c.req.valid("param");
|
|
31
|
+
const skills = await getSkillsForSubAgents(c.get("db"))({
|
|
32
|
+
scopes: {
|
|
33
|
+
tenantId,
|
|
34
|
+
projectId,
|
|
35
|
+
agentId
|
|
36
|
+
},
|
|
37
|
+
subAgentIds: [subAgentId]
|
|
38
|
+
});
|
|
39
|
+
return c.json({ data: skills });
|
|
40
|
+
});
|
|
41
|
+
app.openapi(createRoute({
|
|
42
|
+
method: "post",
|
|
43
|
+
path: "/",
|
|
44
|
+
summary: "Attach Skill to Sub-Agent",
|
|
45
|
+
operationId: "create-subagent-skill",
|
|
46
|
+
tags: ["Skills"],
|
|
47
|
+
request: {
|
|
48
|
+
params: TenantProjectAgentParamsSchema,
|
|
49
|
+
body: { content: { "application/json": { schema: SubAgentSkillApiInsertSchema } } }
|
|
50
|
+
},
|
|
51
|
+
responses: {
|
|
52
|
+
201: {
|
|
53
|
+
description: "Skill attached to sub-agent successfully",
|
|
54
|
+
content: { "application/json": { schema: SubAgentSkillResponse } }
|
|
55
|
+
},
|
|
56
|
+
...commonGetErrorResponses
|
|
57
|
+
}
|
|
58
|
+
}), async (c) => {
|
|
59
|
+
const { tenantId, projectId, agentId } = c.req.valid("param");
|
|
60
|
+
const { subAgentId, skillId, index, alwaysLoaded } = c.req.valid("json");
|
|
61
|
+
const db = c.get("db");
|
|
62
|
+
const [subAgent, skill] = await Promise.all([getSubAgentById(db)({
|
|
63
|
+
scopes: {
|
|
64
|
+
tenantId,
|
|
65
|
+
projectId,
|
|
66
|
+
agentId
|
|
67
|
+
},
|
|
68
|
+
subAgentId
|
|
69
|
+
}), getSkillById(db)({
|
|
70
|
+
scopes: {
|
|
71
|
+
tenantId,
|
|
72
|
+
projectId
|
|
73
|
+
},
|
|
74
|
+
skillId
|
|
75
|
+
})]);
|
|
76
|
+
if (!subAgent) throw createApiError({
|
|
77
|
+
code: "not_found",
|
|
78
|
+
message: `Sub-agent with id '${subAgentId}' not found`
|
|
79
|
+
});
|
|
80
|
+
if (!skill) throw createApiError({
|
|
81
|
+
code: "not_found",
|
|
82
|
+
message: `Skill with id '${skillId}' not found`
|
|
83
|
+
});
|
|
84
|
+
const relation = await upsertSubAgentSkill(db)({
|
|
85
|
+
scopes: {
|
|
86
|
+
tenantId,
|
|
87
|
+
projectId,
|
|
88
|
+
agentId,
|
|
89
|
+
subAgentId
|
|
90
|
+
},
|
|
91
|
+
skillId,
|
|
92
|
+
index,
|
|
93
|
+
alwaysLoaded
|
|
94
|
+
});
|
|
95
|
+
return c.json({ data: relation }, 201);
|
|
96
|
+
});
|
|
97
|
+
app.openapi(createRoute({
|
|
98
|
+
method: "delete",
|
|
99
|
+
path: "/agent/{subAgentId}/skill/{skillId}",
|
|
100
|
+
summary: "Detach Skill from Sub-Agent",
|
|
101
|
+
operationId: "delete-subagent-skill",
|
|
102
|
+
tags: ["Skills"],
|
|
103
|
+
request: { params: TenantProjectAgentParamsSchema.extend({
|
|
104
|
+
subAgentId: z.string(),
|
|
105
|
+
skillId: z.string()
|
|
106
|
+
}) },
|
|
107
|
+
responses: {
|
|
108
|
+
204: { description: "Skill detached successfully" },
|
|
109
|
+
...commonGetErrorResponses
|
|
110
|
+
}
|
|
111
|
+
}), async (c) => {
|
|
112
|
+
const { tenantId, projectId, agentId, subAgentId, skillId } = c.req.valid("param");
|
|
113
|
+
const db = c.get("db");
|
|
114
|
+
const relation = (await getSkillsForSubAgents(db)({
|
|
115
|
+
scopes: {
|
|
116
|
+
tenantId,
|
|
117
|
+
projectId,
|
|
118
|
+
agentId
|
|
119
|
+
},
|
|
120
|
+
subAgentIds: [subAgentId]
|
|
121
|
+
})).find((s) => s.id === skillId);
|
|
122
|
+
if (!relation?.subAgentSkillId) throw createApiError({
|
|
123
|
+
code: "not_found",
|
|
124
|
+
message: "Sub-agent skill relation not found"
|
|
125
|
+
});
|
|
126
|
+
if (!await deleteSubAgentSkill(db)({
|
|
127
|
+
scopes: {
|
|
128
|
+
tenantId,
|
|
129
|
+
projectId,
|
|
130
|
+
agentId
|
|
131
|
+
},
|
|
132
|
+
subAgentSkillId: relation.subAgentSkillId
|
|
133
|
+
})) throw createApiError({
|
|
134
|
+
code: "not_found",
|
|
135
|
+
message: "Sub-agent skill relation not found"
|
|
136
|
+
});
|
|
137
|
+
return c.body(null, 204);
|
|
138
|
+
});
|
|
139
|
+
var subAgentSkills_default = app;
|
|
140
|
+
|
|
141
|
+
//#endregion
|
|
142
|
+
export { subAgentSkills_default 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_types7 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_types7.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_types9 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_types9.BlankEnv, hono_types9.BlankSchema, "/">;
|
|
6
6
|
//#endregion
|
|
7
7
|
export { app as default };
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { SandboxConfig } from "../types/executionContext.js";
|
|
2
2
|
import { StreamHelper } from "../utils/stream-helpers.js";
|
|
3
|
-
import { AgentConversationHistoryConfig, Artifact, ArtifactComponentApiInsert, CredentialStoreRegistry, DataComponentApiInsert, FullExecutionContext, McpTool, MessageContent, Models, ResolvedRef, SubAgentStopWhen } from "@inkeep/agents-core";
|
|
3
|
+
import { AgentConversationHistoryConfig, Artifact, ArtifactComponentApiInsert, CredentialStoreRegistry, DataComponentApiInsert, FullExecutionContext, McpTool, MessageContent, Models, ResolvedRef, SubAgentSkillWithIndex, SubAgentStopWhen } from "@inkeep/agents-core";
|
|
4
4
|
import { FinishReason, StepResult, ToolSet } from "ai";
|
|
5
5
|
|
|
6
6
|
//#region src/domains/run/agents/Agent.d.ts
|
|
@@ -75,6 +75,7 @@ type AgentConfig = {
|
|
|
75
75
|
}>;
|
|
76
76
|
contextConfigId?: string;
|
|
77
77
|
dataComponents?: DataComponentApiInsert[];
|
|
78
|
+
skills?: SubAgentSkillWithIndex[];
|
|
78
79
|
artifactComponents?: ArtifactComponentApiInsert[];
|
|
79
80
|
conversationHistoryConfig?: AgentConversationHistoryConfig;
|
|
80
81
|
models?: Models;
|
|
@@ -1150,15 +1150,18 @@ var Agent = class {
|
|
|
1150
1150
|
const mcpTools = await this.getMcpTools(void 0, streamRequestId);
|
|
1151
1151
|
const functionTools = await this.getFunctionTools(streamRequestId || "");
|
|
1152
1152
|
const relationTools = this.getRelationTools(runtimeContext);
|
|
1153
|
+
const skillTools = this.config.skills?.some((skill) => !skill.alwaysLoaded) ? { load_skill: this.#createLoadSkillTool() } : {};
|
|
1153
1154
|
const allTools = {
|
|
1154
1155
|
...mcpTools,
|
|
1155
1156
|
...functionTools,
|
|
1156
|
-
...relationTools
|
|
1157
|
+
...relationTools,
|
|
1158
|
+
...skillTools
|
|
1157
1159
|
};
|
|
1158
1160
|
logger.info({
|
|
1159
1161
|
mcpTools: Object.keys(mcpTools),
|
|
1160
1162
|
functionTools: Object.keys(functionTools),
|
|
1161
1163
|
relationTools: Object.keys(relationTools),
|
|
1164
|
+
skillTools: Object.keys(skillTools),
|
|
1162
1165
|
allTools: Object.keys(allTools),
|
|
1163
1166
|
functionToolsDetails: Object.entries(functionTools).map(([name, tool$1]) => ({
|
|
1164
1167
|
name,
|
|
@@ -1171,7 +1174,7 @@ var Agent = class {
|
|
|
1171
1174
|
name,
|
|
1172
1175
|
description: tool$1.description || "",
|
|
1173
1176
|
inputSchema: tool$1.inputSchema || tool$1.parameters || {},
|
|
1174
|
-
usageGuidelines: name.startsWith("transfer_to_") || name.startsWith("delegate_to_") ? `Use this tool to ${name.startsWith("transfer_to_") ? "transfer" : "delegate"} to another agent when appropriate.` : "Use this tool when appropriate for the task at hand."
|
|
1177
|
+
usageGuidelines: name === "load_skill" ? "Use this tool to load the full content of an on-demand skill by name." : name.startsWith("transfer_to_") || name.startsWith("delegate_to_") ? `Use this tool to ${name.startsWith("transfer_to_") ? "transfer" : "delegate"} to another agent when appropriate.` : "Use this tool when appropriate for the task at hand."
|
|
1175
1178
|
}));
|
|
1176
1179
|
const { getConversationScopedArtifacts } = await import("../data/conversations.js");
|
|
1177
1180
|
const historyConfig = this.config.conversationHistoryConfig ?? createDefaultConversationHistoryConfig();
|
|
@@ -1211,6 +1214,7 @@ var Agent = class {
|
|
|
1211
1214
|
const config = {
|
|
1212
1215
|
corePrompt: processedPrompt,
|
|
1213
1216
|
prompt,
|
|
1217
|
+
skills: this.config.skills || [],
|
|
1214
1218
|
tools: toolDefinitions,
|
|
1215
1219
|
dataComponents: componentDataComponents,
|
|
1216
1220
|
artifacts: referenceArtifacts,
|
|
@@ -1250,10 +1254,30 @@ var Agent = class {
|
|
|
1250
1254
|
}
|
|
1251
1255
|
});
|
|
1252
1256
|
}
|
|
1257
|
+
#createLoadSkillTool() {
|
|
1258
|
+
return tool({
|
|
1259
|
+
description: "Load an on-demand skill by name and return its full content so you can apply it in this conversation.",
|
|
1260
|
+
inputSchema: z.object({ name: z.string().describe("The skill name from the on-demand skills list.") }),
|
|
1261
|
+
execute: async ({ name }) => {
|
|
1262
|
+
const skill = this.config.skills?.find((item) => item.name === name);
|
|
1263
|
+
if (!skill) throw new Error(`Skill ${name} not found`);
|
|
1264
|
+
return {
|
|
1265
|
+
id: skill.id,
|
|
1266
|
+
name: skill.name,
|
|
1267
|
+
description: skill.description,
|
|
1268
|
+
content: skill.content
|
|
1269
|
+
};
|
|
1270
|
+
}
|
|
1271
|
+
});
|
|
1272
|
+
}
|
|
1253
1273
|
async getDefaultTools(streamRequestId) {
|
|
1254
1274
|
const defaultTools = {};
|
|
1255
1275
|
const compressionConfig = getModelAwareCompressionConfig();
|
|
1256
1276
|
if (await this.agentHasArtifactComponents() || compressionConfig.enabled) defaultTools.get_reference_artifact = this.getArtifactTools();
|
|
1277
|
+
if (this.config.skills?.some((skill) => !skill.alwaysLoaded)) {
|
|
1278
|
+
const loadSkillTool = this.#createLoadSkillTool();
|
|
1279
|
+
if (loadSkillTool) defaultTools.load_skill = this.wrapToolWithStreaming("load_skill", loadSkillTool, streamRequestId, "tool");
|
|
1280
|
+
}
|
|
1257
1281
|
logger.info({
|
|
1258
1282
|
agentId: this.config.id,
|
|
1259
1283
|
streamRequestId
|
|
@@ -4,7 +4,7 @@ import { toolSessionManager } from "./ToolSessionManager.js";
|
|
|
4
4
|
import { agentSessionManager } from "../services/AgentSession.js";
|
|
5
5
|
import { resolveModelConfig } from "../utils/model-resolver.js";
|
|
6
6
|
import { getUserIdFromContext } from "../types/executionContext.js";
|
|
7
|
-
import { enhanceInternalRelation, enhanceTeamRelation, getArtifactComponentsForSubAgent, getDataComponentsForSubAgent, getSubAgentRelations, getToolsForSubAgent } from "../utils/project.js";
|
|
7
|
+
import { enhanceInternalRelation, enhanceTeamRelation, getArtifactComponentsForSubAgent, getDataComponentsForSubAgent, getSkillsForSubAgent, getSubAgentRelations, getToolsForSubAgent } from "../utils/project.js";
|
|
8
8
|
import { buildTransferRelationConfig } from "./relationTools.js";
|
|
9
9
|
import { Agent } from "./Agent.js";
|
|
10
10
|
import { TaskState, generateId, getMcpToolById, withRef } from "@inkeep/agents-core";
|
|
@@ -111,6 +111,7 @@ const createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
111
111
|
return mcpTool;
|
|
112
112
|
}));
|
|
113
113
|
}) ?? [];
|
|
114
|
+
const skills = getSkillsForSubAgent({ subAgent: currentSubAgent });
|
|
114
115
|
agent = new Agent({
|
|
115
116
|
id: config.subAgentId,
|
|
116
117
|
tenantId,
|
|
@@ -124,6 +125,7 @@ const createTaskHandler = (config, credentialStoreRegistry) => {
|
|
|
124
125
|
prompt,
|
|
125
126
|
models: models || void 0,
|
|
126
127
|
stopWhen: stopWhen || void 0,
|
|
128
|
+
skills,
|
|
127
129
|
subAgentRelations: enhancedInternalRelations.map((relation) => ({
|
|
128
130
|
id: relation.id,
|
|
129
131
|
tenantId,
|
|
@@ -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
|