@inkeep/agents-core 0.59.4 → 0.61.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 (88) hide show
  1. package/dist/auth/auth-validation-schemas.d.ts +154 -154
  2. package/dist/auth/init.js +42 -0
  3. package/dist/auth/wait-for-spicedb.d.ts +1 -0
  4. package/dist/auth/wait-for-spicedb.js +51 -0
  5. package/dist/client-exports.d.ts +4 -107
  6. package/dist/client-exports.js +3 -61
  7. package/dist/constants/context-breakdown.js +5 -0
  8. package/dist/constants/otel-attributes.d.ts +25 -1
  9. package/dist/constants/otel-attributes.js +25 -1
  10. package/dist/data-access/index.d.ts +4 -3
  11. package/dist/data-access/index.js +4 -3
  12. package/dist/data-access/manage/agentFull.js +15 -10
  13. package/dist/data-access/manage/agents.d.ts +69 -63
  14. package/dist/data-access/manage/agents.js +2 -0
  15. package/dist/data-access/manage/artifactComponents.d.ts +12 -12
  16. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  17. package/dist/data-access/manage/dataComponents.d.ts +6 -6
  18. package/dist/data-access/manage/functionTools.d.ts +18 -18
  19. package/dist/data-access/manage/functionTools.js +2 -2
  20. package/dist/data-access/manage/projectFull.js +24 -3
  21. package/dist/data-access/manage/skills.d.ts +14 -14
  22. package/dist/data-access/manage/skills.js +2 -3
  23. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +27 -27
  24. package/dist/data-access/manage/subAgentExternalAgentRelations.js +2 -2
  25. package/dist/data-access/manage/subAgentRelations.d.ts +29 -29
  26. package/dist/data-access/manage/subAgentRelations.js +2 -2
  27. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +30 -30
  28. package/dist/data-access/manage/subAgentTeamAgentRelations.js +2 -2
  29. package/dist/data-access/manage/subAgents.d.ts +36 -36
  30. package/dist/data-access/manage/tools.d.ts +21 -21
  31. package/dist/data-access/manage/tools.js +2 -2
  32. package/dist/data-access/manage/triggers.d.ts +2 -2
  33. package/dist/data-access/runtime/apiKeys.d.ts +16 -16
  34. package/dist/data-access/runtime/apps.d.ts +61 -13
  35. package/dist/data-access/runtime/apps.js +15 -1
  36. package/dist/data-access/runtime/conversations.d.ts +23 -23
  37. package/dist/data-access/runtime/conversations.js +18 -1
  38. package/dist/data-access/runtime/ledgerArtifacts.d.ts +11 -2
  39. package/dist/data-access/runtime/ledgerArtifacts.js +12 -1
  40. package/dist/data-access/runtime/messages.d.ts +18 -18
  41. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
  42. package/dist/data-access/runtime/tasks.d.ts +4 -4
  43. package/dist/data-access/runtime/workflowExecutions.d.ts +25 -0
  44. package/dist/data-access/runtime/workflowExecutions.js +32 -0
  45. package/dist/db/manage/manage-schema.d.ts +495 -475
  46. package/dist/db/manage/manage-schema.js +1 -0
  47. package/dist/db/runtime/runtime-schema.d.ts +568 -334
  48. package/dist/db/runtime/runtime-schema.js +19 -2
  49. package/dist/dolt/fk-map.d.ts +5 -0
  50. package/dist/dolt/fk-map.js +34 -0
  51. package/dist/dolt/index.d.ts +3 -2
  52. package/dist/dolt/index.js +3 -2
  53. package/dist/dolt/resolve-conflicts.d.ts +11 -1
  54. package/dist/dolt/resolve-conflicts.js +105 -47
  55. package/dist/index.d.ts +15 -10
  56. package/dist/index.js +13 -8
  57. package/dist/types/entities.d.ts +5 -2
  58. package/dist/types/index.d.ts +3 -3
  59. package/dist/types/utility.d.ts +11 -3
  60. package/dist/utils/apiKeys.js +1 -1
  61. package/dist/utils/conversations.d.ts +10 -1
  62. package/dist/utils/conversations.js +19 -1
  63. package/dist/utils/error.d.ts +51 -51
  64. package/dist/utils/index.d.ts +7 -2
  65. package/dist/utils/index.js +5 -2
  66. package/dist/utils/model-factory.js +35 -10
  67. package/dist/utils/token-estimator.d.ts +19 -0
  68. package/dist/utils/token-estimator.js +17 -0
  69. package/dist/utils/usage-cost-middleware.d.ts +13 -0
  70. package/dist/utils/usage-cost-middleware.js +60 -0
  71. package/dist/utils/usage-tracker.d.ts +2 -0
  72. package/dist/utils/usage-tracker.js +1 -0
  73. package/dist/utils/validate-public-key.d.ts +10 -0
  74. package/dist/utils/validate-public-key.js +89 -0
  75. package/dist/validation/agentFull.js +0 -1
  76. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  77. package/dist/validation/index.d.ts +2 -2
  78. package/dist/validation/index.js +2 -2
  79. package/dist/validation/schemas.d.ts +3518 -2682
  80. package/dist/validation/schemas.js +104 -36
  81. package/drizzle/manage/0013_gorgeous_umar.sql +1 -0
  82. package/drizzle/manage/meta/0013_snapshot.json +3704 -0
  83. package/drizzle/manage/meta/_journal.json +7 -0
  84. package/drizzle/runtime/0025_faulty_kylun.sql +1 -0
  85. package/drizzle/runtime/0026_graceful_scorpion.sql +15 -0
  86. package/drizzle/runtime/meta/0026_snapshot.json +4389 -0
  87. package/drizzle/runtime/meta/_journal.json +14 -0
  88. package/package.json +1 -1
