@inkeep/agents-core 0.64.10 → 0.65.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (50) hide show
  1. package/dist/auth/auth-schema.d.ts +108 -108
  2. package/dist/auth/auth-validation-schemas.d.ts +154 -154
  3. package/dist/client-exports.d.ts +2 -2
  4. package/dist/client-exports.js +2 -2
  5. package/dist/data-access/index.d.ts +4 -3
  6. package/dist/data-access/index.js +3 -2
  7. package/dist/data-access/manage/agents.d.ts +25 -25
  8. package/dist/data-access/manage/artifactComponents.d.ts +8 -8
  9. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  10. package/dist/data-access/manage/dataComponents.d.ts +4 -4
  11. package/dist/data-access/manage/functionTools.d.ts +10 -10
  12. package/dist/data-access/manage/projectLifecycle.d.ts +6 -6
  13. package/dist/data-access/manage/projectLifecycle.js +42 -21
  14. package/dist/data-access/manage/skills.d.ts +12 -12
  15. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  16. package/dist/data-access/manage/subAgentRelations.d.ts +22 -22
  17. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
  18. package/dist/data-access/manage/subAgents.d.ts +15 -15
  19. package/dist/data-access/manage/tools.d.ts +24 -24
  20. package/dist/data-access/manage/triggers.d.ts +3 -3
  21. package/dist/data-access/runtime/apiKeys.d.ts +12 -12
  22. package/dist/data-access/runtime/apps.d.ts +12 -12
  23. package/dist/data-access/runtime/cascade-delete.d.ts +2 -3
  24. package/dist/data-access/runtime/cascade-delete.js +10 -10
  25. package/dist/data-access/runtime/conversations.d.ts +20 -20
  26. package/dist/data-access/runtime/messages.d.ts +12 -12
  27. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +22 -14
  28. package/dist/data-access/runtime/scheduledTriggerInvocations.js +67 -9
  29. package/dist/data-access/runtime/scheduledTriggerUsers.d.ts +54 -0
  30. package/dist/data-access/runtime/scheduledTriggerUsers.js +62 -0
  31. package/dist/data-access/runtime/scheduledTriggers.d.ts +1 -0
  32. package/dist/data-access/runtime/tasks.d.ts +3 -3
  33. package/dist/db/manage/manage-schema.d.ts +6 -6
  34. package/dist/db/runtime/runtime-schema.d.ts +505 -388
  35. package/dist/db/runtime/runtime-schema.js +36 -2
  36. package/dist/index.d.ts +7 -6
  37. package/dist/index.js +5 -4
  38. package/dist/types/entities.d.ts +6 -2
  39. package/dist/types/index.d.ts +2 -2
  40. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  41. package/dist/validation/index.d.ts +2 -2
  42. package/dist/validation/index.js +2 -2
  43. package/dist/validation/schemas/skills.d.ts +49 -49
  44. package/dist/validation/schemas.d.ts +1931 -1837
  45. package/dist/validation/schemas.js +26 -5
  46. package/drizzle/runtime/0032_sloppy_starfox.sql +17 -0
  47. package/drizzle/runtime/0033_backfill-scheduled-trigger-users.sql +7 -0
  48. package/drizzle/runtime/meta/0032_snapshot.json +5120 -0
  49. package/drizzle/runtime/meta/_journal.json +14 -0
  50. package/package.json +1 -1
@@ -10,13 +10,9 @@ import { PgColumn } from "drizzle-orm/pg-core";
10
10
  declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
11
11
  scopes: AgentScopeConfig;
