@inkeep/agents-core 0.0.0-dev-20260120175022 → 0.0.0-dev-20260120221941

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 (65) hide show
  1. package/dist/auth/auth-schema.d.ts +82 -82
  2. package/dist/auth/auth-validation-schemas.d.ts +146 -146
  3. package/dist/auth/auth.d.ts +53 -53
  4. package/dist/auth/permissions.d.ts +13 -13
  5. package/dist/client-exports.d.ts +6 -2
  6. package/dist/client-exports.js +2 -2
  7. package/dist/constants/otel-attributes.d.ts +3 -0
  8. package/dist/constants/otel-attributes.js +3 -0
  9. package/dist/data-access/index.d.ts +3 -1
  10. package/dist/data-access/index.js +3 -1
  11. package/dist/data-access/manage/agentFull.js +114 -0
  12. package/dist/data-access/manage/agents.d.ts +25 -25
  13. package/dist/data-access/manage/agents.js +27 -0
  14. package/dist/data-access/manage/artifactComponents.d.ts +14 -14
  15. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  16. package/dist/data-access/manage/dataComponents.d.ts +6 -6
  17. package/dist/data-access/manage/functionTools.d.ts +14 -14
  18. package/dist/data-access/manage/projectFull.d.ts +4 -0
  19. package/dist/data-access/manage/projectFull.js +31 -8
  20. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
  21. package/dist/data-access/manage/subAgentRelations.d.ts +24 -24
  22. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
  23. package/dist/data-access/manage/subAgents.d.ts +15 -15
  24. package/dist/data-access/manage/tools.d.ts +33 -33
  25. package/dist/data-access/manage/triggers.d.ts +84 -0
  26. package/dist/data-access/manage/triggers.js +95 -0
  27. package/dist/data-access/runtime/apiKeys.d.ts +16 -16
  28. package/dist/data-access/runtime/conversations.d.ts +23 -23
  29. package/dist/data-access/runtime/evalRuns.d.ts +2 -2
  30. package/dist/data-access/runtime/evalRuns.js +11 -1
  31. package/dist/data-access/runtime/messages.d.ts +21 -21
  32. package/dist/data-access/runtime/tasks.d.ts +7 -7
  33. package/dist/data-access/runtime/triggerInvocations.d.ts +62 -0
  34. package/dist/data-access/runtime/triggerInvocations.js +54 -0
  35. package/dist/db/manage/manage-schema.d.ts +553 -288
  36. package/dist/db/manage/manage-schema.js +31 -2
  37. package/dist/db/runtime/runtime-schema.d.ts +370 -155
  38. package/dist/db/runtime/runtime-schema.js +33 -3
  39. package/dist/dolt/branch.d.ts +55 -1
  40. package/dist/dolt/branch.js +85 -1
  41. package/dist/dolt/index.d.ts +2 -2
  42. package/dist/dolt/index.js +2 -2
  43. package/dist/index.d.ts +10 -6
  44. package/dist/index.js +10 -6
  45. package/dist/types/entities.d.ts +14 -2
  46. package/dist/types/index.d.ts +2 -2
  47. package/dist/utils/index.d.ts +3 -1
  48. package/dist/utils/index.js +3 -1
  49. package/dist/utils/template-interpolation.d.ts +22 -0
  50. package/dist/utils/template-interpolation.js +62 -0
  51. package/dist/utils/trigger-auth.d.ts +32 -0
  52. package/dist/utils/trigger-auth.js +130 -0
  53. package/dist/validation/dolt-schemas.d.ts +1 -1
  54. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  55. package/dist/validation/index.d.ts +2 -2
  56. package/dist/validation/index.js +2 -2
  57. package/dist/validation/schemas.d.ts +3620 -1382
  58. package/dist/validation/schemas.js +87 -4
  59. package/drizzle/manage/0001_broken_wendell_vaughn.sql +19 -0
  60. package/drizzle/manage/meta/0001_snapshot.json +3115 -0
  61. package/drizzle/manage/meta/_journal.json +7 -0
  62. package/drizzle/runtime/0009_freezing_leo.sql +17 -0
  63. package/drizzle/runtime/meta/0009_snapshot.json +2397 -0
  64. package/drizzle/runtime/meta/_journal.json +7 -0
  65. package/package.json +1 -1
