@inkeep/agents-core 0.0.0-dev-20260331031331 → 0.0.0-dev-20260331135509

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 (62) hide show
  1. package/dist/auth/auth.d.ts +6 -6
  2. package/dist/auth/auth.js +28 -9
  3. package/dist/auth/entitlement-constants.d.ts +11 -0
  4. package/dist/auth/entitlement-constants.js +10 -0
  5. package/dist/auth/entitlement-lock.d.ts +6 -0
  6. package/dist/auth/entitlement-lock.js +13 -0
  7. package/dist/auth/entitlements.d.ts +11 -0
  8. package/dist/auth/entitlements.js +55 -0
  9. package/dist/auth/permissions.d.ts +13 -13
  10. package/dist/client-exports.d.ts +4 -3
  11. package/dist/client-exports.js +2 -1
  12. package/dist/data-access/index.d.ts +3 -2
  13. package/dist/data-access/index.js +2 -1
  14. package/dist/data-access/manage/agents.d.ts +27 -27
  15. package/dist/data-access/manage/artifactComponents.d.ts +4 -4
  16. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  17. package/dist/data-access/manage/dataComponents.d.ts +2 -2
  18. package/dist/data-access/manage/evalConfig.d.ts +1 -1
  19. package/dist/data-access/manage/functionTools.d.ts +6 -6
  20. package/dist/data-access/manage/projectLifecycle.d.ts +1 -1
  21. package/dist/data-access/manage/skills.d.ts +7 -7
  22. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  23. package/dist/data-access/manage/subAgentRelations.d.ts +16 -16
  24. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
  25. package/dist/data-access/manage/subAgents.d.ts +9 -9
  26. package/dist/data-access/manage/tools.d.ts +12 -12
  27. package/dist/data-access/manage/triggers.d.ts +2 -2
  28. package/dist/data-access/runtime/apiKeys.d.ts +8 -8
  29. package/dist/data-access/runtime/apps.d.ts +12 -12
  30. package/dist/data-access/runtime/cascade-delete.d.ts +1 -1
  31. package/dist/data-access/runtime/conversations.d.ts +17 -17
  32. package/dist/data-access/runtime/entitlements.d.ts +13 -0
  33. package/dist/data-access/runtime/entitlements.js +33 -0
  34. package/dist/data-access/runtime/ledgerArtifacts.d.ts +1 -1
  35. package/dist/data-access/runtime/messages.d.ts +10 -10
  36. package/dist/data-access/runtime/tasks.d.ts +6 -6
  37. package/dist/data-access/runtime/workflowExecutions.d.ts +1 -1
  38. package/dist/data-reconciliation/types.d.ts +1 -1
  39. package/dist/db/clean.d.ts +1 -1
  40. package/dist/db/manage/manage-schema.d.ts +351 -351
  41. package/dist/db/runtime/runtime-schema.d.ts +455 -342
  42. package/dist/db/runtime/runtime-schema.js +20 -3
  43. package/dist/index.d.ts +12 -8
  44. package/dist/index.js +6 -2
  45. package/dist/middleware/create-protected-route.d.ts +3 -0
  46. package/dist/middleware/create-protected-route.js +7 -2
  47. package/dist/middleware/entitlement-meta.d.ts +9 -0
  48. package/dist/middleware/entitlement-meta.js +11 -0
  49. package/dist/middleware/index.d.ts +2 -1
  50. package/dist/middleware/index.js +2 -1
  51. package/dist/middleware/no-auth.d.ts +2 -2
  52. package/dist/utils/error.d.ts +54 -51
  53. package/dist/utils/error.js +3 -0
  54. package/dist/utils/index.d.ts +1 -1
  55. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  56. package/dist/validation/schemas/skills.d.ts +43 -43
  57. package/dist/validation/schemas.d.ts +1967 -1967
  58. package/drizzle/runtime/0029_burly_satana.sql +13 -0
  59. package/drizzle/runtime/meta/0029_snapshot.json +4756 -0
  60. package/drizzle/runtime/meta/_journal.json +7 -0
  61. package/package.json +1 -1
  62. /package/drizzle/runtime/meta/{0023_snapshot.json → 0025_snapshot.json} +0 -0
@@ -12,11 +12,11 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
12
12
  id: string;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
+ headers: Record<string, string> | null;
16
+ agentId: string;
15
17
  projectId: string;
16
18
  tenantId: string;
