@inkeep/agents-core 0.79.0 → 0.79.1

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 (38) hide show
  1. package/dist/auth/permissions.d.ts +9 -9
  2. package/dist/data-access/index.d.ts +2 -1
  3. package/dist/data-access/index.js +2 -1
  4. package/dist/data-access/manage/agents.d.ts +31 -31
  5. package/dist/data-access/manage/artifactComponents.d.ts +4 -4
  6. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  7. package/dist/data-access/manage/dataComponents.d.ts +2 -2
  8. package/dist/data-access/manage/functionTools.d.ts +8 -8
  9. package/dist/data-access/manage/skills.d.ts +8 -8
  10. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  11. package/dist/data-access/manage/subAgentRelations.d.ts +12 -12
  12. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
  13. package/dist/data-access/manage/subAgents.d.ts +9 -9
  14. package/dist/data-access/manage/tools.d.ts +15 -15
  15. package/dist/data-access/manage/triggers.d.ts +4 -4
  16. package/dist/data-access/runtime/apiKeys.d.ts +8 -8
  17. package/dist/data-access/runtime/apps.d.ts +8 -8
  18. package/dist/data-access/runtime/conversations.d.ts +32 -32
  19. package/dist/data-access/runtime/events.d.ts +5 -5
  20. package/dist/data-access/runtime/feedback.d.ts +4 -4
  21. package/dist/data-access/runtime/messages.d.ts +24 -24
  22. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +5 -5
  23. package/dist/data-access/runtime/scheduledTriggerUsers.d.ts +1 -1
  24. package/dist/data-access/runtime/tasks.d.ts +5 -5
  25. package/dist/data-access/runtime/toolApprovalDecisions.d.ts +37 -0
  26. package/dist/data-access/runtime/toolApprovalDecisions.js +76 -0
  27. package/dist/db/manage/manage-schema.d.ts +506 -506
  28. package/dist/db/runtime/runtime-schema.d.ts +596 -448
  29. package/dist/db/runtime/runtime-schema.js +30 -1
  30. package/dist/index.d.ts +3 -2
  31. package/dist/index.js +3 -2
  32. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  33. package/dist/validation/schemas/skills.d.ts +48 -48
  34. package/dist/validation/schemas.d.ts +775 -775
  35. package/drizzle/runtime/0044_productive_bromley.sql +12 -0
  36. package/drizzle/runtime/meta/0044_snapshot.json +6386 -0
  37. package/drizzle/runtime/meta/_journal.json +7 -0
  38. package/package.json +1 -1
@@ -7,17 +7,17 @@ import { EventInsert } from "../../types/entities.js";
7
7
  //#region src/data-access/runtime/events.d.ts
