@inkeep/agents-core 0.73.5 → 0.74.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/dist/auth/init.js +16 -1
  2. package/dist/auth/permissions.d.ts +9 -9
  3. package/dist/client-exports.d.ts +2 -2
  4. package/dist/client-exports.js +2 -2
  5. package/dist/data-access/index.d.ts +2 -2
  6. package/dist/data-access/index.js +2 -2
  7. package/dist/data-access/manage/agentFull.d.ts +10 -3
  8. package/dist/data-access/manage/agentFull.js +43 -7
  9. package/dist/data-access/manage/agents.d.ts +55 -46
  10. package/dist/data-access/manage/agents.js +1 -0
  11. package/dist/data-access/manage/artifactComponents.d.ts +16 -16
  12. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  13. package/dist/data-access/manage/dataComponents.d.ts +8 -8
  14. package/dist/data-access/manage/functionTools.d.ts +18 -18
  15. package/dist/data-access/manage/skills.d.ts +12 -12
  16. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
  17. package/dist/data-access/manage/subAgentRelations.d.ts +28 -28
  18. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
  19. package/dist/data-access/manage/subAgents.d.ts +72 -18
  20. package/dist/data-access/manage/subAgents.js +2 -1
  21. package/dist/data-access/manage/tools.d.ts +27 -27
  22. package/dist/data-access/manage/triggers.d.ts +5 -5
  23. package/dist/data-access/runtime/apiKeys.d.ts +16 -16
  24. package/dist/data-access/runtime/apps.d.ts +10 -10
  25. package/dist/data-access/runtime/conversations.d.ts +20 -20
  26. package/dist/data-access/runtime/events.d.ts +5 -5
  27. package/dist/data-access/runtime/feedback.d.ts +8 -8
  28. package/dist/data-access/runtime/messages.d.ts +21 -21
  29. package/dist/data-access/runtime/scheduledTriggerUsers.d.ts +1 -1
  30. package/dist/data-access/runtime/tasks.d.ts +4 -4
  31. package/dist/db/manage/manage-schema.d.ts +417 -382
  32. package/dist/db/manage/manage-schema.js +1 -0
  33. package/dist/db/runtime/runtime-schema.d.ts +407 -407
  34. package/dist/evaluation/index.d.ts +3 -0
  35. package/dist/evaluation/index.js +3 -0
  36. package/dist/evaluation/pass-criteria-evaluator.d.ts +12 -0
  37. package/dist/evaluation/pass-criteria-evaluator.js +64 -0
  38. package/dist/index.d.ts +5 -3
  39. package/dist/index.js +4 -3
  40. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  41. package/dist/validation/index.d.ts +2 -2
  42. package/dist/validation/index.js +2 -2
  43. package/dist/validation/schemas/skills.d.ts +35 -35
  44. package/dist/validation/schemas.d.ts +1975 -1338
  45. package/dist/validation/schemas.js +17 -3
  46. package/drizzle/manage/0021_furry_warlock.sql +2 -0
  47. package/drizzle/manage/meta/0021_snapshot.json +4098 -0
  48. package/drizzle/manage/meta/_journal.json +7 -0
  49. package/package.json +5 -1
