@inkeep/agents-core 0.47.5 → 0.48.1

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 (72) hide show
  1. package/README.md +1 -1
  2. package/dist/auth/auth-schema.d.ts +83 -83
  3. package/dist/auth/auth-validation-schemas.d.ts +148 -148
  4. package/dist/auth/auth.d.ts +5 -5
  5. package/dist/client-exports.d.ts +13 -2
  6. package/dist/client-exports.js +5 -4
  7. package/dist/data-access/index.d.ts +6 -1
  8. package/dist/data-access/index.js +6 -1
  9. package/dist/data-access/manage/agentFull.js +154 -1
  10. package/dist/data-access/manage/agents.d.ts +4 -4
  11. package/dist/data-access/manage/agents.js +56 -4
  12. package/dist/data-access/manage/artifactComponents.d.ts +41 -5
  13. package/dist/data-access/manage/functionTools.d.ts +3 -3
  14. package/dist/data-access/manage/projectFull.js +97 -0
  15. package/dist/data-access/manage/scheduledTriggers.d.ts +80 -0
  16. package/dist/data-access/manage/scheduledTriggers.js +76 -0
  17. package/dist/data-access/manage/scheduledWorkflows.d.ts +29 -0
  18. package/dist/data-access/manage/scheduledWorkflows.js +32 -0
  19. package/dist/data-access/manage/skills.d.ts +109 -0
  20. package/dist/data-access/manage/skills.js +122 -0
  21. package/dist/data-access/manage/tools.d.ts +4 -4
  22. package/dist/data-access/manage/triggers.d.ts +2 -2
  23. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +233 -0
  24. package/dist/data-access/runtime/scheduledTriggerInvocations.js +226 -0
  25. package/dist/data-access/runtime/workAppSlack.d.ts +55 -0
  26. package/dist/data-access/runtime/workAppSlack.js +146 -0
  27. package/dist/db/manage/manage-schema.d.ts +1519 -589
  28. package/dist/db/manage/manage-schema.js +240 -15
  29. package/dist/db/runtime/runtime-schema.d.ts +1236 -234
  30. package/dist/db/runtime/runtime-schema.js +108 -3
  31. package/dist/index.d.ts +15 -6
  32. package/dist/index.js +13 -5
  33. package/dist/types/entities.d.ts +15 -2
  34. package/dist/types/index.d.ts +2 -2
  35. package/dist/utils/index.d.ts +5 -2
  36. package/dist/utils/index.js +5 -2
  37. package/dist/utils/slack-link-token.d.ts +57 -0
  38. package/dist/utils/slack-link-token.js +112 -0
  39. package/dist/utils/slack-user-token.d.ts +65 -0
  40. package/dist/utils/slack-user-token.js +129 -0
  41. package/dist/utils/sse-parser.d.ts +35 -0
  42. package/dist/utils/sse-parser.js +71 -0
  43. package/dist/utils/tracer-factory.d.ts +11 -2
  44. package/dist/utils/tracer-factory.js +24 -5
  45. package/dist/utils/tracer.d.ts +2 -2
  46. package/dist/utils/tracer.js +2 -2
  47. package/dist/utils/trigger-auth.d.ts +1 -1
  48. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  49. package/dist/validation/extend-schemas.d.ts +34 -0
  50. package/dist/validation/extend-schemas.js +33 -0
  51. package/dist/validation/index.d.ts +2 -2
  52. package/dist/validation/index.js +2 -2
  53. package/dist/validation/json-schemas.d.ts +28 -0
  54. package/dist/validation/json-schemas.js +56 -0
  55. package/dist/validation/schemas.d.ts +4930 -1640
  56. package/dist/validation/schemas.js +159 -38
  57. package/dist/validation/stream-event-schemas.d.ts +0 -2
  58. package/dist/validation/stream-event-schemas.js +1 -2
  59. package/drizzle/manage/0007_nice_lilandra.sql +3 -0
  60. package/drizzle/manage/0008_friendly_mentallo.sql +32 -0
  61. package/drizzle/manage/0009_chilly_old_lace.sql +39 -0
  62. package/drizzle/manage/meta/0007_snapshot.json +3148 -0
  63. package/drizzle/manage/meta/0008_snapshot.json +3391 -0
  64. package/drizzle/manage/meta/0009_snapshot.json +3670 -0
  65. package/drizzle/manage/meta/_journal.json +21 -0
  66. package/drizzle/runtime/0012_greedy_hulk.sql +84 -0
  67. package/drizzle/runtime/0013_huge_white_queen.sql +19 -0
  68. package/drizzle/runtime/meta/0007_snapshot.json +1 -1
  69. package/drizzle/runtime/meta/0012_snapshot.json +3622 -0
  70. package/drizzle/runtime/meta/0013_snapshot.json +3746 -0
  71. package/drizzle/runtime/meta/_journal.json +14 -0
  72. package/package.json +1 -1
