@inkeep/agents-core 0.59.3 → 0.60.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 (84) 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/auth/auth.js +2 -2
  4. package/dist/auth/permissions.d.ts +9 -9
  5. package/dist/client-exports.d.ts +2 -2
  6. package/dist/client-exports.js +2 -2
  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/manage/agentFull.js +5 -5
  11. package/dist/data-access/manage/agents.d.ts +31 -31
  12. package/dist/data-access/manage/artifactComponents.d.ts +14 -14
  13. package/dist/data-access/manage/contextConfigs.d.ts +8 -8
  14. package/dist/data-access/manage/credentialReferences.js +1 -1
  15. package/dist/data-access/manage/dataComponents.d.ts +6 -6
  16. package/dist/data-access/manage/dataComponents.js +1 -1
  17. package/dist/data-access/manage/functionTools.d.ts +14 -14
  18. package/dist/data-access/manage/functionTools.js +2 -2
  19. package/dist/data-access/manage/skills.d.ts +13 -13
  20. package/dist/data-access/manage/skills.js +2 -3
  21. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +18 -18
  22. package/dist/data-access/manage/subAgentExternalAgentRelations.js +2 -2
  23. package/dist/data-access/manage/subAgentRelations.d.ts +20 -20
  24. package/dist/data-access/manage/subAgentRelations.js +2 -2
  25. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +18 -18
  26. package/dist/data-access/manage/subAgentTeamAgentRelations.js +2 -2
  27. package/dist/data-access/manage/subAgents.d.ts +21 -21
  28. package/dist/data-access/manage/tools.d.ts +18 -18
  29. package/dist/data-access/manage/tools.js +2 -2
  30. package/dist/data-access/manage/triggers.d.ts +2 -2
  31. package/dist/data-access/runtime/apiKeys.d.ts +16 -16
  32. package/dist/data-access/runtime/apps.d.ts +13 -10
  33. package/dist/data-access/runtime/conversations.d.ts +18 -18
  34. package/dist/data-access/runtime/conversations.js +17 -1
  35. package/dist/data-access/runtime/messages.d.ts +18 -18
  36. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
  37. package/dist/data-access/runtime/tasks.d.ts +4 -4
  38. package/dist/db/manage/manage-schema.d.ts +453 -453
  39. package/dist/db/runtime/runtime-schema.d.ts +353 -334
  40. package/dist/db/runtime/runtime-schema.js +4 -1
  41. package/dist/db/runtime/test-runtime-client.js +1 -1
  42. package/dist/dolt/advisory-lock.d.ts +7 -0
  43. package/dist/dolt/advisory-lock.js +18 -0
  44. package/dist/dolt/branches-api.d.ts +19 -9
  45. package/dist/dolt/branches-api.js +58 -29
  46. package/dist/dolt/fk-map.d.ts +5 -0
  47. package/dist/dolt/fk-map.js +34 -0
  48. package/dist/dolt/index.d.ts +8 -4
  49. package/dist/dolt/index.js +8 -4
  50. package/dist/dolt/merge.d.ts +41 -5
  51. package/dist/dolt/merge.js +161 -24
  52. package/dist/dolt/pk-map.d.ts +6 -0
  53. package/dist/dolt/pk-map.js +27 -0
  54. package/dist/dolt/ref-middleware.d.ts +2 -1
  55. package/dist/dolt/ref-middleware.js +18 -4
  56. package/dist/dolt/resolve-conflicts.d.ts +20 -0
  57. package/dist/dolt/resolve-conflicts.js +158 -0
  58. package/dist/dolt/schema-sync.js +17 -17
  59. package/dist/index.d.ts +14 -8
  60. package/dist/index.js +14 -8
  61. package/dist/types/utility.d.ts +2 -0
  62. package/dist/utils/apiKeys.js +1 -1
  63. package/dist/utils/conversations.d.ts +7 -1
  64. package/dist/utils/conversations.js +10 -1
  65. package/dist/utils/error.d.ts +51 -51
  66. package/dist/utils/index.d.ts +6 -2
  67. package/dist/utils/index.js +5 -3
  68. package/dist/utils/model-factory.js +35 -10
  69. package/dist/utils/token-estimator.d.ts +19 -0
  70. package/dist/utils/token-estimator.js +17 -0
  71. package/dist/utils/usage-cost-middleware.d.ts +13 -0
  72. package/dist/utils/usage-cost-middleware.js +60 -0
  73. package/dist/utils/usage-tracker.d.ts +2 -0
  74. package/dist/utils/usage-tracker.js +1 -0
  75. package/dist/validation/dolt-schemas.d.ts +95 -2
  76. package/dist/validation/dolt-schemas.js +54 -2
  77. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  78. package/dist/validation/index.d.ts +2 -2
  79. package/dist/validation/index.js +2 -2
  80. package/dist/validation/schemas.d.ts +2161 -2085
  81. package/drizzle/runtime/0025_faulty_kylun.sql +1 -0
  82. package/drizzle/runtime/meta/0025_snapshot.json +4276 -0
  83. package/drizzle/runtime/meta/_journal.json +7 -0
  84. package/package.json +2 -2
