@inkeep/agents-core 0.73.5 → 0.74.1

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 (50) 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 +41 -32
  10. package/dist/data-access/manage/agents.js +1 -0
  11. package/dist/data-access/manage/artifactComponents.d.ts +6 -6
  12. package/dist/data-access/manage/contextConfigs.d.ts +12 -12
  13. package/dist/data-access/manage/dataComponents.d.ts +2 -2
  14. package/dist/data-access/manage/functionTools.d.ts +10 -10
  15. package/dist/data-access/manage/skills.d.ts +10 -10
  16. package/dist/data-access/manage/subAgentExternalAgentRelations.d.ts +12 -12
  17. package/dist/data-access/manage/subAgentRelations.d.ts +14 -14
  18. package/dist/data-access/manage/subAgentTeamAgentRelations.d.ts +12 -12
  19. package/dist/data-access/manage/subAgents.d.ts +66 -12
  20. package/dist/data-access/manage/subAgents.js +2 -1
  21. package/dist/data-access/manage/tools.d.ts +21 -21
  22. package/dist/data-access/manage/triggers.d.ts +4 -4
  23. package/dist/data-access/runtime/apiKeys.d.ts +12 -12
  24. package/dist/data-access/runtime/apps.d.ts +9 -9
  25. package/dist/data-access/runtime/conversations.d.ts +32 -32
  26. package/dist/data-access/runtime/events.d.ts +3 -3
  27. package/dist/data-access/runtime/feedback.d.ts +2 -2
  28. package/dist/data-access/runtime/messages.d.ts +12 -12
  29. package/dist/data-access/runtime/scheduledTriggerInvocations.d.ts +4 -4
  30. package/dist/data-access/runtime/scheduledTriggerUsers.d.ts +1 -1
  31. package/dist/data-access/runtime/tasks.d.ts +5 -5
  32. package/dist/db/manage/manage-schema.d.ts +417 -382
  33. package/dist/db/manage/manage-schema.js +1 -0
  34. package/dist/db/runtime/runtime-schema.d.ts +417 -417
  35. package/dist/evaluation/index.d.ts +3 -0
  36. package/dist/evaluation/index.js +3 -0
  37. package/dist/evaluation/pass-criteria-evaluator.d.ts +12 -0
  38. package/dist/evaluation/pass-criteria-evaluator.js +64 -0
  39. package/dist/index.d.ts +5 -3
  40. package/dist/index.js +4 -3
  41. package/dist/validation/drizzle-schema-helpers.d.ts +3 -3
  42. package/dist/validation/index.d.ts +2 -2
  43. package/dist/validation/index.js +2 -2
  44. package/dist/validation/schemas/skills.d.ts +58 -58
  45. package/dist/validation/schemas.d.ts +2793 -2156
  46. package/dist/validation/schemas.js +17 -3
  47. package/drizzle/manage/0021_furry_warlock.sql +2 -0
  48. package/drizzle/manage/meta/0021_snapshot.json +4098 -0
  49. package/drizzle/manage/meta/_journal.json +7 -0
  50. 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 };
@@ -11,14 +11,12 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
11
11
  scopes: AgentScopeConfig;