@@ -24,7 +24,7 @@ import { createTrigger, createTriggerUser, createTriggerWithUsers, deleteTrigger
24
24
  import { createAgent, deleteAgent, fetchComponentRelationships, getAgentById, getAgentSubAgentInfos, getAgentWithDefaultSubAgent, getFullAgentDefinition, getFullAgentDefinitionWithRelationIds, listAgents, listAgentsAcrossProjectMainBranches, listAgentsPaginated, updateAgent, upsertAgent } from "./manage/agents.js";
25
25
  import { agentHasArtifactComponents, associateArtifactComponentWithAgent, countArtifactComponents, countArtifactComponentsForAgent, createArtifactComponent, deleteAgentArtifactComponentRelationByAgent, deleteArtifactComponent, getAgentsUsingArtifactComponent, getArtifactComponentById, getArtifactComponentsForAgent, isArtifactComponentAssociatedWithAgent, listArtifactComponents, listArtifactComponentsPaginated, removeArtifactComponentFromAgent, updateArtifactComponent, upsertAgentArtifactComponentRelation, upsertArtifactComponent } from "./manage/artifactComponents.js";
26
26
  import { associateDataComponentWithAgent, countDataComponents, createDataComponent, deleteAgentDataComponentRelationByAgent, deleteDataComponent, getAgentsUsingDataComponent, getDataComponent, getDataComponentsForAgent, isDataComponentAssociatedWithAgent, listDataComponents, listDataComponentsPaginated, removeDataComponentFromAgent, updateDataComponent, upsertAgentDataComponentRelation, upsertDataComponent } from "./manage/dataComponents.js";
27
- import { createFullAgentServerSide, deleteFullAgent, getFullAgent, getFullAgentWithRelationIds, updateFullAgentServerSide } from "./manage/agentFull.js";
27
+ import { createFullAgentServerSide, deleteFullAgent, getFullAgent, getFullAgentWithRelationIds, reconcileOutputContract, updateFullAgentServerSide } from "./manage/agentFull.js";
28
28
  import { listAgentIdsByProject, listContextConfigIdsByProject, listToolIdsByProject } from "./manage/audit-queries.js";
29
29
  import { createAgentDatasetRelation, createAgentEvaluatorRelation, createDataset, createDatasetItem, createDatasetItems, createDatasetRunConfig, createDatasetRunConfigAgentRelation, createEvaluationJobConfig, createEvaluationJobConfigEvaluatorRelation, createEvaluationRunConfig, createEvaluationRunConfigEvaluationSuiteConfigRelation, createEvaluationSuiteConfig, createEvaluationSuiteConfigEvaluatorRelation, createEvaluator, deleteAgentDatasetRelation, deleteAgentEvaluatorRelation, deleteDataset, deleteDatasetItem, deleteDatasetItemsByDataset, deleteDatasetRunConfig, deleteDatasetRunConfigAgentRelation, deleteEvaluationJobConfig, deleteEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfigEvaluatorRelationsByEvaluator, deleteEvaluationRunConfig, deleteEvaluationRunConfigEvaluationSuiteConfigRelation, deleteEvaluationSuiteConfig, deleteEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfigEvaluatorRelationsByEvaluator, deleteEvaluator, getAgentDatasetRelationsByAgent, getAgentDatasetRelationsByDataset, getAgentEvaluatorRelationsByAgent, getAgentEvaluatorRelationsByEvaluator, getAgentIdsForEvaluators, getDatasetById, getDatasetItemById, getDatasetRunConfigAgentRelations, getDatasetRunConfigById, getEvaluationJobConfigById, getEvaluationJobConfigEvaluatorRelations, getEvaluationRunConfigById, getEvaluationRunConfigEvaluationSuiteConfigRelations, getEvaluationSuiteConfigById, getEvaluationSuiteConfigEvaluatorRelations, getEvaluatorById, getEvaluatorsByIds, linkDatasetRunToEvaluationJobConfig, listDatasetItems, listDatasetRunConfigs, listDatasets, listDatasetsForAgent, listEvaluationJobConfigs, listEvaluationRunConfigs, listEvaluationRunConfigsWithSuiteConfigs, listEvaluationSuiteConfigs, listEvaluators, listEvaluatorsForAgent, updateDataset, updateDatasetItem, updateDatasetRunConfig, updateEvaluationRunConfig, updateEvaluationSuiteConfig, updateEvaluator } from "./manage/evalConfig.js";
30
30
  import { revertImprovementRows } from "./manage/improvementRowRevert.js";
@@ -54,4 +54,4 @@ import { getOrganizationMemberByEmail, getOrganizationMemberByUserId, getUserByE
54
54
  import { createWorkflowExecution, getWorkflowExecution, getWorkflowExecutionByConversation, updateWorkflowExecutionStatus } from "./runtime/workflowExecutions.js";
55
55
  import { createValidatedDataAccess, validateProjectExists, withProjectValidation } from "./validation.js";
56
56
 
57
- export { SubAgentIsDefaultError, addConversationIdToInvocation, addFunctionToolToSubAgent, addLedgerArtifacts, addRepositories, addToolToAgent, addUserToOrganization, advanceScheduledTriggerNextRunAt, agentHasArtifactComponents, allowedMethodsToMethodOptions, associateArtifactComponentWithAgent, associateDataComponentWithAgent, associateFunctionToolWithSubAgent, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, cascadeDeleteByAgent, cascadeDeleteByBranch, cascadeDeleteByContextConfig, cascadeDeleteByProject, cascadeDeleteBySubAgent, cascadeDeleteByTool, cascadeDeleteGitHubAccessByProject, checkProjectRepositoryAccess, cleanupExpiredStreamChunks, cleanupTenantCache, clearAppDefaultsByAgent, clearAppDefaultsByProject, clearContextConfigCache, clearConversationCache, clearDevConfigWorkspaceDefaultsByAgent, clearDevConfigWorkspaceDefaultsByProject, clearMcpToolRepositoryAccess, clearProjectRepositoryAccess, clearSchedulerState, clearWorkspaceDefaultsByAgent, clearWorkspaceDefaultsByProject, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, countProjectsInRuntime, countVisibleMessages, createAgent, createAgentDatasetRelation, createAgentEvaluatorRelation, createAgentManageDatabaseConnection, createAgentToolRelation, createAgentsManageDatabaseClient, createAgentsManageDatabasePool, createAgentsRunDatabaseClient, createApiKey, createApp, createArtifactComponent, createCoPilotRun, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDataset, createDatasetItem, createDatasetItems, createDatasetRun, createDatasetRunConfig, createDatasetRunConfigAgentRelation, createDatasetRunConversationRelation, createDatasetRunConversationRelations, createEvaluationJobConfig, createEvaluationJobConfigEvaluatorRelation, createEvaluationResult, createEvaluationResults, createEvaluationRun, createEvaluationRunConfig, createEvaluationRunConfigEvaluationSuiteConfigRelation, createEvaluationSuiteConfig, createEvaluationSuiteConfigEvaluatorRelation, createEvaluator, createEvent, createExternalAgent, createFeedback, createFeedbackBulk, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createInstallation, createInvitationInDb, createInvitationProjectAssignments, createMessage, createOrGetConversation, createProject, createProjectMetadata, createProjectMetadataAndBranch, createScheduledTrigger, createScheduledTriggerInvocation, createScheduledTriggerUser, createSkill, createSkillFileById, createSubAgent, createSubAgentExternalAgentRelation, createSubAgentRelation, createSubAgentTeamAgentRelation, createTask, createTool, createTrigger, createTriggerInvocation, createTriggerUser, createTriggerWithUsers, createUserProfileIfNotExists, createValidatedDataAccess, createWebhookDestination, createWorkAppSlackChannelAgentConfig, createWorkAppSlackUserMapping, createWorkAppSlackWorkspace, createWorkflowExecution, dalCountMembersByRoleBucket, dalGetServiceAccountUserId, dalResolveEntitlement, dalSelectEntitlementForUpdate, dalSumSeatEntitlements, dbResultToMcpTool, dbResultToMcpToolSkeleton, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentDatasetRelation, deleteAgentEvaluatorRelation, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteAllSlackMcpToolAccessConfigsByTenant, deleteAllWorkAppSlackChannelAgentConfigsByTeam, deleteAllWorkAppSlackUserMappingsByTeam, deleteApiKey, deleteApp, deleteAppForProject, deleteAppForTenant, deleteAppsByProject, deleteArtifactComponent, deleteCoPilotRunsByBranchName, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteDataset, deleteDatasetItem, deleteDatasetItemsByDataset, deleteDatasetRun, deleteDatasetRunConfig, deleteDatasetRunConfigAgentRelation, deleteDatasetRunConversationRelation, deleteDatasetRunConversationRelationsByRun, deleteEvaluationJobConfig, deleteEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfigEvaluatorRelationsByEvaluator, deleteEvaluationResult, deleteEvaluationResultsByRun, deleteEvaluationRun, deleteEvaluationRunConfig, deleteEvaluationRunConfigEvaluationSuiteConfigRelation, deleteEvaluationSuiteConfig, deleteEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfigEvaluatorRelationsByEvaluator, deleteEvaluator, deleteEventsByConversationIds, deleteExternalAgent, deleteFeedback, deleteFullAgent, deleteFullProject, deleteFunction, deleteFunctionTool, deleteInstallation, deleteInvitationProjectAssignments, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMcpToolAccessMode, deleteMessage, deletePendingInvocationsForTrigger, deleteProject, deleteProjectAccessMode, deleteProjectAndBranches, deleteProjectMetadata, deleteScheduledTrigger, deleteScheduledTriggerUser, deleteScheduledTriggersByRunAsUserId, deleteSkill, deleteSkillFileById, deleteSlackMcpToolAccessConfig, deleteStreamChunks, deleteSubAgent, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, deleteSubAgentRelation, deleteSubAgentSkill, deleteSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelationsByAgent, deleteSubAgentTeamAgentRelationsBySubAgent, deleteTool, deleteTrigger, deleteTriggerUser, deleteTriggersByRunAsUserId, deleteWebhookDestination, deleteWorkAppSlackChannelAgentConfig, deleteWorkAppSlackChannelAgentConfigsByAgent, deleteWorkAppSlackChannelAgentConfigsByProject, deleteWorkAppSlackUserMapping, deleteWorkAppSlackWorkspace, deleteWorkAppSlackWorkspaceByNangoConnectionId, disconnectInstallation, externalAgentExists, externalAgentUrlExists, fetchComponentRelationships, filterConversationsForJob, findDueScheduledTriggersAcrossProjects, findWorkAppSlackChannelAgentConfig, findWorkAppSlackUserMapping, findWorkAppSlackUserMappingByInkeepUserId, findWorkAppSlackUserMappingBySlackUser, findWorkAppSlackWorkspaceByNangoConnectionId, findWorkAppSlackWorkspaceBySlackTeamId, findWorkAppSlackWorkspaceByTeamId, generateAndCreateApiKey, getActiveAgentForConversation, getAgentById, getAgentDatasetRelationsByAgent, getAgentDatasetRelationsByDataset, getAgentEvaluatorRelationsByAgent, getAgentEvaluatorRelationsByEvaluator, getAgentIdsForEvaluators, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentSubAgentInfos, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentWithDefaultSubAgent, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getAllowedAuthMethods, getApiKeyById, getApiKeyByPublicId, getAppAuthKeysForProject, getAppById, getAppByIdForProject, getAppByIdForTenant, getArtifactComponentById, getArtifactComponentsForAgent, getAuthLookupForEmail, getCacheEntry, getCoPilotRunByBranchName, getCoPilotRunByRef, 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, getEventById, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFeedbackById, getFeedbackByIds, getFilteredAuthMethodsForEmail, 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, getProjectAssignmentsForInvitation, getProjectMainBranchName, getProjectMetadata, getProjectRepositoryAccess, getProjectRepositoryAccessWithDetails, getProjectResourceCounts, getProjectWithBranchInfo, getProjectWithMetadata, getRelatedAgentsForAgent, getRepositoriesByInstallationId, getRepositoriesByTenantId, getRepositoryByFullName, getRepositoryById, getRepositoryCount, getRepositoryCountsByTenantId, getSSOProvidersByDomain, getScheduledTriggerById, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerInvocationStatusSummary, getScheduledTriggerRunInfoBatch, getScheduledTriggerUserCount, getScheduledTriggerUsers, getScheduledTriggerUsersBatch, getSchedulerState, getSkillById, getSkillByIdWithFiles, getSkillFileById, getSkillFilesBySkillIds, getSkillsForSubAgents, getSlackMcpToolAccessConfig, getStreamChunks, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getSubAgentsUsingFunctionTool, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getTriggerById, getTriggerIdsWithUser, getTriggerInvocationById, getTriggerUserCount, getTriggerUsers, getTriggerUsersBatch, getUserByEmail, getUserById, getUserOrganizationsFromDb, getUserProfile, getUserProvidersFromDb, getUserScopedCredentialReference, getVisibleMessages, getWebhookDestinationAgentIds, getWebhookDestinationById, getWebhookTriggerIdsWithUser, getWorkflowExecution, getWorkflowExecutionByConversation, hasApiKey, hasContextConfig, hasCredentialReference, insertStreamChunks, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isFunctionToolAssociatedWithSubAgent, isGithubWorkAppTool, isSlackWorkAppTool, linkDatasetRunToEvaluationJobConfig, listAgentIdsByProject, listAgentRelations, listAgentToolRelations, listAgents, listAgentsAcrossProjectMainBranches, listAgentsPaginated, listApiKeys, listApiKeysByProject, listApiKeysPaginated, listAppsPaginated, listArtifactComponents, listArtifactComponentsPaginated, listCoPilotRuns, listCoPilotRunsByBranchName, listContextCacheByProject, listContextConfigIdsByProject, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listDatasetItems, listDatasetRunConfigs, listDatasetRuns, listDatasetRunsByConfig, listDatasets, listDatasetsForAgent, listEvaluationJobConfigs, listEvaluationResults, listEvaluationResultsByConversation, listEvaluationResultsByRun, listEvaluationRunConfigs, listEvaluationRunConfigsWithSuiteConfigs, listEvaluationRuns, listEvaluationRunsByJobConfigId, listEvaluationSuiteConfigs, listEvaluators, listEvaluatorsForAgent, listEventsByConversationId, listExternalAgents, listExternalAgentsPaginated, listFeedback, listFeedbackByConversation, listFunctionTools, listFunctions, listFunctionsPaginated, listGitHubToolAccessByProject, listGitHubToolAccessModeByProject, listMessages, listOrgEntitlements, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listProjects, listProjectsMetadata, listProjectsMetadataPaginated, listProjectsPaginated, listProjectsWithMetadataPaginated, listScheduledTriggerInvocationsByTriggerId, listScheduledTriggerInvocationsPaginated, listScheduledTriggers, listScheduledTriggersPaginated, listSkills, listSkillsWithFiles, listSlackChannelAgentConfigsByProject, listSlackToolAccessConfigByProject, listSubAgentExternalAgentRelations, listSubAgentTeamAgentRelations, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listToolIdsByProject, listTools, listTriggerInvocationsPaginated, listTriggers, listTriggersPaginated, listUpcomingInvocationsForAgentPaginated, listWebhookDestinationsForEvent, listWebhookDestinationsPaginated, listWorkAppSlackChannelAgentConfigsByTeam, listWorkAppSlackUserMappingsByTeam, listWorkAppSlackWorkspacesByTenant, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, markStreamComplete, projectExists, projectExistsInTable, projectHasResources, projectsMetadataExists, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeFunctionToolFromSubAgent, removeRepositories, removeToolFromAgent, removeUserFromProjectScheduledTriggers, removeUserFromProjectTriggerUsers, resetCancelledInvocationToPending, resolveSlackUserContext, revertImprovementRows, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setMcpToolAccessMode, setMcpToolRepositoryAccess, setProjectAccessMode, setProjectRepositoryAccess, setScheduledTriggerUsers, setSlackMcpToolAccessConfig, setTriggerUsers, setWebhookDestinationAgentIds, syncRepositories, updateAgent, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateApp, updateAppAuthKeysForProject, updateAppForProject, updateAppForTenant, updateAppLastUsed, updateArtifactComponent, updateCoPilotRunStatusByConversationId, updateContextConfig, updateConversation, updateConversationActiveSubAgent, updateCredentialReference, updateDataComponent, updateDataset, updateDatasetItem, updateDatasetRunConfig, updateEvaluationResult, updateEvaluationRun, updateEvaluationRunConfig, updateEvaluationSuiteConfig, updateEvaluator, updateExternalAgent, updateFeedback, updateFullAgentServerSide, updateFullProjectServerSide, updateFunctionTool, updateInstallationStatus, updateInstallationStatusByGitHubId, updateLedgerArtifactParts, updateMessage, updateProject, updateScheduledTrigger, updateScheduledTriggerInvocationStatus, updateSkill, updateSkillFileById, updateSlackMcpToolAccessChannelIds, updateSubAgent, updateSubAgentExternalAgentRelation, updateSubAgentFunctionToolRelation, updateSubAgentTeamAgentRelation, updateTask, updateTool, updateTrigger, updateTriggerInvocationStatus, updateWebhookDestination, updateWorkAppSlackWorkspace, updateWorkflowExecutionStatus, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertOrganization, upsertScheduledTrigger, upsertSchedulerState, upsertSkill, upsertSubAgent, upsertSubAgentExternalAgentRelation, upsertSubAgentFunctionToolRelation, upsertSubAgentRelation, upsertSubAgentSkill, upsertSubAgentTeamAgentRelation, upsertSubAgentToolRelation, upsertTool, upsertTrigger, upsertUserProfile, upsertWorkAppSlackChannelAgentConfig, validateAndGetApiKey, validateProjectExists, validateRepositoryOwnership, validateSubAgent, withProjectValidation };
57
+ export { SubAgentIsDefaultError, addConversationIdToInvocation, addFunctionToolToSubAgent, addLedgerArtifacts, addRepositories, addToolToAgent, addUserToOrganization, advanceScheduledTriggerNextRunAt, agentHasArtifactComponents, allowedMethodsToMethodOptions, associateArtifactComponentWithAgent, associateDataComponentWithAgent, associateFunctionToolWithSubAgent, cancelPastPendingInvocationsForTrigger, cancelPendingInvocationsForTrigger, cascadeDeleteByAgent, cascadeDeleteByBranch, cascadeDeleteByContextConfig, cascadeDeleteByProject, cascadeDeleteBySubAgent, cascadeDeleteByTool, cascadeDeleteGitHubAccessByProject, checkProjectRepositoryAccess, cleanupExpiredStreamChunks, cleanupTenantCache, clearAppDefaultsByAgent, clearAppDefaultsByProject, clearContextConfigCache, clearConversationCache, clearDevConfigWorkspaceDefaultsByAgent, clearDevConfigWorkspaceDefaultsByProject, clearMcpToolRepositoryAccess, clearProjectRepositoryAccess, clearSchedulerState, clearWorkspaceDefaultsByAgent, clearWorkspaceDefaultsByProject, countApiKeys, countArtifactComponents, countArtifactComponentsForAgent, countContextConfigs, countCredentialReferences, countDataComponents, countExternalAgents, countLedgerArtifactsByTask, countMessagesByConversation, countProjects, countProjectsInRuntime, countVisibleMessages, createAgent, createAgentDatasetRelation, createAgentEvaluatorRelation, createAgentManageDatabaseConnection, createAgentToolRelation, createAgentsManageDatabaseClient, createAgentsManageDatabasePool, createAgentsRunDatabaseClient, createApiKey, createApp, createArtifactComponent, createCoPilotRun, createContextConfig, createConversation, createCredentialReference, createDataComponent, createDataset, createDatasetItem, createDatasetItems, createDatasetRun, createDatasetRunConfig, createDatasetRunConfigAgentRelation, createDatasetRunConversationRelation, createDatasetRunConversationRelations, createEvaluationJobConfig, createEvaluationJobConfigEvaluatorRelation, createEvaluationResult, createEvaluationResults, createEvaluationRun, createEvaluationRunConfig, createEvaluationRunConfigEvaluationSuiteConfigRelation, createEvaluationSuiteConfig, createEvaluationSuiteConfigEvaluatorRelation, createEvaluator, createEvent, createExternalAgent, createFeedback, createFeedbackBulk, createFullAgentServerSide, createFullProjectServerSide, createFunctionTool, createInstallation, createInvitationInDb, createInvitationProjectAssignments, createMessage, createOrGetConversation, createProject, createProjectMetadata, createProjectMetadataAndBranch, createScheduledTrigger, createScheduledTriggerInvocation, createScheduledTriggerUser, createSkill, createSkillFileById, createSubAgent, createSubAgentExternalAgentRelation, createSubAgentRelation, createSubAgentTeamAgentRelation, createTask, createTool, createTrigger, createTriggerInvocation, createTriggerUser, createTriggerWithUsers, createUserProfileIfNotExists, createValidatedDataAccess, createWebhookDestination, createWorkAppSlackChannelAgentConfig, createWorkAppSlackUserMapping, createWorkAppSlackWorkspace, createWorkflowExecution, dalCountMembersByRoleBucket, dalGetServiceAccountUserId, dalResolveEntitlement, dalSelectEntitlementForUpdate, dalSumSeatEntitlements, dbResultToMcpTool, dbResultToMcpToolSkeleton, deleteAgent, deleteAgentArtifactComponentRelationByAgent, deleteAgentDataComponentRelationByAgent, deleteAgentDatasetRelation, deleteAgentEvaluatorRelation, deleteAgentRelationsByAgent, deleteAgentToolRelation, deleteAgentToolRelationByAgent, deleteAllSlackMcpToolAccessConfigsByTenant, deleteAllWorkAppSlackChannelAgentConfigsByTeam, deleteAllWorkAppSlackUserMappingsByTeam, deleteApiKey, deleteApp, deleteAppForProject, deleteAppForTenant, deleteAppsByProject, deleteArtifactComponent, deleteCoPilotRunsByBranchName, deleteContextConfig, deleteConversation, deleteCredentialReference, deleteDataComponent, deleteDataset, deleteDatasetItem, deleteDatasetItemsByDataset, deleteDatasetRun, deleteDatasetRunConfig, deleteDatasetRunConfigAgentRelation, deleteDatasetRunConversationRelation, deleteDatasetRunConversationRelationsByRun, deleteEvaluationJobConfig, deleteEvaluationJobConfigEvaluatorRelation, deleteEvaluationJobConfigEvaluatorRelationsByEvaluator, deleteEvaluationResult, deleteEvaluationResultsByRun, deleteEvaluationRun, deleteEvaluationRunConfig, deleteEvaluationRunConfigEvaluationSuiteConfigRelation, deleteEvaluationSuiteConfig, deleteEvaluationSuiteConfigEvaluatorRelation, deleteEvaluationSuiteConfigEvaluatorRelationsByEvaluator, deleteEvaluator, deleteEventsByConversationIds, deleteExternalAgent, deleteFeedback, deleteFullAgent, deleteFullProject, deleteFunction, deleteFunctionTool, deleteInstallation, deleteInvitationProjectAssignments, deleteLedgerArtifactsByContext, deleteLedgerArtifactsByTask, deleteMcpToolAccessMode, deleteMessage, deletePendingInvocationsForTrigger, deleteProject, deleteProjectAccessMode, deleteProjectAndBranches, deleteProjectMetadata, deleteScheduledTrigger, deleteScheduledTriggerUser, deleteScheduledTriggersByRunAsUserId, deleteSkill, deleteSkillFileById, deleteSlackMcpToolAccessConfig, deleteStreamChunks, deleteSubAgent, deleteSubAgentExternalAgentRelation, deleteSubAgentExternalAgentRelationsByAgent, deleteSubAgentExternalAgentRelationsBySubAgent, deleteSubAgentRelation, deleteSubAgentSkill, deleteSubAgentTeamAgentRelation, deleteSubAgentTeamAgentRelationsByAgent, deleteSubAgentTeamAgentRelationsBySubAgent, deleteTool, deleteTrigger, deleteTriggerUser, deleteTriggersByRunAsUserId, deleteWebhookDestination, deleteWorkAppSlackChannelAgentConfig, deleteWorkAppSlackChannelAgentConfigsByAgent, deleteWorkAppSlackChannelAgentConfigsByProject, deleteWorkAppSlackUserMapping, deleteWorkAppSlackWorkspace, deleteWorkAppSlackWorkspaceByNangoConnectionId, disconnectInstallation, externalAgentExists, externalAgentUrlExists, fetchComponentRelationships, filterConversationsForJob, findDueScheduledTriggersAcrossProjects, findWorkAppSlackChannelAgentConfig, findWorkAppSlackUserMapping, findWorkAppSlackUserMappingByInkeepUserId, findWorkAppSlackUserMappingBySlackUser, findWorkAppSlackWorkspaceByNangoConnectionId, findWorkAppSlackWorkspaceBySlackTeamId, findWorkAppSlackWorkspaceByTeamId, generateAndCreateApiKey, getActiveAgentForConversation, getAgentById, getAgentDatasetRelationsByAgent, getAgentDatasetRelationsByDataset, getAgentEvaluatorRelationsByAgent, getAgentEvaluatorRelationsByEvaluator, getAgentIdsForEvaluators, getAgentRelationById, getAgentRelationByParams, getAgentRelations, getAgentRelationsByAgent, getAgentRelationsBySource, getAgentSubAgentInfos, getAgentToolRelationByAgent, getAgentToolRelationById, getAgentToolRelationByTool, getAgentWithDefaultSubAgent, getAgentsForTool, getAgentsUsingArtifactComponent, getAgentsUsingDataComponent, getAllowedAuthMethods, getApiKeyById, getApiKeyByPublicId, getAppAuthKeysForProject, getAppById, getAppByIdForProject, getAppByIdForTenant, getArtifactComponentById, getArtifactComponentsForAgent, getAuthLookupForEmail, getCacheEntry, getCoPilotRunByBranchName, getCoPilotRunByRef, 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, getEventById, getExternalAgent, getExternalAgentByUrl, getExternalAgentsForSubAgent, getFeedbackById, getFeedbackByIds, getFilteredAuthMethodsForEmail, 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, getProjectAssignmentsForInvitation, getProjectMainBranchName, getProjectMetadata, getProjectRepositoryAccess, getProjectRepositoryAccessWithDetails, getProjectResourceCounts, getProjectWithBranchInfo, getProjectWithMetadata, getRelatedAgentsForAgent, getRepositoriesByInstallationId, getRepositoriesByTenantId, getRepositoryByFullName, getRepositoryById, getRepositoryCount, getRepositoryCountsByTenantId, getSSOProvidersByDomain, getScheduledTriggerById, getScheduledTriggerInvocationById, getScheduledTriggerInvocationByIdempotencyKey, getScheduledTriggerInvocationStatusSummary, getScheduledTriggerRunInfoBatch, getScheduledTriggerUserCount, getScheduledTriggerUsers, getScheduledTriggerUsersBatch, getSchedulerState, getSkillById, getSkillByIdWithFiles, getSkillFileById, getSkillFilesBySkillIds, getSkillsForSubAgents, getSlackMcpToolAccessConfig, getStreamChunks, getSubAgentById, getSubAgentExternalAgentRelationById, getSubAgentExternalAgentRelationByParams, getSubAgentExternalAgentRelations, getSubAgentExternalAgentRelationsByAgent, getSubAgentExternalAgentRelationsByExternalAgent, getSubAgentRelationsByTarget, getSubAgentTeamAgentRelationById, getSubAgentTeamAgentRelationByParams, getSubAgentTeamAgentRelations, getSubAgentTeamAgentRelationsByAgent, getSubAgentTeamAgentRelationsByTeamAgent, getSubAgentsByIds, getSubAgentsForExternalAgent, getSubAgentsForTeamAgent, getSubAgentsUsingFunctionTool, getTask, getTeamAgentsForSubAgent, getToolById, getToolsForAgent, getTriggerById, getTriggerIdsWithUser, getTriggerInvocationById, getTriggerUserCount, getTriggerUsers, getTriggerUsersBatch, getUserByEmail, getUserById, getUserOrganizationsFromDb, getUserProfile, getUserProvidersFromDb, getUserScopedCredentialReference, getVisibleMessages, getWebhookDestinationAgentIds, getWebhookDestinationById, getWebhookTriggerIdsWithUser, getWorkflowExecution, getWorkflowExecutionByConversation, hasApiKey, hasContextConfig, hasCredentialReference, insertStreamChunks, invalidateHeadersCache, invalidateInvocationDefinitionsCache, isArtifactComponentAssociatedWithAgent, isDataComponentAssociatedWithAgent, isFunctionToolAssociatedWithSubAgent, isGithubWorkAppTool, isSlackWorkAppTool, linkDatasetRunToEvaluationJobConfig, listAgentIdsByProject, listAgentRelations, listAgentToolRelations, listAgents, listAgentsAcrossProjectMainBranches, listAgentsPaginated, listApiKeys, listApiKeysByProject, listApiKeysPaginated, listAppsPaginated, listArtifactComponents, listArtifactComponentsPaginated, listCoPilotRuns, listCoPilotRunsByBranchName, listContextCacheByProject, listContextConfigIdsByProject, listContextConfigs, listContextConfigsPaginated, listConversations, listCredentialReferences, listCredentialReferencesPaginated, listDataComponents, listDataComponentsPaginated, listDatasetItems, listDatasetRunConfigs, listDatasetRuns, listDatasetRunsByConfig, listDatasets, listDatasetsForAgent, listEvaluationJobConfigs, listEvaluationResults, listEvaluationResultsByConversation, listEvaluationResultsByRun, listEvaluationRunConfigs, listEvaluationRunConfigsWithSuiteConfigs, listEvaluationRuns, listEvaluationRunsByJobConfigId, listEvaluationSuiteConfigs, listEvaluators, listEvaluatorsForAgent, listEventsByConversationId, listExternalAgents, listExternalAgentsPaginated, listFeedback, listFeedbackByConversation, listFunctionTools, listFunctions, listFunctionsPaginated, listGitHubToolAccessByProject, listGitHubToolAccessModeByProject, listMessages, listOrgEntitlements, listPendingScheduledTriggerInvocations, listProjectScheduledTriggerInvocationsPaginated, listProjects, listProjectsMetadata, listProjectsMetadataPaginated, listProjectsPaginated, listProjectsWithMetadataPaginated, listScheduledTriggerInvocationsByTriggerId, listScheduledTriggerInvocationsPaginated, listScheduledTriggers, listScheduledTriggersPaginated, listSkills, listSkillsWithFiles, listSlackChannelAgentConfigsByProject, listSlackToolAccessConfigByProject, listSubAgentExternalAgentRelations, listSubAgentTeamAgentRelations, listSubAgents, listSubAgentsPaginated, listTaskIdsByContextId, listToolIdsByProject, listTools, listTriggerInvocationsPaginated, listTriggers, listTriggersPaginated, listUpcomingInvocationsForAgentPaginated, listWebhookDestinationsForEvent, listWebhookDestinationsPaginated, listWorkAppSlackChannelAgentConfigsByTeam, listWorkAppSlackUserMappingsByTeam, listWorkAppSlackWorkspacesByTenant, markScheduledTriggerInvocationCancelled, markScheduledTriggerInvocationCompleted, markScheduledTriggerInvocationFailed, markScheduledTriggerInvocationRunning, markStreamComplete, projectExists, projectExistsInTable, projectHasResources, projectsMetadataExists, reconcileOutputContract, removeArtifactComponentFromAgent, removeDataComponentFromAgent, removeFunctionToolFromSubAgent, removeRepositories, removeToolFromAgent, removeUserFromProjectScheduledTriggers, removeUserFromProjectTriggerUsers, resetCancelledInvocationToPending, resolveSlackUserContext, revertImprovementRows, setActiveAgentForConversation, setActiveAgentForThread, setCacheEntry, setMcpToolAccessMode, setMcpToolRepositoryAccess, setProjectAccessMode, setProjectRepositoryAccess, setScheduledTriggerUsers, setSlackMcpToolAccessConfig, setTriggerUsers, setWebhookDestinationAgentIds, syncRepositories, updateAgent, updateAgentRelation, updateAgentToolRelation, updateApiKey, updateApiKeyLastUsed, updateApp, updateAppAuthKeysForProject, updateAppForProject, updateAppForTenant, updateAppLastUsed, updateArtifactComponent, updateCoPilotRunStatusByConversationId, updateContextConfig, updateConversation, updateConversationActiveSubAgent, updateCredentialReference, updateDataComponent, updateDataset, updateDatasetItem, updateDatasetRunConfig, updateEvaluationResult, updateEvaluationRun, updateEvaluationRunConfig, updateEvaluationSuiteConfig, updateEvaluator, updateExternalAgent, updateFeedback, updateFullAgentServerSide, updateFullProjectServerSide, updateFunctionTool, updateInstallationStatus, updateInstallationStatusByGitHubId, updateLedgerArtifactParts, updateMessage, updateProject, updateScheduledTrigger, updateScheduledTriggerInvocationStatus, updateSkill, updateSkillFileById, updateSlackMcpToolAccessChannelIds, updateSubAgent, updateSubAgentExternalAgentRelation, updateSubAgentFunctionToolRelation, updateSubAgentTeamAgentRelation, updateTask, updateTool, updateTrigger, updateTriggerInvocationStatus, updateWebhookDestination, updateWorkAppSlackWorkspace, updateWorkflowExecutionStatus, upsertAgent, upsertAgentArtifactComponentRelation, upsertAgentDataComponentRelation, upsertArtifactComponent, upsertContextConfig, upsertCredentialReference, upsertDataComponent, upsertExternalAgent, upsertFunction, upsertFunctionTool, upsertLedgerArtifact, upsertOrganization, upsertScheduledTrigger, upsertSchedulerState, upsertSkill, upsertSubAgent, upsertSubAgentExternalAgentRelation, upsertSubAgentFunctionToolRelation, upsertSubAgentRelation, upsertSubAgentSkill, upsertSubAgentTeamAgentRelation, upsertSubAgentToolRelation, upsertTool, upsertTrigger, upsertUserProfile, upsertWorkAppSlackChannelAgentConfig, validateAndGetApiKey, validateProjectExists, validateRepositoryOwnership, validateSubAgent, withProjectValidation };
@@ -1,14 +1,21 @@
1
1
  import { AgentScopeConfig, ProjectScopeConfig } from "../../db/manage/scope-definitions.js";
2
2
  import "../../types/utility.js";
3
3
  import { AgentsManageDatabaseClient } from "../../db/manage/manage-client.js";
4
+ import { OutputContract } from "../../validation/schemas.js";
4
5
  import { FullAgentDefinition, FullAgentSelectWithRelationIds } from "../../types/entities.js";
5
6
 
6
7
  //#region src/data-access/manage/agentFull.d.ts
7
8
 
8
9
  /**
9
- * Server-side implementation of createFullAgent that performs actual database operations.
10
- * This function creates a complete agent with all agents, tools, and relationships.
10
+ * Drop require* entries that name a component/artifact the sub-agent no longer
11
+ * declares a requirement must never outlive the component it points at, or it
12
+ * becomes an unsatisfiable contract. Returns null when no contract is set.
11
13
  */
14
+ declare function reconcileOutputContract(subAgent: {
15
+ dataComponents?: string[];
16
+ artifactComponents?: string[];
17
+ outputContract?: OutputContract | null;
18
+ }, componentNameById: Map<string, string>, artifactNameById: Map<string, string>): OutputContract | null;
12
19
  declare const createFullAgentServerSide: (db: AgentsManageDatabaseClient) => (scopes: ProjectScopeConfig, agentData: FullAgentDefinition) => Promise<FullAgentDefinition>;
13
20
  /**
14
21
  * Server-side implementation of updateFullAgent that performs actual database operations.
@@ -31,4 +38,4 @@ declare const deleteFullAgent: (db: AgentsManageDatabaseClient) => (params: {
31
38
  scopes: AgentScopeConfig;
32
39
  }) => Promise<boolean>;
33
40
  //#endregion
34
- export { createFullAgentServerSide, deleteFullAgent, getFullAgent, getFullAgentWithRelationIds, updateFullAgentServerSide };
41
+ export { createFullAgentServerSide, deleteFullAgent, getFullAgent, getFullAgentWithRelationIds, reconcileOutputContract, updateFullAgentServerSide };
@@ -14,8 +14,8 @@ import { deleteSubAgentTeamAgentRelation, getSubAgentTeamAgentRelationsByAgent,
14
14
  import { upsertSubAgentToolRelation } from "./tools.js";
15
15
  import { deleteTrigger, listTriggers, setTriggerUsers, upsertTrigger } from "./triggers.js";
16
16
  import { deleteAgent, getAgentById, getFullAgentDefinition, getFullAgentDefinitionWithRelationIds, updateAgent, upsertAgent } from "./agents.js";
17
- import { associateArtifactComponentWithAgent, deleteAgentArtifactComponentRelationByAgent, upsertAgentArtifactComponentRelation } from "./artifactComponents.js";
18
- import { associateDataComponentWithAgent, deleteAgentDataComponentRelationByAgent, upsertAgentDataComponentRelation } from "./dataComponents.js";
17
+ import { associateArtifactComponentWithAgent, deleteAgentArtifactComponentRelationByAgent, listArtifactComponents, upsertAgentArtifactComponentRelation } from "./artifactComponents.js";
18
+ import { associateDataComponentWithAgent, deleteAgentDataComponentRelationByAgent, listDataComponents, upsertAgentDataComponentRelation } from "./dataComponents.js";
19
19
  import { and, eq, inArray, not } from "drizzle-orm";
20
20
 
21
21
  //#region src/data-access/manage/agentFull.ts
@@ -100,10 +100,36 @@ async function applyExecutionLimitsInheritance(db, scopes, agentData) {
100
100
  }, "Failed to apply execution limits inheritance");
101
101
  }
102
102
  }
103
+ async function loadComponentNameMaps(db, scopes, subAgentsMap) {
104
+ if (!Object.values(subAgentsMap).some((s) => s?.outputContract != null)) return {
105
+ componentNameById: /* @__PURE__ */ new Map(),
106
+ artifactNameById: /* @__PURE__ */ new Map()
107
+ };
108
+ const [dataComps, artifactComps] = await Promise.all([listDataComponents(db)({ scopes }), listArtifactComponents(db)({ scopes })]);
109
+ return {
110
+ componentNameById: new Map(dataComps.map((c) => [c.id, c.name])),
111
+ artifactNameById: new Map(artifactComps.map((c) => [c.id, c.name]))
112
+ };
113
+ }
103
114
  /**
104
- * Server-side implementation of createFullAgent that performs actual database operations.
105
- * This function creates a complete agent with all agents, tools, and relationships.
115
+ * Drop require* entries that name a component/artifact the sub-agent no longer
116
+ * declares a requirement must never outlive the component it points at, or it
117
+ * becomes an unsatisfiable contract. Returns null when no contract is set.
106
118
  */