@@ -9,14 +9,14 @@ declare const getSubAgentTeamAgentRelationById: (db: AgentsManageDatabaseClient)
9
9
  scopes: SubAgentScopeConfig;
10
10
  relationId: string;
11
11
  }) => Promise<{
12
- id: string;
13
12
  tenantId: string;
14
13
  projectId: string;
15
- agentId: string;
14
+ subAgentId: string;
15
+ id: string;
16
16
  createdAt: string;
17
17
  updatedAt: string;
18
+ agentId: string;
18
19
  headers: Record<string, string> | null;
19
- subAgentId: string;
20
20
  targetAgentId: string;
21
21
  } | undefined>;
22
22
  declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
@@ -44,27 +44,27 @@ declare const listSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) =
44
44
  declare const getSubAgentTeamAgentRelations: (db: AgentsManageDatabaseClient) => (params: {
45
45
  scopes: SubAgentScopeConfig;
46
46
  }) => Promise<{
47
- id: string;
48
47
  tenantId: string;
49
48
  projectId: string;
50
- agentId: string;
49
+ subAgentId: string;
50
+ id: string;
51
51
  createdAt: string;
52
52
  updatedAt: string;
53
+ agentId: string;
53
54
  headers: Record<string, string> | null;
54
- subAgentId: string;
55
55
  targetAgentId: string;
56
56
  }[]>;
57
57
  declare const getSubAgentTeamAgentRelationsByAgent: (db: AgentsManageDatabaseClient) => (params: {
58
58
  scopes: AgentScopeConfig;
59
59
  }) => Promise<{
60
- id: string;
61
60
  tenantId: string;
62
61
  projectId: string;
63
- agentId: string;
62
+ subAgentId: string;
63
+ id: string;
64
64
  createdAt: string;
65
65
  updatedAt: string;
66
+ agentId: string;
66
67
  headers: Record<string, string> | null;
67
- subAgentId: string;
68
68
  targetAgentId: string;
69
69
  }[]>;
70
70
  declare const getSubAgentTeamAgentRelationsByTeamAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -210,14 +210,14 @@ declare const createSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
210
210
  headers?: Record<string, string> | null;
211
211
  };
212
212
  }) => Promise<{
213
- id: string;
214
213
  tenantId: string;
215
214
  projectId: string;
216
- agentId: string;
215
+ subAgentId: string;
216
+ id: string;
217
217
  createdAt: string;
218
218
  updatedAt: string;
219
+ agentId: string;
219
220
  headers: Record<string, string> | null;
220
- subAgentId: string;
221
221
  targetAgentId: string;
222
222
  }>;
