@inkeep/agents-core 0.63.1 → 0.63.3
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/auth/permissions.d.ts +9 -9
- package/dist/client-exports.d.ts +5 -2
- package/dist/client-exports.js +6 -2
- package/dist/data-access/index.d.ts +2 -2
- package/dist/data-access/index.js +2 -2
- package/dist/data-access/manage/agents.d.ts +34 -34
- package/dist/data-access/manage/artifactComponents.d.ts +12 -12
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/dataComponents.d.ts +6 -6
- package/dist/data-access/manage/functionTools.d.ts +16 -16
- package/dist/data-access/manage/projectFull.js +42 -44
- package/dist/data-access/manage/skills.d.ts +84 -36
- package/dist/data-access/manage/skills.js +259 -46
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentRelations.d.ts +32 -32
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgents.d.ts +18 -18
- package/dist/data-access/manage/tools.d.ts +24 -24
- package/dist/data-access/manage/triggers.d.ts +1 -1
- package/dist/data-access/runtime/apiKeys.d.ts +12 -12
- package/dist/data-access/runtime/apps.d.ts +16 -16
- package/dist/data-access/runtime/conversations.d.ts +24 -24
- package/dist/data-access/runtime/messages.d.ts +12 -12
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
- package/dist/data-access/runtime/tasks.d.ts +5 -5
- package/dist/db/manage/manage-schema.d.ts +163 -4
- package/dist/db/manage/manage-schema.js +52 -2
- package/dist/db/runtime/runtime-schema.d.ts +371 -371
- package/dist/index.d.ts +8 -5
- package/dist/index.js +7 -4
- package/dist/types/entities.d.ts +11 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/skill-files.d.ts +17 -0
- package/dist/utils/skill-files.js +29 -0
- package/dist/validation/drizzle-schema-helpers.js +1 -2
- package/dist/validation/index.d.ts +4 -2
- package/dist/validation/index.js +4 -2
- package/dist/validation/schemas/shared.d.ts +38 -0
- package/dist/validation/schemas/shared.js +63 -0
- package/dist/validation/schemas/skills.d.ts +602 -0
- package/dist/validation/schemas/skills.js +128 -0
- package/dist/validation/schemas.d.ts +1540 -2076
- package/dist/validation/schemas.js +4 -109
- package/drizzle/manage/0014_complex_firebird.sql +15 -0
- package/drizzle/manage/0015_backfill_skill_files.sql +61 -0
- package/drizzle/manage/meta/0014_snapshot.json +3821 -0
- package/drizzle/manage/meta/0015_snapshot.json +3821 -0
- package/drizzle/manage/meta/_journal.json +14 -0
- package/package.json +4 -2
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
import { skillFiles, skills, subAgentSkills } from "../../db/manage/manage-schema.js";
|
|
2
|
+
import { PaginationSchema, ResourceIdSchema, StringRecordSchema, createAgentScopedApiSchema, createAgentScopedApiUpdateSchema, createApiSchema } from "./shared.js";
|
|
3
|
+
import { createInsertSchema, createSelectSchema } from "../drizzle-schema-helpers.js";
|
|
4
|
+
import { SKILL_ENTRY_FILE_PATH, parseSkillFromMarkdown } from "../../utils/skill-files.js";
|
|
5
|
+
import { z } from "@hono/zod-openapi";
|
|
6
|
+
|
|
7
|
+
//#region src/validation/schemas/skills.ts
|
|
8
|
+
const SkillIndexSchema = z.int().min(0);
|
|
9
|
+
const SkillFrontmatterSchema = z.looseObject({
|
|
10
|
+
name: z.string().trim().nonempty().max(64).regex(/^[a-z0-9-]+$/, "May only contain lowercase alphanumeric characters and hyphens (a-z, 0-9, -)").refine((v) => !(v.startsWith("-") || v.endsWith("-")), "Must not start or end with a hyphen (-)").refine((v) => !v.includes("--"), "Must not contain consecutive hyphens (--)").refine((v) => v !== "new", "Must not use a reserved name \"new\""),
|
|
11
|
+
description: z.string().trim().nonempty().max(1024),
|
|
12
|
+
metadata: StringRecordSchema.nullish()
|
|
13
|
+
});
|
|
14
|
+
const SkillFilePathSchema = z.string().trim().nonempty().max(1024).refine((value) => !value.startsWith("/"), "Must be a relative file path").refine((value) => !value.includes("\\"), "Must use forward slashes (/) in file paths").refine((value) => value.split("/").every((segment) => segment !== "" && segment !== "." && segment !== ".."), "Must not contain empty, \".\", or \"..\" path segments");
|
|
15
|
+
const SkillSelectSchema = createSelectSchema(skills).extend({ metadata: StringRecordSchema.nullable() });
|
|
16
|
+
const SkillFileContentInputSchema = z.object({
|
|
17
|
+
filePath: SkillFilePathSchema,
|
|
18
|
+
content: z.string()
|
|
19
|
+
});
|
|
20
|
+
function addDuplicateSkillFilePathIssues(files, ctx) {
|
|
21
|
+
const filePaths = /* @__PURE__ */ new Set();
|
|
22
|
+
for (const [index, file] of files.entries()) {
|
|
23
|
+
if (filePaths.has(file.filePath)) ctx.addIssue({
|
|
24
|
+
code: "custom",
|
|
25
|
+
path: [index, "filePath"],
|
|
26
|
+
message: `Duplicate skill file path: ${file.filePath}`
|
|
27
|
+
});
|
|
28
|
+
filePaths.add(file.filePath);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
const SkillUpdateFilesInputSchema = z.array(SkillFileContentInputSchema).superRefine(addDuplicateSkillFilePathIssues);
|
|
32
|
+
const SkillFilesInputSchema = z.array(SkillFileContentInputSchema).superRefine((files, ctx) => {
|
|
33
|
+
addDuplicateSkillFilePathIssues(files, ctx);
|
|
34
|
+
if (!files.some((file) => file.filePath === SKILL_ENTRY_FILE_PATH)) ctx.addIssue({
|
|
35
|
+
code: "custom",
|
|
36
|
+
message: `Skill files must include exactly one ${SKILL_ENTRY_FILE_PATH}`
|
|
37
|
+
});
|
|
38
|
+
});
|
|
39
|
+
const SkillFileSelectSchema = createSelectSchema(skillFiles);
|
|
40
|
+
const SkillFileInsertSchema = createInsertSchema(skillFiles).extend({
|
|
41
|
+
id: ResourceIdSchema,
|
|
42
|
+
skillId: ResourceIdSchema,
|
|
43
|
+
filePath: SkillFilePathSchema,
|
|
44
|
+
content: z.string()
|
|
45
|
+
});
|
|
46
|
+
const SkillInsertSchema = createInsertSchema(skills).extend({
|
|
47
|
+
...SkillFrontmatterSchema.shape,
|
|
48
|
+
content: z.string().trim()
|
|
49
|
+
}).omit({
|
|
50
|
+
id: true,
|
|
51
|
+
createdAt: true,
|
|
52
|
+
updatedAt: true,
|
|
53
|
+
projectId: true,
|
|
54
|
+
tenantId: true
|
|
55
|
+
});
|
|
56
|
+
const SkillCreateDataSchema = z.strictObject({
|
|
57
|
+
...SkillInsertSchema.shape,
|
|
58
|
+
metadata: SkillInsertSchema.shape.metadata.unwrap(),
|
|
59
|
+
files: SkillFilesInputSchema
|
|
60
|
+
});
|
|
61
|
+
const SkillUpdateSchema = z.object({ files: SkillUpdateFilesInputSchema });
|
|
62
|
+
function transformSkill(markdown) {
|
|
63
|
+
const { frontmatter, content } = parseSkillFromMarkdown(markdown);
|
|
64
|
+
const { name, description, metadata = null } = frontmatter;
|
|
65
|
+
return {
|
|
66
|
+
name,
|
|
67
|
+
description,
|
|
68
|
+
metadata,
|
|
69
|
+
content
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
const SkillApiSelectSchema = createApiSchema(SkillSelectSchema).openapi("Skill");
|
|
73
|
+
const SkillApiInsertSchema = z.object({ files: SkillFilesInputSchema }).transform((skill) => {
|
|
74
|
+
const skillFile = skill.files.find((file) => file.filePath === SKILL_ENTRY_FILE_PATH);
|
|
75
|
+
if (!skillFile) throw new Error("should never happen");
|
|
76
|
+
const extracted = transformSkill(skillFile.content);
|
|
77
|
+
return {
|
|
78
|
+
...skill,
|
|
79
|
+
...extracted
|
|
80
|
+
};
|
|
81
|
+
}).pipe(SkillCreateDataSchema).openapi("SkillCreate");
|
|
82
|
+
const SkillApiUpdateSchema = SkillUpdateSchema.transform((skill) => {
|
|
83
|
+
const skillFile = skill.files?.find((file) => file.filePath === SKILL_ENTRY_FILE_PATH);
|
|
84
|
+
if (!skillFile) return { files: [] };
|
|
85
|
+
return {
|
|
86
|
+
...skill,
|
|
87
|
+
...transformSkill(skillFile.content)
|
|
88
|
+
};
|
|
89
|
+
}).pipe(SkillCreateDataSchema.extend({ files: SkillUpdateFilesInputSchema }).partial().required({ files: true })).openapi("SkillUpdate");
|
|
90
|
+
const SkillFileApiSelectSchema = createApiSchema(SkillFileSelectSchema).openapi("SkillFile");
|
|
91
|
+
const SkillFileApiInsertSchema = SkillFileContentInputSchema.openapi("SkillFileCreate");
|
|
92
|
+
const SkillFileApiUpdateSchema = z.object({ content: z.string() }).openapi("SkillFileUpdate");
|
|
93
|
+
const SkillWithFilesApiSelectSchema = SkillApiSelectSchema.extend({ files: z.array(SkillFileApiSelectSchema) }).openapi("SkillWithFiles");
|
|
94
|
+
const SubAgentSkillSelectSchema = createSelectSchema(subAgentSkills).extend({ index: SkillIndexSchema });
|
|
95
|
+
const SubAgentSkillInsertSchema = createInsertSchema(subAgentSkills).extend({
|
|
96
|
+
id: ResourceIdSchema,
|
|
97
|
+
subAgentId: ResourceIdSchema,
|
|
98
|
+
skillId: ResourceIdSchema,
|
|
99
|
+
index: SkillIndexSchema,
|
|
100
|
+
alwaysLoaded: z.boolean().optional().default(false)
|
|
101
|
+
});
|
|
102
|
+
const SubAgentSkillUpdateSchema = SubAgentSkillInsertSchema.partial();
|
|
103
|
+
const SubAgentSkillApiSelectSchema = createAgentScopedApiSchema(SubAgentSkillSelectSchema).openapi("SubAgentSkill");
|
|
104
|
+
const SubAgentSkillApiInsertSchema = SubAgentSkillInsertSchema.omit({
|
|
105
|
+
tenantId: true,
|
|
106
|
+
projectId: true,
|
|
107
|
+
id: true,
|
|
108
|
+
createdAt: true,
|
|
109
|
+
updatedAt: true
|
|
110
|
+
}).openapi("SubAgentSkillCreate");
|
|
111
|
+
const SubAgentSkillApiUpdateSchema = createAgentScopedApiUpdateSchema(SubAgentSkillUpdateSchema).openapi("SubAgentSkillUpdate");
|
|
112
|
+
const SubAgentSkillWithIndexSchema = SkillApiSelectSchema.extend({
|
|
113
|
+
subAgentSkillId: ResourceIdSchema,
|
|
114
|
+
subAgentId: ResourceIdSchema,
|
|
115
|
+
index: SkillIndexSchema,
|
|
116
|
+
alwaysLoaded: z.boolean()
|
|
117
|
+
}).openapi("SubAgentSkillWithIndex");
|
|
118
|
+
const SkillFileResponse = z.object({ data: SkillFileApiSelectSchema }).openapi("SkillFileResponse");
|
|
119
|
+
const SkillWithFilesResponse = z.object({ data: SkillWithFilesApiSelectSchema }).openapi("SkillWithFilesResponse");
|
|
120
|
+
const SkillListResponse = z.object({
|
|
121
|
+
data: z.array(SkillApiSelectSchema),
|
|
122
|
+
pagination: PaginationSchema
|
|
123
|
+
}).openapi("SkillListResponse");
|
|
124
|
+
const SubAgentSkillResponse = z.object({ data: SubAgentSkillApiSelectSchema }).openapi("SubAgentSkillResponse");
|
|
125
|
+
const SubAgentSkillWithIndexArrayResponse = z.object({ data: z.array(SubAgentSkillWithIndexSchema) }).openapi("SubAgentSkillWithIndexArrayResponse");
|
|
126
|
+
|
|
127
|
+
//#endregion
|
|
128
|
+
export { SkillApiInsertSchema, SkillApiSelectSchema, SkillApiUpdateSchema, SkillFileApiInsertSchema, SkillFileApiSelectSchema, SkillFileApiUpdateSchema, SkillFileContentInputSchema, SkillFileInsertSchema, SkillFileResponse, SkillFileSelectSchema, SkillFrontmatterSchema, SkillIndexSchema, SkillInsertSchema, SkillListResponse, SkillSelectSchema, SkillUpdateSchema, SkillWithFilesApiSelectSchema, SkillWithFilesResponse, SubAgentSkillApiInsertSchema, SubAgentSkillApiSelectSchema, SubAgentSkillApiUpdateSchema, SubAgentSkillInsertSchema, SubAgentSkillResponse, SubAgentSkillSelectSchema, SubAgentSkillUpdateSchema, SubAgentSkillWithIndexArrayResponse, SubAgentSkillWithIndexSchema };
|