119
+ function reconcileOutputContract(subAgent, componentNameById, artifactNameById) {
120
+ const contract = subAgent.outputContract;
121
+ if (!contract) return null;
122
+ const declaredComponents = new Set((subAgent.dataComponents ?? []).map((id) => componentNameById.get(id)).filter((name) => Boolean(name)));
123
+ const declaredArtifacts = new Set((subAgent.artifactComponents ?? []).map((id) => artifactNameById.get(id)).filter((name) => Boolean(name)));
124
+ const reconciled = { ...contract };
125
+ const requireComponent = contract.requireComponent?.filter((name) => declaredComponents.has(name));
126
+ if (requireComponent && requireComponent.length > 0) reconciled.requireComponent = requireComponent;
127
+ else delete reconciled.requireComponent;
128
+ const requireArtifact = contract.requireArtifact?.filter((name) => declaredArtifacts.has(name));
129
+ if (requireArtifact && requireArtifact.length > 0) reconciled.requireArtifact = requireArtifact;
130
+ else delete reconciled.requireArtifact;
131
+ return reconciled;
132
+ }
107
133
  const createFullAgentServerSide = (db) => async (scopes, agentData) => {
108
134
  const { tenantId, projectId } = scopes;
109
135
  const typed = validateAndTypeAgentData(agentData);
@@ -112,6 +138,10 @@ const createFullAgentServerSide = (db) => async (scopes, agentData) => {
112
138
  tenantId,
113
139
  projectId
114
140
  }, typed);