223
223
  /**
@@ -227,14 +227,14 @@ declare const getSubAgentTeamAgentRelationByParams: (db: AgentsManageDatabaseCli
227
227
  scopes: SubAgentScopeConfig;
228
228
  targetAgentId: string;
229
229
  }) => Promise<{
230
- id: string;
231
230
  tenantId: string;
232
231
  projectId: string;
233
- agentId: string;
232
+ subAgentId: string;
233
+ id: string;
234
234
  createdAt: string;
235
235
  updatedAt: string;
236
+ agentId: string;
236
237
  headers: Record<string, string> | null;
237
- subAgentId: string;
238
238
  targetAgentId: string;
239
239
  } | undefined>;
240
240
  /**
@@ -248,14 +248,14 @@ declare const upsertSubAgentTeamAgentRelation: (db: AgentsManageDatabaseClient)
248
248
  headers?: Record<string, string> | null;
249
249
  };
250
250
  }) => Promise<{
251
- id: string;
252
251
  tenantId: string;
253
252
  projectId: string;
254
- agentId: string;
253
+ subAgentId: string;
254
+ id: string;
255
255
  createdAt: string;
256
256
  updatedAt: string;
257
+ agentId: string;
257
258
  headers: Record<string, string> | null;
258
- subAgentId: string;
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,
@@ -9,14 +9,13 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
9
9
  scopes: AgentScopeConfig;
10
10
  subAgentId: string;
11
11
  }) => Promise<{
12
- id: string;
13
- name: string;
14
12
  description: string | null;
13
+ name: string;
15
14
  tenantId: string;
16
15
  projectId: string;
17
- agentId: string;
18
- prompt: string | null;
19
- conversationHistoryConfig: ConversationHistoryConfig | null;
16
+ id: string;
17
+ createdAt: string;
18
+ updatedAt: string;
20
19
  models: {
21
20
  base?: {
22
21
  model?: string | undefined;
@@ -34,20 +33,20 @@ declare const getSubAgentById: (db: AgentsManageDatabaseClient) => (params: {
34
33
  stopWhen: {
35
34
  stepCountIs?: number | undefined;
36
35
  } | null;
37
- createdAt: string;
38
- updatedAt: string;
36
+ prompt: string | null;
37
+ conversationHistoryConfig: ConversationHistoryConfig | null;
38
+ agentId: string;
39
39
  } | undefined>;
40
40
  declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
41
41
  scopes: AgentScopeConfig;
42
42
  }) => Promise<{
43
- id: string;
44
- name: string;
45
43
  description: string | null;
44
+ name: string;
46
45
  tenantId: string;
47
46
  projectId: string;
48
- agentId: string;
49
- prompt: string | null;
50
- conversationHistoryConfig: ConversationHistoryConfig | null;
47
+ id: string;
48
+ createdAt: string;
49
+ updatedAt: string;
51
50
  models: {
52
51
  base?: {
53
52
  model?: string | undefined;
@@ -65,8 +64,9 @@ declare const listSubAgents: (db: AgentsManageDatabaseClient) => (params: {
65
64
  stopWhen: {
66
65
  stepCountIs?: number | undefined;
67
66
  } | null;
68
- createdAt: string;
69
- updatedAt: string;
67
+ prompt: string | null;
68
+ conversationHistoryConfig: ConversationHistoryConfig | null;
69
+ agentId: string;
70
70
  }[]>;
71
71
  declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
72
72
  scopes: AgentScopeConfig;
@@ -109,14 +109,13 @@ declare const listSubAgentsPaginated: (db: AgentsManageDatabaseClient) => (param
109
109
  };
110
110
  }>;
111
111
  declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAgentInsert) => Promise<{
112
- id: string;
113
- name: string;
114
112
  description: string | null;
113
+ name: string;
115
114
  tenantId: string;
116
115
  projectId: string;
117
- agentId: string;
118
- prompt: string | null;
119
- conversationHistoryConfig: ConversationHistoryConfig | null;
116
+ id: string;
117
+ createdAt: string;
118
+ updatedAt: string;
120
119
  models: {
121
120
  base?: {
122
121
  model?: string | undefined;
@@ -134,8 +133,9 @@ declare const createSubAgent: (db: AgentsManageDatabaseClient) => (params: SubAg
134
133
  stopWhen: {
135
134
  stepCountIs?: number | undefined;
136
135
  } | null;
137
- createdAt: string;
138
- updatedAt: string;
136
+ prompt: string | null;
137
+ conversationHistoryConfig: ConversationHistoryConfig | null;
138
+ agentId: string;
139
139
  }>;
140
140
  declare const updateSubAgent: (db: AgentsManageDatabaseClient) => (params: {
141
141
  scopes: AgentScopeConfig;
@@ -20,11 +20,11 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
20
20
  scopes: ProjectScopeConfig;
21
21
  toolId: string;
22
22
  }) => Promise<{
23
- id: string;
24
- name: string;
25
23
  description: string | null;
24
+ name: string;
26
25
  tenantId: string;
27
26
  projectId: string;
27
+ id: string;
28
28
  createdAt: string;
29
29
  updatedAt: string;
30
30
  headers: Record<string, string> | null;
@@ -78,11 +78,11 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
78
78
  };
79
79
  }>;
80
80
  declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
81
- id: string;
82
- name: string;
83
81
  description: string | null;
82
+ name: string;
84
83
  tenantId: string;
85
84
  projectId: string;
85
+ id: string;
86
86
  createdAt: string;
87
87
  updatedAt: string;
88
88
  headers: Record<string, string> | null;
@@ -135,18 +135,18 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
135
135
  needsApproval?: boolean;
136
136
  }> | null;
137
137
  }) => Promise<{
138
- id: string;
139
138
  tenantId: string;
140
139
  projectId: string;
141
- agentId: string;
140
+ subAgentId: string;
141
+ id: string;
142
142
  createdAt: string;
143
143
  updatedAt: string;
144
- toolId: string;
144
+ agentId: string;
145
145
  headers: Record<string, string> | null;
146
+ toolId: string;
146
147
  toolPolicies: Record<string, {
147
148
  needsApproval?: boolean;
148
149
  }> | null;
149
- subAgentId: string;
150
150
  selectedTools: string[] | null;
151
151
  }>;
152
152
  declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -154,18 +154,18 @@ declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params:
154
154
  subAgentId: string;
155
155
  toolId: string;
156
156
  }) => Promise<{
157
- id: string;
158
157
  tenantId: string;
159
158
  projectId: string;
160
- agentId: string;
159
+ subAgentId: string;
160
+ id: string;
161
161
  createdAt: string;
162
162
  updatedAt: string;
163
- toolId: string;
163
+ agentId: string;
164
164
  headers: Record<string, string> | null;
165
+ toolId: string;
165
166
  toolPolicies: Record<string, {
166
167
  needsApproval?: boolean;
167
168
  }> | null;
168
- subAgentId: string;
169
169
  selectedTools: string[] | null;
170
170
  }>;
171
171
  /**
@@ -182,18 +182,18 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
182
182
  }> | null;
183
183
  relationId?: string;
184
184
  }) => Promise<{
185
- id: string;
186
185
  tenantId: string;
187
186
  projectId: string;
188
- agentId: string;
187
+ subAgentId: string;
188
+ id: string;
189
189
  createdAt: string;
190
190
  updatedAt: string;
191
- toolId: string;
191
+ agentId: string;
192
192
  headers: Record<string, string> | null;
193
+ toolId: string;
193
194
  toolPolicies: Record<string, {
194
195
  needsApproval?: boolean;
195
196
  }> | null;
196
- subAgentId: string;
197
197
  selectedTools: string[] | null;
198
198
  }>;
199
199
  /**
@@ -202,11 +202,11 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
202
202
  declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
203
203
  data: ToolInsert;
204
204
  }) => Promise<{
205
- id: string;
206
- name: string;
207
205
  description: string | null;
206
+ name: string;
208
207
  tenantId: string;
209
208
  projectId: string;
209
+ id: string;
210
210
  createdAt: string;
211
211
  updatedAt: string;
212
212
  headers: Record<string, string> | null;
@@ -9,7 +9,7 @@ import { getCredentialStoreLookupKeyFromRetrievalParams } from "../../utils/cred
9
9
  import { CredentialStuffer } from "../../credential-stuffer/CredentialStuffer.js";
10
10
  import "../../credential-stuffer/index.js";
11
11
  import { createAgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
12
- import { generateId } from "../../utils/conversations.js";
12
+ import { deriveRelationId } from "../../utils/conversations.js";
13
13
  import { getActiveBranch } from "../../dolt/schema-sync.js";
14
14
  import { agentScopedWhere, projectScopedWhere } from "./scope-helpers.js";
15
15
  import { isSlackWorkAppTool } from "../runtime/slack-work-app-mcp.js";
@@ -371,7 +371,7 @@ const deleteTool = (db) => async (params) => {
371
371
  return true;
372
372
  };
373
373
  const addToolToAgent = (db) => async (params) => {
374
- const id = generateId();
374
+ const id = deriveRelationId(params.scopes.tenantId, params.scopes.projectId, params.scopes.agentId, params.subAgentId, params.toolId);
375
375
  const now = (/* @__PURE__ */ new Date()).toISOString();
