@inkeep/agents-core 0.60.0 → 0.62.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 (70) hide show
  1. package/dist/auth/auth-schema.d.ts +86 -86
  2. package/dist/auth/auth-validation-schemas.d.ts +154 -154
  3. package/dist/auth/init.js +44 -0
  4. package/dist/auth/permissions.d.ts +9 -9
  5. package/dist/auth/wait-for-spicedb.d.ts +1 -0
  6. package/dist/auth/wait-for-spicedb.js +51 -0
  7. package/dist/client-exports.d.ts +3 -106
  8. package/dist/client-exports.js +2 -60
  9. package/dist/data-access/index.d.ts +4 -3
  10. package/dist/data-access/index.js +4 -3
  11. package/dist/data-access/manage/agentFull.js +10 -5
  12. package/dist/data-access/manage/agents.d.ts +47 -41
  13. package/dist/data-access/manage/agents.js +2 -0
  14. package/dist/data-access/manage/artifactComponents.d.ts +12 -12
  15. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  16. package/dist/data-access/manage/dataComponents.d.ts +4 -4
  17. package/dist/data-access/manage/functionTools.d.ts +14 -14
  18. package/dist/data-access/manage/projectFull.js +24 -3
  19. package/dist/data-access/manage/skills.d.ts +17 -17
  20. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +27 -27
  21. package/dist/data-access/manage/subAgentRelations.d.ts +25 -25
  22. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +30 -30
  23. package/dist/data-access/manage/subAgents.d.ts +30 -30
  24. package/dist/data-access/manage/tools.d.ts +27 -27
  25. package/dist/data-access/manage/triggers.d.ts +2 -2
  26. package/dist/data-access/runtime/apiKeys.d.ts +12 -12
  27. package/dist/data-access/runtime/apps.d.ts +54 -9
  28. package/dist/data-access/runtime/apps.js +15 -1
  29. package/dist/data-access/runtime/conversations.d.ts +25 -25
  30. package/dist/data-access/runtime/conversations.js +1 -0
  31. package/dist/data-access/runtime/ledgerArtifacts.d.ts +11 -2
  32. package/dist/data-access/runtime/ledgerArtifacts.js +12 -1
  33. package/dist/data-access/runtime/messages.d.ts +15 -15
  34. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +3 -3
  35. package/dist/data-access/runtime/tasks.d.ts +6 -6
  36. package/dist/data-access/runtime/workflowExecutions.d.ts +25 -0
  37. package/dist/data-access/runtime/workflowExecutions.js +32 -0
  38. package/dist/db/manage/manage-schema.d.ts +495 -475
  39. package/dist/db/manage/manage-schema.js +1 -0
  40. package/dist/db/runtime/runtime-schema.d.ts +550 -335
  41. package/dist/db/runtime/runtime-schema.js +16 -2
  42. package/dist/index.d.ts +11 -9
  43. package/dist/index.js +9 -7
  44. package/dist/types/entities.d.ts +5 -2
  45. package/dist/types/index.d.ts +3 -3
  46. package/dist/types/utility.d.ts +9 -3
  47. package/dist/utils/conversations.d.ts +4 -1
  48. package/dist/utils/conversations.js +10 -1
  49. package/dist/utils/error.d.ts +51 -51
  50. package/dist/utils/index.d.ts +4 -3
  51. package/dist/utils/index.js +4 -3
  52. package/dist/utils/jwt-helpers.d.ts +7 -1
  53. package/dist/utils/jwt-helpers.js +11 -1
  54. package/dist/utils/validate-public-key.d.ts +10 -0
  55. package/dist/utils/validate-public-key.js +89 -0
  56. package/dist/validation/agentFull.js +0 -1
  57. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  58. package/dist/validation/index.d.ts +2 -2
  59. package/dist/validation/index.js +2 -2
  60. package/dist/validation/schemas.d.ts +3468 -2708
  61. package/dist/validation/schemas.js +104 -36
  62. package/drizzle/manage/0013_gorgeous_umar.sql +1 -0
  63. package/drizzle/manage/meta/0013_snapshot.json +3704 -0
  64. package/drizzle/manage/meta/_journal.json +7 -0
  65. package/drizzle/runtime/0026_graceful_scorpion.sql +15 -0
  66. package/drizzle/runtime/0027_seed-playground-app.sql +13 -0
  67. package/drizzle/runtime/meta/{0025_snapshot.json → 0026_snapshot.json} +114 -1
  68. package/drizzle/runtime/meta/0027_snapshot.json +4389 -0
  69. package/drizzle/runtime/meta/_journal.json +14 -0
  70. package/package.json +1 -1