12
12
  }) => Promise<{
13
- tenantId: string;
14
- projectId: string;
15
13
  id: string;
16
14
  name: string;
17
15
  description: string | null;
18
- createdAt: string;
19
- updatedAt: string;
20
16
  models: {
21
17
  base?: {
22
18
  model?: string | undefined;
@@ -40,9 +36,12 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
40
36
  stopWhen: {
41
37
  transferCountIs?: number | undefined;
42
38
  } | null;
43
- prompt: string | null;
39
+ createdAt: string;
40
+ updatedAt: string;
41
+ tenantId: string;
44
42
  defaultSubAgentId: string | null;
45
43
  contextConfigId: string | null;
44
+ prompt: string | null;
46
45
  statusUpdates: {
47
46
  enabled?: boolean | undefined;
48
47
  numEvents?: number | undefined;
@@ -59,17 +58,14 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
59
58
  }[] | undefined;
60
59
  } | null;
61
60
  executionMode: "classic" | "durable";
61
+ projectId: string;
62
62
  } | null>;
63
63
  declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
64
64
  scopes: AgentScopeConfig;
65
65
  }) => Promise<{
66
- tenantId: string;
67
- projectId: string;
68
66
  id: string;
69
67
  name: string;
70
68
  description: string | null;
71
- createdAt: string;
72
- updatedAt: string;
73
69
  models: {
74
70
  base?: {
75
71
  model?: string | undefined;
@@ -93,9 +89,12 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
93
89
  stopWhen: {
94
90
  transferCountIs?: number | undefined;
95
91
  } | null;
96
- prompt: string | null;
92
+ createdAt: string;
93
+ updatedAt: string;
94
+ tenantId: string;
97
95
  defaultSubAgentId: string | null;
98
96
  contextConfigId: string | null;
97
+ prompt: string | null;
99
98
  statusUpdates: {
100
99
  enabled?: boolean | undefined;
101
100
  numEvents?: number | undefined;
@@ -112,14 +111,11 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
112
111
  }[] | undefined;
113
112
  } | null;
114
113
  executionMode: "classic" | "durable";
114
+ projectId: string;
115
115
  defaultSubAgent: {
116
- tenantId: string;
117
- projectId: string;
118
116
  id: string;
119
117
  name: string;
120
118
  description: string | null;
121
- createdAt: string;
122
- updatedAt: string;
123
119
  models: {
124
120
  base?: {
125
121
  model?: string | undefined;
@@ -143,21 +139,21 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
143
139
  stopWhen: {
144
140
  stepCountIs?: number | undefined;
145
141
  } | null;
146
- agentId: string;
142
+ createdAt: string;
143
+ updatedAt: string;
144
+ tenantId: string;
147
145
  prompt: string | null;
146
+ projectId: string;
147
+ agentId: string;
148
148
  conversationHistoryConfig: ConversationHistoryConfig | null;
149
149
  } | null;
150
150
  } | null>;
151
151
  declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
152
152
  scopes: ProjectScopeConfig;
153
153
  }) => Promise<{
154
- tenantId: string;
155
- projectId: string;
156
154
  id: string;
157
155
  name: string;
158
156
  description: string | null;
159
- createdAt: string;
160
- updatedAt: string;
161
157
  models: {
162
158
  base?: {
163
159
  model?: string | undefined;
@@ -181,9 +177,12 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
181
177
  stopWhen: {
182
178
  transferCountIs?: number | undefined;
183
179
  } | null;
184
- prompt: string | null;
180
+ createdAt: string;
181
+ updatedAt: string;
182
+ tenantId: string;
185
183
  defaultSubAgentId: string | null;
186
184
  contextConfigId: string | null;
185
+ prompt: string | null;
187
186
  statusUpdates: {
188
187
  enabled?: boolean | undefined;
189
188
  numEvents?: number | undefined;
@@ -200,6 +199,7 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
200
199
  }[] | undefined;
201
200
  } | null;
202
201
  executionMode: "classic" | "durable";
202
+ projectId: string;
203
203
  }[]>;
204
204
  declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
205
205
  scopes: ProjectScopeConfig;
@@ -281,13 +281,9 @@ declare function listAgentsAcrossProjectMainBranches(db: AgentsManageDatabaseCli
281
281
  projectIds: string[];
282
282
  }): Promise<AvailableAgentInfo[]>;
283
283
  declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
284
- tenantId: string;
285
- projectId: string;
286
284
  id: string;
287
285
  name: string;
288
286
  description: string | null;
289
- createdAt: string;
290
- updatedAt: string;
291
287
  models: {
292
288
  base?: {
293
289
  model?: string | undefined;
@@ -311,9 +307,12 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
311
307
  stopWhen: {
312
308
  transferCountIs?: number | undefined;
313
309
  } | null;
314
- prompt: string | null;
310
+ createdAt: string;
311
+ updatedAt: string;
312
+ tenantId: string;
315
313
  defaultSubAgentId: string | null;
316
314
  contextConfigId: string | null;
315
+ prompt: string | null;
317
316
  statusUpdates: {
318
317
  enabled?: boolean | undefined;
319
318
  numEvents?: number | undefined;
@@ -330,6 +329,7 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
330
329
  }[] | undefined;
331
330
  } | null;
332
331
  executionMode: "classic" | "durable";
332
+ projectId: string;
333
333
  }>;
334
334
  declare const updateAgent: (db: AgentsManageDatabaseClient) => (params: {
335
335
  scopes: AgentScopeConfig;
@@ -9,13 +9,13 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
9
9
  scopes: ProjectScopeConfig;
10
10
  id: string;
11
11
  }) => Promise<{
12
- tenantId: string;
13
- projectId: string;
14
12
  id: string;
15
13
  name: string;
16
14
  description: string | null;
17
15
  createdAt: string;
18
16
  updatedAt: string;
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
- tenantId: string;
69
- projectId: string;
70
68
  id: string;
71
69
  name: string;
72
70
  description: string | null;
73
71
  createdAt: string;
74
72
  updatedAt: string;
73
+ tenantId: string;
74
+ projectId: string;
75
75
  props: {
76
76
  [x: string]: unknown;
77
77
  type: "object";
@@ -141,10 +141,10 @@ declare const associateArtifactComponentWithAgent: (db: AgentsManageDatabaseClie
141
141
  scopes: SubAgentScopeConfig;
142
142
  artifactComponentId: string;
143
143
  }) => Promise<{
144
- tenantId: string;
145
- projectId: string;
146
144
  id: string;
147
145
  createdAt: string;
146
+ tenantId: string;
147
+ projectId: string;
148
148
  agentId: string;
149
149
  subAgentId: string;
150
150
  artifactComponentId: string;
@@ -184,10 +184,10 @@ declare const upsertAgentArtifactComponentRelation: (db: AgentsManageDatabaseCli
184
184
  scopes: SubAgentScopeConfig;
185
185
  artifactComponentId: string;
186
186
  }) => Promise<{
187
- tenantId: string;
188
- projectId: string;
189
187
  id: string;
190
188
  createdAt: string;
189
+ tenantId: string;
190
+ projectId: string;
191
191
  agentId: string;
192
192
  subAgentId: string;
193
193
  artifactComponentId: string;
@@ -9,26 +9,26 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
9
9
  scopes: AgentScopeConfig;
10
10
  id: string;
11
11
  }) => Promise<{
12
- tenantId: string;
13
- projectId: string;
14
12
  id: string;
15
13
  createdAt: string;
16
14
  updatedAt: string;
17
- agentId: string;
15
+ tenantId: string;
16
+ projectId: string;
18
17
  headersSchema: unknown;
19
18
  contextVariables: Record<string, ContextFetchDefinition> | null;
19
+ agentId: string;
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
24
  id: string;
27
25
  createdAt: string;
28
26
  updatedAt: string;
29
- agentId: string;
27
+ tenantId: string;
28
+ projectId: string;
30
29
  headersSchema: unknown;
31
30
  contextVariables: Record<string, ContextFetchDefinition> | null;
31
+ agentId: string;
32
32
  }[]>;
33
33
  declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (params: {
34
34
  scopes: AgentScopeConfig;
@@ -43,14 +43,14 @@ 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
46
  id: string;
49
47
  createdAt: string;
50
48
  updatedAt: string;
51
- agentId: string;
49
+ tenantId: string;
50
+ projectId: string;
52
51
  headersSchema: unknown;
53
52
  contextVariables: Record<string, ContextFetchDefinition> | null;
53
+ agentId: string;
54
54
  }>;
55
55
  declare const updateContextConfig: (db: AgentsManageDatabaseClient) => (params: {
56
56
  scopes: AgentScopeConfig;
@@ -83,14 +83,14 @@ 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
86
  id: string;
89
87
  createdAt: string;
90
88
  updatedAt: string;
91
- agentId: string;
89
+ tenantId: string;
90
+ projectId: string;
92
91
  headersSchema: unknown;
93
92
  contextVariables: Record<string, ContextFetchDefinition> | null;
93
+ agentId: string;
94
94
  }>;
95
95
  //#endregion
96
96
  export { countContextConfigs, createContextConfig, deleteContextConfig, getContextConfigById, hasContextConfig, listContextConfigs, listContextConfigsPaginated, updateContextConfig, upsertContextConfig };
@@ -65,10 +65,10 @@ declare const associateDataComponentWithAgent: (db: AgentsManageDatabaseClient)
65
65
  scopes: SubAgentScopeConfig;
66
66
  dataComponentId: string;
67
67
  }) => Promise<{
68
- tenantId: string;
69
- projectId: string;
70
68
  id: string;
71
69
  createdAt: string;
70
+ tenantId: string;
71
+ projectId: string;
72
72
  agentId: string;
73
73
  subAgentId: string;
74
74
  dataComponentId: string;
@@ -107,10 +107,10 @@ declare const upsertAgentDataComponentRelation: (db: AgentsManageDatabaseClient)
107
107
  scopes: SubAgentScopeConfig;
108
108
  dataComponentId: string;
109
109
  }) => Promise<{
110
- tenantId: string;
111
- projectId: string;
112
110
  id: string;
113
111
  createdAt: string;
112
+ tenantId: string;
113
+ projectId: string;
114
114
  agentId: string;
115
115
  subAgentId: string;
116
116
  dataComponentId: string;
@@ -53,13 +53,13 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
53
53
  data: FunctionToolApiInsert;
54
54
  scopes: AgentScopeConfig;
55
55
  }) => Promise<{
56
- tenantId: string;
57
- projectId: string;
58
56
  id: string;
59
57
  name: string;
60
58
  description: string | null;
61
59
  createdAt: string;
62
60
  updatedAt: string;
61
+ tenantId: string;
62
+ projectId: string;
63
63
  agentId: string;
64
64
  functionId: string;
65
65
  }>;