@@ -9,6 +9,7 @@ import { createSubAgentRelation, deleteAgentRelationsByAgent, deleteAgentToolRel
9
9
  import { deleteSubAgent, listSubAgents, upsertSubAgent } from "./subAgents.js";
10
10
  import { deleteSubAgentTeamAgentRelation, getSubAgentTeamAgentRelationsByAgent, upsertSubAgentTeamAgentRelation } from "./subAgentTeamAgentRelations.js";
11
11
  import { upsertSubAgentToolRelation } from "./tools.js";
12
+ import { deleteTrigger, listTriggers, upsertTrigger } from "./triggers.js";
12
13
  import { deleteAgent, getAgentById, getFullAgentDefinition, getFullAgentDefinitionWithRelationIds, updateAgent, upsertAgent } from "./agents.js";
13
14
  import { associateArtifactComponentWithAgent, deleteAgentArtifactComponentRelationByAgent, upsertAgentArtifactComponentRelation } from "./artifactComponents.js";
14
15
  import { associateDataComponentWithAgent, deleteAgentDataComponentRelationByAgent, upsertAgentDataComponentRelation } from "./dataComponents.js";
@@ -246,6 +247,50 @@ const createFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
246
247
  functionToolCount: Object.keys(typed.functionTools).length
247
248
  }, "All function tools created successfully");
248
249
  }
250
+ if (typed.triggers && Object.keys(typed.triggers).length > 0) {
251
+ logger.info({
252
+ agentId: finalAgentId,
253
+ triggerCount: Object.keys(typed.triggers).length
254
+ }, "Creating triggers for agent");
255
+ const triggerPromises = Object.entries(typed.triggers).map(async ([triggerId, triggerData]) => {
256
+ try {
257
+ logger.info({
258
+ agentId: finalAgentId,
259
+ triggerId
260
+ }, "Creating trigger in agent");
261
+ await upsertTrigger(db)({
262
+ scopes: {
263
+ tenantId,
264
+ projectId,
265
+ agentId: finalAgentId
266
+ },
267
+ data: {
268
+ ...triggerData,
269
+ id: triggerId,
270
+ tenantId,
271
+ projectId,
272
+ agentId: finalAgentId
273
+ }
274
+ });
275
+ logger.info({
276
+ agentId: finalAgentId,
277
+ triggerId
278
+ }, "Trigger created successfully");
279
+ } catch (error) {
280
+ logger.error({
281
+ agentId: finalAgentId,
282
+ triggerId,
283
+ error
284
+ }, "Failed to create trigger in agent");
285
+ throw error;
286
+ }
287
+ });
288
+ await Promise.all(triggerPromises);
289
+ logger.info({
290
+ agentId: finalAgentId,
291
+ triggerCount: Object.keys(typed.triggers).length
292
+ }, "All triggers created successfully");
293
+ }
249
294
  const subAgentPromises = Object.entries(typed.subAgents).map(async ([subAgentId, agentData$1]) => {
250
295
  const subAgent = agentData$1;
251
296
  try {
@@ -766,6 +811,75 @@ const updateFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
766
811
  }, "Failed to delete orphaned function tool");
767
812
  }
768
813
  if (deletedFunctionToolCount > 0) logger.info({ deletedFunctionToolCount }, "Deleted orphaned function tools from agent");
