@inkeep/agents-core 0.60.0 → 0.61.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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/init.js +42 -0
- package/dist/auth/permissions.d.ts +13 -13
- package/dist/auth/wait-for-spicedb.d.ts +1 -0
- package/dist/auth/wait-for-spicedb.js +51 -0
- package/dist/client-exports.d.ts +3 -106
- package/dist/client-exports.js +2 -60
- package/dist/data-access/index.d.ts +4 -3
- package/dist/data-access/index.js +4 -3
- package/dist/data-access/manage/agentFull.js +10 -5
- package/dist/data-access/manage/agents.d.ts +69 -63
- package/dist/data-access/manage/agents.js +2 -0
- package/dist/data-access/manage/artifactComponents.d.ts +16 -16
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/dataComponents.d.ts +6 -6
- package/dist/data-access/manage/functionTools.d.ts +14 -14
- package/dist/data-access/manage/projectFull.js +24 -3
- package/dist/data-access/manage/skills.d.ts +18 -18
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +21 -21
- package/dist/data-access/manage/subAgentRelations.d.ts +23 -23
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgents.d.ts +36 -36
- package/dist/data-access/manage/tools.d.ts +24 -24
- package/dist/data-access/runtime/apiKeys.d.ts +16 -16
- package/dist/data-access/runtime/apps.d.ts +56 -11
- package/dist/data-access/runtime/apps.js +15 -1
- package/dist/data-access/runtime/conversations.d.ts +25 -25
- package/dist/data-access/runtime/conversations.js +1 -0
- package/dist/data-access/runtime/ledgerArtifacts.d.ts +11 -2
- package/dist/data-access/runtime/ledgerArtifacts.js +12 -1
- package/dist/data-access/runtime/messages.d.ts +21 -21
- package/dist/data-access/runtime/tasks.d.ts +6 -6
- package/dist/data-access/runtime/workflowExecutions.d.ts +25 -0
- package/dist/data-access/runtime/workflowExecutions.js +32 -0
- package/dist/db/manage/manage-schema.d.ts +399 -379
- package/dist/db/manage/manage-schema.js +1 -0
- package/dist/db/runtime/runtime-schema.d.ts +516 -301
- package/dist/db/runtime/runtime-schema.js +16 -2
- package/dist/index.d.ts +10 -8
- package/dist/index.js +8 -6
- package/dist/types/entities.d.ts +5 -2
- package/dist/types/index.d.ts +3 -3
- package/dist/types/utility.d.ts +9 -3
- package/dist/utils/conversations.d.ts +4 -1
- package/dist/utils/conversations.js +10 -1
- package/dist/utils/index.d.ts +3 -2
- package/dist/utils/index.js +3 -2
- package/dist/utils/validate-public-key.d.ts +10 -0
- package/dist/utils/validate-public-key.js +89 -0
- package/dist/validation/agentFull.js +0 -1
- package/dist/validation/index.d.ts +2 -2
- package/dist/validation/index.js +2 -2
- package/dist/validation/schemas.d.ts +3264 -2504
- package/dist/validation/schemas.js +104 -36
- package/drizzle/manage/0013_gorgeous_umar.sql +1 -0
- package/drizzle/manage/meta/0013_snapshot.json +3704 -0
- package/drizzle/manage/meta/_journal.json +7 -0
- package/drizzle/runtime/0026_graceful_scorpion.sql +15 -0
- package/drizzle/runtime/meta/{0025_snapshot.json → 0026_snapshot.json} +114 -1
- package/drizzle/runtime/meta/_journal.json +7 -0
- package/package.json +1 -1
|
@@ -8,49 +8,49 @@ declare const getApiKeyById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
8
8
|
scopes: ProjectScopeConfig;
|
|
9
9
|
id: string;
|
|
10
10
|
}) => Promise<{
|
|
11
|
-
name: string | null;
|
|
12
|
-
tenantId: string;
|
|
13
|
-
projectId: string;
|
|
14
11
|
id: string;
|
|
12
|
+
name: string | null;
|
|
15
13
|
createdAt: string;
|
|
16
14
|
updatedAt: string;
|
|
15
|
+
expiresAt: string | null;
|
|
17
16
|
agentId: string;
|
|
17
|
+
projectId: string;
|
|
18
|
+
tenantId: 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
|
-
name: string | null;
|
|
26
|
-
tenantId: string;
|
|
27
|
-
projectId: string;
|
|
28
25
|
id: string;
|
|
26
|
+
name: string | null;
|
|
29
27
|
createdAt: string;
|
|
30
28
|
updatedAt: string;
|
|
29
|
+
expiresAt: string | null;
|
|
31
30
|
agentId: string;
|
|
31
|
+
projectId: string;
|
|
32
|
+
tenantId: 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
|
-
name: string | null;
|
|
43
|
-
tenantId: string;
|
|
44
|
-
projectId: string;
|
|
45
42
|
id: string;
|
|
43
|
+
name: string | null;
|
|
46
44
|
createdAt: string;
|
|
47
45
|
updatedAt: string;
|
|
46
|
+
expiresAt: string | null;
|
|
48
47
|
agentId: string;
|
|
48
|
+
projectId: string;
|
|
49
|
+
tenantId: 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;
|
|
@@ -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
|
-
name: string | null;
|
|
70
|
-
tenantId: string;
|
|
71
|
-
projectId: string;
|
|
72
69
|
id: string;
|
|
70
|
+
name: string | null;
|
|
73
71
|
createdAt: string;
|
|
74
72
|
updatedAt: string;
|
|
73
|
+
expiresAt: string | null;
|
|
75
74
|
agentId: string;
|
|
75
|
+
projectId: string;
|
|
76
|
+
tenantId: 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;
|
|
@@ -6,19 +6,30 @@ import { AppInsert, AppSelect, AppUpdate } from "../../types/entities.js";
|
|
|
6
6
|
//#region src/data-access/runtime/apps.d.ts
|
|
7
7
|
declare const getAppById: (db: AgentsRunDatabaseClient) => (id: string) => Promise<{
|
|
8
8
|
type: AppType;
|
|
9
|
-
description: string | null;
|
|
10
|
-
name: string;
|
|
11
|
-
tenantId: string | null;
|
|
12
|
-
projectId: string | null;
|
|
13
9
|
id: string;
|
|
10
|
+
name: string;
|
|
14
11
|
createdAt: string;
|
|
15
12
|
updatedAt: string;
|
|
16
|
-
|
|
13
|
+
description: string | null;
|
|
17
14
|
enabled: boolean;
|
|
15
|
+
projectId: string | null;
|
|
16
|
+
tenantId: string | null;
|
|
17
|
+
prompt: string | null;
|
|
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";
|
|
@@ -54,19 +65,30 @@ declare const listAppsPaginated: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
54
65
|
}>;
|
|
55
66
|
declare const createApp: (db: AgentsRunDatabaseClient) => (params: AppInsert) => Promise<{
|
|
56
67
|
type: AppType;
|
|
57
|
-
description: string | null;
|
|
58
|
-
name: string;
|
|
59
|
-
tenantId: string | null;
|
|
60
|
-
projectId: string | null;
|
|
61
68
|
id: string;
|
|
69
|
+
name: string;
|
|
62
70
|
createdAt: string;
|
|
63
71
|
updatedAt: string;
|
|
64
|
-
|
|
72
|
+
description: string | null;
|
|
65
73
|
enabled: boolean;
|
|
74
|
+
projectId: string | null;
|
|
75
|
+
tenantId: string | null;
|
|
76
|
+
prompt: string | null;
|
|
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;
|
|
22
18
|
id: string;
|
|
23
19
|
createdAt: string;
|
|
24
20
|
updatedAt: string;
|
|
25
|
-
metadata: ConversationMetadata | null;
|
|
26
|
-
agentId: string | null;
|
|
27
|
-
userId: string | null;
|
|
28
21
|
ref: {
|
|
29
22
|
type: "commit" | "tag" | "branch";
|
|
30
23
|
name: string;
|
|
31
24
|
hash: string;
|
|
32
25
|
} | null;
|
|
26
|
+
userId: string | null;
|
|
27
|
+
metadata: ConversationMetadata | null;
|
|
28
|
+
agentId: string | null;
|
|
29
|
+
projectId: string;
|
|
30
|
+
tenantId: string;
|
|
31
|
+
title: 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;
|
|
91
87
|
id: string;
|
|
92
88
|
createdAt: string;
|
|
93
89
|
updatedAt: string;
|
|
94
|
-
metadata: ConversationMetadata | null;
|
|
95
|
-
agentId: string | null;
|
|
96
|
-
userId: string | null;
|
|
97
90
|
ref: {
|
|
98
91
|
type: "commit" | "tag" | "branch";
|
|
99
92
|
name: string;
|
|
100
93
|
hash: string;
|
|
101
94
|
} | null;
|
|
95
|
+
userId: string | null;
|
|
96
|
+
metadata: ConversationMetadata | null;
|
|
97
|
+
agentId: string | null;
|
|
98
|
+
projectId: string;
|
|
99
|
+
tenantId: string;
|
|
100
|
+
title: 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;
|
|
127
123
|
id: string;
|
|
128
124
|
createdAt: string;
|
|
129
125
|
updatedAt: string;
|
|
130
|
-
metadata: ConversationMetadata | null;
|
|
131
|
-
agentId: string | null;
|
|
132
|
-
userId: string | null;
|
|
133
126
|
ref: {
|
|
134
127
|
type: "commit" | "tag" | "branch";
|
|
135
128
|
name: string;
|
|
136
129
|
hash: string;
|
|
137
130
|
} | null;
|
|
131
|
+
userId: string | null;
|
|
132
|
+
metadata: ConversationMetadata | null;
|
|
133
|
+
agentId: string | null;
|
|
134
|
+
projectId: string;
|
|
135
|
+
tenantId: string;
|
|
136
|
+
title: 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;
|
|
159
155
|
id: string;
|
|
160
156
|
createdAt: string;
|
|
161
157
|
updatedAt: string;
|
|
162
|
-
metadata: ConversationMetadata | null;
|
|
163
|
-
agentId: string | null;
|
|
164
|
-
userId: string | null;
|
|
165
158
|
ref: {
|
|
166
159
|
type: "commit" | "tag" | "branch";
|
|
167
160
|
name: string;
|
|
168
161
|
hash: string;
|
|
169
162
|
} | null;
|
|
163
|
+
userId: string | null;
|
|
164
|
+
metadata: ConversationMetadata | null;
|
|
165
|
+
agentId: string | null;
|
|
166
|
+
projectId: string;
|
|
167
|
+
tenantId: string;
|
|
168
|
+
title: 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,21 +10,21 @@ declare const getMessageById: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
10
10
|
scopes: ProjectScopeConfig;
|
|
11
11
|
messageId: string;
|
|
12
12
|
}) => Promise<{
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
id: string;
|
|
14
|
+
createdAt: string;
|
|
15
|
+
updatedAt: string;
|
|
16
|
+
metadata: MessageMetadata | null;
|
|
17
|
+
role: string;
|
|
15
18
|
projectId: string;
|
|
19
|
+
tenantId: string;
|
|
20
|
+
content: MessageContent;
|
|
16
21
|
fromSubAgentId: string | null;
|
|
17
22
|
toSubAgentId: string | null;
|
|
18
23
|
fromExternalAgentId: string | null;
|
|
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,21 +144,21 @@ declare const createMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
144
144
|
scopes: ProjectScopeConfig;
|
|
145
145
|
data: Omit<MessageInsert, "tenantId" | "projectId">;
|
|
146
146
|
}) => Promise<{
|
|
147
|
-
|
|
148
|
-
|
|
147
|
+
id: string;
|
|
148
|
+
createdAt: string;
|
|
149
|
+
updatedAt: string;
|
|
150
|
+
metadata: MessageMetadata | null;
|
|
151
|
+
role: string;
|
|
149
152
|
projectId: string;
|
|
153
|
+
tenantId: string;
|
|
154
|
+
content: MessageContent;
|
|
150
155
|
fromSubAgentId: string | null;
|
|
151
156
|
toSubAgentId: string | null;
|
|
152
157
|
fromExternalAgentId: string | null;
|
|
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,21 +197,21 @@ declare const deleteMessage: (db: AgentsRunDatabaseClient) => (params: {
|
|
|
197
197
|
scopes: ProjectScopeConfig;
|
|
198
198
|
messageId: string;
|
|
199
199
|
}) => Promise<{
|
|
200
|
-
|
|
201
|
-
|
|
200
|
+
id: string;
|
|
201
|
+
createdAt: string;
|
|
202
|
+
updatedAt: string;
|
|
203
|
+
metadata: MessageMetadata | null;
|
|
204
|
+
role: string;
|
|
202
205
|
projectId: string;
|
|
206
|
+
tenantId: string;
|
|
207
|
+
content: MessageContent;
|
|
203
208
|
fromSubAgentId: string | null;
|
|
204
209
|
toSubAgentId: string | null;
|
|
205
210
|
fromExternalAgentId: string | null;
|
|
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;
|
|
@@ -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;
|
|
14
10
|
id: string;
|
|
15
11
|
createdAt: string;
|
|
16
12
|
updatedAt: string;
|
|
17
|
-
metadata: TaskMetadataConfig | null;
|
|
18
|
-
agentId: string;
|
|
19
13
|
ref: {
|
|
20
14
|
type: "commit" | "tag" | "branch";
|
|
21
15
|
name: string;
|
|
22
16
|
hash: string;
|
|
23
17
|
} | null;
|
|
18
|
+
metadata: TaskMetadataConfig | null;
|
|
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,25 @@
|
|
|
1
|
+
import "../../types/index.js";
|
|
2
|
+
import { AgentsRunDatabaseClient } from "../../db/runtime/runtime-client.js";
|
|
3
|
+
import { WorkflowExecutionInsert, WorkflowExecutionSelect } from "../../types/entities.js";
|
|
4
|
+
|
|
5
|
+
//#region src/data-access/runtime/workflowExecutions.d.ts
|
|
6
|
+
declare const createWorkflowExecution: (db: AgentsRunDatabaseClient) => (params: WorkflowExecutionInsert) => Promise<WorkflowExecutionSelect>;
|
|
7
|
+
declare const getWorkflowExecution: (db: AgentsRunDatabaseClient) => (params: {
|
|
8
|
+
tenantId: string;
|
|
9
|
+
projectId: string;
|
|
10
|
+
id: string;
|
|
11
|
+
}) => Promise<WorkflowExecutionSelect | null>;
|
|
12
|
+
declare const getWorkflowExecutionByConversation: (db: AgentsRunDatabaseClient) => (params: {
|
|
13
|
+
tenantId: string;
|
|
14
|
+
projectId: string;
|
|
15
|
+
conversationId: string;
|
|
16
|
+
}) => Promise<WorkflowExecutionSelect | null>;
|
|
17
|
+
declare const updateWorkflowExecutionStatus: (db: AgentsRunDatabaseClient) => (params: {
|
|
18
|
+
tenantId: string;
|
|
19
|
+
projectId: string;
|
|
20
|
+
id: string;
|
|
21
|
+
status: "running" | "suspended" | "completed" | "failed";
|
|
22
|
+
metadata?: Record<string, unknown>;
|
|
23
|
+
}) => Promise<WorkflowExecutionSelect | null>;
|
|
24
|
+
//#endregion
|
|
25
|
+
export { createWorkflowExecution, getWorkflowExecution, getWorkflowExecutionByConversation, updateWorkflowExecutionStatus };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { workflowExecutions } from "../../db/runtime/runtime-schema.js";
|
|
2
|
+
import { and, desc, eq } from "drizzle-orm";
|
|
3
|
+
|
|
4
|
+
//#region src/data-access/runtime/workflowExecutions.ts
|
|
5
|
+
const createWorkflowExecution = (db) => async (params) => {
|
|
6
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
7
|
+
const [created] = await db.insert(workflowExecutions).values({
|
|
8
|
+
...params,
|
|
9
|
+
createdAt: now,
|
|
10
|
+
updatedAt: now
|
|
11
|
+
}).returning();
|
|
12
|
+
return created;
|
|
13
|
+
};
|
|
14
|
+
const getWorkflowExecution = (db) => async (params) => {
|
|
15
|
+
return (await db.select().from(workflowExecutions).where(and(eq(workflowExecutions.tenantId, params.tenantId), eq(workflowExecutions.projectId, params.projectId), eq(workflowExecutions.id, params.id))).limit(1))[0] ?? null;
|
|
16
|
+
};
|
|
17
|
+
const getWorkflowExecutionByConversation = (db) => async (params) => {
|
|
18
|
+
return (await db.select().from(workflowExecutions).where(and(eq(workflowExecutions.tenantId, params.tenantId), eq(workflowExecutions.projectId, params.projectId), eq(workflowExecutions.conversationId, params.conversationId))).orderBy(desc(workflowExecutions.createdAt)).limit(1))[0] ?? null;
|
|
19
|
+
};
|
|
20
|
+
const updateWorkflowExecutionStatus = (db) => async (params) => {
|
|
21
|
+
const now = (/* @__PURE__ */ new Date()).toISOString();
|
|
22
|
+
const updateData = {
|
|
23
|
+
status: params.status,
|
|
24
|
+
updatedAt: now
|
|
25
|
+
};
|
|
26
|
+
if (params.metadata !== void 0) updateData.metadata = params.metadata;
|
|
27
|
+
const [updated] = await db.update(workflowExecutions).set(updateData).where(and(eq(workflowExecutions.tenantId, params.tenantId), eq(workflowExecutions.projectId, params.projectId), eq(workflowExecutions.id, params.id))).returning();
|
|
28
|
+
return updated ?? null;
|
|
29
|
+
};
|
|
30
|
+
|
|
31
|
+
//#endregion
|
|
32
|
+
export { createWorkflowExecution, getWorkflowExecution, getWorkflowExecutionByConversation, updateWorkflowExecutionStatus };
|