@inkeep/agents-core 0.50.6 → 0.52.0

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 (78) hide show
  1. package/dist/auth/auth-schema.d.ts +139 -105
  2. package/dist/auth/auth-schema.js +3 -1
  3. package/dist/auth/auth-validation-schemas.d.ts +216 -148
  4. package/dist/auth/auth.d.ts +55 -23
  5. package/dist/auth/auth.js +22 -8
  6. package/dist/auth/permissions.d.ts +9 -9
  7. package/dist/client-exports.d.ts +8 -14
  8. package/dist/data-access/index.d.ts +3 -3
  9. package/dist/data-access/index.js +3 -3
  10. package/dist/data-access/manage/agentFull.d.ts +2 -1
  11. package/dist/data-access/manage/agents.d.ts +39 -38
  12. package/dist/data-access/manage/artifactComponents.d.ts +18 -17
  13. package/dist/data-access/manage/contextConfigs.d.ts +18 -17
  14. package/dist/data-access/manage/credentialReferences.d.ts +2 -1
  15. package/dist/data-access/manage/dataComponents.d.ts +8 -7
  16. package/dist/data-access/manage/evalConfig.d.ts +2 -1
  17. package/dist/data-access/manage/externalAgents.d.ts +2 -1
  18. package/dist/data-access/manage/functionTools.d.ts +14 -14
  19. package/dist/data-access/manage/functions.d.ts +2 -2
  20. package/dist/data-access/manage/projectFull.d.ts +2 -1
  21. package/dist/data-access/manage/projects.d.ts +2 -1
  22. package/dist/data-access/manage/scheduledTriggers.d.ts +2 -2
  23. package/dist/data-access/manage/scheduledWorkflows.d.ts +2 -2
  24. package/dist/data-access/manage/scope-helpers.d.ts +15 -22
  25. package/dist/data-access/manage/scope-helpers.js +15 -12
  26. package/dist/data-access/manage/skills.d.ts +17 -16
  27. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +20 -19
  28. package/dist/data-access/manage/subAgentRelations.d.ts +22 -21
  29. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +20 -19
  30. package/dist/data-access/manage/subAgents.d.ts +17 -16
  31. package/dist/data-access/manage/tools.d.ts +29 -28
  32. package/dist/data-access/manage/triggers.d.ts +4 -4
  33. package/dist/data-access/runtime/apiKeys.d.ts +14 -13
  34. package/dist/data-access/runtime/cascade-delete.d.ts +1 -1
  35. package/dist/data-access/runtime/contextCache.d.ts +2 -2
  36. package/dist/data-access/runtime/conversations.d.ts +25 -24
  37. package/dist/data-access/runtime/evalRuns.d.ts +2 -1
  38. package/dist/data-access/runtime/ledgerArtifacts.d.ts +1 -1
  39. package/dist/data-access/runtime/messages.d.ts +23 -22
  40. package/dist/data-access/runtime/organizations.d.ts +11 -1
  41. package/dist/data-access/runtime/organizations.js +27 -1
  42. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +2 -2
  43. package/dist/data-access/runtime/tasks.d.ts +7 -7
  44. package/dist/data-access/runtime/triggerInvocations.d.ts +2 -2
  45. package/dist/data-access/runtime/users.d.ts +9 -1
  46. package/dist/data-access/runtime/users.js +20 -3
  47. package/dist/data-access/runtime/workAppSlack.d.ts +1 -1
  48. package/dist/db/manage/manage-schema.d.ts +449 -449
  49. package/dist/db/manage/manage-schema.js +1 -1
  50. package/dist/db/manage/scope-definitions.d.ts +31 -0
  51. package/dist/db/manage/scope-definitions.js +31 -0
  52. package/dist/db/runtime/runtime-schema.d.ts +314 -297
  53. package/dist/db/runtime/runtime-schema.js +1 -0
  54. package/dist/dolt/branches-api.d.ts +2 -1
  55. package/dist/index.d.ts +7 -5
  56. package/dist/index.js +5 -4
  57. package/dist/middleware/no-auth.d.ts +2 -2
  58. package/dist/types/index.d.ts +2 -1
  59. package/dist/types/utility.d.ts +2 -11
  60. package/dist/utils/error.d.ts +3 -1
  61. package/dist/utils/error.js +11 -1
  62. package/dist/utils/index.d.ts +3 -2
  63. package/dist/utils/index.js +3 -2
  64. package/dist/utils/retry.d.ts +8 -0
  65. package/dist/utils/retry.js +30 -0
  66. package/dist/validation/dolt-schemas.d.ts +1 -1
  67. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  68. package/dist/validation/schemas.d.ts +1826 -1856
  69. package/dist/validation/schemas.js +2 -1
  70. package/dist/validation/stream-event-schemas.d.ts +4 -0
  71. package/dist/validation/stream-event-schemas.js +3 -1
  72. package/drizzle/manage/0010_oval_angel.sql +2 -0
  73. package/drizzle/manage/meta/0010_snapshot.json +3673 -0
  74. package/drizzle/manage/meta/_journal.json +7 -0
  75. package/drizzle/runtime/0015_soft_payback.sql +3 -0
  76. package/drizzle/runtime/meta/0015_snapshot.json +3772 -0
  77. package/drizzle/runtime/meta/_journal.json +7 -0
  78. package/package.json +1 -1