@@ -20,14 +20,14 @@ declare const getToolById: (db: AgentsManageDatabaseClient) => (params: {
20
20
  scopes: ProjectScopeConfig;
21
21
  toolId: string;
22
22
  }) => Promise<{
23
- description: string | null;
23
+ headers: Record<string, string> | null;
24
24
  name: string;
25
- tenantId: string;
26
- projectId: string;
27
25
  id: string;
28
26
  createdAt: string;
29
27
  updatedAt: string;
30
- headers: Record<string, string> | null;
28
+ description: string | null;
29
+ tenantId: string;
30
+ projectId: string;
31
31
  config: {
32
32
  type: "mcp";
33
33
  mcp: ToolMcpConfig;
@@ -78,14 +78,14 @@ declare const listTools: (db: AgentsManageDatabaseClient) => (params: {
78
78
  };
79
79
  }>;
80
80
  declare const createTool: (db: AgentsManageDatabaseClient) => (params: ToolInsert) => Promise<{
81
- description: string | null;
81
+ headers: Record<string, string> | null;
82
82
  name: string;
83
- tenantId: string;
84
- projectId: string;
85
83
  id: string;
86
84
  createdAt: string;
87
85
  updatedAt: string;
88
- headers: Record<string, string> | null;
86
+ description: string | null;
87
+ tenantId: string;
88
+ projectId: string;
89
89
  config: {
90
90
  type: "mcp";
91
91
  mcp: ToolMcpConfig;
@@ -135,38 +135,38 @@ declare const addToolToAgent: (db: AgentsManageDatabaseClient) => (params: {
135
135
  needsApproval?: boolean;
136
136
  }> | null;
137
137
  }) => Promise<{
138
- tenantId: string;
139
- projectId: string;
140
- subAgentId: string;
138
+ headers: Record<string, string> | null;
141
139
  id: string;
142
140
  createdAt: string;
143
141
  updatedAt: string;
142
+ tenantId: string;
143
+ projectId: string;
144
+ subAgentId: string;
144
145
  agentId: string;
145
- headers: Record<string, string> | null;
146
146
  toolId: string;
147
+ selectedTools: string[] | null;
147
148
  toolPolicies: Record<string, {
148
149
  needsApproval?: boolean;
149
150
  }> | null;
150
- selectedTools: string[] | null;
151
151
  }>;
152
152
  declare const removeToolFromAgent: (db: AgentsManageDatabaseClient) => (params: {
153
153
  scopes: AgentScopeConfig;
154
154
  subAgentId: string;
155
155
  toolId: string;
156
156
  }) => Promise<{
157
- tenantId: string;
158
- projectId: string;
159
- subAgentId: string;
157
+ headers: Record<string, string> | null;
160
158
  id: string;
161
159
  createdAt: string;
162
160
  updatedAt: string;
161
+ tenantId: string;
162
+ projectId: string;
163
+ subAgentId: string;
163
164
  agentId: string;
164
- headers: Record<string, string> | null;
165
165
  toolId: string;
166
+ selectedTools: string[] | null;
166
167
  toolPolicies: Record<string, {
167
168
  needsApproval?: boolean;
168
169
  }> | null;
169
- selectedTools: string[] | null;
170
170
  }>;
171
171
  /**
172
172
  * Upsert agent-tool relation (create if it doesn't exist, update if it does)
@@ -182,19 +182,19 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
182
182
  }> | null;
183
183
  relationId?: string;
184
184
  }) => Promise<{
185
- tenantId: string;
186
- projectId: string;
187
- subAgentId: string;
185
+ headers: Record<string, string> | null;
188
186
  id: string;
189
187
  createdAt: string;
190
188
  updatedAt: string;
189
+ tenantId: string;
190
+ projectId: string;
191
+ subAgentId: string;
191
192
  agentId: string;
192
- headers: Record<string, string> | null;
193
193
  toolId: string;
194
+ selectedTools: string[] | null;
194
195
  toolPolicies: Record<string, {
195
196
  needsApproval?: boolean;
196
197
  }> | null;
197
- selectedTools: string[] | null;
198
198
  }>;
199
199
  /**
200
200
  * Upsert a tool (create if it doesn't exist, update if it does)
@@ -202,14 +202,14 @@ declare const upsertSubAgentToolRelation: (db: AgentsManageDatabaseClient) => (p
202
202
  declare const upsertTool: (db: AgentsManageDatabaseClient) => (params: {
203
203
  data: ToolInsert;
204
204
  }) => Promise<{
205
- description: string | null;
205
+ headers: Record<string, string> | null;
206
206
  name: string;
207
- tenantId: string;
208
- projectId: string;
209
207
  id: string;
210
208
  createdAt: string;
211
209
  updatedAt: string;
212
- headers: Record<string, string> | null;
210
+ description: string | null;
211
+ tenantId: string;
212
+ projectId: string;
213
213
  config: {
214
214
  type: "mcp";
215
215
  mcp: ToolMcpConfig;
@@ -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" | "header" | "body";
43
+ source: "body" | "query" | "header";
44
44
  key: string;
45
45
  prefix?: string | undefined;
46
46
  regex?: string | undefined;
47
47
  };
48
48
  signedComponents: {
49
- source: "literal" | "header" | "body";
49
+ source: "literal" | "body" | "header";
50
50
  required: boolean;
51
51
  key?: string | undefined;
52
52
  value?: string | undefined;
@@ -9,48 +9,48 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
9
9
  id: string;
10
10
  }) => Promise<{
11
11
  name: string | null;
12
- tenantId: string;
13
- projectId: string;
14
12
  id: string;
15
13
  createdAt: string;
14
+ expiresAt: string | null;
16
15
  updatedAt: string;
16
+ tenantId: string;
17
+ projectId: string;
17
18
  agentId: string;
18
19
  publicId: string;
19
20
  keyHash: string;
20
21
  keyPrefix: string;
21
22
  lastUsedAt: string | null;
22
- expiresAt: string | null;
23
23
  } | undefined>;
24
24
  declare const getApiKeyByPublicId: (db: AgentsRunDatabaseClient) => (publicId: string) => Promise<{
25
25
  name: string | null;
26
- tenantId: string;
27
- projectId: string;
28
26
  id: string;
29
27
  createdAt: string;
28
+ expiresAt: string | null;
30
29
  updatedAt: string;
30
+ tenantId: string;
31
+ projectId: string;
31
32
  agentId: string;
32
33
  publicId: string;
33
34
  keyHash: string;
34
35
  keyPrefix: string;
35
36
  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
42
  name: string | null;
43
- tenantId: string;
44
- projectId: string;
45
43
  id: string;
46
44
  createdAt: string;
45
+ expiresAt: string | null;
47
46
  updatedAt: string;
47
+ tenantId: string;
48
+ projectId: string;
48
49
  agentId: string;
49
50
  publicId: string;
50
51
  keyHash: string;
51
52
  keyPrefix: string;
52
53
  lastUsedAt: string | null;
53
- expiresAt: string | null;
54
54
  }[]>;
55
55
  declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
56
56
  scopes: ProjectScopeConfig;
@@ -67,17 +67,17 @@ declare const listApiKeysPaginated: (db: AgentsRunDatabaseClient) => (params: {
67
67
  }>;
68
68
  declare const createApiKey: (db: AgentsRunDatabaseClient) => (params: ApiKeyInsert) => Promise<{
69
69
  name: string | null;
70
- tenantId: string;
71
- projectId: string;
72
70
  id: string;
73
71
  createdAt: string;
72
+ expiresAt: string | null;
74
73
  updatedAt: string;
74
+ tenantId: string;
75
+ projectId: string;
75
76
  agentId: string;
76
77
  publicId: string;
77
78
  keyHash: string;
78
79
  keyPrefix: string;
79
80
  lastUsedAt: string | null;
80
- expiresAt: string | null;
81
81
  }>;
82
82
  declare const updateApiKey: (db: AgentsRunDatabaseClient) => (params: {
83
83
  scopes: ProjectScopeConfig;
@@ -5,20 +5,31 @@ 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
+ enabled: boolean;
8
9
  type: AppType;
9
- description: string | null;
10
10
  name: string;
11
- tenantId: string | null;
12
- projectId: string | null;
13
11
  id: string;
14
12
  createdAt: string;
15
13
  updatedAt: string;
14
+ description: string | null;
15
+ tenantId: string | null;
16
+ projectId: string | null;
16
17
  prompt: string | null;
17
- enabled: boolean;
18
18
  config: {
19
19
  type: "web_client";
20
20
  webClient: {
21
21
  allowedDomains: string[];
22
+ auth?: {
23
+ publicKeys: {
24
+ kid: string;
25
+ publicKey: string;
26
+ algorithm: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "EdDSA";
27
+ addedAt: string;
28
+ }[];
29
+ audience?: string | undefined;
30
+ validateScopeClaims?: boolean | undefined;
31
+ allowAnonymous?: boolean | undefined;
32
+ } | undefined;
22
33
  };
23
34
  } | {
24
35
  type: "api";
@@ -53,20 +64,31 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
53
64
  };
54
65
  }>;
55
66
  declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
67
+ enabled: boolean;
56
68
  type: AppType;
57
- description: string | null;
58
69
  name: string;
59
- tenantId: string | null;
60
- projectId: string | null;
61
70
  id: string;
62
71
  createdAt: string;
63
72
  updatedAt: string;
73
+ description: string | null;
74
+ tenantId: string | null;
75
+ projectId: string | null;
64
76
  prompt: string | null;
65
- enabled: boolean;
66
77
  config: {
67
78
  type: "web_client";
68
79
  webClient: {
69
80
  allowedDomains: string[];
81
+ auth?: {
82
+ publicKeys: {
83
+ kid: string;
84
+ publicKey: string;
85
+ algorithm: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "EdDSA";
86
+ addedAt: string;
87
+ }[];
88
+ audience?: string | undefined;
89
+ validateScopeClaims?: boolean | undefined;
90
+ allowAnonymous?: boolean | undefined;
91
+ } | undefined;
70
92
  };
71
93
  } | {
72
94
  type: "api";
@@ -97,6 +119,18 @@ declare const deleteAppForProject: (db: AgentsRunDatabaseClient) => (params: {
97
119
  declare const deleteAppsByProject: (db: AgentsRunDatabaseClient) => (tenantId: string, projectId: string) => Promise<number>;
98
120
  declare const clearAppDefaultsByProject: (db: AgentsRunDatabaseClient) => (tenantId: string, projectId: string) => Promise<number>;
99
121
  declare const clearAppDefaultsByAgent: (db: AgentsRunDatabaseClient) => (tenantId: string, agentId: string) => Promise<number>;
122
+ declare const getAppAuthKeysForProject: (db: AgentsRunDatabaseClient) => (params: {
123
+ scopes: ProjectScopeConfig;
124
+ id: string;
125
+ }) => Promise<{
126
+ config: AppSelect["config"];
127
+ type: AppSelect["type"];
128
+ } | undefined>;
129
+ declare const updateAppAuthKeysForProject: (db: AgentsRunDatabaseClient) => (params: {
130
+ scopes: ProjectScopeConfig;
131
+ id: string;
132
+ config: AppSelect["config"];
133
+ }) => Promise<AppSelect | undefined>;
100
134
  declare const updateApp: (db: AgentsRunDatabaseClient) => (params: {
101
135
  id: string;
102
136
  data: AppUpdate;
@@ -117,6 +151,17 @@ declare const updateApp: (db: AgentsRunDatabaseClient) => (params: {
117
151
  type: "web_client";
118
152
  webClient: {
119
153
  allowedDomains: string[];
154
+ auth?: {
155
+ publicKeys: {
156
+ kid: string;
157
+ publicKey: string;
158
+ algorithm: "RS256" | "RS384" | "RS512" | "ES256" | "ES384" | "ES512" | "EdDSA";
159
+ addedAt: string;
160
+ }[];
161
+ audience?: string | undefined;
162
+ validateScopeClaims?: boolean | undefined;
163
+ allowAnonymous?: boolean | undefined;
164
+ } | undefined;
120
165
  };
121
166
  } | {
122
167
  type: "api";
@@ -126,4 +171,4 @@ declare const updateApp: (db: AgentsRunDatabaseClient) => (params: {
126
171
  }>;
127
172
  declare const deleteApp: (db: AgentsRunDatabaseClient) => (id: string) => Promise<boolean>;
128
173
  //#endregion
129
- export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForProject, deleteAppForTenant, deleteAppsByProject, getAppById, getAppByIdForProject, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppForProject, updateAppForTenant, updateAppLastUsed };
174
+ export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForProject, deleteAppForTenant, deleteAppsByProject, getAppAuthKeysForProject, getAppById, getAppByIdForProject, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppAuthKeysForProject, updateAppForProject, updateAppForTenant, updateAppLastUsed };
@@ -76,6 +76,20 @@ const clearAppDefaultsByAgent = (db) => async (tenantId, agentId) => {
76
76
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
77
77
  }).where(and(tenantScopedWhere(apps, { tenantId }), eq(apps.defaultAgentId, agentId))).returning()).length;
78
78
  };
79
+ const getAppAuthKeysForProject = (db) => async (params) => {
80
+ return (await db.select({
81
+ config: apps.config,
82
+ type: apps.type
83
+ }).from(apps).where(and(eq(apps.id, params.id), projectScopedWhere(apps, params.scopes))).limit(1))[0];
84
+ };
85
+ const updateAppAuthKeysForProject = (db) => async (params) => {
86
+ const now = (/* @__PURE__ */ new Date()).toISOString();
87
+ const [updated] = await db.update(apps).set({
88
+ config: params.config,
89
+ updatedAt: now
90
+ }).where(and(eq(apps.id, params.id), projectScopedWhere(apps, params.scopes))).returning();
91
+ return updated;
92
+ };
79
93
  const updateApp = (db) => async (params) => {
80
94
  const now = (/* @__PURE__ */ new Date()).toISOString();
81
95
  const [updatedApp] = await db.update(apps).set({
@@ -91,4 +105,4 @@ const deleteApp = (db) => async (id) => {
91
105
  };
92
106
 
93
107
  //#endregion
94
- export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForProject, deleteAppForTenant, deleteAppsByProject, getAppById, getAppByIdForProject, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppForProject, updateAppForTenant, updateAppLastUsed };
108
+ export { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForProject, deleteAppForTenant, deleteAppsByProject, getAppAuthKeysForProject, getAppById, getAppByIdForProject, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppAuthKeysForProject, updateAppForProject, updateAppForTenant, updateAppLastUsed };
@@ -3,7 +3,6 @@ import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
3
3
  import { ConversationHistoryConfig, ConversationMetadata, PaginationConfig } from "../../types/utility.js";
4
4
  import "../../types/index.js";
5
5
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
6
- import "../../index.js";
7
6
  import { ConversationInsert, ConversationSelect, ConversationUpdate, MessageSelect } from "../../types/entities.js";
8
7
 
9
8
  //#region src/data-access/runtime/conversations.d.ts
@@ -16,20 +15,20 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
16
15
  total: number;
17
16
  }>;
18
17
  declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
19
- title: string | null;
20
- tenantId: string;
21
- projectId: string;
18
+ metadata: ConversationMetadata | null;
19
+ userId: string | null;
22
20
  id: string;
23
21
  createdAt: string;
24
22
  updatedAt: string;
25
- metadata: ConversationMetadata | null;
26
- agentId: string | null;
27
- userId: string | null;
28
23
  ref: {
29
24
  type: "commit" | "tag" | "branch";
30
25
  name: string;
31
26
  hash: string;
32
27
  } | null;
28
+ title: string | null;
29
+ tenantId: string;
30
+ projectId: string;
31
+ agentId: string | null;
33
32
  activeSubAgentId: string;
34
33
  lastContextResolution: string | null;
35
34
  }>;
@@ -85,20 +84,20 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
85
84
  scopes: ProjectScopeConfig;
86
85
  conversationId: string;
87
86
  }) => Promise<{
88
- title: string | null;
89
- tenantId: string;
90
- projectId: string;
87
+ metadata: ConversationMetadata | null;
88
+ userId: string | null;
91
89
  id: string;
92
90
  createdAt: string;
93
91
  updatedAt: string;
94
- metadata: ConversationMetadata | null;
95
- agentId: string | null;
96
- userId: string | null;
97
92
  ref: {
98
93
  type: "commit" | "tag" | "branch";
99
94
  name: string;
100
95
  hash: string;
101
96
  } | null;
97
+ title: string | null;
98
+ tenantId: string;
99
+ projectId: string;
100
+ agentId: string | null;
102
101
  activeSubAgentId: string;
103
102
  lastContextResolution: string | null;
104
103
  } | undefined>;