@@ -95,13 +95,13 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
95
95
  data: FunctionToolApiInsert;
96
96
  scopes: AgentScopeConfig;
97
97
  }) => Promise<{
98
- tenantId: string;
99
- projectId: string;
100
98
  id: string;
101
99
  name: string;
102
100
  description: string | null;
103
101
  createdAt: string;
104
102
  updatedAt: string;
103
+ tenantId: string;
104
+ projectId: string;
105
105
  agentId: string;
106
106
  functionId: string;
107
107
  }>;
@@ -157,17 +157,17 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
157
157
  needsApproval?: boolean;
158
158
  }> | null;
159
159
  }) => Promise<{
160
- tenantId: string;
161
- projectId: string;
162
160
  id: string;
163
161
  createdAt: string;
164
162
  updatedAt: string;
163
+ tenantId: string;
164
+ projectId: string;
165
165
  agentId: string;
166
166
  subAgentId: string;
167
- functionToolId: string;
168
167
  toolPolicies: Record<string, {
169
168
  needsApproval?: boolean;
170
169
  }> | null;
170
+ functionToolId: string;
171
171
  }>;
172
172
  /**
173
173
  * Update an agent-function tool relation
@@ -222,17 +222,17 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
222
222
  needsApproval?: boolean;
223
223
  }> | null;
224
224
  }) => Promise<{
225
- tenantId: string;
226
- projectId: string;
227
225
  id: string;
228
226
  createdAt: string;
229
227
  updatedAt: string;
228
+ tenantId: string;
229
+ projectId: string;
230
230
  agentId: string;
231
231
  subAgentId: string;
232
- functionToolId: string;
233
232
  toolPolicies: Record<string, {
234
233
  needsApproval?: boolean;
235
234
  }> | null;
235
+ functionToolId: string;
236
236
  }>;
237
237
  //#endregion
238
238
  export { addFunctionToolToSubAgent, associateFunctionToolWithSubAgent, createFunctionTool, deleteFunctionTool, getFunctionToolById, getFunctionToolsForSubAgent, getSubAgentsUsingFunctionTool, isFunctionToolAssociatedWithSubAgent, listFunctionTools, removeFunctionToolFromSubAgent, updateFunctionTool, updateSubAgentFunctionToolRelation, upsertFunctionTool, upsertSubAgentFunctionToolRelation };
@@ -17,7 +17,7 @@ interface CreateProjectWithBranchResult {
17
17
  createdAt: string;
18
18
  createdBy: string | null;
19
19
  }
20
- interface DeleteProjectWithBranchParams {
20
+ interface DeleteProjectAndBranchesParams {
21
21
  tenantId: string;
22
22
  projectId: string;
23
23
  }
@@ -37,11 +37,11 @@ declare function getProjectMainBranchName(tenantId: string, projectId: string):
37
37
  */