@@ -1,4 +1,5 @@
1
- import { AgentScopeConfig, ConversationHistoryConfig, PaginationConfig, ProjectScopeConfig } from "../../types/utility.js";
1
+ import { AgentScopeConfig, ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { ConversationHistoryConfig, PaginationConfig } from "../../types/utility.js";
2
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
4
  import "../../index.js";
4
5
  import { AgentInsert, AgentSelect, AgentUpdate, FullAgentDefinition, FullAgentSelectWithRelationIds } from "../../types/entities.js";
@@ -8,15 +9,13 @@ import { PgTable } from "drizzle-orm/pg-core";
8
9
  declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
9
10
  scopes: AgentScopeConfig;
10
11
  }) => Promise<{
12
+ description: string | null;
11
13
  name: string;
14
+ tenantId: string;
15
+ projectId: string;
12
16
  id: string;
13
17
  createdAt: string;
14
18
  updatedAt: string;
15
- projectId: string;
16
- tenantId: string;
17
- description: string | null;
18
- defaultSubAgentId: string | null;
19
- contextConfigId: string | null;
20
19
  models: {
21
20
  base?: {
22
21
  model?: string | undefined;
@@ -31,6 +30,11 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
31
30
  providerOptions?: Record<string, any> | undefined;
32
31
  } | undefined;
33
32
  } | null;
33
+ stopWhen: {
34
+ transferCountIs?: number | undefined;
35
+ } | null;
36
+ defaultSubAgentId: string | null;
37
+ contextConfigId: string | null;
34
38
  prompt: string | null;
35
39
  statusUpdates: {
36
40
  enabled?: boolean | undefined;
@@ -47,22 +51,17 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
47
51
  } | undefined;
48
52
  }[] | undefined;
49
53
  } | null;
50
- stopWhen: {
51
- transferCountIs?: number | undefined;
52
- } | null;
53
54
  } | null>;
54
55
  declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
55
56
  scopes: AgentScopeConfig;
56
57
  }) => Promise<{
58
+ description: string | null;
57
59
  name: string;
60
+ tenantId: string;
61
+ projectId: string;
58
62
  id: string;
59
63
  createdAt: string;
60
64
  updatedAt: string;
61
- projectId: string;
62
- tenantId: string;
63
- description: string | null;
64
- defaultSubAgentId: string | null;
65
- contextConfigId: string | null;
66
65
  models: {
67
66
  base?: {
68
67
  model?: string | undefined;
@@ -77,6 +76,11 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
77
76
  providerOptions?: Record<string, any> | undefined;
78
77
  } | undefined;
79
78
  } | null;
79
+ stopWhen: {
80
+ transferCountIs?: number | undefined;
81
+ } | null;
82
+ defaultSubAgentId: string | null;
83
+ contextConfigId: string | null;
80
84
  prompt: string | null;
81
85
  statusUpdates: {
82
86
  enabled?: boolean | undefined;
@@ -93,18 +97,14 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
93
97
  } | undefined;
94
98
  }[] | undefined;
95
99
  } | null;