@@ -10,14 +10,14 @@ declare const getSubAgentExternalAgentRelationById: (db: AgentsManageDatabaseCli
10
10
  relationId: string;
11
11
  }) => Promise<{
12
12
  id: string;
13
- tenantId: string;
14
- projectId: string;
15
- agentId: string;
16
13
  createdAt: string;
17
14
  updatedAt: string;
15
+ agentId: string;
16
+ projectId: string;
17
+ tenantId: string;
18
+ subAgentId: string;
18
19
  headers: Record<string, string> | null;
19
20
  externalAgentId: string;
20
- subAgentId: string;
21
21
  } | undefined>;
22
22
  declare const listSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
23
23
  scopes: SubAgentScopeConfig;
@@ -45,27 +45,27 @@ declare const getSubAgentExternalAgentRelations: (db: AgentsManageDatabaseClient
45
45
  scopes: SubAgentScopeConfig;
46
46
  }) => Promise<{
47
47
  id: string;
48
- tenantId: string;
49
- projectId: string;
50
- agentId: string;
51
48
  createdAt: string;
52
49
  updatedAt: string;
50
+ agentId: string;
51
+ projectId: string;
52
+ tenantId: string;
53
+ subAgentId: string;
53
54
  headers: Record<string, string> | null;
54
55
  externalAgentId: string;
55
- subAgentId: string;
56
56
  }[]>;
57
57
  declare const getSubAgentExternalAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
58
58
  scopes: AgentScopeConfig;
59
59
  }) => Promise<{
60
60
  id: string;
61
- tenantId: string;
62
- projectId: string;
63
- agentId: string;
64
61
  createdAt: string;
65
62
  updatedAt: string;
63
+ agentId: string;
64
+ projectId: string;
65
+ tenantId: string;
66
+ subAgentId: string;
66
67
  headers: Record<string, string> | null;
67
68
  externalAgentId: string;
68
- subAgentId: string;
69
69
  }[]>;
