@inkeep/agents-core 0.49.0 → 0.50.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 (35) hide show
  1. package/dist/auth/auth-schema.d.ts +105 -105
  2. package/dist/auth/auth-validation-schemas.d.ts +148 -148
  3. package/dist/auth/auth.d.ts +22 -22
  4. package/dist/auth/permissions.d.ts +9 -9
  5. package/dist/client-exports.d.ts +2 -2
  6. package/dist/data-access/manage/agents.d.ts +11 -11
  7. package/dist/data-access/manage/agents.js +8 -6
  8. package/dist/data-access/manage/artifactComponents.d.ts +6 -6
  9. package/dist/data-access/manage/artifactComponents.js +3 -3
  10. package/dist/data-access/manage/contextConfigs.d.ts +8 -8
  11. package/dist/data-access/manage/dataComponents.d.ts +2 -2
  12. package/dist/data-access/manage/dataComponents.js +2 -2
  13. package/dist/data-access/manage/functionTools.d.ts +8 -8
  14. package/dist/data-access/manage/skills.d.ts +11 -11
  15. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  16. package/dist/data-access/manage/subAgentRelations.d.ts +4 -4
  17. package/dist/data-access/manage/subAgentRelations.js +2 -2
  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 +12 -12
  21. package/dist/data-access/runtime/apiKeys.d.ts +16 -16
  22. package/dist/data-access/runtime/conversations.d.ts +31 -31
  23. package/dist/data-access/runtime/messages.d.ts +18 -18
  24. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
  25. package/dist/data-access/runtime/tasks.d.ts +9 -9
  26. package/dist/db/manage/manage-schema.d.ts +445 -445
  27. package/dist/db/runtime/runtime-schema.d.ts +298 -298
  28. package/dist/setup/index.d.ts +2 -0
  29. package/dist/setup/index.js +3 -0
  30. package/dist/setup/setup.d.ts +24 -0
  31. package/dist/setup/setup.js +506 -0
  32. package/dist/validation/dolt-schemas.d.ts +1 -1
  33. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  34. package/dist/validation/schemas.d.ts +1792 -1792
  35. package/package.json +5 -1
@@ -880,25 +880,25 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
880
880
  ac: better_auth_plugins0.AccessControl;
881
881
  roles: {
882
882
  member: {
883
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
884
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
883
+ authorize<K_1 extends "project" | "organization" | "member" | "invitation" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
884
+ actions: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key];
885
885
  connector: "OR" | "AND";
886
886
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
887
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
887
+ statements: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>;
888
888
  };
889
889
  admin: {
890
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
891
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
890
+ authorize<K_1 extends "project" | "organization" | "member" | "invitation" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
891
+ actions: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key];
892
892
  connector: "OR" | "AND";
893
893
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
894
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
894
+ statements: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>;
895
895
  };
896
896
  owner: {
897
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
898
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
897
+ authorize<K_1 extends "project" | "organization" | "member" | "invitation" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
898
+ actions: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key];
899
899
  connector: "OR" | "AND";
900
900
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
901
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
901
+ statements: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>;
902
902
  };
903
903
  };
904
904
  creatorRole: "admin";
@@ -1084,7 +1084,7 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1084
1084
  id: string;
1085
1085
  organizationId: string;
1086
1086
  email: string;
1087
- role: "member" | "owner" | "admin";
1087
+ role: "owner" | "admin" | "member";
1088
1088
  status: better_auth_plugins0.InvitationStatus;
1089
1089
  inviterId: string;
1090
1090
  expiresAt: Date;