141
+ const { componentNameById, artifactNameById } = await loadComponentNameMaps(db, {
142
+ tenantId,
143
+ projectId
144
+ }, typed.subAgents);
115
145
  try {
116
146
  logger.info("CredentialReferences are project-scoped - skipping credential reference creation in agent");
117
147
  logger.info("MCP Tools are project-scoped - skipping tool creation in agent");
@@ -342,7 +372,8 @@ const createFullAgentServerSide = (db) => async (scopes, agentData) => {
342
372
  prompt: subAgent.prompt || "",
343
373
  conversationHistoryConfig: subAgent.conversationHistoryConfig,
344
374
  models: subAgent.models,
345
- stopWhen: subAgent.stopWhen
375
+ stopWhen: subAgent.stopWhen,
376
+ outputContract: reconcileOutputContract(subAgent, componentNameById, artifactNameById)
346
377
  } });
347
378
  logger.info({ subAgentId }, "Sub-agent processed successfully");
348
379
  } catch (error) {
@@ -643,6 +674,10 @@ const updateFullAgentServerSide = (db) => async (scopes, agentData) => {
643
674
  const { tenantId, projectId } = scopes;
644
675
  const typedAgentDefinition = validateAndTypeAgentData(agentData);
645
676
  if (!typedAgentDefinition.id) throw new Error("Agent ID is required");
677
+ const { componentNameById, artifactNameById } = await loadComponentNameMaps(db, {
678
+ tenantId,
679
+ projectId
680
+ }, typedAgentDefinition.subAgents);
646
681
  logger.info({
647
682
  tenantId,
648
683
  agentId: typedAgentDefinition.id,
@@ -984,7 +1019,8 @@ const updateFullAgentServerSide = (db) => async (scopes, agentData) => {
984
1019
  prompt: subAgent.prompt || "",
985
1020
  conversationHistoryConfig: subAgent.conversationHistoryConfig,
986
1021
  models: finalModelSettings,
987
- stopWhen: subAgent.stopWhen
1022
+ stopWhen: subAgent.stopWhen,
1023
+ outputContract: reconcileOutputContract(subAgent, componentNameById, artifactNameById)
988
1024
  } });
989
1025
  logger.info({ subAgentId }, "Sub-agent processed successfully");
990
1026
  } catch (error) {
@@ -1600,4 +1636,4 @@ const deleteFullAgent = (db) => async (params) => {
1600
1636
  };
1601
1637
 
1602
1638
  //#endregion
1603
- export { createFullAgentServerSide, deleteFullAgent, getFullAgent, getFullAgentWithRelationIds, updateFullAgentServerSide };
1639
+ export { createFullAgentServerSide, deleteFullAgent, getFullAgent, getFullAgentWithRelationIds, reconcileOutputContract, updateFullAgentServerSide };
@@ -10,15 +10,14 @@ import { PgColumn } from "drizzle-orm/pg-core";
10
10
  declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
11
11
  scopes: AgentScopeConfig;
12
12
  }) => Promise<{
13
- id: string;
13
+ description: string | null;
14
+ tenantId: string;
15
+ projectId: string;
14
16
  name: string;
17
+ id: string;
15
18
  createdAt: string;
16
19
  updatedAt: string;
17
- description: string | null;
18
- projectId: string;
19
- tenantId: string;
20
- defaultSubAgentId: string | null;
21
- contextConfigId: string | null;
20
+ prompt: string | null;
22
21
  models: {
23
22
  base?: {
24
23
  model?: string | undefined;
@@ -39,7 +38,11 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
39
38
  allowedProviders?: string[] | undefined;
40
39
  } | undefined;
41
40
  } | null;
42
- prompt: string | null;
41
+ stopWhen: {
42
+ transferCountIs?: number | undefined;
43
+ } | null;
44
+ defaultSubAgentId: string | null;
45
+ contextConfigId: string | null;
43
46
  statusUpdates: {
44
47
  enabled?: boolean | undefined;
45
48
  numEvents?: number | undefined;
@@ -55,23 +58,19 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
55
58
  } | undefined;
56
59
  }[] | undefined;
