@inkeep/agents-core 0.63.0 → 0.63.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/auth/auth-schema.d.ts +86 -86
  2. package/dist/auth/auth-validation-schemas.d.ts +154 -154
  3. package/dist/auth/permissions.d.ts +9 -9
  4. package/dist/client-exports.d.ts +5 -2
  5. package/dist/client-exports.js +6 -2
  6. package/dist/data-access/index.d.ts +2 -2
  7. package/dist/data-access/index.js +2 -2
  8. package/dist/data-access/manage/agents.d.ts +14 -14
  9. package/dist/data-access/manage/artifactComponents.d.ts +6 -6
  10. package/dist/data-access/manage/contextConfigs.d.ts +4 -4
  11. package/dist/data-access/manage/dataComponents.d.ts +2 -2
  12. package/dist/data-access/manage/functionTools.d.ts +8 -8
  13. package/dist/data-access/manage/projectFull.js +42 -44
  14. package/dist/data-access/manage/skills.d.ts +82 -34
  15. package/dist/data-access/manage/skills.js +259 -46
  16. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  17. package/dist/data-access/manage/subAgentRelations.d.ts +12 -12
  18. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
  19. package/dist/data-access/manage/subAgents.d.ts +6 -6
  20. package/dist/data-access/manage/tools.d.ts +21 -21
  21. package/dist/data-access/manage/triggers.d.ts +2 -2
  22. package/dist/data-access/runtime/apiKeys.d.ts +8 -8
  23. package/dist/data-access/runtime/apps.d.ts +8 -8
  24. package/dist/data-access/runtime/conversations.d.ts +24 -24
  25. package/dist/data-access/runtime/messages.d.ts +21 -21
  26. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
  27. package/dist/data-access/runtime/tasks.d.ts +6 -6
  28. package/dist/db/manage/manage-schema.d.ts +503 -344
  29. package/dist/db/manage/manage-schema.js +52 -2
  30. package/dist/db/runtime/runtime-schema.d.ts +369 -369
  31. package/dist/index.d.ts +8 -5
  32. package/dist/index.js +7 -4
  33. package/dist/types/entities.d.ts +11 -2
  34. package/dist/types/index.d.ts +2 -2
  35. package/dist/utils/error.d.ts +51 -51
  36. package/dist/utils/index.d.ts +2 -1
  37. package/dist/utils/index.js +2 -1
  38. package/dist/utils/skill-files.d.ts +17 -0
  39. package/dist/utils/skill-files.js +29 -0
  40. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  41. package/dist/validation/drizzle-schema-helpers.js +1 -2
  42. package/dist/validation/index.d.ts +4 -2
  43. package/dist/validation/index.js +4 -2
  44. package/dist/validation/schemas/shared.d.ts +38 -0
  45. package/dist/validation/schemas/shared.js +63 -0
  46. package/dist/validation/schemas/skills.d.ts +602 -0
  47. package/dist/validation/schemas/skills.js +128 -0
  48. package/dist/validation/schemas.d.ts +2635 -3171
  49. package/dist/validation/schemas.js +4 -109
  50. package/drizzle/manage/0014_complex_firebird.sql +15 -0
  51. package/drizzle/manage/0015_backfill_skill_files.sql +61 -0
  52. package/drizzle/manage/meta/0014_snapshot.json +3821 -0
  53. package/drizzle/manage/meta/0015_snapshot.json +3821 -0
  54. package/drizzle/manage/meta/_journal.json +14 -0
  55. 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 };