17
- agentId: string;
18
19
  subAgentId: string;
19
- headers: Record<string, string> | null;
20
20
  targetAgentId: string;
21
21
  } | undefined>;
22
22
  declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
@@ -47,11 +47,11 @@ declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =>
47
47
  id: string;
48
48
  createdAt: string;
49
49
  updatedAt: string;
50
+ headers: Record<string, string> | null;
51
+ agentId: string;
50
52
  projectId: string;
51
53
  tenantId: string;
52
- agentId: string;
53
54
  subAgentId: string;
54
- headers: Record<string, string> | null;
55
55
  targetAgentId: string;
56
56
  }[]>;
57
57
  declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -60,11 +60,11 @@ declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseCli
60
60
  id: string;
61
61
  createdAt: string;
62
62
  updatedAt: string;
63
+ headers: Record<string, string> | null;
64
+ agentId: string;
63
65
  projectId: string;
64
66
  tenantId: string;
65
- agentId: string;
66
67
  subAgentId: string;
67
- headers: Record<string, string> | null;
68
68
  targetAgentId: string;
69
69
  }[]>;
70
70
  declare const getSubAgentTeamAgentRelationsByTeamAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -213,11 +213,11 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
213
213
  id: string;
214
214
  createdAt: string;
215
215
  updatedAt: string;
216
+ headers: Record<string, string> | null;
217
+ agentId: string;
216
218
  projectId: string;
217
219
  tenantId: string;
218
- agentId: string;
219
220
  subAgentId: string;
220
- headers: Record<string, string> | null;
221
221
  targetAgentId: string;
222
222
  }>;