57
60
  } | null;
58
- stopWhen: {
59
- transferCountIs?: number | undefined;
60
- } | null;
61
61
  executionMode: "classic" | "durable";
62
62
  } | null>;
63
63
  declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
64
64
  scopes: AgentScopeConfig;
65
65
  }) => Promise<{
66
- id: string;
66
+ description: string | null;
67
+ tenantId: string;
68
+ projectId: string;
67
69
  name: string;
70
+ id: string;
68
71
  createdAt: string;
69
72
  updatedAt: string;
70
- description: string | null;
71
- projectId: string;
72
- tenantId: string;
73
- defaultSubAgentId: string | null;
74
- contextConfigId: string | null;
73
+ prompt: string | null;
75
74
  models: {
76
75
  base?: {
77
76
  model?: string | undefined;
@@ -92,7 +91,11 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
92
91
  allowedProviders?: string[] | undefined;
93
92
  } | undefined;
94
93
  } | null;
95
- prompt: string | null;
94
+ stopWhen: {
95
+ transferCountIs?: number | undefined;
96
+ } | null;
97
+ defaultSubAgentId: string | null;
98
+ contextConfigId: string | null;
96
99
  statusUpdates: {
97
100
  enabled?: boolean | undefined;
98
101
  numEvents?: number | undefined;
@@ -108,19 +111,17 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
108
111
  } | undefined;
109
112
  }[] | undefined;
