@inkeep/agents-core 0.73.4 → 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/client-exports.d.ts +2 -2
  3. package/dist/client-exports.js +2 -2
  4. package/dist/data-access/index.d.ts +2 -2
  5. package/dist/data-access/index.js +2 -2
  6. package/dist/data-access/manage/agentFull.d.ts +10 -3
  7. package/dist/data-access/manage/agentFull.js +43 -7
  8. package/dist/data-access/manage/agents.d.ts +35 -26
  9. package/dist/data-access/manage/agents.js +1 -0
  10. package/dist/data-access/manage/artifactComponents.d.ts +14 -14
  11. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  12. package/dist/data-access/manage/dataComponents.d.ts +6 -6
  13. package/dist/data-access/manage/functionTools.d.ts +20 -20
  14. package/dist/data-access/manage/skills.d.ts +15 -15
  15. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +24 -24
  16. package/dist/data-access/manage/subAgentRelations.d.ts +28 -28
  17. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +24 -24
  18. package/dist/data-access/manage/subAgents.d.ts +72 -18
  19. package/dist/data-access/manage/subAgents.js +2 -1
  20. package/dist/data-access/manage/tools.d.ts +30 -30
  21. package/dist/data-access/manage/triggers.d.ts +6 -6
  22. package/dist/data-access/runtime/apiKeys.d.ts +20 -20
  23. package/dist/data-access/runtime/apps.d.ts +14 -14
  24. package/dist/data-access/runtime/conversations.d.ts +32 -32
  25. package/dist/data-access/runtime/events.d.ts +5 -5
  26. package/dist/data-access/runtime/feedback.d.ts +8 -8
  27. package/dist/data-access/runtime/messages.d.ts +24 -24
  28. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +4 -4
  29. package/dist/data-access/runtime/scheduledTriggerUsers.d.ts +1 -1
  30. package/dist/data-access/runtime/tasks.d.ts +5 -5
  31. package/dist/db/manage/manage-schema.d.ts +522 -487
  32. package/dist/db/manage/manage-schema.js +1 -0
  33. package/dist/db/runtime/runtime-schema.d.ts +445 -445
  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 +63 -63
  44. package/dist/validation/schemas.d.ts +3171 -2534
  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,13 +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
+ description: string | null;
14
+ tenantId: string;
15
+ projectId: string;
16
+ name: string;
13
17
  id: string;
14
18
  createdAt: string;
15
- name: string;
16
19
  updatedAt: string;
