@inkeep/agents-core 0.0.0-dev-20260219045007 → 0.0.0-dev-20260219101444
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-schema.d.ts +83 -83
- package/dist/auth/auth-validation-schemas.d.ts +131 -131
- package/dist/data-access/manage/agents.d.ts +32 -32
- package/dist/data-access/manage/artifactComponents.d.ts +8 -8
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/dataComponents.d.ts +4 -4
- package/dist/data-access/manage/functionTools.d.ts +10 -10
- package/dist/data-access/manage/scope-helpers.d.ts +25 -0
- package/dist/data-access/manage/scope-helpers.js +18 -0
- package/dist/data-access/manage/skills.d.ts +8 -8
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgentExternalAgentRelations.js +13 -12
- package/dist/data-access/manage/subAgentRelations.d.ts +16 -16
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgents.d.ts +12 -12
- package/dist/data-access/manage/tools.d.ts +12 -12
- package/dist/data-access/runtime/apiKeys.d.ts +8 -8
- package/dist/data-access/runtime/conversations.d.ts +19 -19
- package/dist/data-access/runtime/messages.d.ts +6 -6
- package/dist/data-access/runtime/tasks.d.ts +4 -4
- package/dist/db/manage/manage-schema.d.ts +92 -92
- package/dist/db/runtime/runtime-schema.d.ts +36 -36
- package/dist/validation/dolt-schemas.d.ts +1 -1
- package/dist/validation/schemas.d.ts +131 -131
- package/package.json +1 -1
|
@@ -12,9 +12,11 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
12
12
|
name: string;
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
|
-
description: string | null;
|
|
16
|
-
tenantId: string;
|
|
17
15
|
projectId: string;
|
|
16
|
+
tenantId: string;
|
|
17
|
+
description: string | null;
|
|
18
|
+
defaultSubAgentId: string | null;
|
|
19
|
+
contextConfigId: string | null;
|
|
18
20
|
models: {
|
|
19
21
|
base?: {
|
|
20
22
|
model?: string | undefined;
|
|
@@ -29,12 +31,7 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
29
31
|
providerOptions?: Record<string, any> | undefined;
|
|
30
32
|
} | undefined;
|
|
31
33
|
} | null;
|
|
32
|
-
stopWhen: {
|
|
33
|
-
transferCountIs?: number | undefined;
|
|
34
|
-
} | null;
|
|
35
34
|
prompt: string | null;
|
|
36
|
-
defaultSubAgentId: string | null;
|
|
37
|
-
contextConfigId: string | null;
|
|
38
35
|
statusUpdates: {
|
|
39
36
|
enabled?: boolean | undefined;
|
|
40
37
|
numEvents?: number | undefined;
|
|
@@ -50,6 +47,9 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
50
47
|
} | undefined;
|
|
51
48
|
}[] | undefined;
|
|
52
49
|
} | null;
|
|
50
|
+
stopWhen: {
|
|
51
|
+
transferCountIs?: number | undefined;
|
|
52
|
+
} | null;
|
|
53
53
|
} | null>;
|
|
54
54
|
declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
55
55
|
scopes: AgentScopeConfig;
|
|
@@ -58,9 +58,11 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
58
58
|
name: string;
|
|
59
59
|
createdAt: string;
|
|
60
60
|
updatedAt: string;
|
|
61
|
-
description: string | null;
|
|
62
|
-
tenantId: string;
|
|
63
61
|
projectId: string;
|
|
62
|
+
tenantId: string;
|
|
63
|
+
description: string | null;
|
|
64
|
+
defaultSubAgentId: string | null;
|
|
65
|
+
contextConfigId: string | null;
|
|
64
66
|
models: {
|
|
65
67
|
base?: {
|
|
66
68
|
model?: string | undefined;
|
|
@@ -75,12 +77,7 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
75
77
|
providerOptions?: Record<string, any> | undefined;
|
|
76
78
|
} | undefined;
|
|
77
79
|
} | null;
|
|
78
|
-
stopWhen: {
|
|
79
|
-
transferCountIs?: number | undefined;
|
|
80
|
-
} | null;
|
|
81
80
|
prompt: string | null;
|
|
82
|
-
defaultSubAgentId: string | null;
|
|
83
|
-
contextConfigId: string | null;
|
|
84
81
|
statusUpdates: {
|
|
85
82
|
enabled?: boolean | undefined;
|
|
86
83
|
numEvents?: number | undefined;
|
|
@@ -96,14 +93,18 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
96
93
|
} | undefined;
|
|
97
94
|
}[] | undefined;
|
|
98
95
|
} | null;
|
|
96
|
+
stopWhen: {
|
|
97
|
+
transferCountIs?: number | undefined;
|
|
98
|
+
} | null;
|
|
99
99
|
defaultSubAgent: {
|
|
100
100
|
id: string;
|
|
101
101
|
name: string;
|
|
102
102
|
createdAt: string;
|
|
103
103
|
updatedAt: string;
|
|
104
|
-
|
|
105
|
-
tenantId: string;
|
|
104
|
+
agentId: string;
|
|
106
105
|
projectId: string;
|
|
106
|
+
tenantId: string;
|
|
107
|
+
description: string | null;
|
|
107
108
|
models: {
|
|
108
109
|
base?: {
|
|
109
110
|
model?: string | undefined;
|
|
@@ -118,12 +119,11 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
118
119
|
providerOptions?: Record<string, any> | undefined;
|
|
119
120
|
} | undefined;
|
|
120
121
|
} | null;
|
|
122
|
+
prompt: string | null;
|
|
121
123
|
stopWhen: {
|
|
122
124
|
stepCountIs?: number | undefined;
|
|
123
125
|
} | null;
|
|
124
|
-
prompt: string | null;
|
|
125
126
|
conversationHistoryConfig: ConversationHistoryConfig | null;
|
|
126
|
-
agentId: string;
|
|
127
127
|
} | null;
|
|
128
128
|
} | null>;
|
|
129
129
|
declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -133,9 +133,11 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
133
133
|
name: string;
|
|
134
134
|
createdAt: string;
|
|
135
135
|
updatedAt: string;
|
|
136
|
-
description: string | null;
|
|
137
|
-
tenantId: string;
|
|
138
136
|
projectId: string;
|
|
137
|
+
tenantId: string;
|
|
138
|
+
description: string | null;
|
|
139
|
+
defaultSubAgentId: string | null;
|
|
140
|
+
contextConfigId: string | null;
|
|
139
141
|
models: {
|
|
140
142
|
base?: {
|
|
141
143
|
model?: string | undefined;
|
|
@@ -150,12 +152,7 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
150
152
|
providerOptions?: Record<string, any> | undefined;
|
|
151
153
|
} | undefined;
|
|
152
154
|
} | null;
|
|
153
|
-
stopWhen: {
|
|
154
|
-
transferCountIs?: number | undefined;
|
|
155
|
-
} | null;
|
|
156
155
|
prompt: string | null;
|
|
157
|
-
defaultSubAgentId: string | null;
|
|
158
|
-
contextConfigId: string | null;
|
|
159
156
|
statusUpdates: {
|
|
160
157
|
enabled?: boolean | undefined;
|
|
161
158
|
numEvents?: number | undefined;
|
|
@@ -171,6 +168,9 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
171
168
|
} | undefined;
|
|
172
169
|
}[] | undefined;
|
|
173
170
|
} | null;
|
|
171
|
+
stopWhen: {
|
|
172
|
+
transferCountIs?: number | undefined;
|
|
173
|
+
} | null;
|
|
174
174
|
}[]>;
|
|
175
175
|
declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
|
|
176
176
|
scopes: ProjectScopeConfig;
|
|
@@ -249,9 +249,11 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
249
249
|
name: string;
|
|
250
250
|
createdAt: string;
|
|
251
251
|
updatedAt: string;
|
|
252
|
-
description: string | null;
|
|
253
|
-
tenantId: string;
|
|
254
252
|
projectId: string;
|
|
253
|
+
tenantId: string;
|
|
254
|
+
description: string | null;
|
|
255
|
+
defaultSubAgentId: string | null;
|
|
256
|
+
contextConfigId: string | null;
|
|
255
257
|
models: {
|
|
256
258
|
base?: {
|
|
257
259
|
model?: string | undefined;
|
|
@@ -266,12 +268,7 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
266
268
|
providerOptions?: Record<string, any> | undefined;
|
|
267
269
|
} | undefined;
|
|
268
270
|
} | null;
|
|
269
|
-
stopWhen: {
|
|
270
|
-
transferCountIs?: number | undefined;
|
|
271
|
-
} | null;
|
|
272
271
|
prompt: string | null;
|
|
273
|
-
defaultSubAgentId: string | null;
|
|
274
|
-
contextConfigId: string | null;
|
|
275
272
|
statusUpdates: {
|
|
276
273
|
enabled?: boolean | undefined;
|
|
277
274
|
numEvents?: number | undefined;
|
|
@@ -287,6 +284,9 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
287
284
|
} | undefined;
|
|
288
285
|
}[] | undefined;
|
|
289
286
|
} | null;
|
|
287
|
+
stopWhen: {
|
|
288
|
+
transferCountIs?: number | undefined;
|
|
289
|
+
} | null;
|
|
290
290
|
}>;
|
|
291
291
|
declare const updateAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
292
292
|
scopes: AgentScopeConfig;
|
|
@@ -12,9 +12,9 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
|
|
|
12
12
|
name: string;
|
|
13
13
|
createdAt: string;
|
|
14
14
|
updatedAt: string;
|
|
15
|
-
description: string | null;
|
|
16
|
-
tenantId: string;
|
|
17
15
|
projectId: string;
|
|
16
|
+
tenantId: string;
|
|
17
|
+
description: string | null;
|
|
18
18
|
props: {
|
|
19
19
|
[x: string]: unknown;
|
|
20
20
|
type: "object";
|
|
@@ -68,9 +68,9 @@ declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (para
|
|
|
68
68
|
name: string;
|
|
69
69
|
createdAt: string;
|
|
70
70
|
updatedAt: string;
|
|
71
|
-
description: string | null;
|
|
72
|
-
tenantId: string;
|
|
73
71
|
projectId: string;
|
|
72
|
+
tenantId: string;
|
|
73
|
+
description: string | null;
|
|
74
74
|
props: {
|
|
75
75
|
[x: string]: unknown;
|
|
76
76
|
type: "object";
|
|
@@ -142,10 +142,10 @@ declare const associateArtifactComponentWithAgent: (db: AgentsManageDatabaseClie
|
|
|
142
142
|
}) => Promise<{
|
|
143
143
|
id: string;
|
|
144
144
|
createdAt: string;
|
|
145
|
-
|
|
145
|
+
agentId: string;
|
|
146
146
|
projectId: string;
|
|
147
|
+
tenantId: string;
|
|
147
148
|
subAgentId: string;
|
|
148
|
-
agentId: string;
|
|
149
149
|
artifactComponentId: string;
|
|
150
150
|
}>;
|
|
151
151
|
declare const removeArtifactComponentFromAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -185,10 +185,10 @@ declare const upsertAgentArtifactComponentRelation: (db: AgentsManageDatabaseCli
|
|
|
185
185
|
}) => Promise<{
|
|
186
186
|
id: string;
|
|
187
187
|
createdAt: string;
|
|
188
|
-
|
|
188
|
+
agentId: string;
|
|
189
189
|
projectId: string;
|
|
190
|
+
tenantId: string;
|
|
190
191
|
subAgentId: string;
|
|
191
|
-
agentId: string;
|
|
192
192
|
artifactComponentId: string;
|
|
193
193
|
} | null>;
|
|
194
194
|
/**
|
|
@@ -11,11 +11,11 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
|
|
|
11
11
|
id: string;
|
|
12
12
|
createdAt: string;
|
|
13
13
|
updatedAt: string;
|
|
14
|
-
tenantId: string;
|
|
15
|
-
projectId: string;
|
|
16
|
-
agentId: string;
|
|
17
14
|
headersSchema: unknown;
|
|
18
15
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
16
|
+
agentId: string;
|
|
17
|
+
projectId: string;
|
|
18
|
+
tenantId: string;
|
|
19
19
|
} | undefined>;
|
|
20
20
|
declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
|
|
21
21
|
scopes: AgentScopeConfig;
|
|
@@ -23,11 +23,11 @@ declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
23
23
|
id: string;
|
|
24
24
|
createdAt: string;
|
|
25
25
|
updatedAt: string;
|
|
26
|
-
tenantId: string;
|
|
27
|
-
projectId: string;
|
|
28
|
-
agentId: string;
|
|
29
26
|
headersSchema: unknown;
|
|
30
27
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
28
|
+
agentId: string;
|
|
29
|
+
projectId: string;
|
|
30
|
+
tenantId: string;
|
|
31
31
|
}[]>;
|
|
32
32
|
declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (params: {
|
|
33
33
|
scopes: AgentScopeConfig;
|
|
@@ -45,11 +45,11 @@ declare const createContextConfig: (db: AgentsManageDatabaseClient) => (params:
|
|
|
45
45
|
id: string;
|
|
46
46
|
createdAt: string;
|
|
47
47
|
updatedAt: string;
|
|
48
|
-
tenantId: string;
|
|
49
|
-
projectId: string;
|
|
50
|
-
agentId: string;
|
|
51
48
|
headersSchema: unknown;
|
|
52
49
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
50
|
+
agentId: string;
|
|
51
|
+
projectId: string;
|
|
52
|
+
tenantId: string;
|
|
53
53
|
}>;
|
|
54
54
|
declare const updateContextConfig: (db: AgentsManageDatabaseClient) => (params: {
|
|
55
55
|
scopes: AgentScopeConfig;
|
|
@@ -85,11 +85,11 @@ declare const upsertContextConfig: (db: AgentsManageDatabaseClient) => (params:
|
|
|
85
85
|
id: string;
|
|
86
86
|
createdAt: string;
|
|
87
87
|
updatedAt: string;
|
|
88
|
-
tenantId: string;
|
|
89
|
-
projectId: string;
|
|
90
|
-
agentId: string;
|
|
91
88
|
headersSchema: unknown;
|
|
92
89
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
90
|
+
agentId: string;
|
|
91
|
+
projectId: string;
|
|
92
|
+
tenantId: string;
|
|
93
93
|
}>;
|
|
94
94
|
//#endregion
|
|
95
95
|
export { countContextConfigs, createContextConfig, deleteContextConfig, getContextConfigById, hasContextConfig, listContextConfigs, listContextConfigsPaginated, updateContextConfig, upsertContextConfig };
|
|
@@ -66,10 +66,10 @@ declare const associateDataComponentWithAgent: (db: AgentsManageDatabaseClient)
|
|
|
66
66
|
}) => Promise<{
|
|
67
67
|
id: string;
|
|
68
68
|
createdAt: string;
|
|
69
|
-
|
|
69
|
+
agentId: string;
|
|
70
70
|
projectId: string;
|
|
71
|
+
tenantId: string;
|
|
71
72
|
subAgentId: string;
|
|
72
|
-
agentId: string;
|
|
73
73
|
dataComponentId: string;
|
|
74
74
|
}>;
|
|
75
75
|
/**
|
|
@@ -108,10 +108,10 @@ declare const upsertAgentDataComponentRelation: (db: AgentsManageDatabaseClient)
|
|
|
108
108
|
}) => Promise<{
|
|
109
109
|
id: string;
|
|
110
110
|
createdAt: string;
|
|
111
|
-
|
|
111
|
+
agentId: string;
|
|
112
112
|
projectId: string;
|
|
113
|
+
tenantId: string;
|
|
113
114
|
subAgentId: string;
|
|
114
|
-
agentId: string;
|
|
115
115
|
dataComponentId: string;
|
|
116
116
|
} | null>;
|
|
117
117
|
/**
|
|
@@ -57,10 +57,10 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
57
57
|
name: string;
|
|
58
58
|
createdAt: string;
|
|
59
59
|
updatedAt: string;
|
|
60
|
-
description: string | null;
|
|
61
|
-
tenantId: string;
|
|
62
|
-
projectId: string;
|
|
63
60
|
agentId: string;
|
|
61
|
+
projectId: string;
|
|
62
|
+
tenantId: string;
|
|
63
|
+
description: string | null;
|
|
64
64
|
functionId: string;
|
|
65
65
|
}>;
|
|
66
66
|
/**
|
|
@@ -99,10 +99,10 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
99
99
|
name: string;
|
|
100
100
|
createdAt: string;
|
|
101
101
|
updatedAt: string;
|
|
102
|
-
description: string | null;
|
|
103
|
-
tenantId: string;
|
|
104
|
-
projectId: string;
|
|
105
102
|
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: {
|
|
@@ -164,10 +164,10 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
|
|
|
164
164
|
id: string;
|
|
165
165
|
createdAt: string;
|
|
166
166
|
updatedAt: string;
|
|
167
|
-
|
|
167
|
+
agentId: string;
|
|
168
168
|
projectId: string;
|
|
169
|
+
tenantId: string;
|
|
169
170
|
subAgentId: string;
|
|
170
|
-
agentId: string;
|
|
171
171
|
functionToolId: string;
|
|
172
172
|
toolPolicies: Record<string, {
|
|
173
173
|
needsApproval?: boolean;
|
|
@@ -229,10 +229,10 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
|
|
|
229
229
|
id: string;
|
|
230
230
|
createdAt: string;
|
|
231
231
|
updatedAt: string;
|
|
232
|
-
|
|
232
|
+
agentId: string;
|
|
233
233
|
projectId: string;
|
|
234
|
+
tenantId: string;
|
|
234
235
|
subAgentId: string;
|
|
235
|
-
agentId: string;
|
|
236
236
|
functionToolId: string;
|
|
237
237
|
toolPolicies: Record<string, {
|
|
238
238
|
needsApproval?: boolean;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { AgentScopeConfig, ProjectScopeConfig, SubAgentScopeConfig } from "../../types/utility.js";
|
|
2
|
+
import * as drizzle_orm20 from "drizzle-orm";
|
|
3
|
+
|
|
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_orm20.SQL<unknown>;
|
|
21
|
+
declare function projectScopedWhere<T extends ProjectScopedColumns>(table: T, scopes: ProjectScopeConfig): drizzle_orm20.SQL<unknown> | undefined;
|
|
22
|
+
declare function agentScopedWhere<T extends AgentScopedColumns>(table: T, scopes: AgentScopeConfig): drizzle_orm20.SQL<unknown> | undefined;
|
|
23
|
+
declare function subAgentScopedWhere<T extends SubAgentScopedColumns>(table: T, scopes: SubAgentScopeConfig): drizzle_orm20.SQL<unknown> | undefined;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { agentScopedWhere, projectScopedWhere, subAgentScopedWhere, tenantScopedWhere };
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { and, eq } from "drizzle-orm";
|
|
2
|
+
|
|
3
|
+
//#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));
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
//#endregion
|
|
18
|
+
export { agentScopedWhere, projectScopedWhere, subAgentScopedWhere, tenantScopedWhere };
|
|
@@ -12,10 +12,10 @@ declare const getSkillById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
12
12
|
createdAt: string;
|
|
13
13
|
updatedAt: string;
|
|
14
14
|
metadata: Record<string, string> | null;
|
|
15
|
+
projectId: string;
|
|
16
|
+
tenantId: string;
|
|
15
17
|
description: string;
|
|
16
18
|
content: string;
|
|
17
|
-
tenantId: string;
|
|
18
|
-
projectId: string;
|
|
19
19
|
} | null>;
|
|
20
20
|
declare const listSkills: (db: AgentsManageDatabaseClient) => (params: {
|
|
21
21
|
scopes: ProjectScopeConfig;
|
|
@@ -45,10 +45,10 @@ declare const createSkill: (db: AgentsManageDatabaseClient) => (data: SkillInser
|
|
|
45
45
|
createdAt: string;
|
|
46
46
|
updatedAt: string;
|
|
47
47
|
metadata: Record<string, string> | null;
|
|
48
|
+
projectId: string;
|
|
49
|
+
tenantId: string;
|
|
48
50
|
description: string;
|
|
49
51
|
content: string;
|
|
50
|
-
tenantId: string;
|
|
51
|
-
projectId: string;
|
|
52
52
|
}>;
|
|
53
53
|
declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillInsert) => Promise<{
|
|
54
54
|
id: string;
|
|
@@ -56,10 +56,10 @@ declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillInser
|
|
|
56
56
|
createdAt: string;
|
|
57
57
|
updatedAt: string;
|
|
58
58
|
metadata: Record<string, string> | null;
|
|
59
|
+
projectId: string;
|
|
60
|
+
tenantId: string;
|
|
59
61
|
description: string;
|
|
60
62
|
content: string;
|
|
61
|
-
tenantId: string;
|
|
62
|
-
projectId: string;
|
|
63
63
|
}>;
|
|
64
64
|
declare const updateSkill: (db: AgentsManageDatabaseClient) => (params: {
|
|
65
65
|
scopes: ProjectScopeConfig;
|
|
@@ -93,10 +93,10 @@ declare const upsertSubAgentSkill: (db: AgentsManageDatabaseClient) => (params:
|
|
|
93
93
|
id: string;
|
|
94
94
|
createdAt: string;
|
|
95
95
|
updatedAt: string;
|
|
96
|
-
|
|
96
|
+
agentId: string;
|
|
97
97
|
projectId: string;
|
|
98
|
+
tenantId: string;
|
|
98
99
|
subAgentId: string;
|
|
99
|
-
agentId: string;
|
|
100
100
|
skillId: string;
|
|
101
101
|
index: number;
|
|
102
102
|
alwaysLoaded: boolean;
|
|
@@ -12,10 +12,10 @@ declare const getSubAgentExternalAgentRelationById: (db: AgentsManageDatabaseCli
|
|
|
12
12
|
createdAt: string;
|
|
13
13
|
updatedAt: string;
|
|
14
14
|
headers: Record<string, string> | null;
|
|
15
|
-
|
|
15
|
+
agentId: string;
|
|
16
16
|
projectId: string;
|
|
17
|
+
tenantId: string;
|
|
17
18
|
subAgentId: string;
|
|
18
|
-
agentId: string;
|
|
19
19
|
externalAgentId: string;
|
|
20
20
|
} | undefined>;
|
|
21
21
|
declare const listSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -47,10 +47,10 @@ declare const getSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient
|
|
|
47
47
|
createdAt: string;
|
|
48
48
|
updatedAt: string;
|
|
49
49
|
headers: Record<string, string> | null;
|
|
50
|
-
|
|
50
|
+
agentId: string;
|
|
51
51
|
projectId: string;
|
|
52
|
+
tenantId: string;
|
|
52
53
|
subAgentId: string;
|
|
53
|
-
agentId: string;
|
|
54
54
|
externalAgentId: string;
|
|
55
55
|
}[]>;
|
|
56
56
|
declare const getSubAgentExternalAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -60,10 +60,10 @@ declare const getSubAgentExternalAgentRelationsByAgent: (db: AgentsManageDatabas
|
|
|
60
60
|
createdAt: string;
|
|
61
61
|
updatedAt: string;
|
|
62
62
|
headers: Record<string, string> | null;
|
|
63
|
-
|
|
63
|
+
agentId: string;
|
|
64
64
|
projectId: string;
|
|
65
|
+
tenantId: string;
|
|
65
66
|
subAgentId: string;
|
|
66
|
-
agentId: string;
|
|
67
67
|
externalAgentId: string;
|
|
68
68
|
}[]>;
|
|
69
69
|
declare const getSubAgentExternalAgentRelationsByExternalAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -183,10 +183,10 @@ declare const createSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
|
|
|
183
183
|
createdAt: string;
|
|
184
184
|
updatedAt: string;
|
|
185
185
|
headers: Record<string, string> | null;
|
|
186
|
-
|
|
186
|
+
agentId: string;
|
|
187
187
|
projectId: string;
|
|
188
|
+
tenantId: string;
|
|
188
189
|
subAgentId: string;
|
|
189
|
-
agentId: string;
|
|
190
190
|
externalAgentId: string;
|
|
191
191
|
}>;
|
|
192
192
|
/**
|
|
@@ -200,10 +200,10 @@ declare const getSubAgentExternalAgentRelationByParams: (db: AgentsManageDatabas
|
|
|
200
200
|
createdAt: string;
|
|
201
201
|
updatedAt: string;
|
|
202
202
|
headers: Record<string, string> | null;
|
|
203
|
-
|
|
203
|
+
agentId: string;
|
|
204
204
|
projectId: string;
|
|
205
|
+
tenantId: string;
|
|
205
206
|
subAgentId: string;
|
|
206
|
-
agentId: string;
|
|
207
207
|
externalAgentId: string;
|
|
208
208
|
} | undefined>;
|
|
209
209
|
/**
|
|
@@ -221,10 +221,10 @@ declare const upsertSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
|
|
|
221
221
|
createdAt: string;
|
|
222
222
|
updatedAt: string;
|
|
223
223
|
headers: Record<string, string> | null;
|
|
224
|
-
|
|
224
|
+
agentId: string;
|
|
225
225
|
projectId: string;
|
|
226
|
+
tenantId: string;
|
|
226
227
|
subAgentId: string;
|
|
227
|
-
agentId: string;
|
|
228
228
|
externalAgentId: string;
|
|
229
229
|
}>;
|
|
230
230
|
declare const updateSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { externalAgents, subAgentExternalAgentRelations, subAgents } from "../../db/manage/manage-schema.js";
|
|
2
|
+
import { agentScopedWhere, subAgentScopedWhere } from "./scope-helpers.js";
|
|
2
3
|
import { and, count, desc, eq } from "drizzle-orm";
|
|
3
4
|
import { nanoid } from "nanoid";
|
|
4
5
|
|
|
5
6
|
//#region src/data-access/manage/subAgentExternalAgentRelations.ts
|
|
6
7
|
const getSubAgentExternalAgentRelationById = (db) => async (params) => {
|
|
7
|
-
return db.query.subAgentExternalAgentRelations.findFirst({ where: and(
|
|
8
|
+
return db.query.subAgentExternalAgentRelations.findFirst({ where: and(subAgentScopedWhere(subAgentExternalAgentRelations, params.scopes), eq(subAgentExternalAgentRelations.id, params.relationId)) });
|
|
8
9
|
};
|
|
9
10
|
const listSubAgentExternalAgentRelations = (db) => async (params) => {
|
|
10
11
|
const page = params.pagination?.page || 1;
|
|
11
12
|
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
12
13
|
const offset = (page - 1) * limit;
|
|
13
|
-
const whereClause =
|
|
14
|
+
const whereClause = subAgentScopedWhere(subAgentExternalAgentRelations, params.scopes);
|
|
14
15
|
const [data, totalResult] = await Promise.all([db.select().from(subAgentExternalAgentRelations).where(whereClause).limit(limit).offset(offset).orderBy(desc(subAgentExternalAgentRelations.createdAt)), db.select({ count: count() }).from(subAgentExternalAgentRelations).where(whereClause)]);
|
|
15
16
|
const total = totalResult[0]?.count || 0;
|
|
16
17
|
return {
|
|
@@ -24,16 +25,16 @@ const listSubAgentExternalAgentRelations = (db) => async (params) => {
|
|
|
24
25
|
};
|
|
25
26
|
};
|
|
26
27
|
const getSubAgentExternalAgentRelations = (db) => async (params) => {
|
|
27
|
-
return await db.query.subAgentExternalAgentRelations.findMany({ where:
|
|
28
|
+
return await db.query.subAgentExternalAgentRelations.findMany({ where: subAgentScopedWhere(subAgentExternalAgentRelations, params.scopes) });
|
|
28
29
|
};
|
|
29
30
|
const getSubAgentExternalAgentRelationsByAgent = (db) => async (params) => {
|
|
30
|
-
return await db.query.subAgentExternalAgentRelations.findMany({ where:
|
|
31
|
+
return await db.query.subAgentExternalAgentRelations.findMany({ where: agentScopedWhere(subAgentExternalAgentRelations, params.scopes) });
|
|
31
32
|
};
|
|
32
33
|
const getSubAgentExternalAgentRelationsByExternalAgent = (db) => async (params) => {
|
|
33
34
|
const page = params.pagination?.page || 1;
|
|
34
35
|
const limit = Math.min(params.pagination?.limit || 10, 100);
|
|
35
36
|
const offset = (page - 1) * limit;
|
|
36
|
-
const whereClause = and(
|
|
37
|
+
const whereClause = and(agentScopedWhere(subAgentExternalAgentRelations, params.scopes), eq(subAgentExternalAgentRelations.externalAgentId, params.externalAgentId));
|
|
37
38
|
const [data, totalResult] = await Promise.all([db.select().from(subAgentExternalAgentRelations).where(whereClause).limit(limit).offset(offset).orderBy(desc(subAgentExternalAgentRelations.createdAt)), db.select({ count: count() }).from(subAgentExternalAgentRelations).where(whereClause)]);
|
|
38
39
|
const total = totalResult[0]?.count || 0;
|
|
39
40
|
return {
|
|
@@ -71,7 +72,7 @@ const getExternalAgentsForSubAgent = (db) => async (params) => {
|
|
|
71
72
|
createdAt: externalAgents.createdAt,
|
|
72
73
|
updatedAt: externalAgents.updatedAt
|
|
73
74
|
}
|
|
74
|
-
}).from(subAgentExternalAgentRelations).innerJoin(externalAgents, and(eq(subAgentExternalAgentRelations.tenantId, externalAgents.tenantId), eq(subAgentExternalAgentRelations.projectId, externalAgents.projectId), eq(subAgentExternalAgentRelations.externalAgentId, externalAgents.id))).where(
|
|
75
|
+
}).from(subAgentExternalAgentRelations).innerJoin(externalAgents, and(eq(subAgentExternalAgentRelations.tenantId, externalAgents.tenantId), eq(subAgentExternalAgentRelations.projectId, externalAgents.projectId), eq(subAgentExternalAgentRelations.externalAgentId, externalAgents.id))).where(subAgentScopedWhere(subAgentExternalAgentRelations, params.scopes)).limit(limit).offset(offset).orderBy(desc(subAgentExternalAgentRelations.createdAt)), db.select({ count: count() }).from(subAgentExternalAgentRelations).where(subAgentScopedWhere(subAgentExternalAgentRelations, params.scopes))]);
|
|
75
76
|
const total = totalResult[0]?.count || 0;
|
|
76
77
|
return {
|
|
77
78
|
data,
|
|
@@ -108,7 +109,7 @@ const getSubAgentsForExternalAgent = (db) => async (params) => {
|
|
|
108
109
|
createdAt: subAgents.createdAt,
|
|
109
110
|
updatedAt: subAgents.updatedAt
|
|
110
111
|
}
|
|
111
|
-
}).from(subAgentExternalAgentRelations).innerJoin(subAgents, and(eq(subAgentExternalAgentRelations.subAgentId, subAgents.id), eq(subAgentExternalAgentRelations.tenantId, subAgents.tenantId), eq(subAgentExternalAgentRelations.projectId, subAgents.projectId), eq(subAgentExternalAgentRelations.agentId, subAgents.agentId))).where(and(
|
|
112
|
+
}).from(subAgentExternalAgentRelations).innerJoin(subAgents, and(eq(subAgentExternalAgentRelations.subAgentId, subAgents.id), eq(subAgentExternalAgentRelations.tenantId, subAgents.tenantId), eq(subAgentExternalAgentRelations.projectId, subAgents.projectId), eq(subAgentExternalAgentRelations.agentId, subAgents.agentId))).where(and(agentScopedWhere(subAgentExternalAgentRelations, params.scopes), eq(subAgentExternalAgentRelations.externalAgentId, params.externalAgentId))).limit(limit).offset(offset).orderBy(desc(subAgentExternalAgentRelations.createdAt)), db.select({ count: count() }).from(subAgentExternalAgentRelations).where(and(agentScopedWhere(subAgentExternalAgentRelations, params.scopes), eq(subAgentExternalAgentRelations.externalAgentId, params.externalAgentId)))]);
|
|
112
113
|
const total = totalResult[0]?.count || 0;
|
|
113
114
|
return {
|
|
114
115
|
data,
|
|
@@ -136,7 +137,7 @@ const createSubAgentExternalAgentRelation = (db) => async (params) => {
|
|
|
136
137
|
* Check if sub-agent external agent relation exists by params
|
|
137
138
|
*/
|
|
138
139
|
const getSubAgentExternalAgentRelationByParams = (db) => async (params) => {
|
|
139
|
-
return db.query.subAgentExternalAgentRelations.findFirst({ where: and(
|
|
140
|
+
return db.query.subAgentExternalAgentRelations.findFirst({ where: and(subAgentScopedWhere(subAgentExternalAgentRelations, params.scopes), eq(subAgentExternalAgentRelations.externalAgentId, params.externalAgentId)) });
|
|
140
141
|
};
|
|
141
142
|
/**
|
|
142
143
|
* Upsert sub-agent external agent relation (create if it doesn't exist, update if it does)
|
|
@@ -163,16 +164,16 @@ const updateSubAgentExternalAgentRelation = (db) => async (params) => {
|
|
|
163
164
|
...params.data,
|
|
164
165
|
updatedAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
165
166
|
};
|
|
166
|
-
return (await db.update(subAgentExternalAgentRelations).set(updateData).where(and(
|
|
167
|
+
return (await db.update(subAgentExternalAgentRelations).set(updateData).where(and(subAgentScopedWhere(subAgentExternalAgentRelations, params.scopes), eq(subAgentExternalAgentRelations.id, params.relationId))).returning())[0];
|
|
167
168
|
};
|
|
168
169
|
const deleteSubAgentExternalAgentRelation = (db) => async (params) => {
|
|
169
|
-
return (await db.delete(subAgentExternalAgentRelations).where(and(
|
|
170
|
+
return (await db.delete(subAgentExternalAgentRelations).where(and(subAgentScopedWhere(subAgentExternalAgentRelations, params.scopes), eq(subAgentExternalAgentRelations.id, params.relationId))).returning()).length > 0;
|
|
170
171
|
};
|
|
171
172
|
const deleteSubAgentExternalAgentRelationsBySubAgent = (db) => async (params) => {
|
|
172
|
-
return (await db.delete(subAgentExternalAgentRelations).where(
|
|
173
|
+
return (await db.delete(subAgentExternalAgentRelations).where(subAgentScopedWhere(subAgentExternalAgentRelations, params.scopes)).returning()).length > 0;
|
|
173
174
|
};
|
|
174
175
|
const deleteSubAgentExternalAgentRelationsByAgent = (db) => async (params) => {
|
|
175
|
-
return (await db.delete(subAgentExternalAgentRelations).where(
|
|
176
|
+
return (await db.delete(subAgentExternalAgentRelations).where(agentScopedWhere(subAgentExternalAgentRelations, params.scopes)).returning()).length > 0;
|
|
176
177
|
};
|
|
177
178
|
|
|
178
179
|
//#endregion
|