110
113
  } | null;
111
- stopWhen: {
112
- transferCountIs?: number | undefined;
113
- } | null;
114
114
  executionMode: "classic" | "durable";
115
115
  defaultSubAgent: {
116
- id: string;
116
+ description: string | null;
117
+ tenantId: string;
118
+ projectId: string;
119
+ agentId: string;
117
120
  name: string;
121
+ id: string;
118
122
  createdAt: string;
119
123
  updatedAt: string;
120
- description: string | null;
121
- agentId: string;
122
- projectId: string;
123
- tenantId: string;
124
+ prompt: string | null;
124
125
  models: {
125
126
  base?: {
126
127
  model?: string | undefined;
@@ -141,25 +142,32 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
141
142
  allowedProviders?: string[] | undefined;
142
143
  } | undefined;
143
144
  } | null;
144
- prompt: string | null;
145
145
  stopWhen: {
146
146
  stepCountIs?: number | undefined;
147
147
  } | null;
148
148
  conversationHistoryConfig: ConversationHistoryConfig | null;
149
+ outputContract: {
150
+ [x: string]: unknown;
151
+ allowText?: boolean | undefined;
152
+ requireComponent?: string[] | undefined;
153
+ requireArtifact?: string[] | undefined;
154
+ requireTransfer?: boolean | undefined;
155
+ onViolation?: "retry" | "reject" | "warn" | undefined;
156
+ retryBudget?: number | undefined;
157
+ } | null;
149
158
  } | null;