376
376
  const [created] = await db.insert(subAgentToolRelations).values({
377
377
  id,
@@ -40,13 +40,13 @@ declare const listTriggersPaginated: (db: AgentsManageDatabaseClient) => (params
40
40
  algorithm: "sha256" | "sha512" | "sha384" | "sha1" | "md5";
41
41
  encoding: "hex" | "base64";
42
42
  signature: {
43
- source: "query" | "body" | "header";
43
+ source: "query" | "header" | "body";
44
44
  key: string;
45
45
  prefix?: string | undefined;
46
46
  regex?: string | undefined;
47
47
  };
48
48
  signedComponents: {
49
- source: "literal" | "body" | "header";
49
+ source: "literal" | "header" | "body";
50
50
  required: boolean;
51
51
  key?: string | undefined;
52
52
  value?: string | undefined;
@@ -8,49 +8,49 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
8
8
  scopes: ProjectScopeConfig;
9
9
  id: string;
10
10
  }) => Promise<{
11
- id: string;
12
11
  name: string | null;
13
12
  tenantId: string;
14
13
  projectId: string;
15
- agentId: string;
14
+ id: string;
16
15
  createdAt: string;
17
16
  updatedAt: string;
18
- expiresAt: string | null;
19
- lastUsedAt: string | null;
17
+ agentId: string;
20
18
  publicId: string;
21
19
  keyHash: string;
22
20
  keyPrefix: string;
21
+ lastUsedAt: string | null;
22
+ expiresAt: string | null;
23
23
  } | undefined>;
24
24
  declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
25
- id: string;
26
25
  name: string | null;
27
26
  tenantId: string;
28
27
  projectId: string;
29
- agentId: string;
28
+ id: string;
30
29
  createdAt: string;
31
30
  updatedAt: string;
32
- expiresAt: string | null;
33
- lastUsedAt: string | null;
31
+ agentId: string;
34
32
  publicId: string;
35
33
  keyHash: string;
36
34
  keyPrefix: string;
35
+ lastUsedAt: string | null;
36
+ expiresAt: string | null;
37
37
  } | undefined>;
38
38
  declare const listApiKeys: (db: AgentsRunDatabaseClient) => (params: {
39
39
  scopes: ProjectScopeConfig;
40
40
  agentId?: string;
41
41
  }) => Promise<{
42
- id: string;
43
42
  name: string | null;
44
43
  tenantId: string;
45
44
  projectId: string;
46
- agentId: string;
45
+ id: string;
47
46
  createdAt: string;
48
47
  updatedAt: string;
49
- expiresAt: string | null;
50
- lastUsedAt: string | null;
48
+ agentId: string;
51
49
  publicId: string;
52
50
  keyHash: string;
53
51
  keyPrefix: string;
52
+ lastUsedAt: string | null;
53
+ expiresAt: string | null;
54
54
  }[]>;
55
55
  declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
56
56
  scopes: ProjectScopeConfig;
@@ -66,18 +66,18 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
66
66
  };