70
70
  declare const getSubAgentExternalAgentRelationsByExternalAgent: (db: AgentsManageDatabaseClient) => (params: {
71
71
  scopes: AgentScopeConfig;
@@ -147,15 +147,15 @@ declare const getSubAgentsForExternalAgent: (db: AgentsManageDatabaseClient) =>
147
147
  models: {
148
148
  base?: {
149
149
  model?: string | undefined;
150
- providerOptions?: Record<string, any> | undefined;
150
+ providerOptions?: Record<string, unknown> | undefined;
151
151
  } | undefined;
152
152
  structuredOutput?: {
153
153
  model?: string | undefined;
154
- providerOptions?: Record<string, any> | undefined;
154
+ providerOptions?: Record<string, unknown> | undefined;
155
155
  } | undefined;
156
156
  summarizer?: {
157
157
  model?: string | undefined;
158
- providerOptions?: Record<string, any> | undefined;
158
+ providerOptions?: Record<string, unknown> | undefined;
159
159
  } | undefined;
160
160
  } | null;
161
161
  stopWhen: {
@@ -181,14 +181,14 @@ declare const createSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
181
181
  };
182
182
  }) => Promise<{
183
183
  id: string;
184
- tenantId: string;
185
- projectId: string;
186
- agentId: string;
187
184
  createdAt: string;
188
185
  updatedAt: string;
186
+ agentId: string;
187
+ projectId: string;
188
+ tenantId: string;
189
+ subAgentId: string;
189
190
  headers: Record<string, string> | null;
190
191
  externalAgentId: string;
191
- subAgentId: string;
192
192
  }>;
193
193
  /**
194
194
  * Check if sub-agent external agent relation exists by params
@@ -198,14 +198,14 @@ declare const getSubAgentExternalAgentRelationByParams: (db: AgentsManageDatabas
198
198
  externalAgentId: string;
199
199
  }) => Promise<{
200
200
  id: string;
201
- tenantId: string;
202
- projectId: string;
203
- agentId: string;
204
201
  createdAt: string;
205
202
  updatedAt: string;
203
+ agentId: string;
204
+ projectId: string;
205
+ tenantId: string;
206
+ subAgentId: string;
206
207
  headers: Record<string, string> | null;
207
208
  externalAgentId: string;
208
- subAgentId: string;
209
209
  } | undefined>;
210
210
  /**
211
211
  * Upsert sub-agent external agent relation (create if it doesn't exist, update if it does)
@@ -219,14 +219,14 @@ declare const upsertSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClie
219
219
  };
220
220
  }) => Promise<{
221
221
  id: string;
222
- tenantId: string;
223
- projectId: string;
224
- agentId: string;
225
222
  createdAt: string;
226
223
  updatedAt: string;
224
+ agentId: string;
225
+ projectId: string;
226
+ tenantId: string;
227
+ subAgentId: string;
227
228
  headers: Record<string, string> | null;
228
229
  externalAgentId: string;
229
- subAgentId: string;
230
230
  }>;
231
231
  declare const updateSubAgentExternalAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
232
232
  scopes: SubAgentScopeConfig;
@@ -1,7 +1,7 @@
1
1
  import { externalAgents, subAgentExternalAgentRelations, subAgents } from "../../db/manage/manage-schema.js";
2
+ import { deriveRelationId } from "../../utils/conversations.js";
2
3
  import { agentScopedWhere, subAgentScopedWhere } from "./scope-helpers.js";
3
4
  import { and, count, desc, eq } from "drizzle-orm";
4
- import { nanoid } from "nanoid";
5
5
 
6
6
  //#region src/data-access/manage/subAgentExternalAgentRelations.ts
7
7
  const getSubAgentExternalAgentRelationById = (db) => async (params) => {
@@ -122,7 +122,7 @@ const getSubAgentsForExternalAgent = (db) => async (params) => {
122
122
  };
123
123
  };
124
124
  const createSubAgentExternalAgentRelation = (db) => async (params) => {
125
- const finalRelationId = params.relationId ?? nanoid();
125
+ const finalRelationId = params.relationId ?? deriveRelationId(params.scopes.tenantId, params.scopes.projectId, params.scopes.agentId, params.scopes.subAgentId, params.data.externalAgentId);
126
126
  return (await db.insert(subAgentExternalAgentRelations).values({
127
127
  id: finalRelationId,
128
128
  tenantId: params.scopes.tenantId,
@@ -10,11 +10,11 @@ declare const getAgentRelationById: (db: AgentsManageDatabaseClient) => (params:
10
10
  relationId: string;
11
11
  }) => Promise<{
12
12
  id: string;
13
- tenantId: string;
14
- projectId: string;
15
- agentId: string;
16
13
  createdAt: string;
17
14
  updatedAt: string;
15
+ agentId: string;
16
+ projectId: string;
17
+ tenantId: string;
18
18
  sourceSubAgentId: string;
19
19
  targetSubAgentId: string | null;
20
20
  relationType: string | null;
@@ -45,11 +45,11 @@ declare const getAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
45
45
  scopes: SubAgentScopeConfig;
46
46
  }) => Promise<{
47
47
  id: string;
48
- tenantId: string;
49
- projectId: string;
50
- agentId: string;
51
48
  createdAt: string;
52
49
  updatedAt: string;
50
+ agentId: string;
51
+ projectId: string;
52
+ tenantId: string;
53
53
  sourceSubAgentId: string;
54
54
  targetSubAgentId: string | null;
55
55
  relationType: string | null;
@@ -58,11 +58,11 @@ declare const getAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (par
58
58
  scopes: AgentScopeConfig;
59
59
  }) => Promise<{
60
60
  id: string;
61
- tenantId: string;
62
- projectId: string;
63
- agentId: string;
64
61
  createdAt: string;
65
62
  updatedAt: string;
63
+ agentId: string;
64
+ projectId: string;
65
+ tenantId: string;
66
66
  sourceSubAgentId: string;
67
67
  targetSubAgentId: string | null;
68
68
  relationType: string | null;
@@ -127,11 +127,11 @@ declare const getRelatedAgentsForAgent: (db: AgentsManageDatabaseClient) => (par
127
127
  }>;
128
128
  declare const createSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
129
129
  id: string;
130
- tenantId: string;
131
- projectId: string;
132
- agentId: string;
133
130
  createdAt: string;
134
131
  updatedAt: string;
132
+ agentId: string;
133
+ projectId: string;
134
+ tenantId: string;
135
135
  sourceSubAgentId: string;
136
136
  targetSubAgentId: string | null;
137
137
  relationType: string | null;
@@ -146,11 +146,11 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
146
146
  relationType: string;
147
147
  }) => Promise<{
148
148
  id: string;
149
- tenantId: string;
150
- projectId: string;
151
- agentId: string;
152
149
  createdAt: string;
153
150
  updatedAt: string;
151
+ agentId: string;
152
+ projectId: string;
153
+ tenantId: string;
154
154
  sourceSubAgentId: string;
155
155
  targetSubAgentId: string | null;
156
156
  relationType: string | null;
@@ -160,11 +160,11 @@ declare const getAgentRelationByParams: (db: AgentsManageDatabaseClient) => (par
160
160
  */