150
159
  } | null>;
151
160
  declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
152
161
  scopes: ProjectScopeConfig;
153
162
  }) => Promise<{
154
- id: string;
163
+ description: string | null;
164
+ tenantId: string;
165
+ projectId: string;
155
166
  name: string;
167
+ id: string;
156
168
  createdAt: string;
157
169
  updatedAt: string;
158
- description: string | null;
159
- projectId: string;
160
- tenantId: string;
161
- defaultSubAgentId: string | null;
162
- contextConfigId: string | null;
170
+ prompt: string | null;
163
171
  models: {
164
172
  base?: {
165
173
  model?: string | undefined;
@@ -180,7 +188,11 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
180
188
  allowedProviders?: string[] | undefined;
181
189
  } | undefined;
182
190
  } | null;
183
- prompt: string | null;
191
+ stopWhen: {
192
+ transferCountIs?: number | undefined;
193
+ } | null;
194
+ defaultSubAgentId: string | null;
195
+ contextConfigId: string | null;
184
196
  statusUpdates: {
185
197
  enabled?: boolean | undefined;
186
198
  numEvents?: number | undefined;
@@ -196,9 +208,6 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
196
208
  } | undefined;
197
209
  }[] | undefined;
198
210
  } | null;
199
- stopWhen: {
200
- transferCountIs?: number | undefined;
201
- } | null;
202
211
  executionMode: "classic" | "durable";
203
212
  }[]>;
204
213
  declare const listAgentsPaginated: (db: AgentsManageDatabaseClient) => (params: {
@@ -281,15 +290,14 @@ declare function listAgentsAcrossProjectMainBranches(db: AgentsManageDatabaseCli
281
290
  projectIds: string[];
282
291
  }): Promise<AvailableAgentInfo[]>;
283
292
  declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
284
- id: string;
293
+ description: string | null;
294
+ tenantId: string;
295
+ projectId: string;
285
296
  name: string;
297
+ id: string;
286
298
  createdAt: string;
287
299
  updatedAt: string;
288
- description: string | null;
289
- projectId: string;
290
- tenantId: string;
291
- defaultSubAgentId: string | null;
292
- contextConfigId: string | null;
300
+ prompt: string | null;
293
301
  models: {
294
302
  base?: {
295
303
  model?: string | undefined;
@@ -310,7 +318,11 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
310
318
  allowedProviders?: string[] | undefined;
311
319
  } | undefined;
312
320
  } | null;
313
- prompt: string | null;
321
+ stopWhen: {
322
+ transferCountIs?: number | undefined;
323
+ } | null;
324
+ defaultSubAgentId: string | null;
325
+ contextConfigId: string | null;
314
326
  statusUpdates: {
315
327
  enabled?: boolean | undefined;
316
328
  numEvents?: number | undefined;
@@ -326,9 +338,6 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
326
338
  } | undefined;
327
339
  }[] | undefined;