96
- stopWhen: {
97
- transferCountIs?: number | undefined;
98
- } | null;
99
100
  defaultSubAgent: {
101
+ description: string | null;
100
102
  name: string;
103
+ tenantId: string;
104
+ projectId: string;
101
105
  id: string;
102
106
  createdAt: string;
103
107
  updatedAt: string;
104
- agentId: string;
105
- projectId: string;
106
- tenantId: string;
107
- description: string | null;
108
108
  models: {
109
109
  base?: {
110
110
  model?: string | undefined;
@@ -119,25 +119,24 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
119
119
  providerOptions?: Record<string, any> | undefined;
120
120
  } | undefined;
121
121
  } | null;
122
- prompt: string | null;
123
122
  stopWhen: {
124
123
  stepCountIs?: number | undefined;
125
124
  } | null;
125
+ prompt: string | null;
126
+ agentId: string;
126
127
  conversationHistoryConfig: ConversationHistoryConfig | null;
127
128
  } | null;
128
129
  } | null>;
129
130
  declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
130
131
  scopes: ProjectScopeConfig;
131
132
  }) => Promise<{
133
+ description: string | null;
132
134
  name: string;
135
+ tenantId: string;
136
+ projectId: string;
133
137
  id: string;
134
138
  createdAt: string;
135
139
  updatedAt: string;
136
- projectId: string;
137
- tenantId: string;
138
- description: string | null;
139
- defaultSubAgentId: string | null;
140
- contextConfigId: string | null;
141
140
  models: {
142
141
  base?: {
143
142
  model?: string | undefined;
@@ -152,6 +151,11 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
152
151
  providerOptions?: Record<string, any> | undefined;
153
152
  } | undefined;
154
153
  } | null;
154
+ stopWhen: {
155
+ transferCountIs?: number | undefined;
156
+ } | null;
157
+ defaultSubAgentId: string | null;
158
+ contextConfigId: string | null;
155
159
  prompt: string | null;
156
160
  statusUpdates: {
157
161
  enabled?: boolean | undefined;
@@ -168,9 +172,6 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
168
172
  } | undefined;
169
173
  }[] | undefined;
170
174
  } | null;
171
- stopWhen: {
172
- transferCountIs?: number | undefined;
173
- } | null;
174
175
  }[]>;
175
176
  declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
176
177
  scopes: ProjectScopeConfig;
@@ -245,15 +246,13 @@ declare function listAgentsAcrossProjectMainBranches(db: AgentsManageDatabaseCli
245
246
  projectIds: string[];
246
247
  }): Promise<AvailableAgentInfo[]>;
247
248
  declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
249
+ description: string | null;
248
250
  name: string;
251
+ tenantId: string;
252
+ projectId: string;
249
253
  id: string;
250
254
  createdAt: string;
251
255
  updatedAt: string;
252
- projectId: string;
253
- tenantId: string;
254
- description: string | null;
255
- defaultSubAgentId: string | null;
256
- contextConfigId: string | null;
257
256
  models: {
258
257
  base?: {
259
258
  model?: string | undefined;
@@ -268,6 +267,11 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
268
267
  providerOptions?: Record<string, any> | undefined;
269
268
  } | undefined;
270
269
  } | null;
270
+ stopWhen: {
271
+ transferCountIs?: number | undefined;
272
+ } | null;
273
+ defaultSubAgentId: string | null;
274
+ contextConfigId: string | null;
271
275
  prompt: string | null;
272
276
  statusUpdates: {
273
277
  enabled?: boolean | undefined;
@@ -284,9 +288,6 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
284
288
  } | undefined;
285
289
  }[] | undefined;
286
290
  } | null;
287
- stopWhen: {
288
- transferCountIs?: number | undefined;
289
- } | null;
290
291
  }>;