67
67
  }>;
68
68
  declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
69
- id: string;
70
69
  name: string | null;
71
70
  tenantId: string;
72
71
  projectId: string;
73
- agentId: string;
72
+ id: string;
74
73
  createdAt: string;
75
74
  updatedAt: string;
76
- expiresAt: string | null;
77
- lastUsedAt: string | null;
75
+ agentId: string;
78
76
  publicId: string;
79
77
  keyHash: string;
80
78
  keyPrefix: string;
79
+ lastUsedAt: string | null;
80
+ expiresAt: string | null;
81
81
  }>;
82
82
  declare const updateApiKey: (db: AgentsRunDatabaseClient) => (params: {
83
83
  scopes: ProjectScopeConfig;
@@ -5,14 +5,15 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
5
5
 
6
6
  //#region src/data-access/runtime/apps.d.ts
7
7
  declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
8
- id: string;
9
- name: string;
8
+ type: AppType;
10
9
  description: string | null;
10
+ name: string;
11
11
  tenantId: string | null;
12
12
  projectId: string | null;
13
- type: AppType;
13
+ id: string;
14
14
  createdAt: string;
15
15
  updatedAt: string;
16
+ prompt: string | null;
16
17
  enabled: boolean;
17
18
  config: {
18
19
  type: "web_client";
@@ -23,9 +24,9 @@ declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promi
23
24
  type: "api";
24
25
  api: Record<string, never>;
25
26
  };
26
- defaultAgentId: string | null;
27
- defaultProjectId: string | null;
28
27
  lastUsedAt: string | null;
28
+ defaultProjectId: string | null;
29
+ defaultAgentId: string | null;
29
30
  } | undefined>;
30
31
  declare const updateAppLastUsed: (db: AgentsRunDatabaseClient) => (id: string) => Promise<void>;
31
32
  declare const getAppByIdForTenant: (db: AgentsRunDatabaseClient) => (params: {
@@ -52,14 +53,15 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
52
53
  };
53
54
  }>;
54
55
  declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
55
- id: string;
56
- name: string;
56
+ type: AppType;
57
57
  description: string | null;
58
+ name: string;
58
59
  tenantId: string | null;
59
60
  projectId: string | null;
60
- type: AppType;
61
+ id: string;
61
62
  createdAt: string;
62
63
  updatedAt: string;
64
+ prompt: string | null;
63
65
  enabled: boolean;
64
66
  config: {
65
67
  type: "web_client";
@@ -70,9 +72,9 @@ declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) =>
70
72
  type: "api";
71
73
  api: Record<string, never>;
72
74
  };