38
38
  declare const createProjectMetadataAndBranch: (runDb: AgentsRunDatabaseClient, configDb: AgentsManageDatabaseClient) => (params: CreateProjectWithBranchParams) => Promise<CreateProjectWithBranchResult>;
39
39
  /**
40
- * Delete a project and its branch
40
+ * Delete a project and ALL its branches
41
41
  *
42
42
  * This utility:
43
- * 1. Gets the project from runtime DB to find the branch name
44
- * 2. Deletes the project branch from config DB (Doltgres)
43
+ * 1. Gets the project from runtime DB
44
+ * 2. Lists and deletes ALL branches matching the project prefix from config DB (Doltgres)
45
45
  * 3. Deletes the project record from runtime DB
46
46
  *
47
47
  * Note: Callers should handle cascade deletion of runtime entities (conversations, etc.)
@@ -50,7 +50,7 @@ declare const createProjectMetadataAndBranch: (runDb: AgentsRunDatabaseClient, c
50
50
  * @param runDb - Runtime database client (Postgres)
51
51
  * @param configDb - Config database client (Doltgres)
52
52
  */
53
- declare const deleteProjectWithBranch: (runDb: AgentsRunDatabaseClient, configDb: AgentsManageDatabaseClient) => (params: DeleteProjectWithBranchParams) => Promise<boolean>;
53
+ declare const deleteProjectAndBranches: (runDb: AgentsRunDatabaseClient, configDb: AgentsManageDatabaseClient) => (params: DeleteProjectAndBranchesParams) => Promise<boolean>;
54
54
  /**
55
55
  * Get project with branch info
56
56
  *
@@ -116,4 +116,4 @@ declare const getProjectWithMetadata: (runDb: AgentsRunDatabaseClient, configDb:
116
116
  projectId: string;
117
117
  }) => Promise<ProjectWithMetadata | null>;
118
118
  //#endregion
119
- export { CreateProjectWithBranchParams, CreateProjectWithBranchResult, DeleteProjectWithBranchParams, ListProjectsWithMetadataResult, ProjectConfigMetadata, ProjectWithMetadata, createProjectMetadataAndBranch, deleteProjectWithBranch, getProjectMainBranchName, getProjectWithBranchInfo, getProjectWithMetadata, listProjectsWithMetadataPaginated };
119
+ export { CreateProjectWithBranchParams, CreateProjectWithBranchResult, DeleteProjectAndBranchesParams, ListProjectsWithMetadataResult, ProjectConfigMetadata, ProjectWithMetadata, createProjectMetadataAndBranch, deleteProjectAndBranches, getProjectMainBranchName, getProjectWithBranchInfo, getProjectWithMetadata, listProjectsWithMetadataPaginated };
@@ -1,5 +1,5 @@
1
1
  import { getLogger } from "../../utils/logger.js";
2
- import { doltBranch, doltBranchExists, doltCheckout, doltDeleteBranch } from "../../dolt/branch.js";
2
+ import { doltBranch, doltBranchExists, doltCheckout, doltDeleteBranch, doltListBranches } from "../../dolt/branch.js";
3
3
  import { createProjectMetadata, deleteProjectMetadata, getProjectMetadata, listProjectsMetadataPaginated } from "../runtime/projects.js";
4
4
  import { sql } from "drizzle-orm";
5
5
 
@@ -66,11 +66,11 @@ const createProjectMetadataAndBranch = (runDb, configDb) => async (params) => {
66
66
  };
67
67
  };
68
68
  /**
69
- * Delete a project and its branch
69
+ * Delete a project and ALL its branches
70
70
  *
71
71
  * This utility:
72
- * 1. Gets the project from runtime DB to find the branch name
73
- * 2. Deletes the project branch from config DB (Doltgres)
72
+ * 1. Gets the project from runtime DB
73
+ * 2. Lists and deletes ALL branches matching the project prefix from config DB (Doltgres)
74
74
  * 3. Deletes the project record from runtime DB
75
75
  *
76
76
  * Note: Callers should handle cascade deletion of runtime entities (conversations, etc.)
@@ -79,36 +79,58 @@ const createProjectMetadataAndBranch = (runDb, configDb) => async (params) => {
79
79
  * @param runDb - Runtime database client (Postgres)
80
80
  * @param configDb - Config database client (Doltgres)
81
81
  */