328
340
  } | null;
329
- stopWhen: {
330
- transferCountIs?: number | undefined;
331
- } | null;
332
341
  executionMode: "classic" | "durable";
333
342
  }>;
334
343
  declare const updateAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -306,6 +306,7 @@ const getFullAgentDefinitionInternal = (db) => async ({ scopes: { tenantId, proj
306
306
  prompt: agent$1.prompt,
307
307
  models: agent$1.models,
308
308
  stopWhen: agent$1.stopWhen,
309
+ outputContract: agent$1.outputContract,
309
310
  canTransferTo,
310
311
  canDelegateTo,
311
312
  skills: skillsBySubAgent[agent$1.id] || [],
@@ -9,13 +9,13 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
9
9
  scopes: ProjectScopeConfig;
10
10
  id: string;
11
11
  }) => Promise<{
12
- id: string;
12
+ description: string | null;
13
+ tenantId: string;
14
+ projectId: string;
13
15
  name: string;
16
+ id: string;
14
17
  createdAt: string;
15
18
  updatedAt: string;
16
- description: string | null;
17
- projectId: string;
18
- tenantId: string;
19
19
  props: {
20
20
  [x: string]: unknown;
21
21
  type: "object";
@@ -65,13 +65,13 @@ declare const listArtifactComponentsPaginated: (db: AgentsManageDatabaseClient)
65
65
  };
66
66
  }>;
67
67
  declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
68
- id: string;
68
+ description: string | null;
69
+ tenantId: string;
70
+ projectId: string;
69
71
  name: string;
72
+ id: string;
70
73
  createdAt: string;
71
74
  updatedAt: string;
72
- description: string | null;
73
- projectId: string;
74
- tenantId: string;
75
75
  props: {
76
76
  [x: string]: unknown;
77
77
  type: "object";
@@ -141,12 +141,12 @@ declare const associateArtifactComponentWithAgent: (db: AgentsManageDatabaseClie
141
141
  scopes: SubAgentScopeConfig;
142
142
  artifactComponentId: string;
143
143
  }) => Promise<{
144
- id: string;
145
- createdAt: string;
146
- agentId: string;
147
- projectId: string;
148
144
  tenantId: string;
145
+ projectId: string;
146
+ agentId: string;
149
147
  subAgentId: string;
148
+ id: string;
149
+ createdAt: string;
150
150
  artifactComponentId: string;
151
151
  }>;
152
152
  declare const removeArtifactComponentFromAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -184,12 +184,12 @@ declare const upsertAgentArtifactComponentRelation: (db: AgentsManageDatabaseCli
184
184
  scopes: SubAgentScopeConfig;
185
185
  artifactComponentId: string;
186
186
  }) => Promise<{
187
- id: string;
188
- createdAt: string;
189
- agentId: string;
190
- projectId: string;
191
187
  tenantId: string;
188
+ projectId: string;
189
+ agentId: string;
192
190
  subAgentId: string;
191
+ id: string;
192
+ createdAt: string;
193
193
  artifactComponentId: string;
194
194
  } | null>;
195
195
  /**
@@ -9,26 +9,26 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
9
9
  scopes: AgentScopeConfig;
10
10
  id: string;
11
11
  }) => Promise<{
12
+ tenantId: string;
13
+ projectId: string;
14
+ agentId: string;
12
15
  id: string;
13
16
  createdAt: string;
14
17
  updatedAt: string;
15
18
  headersSchema: unknown;
16
19
  contextVariables: Record<string, ContextFetchDefinition> | null;
17
- agentId: string;
18
- projectId: string;
19
- tenantId: string;
20
20
  } | undefined>;
21
21
  declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
22
22
  scopes: AgentScopeConfig;
23
23
  }) => Promise<{
24
+ tenantId: string;
25
+ projectId: string;
26
+ agentId: string;
24
27
  id: string;
25
28
  createdAt: string;
26
29
  updatedAt: string;
27
30
  headersSchema: unknown;
28
31
  contextVariables: Record<string, ContextFetchDefinition> | null;
29
- agentId: string;
30
- projectId: string;
31
- tenantId: string;
32
32
  }[]>;
33
33
  declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (params: {
34
34
  scopes: AgentScopeConfig;
@@ -43,14 +43,14 @@ declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (
43
43
  };
44
44
  }>;
45
45
  declare const createContextConfig: (db: AgentsManageDatabaseClient) => (params: ContextConfigInsert) => Promise<{
46
+ tenantId: string;
47
+ projectId: string;
48
+ agentId: string;
46
49
  id: string;
47
50
  createdAt: string;
48
51
  updatedAt: string;
49
52
  headersSchema: unknown;
50
53
  contextVariables: Record<string, ContextFetchDefinition> | null;
51
- agentId: string;
52
- projectId: string;
53
- tenantId: string;
54
54
  }>;
55
55
  declare const updateContextConfig: (db: AgentsManageDatabaseClient) => (params: {
56
56
  scopes: AgentScopeConfig;
@@ -83,14 +83,14 @@ declare const countContextConfigs: (db: AgentsManageDatabaseClient) => (params:
83
83
  declare const upsertContextConfig: (db: AgentsManageDatabaseClient) => (params: {
84
84
  data: ContextConfigInsert;
85
85
  }) => Promise<{
86
+ tenantId: string;
87
+ projectId: string;
88
+ agentId: string;
86
89
  id: string;
87
90
  createdAt: string;
88
91
  updatedAt: string;
89
92
  headersSchema: unknown;
90
93
  contextVariables: Record<string, ContextFetchDefinition> | null;
91
- agentId: string;
92
- projectId: string;
93
- tenantId: string;
94
94
  }>;
95
95
  //#endregion
96
96
  export { countContextConfigs, createContextConfig, deleteContextConfig, getContextConfigById, hasContextConfig, listContextConfigs, listContextConfigsPaginated, updateContextConfig, upsertContextConfig };
@@ -65,12 +65,12 @@ declare const associateDataComponentWithAgent: (db: AgentsManageDatabaseClient)
65
65
  scopes: SubAgentScopeConfig;
66
66
  dataComponentId: string;
67
67
  }) => Promise<{
68
- id: string;
69
- createdAt: string;
70
- agentId: string;
71
- projectId: string;
72
68
  tenantId: string;
69
+ projectId: string;
70
+ agentId: string;
73
71
  subAgentId: string;
72
+ id: string;
73
+ createdAt: string;
74
74
  dataComponentId: string;
75
75
  }>;
76
76
  /**
@@ -107,12 +107,12 @@ declare const upsertAgentDataComponentRelation: (db: AgentsManageDatabaseClient)
107
107
  scopes: SubAgentScopeConfig;
108
108
  dataComponentId: string;
109
109
  }) => Promise<{
110
- id: string;
111
- createdAt: string;
112
- agentId: string;
113
- projectId: string;
114
110
  tenantId: string;
111
+ projectId: string;
112
+ agentId: string;
115
113
  subAgentId: string;
114
+ id: string;
115
+ createdAt: string;
116
116
  dataComponentId: string;
117
117
  } | null>;
118
118
  /**