@inkeep/agents-core 0.0.0-dev-20260330214247 → 0.0.0-dev-20260330224432
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 +154 -154
- package/dist/auth/permissions.d.ts +9 -9
- package/dist/client-exports.d.ts +5 -2
- package/dist/client-exports.js +6 -2
- package/dist/data-access/index.d.ts +2 -2
- package/dist/data-access/index.js +2 -2
- package/dist/data-access/manage/agents.d.ts +26 -26
- package/dist/data-access/manage/artifactComponents.d.ts +10 -10
- 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 +14 -14
- package/dist/data-access/manage/projectFull.js +42 -44
- package/dist/data-access/manage/skills.d.ts +80 -32
- package/dist/data-access/manage/skills.js +259 -46
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
- package/dist/data-access/manage/subAgents.d.ts +18 -18
- package/dist/data-access/manage/tools.d.ts +18 -18
- package/dist/data-access/manage/triggers.d.ts +1 -1
- package/dist/data-access/runtime/apiKeys.d.ts +12 -12
- package/dist/data-access/runtime/apps.d.ts +8 -8
- package/dist/data-access/runtime/conversations.d.ts +24 -24
- package/dist/data-access/runtime/messages.d.ts +18 -18
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
- package/dist/data-access/runtime/tasks.d.ts +6 -6
- package/dist/db/manage/manage-schema.d.ts +501 -342
- package/dist/db/manage/manage-schema.js +52 -2
- package/dist/db/runtime/runtime-schema.d.ts +371 -371
- package/dist/index.d.ts +8 -5
- package/dist/index.js +7 -4
- package/dist/types/entities.d.ts +11 -2
- package/dist/types/index.d.ts +2 -2
- package/dist/utils/index.d.ts +2 -1
- package/dist/utils/index.js +2 -1
- package/dist/utils/skill-files.d.ts +17 -0
- package/dist/utils/skill-files.js +29 -0
- package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
- package/dist/validation/drizzle-schema-helpers.js +1 -2
- package/dist/validation/index.d.ts +4 -2
- package/dist/validation/index.js +4 -2
- package/dist/validation/schemas/shared.d.ts +38 -0
- package/dist/validation/schemas/shared.js +63 -0
- package/dist/validation/schemas/skills.d.ts +602 -0
- package/dist/validation/schemas/skills.js +128 -0
- package/dist/validation/schemas.d.ts +2596 -3132
- package/dist/validation/schemas.js +4 -109
- package/drizzle/manage/0014_complex_firebird.sql +15 -0
- package/drizzle/manage/0015_backfill_skill_files.sql +61 -0
- package/drizzle/manage/meta/0014_snapshot.json +3821 -0
- package/drizzle/manage/meta/0015_snapshot.json +3821 -0
- package/drizzle/manage/meta/_journal.json +14 -0
- package/package.json +4 -2
|
@@ -10,11 +10,11 @@ import { PgColumn } from "drizzle-orm/pg-core";
|
|
|
10
10
|
declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
11
11
|
scopes: AgentScopeConfig;
|
|
12
12
|
}) => Promise<{
|
|
13
|
-
description: string | null;
|
|
14
|
-
tenantId: string;
|
|
15
|
-
projectId: string;
|
|
16
13
|
id: string;
|
|
17
14
|
name: string;
|
|
15
|
+
createdAt: string;
|
|
16
|
+
updatedAt: string;
|
|
17
|
+
description: string | null;
|
|
18
18
|
models: {
|
|
19
19
|
base?: {
|
|
20
20
|
model?: string | undefined;
|
|
@@ -32,8 +32,8 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
32
32
|
stopWhen: {
|
|
33
33
|
transferCountIs?: number | undefined;
|
|
34
34
|
} | null;
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
tenantId: string;
|
|
36
|
+
projectId: string;
|
|
37
37
|
defaultSubAgentId: string | null;
|
|
38
38
|
contextConfigId: string | null;
|
|
39
39
|
prompt: string | null;
|
|
@@ -57,11 +57,11 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
57
57
|
declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
58
58
|
scopes: AgentScopeConfig;
|
|
59
59
|
}) => Promise<{
|
|
60
|
-
description: string | null;
|
|
61
|
-
tenantId: string;
|
|
62
|
-
projectId: string;
|
|
63
60
|
id: string;
|
|
64
61
|
name: string;
|
|
62
|
+
createdAt: string;
|
|
63
|
+
updatedAt: string;
|
|
64
|
+
description: string | null;
|
|
65
65
|
models: {
|
|
66
66
|
base?: {
|
|
67
67
|
model?: string | undefined;
|
|
@@ -79,8 +79,8 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
79
79
|
stopWhen: {
|
|
80
80
|
transferCountIs?: number | undefined;
|
|
81
81
|
} | null;
|
|
82
|
-
|
|
83
|
-
|
|
82
|
+
tenantId: string;
|
|
83
|
+
projectId: string;
|
|
84
84
|
defaultSubAgentId: string | null;
|
|
85
85
|
contextConfigId: string | null;
|
|
86
86
|
prompt: string | null;
|
|
@@ -101,12 +101,11 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
101
101
|
} | null;
|
|
102
102
|
executionMode: "classic" | "durable";
|
|
103
103
|
defaultSubAgent: {
|
|
104
|
-
description: string | null;
|
|
105
|
-
tenantId: string;
|
|
106
|
-
projectId: string;
|
|
107
|
-
agentId: string;
|
|
108
104
|
id: string;
|
|
109
105
|
name: string;
|
|
106
|
+
createdAt: string;
|
|
107
|
+
updatedAt: string;
|
|
108
|
+
description: string | null;
|
|
110
109
|
models: {
|
|
111
110
|
base?: {
|
|
112
111
|
model?: string | undefined;
|
|
@@ -124,8 +123,9 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
124
123
|
stopWhen: {
|
|
125
124
|
stepCountIs?: number | undefined;
|
|
126
125
|
} | null;
|
|
127
|
-
|
|
128
|
-
|
|
126
|
+
tenantId: string;
|
|
127
|
+
projectId: string;
|
|
128
|
+
agentId: string;
|
|
129
129
|
prompt: string | null;
|
|
130
130
|
conversationHistoryConfig: ConversationHistoryConfig | null;
|
|
131
131
|
} | null;
|
|
@@ -133,11 +133,11 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
133
133
|
declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
134
134
|
scopes: ProjectScopeConfig;
|
|
135
135
|
}) => Promise<{
|
|
136
|
-
description: string | null;
|
|
137
|
-
tenantId: string;
|
|
138
|
-
projectId: string;
|
|
139
136
|
id: string;
|
|
140
137
|
name: string;
|
|
138
|
+
createdAt: string;
|
|
139
|
+
updatedAt: string;
|
|
140
|
+
description: string | null;
|
|
141
141
|
models: {
|
|
142
142
|
base?: {
|
|
143
143
|
model?: string | undefined;
|
|
@@ -155,8 +155,8 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
155
155
|
stopWhen: {
|
|
156
156
|
transferCountIs?: number | undefined;
|
|
157
157
|
} | null;
|
|
158
|
-
|
|
159
|
-
|
|
158
|
+
tenantId: string;
|
|
159
|
+
projectId: string;
|
|
160
160
|
defaultSubAgentId: string | null;
|
|
161
161
|
contextConfigId: string | null;
|
|
162
162
|
prompt: string | null;
|
|
@@ -251,11 +251,11 @@ declare function listAgentsAcrossProjectMainBranches(db: AgentsManageDatabaseCli
|
|
|
251
251
|
projectIds: string[];
|
|
252
252
|
}): Promise<AvailableAgentInfo[]>;
|
|
253
253
|
declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
|
|
254
|
-
description: string | null;
|
|
255
|
-
tenantId: string;
|
|
256
|
-
projectId: string;
|
|
257
254
|
id: string;
|
|
258
255
|
name: string;
|
|
256
|
+
createdAt: string;
|
|
257
|
+
updatedAt: string;
|
|
258
|
+
description: string | null;
|
|
259
259
|
models: {
|
|
260
260
|
base?: {
|
|
261
261
|
model?: string | undefined;
|
|
@@ -273,8 +273,8 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
273
273
|
stopWhen: {
|
|
274
274
|
transferCountIs?: number | undefined;
|
|
275
275
|
} | null;
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
tenantId: string;
|
|
277
|
+
projectId: string;
|
|
278
278
|
defaultSubAgentId: string | null;
|
|
279
279
|
contextConfigId: string | null;
|
|
280
280
|
prompt: string | null;
|
|
@@ -9,13 +9,13 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
|
|
|
9
9
|
scopes: ProjectScopeConfig;
|
|
10
10
|
id: string;
|
|
11
11
|
}) => Promise<{
|
|
12
|
-
description: string | null;
|
|
13
|
-
tenantId: string;
|
|
14
|
-
projectId: string;
|
|
15
12
|
id: string;
|
|
16
13
|
name: string;
|
|
17
14
|
createdAt: string;
|
|
18
15
|
updatedAt: string;
|
|
16
|
+
description: string | null;
|
|
17
|
+
tenantId: string;
|
|
18
|
+
projectId: string;
|
|
19
19
|
props: {
|
|
20
20
|
[x: string]: unknown;
|
|
21
21
|
type: "object";
|
|
@@ -65,13 +65,13 @@ declare const listArtifactComponentsPaginated: (db: AgentsManageDatabaseClient)
|
|
|
65
65
|
};
|
|
66
66
|
}>;
|
|
67
67
|
declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
|
|
68
|
-
description: string | null;
|
|
69
|
-
tenantId: string;
|
|
70
|
-
projectId: string;
|
|
71
68
|
id: string;
|
|
72
69
|
name: string;
|
|
73
70
|
createdAt: string;
|
|
74
71
|
updatedAt: string;
|
|
72
|
+
description: string | null;
|
|
73
|
+
tenantId: string;
|
|
74
|
+
projectId: string;
|
|
75
75
|
props: {
|
|
76
76
|
[x: string]: unknown;
|
|
77
77
|
type: "object";
|
|
@@ -141,12 +141,12 @@ declare const associateArtifactComponentWithAgent: (db: AgentsManageDatabaseClie
|
|
|
141
141
|
scopes: SubAgentScopeConfig;
|
|
142
142
|
artifactComponentId: string;
|
|
143
143
|
}) => Promise<{
|
|
144
|
+
id: string;
|
|
145
|
+
createdAt: string;
|
|
144
146
|
tenantId: string;
|
|
145
147
|
projectId: string;
|
|
146
148
|
agentId: string;
|
|
147
149
|
subAgentId: string;
|
|
148
|
-
id: string;
|
|
149
|
-
createdAt: string;
|
|
150
150
|
artifactComponentId: string;
|
|
151
151
|
}>;
|
|
152
152
|
declare const removeArtifactComponentFromAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -184,12 +184,12 @@ declare const upsertAgentArtifactComponentRelation: (db: AgentsManageDatabaseCli
|
|
|
184
184
|
scopes: SubAgentScopeConfig;
|
|
185
185
|
artifactComponentId: string;
|
|
186
186
|
}) => Promise<{
|
|
187
|
+
id: string;
|
|
188
|
+
createdAt: string;
|
|
187
189
|
tenantId: string;
|
|
188
190
|
projectId: string;
|
|
189
191
|
agentId: string;
|
|
190
192
|
subAgentId: string;
|
|
191
|
-
id: string;
|
|
192
|
-
createdAt: string;
|
|
193
193
|
artifactComponentId: string;
|
|
194
194
|
} | null>;
|
|
195
195
|
/**
|
|
@@ -9,24 +9,24 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
|
|
|
9
9
|
scopes: AgentScopeConfig;
|
|
10
10
|
id: string;
|
|
11
11
|
}) => Promise<{
|
|
12
|
-
tenantId: string;
|
|
13
|
-
projectId: string;
|
|
14
|
-
agentId: string;
|
|
15
12
|
id: string;
|
|
16
13
|
createdAt: string;
|
|
17
14
|
updatedAt: string;
|
|
15
|
+
tenantId: string;
|
|
16
|
+
projectId: string;
|
|
17
|
+
agentId: string;
|
|
18
18
|
headersSchema: unknown;
|
|
19
19
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
20
20
|
} | undefined>;
|
|
21
21
|
declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
|
|
22
22
|
scopes: AgentScopeConfig;
|
|
23
23
|
}) => Promise<{
|
|
24
|
-
tenantId: string;
|
|
25
|
-
projectId: string;
|
|
26
|
-
agentId: string;
|
|
27
24
|
id: string;
|
|
28
25
|
createdAt: string;
|
|
29
26
|
updatedAt: string;
|
|
27
|
+
tenantId: string;
|
|
28
|
+
projectId: string;
|
|
29
|
+
agentId: string;
|
|
30
30
|
headersSchema: unknown;
|
|
31
31
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
32
32
|
}[]>;
|
|
@@ -43,12 +43,12 @@ declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (
|
|
|
43
43
|
};
|
|
44
44
|
}>;
|
|
45
45
|
declare const createContextConfig: (db: AgentsManageDatabaseClient) => (params: ContextConfigInsert) => Promise<{
|
|
46
|
-
tenantId: string;
|
|
47
|
-
projectId: string;
|
|
48
|
-
agentId: string;
|
|
49
46
|
id: string;
|
|
50
47
|
createdAt: string;
|
|
51
48
|
updatedAt: string;
|
|
49
|
+
tenantId: string;
|
|
50
|
+
projectId: string;
|
|
51
|
+
agentId: string;
|
|
52
52
|
headersSchema: unknown;
|
|
53
53
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
54
54
|
}>;
|
|
@@ -83,12 +83,12 @@ declare const countContextConfigs: (db: AgentsManageDatabaseClient) => (params:
|
|
|
83
83
|
declare const upsertContextConfig: (db: AgentsManageDatabaseClient) => (params: {
|
|
84
84
|
data: ContextConfigInsert;
|
|
85
85
|
}) => Promise<{
|
|
86
|
-
tenantId: string;
|
|
87
|
-
projectId: string;
|
|
88
|
-
agentId: string;
|
|
89
86
|
id: string;
|
|
90
87
|
createdAt: string;
|
|
91
88
|
updatedAt: string;
|
|
89
|
+
tenantId: string;
|
|
90
|
+
projectId: string;
|
|
91
|
+
agentId: string;
|
|
92
92
|
headersSchema: unknown;
|
|
93
93
|
contextVariables: Record<string, ContextFetchDefinition> | null;
|
|
94
94
|
}>;
|
|
@@ -65,12 +65,12 @@ declare const associateDataComponentWithAgent: (db: AgentsManageDatabaseClient)
|
|
|
65
65
|
scopes: SubAgentScopeConfig;
|
|
66
66
|
dataComponentId: string;
|
|
67
67
|
}) => Promise<{
|
|
68
|
+
id: string;
|
|
69
|
+
createdAt: string;
|
|
68
70
|
tenantId: string;
|
|
69
71
|
projectId: string;
|
|
70
72
|
agentId: string;
|
|
71
73
|
subAgentId: string;
|
|
72
|
-
id: string;
|
|
73
|
-
createdAt: string;
|
|
74
74
|
dataComponentId: string;
|
|
75
75
|
}>;
|
|
76
76
|
/**
|
|
@@ -107,12 +107,12 @@ declare const upsertAgentDataComponentRelation: (db: AgentsManageDatabaseClient)
|
|
|
107
107
|
scopes: SubAgentScopeConfig;
|
|
108
108
|
dataComponentId: string;
|
|
109
109
|
}) => Promise<{
|
|
110
|
+
id: string;
|
|
111
|
+
createdAt: string;
|
|
110
112
|
tenantId: string;
|
|
111
113
|
projectId: string;
|
|
112
114
|
agentId: string;
|
|
113
115
|
subAgentId: string;
|
|
114
|
-
id: string;
|
|
115
|
-
createdAt: string;
|
|
116
116
|
dataComponentId: string;
|
|
117
117
|
} | null>;
|
|
118
118
|
/**
|
|
@@ -53,14 +53,14 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
53
53
|
data: FunctionToolApiInsert;
|
|
54
54
|
scopes: AgentScopeConfig;
|
|
55
55
|
}) => Promise<{
|
|
56
|
-
description: string | null;
|
|
57
|
-
tenantId: string;
|
|
58
|
-
projectId: string;
|
|
59
|
-
agentId: string;
|
|
60
56
|
id: string;
|
|
61
57
|
name: string;
|
|
62
58
|
createdAt: string;
|
|
63
59
|
updatedAt: string;
|
|
60
|
+
description: string | null;
|
|
61
|
+
tenantId: string;
|
|
62
|
+
projectId: string;
|
|
63
|
+
agentId: string;
|
|
64
64
|
functionId: string;
|
|
65
65
|
}>;
|
|
66
66
|
/**
|
|
@@ -95,14 +95,14 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
95
95
|
data: FunctionToolApiInsert;
|
|
96
96
|
scopes: AgentScopeConfig;
|
|
97
97
|
}) => Promise<{
|
|
98
|
-
description: string | null;
|
|
99
|
-
tenantId: string;
|
|
100
|
-
projectId: string;
|
|
101
|
-
agentId: string;
|
|
102
98
|
id: string;
|
|
103
99
|
name: string;
|
|
104
100
|
createdAt: string;
|
|
105
101
|
updatedAt: string;
|
|
102
|
+
description: string | null;
|
|
103
|
+
tenantId: string;
|
|
104
|
+
projectId: string;
|
|
105
|
+
agentId: string;
|
|
106
106
|
functionId: string;
|
|
107
107
|
}>;
|
|
108
108
|
declare const getFunctionToolsForSubAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -157,13 +157,13 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
|
|
|
157
157
|
needsApproval?: boolean;
|
|
158
158
|
}> | null;
|
|
159
159
|
}) => Promise<{
|
|
160
|
+
id: string;
|
|
161
|
+
createdAt: string;
|
|
162
|
+
updatedAt: string;
|
|
160
163
|
tenantId: string;
|
|
161
164
|
projectId: string;
|
|
162
165
|
agentId: string;
|
|
163
166
|
subAgentId: string;
|
|
164
|
-
id: string;
|
|
165
|
-
createdAt: string;
|
|
166
|
-
updatedAt: string;
|
|
167
167
|
toolPolicies: Record<string, {
|
|
168
168
|
needsApproval?: boolean;
|
|
169
169
|
}> | null;
|
|
@@ -222,13 +222,13 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
|
|
|
222
222
|
needsApproval?: boolean;
|
|
223
223
|
}> | null;
|
|
224
224
|
}) => Promise<{
|
|
225
|
+
id: string;
|
|
226
|
+
createdAt: string;
|
|
227
|
+
updatedAt: string;
|
|
225
228
|
tenantId: string;
|
|
226
229
|
projectId: string;
|
|
227
230
|
agentId: string;
|
|
228
231
|
subAgentId: string;
|
|
229
|
-
id: string;
|
|
230
|
-
createdAt: string;
|
|
231
|
-
updatedAt: string;
|
|
232
232
|
toolPolicies: Record<string, {
|
|
233
233
|
needsApproval?: boolean;
|
|
234
234
|
}> | null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { getLogger } from "../../utils/logger.js";
|
|
2
2
|
import { deleteExternalAgent, listExternalAgents, upsertExternalAgent } from "./externalAgents.js";
|
|
3
3
|
import { deleteFunction, listFunctions, upsertFunction } from "./functions.js";
|
|
4
|
-
import {
|
|
4
|
+
import { listSkillsWithFiles, upsertSkill } from "./skills.js";
|
|
5
5
|
import { deleteCredentialReference, listCredentialReferences, upsertCredentialReference } from "./credentialReferences.js";
|
|
6
6
|
import { deleteTool, listTools, upsertTool } from "./tools.js";
|
|
7
7
|
import { listAgents } from "./agents.js";
|
|
@@ -48,27 +48,24 @@ const createFullProjectServerSide = (db, logger = defaultLogger) => async (param
|
|
|
48
48
|
projectId: typed.id,
|
|
49
49
|
count: Object.keys(typed.skills).length
|
|
50
50
|
}, "Creating project skills");
|
|
51
|
-
const
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
}
|
|
70
|
-
});
|
|
71
|
-
await Promise.all(skillPromises);
|
|
51
|
+
for (const [skillId, skill] of Object.entries(typed.skills)) try {
|
|
52
|
+
await upsertSkill(db)({
|
|
53
|
+
...skill,
|
|
54
|
+
tenantId,
|
|
55
|
+
projectId: typed.id
|
|
56
|
+
});
|
|
57
|
+
logger.info({
|
|
58
|
+
projectId: typed.id,
|
|
59
|
+
skillId
|
|
60
|
+
}, "Skill processed");
|
|
61
|
+
} catch (error) {
|
|
62
|
+
logger.error({
|
|
63
|
+
projectId: typed.id,
|
|
64
|
+
skillId,
|
|
65
|
+
error
|
|
66
|
+
}, "Failed to create skill");
|
|
67
|
+
throw error;
|
|
68
|
+
}
|
|
72
69
|
logger.info({
|
|
73
70
|
projectId: typed.id,
|
|
74
71
|
count: Object.keys(typed.skills).length
|
|
@@ -446,27 +443,24 @@ const updateFullProjectServerSide = (db, logger = defaultLogger) => async (param
|
|
|
446
443
|
projectId: typed.id,
|
|
447
444
|
count: Object.keys(typed.skills).length
|
|
448
445
|
}, "Updating project skills");
|
|
449
|
-
const
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
}
|
|
468
|
-
});
|
|
469
|
-
await Promise.all(skillPromises);
|
|
446
|
+
for (const [skillId, skill] of Object.entries(typed.skills)) try {
|
|
447
|
+
await upsertSkill(db)({
|
|
448
|
+
...skill,
|
|
449
|
+
tenantId,
|
|
450
|
+
projectId: typed.id
|
|
451
|
+
});
|
|
452
|
+
logger.info({
|
|
453
|
+
projectId: typed.id,
|
|
454
|
+
skillId
|
|
455
|
+
}, "Skill processed");
|
|
456
|
+
} catch (error) {
|
|
457
|
+
logger.error({
|
|
458
|
+
projectId: typed.id,
|
|
459
|
+
skillId,
|
|
460
|
+
error
|
|
461
|
+
}, "Failed to update skill");
|
|
462
|
+
throw error;
|
|
463
|
+
}
|
|
470
464
|
logger.info({
|
|
471
465
|
projectId: typed.id,
|
|
472
466
|
count: Object.keys(typed.skills).length
|
|
@@ -1095,7 +1089,7 @@ const getFullProjectInternal = (db, logger = defaultLogger) => async (params) =>
|
|
|
1095
1089
|
}
|
|
1096
1090
|
const projectSkills = {};
|
|
1097
1091
|
try {
|
|
1098
|
-
const skillsList = await
|
|
1092
|
+
const skillsList = await listSkillsWithFiles(db)({
|
|
1099
1093
|
scopes: {
|
|
1100
1094
|
tenantId,
|
|
1101
1095
|
projectId
|
|
@@ -1111,6 +1105,10 @@ const getFullProjectInternal = (db, logger = defaultLogger) => async (params) =>
|
|
|
1111
1105
|
description: skill.description,
|
|
1112
1106
|
content: skill.content,
|
|
1113
1107
|
metadata: skill.metadata,
|
|
1108
|
+
files: skill.files.map((file) => ({
|
|
1109
|
+
filePath: file.filePath,
|
|
1110
|
+
content: file.content
|
|
1111
|
+
})),
|
|
1114
1112
|
createdAt: skill.createdAt,
|
|
1115
1113
|
updatedAt: skill.updatedAt
|
|
1116
1114
|
};
|
|
@@ -1,23 +1,55 @@
|
|
|
1
1
|
import { AgentScopeConfig, ProjectScopeConfig, SubAgentScopeConfig } from "../../db/manage/scope-definitions.js";
|
|
2
2
|
import { PaginationConfig } from "../../types/utility.js";
|
|
3
3
|
import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
|
|
4
|
-
import {
|
|
4
|
+
import { SkillApiInsert, SkillApiUpdate, SkillFileApiInsert, SkillFileSelect, SkillSelect, SubAgentSkillWithIndex } from "../../types/entities.js";
|
|
5
5
|
|
|
6
6
|
//#region src/data-access/manage/skills.d.ts
|
|
7
|
+
interface SkillRecordWithFiles extends SkillSelect {
|
|
8
|
+
files: SkillFileSelect[];
|
|
9
|
+
}
|
|
10
|
+
declare const getSkillFilesBySkillIds: (db: AgentsManageDatabaseClient) => (params: {
|
|
11
|
+
scopes: ProjectScopeConfig;
|
|
12
|
+
skillIds: string[];
|
|
13
|
+
}) => Promise<Record<string, SkillFileSelect[]>>;
|
|
7
14
|
declare const getSkillById: (db: AgentsManageDatabaseClient) => (params: {
|
|
8
15
|
scopes: ProjectScopeConfig;
|
|
9
16
|
skillId: string;
|
|
10
17
|
}) => Promise<{
|
|
11
|
-
description: string;
|
|
12
|
-
tenantId: string;
|
|
13
|
-
projectId: string;
|
|
14
18
|
id: string;
|
|
15
19
|
name: string;
|
|
16
20
|
createdAt: string;
|
|
17
21
|
updatedAt: string;
|
|
18
|
-
content: string;
|
|
19
22
|
metadata: Record<string, string> | null;
|
|
23
|
+
description: string;
|
|
24
|
+
tenantId: string;
|
|
25
|
+
content: string;
|
|
26
|
+
projectId: string;
|
|
20
27
|
} | null>;
|
|
28
|
+
declare const getSkillByIdWithFiles: (db: AgentsManageDatabaseClient) => (params: {
|
|
29
|
+
scopes: ProjectScopeConfig;
|
|
30
|
+
skillId: string;
|
|
31
|
+
}) => Promise<SkillRecordWithFiles | null>;
|
|
32
|
+
declare const getSkillFileById: (db: AgentsManageDatabaseClient) => (params: {
|
|
33
|
+
scopes: ProjectScopeConfig;
|
|
34
|
+
skillId: string;
|
|
35
|
+
fileId: string;
|
|
36
|
+
}) => Promise<SkillFileSelect | null>;
|
|
37
|
+
declare const createSkillFileById: (db: AgentsManageDatabaseClient) => (params: {
|
|
38
|
+
scopes: ProjectScopeConfig;
|
|
39
|
+
skillId: string;
|
|
40
|
+
data: SkillFileApiInsert;
|
|
41
|
+
}) => Promise<SkillFileSelect | null>;
|
|
42
|
+
declare const updateSkillFileById: (db: AgentsManageDatabaseClient) => (params: {
|
|
43
|
+
scopes: ProjectScopeConfig;
|
|
44
|
+
skillId: string;
|
|
45
|
+
fileId: string;
|
|
46
|
+
content: string;
|
|
47
|
+
}) => Promise<SkillFileSelect | null>;
|
|
48
|
+
declare const deleteSkillFileById: (db: AgentsManageDatabaseClient) => (params: {
|
|
49
|
+
scopes: ProjectScopeConfig;
|
|
50
|
+
skillId: string;
|
|
51
|
+
fileId: string;
|
|
52
|
+
}) => Promise<boolean | null>;
|
|
21
53
|
declare const listSkills: (db: AgentsManageDatabaseClient) => (params: {
|
|
22
54
|
scopes: ProjectScopeConfig;
|
|
23
55
|
pagination?: PaginationConfig;
|
|
@@ -40,43 +72,59 @@ declare const listSkills: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
40
72
|
pages: number;
|
|
41
73
|
};
|
|
42
74
|
}>;
|
|
43
|
-
declare const
|
|
44
|
-
|
|
75
|
+
declare const listSkillsWithFiles: (db: AgentsManageDatabaseClient) => (params: {
|
|
76
|
+
scopes: ProjectScopeConfig;
|
|
77
|
+
pagination?: PaginationConfig;
|
|
78
|
+
}) => Promise<{
|
|
79
|
+
data: {
|
|
80
|
+
files: {
|
|
81
|
+
createdAt: string;
|
|
82
|
+
updatedAt: string;
|
|
83
|
+
skillId: string;
|
|
84
|
+
filePath: string;
|
|
85
|
+
content: string;
|
|
86
|
+
projectId: string;
|
|
87
|
+
tenantId: string;
|
|
88
|
+
id: string;
|
|
89
|
+
}[];
|
|
90
|
+
createdAt: string;
|
|
91
|
+
updatedAt: string;
|
|
92
|
+
id: string;
|
|
93
|
+
name: string;
|
|
94
|
+
description: string;
|
|
95
|
+
content: string;
|
|
96
|
+
metadata: Record<string, string> | null;
|
|
97
|
+
projectId: string;
|
|
98
|
+
tenantId: string;
|
|
99
|
+
}[];
|
|
100
|
+
pagination: {
|
|
101
|
+
page: number;
|
|
102
|
+
limit: number;
|
|
103
|
+
total: number;
|
|
104
|
+
pages: number;
|
|
105
|
+
};
|
|
106
|
+
}>;
|
|
107
|
+
interface WithTenantIdProjectId {
|
|
45
108
|
tenantId: string;
|
|
46
109
|
projectId: string;
|
|
110
|
+
}
|
|
111
|
+
declare const createSkill: (db: AgentsManageDatabaseClient) => (data: SkillApiInsert & WithTenantIdProjectId) => Promise<SkillRecordWithFiles>;
|
|
112
|
+
declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillApiInsert & WithTenantIdProjectId) => Promise<{
|
|
47
113
|
id: string;
|
|
48
114
|
name: string;
|
|
49
115
|
createdAt: string;
|
|
50
116
|
updatedAt: string;
|
|
51
|
-
content: string;
|
|
52
117
|
metadata: Record<string, string> | null;
|
|
53
|
-
}>;
|
|
54
|
-
declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillInsert) => Promise<{
|
|
55
118
|
description: string;
|
|
56
119
|
tenantId: string;
|
|
57
|
-
projectId: string;
|
|
58
|
-
id: string;
|
|
59
|
-
name: string;
|
|
60
|
-
createdAt: string;
|
|
61
|
-
updatedAt: string;
|
|
62
120
|
content: string;
|
|
63
|
-
|
|
121
|
+
projectId: string;
|
|
64
122
|
}>;
|
|
65
123
|
declare const updateSkill: (db: AgentsManageDatabaseClient) => (params: {
|
|
66
124
|
scopes: ProjectScopeConfig;
|
|
67
125
|
skillId: string;
|
|
68
|
-
data:
|
|
69
|
-
}) => Promise<
|
|
70
|
-
createdAt: string;
|
|
71
|
-
updatedAt: string;
|
|
72
|
-
id: string;
|
|
73
|
-
name: string;
|
|
74
|
-
description: string;
|
|
75
|
-
content: string;
|
|
76
|
-
metadata: Record<string, string> | null;
|
|
77
|
-
projectId: string;
|
|
78
|
-
tenantId: string;
|
|
79
|
-
}>;
|
|
126
|
+
data: SkillApiUpdate;
|
|
127
|
+
}) => Promise<SkillRecordWithFiles | null>;
|
|
80
128
|
declare const deleteSkill: (db: AgentsManageDatabaseClient) => (params: {
|
|
81
129
|
scopes: ProjectScopeConfig;
|
|
82
130
|
skillId: string;
|
|
@@ -91,13 +139,13 @@ declare const upsertSubAgentSkill: (db: AgentsManageDatabaseClient) => (params:
|
|
|
91
139
|
index: number;
|
|
92
140
|
alwaysLoaded?: boolean;
|
|
93
141
|
}) => Promise<{
|
|
142
|
+
id: string;
|
|
143
|
+
createdAt: string;
|
|
144
|
+
updatedAt: string;
|
|
94
145
|
tenantId: string;
|
|
95
146
|
projectId: string;
|
|
96
147
|
agentId: string;
|
|
97
148
|
subAgentId: string;
|
|
98
|
-
id: string;
|
|
99
|
-
createdAt: string;
|
|
100
|
-
updatedAt: string;
|
|
101
149
|
skillId: string;
|
|
102
150
|
index: number;
|
|
103
151
|
alwaysLoaded: boolean;
|
|
@@ -107,4 +155,4 @@ declare const deleteSubAgentSkill: (db: AgentsManageDatabaseClient) => (params:
|
|
|
107
155
|
subAgentSkillId: string;
|
|
108
156
|
}) => Promise<boolean>;
|
|
109
157
|
//#endregion
|
|
110
|
-
export { createSkill, deleteSkill, deleteSubAgentSkill, getSkillById, getSkillsForSubAgents, listSkills, updateSkill, upsertSkill, upsertSubAgentSkill };
|
|
158
|
+
export { createSkill, createSkillFileById, deleteSkill, deleteSkillFileById, deleteSubAgentSkill, getSkillById, getSkillByIdWithFiles, getSkillFileById, getSkillFilesBySkillIds, getSkillsForSubAgents, listSkills, listSkillsWithFiles, updateSkill, updateSkillFileById, upsertSkill, upsertSubAgentSkill };
|