@inkeep/agents-core 0.58.14 → 0.58.16
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 +85 -85
- package/dist/auth/auth-validation-schemas.d.ts +135 -135
- package/dist/auth/auth.js +17 -45
- package/dist/data-access/index.d.ts +5 -2
- package/dist/data-access/index.js +5 -2
- package/dist/data-access/manage/agentFull.js +28 -12
- package/dist/data-access/manage/agents.d.ts +35 -34
- package/dist/data-access/manage/agents.js +33 -33
- package/dist/data-access/manage/artifactComponents.d.ts +12 -12
- package/dist/data-access/manage/artifactComponents.js +14 -13
- package/dist/data-access/manage/audit-queries.js +6 -5
- package/dist/data-access/manage/contextConfigs.d.ts +12 -12
- package/dist/data-access/manage/contextConfigs.js +7 -6
- package/dist/data-access/manage/credentialReferences.js +12 -11
- package/dist/data-access/manage/dataComponents.d.ts +6 -6
- package/dist/data-access/manage/dataComponents.js +13 -11
- package/dist/data-access/manage/evalConfig.js +42 -41
- package/dist/data-access/manage/externalAgents.js +8 -7
- package/dist/data-access/manage/functionTools.d.ts +17 -21
- package/dist/data-access/manage/functionTools.js +27 -65
- package/dist/data-access/manage/functions.js +7 -10
- package/dist/data-access/manage/projects.js +37 -36
- package/dist/data-access/manage/scheduledTriggers.js +10 -6
- package/dist/data-access/manage/scheduledWorkflows.js +3 -2
- package/dist/data-access/manage/scope-helpers.d.ts +2 -1
- package/dist/data-access/manage/scope-helpers.js +2 -1
- package/dist/data-access/manage/skills.d.ts +14 -14
- package/dist/data-access/manage/skills.js +14 -9
- package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentRelations.d.ts +28 -28
- package/dist/data-access/manage/subAgentRelations.js +28 -26
- package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
- package/dist/data-access/manage/subAgentTeamAgentRelations.js +16 -16
- package/dist/data-access/manage/subAgents.d.ts +18 -18
- package/dist/data-access/manage/subAgents.js +8 -7
- package/dist/data-access/manage/tools.d.ts +24 -24
- package/dist/data-access/manage/tools.js +8 -6
- package/dist/data-access/manage/triggers.js +12 -8
- package/dist/data-access/runtime/apiKeys.d.ts +20 -20
- package/dist/data-access/runtime/apiKeys.js +16 -12
- package/dist/data-access/runtime/apps.d.ts +10 -10
- package/dist/data-access/runtime/apps.js +8 -7
- package/dist/data-access/runtime/audit-queries.js +7 -7
- package/dist/data-access/runtime/auth.d.ts +18 -0
- package/dist/data-access/runtime/auth.js +35 -0
- package/dist/data-access/runtime/cascade-delete.js +29 -24
- package/dist/data-access/runtime/contextCache.d.ts +1 -0
- package/dist/data-access/runtime/contextCache.js +9 -8
- package/dist/data-access/runtime/conversations.d.ts +27 -27
- package/dist/data-access/runtime/conversations.js +8 -12
- package/dist/data-access/runtime/evalRuns.js +23 -22
- package/dist/data-access/runtime/github-work-app-installations.js +32 -21
- package/dist/data-access/runtime/ledgerArtifacts.js +9 -24
- package/dist/data-access/runtime/messages.d.ts +24 -19
- package/dist/data-access/runtime/messages.js +15 -9
- package/dist/data-access/runtime/projects.js +6 -5
- package/dist/data-access/runtime/scheduledTriggerInvocations.js +16 -26
- package/dist/data-access/runtime/slack-work-app-mcp.js +6 -5
- package/dist/data-access/runtime/tasks.d.ts +10 -6
- package/dist/data-access/runtime/tasks.js +4 -5
- package/dist/data-access/runtime/triggerInvocations.js +4 -8
- package/dist/data-access/runtime/workAppSlack.js +21 -14
- package/dist/db/manage/manage-schema.d.ts +357 -357
- package/dist/db/runtime/runtime-schema.d.ts +300 -300
- package/dist/index.d.ts +7 -3
- package/dist/index.js +8 -2
- package/dist/retry/index.d.ts +3 -0
- package/dist/retry/index.js +4 -0
- package/dist/retry/retryable-errors.d.ts +10 -0
- package/dist/retry/retryable-errors.js +72 -0
- package/dist/retry/withRetry.d.ts +15 -0
- package/dist/retry/withRetry.js +37 -0
- package/dist/validation/dolt-schemas.d.ts +1 -1
- package/dist/validation/schemas.d.ts +1704 -1704
- package/package.json +1 -1
package/dist/auth/auth.js
CHANGED
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
import { account, member, ssoProvider } from "./auth-schema.js";
|
|
2
1
|
import { OrgRoles } from "./authz/types.js";
|
|
3
2
|
import { env } from "../env.js";
|
|
4
3
|
import { setEmailSendStatus } from "./email-send-status-store.js";
|
|
5
4
|
import { setPasswordResetLink } from "./password-reset-link-store.js";
|
|
6
|
-
import {
|
|
7
|
-
import "../utils/index.js";
|
|
5
|
+
import { getInitialOrganization, queryHasCredentialAccount, registerSSOProvider as registerSSOProvider$1 } from "../data-access/runtime/auth.js";
|
|
8
6
|
import { createUserProfileIfNotExists } from "../data-access/runtime/userProfiles.js";
|
|
9
7
|
import { ac, adminRole, memberRole, ownerRole } from "./permissions.js";
|
|
10
|
-
import { and, eq } from "drizzle-orm";
|
|
11
8
|
import { betterAuth } from "better-auth";
|
|
12
9
|
import { sso } from "@better-auth/sso";
|
|
13
10
|
import { drizzleAdapter } from "better-auth/adapters/drizzle";
|
|
@@ -15,15 +12,6 @@ import { bearer, deviceAuthorization, oAuthProxy, organization } from "better-au
|
|
|
15
12
|
|
|
16
13
|
//#region src/auth/auth.ts
|
|
17
14
|
/**
|
|
18
|
-
* Get the user's initial organization for a new session.
|
|
19
|
-
* Returns the oldest organization the user is a member of.
|
|
20
|
-
* See: https://www.better-auth.com/docs/plugins/organization#active-organization
|
|
21
|
-
*/
|
|
22
|
-
async function getInitialOrganization(dbClient, userId) {
|
|
23
|
-
const [membership] = await dbClient.select({ organizationId: member.organizationId }).from(member).where(eq(member.userId, userId)).orderBy(member.createdAt).limit(1);
|
|
24
|
-
return membership ? { id: membership.organizationId } : null;
|
|
25
|
-
}
|
|
26
|
-
/**
|
|
27
15
|
* Extracts the root domain from a URL for cross-subdomain cookie sharing.
|
|
28
16
|
*
|
|
29
17
|
* When the API and UI share a common 3-part parent (e.g., api.pilot.inkeep.com
|
|
@@ -56,26 +44,10 @@ function extractCookieDomain(baseURL, explicitDomain) {
|
|
|
56
44
|
}
|
|
57
45
|
}
|
|
58
46
|
async function registerSSOProvider(dbClient, provider) {
|
|
59
|
-
|
|
60
|
-
if ((await dbClient.select().from(ssoProvider).where(eq(ssoProvider.providerId, provider.providerId)).limit(1)).length > 0) return;
|
|
61
|
-
if (!provider.domain) throw new Error(`SSO provider '${provider.providerId}' must have a domain`);
|
|
62
|
-
await dbClient.insert(ssoProvider).values({
|
|
63
|
-
id: generateId$1(),
|
|
64
|
-
providerId: provider.providerId,
|
|
65
|
-
issuer: provider.issuer,
|
|
66
|
-
domain: provider.domain,
|
|
67
|
-
oidcConfig: provider.oidcConfig ? JSON.stringify(provider.oidcConfig) : null,
|
|
68
|
-
samlConfig: provider.samlConfig ? JSON.stringify(provider.samlConfig) : null,
|
|
69
|
-
userId: null,
|
|
70
|
-
organizationId: provider.organizationId || null
|
|
71
|
-
});
|
|
72
|
-
} catch (error) {
|
|
73
|
-
console.error(`❌ Failed to register SSO provider '${provider.providerId}':`, error);
|
|
74
|
-
}
|
|
47
|
+
await registerSSOProvider$1(dbClient)(provider);
|
|
75
48
|
}
|
|
76
49
|
async function hasCredentialAccount(dbClient, userId) {
|
|
77
|
-
|
|
78
|
-
return !!row;
|
|
50
|
+
return queryHasCredentialAccount(dbClient)(userId);
|
|
79
51
|
}
|
|
80
52
|
function createAuth(config) {
|
|
81
53
|
const cookieDomain = extractCookieDomain(config.baseURL, config.cookieDomain);
|
|
@@ -117,7 +89,7 @@ function createAuth(config) {
|
|
|
117
89
|
]
|
|
118
90
|
} },
|
|
119
91
|
databaseHooks: { session: { create: { before: async (session) => {
|
|
120
|
-
const organization$1 = await getInitialOrganization(config.dbClient
|
|
92
|
+
const organization$1 = await getInitialOrganization(config.dbClient)(session.userId);
|
|
121
93
|
return { data: {
|
|
122
94
|
...session,
|
|
123
95
|
activeOrganizationId: organization$1?.id ?? null
|
|
@@ -233,16 +205,16 @@ function createAuth(config) {
|
|
|
233
205
|
} }
|
|
234
206
|
},
|
|
235
207
|
organizationHooks: {
|
|
236
|
-
afterAcceptInvitation: async ({ member
|
|
208
|
+
afterAcceptInvitation: async ({ member, user, organization: org }) => {
|
|
237
209
|
try {
|
|
238
210
|
const { syncOrgMemberToSpiceDb } = await import("./authz/sync.js");
|
|
239
211
|
await syncOrgMemberToSpiceDb({
|
|
240
212
|
tenantId: org.id,
|
|
241
213
|
userId: user.id,
|
|
242
|
-
role: member
|
|
214
|
+
role: member.role,
|
|
243
215
|
action: "add"
|
|
244
216
|
});
|
|
245
|
-
console.log(`🔐 SpiceDB: Synced member ${user.email} as ${member
|
|
217
|
+
console.log(`🔐 SpiceDB: Synced member ${user.email} as ${member.role} to org ${org.name}`);
|
|
246
218
|
} catch (error) {
|
|
247
219
|
console.error("❌ SpiceDB sync failed for new member:", error);
|
|
248
220
|
}
|
|
@@ -252,32 +224,32 @@ function createAuth(config) {
|
|
|
252
224
|
console.error("[auth] Failed to create user profile for user", user.id, error);
|
|
253
225
|
}
|
|
254
226
|
},
|
|
255
|
-
beforeUpdateMemberRole: async ({ member
|
|
227
|
+
beforeUpdateMemberRole: async ({ member, organization: org, newRole }) => {
|
|
256
228
|
const { changeOrgRole, revokeAllProjectMemberships } = await import("./authz/sync.js");
|
|
257
|
-
const oldRole = member
|
|
229
|
+
const oldRole = member.role;
|
|
258
230
|
const targetRole = newRole;
|
|
259
231
|
await changeOrgRole({
|
|
260
232
|
tenantId: org.id,
|
|
261
|
-
userId: member
|
|
233
|
+
userId: member.userId,
|
|
262
234
|
oldRole,
|
|
263
235
|
newRole: targetRole
|
|
264
236
|
});
|
|
265
|
-
console.log(`🔐 SpiceDB: Updated member ${member
|
|
237
|
+
console.log(`🔐 SpiceDB: Updated member ${member.userId} role from ${oldRole} to ${targetRole} in org ${org.name}`);
|
|
266
238
|
if (oldRole === OrgRoles.MEMBER && (targetRole === OrgRoles.ADMIN || targetRole === OrgRoles.OWNER)) {
|
|
267
239
|
await revokeAllProjectMemberships({
|
|
268
240
|
tenantId: org.id,
|
|
269
|
-
userId: member
|
|
241
|
+
userId: member.userId
|
|
270
242
|
});
|
|
271
|
-
console.log(`🔐 SpiceDB: Revoked all project memberships for ${member
|
|
243
|
+
console.log(`🔐 SpiceDB: Revoked all project memberships for ${member.userId} (promoted to ${targetRole})`);
|
|
272
244
|
}
|
|
273
245
|
},
|
|
274
|
-
beforeRemoveMember: async ({ member
|
|
246
|
+
beforeRemoveMember: async ({ member, organization: org }) => {
|
|
275
247
|
try {
|
|
276
248
|
if (config.manageDbPool) {
|
|
277
249
|
const { cleanupUserTriggers } = await import("../data-access/manage/triggerCleanup.js");
|
|
278
250
|
await cleanupUserTriggers({
|
|
279
251
|
tenantId: org.id,
|
|
280
|
-
userId: member
|
|
252
|
+
userId: member.userId,
|
|
281
253
|
runDb: config.dbClient,
|
|
282
254
|
manageDbPool: config.manageDbPool
|
|
283
255
|
});
|
|
@@ -285,9 +257,9 @@ function createAuth(config) {
|
|
|
285
257
|
const { revokeAllUserRelationships } = await import("./authz/sync.js");
|
|
286
258
|
await revokeAllUserRelationships({
|
|
287
259
|
tenantId: org.id,
|
|
288
|
-
userId: member
|
|
260
|
+
userId: member.userId
|
|
289
261
|
});
|
|
290
|
-
console.log(`🔐 Preparing to remove member ${member
|
|
262
|
+
console.log(`🔐 Preparing to remove member ${member.userId} - cleaned up triggers and revoked all relationships in org ${org.name}`);
|
|
291
263
|
} catch (error) {
|
|
292
264
|
console.error("❌ Cleanup failed before member removal:", error);
|
|
293
265
|
throw new Error(`Failed to clean up user data: ${error instanceof Error ? error.message : "Unknown error"}`);
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { AgentScopeConfig, ProjectScopeConfig, SCOPE_KEYS, ScopeConfig, ScopeKeysOf, ScopeLevel, ScopedTable, SubAgentScopeConfig, TenantScopeConfig, ToolScopeConfig } from "../db/manage/scope-definitions.js";
|
|
1
2
|
import { AgentsManageDatabaseClient, AgentsManageDatabaseConfig, createAgentManageDatabaseConnection, createAgentsManageDatabaseClient, createAgentsManageDatabasePool } from "../db/manage/manage-client.js";
|
|
2
3
|
import { AgentsRunDatabaseClient, AgentsRunDatabaseConfig, createAgentsRunDatabaseClient } from "../db/runtime/runtime-client.js";
|
|
3
4
|
import { AgentLogger, createFullAgentServerSide, deleteFullAgent, getFullAgent, getFullAgentWithRelationIds, updateFullAgentServerSide } from "./manage/agentFull.js";
|
|
@@ -16,6 +17,7 @@ import { CreateProjectWithBranchParams, CreateProjectWithBranchResult, DeletePro
|
|
|
16
17
|
import { countProjects, createProject, deleteProject, getProject, getProjectResourceCounts, listProjects, listProjectsPaginated, projectExists, projectExistsInTable, projectHasResources, updateProject } from "./manage/projects.js";
|
|
17
18
|
import { createScheduledTrigger, deleteScheduledTrigger, deleteScheduledTriggersByRunAsUserId, getScheduledTriggerById, listScheduledTriggers, listScheduledTriggersPaginated, updateScheduledTrigger, upsertScheduledTrigger } from "./manage/scheduledTriggers.js";
|
|
18
19
|
import { createScheduledWorkflow, getScheduledWorkflowByTriggerId, updateScheduledWorkflowRunId } from "./manage/scheduledWorkflows.js";
|
|
20
|
+
import { agentScopedWhere, projectScopedWhere, scopedWhere, subAgentScopedWhere, tenantScopedWhere, toolScopedWhere } from "./manage/scope-helpers.js";
|
|
19
21
|
import { createSkill, deleteSkill, deleteSubAgentSkill, getSkillById, getSkillsForSubAgents, listSkills, updateSkill, upsertSkill, upsertSubAgentSkill } from "./manage/skills.js";
|
|
20
22
|
import { createSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, getExternalAgentsForSubAgent, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentsForExternalAgent, listSubAgentExternalAgentRelations, updateSubAgentExternalAgentRelation, upsertSubAgentExternalAgentRelation } from "./manage/subAgentExternalAgentRelations.js";
|
|
21
23
|
import { createAgentToolRelation, createSubAgentRelation, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteSubAgentRelation, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentsForTool, getRelatedAgentsForAgent, getSubAgentRelationsByTarget, getToolsForAgent, listAgentRelations, listAgentToolRelations, updateAgentRelation, updateAgentToolRelation, upsertSubAgentRelation, validateSubAgent } from "./manage/subAgentRelations.js";
|
|
@@ -26,13 +28,14 @@ import { createTrigger, deleteTrigger, deleteTriggersByRunAsUserId, getTriggerBy
|
|
|
26
28
|
import { countApiKeys, createApiKey, deleteApiKey, generateAndCreateApiKey, getApiKeyById, getApiKeyByPublicId, hasApiKey, listApiKeys, listApiKeysPaginated, updateApiKey, updateApiKeyLastUsed, validateAndGetApiKey } from "./runtime/apiKeys.js";
|
|
27
29
|
import { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForTenant, deleteAppsByProject, getAppById, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppForTenant, updateAppLastUsed } from "./runtime/apps.js";
|
|
28
30
|
import { listApiKeysByProject, listContextCacheByProject, listGitHubToolAccessByProject, listGitHubToolAccessModeByProject, listSlackChannelAgentConfigsByProject, listSlackToolAccessConfigByProject } from "./runtime/audit-queries.js";
|
|
31
|
+
import { SSOProviderRegistration, getInitialOrganization, queryHasCredentialAccount, registerSSOProvider } from "./runtime/auth.js";
|
|
29
32
|
import { CascadeDeleteResult, ProjectGitHubAccessCascadeDeleteResult, ToolCascadeDeleteResult, cascadeDeleteByAgent, cascadeDeleteByBranch, cascadeDeleteByContextConfig, cascadeDeleteByProject, cascadeDeleteBySubAgent, cascadeDeleteByTool, cascadeDeleteGitHubAccessByProject } from "./runtime/cascade-delete.js";
|
|
30
33
|
import { cleanupTenantCache, clearContextConfigCache, clearConversationCache, getCacheEntry, getContextConfigCacheEntries, getConversationCacheEntries, invalidateHeadersCache, invalidateInvocationDefinitionsCache, setCacheEntry } from "./runtime/contextCache.js";
|
|
31
34
|
import { createConversation, createOrGetConversation, deleteConversation, getActiveAgentForConversation, getConversation, getConversationHistory, listConversations, setActiveAgentForConversation, setActiveAgentForThread, updateConversation, updateConversationActiveSubAgent } from "./runtime/conversations.js";
|
|
32
35
|
import { createDatasetRun, createDatasetRunConversationRelation, createDatasetRunConversationRelations, createEvaluationResult, createEvaluationResults, createEvaluationRun, deleteDatasetRun, deleteDatasetRunConversationRelation, deleteDatasetRunConversationRelationsByRun, deleteEvaluationResult, deleteEvaluationResultsByRun, deleteEvaluationRun, filterConversationsForJob, getDatasetRunById, getDatasetRunConversationRelationByConversation, getDatasetRunConversationRelations, getEvaluationResultById, getEvaluationRunById, getEvaluationRunByJobConfigId, listDatasetRuns, listDatasetRunsByConfig, listEvaluationResults, listEvaluationResultsByConversation, listEvaluationResultsByRun, listEvaluationRuns, listEvaluationRunsByJobConfigId, updateEvaluationResult, updateEvaluationRun } from "./runtime/evalRuns.js";
|
|
33
36
|
import { WorkAppGitHubAccessMode, addRepositories, checkProjectRepositoryAccess, clearMcpToolRepositoryAccess, clearProjectRepositoryAccess, createInstallation, deleteInstallation, deleteMcpToolAccessMode, deleteProjectAccessMode, disconnectInstallation, getInstallationByGitHubId, getInstallationById, getInstallationsByTenantId, getMcpToolAccessMode, getMcpToolRepositoryAccess, getMcpToolRepositoryAccessWithDetails, getProjectAccessMode, getProjectRepositoryAccess, getProjectRepositoryAccessWithDetails, getRepositoriesByInstallationId, getRepositoriesByTenantId, getRepositoryByFullName, getRepositoryById, getRepositoryCount, getRepositoryCountsByTenantId, isGithubWorkAppTool, removeRepositories, setMcpToolAccessMode, setMcpToolRepositoryAccess, setProjectAccessMode, setProjectRepositoryAccess, syncRepositories, updateInstallationStatus, updateInstallationStatusByGitHubId, validateRepositoryOwnership } from "./runtime/github-work-app-installations.js";
|
|
34
37
|
import { addLedgerArtifacts, countLedgerArtifactsByTask, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, getLedgerArtifacts, getLedgerArtifactsByContext, upsertLedgerArtifact } from "./runtime/ledgerArtifacts.js";
|
|
35
|
-
import { countMessagesByConversation, createMessage, deleteMessage, getMessageById, getMessagesByConversation, getMessagesByTask, getVisibleMessages, listMessages, updateMessage } from "./runtime/messages.js";
|
|
38
|
+
import { countMessagesByConversation, countVisibleMessages, createMessage, deleteMessage, getMessageById, getMessagesByConversation, getMessagesByTask, getVisibleMessages, listMessages, updateMessage } from "./runtime/messages.js";
|
|
36
39
|
import { UserProviderInfo, addUserToOrganization, createInvitationInDb, getPendingInvitationsByEmail, getUserOrganizationsFromDb, getUserProvidersFromDb, upsertOrganization } from "./runtime/organizations.js";
|
|
37
40
|
import { ProjectMetadataPaginatedResult, countProjectsInRuntime, createProjectMetadata, deleteProjectMetadata, getProjectMetadata, listProjectsMetadata, listProjectsMetadataPaginated, projectsMetadataExists } from "./runtime/projects.js";
|
|
38
41
|
import { addConversationIdToInvocation, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, createScheduledTriggerInvocation, deletePendingInvocationsForTrigger, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerRunInfoBatch, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listScheduledTriggerInvocationsPaginated, listUpcomingInvocationsForAgentPaginated, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, updateScheduledTriggerInvocationStatus } from "./runtime/scheduledTriggerInvocations.js";
|
|
@@ -43,4 +46,4 @@ import { UpsertUserProfileData, UserProfile, createUserProfileIfNotExists, getUs
|
|
|
43
46
|
import { getOrganizationMemberByEmail, getOrganizationMemberByUserId, getUserByEmail, getUserById } from "./runtime/users.js";
|
|
44
47
|
import { WorkAppSlackChannelAgentConfigInsert, WorkAppSlackChannelAgentConfigSelect, WorkAppSlackUserMappingInsert, WorkAppSlackUserMappingSelect, WorkAppSlackWorkspaceInsert, WorkAppSlackWorkspaceSelect, clearDevConfigWorkspaceDefaultsByAgent, clearDevConfigWorkspaceDefaultsByProject, clearWorkspaceDefaultsByAgent, clearWorkspaceDefaultsByProject, createWorkAppSlackChannelAgentConfig, createWorkAppSlackUserMapping, createWorkAppSlackWorkspace, deleteAllWorkAppSlackChannelAgentConfigsByTeam, deleteAllWorkAppSlackUserMappingsByTeam, deleteWorkAppSlackChannelAgentConfig, deleteWorkAppSlackChannelAgentConfigsByAgent, deleteWorkAppSlackChannelAgentConfigsByProject, deleteWorkAppSlackUserMapping, deleteWorkAppSlackWorkspace, deleteWorkAppSlackWorkspaceByNangoConnectionId, findWorkAppSlackChannelAgentConfig, findWorkAppSlackUserMapping, findWorkAppSlackUserMappingByInkeepUserId, findWorkAppSlackUserMappingBySlackUser, findWorkAppSlackWorkspaceByNangoConnectionId, findWorkAppSlackWorkspaceBySlackTeamId, findWorkAppSlackWorkspaceByTeamId, listWorkAppSlackChannelAgentConfigsByTeam, listWorkAppSlackUserMappingsByTeam, listWorkAppSlackWorkspacesByTenant, updateWorkAppSlackWorkspace, upsertWorkAppSlackChannelAgentConfig } from "./runtime/workAppSlack.js";
|
|
45
48
|
import { createValidatedDataAccess, validateProjectExists, withProjectValidation } from "./validation.js";
|
|
46
|
-
export { AgentLogger, AgentsManageDatabaseClient, AgentsManageDatabaseConfig, AgentsRunDatabaseClient, AgentsRunDatabaseConfig, AvailableAgentInfo, CascadeDeleteResult, CreateProjectWithBranchParams, CreateProjectWithBranchResult, CredentialReferenceWithResources, DeleteProjectWithBranchParams, ListProjectsWithMetadataResult, ProjectConfigMetadata, ProjectGitHubAccessCascadeDeleteResult, ProjectLogger, ProjectMetadataPaginatedResult, ProjectWithMetadata, SlackMcpToolAccessConfig, SubAgentIsDefaultError, ToolCascadeDeleteResult, UpsertUserProfileData, UserProfile, UserProviderInfo, WorkAppGitHubAccessMode, WorkAppSlackChannelAgentConfigInsert, WorkAppSlackChannelAgentConfigSelect, WorkAppSlackUserMappingInsert, WorkAppSlackUserMappingSelect, WorkAppSlackWorkspaceInsert, WorkAppSlackWorkspaceSelect, addConversationIdToInvocation, addFunctionToolToSubAgent, addLedgerArtifacts, addRepositories, addToolToAgent, addUserToOrganization, agentHasArtifactComponents, associateArtifactComponentWithAgent, associateDataComponentWithAgent, associateFunctionToolWithSubAgent, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, cascadeDeleteByAgent, cascadeDeleteByBranch, cascadeDeleteByContextConfig, cascadeDeleteByProject, cascadeDeleteBySubAgent, cascadeDeleteByTool, cascadeDeleteGitHubAccessByProject, checkProjectRepositoryAccess, cleanupTenantCache, clearAppDefaultsByAgent, clearAppDefaultsByProject, clearContextConfigCache, clearConversationCache, clearDevConfigWorkspaceDefaultsByAgent, clearDevConfigWorkspaceDefaultsByProject, clearMcpToolRepositoryAccess, clearProjectRepositoryAccess, clearWorkspaceDefaultsByAgent, clearWorkspaceDefaultsByProject, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, countProjectsInRuntime, createAgent, createAgentManageDatabaseConnection, createAgentToolRelation, createAgentsManageDatabaseClient, createAgentsManageDatabasePool, createAgentsRunDatabaseClient, createApiKey, createApp, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDataset, createDatasetItem, createDatasetItems, createDatasetRun, createDatasetRunConfig, createDatasetRunConfigAgentRelation, createDatasetRunConversationRelation, createDatasetRunConversationRelations, createEvaluationJobConfig, createEvaluationJobConfigEvaluatorRelation, createEvaluationResult, createEvaluationResults, createEvaluationRun, createEvaluationRunConfig, createEvaluationRunConfigEvaluationSuiteConfigRelation, createEvaluationSuiteConfig, createEvaluationSuiteConfigEvaluatorRelation, createEvaluator, createExternalAgent, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createInstallation, createInvitationInDb, createMessage, createOrGetConversation, createProject, createProjectMetadata, createProjectMetadataAndBranch, createScheduledTrigger, createScheduledTriggerInvocation, createScheduledWorkflow, createSkill, createSubAgent, createSubAgentExternalAgentRelation, createSubAgentRelation, createSubAgentTeamAgentRelation, createTask, createTool, createTrigger, createTriggerInvocation, createUserProfileIfNotExists, createValidatedDataAccess, createWorkAppSlackChannelAgentConfig, createWorkAppSlackUserMapping, createWorkAppSlackWorkspace, dbResultToMcpTool, dbResultToMcpToolSkeleton, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteAllSlackMcpToolAccessConfigsByTenant, deleteAllWorkAppSlackChannelAgentConfigsByTeam, deleteAllWorkAppSlackUserMappingsByTeam, deleteApiKey, deleteApp, deleteAppForTenant, deleteAppsByProject, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteDataset, deleteDatasetItem, deleteDatasetItemsByDataset, deleteDatasetRun, deleteDatasetRunConfig, deleteDatasetRunConfigAgentRelation, deleteDatasetRunConversationRelation, deleteDatasetRunConversationRelationsByRun, deleteEvaluationJobConfig, deleteEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfigEvaluatorRelationsByEvaluator, deleteEvaluationResult, deleteEvaluationResultsByRun, deleteEvaluationRun, deleteEvaluationRunConfig, deleteEvaluationRunConfigEvaluationSuiteConfigRelation, deleteEvaluationSuiteConfig, deleteEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfigEvaluatorRelationsByEvaluator, deleteEvaluator, deleteExternalAgent, deleteFullAgent, deleteFullProject, deleteFunction, deleteFunctionTool, deleteInstallation, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMcpToolAccessMode, deleteMessage, deletePendingInvocationsForTrigger, deleteProject, deleteProjectAccessMode, deleteProjectMetadata, deleteProjectWithBranch, deleteScheduledTrigger, deleteScheduledTriggersByRunAsUserId, deleteSkill, deleteSlackMcpToolAccessConfig, deleteSubAgent, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, deleteSubAgentRelation, deleteSubAgentSkill, deleteSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelationsByAgent, deleteSubAgentTeamAgentRelationsBySubAgent, deleteTool, deleteTrigger, deleteTriggersByRunAsUserId, deleteWorkAppSlackChannelAgentConfig, deleteWorkAppSlackChannelAgentConfigsByAgent, deleteWorkAppSlackChannelAgentConfigsByProject, deleteWorkAppSlackUserMapping, deleteWorkAppSlackWorkspace, deleteWorkAppSlackWorkspaceByNangoConnectionId, disconnectInstallation, externalAgentExists, externalAgentUrlExists, fetchComponentRelationships, filterConversationsForJob, findWorkAppSlackChannelAgentConfig, findWorkAppSlackUserMapping, findWorkAppSlackUserMappingByInkeepUserId, findWorkAppSlackUserMappingBySlackUser, findWorkAppSlackWorkspaceByNangoConnectionId, findWorkAppSlackWorkspaceBySlackTeamId, findWorkAppSlackWorkspaceByTeamId, generateAndCreateApiKey, getActiveAgentForConversation, getAgentById, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentSubAgentInfos, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentWithDefaultSubAgent, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getAppById, getAppByIdForTenant, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getContextConfigById, getContextConfigCacheEntries, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getDataComponent, getDataComponentsForAgent, getDatasetById, getDatasetItemById, getDatasetRunById, getDatasetRunConfigAgentRelations, getDatasetRunConfigById, getDatasetRunConversationRelationByConversation, getDatasetRunConversationRelations, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluationResultById, getEvaluationRunById, getEvaluationRunByJobConfigId, getEvaluationRunConfigById, getEvaluationRunConfigEvaluationSuiteConfigRelations, getEvaluationSuiteConfigById, getEvaluationSuiteConfigEvaluatorRelations, getEvaluatorById, getEvaluatorsByIds, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFullAgent, getFullAgentDefinition, getFullAgentDefinitionWithRelationIds, getFullAgentWithRelationIds, getFullProject, getFullProjectWithRelationIds, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getInstallationByGitHubId, getInstallationById, getInstallationsByTenantId, getLedgerArtifacts, getLedgerArtifactsByContext, getMcpToolAccessMode, getMcpToolById, getMcpToolRepositoryAccess, getMcpToolRepositoryAccessWithDetails, getMessageById, getMessagesByConversation, getMessagesByTask, getOrganizationMemberByEmail, getOrganizationMemberByUserId, getPendingInvitationsByEmail, getProject, getProjectAccessMode, getProjectMainBranchName, getProjectMetadata, getProjectRepositoryAccess, getProjectRepositoryAccessWithDetails, getProjectResourceCounts, getProjectWithBranchInfo, getProjectWithMetadata, getRelatedAgentsForAgent, getRepositoriesByInstallationId, getRepositoriesByTenantId, getRepositoryByFullName, getRepositoryById, getRepositoryCount, getRepositoryCountsByTenantId, getScheduledTriggerById, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerRunInfoBatch, getScheduledWorkflowByTriggerId, getSkillById, getSkillsForSubAgents, getSlackMcpToolAccessConfig, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getSubAgentsUsingFunctionTool, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getTriggerById, getTriggerInvocationById, getUserByEmail, getUserById, getUserOrganizationsFromDb, getUserProfile, getUserProvidersFromDb, getUserScopedCredentialReference, getVisibleMessages, hasApiKey, hasContextConfig, hasCredentialReference, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isFunctionToolAssociatedWithSubAgent, isGithubWorkAppTool, isSlackWorkAppTool, linkDatasetRunToEvaluationJobConfig, listAgentIdsByProject, listAgentRelations, listAgentToolRelations, listAgents, listAgentsAcrossProjectMainBranches, listAgentsPaginated, listApiKeys, listApiKeysByProject, listApiKeysPaginated, listAppsPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextCacheByProject, listContextConfigIdsByProject, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listDatasetItems, listDatasetRunConfigs, listDatasetRuns, listDatasetRunsByConfig, listDatasets, listEnabledScheduledTriggers, listEvaluationJobConfigs, listEvaluationResults, listEvaluationResultsByConversation, listEvaluationResultsByRun, listEvaluationRunConfigs, listEvaluationRunConfigsWithSuiteConfigs, listEvaluationRuns, listEvaluationRunsByJobConfigId, listEvaluationSuiteConfigs, listEvaluators, listExternalAgents, listExternalAgentsPaginated, listFunctionTools, listFunctions, listFunctionsPaginated, listGitHubToolAccessByProject, listGitHubToolAccessModeByProject, listMessages, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listProjects, listProjectsMetadata, listProjectsMetadataPaginated, listProjectsPaginated, listProjectsWithMetadataPaginated, listScheduledTriggerInvocationsPaginated, listScheduledTriggers, listScheduledTriggersPaginated, listScheduledWorkflowsByProject, listSkills, listSlackChannelAgentConfigsByProject, listSlackToolAccessConfigByProject, listSubAgentExternalAgentRelations, listSubAgentTeamAgentRelations, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listToolIdsByProject, listTools, listTriggerInvocationsPaginated, listTriggers, listTriggersPaginated, listUpcomingInvocationsForAgentPaginated, listWorkAppSlackChannelAgentConfigsByTeam, listWorkAppSlackUserMappingsByTeam, listWorkAppSlackWorkspacesByTenant, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, projectExists, projectExistsInTable, projectHasResources, projectsMetadataExists, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeFunctionToolFromSubAgent, removeRepositories, removeToolFromAgent, resolveSlackUserContext, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setMcpToolAccessMode, setMcpToolRepositoryAccess, setProjectAccessMode, setProjectRepositoryAccess, setSlackMcpToolAccessConfig, syncRepositories, updateAgent, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateApp, updateAppForTenant, updateAppLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveSubAgent, updateCredentialReference, updateDataComponent, updateDataset, updateDatasetItem, updateDatasetRunConfig, updateEvaluationResult, updateEvaluationRun, updateEvaluationRunConfig, updateEvaluationSuiteConfig, updateEvaluator, updateExternalAgent, updateFullAgentServerSide, updateFullProjectServerSide, updateFunctionTool, updateInstallationStatus, updateInstallationStatusByGitHubId, updateMessage, updateProject, updateScheduledTrigger, updateScheduledTriggerInvocationStatus, updateScheduledWorkflowRunId, updateSkill, updateSlackMcpToolAccessChannelIds, updateSubAgent, updateSubAgentExternalAgentRelation, updateSubAgentFunctionToolRelation, updateSubAgentTeamAgentRelation, updateTask, updateTool, updateTrigger, updateTriggerInvocationStatus, updateWorkAppSlackWorkspace, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertOrganization, upsertScheduledTrigger, upsertSkill, upsertSubAgent, upsertSubAgentExternalAgentRelation, upsertSubAgentFunctionToolRelation, upsertSubAgentRelation, upsertSubAgentSkill, upsertSubAgentTeamAgentRelation, upsertSubAgentToolRelation, upsertTool, upsertTrigger, upsertUserProfile, upsertWorkAppSlackChannelAgentConfig, validateAndGetApiKey, validateProjectExists, validateRepositoryOwnership, validateSubAgent, withProjectValidation };
|
|
49
|
+
export { AgentLogger, AgentScopeConfig, AgentsManageDatabaseClient, AgentsManageDatabaseConfig, AgentsRunDatabaseClient, AgentsRunDatabaseConfig, AvailableAgentInfo, CascadeDeleteResult, CreateProjectWithBranchParams, CreateProjectWithBranchResult, CredentialReferenceWithResources, DeleteProjectWithBranchParams, ListProjectsWithMetadataResult, ProjectConfigMetadata, ProjectGitHubAccessCascadeDeleteResult, ProjectLogger, ProjectMetadataPaginatedResult, ProjectScopeConfig, ProjectWithMetadata, SCOPE_KEYS, SSOProviderRegistration, ScopeConfig, ScopeKeysOf, ScopeLevel, ScopedTable, SlackMcpToolAccessConfig, SubAgentIsDefaultError, SubAgentScopeConfig, TenantScopeConfig, ToolCascadeDeleteResult, ToolScopeConfig, UpsertUserProfileData, UserProfile, UserProviderInfo, WorkAppGitHubAccessMode, WorkAppSlackChannelAgentConfigInsert, WorkAppSlackChannelAgentConfigSelect, WorkAppSlackUserMappingInsert, WorkAppSlackUserMappingSelect, WorkAppSlackWorkspaceInsert, WorkAppSlackWorkspaceSelect, addConversationIdToInvocation, addFunctionToolToSubAgent, addLedgerArtifacts, addRepositories, addToolToAgent, addUserToOrganization, agentHasArtifactComponents, agentScopedWhere, associateArtifactComponentWithAgent, associateDataComponentWithAgent, associateFunctionToolWithSubAgent, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, cascadeDeleteByAgent, cascadeDeleteByBranch, cascadeDeleteByContextConfig, cascadeDeleteByProject, cascadeDeleteBySubAgent, cascadeDeleteByTool, cascadeDeleteGitHubAccessByProject, checkProjectRepositoryAccess, cleanupTenantCache, clearAppDefaultsByAgent, clearAppDefaultsByProject, clearContextConfigCache, clearConversationCache, clearDevConfigWorkspaceDefaultsByAgent, clearDevConfigWorkspaceDefaultsByProject, clearMcpToolRepositoryAccess, clearProjectRepositoryAccess, clearWorkspaceDefaultsByAgent, clearWorkspaceDefaultsByProject, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, countProjectsInRuntime, countVisibleMessages, createAgent, createAgentManageDatabaseConnection, createAgentToolRelation, createAgentsManageDatabaseClient, createAgentsManageDatabasePool, createAgentsRunDatabaseClient, createApiKey, createApp, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDataset, createDatasetItem, createDatasetItems, createDatasetRun, createDatasetRunConfig, createDatasetRunConfigAgentRelation, createDatasetRunConversationRelation, createDatasetRunConversationRelations, createEvaluationJobConfig, createEvaluationJobConfigEvaluatorRelation, createEvaluationResult, createEvaluationResults, createEvaluationRun, createEvaluationRunConfig, createEvaluationRunConfigEvaluationSuiteConfigRelation, createEvaluationSuiteConfig, createEvaluationSuiteConfigEvaluatorRelation, createEvaluator, createExternalAgent, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createInstallation, createInvitationInDb, createMessage, createOrGetConversation, createProject, createProjectMetadata, createProjectMetadataAndBranch, createScheduledTrigger, createScheduledTriggerInvocation, createScheduledWorkflow, createSkill, createSubAgent, createSubAgentExternalAgentRelation, createSubAgentRelation, createSubAgentTeamAgentRelation, createTask, createTool, createTrigger, createTriggerInvocation, createUserProfileIfNotExists, createValidatedDataAccess, createWorkAppSlackChannelAgentConfig, createWorkAppSlackUserMapping, createWorkAppSlackWorkspace, dbResultToMcpTool, dbResultToMcpToolSkeleton, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteAllSlackMcpToolAccessConfigsByTenant, deleteAllWorkAppSlackChannelAgentConfigsByTeam, deleteAllWorkAppSlackUserMappingsByTeam, deleteApiKey, deleteApp, deleteAppForTenant, deleteAppsByProject, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteDataset, deleteDatasetItem, deleteDatasetItemsByDataset, deleteDatasetRun, deleteDatasetRunConfig, deleteDatasetRunConfigAgentRelation, deleteDatasetRunConversationRelation, deleteDatasetRunConversationRelationsByRun, deleteEvaluationJobConfig, deleteEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfigEvaluatorRelationsByEvaluator, deleteEvaluationResult, deleteEvaluationResultsByRun, deleteEvaluationRun, deleteEvaluationRunConfig, deleteEvaluationRunConfigEvaluationSuiteConfigRelation, deleteEvaluationSuiteConfig, deleteEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfigEvaluatorRelationsByEvaluator, deleteEvaluator, deleteExternalAgent, deleteFullAgent, deleteFullProject, deleteFunction, deleteFunctionTool, deleteInstallation, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMcpToolAccessMode, deleteMessage, deletePendingInvocationsForTrigger, deleteProject, deleteProjectAccessMode, deleteProjectMetadata, deleteProjectWithBranch, deleteScheduledTrigger, deleteScheduledTriggersByRunAsUserId, deleteSkill, deleteSlackMcpToolAccessConfig, deleteSubAgent, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, deleteSubAgentRelation, deleteSubAgentSkill, deleteSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelationsByAgent, deleteSubAgentTeamAgentRelationsBySubAgent, deleteTool, deleteTrigger, deleteTriggersByRunAsUserId, deleteWorkAppSlackChannelAgentConfig, deleteWorkAppSlackChannelAgentConfigsByAgent, deleteWorkAppSlackChannelAgentConfigsByProject, deleteWorkAppSlackUserMapping, deleteWorkAppSlackWorkspace, deleteWorkAppSlackWorkspaceByNangoConnectionId, disconnectInstallation, externalAgentExists, externalAgentUrlExists, fetchComponentRelationships, filterConversationsForJob, findWorkAppSlackChannelAgentConfig, findWorkAppSlackUserMapping, findWorkAppSlackUserMappingByInkeepUserId, findWorkAppSlackUserMappingBySlackUser, findWorkAppSlackWorkspaceByNangoConnectionId, findWorkAppSlackWorkspaceBySlackTeamId, findWorkAppSlackWorkspaceByTeamId, generateAndCreateApiKey, getActiveAgentForConversation, getAgentById, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentSubAgentInfos, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentWithDefaultSubAgent, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getAppById, getAppByIdForTenant, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getContextConfigById, getContextConfigCacheEntries, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getDataComponent, getDataComponentsForAgent, getDatasetById, getDatasetItemById, getDatasetRunById, getDatasetRunConfigAgentRelations, getDatasetRunConfigById, getDatasetRunConversationRelationByConversation, getDatasetRunConversationRelations, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluationResultById, getEvaluationRunById, getEvaluationRunByJobConfigId, getEvaluationRunConfigById, getEvaluationRunConfigEvaluationSuiteConfigRelations, getEvaluationSuiteConfigById, getEvaluationSuiteConfigEvaluatorRelations, getEvaluatorById, getEvaluatorsByIds, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFullAgent, getFullAgentDefinition, getFullAgentDefinitionWithRelationIds, getFullAgentWithRelationIds, getFullProject, getFullProjectWithRelationIds, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getInitialOrganization, getInstallationByGitHubId, getInstallationById, getInstallationsByTenantId, getLedgerArtifacts, getLedgerArtifactsByContext, getMcpToolAccessMode, getMcpToolById, getMcpToolRepositoryAccess, getMcpToolRepositoryAccessWithDetails, getMessageById, getMessagesByConversation, getMessagesByTask, getOrganizationMemberByEmail, getOrganizationMemberByUserId, getPendingInvitationsByEmail, getProject, getProjectAccessMode, getProjectMainBranchName, getProjectMetadata, getProjectRepositoryAccess, getProjectRepositoryAccessWithDetails, getProjectResourceCounts, getProjectWithBranchInfo, getProjectWithMetadata, getRelatedAgentsForAgent, getRepositoriesByInstallationId, getRepositoriesByTenantId, getRepositoryByFullName, getRepositoryById, getRepositoryCount, getRepositoryCountsByTenantId, getScheduledTriggerById, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerRunInfoBatch, getScheduledWorkflowByTriggerId, getSkillById, getSkillsForSubAgents, getSlackMcpToolAccessConfig, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getSubAgentsUsingFunctionTool, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getTriggerById, getTriggerInvocationById, getUserByEmail, getUserById, getUserOrganizationsFromDb, getUserProfile, getUserProvidersFromDb, getUserScopedCredentialReference, getVisibleMessages, hasApiKey, hasContextConfig, hasCredentialReference, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isFunctionToolAssociatedWithSubAgent, isGithubWorkAppTool, isSlackWorkAppTool, linkDatasetRunToEvaluationJobConfig, listAgentIdsByProject, listAgentRelations, listAgentToolRelations, listAgents, listAgentsAcrossProjectMainBranches, listAgentsPaginated, listApiKeys, listApiKeysByProject, listApiKeysPaginated, listAppsPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextCacheByProject, listContextConfigIdsByProject, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listDatasetItems, listDatasetRunConfigs, listDatasetRuns, listDatasetRunsByConfig, listDatasets, listEnabledScheduledTriggers, listEvaluationJobConfigs, listEvaluationResults, listEvaluationResultsByConversation, listEvaluationResultsByRun, listEvaluationRunConfigs, listEvaluationRunConfigsWithSuiteConfigs, listEvaluationRuns, listEvaluationRunsByJobConfigId, listEvaluationSuiteConfigs, listEvaluators, listExternalAgents, listExternalAgentsPaginated, listFunctionTools, listFunctions, listFunctionsPaginated, listGitHubToolAccessByProject, listGitHubToolAccessModeByProject, listMessages, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listProjects, listProjectsMetadata, listProjectsMetadataPaginated, listProjectsPaginated, listProjectsWithMetadataPaginated, listScheduledTriggerInvocationsPaginated, listScheduledTriggers, listScheduledTriggersPaginated, listScheduledWorkflowsByProject, listSkills, listSlackChannelAgentConfigsByProject, listSlackToolAccessConfigByProject, listSubAgentExternalAgentRelations, listSubAgentTeamAgentRelations, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listToolIdsByProject, listTools, listTriggerInvocationsPaginated, listTriggers, listTriggersPaginated, listUpcomingInvocationsForAgentPaginated, listWorkAppSlackChannelAgentConfigsByTeam, listWorkAppSlackUserMappingsByTeam, listWorkAppSlackWorkspacesByTenant, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, projectExists, projectExistsInTable, projectHasResources, projectScopedWhere, projectsMetadataExists, queryHasCredentialAccount, registerSSOProvider, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeFunctionToolFromSubAgent, removeRepositories, removeToolFromAgent, resolveSlackUserContext, scopedWhere, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setMcpToolAccessMode, setMcpToolRepositoryAccess, setProjectAccessMode, setProjectRepositoryAccess, setSlackMcpToolAccessConfig, subAgentScopedWhere, syncRepositories, tenantScopedWhere, toolScopedWhere, updateAgent, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateApp, updateAppForTenant, updateAppLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveSubAgent, updateCredentialReference, updateDataComponent, updateDataset, updateDatasetItem, updateDatasetRunConfig, updateEvaluationResult, updateEvaluationRun, updateEvaluationRunConfig, updateEvaluationSuiteConfig, updateEvaluator, updateExternalAgent, updateFullAgentServerSide, updateFullProjectServerSide, updateFunctionTool, updateInstallationStatus, updateInstallationStatusByGitHubId, updateMessage, updateProject, updateScheduledTrigger, updateScheduledTriggerInvocationStatus, updateScheduledWorkflowRunId, updateSkill, updateSlackMcpToolAccessChannelIds, updateSubAgent, updateSubAgentExternalAgentRelation, updateSubAgentFunctionToolRelation, updateSubAgentTeamAgentRelation, updateTask, updateTool, updateTrigger, updateTriggerInvocationStatus, updateWorkAppSlackWorkspace, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertOrganization, upsertScheduledTrigger, upsertSkill, upsertSubAgent, upsertSubAgentExternalAgentRelation, upsertSubAgentFunctionToolRelation, upsertSubAgentRelation, upsertSubAgentSkill, upsertSubAgentTeamAgentRelation, upsertSubAgentToolRelation, upsertTool, upsertTrigger, upsertUserProfile, upsertWorkAppSlackChannelAgentConfig, validateAndGetApiKey, validateProjectExists, validateRepositoryOwnership, validateSubAgent, withProjectValidation };
|
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
import { createAgentManageDatabaseConnection, createAgentsManageDatabaseClient, createAgentsManageDatabasePool } from "../db/manage/manage-client.js";
|
|
2
|
+
import { SCOPE_KEYS } from "../db/manage/scope-definitions.js";
|
|
2
3
|
import { createAgentsRunDatabaseClient } from "../db/runtime/runtime-client.js";
|
|
4
|
+
import { agentScopedWhere, projectScopedWhere, scopedWhere, subAgentScopedWhere, tenantScopedWhere, toolScopedWhere } from "./manage/scope-helpers.js";
|
|
3
5
|
import { countProjectsInRuntime, createProjectMetadata, deleteProjectMetadata, getProjectMetadata, listProjectsMetadata, listProjectsMetadataPaginated, projectsMetadataExists } from "./runtime/projects.js";
|
|
4
6
|
import { createProjectMetadataAndBranch, deleteProjectWithBranch, getProjectMainBranchName, getProjectWithBranchInfo, getProjectWithMetadata, listProjectsWithMetadataPaginated } from "./manage/projectLifecycle.js";
|
|
5
7
|
import { clearAppDefaultsByAgent, clearAppDefaultsByProject, createApp, deleteApp, deleteAppForTenant, deleteAppsByProject, getAppById, getAppByIdForTenant, listAppsPaginated, updateApp, updateAppForTenant, updateAppLastUsed } from "./runtime/apps.js";
|
|
@@ -31,11 +33,12 @@ import { createFullProjectServerSide, deleteFullProject, getFullProject, getFull
|
|
|
31
33
|
import { createScheduledWorkflow, getScheduledWorkflowByTriggerId, updateScheduledWorkflowRunId } from "./manage/scheduledWorkflows.js";
|
|
32
34
|
import { countApiKeys, createApiKey, deleteApiKey, generateAndCreateApiKey, getApiKeyById, getApiKeyByPublicId, hasApiKey, listApiKeys, listApiKeysPaginated, updateApiKey, updateApiKeyLastUsed, validateAndGetApiKey } from "./runtime/apiKeys.js";
|
|
33
35
|
import { listApiKeysByProject, listContextCacheByProject, listGitHubToolAccessByProject, listGitHubToolAccessModeByProject, listSlackChannelAgentConfigsByProject, listSlackToolAccessConfigByProject } from "./runtime/audit-queries.js";
|
|
36
|
+
import { getInitialOrganization, queryHasCredentialAccount, registerSSOProvider } from "./runtime/auth.js";
|
|
34
37
|
import { cleanupTenantCache, clearContextConfigCache, clearConversationCache, getCacheEntry, getContextConfigCacheEntries, getConversationCacheEntries, invalidateHeadersCache, invalidateInvocationDefinitionsCache, setCacheEntry } from "./runtime/contextCache.js";
|
|
35
38
|
import { createConversation, createOrGetConversation, deleteConversation, getActiveAgentForConversation, getConversation, getConversationHistory, listConversations, setActiveAgentForConversation, setActiveAgentForThread, updateConversation, updateConversationActiveSubAgent } from "./runtime/conversations.js";
|
|
36
39
|
import { createDatasetRun, createDatasetRunConversationRelation, createDatasetRunConversationRelations, createEvaluationResult, createEvaluationResults, createEvaluationRun, deleteDatasetRun, deleteDatasetRunConversationRelation, deleteDatasetRunConversationRelationsByRun, deleteEvaluationResult, deleteEvaluationResultsByRun, deleteEvaluationRun, filterConversationsForJob, getDatasetRunById, getDatasetRunConversationRelationByConversation, getDatasetRunConversationRelations, getEvaluationResultById, getEvaluationRunById, getEvaluationRunByJobConfigId, listDatasetRuns, listDatasetRunsByConfig, listEvaluationResults, listEvaluationResultsByConversation, listEvaluationResultsByRun, listEvaluationRuns, listEvaluationRunsByJobConfigId, updateEvaluationResult, updateEvaluationRun } from "./runtime/evalRuns.js";
|
|
37
40
|
import { addLedgerArtifacts, countLedgerArtifactsByTask, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, getLedgerArtifacts, getLedgerArtifactsByContext, upsertLedgerArtifact } from "./runtime/ledgerArtifacts.js";
|
|
38
|
-
import { countMessagesByConversation, createMessage, deleteMessage, getMessageById, getMessagesByConversation, getMessagesByTask, getVisibleMessages, listMessages, updateMessage } from "./runtime/messages.js";
|
|
41
|
+
import { countMessagesByConversation, countVisibleMessages, createMessage, deleteMessage, getMessageById, getMessagesByConversation, getMessagesByTask, getVisibleMessages, listMessages, updateMessage } from "./runtime/messages.js";
|
|
39
42
|
import { addUserToOrganization, createInvitationInDb, getPendingInvitationsByEmail, getUserOrganizationsFromDb, getUserProvidersFromDb, upsertOrganization } from "./runtime/organizations.js";
|
|
40
43
|
import { addConversationIdToInvocation, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, createScheduledTriggerInvocation, deletePendingInvocationsForTrigger, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerRunInfoBatch, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listScheduledTriggerInvocationsPaginated, listUpcomingInvocationsForAgentPaginated, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, updateScheduledTriggerInvocationStatus } from "./runtime/scheduledTriggerInvocations.js";
|
|
41
44
|
import { createTask, getTask, listTaskIdsByContextId, updateTask } from "./runtime/tasks.js";
|
|
@@ -44,4 +47,4 @@ import { createUserProfileIfNotExists, getUserProfile, upsertUserProfile } from
|
|
|
44
47
|
import { getOrganizationMemberByEmail, getOrganizationMemberByUserId, getUserByEmail, getUserById } from "./runtime/users.js";
|
|
45
48
|
import { createValidatedDataAccess, validateProjectExists, withProjectValidation } from "./validation.js";
|
|
46
49
|
|
|
47
|
-
export { SubAgentIsDefaultError, addConversationIdToInvocation, addFunctionToolToSubAgent, addLedgerArtifacts, addRepositories, addToolToAgent, addUserToOrganization, agentHasArtifactComponents, associateArtifactComponentWithAgent, associateDataComponentWithAgent, associateFunctionToolWithSubAgent, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, cascadeDeleteByAgent, cascadeDeleteByBranch, cascadeDeleteByContextConfig, cascadeDeleteByProject, cascadeDeleteBySubAgent, cascadeDeleteByTool, cascadeDeleteGitHubAccessByProject, checkProjectRepositoryAccess, cleanupTenantCache, clearAppDefaultsByAgent, clearAppDefaultsByProject, clearContextConfigCache, clearConversationCache, clearDevConfigWorkspaceDefaultsByAgent, clearDevConfigWorkspaceDefaultsByProject, clearMcpToolRepositoryAccess, clearProjectRepositoryAccess, clearWorkspaceDefaultsByAgent, clearWorkspaceDefaultsByProject, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, countProjectsInRuntime, createAgent, createAgentManageDatabaseConnection, createAgentToolRelation, createAgentsManageDatabaseClient, createAgentsManageDatabasePool, createAgentsRunDatabaseClient, createApiKey, createApp, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDataset, createDatasetItem, createDatasetItems, createDatasetRun, createDatasetRunConfig, createDatasetRunConfigAgentRelation, createDatasetRunConversationRelation, createDatasetRunConversationRelations, createEvaluationJobConfig, createEvaluationJobConfigEvaluatorRelation, createEvaluationResult, createEvaluationResults, createEvaluationRun, createEvaluationRunConfig, createEvaluationRunConfigEvaluationSuiteConfigRelation, createEvaluationSuiteConfig, createEvaluationSuiteConfigEvaluatorRelation, createEvaluator, createExternalAgent, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createInstallation, createInvitationInDb, createMessage, createOrGetConversation, createProject, createProjectMetadata, createProjectMetadataAndBranch, createScheduledTrigger, createScheduledTriggerInvocation, createScheduledWorkflow, createSkill, createSubAgent, createSubAgentExternalAgentRelation, createSubAgentRelation, createSubAgentTeamAgentRelation, createTask, createTool, createTrigger, createTriggerInvocation, createUserProfileIfNotExists, createValidatedDataAccess, createWorkAppSlackChannelAgentConfig, createWorkAppSlackUserMapping, createWorkAppSlackWorkspace, dbResultToMcpTool, dbResultToMcpToolSkeleton, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteAllSlackMcpToolAccessConfigsByTenant, deleteAllWorkAppSlackChannelAgentConfigsByTeam, deleteAllWorkAppSlackUserMappingsByTeam, deleteApiKey, deleteApp, deleteAppForTenant, deleteAppsByProject, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteDataset, deleteDatasetItem, deleteDatasetItemsByDataset, deleteDatasetRun, deleteDatasetRunConfig, deleteDatasetRunConfigAgentRelation, deleteDatasetRunConversationRelation, deleteDatasetRunConversationRelationsByRun, deleteEvaluationJobConfig, deleteEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfigEvaluatorRelationsByEvaluator, deleteEvaluationResult, deleteEvaluationResultsByRun, deleteEvaluationRun, deleteEvaluationRunConfig, deleteEvaluationRunConfigEvaluationSuiteConfigRelation, deleteEvaluationSuiteConfig, deleteEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfigEvaluatorRelationsByEvaluator, deleteEvaluator, deleteExternalAgent, deleteFullAgent, deleteFullProject, deleteFunction, deleteFunctionTool, deleteInstallation, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMcpToolAccessMode, deleteMessage, deletePendingInvocationsForTrigger, deleteProject, deleteProjectAccessMode, deleteProjectMetadata, deleteProjectWithBranch, deleteScheduledTrigger, deleteScheduledTriggersByRunAsUserId, deleteSkill, deleteSlackMcpToolAccessConfig, deleteSubAgent, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, deleteSubAgentRelation, deleteSubAgentSkill, deleteSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelationsByAgent, deleteSubAgentTeamAgentRelationsBySubAgent, deleteTool, deleteTrigger, deleteTriggersByRunAsUserId, deleteWorkAppSlackChannelAgentConfig, deleteWorkAppSlackChannelAgentConfigsByAgent, deleteWorkAppSlackChannelAgentConfigsByProject, deleteWorkAppSlackUserMapping, deleteWorkAppSlackWorkspace, deleteWorkAppSlackWorkspaceByNangoConnectionId, disconnectInstallation, externalAgentExists, externalAgentUrlExists, fetchComponentRelationships, filterConversationsForJob, findWorkAppSlackChannelAgentConfig, findWorkAppSlackUserMapping, findWorkAppSlackUserMappingByInkeepUserId, findWorkAppSlackUserMappingBySlackUser, findWorkAppSlackWorkspaceByNangoConnectionId, findWorkAppSlackWorkspaceBySlackTeamId, findWorkAppSlackWorkspaceByTeamId, generateAndCreateApiKey, getActiveAgentForConversation, getAgentById, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentSubAgentInfos, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentWithDefaultSubAgent, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getAppById, getAppByIdForTenant, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getContextConfigById, getContextConfigCacheEntries, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getDataComponent, getDataComponentsForAgent, getDatasetById, getDatasetItemById, getDatasetRunById, getDatasetRunConfigAgentRelations, getDatasetRunConfigById, getDatasetRunConversationRelationByConversation, getDatasetRunConversationRelations, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluationResultById, getEvaluationRunById, getEvaluationRunByJobConfigId, getEvaluationRunConfigById, getEvaluationRunConfigEvaluationSuiteConfigRelations, getEvaluationSuiteConfigById, getEvaluationSuiteConfigEvaluatorRelations, getEvaluatorById, getEvaluatorsByIds, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFullAgent, getFullAgentDefinition, getFullAgentDefinitionWithRelationIds, getFullAgentWithRelationIds, getFullProject, getFullProjectWithRelationIds, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getInstallationByGitHubId, getInstallationById, getInstallationsByTenantId, getLedgerArtifacts, getLedgerArtifactsByContext, getMcpToolAccessMode, getMcpToolById, getMcpToolRepositoryAccess, getMcpToolRepositoryAccessWithDetails, getMessageById, getMessagesByConversation, getMessagesByTask, getOrganizationMemberByEmail, getOrganizationMemberByUserId, getPendingInvitationsByEmail, getProject, getProjectAccessMode, getProjectMainBranchName, getProjectMetadata, getProjectRepositoryAccess, getProjectRepositoryAccessWithDetails, getProjectResourceCounts, getProjectWithBranchInfo, getProjectWithMetadata, getRelatedAgentsForAgent, getRepositoriesByInstallationId, getRepositoriesByTenantId, getRepositoryByFullName, getRepositoryById, getRepositoryCount, getRepositoryCountsByTenantId, getScheduledTriggerById, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerRunInfoBatch, getScheduledWorkflowByTriggerId, getSkillById, getSkillsForSubAgents, getSlackMcpToolAccessConfig, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getSubAgentsUsingFunctionTool, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getTriggerById, getTriggerInvocationById, getUserByEmail, getUserById, getUserOrganizationsFromDb, getUserProfile, getUserProvidersFromDb, getUserScopedCredentialReference, getVisibleMessages, hasApiKey, hasContextConfig, hasCredentialReference, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isFunctionToolAssociatedWithSubAgent, isGithubWorkAppTool, isSlackWorkAppTool, linkDatasetRunToEvaluationJobConfig, listAgentIdsByProject, listAgentRelations, listAgentToolRelations, listAgents, listAgentsAcrossProjectMainBranches, listAgentsPaginated, listApiKeys, listApiKeysByProject, listApiKeysPaginated, listAppsPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextCacheByProject, listContextConfigIdsByProject, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listDatasetItems, listDatasetRunConfigs, listDatasetRuns, listDatasetRunsByConfig, listDatasets, listEnabledScheduledTriggers, listEvaluationJobConfigs, listEvaluationResults, listEvaluationResultsByConversation, listEvaluationResultsByRun, listEvaluationRunConfigs, listEvaluationRunConfigsWithSuiteConfigs, listEvaluationRuns, listEvaluationRunsByJobConfigId, listEvaluationSuiteConfigs, listEvaluators, listExternalAgents, listExternalAgentsPaginated, listFunctionTools, listFunctions, listFunctionsPaginated, listGitHubToolAccessByProject, listGitHubToolAccessModeByProject, listMessages, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listProjects, listProjectsMetadata, listProjectsMetadataPaginated, listProjectsPaginated, listProjectsWithMetadataPaginated, listScheduledTriggerInvocationsPaginated, listScheduledTriggers, listScheduledTriggersPaginated, listScheduledWorkflowsByProject, listSkills, listSlackChannelAgentConfigsByProject, listSlackToolAccessConfigByProject, listSubAgentExternalAgentRelations, listSubAgentTeamAgentRelations, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listToolIdsByProject, listTools, listTriggerInvocationsPaginated, listTriggers, listTriggersPaginated, listUpcomingInvocationsForAgentPaginated, listWorkAppSlackChannelAgentConfigsByTeam, listWorkAppSlackUserMappingsByTeam, listWorkAppSlackWorkspacesByTenant, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, projectExists, projectExistsInTable, projectHasResources, projectsMetadataExists, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeFunctionToolFromSubAgent, removeRepositories, removeToolFromAgent, resolveSlackUserContext, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setMcpToolAccessMode, setMcpToolRepositoryAccess, setProjectAccessMode, setProjectRepositoryAccess, setSlackMcpToolAccessConfig, syncRepositories, updateAgent, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateApp, updateAppForTenant, updateAppLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveSubAgent, updateCredentialReference, updateDataComponent, updateDataset, updateDatasetItem, updateDatasetRunConfig, updateEvaluationResult, updateEvaluationRun, updateEvaluationRunConfig, updateEvaluationSuiteConfig, updateEvaluator, updateExternalAgent, updateFullAgentServerSide, updateFullProjectServerSide, updateFunctionTool, updateInstallationStatus, updateInstallationStatusByGitHubId, updateMessage, updateProject, updateScheduledTrigger, updateScheduledTriggerInvocationStatus, updateScheduledWorkflowRunId, updateSkill, updateSlackMcpToolAccessChannelIds, updateSubAgent, updateSubAgentExternalAgentRelation, updateSubAgentFunctionToolRelation, updateSubAgentTeamAgentRelation, updateTask, updateTool, updateTrigger, updateTriggerInvocationStatus, updateWorkAppSlackWorkspace, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertOrganization, upsertScheduledTrigger, upsertSkill, upsertSubAgent, upsertSubAgentExternalAgentRelation, upsertSubAgentFunctionToolRelation, upsertSubAgentRelation, upsertSubAgentSkill, upsertSubAgentTeamAgentRelation, upsertSubAgentToolRelation, upsertTool, upsertTrigger, upsertUserProfile, upsertWorkAppSlackChannelAgentConfig, validateAndGetApiKey, validateProjectExists, validateRepositoryOwnership, validateSubAgent, withProjectValidation };
|
|
50
|
+
export { SCOPE_KEYS, SubAgentIsDefaultError, addConversationIdToInvocation, addFunctionToolToSubAgent, addLedgerArtifacts, addRepositories, addToolToAgent, addUserToOrganization, agentHasArtifactComponents, agentScopedWhere, associateArtifactComponentWithAgent, associateDataComponentWithAgent, associateFunctionToolWithSubAgent, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, cascadeDeleteByAgent, cascadeDeleteByBranch, cascadeDeleteByContextConfig, cascadeDeleteByProject, cascadeDeleteBySubAgent, cascadeDeleteByTool, cascadeDeleteGitHubAccessByProject, checkProjectRepositoryAccess, cleanupTenantCache, clearAppDefaultsByAgent, clearAppDefaultsByProject, clearContextConfigCache, clearConversationCache, clearDevConfigWorkspaceDefaultsByAgent, clearDevConfigWorkspaceDefaultsByProject, clearMcpToolRepositoryAccess, clearProjectRepositoryAccess, clearWorkspaceDefaultsByAgent, clearWorkspaceDefaultsByProject, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, countProjectsInRuntime, countVisibleMessages, createAgent, createAgentManageDatabaseConnection, createAgentToolRelation, createAgentsManageDatabaseClient, createAgentsManageDatabasePool, createAgentsRunDatabaseClient, createApiKey, createApp, createArtifactComponent, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDataset, createDatasetItem, createDatasetItems, createDatasetRun, createDatasetRunConfig, createDatasetRunConfigAgentRelation, createDatasetRunConversationRelation, createDatasetRunConversationRelations, createEvaluationJobConfig, createEvaluationJobConfigEvaluatorRelation, createEvaluationResult, createEvaluationResults, createEvaluationRun, createEvaluationRunConfig, createEvaluationRunConfigEvaluationSuiteConfigRelation, createEvaluationSuiteConfig, createEvaluationSuiteConfigEvaluatorRelation, createEvaluator, createExternalAgent, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createInstallation, createInvitationInDb, createMessage, createOrGetConversation, createProject, createProjectMetadata, createProjectMetadataAndBranch, createScheduledTrigger, createScheduledTriggerInvocation, createScheduledWorkflow, createSkill, createSubAgent, createSubAgentExternalAgentRelation, createSubAgentRelation, createSubAgentTeamAgentRelation, createTask, createTool, createTrigger, createTriggerInvocation, createUserProfileIfNotExists, createValidatedDataAccess, createWorkAppSlackChannelAgentConfig, createWorkAppSlackUserMapping, createWorkAppSlackWorkspace, dbResultToMcpTool, dbResultToMcpToolSkeleton, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteAllSlackMcpToolAccessConfigsByTenant, deleteAllWorkAppSlackChannelAgentConfigsByTeam, deleteAllWorkAppSlackUserMappingsByTeam, deleteApiKey, deleteApp, deleteAppForTenant, deleteAppsByProject, deleteArtifactComponent, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteDataset, deleteDatasetItem, deleteDatasetItemsByDataset, deleteDatasetRun, deleteDatasetRunConfig, deleteDatasetRunConfigAgentRelation, deleteDatasetRunConversationRelation, deleteDatasetRunConversationRelationsByRun, deleteEvaluationJobConfig, deleteEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfigEvaluatorRelationsByEvaluator, deleteEvaluationResult, deleteEvaluationResultsByRun, deleteEvaluationRun, deleteEvaluationRunConfig, deleteEvaluationRunConfigEvaluationSuiteConfigRelation, deleteEvaluationSuiteConfig, deleteEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfigEvaluatorRelationsByEvaluator, deleteEvaluator, deleteExternalAgent, deleteFullAgent, deleteFullProject, deleteFunction, deleteFunctionTool, deleteInstallation, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMcpToolAccessMode, deleteMessage, deletePendingInvocationsForTrigger, deleteProject, deleteProjectAccessMode, deleteProjectMetadata, deleteProjectWithBranch, deleteScheduledTrigger, deleteScheduledTriggersByRunAsUserId, deleteSkill, deleteSlackMcpToolAccessConfig, deleteSubAgent, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, deleteSubAgentRelation, deleteSubAgentSkill, deleteSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelationsByAgent, deleteSubAgentTeamAgentRelationsBySubAgent, deleteTool, deleteTrigger, deleteTriggersByRunAsUserId, deleteWorkAppSlackChannelAgentConfig, deleteWorkAppSlackChannelAgentConfigsByAgent, deleteWorkAppSlackChannelAgentConfigsByProject, deleteWorkAppSlackUserMapping, deleteWorkAppSlackWorkspace, deleteWorkAppSlackWorkspaceByNangoConnectionId, disconnectInstallation, externalAgentExists, externalAgentUrlExists, fetchComponentRelationships, filterConversationsForJob, findWorkAppSlackChannelAgentConfig, findWorkAppSlackUserMapping, findWorkAppSlackUserMappingByInkeepUserId, findWorkAppSlackUserMappingBySlackUser, findWorkAppSlackWorkspaceByNangoConnectionId, findWorkAppSlackWorkspaceBySlackTeamId, findWorkAppSlackWorkspaceByTeamId, generateAndCreateApiKey, getActiveAgentForConversation, getAgentById, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentSubAgentInfos, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentWithDefaultSubAgent, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getApiKeyById, getApiKeyByPublicId, getAppById, getAppByIdForTenant, getArtifactComponentById, getArtifactComponentsForAgent, getCacheEntry, getContextConfigById, getContextConfigCacheEntries, getConversation, getConversationCacheEntries, getConversationHistory, getCredentialReference, getCredentialReferenceById, getCredentialReferenceWithResources, getDataComponent, getDataComponentsForAgent, getDatasetById, getDatasetItemById, getDatasetRunById, getDatasetRunConfigAgentRelations, getDatasetRunConfigById, getDatasetRunConversationRelationByConversation, getDatasetRunConversationRelations, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluationResultById, getEvaluationRunById, getEvaluationRunByJobConfigId, getEvaluationRunConfigById, getEvaluationRunConfigEvaluationSuiteConfigRelations, getEvaluationSuiteConfigById, getEvaluationSuiteConfigEvaluatorRelations, getEvaluatorById, getEvaluatorsByIds, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFullAgent, getFullAgentDefinition, getFullAgentDefinitionWithRelationIds, getFullAgentWithRelationIds, getFullProject, getFullProjectWithRelationIds, getFunction, getFunctionToolById, getFunctionToolsForSubAgent, getInitialOrganization, getInstallationByGitHubId, getInstallationById, getInstallationsByTenantId, getLedgerArtifacts, getLedgerArtifactsByContext, getMcpToolAccessMode, getMcpToolById, getMcpToolRepositoryAccess, getMcpToolRepositoryAccessWithDetails, getMessageById, getMessagesByConversation, getMessagesByTask, getOrganizationMemberByEmail, getOrganizationMemberByUserId, getPendingInvitationsByEmail, getProject, getProjectAccessMode, getProjectMainBranchName, getProjectMetadata, getProjectRepositoryAccess, getProjectRepositoryAccessWithDetails, getProjectResourceCounts, getProjectWithBranchInfo, getProjectWithMetadata, getRelatedAgentsForAgent, getRepositoriesByInstallationId, getRepositoriesByTenantId, getRepositoryByFullName, getRepositoryById, getRepositoryCount, getRepositoryCountsByTenantId, getScheduledTriggerById, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerRunInfoBatch, getScheduledWorkflowByTriggerId, getSkillById, getSkillsForSubAgents, getSlackMcpToolAccessConfig, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getSubAgentsUsingFunctionTool, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getTriggerById, getTriggerInvocationById, getUserByEmail, getUserById, getUserOrganizationsFromDb, getUserProfile, getUserProvidersFromDb, getUserScopedCredentialReference, getVisibleMessages, hasApiKey, hasContextConfig, hasCredentialReference, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isFunctionToolAssociatedWithSubAgent, isGithubWorkAppTool, isSlackWorkAppTool, linkDatasetRunToEvaluationJobConfig, listAgentIdsByProject, listAgentRelations, listAgentToolRelations, listAgents, listAgentsAcrossProjectMainBranches, listAgentsPaginated, listApiKeys, listApiKeysByProject, listApiKeysPaginated, listAppsPaginated, listArtifactComponents, listArtifactComponentsPaginated, listContextCacheByProject, listContextConfigIdsByProject, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listDatasetItems, listDatasetRunConfigs, listDatasetRuns, listDatasetRunsByConfig, listDatasets, listEnabledScheduledTriggers, listEvaluationJobConfigs, listEvaluationResults, listEvaluationResultsByConversation, listEvaluationResultsByRun, listEvaluationRunConfigs, listEvaluationRunConfigsWithSuiteConfigs, listEvaluationRuns, listEvaluationRunsByJobConfigId, listEvaluationSuiteConfigs, listEvaluators, listExternalAgents, listExternalAgentsPaginated, listFunctionTools, listFunctions, listFunctionsPaginated, listGitHubToolAccessByProject, listGitHubToolAccessModeByProject, listMessages, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listProjects, listProjectsMetadata, listProjectsMetadataPaginated, listProjectsPaginated, listProjectsWithMetadataPaginated, listScheduledTriggerInvocationsPaginated, listScheduledTriggers, listScheduledTriggersPaginated, listScheduledWorkflowsByProject, listSkills, listSlackChannelAgentConfigsByProject, listSlackToolAccessConfigByProject, listSubAgentExternalAgentRelations, listSubAgentTeamAgentRelations, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listToolIdsByProject, listTools, listTriggerInvocationsPaginated, listTriggers, listTriggersPaginated, listUpcomingInvocationsForAgentPaginated, listWorkAppSlackChannelAgentConfigsByTeam, listWorkAppSlackUserMappingsByTeam, listWorkAppSlackWorkspacesByTenant, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, projectExists, projectExistsInTable, projectHasResources, projectScopedWhere, projectsMetadataExists, queryHasCredentialAccount, registerSSOProvider, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeFunctionToolFromSubAgent, removeRepositories, removeToolFromAgent, resolveSlackUserContext, scopedWhere, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setMcpToolAccessMode, setMcpToolRepositoryAccess, setProjectAccessMode, setProjectRepositoryAccess, setSlackMcpToolAccessConfig, subAgentScopedWhere, syncRepositories, tenantScopedWhere, toolScopedWhere, updateAgent, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateApp, updateAppForTenant, updateAppLastUsed, updateArtifactComponent, updateContextConfig, updateConversation, updateConversationActiveSubAgent, updateCredentialReference, updateDataComponent, updateDataset, updateDatasetItem, updateDatasetRunConfig, updateEvaluationResult, updateEvaluationRun, updateEvaluationRunConfig, updateEvaluationSuiteConfig, updateEvaluator, updateExternalAgent, updateFullAgentServerSide, updateFullProjectServerSide, updateFunctionTool, updateInstallationStatus, updateInstallationStatusByGitHubId, updateMessage, updateProject, updateScheduledTrigger, updateScheduledTriggerInvocationStatus, updateScheduledWorkflowRunId, updateSkill, updateSlackMcpToolAccessChannelIds, updateSubAgent, updateSubAgentExternalAgentRelation, updateSubAgentFunctionToolRelation, updateSubAgentTeamAgentRelation, updateTask, updateTool, updateTrigger, updateTriggerInvocationStatus, updateWorkAppSlackWorkspace, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertOrganization, upsertScheduledTrigger, upsertSkill, upsertSubAgent, upsertSubAgentExternalAgentRelation, upsertSubAgentFunctionToolRelation, upsertSubAgentRelation, upsertSubAgentSkill, upsertSubAgentTeamAgentRelation, upsertSubAgentToolRelation, upsertTool, upsertTrigger, upsertUserProfile, upsertWorkAppSlackChannelAgentConfig, validateAndGetApiKey, validateProjectExists, validateRepositoryOwnership, validateSubAgent, withProjectValidation };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { projects, subAgentFunctionToolRelations, subAgentSkills, subAgentToolRelations, subAgents } from "../../db/manage/manage-schema.js";
|
|
2
2
|
import { validateAgentStructure, validateAndTypeAgentData } from "../../validation/agentFull.js";
|
|
3
3
|
import { generateId } from "../../utils/conversations.js";
|
|
4
|
+
import { agentScopedWhere, subAgentScopedWhere, tenantScopedWhere } from "./scope-helpers.js";
|
|
4
5
|
import { upsertContextConfig } from "./contextConfigs.js";
|
|
5
6
|
import { upsertFunction } from "./functions.js";
|
|
6
7
|
import { deleteFunctionTool, listFunctionTools, upsertFunctionTool, upsertSubAgentFunctionToolRelation } from "./functionTools.js";
|
|
@@ -23,7 +24,7 @@ const defaultLogger = {
|
|
|
23
24
|
error: () => {}
|
|
24
25
|
};
|
|
25
26
|
async function syncSubAgentSkills(db, scopes, subAgentsMap, logger) {
|
|
26
|
-
await db.delete(subAgentSkills).where(
|
|
27
|
+
await db.delete(subAgentSkills).where(agentScopedWhere(subAgentSkills, scopes));
|
|
27
28
|
const skillPromises = [];
|
|
28
29
|
for (const [subAgentId, subAgentData] of Object.entries(subAgentsMap)) {
|
|
29
30
|
if (!subAgentData.skills || subAgentData.skills.length === 0) continue;
|
|
@@ -52,16 +53,15 @@ async function syncSubAgentSkills(db, scopes, subAgentsMap, logger) {
|
|
|
52
53
|
* Apply execution limits inheritance from project to Agents and Sub Agents
|
|
53
54
|
*/
|
|
54
55
|
async function applyExecutionLimitsInheritance(db, logger, scopes, agentData) {
|
|
55
|
-
const { tenantId, projectId } = scopes;
|
|
56
56
|
try {
|
|
57
|
-
const project = await db.query.projects.findFirst({ where: and(
|
|
57
|
+
const project = await db.query.projects.findFirst({ where: and(tenantScopedWhere(projects, scopes), eq(projects.id, scopes.projectId)) });
|
|
58
58
|
if (!project?.stopWhen) {
|
|
59
|
-
logger.info({ projectId }, "No project stopWhen configuration found");
|
|
59
|
+
logger.info({ projectId: scopes.projectId }, "No project stopWhen configuration found");
|
|
60
60
|
return;
|
|
61
61
|
}
|
|
62
62
|
const projectStopWhen = project.stopWhen;
|
|
63
63
|
logger.info({
|
|
64
|
-
projectId,
|
|
64
|
+
projectId: scopes.projectId,
|
|
65
65
|
projectStopWhen
|
|
66
66
|
}, "Found project stopWhen configuration");
|
|
67
67
|
if (!agentData.stopWhen) agentData.stopWhen = {};
|
|
@@ -81,7 +81,7 @@ async function applyExecutionLimitsInheritance(db, logger, scopes, agentData) {
|
|
|
81
81
|
}
|
|
82
82
|
if (projectStopWhen?.stepCountIs !== void 0) {
|
|
83
83
|
logger.info({
|
|
84
|
-
projectId,
|
|
84
|
+
projectId: scopes.projectId,
|
|
85
85
|
stepCountIs: projectStopWhen.stepCountIs
|
|
86
86
|
}, "Propagating stepCountIs to agents");
|
|
87
87
|
for (const [subAgentId, subAgentData] of Object.entries(agentData.subAgents)) if (subAgentData.canTransferTo && Array.isArray(subAgentData.canTransferTo)) {
|
|
@@ -98,7 +98,7 @@ async function applyExecutionLimitsInheritance(db, logger, scopes, agentData) {
|
|
|
98
98
|
}
|
|
99
99
|
} catch (error) {
|
|
100
100
|
logger.error({
|
|
101
|
-
projectId,
|
|
101
|
+
projectId: scopes.projectId,
|
|
102
102
|
error: error instanceof Error ? error.message : "Unknown error"
|
|
103
103
|
}, "Failed to apply execution limits inheritance");
|
|
104
104
|
}
|
|
@@ -1036,7 +1036,11 @@ const updateFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
|
|
|
1036
1036
|
let existingSubAgent = null;
|
|
1037
1037
|
try {
|
|
1038
1038
|
existingSubAgent = await db.query.subAgents.findFirst({
|
|
1039
|
-
where: and(
|
|
1039
|
+
where: and(agentScopedWhere(subAgents, {
|
|
1040
|
+
tenantId,
|
|
1041
|
+
projectId,
|
|
1042
|
+
agentId: finalAgentId
|
|
1043
|
+
}), eq(subAgents.id, subAgentId)),
|
|
1040
1044
|
columns: { models: true }
|
|
1041
1045
|
});
|
|
1042
1046
|
} catch (_error) {}
|
|
@@ -1235,8 +1239,14 @@ const updateFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
|
|
|
1235
1239
|
}
|
|
1236
1240
|
for (const subAgentId of Object.keys(typedAgentDefinition.subAgents)) try {
|
|
1237
1241
|
let deletedCount = 0;
|
|
1238
|
-
|
|
1239
|
-
|
|
1242
|
+
const toolRelScopes = {
|
|
1243
|
+
tenantId,
|
|
1244
|
+
projectId,
|
|
1245
|
+
agentId: finalAgentId,
|
|
1246
|
+
subAgentId
|
|
1247
|
+
};
|
|
1248
|
+
if (incomingRelationshipIds.size === 0) deletedCount = (await db.delete(subAgentToolRelations).where(subAgentScopedWhere(subAgentToolRelations, toolRelScopes)).returning()).length;
|
|
1249
|
+
else deletedCount = (await db.delete(subAgentToolRelations).where(and(subAgentScopedWhere(subAgentToolRelations, toolRelScopes), not(inArray(subAgentToolRelations.id, Array.from(incomingRelationshipIds))))).returning()).length;
|
|
1240
1250
|
if (deletedCount > 0) logger.info({
|
|
1241
1251
|
subAgentId,
|
|
1242
1252
|
deletedCount
|
|
@@ -1253,8 +1263,14 @@ const updateFullAgentServerSide = (db, logger = defaultLogger) => async (scopes,
|
|
|
1253
1263
|
}
|
|
1254
1264
|
for (const subAgentId of Object.keys(typedAgentDefinition.subAgents)) try {
|
|
1255
1265
|
let deletedFunctionToolRelationCount = 0;
|
|
1256
|
-
|
|
1257
|
-
|
|
1266
|
+
const fnToolRelScopes = {
|
|
1267
|
+
tenantId,
|
|
1268
|
+
projectId,
|
|
1269
|
+
agentId: finalAgentId,
|
|
1270
|
+
subAgentId
|
|
1271
|
+
};
|
|
1272
|
+
if (incomingFunctionToolRelationIds.size === 0) deletedFunctionToolRelationCount = (await db.delete(subAgentFunctionToolRelations).where(subAgentScopedWhere(subAgentFunctionToolRelations, fnToolRelScopes)).returning()).length;
|
|
1273
|
+
else deletedFunctionToolRelationCount = (await db.delete(subAgentFunctionToolRelations).where(and(subAgentScopedWhere(subAgentFunctionToolRelations, fnToolRelScopes), not(inArray(subAgentFunctionToolRelations.id, Array.from(incomingFunctionToolRelationIds))))).returning()).length;
|
|
1258
1274
|
if (deletedFunctionToolRelationCount > 0) logger.info({
|
|
1259
1275
|
subAgentId,
|
|
1260
1276
|
deletedCount: deletedFunctionToolRelationCount
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { AgentScopeConfig, ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
|
|
1
|
+
import { AgentScopeConfig, ProjectScopeConfig, ScopedTable } from "../../db/manage/scope-definitions.js";
|
|
2
2
|
import { ConversationHistoryConfig, PaginationConfig } from "../../types/utility.js";
|
|
3
3
|
import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
|
|
4
4
|
import "../../index.js";
|
|
5
5
|
import { AgentInsert, AgentSelect, AgentUpdate, FullAgentDefinition, FullAgentSelectWithRelationIds } from "../../types/entities.js";
|
|
6
|
-
import {
|
|
6
|
+
import { Column } from "drizzle-orm";
|
|
7
|
+
import { PgColumn } from "drizzle-orm/pg-core";
|
|
7
8
|
|
|
8
9
|
//#region src/data-access/manage/agents.d.ts
|
|
9
10
|
declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -11,11 +12,11 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
11
12
|
}) => Promise<{
|
|
12
13
|
id: string;
|
|
13
14
|
name: string;
|
|
14
|
-
createdAt: string;
|
|
15
|
-
updatedAt: string;
|
|
16
15
|
description: string | null;
|
|
17
|
-
|
|
16
|
+
defaultSubAgentId: string | null;
|
|
18
17
|
tenantId: string;
|
|
18
|
+
projectId: string;
|
|
19
|
+
prompt: string | null;
|
|
19
20
|
models: {
|
|
20
21
|
base?: {
|
|
21
22
|
model?: string | undefined;
|
|
@@ -33,8 +34,8 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
33
34
|
stopWhen: {
|
|
34
35
|
transferCountIs?: number | undefined;
|
|
35
36
|
} | null;
|
|
36
|
-
|
|
37
|
-
|
|
37
|
+
createdAt: string;
|
|
38
|
+
updatedAt: string;
|
|
38
39
|
contextConfigId: string | null;
|
|
39
40
|
statusUpdates: {
|
|
40
41
|
enabled?: boolean | undefined;
|
|
@@ -57,11 +58,11 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
57
58
|
}) => Promise<{
|
|
58
59
|
id: string;
|
|
59
60
|
name: string;
|
|
60
|
-
createdAt: string;
|
|
61
|
-
updatedAt: string;
|
|
62
61
|
description: string | null;
|
|
63
|
-
|
|
62
|
+
defaultSubAgentId: string | null;
|
|
64
63
|
tenantId: string;
|
|
64
|
+
projectId: string;
|
|
65
|
+
prompt: string | null;
|
|
65
66
|
models: {
|
|
66
67
|
base?: {
|
|
67
68
|
model?: string | undefined;
|
|
@@ -79,8 +80,8 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
79
80
|
stopWhen: {
|
|
80
81
|
transferCountIs?: number | undefined;
|
|
81
82
|
} | null;
|
|
82
|
-
|
|
83
|
-
|
|
83
|
+
createdAt: string;
|
|
84
|
+
updatedAt: string;
|
|
84
85
|
contextConfigId: string | null;
|
|
85
86
|
statusUpdates: {
|
|
86
87
|
enabled?: boolean | undefined;
|
|
@@ -100,11 +101,12 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
100
101
|
defaultSubAgent: {
|
|
101
102
|
id: string;
|
|
102
103
|
name: string;
|
|
103
|
-
createdAt: string;
|
|
104
|
-
updatedAt: string;
|
|
105
104
|
description: string | null;
|
|
106
|
-
projectId: string;
|
|
107
105
|
tenantId: string;
|
|
106
|
+
projectId: string;
|
|
107
|
+
agentId: string;
|
|
108
|
+
prompt: string | null;
|
|
109
|
+
conversationHistoryConfig: ConversationHistoryConfig | null;
|
|
108
110
|
models: {
|
|
109
111
|
base?: {
|
|
110
112
|
model?: string | undefined;
|
|
@@ -122,9 +124,8 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
|
|
|
122
124
|
stopWhen: {
|
|
123
125
|
stepCountIs?: number | undefined;
|
|
124
126
|
} | null;
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
agentId: string;
|
|
127
|
+
createdAt: string;
|
|
128
|
+
updatedAt: string;
|
|
128
129
|
} | null;
|
|
129
130
|
} | null>;
|
|
130
131
|
declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
@@ -132,11 +133,11 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
132
133
|
}) => Promise<{
|
|
133
134
|
id: string;
|
|
134
135
|
name: string;
|
|
135
|
-
createdAt: string;
|
|
136
|
-
updatedAt: string;
|
|
137
136
|
description: string | null;
|
|
138
|
-
|
|
137
|
+
defaultSubAgentId: string | null;
|
|
139
138
|
tenantId: string;
|
|
139
|
+
projectId: string;
|
|
140
|
+
prompt: string | null;
|
|
140
141
|
models: {
|
|
141
142
|
base?: {
|
|
142
143
|
model?: string | undefined;
|
|
@@ -154,8 +155,8 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
154
155
|
stopWhen: {
|
|
155
156
|
transferCountIs?: number | undefined;
|
|
156
157
|
} | null;
|
|
157
|
-
|
|
158
|
-
|
|
158
|
+
createdAt: string;
|
|
159
|
+
updatedAt: string;
|
|
159
160
|
contextConfigId: string | null;
|
|
160
161
|
statusUpdates: {
|
|
161
162
|
enabled?: boolean | undefined;
|
|
@@ -248,11 +249,11 @@ declare function listAgentsAcrossProjectMainBranches(db: AgentsManageDatabaseCli
|
|
|
248
249
|
declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
|
|
249
250
|
id: string;
|
|
250
251
|
name: string;
|
|
251
|
-
createdAt: string;
|
|
252
|
-
updatedAt: string;
|
|
253
252
|
description: string | null;
|
|
254
|
-
|
|
253
|
+
defaultSubAgentId: string | null;
|
|
255
254
|
tenantId: string;
|
|
255
|
+
projectId: string;
|
|
256
|
+
prompt: string | null;
|
|
256
257
|
models: {
|
|
257
258
|
base?: {
|
|
258
259
|
model?: string | undefined;
|
|
@@ -270,8 +271,8 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
|
|
|
270
271
|
stopWhen: {
|
|
271
272
|
transferCountIs?: number | undefined;
|
|
272
273
|
} | null;
|
|
273
|
-
|
|
274
|
-
|
|
274
|
+
createdAt: string;
|
|
275
|
+
updatedAt: string;
|
|
275
276
|
contextConfigId: string | null;
|
|
276
277
|
statusUpdates: {
|
|
277
278
|
enabled?: boolean | undefined;
|
|
@@ -343,12 +344,12 @@ declare const deleteAgent: (db: AgentsManageDatabaseClient) => (params: {
|
|
|
343
344
|
* Helper function to fetch component relationships using efficient joins
|
|
344
345
|
*/
|
|
345
346
|
declare const fetchComponentRelationships: (db: AgentsManageDatabaseClient) => <T extends Record<string, unknown>>(scopes: AgentScopeConfig, subAgentIds: string[], config: {
|
|
346
|
-
relationTable:
|
|
347
|
-
componentTable:
|
|
348
|
-
relationIdField:
|
|
349
|
-
componentIdField:
|
|
350
|
-
subAgentIdField:
|
|
351
|
-
selectFields: Record<string,
|
|
347
|
+
relationTable: ScopedTable<"agent">;
|
|
348
|
+
componentTable: ScopedTable<"project">;
|
|
349
|
+
relationIdField: Column;
|
|
350
|
+
componentIdField: Column;
|
|
351
|
+
subAgentIdField: Column;
|
|
352
|
+
selectFields: Record<string, PgColumn>;
|
|
352
353
|
}) => Promise<Record<string, T>>;
|
|
353
354
|
declare const getAgentSubAgentInfos: (db: AgentsManageDatabaseClient) => ({
|
|
354
355
|
scopes: {
|