291
292
  declare const updateAgent: (db: AgentsManageDatabaseClient) => (params: {
292
293
  scopes: AgentScopeConfig;
@@ -1,4 +1,5 @@
1
- import { AgentScopeConfig, PaginationConfig, ProjectScopeConfig, SubAgentScopeConfig } from "../../types/utility.js";
1
+ import { AgentScopeConfig, ProjectScopeConfig, SubAgentScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig } from "../../types/utility.js";
2
3
  import { JsonSchemaProperty } from "../../validation/json-schemas.js";
3
4
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
4
5
  import { ArtifactComponentInsert, ArtifactComponentSelect, ArtifactComponentUpdate } from "../../types/entities.js";
@@ -8,13 +9,11 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
8
9
  scopes: ProjectScopeConfig;
9
10
  id: string;
10
11
  }) => Promise<{
12
+ description: string | null;
11
13
  name: string;
12
- id: string;
13
- createdAt: string;
14
- updatedAt: string;
15
- projectId: string;
16
14
  tenantId: string;
17
- description: string | null;
15
+ projectId: string;
16
+ id: string;
18
17
  props: {
19
18
  [x: string]: unknown;
20
19
  type: "object";
@@ -27,6 +26,8 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
27
26
  component: string;
28
27
  mockData: Record<string, unknown>;
29
28
  } | null;
29
+ createdAt: string;
30
+ updatedAt: string;
30
31
  } | undefined>;
31
32
  declare const listArtifactComponents: (db: AgentsManageDatabaseClient) => (params: {
32
33
  scopes: ProjectScopeConfig;
@@ -64,13 +65,11 @@ declare const listArtifactComponentsPaginated: (db: AgentsManageDatabaseClient)
64
65
  };
65
66
  }>;
66
67
  declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
68
+ description: string | null;
67
69
  name: string;
68
- id: string;
69
- createdAt: string;
70
- updatedAt: string;
71
- projectId: string;
72
70
  tenantId: string;
73
- description: string | null;
71
+ projectId: string;
72
+ id: string;
74
73
  props: {
75
74
  [x: string]: unknown;
76
75
  type: "object";
@@ -83,6 +82,8 @@ declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (para
83
82
  component: string;
84
83
  mockData: Record<string, unknown>;
85
84
  } | null;
85
+ createdAt: string;
86
+ updatedAt: string;
86
87
  }>;
87
88
  declare const updateArtifactComponent: (db: AgentsManageDatabaseClient) => (params: {
88
89
  scopes: ProjectScopeConfig;
@@ -140,12 +141,12 @@ declare const associateArtifactComponentWithAgent: (db: AgentsManageDatabaseClie
140
141
  scopes: SubAgentScopeConfig;
141
142
  artifactComponentId: string;
142
143
  }) => Promise<{
144
+ tenantId: string;
145
+ projectId: string;
146
+ subAgentId: string;
143
147
  id: string;
144
148
  createdAt: string;
145
149
  agentId: string;
146
- projectId: string;
147
- tenantId: string;
148
- subAgentId: string;
149
150
  artifactComponentId: string;
150
151
  }>;
151
152
  declare const removeArtifactComponentFromAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -183,12 +184,12 @@ declare const upsertAgentArtifactComponentRelation: (db: AgentsManageDatabaseCli
183
184
  scopes: SubAgentScopeConfig;
184
185
  artifactComponentId: string;
185
186
  }) => Promise<{
187
+ tenantId: string;
188
+ projectId: string;
189
+ subAgentId: string;
186
190
  id: string;
187
191
  createdAt: string;
188
192
  agentId: string;
189
- projectId: string;
190
- tenantId: string;
191
- subAgentId: string;
192
193
  artifactComponentId: string;
193
194
  } | null>;