161
161
  declare const upsertSubAgentRelation: (db: AgentsManageDatabaseClient) => (params: SubAgentRelationInsert) => Promise<{
162
162
  id: string;
163
- tenantId: string;
164
- projectId: string;
165
- agentId: string;
166
163
  createdAt: string;
167
164
  updatedAt: string;
165
+ agentId: string;
166
+ projectId: string;
167
+ tenantId: string;
168
168
  sourceSubAgentId: string;
169
169
  targetSubAgentId: string | null;
170
170
  relationType: string | null;
@@ -205,17 +205,17 @@ declare const createAgentToolRelation: (db: AgentsManageDatabaseClient) => (para
205
205
  };
206
206
  }) => Promise<{
207
207
  id: string;
208
- tenantId: string;
209
- projectId: string;
210
- agentId: string;
211
208
  createdAt: string;
212
209
  updatedAt: string;
210
+ agentId: string;
211
+ projectId: string;
212
+ tenantId: string;
213
+ subAgentId: string;
213
214
  toolId: string;
214
215
  headers: Record<string, string> | null;
215
216
  toolPolicies: Record<string, {
216
217
  needsApproval?: boolean;
217
218
  }> | null;
218
- subAgentId: string;
219
219
  selectedTools: string[] | null;
220
220
  }>;
