@inkeep/agents-core 0.0.0-dev-20260331052759 → 0.0.0-dev-20260331152429
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.
- package/dist/auth/auth-validation-schemas.d.ts +17 -17
- package/dist/auth/auth.d.ts +6 -6
- package/dist/auth/auth.js +28 -9
- package/dist/auth/entitlement-constants.d.ts +11 -0
- package/dist/auth/entitlement-constants.js +10 -0
- package/dist/auth/entitlement-lock.d.ts +6 -0
- package/dist/auth/entitlement-lock.js +13 -0
- package/dist/auth/entitlements.d.ts +11 -0
- package/dist/auth/entitlements.js +55 -0
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/client-exports.d.ts +4 -3
- package/dist/client-exports.js +2 -1
- package/dist/data-access/index.d.ts +3 -2
- package/dist/data-access/index.js +2 -1
- package/dist/data-access/manage/agents.d.ts +18 -18
- package/dist/data-access/manage/artifactComponents.d.ts +8 -8
- package/dist/data-access/manage/contextConfigs.d.ts +8 -8
- package/dist/data-access/manage/dataComponents.d.ts +4 -4
- package/dist/data-access/manage/evalConfig.d.ts +1 -1
- package/dist/data-access/manage/functionTools.d.ts +10 -10
- package/dist/data-access/manage/projectLifecycle.d.ts +1 -1
- package/dist/data-access/manage/skills.d.ts +11 -11
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgentRelations.d.ts +14 -14
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgents.d.ts +6 -6
- package/dist/data-access/manage/tools.d.ts +21 -21
- package/dist/data-access/runtime/apiKeys.d.ts +8 -8
- package/dist/data-access/runtime/apps.d.ts +14 -14
- package/dist/data-access/runtime/cascade-delete.d.ts +1 -1
- package/dist/data-access/runtime/conversations.d.ts +17 -17
- package/dist/data-access/runtime/entitlements.d.ts +13 -0
- package/dist/data-access/runtime/entitlements.js +33 -0
- package/dist/data-access/runtime/ledgerArtifacts.d.ts +1 -1
- package/dist/data-access/runtime/messages.d.ts +22 -22
- package/dist/data-access/runtime/tasks.d.ts +6 -6
- package/dist/data-access/runtime/workflowExecutions.d.ts +1 -1
- package/dist/data-reconciliation/types.d.ts +1 -1
- package/dist/db/clean.d.ts +1 -1
- package/dist/db/manage/manage-schema.d.ts +2 -218
- package/dist/db/manage/manage-schema.js +2 -128
- package/dist/db/runtime/runtime-schema.d.ts +485 -372
- package/dist/db/runtime/runtime-schema.js +20 -3
- package/dist/index.d.ts +13 -9
- package/dist/index.js +7 -3
- package/dist/middleware/create-protected-route.d.ts +3 -0
- package/dist/middleware/create-protected-route.js +7 -2
- package/dist/middleware/entitlement-meta.d.ts +9 -0
- package/dist/middleware/entitlement-meta.js +11 -0
- package/dist/middleware/index.d.ts +2 -1
- package/dist/middleware/index.js +2 -1
- package/dist/utils/error.d.ts +54 -51
- package/dist/utils/error.js +3 -0
- package/dist/utils/index.d.ts +1 -1
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/schemas/skills.d.ts +49 -49
- package/dist/validation/schemas.d.ts +450 -450
- package/drizzle/manage/0016_complex_klaw.sql +2 -0
- package/drizzle/manage/meta/0016_snapshot.json +3530 -0
- package/drizzle/manage/meta/_journal.json +7 -0
- package/drizzle/runtime/0029_burly_satana.sql +13 -0
- package/drizzle/runtime/meta/0029_snapshot.json +4756 -0
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +1 -1
- /package/drizzle/runtime/meta/{0023_snapshot.json → 0025_snapshot.json} +0 -0
|
@@ -12,8 +12,8 @@ declare const getAgentRelationById: (db: AgentsManageDatabaseClient) => (params:
|
|
|
12
12
|
id: string;
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
|
-
projectId: string;
|
|
16
15
|
tenantId: string;
|
|
16
|
+
projectId: string;
|
|
17
17
|
agentId: string;
|
|
18
18
|
relationType: string | null;
|
|
19
19
|
sourceSubAgentId: string;
|
|
@@ -47,8 +47,8 @@ declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
47
47
|
id: string;
|
|
48
48
|
createdAt: string;
|
|
49
49
|
updatedAt: string;
|
|
50
|
-
projectId: string;
|
|
51
50
|
tenantId: string;
|
|
51
|
+
projectId: string;
|
|
52
52
|
agentId: string;
|
|
53
53
|
relationType: string | null;
|
|
54
54
|
sourceSubAgentId: string;
|
|
@@ -60,8 +60,8 @@ declare const getAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (par
|
|
|
60
60
|
id: string;
|
|
61
61
|
createdAt: string;
|
|
62
62
|
updatedAt: string;
|
|
63
|
-
projectId: string;
|
|
64
63
|
tenantId: string;
|
|
64
|
+
projectId: string;
|
|
65
65
|
agentId: string;
|
|
66
66
|
relationType: string | null;
|
|
67
67
|
sourceSubAgentId: string;
|
|
@@ -129,8 +129,8 @@ declare const createSubAgentRelation: (db: AgentsManageDatabaseClient) => (param
|
|
|
129
129
|
id: string;
|
|
130
130
|
createdAt: string;
|
|
131
131
|
updatedAt: string;
|
|
132
|
-
projectId: string;
|
|
133
132
|
tenantId: string;
|
|
133
|
+
projectId: string;
|
|
134
134
|
agentId: string;
|
|
135
135
|
relationType: string | null;
|
|
136
136
|
sourceSubAgentId: string;
|
|
@@ -148,8 +148,8 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
|
|
|
148
148
|
id: string;
|
|
149
149
|
createdAt: string;
|
|
150
150
|
updatedAt: string;
|
|
151
|
-
projectId: string;
|
|
152
151
|
tenantId: string;
|
|
152
|
+
projectId: string;
|
|
153
153
|
agentId: string;
|
|
154
154
|
relationType: string | null;
|
|
155
155
|
sourceSubAgentId: string;
|
|
@@ -162,8 +162,8 @@ declare const upsertSubAgentRelation: (db: AgentsManageDatabaseClient) => (param
|
|
|
162
162
|
id: string;
|
|
163
163
|
createdAt: string;
|
|
164
164
|
updatedAt: string;
|
|
165
|
-
projectId: string;
|
|
166
165
|
tenantId: string;
|
|
166
|
+
projectId: string;
|
|
167
167
|
agentId: string;
|
|
168
168
|
relationType: string | null;
|
|
169
169
|
sourceSubAgentId: string;
|
|
@@ -207,16 +207,16 @@ declare const createAgentToolRelation: (db: AgentsManageDatabaseClient) => (para
|
|
|
207
207
|
id: string;
|
|
208
208
|
createdAt: string;
|
|
209
209
|
updatedAt: string;
|
|
210
|
-
projectId: string;
|
|
211
210
|
tenantId: string;
|
|
212
|
-
|
|
211
|
+
projectId: string;
|
|
213
212
|
subAgentId: string;
|
|
214
|
-
|
|
213
|
+
agentId: string;
|
|
215
214
|
headers: Record<string, string> | null;
|
|
216
|
-
|
|
215
|
+
toolId: string;
|
|
217
216
|
toolPolicies: Record<string, {
|
|
218
217
|
needsApproval?: boolean;
|
|
219
218
|
}> | null;
|
|
219
|
+
selectedTools: string[] | null;
|
|
220
220
|
}>;
|
|
221
221
|
declare const updateAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
|
|
222
222
|
scopes: AgentScopeConfig;
|
|
@@ -251,16 +251,16 @@ declare const getAgentToolRelationById: (db: AgentsManageDatabaseClient) => (par
|
|
|
251
251
|
id: string;
|
|
252
252
|
createdAt: string;
|
|
253
253
|
updatedAt: string;
|
|
254
|
-
projectId: string;
|
|
255
254
|
tenantId: string;
|
|
256
|
-
|
|
255
|
+
projectId: string;
|
|
257
256
|
subAgentId: string;
|
|
258
|
-
|
|
257
|
+
agentId: string;
|
|
259
258
|
headers: Record<string, string> | null;
|
|
260
|
-
|
|
259
|
+
toolId: string;
|
|
261
260
|
toolPolicies: Record<string, {
|
|
262
261
|
needsApproval?: boolean;
|
|
263
262
|
}> | null;
|
|
263
|
+
selectedTools: string[] | null;
|
|
264
264
|
} | undefined>;
|
|
265
265
|
declare const getAgentToolRelationByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
266
266
|
scopes: SubAgentScopeConfig;
|
|
@@ -12,10 +12,10 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
|
|
|
12
12
|
id: string;
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
|
-
projectId: string;
|
|
16
15
|
tenantId: string;
|
|
17
|
-
|
|
16
|
+
projectId: string;
|
|
18
17
|
subAgentId: string;
|
|
18
|
+
agentId: string;
|
|
19
19
|
headers: Record<string, string> | null;
|
|
20
20
|
targetAgentId: string;
|
|
21
21
|
} | undefined>;
|
|
@@ -47,10 +47,10 @@ declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =>
|
|
|
47
47
|
id: string;
|
|
48
48
|
createdAt: string;
|
|
49
49
|
updatedAt: string;
|
|
50
|
-
projectId: string;
|
|
51
50
|
tenantId: string;
|
|
52
|
-
|
|
51
|
+
projectId: string;
|
|
53
52
|
subAgentId: string;
|
|
53
|
+
agentId: string;
|
|
54
54
|
headers: Record<string, string> | null;
|
|
55
55
|
targetAgentId: string;
|
|
56
56
|
}[]>;
|
|
@@ -60,10 +60,10 @@ declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseCli
|
|
|
60
60
|
id: string;
|
|
61
61
|
createdAt: string;
|
|
62
62
|
updatedAt: string;
|
|
63
|
-
projectId: string;
|
|
64
63
|
tenantId: string;
|
|
65
|
-
|
|
64
|
+
projectId: string;
|
|
66
65
|
subAgentId: string;
|
|
66
|
+
agentId: string;
|
|
67
67
|
headers: Record<string, string> | null;
|
|
68
68
|
targetAgentId: string;
|
|
69
69
|
}[]>;
|
|
@@ -213,10 +213,10 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
|
|
|
213
213
|
id: string;
|
|
214
214
|
createdAt: string;
|
|
215
215
|
updatedAt: string;
|
|
216
|
-
projectId: string;
|
|
217
216
|
tenantId: string;
|
|
218
|
-
|
|
217
|
+
projectId: string;
|
|
219
218
|
subAgentId: string;
|
|
219
|
+
agentId: string;
|
|
220
220
|
headers: Record<string, string> | null;
|
|
221
221
|
targetAgentId: string;
|
|
222
222
|
}>;
|
|
@@ -230,10 +230,10 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
|
|
|
230
230
|
id: string;
|
|
231
231
|
createdAt: string;
|
|
232
232
|
updatedAt: string;
|
|
233
|
-
projectId: string;
|
|
234
233
|
tenantId: string;
|
|
235
|
-
|
|
234
|
+
projectId: string;
|
|
236
235
|
subAgentId: string;
|
|
236
|
+
agentId: string;
|
|
237
237
|
headers: Record<string, string> | null;
|
|
238
238
|
targetAgentId: string;
|
|
239
239
|
} | undefined>;
|
|
@@ -251,10 +251,10 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
|
|
|
251
251
|
id: string;
|
|
252
252
|
createdAt: string;
|
|
253
253
|
updatedAt: string;
|
|
254
|
-
projectId: string;
|
|
255
254
|
tenantId: string;
|
|
256
|
-
|
|
255
|
+
projectId: string;
|
|
257
256
|
subAgentId: string;
|
|
257
|
+
agentId: string;
|
|
258
258
|
headers: Record<string, string> | null;
|
|
259
259
|
targetAgentId: string;
|
|
260
260
|
}>;
|
|
@@ -11,11 +11,11 @@ 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;
|
|
17
|
-
|
|
16
|
+
description: string | null;
|
|
18
17
|
tenantId: string;
|
|
18
|
+
projectId: string;
|
|
19
19
|
models: {
|
|
20
20
|
base?: {
|
|
21
21
|
model?: string | undefined;
|
|
@@ -42,11 +42,11 @@ 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;
|
|
48
|
-
|
|
47
|
+
description: string | null;
|
|
49
48
|
tenantId: string;
|
|
49
|
+
projectId: string;
|
|
50
50
|
models: {
|
|
51
51
|
base?: {
|
|
52
52
|
model?: string | undefined;
|
|
@@ -111,11 +111,11 @@ 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;
|
|
117
|
-
|
|
116
|
+
description: string | null;
|
|
118
117
|
tenantId: string;
|
|
118
|
+
projectId: string;
|
|
119
119
|
models: {
|
|
120
120
|
base?: {
|
|
121
121
|
model?: string | undefined;
|
|
@@ -22,18 +22,18 @@ 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;
|
|
28
|
-
|
|
27
|
+
description: string | null;
|
|
29
28
|
tenantId: string;
|
|
29
|
+
projectId: string;
|
|
30
|
+
headers: Record<string, string> | null;
|
|
30
31
|
config: {
|
|
31
32
|
type: "mcp";
|
|
32
33
|
mcp: ToolMcpConfig;
|
|
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,18 +80,18 @@ 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;
|
|
86
|
-
|
|
85
|
+
description: string | null;
|
|
87
86
|
tenantId: string;
|
|
87
|
+
projectId: string;
|
|
88
|
+
headers: Record<string, string> | null;
|
|
88
89
|
config: {
|
|
89
90
|
type: "mcp";
|
|
90
91
|
mcp: ToolMcpConfig;
|
|
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,16 +138,16 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
138
138
|
id: string;
|
|
139
139
|
createdAt: string;
|
|
140
140
|
updatedAt: string;
|
|
141
|
-
projectId: string;
|
|
142
141
|
tenantId: string;
|
|
143
|
-
|
|
142
|
+
projectId: string;
|
|
144
143
|
subAgentId: string;
|
|
145
|
-
|
|
144
|
+
agentId: string;
|
|
146
145
|
headers: Record<string, string> | null;
|
|
147
|
-
|
|
146
|
+
toolId: string;
|
|
148
147
|
toolPolicies: Record<string, {
|
|
149
148
|
needsApproval?: boolean;
|
|
150
149
|
}> | null;
|
|
150
|
+
selectedTools: string[] | null;
|
|
151
151
|
}>;
|
|
152
152
|
declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
153
153
|
scopes: AgentScopeConfig;
|
|
@@ -157,16 +157,16 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
|
|
|
157
157
|
id: string;
|
|
158
158
|
createdAt: string;
|
|
159
159
|
updatedAt: string;
|
|
160
|
-
projectId: string;
|
|
161
160
|
tenantId: string;
|
|
162
|
-
|
|
161
|
+
projectId: string;
|
|
163
162
|
subAgentId: string;
|
|
164
|
-
|
|
163
|
+
agentId: string;
|
|
165
164
|
headers: Record<string, string> | null;
|
|
166
|
-
|
|
165
|
+
toolId: string;
|
|
167
166
|
toolPolicies: Record<string, {
|
|
168
167
|
needsApproval?: boolean;
|
|
169
168
|
}> | null;
|
|
169
|
+
selectedTools: string[] | null;
|
|
170
170
|
}>;
|
|
171
171
|
/**
|
|
172
172
|
* Upsert agent-tool relation (create if it doesn't exist, update if it does)
|
|
@@ -185,16 +185,16 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
|
|
|
185
185
|
id: string;
|
|
186
186
|
createdAt: string;
|
|
187
187
|
updatedAt: string;
|
|
188
|
-
projectId: string;
|
|
189
188
|
tenantId: string;
|
|
190
|
-
|
|
189
|
+
projectId: string;
|
|
191
190
|
subAgentId: string;
|
|
192
|
-
|
|
191
|
+
agentId: string;
|
|
193
192
|
headers: Record<string, string> | null;
|
|
194
|
-
|
|
193
|
+
toolId: string;
|
|
195
194
|
toolPolicies: Record<string, {
|
|
196
195
|
needsApproval?: boolean;
|
|
197
196
|
}> | null;
|
|
197
|
+
selectedTools: string[] | null;
|
|
198
198
|
}>;
|
|
199
199
|
/**
|
|
200
200
|
* Upsert a tool (create if it doesn't exist, update if it does)
|
|
@@ -204,18 +204,18 @@ 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;
|
|
210
|
-
|
|
209
|
+
description: string | null;
|
|
211
210
|
tenantId: string;
|
|
211
|
+
projectId: string;
|
|
212
|
+
headers: Record<string, string> | null;
|
|
212
213
|
config: {
|
|
213
214
|
type: "mcp";
|
|
214
215
|
mcp: ToolMcpConfig;
|
|
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;
|
|
@@ -12,9 +12,9 @@ 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;
|
|
16
|
+
tenantId: string;
|
|
17
|
+
projectId: string;
|
|
18
18
|
agentId: string;
|
|
19
19
|
publicId: string;
|
|
20
20
|
keyHash: string;
|
|
@@ -26,9 +26,9 @@ 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;
|
|
30
|
+
tenantId: string;
|
|
31
|
+
projectId: string;
|
|
32
32
|
agentId: string;
|
|
33
33
|
publicId: string;
|
|
34
34
|
keyHash: string;
|
|
@@ -43,9 +43,9 @@ 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;
|
|
47
|
+
tenantId: string;
|
|
48
|
+
projectId: string;
|
|
49
49
|
agentId: string;
|
|
50
50
|
publicId: string;
|
|
51
51
|
keyHash: string;
|
|
@@ -70,9 +70,9 @@ 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;
|
|
74
|
+
tenantId: string;
|
|
75
|
+
projectId: string;
|
|
76
76
|
agentId: string;
|
|
77
77
|
publicId: string;
|
|
78
78
|
keyHash: 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
|
+
type: AppType;
|
|
8
9
|
id: string;
|
|
9
10
|
name: string;
|
|
10
|
-
description: string | null;
|
|
11
11
|
createdAt: string;
|
|
12
12
|
updatedAt: string;
|
|
13
|
-
|
|
13
|
+
description: string | null;
|
|
14
14
|
tenantId: string | null;
|
|
15
|
-
|
|
16
|
-
lastUsedAt: string | null;
|
|
17
|
-
defaultProjectId: string | null;
|
|
18
|
-
defaultAgentId: string | null;
|
|
19
|
-
prompt: string | null;
|
|
15
|
+
projectId: string | null;
|
|
20
16
|
enabled: boolean;
|
|
17
|
+
prompt: string | null;
|
|
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
|
+
type: AppType;
|
|
67
68
|
id: string;
|
|
68
69
|
name: string;
|
|
69
|
-
description: string | null;
|
|
70
70
|
createdAt: string;
|
|
71
71
|
updatedAt: string;
|
|
72
|
-
|
|
72
|
+
description: string | null;
|
|
73
73
|
tenantId: string | null;
|
|
74
|
-
|
|
75
|
-
lastUsedAt: string | null;
|
|
76
|
-
defaultProjectId: string | null;
|
|
77
|
-
defaultAgentId: string | null;
|
|
78
|
-
prompt: string | null;
|
|
74
|
+
projectId: string | null;
|
|
79
75
|
enabled: boolean;
|
|
76
|
+
prompt: string | null;
|
|
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,18 +16,18 @@ 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;
|
|
28
|
+
title: string | null;
|
|
29
|
+
tenantId: string;
|
|
30
|
+
projectId: string;
|
|
31
31
|
agentId: string | null;
|
|
32
32
|
activeSubAgentId: string;
|
|
33
33
|
lastContextResolution: string | null;
|
|
@@ -85,18 +85,18 @@ 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;
|
|
97
|
+
title: string | null;
|
|
98
|
+
tenantId: string;
|
|
99
|
+
projectId: string;
|
|
100
100
|
agentId: string | null;
|
|
101
101
|
activeSubAgentId: string;
|
|
102
102
|
lastContextResolution: string | null;
|
|
@@ -121,18 +121,18 @@ 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;
|
|
133
|
+
title: string | null;
|
|
134
|
+
tenantId: string;
|
|
135
|
+
projectId: string;
|
|
136
136
|
agentId: string | null;
|
|
137
137
|
activeSubAgentId: string;
|
|
138
138
|
lastContextResolution: string | null;
|
|
@@ -153,18 +153,18 @@ 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;
|
|
165
|
+
title: string | null;
|
|
166
|
+
tenantId: string;
|
|
167
|
+
projectId: string;
|
|
168
168
|
agentId: string | null;
|
|
169
169
|
activeSubAgentId: string;
|
|
170
170
|
lastContextResolution: string | null;
|
|
@@ -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
|