73
- defaultAgentId: string | null;
74
- defaultProjectId: string | null;
75
75
  lastUsedAt: string | null;
76
+ defaultProjectId: string | null;
77
+ defaultAgentId: string | null;
76
78
  }>;
77
79
  declare const updateAppForTenant: (db: AgentsRunDatabaseClient) => (params: {
78
80
  scopes: TenantScopeConfig;
@@ -109,6 +111,7 @@ declare const updateApp: (db: AgentsRunDatabaseClient) => (params: {
109
111
  type: AppType;
110
112
  defaultProjectId: string | null;
111
113
  defaultAgentId: string | null;
114
+ prompt: string | null;
112
115
  enabled: boolean;
113
116
  config: {
114
117
  type: "web_client";
@@ -4,7 +4,7 @@ import { ConversationHistoryConfig, ConversationMetadata, PaginationConfig } fro
4
4
  import "../../types/index.js";
5
5
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
6
6
  import "../../index.js";
7
- import { ConversationInsert, ConversationSelect, ConversationUpdate } from "../../types/entities.js";
7
+ import { ConversationInsert, ConversationSelect, ConversationUpdate, MessageSelect } from "../../types/entities.js";
8
8
 
9
9
  //#region src/data-access/runtime/conversations.d.ts
10
10
  declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
@@ -16,20 +16,20 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
16
16
  total: number;
17
17
  }>;
18
18
  declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
19
- id: string;
19
+ title: string | null;
20
20
  tenantId: string;
21
21
  projectId: string;
22
- agentId: string | null;
23
- title: string | null;
22
+ id: string;
24
23
  createdAt: string;
25
24
  updatedAt: string;
26
25
  metadata: ConversationMetadata | null;
26
+ agentId: string | null;
27
+ userId: string | null;
27
28
  ref: {
28
29
  type: "commit" | "tag" | "branch";
29
30
  name: string;
30
31
  hash: string;
31
32
  } | null;
32
- userId: string | null;
33
33
  activeSubAgentId: string;
34
34
  lastContextResolution: string | null;
35
35
  }>;
@@ -85,20 +85,20 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
85
85
  scopes: ProjectScopeConfig;
86
86
  conversationId: string;
87
87
  }) => Promise<{
88
- id: string;
88
+ title: string | null;
89
89
  tenantId: string;
90
90
  projectId: string;
91
- agentId: string | null;
92
- title: string | null;
91
+ id: string;
93
92
  createdAt: string;
94
93
  updatedAt: string;
95
94
  metadata: ConversationMetadata | null;
95
+ agentId: string | null;
96
+ userId: string | null;
96
97
  ref: {
97
98
  type: "commit" | "tag" | "branch";
98
99
  name: string;
99
100
  hash: string;
100
101
  } | null;
101
- userId: string | null;
102
102
  activeSubAgentId: string;
103
103
  lastContextResolution: string | null;
104
104
  } | undefined>;
@@ -121,20 +121,20 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
121
121
  metadata?: ConversationMetadata | null | undefined;
122
122
  contextConfigId?: string | undefined;
123
123
  } | {
124
- id: string;
124
+ title: string | null;
125
125
  tenantId: string;
126
126
  projectId: string;
127
- agentId: string | null;
128
- title: string | null;
127
+ id: string;
129
128
  createdAt: string;
130
129
  updatedAt: string;
131
130
  metadata: ConversationMetadata | null;
131
+ agentId: string | null;
132
+ userId: string | null;
132
133
  ref: {
133
134
  type: "commit" | "tag" | "branch";
134
135
  name: string;
135
136
  hash: string;
136
137
  } | null;
137
- userId: string | null;
138
138
  activeSubAgentId: string;
139
139
  lastContextResolution: string | null;
140
140
  }>;