814
+ if (typedAgentDefinition.triggers && Object.keys(typedAgentDefinition.triggers).length > 0) {
815
+ logger.info({
816
+ agentId: finalAgentId,
817
+ triggerCount: Object.keys(typedAgentDefinition.triggers).length
818
+ }, "Updating triggers for agent");
819
+ const triggerPromises = Object.entries(typedAgentDefinition.triggers).map(async ([triggerId, triggerData]) => {
820
+ try {
821
+ logger.info({
822
+ agentId: finalAgentId,
823
+ triggerId
824
+ }, "Updating trigger in agent");
825
+ await upsertTrigger(db)({
826
+ scopes: {
827
+ tenantId,
828
+ projectId,
829
+ agentId: finalAgentId
830
+ },
831
+ data: {
832
+ ...triggerData,
833
+ id: triggerId,
834
+ tenantId,
835
+ projectId,
836
+ agentId: finalAgentId
837
+ }
838
+ });
839
+ logger.info({
840
+ agentId: finalAgentId,
841
+ triggerId
842
+ }, "Trigger updated successfully");
843
+ } catch (error) {
844
+ logger.error({
845
+ agentId: finalAgentId,
846
+ triggerId,
847
+ error
848
+ }, "Failed to update trigger in agent");
849
+ throw error;
850
+ }
851
+ });
852
+ await Promise.all(triggerPromises);
853
+ logger.info({
854
+ agentId: finalAgentId,
855
+ triggerCount: Object.keys(typedAgentDefinition.triggers).length
856
+ }, "All triggers updated successfully");
857
+ }
858
+ const incomingTriggerIds = new Set(typedAgentDefinition.triggers ? Object.keys(typedAgentDefinition.triggers) : []);
859
+ const existingTriggers = await listTriggers(db)({ scopes: {
860
+ tenantId,
861
+ projectId,
862
+ agentId: finalAgentId
863
+ } });
864
+ let deletedTriggerCount = 0;
865
+ for (const trigger of existingTriggers) if (!incomingTriggerIds.has(trigger.id)) try {
866
+ await deleteTrigger(db)({
867
+ scopes: {
868
+ tenantId,
869
+ projectId,
870
+ agentId: finalAgentId
871
+ },
872
+ triggerId: trigger.id
873
+ });
874
+ deletedTriggerCount++;
875
+ logger.info({ triggerId: trigger.id }, "Deleted orphaned trigger");
876
+ } catch (error) {
877
+ logger.error({
878
+ triggerId: trigger.id,
879
+ error
880
+ }, "Failed to delete orphaned trigger");
881
+ }
882
+ if (deletedTriggerCount > 0) logger.info({ deletedTriggerCount }, "Deleted orphaned triggers from agent");
769
883
  const subAgentPromises = Object.entries(typedAgentDefinition.subAgents).map(async ([subAgentId, agentData$1]) => {
770
884
  const subAgent = agentData$1;
771
885
  let existingSubAgent = null;
@@ -8,13 +8,13 @@ import { PgTable } from "drizzle-orm/pg-core";
8
8
  declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
9
9
  scopes: AgentScopeConfig;
10
10
  }) => Promise<{
11
+ tenantId: string;
12
+ projectId: string;
11
13
  id: string;
12
- name: string;
13
- description: string | null;
14
14
  createdAt: string;
15
+ name: string;
15
16
  updatedAt: string;
16
- projectId: string;
17
- tenantId: string;
17
+ description: string | null;
18
18
  models: {
19
19
  base?: {
20
20
  model?: string | undefined;
@@ -32,9 +32,9 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
32
32
  stopWhen: {
33
33
  transferCountIs?: number | undefined;
34
34
  } | null;
35
- prompt: string | null;
36
35
  defaultSubAgentId: string | null;
37
36
  contextConfigId: string | null;
37
+ prompt: string | null;
38
38
  statusUpdates: {
39
39
  enabled?: boolean | undefined;
40
40
  numEvents?: number | undefined;
@@ -54,13 +54,13 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
54
54
  declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
55
55
  scopes: AgentScopeConfig;
56
56
  }) => Promise<{
57
+ tenantId: string;
58
+ projectId: string;
57
59
  id: string;
58
- name: string;
59
- description: string | null;
60
60
  createdAt: string;
61
+ name: string;
61
62
  updatedAt: string;
62
- projectId: string;
63
- tenantId: string;
63
+ description: string | null;
64
64
  models: {
65
65
  base?: {
66
66
  model?: string | undefined;
@@ -78,9 +78,9 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
78
78
  stopWhen: {
79
79
  transferCountIs?: number | undefined;
80
80
  } | null;
81
- prompt: string | null;
82
81
  defaultSubAgentId: string | null;
83
82
  contextConfigId: string | null;
83
+ prompt: string | null;
84
84
  statusUpdates: {
85
85
  enabled?: boolean | undefined;
86
86
  numEvents?: number | undefined;
@@ -97,13 +97,13 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
97
97
  }[] | undefined;
98
98
  } | null;
99
99
  defaultSubAgent: {
100
+ tenantId: string;
101
+ projectId: string;
100
102
  id: string;
101
- name: string;
102
- description: string | null;
103
103
  createdAt: string;
104
+ name: string;
104
105
  updatedAt: string;
105
- projectId: string;
106
- tenantId: string;
106
+ description: string | null;
107
107
  models: {
108
108
  base?: {
109
109
  model?: string | undefined;
@@ -121,21 +121,21 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
121
121
  stopWhen: {
122
122
  stepCountIs?: number | undefined;
123
123
  } | null;
124
- prompt: string | null;
125
124
  agentId: string;
125
+ prompt: string | null;
126
126
  conversationHistoryConfig: ConversationHistoryConfig | null;
127
127
  } | null;
128
128
  } | null>;
129
129
  declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
130
130
  scopes: ProjectScopeConfig;
131
131
  }) => Promise<{
132
+ tenantId: string;
133
+ projectId: string;
132
134
  id: string;
133
- name: string;
134
- description: string | null;
135
135
  createdAt: string;
136
+ name: string;
136
137
  updatedAt: string;
137
- projectId: string;
138
- tenantId: string;
138
+ description: string | null;
139
139
  models: {
140
140
  base?: {
141
141
  model?: string | undefined;
@@ -153,9 +153,9 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
153
153
  stopWhen: {
154
154
  transferCountIs?: number | undefined;
155
155
  } | null;
156
- prompt: string | null;
157
156
  defaultSubAgentId: string | null;
158
157
  contextConfigId: string | null;
158
+ prompt: string | null;
159
159
  statusUpdates: {
160
160
  enabled?: boolean | undefined;
161
161
  numEvents?: number | undefined;
@@ -228,13 +228,13 @@ declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params:
228
228
  };
229
229
  }>;
230
230
  declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
231
+ tenantId: string;
232
+ projectId: string;
231
233
  id: string;
232
- name: string;
233
- description: string | null;
234
234
  createdAt: string;
235
+ name: string;
235
236
  updatedAt: string;
236
- projectId: string;
237
- tenantId: string;
237
+ description: string | null;
238
238
  models: {
239
239
  base?: {
240
240
  model?: string | undefined;
@@ -252,9 +252,9 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
252
252
  stopWhen: {
253
253
  transferCountIs?: number | undefined;
254
254
  } | null;
255
- prompt: string | null;
256
255
  defaultSubAgentId: string | null;
257
256
  contextConfigId: string | null;
257
+ prompt: string | null;
258
258
  statusUpdates: {
259
259
  enabled?: boolean | undefined;
260
260
  numEvents?: number | undefined;
@@ -9,6 +9,7 @@ import { getAgentRelations, getAgentRelationsByAgent } from "./subAgentRelations
9
9
  import { getSubAgentById } from "./subAgents.js";
10
10
  import { getSubAgentTeamAgentRelationsByAgent } from "./subAgentTeamAgentRelations.js";
11
11
  import { listTools } from "./tools.js";
12
+ import { listTriggers } from "./triggers.js";
12
13
  import { and, count, desc, eq, inArray } from "drizzle-orm";
13
14
 
14
15
  //#region src/data-access/manage/agents.ts
@@ -450,6 +451,32 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
450
451
  } catch (error) {
451
452
  console.warn("Failed to load tools/functions lookups:", error);
452
453
  }
454
+ try {
455
+ const triggersList = await listTriggers(db)({ scopes: {
456
+ tenantId,
457
+ projectId,
458
+ agentId
459
+ } });
460
+ console.log(`[getFullAgentDefinitionInternal] Fetched ${triggersList.length} triggers for agent ${agentId}`);
461
+ if (triggersList.length > 0) {
462
+ const triggersObject = {};
463
+ for (const trigger of triggersList) triggersObject[trigger.id] = {
464
+ id: trigger.id,
465
+ name: trigger.name,
466
+ description: trigger.description,
467
+ enabled: trigger.enabled,
468
+ inputSchema: trigger.inputSchema,
469
+ outputTransform: trigger.outputTransform,
470
+ messageTemplate: trigger.messageTemplate,
471
+ authentication: trigger.authentication,
472
+ signingSecret: trigger.signingSecret
473
+ };
474
+ result.triggers = triggersObject;
475
+ console.log(`[getFullAgentDefinitionInternal] Added triggers to result:`, Object.keys(triggersObject));
476
+ }
477
+ } catch (error) {
478
+ console.warn("Failed to load triggers:", error);
479
+ }
453
480
  return result;
454
481
  };
455
482
  const getFullAgentDefinition = (db) => async ({ scopes }) => {
@@ -7,13 +7,13 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
7
7
  scopes: ProjectScopeConfig;
8
8
  id: string;
9
9
  }) => Promise<{
10
+ tenantId: string;
11
+ projectId: string;
10
12
  id: string;
11
- name: string;
12
- description: string | null;
13
13
  createdAt: string;
14
+ name: string;
14
15
  updatedAt: string;
15
- projectId: string;
16
- tenantId: string;
16
+ description: string | null;
17
17
  props: Record<string, unknown> | null;
18
18
  render: {
19
19
  component: string;
@@ -49,13 +49,13 @@ declare const listArtifactComponentsPaginated: (db: AgentsManageDatabaseClient)
49
49
  };
50
50
  }>;
51
51
  declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
52
+ tenantId: string;
53
+ projectId: string;
52
54
  id: string;
53
- name: string;
54
- description: string | null;
55
55
  createdAt: string;
56
+ name: string;
56
57
  updatedAt: string;
57
- projectId: string;
58
- tenantId: string;
58
+ description: string | null;
59
59
  props: Record<string, unknown> | null;
60
60
  render: {
61
61
  component: string;
@@ -104,12 +104,12 @@ declare const associateArtifactComponentWithAgent: (db: AgentsManageDatabaseClie
104
104
  scopes: SubAgentScopeConfig;
105
105
  artifactComponentId: string;
106
106
  }) => Promise<{
107
+ tenantId: string;
108
+ projectId: string;
107
109
  id: string;
108
110
  createdAt: string;
109
- projectId: string;
110
- tenantId: string;
111
- agentId: string;
112
111
  subAgentId: string;
112
+ agentId: string;
113
113
  artifactComponentId: string;
114
114
  }>;
115
115
  declare const removeArtifactComponentFromAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -147,12 +147,12 @@ declare const upsertAgentArtifactComponentRelation: (db: AgentsManageDatabaseCli
147
147
  scopes: SubAgentScopeConfig;
148
148
  artifactComponentId: string;
149
149
  }) => Promise<{
150
+ tenantId: string;
151
+ projectId: string;
150
152
  id: string;
151
153
  createdAt: string;
152
- projectId: string;
153
- tenantId: string;
154
- agentId: string;
155
154
  subAgentId: string;
155
+ agentId: string;
156
156
  artifactComponentId: string;
157
157
  } | null>;
158
158
  /**
@@ -8,26 +8,26 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
8
8
  scopes: AgentScopeConfig;
9
9
  id: string;
10
10
  }) => Promise<{
11
+ tenantId: string;
12
+ projectId: string;
11
13
  id: string;
12
14
  createdAt: string;
13
15
  updatedAt: string;
14
- projectId: string;
15
- tenantId: string;
16
- agentId: string;
17
16
  headersSchema: unknown;
18
17
  contextVariables: Record<string, ContextFetchDefinition> | null;
18
+ agentId: string;
19
19
  } | undefined>;
20
20
  declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
21
21
  scopes: AgentScopeConfig;
22
22
  }) => Promise<{
23
+ tenantId: string;
24
+ projectId: string;
23
25
  id: string;
24
26
  createdAt: string;
25
27
  updatedAt: string;
26
- projectId: string;
27
- tenantId: string;
28
- agentId: string;
29
28
  headersSchema: unknown;
30
29
  contextVariables: Record<string, ContextFetchDefinition> | null;
30
+ agentId: string;
31
31
  }[]>;
32
32
  declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (params: {
33
33
  scopes: AgentScopeConfig;
@@ -42,14 +42,14 @@ declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (
42
42
  };
43
43
  }>;
44
44
  declare const createContextConfig: (db: AgentsManageDatabaseClient) => (params: ContextConfigInsert) => Promise<{
45
+ tenantId: string;
46
+ projectId: string;
45
47
  id: string;
46
48
  createdAt: string;
47
49
  updatedAt: string;
48
- projectId: string;
49
- tenantId: string;
50
- agentId: string;
51
50
  headersSchema: unknown;
52
51
  contextVariables: Record<string, ContextFetchDefinition> | null;
52
+ agentId: string;
53
53
  }>;
54
54
  declare const updateContextConfig: (db: AgentsManageDatabaseClient) => (params: {
55
55
  scopes: AgentScopeConfig;
@@ -82,14 +82,14 @@ declare const countContextConfigs: (db: AgentsManageDatabaseClient) => (params:
82
82
  declare const upsertContextConfig: (db: AgentsManageDatabaseClient) => (params: {
83
83
  data: ContextConfigInsert;
84
84
  }) => Promise<{
85
+ tenantId: string;
86
+ projectId: string;
85
87
  id: string;
86
88
  createdAt: string;
87
89
  updatedAt: string;
88
- projectId: string;
89
- tenantId: string;
90
- agentId: string;
91
90
  headersSchema: unknown;
92
91
  contextVariables: Record<string, ContextFetchDefinition> | null;
92
+ agentId: string;
93
93
  }>;
94
94
  //#endregion
95
95
  export { countContextConfigs, createContextConfig, deleteContextConfig, getContextConfigById, hasContextConfig, listContextConfigs, listContextConfigsPaginated, updateContextConfig, upsertContextConfig };
@@ -64,12 +64,12 @@ declare const associateDataComponentWithAgent: (db: AgentsManageDatabaseClient)
64
64
  scopes: SubAgentScopeConfig;
65
65
  dataComponentId: string;
66
66
  }) => Promise<{
67
+ tenantId: string;
68
+ projectId: string;
67
69
  id: string;
68
70
  createdAt: string;
69
- projectId: string;
70
- tenantId: string;
71
- agentId: string;
72
71
  subAgentId: string;
72
+ agentId: string;
73
73
  dataComponentId: string;
74
74
  }>;
75
75
  /**
@@ -106,12 +106,12 @@ declare const upsertAgentDataComponentRelation: (db: AgentsManageDatabaseClient)
106
106
  scopes: SubAgentScopeConfig;
107
107
  dataComponentId: string;
108
108
  }) => Promise<{
109
+ tenantId: string;
110
+ projectId: string;
109
111
  id: string;
110
112
  createdAt: string;
111
- projectId: string;
112
- tenantId: string;
113
- agentId: string;
114
113
  subAgentId: string;
114
+ agentId: string;
115
115
  dataComponentId: string;
116
116
  } | null>;
117
117
  /**
@@ -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;
56
58
  id: string;
57
- name: string;
58
- description: string | null;
59
59
  createdAt: string;
60
+ name: string;
60
61
  updatedAt: string;
61
- projectId: string;
62
- tenantId: string;
62
+ description: string | null;
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;
98
100
  id: string;
99
- name: string;
100
- description: string | null;
101
101
  createdAt: string;
102
+ name: string;
102
103
  updatedAt: string;
103
- projectId: string;
104
- tenantId: string;
104
+ description: string | null;
105
105
  agentId: string;
106
106
  functionId: string;
107
107
  }>;
@@ -150,13 +150,13 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
150
150
  subAgentId: string;
151
151
  functionToolId: string;
152
152
  }) => Promise<{
153
+ tenantId: string;
154
+ projectId: string;
153
155
  id: string;
154
156
  createdAt: string;
155
157
  updatedAt: string;
156
- projectId: string;
157
- tenantId: string;
158
- agentId: string;
159
158
  subAgentId: string;
159
+ agentId: string;
160
160
  functionToolId: string;
161
161
  }>;
162
162
  /**
@@ -206,13 +206,13 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
206
206
  subAgentId: string;
207
207
  functionToolId: string;
208
208
  }) => Promise<{
209
+ tenantId: string;
210
+ projectId: string;
209
211
  id: string;
210
212
  createdAt: string;
211
213
  updatedAt: string;
212
- projectId: string;
213
- tenantId: string;
214
- agentId: string;
215
214
  subAgentId: string;
215
+ agentId: string;
216
216
  functionToolId: string;
217
217
  }>;
218
218
  //#endregion
@@ -24,9 +24,13 @@ declare const updateFullProjectServerSide: (db: AgentsManageDatabaseClient, logg
24
24
  }) => Promise<FullProjectSelect>;
25
25
  declare const getFullProject: (db: AgentsManageDatabaseClient, logger?: ProjectLogger) => (params: {
26
26
  scopes: ProjectScopeConfig;
27
+ /** Optional branch name to query from. If not provided, uses the project's main branch. */
28
+ branchName?: string;
27
29
  }) => Promise<FullProjectSelect | null>;
28
30
  declare const getFullProjectWithRelationIds: (db: AgentsManageDatabaseClient, logger?: ProjectLogger) => (params: {
29
31
  scopes: ProjectScopeConfig;
32
+ /** Optional branch name to query from. If not provided, uses the project's main branch. */
33
+ branchName?: string;
30
34
  }) => Promise<FullProjectSelectWithRelationIds | null>;
31
35
  /**
32
36
  * Delete a complete project and cascade to all related entities
@@ -3,6 +3,7 @@ import { deleteExternalAgent, listExternalAgents, upsertExternalAgent } from "./
3
3
  import { deleteFunction, listFunctions, upsertFunction } from "./functions.js";
4
4
  import { deleteCredentialReference, listCredentialReferences, upsertCredentialReference } from "./credentialReferences.js";
5
5
  import { deleteTool, listTools, upsertTool } from "./tools.js";
6
+ import { getProjectBranchName, withBranch } from "../../dolt/branch.js";
6
7
  import { listAgents } from "./agents.js";
7
8
  import { deleteArtifactComponent, listArtifactComponents, upsertArtifactComponent } from "./artifactComponents.js";
8
9
  import { deleteDataComponent, listDataComponents, upsertDataComponent } from "./dataComponents.js";
@@ -1047,12 +1048,20 @@ const getFullProjectInternal = (db, logger = defaultLogger) => async (params) =>
1047
1048
  });
1048
1049
  await Promise.all(agentPromises);
1049
1050
  }
1050
- if (!project.models) throw new Error(`Project ${project.id} is missing required models configuration. Please update the project to include a base model.`);
1051
+ const projectModels = project.models ?? {
1052
+ base: { model: "claude-sonnet-4-5" },
1053
+ structuredOutput: { model: "claude-sonnet-4-5" },
1054
+ summarizer: { model: "claude-sonnet-4-5" }
1055
+ };
1056
+ if (!projectModels.base) logger.warn({
1057
+ tenantId,
1058
+ projectId
1059
+ }, `Project ${project.id} is missing base model configuration. Using default: claude-sonnet-4-5`);
1051
1060
  const fullProjectDefinition = {
1052
1061
  id: project.id,
1053
1062
  name: project.name,
1054
1063
  description: project.description,
1055
- models: project.models,
1064
+ models: projectModels,
1056
1065
  stopWhen: project.stopWhen ?? null,
1057
1066
  agents,
1058
1067
  tools: projectTools,
@@ -1082,15 +1091,29 @@ const getFullProjectInternal = (db, logger = defaultLogger) => async (params) =>
1082
1091
  }
1083
1092
  };
1084
1093
  const getFullProject = (db, logger = defaultLogger) => async (params) => {
1085
- return getFullProjectInternal(db, logger)({
1086
- scopes: params.scopes,
1087
- includeRelationIds: false
1094
+ const { scopes, branchName } = params;
1095
+ const targetBranch = branchName ?? getProjectBranchName(scopes.tenantId, scopes.projectId);
1096
+ return withBranch(db)({
1097
+ branchName: targetBranch,
1098
+ callback: async (txDb) => {
1099
+ return getFullProjectInternal(txDb, logger)({
1100
+ scopes,
1101
+ includeRelationIds: false
1102
+ });
1103
+ }
1088
1104
  });
1089
1105
  };
1090
1106
  const getFullProjectWithRelationIds = (db, logger = defaultLogger) => async (params) => {
1091
- return getFullProjectInternal(db, logger)({
1092
- scopes: params.scopes,
1093
- includeRelationIds: true
1107
+ const { scopes, branchName } = params;
1108
+ const targetBranch = branchName ?? getProjectBranchName(scopes.tenantId, scopes.projectId);
1109
+ return withBranch(db)({
1110
+ branchName: targetBranch,
1111
+ callback: async (txDb) => {
1112
+ return getFullProjectInternal(txDb, logger)({
1113
+ scopes,
1114
+ includeRelationIds: true
1115
+ });
1116
+ }
1094
1117
  });
1095
1118
  };
1096
1119
  /**