221
221
  declare const updateAgentToolRelation: (db: AgentsManageDatabaseClient) => (params: {
@@ -249,17 +249,17 @@ declare const getAgentToolRelationById: (db: AgentsManageDatabaseClient) => (par
249
249
  relationId: string;
250
250
  }) => Promise<{
251
251
  id: string;
252
- tenantId: string;
253
- projectId: string;
254
- agentId: string;
255
252
  createdAt: string;
256
253
  updatedAt: string;
254
+ agentId: string;
255
+ projectId: string;
256
+ tenantId: string;
257
+ subAgentId: string;
257
258
  toolId: string;
258
259
  headers: Record<string, string> | null;
259
260
  toolPolicies: Record<string, {
260
261
  needsApproval?: boolean;
261
262
  }> | null;
262
- subAgentId: string;
263
263
  selectedTools: string[] | null;
264
264
  } | undefined>;
265
265
  declare const getAgentToolRelationByAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -410,15 +410,15 @@ declare const getAgentsForTool: (db: AgentsManageDatabaseClient) => (params: {
410
410
  models: {
411
411
  base?: {
412
412
  model?: string | undefined;
413
- providerOptions?: Record<string, any> | undefined;
413
+ providerOptions?: Record<string, unknown> | undefined;
414
414
  } | undefined;
415
415
  structuredOutput?: {
416
416
  model?: string | undefined;
417
- providerOptions?: Record<string, any> | undefined;
417
+ providerOptions?: Record<string, unknown> | undefined;
418
418
  } | undefined;
419
419
  summarizer?: {
420
420
  model?: string | undefined;
421
- providerOptions?: Record<string, any> | undefined;
421
+ providerOptions?: Record<string, unknown> | undefined;
422
422
  } | undefined;
423
423
  } | null;
424
424
  stopWhen: {
@@ -1,5 +1,5 @@
1
1
  import { subAgentRelations, subAgentToolRelations, subAgents, tools } from "../../db/manage/manage-schema.js";
2
- import { generateId } from "../../utils/conversations.js";
2
+ import { deriveRelationId } from "../../utils/conversations.js";
3
3
  import { agentScopedWhere, subAgentScopedWhere } from "./scope-helpers.js";
4
4
  import { and, count, desc, eq, isNotNull } from "drizzle-orm";
5
5
 
@@ -126,7 +126,7 @@ const deleteAgentRelationsByAgent = (db) => async (params) => {
126
126
  return (await db.delete(subAgentRelations).where(agentScopedWhere(subAgentRelations, params.scopes)).returning()).length > 0;
127
127
  };
128
128
  const createAgentToolRelation = (db) => async (params) => {
129
- const finalRelationId = params.relationId ?? generateId();
129
+ const finalRelationId = params.relationId ?? deriveRelationId(params.scopes.tenantId, params.scopes.projectId, params.scopes.agentId, params.data.subAgentId, params.data.toolId);
130
130
  return (await db.insert(subAgentToolRelations).values({
131
131
  id: finalRelationId,
132
132
  ...params.scopes,
@@ -10,13 +10,13 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
10
10
  relationId: string;
11
11
  }) => Promise<{
12
12
  id: string;
13
- tenantId: string;
14
- projectId: string;
15
- agentId: string;
16
13
  createdAt: string;
17
14
  updatedAt: string;
18
- headers: Record<string, string> | null;
15
+ agentId: string;
16
+ projectId: string;
17
+ tenantId: string;
19
18
  subAgentId: string;
19
+ headers: Record<string, string> | null;
20
20
  targetAgentId: string;
21
21
  } | undefined>;
22
22
  declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
@@ -45,26 +45,26 @@ declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =>
45
45
  scopes: SubAgentScopeConfig;
46
46
  }) => Promise<{
47
47
  id: string;
48
- tenantId: string;
49
- projectId: string;
50
- agentId: string;
51
48
  createdAt: string;
52
49
  updatedAt: string;
53
- headers: Record<string, string> | null;
50
+ agentId: string;
51
+ projectId: string;
52
+ tenantId: string;
54
53
  subAgentId: string;
54
+ headers: Record<string, string> | null;
55
55
  targetAgentId: string;
56
56
  }[]>;
57
57
  declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
58
58
  scopes: AgentScopeConfig;
59
59
  }) => Promise<{
60
60
  id: string;
61
- tenantId: string;
62
- projectId: string;
63
- agentId: string;
64
61
  createdAt: string;
65
62
  updatedAt: string;
66
- headers: Record<string, string> | null;
63
+ agentId: string;
64
+ projectId: string;
65
+ tenantId: string;
67
66
  subAgentId: string;
67
+ headers: Record<string, string> | null;
68
68
  targetAgentId: string;
69
69
  }[]>;
70
70
  declare const getSubAgentTeamAgentRelationsByTeamAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -113,15 +113,15 @@ declare const getTeamAgentsForSubAgent: (db: AgentsManageDatabaseClient) => (par
113
113
  models: {
114
114
  base?: {
115
115
  model?: string | undefined;
116
- providerOptions?: Record<string, any> | undefined;
116
+ providerOptions?: Record<string, unknown> | undefined;
117
117
  } | undefined;
118
118
  structuredOutput?: {
119
119
  model?: string | undefined;
120
- providerOptions?: Record<string, any> | undefined;
120
+ providerOptions?: Record<string, unknown> | undefined;
121
121
  } | undefined;
122
122
  summarizer?: {
123
123
  model?: string | undefined;
124
- providerOptions?: Record<string, any> | undefined;
124
+ providerOptions?: Record<string, unknown> | undefined;
125
125
  } | undefined;
126
126
  } | null;
127
127
  statusUpdates: {
@@ -177,15 +177,15 @@ declare const getSubAgentsForTeamAgent: (db: AgentsManageDatabaseClient) => (par
177
177
  models: {
178
178
  base?: {
179
179
  model?: string | undefined;
180
- providerOptions?: Record<string, any> | undefined;
180
+ providerOptions?: Record<string, unknown> | undefined;
181
181
  } | undefined;
182
182
  structuredOutput?: {
183
183
  model?: string | undefined;
184
- providerOptions?: Record<string, any> | undefined;
184
+ providerOptions?: Record<string, unknown> | undefined;
185
185
  } | undefined;
186
186
  summarizer?: {
187
187
  model?: string | undefined;
188
- providerOptions?: Record<string, any> | undefined;
188
+ providerOptions?: Record<string, unknown> | undefined;
189
189
  } | undefined;
190
190
  } | null;
191
191
  stopWhen: {
@@ -211,13 +211,13 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
211
211
  };
212
212
  }) => Promise<{
213
213
  id: string;
214
- tenantId: string;
215
- projectId: string;
216
- agentId: string;
217
214
  createdAt: string;
218
215
  updatedAt: string;
219
- headers: Record<string, string> | null;
216
+ agentId: string;
217
+ projectId: string;
218
+ tenantId: string;
220
219
  subAgentId: string;
220
+ headers: Record<string, string> | null;
221
221
  targetAgentId: string;
222
222
  }>;
223
223
  /**
@@ -228,13 +228,13 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
228
228
  targetAgentId: string;
229
229
  }) => Promise<{
230
230
  id: string;
231
- tenantId: string;
232
- projectId: string;
233
- agentId: string;
234
231
  createdAt: string;
235
232
  updatedAt: string;
236
- headers: Record<string, string> | null;
233
+ agentId: string;
234
+ projectId: string;
235
+ tenantId: string;
237
236
  subAgentId: string;
237
+ headers: Record<string, string> | null;
238
238
  targetAgentId: string;
239
239
  } | undefined>;
240
240
  /**
@@ -249,13 +249,13 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
249
249
  };
250
250
  }) => Promise<{
251
251
  id: string;
252
- tenantId: string;
253
- projectId: string;
254
- agentId: string;
255
252
  createdAt: string;
256
253
  updatedAt: string;
257
- headers: Record<string, string> | null;
254
+ agentId: string;
255
+ projectId: string;
256
+ tenantId: string;
258
257
  subAgentId: string;
258
+ headers: Record<string, string> | null;
259
259
  targetAgentId: string;
260
260
  }>;
261
261
  declare const updateSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient) => (params: {
@@ -1,7 +1,7 @@
1
1
  import { agents, subAgentTeamAgentRelations, subAgents } from "../../db/manage/manage-schema.js";
2
+ import { deriveRelationId } from "../../utils/conversations.js";
2
3
  import { agentScopedWhere, subAgentScopedWhere } from "./scope-helpers.js";
3
4
  import { and, count, desc, eq } from "drizzle-orm";
4
- import { nanoid } from "nanoid";
5
5
 
6
6
  //#region src/data-access/manage/subAgentTeamAgentRelations.ts
7
7
  const getSubAgentTeamAgentRelationById = (db) => async (params) => {
@@ -125,7 +125,7 @@ const getSubAgentsForTeamAgent = (db) => async (params) => {
125
125
  };
126
126
  };
127
127
  const createSubAgentTeamAgentRelation = (db) => async (params) => {
128
- const finalRelationId = params.relationId ?? nanoid();
128
+ const finalRelationId = params.relationId ?? deriveRelationId(params.scopes.tenantId, params.scopes.projectId, params.scopes.agentId, params.scopes.subAgentId, params.data.targetAgentId);
129
129
  return (await db.insert(subAgentTeamAgentRelations).values({
130
130
  id: finalRelationId,
131
131
  ...params.scopes,
@@ -11,62 +11,62 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
11
11
  }) => Promise<{
12
12
  id: string;
13
13
  name: string;
14
+ createdAt: string;
15
+ updatedAt: string;
14
16
  description: string | null;
15
- tenantId: string;
16
- projectId: string;
17
17
  agentId: string;
18
- prompt: string | null;
19
- conversationHistoryConfig: ConversationHistoryConfig | null;
18
+ projectId: string;
19
+ tenantId: string;
20
20
  models: {
21
21
  base?: {
22
22
  model?: string | undefined;
23
- providerOptions?: Record<string, any> | undefined;
23
+ providerOptions?: Record<string, unknown> | undefined;
24
24
  } | undefined;
25
25
  structuredOutput?: {
26
26
  model?: string | undefined;
27
- providerOptions?: Record<string, any> | undefined;
27
+ providerOptions?: Record<string, unknown> | undefined;
28
28
  } | undefined;
29
29
  summarizer?: {
30
30
  model?: string | undefined;
31
- providerOptions?: Record<string, any> | undefined;
31
+ providerOptions?: Record<string, unknown> | undefined;
32
32
  } | undefined;
33
33
  } | null;
34
+ prompt: string | null;
34
35
  stopWhen: {
35
36
  stepCountIs?: number | undefined;
36
37
  } | null;
37
- createdAt: string;
38
- updatedAt: string;
38
+ conversationHistoryConfig: ConversationHistoryConfig | null;
39
39
  } | undefined>;
40
40
  declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
41
41
  scopes: AgentScopeConfig;
42
42
  }) => Promise<{
43
43
  id: string;
44
44
  name: string;
45
+ createdAt: string;
46
+ updatedAt: string;
45
47
  description: string | null;
46
- tenantId: string;
47
- projectId: string;
48
48
  agentId: string;
49
- prompt: string | null;
50
- conversationHistoryConfig: ConversationHistoryConfig | null;
49
+ projectId: string;
50
+ tenantId: string;
51
51
  models: {
52
52
  base?: {
53
53
  model?: string | undefined;
54
- providerOptions?: Record<string, any> | undefined;
54
+ providerOptions?: Record<string, unknown> | undefined;
55
55
  } | undefined;
56
56
  structuredOutput?: {
57
57
  model?: string | undefined;
58
- providerOptions?: Record<string, any> | undefined;
58
+ providerOptions?: Record<string, unknown> | undefined;
59
59
  } | undefined;
60
60
  summarizer?: {
61
61
  model?: string | undefined;
62
- providerOptions?: Record<string, any> | undefined;
62
+ providerOptions?: Record<string, unknown> | undefined;
63
63
  } | undefined;
64
64
  } | null;
65
+ prompt: string | null;
65
66
  stopWhen: {
66
67
  stepCountIs?: number | undefined;
67
68
  } | null;
68
- createdAt: string;
69
- updatedAt: string;
69
+ conversationHistoryConfig: ConversationHistoryConfig | null;
70
70
  }[]>;
71
71
  declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
72
72
  scopes: AgentScopeConfig;
@@ -80,15 +80,15 @@ declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (param
80
80
  models: {
81
81
  base?: {
82
82
  model?: string | undefined;
83
- providerOptions?: Record<string, any> | undefined;
83
+ providerOptions?: Record<string, unknown> | undefined;
84
84
  } | undefined;
85
85
  structuredOutput?: {
86
86
  model?: string | undefined;
87
- providerOptions?: Record<string, any> | undefined;
87
+ providerOptions?: Record<string, unknown> | undefined;
88
88
  } | undefined;
89
89
  summarizer?: {
90
90
  model?: string | undefined;
91
- providerOptions?: Record<string, any> | undefined;
91
+ providerOptions?: Record<string, unknown> | undefined;
92
92
  } | undefined;
93
93
  } | null;
94
94
  stopWhen: {
@@ -111,31 +111,31 @@ declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (param
111
111
  declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAgentInsert) => Promise<{
112
112
  id: string;
113
113
  name: string;
114
+ createdAt: string;
115
+ updatedAt: string;
114
116
  description: string | null;
115
- tenantId: string;
116
- projectId: string;
117
117
  agentId: string;
118
- prompt: string | null;
119
- conversationHistoryConfig: ConversationHistoryConfig | null;
118
+ projectId: string;
119
+ tenantId: string;
120
120
  models: {
121
121
  base?: {
122
122
  model?: string | undefined;
123
- providerOptions?: Record<string, any> | undefined;
123
+ providerOptions?: Record<string, unknown> | undefined;
124
124
  } | undefined;
125
125
  structuredOutput?: {
126
126
  model?: string | undefined;
127
- providerOptions?: Record<string, any> | undefined;
127
+ providerOptions?: Record<string, unknown> | undefined;
128
128
  } | undefined;
129
129
  summarizer?: {
130
130
  model?: string | undefined;
131
- providerOptions?: Record<string, any> | undefined;
131
+ providerOptions?: Record<string, unknown> | undefined;
132
132
  } | undefined;
133
133
  } | null;
134
+ prompt: string | null;
134
135
  stopWhen: {
135
136
  stepCountIs?: number | undefined;
136
137
  } | null;
137
- createdAt: string;
138
- updatedAt: string;
138
+ conversationHistoryConfig: ConversationHistoryConfig | null;
139
139
  }>;
140
140
  declare const updateSubAgent: (db: AgentsManageDatabaseClient) => (params: {
141
141
  scopes: AgentScopeConfig;
@@ -149,15 +149,15 @@ declare const updateSubAgent: (db: AgentsManageDatabaseClient) => (params: {
149
149
  models: {
150
150
  base?: {
151
151
  model?: string | undefined;
152
- providerOptions?: Record<string, any> | undefined;
152
+ providerOptions?: Record<string, unknown> | undefined;
153
153
  } | undefined;
154
154
  structuredOutput?: {
155
155
  model?: string | undefined;
156
- providerOptions?: Record<string, any> | undefined;
156
+ providerOptions?: Record<string, unknown> | undefined;
157
157
  } | undefined;
158
158
  summarizer?: {
159
159
  model?: string | undefined;
160
- providerOptions?: Record<string, any> | undefined;
160
+ providerOptions?: Record<string, unknown> | undefined;
161
161
  } | undefined;
162
162
  } | null;
163
163
  stopWhen: {
@@ -196,15 +196,15 @@ declare const getSubAgentsByIds: (db: AgentsManageDatabaseClient) => (params: {
196
196
  models: {
197
197
  base?: {
198
198
  model?: string | undefined;
199
- providerOptions?: Record<string, any> | undefined;
199
+ providerOptions?: Record<string, unknown> | undefined;
200
200
  } | undefined;
201
201
  structuredOutput?: {
202
202
  model?: string | undefined;
203
- providerOptions?: Record<string, any> | undefined;
203
+ providerOptions?: Record<string, unknown> | undefined;
204
204
  } | undefined;
205
205
  summarizer?: {
206
206
  model?: string | undefined;
207
- providerOptions?: Record<string, any> | undefined;
207
+ providerOptions?: Record<string, unknown> | undefined;
208
208
  } | undefined;
209
209
  } | null;
210
210
  stopWhen: {