223
223
  /**
@@ -230,11 +230,11 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
230
230
  id: string;
231
231
  createdAt: string;
232
232
  updatedAt: string;
233
+ headers: Record<string, string> | null;
234
+ agentId: string;
233
235
  projectId: string;
234
236
  tenantId: string;
235
- agentId: string;
236
237
  subAgentId: string;
237
- headers: Record<string, string> | null;
238
238
  targetAgentId: string;
239
239
  } | undefined>;
240
240
  /**
@@ -251,11 +251,11 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
251
251
  id: string;
252
252
  createdAt: string;
253
253
  updatedAt: string;
254
+ headers: Record<string, string> | null;
255
+ agentId: string;
254
256
  projectId: string;
255
257
  tenantId: string;
256
- agentId: string;
257
258
  subAgentId: string;
258
- headers: Record<string, string> | null;
259
259
  targetAgentId: string;
260
260
  }>;
261
261
  declare const updateSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
@@ -11,9 +11,10 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
11
11
  }) => Promise<{
12
12
  id: string;
13
13
  name: string;
14
- description: string | null;
15
14
  createdAt: string;
16
15
  updatedAt: string;
16
+ description: string | null;
17
+ agentId: string;
17
18
  projectId: string;
18
19
  tenantId: string;
19
20
  models: {
@@ -30,11 +31,10 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
30
31
  providerOptions?: Record<string, unknown> | undefined;
31
32
  } | undefined;
32
33
  } | null;
34
+ prompt: string | null;
33
35
  stopWhen: {
34
36
  stepCountIs?: number | undefined;
35
37
  } | null;
36
- agentId: string;
37
- prompt: string | null;
38
38
  conversationHistoryConfig: ConversationHistoryConfig | null;
39
39
  } | undefined>;
40
40
  declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
@@ -42,9 +42,10 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
42
42
  }) => Promise<{
43
43
  id: string;
44
44
  name: string;
45
- description: string | null;
46
45
  createdAt: string;
47
46
  updatedAt: string;
47
+ description: string | null;
48
+ agentId: string;
48
49
  projectId: string;
49
50
  tenantId: string;
50
51
  models: {
@@ -61,11 +62,10 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
61
62
  providerOptions?: Record<string, unknown> | undefined;
62
63
  } | undefined;
63
64
  } | null;
65
+ prompt: string | null;
64
66
  stopWhen: {
65
67
  stepCountIs?: number | undefined;
66
68
  } | null;
67
- agentId: string;
68
- prompt: string | null;
69
69
  conversationHistoryConfig: ConversationHistoryConfig | null;
70
70
  }[]>;
71
71
  declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
@@ -111,9 +111,10 @@ declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (param
111
111
  declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAgentInsert) => Promise<{
112
112
  id: string;
113
113
  name: string;
114
- description: string | null;
115
114
  createdAt: string;
116
115
  updatedAt: string;
116
+ description: string | null;
117
+ agentId: string;
117
118
  projectId: string;
118
119
  tenantId: string;
119
120
  models: {
@@ -130,11 +131,10 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
130
131
  providerOptions?: Record<string, unknown> | undefined;
131
132
  } | undefined;
132
133
  } | null;
134
+ prompt: string | null;
133
135
  stopWhen: {
134
136
  stepCountIs?: number | undefined;
135
137
  } | null;
136
- agentId: string;
137
- prompt: string | null;
138
138
  conversationHistoryConfig: ConversationHistoryConfig | null;
139
139
  }>;
140
140
  declare const updateSubAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -22,9 +22,10 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
22
22
  }) => Promise<{
23
23
  id: string;
24
24
  name: string;
25
- description: string | null;
26
25
  createdAt: string;
27
26
  updatedAt: string;
27
+ description: string | null;
28
+ headers: Record<string, string> | null;
28
29
  projectId: string;
29
30
  tenantId: string;
30
31
  config: {
@@ -33,7 +34,6 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
33
34
  };
34
35
  credentialReferenceId: string | null;
35
36
  credentialScope: string;
36
- headers: Record<string, string> | null;
37
37
  imageUrl: string | null;
38
38
  capabilities: ToolServerCapabilities | null;
39
39
  lastError: string | null;
@@ -80,9 +80,10 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
80
80
  declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
81
81
  id: string;
82
82
  name: string;
83
- description: string | null;
84
83
  createdAt: string;
85
84
  updatedAt: string;
85
+ description: string | null;
86
+ headers: Record<string, string> | null;
86
87
  projectId: string;
87
88
  tenantId: string;
88
89
  config: {
@@ -91,7 +92,6 @@ declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInser
91
92
  };
92
93
  credentialReferenceId: string | null;
93
94
  credentialScope: string;
94
- headers: Record<string, string> | null;
95
95
  imageUrl: string | null;
96
96
  capabilities: ToolServerCapabilities | null;
97
97
  lastError: string | null;
@@ -138,12 +138,12 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
138
138
  id: string;
139
139
  createdAt: string;
140
140
  updatedAt: string;
141
+ headers: Record<string, string> | null;
142
+ agentId: string;
141
143
  projectId: string;
142
144
  tenantId: string;
143
- agentId: string;
144
145
  subAgentId: string;
145
146
  toolId: string;
146
- headers: Record<string, string> | null;
147
147
  selectedTools: string[] | null;
148
148
  toolPolicies: Record<string, {
149
149
  needsApproval?: boolean;
@@ -157,12 +157,12 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
157
157
  id: string;
158
158
  createdAt: string;
159
159
  updatedAt: string;
160
+ headers: Record<string, string> | null;
161
+ agentId: string;
160
162
  projectId: string;
161
163
  tenantId: string;
162
- agentId: string;
163
164
  subAgentId: string;
164
165
  toolId: string;
165
- headers: Record<string, string> | null;
166
166
  selectedTools: string[] | null;
167
167
  toolPolicies: Record<string, {
168
168
  needsApproval?: boolean;
@@ -185,12 +185,12 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
185
185
  id: string;
186
186
  createdAt: string;
187
187
  updatedAt: string;
188
+ headers: Record<string, string> | null;
189
+ agentId: string;
188
190
  projectId: string;
189
191
  tenantId: string;
190
- agentId: string;
191
192
  subAgentId: string;
192
193
  toolId: string;
193
- headers: Record<string, string> | null;
194
194
  selectedTools: string[] | null;
195
195
  toolPolicies: Record<string, {
196
196
  needsApproval?: boolean;
@@ -204,9 +204,10 @@ declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
204
204
  }) => Promise<{
205
205
  id: string;
206
206
  name: string;
207
- description: string | null;
208
207
  createdAt: string;
209
208
  updatedAt: string;
209
+ description: string | null;
210
+ headers: Record<string, string> | null;
210
211
  projectId: string;
211
212
  tenantId: string;
212
213
  config: {
@@ -215,7 +216,6 @@ declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
215
216
  };
216
217
  credentialReferenceId: string | null;
217
218
  credentialScope: string;
218
- headers: Record<string, string> | null;
219
219
  imageUrl: string | null;
220
220
  capabilities: ToolServerCapabilities | null;
221
221
  lastError: string | null;
@@ -40,13 +40,13 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
40
40
  algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
41
41
  encoding: "hex" | "base64";
42
42
  signature: {
43
- source: "query" | "header" | "body";
43
+ source: "query" | "body" | "header";
44
44
  key: string;
45
45
  prefix?: string | undefined;
46
46
  regex?: string | undefined;
47
47
  };
48
48
  signedComponents: {
49
- source: "literal" | "header" | "body";
49
+ source: "literal" | "body" | "header";
50
50
  required: boolean;
51
51
  key?: string | undefined;
52
52
  value?: string | undefined;
@@ -12,10 +12,10 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
12
12
  name: string | null;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
- projectId: string;
16
- tenantId: string;
17
15
  expiresAt: string | null;
18
16
  agentId: string;
17
+ projectId: string;
18
+ tenantId: string;
19
19
  publicId: string;
20
20
  keyHash: string;
21
21
  keyPrefix: string;
@@ -26,10 +26,10 @@ declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: s
26
26
  name: string | null;
27
27
  createdAt: string;
28
28
  updatedAt: string;
29
- projectId: string;
30
- tenantId: string;
31
29
  expiresAt: string | null;
32
30
  agentId: string;
31
+ projectId: string;
32
+ tenantId: string;
33
33
  publicId: string;
34
34
  keyHash: string;
35
35
  keyPrefix: string;
@@ -43,10 +43,10 @@ declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
43
43
  name: string | null;
44
44
  createdAt: string;
45
45
  updatedAt: string;
46
- projectId: string;
47
- tenantId: string;
48
46
  expiresAt: string | null;
49
47
  agentId: string;
48
+ projectId: string;
49
+ tenantId: string;
50
50
  publicId: string;
51
51
  keyHash: string;
52
52
  keyPrefix: string;
@@ -70,10 +70,10 @@ declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInse
70
70
  name: string | null;
71
71
  createdAt: string;
72
72
  updatedAt: string;
73
- projectId: string;
74
- tenantId: string;
75
73
  expiresAt: string | null;
76
74
  agentId: string;
75
+ projectId: string;
76
+ tenantId: string;
77
77
  publicId: string;
78
78
  keyHash: string;
79
79
  keyPrefix: string;
@@ -5,19 +5,16 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
5
5
 
6
6
  //#region src/data-access/runtime/apps.d.ts
7
7
  declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
8
+ enabled: boolean;
8
9
  id: string;
9
10
  name: string;
10
- description: string | null;
11
11
  createdAt: string;
12
12
  updatedAt: string;
13
+ description: string | null;
14
+ type: AppType;
13
15
  projectId: string | null;
14
16
  tenantId: string | null;
15
- type: AppType;
16
- lastUsedAt: string | null;
17
- defaultProjectId: string | null;
18
- defaultAgentId: string | null;
19
17
  prompt: string | null;
20
- enabled: boolean;
21
18
  config: {
22
19
  type: "web_client";
23
20
  webClient: {
@@ -38,6 +35,9 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
38
35
  type: "api";
39
36
  api: Record<string, never>;
40
37
  };
38
+ lastUsedAt: string | null;
39
+ defaultProjectId: string | null;
40
+ defaultAgentId: string | null;
41
41
  } | undefined>;
42
42
  declare const updateAppLastUsed: (db: AgentsRunDatabaseClient) => (id: string) => Promise<void>;
43
43
  declare const getAppByIdForTenant: (db: AgentsRunDatabaseClient) => (params: {
@@ -64,19 +64,16 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
64
64
  };
65
65
  }>;
66
66
  declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
67
+ enabled: boolean;
67
68
  id: string;
68
69
  name: string;
69
- description: string | null;
70
70
  createdAt: string;
71
71
  updatedAt: string;
72
+ description: string | null;
73
+ type: AppType;
72
74
  projectId: string | null;
73
75
  tenantId: string | null;
74
- type: AppType;
75
- lastUsedAt: string | null;
76
- defaultProjectId: string | null;
77
- defaultAgentId: string | null;
78
76
  prompt: string | null;
79
- enabled: boolean;
80
77
  config: {
81
78
  type: "web_client";
82
79
  webClient: {
@@ -97,6 +94,9 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
97
94
  type: "api";
98
95
  api: Record<string, never>;
99
96
  };
97
+ lastUsedAt: string | null;
98
+ defaultProjectId: string | null;
99
+ defaultAgentId: string | null;
100
100
  }>;
101
101
  declare const updateAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
102
102
  scopes: TenantScopeConfig;
@@ -1,6 +1,6 @@
1
1
  import { AgentScopeConfig, ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
- import "../../types/index.js";
3
2
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
3
+ import "../../types/index.js";
4
4
 
5
5
  //#region src/data-access/runtime/cascade-delete.d.ts
6
6
  /**
@@ -1,8 +1,8 @@
1
1
  import { ResolvedRef } from "../../validation/dolt-schemas.js";
2
2
  import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
3
3
  import { ConversationHistoryConfig, ConversationMetadata, PaginationConfig } from "../../types/utility.js";
4
- import "../../types/index.js";
5
4
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
5
+ import "../../types/index.js";
6
6
  import { ConversationInsert, ConversationSelect, ConversationUpdate, MessageSelect } from "../../types/entities.js";
7
7
 
8
8
  //#region src/data-access/runtime/conversations.d.ts
@@ -16,19 +16,19 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
16
16
  }>;
17
17
  declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
18
18
  id: string;
19
- metadata: ConversationMetadata | null;
20
19
  createdAt: string;
21
20
  updatedAt: string;
22
- projectId: string;
23
- tenantId: string;
24
- title: string | null;
25
21
  ref: {
26
22
  type: "commit" | "tag" | "branch";
27
23
  name: string;
28
24
  hash: string;
29
25
  } | null;
30
26
  userId: string | null;
27
+ metadata: ConversationMetadata | null;
31
28
  agentId: string | null;
29
+ projectId: string;
30
+ tenantId: string;
31
+ title: string | null;
32
32
  activeSubAgentId: string;
33
33
  lastContextResolution: string | null;
34
34
  }>;
@@ -85,19 +85,19 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
85
85
  conversationId: string;
86
86
  }) => Promise<{
87
87
  id: string;
88
- metadata: ConversationMetadata | null;
89
88
  createdAt: string;
90
89
  updatedAt: string;
91
- projectId: string;
92
- tenantId: string;
93
- title: string | null;
94
90
  ref: {
95
91
  type: "commit" | "tag" | "branch";
96
92
  name: string;
97
93
  hash: string;
98
94
  } | null;
99
95
  userId: string | null;
96
+ metadata: ConversationMetadata | null;
100
97
  agentId: string | null;
98
+ projectId: string;
99
+ tenantId: string;
100
+ title: string | null;
101
101
  activeSubAgentId: string;
102
102
  lastContextResolution: string | null;
103
103
  } | undefined>;
@@ -121,19 +121,19 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
121
121
  contextConfigId?: string | undefined;
122
122
  } | {
123
123
  id: string;
124
- metadata: ConversationMetadata | null;
125
124
  createdAt: string;
126
125
  updatedAt: string;
127
- projectId: string;
128
- tenantId: string;
129
- title: string | null;
130
126
  ref: {
131
127
  type: "commit" | "tag" | "branch";
132
128
  name: string;
133
129
  hash: string;
134
130
  } | null;
135
131
  userId: string | null;
132
+ metadata: ConversationMetadata | null;
136
133
  agentId: string | null;
134
+ projectId: string;
135
+ tenantId: string;
136
+ title: string | null;
137
137
  activeSubAgentId: string;
138
138
  lastContextResolution: string | null;
139
139
  }>;
@@ -153,19 +153,19 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
153
153
  conversationId: string;
154
154
  }) => Promise<{
155
155
  id: string;
156
- metadata: ConversationMetadata | null;
157
156
  createdAt: string;
158
157
  updatedAt: string;
159
- projectId: string;
160
- tenantId: string;
161
- title: string | null;
162
158
  ref: {
163
159
  type: "commit" | "tag" | "branch";
164
160
  name: string;
165
161
  hash: string;
166
162
  } | null;
167
163
  userId: string | null;
164
+ metadata: ConversationMetadata | null;
168
165
  agentId: string | null;
166
+ projectId: string;
167
+ tenantId: string;
168
+ title: string | null;
169
169
  activeSubAgentId: string;
170
170
  lastContextResolution: string | null;
171
171
  } | undefined>;
@@ -0,0 +1,13 @@
1
+ import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
2
+
3
+ //#region src/data-access/runtime/entitlements.d.ts
4
+ declare const listOrgEntitlements: (db: AgentsRunDatabaseClient) => (orgId: string) => Promise<Array<{
5
+ resourceType: string;
6
+ maxValue: number;
7
+ }>>;
8
+ declare function dalResolveEntitlement(db: AgentsRunDatabaseClient, orgId: string, resourceType: string): Promise<number | null>;
9
+ declare function dalGetServiceAccountUserId(db: AgentsRunDatabaseClient, orgId: string): Promise<string | null>;
10
+ declare function dalCountMembersByRoleBucket(db: AgentsRunDatabaseClient, orgId: string, isAdminBucket: boolean, serviceAccountUserId: string | null): Promise<number>;
11
+ declare function dalSumSeatEntitlements(db: AgentsRunDatabaseClient, orgId: string): Promise<number | null>;
12
+ //#endregion
13
+ export { dalCountMembersByRoleBucket, dalGetServiceAccountUserId, dalResolveEntitlement, dalSumSeatEntitlements, listOrgEntitlements };
@@ -0,0 +1,33 @@
1
+ import { member, organization } from "../../auth/auth-schema.js";
2
+ import { orgEntitlement } from "../../db/runtime/runtime-schema.js";
3
+ import { and, eq, like, or, sql } from "drizzle-orm";
4
+
5
+ //#region src/data-access/runtime/entitlements.ts
6
+ const listOrgEntitlements = (db) => async (orgId) => {
7
+ return await db.select({
8
+ resourceType: orgEntitlement.resourceType,
9
+ maxValue: orgEntitlement.maxValue
10
+ }).from(orgEntitlement).where(eq(orgEntitlement.organizationId, orgId));
11
+ };
12
+ async function dalResolveEntitlement(db, orgId, resourceType) {
13
+ const rows = await db.select({ maxValue: orgEntitlement.maxValue }).from(orgEntitlement).where(and(eq(orgEntitlement.organizationId, orgId), eq(orgEntitlement.resourceType, resourceType)));
14
+ if (rows.length === 0) return null;
15
+ return rows[0].maxValue;
16
+ }
17
+ async function dalGetServiceAccountUserId(db, orgId) {
18
+ return (await db.select({ serviceAccountUserId: organization.serviceAccountUserId }).from(organization).where(eq(organization.id, orgId)))[0]?.serviceAccountUserId ?? null;
19
+ }
20
+ async function dalCountMembersByRoleBucket(db, orgId, isAdminBucket, serviceAccountUserId) {
21
+ const memberCondition = isAdminBucket ? or(eq(member.role, "owner"), eq(member.role, "admin")) : eq(member.role, "member");
22
+ const memberWhere = serviceAccountUserId ? and(eq(member.organizationId, orgId), memberCondition, sql`${member.userId} != ${serviceAccountUserId}`) : and(eq(member.organizationId, orgId), memberCondition);
23
+ const [result] = await db.select({ count: sql`count(*)::int` }).from(member).where(memberWhere);
24
+ return result?.count ?? 0;
25
+ }
26
+ async function dalSumSeatEntitlements(db, orgId) {
27
+ const rows = await db.select({ maxValue: orgEntitlement.maxValue }).from(orgEntitlement).where(and(eq(orgEntitlement.organizationId, orgId), like(orgEntitlement.resourceType, "seat:%")));
28
+ if (rows.length === 0) return null;
29
+ return rows.reduce((sum, r) => sum + r.maxValue, 0);
30
+ }
31
+
32
+ //#endregion
33
+ export { dalCountMembersByRoleBucket, dalGetServiceAccountUserId, dalResolveEntitlement, dalSumSeatEntitlements, listOrgEntitlements };
@@ -1,7 +1,7 @@
1
1
  import { Artifact, Part } from "../../types/a2a.js";
2
2
  import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
3
- import "../../types/index.js";
4
3
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
4
+ import "../../types/index.js";
5
5
  import { LedgerArtifactSelect } from "../../types/entities.js";
6
6
 
7
7
  //#region src/data-access/runtime/ledgerArtifacts.d.ts
@@ -1,7 +1,7 @@
1
1
  import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
2
  import { MessageContent, MessageMetadata, MessageVisibility, PaginationConfig } from "../../types/utility.js";
3
- import "../../types/index.js";
4
3
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
4
+ import "../../types/index.js";
5
5
  import "../../index.js";
6
6
  import { MessageInsert, MessageUpdate } from "../../types/entities.js";
7
7
 
@@ -11,13 +11,13 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
11
11
  messageId: string;
12
12
  }) => Promise<{
13
13
  id: string;
14
- content: MessageContent;
15
- metadata: MessageMetadata | null;
16
14
  createdAt: string;
17
15
  updatedAt: string;
16
+ metadata: MessageMetadata | null;
17
+ role: string;
18
18
  projectId: string;
19
19
  tenantId: string;
20
- role: string;
20
+ content: MessageContent;
21
21
  conversationId: string;
22
22
  fromSubAgentId: string | null;
23
23
  toSubAgentId: string | null;
@@ -145,13 +145,13 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
145
145
  data: Omit<MessageInsert, "tenantId" | "projectId">;
146
146
  }) => Promise<{
147
147
  id: string;
148
- content: MessageContent;
149
- metadata: MessageMetadata | null;
150
148
  createdAt: string;
151
149
  updatedAt: string;
150
+ metadata: MessageMetadata | null;
151
+ role: string;
152
152
  projectId: string;
153
153
  tenantId: string;
154
- role: string;
154
+ content: MessageContent;
155
155
  conversationId: string;
156
156
  fromSubAgentId: string | null;
157
157
  toSubAgentId: string | null;
@@ -198,13 +198,13 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
198
198
  messageId: string;
199
199
  }) => Promise<{
200
200
  id: string;
201
- content: MessageContent;
202
- metadata: MessageMetadata | null;
203
201
  createdAt: string;
204
202
  updatedAt: string;
203
+ metadata: MessageMetadata | null;
204
+ role: string;
205
205
  projectId: string;
206
206
  tenantId: string;
207
- role: string;
207
+ content: MessageContent;
208
208
  conversationId: string;
209
209
  fromSubAgentId: string | null;
210
210
  toSubAgentId: string | null;
@@ -1,27 +1,27 @@
1
1
  import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
2
  import { TaskMetadataConfig } from "../../types/utility.js";
3
- import "../../types/index.js";
4
3
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
4
+ import "../../types/index.js";
5
5
  import "../../index.js";
6
6
  import { TaskInsert, TaskSelect } from "../../types/entities.js";
7
7
 
8
8
  //#region src/data-access/runtime/tasks.d.ts
9
9
  declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
10
10
  id: string;
11
- metadata: TaskMetadataConfig | null;
12
11
  createdAt: string;
13
12
  updatedAt: string;
14
- projectId: string;
15
- tenantId: string;
16
- status: string;
17
13
  ref: {
18
14
  type: "commit" | "tag" | "branch";
19
15
  name: string;
20
16
  hash: string;
21
17
  } | null;
18
+ metadata: TaskMetadataConfig | null;
19
+ status: string;
22
20
  agentId: string;
23
- contextId: string;
21
+ projectId: string;
22
+ tenantId: string;
24
23
  subAgentId: string;
24
+ contextId: string;
25
25
  }>;
26
26
  declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
27
27
  id: string;
@@ -1,5 +1,5 @@
1
- import "../../types/index.js";
2
1
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
2
+ import "../../types/index.js";
3
3
  import { WorkflowExecutionInsert, WorkflowExecutionSelect } from "../../types/entities.js";
4
4
 
5
5
  //#region src/data-access/runtime/workflowExecutions.d.ts
@@ -1,6 +1,6 @@
1
+ import { AgentsRunDatabaseClient } from "../db/runtime/runtime-client.js";
1
2
  import { PinoLogger } from "../utils/logger.js";
2
3
  import { AgentsManageDatabaseClient } from "../db/manage/manage-client.js";
3
- import { AgentsRunDatabaseClient } from "../db/runtime/runtime-client.js";
4
4
  import { AgentSelect, ContextConfigSelect, SubAgentSelect, ToolSelect } from "../types/entities.js";
5
5
 
6
6
  //#region src/data-reconciliation/types.d.ts
@@ -1,5 +1,5 @@
1
- import { AgentsManageDatabaseClient } from "./manage/manage-client.js";
2
1
  import { AgentsRunDatabaseClient } from "./runtime/runtime-client.js";
2
+ import { AgentsManageDatabaseClient } from "./manage/manage-client.js";
3
3
 
4
4
  //#region src/db/clean.d.ts
5
5