194
195
  /**
@@ -1,4 +1,5 @@
1
- import { AgentScopeConfig, ContextFetchDefinition, PaginationConfig } from "../../types/utility.js";
1
+ import { AgentScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { ContextFetchDefinition, PaginationConfig } from "../../types/utility.js";
2
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
4
  import "../../index.js";
4
5
  import { ContextConfigInsert, ContextConfigUpdate } from "../../types/entities.js";
@@ -8,26 +9,26 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
8
9
  scopes: AgentScopeConfig;
9
10
  id: string;
10
11
  }) => Promise<{
12
+ tenantId: string;
13
+ projectId: string;
11
14
  id: string;
12
- headersSchema: unknown;
13
- contextVariables: Record<string, ContextFetchDefinition> | null;
14
15
  createdAt: string;
15
16
  updatedAt: string;
17
+ headersSchema: unknown;
18
+ contextVariables: Record<string, ContextFetchDefinition> | null;
16
19
  agentId: string;
17
- projectId: string;
18
- tenantId: string;
19
20
  } | undefined>;
20
21
  declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
21
22
  scopes: AgentScopeConfig;
22
23
  }) => Promise<{
24
+ tenantId: string;
25
+ projectId: string;
23
26
  id: string;
24
- headersSchema: unknown;
25
- contextVariables: Record<string, ContextFetchDefinition> | null;
26
27
  createdAt: string;
27
28
  updatedAt: string;
29
+ headersSchema: unknown;
30
+ contextVariables: Record<string, ContextFetchDefinition> | null;
28
31
  agentId: string;
29
- projectId: string;
30
- tenantId: string;
31
32
  }[]>;
32
33
  declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (params: {
33
34
  scopes: AgentScopeConfig;
@@ -42,14 +43,14 @@ declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (
42
43
  };
43
44
  }>;
44
45
  declare const createContextConfig: (db: AgentsManageDatabaseClient) => (params: ContextConfigInsert) => Promise<{
46
+ tenantId: string;
47
+ projectId: string;
45
48
  id: string;
46
- headersSchema: unknown;
47
- contextVariables: Record<string, ContextFetchDefinition> | null;
48
49
  createdAt: string;
49
50
  updatedAt: string;
51
+ headersSchema: unknown;
52
+ contextVariables: Record<string, ContextFetchDefinition> | null;
50
53
  agentId: string;
51
- projectId: string;
52
- tenantId: string;
53
54
  }>;
54
55
  declare const updateContextConfig: (db: AgentsManageDatabaseClient) => (params: {
55
56
  scopes: AgentScopeConfig;
@@ -82,14 +83,14 @@ declare const countContextConfigs: (db: AgentsManageDatabaseClient) => (params:
82
83
  declare const upsertContextConfig: (db: AgentsManageDatabaseClient) => (params: {
83
84
  data: ContextConfigInsert;
84
85
  }) => Promise<{
86
+ tenantId: string;
87
+ projectId: string;
85
88
  id: string;
86
- headersSchema: unknown;
87
- contextVariables: Record<string, ContextFetchDefinition> | null;
88
89
  createdAt: string;
89
90
  updatedAt: string;
91
+ headersSchema: unknown;
92
+ contextVariables: Record<string, ContextFetchDefinition> | null;
90
93
  agentId: string;
91
- projectId: string;
92
- tenantId: string;
93
94
  }>;
94
95
  //#endregion
95
96
  export { countContextConfigs, createContextConfig, deleteContextConfig, getContextConfigById, hasContextConfig, listContextConfigs, listContextConfigsPaginated, updateContextConfig, upsertContextConfig };
@@ -1,4 +1,5 @@
1
- import { PaginationConfig, ProjectScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig } from "../../types/utility.js";
2
3
  import "../../types/index.js";
3
4
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
4
5
  import { CredentialReferenceInsert, CredentialReferenceSelect, CredentialReferenceUpdate, ExternalAgentSelect, ToolSelect } from "../../types/entities.js";
@@ -1,4 +1,5 @@
1
- import { PaginationConfig, ProjectScopeConfig, SubAgentScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig, SubAgentScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig } from "../../types/utility.js";
2
3
  import "../../types/index.js";
3
4
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
4
5
  import { DataComponentInsert, DataComponentSelect, DataComponentUpdate } from "../../types/entities.js";
@@ -64,12 +65,12 @@ declare const associateDataComponentWithAgent: (db: AgentsManageDatabaseClient)
64
65
  scopes: SubAgentScopeConfig;
65
66
  dataComponentId: string;
66
67
  }) => Promise<{
68
+ tenantId: string;
69
+ projectId: string;
70
+ subAgentId: string;
67
71
  id: string;
68
72
  createdAt: string;
69
73
  agentId: string;
70
- projectId: string;
71
- tenantId: string;
72
- subAgentId: string;
73
74
  dataComponentId: string;
74
75
  }>;
75
76
  /**
@@ -106,12 +107,12 @@ declare const upsertAgentDataComponentRelation: (db: AgentsManageDatabaseClient)
106
107
  scopes: SubAgentScopeConfig;
107
108
  dataComponentId: string;
108
109
  }) => Promise<{
110
+ tenantId: string;
111
+ projectId: string;
112
+ subAgentId: string;
109
113
  id: string;
110
114
  createdAt: string;
111
115
  agentId: string;
112
- projectId: string;
113
- tenantId: string;
114
- subAgentId: string;
115
116
  dataComponentId: string;
116
117
  } | null>;
117
118
  /**
@@ -1,4 +1,5 @@
1
- import { ProjectScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import "../../types/utility.js";
2
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
4
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
4
5
  import { DatasetInsert, DatasetItemInsert, DatasetItemSelect, DatasetItemUpdate, DatasetRunConfigAgentRelationInsert, DatasetRunConfigAgentRelationSelect, DatasetRunConfigInsert, DatasetRunConfigSelect, DatasetRunConfigUpdate, DatasetSelect, DatasetUpdate, EvaluationJobConfigEvaluatorRelationInsert, EvaluationJobConfigEvaluatorRelationSelect, EvaluationJobConfigInsert, EvaluationJobConfigSelect, EvaluationRunConfigEvaluationSuiteConfigRelationInsert, EvaluationRunConfigEvaluationSuiteConfigRelationSelect, EvaluationRunConfigInsert, EvaluationRunConfigSelect, EvaluationRunConfigUpdate, EvaluationRunConfigWithSuiteConfigs, EvaluationSuiteConfigEvaluatorRelationInsert, EvaluationSuiteConfigEvaluatorRelationSelect, EvaluationSuiteConfigInsert, EvaluationSuiteConfigSelect, EvaluationSuiteConfigUpdate, EvaluatorInsert, EvaluatorSelect, EvaluatorUpdate } from "../../types/entities.js";
@@ -1,4 +1,5 @@
1
- import { PaginationConfig, ProjectScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig } from "../../types/utility.js";
2
3
  import "../../types/index.js";
3
4
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
4
5
  import { ExternalAgentInsert, ExternalAgentSelect, ExternalAgentUpdate } from "../../types/entities.js";
@@ -1,9 +1,9 @@
1
- import { AgentScopeConfig, PaginationConfig } from "../../types/utility.js";
1
+ import { AgentScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig } from "../../types/utility.js";
2
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
4
  import { FunctionToolApiInsert, FunctionToolApiUpdate } from "../../types/entities.js";
4
5
 
5
6
  //#region src/data-access/manage/functionTools.d.ts
6
-
7
7
  /**
8
8
  * Get a function tool by ID (agent-scoped)
9
9
  */