82
- const deleteProjectWithBranch = (runDb, configDb) => async (params) => {
82
+ const deleteProjectAndBranches = (runDb, configDb) => async (params) => {
83
83
  const { tenantId, projectId } = params;
84
84
  logger.info({
85
85
  tenantId,
86
86
  projectId
87
- }, "Deleting project with branch");
88
- const project = await getProjectMetadata(runDb)({
87
+ }, "Deleting project with all branches");
88
+ if (!await getProjectMetadata(runDb)({
89
89
  tenantId,
90
90
  projectId
91
- });
92
- if (!project) {
91
+ })) {
93
92
  logger.warn({
94
93
  tenantId,
95
94
  projectId
96
95
  }, "Project not found in runtime DB");
97
96
  return false;
98
97
  }
99
- const { mainBranchName } = project;
100
98
  try {
101
99
  await doltCheckout(configDb)({ branch: "main" });
102
- await doltDeleteBranch(configDb)({
103
- name: mainBranchName,
104
- force: true
105
- });
106
- logger.info({ mainBranchName }, "Deleted project branch");
100
+ const allBranches = await doltListBranches(configDb)();
101
+ const prefix = `${tenantId}_${projectId}_`;
102
+ const projectBranches = allBranches.filter((b) => b.name.startsWith(prefix));
103
+ const failedBranches = [];
104
+ for (const branch of projectBranches) try {
105
+ await doltDeleteBranch(configDb)({
106
+ name: branch.name,
107
+ force: true
108
+ });
109
+ logger.debug({ branchName: branch.name }, "Deleted project branch");
110
+ } catch (error) {
111
+ failedBranches.push(branch.name);
112
+ logger.error({
113
+ error,
114
+ branchName: branch.name
115
+ }, "Failed to delete project branch, continuing with remaining branches");
116
+ }
117
+ if (failedBranches.length > 0) logger.warn({
118
+ tenantId,
119
+ projectId,
120
+ failedBranches,
121
+ successCount: projectBranches.length - failedBranches.length
122
+ }, "Some project branches could not be deleted");
123
+ else logger.info({
124
+ tenantId,
125
+ projectId,
126
+ branchCount: projectBranches.length
127
+ }, "Deleted all project branches");
107
128
  } catch (error) {
108
129
  logger.error({
109
130
  error,
110
- mainBranchName
111
- }, "Failed to delete project branch, continuing with runtime cleanup");
131
+ tenantId,
132
+ projectId
133
+ }, "Failed to list/delete project branches, continuing with runtime cleanup");
112
134
  }