17
- projectId: string;
18
- tenantId: string;
19
- description: string | null;
20
+ prompt: string | null;
20
21
  models: {
21
22
  base?: {
22
23
  model?: string | undefined;
@@ -42,7 +43,6 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
42
43
  } | null;
43
44
  defaultSubAgentId: string | null;
44
45
  contextConfigId: string | null;
45
- prompt: string | null;
46
46
  statusUpdates: {
47
47
  enabled?: boolean | undefined;
48
48
  numEvents?: number | undefined;
@@ -63,13 +63,14 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
63
63
  declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (params: {
64
64
  scopes: AgentScopeConfig;
65
65
  }) => Promise<{
66
+ description: string | null;
67
+ tenantId: string;
68
+ projectId: string;
69
+ name: string;
66
70
  id: string;
67
71
  createdAt: string;
68
- name: string;
69
72
  updatedAt: string;
70
- projectId: string;
71
- tenantId: string;
72
- description: string | null;
73
+ prompt: string | null;
73
74
  models: {
74
75
  base?: {
75
76
  model?: string | undefined;
@@ -95,7 +96,6 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
95
96
  } | null;
96
97
  defaultSubAgentId: string | null;
97
98
  contextConfigId: string | null;
98
- prompt: string | null;
99
99
  statusUpdates: {
100
100
  enabled?: boolean | undefined;
101
101
  numEvents?: number | undefined;
@@ -113,13 +113,15 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
113
113
  } | null;
114
114
  executionMode: "classic" | "durable";
115
115
  defaultSubAgent: {
116
+ description: string | null;
117
+ tenantId: string;
118
+ projectId: string;
119
+ agentId: string;
120
+ name: string;
116
121
  id: string;
117
122
  createdAt: string;
118
- name: string;
119
123
  updatedAt: string;
120
- projectId: string;
121
- tenantId: string;
122
- description: string | null;
124
+ prompt: string | null;
123
125
  models: {
124
126
  base?: {
125
127
  model?: string | undefined;
@@ -143,21 +145,29 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
143
145
  stopWhen: {
144
146
  stepCountIs?: number | undefined;
145
147
  } | null;
146
- agentId: string;
147
- prompt: string | 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<{
163
+ description: string | null;
164
+ tenantId: string;
165
+ projectId: string;
166
+ name: string;
154
167
  id: string;
155
168
  createdAt: string;
156
- name: string;
157
169
  updatedAt: string;
158
- projectId: string;
159
- tenantId: string;
160
- description: string | null;
170
+ prompt: string | null;
161
171
  models: {
162
172
  base?: {
163
173
  model?: string | undefined;
@@ -183,7 +193,6 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
183
193
  } | null;
184
194
  defaultSubAgentId: string | null;
185
195
  contextConfigId: string | null;
186
- prompt: string | null;
187
196
  statusUpdates: {
188
197
  enabled?: boolean | undefined;
189
198
  numEvents?: number | undefined;
@@ -281,13 +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<{
293
+ description: string | null;
294
+ tenantId: string;
295
+ projectId: string;
296
+ name: string;
284
297
  id: string;
285
298
  createdAt: string;
286
- name: string;
287
299
  updatedAt: string;
288
- projectId: string;
289
- tenantId: string;
290
- description: string | null;
300
+ prompt: string | null;
291
301
  models: {
292
302
  base?: {
293
303
  model?: string | undefined;
@@ -313,7 +323,6 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
313
323
  } | null;
314
324
  defaultSubAgentId: string | null;
315
325
  contextConfigId: string | null;
316
- prompt: string | null;
317
326
  statusUpdates: {
318
327
  enabled?: boolean | undefined;
319
328
  numEvents?: number | undefined;
@@ -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
+ description: string | null;
13
+ tenantId: string;
14
+ projectId: string;
15
+ name: string;
12
16
  id: string;
13
17
  createdAt: string;
14
- name: string;
15
18
  updatedAt: string;
16
- projectId: string;
17
- tenantId: string;
18
- description: string | null;
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
+ description: string | null;
69
+ tenantId: string;
70
+ projectId: string;
71
+ name: string;
68
72
  id: string;
69
73
  createdAt: string;
70
- name: string;
71
74
  updatedAt: string;
72
- projectId: string;
73
- tenantId: string;
74
- description: string | null;
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
- projectId: string;
147
144
  tenantId: string;
145
+ projectId: string;
148
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
- projectId: string;
190
187
  tenantId: string;
188
+ projectId: string;
191
189
  agentId: string;
192
190
  subAgentId: string;
191
+ id: string;
192
+ createdAt: string;
193
193
  artifactComponentId: string;
194
194
  } | null>;
195
195
  /**
@@ -9,24 +9,24 @@ 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
- projectId: string;
16
- tenantId: string;
17
- agentId: string;
18
18
  headersSchema: unknown;
19
19
  contextVariables: Record<string, ContextFetchDefinition> | null;
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
- projectId: string;
28
- tenantId: string;
29
- agentId: string;
30
30
  headersSchema: unknown;
31
31
  contextVariables: Record<string, ContextFetchDefinition> | null;
32
32
  }[]>;
@@ -43,12 +43,12 @@ 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
- projectId: string;
50
- tenantId: string;
51
- agentId: string;
52
52
  headersSchema: unknown;
53
53
  contextVariables: Record<string, ContextFetchDefinition> | null;
54
54
  }>;
@@ -83,12 +83,12 @@ 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
- projectId: string;
90
- tenantId: string;
91
- agentId: string;
92
92
  headersSchema: unknown;
93
93
  contextVariables: Record<string, ContextFetchDefinition> | null;
94
94
  }>;
@@ -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
- projectId: string;
71
68
  tenantId: string;
69
+ projectId: string;
72
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
- projectId: string;
113
110
  tenantId: string;
111
+ projectId: string;
114
112
  agentId: string;
115
113
  subAgentId: string;
114
+ id: string;
115
+ createdAt: string;
116
116
  dataComponentId: string;
117
117
  } | null>;
118
118
  /**
@@ -53,14 +53,14 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
53
53
  data: FunctionToolApiInsert;
54
54
  scopes: AgentScopeConfig;
55
55
  }) => Promise<{
56
+ description: string | null;
57
+ tenantId: string;
58
+ projectId: string;
59
+ agentId: string;
60
+ name: string;
56
61
  id: string;
57
62
  createdAt: string;
58
- name: string;
59
63
  updatedAt: string;
60
- projectId: string;
61
- tenantId: string;
62
- description: string | null;
63
- agentId: string;
64
64
  functionId: string;
65
65
  }>;
66
66
  /**
@@ -95,14 +95,14 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
95
95
  data: FunctionToolApiInsert;
96
96
  scopes: AgentScopeConfig;
97
97
  }) => Promise<{
98
+ description: string | null;
99
+ tenantId: string;
100
+ projectId: string;
101
+ agentId: string;
102
+ name: string;
98
103
  id: string;
99
104
  createdAt: string;
100
- name: string;
101
105
  updatedAt: string;
102
- projectId: string;
103
- tenantId: string;
104
- description: string | null;
105
- agentId: string;
106
106
  functionId: string;
107
107
  }>;
108
108
  declare const getFunctionToolsForSubAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -157,17 +157,17 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
157
157
  needsApproval?: boolean;
158
158
  }> | null;
159
159
  }) => Promise<{
160
- id: string;
161
- createdAt: string;
162
- updatedAt: string;
163
- projectId: string;
164
160
  tenantId: string;
161
+ projectId: string;
165
162
  agentId: string;
166
163
  subAgentId: string;
164
+ id: string;
165
+ createdAt: string;
166
+ updatedAt: string;
167
+ functionToolId: string;
167
168
  toolPolicies: Record<string, {
168
169
  needsApproval?: boolean;
169
170
  }> | null;
170
- functionToolId: string;
171
171
  }>;
172
172
  /**
173
173
  * Update an agent-function tool relation
@@ -222,17 +222,17 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
222
222
  needsApproval?: boolean;
223
223
  }> | null;
224
224
  }) => Promise<{
225
- id: string;
226
- createdAt: string;
227
- updatedAt: string;
228
- projectId: string;
229
225
  tenantId: string;
226
+ projectId: string;
230
227
  agentId: string;
231
228
  subAgentId: string;
229
+ id: string;
230
+ createdAt: string;
231
+ updatedAt: string;
232
+ functionToolId: string;
232
233
  toolPolicies: Record<string, {
233
234
  needsApproval?: boolean;
234
235
  }> | null;
235
- functionToolId: string;
236
236
  }>;
237
237
  //#endregion
238
238
  export { addFunctionToolToSubAgent, associateFunctionToolWithSubAgent, createFunctionTool, deleteFunctionTool, getFunctionToolById, getFunctionToolsForSubAgent, getSubAgentsUsingFunctionTool, isFunctionToolAssociatedWithSubAgent, listFunctionTools, removeFunctionToolFromSubAgent, updateFunctionTool, updateSubAgentFunctionToolRelation, upsertFunctionTool, upsertSubAgentFunctionToolRelation };