@@ -1094,7 +1094,7 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1094
1094
  Member: {
1095
1095
  id: string;
1096
1096
  organizationId: string;
1097
- role: "member" | "owner" | "admin";
1097
+ role: "owner" | "admin" | "member";
1098
1098
  createdAt: Date;
1099
1099
  userId: string;
1100
1100
  user: {
@@ -1110,7 +1110,7 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1110
1110
  members: {
1111
1111
  id: string;
1112
1112
  organizationId: string;
1113
- role: "member" | "owner" | "admin";
1113
+ role: "owner" | "admin" | "member";
1114
1114
  createdAt: Date;
1115
1115
  userId: string;
1116
1116
  user: {
@@ -1124,7 +1124,7 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1124
1124
  id: string;
1125
1125
  organizationId: string;
1126
1126
  email: string;
1127
- role: "member" | "owner" | "admin";
1127
+ role: "owner" | "admin" | "member";
1128
1128
  status: better_auth_plugins0.InvitationStatus;
1129
1129
  inviterId: string;
1130
1130
  expiresAt: Date;
@@ -1203,25 +1203,25 @@ declare function createAuth(config: BetterAuthConfig): better_auth0.Auth<{
1203
1203
  ac: better_auth_plugins0.AccessControl;
1204
1204
  roles: {
1205
1205
  member: {
1206
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
1207
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
1206
+ authorize<K_1 extends "project" | "organization" | "member" | "invitation" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
1207
+ actions: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key];
1208
1208
  connector: "OR" | "AND";
1209
1209
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1210
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
1210
+ statements: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>;
1211
1211
  };
1212
1212
  admin: {
1213
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
1214
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
1213
+ authorize<K_1 extends "project" | "organization" | "member" | "invitation" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
1214
+ actions: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key];
1215
1215
  connector: "OR" | "AND";
1216
1216
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1217
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
1217
+ statements: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>;
1218
1218
  };
1219
1219
  owner: {
1220
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
1221
- actions: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>[key];
1220
+ authorize<K_1 extends "project" | "organization" | "member" | "invitation" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key] | {
1221
+ actions: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>[key];
1222
1222
  connector: "OR" | "AND";
1223
1223
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins0.AuthorizeResponse;
1224
- statements: better_auth_plugins0.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins0.Statements>;
1224
+ statements: better_auth_plugins0.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins0.Statements>;
1225
1225
  };
1226
1226
  };
1227
1227
  creatorRole: "admin";
@@ -5,25 +5,25 @@ import { organizationClient } from "better-auth/client/plugins";
5
5
  //#region src/auth/permissions.d.ts
6
6
  declare const ac: AccessControl;
7
7
  declare const memberRole: {
8
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
9
- actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key];
8
+ authorize<K_1 extends "project" | "organization" | "member" | "invitation" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
9
+ actions: better_auth_plugins69.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins69.Statements>[key];
10
10
  connector: "OR" | "AND";
11
11
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
12
- statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>;
12
+ statements: better_auth_plugins69.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins69.Statements>;
13
13
  };
14
14
  declare const adminRole: {
15
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
16
- actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key];
15
+ authorize<K_1 extends "project" | "organization" | "member" | "invitation" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
16
+ actions: better_auth_plugins69.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins69.Statements>[key];
17
17
  connector: "OR" | "AND";
18
18
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
19
- statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>;
19
+ statements: better_auth_plugins69.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins69.Statements>;
20
20
  };
21
21
  declare const ownerRole: {
22
- authorize<K_1 extends "organization" | "member" | "invitation" | "project" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
23
- actions: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>[key];
22
+ authorize<K_1 extends "project" | "organization" | "member" | "invitation" | "ac" | "team">(request: K_1 extends infer T extends K ? { [key in T]?: better_auth_plugins69.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins69.Statements>[key] | {
23
+ actions: better_auth_plugins69.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins69.Statements>[key];
24
24
  connector: "OR" | "AND";
25
25
  } | undefined } : never, connector?: "OR" | "AND"): better_auth_plugins69.AuthorizeResponse;
26
- statements: better_auth_plugins69.Subset<"organization" | "member" | "invitation" | "project" | "ac" | "team", better_auth_plugins69.Statements>;
26
+ statements: better_auth_plugins69.Subset<"project" | "organization" | "member" | "invitation" | "ac" | "team", better_auth_plugins69.Statements>;
27
27
  };
28
28
  //#endregion
29
29
  export { ac, adminRole, memberRole, organizationClient, ownerRole };
@@ -19,8 +19,6 @@ declare const FullAgentDefinitionSchema: z.ZodObject<{
19
19
  subAgents: z.ZodRecord<z.ZodString, z.ZodUnion<readonly [z.ZodObject<{
20
20
  id: z.ZodString;
21
21
  name: z.ZodString;
22
- createdAt: z.ZodOptional<z.ZodString>;
23
- updatedAt: z.ZodOptional<z.ZodString>;
24
22
  description: z.ZodOptional<z.ZodNullable<z.ZodString>>;
25
23
  conversationHistoryConfig: z.ZodOptional<z.ZodNullable<z.ZodType<ConversationHistoryConfig, ConversationHistoryConfig, z.core.$ZodTypeInternals<ConversationHistoryConfig, ConversationHistoryConfig>>>>;
26
24
  models: z.ZodOptional<z.ZodObject<{
@@ -46,6 +44,8 @@ declare const FullAgentDefinitionSchema: z.ZodObject<{
46
44
  }, {
47
45
  stepCountIs?: number | undefined;
48
46
  }>>>>;
47
+ createdAt: z.ZodOptional<z.ZodString>;
48
+ updatedAt: z.ZodOptional<z.ZodString>;
49
49
  type: z.ZodLiteral<"internal">;
50
50
  canUse: z.ZodArray<z.ZodObject<{
51
51
  agentToolRelationId: z.ZodOptional<z.ZodString>;
@@ -10,8 +10,6 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
10
10
  }) => Promise<{
11
11
  id: string;
12
12
  name: string;
13
- createdAt: string;
14
- updatedAt: string;
15
13
  description: string | null;
16
14
  defaultSubAgentId: string | null;
17
15
  tenantId: string;
@@ -34,6 +32,8 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
34
32
  stopWhen: {
35
33
  transferCountIs?: number | undefined;
36
34
  } | null;
35
+ createdAt: string;
36
+ updatedAt: string;
37
37
  contextConfigId: string | null;
38
38
  statusUpdates: {
39
39
  enabled?: boolean | undefined;
@@ -56,8 +56,6 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
56
56
  }) => Promise<{
57
57
  id: string;
58
58
  name: string;
59
- createdAt: string;
60
- updatedAt: string;
61
59
  description: string | null;
62
60
  defaultSubAgentId: string | null;
63
61
  tenantId: string;
@@ -80,6 +78,8 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
80
78
  stopWhen: {
81
79
  transferCountIs?: number | undefined;
82
80
  } | null;
81
+ createdAt: string;
82
+ updatedAt: string;
83
83
  contextConfigId: string | null;
84
84
  statusUpdates: {
85
85
  enabled?: boolean | undefined;
@@ -99,8 +99,6 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
99
99
  defaultSubAgent: {
100
100
  id: string;
101
101
  name: string;
102
- createdAt: string;
103
- updatedAt: string;
104
102
  description: string | null;
105
103
  tenantId: string;
106
104
  projectId: string;
@@ -124,6 +122,8 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
124
122
  stopWhen: {
125
123
  stepCountIs?: number | undefined;
126
124
  } | null;
125
+ createdAt: string;
126
+ updatedAt: string;
127
127
  } | null;
128
128
  } | null>;
129
129
  declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
@@ -131,8 +131,6 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
131
131
  }) => Promise<{
132
132
  id: string;
133
133
  name: string;
134
- createdAt: string;
135
- updatedAt: string;
136
134
  description: string | null;
137
135
  defaultSubAgentId: string | null;
138
136
  tenantId: string;
@@ -155,6 +153,8 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
155
153
  stopWhen: {
156
154
  transferCountIs?: number | undefined;
157
155
  } | null;
156
+ createdAt: string;
157
+ updatedAt: string;
158
158
  contextConfigId: string | null;
159
159
  statusUpdates: {
160
160
  enabled?: boolean | undefined;
@@ -247,8 +247,6 @@ declare function listAgentsAcrossProjectMainBranches(db: AgentsManageDatabaseCli
247
247
  declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
248
248
  id: string;
249
249
  name: string;
250
- createdAt: string;
251
- updatedAt: string;
252
250
  description: string | null;
253
251
  defaultSubAgentId: string | null;
254
252
  tenantId: string;
@@ -271,6 +269,8 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
271
269
  stopWhen: {
272
270
  transferCountIs?: number | undefined;
273
271
  } | null;
272
+ createdAt: string;
273
+ updatedAt: string;
274
274
  contextConfigId: string | null;
275
275
  statusUpdates: {
276
276
  enabled?: boolean | undefined;
@@ -341,7 +341,7 @@ declare const deleteAgent: (db: AgentsManageDatabaseClient) => (params: {
341
341
  /**
342
342
  * Helper function to fetch component relationships using efficient joins
343
343
  */
344
- declare const fetchComponentRelationships: (db: AgentsManageDatabaseClient) => <T extends Record<string, unknown>>(scopes: ProjectScopeConfig, subAgentIds: string[], config: {
344
+ declare const fetchComponentRelationships: (db: AgentsManageDatabaseClient) => <T extends Record<string, unknown>>(scopes: AgentScopeConfig, subAgentIds: string[], config: {
345
345
  relationTable: PgTable<any>;
346
346
  componentTable: PgTable<any>;
347
347
  relationIdField: unknown;
@@ -117,7 +117,7 @@ const deleteAgent = (db) => async (params) => {
117
117
  const fetchComponentRelationships = (db) => async (scopes, subAgentIds, config) => {
118
118
  const componentsObject = {};
119
119
  if (subAgentIds.length > 0) {
120
- const results = await db.select(config.selectFields).from(config.relationTable).innerJoin(config.componentTable, eq(config.relationIdField, config.componentIdField)).where(and(eq(config.relationTable.tenantId, scopes.tenantId), eq(config.relationTable.projectId, scopes.projectId), inArray(config.subAgentIdField, subAgentIds)));
120
+ const results = await db.select(config.selectFields).from(config.relationTable).innerJoin(config.componentTable, eq(config.relationIdField, config.componentIdField)).where(and(eq(config.relationTable.tenantId, scopes.tenantId), eq(config.relationTable.projectId, scopes.projectId), eq(config.relationTable.agentId, scopes.agentId), inArray(config.subAgentIdField, subAgentIds)));
121
121
  for (const component of results) componentsObject[component.id] = component;
122
122
  }
123
123
  return componentsObject;
@@ -260,8 +260,8 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
260
260
  agentToolRelationId: subAgentFunctionToolRelations.id,
261
261
  toolPolicies: subAgentFunctionToolRelations.toolPolicies
262
262
  }).from(subAgentFunctionToolRelations).innerJoin(functionTools, and(eq(subAgentFunctionToolRelations.functionToolId, functionTools.id), eq(subAgentFunctionToolRelations.tenantId, functionTools.tenantId), eq(subAgentFunctionToolRelations.projectId, functionTools.projectId), eq(subAgentFunctionToolRelations.agentId, functionTools.agentId))).where(and(eq(subAgentFunctionToolRelations.tenantId, tenantId), eq(subAgentFunctionToolRelations.projectId, projectId), eq(subAgentFunctionToolRelations.agentId, agentId), eq(subAgentFunctionToolRelations.subAgentId, agent$1.id)));
263
- const agentDataComponentIds = (await db.query.subAgentDataComponents.findMany({ where: and(eq(subAgentDataComponents.tenantId, tenantId), eq(subAgentDataComponents.subAgentId, agent$1.id)) })).map((rel) => rel.dataComponentId);
264
- const agentArtifactComponentIds = (await db.query.subAgentArtifactComponents.findMany({ where: and(eq(subAgentArtifactComponents.tenantId, tenantId), eq(subAgentArtifactComponents.subAgentId, agent$1.id)) })).map((rel) => rel.artifactComponentId);
263
+ const agentDataComponentIds = (await db.query.subAgentDataComponents.findMany({ where: and(eq(subAgentDataComponents.tenantId, tenantId), eq(subAgentDataComponents.projectId, projectId), eq(subAgentDataComponents.agentId, agentId), eq(subAgentDataComponents.subAgentId, agent$1.id)) })).map((rel) => rel.dataComponentId);
264
+ const agentArtifactComponentIds = (await db.query.subAgentArtifactComponents.findMany({ where: and(eq(subAgentArtifactComponents.tenantId, tenantId), eq(subAgentArtifactComponents.projectId, projectId), eq(subAgentArtifactComponents.agentId, agentId), eq(subAgentArtifactComponents.subAgentId, agent$1.id)) })).map((rel) => rel.artifactComponentId);
265
265
  const mcpToolCanUse = subAgentTools.map((tool) => ({
266
266
  agentToolRelationId: tool.agentToolRelationId,
267
267
  toolId: tool.id,
@@ -352,7 +352,8 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
352
352
  try {
353
353
  await fetchComponentRelationships(db)({
354
354
  tenantId,
355
- projectId
355
+ projectId,
356
+ agentId
356
357
  }, subAgentIds, {
357
358
  relationTable: subAgentDataComponents,
358
359
  componentTable: dataComponents,
@@ -372,7 +373,8 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
372
373
  try {
373
374
  await fetchComponentRelationships(db)({
374
375
  tenantId,
375
- projectId
376
+ projectId,
377
+ agentId
376
378
  }, subAgentIds, {
377
379
  relationTable: subAgentArtifactComponents,
378
380
  componentTable: artifactComponents,
@@ -429,7 +431,7 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
429
431
  await db.update(subAgents).set({
430
432
  stopWhen: agent$1.stopWhen,
431
433
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
432
- }).where(and(eq(subAgents.tenantId, tenantId), eq(subAgents.projectId, projectId), eq(subAgents.id, subAgentId)));
434
+ }).where(and(eq(subAgents.tenantId, tenantId), eq(subAgents.projectId, projectId), eq(subAgents.agentId, agentId), eq(subAgents.id, subAgentId)));
433
435
  result.subAgents[subAgentId] = {
434
436
  ...result.subAgents[subAgentId],
435
437
  stopWhen: agent$1.stopWhen
@@ -10,11 +10,11 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
10
10
  }) => Promise<{
11
11
  id: string;
12
12
  name: string;
13
- createdAt: string;
14
- updatedAt: string;
15
13
  description: string | null;
16
14
  tenantId: string;
17
15
  projectId: string;
16
+ createdAt: string;
17
+ updatedAt: string;
18
18
  props: {
19
19
  [x: string]: unknown;
20
20
  type: "object";
@@ -66,11 +66,11 @@ declare const listArtifactComponentsPaginated: (db: AgentsManageDatabaseClient)
66
66
  declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
67
67
  id: string;
68
68
  name: string;
69
- createdAt: string;
70
- updatedAt: string;
71
69
  description: string | null;
72
70
  tenantId: string;
73
71
  projectId: string;
72
+ createdAt: string;
73
+ updatedAt: string;
74
74
  props: {
75
75
  [x: string]: unknown;
76
76
  type: "object";
@@ -141,10 +141,10 @@ declare const associateArtifactComponentWithAgent: (db: AgentsManageDatabaseClie
141
141
  artifactComponentId: string;
142
142
  }) => Promise<{
143
143
  id: string;
144
- createdAt: string;
145
144
  tenantId: string;
146
145
  projectId: string;
147
146
  agentId: string;
147
+ createdAt: string;
148
148
  subAgentId: string;
149
149
  artifactComponentId: string;
150
150
  }>;
@@ -184,10 +184,10 @@ declare const upsertAgentArtifactComponentRelation: (db: AgentsManageDatabaseCli
184
184
  artifactComponentId: string;
185
185
  }) => Promise<{
186
186
  id: string;
187
- createdAt: string;
188
187
  tenantId: string;
189
188
  projectId: string;
190
189
  agentId: string;
190
+ createdAt: string;
191
191
  subAgentId: string;
192
192
  artifactComponentId: string;
193
193
  } | null>;
@@ -97,7 +97,7 @@ const getArtifactComponentsForAgent = (db) => async (params) => {
97
97
  render: artifactComponents.render,
98
98
  createdAt: artifactComponents.createdAt,
99
99
  updatedAt: artifactComponents.updatedAt
100
- }).from(artifactComponents).innerJoin(subAgentArtifactComponents, eq(artifactComponents.id, subAgentArtifactComponents.artifactComponentId)).where(and(eq(artifactComponents.tenantId, params.scopes.tenantId), eq(artifactComponents.projectId, params.scopes.projectId), eq(subAgentArtifactComponents.agentId, params.scopes.agentId), eq(subAgentArtifactComponents.subAgentId, params.scopes.subAgentId))).orderBy(desc(artifactComponents.createdAt));
100
+ }).from(artifactComponents).innerJoin(subAgentArtifactComponents, and(eq(artifactComponents.id, subAgentArtifactComponents.artifactComponentId), eq(artifactComponents.tenantId, subAgentArtifactComponents.tenantId), eq(artifactComponents.projectId, subAgentArtifactComponents.projectId))).where(and(eq(artifactComponents.tenantId, params.scopes.tenantId), eq(artifactComponents.projectId, params.scopes.projectId), eq(subAgentArtifactComponents.agentId, params.scopes.agentId), eq(subAgentArtifactComponents.subAgentId, params.scopes.subAgentId))).orderBy(desc(artifactComponents.createdAt));
101
101
  };
102
102
  const associateArtifactComponentWithAgent = (db) => async (params) => {
103
103
  const [association] = await db.insert(subAgentArtifactComponents).values({
@@ -120,7 +120,7 @@ const removeArtifactComponentFromAgent = (db) => async (params) => {
120
120
  }
121
121
  };
122
122
  const deleteAgentArtifactComponentRelationByAgent = (db) => async (params) => {
123
- return (await db.delete(subAgentArtifactComponents).where(and(eq(subAgentArtifactComponents.tenantId, params.scopes.tenantId), eq(subAgentArtifactComponents.agentId, params.scopes.agentId), eq(subAgentArtifactComponents.subAgentId, params.scopes.subAgentId))).returning()).length > 0;
123
+ return (await db.delete(subAgentArtifactComponents).where(and(eq(subAgentArtifactComponents.tenantId, params.scopes.tenantId), eq(subAgentArtifactComponents.projectId, params.scopes.projectId), eq(subAgentArtifactComponents.agentId, params.scopes.agentId), eq(subAgentArtifactComponents.subAgentId, params.scopes.subAgentId))).returning()).length > 0;
124
124
  };
125
125
  const getAgentsUsingArtifactComponent = (db) => async (params) => {
126
126
  return await db.select({
@@ -133,7 +133,7 @@ const isArtifactComponentAssociatedWithAgent = (db) => async (params) => {
133
133
  return (await db.select({ id: subAgentArtifactComponents.id }).from(subAgentArtifactComponents).where(and(eq(subAgentArtifactComponents.tenantId, params.scopes.tenantId), eq(subAgentArtifactComponents.projectId, params.scopes.projectId), eq(subAgentArtifactComponents.agentId, params.scopes.agentId), eq(subAgentArtifactComponents.subAgentId, params.scopes.subAgentId), eq(subAgentArtifactComponents.artifactComponentId, params.artifactComponentId))).limit(1)).length > 0;
134
134
  };
135
135
  const agentHasArtifactComponents = (db) => async (params) => {
136
- const total = (await db.select({ count: count() }).from(subAgentArtifactComponents).innerJoin(subAgents, and(eq(subAgentArtifactComponents.subAgentId, subAgents.id), eq(subAgentArtifactComponents.tenantId, subAgents.tenantId))).innerJoin(subAgentRelations, and(eq(subAgents.id, subAgentRelations.sourceSubAgentId), eq(subAgents.tenantId, subAgentRelations.tenantId), eq(subAgents.projectId, subAgentRelations.projectId), eq(subAgents.agentId, subAgentRelations.agentId))).where(and(eq(subAgentArtifactComponents.tenantId, params.scopes.tenantId), eq(subAgentArtifactComponents.projectId, params.scopes.projectId), eq(subAgentRelations.agentId, params.scopes.agentId))).limit(1))[0]?.count || 0;
136
+ const total = (await db.select({ count: count() }).from(subAgentArtifactComponents).innerJoin(subAgents, and(eq(subAgentArtifactComponents.subAgentId, subAgents.id), eq(subAgentArtifactComponents.tenantId, subAgents.tenantId), eq(subAgentArtifactComponents.projectId, subAgents.projectId), eq(subAgentArtifactComponents.agentId, subAgents.agentId))).innerJoin(subAgentRelations, and(eq(subAgents.id, subAgentRelations.sourceSubAgentId), eq(subAgents.tenantId, subAgentRelations.tenantId), eq(subAgents.projectId, subAgentRelations.projectId), eq(subAgents.agentId, subAgentRelations.agentId))).where(and(eq(subAgentArtifactComponents.tenantId, params.scopes.tenantId), eq(subAgentArtifactComponents.projectId, params.scopes.projectId), eq(subAgentRelations.agentId, params.scopes.agentId))).limit(1))[0]?.count || 0;
137
137
  return (typeof total === "string" ? Number.parseInt(total, 10) : total) > 0;
138
138
  };
139
139
  const countArtifactComponents = (db) => async (params) => {
@@ -9,11 +9,11 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
9
9
  id: string;
10
10
  }) => Promise<{
11
11
  id: string;
12
- createdAt: string;
13
- updatedAt: string;
14
12
  tenantId: string;
15
13
  projectId: string;
16
14
  agentId: string;
15
+ createdAt: string;
16
+ updatedAt: string;
17
17
  headersSchema: unknown;
18
18
  contextVariables: Record<string, ContextFetchDefinition> | null;
19
19
  } | undefined>;
@@ -21,11 +21,11 @@ declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
21
21
  scopes: AgentScopeConfig;
22
22
  }) => Promise<{
23
23
  id: string;
24
- createdAt: string;
25
- updatedAt: string;
26
24
  tenantId: string;
27
25
  projectId: string;
28
26
  agentId: string;
27
+ createdAt: string;
28
+ updatedAt: string;
29
29
  headersSchema: unknown;
30
30
  contextVariables: Record<string, ContextFetchDefinition> | null;
31
31
  }[]>;
@@ -43,11 +43,11 @@ declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (
43
43
  }>;
44
44
  declare const createContextConfig: (db: AgentsManageDatabaseClient) => (params: ContextConfigInsert) => Promise<{
45
45
  id: string;
46
- createdAt: string;
47
- updatedAt: string;
48
46
  tenantId: string;
49
47
  projectId: string;
50
48
  agentId: string;
49
+ createdAt: string;
50
+ updatedAt: string;
51
51
  headersSchema: unknown;
52
52
  contextVariables: Record<string, ContextFetchDefinition> | null;
53
53
  }>;
@@ -83,11 +83,11 @@ declare const upsertContextConfig: (db: AgentsManageDatabaseClient) => (params:
83
83
  data: ContextConfigInsert;
84
84
  }) => Promise<{
85
85
  id: string;
86
- createdAt: string;
87
- updatedAt: string;
88
86
  tenantId: string;
89
87
  projectId: string;
90
88
  agentId: string;
89
+ createdAt: string;
90
+ updatedAt: string;
91
91
  headersSchema: unknown;
92
92
  contextVariables: Record<string, ContextFetchDefinition> | null;
93
93
  }>;
@@ -65,10 +65,10 @@ declare const associateDataComponentWithAgent: (db: AgentsManageDatabaseClient)
65
65
  dataComponentId: string;
66
66
  }) => Promise<{
67
67
  id: string;
68
- createdAt: string;
69
68
  tenantId: string;
70
69
  projectId: string;
71
70
  agentId: string;
71
+ createdAt: string;
72
72
  subAgentId: string;
73
73
  dataComponentId: string;
74
74
  }>;
@@ -107,10 +107,10 @@ declare const upsertAgentDataComponentRelation: (db: AgentsManageDatabaseClient)
107
107
  dataComponentId: string;
108
108
  }) => Promise<{
109
109
  id: string;
110
- createdAt: string;
111
110
  tenantId: string;
112
111
  projectId: string;
113
112
  agentId: string;
113
+ createdAt: string;
114
114
  subAgentId: string;
115
115
  dataComponentId: string;
116
116
  } | null>;
@@ -110,7 +110,7 @@ const getDataComponentsForAgent = (db) => async (params) => {
110
110
  createdAt: dataComponents.createdAt,
111
111
  updatedAt: dataComponents.updatedAt,
112
112
  render: dataComponents.render
113
- }).from(dataComponents).innerJoin(subAgentDataComponents, eq(dataComponents.id, subAgentDataComponents.dataComponentId)).where(and(eq(dataComponents.tenantId, params.scopes.tenantId), eq(dataComponents.projectId, params.scopes.projectId), eq(subAgentDataComponents.agentId, params.scopes.agentId), eq(subAgentDataComponents.subAgentId, params.scopes.subAgentId))).orderBy(desc(dataComponents.createdAt));
113
+ }).from(dataComponents).innerJoin(subAgentDataComponents, and(eq(dataComponents.id, subAgentDataComponents.dataComponentId), eq(dataComponents.tenantId, subAgentDataComponents.tenantId), eq(dataComponents.projectId, subAgentDataComponents.projectId))).where(and(eq(dataComponents.tenantId, params.scopes.tenantId), eq(dataComponents.projectId, params.scopes.projectId), eq(subAgentDataComponents.agentId, params.scopes.agentId), eq(subAgentDataComponents.subAgentId, params.scopes.subAgentId))).orderBy(desc(dataComponents.createdAt));
114
114
  };
115
115
  /**
116
116
  * Associate a data component with an agent
@@ -132,7 +132,7 @@ const removeDataComponentFromAgent = (db) => async (params) => {
132
132
  return (await db.delete(subAgentDataComponents).where(and(eq(subAgentDataComponents.tenantId, params.scopes.tenantId), eq(subAgentDataComponents.projectId, params.scopes.projectId), eq(subAgentDataComponents.agentId, params.scopes.agentId), eq(subAgentDataComponents.subAgentId, params.scopes.subAgentId), eq(subAgentDataComponents.dataComponentId, params.dataComponentId))).returning()).length > 0;
133
133
  };
134
134
  const deleteAgentDataComponentRelationByAgent = (db) => async (params) => {
135
- return (await db.delete(subAgentDataComponents).where(and(eq(subAgentDataComponents.tenantId, params.scopes.tenantId), eq(subAgentDataComponents.agentId, params.scopes.agentId), eq(subAgentDataComponents.subAgentId, params.scopes.subAgentId))).returning()).length > 0;
135
+ return (await db.delete(subAgentDataComponents).where(and(eq(subAgentDataComponents.tenantId, params.scopes.tenantId), eq(subAgentDataComponents.projectId, params.scopes.projectId), eq(subAgentDataComponents.agentId, params.scopes.agentId), eq(subAgentDataComponents.subAgentId, params.scopes.subAgentId))).returning()).length > 0;
136
136
  };
137
137
  /**
138
138
  * Get all agents that use a specific data component
@@ -55,12 +55,12 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
55
55
  }) => Promise<{
56
56
  id: string;
57
57
  name: string;
58
- createdAt: string;
59
- updatedAt: string;
60
58
  description: string | null;
61
59
  tenantId: string;
62
60
  projectId: string;
63
61
  agentId: string;
62
+ createdAt: string;
63
+ updatedAt: string;
64
64
  functionId: string;
65
65
  }>;
66
66
  /**
@@ -97,12 +97,12 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
97
97
  }) => Promise<{
98
98
  id: string;
99
99
  name: string;
100
- createdAt: string;
101
- updatedAt: string;
102
100
  description: string | null;
103
101
  tenantId: string;
104
102
  projectId: string;
105
103
  agentId: string;
104
+ createdAt: string;
105
+ updatedAt: string;
106
106
  functionId: string;
107
107
  }>;
108
108
  declare const getFunctionToolsForSubAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -162,11 +162,11 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
162
162
  }> | null;
163
163
  }) => Promise<{
164
164
  id: string;
165
- createdAt: string;
166
- updatedAt: string;
167
165
  tenantId: string;
168
166
  projectId: string;
169
167
  agentId: string;
168
+ createdAt: string;
169
+ updatedAt: string;
170
170
  toolPolicies: Record<string, {
171
171
  needsApproval?: boolean;
172
172
  }> | null;
@@ -227,11 +227,11 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
227
227
  }> | null;
228
228
  }) => Promise<{
229
229
  id: string;
230
- createdAt: string;
231
- updatedAt: string;
232
230
  tenantId: string;
233
231
  projectId: string;
234
232
  agentId: string;
233
+ createdAt: string;
234
+ updatedAt: string;
235
235
  toolPolicies: Record<string, {
236
236
  needsApproval?: boolean;
237
237
  }> | null;
@@ -9,12 +9,12 @@ declare const getSkillById: (db: AgentsManageDatabaseClient) => (params: {
9
9
  }) => Promise<{
10
10
  id: string;
11
11
  name: string;
12
- createdAt: string;
13
- updatedAt: string;
14
- metadata: Record<string, string> | null;
15
12
  description: string;
16
13
  tenantId: string;
17
14
  projectId: string;
15
+ createdAt: string;
16
+ updatedAt: string;
17
+ metadata: Record<string, string> | null;
18
18
  content: string;
19
19
  } | null>;
20
20
  declare const listSkills: (db: AgentsManageDatabaseClient) => (params: {
@@ -42,23 +42,23 @@ declare const listSkills: (db: AgentsManageDatabaseClient) => (params: {
42
42
  declare const createSkill: (db: AgentsManageDatabaseClient) => (data: SkillInsert) => Promise<{
43
43
  id: string;
44
44
  name: string;
45
- createdAt: string;
46
- updatedAt: string;
47
- metadata: Record<string, string> | null;
48
45
  description: string;
49
46
  tenantId: string;
50
47
  projectId: string;
48
+ createdAt: string;
49
+ updatedAt: string;
50
+ metadata: Record<string, string> | null;
51
51
  content: string;
52
52
  }>;
53
53
  declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillInsert) => Promise<{
54
54
  id: string;
55
55
  name: string;
56
- createdAt: string;
57
- updatedAt: string;
58
- metadata: Record<string, string> | null;
59
56
  description: string;
60
57
  tenantId: string;
61
58
  projectId: string;
59
+ createdAt: string;
60
+ updatedAt: string;
61
+ metadata: Record<string, string> | null;
62
62
  content: string;
63
63
  }>;
64
64
  declare const updateSkill: (db: AgentsManageDatabaseClient) => (params: {
@@ -91,11 +91,11 @@ declare const upsertSubAgentSkill: (db: AgentsManageDatabaseClient) => (params:
91
91
  alwaysLoaded?: boolean;
92
92
  }) => Promise<{
93
93
  id: string;
94
- createdAt: string;
95
- updatedAt: string;
96
94
  tenantId: string;
97
95
  projectId: string;
98
96
  agentId: string;
97
+ createdAt: string;
98
+ updatedAt: string;
99
99
  index: number;
100
100
  alwaysLoaded: boolean;
101
101
  subAgentId: string;