@@ -145,7 +145,7 @@ declare const getConversationHistory: (db: AgentsRunDatabaseClient) => (params:
145
145
  scopes: ProjectScopeConfig;
146
146
  conversationId: string;
147
147
  options?: ConversationHistoryConfig;
148
- }) => Promise<any[]>;
148
+ }) => Promise<MessageSelect[]>;
149
149
  /**
150
150
  * Get active agent for a conversation
151
151
  */
@@ -153,20 +153,20 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
153
153
  scopes: ProjectScopeConfig;
154
154
  conversationId: string;
155
155
  }) => Promise<{
156
- id: string;
156
+ title: string | null;
157
157
  tenantId: string;
158
158
  projectId: string;
159
- agentId: string | null;
160
- title: string | null;
159
+ id: string;
161
160
  createdAt: string;
162
161
  updatedAt: string;
163
162
  metadata: ConversationMetadata | null;
163
+ agentId: string | null;
164
+ userId: string | null;
164
165
  ref: {
165
166
  type: "commit" | "tag" | "branch";
166
167
  name: string;
167
168
  hash: string;
168
169
  } | null;
169
- userId: string | null;
170
170
  activeSubAgentId: string;
171
171
  lastContextResolution: string | null;
172
172
  } | undefined>;
@@ -113,13 +113,29 @@ function applyContextWindowManagement(messageHistory, maxTokens) {
113
113
  totalTokens += messageTokens;
114
114
  } else {
115
115
  if (i > 0) {
116
+ const referenceMessage = messageHistory[0];
116
117
  const summaryMessage = {
117
118
  id: `summary-${getConversationId()}`,
119
+ tenantId: referenceMessage.tenantId,
120
+ projectId: referenceMessage.projectId,
121
+ conversationId: referenceMessage.conversationId,
118
122
  role: "system",
123
+ fromSubAgentId: null,
124
+ toSubAgentId: null,
125
+ fromExternalAgentId: null,
126
+ toExternalAgentId: null,
127
+ fromTeamAgentId: null,
128
+ toTeamAgentId: null,
119
129
  content: { text: `[Previous conversation history truncated - ${i + 1} earlier messages]` },
120
130
  visibility: "system",
121
131
  messageType: "chat",
122
- createdAt: messageHistory[0].createdAt
132
+ taskId: null,
133
+ parentMessageId: null,
134
+ a2aTaskId: null,
135
+ a2aSessionId: null,
136
+ metadata: null,
137
+ createdAt: referenceMessage.createdAt,
138
+ updatedAt: referenceMessage.updatedAt
123
139
  };
124
140
  managedHistory.unshift(summaryMessage);
125
141
  }