@inkeep/agents-core 0.0.0-dev-20260403194639 → 0.0.0-dev-20260404012728
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.
- package/dist/auth/auth-schema.d.ts +86 -86
- package/dist/auth/auth-validation-schemas.d.ts +154 -154
- package/dist/auth/auth.d.ts +6 -6
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/data-access/index.d.ts +2 -1
- package/dist/data-access/index.js +2 -1
- package/dist/data-access/manage/agents.d.ts +15 -15
- package/dist/data-access/manage/artifactComponents.d.ts +8 -8
- package/dist/data-access/manage/contextConfigs.d.ts +8 -8
- package/dist/data-access/manage/dataComponents.d.ts +4 -4
- package/dist/data-access/manage/functionTools.d.ts +8 -8
- package/dist/data-access/manage/skills.d.ts +9 -9
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
- package/dist/data-access/manage/subAgents.d.ts +9 -9
- package/dist/data-access/manage/tools.d.ts +15 -15
- package/dist/data-access/manage/triggers.d.ts +2 -2
- package/dist/data-access/runtime/apiKeys.d.ts +12 -12
- package/dist/data-access/runtime/apps.d.ts +14 -14
- package/dist/data-access/runtime/conversations.d.ts +8 -8
- package/dist/data-access/runtime/messages.d.ts +12 -12
- package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +4 -4
- package/dist/data-access/runtime/streamChunks.d.ts +29 -0
- package/dist/data-access/runtime/streamChunks.js +65 -0
- package/dist/data-access/runtime/tasks.d.ts +3 -3
- package/dist/db/manage/dolt-safe-jsonb.d.ts +2 -2
- package/dist/db/manage/manage-schema.d.ts +354 -354
- package/dist/db/runtime/runtime-schema.d.ts +480 -348
- package/dist/db/runtime/runtime-schema.js +20 -1
- package/dist/dolt/ref-helpers.js +15 -1
- package/dist/dolt/ref-scope.js +29 -1
- package/dist/index.d.ts +3 -2
- package/dist/index.js +3 -2
- package/dist/utils/service-token-auth.d.ts +3 -0
- package/dist/utils/service-token-auth.js +5 -2
- package/dist/validation/schemas/skills.d.ts +36 -36
- package/dist/validation/schemas.d.ts +1816 -1816
- package/drizzle/runtime/0031_fantastic_gorilla_man.sql +13 -0
- package/drizzle/runtime/meta/0031_snapshot.json +4872 -0
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +1 -1
|
@@ -16,6 +16,8 @@ declare const listConversations: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
16
16
|
}>;
|
|
17
17
|
declare const createConversation: (db: AgentsRunDatabaseClient) => (params: ConversationInsert) => Promise<{
|
|
18
18
|
title: string | null;
|
|
19
|
+
tenantId: string;
|
|
20
|
+
projectId: string;
|
|
19
21
|
id: string;
|
|
20
22
|
ref: {
|
|
21
23
|
type: "commit" | "tag" | "branch";
|
|
@@ -24,8 +26,6 @@ declare const createConversation: (db: AgentsRunDatabaseClient) => (params: Conv
|
|
|
24
26
|
} | null;
|
|
25
27
|
createdAt: string;
|
|
26
28
|
updatedAt: string;
|
|
27
|
-
projectId: string;
|
|
28
|
-
tenantId: string;
|
|
29
29
|
metadata: ConversationMetadata | null;
|
|
30
30
|
agentId: string | null;
|
|
31
31
|
userId: string | null;
|
|
@@ -85,6 +85,8 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
85
85
|
conversationId: string;
|
|
86
86
|
}) => Promise<{
|
|
87
87
|
title: string | null;
|
|
88
|
+
tenantId: string;
|
|
89
|
+
projectId: string;
|
|
88
90
|
id: string;
|
|
89
91
|
ref: {
|
|
90
92
|
type: "commit" | "tag" | "branch";
|
|
@@ -93,8 +95,6 @@ declare const getConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
93
95
|
} | null;
|
|
94
96
|
createdAt: string;
|
|
95
97
|
updatedAt: string;
|
|
96
|
-
projectId: string;
|
|
97
|
-
tenantId: string;
|
|
98
98
|
metadata: ConversationMetadata | null;
|
|
99
99
|
agentId: string | null;
|
|
100
100
|
userId: string | null;
|
|
@@ -121,6 +121,8 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
121
121
|
contextConfigId?: string | undefined;
|
|
122
122
|
} | {
|
|
123
123
|
title: string | null;
|
|
124
|
+
tenantId: string;
|
|
125
|
+
projectId: string;
|
|
124
126
|
id: string;
|
|
125
127
|
ref: {
|
|
126
128
|
type: "commit" | "tag" | "branch";
|
|
@@ -129,8 +131,6 @@ declare const createOrGetConversation: (db: AgentsRunDatabaseClient) => (input:
|
|
|
129
131
|
} | null;
|
|
130
132
|
createdAt: string;
|
|
131
133
|
updatedAt: string;
|
|
132
|
-
projectId: string;
|
|
133
|
-
tenantId: string;
|
|
134
134
|
metadata: ConversationMetadata | null;
|
|
135
135
|
agentId: string | null;
|
|
136
136
|
userId: string | null;
|
|
@@ -153,6 +153,8 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
153
153
|
conversationId: string;
|
|
154
154
|
}) => Promise<{
|
|
155
155
|
title: string | null;
|
|
156
|
+
tenantId: string;
|
|
157
|
+
projectId: string;
|
|
156
158
|
id: string;
|
|
157
159
|
ref: {
|
|
158
160
|
type: "commit" | "tag" | "branch";
|
|
@@ -161,8 +163,6 @@ declare const getActiveAgentForConversation: (db: AgentsRunDatabaseClient) => (p
|
|
|
161
163
|
} | null;
|
|
162
164
|
createdAt: string;
|
|
163
165
|
updatedAt: string;
|
|
164
|
-
projectId: string;
|
|
165
|
-
tenantId: string;
|
|
166
166
|
metadata: ConversationMetadata | null;
|
|
167
167
|
agentId: string | null;
|
|
168
168
|
userId: string | null;
|
|
@@ -10,6 +10,9 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
10
10
|
scopes: ProjectScopeConfig;
|
|
11
11
|
messageId: string;
|
|
12
12
|
}) => Promise<{
|
|
13
|
+
content: MessageContent;
|
|
14
|
+
tenantId: string;
|
|
15
|
+
projectId: string;
|
|
13
16
|
fromSubAgentId: string | null;
|
|
14
17
|
toSubAgentId: string | null;
|
|
15
18
|
fromExternalAgentId: string | null;
|
|
@@ -19,12 +22,9 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
19
22
|
id: string;
|
|
20
23
|
createdAt: string;
|
|
21
24
|
updatedAt: string;
|
|
22
|
-
projectId: string;
|
|
23
|
-
tenantId: string;
|
|
24
25
|
metadata: MessageMetadata | null;
|
|
25
|
-
content: MessageContent;
|
|
26
|
-
conversationId: string;
|
|
27
26
|
role: string;
|
|
27
|
+
conversationId: string;
|
|
28
28
|
fromTeamAgentId: string | null;
|
|
29
29
|
toTeamAgentId: string | null;
|
|
30
30
|
visibility: string;
|
|
@@ -144,6 +144,9 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
144
144
|
scopes: ProjectScopeConfig;
|
|
145
145
|
data: Omit<MessageInsert, "tenantId" | "projectId">;
|
|
146
146
|
}) => Promise<{
|
|
147
|
+
content: MessageContent;
|
|
148
|
+
tenantId: string;
|
|
149
|
+
projectId: string;
|
|
147
150
|
fromSubAgentId: string | null;
|
|
148
151
|
toSubAgentId: string | null;
|
|
149
152
|
fromExternalAgentId: string | null;
|
|
@@ -153,12 +156,9 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
153
156
|
id: string;
|
|
154
157
|
createdAt: string;
|
|
155
158
|
updatedAt: string;
|
|
156
|
-
projectId: string;
|
|
157
|
-
tenantId: string;
|
|
158
159
|
metadata: MessageMetadata | null;
|
|
159
|
-
content: MessageContent;
|
|
160
|
-
conversationId: string;
|
|
161
160
|
role: string;
|
|
161
|
+
conversationId: string;
|
|
162
162
|
fromTeamAgentId: string | null;
|
|
163
163
|
toTeamAgentId: string | null;
|
|
164
164
|
visibility: string;
|
|
@@ -197,6 +197,9 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
197
197
|
scopes: ProjectScopeConfig;
|
|
198
198
|
messageId: string;
|
|
199
199
|
}) => Promise<{
|
|
200
|
+
content: MessageContent;
|
|
201
|
+
tenantId: string;
|
|
202
|
+
projectId: string;
|
|
200
203
|
fromSubAgentId: string | null;
|
|
201
204
|
toSubAgentId: string | null;
|
|
202
205
|
fromExternalAgentId: string | null;
|
|
@@ -206,12 +209,9 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
206
209
|
id: string;
|
|
207
210
|
createdAt: string;
|
|
208
211
|
updatedAt: string;
|
|
209
|
-
projectId: string;
|
|
210
|
-
tenantId: string;
|
|
211
212
|
metadata: MessageMetadata | null;
|
|
212
|
-
content: MessageContent;
|
|
213
|
-
conversationId: string;
|
|
214
213
|
role: string;
|
|
214
|
+
conversationId: string;
|
|
215
215
|
fromTeamAgentId: string | null;
|
|
216
216
|
toTeamAgentId: string | null;
|
|
217
217
|
visibility: string;
|
|
@@ -40,7 +40,7 @@ declare const listScheduledTriggerInvocationsPaginated: (db: AgentsRunDatabaseCl
|
|
|
40
40
|
name: string;
|
|
41
41
|
hash: string;
|
|
42
42
|
} | null;
|
|
43
|
-
status: "pending" | "
|
|
43
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
44
44
|
scheduledFor: string;
|
|
45
45
|
startedAt: string | null;
|
|
46
46
|
completedAt: string | null;
|
|
@@ -194,7 +194,7 @@ declare const listUpcomingInvocationsForAgentPaginated: (db: AgentsRunDatabaseCl
|
|
|
194
194
|
name: string;
|
|
195
195
|
hash: string;
|
|
196
196
|
} | null;
|
|
197
|
-
status: "pending" | "
|
|
197
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
198
198
|
scheduledFor: string;
|
|
199
199
|
startedAt: string | null;
|
|
200
200
|
completedAt: string | null;
|
|
@@ -233,7 +233,7 @@ declare const listProjectScheduledTriggerInvocationsPaginated: (db: AgentsRunDat
|
|
|
233
233
|
name: string;
|
|
234
234
|
hash: string;
|
|
235
235
|
} | null;
|
|
236
|
-
status: "pending" | "
|
|
236
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
237
237
|
scheduledFor: string;
|
|
238
238
|
startedAt: string | null;
|
|
239
239
|
completedAt: string | null;
|
|
@@ -285,7 +285,7 @@ declare const listScheduledTriggerInvocationsByTriggerId: (db: AgentsRunDatabase
|
|
|
285
285
|
name: string;
|
|
286
286
|
hash: string;
|
|
287
287
|
} | null;
|
|
288
|
-
status: "pending" | "
|
|
288
|
+
status: "pending" | "running" | "completed" | "failed" | "cancelled";
|
|
289
289
|
scheduledFor: string;
|
|
290
290
|
startedAt: string | null;
|
|
291
291
|
completedAt: string | null;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
2
|
+
|
|
3
|
+
//#region src/data-access/runtime/streamChunks.d.ts
|
|
4
|
+
interface ConversationScope {
|
|
5
|
+
tenantId: string;
|
|
6
|
+
projectId: string;
|
|
7
|
+
conversationId: string;
|
|
8
|
+
}
|
|
9
|
+
declare const insertStreamChunks: (db: AgentsRunDatabaseClient) => (params: ConversationScope & {
|
|
10
|
+
chunks: {
|
|
11
|
+
idx: number;
|
|
12
|
+
data: string;
|
|
13
|
+
}[];
|
|
14
|
+
}) => Promise<void>;
|
|
15
|
+
declare const markStreamComplete: (db: AgentsRunDatabaseClient) => (params: ConversationScope & {
|
|
16
|
+
finalIdx: number;
|
|
17
|
+
}) => Promise<void>;
|
|
18
|
+
declare const getStreamChunks: (db: AgentsRunDatabaseClient) => (params: ConversationScope & {
|
|
19
|
+
afterIdx?: number;
|
|
20
|
+
limit?: number;
|
|
21
|
+
}) => Promise<{
|
|
22
|
+
idx: number;
|
|
23
|
+
data: string;
|
|
24
|
+
isFinal: boolean;
|
|
25
|
+
}[]>;
|
|
26
|
+
declare const deleteStreamChunks: (db: AgentsRunDatabaseClient) => (params: ConversationScope) => Promise<void>;
|
|
27
|
+
declare const cleanupExpiredStreamChunks: (db: AgentsRunDatabaseClient) => (olderThanMinutes?: number, batchSize?: number) => Promise<void>;
|
|
28
|
+
//#endregion
|
|
29
|
+
export { cleanupExpiredStreamChunks, deleteStreamChunks, getStreamChunks, insertStreamChunks, markStreamComplete };
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
import { streamChunks } from "../../db/runtime/runtime-schema.js";
|
|
2
|
+
import { and, eq, gt, sql } from "drizzle-orm";
|
|
3
|
+
|
|
4
|
+
//#region src/data-access/runtime/streamChunks.ts
|
|
5
|
+
const DEFAULT_CHUNK_BATCH_LIMIT = 500;
|
|
6
|
+
const DEFAULT_CLEANUP_AGE_MINUTES = 60;
|
|
7
|
+
const DEFAULT_CLEANUP_BATCH_SIZE = 1e3;
|
|
8
|
+
const scopeConditions = (scope) => [
|
|
9
|
+
eq(streamChunks.tenantId, scope.tenantId),
|
|
10
|
+
eq(streamChunks.projectId, scope.projectId),
|
|
11
|
+
eq(streamChunks.conversationId, scope.conversationId)
|
|
12
|
+
];
|
|
13
|
+
const insertStreamChunks = (db) => async (params) => {
|
|
14
|
+
if (params.chunks.length === 0) return;
|
|
15
|
+
await db.insert(streamChunks).values(params.chunks.map((chunk) => ({
|
|
16
|
+
tenantId: params.tenantId,
|
|
17
|
+
projectId: params.projectId,
|
|
18
|
+
conversationId: params.conversationId,
|
|
19
|
+
idx: chunk.idx,
|
|
20
|
+
data: chunk.data,
|
|
21
|
+
isFinal: false
|
|
22
|
+
})));
|
|
23
|
+
};
|
|
24
|
+
const markStreamComplete = (db) => async (params) => {
|
|
25
|
+
await db.insert(streamChunks).values({
|
|
26
|
+
tenantId: params.tenantId,
|
|
27
|
+
projectId: params.projectId,
|
|
28
|
+
conversationId: params.conversationId,
|
|
29
|
+
idx: params.finalIdx,
|
|
30
|
+
data: "",
|
|
31
|
+
isFinal: true
|
|
32
|
+
});
|
|
33
|
+
};
|
|
34
|
+
const getStreamChunks = (db) => async (params) => {
|
|
35
|
+
const conditions = scopeConditions(params);
|
|
36
|
+
if (params.afterIdx !== void 0) conditions.push(gt(streamChunks.idx, params.afterIdx));
|
|
37
|
+
return db.select({
|
|
38
|
+
idx: streamChunks.idx,
|
|
39
|
+
data: streamChunks.data,
|
|
40
|
+
isFinal: streamChunks.isFinal
|
|
41
|
+
}).from(streamChunks).where(and(...conditions)).orderBy(streamChunks.idx).limit(params.limit ?? DEFAULT_CHUNK_BATCH_LIMIT);
|
|
42
|
+
};
|
|
43
|
+
const deleteStreamChunks = (db) => async (params) => {
|
|
44
|
+
await db.delete(streamChunks).where(and(...scopeConditions(params)));
|
|
45
|
+
};
|
|
46
|
+
const cleanupExpiredStreamChunks = (db) => async (olderThanMinutes = DEFAULT_CLEANUP_AGE_MINUTES, batchSize = DEFAULT_CLEANUP_BATCH_SIZE) => {
|
|
47
|
+
const cutoff = sql`now() - make_interval(mins => ${olderThanMinutes})`;
|
|
48
|
+
let deleted;
|
|
49
|
+
do {
|
|
50
|
+
const batch = await db.select({
|
|
51
|
+
tenantId: streamChunks.tenantId,
|
|
52
|
+
projectId: streamChunks.projectId,
|
|
53
|
+
conversationId: streamChunks.conversationId,
|
|
54
|
+
idx: streamChunks.idx
|
|
55
|
+
}).from(streamChunks).where(sql`${streamChunks.createdAt} < ${cutoff}`).limit(batchSize);
|
|
56
|
+
deleted = batch.length;
|
|
57
|
+
if (deleted > 0) {
|
|
58
|
+
const pks = batch.map((row) => sql`(${row.tenantId}, ${row.projectId}, ${row.conversationId}, ${row.idx})`);
|
|
59
|
+
await db.delete(streamChunks).where(sql`(${streamChunks.tenantId}, ${streamChunks.projectId}, ${streamChunks.conversationId}, ${streamChunks.idx}) IN (${sql.join(pks, sql`, `)})`);
|
|
60
|
+
}
|
|
61
|
+
} while (deleted >= batchSize);
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
//#endregion
|
|
65
|
+
export { cleanupExpiredStreamChunks, deleteStreamChunks, getStreamChunks, insertStreamChunks, markStreamComplete };
|
|
@@ -7,6 +7,9 @@ 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
|
+
tenantId: string;
|
|
11
|
+
projectId: string;
|
|
12
|
+
status: string;
|
|
10
13
|
subAgentId: string;
|
|
11
14
|
id: string;
|
|
12
15
|
ref: {
|
|
@@ -16,10 +19,7 @@ declare const createTask: (db: AgentsRunDatabaseClient) => (params: TaskInsert)
|
|
|
16
19
|
} | null;
|
|
17
20
|
createdAt: string;
|
|
18
21
|
updatedAt: string;
|
|
19
|
-
projectId: string;
|
|
20
|
-
tenantId: string;
|
|
21
22
|
metadata: TaskMetadataConfig | null;
|
|
22
|
-
status: string;
|
|
23
23
|
agentId: string;
|
|
24
24
|
contextId: string;
|
|
25
25
|
}>;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import * as
|
|
1
|
+
import * as drizzle_orm_pg_core220 from "drizzle-orm/pg-core";
|
|
2
2
|
|
|
3
3
|
//#region src/db/manage/dolt-safe-jsonb.d.ts
|
|
4
4
|
declare function encodeBackslashes(value: unknown): unknown;
|
|
@@ -7,6 +7,6 @@ declare function decodeBackslashes(value: unknown): unknown;
|
|
|
7
7
|
* Drop-in replacement for drizzle-orm's `jsonb()`.
|
|
8
8
|
* Encodes backslashes on write and decodes on read to work around the Doltgres bug.
|
|
9
9
|
*/
|
|
10
|
-
declare function jsonb(name: string): ReturnType<typeof
|
|
10
|
+
declare function jsonb(name: string): ReturnType<typeof drizzle_orm_pg_core220.jsonb>;
|
|
11
11
|
//#endregion
|
|
12
12
|
export { decodeBackslashes, encodeBackslashes, jsonb };
|