@@ -53,14 +53,14 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
53
53
  data: FunctionToolApiInsert;
54
54
  scopes: AgentScopeConfig;
55
55
  }) => Promise<{
56
+ description: string | null;
56
57
  name: string;
58
+ tenantId: string;
59
+ projectId: string;
57
60
  id: string;
58
61
  createdAt: string;
59
62
  updatedAt: string;
60
63
  agentId: string;
61
- projectId: string;
62
- tenantId: string;
63
- description: string | null;
64
64
  functionId: string;
65
65
  }>;
66
66
  /**
@@ -95,14 +95,14 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
95
95
  data: FunctionToolApiInsert;
96
96
  scopes: AgentScopeConfig;
97
97
  }) => Promise<{
98
+ description: string | null;
98
99
  name: string;
100
+ tenantId: string;
101
+ projectId: string;
99
102
  id: string;
100
103
  createdAt: string;
101
104
  updatedAt: string;
102
105
  agentId: string;
103
- projectId: string;
104
- tenantId: string;
105
- description: string | null;
106
106
  functionId: string;
107
107
  }>;
108
108
  declare const getFunctionToolsForSubAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -161,13 +161,13 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
161
161
  needsApproval?: boolean;
162
162
  }> | null;
163
163
  }) => Promise<{
164
+ tenantId: string;
165
+ projectId: string;
166
+ subAgentId: string;
164
167
  id: string;
165
168
  createdAt: string;
166
169
  updatedAt: string;
167
170
  agentId: string;
168
- projectId: string;
169
- tenantId: string;
170
- subAgentId: string;
171
171
  toolPolicies: Record<string, {
172
172
  needsApproval?: boolean;
173
173
  }> | null;
@@ -226,13 +226,13 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
226
226
  needsApproval?: boolean;
227
227
  }> | null;
228
228
  }) => Promise<{
229
+ tenantId: string;
230
+ projectId: string;
231
+ subAgentId: string;
229
232
  id: string;
230
233
  createdAt: string;
231
234
  updatedAt: string;
232
235
  agentId: string;
233
- projectId: string;
234
- tenantId: string;
235
- subAgentId: string;
236
236
  toolPolicies: Record<string, {
237
237
  needsApproval?: boolean;
238
238
  }> | null;
@@ -1,9 +1,9 @@
1
- import { PaginationConfig, ProjectScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig } from "../../types/utility.js";
2
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
4
  import { FunctionApiInsert } from "../../types/entities.js";
4
5
 
5
6
  //#region src/data-access/manage/functions.d.ts
6
-
7
7
  /**
8
8
  * Create or update a function (project-scoped)
9
9
  */
