libre-webui 0.21.3 → 0.22.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.
- package/README.md +308 -328
- package/backend/dist/cli/migrateSqliteToPostgres.d.ts +2 -0
- package/backend/dist/cli/migrateSqliteToPostgres.d.ts.map +1 -0
- package/backend/dist/cli/migrateSqliteToPostgres.js +113 -0
- package/backend/dist/cli/migrateSqliteToPostgres.js.map +1 -0
- package/backend/dist/cli/recoveryBackup.d.ts +3 -0
- package/backend/dist/cli/recoveryBackup.d.ts.map +1 -0
- package/backend/dist/cli/recoveryBackup.js +251 -0
- package/backend/dist/cli/recoveryBackup.js.map +1 -0
- package/backend/dist/cli/recoveryInventory.d.ts +2 -0
- package/backend/dist/cli/recoveryInventory.d.ts.map +1 -0
- package/backend/dist/cli/recoveryInventory.js +109 -0
- package/backend/dist/cli/recoveryInventory.js.map +1 -0
- package/backend/dist/db.d.ts +27 -0
- package/backend/dist/db.d.ts.map +1 -1
- package/backend/dist/db.js +333 -16
- package/backend/dist/db.js.map +1 -1
- package/backend/dist/env.d.ts.map +1 -1
- package/backend/dist/env.js +12 -2
- package/backend/dist/env.js.map +1 -1
- package/backend/dist/index.d.ts.map +1 -1
- package/backend/dist/index.js +235 -47
- package/backend/dist/index.js.map +1 -1
- package/backend/dist/main.d.ts +2 -0
- package/backend/dist/main.d.ts.map +1 -0
- package/backend/dist/main.js +137 -0
- package/backend/dist/main.js.map +1 -0
- package/backend/dist/middleware/auth.d.ts.map +1 -1
- package/backend/dist/middleware/auth.js +7 -3
- package/backend/dist/middleware/auth.js.map +1 -1
- package/backend/dist/middleware/chatCancellationAdmission.d.ts +7 -0
- package/backend/dist/middleware/chatCancellationAdmission.d.ts.map +1 -0
- package/backend/dist/middleware/chatCancellationAdmission.js +17 -0
- package/backend/dist/middleware/chatCancellationAdmission.js.map +1 -0
- package/backend/dist/middleware/coordinatedRateLimit.d.ts +18 -0
- package/backend/dist/middleware/coordinatedRateLimit.d.ts.map +1 -0
- package/backend/dist/middleware/coordinatedRateLimit.js +52 -0
- package/backend/dist/middleware/coordinatedRateLimit.js.map +1 -0
- package/backend/dist/middleware/sharedRateLimit.d.ts +26 -0
- package/backend/dist/middleware/sharedRateLimit.d.ts.map +1 -0
- package/backend/dist/middleware/sharedRateLimit.js +99 -0
- package/backend/dist/middleware/sharedRateLimit.js.map +1 -0
- package/backend/dist/models/personaModel.d.ts +1 -26
- package/backend/dist/models/personaModel.d.ts.map +1 -1
- package/backend/dist/models/personaModel.js +54 -247
- package/backend/dist/models/personaModel.js.map +1 -1
- package/backend/dist/models/userModel.d.ts +23 -66
- package/backend/dist/models/userModel.d.ts.map +1 -1
- package/backend/dist/models/userModel.js +110 -187
- package/backend/dist/models/userModel.js.map +1 -1
- package/backend/dist/persistence/chatGenerationTypes.d.ts +24 -0
- package/backend/dist/persistence/chatGenerationTypes.d.ts.map +1 -0
- package/backend/dist/persistence/chatGenerationTypes.js +7 -0
- package/backend/dist/persistence/chatGenerationTypes.js.map +1 -0
- package/backend/dist/persistence/extensionTypes.d.ts +185 -0
- package/backend/dist/persistence/extensionTypes.d.ts.map +1 -0
- package/backend/dist/persistence/extensionTypes.js +13 -0
- package/backend/dist/persistence/extensionTypes.js.map +1 -0
- package/backend/dist/persistence/identityDeletionTypes.d.ts +16 -0
- package/backend/dist/persistence/identityDeletionTypes.d.ts.map +1 -0
- package/backend/dist/persistence/identityDeletionTypes.js +7 -0
- package/backend/dist/persistence/identityDeletionTypes.js.map +1 -0
- package/backend/dist/persistence/index.d.ts +48 -0
- package/backend/dist/persistence/index.d.ts.map +1 -0
- package/backend/dist/persistence/index.js +159 -0
- package/backend/dist/persistence/index.js.map +1 -0
- package/backend/dist/persistence/postgresConfig.d.ts +32 -0
- package/backend/dist/persistence/postgresConfig.d.ts.map +1 -0
- package/backend/dist/persistence/postgresConfig.js +91 -0
- package/backend/dist/persistence/postgresConfig.js.map +1 -0
- package/backend/dist/persistence/postgresCoreMigration.d.ts +8 -0
- package/backend/dist/persistence/postgresCoreMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresCoreMigration.js +179 -0
- package/backend/dist/persistence/postgresCoreMigration.js.map +1 -0
- package/backend/dist/persistence/postgresDatabase.d.ts +40 -0
- package/backend/dist/persistence/postgresDatabase.d.ts.map +1 -0
- package/backend/dist/persistence/postgresDatabase.js +148 -0
- package/backend/dist/persistence/postgresDatabase.js.map +1 -0
- package/backend/dist/persistence/postgresExtensionMigration.d.ts +4 -0
- package/backend/dist/persistence/postgresExtensionMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresExtensionMigration.js +143 -0
- package/backend/dist/persistence/postgresExtensionMigration.js.map +1 -0
- package/backend/dist/persistence/postgresExtensionRepositories.d.ts +6 -0
- package/backend/dist/persistence/postgresExtensionRepositories.d.ts.map +1 -0
- package/backend/dist/persistence/postgresExtensionRepositories.js +550 -0
- package/backend/dist/persistence/postgresExtensionRepositories.js.map +1 -0
- package/backend/dist/persistence/postgresImportState.d.ts +9 -0
- package/backend/dist/persistence/postgresImportState.d.ts.map +1 -0
- package/backend/dist/persistence/postgresImportState.js +64 -0
- package/backend/dist/persistence/postgresImportState.js.map +1 -0
- package/backend/dist/persistence/postgresMigrationRegistry.d.ts +4 -0
- package/backend/dist/persistence/postgresMigrationRegistry.d.ts.map +1 -0
- package/backend/dist/persistence/postgresMigrationRegistry.js +33 -0
- package/backend/dist/persistence/postgresMigrationRegistry.js.map +1 -0
- package/backend/dist/persistence/postgresMigrationTypes.d.ts +24 -0
- package/backend/dist/persistence/postgresMigrationTypes.d.ts.map +1 -0
- package/backend/dist/persistence/postgresMigrationTypes.js +7 -0
- package/backend/dist/persistence/postgresMigrationTypes.js.map +1 -0
- package/backend/dist/persistence/postgresMigrations.d.ts +15 -0
- package/backend/dist/persistence/postgresMigrations.d.ts.map +1 -0
- package/backend/dist/persistence/postgresMigrations.js +333 -0
- package/backend/dist/persistence/postgresMigrations.js.map +1 -0
- package/backend/dist/persistence/postgresPersistence.d.ts +17 -0
- package/backend/dist/persistence/postgresPersistence.d.ts.map +1 -0
- package/backend/dist/persistence/postgresPersistence.js +332 -0
- package/backend/dist/persistence/postgresPersistence.js.map +1 -0
- package/backend/dist/persistence/postgresPluginDefinitionMigration.d.ts +4 -0
- package/backend/dist/persistence/postgresPluginDefinitionMigration.d.ts.map +1 -0
- package/backend/dist/persistence/postgresPluginDefinitionMigration.js +40 -0
- package/backend/dist/persistence/postgresPluginDefinitionMigration.js.map +1 -0
- package/backend/dist/persistence/postgresResourceRepositories.d.ts +7 -0
- package/backend/dist/persistence/postgresResourceRepositories.d.ts.map +1 -0
- package/backend/dist/persistence/postgresResourceRepositories.js +776 -0
- package/backend/dist/persistence/postgresResourceRepositories.js.map +1 -0
- package/backend/dist/persistence/postgresSchemaInspector.d.ts +14 -0
- package/backend/dist/persistence/postgresSchemaInspector.d.ts.map +1 -0
- package/backend/dist/persistence/postgresSchemaInspector.js +817 -0
- package/backend/dist/persistence/postgresSchemaInspector.js.map +1 -0
- package/backend/dist/persistence/resourceTypes.d.ts +207 -0
- package/backend/dist/persistence/resourceTypes.d.ts.map +1 -0
- package/backend/dist/persistence/resourceTypes.js +38 -0
- package/backend/dist/persistence/resourceTypes.js.map +1 -0
- package/backend/dist/persistence/sqliteExtensionRepositories.d.ts +4 -0
- package/backend/dist/persistence/sqliteExtensionRepositories.d.ts.map +1 -0
- package/backend/dist/persistence/sqliteExtensionRepositories.js +494 -0
- package/backend/dist/persistence/sqliteExtensionRepositories.js.map +1 -0
- package/backend/dist/persistence/sqliteMigrations.d.ts +93 -0
- package/backend/dist/persistence/sqliteMigrations.d.ts.map +1 -0
- package/backend/dist/persistence/sqliteMigrations.js +2232 -0
- package/backend/dist/persistence/sqliteMigrations.js.map +1 -0
- package/backend/dist/persistence/sqlitePersistence.d.ts +23 -0
- package/backend/dist/persistence/sqlitePersistence.d.ts.map +1 -0
- package/backend/dist/persistence/sqlitePersistence.js +596 -0
- package/backend/dist/persistence/sqlitePersistence.js.map +1 -0
- package/backend/dist/persistence/sqliteResourceRepositories.d.ts +4 -0
- package/backend/dist/persistence/sqliteResourceRepositories.d.ts.map +1 -0
- package/backend/dist/persistence/sqliteResourceRepositories.js +663 -0
- package/backend/dist/persistence/sqliteResourceRepositories.js.map +1 -0
- package/backend/dist/persistence/sqliteSyncExecutor.d.ts +5 -0
- package/backend/dist/persistence/sqliteSyncExecutor.d.ts.map +1 -0
- package/backend/dist/persistence/sqliteSyncExecutor.js +19 -0
- package/backend/dist/persistence/sqliteSyncExecutor.js.map +1 -0
- package/backend/dist/persistence/sqliteToPostgresMigration.d.ts +80 -0
- package/backend/dist/persistence/sqliteToPostgresMigration.d.ts.map +1 -0
- package/backend/dist/persistence/sqliteToPostgresMigration.js +1543 -0
- package/backend/dist/persistence/sqliteToPostgresMigration.js.map +1 -0
- package/backend/dist/persistence/types.d.ts +131 -0
- package/backend/dist/persistence/types.d.ts.map +1 -0
- package/backend/dist/persistence/types.js +18 -0
- package/backend/dist/persistence/types.js.map +1 -0
- package/backend/dist/persistence/voiceProfileNameLookup.d.ts +9 -0
- package/backend/dist/persistence/voiceProfileNameLookup.d.ts.map +1 -0
- package/backend/dist/persistence/voiceProfileNameLookup.js +15 -0
- package/backend/dist/persistence/voiceProfileNameLookup.js.map +1 -0
- package/backend/dist/platform/coordination/index.d.ts +7 -0
- package/backend/dist/platform/coordination/index.d.ts.map +1 -0
- package/backend/dist/platform/coordination/index.js +24 -0
- package/backend/dist/platform/coordination/index.js.map +1 -0
- package/backend/dist/platform/coordination/localCoordinator.d.ts +49 -0
- package/backend/dist/platform/coordination/localCoordinator.d.ts.map +1 -0
- package/backend/dist/platform/coordination/localCoordinator.js +380 -0
- package/backend/dist/platform/coordination/localCoordinator.js.map +1 -0
- package/backend/dist/platform/coordination/redisCoordinator.d.ts +83 -0
- package/backend/dist/platform/coordination/redisCoordinator.d.ts.map +1 -0
- package/backend/dist/platform/coordination/redisCoordinator.js +726 -0
- package/backend/dist/platform/coordination/redisCoordinator.js.map +1 -0
- package/backend/dist/platform/coordination/service.d.ts +11 -0
- package/backend/dist/platform/coordination/service.d.ts.map +1 -0
- package/backend/dist/platform/coordination/service.js +55 -0
- package/backend/dist/platform/coordination/service.js.map +1 -0
- package/backend/dist/platform/coordination/sharedAdmission.d.ts +53 -0
- package/backend/dist/platform/coordination/sharedAdmission.d.ts.map +1 -0
- package/backend/dist/platform/coordination/sharedAdmission.js +194 -0
- package/backend/dist/platform/coordination/sharedAdmission.js.map +1 -0
- package/backend/dist/platform/coordination/types.d.ts +76 -0
- package/backend/dist/platform/coordination/types.d.ts.map +1 -0
- package/backend/dist/platform/coordination/types.js +32 -0
- package/backend/dist/platform/coordination/types.js.map +1 -0
- package/backend/dist/platform/events/durableEventGateway.d.ts +54 -0
- package/backend/dist/platform/events/durableEventGateway.d.ts.map +1 -0
- package/backend/dist/platform/events/durableEventGateway.js +262 -0
- package/backend/dist/platform/events/durableEventGateway.js.map +1 -0
- package/backend/dist/platform/events/index.d.ts +3 -0
- package/backend/dist/platform/events/index.d.ts.map +1 -0
- package/backend/dist/platform/events/index.js +8 -0
- package/backend/dist/platform/events/index.js.map +1 -0
- package/backend/dist/platform/events/service.d.ts +8 -0
- package/backend/dist/platform/events/service.d.ts.map +1 -0
- package/backend/dist/platform/events/service.js +25 -0
- package/backend/dist/platform/events/service.js.map +1 -0
- package/backend/dist/platform/jobs/chatGenerationEnqueuer.d.ts +3 -0
- package/backend/dist/platform/jobs/chatGenerationEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/chatGenerationEnqueuer.js +55 -0
- package/backend/dist/platform/jobs/chatGenerationEnqueuer.js.map +1 -0
- package/backend/dist/platform/jobs/documentIngestionEnqueuer.d.ts +3 -0
- package/backend/dist/platform/jobs/documentIngestionEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/documentIngestionEnqueuer.js +38 -0
- package/backend/dist/platform/jobs/documentIngestionEnqueuer.js.map +1 -0
- package/backend/dist/platform/jobs/domainJobContracts.d.ts +30 -0
- package/backend/dist/platform/jobs/domainJobContracts.d.ts.map +1 -0
- package/backend/dist/platform/jobs/domainJobContracts.js +53 -0
- package/backend/dist/platform/jobs/domainJobContracts.js.map +1 -0
- package/backend/dist/platform/jobs/domainJobHandlers.d.ts +11 -0
- package/backend/dist/platform/jobs/domainJobHandlers.d.ts.map +1 -0
- package/backend/dist/platform/jobs/domainJobHandlers.js +617 -0
- package/backend/dist/platform/jobs/domainJobHandlers.js.map +1 -0
- package/backend/dist/platform/jobs/durableEventIdentity.d.ts +8 -0
- package/backend/dist/platform/jobs/durableEventIdentity.d.ts.map +1 -0
- package/backend/dist/platform/jobs/durableEventIdentity.js +33 -0
- package/backend/dist/platform/jobs/durableEventIdentity.js.map +1 -0
- package/backend/dist/platform/jobs/durableJobRuntime.d.ts +57 -0
- package/backend/dist/platform/jobs/durableJobRuntime.d.ts.map +1 -0
- package/backend/dist/platform/jobs/durableJobRuntime.js +131 -0
- package/backend/dist/platform/jobs/durableJobRuntime.js.map +1 -0
- package/backend/dist/platform/jobs/durableJobRuntimeBackend.d.ts +28 -0
- package/backend/dist/platform/jobs/durableJobRuntimeBackend.d.ts.map +1 -0
- package/backend/dist/platform/jobs/durableJobRuntimeBackend.js +62 -0
- package/backend/dist/platform/jobs/durableJobRuntimeBackend.js.map +1 -0
- package/backend/dist/platform/jobs/durableJobService.d.ts +85 -0
- package/backend/dist/platform/jobs/durableJobService.d.ts.map +1 -0
- package/backend/dist/platform/jobs/durableJobService.js +726 -0
- package/backend/dist/platform/jobs/durableJobService.js.map +1 -0
- package/backend/dist/platform/jobs/durableJobTypes.d.ts +195 -0
- package/backend/dist/platform/jobs/durableJobTypes.d.ts.map +1 -0
- package/backend/dist/platform/jobs/durableJobTypes.js +72 -0
- package/backend/dist/platform/jobs/durableJobTypes.js.map +1 -0
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts +87 -0
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.d.ts.map +1 -0
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.js +429 -0
- package/backend/dist/platform/jobs/embeddedDurableJobWorker.js.map +1 -0
- package/backend/dist/platform/jobs/identityDeletionEnqueuer.d.ts +3 -0
- package/backend/dist/platform/jobs/identityDeletionEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/identityDeletionEnqueuer.js +36 -0
- package/backend/dist/platform/jobs/identityDeletionEnqueuer.js.map +1 -0
- package/backend/dist/platform/jobs/index.d.ts +18 -0
- package/backend/dist/platform/jobs/index.d.ts.map +1 -0
- package/backend/dist/platform/jobs/index.js +34 -0
- package/backend/dist/platform/jobs/index.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.d.ts +4 -0
- package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.js +25 -0
- package/backend/dist/platform/jobs/postgresDurableEventIdempotencyMigration.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.d.ts +4 -0
- package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.js +23 -0
- package/backend/dist/platform/jobs/postgresDurableEventReplayIndexMigration.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobMigration.d.ts +11 -0
- package/backend/dist/platform/jobs/postgresDurableJobMigration.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobMigration.js +106 -0
- package/backend/dist/platform/jobs/postgresDurableJobMigration.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobRepository.d.ts +88 -0
- package/backend/dist/platform/jobs/postgresDurableJobRepository.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobRepository.js +1185 -0
- package/backend/dist/platform/jobs/postgresDurableJobRepository.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobService.d.ts +86 -0
- package/backend/dist/platform/jobs/postgresDurableJobService.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobService.js +696 -0
- package/backend/dist/platform/jobs/postgresDurableJobService.js.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts +53 -0
- package/backend/dist/platform/jobs/postgresDurableJobWorker.d.ts.map +1 -0
- package/backend/dist/platform/jobs/postgresDurableJobWorker.js +393 -0
- package/backend/dist/platform/jobs/postgresDurableJobWorker.js.map +1 -0
- package/backend/dist/platform/jobs/resourceDeletionEnqueuer.d.ts +3 -0
- package/backend/dist/platform/jobs/resourceDeletionEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/resourceDeletionEnqueuer.js +43 -0
- package/backend/dist/platform/jobs/resourceDeletionEnqueuer.js.map +1 -0
- package/backend/dist/platform/jobs/sqliteDurableJobRepository.d.ts +166 -0
- package/backend/dist/platform/jobs/sqliteDurableJobRepository.d.ts.map +1 -0
- package/backend/dist/platform/jobs/sqliteDurableJobRepository.js +1008 -0
- package/backend/dist/platform/jobs/sqliteDurableJobRepository.js.map +1 -0
- package/backend/dist/platform/jobs/videoGenerationEnqueuer.d.ts +4 -0
- package/backend/dist/platform/jobs/videoGenerationEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/videoGenerationEnqueuer.js +46 -0
- package/backend/dist/platform/jobs/videoGenerationEnqueuer.js.map +1 -0
- package/backend/dist/platform/jobs/workExecutionEnqueuer.d.ts +3 -0
- package/backend/dist/platform/jobs/workExecutionEnqueuer.d.ts.map +1 -0
- package/backend/dist/platform/jobs/workExecutionEnqueuer.js +38 -0
- package/backend/dist/platform/jobs/workExecutionEnqueuer.js.map +1 -0
- package/backend/dist/platform/ollamaRuntimeConfig.d.ts +40 -0
- package/backend/dist/platform/ollamaRuntimeConfig.d.ts.map +1 -0
- package/backend/dist/platform/ollamaRuntimeConfig.js +72 -0
- package/backend/dist/platform/ollamaRuntimeConfig.js.map +1 -0
- package/backend/dist/platform/recovery/backupArchive.d.ts +120 -0
- package/backend/dist/platform/recovery/backupArchive.d.ts.map +1 -0
- package/backend/dist/platform/recovery/backupArchive.js +842 -0
- package/backend/dist/platform/recovery/backupArchive.js.map +1 -0
- package/backend/dist/platform/recovery/index.d.ts +3 -0
- package/backend/dist/platform/recovery/index.d.ts.map +1 -0
- package/backend/dist/platform/recovery/index.js +8 -0
- package/backend/dist/platform/recovery/index.js.map +1 -0
- package/backend/dist/platform/recovery/teamBackupArchive.d.ts +98 -0
- package/backend/dist/platform/recovery/teamBackupArchive.d.ts.map +1 -0
- package/backend/dist/platform/recovery/teamBackupArchive.js +1203 -0
- package/backend/dist/platform/recovery/teamBackupArchive.js.map +1 -0
- package/backend/dist/platform/runtimeConfig.d.ts +70 -0
- package/backend/dist/platform/runtimeConfig.d.ts.map +1 -0
- package/backend/dist/platform/runtimeConfig.js +205 -0
- package/backend/dist/platform/runtimeConfig.js.map +1 -0
- package/backend/dist/platform/storage/aesGcmKeyring.d.ts +26 -0
- package/backend/dist/platform/storage/aesGcmKeyring.d.ts.map +1 -0
- package/backend/dist/platform/storage/aesGcmKeyring.js +135 -0
- package/backend/dist/platform/storage/aesGcmKeyring.js.map +1 -0
- package/backend/dist/platform/storage/blobReferenceRepository.d.ts +36 -0
- package/backend/dist/platform/storage/blobReferenceRepository.d.ts.map +1 -0
- package/backend/dist/platform/storage/blobReferenceRepository.js +117 -0
- package/backend/dist/platform/storage/blobReferenceRepository.js.map +1 -0
- package/backend/dist/platform/storage/blobStore.d.ts +111 -0
- package/backend/dist/platform/storage/blobStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/blobStore.js +46 -0
- package/backend/dist/platform/storage/blobStore.js.map +1 -0
- package/backend/dist/platform/storage/documentVectorIndex.d.ts +44 -0
- package/backend/dist/platform/storage/documentVectorIndex.d.ts.map +1 -0
- package/backend/dist/platform/storage/documentVectorIndex.js +110 -0
- package/backend/dist/platform/storage/documentVectorIndex.js.map +1 -0
- package/backend/dist/platform/storage/durableBlobQuotaPolicy.d.ts +82 -0
- package/backend/dist/platform/storage/durableBlobQuotaPolicy.d.ts.map +1 -0
- package/backend/dist/platform/storage/durableBlobQuotaPolicy.js +583 -0
- package/backend/dist/platform/storage/durableBlobQuotaPolicy.js.map +1 -0
- package/backend/dist/platform/storage/index.d.ts +19 -0
- package/backend/dist/platform/storage/index.d.ts.map +1 -0
- package/backend/dist/platform/storage/index.js +35 -0
- package/backend/dist/platform/storage/index.js.map +1 -0
- package/backend/dist/platform/storage/localEncryptedBlobStore.d.ts +120 -0
- package/backend/dist/platform/storage/localEncryptedBlobStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/localEncryptedBlobStore.js +1205 -0
- package/backend/dist/platform/storage/localEncryptedBlobStore.js.map +1 -0
- package/backend/dist/platform/storage/personaMemoryIndexing.d.ts +12 -0
- package/backend/dist/platform/storage/personaMemoryIndexing.d.ts.map +1 -0
- package/backend/dist/platform/storage/personaMemoryIndexing.js +25 -0
- package/backend/dist/platform/storage/personaMemoryIndexing.js.map +1 -0
- package/backend/dist/platform/storage/pgVectorStore.d.ts +37 -0
- package/backend/dist/platform/storage/pgVectorStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/pgVectorStore.js +493 -0
- package/backend/dist/platform/storage/pgVectorStore.js.map +1 -0
- package/backend/dist/platform/storage/platformDomainRepositories.d.ts +244 -0
- package/backend/dist/platform/storage/platformDomainRepositories.d.ts.map +1 -0
- package/backend/dist/platform/storage/platformDomainRepositories.js +7 -0
- package/backend/dist/platform/storage/platformDomainRepositories.js.map +1 -0
- package/backend/dist/platform/storage/platformStorageRuntime.d.ts +35 -0
- package/backend/dist/platform/storage/platformStorageRuntime.d.ts.map +1 -0
- package/backend/dist/platform/storage/platformStorageRuntime.js +299 -0
- package/backend/dist/platform/storage/platformStorageRuntime.js.map +1 -0
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts +4 -0
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.d.ts.map +1 -0
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js +1017 -0
- package/backend/dist/platform/storage/postgresPlatformDomainRepositories.js.map +1 -0
- package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.d.ts +4 -0
- package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.d.ts.map +1 -0
- package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.js +40 -0
- package/backend/dist/platform/storage/postgresResourceDeletionLifecycleMigration.js.map +1 -0
- package/backend/dist/platform/storage/resourceContentCleanup.d.ts +29 -0
- package/backend/dist/platform/storage/resourceContentCleanup.d.ts.map +1 -0
- package/backend/dist/platform/storage/resourceContentCleanup.js +100 -0
- package/backend/dist/platform/storage/resourceContentCleanup.js.map +1 -0
- package/backend/dist/platform/storage/resourceDeletionLifecycle.d.ts +14 -0
- package/backend/dist/platform/storage/resourceDeletionLifecycle.d.ts.map +1 -0
- package/backend/dist/platform/storage/resourceDeletionLifecycle.js +31 -0
- package/backend/dist/platform/storage/resourceDeletionLifecycle.js.map +1 -0
- package/backend/dist/platform/storage/s3EncryptedBlobStore.d.ts +140 -0
- package/backend/dist/platform/storage/s3EncryptedBlobStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/s3EncryptedBlobStore.js +1309 -0
- package/backend/dist/platform/storage/s3EncryptedBlobStore.js.map +1 -0
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts +71 -0
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js +766 -0
- package/backend/dist/platform/storage/sqliteEncryptedVectorStore.js.map +1 -0
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts +4 -0
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.d.ts.map +1 -0
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js +1037 -0
- package/backend/dist/platform/storage/sqlitePlatformDomainRepositories.js.map +1 -0
- package/backend/dist/platform/storage/sqliteToTeamStorageMigration.d.ts +25 -0
- package/backend/dist/platform/storage/sqliteToTeamStorageMigration.d.ts.map +1 -0
- package/backend/dist/platform/storage/sqliteToTeamStorageMigration.js +1292 -0
- package/backend/dist/platform/storage/sqliteToTeamStorageMigration.js.map +1 -0
- package/backend/dist/platform/storage/storageFactory.d.ts +83 -0
- package/backend/dist/platform/storage/storageFactory.d.ts.map +1 -0
- package/backend/dist/platform/storage/storageFactory.js +530 -0
- package/backend/dist/platform/storage/storageFactory.js.map +1 -0
- package/backend/dist/platform/storage/storageSchemaContracts.d.ts +22 -0
- package/backend/dist/platform/storage/storageSchemaContracts.d.ts.map +1 -0
- package/backend/dist/platform/storage/storageSchemaContracts.js +299 -0
- package/backend/dist/platform/storage/storageSchemaContracts.js.map +1 -0
- package/backend/dist/platform/storage/vectorStore.d.ts +117 -0
- package/backend/dist/platform/storage/vectorStore.d.ts.map +1 -0
- package/backend/dist/platform/storage/vectorStore.js +40 -0
- package/backend/dist/platform/storage/vectorStore.js.map +1 -0
- package/backend/dist/platform/workPersistence/index.d.ts +9 -0
- package/backend/dist/platform/workPersistence/index.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/index.js +14 -0
- package/backend/dist/platform/workPersistence/index.js.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.d.ts +9 -0
- package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.js +47 -0
- package/backend/dist/platform/workPersistence/postgresWorkLifecycleMigration.js.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.d.ts +3 -0
- package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.js +28 -0
- package/backend/dist/platform/workPersistence/postgresWorkMessageContentMigration.js.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkMigration.d.ts +3 -0
- package/backend/dist/platform/workPersistence/postgresWorkMigration.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkMigration.js +101 -0
- package/backend/dist/platform/workPersistence/postgresWorkMigration.js.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts +79 -0
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.js +521 -0
- package/backend/dist/platform/workPersistence/postgresWorkPersistence.js.map +1 -0
- package/backend/dist/platform/workPersistence/service.d.ts +6 -0
- package/backend/dist/platform/workPersistence/service.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/service.js +27 -0
- package/backend/dist/platform/workPersistence/service.js.map +1 -0
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts +77 -0
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js +463 -0
- package/backend/dist/platform/workPersistence/sqliteWorkPersistence.js.map +1 -0
- package/backend/dist/platform/workPersistence/types.d.ts +159 -0
- package/backend/dist/platform/workPersistence/types.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/types.js +13 -0
- package/backend/dist/platform/workPersistence/types.js.map +1 -0
- package/backend/dist/platform/workPersistence/workExecutionTypes.d.ts +13 -0
- package/backend/dist/platform/workPersistence/workExecutionTypes.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/workExecutionTypes.js +7 -0
- package/backend/dist/platform/workPersistence/workExecutionTypes.js.map +1 -0
- package/backend/dist/platform/workPersistence/workMessageContentCodec.d.ts +8 -0
- package/backend/dist/platform/workPersistence/workMessageContentCodec.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/workMessageContentCodec.js +25 -0
- package/backend/dist/platform/workPersistence/workMessageContentCodec.js.map +1 -0
- package/backend/dist/platform/workPersistence/workTextSafety.d.ts +3 -0
- package/backend/dist/platform/workPersistence/workTextSafety.d.ts.map +1 -0
- package/backend/dist/platform/workPersistence/workTextSafety.js +8 -0
- package/backend/dist/platform/workPersistence/workTextSafety.js.map +1 -0
- package/backend/dist/routes/agentCli.js +1 -1
- package/backend/dist/routes/agentCli.js.map +1 -1
- package/backend/dist/routes/artifacts.d.ts.map +1 -1
- package/backend/dist/routes/artifacts.js +2 -1
- package/backend/dist/routes/artifacts.js.map +1 -1
- package/backend/dist/routes/auth.d.ts.map +1 -1
- package/backend/dist/routes/auth.js +64 -18
- package/backend/dist/routes/auth.js.map +1 -1
- package/backend/dist/routes/chat.d.ts.map +1 -1
- package/backend/dist/routes/chat.js +519 -85
- package/backend/dist/routes/chat.js.map +1 -1
- package/backend/dist/routes/documents.d.ts.map +1 -1
- package/backend/dist/routes/documents.js +134 -28
- package/backend/dist/routes/documents.js.map +1 -1
- package/backend/dist/routes/embeddings.d.ts.map +1 -1
- package/backend/dist/routes/embeddings.js +2 -1
- package/backend/dist/routes/embeddings.js.map +1 -1
- package/backend/dist/routes/health.d.ts +3 -0
- package/backend/dist/routes/health.d.ts.map +1 -0
- package/backend/dist/routes/health.js +52 -0
- package/backend/dist/routes/health.js.map +1 -0
- package/backend/dist/routes/huggingfaceHub.d.ts.map +1 -1
- package/backend/dist/routes/huggingfaceHub.js +2 -1
- package/backend/dist/routes/huggingfaceHub.js.map +1 -1
- package/backend/dist/routes/imageGen.d.ts.map +1 -1
- package/backend/dist/routes/imageGen.js +42 -10
- package/backend/dist/routes/imageGen.js.map +1 -1
- package/backend/dist/routes/jobs.d.ts +3 -0
- package/backend/dist/routes/jobs.d.ts.map +1 -0
- package/backend/dist/routes/jobs.js +126 -0
- package/backend/dist/routes/jobs.js.map +1 -0
- package/backend/dist/routes/libreClaw.d.ts.map +1 -1
- package/backend/dist/routes/libreClaw.js +10 -7
- package/backend/dist/routes/libreClaw.js.map +1 -1
- package/backend/dist/routes/media.d.ts.map +1 -1
- package/backend/dist/routes/media.js +523 -77
- 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 +21 -21
- package/backend/dist/routes/notes.js.map +1 -1
- package/backend/dist/routes/ollama.d.ts.map +1 -1
- package/backend/dist/routes/ollama.js +40 -12
- package/backend/dist/routes/ollama.js.map +1 -1
- package/backend/dist/routes/personas.d.ts.map +1 -1
- package/backend/dist/routes/personas.js +4 -2
- package/backend/dist/routes/personas.js.map +1 -1
- package/backend/dist/routes/plugins.d.ts.map +1 -1
- package/backend/dist/routes/plugins.js +79 -51
- package/backend/dist/routes/plugins.js.map +1 -1
- package/backend/dist/routes/preferences.d.ts.map +1 -1
- package/backend/dist/routes/preferences.js +290 -25
- package/backend/dist/routes/preferences.js.map +1 -1
- package/backend/dist/routes/search.d.ts.map +1 -1
- package/backend/dist/routes/search.js +23 -14
- package/backend/dist/routes/search.js.map +1 -1
- package/backend/dist/routes/stt.d.ts +9 -0
- package/backend/dist/routes/stt.d.ts.map +1 -0
- package/backend/dist/routes/stt.js +217 -0
- package/backend/dist/routes/stt.js.map +1 -0
- package/backend/dist/routes/systemDiagnostics.d.ts.map +1 -1
- package/backend/dist/routes/systemDiagnostics.js +2 -1
- package/backend/dist/routes/systemDiagnostics.js.map +1 -1
- package/backend/dist/routes/tts.d.ts.map +1 -1
- package/backend/dist/routes/tts.js +577 -28
- 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 +16 -25
- package/backend/dist/routes/users.js.map +1 -1
- package/backend/dist/routes/work.d.ts.map +1 -1
- package/backend/dist/routes/work.js +167 -113
- package/backend/dist/routes/work.js.map +1 -1
- package/backend/dist/services/agentAccessService.d.ts +2 -2
- package/backend/dist/services/agentAccessService.d.ts.map +1 -1
- package/backend/dist/services/agentAccessService.js +5 -14
- package/backend/dist/services/agentAccessService.js.map +1 -1
- package/backend/dist/services/agentCliService.d.ts +3 -2
- package/backend/dist/services/agentCliService.d.ts.map +1 -1
- package/backend/dist/services/agentCliService.js +44 -16
- package/backend/dist/services/agentCliService.js.map +1 -1
- package/backend/dist/services/assistantCompletionService.d.ts +2 -1
- package/backend/dist/services/assistantCompletionService.d.ts.map +1 -1
- package/backend/dist/services/assistantCompletionService.js +7 -3
- package/backend/dist/services/assistantCompletionService.js.map +1 -1
- package/backend/dist/services/authService.d.ts +7 -2
- package/backend/dist/services/authService.d.ts.map +1 -1
- package/backend/dist/services/authService.js +23 -10
- package/backend/dist/services/authService.js.map +1 -1
- package/backend/dist/services/chatGenerationService.d.ts +5 -4
- package/backend/dist/services/chatGenerationService.d.ts.map +1 -1
- package/backend/dist/services/chatGenerationService.js +23 -17
- package/backend/dist/services/chatGenerationService.js.map +1 -1
- package/backend/dist/services/chatRequestService.d.ts +4 -3
- package/backend/dist/services/chatRequestService.d.ts.map +1 -1
- package/backend/dist/services/chatRequestService.js +3 -3
- package/backend/dist/services/chatRequestService.js.map +1 -1
- package/backend/dist/services/chatService.d.ts +66 -16
- package/backend/dist/services/chatService.d.ts.map +1 -1
- package/backend/dist/services/chatService.js +402 -111
- package/backend/dist/services/chatService.js.map +1 -1
- package/backend/dist/services/codexOAuthService.d.ts +2 -2
- package/backend/dist/services/codexOAuthService.d.ts.map +1 -1
- package/backend/dist/services/codexOAuthService.js +63 -7
- package/backend/dist/services/codexOAuthService.js.map +1 -1
- package/backend/dist/services/dataArchiveService.d.ts +88 -0
- package/backend/dist/services/dataArchiveService.d.ts.map +1 -0
- package/backend/dist/services/dataArchiveService.js +1027 -0
- package/backend/dist/services/dataArchiveService.js.map +1 -0
- package/backend/dist/services/documentService.d.ts +67 -14
- package/backend/dist/services/documentService.d.ts.map +1 -1
- package/backend/dist/services/documentService.js +938 -193
- package/backend/dist/services/documentService.js.map +1 -1
- package/backend/dist/services/durableChatCompletion.d.ts +16 -0
- package/backend/dist/services/durableChatCompletion.d.ts.map +1 -0
- package/backend/dist/services/durableChatCompletion.js +34 -0
- package/backend/dist/services/durableChatCompletion.js.map +1 -0
- package/backend/dist/services/durableChatGenerationService.d.ts +19 -0
- package/backend/dist/services/durableChatGenerationService.d.ts.map +1 -0
- package/backend/dist/services/durableChatGenerationService.js +341 -0
- package/backend/dist/services/durableChatGenerationService.js.map +1 -0
- package/backend/dist/services/embeddingService.d.ts +1 -1
- package/backend/dist/services/embeddingService.d.ts.map +1 -1
- package/backend/dist/services/embeddingService.js +16 -13
- package/backend/dist/services/embeddingService.js.map +1 -1
- package/backend/dist/services/encryptionService.d.ts +28 -1
- package/backend/dist/services/encryptionService.d.ts.map +1 -1
- package/backend/dist/services/encryptionService.js +131 -51
- package/backend/dist/services/encryptionService.js.map +1 -1
- package/backend/dist/services/followUpService.d.ts +1 -1
- package/backend/dist/services/followUpService.d.ts.map +1 -1
- package/backend/dist/services/followUpService.js +1 -1
- package/backend/dist/services/followUpService.js.map +1 -1
- package/backend/dist/services/galleryService.d.ts +38 -37
- package/backend/dist/services/galleryService.d.ts.map +1 -1
- package/backend/dist/services/galleryService.js +356 -251
- package/backend/dist/services/galleryService.js.map +1 -1
- package/backend/dist/services/healthService.d.ts +65 -0
- package/backend/dist/services/healthService.d.ts.map +1 -0
- package/backend/dist/services/healthService.js +379 -0
- package/backend/dist/services/healthService.js.map +1 -0
- package/backend/dist/services/legacyCiphertextIntegrity.d.ts +40 -0
- package/backend/dist/services/legacyCiphertextIntegrity.d.ts.map +1 -0
- package/backend/dist/services/legacyCiphertextIntegrity.js +406 -0
- package/backend/dist/services/legacyCiphertextIntegrity.js.map +1 -0
- package/backend/dist/services/mediaGenerationJobService.d.ts +27 -5
- package/backend/dist/services/mediaGenerationJobService.d.ts.map +1 -1
- package/backend/dist/services/mediaGenerationJobService.js +185 -55
- package/backend/dist/services/mediaGenerationJobService.js.map +1 -1
- package/backend/dist/services/memoryService.d.ts +7 -83
- package/backend/dist/services/memoryService.d.ts.map +1 -1
- package/backend/dist/services/memoryService.js +428 -573
- package/backend/dist/services/memoryService.js.map +1 -1
- package/backend/dist/services/memoryUtils.d.ts.map +1 -1
- package/backend/dist/services/memoryUtils.js +8 -1
- package/backend/dist/services/memoryUtils.js.map +1 -1
- package/backend/dist/services/modelAccessService.d.ts +3 -3
- package/backend/dist/services/modelAccessService.d.ts.map +1 -1
- package/backend/dist/services/modelAccessService.js +8 -16
- package/backend/dist/services/modelAccessService.js.map +1 -1
- package/backend/dist/services/mutationEngineService.d.ts +0 -7
- package/backend/dist/services/mutationEngineService.d.ts.map +1 -1
- package/backend/dist/services/mutationEngineService.js +7 -78
- package/backend/dist/services/mutationEngineService.js.map +1 -1
- package/backend/dist/services/ollamaService.d.ts +4 -4
- package/backend/dist/services/ollamaService.d.ts.map +1 -1
- package/backend/dist/services/ollamaService.js +62 -31
- package/backend/dist/services/ollamaService.js.map +1 -1
- package/backend/dist/services/personaService.d.ts.map +1 -1
- package/backend/dist/services/personaService.js +19 -54
- package/backend/dist/services/personaService.js.map +1 -1
- package/backend/dist/services/pluginActivationService.d.ts +6 -5
- package/backend/dist/services/pluginActivationService.d.ts.map +1 -1
- package/backend/dist/services/pluginActivationService.js +36 -76
- package/backend/dist/services/pluginActivationService.js.map +1 -1
- package/backend/dist/services/pluginAudioGenerationService.d.ts +11 -6
- package/backend/dist/services/pluginAudioGenerationService.d.ts.map +1 -1
- package/backend/dist/services/pluginAudioGenerationService.js +74 -16
- package/backend/dist/services/pluginAudioGenerationService.js.map +1 -1
- package/backend/dist/services/pluginCacheInvalidation.d.ts +38 -0
- package/backend/dist/services/pluginCacheInvalidation.d.ts.map +1 -0
- package/backend/dist/services/pluginCacheInvalidation.js +198 -0
- package/backend/dist/services/pluginCacheInvalidation.js.map +1 -0
- package/backend/dist/services/pluginCapabilityRegistryService.d.ts +3 -3
- package/backend/dist/services/pluginCapabilityRegistryService.d.ts.map +1 -1
- package/backend/dist/services/pluginCapabilityRegistryService.js +11 -7
- package/backend/dist/services/pluginCapabilityRegistryService.js.map +1 -1
- package/backend/dist/services/pluginCredentialsService.d.ts +9 -8
- package/backend/dist/services/pluginCredentialsService.d.ts.map +1 -1
- package/backend/dist/services/pluginCredentialsService.js +48 -89
- package/backend/dist/services/pluginCredentialsService.js.map +1 -1
- package/backend/dist/services/pluginEmbeddingService.d.ts +8 -7
- package/backend/dist/services/pluginEmbeddingService.d.ts.map +1 -1
- package/backend/dist/services/pluginEmbeddingService.js +13 -11
- package/backend/dist/services/pluginEmbeddingService.js.map +1 -1
- package/backend/dist/services/pluginImageGenerationService.d.ts +10 -8
- package/backend/dist/services/pluginImageGenerationService.d.ts.map +1 -1
- package/backend/dist/services/pluginImageGenerationService.js +119 -14
- package/backend/dist/services/pluginImageGenerationService.js.map +1 -1
- package/backend/dist/services/pluginSTTService.d.ts +47 -0
- package/backend/dist/services/pluginSTTService.d.ts.map +1 -0
- package/backend/dist/services/pluginSTTService.js +199 -0
- package/backend/dist/services/pluginSTTService.js.map +1 -0
- package/backend/dist/services/pluginService.d.ts +94 -40
- package/backend/dist/services/pluginService.d.ts.map +1 -1
- package/backend/dist/services/pluginService.js +833 -275
- package/backend/dist/services/pluginService.js.map +1 -1
- package/backend/dist/services/pluginTTSService.d.ts +26 -8
- package/backend/dist/services/pluginTTSService.d.ts.map +1 -1
- package/backend/dist/services/pluginTTSService.js +277 -25
- package/backend/dist/services/pluginTTSService.js.map +1 -1
- package/backend/dist/services/pluginUsageService.d.ts +4 -4
- package/backend/dist/services/pluginUsageService.d.ts.map +1 -1
- package/backend/dist/services/pluginUsageService.js +44 -93
- package/backend/dist/services/pluginUsageService.js.map +1 -1
- package/backend/dist/services/pluginVariablesService.d.ts +14 -7
- package/backend/dist/services/pluginVariablesService.d.ts.map +1 -1
- package/backend/dist/services/pluginVariablesService.js +116 -81
- package/backend/dist/services/pluginVariablesService.js.map +1 -1
- package/backend/dist/services/pluginVideoGenerationService.d.ts +19 -8
- package/backend/dist/services/pluginVideoGenerationService.d.ts.map +1 -1
- package/backend/dist/services/pluginVideoGenerationService.js +116 -20
- package/backend/dist/services/pluginVideoGenerationService.js.map +1 -1
- package/backend/dist/services/preferencesService.d.ts +31 -21
- package/backend/dist/services/preferencesService.d.ts.map +1 -1
- package/backend/dist/services/preferencesService.js +104 -102
- package/backend/dist/services/preferencesService.js.map +1 -1
- package/backend/dist/services/recoveryInventoryService.d.ts +244 -0
- package/backend/dist/services/recoveryInventoryService.d.ts.map +1 -0
- package/backend/dist/services/recoveryInventoryService.js +1436 -0
- package/backend/dist/services/recoveryInventoryService.js.map +1 -0
- package/backend/dist/services/simpleGitHubOAuth.js +3 -3
- package/backend/dist/services/simpleGitHubOAuth.js.map +1 -1
- package/backend/dist/services/simpleHuggingFaceOAuth.d.ts.map +1 -1
- package/backend/dist/services/simpleHuggingFaceOAuth.js +3 -3
- package/backend/dist/services/simpleHuggingFaceOAuth.js.map +1 -1
- package/backend/dist/services/systemDiagnosticsService.d.ts.map +1 -1
- package/backend/dist/services/systemDiagnosticsService.js +2 -2
- package/backend/dist/services/systemDiagnosticsService.js.map +1 -1
- package/backend/dist/services/systemSettingsService.d.ts +5 -0
- package/backend/dist/services/systemSettingsService.d.ts.map +1 -0
- package/backend/dist/services/systemSettingsService.js +24 -0
- package/backend/dist/services/systemSettingsService.js.map +1 -0
- package/backend/dist/services/titleGenerationService.d.ts +1 -1
- package/backend/dist/services/titleGenerationService.d.ts.map +1 -1
- package/backend/dist/services/titleGenerationService.js +1 -1
- package/backend/dist/services/titleGenerationService.js.map +1 -1
- package/backend/dist/services/voiceProfileService.d.ts +44 -0
- package/backend/dist/services/voiceProfileService.d.ts.map +1 -0
- package/backend/dist/services/voiceProfileService.js +195 -0
- package/backend/dist/services/voiceProfileService.js.map +1 -0
- package/backend/dist/services/webSearchService.d.ts +7 -7
- package/backend/dist/services/webSearchService.d.ts.map +1 -1
- package/backend/dist/services/webSearchService.js +40 -35
- package/backend/dist/services/webSearchService.js.map +1 -1
- package/backend/dist/services/websocketTicketService.d.ts +39 -0
- package/backend/dist/services/websocketTicketService.d.ts.map +1 -0
- package/backend/dist/services/websocketTicketService.js +183 -0
- package/backend/dist/services/websocketTicketService.js.map +1 -0
- package/backend/dist/services/workAccessService.d.ts +3 -3
- package/backend/dist/services/workAccessService.d.ts.map +1 -1
- package/backend/dist/services/workAccessService.js +8 -16
- package/backend/dist/services/workAccessService.js.map +1 -1
- package/backend/dist/services/workAdminService.d.ts +3 -3
- package/backend/dist/services/workAdminService.d.ts.map +1 -1
- package/backend/dist/services/workAdminService.js +4 -4
- package/backend/dist/services/workAdminService.js.map +1 -1
- package/backend/dist/services/workAgentService.d.ts +25 -1
- package/backend/dist/services/workAgentService.d.ts.map +1 -1
- package/backend/dist/services/workAgentService.js +294 -126
- package/backend/dist/services/workAgentService.js.map +1 -1
- package/backend/dist/services/workEventService.d.ts +15 -2
- package/backend/dist/services/workEventService.d.ts.map +1 -1
- package/backend/dist/services/workEventService.js +201 -3
- package/backend/dist/services/workEventService.js.map +1 -1
- package/backend/dist/services/workKubernetesDriver.d.ts +8 -7
- package/backend/dist/services/workKubernetesDriver.d.ts.map +1 -1
- package/backend/dist/services/workKubernetesDriver.js +65 -21
- package/backend/dist/services/workKubernetesDriver.js.map +1 -1
- package/backend/dist/services/workModelProviderService.d.ts +2 -2
- package/backend/dist/services/workModelProviderService.d.ts.map +1 -1
- package/backend/dist/services/workModelProviderService.js +38 -34
- package/backend/dist/services/workModelProviderService.js.map +1 -1
- package/backend/dist/services/workPolicyService.d.ts +7 -7
- package/backend/dist/services/workPolicyService.d.ts.map +1 -1
- package/backend/dist/services/workPolicyService.js +50 -51
- package/backend/dist/services/workPolicyService.js.map +1 -1
- package/backend/dist/services/workPreviewProxyService.d.ts +8 -8
- package/backend/dist/services/workPreviewProxyService.d.ts.map +1 -1
- package/backend/dist/services/workPreviewProxyService.js +47 -44
- package/backend/dist/services/workPreviewProxyService.js.map +1 -1
- package/backend/dist/services/workRuntimeDriver.d.ts +21 -18
- package/backend/dist/services/workRuntimeDriver.d.ts.map +1 -1
- package/backend/dist/services/workRuntimeDriver.js +69 -20
- package/backend/dist/services/workRuntimeDriver.js.map +1 -1
- package/backend/dist/services/workRuntimeService.d.ts +18 -13
- package/backend/dist/services/workRuntimeService.d.ts.map +1 -1
- package/backend/dist/services/workRuntimeService.js +438 -194
- package/backend/dist/services/workRuntimeService.js.map +1 -1
- package/backend/dist/services/workRuntimeShared.d.ts +2 -0
- package/backend/dist/services/workRuntimeShared.d.ts.map +1 -1
- package/backend/dist/services/workRuntimeShared.js.map +1 -1
- package/backend/dist/services/workTaskService.d.ts +42 -36
- package/backend/dist/services/workTaskService.d.ts.map +1 -1
- package/backend/dist/services/workTaskService.js +445 -350
- package/backend/dist/services/workTaskService.js.map +1 -1
- package/backend/dist/services/workTerminalService.d.ts +1 -1
- package/backend/dist/services/workTerminalService.d.ts.map +1 -1
- package/backend/dist/services/workTerminalService.js +33 -6
- package/backend/dist/services/workTerminalService.js.map +1 -1
- package/backend/dist/storage.d.ts +72 -40
- package/backend/dist/storage.d.ts.map +1 -1
- package/backend/dist/storage.js +312 -660
- package/backend/dist/storage.js.map +1 -1
- package/backend/dist/types/index.d.ts +28 -0
- package/backend/dist/types/index.d.ts.map +1 -1
- package/backend/dist/types/index.js.map +1 -1
- package/backend/dist/types/work.d.ts +7 -2
- package/backend/dist/types/work.d.ts.map +1 -1
- package/backend/dist/utils/chatCancellation.d.ts +48 -0
- package/backend/dist/utils/chatCancellation.d.ts.map +1 -0
- package/backend/dist/utils/chatCancellation.js +152 -0
- package/backend/dist/utils/chatCancellation.js.map +1 -0
- package/backend/dist/utils/chatDocumentContext.d.ts +1 -1
- package/backend/dist/utils/chatDocumentContext.d.ts.map +1 -1
- package/backend/dist/utils/chatDocumentContext.js +11 -5
- package/backend/dist/utils/chatDocumentContext.js.map +1 -1
- package/backend/dist/utils/chatStreamCoalescer.d.ts +15 -0
- package/backend/dist/utils/chatStreamCoalescer.d.ts.map +1 -0
- package/backend/dist/utils/chatStreamCoalescer.js +59 -0
- package/backend/dist/utils/chatStreamCoalescer.js.map +1 -0
- package/backend/dist/utils/dataDirectory.d.ts +49 -0
- package/backend/dist/utils/dataDirectory.d.ts.map +1 -0
- package/backend/dist/utils/dataDirectory.js +291 -0
- package/backend/dist/utils/dataDirectory.js.map +1 -0
- package/backend/dist/utils/generationUtils.d.ts.map +1 -1
- package/backend/dist/utils/generationUtils.js +18 -6
- package/backend/dist/utils/generationUtils.js.map +1 -1
- package/backend/dist/utils/jwt.d.ts.map +1 -1
- package/backend/dist/utils/jwt.js +2 -3
- package/backend/dist/utils/jwt.js.map +1 -1
- package/backend/dist/utils/ollamaModelDefaults.d.ts.map +1 -1
- package/backend/dist/utils/ollamaModelDefaults.js +2 -7
- package/backend/dist/utils/ollamaModelDefaults.js.map +1 -1
- package/backend/dist/utils/ollamaStreaming.d.ts +2 -1
- package/backend/dist/utils/ollamaStreaming.d.ts.map +1 -1
- package/backend/dist/utils/ollamaStreaming.js +49 -11
- package/backend/dist/utils/ollamaStreaming.js.map +1 -1
- package/backend/dist/utils/pluginConnectionVariables.d.ts.map +1 -1
- package/backend/dist/utils/pluginConnectionVariables.js +11 -3
- package/backend/dist/utils/pluginConnectionVariables.js.map +1 -1
- package/backend/dist/utils/pluginDefinitionTrust.d.ts.map +1 -1
- package/backend/dist/utils/pluginDefinitionTrust.js +4 -3
- package/backend/dist/utils/pluginDefinitionTrust.js.map +1 -1
- package/backend/dist/utils/pluginStreaming.d.ts +2 -1
- package/backend/dist/utils/pluginStreaming.d.ts.map +1 -1
- package/backend/dist/utils/pluginStreaming.js +5 -1
- package/backend/dist/utils/pluginStreaming.js.map +1 -1
- package/backend/dist/utils/pluginUpload.d.ts +1 -0
- package/backend/dist/utils/pluginUpload.d.ts.map +1 -1
- package/backend/dist/utils/pluginUpload.js +14 -4
- package/backend/dist/utils/pluginUpload.js.map +1 -1
- package/backend/dist/utils/pluginValidation.d.ts.map +1 -1
- package/backend/dist/utils/pluginValidation.js +29 -1
- package/backend/dist/utils/pluginValidation.js.map +1 -1
- package/backend/dist/utils/sttAudioUpload.d.ts +24 -0
- package/backend/dist/utils/sttAudioUpload.d.ts.map +1 -0
- package/backend/dist/utils/sttAudioUpload.js +500 -0
- package/backend/dist/utils/sttAudioUpload.js.map +1 -0
- package/backend/dist/utils/ttsVoiceCloneUpload.d.ts +34 -0
- package/backend/dist/utils/ttsVoiceCloneUpload.d.ts.map +1 -0
- package/backend/dist/utils/ttsVoiceCloneUpload.js +224 -0
- package/backend/dist/utils/ttsVoiceCloneUpload.js.map +1 -0
- package/backend/dist/utils/websocketMessages.d.ts +2 -1
- package/backend/dist/utils/websocketMessages.d.ts.map +1 -1
- package/backend/dist/utils/websocketMessages.js +16 -2
- package/backend/dist/utils/websocketMessages.js.map +1 -1
- package/backend/dist/websocketServer.d.ts +4 -1
- package/backend/dist/websocketServer.d.ts.map +1 -1
- package/backend/dist/websocketServer.js +290 -44
- package/backend/dist/websocketServer.js.map +1 -1
- package/backend/dist/workTerminalServer.d.ts +9 -0
- package/backend/dist/workTerminalServer.d.ts.map +1 -1
- package/backend/dist/workTerminalServer.js +221 -52
- package/backend/dist/workTerminalServer.js.map +1 -1
- package/backend/dist/worker.d.ts +2 -0
- package/backend/dist/worker.d.ts.map +1 -0
- package/backend/dist/worker.js +250 -0
- package/backend/dist/worker.js.map +1 -0
- package/backend/package.json +19 -9
- package/bin/cli.js +126 -99
- package/bin/runtime-paths.js +108 -0
- package/frontend/dist/artifact-runtime/.build-fingerprint +1 -1
- package/frontend/dist/artifact-runtime/framer-motion.js +5 -5
- package/frontend/dist/artifact-runtime/lucide-react.js +1 -1
- package/frontend/dist/assets/index-Jtx9Amhz.js +16 -0
- package/frontend/dist/assets/index-kxtZQLV6.css +1 -0
- package/frontend/dist/assets/{markdown-math-ClQbWekD.css → markdown-math-ClTedVi7.css} +1 -1
- package/frontend/dist/index.html +18 -18
- package/frontend/dist/js/{ArtifactContainer-Dy2Q0iIL.js → ArtifactContainer-fZegtmva.js} +1 -1
- package/frontend/dist/js/{ArtifactDemoPage-K79dWshB.js → ArtifactDemoPage-BDBXYv9l.js} +1 -1
- package/frontend/dist/js/{ArtifactSandboxFrame-DhqLNUtY.js → ArtifactSandboxFrame-BN16NtKe.js} +3 -3
- package/frontend/dist/js/{ArtifactSlideOutPanel-Cl8JG7bz.js → ArtifactSlideOutPanel-x1fS85Ww.js} +1 -1
- package/frontend/dist/js/{Button-CTXHujOd.js → Button-BV44cTnj.js} +1 -1
- package/frontend/dist/js/ChatPage-C_pXh7WN.js +23 -0
- package/frontend/dist/js/{FirstTimeSetup-kHhRzGJ8.js → FirstTimeSetup-oRrlZnBm.js} +1 -1
- package/frontend/dist/js/GalleryPage-CV_vbE7X.js +1 -0
- package/frontend/dist/js/{HomePage-C1L8WAXL.js → HomePage-P-e7Huco.js} +1 -1
- package/frontend/dist/js/{LibreClawPage-Dyua8IUu.js → LibreClawPage-Cee06SUM.js} +1 -1
- package/frontend/dist/js/{ModelManagerModals-CuMRGUd-.js → ModelManagerModals-D7jIT3v1.js} +1 -1
- package/frontend/dist/js/{ModelSelector-CqHc-Ln4.js → ModelSelector-DXucbvrz.js} +1 -1
- package/frontend/dist/js/ModelsPage-C3_fZpMM.js +2 -0
- package/frontend/dist/js/NotesPage-rEIPWGIb.js +1 -0
- package/frontend/dist/js/{OptimizedSyntaxHighlighter-CWYUn9Oe.js → OptimizedSyntaxHighlighter-XwqZEoTf.js} +1 -1
- package/frontend/dist/js/{PersonasPage-D_6WBCH5.js → PersonasPage-BXtepFuD.js} +2 -2
- package/frontend/dist/js/PluginUsagePage-hhu8cxsu.js +1 -0
- package/frontend/dist/js/RichMessageContent-DkiEvdSg.js +3 -0
- package/frontend/dist/js/SettingsModal-BNxCtJ51.js +1 -0
- package/frontend/dist/js/{SettingsToggle-DLHlCDBl.js → SettingsToggle-WTa0rgvY.js} +1 -1
- package/frontend/dist/js/{SystemPage-BMWEet9e.js → SystemPage-BvvKFuoG.js} +1 -1
- package/frontend/dist/js/UserManagementPage-BccyR7si.js +1 -0
- package/frontend/dist/js/WorkPage-BgxrvY3I.js +6 -0
- package/frontend/dist/js/api-BvPDxsUQ.js +14 -0
- package/frontend/dist/js/appStore-DRSSjaHn.js +2 -0
- package/frontend/dist/js/ar-xTSvTq05.js +2 -0
- package/frontend/dist/js/authStore-BVykIRec.js +4 -0
- package/frontend/dist/js/{babel-CmENXdZw.js → babel-D24oDI9y.js} +1 -1
- package/frontend/dist/js/bn-iYAsohEA.js +2 -0
- package/frontend/dist/js/chatStore-UPp5TV_t.js +3 -0
- package/frontend/dist/js/{config-DkV1ka7I.js → config-BTlPm-cZ.js} +1 -1
- package/frontend/dist/js/cs-YBHN88Hb.js +2 -0
- package/frontend/dist/js/da-D7qlLy_k.js +2 -0
- package/frontend/dist/js/de-DV671k2c.js +2 -0
- package/frontend/dist/js/es-kyBgzNq-.js +2 -0
- package/frontend/dist/js/{estree-D5KP-qbw.js → estree-CfYahF_d.js} +1 -1
- package/frontend/dist/js/fr-Cw1vut7I.js +2 -0
- package/frontend/dist/js/hi-DWEFC024.js +2 -0
- package/frontend/dist/js/{html-Cm9c2akd.js → html-BJsDX1UZ.js} +1 -1
- package/frontend/dist/js/id-DlMHjjy0.js +2 -0
- package/frontend/dist/js/is-B9E_a7dG.js +2 -0
- package/frontend/dist/js/it-DawmVbLC.js +2 -0
- package/frontend/dist/js/ja-DmVvwY3W.js +2 -0
- package/frontend/dist/js/ko-DzOPpkVs.js +2 -0
- package/frontend/dist/js/{markdown-B2u7CnKN.js → markdown-GLyuUNig.js} +1 -1
- package/frontend/dist/js/markdown-core-BmPPZiuD.js +31 -0
- package/frontend/dist/js/{markdown-math-B7FlYsmr.js → markdown-math-mH7AZ_mb.js} +6 -6
- package/frontend/dist/js/{messageCodeStyles-DalG2j6U.js → messageCodeStyles-BHddEFP1.js} +1 -1
- package/frontend/dist/js/ms-DpsaOPht.js +2 -0
- package/frontend/dist/js/nl-B1d8W22n.js +2 -0
- package/frontend/dist/js/pl-nCncRVgt.js +2 -0
- package/frontend/dist/js/{postcss-B5WIGhAY.js → postcss-Bx9CTcIc.js} +1 -1
- package/frontend/dist/js/pt-DHw8fGuu.js +2 -0
- package/frontend/dist/js/{react-vendor-DPNXrO-8.js → react-vendor-C5yShNlM.js} +1 -1
- package/frontend/dist/js/{router-vendor-Ca9zqOqT.js → router-vendor-CbPDks39.js} +1 -1
- package/frontend/dist/js/ru-Derl_YP_.js +2 -0
- package/frontend/dist/js/{standalone-Dwm1daef.js → standalone-Dh56V0YW.js} +1 -1
- package/frontend/dist/js/sv-pJAfBVo0.js +2 -0
- package/frontend/dist/js/{syntax-highlight-Ca9bHsaz.js → syntax-highlight-3EEX6CGL.js} +3 -3
- package/frontend/dist/js/th-C_7fIGnk.js +2 -0
- package/frontend/dist/js/tr-CPqsJvaP.js +2 -0
- package/frontend/dist/js/{typescript-CwieSptM.js → typescript-DRy7A9w4.js} +1 -1
- package/frontend/dist/js/{ui-BnDZpjfc.js → ui-CuY4IifA.js} +2 -2
- package/frontend/dist/js/ui-vendor-D3Ahl1x5.js +177 -0
- package/frontend/dist/js/uk-3o8P_kFi.js +2 -0
- package/frontend/dist/js/{useTranslation-CXY69qNk.js → useTranslation-C3ei3mJq.js} +1 -1
- package/frontend/dist/js/{utils-BM0_0iFj.js → utils-CuC1beTY.js} +1 -1
- package/frontend/dist/js/{utils-vendor-1zob7nK9.js → utils-vendor-BBa8OxtB.js} +1 -1
- package/frontend/dist/js/vi-Dv6N7OVD.js +2 -0
- package/frontend/dist/js/{workApi-BOS7crs9.js → workApi-DHuYNHLf.js} +2 -2
- package/frontend/dist/js/{yaml-QD4znPfZ.js → yaml-DioTxVLA.js} +1 -1
- package/frontend/dist/js/zh-qg5iqtPi.js +2 -0
- package/package.json +16 -5
- package/plugins/huggingface.json +12 -3
- package/plugins/llama-cpp.json +18 -6
- package/plugins/longcat-audiodit.json +114 -0
- package/plugins/openai.json +18 -0
- package/frontend/dist/assets/index-BBpNbfKW.js +0 -16
- package/frontend/dist/assets/index-BLATyFmD.css +0 -1
- package/frontend/dist/js/ChatPage-BBayfMLS.js +0 -16
- package/frontend/dist/js/GalleryPage-By8VI39Q.js +0 -1
- package/frontend/dist/js/ModelsPage-ODeXhDDk.js +0 -2
- package/frontend/dist/js/NotesPage-CApzDjOq.js +0 -1
- package/frontend/dist/js/PluginUsagePage-kutS6SOd.js +0 -1
- package/frontend/dist/js/RichMessageContent-g6WT75Te.js +0 -3
- package/frontend/dist/js/SettingsModal-B7z51BCx.js +0 -1
- package/frontend/dist/js/UserManagementPage-D08lM51c.js +0 -1
- package/frontend/dist/js/WorkPage-DdVLefsK.js +0 -6
- package/frontend/dist/js/api-CLEmGcEh.js +0 -14
- package/frontend/dist/js/appStore-CGdhvp9P.js +0 -2
- package/frontend/dist/js/ar-BTmB2WVm.js +0 -2
- package/frontend/dist/js/authStore-Dh3beEOq.js +0 -4
- package/frontend/dist/js/bn-CQnH7YVT.js +0 -2
- package/frontend/dist/js/chatStore-CDeYWL_q.js +0 -3
- package/frontend/dist/js/cs-oTTZkQXr.js +0 -2
- package/frontend/dist/js/da-Br0gB6J6.js +0 -2
- package/frontend/dist/js/de-DE2iztTF.js +0 -2
- package/frontend/dist/js/es-DgthfVtl.js +0 -2
- package/frontend/dist/js/fr-BjxjFwPh.js +0 -2
- package/frontend/dist/js/hi-D1q7E-9N.js +0 -2
- package/frontend/dist/js/id-CDJZqLTF.js +0 -2
- package/frontend/dist/js/is-BU7Um_Tq.js +0 -2
- package/frontend/dist/js/it-CdAxr8P_.js +0 -2
- package/frontend/dist/js/ja-BLbQwz9u.js +0 -2
- package/frontend/dist/js/ko-CY5lpkAe.js +0 -2
- package/frontend/dist/js/markdown-core-DHnR5Hw8.js +0 -16
- package/frontend/dist/js/ms-tQ8AYXEQ.js +0 -2
- package/frontend/dist/js/nl-CRNi2oWT.js +0 -2
- package/frontend/dist/js/pl-CWtFRS_W.js +0 -2
- package/frontend/dist/js/pt-C7SPoLF8.js +0 -2
- package/frontend/dist/js/ru-Dz4AX8xc.js +0 -2
- package/frontend/dist/js/sv-ETy5-boa.js +0 -2
- package/frontend/dist/js/th-DpuMqvxU.js +0 -2
- package/frontend/dist/js/tr-C-1AYAqg.js +0 -2
- package/frontend/dist/js/ui-vendor-xUzKqAXI.js +0 -177
- package/frontend/dist/js/uk-CyS680gr.js +0 -2
- package/frontend/dist/js/vi-BG8HuiTz.js +0 -2
- package/frontend/dist/js/zh-NCs2mkHj.js +0 -2
|
@@ -0,0 +1,726 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Libre WebUI
|
|
3
|
+
* Copyright (C) 2025 Kroonen AI, Inc.
|
|
4
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
5
|
+
*/
|
|
6
|
+
import { createHash, randomBytes, randomUUID } from 'crypto';
|
|
7
|
+
import { createClient } from 'redis';
|
|
8
|
+
import { assertCoordinationName, assertTtl, CoordinationUnavailableError, } from './types.js';
|
|
9
|
+
const MAX_COORDINATION_PAYLOAD_BYTES = 256 * 1024;
|
|
10
|
+
const ACQUIRE_LEASE_SCRIPT = `
|
|
11
|
+
if redis.call('EXISTS', KEYS[1]) == 0 then
|
|
12
|
+
local fence = redis.call('INCR', KEYS[2])
|
|
13
|
+
redis.call('PSETEX', KEYS[1], ARGV[1], ARGV[2] .. ':' .. fence)
|
|
14
|
+
return fence
|
|
15
|
+
end
|
|
16
|
+
return 0
|
|
17
|
+
`;
|
|
18
|
+
const EXTEND_LEASE_SCRIPT = `
|
|
19
|
+
local value = redis.call('GET', KEYS[1])
|
|
20
|
+
if value and value == ARGV[1] then
|
|
21
|
+
redis.call('PEXPIRE', KEYS[1], ARGV[2])
|
|
22
|
+
return 1
|
|
23
|
+
end
|
|
24
|
+
return 0
|
|
25
|
+
`;
|
|
26
|
+
const RELEASE_LEASE_SCRIPT = `
|
|
27
|
+
local value = redis.call('GET', KEYS[1])
|
|
28
|
+
if value and value == ARGV[1] then
|
|
29
|
+
return redis.call('DEL', KEYS[1])
|
|
30
|
+
end
|
|
31
|
+
return 0
|
|
32
|
+
`;
|
|
33
|
+
const RATE_LIMIT_SCRIPT = `
|
|
34
|
+
local token = redis.call('GET', KEYS[2])
|
|
35
|
+
if redis.call('EXISTS', KEYS[1]) == 0 or not token then
|
|
36
|
+
token = ARGV[2]
|
|
37
|
+
redis.call('PSETEX', KEYS[1], ARGV[1], 1)
|
|
38
|
+
redis.call('PSETEX', KEYS[2], ARGV[1], token)
|
|
39
|
+
return { 1, tonumber(ARGV[1]), token }
|
|
40
|
+
end
|
|
41
|
+
local count = redis.call('INCR', KEYS[1])
|
|
42
|
+
local ttl = redis.call('PTTL', KEYS[1])
|
|
43
|
+
return { count, ttl, token }
|
|
44
|
+
`;
|
|
45
|
+
const REFUND_RATE_LIMIT_SCRIPT = `
|
|
46
|
+
if redis.call('GET', KEYS[2]) ~= ARGV[1] or redis.call('EXISTS', KEYS[1]) == 0 then
|
|
47
|
+
return 0
|
|
48
|
+
end
|
|
49
|
+
local count = redis.call('DECR', KEYS[1])
|
|
50
|
+
if count <= 0 then
|
|
51
|
+
redis.call('DEL', KEYS[1], KEYS[2])
|
|
52
|
+
end
|
|
53
|
+
return 1
|
|
54
|
+
`;
|
|
55
|
+
const CONSUME_CACHE_SCRIPT = `
|
|
56
|
+
local value = redis.call('GET', KEYS[1])
|
|
57
|
+
if value then
|
|
58
|
+
redis.call('DEL', KEYS[1])
|
|
59
|
+
end
|
|
60
|
+
return value
|
|
61
|
+
`;
|
|
62
|
+
const ACQUIRE_SEMAPHORE_SCRIPT = `
|
|
63
|
+
local redisTime = redis.call('TIME')
|
|
64
|
+
local now = tonumber(redisTime[1]) * 1000 + math.floor(tonumber(redisTime[2]) / 1000)
|
|
65
|
+
local ttl = tonumber(ARGV[1])
|
|
66
|
+
redis.call('ZREMRANGEBYSCORE', KEYS[1], '-inf', now)
|
|
67
|
+
if redis.call('ZCARD', KEYS[1]) >= tonumber(ARGV[2]) then
|
|
68
|
+
return { 0, now }
|
|
69
|
+
end
|
|
70
|
+
local expiresAt = now + ttl
|
|
71
|
+
redis.call('ZADD', KEYS[1], expiresAt, ARGV[3])
|
|
72
|
+
local latest = redis.call('ZREVRANGE', KEYS[1], 0, 0, 'WITHSCORES')
|
|
73
|
+
if latest[2] then redis.call('PEXPIREAT', KEYS[1], math.floor(latest[2])) end
|
|
74
|
+
return { 1, expiresAt }
|
|
75
|
+
`;
|
|
76
|
+
const EXTEND_SEMAPHORE_SCRIPT = `
|
|
77
|
+
local redisTime = redis.call('TIME')
|
|
78
|
+
local now = tonumber(redisTime[1]) * 1000 + math.floor(tonumber(redisTime[2]) / 1000)
|
|
79
|
+
redis.call('ZREMRANGEBYSCORE', KEYS[1], '-inf', now)
|
|
80
|
+
if redis.call('ZSCORE', KEYS[1], ARGV[1]) then
|
|
81
|
+
local expiresAt = now + tonumber(ARGV[2])
|
|
82
|
+
redis.call('ZADD', KEYS[1], expiresAt, ARGV[1])
|
|
83
|
+
local latest = redis.call('ZREVRANGE', KEYS[1], 0, 0, 'WITHSCORES')
|
|
84
|
+
if latest[2] then redis.call('PEXPIREAT', KEYS[1], math.floor(latest[2])) end
|
|
85
|
+
return expiresAt
|
|
86
|
+
end
|
|
87
|
+
return 0
|
|
88
|
+
`;
|
|
89
|
+
const SET_PRESENCE_SCRIPT = `
|
|
90
|
+
local redisTime = redis.call('TIME')
|
|
91
|
+
local now = tonumber(redisTime[1]) * 1000 + math.floor(tonumber(redisTime[2]) / 1000)
|
|
92
|
+
local expiresAt = now + tonumber(ARGV[1])
|
|
93
|
+
redis.call('ZADD', KEYS[1], expiresAt, ARGV[2])
|
|
94
|
+
local latest = redis.call('ZREVRANGE', KEYS[1], 0, 0, 'WITHSCORES')
|
|
95
|
+
if latest[2] then redis.call('PEXPIREAT', KEYS[1], math.floor(latest[2])) end
|
|
96
|
+
return expiresAt
|
|
97
|
+
`;
|
|
98
|
+
const LIST_PRESENCE_SCRIPT = `
|
|
99
|
+
local redisTime = redis.call('TIME')
|
|
100
|
+
local now = tonumber(redisTime[1]) * 1000 + math.floor(tonumber(redisTime[2]) / 1000)
|
|
101
|
+
redis.call('ZREMRANGEBYSCORE', KEYS[1], '-inf', now)
|
|
102
|
+
local members = redis.call('ZRANGE', KEYS[1], 0, -1)
|
|
103
|
+
local latest = redis.call('ZREVRANGE', KEYS[1], 0, 0, 'WITHSCORES')
|
|
104
|
+
if latest[2] then redis.call('PEXPIREAT', KEYS[1], math.floor(latest[2])) end
|
|
105
|
+
return members
|
|
106
|
+
`;
|
|
107
|
+
const REVOKE_SCRIPT = `
|
|
108
|
+
local epoch = redis.call('INCR', KEYS[1])
|
|
109
|
+
local event = cjson.encode({
|
|
110
|
+
id = ARGV[1],
|
|
111
|
+
topic = ARGV[2],
|
|
112
|
+
emittedAt = ARGV[3],
|
|
113
|
+
payload = { subject = ARGV[4], epoch = epoch }
|
|
114
|
+
})
|
|
115
|
+
redis.call('PUBLISH', KEYS[2], event)
|
|
116
|
+
return epoch
|
|
117
|
+
`;
|
|
118
|
+
/** Redis coordination for shared deployments. Durable state remains in SQL. */
|
|
119
|
+
export class RedisCoordinator {
|
|
120
|
+
constructor(options) {
|
|
121
|
+
this.backend = 'redis';
|
|
122
|
+
this.handlers = new Map();
|
|
123
|
+
this.subscriptionStates = new Map();
|
|
124
|
+
this.activeSubscriptionDispatches = new Set();
|
|
125
|
+
this.closing = false;
|
|
126
|
+
this.prefix = options.keyPrefix?.trim() || 'libre';
|
|
127
|
+
this.connectTimeoutMs = options.connectTimeoutMs || 5000;
|
|
128
|
+
this.now = options.now || Date.now;
|
|
129
|
+
const clients = options.clientFactory?.() || this.createClients(options.url);
|
|
130
|
+
this.command = clients.command;
|
|
131
|
+
this.subscriber = clients.subscriber;
|
|
132
|
+
this.command.on('error', error => {
|
|
133
|
+
this.lastError = error;
|
|
134
|
+
});
|
|
135
|
+
this.subscriber.on('error', error => {
|
|
136
|
+
this.lastError = error;
|
|
137
|
+
});
|
|
138
|
+
}
|
|
139
|
+
async connect() {
|
|
140
|
+
if (this.closing) {
|
|
141
|
+
throw this.unavailable('Redis coordination is closing.', this.lastError);
|
|
142
|
+
}
|
|
143
|
+
try {
|
|
144
|
+
await this.withTimeout(Promise.all([this.command.connect(), this.subscriber.connect()]), this.connectTimeoutMs, 'Redis connection timed out.');
|
|
145
|
+
await this.withTimeout(this.command.ping(), this.connectTimeoutMs, 'Redis readiness ping timed out.');
|
|
146
|
+
this.lastError = undefined;
|
|
147
|
+
}
|
|
148
|
+
catch (error) {
|
|
149
|
+
this.command.destroy();
|
|
150
|
+
this.subscriber.destroy();
|
|
151
|
+
throw this.unavailable('Redis coordination is unavailable.', error);
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
async close() {
|
|
155
|
+
if (this.closePromise)
|
|
156
|
+
return this.closePromise;
|
|
157
|
+
this.closing = true;
|
|
158
|
+
this.handlers.clear();
|
|
159
|
+
this.subscriptionStates.clear();
|
|
160
|
+
this.closePromise = (async () => {
|
|
161
|
+
// A subscriber callback can still be awaiting an application handler
|
|
162
|
+
// after node-redis has delivered the message. Keep Redis and any
|
|
163
|
+
// persistence dependencies alive until every accepted dispatch settles.
|
|
164
|
+
while (this.activeSubscriptionDispatches.size > 0) {
|
|
165
|
+
await Promise.allSettled([...this.activeSubscriptionDispatches]);
|
|
166
|
+
}
|
|
167
|
+
await Promise.allSettled([
|
|
168
|
+
this.closeClient(this.command),
|
|
169
|
+
this.closeClient(this.subscriber),
|
|
170
|
+
]);
|
|
171
|
+
})();
|
|
172
|
+
return this.closePromise;
|
|
173
|
+
}
|
|
174
|
+
async health() {
|
|
175
|
+
const started = this.now();
|
|
176
|
+
if (!this.command.isReady || !this.subscriber.isReady) {
|
|
177
|
+
return {
|
|
178
|
+
ready: false,
|
|
179
|
+
backend: this.backend,
|
|
180
|
+
latencyMs: 0,
|
|
181
|
+
message: this.lastError?.message || 'Redis clients are not ready.',
|
|
182
|
+
};
|
|
183
|
+
}
|
|
184
|
+
try {
|
|
185
|
+
await this.withTimeout(this.command.ping(), 1000, 'Redis ping timed out.');
|
|
186
|
+
return {
|
|
187
|
+
ready: true,
|
|
188
|
+
backend: this.backend,
|
|
189
|
+
latencyMs: Math.max(0, this.now() - started),
|
|
190
|
+
};
|
|
191
|
+
}
|
|
192
|
+
catch (error) {
|
|
193
|
+
return {
|
|
194
|
+
ready: false,
|
|
195
|
+
backend: this.backend,
|
|
196
|
+
latencyMs: Math.max(0, this.now() - started),
|
|
197
|
+
message: error instanceof Error ? error.message : 'Redis ping failed.',
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
async publish(topic, payload) {
|
|
202
|
+
this.requireReady();
|
|
203
|
+
const normalizedTopic = assertCoordinationName(topic, 'Topic');
|
|
204
|
+
const event = {
|
|
205
|
+
id: randomUUID(),
|
|
206
|
+
topic: normalizedTopic,
|
|
207
|
+
emittedAt: new Date(this.now()).toISOString(),
|
|
208
|
+
payload,
|
|
209
|
+
};
|
|
210
|
+
const serialized = this.serialize(event);
|
|
211
|
+
try {
|
|
212
|
+
await this.withTimeout(this.command.publish(this.redisKey('event', normalizedTopic), serialized), this.connectTimeoutMs, 'Redis publish timed out.');
|
|
213
|
+
return event;
|
|
214
|
+
}
|
|
215
|
+
catch (error) {
|
|
216
|
+
throw this.unavailable('Redis publish failed.', error);
|
|
217
|
+
}
|
|
218
|
+
}
|
|
219
|
+
async subscribe(topic, handler) {
|
|
220
|
+
this.requireReady();
|
|
221
|
+
const normalizedTopic = assertCoordinationName(topic, 'Topic');
|
|
222
|
+
const channel = this.redisKey('event', normalizedTopic);
|
|
223
|
+
const tearingDown = this.subscriptionStates.get(channel)?.teardown;
|
|
224
|
+
if (tearingDown) {
|
|
225
|
+
try {
|
|
226
|
+
await tearingDown;
|
|
227
|
+
}
|
|
228
|
+
catch (error) {
|
|
229
|
+
throw this.unavailable('Redis subscription teardown failed.', error);
|
|
230
|
+
}
|
|
231
|
+
this.requireReady();
|
|
232
|
+
}
|
|
233
|
+
const handlers = this.handlers.get(channel) || new Set();
|
|
234
|
+
const untypedHandler = handler;
|
|
235
|
+
handlers.add(untypedHandler);
|
|
236
|
+
this.handlers.set(channel, handlers);
|
|
237
|
+
let state = this.subscriptionStates.get(channel);
|
|
238
|
+
if (!state) {
|
|
239
|
+
const rawSetup = this.subscriber.subscribe(channel, message => {
|
|
240
|
+
if (this.closing)
|
|
241
|
+
return;
|
|
242
|
+
// node-redis does not observe rejected async listener promises.
|
|
243
|
+
// Contain malformed events and individual handler failures here so
|
|
244
|
+
// a hostile/corrupt pub-sub message cannot become an unhandled
|
|
245
|
+
// process rejection.
|
|
246
|
+
let dispatch;
|
|
247
|
+
dispatch = this.dispatchSubscriptionMessage(channel, normalizedTopic, message)
|
|
248
|
+
.catch(() => {
|
|
249
|
+
this.lastError = new Error('Redis subscription event processing failed.');
|
|
250
|
+
})
|
|
251
|
+
.finally(() => this.activeSubscriptionDispatches.delete(dispatch));
|
|
252
|
+
this.activeSubscriptionDispatches.add(dispatch);
|
|
253
|
+
});
|
|
254
|
+
const created = {
|
|
255
|
+
rawSetup,
|
|
256
|
+
failed: false,
|
|
257
|
+
};
|
|
258
|
+
created.ready = this.withTimeout(rawSetup, this.connectTimeoutMs, 'Redis subscription timed out.').catch(error => {
|
|
259
|
+
created.failed = true;
|
|
260
|
+
void rawSetup
|
|
261
|
+
.then(() => this.withTimeout(this.subscriber.unsubscribe(channel), this.connectTimeoutMs, 'Redis late subscription cleanup timed out.')
|
|
262
|
+
.catch(() => undefined)
|
|
263
|
+
.finally(() => {
|
|
264
|
+
if (this.subscriptionStates.get(channel) === created) {
|
|
265
|
+
this.subscriptionStates.delete(channel);
|
|
266
|
+
}
|
|
267
|
+
}))
|
|
268
|
+
.catch(() => {
|
|
269
|
+
if (this.subscriptionStates.get(channel) === created) {
|
|
270
|
+
this.subscriptionStates.delete(channel);
|
|
271
|
+
}
|
|
272
|
+
});
|
|
273
|
+
throw error;
|
|
274
|
+
});
|
|
275
|
+
state = created;
|
|
276
|
+
this.subscriptionStates.set(channel, state);
|
|
277
|
+
}
|
|
278
|
+
try {
|
|
279
|
+
if (state.failed) {
|
|
280
|
+
throw new Error('Redis subscription setup previously failed.');
|
|
281
|
+
}
|
|
282
|
+
await state.ready;
|
|
283
|
+
if (this.closing) {
|
|
284
|
+
throw new Error('Redis coordinator is closing.');
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
catch (error) {
|
|
288
|
+
handlers.delete(untypedHandler);
|
|
289
|
+
if (handlers.size === 0)
|
|
290
|
+
this.handlers.delete(channel);
|
|
291
|
+
throw this.unavailable('Redis subscription failed.', error);
|
|
292
|
+
}
|
|
293
|
+
return async () => {
|
|
294
|
+
const current = this.handlers.get(channel);
|
|
295
|
+
current?.delete(untypedHandler);
|
|
296
|
+
if (current && current.size === 0) {
|
|
297
|
+
this.handlers.delete(channel);
|
|
298
|
+
const currentState = this.subscriptionStates.get(channel);
|
|
299
|
+
if (!currentState || currentState.failed)
|
|
300
|
+
return;
|
|
301
|
+
const pendingUnsubscribe = this.subscriber.unsubscribe(channel);
|
|
302
|
+
currentState.teardown = this.withTimeout(pendingUnsubscribe, this.connectTimeoutMs, 'Redis unsubscribe timed out.')
|
|
303
|
+
.then(() => {
|
|
304
|
+
if (this.subscriptionStates.get(channel) === currentState) {
|
|
305
|
+
this.subscriptionStates.delete(channel);
|
|
306
|
+
}
|
|
307
|
+
})
|
|
308
|
+
.catch(error => {
|
|
309
|
+
currentState.failed = true;
|
|
310
|
+
void pendingUnsubscribe
|
|
311
|
+
.then(() => {
|
|
312
|
+
if (this.subscriptionStates.get(channel) === currentState) {
|
|
313
|
+
this.subscriptionStates.delete(channel);
|
|
314
|
+
}
|
|
315
|
+
})
|
|
316
|
+
.catch(() => undefined);
|
|
317
|
+
throw error;
|
|
318
|
+
});
|
|
319
|
+
try {
|
|
320
|
+
await currentState.teardown;
|
|
321
|
+
if (this.subscriptionStates.get(channel) === currentState) {
|
|
322
|
+
this.subscriptionStates.delete(channel);
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
catch (error) {
|
|
326
|
+
throw this.unavailable('Redis unsubscribe failed.', error);
|
|
327
|
+
}
|
|
328
|
+
}
|
|
329
|
+
};
|
|
330
|
+
}
|
|
331
|
+
async getCache(key) {
|
|
332
|
+
this.requireReady();
|
|
333
|
+
try {
|
|
334
|
+
const value = await this.withTimeout(this.command.get(this.redisKey('cache', assertCoordinationName(key, 'Cache key'))), this.connectTimeoutMs, 'Redis cache read timed out.');
|
|
335
|
+
return value === null ? null : this.parse(value);
|
|
336
|
+
}
|
|
337
|
+
catch (error) {
|
|
338
|
+
if (error instanceof CoordinationUnavailableError)
|
|
339
|
+
throw error;
|
|
340
|
+
throw this.unavailable('Redis cache read failed.', error);
|
|
341
|
+
}
|
|
342
|
+
}
|
|
343
|
+
async setCache(key, value, ttlMs) {
|
|
344
|
+
this.requireReady();
|
|
345
|
+
try {
|
|
346
|
+
await this.withTimeout(this.command.set(this.redisKey('cache', assertCoordinationName(key, 'Cache key')), this.serialize(value), { PX: assertTtl(ttlMs) }), this.connectTimeoutMs, 'Redis cache write timed out.');
|
|
347
|
+
}
|
|
348
|
+
catch (error) {
|
|
349
|
+
throw this.unavailable('Redis cache write failed.', error);
|
|
350
|
+
}
|
|
351
|
+
}
|
|
352
|
+
async consumeCache(key) {
|
|
353
|
+
this.requireReady();
|
|
354
|
+
try {
|
|
355
|
+
const value = await this.withTimeout(this.command.eval(CONSUME_CACHE_SCRIPT, {
|
|
356
|
+
keys: [
|
|
357
|
+
this.redisKey('cache', assertCoordinationName(key, 'Cache key')),
|
|
358
|
+
],
|
|
359
|
+
arguments: [],
|
|
360
|
+
}), this.connectTimeoutMs, 'Redis cache consume timed out.');
|
|
361
|
+
if (value === null)
|
|
362
|
+
return null;
|
|
363
|
+
if (typeof value !== 'string') {
|
|
364
|
+
throw new Error('Redis returned an invalid consumed cache value.');
|
|
365
|
+
}
|
|
366
|
+
return this.parse(value);
|
|
367
|
+
}
|
|
368
|
+
catch (error) {
|
|
369
|
+
if (error instanceof CoordinationUnavailableError)
|
|
370
|
+
throw error;
|
|
371
|
+
throw this.unavailable('Redis cache consume failed.', error);
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
async deleteCache(key) {
|
|
375
|
+
this.requireReady();
|
|
376
|
+
try {
|
|
377
|
+
await this.withTimeout(this.command.del(this.redisKey('cache', assertCoordinationName(key, 'Cache key'))), this.connectTimeoutMs, 'Redis cache delete timed out.');
|
|
378
|
+
}
|
|
379
|
+
catch (error) {
|
|
380
|
+
throw this.unavailable('Redis cache delete failed.', error);
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
async acquireLease(key, ttlMs) {
|
|
384
|
+
this.requireReady();
|
|
385
|
+
const normalizedKey = assertCoordinationName(key, 'Lease key');
|
|
386
|
+
const ttl = assertTtl(ttlMs);
|
|
387
|
+
const ownerToken = randomBytes(24).toString('base64url');
|
|
388
|
+
const leaseKey = this.redisKey('lease', normalizedKey);
|
|
389
|
+
const fenceKey = this.redisKey('fence', normalizedKey);
|
|
390
|
+
try {
|
|
391
|
+
let abandoned = false;
|
|
392
|
+
const pendingAcquire = this.command.eval(ACQUIRE_LEASE_SCRIPT, {
|
|
393
|
+
keys: [leaseKey, fenceKey],
|
|
394
|
+
arguments: [String(ttl), ownerToken],
|
|
395
|
+
});
|
|
396
|
+
void pendingAcquire
|
|
397
|
+
.then(value => {
|
|
398
|
+
const fencingToken = Number(value);
|
|
399
|
+
if (!abandoned ||
|
|
400
|
+
!Number.isSafeInteger(fencingToken) ||
|
|
401
|
+
fencingToken <= 0) {
|
|
402
|
+
return;
|
|
403
|
+
}
|
|
404
|
+
void this.withTimeout(this.command.eval(RELEASE_LEASE_SCRIPT, {
|
|
405
|
+
keys: [leaseKey],
|
|
406
|
+
arguments: [`${ownerToken}:${fencingToken}`],
|
|
407
|
+
}), this.connectTimeoutMs, 'Redis late lease cleanup timed out.').catch(() => undefined);
|
|
408
|
+
})
|
|
409
|
+
.catch(() => undefined);
|
|
410
|
+
let acquired;
|
|
411
|
+
try {
|
|
412
|
+
acquired = await this.withTimeout(pendingAcquire, this.connectTimeoutMs, 'Redis lease acquisition timed out.');
|
|
413
|
+
}
|
|
414
|
+
catch (error) {
|
|
415
|
+
abandoned = true;
|
|
416
|
+
throw error;
|
|
417
|
+
}
|
|
418
|
+
const result = Number(acquired);
|
|
419
|
+
if (!Number.isSafeInteger(result) || result <= 0)
|
|
420
|
+
return null;
|
|
421
|
+
const storedValue = `${ownerToken}:${result}`;
|
|
422
|
+
const lease = {
|
|
423
|
+
key: normalizedKey,
|
|
424
|
+
ownerToken,
|
|
425
|
+
fencingToken: result,
|
|
426
|
+
expiresAt: this.now() + ttl,
|
|
427
|
+
extend: async (nextTtl) => {
|
|
428
|
+
const next = assertTtl(nextTtl);
|
|
429
|
+
try {
|
|
430
|
+
const extended = Number(await this.withTimeout(this.command.eval(EXTEND_LEASE_SCRIPT, {
|
|
431
|
+
keys: [leaseKey],
|
|
432
|
+
arguments: [storedValue, String(next)],
|
|
433
|
+
}), this.connectTimeoutMs, 'Redis lease renewal timed out.'));
|
|
434
|
+
if (extended === 1)
|
|
435
|
+
lease.expiresAt = this.now() + next;
|
|
436
|
+
return extended === 1;
|
|
437
|
+
}
|
|
438
|
+
catch (error) {
|
|
439
|
+
throw this.unavailable('Redis lease renewal failed.', error);
|
|
440
|
+
}
|
|
441
|
+
},
|
|
442
|
+
release: async () => {
|
|
443
|
+
try {
|
|
444
|
+
return (Number(await this.withTimeout(this.command.eval(RELEASE_LEASE_SCRIPT, {
|
|
445
|
+
keys: [leaseKey],
|
|
446
|
+
arguments: [storedValue],
|
|
447
|
+
}), this.connectTimeoutMs, 'Redis lease release timed out.')) === 1);
|
|
448
|
+
}
|
|
449
|
+
catch (error) {
|
|
450
|
+
throw this.unavailable('Redis lease release failed.', error);
|
|
451
|
+
}
|
|
452
|
+
},
|
|
453
|
+
};
|
|
454
|
+
return lease;
|
|
455
|
+
}
|
|
456
|
+
catch (error) {
|
|
457
|
+
throw this.unavailable('Redis lease operation failed.', error);
|
|
458
|
+
}
|
|
459
|
+
}
|
|
460
|
+
async consumeRateLimit(key, limit, windowMs) {
|
|
461
|
+
this.requireReady();
|
|
462
|
+
if (!Number.isSafeInteger(limit) || limit < 1) {
|
|
463
|
+
throw new Error('Rate-limit capacity must be a positive integer.');
|
|
464
|
+
}
|
|
465
|
+
const window = assertTtl(windowMs);
|
|
466
|
+
try {
|
|
467
|
+
const result = (await this.withTimeout(this.command.eval(RATE_LIMIT_SCRIPT, {
|
|
468
|
+
keys: [
|
|
469
|
+
this.redisKey('rate', assertCoordinationName(key, 'Rate-limit key')),
|
|
470
|
+
this.redisKey('rate-window', assertCoordinationName(key, 'Rate-limit key')),
|
|
471
|
+
],
|
|
472
|
+
arguments: [String(window), randomUUID()],
|
|
473
|
+
}), this.connectTimeoutMs, 'Redis rate-limit operation timed out.'));
|
|
474
|
+
const count = Number(result[0]);
|
|
475
|
+
const remainingTtl = Math.max(0, Number(result[1]));
|
|
476
|
+
return {
|
|
477
|
+
allowed: count <= limit,
|
|
478
|
+
remaining: Math.max(0, limit - count),
|
|
479
|
+
resetAt: this.now() + remainingTtl,
|
|
480
|
+
windowToken: result[2],
|
|
481
|
+
};
|
|
482
|
+
}
|
|
483
|
+
catch (error) {
|
|
484
|
+
throw this.unavailable('Redis rate-limit operation failed.', error);
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
async refundRateLimit(key, windowToken) {
|
|
488
|
+
this.requireReady();
|
|
489
|
+
try {
|
|
490
|
+
const normalizedKey = assertCoordinationName(key, 'Rate-limit key');
|
|
491
|
+
const normalizedWindowToken = assertCoordinationName(windowToken, 'Rate-limit window token');
|
|
492
|
+
return (Number(await this.withTimeout(this.command.eval(REFUND_RATE_LIMIT_SCRIPT, {
|
|
493
|
+
keys: [
|
|
494
|
+
this.redisKey('rate', normalizedKey),
|
|
495
|
+
this.redisKey('rate-window', normalizedKey),
|
|
496
|
+
],
|
|
497
|
+
arguments: [normalizedWindowToken],
|
|
498
|
+
}), this.connectTimeoutMs, 'Redis rate-limit refund timed out.')) === 1);
|
|
499
|
+
}
|
|
500
|
+
catch (error) {
|
|
501
|
+
throw this.unavailable('Redis rate-limit refund failed.', error);
|
|
502
|
+
}
|
|
503
|
+
}
|
|
504
|
+
async acquireSemaphore(key, capacity, ttlMs) {
|
|
505
|
+
this.requireReady();
|
|
506
|
+
const normalizedKey = assertCoordinationName(key, 'Semaphore key');
|
|
507
|
+
if (!Number.isSafeInteger(capacity) || capacity < 1 || capacity > 10000) {
|
|
508
|
+
throw new Error('Semaphore capacity must be an integer from 1 to 10000.');
|
|
509
|
+
}
|
|
510
|
+
const ttl = assertTtl(ttlMs);
|
|
511
|
+
const ownerToken = randomBytes(24).toString('base64url');
|
|
512
|
+
const semaphoreKey = this.redisKey('semaphore', normalizedKey);
|
|
513
|
+
try {
|
|
514
|
+
let abandoned = false;
|
|
515
|
+
const pendingAcquire = this.command.eval(ACQUIRE_SEMAPHORE_SCRIPT, {
|
|
516
|
+
keys: [semaphoreKey],
|
|
517
|
+
arguments: [String(ttl), String(capacity), ownerToken],
|
|
518
|
+
});
|
|
519
|
+
void pendingAcquire
|
|
520
|
+
.then(value => {
|
|
521
|
+
const late = value;
|
|
522
|
+
if (!abandoned || Number(late[0]) !== 1)
|
|
523
|
+
return;
|
|
524
|
+
void this.withTimeout(this.command.zRem(semaphoreKey, ownerToken), this.connectTimeoutMs, 'Redis late semaphore cleanup timed out.').catch(() => undefined);
|
|
525
|
+
})
|
|
526
|
+
.catch(() => undefined);
|
|
527
|
+
let acquired;
|
|
528
|
+
try {
|
|
529
|
+
acquired = await this.withTimeout(pendingAcquire, this.connectTimeoutMs, 'Redis semaphore acquisition timed out.');
|
|
530
|
+
}
|
|
531
|
+
catch (error) {
|
|
532
|
+
abandoned = true;
|
|
533
|
+
throw error;
|
|
534
|
+
}
|
|
535
|
+
const result = acquired;
|
|
536
|
+
if (Number(result[0]) !== 1)
|
|
537
|
+
return null;
|
|
538
|
+
const expiresAt = Number(result[1]);
|
|
539
|
+
const permit = {
|
|
540
|
+
key: normalizedKey,
|
|
541
|
+
ownerToken,
|
|
542
|
+
expiresAt,
|
|
543
|
+
extend: async (nextTtl) => {
|
|
544
|
+
const next = assertTtl(nextTtl);
|
|
545
|
+
const nextExpiry = Number(await this.withTimeout(this.command.eval(EXTEND_SEMAPHORE_SCRIPT, {
|
|
546
|
+
keys: [semaphoreKey],
|
|
547
|
+
arguments: [ownerToken, String(next)],
|
|
548
|
+
}), this.connectTimeoutMs, 'Redis semaphore renewal timed out.'));
|
|
549
|
+
if (nextExpiry > 0)
|
|
550
|
+
permit.expiresAt = nextExpiry;
|
|
551
|
+
return nextExpiry > 0;
|
|
552
|
+
},
|
|
553
|
+
release: async () => (await this.withTimeout(this.command.zRem(semaphoreKey, ownerToken), this.connectTimeoutMs, 'Redis semaphore release timed out.')) === 1,
|
|
554
|
+
};
|
|
555
|
+
return permit;
|
|
556
|
+
}
|
|
557
|
+
catch (error) {
|
|
558
|
+
throw this.unavailable('Redis semaphore operation failed.', error);
|
|
559
|
+
}
|
|
560
|
+
}
|
|
561
|
+
async setPresence(scope, memberId, ttlMs) {
|
|
562
|
+
this.requireReady();
|
|
563
|
+
const key = this.redisKey('presence', assertCoordinationName(scope, 'Presence scope'));
|
|
564
|
+
const member = assertCoordinationName(memberId, 'Presence member ID');
|
|
565
|
+
try {
|
|
566
|
+
await this.withTimeout(this.command.eval(SET_PRESENCE_SCRIPT, {
|
|
567
|
+
keys: [key],
|
|
568
|
+
arguments: [String(assertTtl(ttlMs)), member],
|
|
569
|
+
}), this.connectTimeoutMs, 'Redis presence update timed out.');
|
|
570
|
+
}
|
|
571
|
+
catch (error) {
|
|
572
|
+
throw this.unavailable('Redis presence update failed.', error);
|
|
573
|
+
}
|
|
574
|
+
}
|
|
575
|
+
async listPresence(scope) {
|
|
576
|
+
this.requireReady();
|
|
577
|
+
const key = this.redisKey('presence', assertCoordinationName(scope, 'Presence scope'));
|
|
578
|
+
try {
|
|
579
|
+
const members = (await this.withTimeout(this.command.eval(LIST_PRESENCE_SCRIPT, {
|
|
580
|
+
keys: [key],
|
|
581
|
+
arguments: [],
|
|
582
|
+
}), this.connectTimeoutMs, 'Redis presence read timed out.'));
|
|
583
|
+
return members.sort();
|
|
584
|
+
}
|
|
585
|
+
catch (error) {
|
|
586
|
+
throw this.unavailable('Redis presence read failed.', error);
|
|
587
|
+
}
|
|
588
|
+
}
|
|
589
|
+
async clearPresence(scope, memberId) {
|
|
590
|
+
this.requireReady();
|
|
591
|
+
const key = this.redisKey('presence', assertCoordinationName(scope, 'Presence scope'));
|
|
592
|
+
try {
|
|
593
|
+
await this.withTimeout(this.command.zRem(key, assertCoordinationName(memberId, 'Presence member ID')), this.connectTimeoutMs, 'Redis presence removal timed out.');
|
|
594
|
+
}
|
|
595
|
+
catch (error) {
|
|
596
|
+
throw this.unavailable('Redis presence removal failed.', error);
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
async getRevocationEpoch(subject) {
|
|
600
|
+
this.requireReady();
|
|
601
|
+
try {
|
|
602
|
+
const value = await this.withTimeout(this.command.get(this.redisKey('revocation', assertCoordinationName(subject, 'Revocation subject'))), this.connectTimeoutMs, 'Redis revocation read timed out.');
|
|
603
|
+
const epoch = value === null ? 0 : Number(value);
|
|
604
|
+
if (!Number.isSafeInteger(epoch) || epoch < 0) {
|
|
605
|
+
throw new Error('Invalid revocation epoch.');
|
|
606
|
+
}
|
|
607
|
+
return epoch;
|
|
608
|
+
}
|
|
609
|
+
catch (error) {
|
|
610
|
+
throw this.unavailable('Redis revocation read failed.', error);
|
|
611
|
+
}
|
|
612
|
+
}
|
|
613
|
+
async revoke(subject) {
|
|
614
|
+
this.requireReady();
|
|
615
|
+
const normalized = assertCoordinationName(subject, 'Revocation subject');
|
|
616
|
+
const topic = 'security.revoked';
|
|
617
|
+
try {
|
|
618
|
+
const epoch = Number(await this.withTimeout(this.command.eval(REVOKE_SCRIPT, {
|
|
619
|
+
keys: [
|
|
620
|
+
this.redisKey('revocation', normalized),
|
|
621
|
+
this.redisKey('event', topic),
|
|
622
|
+
],
|
|
623
|
+
arguments: [
|
|
624
|
+
randomUUID(),
|
|
625
|
+
topic,
|
|
626
|
+
new Date(this.now()).toISOString(),
|
|
627
|
+
normalized,
|
|
628
|
+
],
|
|
629
|
+
}), this.connectTimeoutMs, 'Redis revocation update timed out.'));
|
|
630
|
+
if (!Number.isSafeInteger(epoch) || epoch < 1) {
|
|
631
|
+
throw new Error('Invalid revocation epoch.');
|
|
632
|
+
}
|
|
633
|
+
return epoch;
|
|
634
|
+
}
|
|
635
|
+
catch (error) {
|
|
636
|
+
throw this.unavailable('Redis revocation update failed.', error);
|
|
637
|
+
}
|
|
638
|
+
}
|
|
639
|
+
createClients(url) {
|
|
640
|
+
const command = createClient({ url });
|
|
641
|
+
return {
|
|
642
|
+
command: command,
|
|
643
|
+
subscriber: command.duplicate(),
|
|
644
|
+
};
|
|
645
|
+
}
|
|
646
|
+
async closeClient(client) {
|
|
647
|
+
if (!client.isReady) {
|
|
648
|
+
client.destroy();
|
|
649
|
+
return;
|
|
650
|
+
}
|
|
651
|
+
try {
|
|
652
|
+
await this.withTimeout(client.close(), this.connectTimeoutMs, 'Redis client close timed out.');
|
|
653
|
+
}
|
|
654
|
+
catch {
|
|
655
|
+
client.destroy();
|
|
656
|
+
}
|
|
657
|
+
}
|
|
658
|
+
async dispatchSubscriptionMessage(channel, expectedTopic, message) {
|
|
659
|
+
try {
|
|
660
|
+
const event = this.parse(message);
|
|
661
|
+
if (!event ||
|
|
662
|
+
typeof event !== 'object' ||
|
|
663
|
+
typeof event.id !== 'string' ||
|
|
664
|
+
event.id.length < 1 ||
|
|
665
|
+
event.id.length > 128 ||
|
|
666
|
+
event.topic !== expectedTopic ||
|
|
667
|
+
typeof event.emittedAt !== 'string' ||
|
|
668
|
+
!Number.isFinite(Date.parse(event.emittedAt)) ||
|
|
669
|
+
!Object.prototype.hasOwnProperty.call(event, 'payload')) {
|
|
670
|
+
throw new Error('Invalid coordination event envelope.');
|
|
671
|
+
}
|
|
672
|
+
const outcomes = await Promise.allSettled([...(this.handlers.get(channel) || [])].map(callback => callback(event)));
|
|
673
|
+
if (outcomes.some(outcome => outcome.status === 'rejected')) {
|
|
674
|
+
throw new Error('A coordination event handler failed.');
|
|
675
|
+
}
|
|
676
|
+
}
|
|
677
|
+
catch {
|
|
678
|
+
// Preserve only a redacted diagnostic. Never retain payloads, handler
|
|
679
|
+
// errors, Redis URLs, or credentials in coordinator health state.
|
|
680
|
+
this.lastError = new Error('Redis subscription event processing failed.');
|
|
681
|
+
}
|
|
682
|
+
}
|
|
683
|
+
redisKey(kind, input) {
|
|
684
|
+
const digest = createHash('sha256').update(input).digest('base64url');
|
|
685
|
+
return `${this.prefix}:${kind}:${digest}`;
|
|
686
|
+
}
|
|
687
|
+
serialize(value) {
|
|
688
|
+
const serialized = JSON.stringify(value);
|
|
689
|
+
if (Buffer.byteLength(serialized, 'utf8') > MAX_COORDINATION_PAYLOAD_BYTES) {
|
|
690
|
+
throw new Error('Coordination payload exceeds 256 KiB.');
|
|
691
|
+
}
|
|
692
|
+
return serialized;
|
|
693
|
+
}
|
|
694
|
+
parse(value) {
|
|
695
|
+
if (Buffer.byteLength(value, 'utf8') > MAX_COORDINATION_PAYLOAD_BYTES) {
|
|
696
|
+
throw new Error('Coordination payload exceeds 256 KiB.');
|
|
697
|
+
}
|
|
698
|
+
return JSON.parse(value);
|
|
699
|
+
}
|
|
700
|
+
requireReady() {
|
|
701
|
+
if (this.closing || !this.command.isReady || !this.subscriber.isReady) {
|
|
702
|
+
throw this.unavailable('Redis coordination is not ready.', this.lastError);
|
|
703
|
+
}
|
|
704
|
+
}
|
|
705
|
+
unavailable(message, cause) {
|
|
706
|
+
const error = cause instanceof Error ? cause : new Error(String(cause || message));
|
|
707
|
+
this.lastError = error;
|
|
708
|
+
return new CoordinationUnavailableError(message, error);
|
|
709
|
+
}
|
|
710
|
+
async withTimeout(promise, timeoutMs, message) {
|
|
711
|
+
let timer;
|
|
712
|
+
try {
|
|
713
|
+
return await Promise.race([
|
|
714
|
+
promise,
|
|
715
|
+
new Promise((_, reject) => {
|
|
716
|
+
timer = setTimeout(() => reject(new Error(message)), timeoutMs);
|
|
717
|
+
}),
|
|
718
|
+
]);
|
|
719
|
+
}
|
|
720
|
+
finally {
|
|
721
|
+
if (timer)
|
|
722
|
+
clearTimeout(timer);
|
|
723
|
+
}
|
|
724
|
+
}
|
|
725
|
+
}
|
|
726
|
+
//# sourceMappingURL=redisCoordinator.js.map
|