@@ -1,9 +1,11 @@
1
- import { projects, subAgentFunctionToolRelations, subAgentToolRelations, subAgents } from "../../db/manage/manage-schema.js";
1
+ import { projects, subAgentFunctionToolRelations, subAgentSkills, subAgentToolRelations, subAgents } from "../../db/manage/manage-schema.js";
2
2
  import { validateAgentStructure, validateAndTypeAgentData } from "../../validation/agentFull.js";
3
3
  import { generateId } from "../../utils/conversations.js";
4
4
  import { upsertContextConfig } from "./contextConfigs.js";
5
5
  import { upsertFunction } from "./functions.js";
6
6
  import { deleteFunctionTool, listFunctionTools, upsertFunctionTool, upsertSubAgentFunctionToolRelation } from "./functionTools.js";
7
+ import { deleteScheduledTrigger, listScheduledTriggers, upsertScheduledTrigger } from "./scheduledTriggers.js";
8
+ import { upsertSubAgentSkill } from "./skills.js";
7
9
  import { deleteSubAgentExternalAgentRelation, getSubAgentExternalAgentRelationsByAgent, upsertSubAgentExternalAgentRelation } from "./subAgentExternalAgentRelations.js";
8
10
  import { createSubAgentRelation, deleteAgentRelationsByAgent, deleteAgentToolRelationByAgent, upsertSubAgentRelation } from "./subAgentRelations.js";
9
11
  import { deleteSubAgent, listSubAgents, upsertSubAgent } from "./subAgents.js";
@@ -20,6 +22,32 @@ const defaultLogger = {
20
22
  info: () => {},
21
23
  error: () => {}
22
24
  };
25
+ async function syncSubAgentSkills(db, scopes, subAgentsMap, logger) {
26
+ await db.delete(subAgentSkills).where(and(eq(subAgentSkills.tenantId, scopes.tenantId), eq(subAgentSkills.projectId, scopes.projectId), eq(subAgentSkills.agentId, scopes.agentId)));
27
+ const skillPromises = [];
28
+ for (const [subAgentId, subAgentData] of Object.entries(subAgentsMap)) {
29
+ if (!subAgentData.skills || subAgentData.skills.length === 0) continue;
30
+ subAgentData.skills.forEach((skill) => {
31
+ if (!skill.id) return;
32
+ skillPromises.push(upsertSubAgentSkill(db)({
33
+ scopes: {
34
+ tenantId: scopes.tenantId,
35
+ projectId: scopes.projectId,
36
+ agentId: scopes.agentId,
37
+ subAgentId
38
+ },
39
+ skillId: skill.id,
40
+ index: skill.index,
41
+ alwaysLoaded: skill.alwaysLoaded
42
+ }));
43
+ });
44
+ }
45
+ await Promise.all(skillPromises);
46
+ logger.info({
47
+ agentId: scopes.agentId,
48
+ count: skillPromises.length
49
+ }, "Synced sub-agent skills");
50
+ }
23
51
  /**
24
52
  * Apply execution limits inheritance from project to Agents and Sub Agents
25
53
  */
@@ -291,6 +319,50 @@ const createFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
291
319
  triggerCount: Object.keys(typed.triggers).length
292
320
  }, "All triggers created successfully");
293
321
  }
