libre-webui 0.25.0 → 0.27.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +32 -22
- package/backend/dist/index.d.ts.map +1 -1
- package/backend/dist/index.js +33 -4
- package/backend/dist/index.js.map +1 -1
- package/backend/dist/middleware/auth.d.ts +7 -0
- package/backend/dist/middleware/auth.d.ts.map +1 -1
- package/backend/dist/middleware/auth.js +26 -0
- package/backend/dist/middleware/auth.js.map +1 -1
- package/backend/dist/middleware/index.d.ts +20 -0
- package/backend/dist/middleware/index.d.ts.map +1 -1
- package/backend/dist/middleware/index.js +105 -2
- package/backend/dist/middleware/index.js.map +1 -1
- package/backend/dist/models/personaModel.d.ts.map +1 -1
- package/backend/dist/models/personaModel.js +2 -0
- package/backend/dist/models/personaModel.js.map +1 -1
- package/backend/dist/observability/otel.d.ts +40 -0
- package/backend/dist/observability/otel.d.ts.map +1 -0
- package/backend/dist/observability/otel.js +337 -0
- package/backend/dist/observability/otel.js.map +1 -0
- package/backend/dist/observability/requestContext.d.ts +14 -0
- package/backend/dist/observability/requestContext.d.ts.map +1 -0
- package/backend/dist/observability/requestContext.js +21 -0
- package/backend/dist/observability/requestContext.js.map +1 -0
- package/backend/dist/persistence/chatGenerationTypes.d.ts +9 -0
- package/backend/dist/persistence/chatGenerationTypes.d.ts.map +1 -1
- package/backend/dist/persistence/extensionTypes.d.ts +13 -0
- package/backend/dist/persistence/extensionTypes.d.ts.map +1 -1
- package/backend/dist/persistence/extensionTypes.js.map +1 -1
- package/backend/dist/persistence/index.d.ts +1 -1
- package/backend/dist/persistence/index.d.ts.map +1 -1
- package/backend/dist/persistence/index.js.map +1 -1
- package/backend/dist/persistence/postgresAgentFoundationMigration.d.ts +9 -0
- package/backend/dist/persistence/postgresAgentFoundationMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresAgentFoundationMigration.js +164 -0
- package/backend/dist/persistence/postgresAgentFoundationMigration.js.map +1 -0
- package/backend/dist/persistence/postgresExtensionRepositories.d.ts.map +1 -1
- package/backend/dist/persistence/postgresExtensionRepositories.js +46 -2
- package/backend/dist/persistence/postgresExtensionRepositories.js.map +1 -1
- package/backend/dist/persistence/postgresMediaEnterpriseOpsMigration.d.ts +10 -0
- package/backend/dist/persistence/postgresMediaEnterpriseOpsMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresMediaEnterpriseOpsMigration.js +148 -0
- package/backend/dist/persistence/postgresMediaEnterpriseOpsMigration.js.map +1 -0
- package/backend/dist/persistence/postgresMfaPushRecoveryMigration.d.ts +9 -0
- package/backend/dist/persistence/postgresMfaPushRecoveryMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresMfaPushRecoveryMigration.js +107 -0
- package/backend/dist/persistence/postgresMfaPushRecoveryMigration.js.map +1 -0
- package/backend/dist/persistence/postgresMigrationRegistry.d.ts.map +1 -1
- package/backend/dist/persistence/postgresMigrationRegistry.js +12 -0
- package/backend/dist/persistence/postgresMigrationRegistry.js.map +1 -1
- package/backend/dist/persistence/postgresNotesV2Migration.d.ts +4 -0
- package/backend/dist/persistence/postgresNotesV2Migration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresNotesV2Migration.js +57 -0
- package/backend/dist/persistence/postgresNotesV2Migration.js.map +1 -0
- package/backend/dist/persistence/postgresResourceRepositories.d.ts.map +1 -1
- package/backend/dist/persistence/postgresResourceRepositories.js +1930 -133
- package/backend/dist/persistence/postgresResourceRepositories.js.map +1 -1
- package/backend/dist/persistence/postgresSecurityRepositories.d.ts.map +1 -1
- package/backend/dist/persistence/postgresSecurityRepositories.js +150 -0
- package/backend/dist/persistence/postgresSecurityRepositories.js.map +1 -1
- package/backend/dist/persistence/postgresSkillFilesMigration.d.ts +9 -0
- package/backend/dist/persistence/postgresSkillFilesMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresSkillFilesMigration.js +50 -0
- package/backend/dist/persistence/postgresSkillFilesMigration.js.map +1 -0
- package/backend/dist/persistence/postgresTeamCollaborationMigration.d.ts +10 -0
- package/backend/dist/persistence/postgresTeamCollaborationMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresTeamCollaborationMigration.js +161 -0
- package/backend/dist/persistence/postgresTeamCollaborationMigration.js.map +1 -0
- package/backend/dist/persistence/resourceTypes.d.ts +600 -3
- package/backend/dist/persistence/resourceTypes.d.ts.map +1 -1
- package/backend/dist/persistence/resourceTypes.js.map +1 -1
- package/backend/dist/persistence/securityTypes.d.ts +59 -0
- package/backend/dist/persistence/securityTypes.d.ts.map +1 -1
- package/backend/dist/persistence/sqliteExtensionRepositories.d.ts.map +1 -1
- package/backend/dist/persistence/sqliteExtensionRepositories.js +26 -4
- package/backend/dist/persistence/sqliteExtensionRepositories.js.map +1 -1
- package/backend/dist/persistence/sqliteMigrations.d.ts +10 -0
- package/backend/dist/persistence/sqliteMigrations.d.ts.map +1 -1
- package/backend/dist/persistence/sqliteMigrations.js +1492 -131
- package/backend/dist/persistence/sqliteMigrations.js.map +1 -1
- package/backend/dist/persistence/sqliteResourceRepositories.d.ts.map +1 -1
- package/backend/dist/persistence/sqliteResourceRepositories.js +1657 -134
- package/backend/dist/persistence/sqliteResourceRepositories.js.map +1 -1
- package/backend/dist/persistence/sqliteSecurityRepositories.d.ts.map +1 -1
- package/backend/dist/persistence/sqliteSecurityRepositories.js +134 -0
- package/backend/dist/persistence/sqliteSecurityRepositories.js.map +1 -1
- package/backend/dist/persistence/sqliteToPostgresMigration.d.ts.map +1 -1
- package/backend/dist/persistence/sqliteToPostgresMigration.js +302 -3
- package/backend/dist/persistence/sqliteToPostgresMigration.js.map +1 -1
- package/backend/dist/platform/jobs/domainJobContracts.d.ts +10 -0
- package/backend/dist/platform/jobs/domainJobContracts.d.ts.map +1 -1
- package/backend/dist/platform/jobs/domainJobContracts.js +10 -0
- package/backend/dist/platform/jobs/domainJobContracts.js.map +1 -1
- package/backend/dist/platform/jobs/domainJobHandlers.d.ts.map +1 -1
- package/backend/dist/platform/jobs/domainJobHandlers.js +374 -4
- package/backend/dist/platform/jobs/domainJobHandlers.js.map +1 -1
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts.map +1 -1
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.js +4 -2
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.js.map +1 -1
- package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts.map +1 -1
- package/backend/dist/platform/jobs/postgresDurableJobWorker.js +4 -2
- package/backend/dist/platform/jobs/postgresDurableJobWorker.js.map +1 -1
- package/backend/dist/platform/storage/pgVectorStore.d.ts +2 -1
- package/backend/dist/platform/storage/pgVectorStore.d.ts.map +1 -1
- package/backend/dist/platform/storage/pgVectorStore.js +51 -0
- package/backend/dist/platform/storage/pgVectorStore.js.map +1 -1
- package/backend/dist/platform/storage/platformDomainRepositories.d.ts +8 -2
- package/backend/dist/platform/storage/platformDomainRepositories.d.ts.map +1 -1
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts.map +1 -1
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js +25 -4
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js.map +1 -1
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts +2 -1
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts.map +1 -1
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js +35 -0
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js.map +1 -1
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts.map +1 -1
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js +26 -3
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js.map +1 -1
- package/backend/dist/platform/storage/vectorStore.d.ts +14 -0
- package/backend/dist/platform/storage/vectorStore.d.ts.map +1 -1
- package/backend/dist/platform/storage/vectorStore.js.map +1 -1
- package/backend/dist/routes/access.d.ts.map +1 -1
- package/backend/dist/routes/access.js +84 -3
- package/backend/dist/routes/access.js.map +1 -1
- package/backend/dist/routes/auth.d.ts.map +1 -1
- package/backend/dist/routes/auth.js +419 -1
- package/backend/dist/routes/auth.js.map +1 -1
- package/backend/dist/routes/calendar.d.ts.map +1 -1
- package/backend/dist/routes/calendar.js +125 -22
- package/backend/dist/routes/calendar.js.map +1 -1
- package/backend/dist/routes/channels.d.ts +3 -0
- package/backend/dist/routes/channels.d.ts.map +1 -0
- package/backend/dist/routes/channels.js +447 -0
- package/backend/dist/routes/channels.js.map +1 -0
- package/backend/dist/routes/chat.d.ts.map +1 -1
- package/backend/dist/routes/chat.js +195 -7
- package/backend/dist/routes/chat.js.map +1 -1
- package/backend/dist/routes/costs.d.ts +3 -0
- package/backend/dist/routes/costs.d.ts.map +1 -0
- package/backend/dist/routes/costs.js +191 -0
- package/backend/dist/routes/costs.js.map +1 -0
- package/backend/dist/routes/documents.d.ts.map +1 -1
- package/backend/dist/routes/documents.js +68 -21
- package/backend/dist/routes/documents.js.map +1 -1
- package/backend/dist/routes/evaluations.d.ts +3 -0
- package/backend/dist/routes/evaluations.d.ts.map +1 -0
- package/backend/dist/routes/evaluations.js +352 -0
- package/backend/dist/routes/evaluations.js.map +1 -0
- package/backend/dist/routes/imageGen.d.ts.map +1 -1
- package/backend/dist/routes/imageGen.js +2 -1
- package/backend/dist/routes/imageGen.js.map +1 -1
- package/backend/dist/routes/media.d.ts.map +1 -1
- package/backend/dist/routes/media.js +228 -7
- package/backend/dist/routes/media.js.map +1 -1
- package/backend/dist/routes/notes.d.ts.map +1 -1
- package/backend/dist/routes/notes.js +149 -36
- package/backend/dist/routes/notes.js.map +1 -1
- package/backend/dist/routes/notifications.d.ts +3 -0
- package/backend/dist/routes/notifications.d.ts.map +1 -0
- package/backend/dist/routes/notifications.js +213 -0
- package/backend/dist/routes/notifications.js.map +1 -0
- package/backend/dist/routes/openaiCompat.d.ts +3 -0
- package/backend/dist/routes/openaiCompat.d.ts.map +1 -0
- package/backend/dist/routes/openaiCompat.js +314 -0
- package/backend/dist/routes/openaiCompat.js.map +1 -0
- package/backend/dist/routes/personas.js +1 -1
- package/backend/dist/routes/personas.js.map +1 -1
- package/backend/dist/routes/prompts.d.ts +3 -0
- package/backend/dist/routes/prompts.d.ts.map +1 -0
- package/backend/dist/routes/prompts.js +173 -0
- package/backend/dist/routes/prompts.js.map +1 -0
- package/backend/dist/routes/push.d.ts +3 -0
- package/backend/dist/routes/push.d.ts.map +1 -0
- package/backend/dist/routes/push.js +105 -0
- package/backend/dist/routes/push.js.map +1 -0
- package/backend/dist/routes/recovery.d.ts +3 -0
- package/backend/dist/routes/recovery.d.ts.map +1 -0
- package/backend/dist/routes/recovery.js +83 -0
- package/backend/dist/routes/recovery.js.map +1 -0
- package/backend/dist/routes/search.d.ts.map +1 -1
- package/backend/dist/routes/search.js +29 -1
- package/backend/dist/routes/search.js.map +1 -1
- package/backend/dist/routes/skills.d.ts +3 -0
- package/backend/dist/routes/skills.d.ts.map +1 -0
- package/backend/dist/routes/skills.js +246 -0
- package/backend/dist/routes/skills.js.map +1 -0
- package/backend/dist/routes/stt.d.ts.map +1 -1
- package/backend/dist/routes/stt.js +2 -1
- package/backend/dist/routes/stt.js.map +1 -1
- package/backend/dist/routes/tools.d.ts +3 -0
- package/backend/dist/routes/tools.d.ts.map +1 -0
- package/backend/dist/routes/tools.js +359 -0
- package/backend/dist/routes/tools.js.map +1 -0
- package/backend/dist/routes/tts.d.ts.map +1 -1
- package/backend/dist/routes/tts.js +63 -8
- package/backend/dist/routes/tts.js.map +1 -1
- package/backend/dist/routes/users.d.ts.map +1 -1
- package/backend/dist/routes/users.js +35 -0
- package/backend/dist/routes/users.js.map +1 -1
- package/backend/dist/routes/voiceAccess.d.ts +3 -0
- package/backend/dist/routes/voiceAccess.d.ts.map +1 -0
- package/backend/dist/routes/voiceAccess.js +102 -0
- package/backend/dist/routes/voiceAccess.js.map +1 -0
- package/backend/dist/services/apiTokenService.d.ts +2 -2
- package/backend/dist/services/apiTokenService.d.ts.map +1 -1
- package/backend/dist/services/apiTokenService.js +7 -0
- package/backend/dist/services/apiTokenService.js.map +1 -1
- package/backend/dist/services/authService.d.ts +6 -0
- package/backend/dist/services/authService.d.ts.map +1 -1
- package/backend/dist/services/authService.js +9 -0
- package/backend/dist/services/authService.js.map +1 -1
- package/backend/dist/services/authorizationService.d.ts +8 -4
- package/backend/dist/services/authorizationService.d.ts.map +1 -1
- package/backend/dist/services/authorizationService.js +31 -1
- package/backend/dist/services/authorizationService.js.map +1 -1
- package/backend/dist/services/automationSchedulerService.d.ts.map +1 -1
- package/backend/dist/services/automationSchedulerService.js +40 -3
- package/backend/dist/services/automationSchedulerService.js.map +1 -1
- package/backend/dist/services/automationService.d.ts +4 -1
- package/backend/dist/services/automationService.d.ts.map +1 -1
- package/backend/dist/services/automationService.js +25 -2
- package/backend/dist/services/automationService.js.map +1 -1
- package/backend/dist/services/builtinToolsService.d.ts +20 -0
- package/backend/dist/services/builtinToolsService.d.ts.map +1 -0
- package/backend/dist/services/builtinToolsService.js +661 -0
- package/backend/dist/services/builtinToolsService.js.map +1 -0
- package/backend/dist/services/calendarService.d.ts +74 -0
- package/backend/dist/services/calendarService.d.ts.map +1 -0
- package/backend/dist/services/calendarService.js +339 -0
- package/backend/dist/services/calendarService.js.map +1 -0
- package/backend/dist/services/channelService.d.ts +195 -0
- package/backend/dist/services/channelService.d.ts.map +1 -0
- package/backend/dist/services/channelService.js +1057 -0
- package/backend/dist/services/channelService.js.map +1 -0
- package/backend/dist/services/chatRequestService.d.ts.map +1 -1
- package/backend/dist/services/chatRequestService.js +29 -1
- package/backend/dist/services/chatRequestService.js.map +1 -1
- package/backend/dist/services/chatService.d.ts +61 -1
- package/backend/dist/services/chatService.d.ts.map +1 -1
- package/backend/dist/services/chatService.js +218 -1
- package/backend/dist/services/chatService.js.map +1 -1
- package/backend/dist/services/chatToolRuntimeService.d.ts +55 -0
- package/backend/dist/services/chatToolRuntimeService.d.ts.map +1 -0
- package/backend/dist/services/chatToolRuntimeService.js +389 -0
- package/backend/dist/services/chatToolRuntimeService.js.map +1 -0
- package/backend/dist/services/costGovernanceService.d.ts +102 -0
- package/backend/dist/services/costGovernanceService.d.ts.map +1 -0
- package/backend/dist/services/costGovernanceService.js +463 -0
- package/backend/dist/services/costGovernanceService.js.map +1 -0
- package/backend/dist/services/dataArchiveService.d.ts +6 -0
- package/backend/dist/services/dataArchiveService.d.ts.map +1 -1
- package/backend/dist/services/dataArchiveService.js +26 -4
- package/backend/dist/services/dataArchiveService.js.map +1 -1
- package/backend/dist/services/documentMediaExtractionService.d.ts +40 -0
- package/backend/dist/services/documentMediaExtractionService.d.ts.map +1 -0
- package/backend/dist/services/documentMediaExtractionService.js +157 -0
- package/backend/dist/services/documentMediaExtractionService.js.map +1 -0
- package/backend/dist/services/documentService.d.ts +64 -1
- package/backend/dist/services/documentService.d.ts.map +1 -1
- package/backend/dist/services/documentService.js +342 -83
- package/backend/dist/services/documentService.js.map +1 -1
- package/backend/dist/services/durableChatGenerationService.d.ts +9 -0
- package/backend/dist/services/durableChatGenerationService.d.ts.map +1 -1
- package/backend/dist/services/durableChatGenerationService.js +152 -11
- package/backend/dist/services/durableChatGenerationService.js.map +1 -1
- package/backend/dist/services/encryptionService.d.ts +6 -0
- package/backend/dist/services/encryptionService.d.ts.map +1 -1
- package/backend/dist/services/encryptionService.js +12 -0
- package/backend/dist/services/encryptionService.js.map +1 -1
- package/backend/dist/services/evaluationService.d.ts +111 -0
- package/backend/dist/services/evaluationService.d.ts.map +1 -0
- package/backend/dist/services/evaluationService.js +403 -0
- package/backend/dist/services/evaluationService.js.map +1 -0
- package/backend/dist/services/galleryService.d.ts +6 -0
- package/backend/dist/services/galleryService.d.ts.map +1 -1
- package/backend/dist/services/galleryService.js +26 -0
- package/backend/dist/services/galleryService.js.map +1 -1
- package/backend/dist/services/mcpClientService.d.ts +29 -0
- package/backend/dist/services/mcpClientService.d.ts.map +1 -0
- package/backend/dist/services/mcpClientService.js +189 -0
- package/backend/dist/services/mcpClientService.js.map +1 -0
- package/backend/dist/services/mfaService.d.ts +64 -0
- package/backend/dist/services/mfaService.d.ts.map +1 -0
- package/backend/dist/services/mfaService.js +263 -0
- package/backend/dist/services/mfaService.js.map +1 -0
- package/backend/dist/services/noteService.d.ts +71 -0
- package/backend/dist/services/noteService.d.ts.map +1 -0
- package/backend/dist/services/noteService.js +397 -0
- package/backend/dist/services/noteService.js.map +1 -0
- package/backend/dist/services/notificationService.d.ts +60 -0
- package/backend/dist/services/notificationService.d.ts.map +1 -0
- package/backend/dist/services/notificationService.js +340 -0
- package/backend/dist/services/notificationService.js.map +1 -0
- package/backend/dist/services/openApiToolService.d.ts +38 -0
- package/backend/dist/services/openApiToolService.d.ts.map +1 -0
- package/backend/dist/services/openApiToolService.js +254 -0
- package/backend/dist/services/openApiToolService.js.map +1 -0
- package/backend/dist/services/personaService.d.ts +18 -2
- package/backend/dist/services/personaService.d.ts.map +1 -1
- package/backend/dist/services/personaService.js +113 -4
- package/backend/dist/services/personaService.js.map +1 -1
- package/backend/dist/services/pluginImageGenerationService.d.ts +19 -0
- package/backend/dist/services/pluginImageGenerationService.d.ts.map +1 -1
- package/backend/dist/services/pluginImageGenerationService.js +121 -0
- package/backend/dist/services/pluginImageGenerationService.js.map +1 -1
- package/backend/dist/services/pluginService.d.ts +7 -0
- package/backend/dist/services/pluginService.d.ts.map +1 -1
- package/backend/dist/services/pluginService.js +8 -2
- package/backend/dist/services/pluginService.js.map +1 -1
- package/backend/dist/services/preferencesService.d.ts +1 -1
- package/backend/dist/services/preferencesService.d.ts.map +1 -1
- package/backend/dist/services/preferencesService.js +1 -0
- package/backend/dist/services/preferencesService.js.map +1 -1
- package/backend/dist/services/promptService.d.ts +74 -0
- package/backend/dist/services/promptService.d.ts.map +1 -0
- package/backend/dist/services/promptService.js +513 -0
- package/backend/dist/services/promptService.js.map +1 -0
- package/backend/dist/services/recoveryDrillService.d.ts +57 -0
- package/backend/dist/services/recoveryDrillService.d.ts.map +1 -0
- package/backend/dist/services/recoveryDrillService.js +363 -0
- package/backend/dist/services/recoveryDrillService.js.map +1 -0
- package/backend/dist/services/resourceGrantService.d.ts.map +1 -1
- package/backend/dist/services/resourceGrantService.js +62 -17
- package/backend/dist/services/resourceGrantService.js.map +1 -1
- package/backend/dist/services/searchService.d.ts +29 -0
- package/backend/dist/services/searchService.d.ts.map +1 -0
- package/backend/dist/services/searchService.js +0 -0
- package/backend/dist/services/searchService.js.map +1 -0
- package/backend/dist/services/securityAuditService.d.ts.map +1 -1
- package/backend/dist/services/securityAuditService.js +2 -1
- package/backend/dist/services/securityAuditService.js.map +1 -1
- package/backend/dist/services/sharedResourceAccess.d.ts +25 -0
- package/backend/dist/services/sharedResourceAccess.d.ts.map +1 -0
- package/backend/dist/services/sharedResourceAccess.js +59 -0
- package/backend/dist/services/sharedResourceAccess.js.map +1 -0
- package/backend/dist/services/skillService.d.ts +137 -0
- package/backend/dist/services/skillService.d.ts.map +1 -0
- package/backend/dist/services/skillService.js +852 -0
- package/backend/dist/services/skillService.js.map +1 -0
- package/backend/dist/services/toolAccessService.d.ts +9 -0
- package/backend/dist/services/toolAccessService.d.ts.map +1 -0
- package/backend/dist/services/toolAccessService.js +60 -0
- package/backend/dist/services/toolAccessService.js.map +1 -0
- package/backend/dist/services/toolApprovalService.d.ts +34 -0
- package/backend/dist/services/toolApprovalService.d.ts.map +1 -0
- package/backend/dist/services/toolApprovalService.js +188 -0
- package/backend/dist/services/toolApprovalService.js.map +1 -0
- package/backend/dist/services/toolGatewayService.d.ts +53 -0
- package/backend/dist/services/toolGatewayService.d.ts.map +1 -0
- package/backend/dist/services/toolGatewayService.js +249 -0
- package/backend/dist/services/toolGatewayService.js.map +1 -0
- package/backend/dist/services/toolServerService.d.ts +57 -0
- package/backend/dist/services/toolServerService.d.ts.map +1 -0
- package/backend/dist/services/toolServerService.js +521 -0
- package/backend/dist/services/toolServerService.js.map +1 -0
- package/backend/dist/services/voiceAccessService.d.ts +10 -0
- package/backend/dist/services/voiceAccessService.d.ts.map +1 -0
- package/backend/dist/services/voiceAccessService.js +74 -0
- package/backend/dist/services/voiceAccessService.js.map +1 -0
- package/backend/dist/services/voiceProfileService.d.ts +20 -0
- package/backend/dist/services/voiceProfileService.d.ts.map +1 -1
- package/backend/dist/services/voiceProfileService.js +60 -0
- package/backend/dist/services/voiceProfileService.js.map +1 -1
- package/backend/dist/services/webPushService.d.ts +71 -0
- package/backend/dist/services/webPushService.d.ts.map +1 -0
- package/backend/dist/services/webPushService.js +328 -0
- package/backend/dist/services/webPushService.js.map +1 -0
- package/backend/dist/services/webauthnService.d.ts +58 -0
- package/backend/dist/services/webauthnService.d.ts.map +1 -0
- package/backend/dist/services/webauthnService.js +300 -0
- package/backend/dist/services/webauthnService.js.map +1 -0
- package/backend/dist/storage.d.ts +28 -1
- package/backend/dist/storage.d.ts.map +1 -1
- package/backend/dist/storage.js +100 -1
- package/backend/dist/storage.js.map +1 -1
- package/backend/dist/storageMappers.d.ts +2 -2
- package/backend/dist/storageMappers.d.ts.map +1 -1
- package/backend/dist/storageMappers.js.map +1 -1
- package/backend/dist/types/index.d.ts +199 -3
- package/backend/dist/types/index.d.ts.map +1 -1
- package/backend/dist/types/index.js.map +1 -1
- package/backend/dist/types/tools.d.ts +137 -0
- package/backend/dist/types/tools.d.ts.map +1 -0
- package/backend/dist/types/tools.js +25 -0
- package/backend/dist/types/tools.js.map +1 -0
- package/backend/dist/utils/chatDocumentContext.d.ts +26 -1
- package/backend/dist/utils/chatDocumentContext.d.ts.map +1 -1
- package/backend/dist/utils/chatDocumentContext.js +87 -18
- package/backend/dist/utils/chatDocumentContext.js.map +1 -1
- package/backend/dist/utils/documentExtraction.d.ts +97 -0
- package/backend/dist/utils/documentExtraction.d.ts.map +1 -0
- package/backend/dist/utils/documentExtraction.js +651 -0
- package/backend/dist/utils/documentExtraction.js.map +1 -0
- package/backend/dist/utils/hybridRetrieval.d.ts +34 -0
- package/backend/dist/utils/hybridRetrieval.d.ts.map +1 -0
- package/backend/dist/utils/hybridRetrieval.js +119 -0
- package/backend/dist/utils/hybridRetrieval.js.map +1 -0
- package/backend/dist/utils/icsCalendar.d.ts +27 -0
- package/backend/dist/utils/icsCalendar.d.ts.map +1 -0
- package/backend/dist/utils/icsCalendar.js +313 -0
- package/backend/dist/utils/icsCalendar.js.map +1 -0
- package/backend/dist/utils/imageEditUpload.d.ts +29 -0
- package/backend/dist/utils/imageEditUpload.d.ts.map +1 -0
- package/backend/dist/utils/imageEditUpload.js +82 -0
- package/backend/dist/utils/imageEditUpload.js.map +1 -0
- package/backend/dist/utils/logRedaction.d.ts +2 -0
- package/backend/dist/utils/logRedaction.d.ts.map +1 -0
- package/backend/dist/utils/logRedaction.js +66 -0
- package/backend/dist/utils/logRedaction.js.map +1 -0
- package/backend/dist/utils/logger.d.ts +3 -0
- package/backend/dist/utils/logger.d.ts.map +1 -1
- package/backend/dist/utils/logger.js +63 -20
- package/backend/dist/utils/logger.js.map +1 -1
- package/backend/dist/utils/pluginChatAdapter.d.ts +5 -1
- package/backend/dist/utils/pluginChatAdapter.d.ts.map +1 -1
- package/backend/dist/utils/pluginChatAdapter.js +83 -0
- package/backend/dist/utils/pluginChatAdapter.js.map +1 -1
- package/backend/dist/utils/pluginDefinitionTrust.js +1 -1
- package/backend/dist/utils/resourceLimits.d.ts +61 -2
- package/backend/dist/utils/resourceLimits.d.ts.map +1 -1
- package/backend/dist/utils/resourceLimits.js +59 -0
- package/backend/dist/utils/resourceLimits.js.map +1 -1
- package/backend/dist/utils/toolEgress.d.ts +23 -0
- package/backend/dist/utils/toolEgress.d.ts.map +1 -0
- package/backend/dist/utils/toolEgress.js +169 -0
- package/backend/dist/utils/toolEgress.js.map +1 -0
- package/backend/dist/utils/totp.d.ts +19 -0
- package/backend/dist/utils/totp.d.ts.map +1 -0
- package/backend/dist/utils/totp.js +117 -0
- package/backend/dist/utils/totp.js.map +1 -0
- package/backend/dist/utils/webauthn.d.ts +43 -0
- package/backend/dist/utils/webauthn.d.ts.map +1 -0
- package/backend/dist/utils/webauthn.js +294 -0
- package/backend/dist/utils/webauthn.js.map +1 -0
- package/backend/dist/utils/websocketMessages.d.ts +6 -0
- package/backend/dist/utils/websocketMessages.d.ts.map +1 -1
- package/backend/dist/utils/websocketMessages.js +8 -0
- package/backend/dist/utils/websocketMessages.js.map +1 -1
- package/backend/dist/utils/zipArchive.d.ts +32 -0
- package/backend/dist/utils/zipArchive.d.ts.map +1 -0
- package/backend/dist/utils/zipArchive.js +171 -0
- package/backend/dist/utils/zipArchive.js.map +1 -0
- package/backend/dist/websocketServer.d.ts.map +1 -1
- package/backend/dist/websocketServer.js +142 -35
- package/backend/dist/websocketServer.js.map +1 -1
- package/backend/package.json +1 -1
- package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
- package/frontend/dist/assets/index-DBAf_VaS.js +47 -0
- package/frontend/dist/assets/index-kn_Axjts.css +1 -0
- package/frontend/dist/fonts/jetbrains-mono-latin-400-normal.woff2 +0 -0
- package/frontend/dist/fonts/jetbrains-mono-latin-700-normal.woff2 +0 -0
- package/frontend/dist/fonts/jetbrains-mono.css +24 -0
- package/frontend/dist/index.html +27 -20
- package/frontend/dist/js/ArtifactContainer-C9zNtCay.js +1 -0
- package/frontend/dist/js/{ArtifactDemoPage-BeNs3gHp.js → ArtifactDemoPage-C-EBFBCt.js} +1 -1
- package/frontend/dist/js/ArtifactSandboxFrame-CTA1j_d1.js +111 -0
- package/frontend/dist/js/ArtifactSlideOutPanel-BOENbOiv.js +1 -0
- package/frontend/dist/js/AutomationsPage-C58MQ4te.js +1 -0
- package/frontend/dist/js/{Button-BPf_pOxH.js → Button-C0r3J9G_.js} +1 -1
- package/frontend/dist/js/CalendarPage-BcdAZ292.js +1 -0
- package/frontend/dist/js/ChannelsPage-DPr9Yajs.js +1 -0
- package/frontend/dist/js/ChatPage-DsbB748s.js +14 -0
- package/frontend/dist/js/EvaluationsPage-FWIJu2fI.js +2 -0
- package/frontend/dist/js/FirstTimeSetup-Cy-w6xko.js +1 -0
- package/frontend/dist/js/GalleryPage-DDAtxM-x.js +1 -0
- package/frontend/dist/js/HomePage-DLKwmE7n.js +1 -0
- package/frontend/dist/js/LibreClawPage-vKOj-9w9.js +1 -0
- package/frontend/dist/js/{ModelManagerModals-DcLGYN3l.js → ModelManagerModals-BY5TK38_.js} +1 -1
- package/frontend/dist/js/ModelSelector-CoCS6MZ9.js +1 -0
- package/frontend/dist/js/NotesPage-BElIpXgA.js +3 -0
- package/frontend/dist/js/OptimizedSyntaxHighlighter-xgyE3dRA.js +1 -0
- package/frontend/dist/js/PersonasPage-P40jVbfU.js +13 -0
- package/frontend/dist/js/PluginUsagePage-CKUEPCJN.js +1 -0
- package/frontend/dist/js/RichMessageContent-Bm2WaEGi.js +3 -0
- package/frontend/dist/js/SettingsModal-DxSGzx9A.js +19 -0
- package/frontend/dist/js/{SettingsToggle-woG_WebF.js → SettingsToggle-BIVyfGjl.js} +1 -1
- package/frontend/dist/js/SystemPage-BT07dTMT.js +1 -0
- package/frontend/dist/js/UserManagementPage-B9Vz5cm3.js +1 -0
- package/frontend/dist/js/WorkPage-qoN_e_jK.js +6 -0
- package/frontend/dist/js/api-D7Ff5M2Q.js +14 -0
- package/frontend/dist/js/appStore-DmV5wqDz.js +2 -0
- package/frontend/dist/js/ar-YHHTVP8f.js +2 -0
- package/frontend/dist/js/artifactHtml-DDmfpcB0.js +41 -0
- package/frontend/dist/js/{authStore-DbMdvNgJ.js → authStore-BYW8-kP6.js} +3 -3
- package/frontend/dist/js/{babel-BsYoxD-7.js → babel-DSqqk5kt.js} +1 -1
- package/frontend/dist/js/bn-C8VTxBVl.js +2 -0
- package/frontend/dist/js/chatStore-D-NTlArO.js +3 -0
- package/frontend/dist/js/{config-DSOYQ9a3.js → config-BqZ5304Q.js} +1 -1
- package/frontend/dist/js/cs-CCngB5fC.js +2 -0
- package/frontend/dist/js/da-CM2PP2ma.js +2 -0
- package/frontend/dist/js/de-BqVkD-dw.js +2 -0
- package/frontend/dist/js/es-BtWsWBjZ.js +2 -0
- package/frontend/dist/js/{estree-BcnBcOAx.js → estree-DPkpBuOU.js} +3 -3
- package/frontend/dist/js/evaluationsApi-Dnf2dTd-.js +1 -0
- package/frontend/dist/js/fr-C68w9abT.js +2 -0
- package/frontend/dist/js/hi-DtBlcyXZ.js +2 -0
- package/frontend/dist/js/{html-DkY55Jys.js → html-BpGUXG8E.js} +2 -2
- package/frontend/dist/js/id-BWzIu8tn.js +2 -0
- package/frontend/dist/js/is-yeFwu4dJ.js +2 -0
- package/frontend/dist/js/it-AxEMG8Jg.js +2 -0
- package/frontend/dist/js/ja-B-VyokB8.js +2 -0
- package/frontend/dist/js/ko-CvwzYr9k.js +2 -0
- package/frontend/dist/js/{markdown-IZSI9DXw.js → markdown-DCBRWJSK.js} +3 -3
- package/frontend/dist/js/markdown-core-BK7WVOb7.js +32 -0
- package/frontend/dist/js/{markdown-math-DK846gXU.js → markdown-math-e1ByS3KY.js} +5 -5
- package/frontend/dist/js/messageCodeStyles-BQwf7sSz.js +2 -0
- package/frontend/dist/js/ms-BhEwb4b7.js +2 -0
- package/frontend/dist/js/nl-Dq-QRx1L.js +2 -0
- package/frontend/dist/js/pl-BNEy8mQm.js +2 -0
- package/frontend/dist/js/{postcss-BJ0okz7n.js → postcss-Bg15EcFE.js} +1 -1
- package/frontend/dist/js/pt-_3Jl3FdY.js +2 -0
- package/frontend/dist/js/{react-vendor-C5yShNlM.js → react-vendor-BG_HPV6X.js} +1 -1
- package/frontend/dist/js/router-vendor-CbexJIsv.js +1 -0
- package/frontend/dist/js/ru-IhQiJ8ta.js +2 -0
- package/frontend/dist/js/{standalone-Csw3jfJ_.js → standalone-BFrK0R2A.js} +3 -3
- package/frontend/dist/js/sv-DWunXUNz.js +2 -0
- package/frontend/dist/js/{syntax-highlight-3EEX6CGL.js → syntax-highlight-P2zo9o06.js} +4 -4
- package/frontend/dist/js/th-DVnW2yyh.js +2 -0
- package/frontend/dist/js/tr-Do8CFmhR.js +2 -0
- package/frontend/dist/js/{typescript-CnF4UVx7.js → typescript-DYVyvmm_.js} +1 -1
- package/frontend/dist/js/ui-db9meqAB.js +2 -0
- package/frontend/dist/js/ui-vendor-C0DZ8-Cm.js +177 -0
- package/frontend/dist/js/uk-BNPKIZga.js +2 -0
- package/frontend/dist/js/{useTranslation-Bho4HCyg.js → useTranslation-5b5UhAc9.js} +1 -1
- package/frontend/dist/js/{utils-D9W1Lnkn.js → utils-BGrdX9ie.js} +1 -1
- package/frontend/dist/js/{utils-vendor-DWh39_3x.js → utils-vendor-9bQ62WeD.js} +1 -1
- package/frontend/dist/js/vi-CZMFo9je.js +2 -0
- package/frontend/dist/js/{workApi-C3uy9EDT.js → workApi-CcprMH_1.js} +3 -3
- package/frontend/dist/js/{yaml-DzT5hBSH.js → yaml-DUeWcOOH.js} +2 -2
- package/frontend/dist/js/zh-Pg0881v0.js +2 -0
- package/frontend/dist/manifest.webmanifest +32 -0
- package/frontend/dist/sw.js +125 -0
- package/package.json +2 -2
- package/plugins/openai.json +52 -9
- package/frontend/dist/assets/index-6o-Hc2wS.js +0 -41
- package/frontend/dist/assets/index-D-pM957b.css +0 -1
- package/frontend/dist/js/ArtifactContainer-CpUi6ekF.js +0 -1
- package/frontend/dist/js/ArtifactSandboxFrame-qsj_Y3LV.js +0 -151
- package/frontend/dist/js/ArtifactSlideOutPanel-CSFRluWA.js +0 -1
- package/frontend/dist/js/AutomationsPage-KUeWoZNv.js +0 -1
- package/frontend/dist/js/CalendarPage-D9I972w8.js +0 -1
- package/frontend/dist/js/ChatPage-CmBx4oAL.js +0 -16
- package/frontend/dist/js/FirstTimeSetup-Df0YJni3.js +0 -1
- package/frontend/dist/js/GalleryPage-bLCrdJN_.js +0 -1
- package/frontend/dist/js/HomePage-Uc6PEg-U.js +0 -1
- package/frontend/dist/js/LibreClawPage-CG63DHg1.js +0 -1
- package/frontend/dist/js/ModelSelector-yxJC64rM.js +0 -1
- package/frontend/dist/js/ModelsPage-1R_TxgmJ.js +0 -2
- package/frontend/dist/js/NotesPage-L65j5HoW.js +0 -1
- package/frontend/dist/js/OptimizedSyntaxHighlighter-Dz7D1LPB.js +0 -1
- package/frontend/dist/js/PersonasPage-CKeBpHIH.js +0 -13
- package/frontend/dist/js/PluginUsagePage-BX1SKMbW.js +0 -1
- package/frontend/dist/js/RichMessageContent-DiySVYGB.js +0 -3
- package/frontend/dist/js/SettingsModal-68SG1uZ2.js +0 -1
- package/frontend/dist/js/SystemPage-CytpZiQV.js +0 -1
- package/frontend/dist/js/UserManagementPage-BzJBvZiS.js +0 -1
- package/frontend/dist/js/WorkPage-C8gr0QJe.js +0 -6
- package/frontend/dist/js/api-BDtqBtqw.js +0 -14
- package/frontend/dist/js/appStore-0JnCUlEq.js +0 -2
- package/frontend/dist/js/ar-CSpi37Gr.js +0 -2
- package/frontend/dist/js/bn-CyH1BeDD.js +0 -2
- package/frontend/dist/js/chatStore-CHQ2uINS.js +0 -3
- package/frontend/dist/js/cs-Cv2NfRK5.js +0 -2
- package/frontend/dist/js/da-D6D6IvPK.js +0 -2
- package/frontend/dist/js/de-BNoJJTrT.js +0 -2
- package/frontend/dist/js/es-kzo9C7q_.js +0 -2
- package/frontend/dist/js/fr-CjHYvJRp.js +0 -2
- package/frontend/dist/js/hi-BU98AdCQ.js +0 -2
- package/frontend/dist/js/id-CpdedejX.js +0 -2
- package/frontend/dist/js/is-Cp5dDWBH.js +0 -2
- package/frontend/dist/js/it-CuH_cK4U.js +0 -2
- package/frontend/dist/js/ja-BWXXXiHn.js +0 -2
- package/frontend/dist/js/ko-DQgv2M1t.js +0 -2
- package/frontend/dist/js/markdown-core-BmPPZiuD.js +0 -31
- package/frontend/dist/js/messageCodeStyles-BFNR9Wv6.js +0 -2
- package/frontend/dist/js/ms-DCcRoIcX.js +0 -2
- package/frontend/dist/js/nl-CbKR1_EU.js +0 -2
- package/frontend/dist/js/pl-CRyJZccn.js +0 -2
- package/frontend/dist/js/pt-BXYmHFGH.js +0 -2
- package/frontend/dist/js/router-vendor-DGFGM3EP.js +0 -1
- package/frontend/dist/js/ru-M9SyZG4b.js +0 -2
- package/frontend/dist/js/sv-DJ486LTU.js +0 -2
- package/frontend/dist/js/th-Ch7gKtZv.js +0 -2
- package/frontend/dist/js/tr-ClehWhSC.js +0 -2
- package/frontend/dist/js/ui-CC-K19wO.js +0 -2
- package/frontend/dist/js/ui-vendor-B1UgO3vd.js +0 -177
- package/frontend/dist/js/uk-BqAd5zHF.js +0 -2
- package/frontend/dist/js/vi-D9gjlDVB.js +0 -2
- package/frontend/dist/js/zh-DKTyHkiR.js +0 -2
|
@@ -0,0 +1,661 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Libre WebUI
|
|
3
|
+
* Copyright (C) 2025 Kroonen AI, Inc.
|
|
4
|
+
*
|
|
5
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
6
|
+
* you may not use this file except in compliance with the License.
|
|
7
|
+
* You may obtain a copy of the License at:
|
|
8
|
+
*
|
|
9
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
10
|
+
*
|
|
11
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
12
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
13
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
14
|
+
* See the License for the specific language governing permissions and
|
|
15
|
+
* limitations under the License.
|
|
16
|
+
*/
|
|
17
|
+
/**
|
|
18
|
+
* First-party chat tools (TOOL-01). Every builtin executes with the
|
|
19
|
+
* invoking user's identity and effective permissions: web search honors
|
|
20
|
+
* the web-search feature gate, document search reaches the user's own and
|
|
21
|
+
* shared collections, and skill loading resolves the user's own enabled
|
|
22
|
+
* skills. Mutating tools (notes, calendar) are marked side-effecting and
|
|
23
|
+
* run behind the standard approval flow. Outputs are bounded before they
|
|
24
|
+
* re-enter the model.
|
|
25
|
+
*/
|
|
26
|
+
import { randomUUID } from 'node:crypto';
|
|
27
|
+
import { ResourcePolicyError } from '../utils/resourceLimits.js';
|
|
28
|
+
import { userCanUseWebSearch, webSearch } from './webSearchService.js';
|
|
29
|
+
import documentService from './documentService.js';
|
|
30
|
+
import { readDocumentSegments, resolveSegmentLabel, } from '../utils/documentExtraction.js';
|
|
31
|
+
import { getSkillBySlug, getSkillFile, listSkillFiles, listSkills, } from './skillService.js';
|
|
32
|
+
import { createNote, getNote, listNotes, NoteError, updateNote, } from './noteService.js';
|
|
33
|
+
const MAX_RESULT_CHARS = 24000;
|
|
34
|
+
const READ_DOCUMENT_WINDOW = 8000;
|
|
35
|
+
const bounded = (text) => text.length > MAX_RESULT_CHARS
|
|
36
|
+
? {
|
|
37
|
+
text: `${text.slice(0, MAX_RESULT_CHARS)}\n[truncated]`,
|
|
38
|
+
truncated: true,
|
|
39
|
+
}
|
|
40
|
+
: { text, truncated: false };
|
|
41
|
+
const asString = (value) => typeof value === 'string' ? value : '';
|
|
42
|
+
const BUILTIN_TOOLS = [
|
|
43
|
+
{
|
|
44
|
+
name: 'web_search',
|
|
45
|
+
description: 'Search the web and return result titles, URLs, and snippets. Use for current events or facts outside the conversation.',
|
|
46
|
+
paramsSchema: {
|
|
47
|
+
type: 'object',
|
|
48
|
+
properties: {
|
|
49
|
+
query: { type: 'string', description: 'The search query' },
|
|
50
|
+
max_results: {
|
|
51
|
+
type: 'integer',
|
|
52
|
+
description: 'Maximum results to return',
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
required: ['query'],
|
|
56
|
+
},
|
|
57
|
+
available: async (context) => userCanUseWebSearch({
|
|
58
|
+
id: context.actor.userId,
|
|
59
|
+
...(context.actor.role !== undefined
|
|
60
|
+
? { role: context.actor.role }
|
|
61
|
+
: {}),
|
|
62
|
+
...(context.actor.status !== undefined
|
|
63
|
+
? { status: context.actor.status }
|
|
64
|
+
: {}),
|
|
65
|
+
}),
|
|
66
|
+
execute: async (args, context) => {
|
|
67
|
+
const query = asString(args.query).trim();
|
|
68
|
+
if (!query) {
|
|
69
|
+
return {
|
|
70
|
+
text: 'A search query is required.',
|
|
71
|
+
isError: true,
|
|
72
|
+
truncated: false,
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
const maxResults = typeof args.max_results === 'number' ? args.max_results : undefined;
|
|
76
|
+
const results = await webSearch(query, maxResults, context.signal);
|
|
77
|
+
if (results.length === 0) {
|
|
78
|
+
return { text: 'No results found.', isError: false, truncated: false };
|
|
79
|
+
}
|
|
80
|
+
const rendered = results
|
|
81
|
+
.map((result, index) => `${index + 1}. ${result.title}\n${result.url}\n${result.content}`)
|
|
82
|
+
.join('\n\n');
|
|
83
|
+
return { ...bounded(rendered), isError: false };
|
|
84
|
+
},
|
|
85
|
+
},
|
|
86
|
+
{
|
|
87
|
+
name: 'search_documents',
|
|
88
|
+
description: "Search the user's uploaded documents and knowledge collections; returns matching passages with their source document.",
|
|
89
|
+
paramsSchema: {
|
|
90
|
+
type: 'object',
|
|
91
|
+
properties: {
|
|
92
|
+
query: { type: 'string', description: 'What to look for' },
|
|
93
|
+
limit: { type: 'integer', description: 'Maximum passages to return' },
|
|
94
|
+
},
|
|
95
|
+
required: ['query'],
|
|
96
|
+
},
|
|
97
|
+
available: async () => true,
|
|
98
|
+
execute: async (args, context) => {
|
|
99
|
+
const query = asString(args.query).trim();
|
|
100
|
+
if (!query) {
|
|
101
|
+
return {
|
|
102
|
+
text: 'A search query is required.',
|
|
103
|
+
isError: true,
|
|
104
|
+
truncated: false,
|
|
105
|
+
};
|
|
106
|
+
}
|
|
107
|
+
const limit = Math.min(Math.max(typeof args.limit === 'number' ? Math.trunc(args.limit) : 5, 1), 10);
|
|
108
|
+
const chunks = await documentService.searchDocuments(query, context.actor.userId, context.sessionId, limit, context.collectionIds ? [...context.collectionIds] : undefined, context.signal);
|
|
109
|
+
if (chunks.length === 0) {
|
|
110
|
+
return {
|
|
111
|
+
text: 'No matching passages found in the available documents.',
|
|
112
|
+
isError: false,
|
|
113
|
+
truncated: false,
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
const titles = new Map();
|
|
117
|
+
for (const chunk of chunks) {
|
|
118
|
+
if (titles.has(chunk.documentId))
|
|
119
|
+
continue;
|
|
120
|
+
const document = await documentService.getDocument(chunk.documentId, context.actor.userId);
|
|
121
|
+
titles.set(chunk.documentId, document?.title || document?.filename || chunk.documentId);
|
|
122
|
+
}
|
|
123
|
+
const rendered = chunks
|
|
124
|
+
.map(chunk => {
|
|
125
|
+
const cite = [
|
|
126
|
+
titles.get(chunk.documentId),
|
|
127
|
+
`chunk ${chunk.chunkIndex}`,
|
|
128
|
+
...(chunk.location ? [chunk.location] : []),
|
|
129
|
+
].join(' · ');
|
|
130
|
+
return `[${cite}]\n${chunk.content}`;
|
|
131
|
+
})
|
|
132
|
+
.join('\n\n');
|
|
133
|
+
return { ...bounded(rendered), isError: false };
|
|
134
|
+
},
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
name: 'list_documents',
|
|
138
|
+
description: 'List the documents available to this chat: its uploads, attached knowledge collections, and standing uploads. Returns ids for read_document.',
|
|
139
|
+
paramsSchema: {
|
|
140
|
+
type: 'object',
|
|
141
|
+
properties: {},
|
|
142
|
+
},
|
|
143
|
+
available: async () => true,
|
|
144
|
+
execute: async (_args, context) => {
|
|
145
|
+
const documents = await documentService.getDocumentsInScope(context.actor.userId, context.sessionId, context.collectionIds ? [...context.collectionIds] : undefined);
|
|
146
|
+
if (documents.length === 0) {
|
|
147
|
+
return {
|
|
148
|
+
text: 'No documents are available in this chat.',
|
|
149
|
+
isError: false,
|
|
150
|
+
truncated: false,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
const rendered = documents
|
|
154
|
+
.map(document => {
|
|
155
|
+
const chars = (document.content ?? '').length;
|
|
156
|
+
const type = document.fileType ?? 'txt';
|
|
157
|
+
return `- ${document.filename} (id: ${document.id}, ${type}, ${chars} chars)`;
|
|
158
|
+
})
|
|
159
|
+
.join('\n');
|
|
160
|
+
return { ...bounded(rendered), isError: false };
|
|
161
|
+
},
|
|
162
|
+
},
|
|
163
|
+
{
|
|
164
|
+
name: 'read_document',
|
|
165
|
+
description: 'Read part of an available document by id. Returns up to 8000 characters from the requested offset with its source location.',
|
|
166
|
+
paramsSchema: {
|
|
167
|
+
type: 'object',
|
|
168
|
+
properties: {
|
|
169
|
+
document_id: {
|
|
170
|
+
type: 'string',
|
|
171
|
+
description: 'The document id from list_documents or search results',
|
|
172
|
+
},
|
|
173
|
+
offset: {
|
|
174
|
+
type: 'integer',
|
|
175
|
+
description: 'Character offset to start reading from (default 0)',
|
|
176
|
+
},
|
|
177
|
+
},
|
|
178
|
+
required: ['document_id'],
|
|
179
|
+
},
|
|
180
|
+
available: async () => true,
|
|
181
|
+
execute: async (args, context) => {
|
|
182
|
+
const documentId = asString(args.document_id).trim();
|
|
183
|
+
if (!documentId) {
|
|
184
|
+
return {
|
|
185
|
+
text: 'A document_id is required.',
|
|
186
|
+
isError: true,
|
|
187
|
+
truncated: false,
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
const documents = await documentService.getDocumentsInScope(context.actor.userId, context.sessionId, context.collectionIds ? [...context.collectionIds] : undefined);
|
|
191
|
+
const document = documents.find(candidate => candidate.id === documentId);
|
|
192
|
+
if (!document) {
|
|
193
|
+
return {
|
|
194
|
+
text: `No available document has the id "${documentId}". Call list_documents first.`,
|
|
195
|
+
isError: true,
|
|
196
|
+
truncated: false,
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
const content = document.content ?? '';
|
|
200
|
+
const total = content.length;
|
|
201
|
+
const requestedOffset = typeof args.offset === 'number' && Number.isFinite(args.offset)
|
|
202
|
+
? Math.trunc(args.offset)
|
|
203
|
+
: 0;
|
|
204
|
+
const offset = Math.min(Math.max(requestedOffset, 0), total);
|
|
205
|
+
const window = content.slice(offset, offset + READ_DOCUMENT_WINDOW);
|
|
206
|
+
if (!window) {
|
|
207
|
+
return {
|
|
208
|
+
text: `The document "${document.filename}" has ${total} characters; offset ${offset} is past its end.`,
|
|
209
|
+
isError: true,
|
|
210
|
+
truncated: false,
|
|
211
|
+
};
|
|
212
|
+
}
|
|
213
|
+
const location = resolveSegmentLabel(readDocumentSegments(document.metadata), offset, offset + window.length);
|
|
214
|
+
const end = offset + window.length;
|
|
215
|
+
const header = [
|
|
216
|
+
`# ${document.filename}`,
|
|
217
|
+
`chars ${offset}-${end} of ${total}`,
|
|
218
|
+
...(location ? [location] : []),
|
|
219
|
+
...(end < total ? [`continue with offset ${end}`] : []),
|
|
220
|
+
].join(' · ');
|
|
221
|
+
return { ...bounded(`${header}\n\n${window}`), isError: false };
|
|
222
|
+
},
|
|
223
|
+
},
|
|
224
|
+
{
|
|
225
|
+
name: 'list_notes',
|
|
226
|
+
description: "List the user's notes (own and shared) with their ids and titles.",
|
|
227
|
+
paramsSchema: {
|
|
228
|
+
type: 'object',
|
|
229
|
+
properties: {},
|
|
230
|
+
},
|
|
231
|
+
available: async () => true,
|
|
232
|
+
execute: async (_args, context) => {
|
|
233
|
+
const all = await listNotes(context.actor);
|
|
234
|
+
if (all.length === 0) {
|
|
235
|
+
return {
|
|
236
|
+
text: 'No notes exist yet.',
|
|
237
|
+
isError: false,
|
|
238
|
+
truncated: false,
|
|
239
|
+
};
|
|
240
|
+
}
|
|
241
|
+
const rendered = all
|
|
242
|
+
.map(entry => {
|
|
243
|
+
const marks = [
|
|
244
|
+
...(entry.pinned ? ['pinned'] : []),
|
|
245
|
+
...(entry.shared ? [`shared, ${entry.shared.permission}`] : []),
|
|
246
|
+
];
|
|
247
|
+
const suffix = marks.length > 0 ? ` [${marks.join('; ')}]` : '';
|
|
248
|
+
return `- ${entry.title || 'Untitled'} (id: ${entry.id})${suffix}`;
|
|
249
|
+
})
|
|
250
|
+
.join('\n');
|
|
251
|
+
return { ...bounded(rendered), isError: false };
|
|
252
|
+
},
|
|
253
|
+
},
|
|
254
|
+
{
|
|
255
|
+
name: 'read_note',
|
|
256
|
+
description: 'Read the full content of one note by its id.',
|
|
257
|
+
paramsSchema: {
|
|
258
|
+
type: 'object',
|
|
259
|
+
properties: {
|
|
260
|
+
note_id: { type: 'string', description: 'The note id from list_notes' },
|
|
261
|
+
},
|
|
262
|
+
required: ['note_id'],
|
|
263
|
+
},
|
|
264
|
+
available: async () => true,
|
|
265
|
+
execute: async (args, context) => {
|
|
266
|
+
const noteId = asString(args.note_id).trim();
|
|
267
|
+
try {
|
|
268
|
+
const note = await getNote(context.actor, noteId);
|
|
269
|
+
return {
|
|
270
|
+
...bounded(`# ${note.title || 'Untitled'}\n\n${note.content}`),
|
|
271
|
+
isError: false,
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
catch (error) {
|
|
275
|
+
if (error instanceof NoteError) {
|
|
276
|
+
return { text: error.message, isError: true, truncated: false };
|
|
277
|
+
}
|
|
278
|
+
throw error;
|
|
279
|
+
}
|
|
280
|
+
},
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: 'create_note',
|
|
284
|
+
description: 'Create a new note with a title and Markdown content. Requires approval.',
|
|
285
|
+
sideEffect: true,
|
|
286
|
+
paramsSchema: {
|
|
287
|
+
type: 'object',
|
|
288
|
+
properties: {
|
|
289
|
+
title: { type: 'string', description: 'The note title' },
|
|
290
|
+
content: { type: 'string', description: 'The Markdown note content' },
|
|
291
|
+
},
|
|
292
|
+
required: ['title', 'content'],
|
|
293
|
+
},
|
|
294
|
+
available: async () => true,
|
|
295
|
+
execute: async (args, context) => {
|
|
296
|
+
try {
|
|
297
|
+
const note = await createNote(context.actor, {
|
|
298
|
+
title: asString(args.title),
|
|
299
|
+
content: asString(args.content),
|
|
300
|
+
});
|
|
301
|
+
return {
|
|
302
|
+
text: `Created note "${note.title}" (id: ${note.id}).`,
|
|
303
|
+
isError: false,
|
|
304
|
+
truncated: false,
|
|
305
|
+
};
|
|
306
|
+
}
|
|
307
|
+
catch (error) {
|
|
308
|
+
if (error instanceof NoteError) {
|
|
309
|
+
return { text: error.message, isError: true, truncated: false };
|
|
310
|
+
}
|
|
311
|
+
throw error;
|
|
312
|
+
}
|
|
313
|
+
},
|
|
314
|
+
},
|
|
315
|
+
{
|
|
316
|
+
name: 'update_note',
|
|
317
|
+
description: 'Replace the content (and optionally the title) of an existing note. The previous state is kept as a restorable revision. Requires approval.',
|
|
318
|
+
sideEffect: true,
|
|
319
|
+
paramsSchema: {
|
|
320
|
+
type: 'object',
|
|
321
|
+
properties: {
|
|
322
|
+
note_id: { type: 'string', description: 'The note id from list_notes' },
|
|
323
|
+
content: {
|
|
324
|
+
type: 'string',
|
|
325
|
+
description: 'The complete replacement Markdown content',
|
|
326
|
+
},
|
|
327
|
+
title: { type: 'string', description: 'Optional replacement title' },
|
|
328
|
+
},
|
|
329
|
+
required: ['note_id', 'content'],
|
|
330
|
+
},
|
|
331
|
+
available: async () => true,
|
|
332
|
+
execute: async (args, context) => {
|
|
333
|
+
const noteId = asString(args.note_id).trim();
|
|
334
|
+
try {
|
|
335
|
+
const note = await updateNote(context.actor, noteId, {
|
|
336
|
+
content: asString(args.content),
|
|
337
|
+
...(typeof args.title === 'string' ? { title: args.title } : {}),
|
|
338
|
+
});
|
|
339
|
+
return {
|
|
340
|
+
text: `Updated note "${note.title}" (id: ${note.id}); the previous version is saved as a revision.`,
|
|
341
|
+
isError: false,
|
|
342
|
+
truncated: false,
|
|
343
|
+
};
|
|
344
|
+
}
|
|
345
|
+
catch (error) {
|
|
346
|
+
if (error instanceof NoteError) {
|
|
347
|
+
return { text: error.message, isError: true, truncated: false };
|
|
348
|
+
}
|
|
349
|
+
throw error;
|
|
350
|
+
}
|
|
351
|
+
},
|
|
352
|
+
},
|
|
353
|
+
{
|
|
354
|
+
name: 'list_calendar_events',
|
|
355
|
+
description: "List the user's calendar events (own and shared calendars) in a " +
|
|
356
|
+
'date range. Times are epoch milliseconds.',
|
|
357
|
+
paramsSchema: {
|
|
358
|
+
type: 'object',
|
|
359
|
+
properties: {
|
|
360
|
+
from: {
|
|
361
|
+
type: 'number',
|
|
362
|
+
description: 'Range start as epoch milliseconds',
|
|
363
|
+
},
|
|
364
|
+
to: { type: 'number', description: 'Range end as epoch milliseconds' },
|
|
365
|
+
},
|
|
366
|
+
required: ['from', 'to'],
|
|
367
|
+
},
|
|
368
|
+
available: async () => true,
|
|
369
|
+
execute: async (args, context) => {
|
|
370
|
+
const from = Number(args.from);
|
|
371
|
+
const to = Number(args.to);
|
|
372
|
+
if (!Number.isSafeInteger(from) ||
|
|
373
|
+
!Number.isSafeInteger(to) ||
|
|
374
|
+
to <= from) {
|
|
375
|
+
return {
|
|
376
|
+
text: 'from and to must be an increasing epoch-ms range.',
|
|
377
|
+
isError: true,
|
|
378
|
+
truncated: false,
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
try {
|
|
382
|
+
const { calendarService } = await import('./calendarService.js');
|
|
383
|
+
const { events } = await calendarService.listEventsForActor(context.actor, { from, to });
|
|
384
|
+
const scoped = events.filter(event => event.startAt >= from && event.startAt < to);
|
|
385
|
+
if (scoped.length === 0) {
|
|
386
|
+
return {
|
|
387
|
+
text: 'No calendar events in this range.',
|
|
388
|
+
isError: false,
|
|
389
|
+
truncated: false,
|
|
390
|
+
};
|
|
391
|
+
}
|
|
392
|
+
const rendered = scoped
|
|
393
|
+
.sort((left, right) => left.startAt - right.startAt)
|
|
394
|
+
.map(event => {
|
|
395
|
+
const start = new Date(event.startAt).toISOString();
|
|
396
|
+
const marks = [
|
|
397
|
+
...(event.allDay ? ['all-day'] : []),
|
|
398
|
+
...(event.recurrence ? ['recurring'] : []),
|
|
399
|
+
...(event.shared ? ['shared'] : []),
|
|
400
|
+
];
|
|
401
|
+
const suffix = marks.length > 0 ? ` [${marks.join('; ')}]` : '';
|
|
402
|
+
return `- ${start} ${event.title} (id: ${event.id})${suffix}`;
|
|
403
|
+
})
|
|
404
|
+
.join('\n');
|
|
405
|
+
return { ...bounded(rendered), isError: false };
|
|
406
|
+
}
|
|
407
|
+
catch (error) {
|
|
408
|
+
if (error instanceof ResourcePolicyError) {
|
|
409
|
+
return { text: error.message, isError: true, truncated: false };
|
|
410
|
+
}
|
|
411
|
+
throw error;
|
|
412
|
+
}
|
|
413
|
+
},
|
|
414
|
+
},
|
|
415
|
+
{
|
|
416
|
+
name: 'create_calendar_event',
|
|
417
|
+
description: 'Create a calendar event. Times are epoch milliseconds. Requires approval.',
|
|
418
|
+
sideEffect: true,
|
|
419
|
+
paramsSchema: {
|
|
420
|
+
type: 'object',
|
|
421
|
+
properties: {
|
|
422
|
+
title: { type: 'string', description: 'The event title' },
|
|
423
|
+
start_at: {
|
|
424
|
+
type: 'number',
|
|
425
|
+
description: 'Event start as epoch milliseconds',
|
|
426
|
+
},
|
|
427
|
+
end_at: {
|
|
428
|
+
type: 'number',
|
|
429
|
+
description: 'Optional event end as epoch milliseconds',
|
|
430
|
+
},
|
|
431
|
+
notes: { type: 'string', description: 'Optional event notes' },
|
|
432
|
+
all_day: {
|
|
433
|
+
type: 'boolean',
|
|
434
|
+
description: 'Whether the event is all-day',
|
|
435
|
+
},
|
|
436
|
+
},
|
|
437
|
+
required: ['title', 'start_at'],
|
|
438
|
+
},
|
|
439
|
+
available: async () => true,
|
|
440
|
+
execute: async (args, context) => {
|
|
441
|
+
const startAt = Number(args.start_at);
|
|
442
|
+
const endAt = args.end_at !== undefined ? Number(args.end_at) : undefined;
|
|
443
|
+
if (!Number.isSafeInteger(startAt) ||
|
|
444
|
+
(endAt !== undefined &&
|
|
445
|
+
(!Number.isSafeInteger(endAt) || endAt < startAt))) {
|
|
446
|
+
return {
|
|
447
|
+
text: 'start_at (and optional end_at) must be epoch milliseconds.',
|
|
448
|
+
isError: true,
|
|
449
|
+
truncated: false,
|
|
450
|
+
};
|
|
451
|
+
}
|
|
452
|
+
try {
|
|
453
|
+
const { calendarService } = await import('./calendarService.js');
|
|
454
|
+
const now = Date.now();
|
|
455
|
+
const saved = await calendarService.saveEventForActor(context.actor, {
|
|
456
|
+
id: randomUUID(),
|
|
457
|
+
title: asString(args.title),
|
|
458
|
+
...(typeof args.notes === 'string' && args.notes
|
|
459
|
+
? { notes: args.notes }
|
|
460
|
+
: {}),
|
|
461
|
+
startAt,
|
|
462
|
+
...(endAt !== undefined ? { endAt } : {}),
|
|
463
|
+
allDay: args.all_day === true,
|
|
464
|
+
createdAt: now,
|
|
465
|
+
updatedAt: now,
|
|
466
|
+
}, undefined);
|
|
467
|
+
return {
|
|
468
|
+
text: `Created event "${saved.event.title}" at ` +
|
|
469
|
+
`${new Date(saved.event.startAt).toISOString()} ` +
|
|
470
|
+
`(id: ${saved.event.id}).`,
|
|
471
|
+
isError: false,
|
|
472
|
+
truncated: false,
|
|
473
|
+
};
|
|
474
|
+
}
|
|
475
|
+
catch (error) {
|
|
476
|
+
if (error instanceof ResourcePolicyError) {
|
|
477
|
+
return { text: error.message, isError: true, truncated: false };
|
|
478
|
+
}
|
|
479
|
+
throw error;
|
|
480
|
+
}
|
|
481
|
+
},
|
|
482
|
+
},
|
|
483
|
+
{
|
|
484
|
+
name: 'delete_calendar_event',
|
|
485
|
+
description: 'Delete one calendar event by its id. Requires approval.',
|
|
486
|
+
sideEffect: true,
|
|
487
|
+
paramsSchema: {
|
|
488
|
+
type: 'object',
|
|
489
|
+
properties: {
|
|
490
|
+
event_id: {
|
|
491
|
+
type: 'string',
|
|
492
|
+
description: 'The event id from list_calendar_events',
|
|
493
|
+
},
|
|
494
|
+
},
|
|
495
|
+
required: ['event_id'],
|
|
496
|
+
},
|
|
497
|
+
available: async () => true,
|
|
498
|
+
execute: async (args, context) => {
|
|
499
|
+
const { calendarService } = await import('./calendarService.js');
|
|
500
|
+
const deleted = await calendarService.deleteEventForActor(context.actor, asString(args.event_id).trim());
|
|
501
|
+
return deleted
|
|
502
|
+
? { text: 'Event deleted.', isError: false, truncated: false }
|
|
503
|
+
: { text: 'Event not found.', isError: true, truncated: false };
|
|
504
|
+
},
|
|
505
|
+
},
|
|
506
|
+
{
|
|
507
|
+
name: 'load_skill',
|
|
508
|
+
description: 'Load the full instructions of one of the available skills by its slug.',
|
|
509
|
+
paramsSchema: {
|
|
510
|
+
type: 'object',
|
|
511
|
+
properties: {
|
|
512
|
+
slug: { type: 'string', description: 'The skill slug to load' },
|
|
513
|
+
},
|
|
514
|
+
required: ['slug'],
|
|
515
|
+
},
|
|
516
|
+
available: async (context) => (await availableSkills(context)).length > 0,
|
|
517
|
+
execute: async (args, context) => {
|
|
518
|
+
const slug = asString(args.slug).trim();
|
|
519
|
+
const permitted = await availableSkills(context);
|
|
520
|
+
const listed = permitted.find(skill => skill.slug === slug);
|
|
521
|
+
const skill = listed
|
|
522
|
+
? await getSkillBySlug(context.actor.userId, slug)
|
|
523
|
+
: null;
|
|
524
|
+
if (!skill || !skill.enabled) {
|
|
525
|
+
return {
|
|
526
|
+
text: `No enabled skill named "${slug}" is available.`,
|
|
527
|
+
isError: true,
|
|
528
|
+
truncated: false,
|
|
529
|
+
};
|
|
530
|
+
}
|
|
531
|
+
const files = (await listSkillFiles(skill.id, context.actor)) ?? [];
|
|
532
|
+
const inventory = files.length > 0
|
|
533
|
+
? [
|
|
534
|
+
'',
|
|
535
|
+
'',
|
|
536
|
+
'Bundled files (read one with read_skill_file):',
|
|
537
|
+
...files.map(file => `- ${file.path} (${file.size} bytes)`),
|
|
538
|
+
].join('\n')
|
|
539
|
+
: '';
|
|
540
|
+
return {
|
|
541
|
+
...bounded(`# Skill: ${skill.name}\n\n${skill.instructions}${inventory}`),
|
|
542
|
+
isError: false,
|
|
543
|
+
};
|
|
544
|
+
},
|
|
545
|
+
},
|
|
546
|
+
{
|
|
547
|
+
name: 'read_skill_file',
|
|
548
|
+
description: 'Read a file bundled with a loaded skill. Pass the skill slug and the relative path listed by load_skill.',
|
|
549
|
+
paramsSchema: {
|
|
550
|
+
type: 'object',
|
|
551
|
+
properties: {
|
|
552
|
+
slug: { type: 'string', description: 'The skill slug' },
|
|
553
|
+
path: {
|
|
554
|
+
type: 'string',
|
|
555
|
+
description: 'The bundled file path, as listed by load_skill',
|
|
556
|
+
},
|
|
557
|
+
},
|
|
558
|
+
required: ['slug', 'path'],
|
|
559
|
+
},
|
|
560
|
+
available: async (context) => (await availableSkills(context)).length > 0,
|
|
561
|
+
execute: async (args, context) => {
|
|
562
|
+
const slug = asString(args.slug).trim();
|
|
563
|
+
const path = asString(args.path).trim();
|
|
564
|
+
const permitted = await availableSkills(context);
|
|
565
|
+
const listed = permitted.find(skill => skill.slug === slug);
|
|
566
|
+
const skill = listed
|
|
567
|
+
? await getSkillBySlug(context.actor.userId, slug)
|
|
568
|
+
: null;
|
|
569
|
+
if (!skill || !skill.enabled) {
|
|
570
|
+
return {
|
|
571
|
+
text: `No enabled skill named "${slug}" is available.`,
|
|
572
|
+
isError: true,
|
|
573
|
+
truncated: false,
|
|
574
|
+
};
|
|
575
|
+
}
|
|
576
|
+
let file;
|
|
577
|
+
try {
|
|
578
|
+
file = await getSkillFile(skill.id, context.actor, path);
|
|
579
|
+
}
|
|
580
|
+
catch {
|
|
581
|
+
file = null;
|
|
582
|
+
}
|
|
583
|
+
if (!file) {
|
|
584
|
+
return {
|
|
585
|
+
text: `The skill "${slug}" bundles no file at "${path}". Call load_skill to list its files.`,
|
|
586
|
+
isError: true,
|
|
587
|
+
truncated: false,
|
|
588
|
+
};
|
|
589
|
+
}
|
|
590
|
+
return {
|
|
591
|
+
...bounded(`# ${slug}/${file.path}\n\n${file.content}`),
|
|
592
|
+
isError: false,
|
|
593
|
+
};
|
|
594
|
+
},
|
|
595
|
+
},
|
|
596
|
+
];
|
|
597
|
+
const MAX_MANIFEST_SKILLS = 30;
|
|
598
|
+
/** Enabled skills visible to this turn, honoring a profile's skill binding. */
|
|
599
|
+
const availableSkills = async (context) => {
|
|
600
|
+
const skills = await listSkills(context.actor.userId);
|
|
601
|
+
return skills
|
|
602
|
+
.filter(skill => skill.enabled)
|
|
603
|
+
.filter(skill => !context.skillIds || context.skillIds.includes(skill.id))
|
|
604
|
+
.slice(0, MAX_MANIFEST_SKILLS)
|
|
605
|
+
.map(skill => ({
|
|
606
|
+
slug: skill.slug,
|
|
607
|
+
name: skill.name,
|
|
608
|
+
description: skill.description,
|
|
609
|
+
}));
|
|
610
|
+
};
|
|
611
|
+
/**
|
|
612
|
+
* The lazy skill manifest travels in the load_skill tool description, so it
|
|
613
|
+
* reaches the model identically on every provider without touching the
|
|
614
|
+
* system-prompt plumbing.
|
|
615
|
+
*/
|
|
616
|
+
const loadSkillDescription = (skills) => [
|
|
617
|
+
'Load the full instructions of one of the available skills by its slug before applying it. Available skills:',
|
|
618
|
+
...skills.map(skill => `- ${skill.slug}: ${skill.name} — ${skill.description.slice(0, 200)}`),
|
|
619
|
+
].join('\n');
|
|
620
|
+
export const BUILTIN_TOOL_NAMES = BUILTIN_TOOLS.map(tool => tool.name);
|
|
621
|
+
/** The builtin tools available to this actor, optionally filtered by name. */
|
|
622
|
+
export async function effectiveBuiltinTools(context, names) {
|
|
623
|
+
const catalog = [];
|
|
624
|
+
for (const tool of BUILTIN_TOOLS) {
|
|
625
|
+
if (names && !names.includes(tool.name))
|
|
626
|
+
continue;
|
|
627
|
+
if (!(await tool.available(context)))
|
|
628
|
+
continue;
|
|
629
|
+
const description = tool.name === 'load_skill'
|
|
630
|
+
? loadSkillDescription(await availableSkills(context))
|
|
631
|
+
: tool.description;
|
|
632
|
+
catalog.push({
|
|
633
|
+
name: tool.name,
|
|
634
|
+
description,
|
|
635
|
+
paramsSchema: tool.paramsSchema,
|
|
636
|
+
sideEffect: tool.sideEffect === true,
|
|
637
|
+
source: 'builtin',
|
|
638
|
+
toolName: tool.name,
|
|
639
|
+
});
|
|
640
|
+
}
|
|
641
|
+
return catalog;
|
|
642
|
+
}
|
|
643
|
+
export async function executeBuiltinTool(name, args, context) {
|
|
644
|
+
const tool = BUILTIN_TOOLS.find(candidate => candidate.name === name);
|
|
645
|
+
if (!tool) {
|
|
646
|
+
return {
|
|
647
|
+
text: `Unknown builtin tool: ${name}`,
|
|
648
|
+
isError: true,
|
|
649
|
+
truncated: false,
|
|
650
|
+
};
|
|
651
|
+
}
|
|
652
|
+
if (!(await tool.available(context))) {
|
|
653
|
+
return {
|
|
654
|
+
text: `The ${name} tool is not available to this account.`,
|
|
655
|
+
isError: true,
|
|
656
|
+
truncated: false,
|
|
657
|
+
};
|
|
658
|
+
}
|
|
659
|
+
return tool.execute(args, context);
|
|
660
|
+
}
|
|
661
|
+
//# sourceMappingURL=builtinToolsService.js.map
|