113
135
  const deleted = await deleteProjectMetadata(runDb)({
114
136
  tenantId,
@@ -116,9 +138,8 @@ const deleteProjectWithBranch = (runDb, configDb) => async (params) => {
116
138
  });
117
139
  if (deleted) logger.info({
118
140
  tenantId,
119
- projectId,
120
- mainBranchName
121
- }, "Successfully deleted project with branch");
141
+ projectId
142
+ }, "Successfully deleted project with all branches");
122
143
  else logger.warn({
123
144
  tenantId,
124
145
  projectId
@@ -231,4 +252,4 @@ const getProjectWithMetadata = (runDb, configDb) => async (params) => {
231
252
  };
232
253
 
233
254
  //#endregion
234
- export { createProjectMetadataAndBranch, deleteProjectWithBranch, getProjectMainBranchName, getProjectWithBranchInfo, getProjectWithMetadata, listProjectsWithMetadataPaginated };
255
+ export { createProjectMetadataAndBranch, deleteProjectAndBranches, getProjectMainBranchName, getProjectWithBranchInfo, getProjectWithMetadata, listProjectsWithMetadataPaginated };
@@ -15,15 +15,15 @@ declare const getSkillById: (db: AgentsManageDatabaseClient) => (params: {
15
15
  scopes: ProjectScopeConfig;
16
16
  skillId: string;
17
17
  }) => Promise<{
18
- tenantId: string;
19
- projectId: string;
20
18
  id: string;
21
19
  name: string;
22
20
  description: string;
23
- metadata: Record<string, string> | null;
24
- content: string;
25
21
  createdAt: string;
26
22
  updatedAt: string;
23
+ tenantId: string;
24
+ projectId: string;
25
+ content: string;
26
+ metadata: Record<string, string> | null;
27
27
  } | null>;
28
28
  declare const getSkillByIdWithFiles: (db: AgentsManageDatabaseClient) => (params: {
29
29
  scopes: ProjectScopeConfig;
@@ -110,15 +110,15 @@ interface WithTenantIdProjectId {
110
110
  }
111
111
  declare const createSkill: (db: AgentsManageDatabaseClient) => (data: SkillApiInsert & WithTenantIdProjectId) => Promise<SkillRecordWithFiles>;
112
112
  declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillApiInsert & WithTenantIdProjectId) => Promise<{
113
- tenantId: string;
114
- projectId: string;
115
113
  id: string;
116
114
  name: string;
117
115
  description: string;
118
- metadata: Record<string, string> | null;
119
- content: string;
120
116
  createdAt: string;
121
117
  updatedAt: string;
118
+ tenantId: string;
119
+ projectId: string;
120
+ content: string;
121
+ metadata: Record<string, string> | null;
122
122
  }>;
123
123
  declare const updateSkill: (db: AgentsManageDatabaseClient) => (params: {
124
124
  scopes: ProjectScopeConfig;
@@ -139,16 +139,16 @@ declare const upsertSubAgentSkill: (db: AgentsManageDatabaseClient) => (params:
139
139
  index: number;
140
140
  alwaysLoaded?: boolean;
141
141
  }) => Promise<{
142
- tenantId: string;
143
- projectId: string;
144
142
  id: string;
145
143
  createdAt: string;
146
144
  updatedAt: string;
145
+ tenantId: string;
146
+ projectId: string;
147
147
  agentId: string;
148
- subAgentId: string;
148
+ skillId: string;
149
149
  index: number;
150
150
  alwaysLoaded: boolean;
151
- skillId: string;
151
+ subAgentId: string;
152
152
  }>;
153
153
  declare const deleteSubAgentSkill: (db: AgentsManageDatabaseClient) => (params: {
154
154
  scopes: AgentScopeConfig;
@@ -9,11 +9,11 @@ declare const getSubAgentExternalAgentRelationById: (db: AgentsManageDatabaseCli
9
9
  scopes: SubAgentScopeConfig;
10
10
  relationId: string;
11
11
  }) => Promise<{
12
- tenantId: string;
13
- projectId: string;
14
12
  id: string;
15
13
  createdAt: string;
16
14
  updatedAt: string;
15
+ tenantId: string;
16
+ projectId: string;
17
17
  agentId: string;
18
18
  subAgentId: string;
19
19
  headers: Record<string, string> | null;
@@ -44,11 +44,11 @@ declare const listSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClien
44
44
  declare const getSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
45
45
  scopes: SubAgentScopeConfig;
46
46
  }) => Promise<{
47
- tenantId: string;
48
- projectId: string;
49
47
  id: string;
50
48
  createdAt: string;
51
49
  updatedAt: string;
50
+ tenantId: string;
51
+ projectId: string;
52
52
  agentId: string;
53
53
  subAgentId: string;
54
54
  headers: Record<string, string> | null;
@@ -57,11 +57,11 @@ declare const getSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient
57
57
  declare const getSubAgentExternalAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
58
58
  scopes: AgentScopeConfig;
59
59
  }) => Promise<{
60
- tenantId: string;
61
- projectId: string;
62
60
  id: string;
63
61
  createdAt: string;
64
62
  updatedAt: string;
63
+ tenantId: string;
64
+ projectId: string;
65
65
  agentId: string;
66
66
  subAgentId: string;
67
67
  headers: Record<string, string> | null;
@@ -186,11 +186,11 @@ declare const createSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
186
186
  headers?: Record<string, string> | null;
187
187
  };
188
188
  }) => Promise<{
189
- tenantId: string;
190
- projectId: string;
191
189
  id: string;
192
190
  createdAt: string;
193
191
  updatedAt: string;
192
+ tenantId: string;
193
+ projectId: string;
194
194
  agentId: string;
195
195
  subAgentId: string;
196
196
  headers: Record<string, string> | null;
@@ -203,11 +203,11 @@ declare const getSubAgentExternalAgentRelationByParams: (db: AgentsManageDatabas
203
203
  scopes: SubAgentScopeConfig;
204
204
  externalAgentId: string;
205
205
  }) => Promise<{
206
- tenantId: string;
207
- projectId: string;
208
206
  id: string;
209
207
  createdAt: string;
210
208
  updatedAt: string;
209
+ tenantId: string;
210
+ projectId: string;
211
211
  agentId: string;
212
212
  subAgentId: string;
213
213
  headers: Record<string, string> | null;
@@ -224,11 +224,11 @@ declare const upsertSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
224
224
  headers?: Record<string, string> | null;
225
225
  };
226
226
  }) => Promise<{
227
- tenantId: string;
228
- projectId: string;
229
227
  id: string;
230
228
  createdAt: string;
231
229
  updatedAt: string;
230
+ tenantId: string;
231
+ projectId: string;
232
232
  agentId: string;
233
233
  subAgentId: string;
234
234
  headers: Record<string, string> | null;