@@ -1,4 +1,5 @@
1
- import { ProjectScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import "../../types/utility.js";
2
3
  import { getLogger } from "../../utils/logger.js";
3
4
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
4
5
  import { FullProjectDefinition, FullProjectSelect, FullProjectSelectWithRelationIds } from "../../types/entities.js";
@@ -1,4 +1,5 @@
1
- import { PaginationConfig, PaginationResult, ProjectInfo, ProjectResourceCounts, ProjectScopeConfig } from "../../types/utility.js";
1
+ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig, PaginationResult, ProjectInfo, ProjectResourceCounts } from "../../types/utility.js";
2
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
4
  import { ProjectInsert, ProjectSelect, ProjectUpdate } from "../../types/entities.js";
4
5
 
@@ -1,9 +1,9 @@
1
- import { AgentScopeConfig, PaginationConfig } from "../../types/utility.js";
1
+ import { AgentScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import { PaginationConfig } from "../../types/utility.js";
2
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
4
  import { ScheduledTrigger, ScheduledTriggerInsert, ScheduledTriggerUpdate } from "../../validation/schemas.js";
4
5
 
5
6
  //#region src/data-access/manage/scheduledTriggers.d.ts
6
-
7
7
  /**
8
8
  * Get a scheduled trigger by ID (agent-scoped)
9
9
  */
@@ -1,9 +1,9 @@
1
- import { AgentScopeConfig } from "../../types/utility.js";
1
+ import { AgentScopeConfig } from "../../db/manage/scope-definitions.js";
2
+ import "../../types/utility.js";
2
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
3
4
  import { ScheduledWorkflow, ScheduledWorkflowInsert } from "../../validation/schemas.js";
4
5
 
5
6
  //#region src/data-access/manage/scheduledWorkflows.d.ts
6
-
7
7
  /**
8
8
  * Get a scheduled workflow by trigger ID (agent-scoped)
9
9
  */
@@ -1,25 +1,18 @@
1
- import { AgentScopeConfig, ProjectScopeConfig, SubAgentScopeConfig } from "../../types/utility.js";
2
- import * as drizzle_orm138 from "drizzle-orm";
1
+ import { ScopeConfig, ScopeLevel, ScopedTable } from "../../db/manage/scope-definitions.js";
2
+ import { SQL } from "drizzle-orm";
3
3
 
4
4
  //#region src/data-access/manage/scope-helpers.d.ts
5
- type TenantScopeConfig = {
6
- tenantId: string;
7
- };
8
- type TenantScopedColumns = {
9
- tenantId: any;
10
- };
11
- type ProjectScopedColumns = TenantScopedColumns & {
12
- projectId: any;
13
- };
14
- type AgentScopedColumns = ProjectScopedColumns & {
15
- agentId: any;
16
- };
17
- type SubAgentScopedColumns = AgentScopedColumns & {
18
- subAgentId: any;
19
- };
20
- declare function tenantScopedWhere<T extends TenantScopedColumns>(table: T, scopes: TenantScopeConfig): drizzle_orm138.SQL<unknown>;
21
- declare function projectScopedWhere<T extends ProjectScopedColumns>(table: T, scopes: ProjectScopeConfig): drizzle_orm138.SQL<unknown> | undefined;
22
- declare function agentScopedWhere<T extends AgentScopedColumns>(table: T, scopes: AgentScopeConfig): drizzle_orm138.SQL<unknown> | undefined;
23
- declare function subAgentScopedWhere<T extends SubAgentScopedColumns>(table: T, scopes: SubAgentScopeConfig): drizzle_orm138.SQL<unknown> | undefined;
5
+
6
+ /**
7
+ * Build a WHERE clause that filters by all scope columns for the given level.
8
+ *
9
+ * The columns and config shape are both derived from `SCOPE_KEYS` in
10
+ * `scope-definitions.ts`, so they cannot drift apart.
11
+ */
12
+ declare function scopedWhere<L extends ScopeLevel>(level: L, table: ScopedTable<L>, scopes: ScopeConfig<L>): SQL | undefined;
13
+ declare const tenantScopedWhere: <T extends ScopedTable<"tenant">>(table: T, scopes: ScopeConfig<"tenant">) => SQL<unknown> | undefined;
14
+ declare const projectScopedWhere: <T extends ScopedTable<"project">>(table: T, scopes: ScopeConfig<"project">) => SQL<unknown> | undefined;
15
+ declare const agentScopedWhere: <T extends ScopedTable<"agent">>(table: T, scopes: ScopeConfig<"agent">) => SQL<unknown> | undefined;
16
+ declare const subAgentScopedWhere: <T extends ScopedTable<"subAgent">>(table: T, scopes: ScopeConfig<"subAgent">) => SQL<unknown> | undefined;
24
17
  //#endregion
25
- export { agentScopedWhere, projectScopedWhere, subAgentScopedWhere, tenantScopedWhere };
18
+ export { agentScopedWhere, projectScopedWhere, scopedWhere, subAgentScopedWhere, tenantScopedWhere };
@@ -1,18 +1,21 @@
1
+ import { SCOPE_KEYS } from "../../db/manage/scope-definitions.js";
1
2
  import { and, eq } from "drizzle-orm";
2
3
 
3
4
  //#region src/data-access/manage/scope-helpers.ts
4
- function tenantScopedWhere(table, scopes) {
5
- return eq(table.tenantId, scopes.tenantId);
6
- }
7
- function projectScopedWhere(table, scopes) {
8
- return and(eq(table.tenantId, scopes.tenantId), eq(table.projectId, scopes.projectId));
9
- }
10
- function agentScopedWhere(table, scopes) {
11
- return and(eq(table.tenantId, scopes.tenantId), eq(table.projectId, scopes.projectId), eq(table.agentId, scopes.agentId));
12
- }
13
- function subAgentScopedWhere(table, scopes) {
14
- return and(eq(table.tenantId, scopes.tenantId), eq(table.projectId, scopes.projectId), eq(table.agentId, scopes.agentId), eq(table.subAgentId, scopes.subAgentId));
5
+ /**
6
+ * Build a WHERE clause that filters by all scope columns for the given level.
7
+ *
8
+ * The columns and config shape are both derived from `SCOPE_KEYS` in
9
+ * `scope-definitions.ts`, so they cannot drift apart.
10
+ */
11
+ function scopedWhere(level, table, scopes) {
12
+ const conditions = SCOPE_KEYS[level].map((key) => eq(table[key], scopes[key]));
13
+ return conditions.length === 1 ? conditions[0] : and(...conditions);
15
14
  }
15
+ const tenantScopedWhere = (table, scopes) => scopedWhere("tenant", table, scopes);
16
+ const projectScopedWhere = (table, scopes) => scopedWhere("project", table, scopes);
17
+ const agentScopedWhere = (table, scopes) => scopedWhere("agent", table, scopes);
18
+ const subAgentScopedWhere = (table, scopes) => scopedWhere("subAgent", table, scopes);
16
19
 
17
20
  //#endregion
18
- export { agentScopedWhere, projectScopedWhere, subAgentScopedWhere, tenantScopedWhere };
21
+ export { agentScopedWhere, projectScopedWhere, scopedWhere, subAgentScopedWhere, tenantScopedWhere };