322
+ if (typed.scheduledTriggers && Object.keys(typed.scheduledTriggers).length > 0) {
323
+ logger.info({
324
+ agentId: finalAgentId,
325
+ scheduledTriggerCount: Object.keys(typed.scheduledTriggers).length
326
+ }, "Creating scheduled triggers for agent");
327
+ const scheduledTriggerPromises = Object.entries(typed.scheduledTriggers).map(async ([scheduledTriggerId, scheduledTriggerData]) => {
328
+ try {
329
+ logger.info({
330
+ agentId: finalAgentId,
331
+ scheduledTriggerId
332
+ }, "Creating scheduled trigger in agent");
333
+ await upsertScheduledTrigger(db)({
334
+ scopes: {
335
+ tenantId,
336
+ projectId,
337
+ agentId: finalAgentId
338
+ },
339
+ data: {
340
+ ...scheduledTriggerData,
341
+ id: scheduledTriggerId,
342
+ tenantId,
343
+ projectId,
344
+ agentId: finalAgentId
345
+ }
346
+ });
347
+ logger.info({
348
+ agentId: finalAgentId,
349
+ scheduledTriggerId
350
+ }, "Scheduled trigger created successfully");
351
+ } catch (error) {
352
+ logger.error({
353
+ agentId: finalAgentId,
354
+ scheduledTriggerId,
355
+ error
356
+ }, "Failed to create scheduled trigger in agent");
357
+ throw error;
358
+ }
359
+ });
360
+ await Promise.all(scheduledTriggerPromises);
361
+ logger.info({
362
+ agentId: finalAgentId,
363
+ scheduledTriggerCount: Object.keys(typed.scheduledTriggers).length
364
+ }, "All scheduled triggers created successfully");
365
+ }
294
366
  const subAgentPromises = Object.entries(typed.subAgents).map(async ([subAgentId, agentData$1]) => {
295
367
  const subAgent = agentData$1;
296
368
  try {
@@ -569,6 +641,11 @@ const createFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
569
641
  await Promise.all(subAgentRelationPromises);
570
642
  await Promise.all(subAgentExternalAgentRelationPromises);
571
643
  await Promise.all(subAgentTeamAgentRelationPromises);
644
+ await syncSubAgentSkills(db, {
645
+ tenantId,
646
+ projectId,
647
+ agentId: finalAgentId
648
+ }, typed.subAgents, logger);
572
649
  logger.info({ subAgentRelationCount: subAgentRelationPromises.length }, "All sub-agent relations created");
573
650
  logger.info({ subAgentExternalAgentRelationCount: subAgentExternalAgentRelationPromises.length }, "All sub-agent external agent relations created");
574
651
  logger.info({ subAgentTeamAgentRelationCount: subAgentTeamAgentRelationPromises.length }, "All sub-agent team agent relations created");
@@ -883,6 +960,77 @@ const updateFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
883
960
  }
884
961
  if (deletedTriggerCount > 0) logger.info({ deletedTriggerCount }, "Deleted orphaned triggers from agent");
885
962
  }
963
+ if (typedAgentDefinition.scheduledTriggers && Object.keys(typedAgentDefinition.scheduledTriggers).length > 0) {
964
+ logger.info({
965
+ agentId: finalAgentId,
966
+ scheduledTriggerCount: Object.keys(typedAgentDefinition.scheduledTriggers).length
967
+ }, "Updating scheduled triggers for agent");
968
+ const scheduledTriggerPromises = Object.entries(typedAgentDefinition.scheduledTriggers).map(async ([scheduledTriggerId, scheduledTriggerData]) => {
969
+ try {
970
+ logger.info({
971
+ agentId: finalAgentId,
972
+ scheduledTriggerId
973
+ }, "Updating scheduled trigger in agent");
974
+ await upsertScheduledTrigger(db)({
975
+ scopes: {
976
+ tenantId,
977
+ projectId,
978
+ agentId: finalAgentId
979
+ },
980
+ data: {
981
+ ...scheduledTriggerData,
982
+ id: scheduledTriggerId,
983
+ tenantId,
984
+ projectId,
985
+ agentId: finalAgentId
986
+ }
987
+ });
988
+ logger.info({
989
+ agentId: finalAgentId,
990
+ scheduledTriggerId
991
+ }, "Scheduled trigger updated successfully");
992
+ } catch (error) {
993
+ logger.error({
994
+ agentId: finalAgentId,
995
+ scheduledTriggerId,
996
+ error
997
+ }, "Failed to update scheduled trigger in agent");
998
+ throw error;
999
+ }
1000
+ });
1001
+ await Promise.all(scheduledTriggerPromises);
1002
+ logger.info({
1003
+ agentId: finalAgentId,
1004
+ scheduledTriggerCount: Object.keys(typedAgentDefinition.scheduledTriggers).length
1005
+ }, "All scheduled triggers updated successfully");
1006
+ }
1007
+ if (typedAgentDefinition.scheduledTriggers !== void 0) {
1008
+ const incomingScheduledTriggerIds = new Set(Object.keys(typedAgentDefinition.scheduledTriggers));
1009
+ const existingScheduledTriggers = await listScheduledTriggers(db)({ scopes: {
1010
+ tenantId,
1011
+ projectId,
1012
+ agentId: finalAgentId
1013
+ } });
1014
+ let deletedScheduledTriggerCount = 0;
1015
+ for (const scheduledTrigger of existingScheduledTriggers) if (!incomingScheduledTriggerIds.has(scheduledTrigger.id)) try {
1016
+ await deleteScheduledTrigger(db)({
1017
+ scopes: {
1018
+ tenantId,
1019
+ projectId,
1020
+ agentId: finalAgentId
1021
+ },
1022
+ scheduledTriggerId: scheduledTrigger.id
1023
+ });
1024
+ deletedScheduledTriggerCount++;
1025
+ logger.info({ scheduledTriggerId: scheduledTrigger.id }, "Deleted orphaned scheduled trigger");
1026
+ } catch (error) {
1027
+ logger.error({
1028
+ scheduledTriggerId: scheduledTrigger.id,
1029
+ error
1030
+ }, "Failed to delete orphaned scheduled trigger");
1031
+ }
1032
+ if (deletedScheduledTriggerCount > 0) logger.info({ deletedScheduledTriggerCount }, "Deleted orphaned scheduled triggers from agent");
1033
+ }
886
1034
  const subAgentPromises = Object.entries(typedAgentDefinition.subAgents).map(async ([subAgentId, agentData$1]) => {
887
1035
  const subAgent = agentData$1;
888
1036
  let existingSubAgent = null;
@@ -1365,6 +1513,11 @@ const updateFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
1365
1513
  logger.info({ subAgentExternalAgentRelationPromisesCount: subAgentExternalAgentRelationPromises.length }, "All sub-agent external agent relations updated");
1366
1514
  await Promise.all(subAgentTeamAgentRelationPromises);
1367
1515
  logger.info({ subAgentTeamAgentRelationPromisesCount: subAgentTeamAgentRelationPromises.length }, "All sub-agent team agent relations updated");
1516
+ await syncSubAgentSkills(db, {
1517
+ tenantId,
1518
+ projectId,
1519
+ agentId: typedAgentDefinition.id
1520
+ }, typedAgentDefinition.subAgents, logger);
1368
1521
  const updatedAgent = await getFullAgentDefinition(db)({ scopes: {
1369
1522
  tenantId,
1370
1523
  projectId,
@@ -179,8 +179,6 @@ declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params:
179
179
  data: {
180
180
  createdAt: string;
181
181
  updatedAt: string;
182
- name: string;
183
- description: string | null;
184
182
  defaultSubAgentId: string | null;
185
183
  contextConfigId: string | null;
186
184
  models: {
@@ -216,6 +214,8 @@ declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params:
216
214
  stopWhen: {
217
215
  transferCountIs?: number | undefined;
218
216
  } | null;
217
+ name: string;
218
+ description: string | null;
219
219
  projectId: string;
220
220
  tenantId: string;
221
221
  id: string;
@@ -294,8 +294,6 @@ declare const updateAgent: (db: AgentsManageDatabaseClient) => (params: {
294
294
  }) => Promise<{
295
295
  createdAt: string;
296
296
  updatedAt: string;
297
- name: string;
298
- description: string | null;
299
297
  defaultSubAgentId: string | null;
300
298
  contextConfigId: string | null;
301
299
  models: {
@@ -331,6 +329,8 @@ declare const updateAgent: (db: AgentsManageDatabaseClient) => (params: {
331
329
  stopWhen: {
332
330
  transferCountIs?: number | undefined;
333
331
  } | null;
332
+ name: string;
333
+ description: string | null;
334
334
  projectId: string;
335
335
  tenantId: string;
336
336
  id: string;
@@ -6,6 +6,8 @@ import { getContextConfigById } from "./contextConfigs.js";
6
6
  import { getExternalAgent } from "./externalAgents.js";
7
7
  import { getFunction } from "./functions.js";
8
8
  import { listFunctionTools } from "./functionTools.js";
9
+ import { listScheduledTriggers } from "./scheduledTriggers.js";
10
+ import { getSkillsForSubAgents } from "./skills.js";
9
11
  import { getSubAgentExternalAgentRelationsByAgent } from "./subAgentExternalAgentRelations.js";
10
12
  import { getAgentRelations, getAgentRelationsByAgent } from "./subAgentRelations.js";
11
13
  import { getSubAgentById } from "./subAgents.js";
@@ -162,6 +164,7 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
162
164
  agentId
163
165
  } });
164
166
  const agentSubAgents = await db.query.subAgents.findMany({ where: and(eq(subAgents.tenantId, tenantId), eq(subAgents.projectId, projectId), eq(subAgents.agentId, agentId)) });
167
+ const subAgentIds = agentSubAgents.map((subAgent) => subAgent.id);
165
168
  const externalAgentRelations = await getSubAgentExternalAgentRelationsByAgent(db)({ scopes: {
166
169
  tenantId,
167
170
  projectId,
@@ -176,6 +179,31 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
176
179
  for (const relation of teamAgentRelations) teamAgentSubAgentIds.add(relation.targetAgentId);
177
180
  const externalSubAgentIds = /* @__PURE__ */ new Set();
178
181
  for (const relation of externalAgentRelations) externalSubAgentIds.add(relation.externalAgentId);
182
+ const subAgentSkillsList = await getSkillsForSubAgents(db)({
183
+ scopes: {
184
+ tenantId,
185
+ projectId,
186
+ agentId
187
+ },
188
+ subAgentIds
189
+ });
190
+ const skillsBySubAgent = {};
191
+ for (const skill of subAgentSkillsList) {
192
+ skillsBySubAgent[skill.subAgentId] ??= [];
193
+ skillsBySubAgent[skill.subAgentId].push({
194
+ id: skill.id,
195
+ name: skill.name,
196
+ description: skill.description,
197
+ content: skill.content,
198
+ metadata: skill.metadata,
199
+ index: skill.index,
200
+ alwaysLoaded: skill.alwaysLoaded,
201
+ subAgentSkillId: skill.subAgentSkillId,
202
+ subAgentId: skill.subAgentId,
203
+ createdAt: skill.createdAt,
204
+ updatedAt: skill.updatedAt
205
+ });
206
+ }
179
207
  const processedSubAgents = await Promise.all(agentSubAgents.map(async (agent$1) => {
180
208
  if (!agent$1) return null;
181
209
  const subAgentRelationsList = agentRelations.filter((relation) => relation.sourceSubAgentId === agent$1.id);
@@ -258,6 +286,7 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
258
286
  stopWhen: agent$1.stopWhen,
259
287
  canTransferTo,
260
288
  canDelegateTo,
289
+ skills: skillsBySubAgent[agent$1.id] || [],
261
290
  dataComponents: agentDataComponentIds,
262
291
  artifactComponents: agentArtifactComponentIds,
263
292
  canUse
@@ -321,8 +350,6 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
321
350
  console.warn(`Failed to retrieve contextConfig ${agent.contextConfigId}:`, error);
322
351
  }
323
352
  try {
324
- const internalAgentIds = agentSubAgents.map((subAgent) => subAgent.id);
325
- const subAgentIds = Array.from(internalAgentIds);
326
353
  await fetchComponentRelationships(db)({
327
354
  tenantId,
328
355
  projectId
@@ -343,8 +370,6 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
343
370
  console.warn("Failed to retrieve dataComponents:", error);
344
371
  }
345
372
  try {
346
- const internalAgentIds = agentSubAgents.map((subAgent) => subAgent.id);
347
- const subAgentIds = Array.from(internalAgentIds);
348
373
  await fetchComponentRelationships(db)({
349
374
  tenantId,
350
375
  projectId
@@ -516,6 +541,33 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
516
541
  } catch (error) {
517
542
  console.warn("Failed to load triggers:", error);
518
543
  }
544
+ try {
545
+ const scheduledTriggersList = await listScheduledTriggers(db)({ scopes: {
546
+ tenantId,
547
+ projectId,
548
+ agentId
549
+ } });
550
+ if (scheduledTriggersList.length > 0) {
551
+ const scheduledTriggersObject = {};
552
+ for (const scheduledTrigger of scheduledTriggersList) scheduledTriggersObject[scheduledTrigger.id] = {
553
+ id: scheduledTrigger.id,
554
+ name: scheduledTrigger.name,
555
+ description: scheduledTrigger.description,
556
+ enabled: scheduledTrigger.enabled,
557
+ cronExpression: scheduledTrigger.cronExpression,
558
+ cronTimezone: scheduledTrigger.cronTimezone,
559
+ runAt: scheduledTrigger.runAt,
560
+ payload: scheduledTrigger.payload,
561
+ messageTemplate: scheduledTrigger.messageTemplate,
562
+ maxRetries: scheduledTrigger.maxRetries,
563
+ retryDelaySeconds: scheduledTrigger.retryDelaySeconds,
564
+ timeoutSeconds: scheduledTrigger.timeoutSeconds
565
+ };
566
+ result.scheduledTriggers = scheduledTriggersObject;
567
+ }
568
+ } catch (error) {
569
+ console.warn("Failed to load scheduled triggers:", error);
570
+ }
519
571
  return result;
520
572
  };
521
573
  const getFullAgentDefinition = (db) => async ({ scopes }) => {
@@ -1,4 +1,5 @@
1
1
  import { AgentScopeConfig, PaginationConfig, ProjectScopeConfig, SubAgentScopeConfig } from "../../types/utility.js";
2
+ import { JsonSchemaProperty } from "../../validation/json-schemas.js";
2
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
4
  import { ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate } from "../../types/entities.js";
4
5
 
@@ -14,7 +15,14 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
14
15
  projectId: string;
15
16
  createdAt: string;
16
17
  updatedAt: string;
17
- props: Record<string, unknown> | null;
18
+ props: {
19
+ [x: string]: unknown;
20
+ type: "object";
21
+ properties: Record<string, JsonSchemaProperty>;
22
+ required?: string[] | undefined;
23
+ additionalProperties?: boolean | undefined;
24
+ description?: string | undefined;
25
+ } | null;
18
26
  render: {
19
27
  component: string;
20
28
  mockData: Record<string, unknown>;
@@ -25,7 +33,14 @@ declare const listArtifactComponents: (db: AgentsManageDatabaseClient) => (param
25
33
  }) => Promise<{
26
34
  createdAt: string;
27
35
  updatedAt: string;
28
- props: Record<string, unknown> | null;
36
+ props: {
37
+ [x: string]: unknown;
38
+ type: "object";
39
+ properties: Record<string, JsonSchemaProperty>;
40
+ required?: string[] | undefined;
41
+ additionalProperties?: boolean | undefined;
42
+ description?: string | undefined;
43
+ } | null;
29
44
  render: {
30
45
  component: string;
31
46
  mockData: Record<string, unknown>;
@@ -56,7 +71,14 @@ declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (para
56
71
  projectId: string;
57
72
  createdAt: string;
58
73
  updatedAt: string;
59
- props: Record<string, unknown> | null;
74
+ props: {
75
+ [x: string]: unknown;
76
+ type: "object";
77
+ properties: Record<string, JsonSchemaProperty>;
78
+ required?: string[] | undefined;
79
+ additionalProperties?: boolean | undefined;
80
+ description?: string | undefined;
81
+ } | null;
60
82
  render: {
61
83
  component: string;
62
84
  mockData: Record<string, unknown>;
@@ -69,7 +91,14 @@ declare const updateArtifactComponent: (db: AgentsManageDatabaseClient) => (para
69
91
  }) => Promise<{
70
92
  createdAt: string;
71
93
  updatedAt: string;
72
- props: Record<string, unknown> | null;
94
+ props: {
95
+ [x: string]: unknown;
96
+ type: "object";
97
+ properties: Record<string, JsonSchemaProperty>;
98
+ required?: string[] | undefined;
99
+ additionalProperties?: boolean | undefined;
100
+ description?: string | undefined;
101
+ } | null;
73
102
  render: {
74
103
  component: string;
75
104
  mockData: Record<string, unknown>;
@@ -92,7 +121,14 @@ declare const getArtifactComponentsForAgent: (db: AgentsManageDatabaseClient) =>
92
121
  projectId: string;
93
122
  name: string;
94
123
  description: string | null;
95
- props: Record<string, unknown> | null;
124
+ props: {
125
+ [x: string]: unknown;
126
+ type: "object";
127
+ properties: Record<string, JsonSchemaProperty>;
128
+ required?: string[] | undefined;
129
+ additionalProperties?: boolean | undefined;
130
+ description?: string | undefined;
131
+ } | null;
96
132
  render: {
97
133
  component: string;
98
134
  mockData: Record<string, unknown>;
@@ -13,9 +13,9 @@ declare const getFunctionToolById: (db: AgentsManageDatabaseClient) => (params:
13
13
  }) => Promise<{
14
14
  createdAt: string;
15
15
  updatedAt: string;
16
+ functionId: string;
16
17
  name: string;
17
18
  description: string | null;
18
- functionId: string;
19
19
  agentId: string;
20
20
  projectId: string;
21
21
  tenantId: string;
@@ -31,9 +31,9 @@ declare const listFunctionTools: (db: AgentsManageDatabaseClient) => (params: {
31
31
  data: {
32
32
  createdAt: string;
33
33
  updatedAt: string;
34
+ functionId: string;
34
35
  name: string;
35
36
  description: string | null;
36
- functionId: string;
37
37
  agentId: string;
38
38
  projectId: string;
39
39
  tenantId: string;
@@ -73,9 +73,9 @@ declare const updateFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
73
73
  }) => Promise<{
74
74
  createdAt: string;
75
75
  updatedAt: string;
76
+ functionId: string;
76
77
  name: string;
77
78
  description: string | null;
78
- functionId: string;
79
79
  agentId: string;
80
80
  projectId: string;
81
81
  tenantId: string;
@@ -1,6 +1,7 @@
1
1
  import { getLogger } from "../../utils/logger.js";
2
2
  import { deleteExternalAgent, listExternalAgents, upsertExternalAgent } from "./externalAgents.js";
3
3
  import { deleteFunction, listFunctions, upsertFunction } from "./functions.js";
4
+ import { listSkills, upsertSkill } from "./skills.js";
4
5
  import { deleteCredentialReference, listCredentialReferences, upsertCredentialReference } from "./credentialReferences.js";
5
6
  import { deleteTool, listTools, upsertTool } from "./tools.js";
6
7
  import { listAgents } from "./agents.js";
@@ -42,6 +43,37 @@ const createFullProjectServerSide = (db, logger = defaultLogger) => async (param
42
43
  logger.info({ projectId: typed.id }, "Creating project metadata");
43
44
  await createProject(db)(projectPayload);
44
45
  logger.info({ projectId: typed.id }, "Project metadata created successfully");
46
+ if (typed.skills && Object.keys(typed.skills).length) {
47
+ logger.info({
48
+ projectId: typed.id,
49
+ count: Object.keys(typed.skills).length
50
+ }, "Creating project skills");
51
+ const skillPromises = Object.entries(typed.skills).map(async ([skillId, skill]) => {
52
+ try {
53
+ await upsertSkill(db)({
54
+ ...skill,
55
+ tenantId,
56
+ projectId: typed.id
57
+ });
58
+ logger.info({
59
+ projectId: typed.id,
60
+ skillId
61
+ }, "Skill processed");
62
+ } catch (error) {
63
+ logger.error({
64
+ projectId: typed.id,
65
+ skillId,
66
+ error
67
+ }, "Failed to create skill");
68
+ throw error;
69
+ }
70
+ });
71
+ await Promise.all(skillPromises);
72
+ logger.info({
73
+ projectId: typed.id,
74
+ count: Object.keys(typed.skills).length
75
+ }, "All project skills created successfully");
76
+ }
45
77
  if (typed.credentialReferences && Object.keys(typed.credentialReferences).length > 0) {
46
78
  logger.info({
47
79
  projectId: typed.id,
@@ -395,6 +427,37 @@ const updateFullProjectServerSide = (db, logger = defaultLogger) => async (param
395
427
  data: projectUpdatePayload
396
428
  });
397
429
  logger.info({ projectId: typed.id }, "Project metadata updated successfully");
430
+ if (typed.skills && Object.keys(typed.skills).length) {
431
+ logger.info({
432
+ projectId: typed.id,
433
+ count: Object.keys(typed.skills).length
434
+ }, "Updating project skills");
435
+ const skillPromises = Object.entries(typed.skills).map(async ([skillId, skill]) => {
436
+ try {
437
+ await upsertSkill(db)({
438
+ ...skill,
439
+ tenantId,
440
+ projectId: typed.id
441
+ });
442
+ logger.info({
443
+ projectId: typed.id,
444
+ skillId
445
+ }, "Skill processed");
446
+ } catch (error) {
447
+ logger.error({
448
+ projectId: typed.id,
449
+ skillId,
450
+ error
451
+ }, "Failed to update skill");
452
+ throw error;
453
+ }
454
+ });
455
+ await Promise.all(skillPromises);
456
+ logger.info({
457
+ projectId: typed.id,
458
+ count: Object.keys(typed.skills).length
459
+ }, "All project skills updated successfully");
460
+ }
398
461
  if (typed.credentialReferences && Object.keys(typed.credentialReferences).length > 0) {
399
462
  logger.info({
400
463
  projectId: typed.id,
@@ -1009,6 +1072,39 @@ const getFullProjectInternal = (db, logger = defaultLogger) => async (params) =>
1009
1072
  error
1010
1073
  }, "Failed to retrieve functions for project");
1011
1074
  }
1075
+ const projectSkills = {};
1076
+ try {
1077
+ const skillsList = await listSkills(db)({
1078
+ scopes: {
1079
+ tenantId,
1080
+ projectId
1081
+ },
1082
+ pagination: {
1083
+ page: 1,
1084
+ limit: 1e3
1085
+ }
1086
+ });
1087
+ for (const skill of skillsList.data) projectSkills[skill.id] = {
1088
+ id: skill.id,
1089
+ name: skill.name,
1090
+ description: skill.description,
1091
+ content: skill.content,
1092
+ metadata: skill.metadata,
1093
+ createdAt: skill.createdAt,
1094
+ updatedAt: skill.updatedAt
1095
+ };
1096
+ logger.info({
1097
+ tenantId,
1098
+ projectId,
1099
+ skillCount: Object.keys(projectSkills).length
1100
+ }, "Skills retrieved for project");
1101
+ } catch (error) {
1102
+ logger.warn({
1103
+ tenantId,
1104
+ projectId,
1105
+ error
1106
+ }, "Failed to retrieve skills for project");
1107
+ }
1012
1108
  const agents = {};
1013
1109
  if (agentList.length > 0) {
1014
1110
  const getAgentFn = includeRelationIds ? getFullAgentWithRelationIds : getFullAgent;
@@ -1071,6 +1167,7 @@ const getFullProjectInternal = (db, logger = defaultLogger) => async (params) =>
1071
1167
  credentialReferences: Object.keys(projectCredentialReferences).length > 0 ? projectCredentialReferences : null,
1072
1168
  statusUpdates: null,
1073
1169
  functionTools: null,
1170
+ skills: Object.keys(projectSkills).length > 0 ? projectSkills : void 0,
1074
1171
  createdAt: project.createdAt,
1075
1172
  updatedAt: project.updatedAt
1076
1173
  };
@@ -0,0 +1,80 @@
1
+ import { AgentScopeConfig, PaginationConfig } from "../../types/utility.js";
2
+ import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
+ import { ScheduledTrigger, ScheduledTriggerInsert, ScheduledTriggerUpdate } from "../../validation/schemas.js";
4
+
5
+ //#region src/data-access/manage/scheduledTriggers.d.ts
6
+
7
+ /**
8
+ * Get a scheduled trigger by ID (agent-scoped)
9
+ */
10
+ declare const getScheduledTriggerById: (db: AgentsManageDatabaseClient) => (params: {
11
+ scopes: AgentScopeConfig;
12
+ scheduledTriggerId: string;
13
+ }) => Promise<ScheduledTrigger | undefined>;
14
+ /**
15
+ * List scheduled triggers for an agent with pagination
16
+ */
17
+ declare const listScheduledTriggersPaginated: (db: AgentsManageDatabaseClient) => (params: {
18
+ scopes: AgentScopeConfig;
19
+ pagination?: PaginationConfig;
20
+ }) => Promise<{
21
+ data: {
22
+ createdAt: string;
23
+ updatedAt: string;
24
+ enabled: boolean;
25
+ cronExpression: string | null;
26
+ cronTimezone: string | null;
27
+ runAt: string | null;
28
+ payload: Record<string, unknown> | null;
29
+ messageTemplate: string | null;
30
+ maxRetries: number;
31
+ retryDelaySeconds: number;
32
+ timeoutSeconds: number;
33
+ name: string;
34
+ description: string | null;
35
+ agentId: string;
36
+ projectId: string;
37
+ tenantId: string;
38
+ id: string;
39
+ }[];
40
+ pagination: {
41
+ page: number;
42
+ limit: number;
43
+ total: number;
44
+ pages: number;
45
+ };
46
+ }>;
47
+ /**
48
+ * Create a new scheduled trigger (agent-scoped)
49
+ */
50
+ declare const createScheduledTrigger: (db: AgentsManageDatabaseClient) => (params: ScheduledTriggerInsert) => Promise<ScheduledTrigger>;
51
+ /**
52
+ * Update a scheduled trigger (agent-scoped)
53
+ */
54
+ declare const updateScheduledTrigger: (db: AgentsManageDatabaseClient) => (params: {
55
+ scopes: AgentScopeConfig;
56
+ scheduledTriggerId: string;
57
+ data: ScheduledTriggerUpdate;
58
+ }) => Promise<ScheduledTrigger>;
59
+ /**
60
+ * Delete a scheduled trigger (agent-scoped)
61
+ */
62
+ declare const deleteScheduledTrigger: (db: AgentsManageDatabaseClient) => (params: {
63
+ scopes: AgentScopeConfig;
64
+ scheduledTriggerId: string;
65
+ }) => Promise<void>;
66
+ /**
67
+ * Upsert a scheduled trigger (create if it doesn't exist, update if it does)
68
+ */
69
+ declare const upsertScheduledTrigger: (db: AgentsManageDatabaseClient) => (params: {
70
+ scopes: AgentScopeConfig;
71
+ data: ScheduledTriggerInsert;
72
+ }) => Promise<ScheduledTrigger>;
73
+ /**
74
+ * List all scheduled triggers for an agent (non-paginated, used by agentFull)
75
+ */
76
+ declare const listScheduledTriggers: (db: AgentsManageDatabaseClient) => (params: {
77
+ scopes: AgentScopeConfig;
78
+ }) => Promise<ScheduledTrigger[]>;
79
+ //#endregion
80
+ export { createScheduledTrigger, deleteScheduledTrigger, getScheduledTriggerById, listScheduledTriggers, listScheduledTriggersPaginated, updateScheduledTrigger, upsertScheduledTrigger };