8
8
  declare const createEvent: (db: AgentsRunDatabaseClient) => (params: EventInsert) => Promise<{
9
9
  row: {
10
+ type: string;
10
11
  id: string;
11
- metadata: Record<string, unknown> | null;
12
12
  createdAt: string;
13
13
  updatedAt: string;
14
- projectId: string;
15
- tenantId: string;
16
- type: string;
14
+ metadata: Record<string, unknown> | null;
17
15
  properties: Record<string, unknown> | null;
18
16
  agentId: string | null;
19
- conversationId: string | null;
17
+ projectId: string;
18
+ tenantId: string;
20
19
  userProperties: Record<string, unknown> | null;
20
+ conversationId: string | null;
21
21
  messageId: string | null;
22
22
  serverMetadata: {
23
23
  [k: string]: unknown;
@@ -70,15 +70,15 @@ declare const getFeedbackByIds: (db: AgentsRunDatabaseClient) => (params: {
70
70
  agentId: string | null;
71
71
  }[]>;
72
72
  declare const createFeedback: (db: AgentsRunDatabaseClient) => (params: FeedbackInsert) => Promise<{
73
+ type: "positive" | "negative";
73
74
  id: string;
74
75
  createdAt: string;
75
76
  updatedAt: string;
76
77
  projectId: string;
77
78
  tenantId: string;
78
- type: "positive" | "negative";
79
- details: string | null;
80
79
  conversationId: string;
81
80
  messageId: string | null;
81
+ details: string | null;
82
82
  }>;
83
83
  declare const createFeedbackBulk: (db: AgentsRunDatabaseClient) => (items: FeedbackInsert[]) => Promise<(typeof feedback.$inferSelect)[]>;
84
84
  declare const updateFeedback: (db: AgentsRunDatabaseClient) => (params: {
@@ -100,15 +100,15 @@ declare const deleteFeedback: (db: AgentsRunDatabaseClient) => (params: {
100
100
  scopes: ProjectScopeConfig;
101
101
  feedbackId: string;
102
102
  }) => Promise<{
103
+ type: "positive" | "negative";
103
104
  id: string;
104
105
  createdAt: string;
105
106
  updatedAt: string;
106
107
  projectId: string;
107
108
  tenantId: string;
108
- type: "positive" | "negative";
109
- details: string | null;
110
109
  conversationId: string;
111
110
  messageId: string | null;
111
+ details: string | null;
112
112
  }>;
113
113
  //#endregion
114
114
  export { createFeedback, createFeedbackBulk, deleteFeedback, getFeedbackById, getFeedbackByIds, listFeedback, listFeedbackByConversation, updateFeedback };
@@ -11,27 +11,27 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
11
11
  messageId: string;
12
12
  }) => Promise<{
13
13
  id: string;
14
- content: MessageContent;
15
- metadata: MessageMetadata | null;
16
14
  createdAt: string;
17
15
  updatedAt: string;
16
+ metadata: MessageMetadata | null;
17
+ role: string;
18
+ properties: Record<string, unknown> | null;
18
19
  projectId: string;
19
20
  tenantId: string;
20
- properties: Record<string, unknown> | null;
21
- role: string;
21
+ content: MessageContent;
22
+ userProperties: Record<string, unknown> | null;
23
+ conversationId: string;
22
24
  fromSubAgentId: string | null;
23
25
  toSubAgentId: string | null;
24
26
  fromExternalAgentId: string | null;
25
27
  toExternalAgentId: string | null;
26
- taskId: string | null;
27
- a2aTaskId: string | null;
28
- conversationId: string;
29
- userProperties: Record<string, unknown> | null;
30
28
  fromTeamAgentId: string | null;
31
29
  toTeamAgentId: string | null;
32
30
  visibility: string;
33
31
  messageType: string;
32
+ taskId: string | null;
34
33
  parentMessageId: string | null;
34
+ a2aTaskId: string | null;
35
35
  a2aSessionId: string | null;
36
36
  } | undefined>;
37
37
  declare const listMessages: (db: AgentsRunDatabaseClient) => (params: {
@@ -184,27 +184,27 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
184
184
  data: Omit<MessageInsert, "tenantId" | "projectId">;
185
185
  }) => Promise<{
186
186
  id: string;
187
- content: MessageContent;
188
- metadata: MessageMetadata | null;
189
187
  createdAt: string;
190
188
  updatedAt: string;
189
+ metadata: MessageMetadata | null;
190
+ role: string;
191
+ properties: Record<string, unknown> | null;
191
192
  projectId: string;
192
193
  tenantId: string;
193
- properties: Record<string, unknown> | null;
194
- role: string;
194
+ content: MessageContent;
195
+ userProperties: Record<string, unknown> | null;
196
+ conversationId: string;
195
197
  fromSubAgentId: string | null;
196
198
  toSubAgentId: string | null;
197
199
  fromExternalAgentId: string | null;
198
200
  toExternalAgentId: string | null;
199
- taskId: string | null;
200
- a2aTaskId: string | null;
201
- conversationId: string;
202
- userProperties: Record<string, unknown> | null;
203
201
  fromTeamAgentId: string | null;
204
202
  toTeamAgentId: string | null;
205
203
  visibility: string;
206
204
  messageType: string;
205
+ taskId: string | null;
207
206
  parentMessageId: string | null;
207
+ a2aTaskId: string | null;
208
208
  a2aSessionId: string | null;
209
209
  }>;
210
210
  declare const updateMessage: (db: AgentsRunDatabaseClient) => (params: {
@@ -241,27 +241,27 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
241
241
  messageId: string;
242
242
  }) => Promise<{
243
243
  id: string;
244
- content: MessageContent;
245
- metadata: MessageMetadata | null;
246
244
  createdAt: string;
247
245
  updatedAt: string;
246
+ metadata: MessageMetadata | null;
247
+ role: string;
248
+ properties: Record<string, unknown> | null;
248
249
  projectId: string;
249
250
  tenantId: string;
250
- properties: Record<string, unknown> | null;
251
- role: string;
251
+ content: MessageContent;
252
+ userProperties: Record<string, unknown> | null;
253
+ conversationId: string;
252
254
  fromSubAgentId: string | null;
253
255
  toSubAgentId: string | null;
254
256
  fromExternalAgentId: string | null;
255
257
  toExternalAgentId: string | null;
256
- taskId: string | null;
257
- a2aTaskId: string | null;
258
- conversationId: string;
259
- userProperties: Record<string, unknown> | null;
260
258
  fromTeamAgentId: string | null;
261
259
  toTeamAgentId: string | null;
262
260
  visibility: string;
263
261
  messageType: string;
262
+ taskId: string | null;
264
263
  parentMessageId: string | null;
264
+ a2aTaskId: string | null;
265
265
  a2aSessionId: string | null;
266
266
  }>;
267
267
  declare const countMessagesByConversation: (db: AgentsRunDatabaseClient) => (params: {
@@ -40,7 +40,7 @@ declare const listScheduledTriggerInvocationsPaginated: (db: AgentsRunDatabaseCl
40
40
  name: string;
41
41
  hash: string;
42
42
  } | null;
43
- status: "pending" | "failed" | "running" | "completed" | "cancelled";
43
+ status: "pending" | "running" | "completed" | "failed" | "cancelled";
44
44
  scheduledFor: string;
45
45
  startedAt: string | null;
46
46
  completedAt: string | null;
@@ -199,7 +199,7 @@ declare const listUpcomingInvocationsForAgentPaginated: (db: AgentsRunDatabaseCl
199
199
  name: string;
200
200
  hash: string;
201
201
  } | null;
202
- status: "pending" | "failed" | "running" | "completed" | "cancelled";
202
+ status: "pending" | "running" | "completed" | "failed" | "cancelled";
203
203
  scheduledFor: string;
204
204
  startedAt: string | null;
205
205
  completedAt: string | null;
@@ -239,7 +239,7 @@ declare const listProjectScheduledTriggerInvocationsPaginated: (db: AgentsRunDat
239
239
  name: string;
240
240
  hash: string;
241
241
  } | null;
242
- status: "pending" | "failed" | "running" | "completed" | "cancelled";
242
+ status: "pending" | "running" | "completed" | "failed" | "cancelled";
243
243
  scheduledFor: string;
244
244
  startedAt: string | null;
245
245
  completedAt: string | null;
@@ -292,7 +292,7 @@ declare const listScheduledTriggerInvocationsByTriggerId: (db: AgentsRunDatabase
292
292
  name: string;
293
293
  hash: string;
294
294
  } | null;
295
- status: "pending" | "failed" | "running" | "completed" | "cancelled";
295
+ status: "pending" | "running" | "completed" | "failed" | "cancelled";
296
296
  scheduledFor: string;
297
297
  startedAt: string | null;
298
298
  completedAt: string | null;
@@ -320,7 +320,7 @@ declare const listScheduledTriggerInvocationsByDatasetRunId: (db: AgentsRunDatab
320
320
  name: string;
321
321
  hash: string;
322
322
  } | null;
323
- status: "pending" | "failed" | "running" | "completed" | "cancelled";
323
+ status: "pending" | "running" | "completed" | "failed" | "cancelled";
324
324
  scheduledFor: string;
325
325
  startedAt: string | null;
326
326
  completedAt: string | null;
@@ -16,8 +16,8 @@ declare const createScheduledTriggerUser: (db: AgentsRunDatabaseClient) => (para
16
16
  userId: string;
17
17
  }) => Promise<{
18
18
  createdAt: string;
19
- tenantId: string;
20
19
  userId: string;
20
+ tenantId: string;
21
21
  scheduledTriggerId: string;
22
22
  }>;
23
23
  declare const deleteScheduledTriggerUser: (db: AgentsRunDatabaseClient) => (params: {
@@ -8,19 +8,19 @@ import { TaskInsert, TaskSelect } from "../../types/entities.js";
8
8
  //#region src/data-access/runtime/tasks.d.ts
9
9
  declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert) => Promise<{
10
10
  id: string;
11
- metadata: TaskMetadataConfig | null;
12
11
  createdAt: string;
13
12
  updatedAt: string;
14
- projectId: string;
15
- tenantId: string;
16
- agentId: string;
17
- subAgentId: string;
18
13
  ref: {
19
14
  type: "commit" | "tag" | "branch";
20
15
  name: string;
21
16
  hash: string;
22
17
  } | null;
18
+ metadata: TaskMetadataConfig | null;
23
19
  status: string;
20
+ agentId: string;
21
+ projectId: string;
22
+ tenantId: string;
23
+ subAgentId: string;
24
24
  contextId: string;
25
25
  }>;
26
26
  declare const getTask: (db: AgentsRunDatabaseClient) => (params: {
@@ -0,0 +1,37 @@
1
+ import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
2
+
3
+ //#region src/data-access/runtime/toolApprovalDecisions.d.ts
4
+ interface ToolApprovalScope {
5
+ tenantId: string;
6
+ projectId: string;
7
+ conversationId: string;
8
+ }
9
+ /**
10
+ * Persist an approval/denial so the instance running the suspended agent can
11
+ * pick it up. Used when the approval request lands on a different instance than
12
+ * the one holding the in-memory pending approval. Upserts so a retry/re-submit
13
+ * overwrites rather than conflicts.
14
+ */
15
+ declare const recordToolApprovalDecision: (db: AgentsRunDatabaseClient) => (params: ToolApprovalScope & {
16
+ toolCallId: string;
17
+ approved: boolean;
18
+ reason?: string;
19
+ }) => Promise<void>;
20
+ /**
21
+ * Atomically read-and-delete a pending decision for a tool call. Returns null
22
+ * when none is present. The delete-on-read (DELETE ... RETURNING) guarantees a
23
+ * single waiter consumes any given decision exactly once.
24
+ */
25
+ declare const consumeToolApprovalDecision: (db: AgentsRunDatabaseClient) => (params: ToolApprovalScope & {
26
+ toolCallId: string;
27
+ }) => Promise<{
28
+ approved: boolean;
29
+ reason: string | null;
30
+ } | null>;
31
+ /**
32
+ * Delete decisions older than the timeout window. Batched to bound statement
33
+ * size, mirroring cleanupExpiredStreamChunks.
34
+ */
35
+ declare const cleanupExpiredToolApprovalDecisions: (db: AgentsRunDatabaseClient) => (olderThanMinutes?: number, batchSize?: number) => Promise<void>;
36
+ //#endregion
37
+ export { cleanupExpiredToolApprovalDecisions, consumeToolApprovalDecision, recordToolApprovalDecision };
@@ -0,0 +1,76 @@
1
+ import { toolApprovalDecisions } from "../../db/runtime/runtime-schema.js";
2
+ import { and, eq, sql } from "drizzle-orm";
3
+
4
+ //#region src/data-access/runtime/toolApprovalDecisions.ts
5
+ const DEFAULT_CLEANUP_AGE_MINUTES = 15;
6
+ const DEFAULT_CLEANUP_BATCH_SIZE = 1e3;
7
+ const decisionConditions = (scope, toolCallId) => [
8
+ eq(toolApprovalDecisions.tenantId, scope.tenantId),
9
+ eq(toolApprovalDecisions.projectId, scope.projectId),
10
+ eq(toolApprovalDecisions.conversationId, scope.conversationId),
11
+ eq(toolApprovalDecisions.toolCallId, toolCallId)
12
+ ];
13
+ /**
14
+ * Persist an approval/denial so the instance running the suspended agent can
15
+ * pick it up. Used when the approval request lands on a different instance than
16
+ * the one holding the in-memory pending approval. Upserts so a retry/re-submit
17
+ * overwrites rather than conflicts.
18
+ */
19
+ const recordToolApprovalDecision = (db) => async (params) => {
20
+ await db.insert(toolApprovalDecisions).values({
21
+ tenantId: params.tenantId,
22
+ projectId: params.projectId,
23
+ conversationId: params.conversationId,
24
+ toolCallId: params.toolCallId,
25
+ approved: params.approved,
26
+ reason: params.reason ?? null
27
+ }).onConflictDoUpdate({
28
+ target: [
29
+ toolApprovalDecisions.tenantId,
30
+ toolApprovalDecisions.projectId,
31
+ toolApprovalDecisions.conversationId,
32
+ toolApprovalDecisions.toolCallId
33
+ ],
34
+ set: {
35
+ approved: params.approved,
36
+ reason: params.reason ?? null
37
+ }
38
+ });
39
+ };
40
+ /**
41
+ * Atomically read-and-delete a pending decision for a tool call. Returns null
42
+ * when none is present. The delete-on-read (DELETE ... RETURNING) guarantees a
43
+ * single waiter consumes any given decision exactly once.
44
+ */
45
+ const consumeToolApprovalDecision = (db) => async (params) => {
46
+ const [row] = await db.delete(toolApprovalDecisions).where(and(...decisionConditions(params, params.toolCallId))).returning();
47
+ if (!row) return null;
48
+ return {
49
+ approved: row.approved,
50
+ reason: row.reason ?? null
51
+ };
52
+ };
53
+ /**
54
+ * Delete decisions older than the timeout window. Batched to bound statement
55
+ * size, mirroring cleanupExpiredStreamChunks.
56
+ */
57
+ const cleanupExpiredToolApprovalDecisions = (db) => async (olderThanMinutes = DEFAULT_CLEANUP_AGE_MINUTES, batchSize = DEFAULT_CLEANUP_BATCH_SIZE) => {
58
+ const cutoff = sql`now() - make_interval(mins => ${olderThanMinutes})`;
59
+ let deleted;
60
+ do {
61
+ const batch = await db.select({
62
+ tenantId: toolApprovalDecisions.tenantId,
63
+ projectId: toolApprovalDecisions.projectId,
64
+ conversationId: toolApprovalDecisions.conversationId,
65
+ toolCallId: toolApprovalDecisions.toolCallId
66
+ }).from(toolApprovalDecisions).where(sql`${toolApprovalDecisions.createdAt} < ${cutoff}`).limit(batchSize);
67
+ deleted = batch.length;
68
+ if (deleted > 0) {
69
+ const pks = batch.map((row) => sql`(${row.tenantId}, ${row.projectId}, ${row.conversationId}, ${row.toolCallId})`);
70
+ await db.delete(toolApprovalDecisions).where(sql`(${toolApprovalDecisions.tenantId}, ${toolApprovalDecisions.projectId}, ${toolApprovalDecisions.conversationId}, ${toolApprovalDecisions.toolCallId}) IN (${sql.join(pks, sql`, `)})`);
71
+ }
72
+ } while (deleted >= batchSize);
73
+ };
74
+
75
+ //#endregion
76
+ export { cleanupExpiredToolApprovalDecisions, consumeToolApprovalDecision, recordToolApprovalDecision };