@@ -121,20 +120,20 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
121
120
  metadata?: ConversationMetadata | null | undefined;
122
121
  contextConfigId?: string | undefined;
123
122
  } | {
124
- title: string | null;
125
- tenantId: string;
126
- projectId: string;
123
+ metadata: ConversationMetadata | null;
124
+ userId: string | null;
127
125
  id: string;
128
126
  createdAt: string;
129
127
  updatedAt: string;
130
- metadata: ConversationMetadata | null;
131
- agentId: string | null;
132
- userId: string | null;
133
128
  ref: {
134
129
  type: "commit" | "tag" | "branch";
135
130
  name: string;
136
131
  hash: string;
137
132
  } | null;
133
+ title: string | null;
134
+ tenantId: string;
135
+ projectId: string;
136
+ agentId: string | null;
138
137
  activeSubAgentId: string;
139
138
  lastContextResolution: string | null;
140
139
  }>;
@@ -153,20 +152,20 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
153
152
  scopes: ProjectScopeConfig;
154
153
  conversationId: string;
155
154
  }) => Promise<{
156
- title: string | null;
157
- tenantId: string;
158
- projectId: string;
155
+ metadata: ConversationMetadata | null;
156
+ userId: string | null;
159
157
  id: string;
160
158
  createdAt: string;
161
159
  updatedAt: string;
162
- metadata: ConversationMetadata | null;
163
- agentId: string | null;
164
- userId: string | null;
165
160
  ref: {
166
161
  type: "commit" | "tag" | "branch";
167
162
  name: string;
168
163
  hash: string;
169
164
  } | null;
165
+ title: string | null;
166
+ tenantId: string;
167
+ projectId: string;
168
+ agentId: string | null;
170
169
  activeSubAgentId: string;
171
170
  lastContextResolution: string | null;
172
171
  } | undefined>;