12
12
  }) => Promise<{
13
13
  id: string;
14
- name: string;
15
14
  createdAt: string;
15
+ name: string;
16
16
  updatedAt: string;
17
- description: string | null;
18
17
  projectId: string;
19
18
  tenantId: string;
20
- defaultSubAgentId: string | null;
21
- contextConfigId: string | null;
19
+ description: string | null;
22
20
  models: {
23
21
  base?: {
24
22
  model?: string | undefined;
@@ -39,6 +37,11 @@ declare const getAgentById: (db: AgentsManageDatabaseClient) => (params: {
39
37
  allowedProviders?: string[] | undefined;
40
38
  } | undefined;
41
39
  } | null;
40
+ stopWhen: {
41
+ transferCountIs?: number | undefined;
42
+ } | null;
43
+ defaultSubAgentId: string | null;
44
+ contextConfigId: string | null;
42
45
  prompt: string | null;
43
46
  statusUpdates: {
44
47
  enabled?: boolean | undefined;
@@ -55,23 +58,18 @@ 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
66
  id: string;
67
- name: string;
68
67
  createdAt: string;
68
+ name: string;
69
69
  updatedAt: string;
70
- description: string | null;
71
70
  projectId: string;
72
71
  tenantId: string;
73
- defaultSubAgentId: string | null;
74
- contextConfigId: string | null;
72
+ description: string | null;
75
73
  models: {
76
74
  base?: {
77
75
  model?: string | undefined;
@@ -92,6 +90,11 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
92
90
  allowedProviders?: string[] | undefined;
93
91
  } | undefined;
94
92
  } | null;
93
+ stopWhen: {
94
+ transferCountIs?: number | undefined;
95
+ } | null;
96
+ defaultSubAgentId: string | null;
97
+ contextConfigId: string | null;
95
98
  prompt: string | null;
96
99
  statusUpdates: {
97
100
  enabled?: boolean | undefined;
@@ -108,19 +111,15 @@ 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
116
  id: string;
117
- name: string;
118
117
  createdAt: string;
118
+ name: string;
119
119
  updatedAt: string;
120
- description: string | null;
121
- agentId: string;
122
120
  projectId: string;
123
121
  tenantId: string;
122
+ description: string | null;
124
123
  models: {
125
124
  base?: {
126
125
  model?: string | undefined;
@@ -141,25 +140,33 @@ declare const getAgentWithDefaultSubAgent: (db: AgentsManageDatabaseClient) => (
141
140
  allowedProviders?: string[] | undefined;
142
141
  } | undefined;
143
142
  } | null;
144
- prompt: string | null;
145
143
  stopWhen: {
146
144
  stepCountIs?: number | undefined;
147
145
  } | 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<{
154
163
  id: string;
155
- name: string;
156
164
  createdAt: string;
165
+ name: string;
157
166
  updatedAt: string;
158
- description: string | null;
159
167
  projectId: string;
160
168
  tenantId: string;
161
- defaultSubAgentId: string | null;
162
- contextConfigId: string | null;
169
+ description: string | null;
163
170
  models: {
164
171
  base?: {
165
172
  model?: string | undefined;
@@ -180,6 +187,11 @@ declare const listAgents: (db: AgentsManageDatabaseClient) => (params: {
180
187
  allowedProviders?: string[] | undefined;
181
188
  } | undefined;
182
189
  } | null;
190
+ stopWhen: {
191
+ transferCountIs?: number | undefined;
192
+ } | null;
193
+ defaultSubAgentId: string | null;
194
+ contextConfigId: string | null;
183
195
  prompt: string | null;
184
196
  statusUpdates: {
185
197
  enabled?: boolean | 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: {
@@ -282,14 +291,12 @@ declare function listAgentsAcrossProjectMainBranches(db: AgentsManageDatabaseCli
282
291
  }): Promise<AvailableAgentInfo[]>;
283
292
  declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInsert) => Promise<{
284
293
  id: string;
285
- name: string;
286
294
  createdAt: string;
295
+ name: string;
287
296
  updatedAt: string;
288
- description: string | null;
289
297
  projectId: string;
290
298
  tenantId: string;
291
- defaultSubAgentId: string | null;
292
- contextConfigId: string | null;
299
+ description: string | null;
293
300
  models: {
294
301
  base?: {
295
302
  model?: string | undefined;
@@ -310,6 +317,11 @@ declare const createAgent: (db: AgentsManageDatabaseClient) => (data: AgentInser
310
317
  allowedProviders?: string[] | undefined;
311
318
  } | undefined;
312
319
  } | null;
320
+ stopWhen: {
321
+ transferCountIs?: number | undefined;
322
+ } | null;
323
+ defaultSubAgentId: string | null;
324
+ contextConfigId: string | null;
313
325
  prompt: string | null;
314
326
  statusUpdates: {
315
327
  enabled?: boolean | 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] || [],
@@ -10,12 +10,12 @@ declare const getArtifactComponentById: (db: AgentsManageDatabaseClient) => (par
10
10
  id: string;
11
11
  }) => Promise<{
12
12
  id: string;
13
- name: string;
14
13
  createdAt: string;
14
+ name: string;
15
15
  updatedAt: string;
16
- description: string | null;
17
16
  projectId: string;
18
17
  tenantId: string;
18
+ description: string | null;
19
19
  props: {
20
20
  [x: string]: unknown;
21
21
  type: "object";
@@ -66,12 +66,12 @@ declare const listArtifactComponentsPaginated: (db: AgentsManageDatabaseClient)
66
66
  }>;
67
67
  declare const createArtifactComponent: (db: AgentsManageDatabaseClient) => (params: ArtifactComponentInsert) => Promise<{
68
68
  id: string;
69
- name: string;
70
69
  createdAt: string;
70
+ name: string;
71
71
  updatedAt: string;
72
- description: string | null;
73
72
  projectId: string;
74
73
  tenantId: string;
74
+ description: string | null;
75
75
  props: {
76
76
  [x: string]: unknown;
77
77
  type: "object";
@@ -143,9 +143,9 @@ declare const associateArtifactComponentWithAgent: (db: AgentsManageDatabaseClie
143
143
  }) => Promise<{
144
144
  id: string;
145
145
  createdAt: string;
146
- agentId: string;
147
146
  projectId: string;
148
147
  tenantId: string;
148
+ agentId: string;
149
149
  subAgentId: string;
150
150
  artifactComponentId: string;
151
151
  }>;
@@ -186,9 +186,9 @@ declare const upsertAgentArtifactComponentRelation: (db: AgentsManageDatabaseCli
186
186
  }) => Promise<{
187
187
  id: string;
188
188
  createdAt: string;
189
- agentId: string;
190
189
  projectId: string;
191
190
  tenantId: string;
191
+ agentId: string;
192
192
  subAgentId: string;
193
193
  artifactComponentId: string;
194
194
  } | null>;
@@ -12,11 +12,11 @@ declare const getContextConfigById: (db: AgentsManageDatabaseClient) => (params:
12
12
  id: string;
13
13
  createdAt: string;
14
14
  updatedAt: string;
15
- headersSchema: unknown;
16
- contextVariables: Record<string, ContextFetchDefinition> | null;
17
- agentId: string;
18
15
  projectId: string;
19
16
  tenantId: string;
17
+ agentId: string;
18
+ headersSchema: unknown;
19
+ contextVariables: Record<string, ContextFetchDefinition> | null;
20
20
  } | undefined>;
21
21
  declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
22
22
  scopes: AgentScopeConfig;
@@ -24,11 +24,11 @@ declare const listContextConfigs: (db: AgentsManageDatabaseClient) => (params: {
24
24
  id: string;
25
25
  createdAt: string;
26
26
  updatedAt: string;
27
- headersSchema: unknown;
28
- contextVariables: Record<string, ContextFetchDefinition> | null;
29
- agentId: string;
30
27
  projectId: string;
31
28
  tenantId: string;
29
+ agentId: string;
30
+ headersSchema: unknown;
31
+ contextVariables: Record<string, ContextFetchDefinition> | null;
32
32
  }[]>;
33
33
  declare const listContextConfigsPaginated: (db: AgentsManageDatabaseClient) => (params: {
34
34
  scopes: AgentScopeConfig;
@@ -46,11 +46,11 @@ declare const createContextConfig: (db: AgentsManageDatabaseClient) => (params:
46
46
  id: string;
47
47
  createdAt: string;
48
48
  updatedAt: string;
49
- headersSchema: unknown;
50
- contextVariables: Record<string, ContextFetchDefinition> | null;
51
- agentId: string;
52
49
  projectId: string;
53
50
  tenantId: string;
51
+ agentId: string;
52
+ headersSchema: unknown;
53
+ contextVariables: Record<string, ContextFetchDefinition> | null;
54
54
  }>;
55
55
  declare const updateContextConfig: (db: AgentsManageDatabaseClient) => (params: {
56
56
  scopes: AgentScopeConfig;
@@ -86,11 +86,11 @@ declare const upsertContextConfig: (db: AgentsManageDatabaseClient) => (params:
86
86
  id: string;
87
87
  createdAt: string;
88
88
  updatedAt: string;
89
- headersSchema: unknown;
90
- contextVariables: Record<string, ContextFetchDefinition> | null;
91
- agentId: string;
92
89
  projectId: string;
93
90
  tenantId: string;
91
+ agentId: string;
92
+ headersSchema: unknown;
93
+ contextVariables: Record<string, ContextFetchDefinition> | null;
94
94
  }>;
95
95
  //#endregion
96
96
  export { countContextConfigs, createContextConfig, deleteContextConfig, getContextConfigById, hasContextConfig, listContextConfigs, listContextConfigsPaginated, updateContextConfig, upsertContextConfig };
@@ -67,9 +67,9 @@ declare const associateDataComponentWithAgent: (db: AgentsManageDatabaseClient)
67
67
  }) => Promise<{
68
68
  id: string;
69
69
  createdAt: string;
70
- agentId: string;
71
70
  projectId: string;
72
71
  tenantId: string;
72
+ agentId: string;
73
73
  subAgentId: string;
74
74
  dataComponentId: string;
75
75
  }>;
@@ -109,9 +109,9 @@ declare const upsertAgentDataComponentRelation: (db: AgentsManageDatabaseClient)
109
109
  }) => Promise<{
110
110
  id: string;
111
111
  createdAt: string;
112
- agentId: string;
113
112
  projectId: string;
114
113
  tenantId: string;
114
+ agentId: string;
115
115
  subAgentId: string;
116
116
  dataComponentId: string;
117
117
  } | null>;
@@ -54,13 +54,13 @@ declare const createFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
54
54
  scopes: AgentScopeConfig;
55
55
  }) => Promise<{
56
56
  id: string;
57
- name: string;
58
57
  createdAt: string;
58
+ name: string;
59
59
  updatedAt: string;
60
- description: string | null;
61
- agentId: string;
62
60
  projectId: string;
63
61
  tenantId: string;
62
+ description: string | null;
63
+ agentId: string;
64
64
  functionId: string;
65
65
  }>;
66
66
  /**
@@ -96,13 +96,13 @@ declare const upsertFunctionTool: (db: AgentsManageDatabaseClient) => (params: {
96
96
  scopes: AgentScopeConfig;
97
97
  }) => Promise<{
98
98
  id: string;
99
- name: string;
100
99
  createdAt: string;
100
+ name: string;
101
101
  updatedAt: string;
102
- description: string | null;
103
- agentId: string;
104
102
  projectId: string;
105
103
  tenantId: string;
104
+ description: string | null;
105
+ agentId: string;
106
106
  functionId: string;
107
107
  }>;
108
108
  declare const getFunctionToolsForSubAgent: (db: AgentsManageDatabaseClient) => (params: {
@@ -160,14 +160,14 @@ declare const addFunctionToolToSubAgent: (db: AgentsManageDatabaseClient) => (pa
160
160
  id: string;
161
161
  createdAt: string;
162
162
  updatedAt: string;
163
- agentId: string;
164
163
  projectId: string;
165
164
  tenantId: string;
165
+ agentId: string;
166
166
  subAgentId: string;
167
- functionToolId: string;
168
167
  toolPolicies: Record<string, {
169
168
  needsApproval?: boolean;
170
169
  }> | null;
170
+ functionToolId: string;
171
171
  }>;
172
172
  /**
173
173
  * Update an agent-function tool relation
@@ -225,14 +225,14 @@ declare const associateFunctionToolWithSubAgent: (db: AgentsManageDatabaseClient
225
225
  id: string;
226
226
  createdAt: string;
227
227
  updatedAt: string;
228
- agentId: string;
229
228
  projectId: string;
230
229
  tenantId: string;
230
+ agentId: string;
231
231
  subAgentId: string;
232
- functionToolId: string;
233
232
  toolPolicies: Record<string, {
234
233
  needsApproval?: boolean;
235
234
  }> | 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 };
@@ -16,14 +16,14 @@ declare const getSkillById: (db: AgentsManageDatabaseClient) => (params: {
16
16
  skillId: string;
17
17
  }) => Promise<{
18
18
  id: string;
19
- name: string;
19
+ content: string;
20
20
  createdAt: string;
21
+ name: string;
21
22
  updatedAt: string;
22
- metadata: Record<string, string> | null;
23
- description: string;
24
23
  projectId: string;
25
24
  tenantId: string;
26
- content: string;
25
+ description: string;
26
+ metadata: Record<string, string> | null;
27
27
  } | null>;
28
28
  declare const getSkillByIdWithFiles: (db: AgentsManageDatabaseClient) => (params: {
29
29
  scopes: ProjectScopeConfig;
@@ -111,14 +111,14 @@ interface WithTenantIdProjectId {
111
111
  declare const createSkill: (db: AgentsManageDatabaseClient) => (data: SkillApiInsert & WithTenantIdProjectId) => Promise<SkillRecordWithFiles>;
112
112
  declare const upsertSkill: (db: AgentsManageDatabaseClient) => (data: SkillApiInsert & WithTenantIdProjectId) => Promise<{
113
113
  id: string;
114
- name: string;
114
+ content: string;
115
115
  createdAt: string;
116
+ name: string;
116
117
  updatedAt: string;
117
- metadata: Record<string, string> | null;
118
- description: string;
119
118
  projectId: string;
120
119
  tenantId: string;
121
- content: string;
120
+ description: string;
121
+ metadata: Record<string, string> | null;
122
122
  }>;
123
123
  declare const updateSkill: (db: AgentsManageDatabaseClient) => (params: {
124
124
  scopes: ProjectScopeConfig;
@@ -140,15 +140,15 @@ declare const upsertSubAgentSkill: (db: AgentsManageDatabaseClient) => (params:
140
140
  alwaysLoaded?: boolean;
141
141
  }) => Promise<{
142
142
  id: string;
143
+ skillId: string;
143
144
  createdAt: string;
144
145
  updatedAt: string;
145
- agentId: string;
146
146
  projectId: string;
147
147
  tenantId: string;
148
+ agentId: string;
148
149
  subAgentId: string;
149
150
  index: number;
150
151
  alwaysLoaded: boolean;
151
- skillId: string;
152
152
  }>;
153
153
  declare const deleteSubAgentSkill: (db: AgentsManageDatabaseClient) => (params: {
154
154
  scopes: AgentScopeConfig;