@@ -180,6 +179,7 @@ declare const setActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
180
179
  agentId: string;
181
180
  ref: ResolvedRef;
182
181
  userId?: string;
182
+ metadata?: ConversationMetadata;
183
183
  }) => Promise<void>;
184
184
  declare const setActiveAgentForThread: (db: AgentsRunDatabaseClient) => ({
185
185
  scopes,
@@ -175,6 +175,7 @@ const setActiveAgentForConversation = (db) => async (params) => {
175
175
  agentId: params.agentId,
176
176
  ref: params.ref,
177
177
  userId: params.userId,
178
+ metadata: params.metadata,
178
179
  createdAt: (/* @__PURE__ */ new Date()).toISOString(),
179
180
  updatedAt: (/* @__PURE__ */ new Date()).toISOString()
180
181
  }).onConflictDoUpdate({
@@ -1,4 +1,4 @@
1
- import { Artifact } from "../../types/a2a.js";
1
+ import { Artifact, Part } from "../../types/a2a.js";
2
2
  import { ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
3
3
  import "../../types/index.js";
4
4
  import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
@@ -47,6 +47,15 @@ declare const getLedgerArtifactsByContext: (db: AgentsRunDatabaseClient) => (par
47
47
  scopes: ProjectScopeConfig;
48
48
  contextId: string;
49
49
  }) => Promise<LedgerArtifactSelect[]>;
50
+ /**
51
+ * Update the parts column of an existing ledger artifact by ID.
52
+ * Used to persist modifications (e.g. key_findings) to artifacts that already exist.
53
+ */
54
+ declare const updateLedgerArtifactParts: (db: AgentsRunDatabaseClient) => (params: {
55
+ scopes: ProjectScopeConfig;
56
+ artifactId: string;
57
+ parts: Part[];
58
+ }) => Promise<boolean>;
50
59
  /**
51
60
  * Delete ledger artifacts by task ID
52
61
  */
@@ -69,4 +78,4 @@ declare const countLedgerArtifactsByTask: (db: AgentsRunDatabaseClient) => (para
69
78
  taskId: string;
70
79
  }) => Promise<number>;
71
80
  //#endregion
72
- export { addLedgerArtifacts, countLedgerArtifactsByTask, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, getLedgerArtifacts, getLedgerArtifactsByContext, upsertLedgerArtifact };
81
+ export { addLedgerArtifacts, countLedgerArtifactsByTask, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, getLedgerArtifacts, getLedgerArtifactsByContext, updateLedgerArtifactParts, upsertLedgerArtifact };
@@ -212,6 +212,17 @@ const getLedgerArtifactsByContext = (db) => async (params) => {
212
212
  return await db.select().from(ledgerArtifacts).where(and(projectScopedWhere(ledgerArtifacts, params.scopes), eq(ledgerArtifacts.contextId, params.contextId)));
213
213
  };
214
214
  /**
215
+ * Update the parts column of an existing ledger artifact by ID.
216
+ * Used to persist modifications (e.g. key_findings) to artifacts that already exist.
217
+ */
218
+ const updateLedgerArtifactParts = (db) => async (params) => {
219
+ const { scopes, artifactId, parts } = params;
220
+ return (await db.update(ledgerArtifacts).set({
221
+ parts,
222
+ updatedAt: (/* @__PURE__ */ new Date()).toISOString()
223
+ }).where(and(projectScopedWhere(ledgerArtifacts, scopes), eq(ledgerArtifacts.id, artifactId))).returning()).length > 0;
224
+ };
225
+ /**
215
226
  * Delete ledger artifacts by task ID
216
227
  */
217
228
  const deleteLedgerArtifactsByTask = (db) => async (params) => {
@@ -232,4 +243,4 @@ const countLedgerArtifactsByTask = (db) => async (params) => {
232
243
  };
233
244
 
234
245
  //#endregion
235
- export { addLedgerArtifacts, countLedgerArtifactsByTask, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, getLedgerArtifacts, getLedgerArtifactsByContext, upsertLedgerArtifact };
246
+ export { addLedgerArtifacts, countLedgerArtifactsByTask, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, getLedgerArtifacts, getLedgerArtifactsByContext, updateLedgerArtifactParts, upsertLedgerArtifact };
@@ -10,6 +10,11 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
10
10
  scopes: ProjectScopeConfig;
11
11
  messageId: string;
12
12
  }) => Promise<{
13
+ metadata: MessageMetadata | null;
14
+ role: string;
15
+ id: string;
16
+ createdAt: string;
17
+ updatedAt: string;
13
18
  content: MessageContent;
14
19
  tenantId: string;
15
20
  projectId: string;
@@ -19,12 +24,7 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
19
24
  toExternalAgentId: string | null;
20
25
  taskId: string | null;
21
26
  a2aTaskId: string | null;
22
- id: string;
23
- createdAt: string;
24
- updatedAt: string;
25
- metadata: MessageMetadata | null;
26
27
  conversationId: string;
27
- role: string;
28
28
  fromTeamAgentId: string | null;
29
29
  toTeamAgentId: string | null;
30
30
  visibility: string;
@@ -144,6 +144,11 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
144
144
  scopes: ProjectScopeConfig;
145
145
  data: Omit<MessageInsert, "tenantId" | "projectId">;
146
146
  }) => Promise<{
147
+ metadata: MessageMetadata | null;
148
+ role: string;
149
+ id: string;
150
+ createdAt: string;
151
+ updatedAt: string;
147
152
  content: MessageContent;
148
153
  tenantId: string;
149
154
  projectId: string;
@@ -153,12 +158,7 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
153
158
  toExternalAgentId: string | null;
154
159
  taskId: string | null;
155
160
  a2aTaskId: string | null;
156
- id: string;
157
- createdAt: string;
158
- updatedAt: string;
159
- metadata: MessageMetadata | null;
160
161
  conversationId: string;
161
- role: string;
162
162
  fromTeamAgentId: string | null;
163
163
  toTeamAgentId: string | null;
164
164
  visibility: string;
@@ -197,6 +197,11 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
197
197
  scopes: ProjectScopeConfig;
198
198
  messageId: string;
199
199
  }) => Promise<{
200
+ metadata: MessageMetadata | null;
201
+ role: string;
202
+ id: string;
203
+ createdAt: string;
204
+ updatedAt: string;
200
205
  content: MessageContent;
201
206
  tenantId: string;
202
207
  projectId: string;
@@ -206,12 +211,7 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
206
211
  toExternalAgentId: string | null;
207
212
  taskId: string | null;
208
213
  a2aTaskId: string | null;
209
- id: string;
210
- createdAt: string;
211
- updatedAt: string;
212
- metadata: MessageMetadata | null;
213
214
  conversationId: string;
214
- role: string;
215
215
  fromTeamAgentId: string | null;
216
216
  toTeamAgentId: string | null;
217
217
  visibility: string;
@@ -39,7 +39,7 @@ declare const listScheduledTriggerInvocationsPaginated: (db: AgentsRunDatabaseCl
39
39
  name: string;
40
40
  hash: string;
41
41
  } | null;
42
- status: "pending" | "failed" | "running" | "completed" | "cancelled";
42
+ status: "pending" | "running" | "completed" | "failed" | "cancelled";
43
43
  scheduledFor: string;
44
44
  startedAt: string | null;
45
45
  completedAt: string | null;
@@ -193,7 +193,7 @@ declare const listUpcomingInvocationsForAgentPaginated: (db: AgentsRunDatabaseCl
193
193
  name: string;
194
194
  hash: string;
195
195
  } | null;
196
- status: "pending" | "failed" | "running" | "completed" | "cancelled";
196
+ status: "pending" | "running" | "completed" | "failed" | "cancelled";
197
197
  scheduledFor: string;
198
198
  startedAt: string | null;
199
199
  completedAt: string | null;
@@ -232,7 +232,7 @@ declare const listProjectScheduledTriggerInvocationsPaginated: (db: AgentsRunDat
232
232
  name: string;
233
233
  hash: string;
234
234
  } | null;
235
- status: "pending" | "failed" | "running" | "completed" | "cancelled";
235
+ status: "pending" | "running" | "completed" | "failed" | "cancelled";
236
236
  scheduledFor: string;
237
237
  startedAt: string | null;
238
238
  completedAt: string | null;
@@ -7,20 +7,20 @@ import { TaskInsert, TaskSelect } from "../../types/entities.js";
7
7
 
8
8
  //#region src/data-access/runtime/tasks.d.ts
9
9
  declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
10
- status: string;
11
- tenantId: string;
12
- projectId: string;
13
- subAgentId: string;
10
+ metadata: TaskMetadataConfig | null;
14
11
  id: string;
15
12
  createdAt: string;
13
+ status: string;
16
14
  updatedAt: string;
17
- metadata: TaskMetadataConfig | null;
18
- agentId: string;
19
15
  ref: {
20
16
  type: "commit" | "tag" | "branch";
21
17
  name: string;
22
18
  hash: string;
23
19
  } | null;
20
+ tenantId: string;
21
+ projectId: string;
22
+ subAgentId: string;
23
+ agentId: string;
24
24
  contextId: string;
25
25
  }>;
26
26
  declare const getTask: (db: AgentsRunDatabaseClient) => (params: {