libre-webui 0.21.2 → 0.22.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +612 -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 +81 -0
- package/backend/dist/platform/storage/storageFactory.d.ts.map +1 -0
- package/backend/dist/platform/storage/storageFactory.js +518 -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 +136 -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 +117 -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 +97 -34
- 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 +799 -274
- 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 +15 -4
- 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 +9 -2
- 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-CUhEG7E2.js +33 -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 +36 -18
- package/frontend/dist/js/{ArtifactContainer-C_UdeK4k.js → ArtifactContainer-BTEDhBnv.js} +1 -1
- package/frontend/dist/js/{ArtifactDemoPage-D3AuvuR5.js → ArtifactDemoPage-B0gN3YTl.js} +1 -1
- package/frontend/dist/js/{ArtifactSandboxFrame-BiXl9iGD.js → ArtifactSandboxFrame-CLBXQkZs.js} +3 -3
- package/frontend/dist/js/{ArtifactSlideOutPanel-CvgS3sfQ.js → ArtifactSlideOutPanel-CfqHPFdE.js} +1 -1
- package/frontend/dist/js/{Button-DcBM7gdH.js → Button-BV44cTnj.js} +1 -1
- package/frontend/dist/js/ChatPage-DIkAXZWA.js +23 -0
- package/frontend/dist/js/{FirstTimeSetup-B9742i3H.js → FirstTimeSetup-B8phXGNA.js} +1 -1
- package/frontend/dist/js/GalleryPage-W4uI043I.js +1 -0
- package/frontend/dist/js/HomePage-DlxehbyO.js +1 -0
- package/frontend/dist/js/{LibreClawPage-Ds6pqEyk.js → LibreClawPage-CgD0_G_F.js} +1 -1
- package/frontend/dist/js/{ModelManagerModals-BBNg2fxs.js → ModelManagerModals-D7jIT3v1.js} +1 -1
- package/frontend/dist/js/{ModelSelector-CJfJYwxh.js → ModelSelector-BYxJU1UV.js} +1 -1
- package/frontend/dist/js/ModelsPage-C4XdCKP5.js +2 -0
- package/frontend/dist/js/NotesPage-CDECOl4V.js +1 -0
- package/frontend/dist/js/{OptimizedSyntaxHighlighter-CWYUn9Oe.js → OptimizedSyntaxHighlighter-XwqZEoTf.js} +1 -1
- package/frontend/dist/js/{PersonasPage-CbQVv9OM.js → PersonasPage-CjSLPrgS.js} +2 -2
- package/frontend/dist/js/PluginUsagePage-DJOXJuH4.js +1 -0
- package/frontend/dist/js/RichMessageContent-Debeh6bi.js +3 -0
- package/frontend/dist/js/SettingsModal-cUqAeYUP.js +1 -0
- package/frontend/dist/js/{SettingsToggle-Uz2jvV64.js → SettingsToggle-WTa0rgvY.js} +1 -1
- package/frontend/dist/js/{SystemPage-CIBDZTWB.js → SystemPage-DxPw0GS7.js} +1 -1
- package/frontend/dist/js/UserManagementPage-CEdYFe_Z.js +1 -0
- package/frontend/dist/js/WorkPage-DDVeuG_9.js +6 -0
- package/frontend/dist/js/api-IzobHGND.js +14 -0
- package/frontend/dist/js/appStore-DKwC2vgn.js +2 -0
- package/frontend/dist/js/ar-xTSvTq05.js +2 -0
- package/frontend/dist/js/authStore-OaTuapL7.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-DXGUVLXD.js +3 -0
- package/frontend/dist/js/{config-CV8L89A5.js → config-DPEEuTAe.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-Lx6fK8Ug.js → estree-ChwJsD2w.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-Dx5reqmV.js → html-DFrVjciF.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-Bd5G8zQB.js → markdown-FLLx7b67.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-CUWSpffv.js → messageCodeStyles-CBkkZY4n.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-DLNXiOUi.js → standalone-i8-5bg5p.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-YKxslwSt.js → typescript-CQ3x-Uni.js} +1 -1
- package/frontend/dist/js/{ui-Dw6jDKxN.js → ui-BHhR3Vok.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-t1quV8ce.js → useTranslation-C3ei3mJq.js} +1 -1
- package/frontend/dist/js/{utils-iKndEgla.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-LrQmhNxb.js → workApi-Czu69yWS.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-CN7wpzUO.js +0 -26
- package/frontend/dist/assets/index-Dqkx5o2y.css +0 -1
- package/frontend/dist/js/ChatPage-DBEi-FSO.js +0 -16
- package/frontend/dist/js/GalleryPage-BL0x_xl7.js +0 -1
- package/frontend/dist/js/HomePage-Ukn2Y-BG.js +0 -1
- package/frontend/dist/js/ModelsPage-CDPJM-LA.js +0 -2
- package/frontend/dist/js/NotesPage-DJ-_MSI1.js +0 -1
- package/frontend/dist/js/PluginUsagePage-D69rQvFl.js +0 -1
- package/frontend/dist/js/RichMessageContent-DfuCu6PB.js +0 -3
- package/frontend/dist/js/SettingsModal-D87lWSx4.js +0 -1
- package/frontend/dist/js/UserManagementPage-DzMnFKDG.js +0 -1
- package/frontend/dist/js/WorkPage-D84JNdjS.js +0 -6
- package/frontend/dist/js/api-DhmVEJr2.js +0 -14
- package/frontend/dist/js/appStore-BsqeY2tS.js +0 -2
- package/frontend/dist/js/ar-BgCHB9_9.js +0 -2
- package/frontend/dist/js/authStore-DanfaPdm.js +0 -4
- package/frontend/dist/js/bn-Cr8_opuR.js +0 -2
- package/frontend/dist/js/chatStore-C25ywAXQ.js +0 -3
- package/frontend/dist/js/cs-Bb9gXpfH.js +0 -2
- package/frontend/dist/js/da-JfdGHjAw.js +0 -2
- package/frontend/dist/js/de-CczkCOVx.js +0 -2
- package/frontend/dist/js/es-n_0cjhn7.js +0 -2
- package/frontend/dist/js/fr-Pno128cn.js +0 -2
- package/frontend/dist/js/hi-DBCdcL4p.js +0 -2
- package/frontend/dist/js/id-85QDk-wA.js +0 -2
- package/frontend/dist/js/is-9MuKmBft.js +0 -2
- package/frontend/dist/js/it-C5mz9I3H.js +0 -2
- package/frontend/dist/js/ja-Cu90QTBd.js +0 -2
- package/frontend/dist/js/ko-CSdgcMgq.js +0 -2
- package/frontend/dist/js/markdown-core-DHnR5Hw8.js +0 -16
- package/frontend/dist/js/ms-IQMi6HBU.js +0 -2
- package/frontend/dist/js/nl-BwpdTgvn.js +0 -2
- package/frontend/dist/js/pl-zq8ctKrQ.js +0 -2
- package/frontend/dist/js/pt-BIQu7dBu.js +0 -2
- package/frontend/dist/js/ru-BT5-Z0F9.js +0 -2
- package/frontend/dist/js/sv-B1_q6-Uj.js +0 -2
- package/frontend/dist/js/th-BiLLwq0A.js +0 -2
- package/frontend/dist/js/tr-NZbkkeKs.js +0 -2
- package/frontend/dist/js/ui-vendor-xUzKqAXI.js +0 -177
- package/frontend/dist/js/uk-CGu1pg-F.js +0 -2
- package/frontend/dist/js/vi-ClvH5JZg.js +0 -2
- package/frontend/dist/js/zh-Jgjy3uAG.js +0 -2
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/babel-CmENXdZw.js","js/router-vendor-Ca9zqOqT.js","js/rolldown-runtime-hePW80VL.js","js/markdown-core-DHnR5Hw8.js","js/estree-Lx6fK8Ug.js","assets/index-CN7wpzUO.js","js/react-vendor-DPNXrO-8.js","js/useTranslation-t1quV8ce.js","js/utils-iKndEgla.js","js/utils-vendor-1zob7nK9.js","js/chatStore-C25ywAXQ.js","js/i18next-DgmgtwsV.js","js/ui-vendor-xUzKqAXI.js","js/logger-DSXjF4ye.js","js/api-DhmVEJr2.js","js/config-CV8L89A5.js","js/workApi-LrQmhNxb.js","js/authStore-DanfaPdm.js","js/appStore-BsqeY2tS.js","js/welcomePrompts-to5mv_gx.js","js/messageCodeStyles-CUWSpffv.js","js/Button-DcBM7gdH.js","js/ui-Dw6jDKxN.js","assets/index-Dqkx5o2y.css","js/typescript-YKxslwSt.js","js/postcss-B5WIGhAY.js","js/html-Dx5reqmV.js","js/markdown-Bd5G8zQB.js","js/yaml-QD4znPfZ.js","js/standalone-DLNXiOUi.js","js/OptimizedSyntaxHighlighter-CWYUn9Oe.js","js/syntax-highlight-Ca9bHsaz.js","assets/xterm-DHcfr8qj.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./rolldown-runtime-hePW80VL.js";import{d as t,f as n}from"./markdown-core-DHnR5Hw8.js";import{d as r,f as i,i as a,l as o,u as s}from"./router-vendor-Ca9zqOqT.js";import{t as c}from"./useTranslation-t1quV8ce.js";import{t as l}from"./utils-iKndEgla.js";import{_ as u,t as d}from"./chatStore-C25ywAXQ.js";import{B as f,C as p,Cn as m,En as h,F as g,Ht as _,L as v,Lt as y,N as b,Nt as x,P as S,Pt as C,R as w,T,Tt as E,V as ee,Vt as te,an as D,bn as O,bt as ne,c as k,en as A,et as re,fn as j,i as ie,jt as M,kt as N,lt as P,m as F,mn as ae,n as oe,on as I,rt as L,sn as se,tn as R,wt as ce,x as le,yn as ue}from"./ui-vendor-xUzKqAXI.js";import{t as de}from"./config-CV8L89A5.js";import{t as z}from"./workApi-LrQmhNxb.js";import{s as fe}from"./api-DhmVEJr2.js";import{a as pe,i as me,l as he,n as ge,o as _e,s as ve}from"./authStore-DanfaPdm.js";import{t as ye}from"./appStore-BsqeY2tS.js";import{t as B}from"./Button-DcBM7gdH.js";import{u as be}from"./ui-Dw6jDKxN.js";import{c as xe,l as Se}from"../assets/index-CN7wpzUO.js";import{t as Ce}from"./RichMessageContent-DfuCu6PB.js";import{t as V}from"./ModelSelector-CJfJYwxh.js";import{n as we,t as H}from"./work-DVgm81bJ.js";var U=e(n(),1),W=t(),G=e=>we({model:e.name,providerType:e.isPlugin?`plugin`:`ollama`,providerId:e.isPlugin?e.pluginId:void 0}),K=e=>{let t=e.name.split(`/`).filter(Boolean),n=t[t.length-1]||e.name;return t.length>1?n.replace(/[-_]+/g,` `):n},Te=e=>{let t=`${e.model} · `;return{name:e.model,model:e.model,size:0,digest:``,modified_at:``,details:{},isPlugin:e.providerType===`plugin`,pluginId:e.providerId,pluginName:e.providerType===`plugin`?e.label.startsWith(t)?e.label.slice(t.length):e.providerId:void 0}};function Ee({models:e,selectorModels:t,modelKey:n,running:r,loading:i,variant:a=`task`,disabled:o=!1,remoteDisclosureDismissed:s,remoteDisclosureSaving:u,onModelChange:d,onDismissRemoteDisclosure:f,onModelsRefresh:p,onSubmit:m,onCancel:h}){let{t:g}=c(),[_,v]=(0,U.useState)(``),y=(0,U.useRef)(null),x=(0,U.useRef)(null),S=(0,U.useRef)(null),C=e.find(e=>e.key===n),w=C?.remote===!0,T=a===`landing`,E=(0,U.useMemo)(()=>{let n=new Set(t.map(G)),r=e.filter(e=>!n.has(e.key)).map(Te);return[...t,...r]},[e,t]);(0,U.useEffect)(()=>{let e=y.current;e&&(e.style.height=`auto`,e.style.height=`${Math.min(e.scrollHeight,160)}px`)},[_]);let ee=async()=>{await f()&&([x.current,S.current].find(e=>e&&e.offsetParent!==null)||x.current)?.focus()},te=t=>{let n=e.find(e=>e.key===t)||e.find(e=>e.providerType===`ollama`&&e.model===t);n&&d(n.key)},D=async()=>{let e=_.trim();!e||i||r||o||!C||await m(e)&&v(``)};return(0,W.jsxs)(`div`,{"data-testid":T?`work-landing-composer`:`work-task-composer`,"data-variant":a,className:l(`relative shrink-0`,T?`mt-10 w-full`:`border-t border-line bg-surface/95 px-3 py-3 backdrop-blur md:px-5`),children:[w&&!s&&(0,W.jsx)(`div`,{className:l(`absolute inset-x-3 z-30 mx-auto max-w-3xl md:inset-x-5`,`bottom-full mb-3`),children:(0,W.jsxs)(`aside`,{"data-testid":`work-provider-disclosure-popover`,"aria-labelledby":`work-provider-disclosure-title`,"aria-live":`polite`,className:`relative rounded-2xl border border-warning-500/40 bg-surface-overlay p-3 pe-10 shadow-overlay backdrop-blur dark:border-warning-500/45`,children:[(0,W.jsx)(`button`,{type:`button`,onClick:()=>void ee(),disabled:u,className:`absolute end-2 top-2 inline-flex h-7 w-7 items-center justify-center rounded-lg text-ink-muted transition-colors hover:bg-warning-500/20 hover:text-ink focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-warning-500 disabled:cursor-wait disabled:opacity-50`,"aria-label":g(`work.composer.remoteDismissLabel`,{defaultValue:`Dismiss remote provider notice`}),children:(0,W.jsx)(oe,{className:`h-4 w-4`})}),(0,W.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,W.jsx)(`div`,{className:`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center rounded-xl bg-warning-500/20`,children:(0,W.jsx)(A,{"data-testid":`work-provider-disclosure-accent`,className:`h-4 w-4 text-warning-500`,"aria-hidden":`true`})}),(0,W.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,W.jsx)(`p`,{id:`work-provider-disclosure-title`,className:`text-sm font-semibold text-ink`,children:g(`work.composer.remoteTitle`,{defaultValue:`Remote provider`})}),(0,W.jsx)(`p`,{className:`mt-0.5 text-xs leading-relaxed text-ink-muted`,children:g(`work.composer.remoteHint`,{defaultValue:`Conversation and tool output are sent to the configured service. One autonomous run can make multiple provider calls and may incur charges. Workspace files stay local unless a tool returns their contents.`})}),(0,W.jsx)(`div`,{className:`mt-2.5 flex justify-end`,children:(0,W.jsx)(B,{"data-testid":`work-provider-disclosure-dismiss`,type:`button`,variant:`ghost`,size:`sm`,loading:u,className:`h-7 border-warning-500 bg-warning-500 px-2.5 text-xs text-[#3d120c] hover:bg-warning-500/90 hover:text-[#3d120c]`,onClick:()=>void ee(),children:g(`work.composer.remoteDismiss`,{defaultValue:`Dismiss`})})})]})]})]})}),(0,W.jsx)(`form`,{className:`mx-auto w-full max-w-3xl`,onSubmit:e=>{e.preventDefault(),D()},children:(0,W.jsxs)(`div`,{"data-testid":`work-composer-surface`,className:l(`flex items-end gap-2 rounded-[1.6rem] border p-2.5 transition-[border-color,box-shadow,background-color] duration-200 sm:p-3`,`border-black/[0.08] bg-surface/90 dark:border-white/[0.09] dark:bg-dark-200/90`,`shadow-[0_1px_2px_rgba(0,0,0,0.03),0_18px_50px_rgba(15,23,42,0.08)] backdrop-blur-xl`,`focus-within:border-primary-500/35 focus-within:shadow-[0_1px_2px_rgba(0,0,0,0.03),0_22px_65px_rgba(15,23,42,0.12)]`),children:[(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(`textarea`,{ref:y,"data-testid":`work-composer-input`,dir:`auto`,value:_,onChange:e=>v(e.target.value),onKeyDown:e=>{e.key===`Enter`&&!e.shiftKey&&(e.preventDefault(),D())},disabled:o||r,rows:1,className:`m-0 block max-h-[160px] min-h-10 w-full resize-none overflow-y-auto rounded-none border-0 bg-transparent p-2 text-base leading-relaxed text-ink shadow-none outline-none placeholder:text-ink-subtle focus:border-0 focus:bg-transparent focus:ring-0 disabled:cursor-not-allowed disabled:opacity-60`,placeholder:g(`work.composer.placeholder`,{defaultValue:`Describe what you want to build or change…`})})}),(0,W.jsx)(`div`,{className:`hidden shrink-0 sm:block`,children:(0,W.jsx)(V,{models:E,selectedModel:n,onModelChange:e=>te(e.target.value),onModelsRefresh:()=>void p(),getModelValue:G,getModelLabel:K,getModelTitle:e=>e.name,triggerRef:x,triggerTestId:`work-model-selector-trigger`,selectTestId:`work-model-select`,ariaLabel:g(`work.composer.model`,{defaultValue:`Work model`}),disabled:r||e.length===0,className:`min-w-[150px] max-w-[230px]`,compact:!0})}),r?(0,W.jsx)(B,{"data-testid":`work-cancel-button`,type:`button`,variant:`ghost`,size:`sm`,disabled:i,className:`flex h-9 w-9 shrink-0 touch-manipulation items-center justify-center rounded-full bg-error-500/15 p-0 text-error-600 transition-colors duration-150 hover:bg-error-500/25 dark:text-error-400 sm:h-10 sm:w-10`,title:g(`work.composer.cancel`,{defaultValue:`Stop`}),"aria-label":g(`work.composer.cancel`,{defaultValue:`Stop`}),onClick:()=>void h(),children:i?(0,W.jsx)(P,{className:`h-4 w-4 animate-spin`}):(0,W.jsx)(le,{className:`h-4 w-4 fill-current`})}):(0,W.jsx)(B,{"data-testid":`work-submit-button`,type:`submit`,variant:`ghost`,size:`sm`,disabled:i||o||!_.trim()||!C,className:l(`flex h-9 w-9 shrink-0 touch-manipulation items-center justify-center rounded-full p-0 transition-colors duration-150 sm:h-10 sm:w-10`,`bg-gray-950 text-white hover:bg-gray-800 dark:bg-white dark:text-gray-950 dark:hover:bg-gray-100`,`disabled:bg-gray-100 disabled:text-gray-400 disabled:hover:bg-gray-100 dark:disabled:bg-dark-300 dark:disabled:text-dark-500 dark:disabled:hover:bg-dark-300`,_.trim()&&C&&!o&&`shadow-sm`),title:g(`work.composer.send`,{defaultValue:`Run`}),"aria-label":g(`work.composer.send`,{defaultValue:`Run`}),children:i?(0,W.jsx)(P,{className:`h-4 w-4 animate-spin`}):(0,W.jsx)(b,{className:`h-4 w-4`})})]})}),(0,W.jsx)(`div`,{className:`mx-auto mt-3 w-full max-w-3xl sm:hidden`,children:(0,W.jsx)(V,{models:E,selectedModel:n,onModelChange:e=>te(e.target.value),onModelsRefresh:()=>void p(),getModelValue:G,getModelLabel:K,getModelTitle:e=>e.name,triggerRef:S,triggerTestId:`work-model-selector-trigger-mobile`,selectTestId:`work-model-select-mobile`,ariaLabel:g(`work.composer.model`,{defaultValue:`Work model`}),disabled:r||e.length===0,className:`w-full`,compact:!0})})]})}var De=e=>{if(e==null||e===``)return null;if(typeof e==`string`)return e;try{return JSON.stringify(e,null,2)}catch{return String(e)}},Oe=e=>{if(e<1e3)return`${Math.max(0,Math.round(e))}ms`;let t=Math.max(0,Math.round(e/1e3)),n=Math.floor(t/60),r=t%60;return n>0?`${n}:${String(r).padStart(2,`0`)}`:`${r}s`},ke=e=>{if(!e)return 0;let t=Array.from(e).length,n=e.trim()?e.trim().split(/\s+/u).length:0;return Math.max(n,Math.ceil(t/4))};function q({run:e}){let[t,n]=(0,U.useState)();if((0,U.useEffect)(()=>{if(e.terminal||!e.startedAt)return;let t=window.setInterval(()=>n(Date.now()),1e3);return()=>window.clearInterval(t)},[e.startedAt,e.terminal]),!e.startedAt)return null;let r=e.finishedAt||t;return r?(0,W.jsx)(`span`,{dir:`ltr`,className:`tabular-nums text-ink-subtle`,"aria-hidden":`true`,children:Oe(r-e.startedAt)}):null}function J({tool:e,expandedByDefault:t}){let{t:n}=c(),[r]=(0,U.useState)(e.status),[i,a]=(0,U.useState)(null),o=(0,U.useMemo)(()=>De(e.arguments),[e.arguments]),s=e.output||null,u=!!(o||s),d=e.status===`error`,f=e.status===`running`,p=(0,U.useId)(),m=d?n(`work.activity.kinds.error`,{defaultValue:`Error`}):f?n(`work.activity.kinds.toolCall`,{defaultValue:`Tool call`}):n(`work.activity.kinds.toolResult`,{defaultValue:`Tool result`}),h=i??(e.status===r?t:e.status===`error`);return(0,W.jsxs)(`div`,{"data-testid":`work-live-tool`,"data-tool-id":e.id,className:l(`overflow-hidden rounded-xl border bg-surface-raised transition-colors`,d?`border-error-500/30`:`border-line`),children:[(0,W.jsxs)(`button`,{type:`button`,disabled:!u,onClick:()=>{a(!h)},"aria-expanded":u?h:void 0,"aria-controls":u?p:void 0,"aria-label":`${m}: ${e.name}`,className:`flex min-h-10 w-full items-center gap-2 px-3 py-2 text-start outline-none hover:bg-surface-subtle focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#ff7b52] disabled:cursor-default disabled:hover:bg-transparent`,children:[(0,W.jsx)(`span`,{className:`flex h-5 w-5 shrink-0 items-center justify-center`,children:d?(0,W.jsx)(A,{className:`h-3.5 w-3.5 text-error-500`}):f?(0,W.jsx)(P,{className:`h-3.5 w-3.5 animate-spin text-[rgb(48,121,255)] motion-reduce:animate-none`}):(0,W.jsx)(se,{className:`h-3.5 w-3.5 text-[rgb(76,212,117)]`})}),(0,W.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-xs text-ink`,children:e.name}),e.durationMs!==void 0&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] tabular-nums text-ink-subtle`,children:Oe(e.durationMs)}),u&&(0,W.jsx)(I,{"aria-hidden":`true`,className:l(`h-3.5 w-3.5 shrink-0 text-ink-subtle transition-transform`,h&&`rotate-180`)})]}),u&&h&&(0,W.jsxs)(`div`,{id:p,className:`border-t border-line bg-surface-subtle/50`,children:[o&&(0,W.jsx)(`pre`,{dir:`ltr`,className:`max-h-48 overflow-auto whitespace-pre-wrap break-words px-3 py-2.5 text-left font-mono text-[11px] leading-relaxed text-ink-muted`,children:o}),s&&(0,W.jsx)(`pre`,{dir:`ltr`,className:l(`max-h-64 overflow-auto whitespace-pre-wrap break-words border-t border-line px-3 py-2.5 text-left font-mono text-[11px] leading-relaxed`,d?`text-error-600`:`text-ink-muted`),children:s})]})]})}var Ae=e=>{let t=e.split(`
|
|
3
|
-
`);for(let e=t.length-1;e>=0;--e){let n=t[e].trim();if(n)return n}return``};function je({content:e,streaming:t}){let{t:n}=c(),[r,i]=(0,U.useState)(!1),a=t&&!r?Ae(e):``;return(0,W.jsxs)(`details`,{"data-testid":`work-live-reasoning`,open:r,onToggle:e=>i(e.currentTarget.open),className:`group overflow-hidden rounded-xl border border-line bg-surface-subtle/70`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none flex-col gap-1 px-3 py-2 marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,W.jsxs)(`span`,{className:`flex items-center justify-between gap-3 text-xs font-medium text-ink-muted`,children:[(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(j,{className:l(`h-3.5 w-3.5 shrink-0 text-[rgb(48,121,255)]`,t&&`animate-pulse-subtle motion-reduce:animate-none`)}),t?(0,W.jsxs)(`span`,{className:`animate-shimmer truncate bg-gradient-to-r from-ink-subtle via-ink to-ink-subtle bg-[length:200%_100%] bg-clip-text text-transparent motion-reduce:animate-none motion-reduce:bg-none motion-reduce:text-ink-muted`,children:[n(`work.statusLabels.thinking`,{defaultValue:`Thinking`}),`…`]}):(0,W.jsx)(`span`,{className:`truncate`,children:n(`libreClaw.metrics.reasoning`,{defaultValue:`Reasoning`})})]}),(0,W.jsx)(I,{className:`h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180`})]}),a&&(0,W.jsx)(`span`,{dir:`auto`,"data-testid":`work-live-reasoning-preview`,className:`block truncate text-[11px] leading-relaxed text-ink-subtle`,children:a})]}),(0,W.jsx)(`div`,{className:`border-t border-line px-3 py-2.5`,children:(0,W.jsx)(be,{content:e,isStreaming:t,className:`text-xs text-ink-muted`})})]})}var Me=(e,t,n)=>e===`queued`||e===`preparing`?t(`work.status.preparing`,{defaultValue:`Preparing isolated workspace…`}):e===`using_tool`?n?.name?`${t(`work.activity.toolActivity`,{defaultValue:`Tool activity`})} · ${n.name}`:t(`work.activity.toolActivity`,{defaultValue:`Tool activity`}):e===`completed`?t(`work.statusLabels.complete`,{defaultValue:`Complete`}):e===`needs_input`?t(`work.statusLabels.needsInput`,{defaultValue:`Needs input`}):e===`failed`?t(`work.statusLabels.error`,{defaultValue:`Error`}):e===`cancelled`?t(`work.statusLabels.needsInput`,{defaultValue:`Needs input`}):e===`responding`?t(`work.status.running`,{defaultValue:`Working in the local workspace…`}):t(`work.statusLabels.thinking`,{defaultValue:`Thinking`}),Ne=(e,t)=>{if(e===`connecting`)return t(`work.live.connecting`,{defaultValue:`Connecting to live updates…`});if(e===`reconnecting`)return t(`work.live.reconnecting`,{defaultValue:`Reconnecting to live updates…`});if(e===`error`)return t(`work.live.unavailable`,{defaultValue:`Live updates unavailable`})};function Pe({run:e,variant:t=`conversation`}){let{t:n}=c(),r=[...e.tools].reverse().find(e=>e.status===`running`),i=Ne(e.connection,n)||Me(e.phase,n,r),a=!e.terminal,o=e.usage?.outputTokens,s=e.reasoning+e.response,u=o!==void 0&&o>0?o:s?ke(s):o,d=(o===void 0||o===0)&&!!s&&u!==void 0,f=e.usage?.tokensPerSecond;return(0,W.jsxs)(`section`,{"data-testid":`work-live-run`,"data-run-id":e.runId,"data-phase":e.phase,"aria-busy":a||void 0,className:l(`min-w-0`,t===`activity`&&`rounded-2xl border border-line bg-surface p-3 shadow-subtle`),children:[(0,W.jsxs)(`div`,{className:`mb-3 flex min-h-6 items-center gap-2 text-xs`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:l(`h-2 w-2 shrink-0 rounded-full`,e.phase===`failed`?`bg-[rgb(255,61,129)]`:e.phase===`completed`?`bg-[rgb(76,212,117)]`:e.phase===`needs_input`||e.phase===`cancelled`?`bg-[rgb(255,204,0)]`:e.connection===`error`?`bg-[rgb(255,61,129)]`:`bg-[rgb(48,121,255)]`,a&&`animate-pulse motion-reduce:animate-none`)}),(0,W.jsx)(`span`,{dir:`auto`,title:e.connectionError,className:`min-w-0 flex-1 truncate font-medium text-ink-muted`,children:i}),e.round!==void 0&&(0,W.jsx)(`span`,{dir:`ltr`,className:`shrink-0 tabular-nums text-ink-subtle`,children:e.roundLimit===void 0?`#${e.round}`:`${e.round}/${e.roundLimit}`}),(0,W.jsx)(q,{run:e})]}),t===`conversation`&&(0,W.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,"aria-atomic":`true`,children:i}),e.skills.length>0&&(0,W.jsx)(`div`,{className:`mb-3 flex flex-wrap gap-1.5`,children:(0,W.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-line bg-surface-raised px-2 py-1 text-[10px] text-ink-muted`,children:[(0,W.jsx)(T,{className:`h-3 w-3 text-[#ff7b52]`,"aria-hidden":`true`}),(0,W.jsx)(`span`,{dir:`auto`,children:n(`work.live.skillsLoaded`,{count:e.skills.length,defaultValue:`Workspace skills · {{count}}`})})]})}),t===`conversation`?e.timeline.length>0&&(0,W.jsx)(`div`,{"data-testid":`work-live-timeline`,className:`space-y-2`,children:e.timeline.map((t,n)=>{let r=n===e.timeline.length-1;if(t.kind===`reasoning`)return(0,W.jsx)(je,{content:t.text,streaming:a&&r},`segment-${n}`);if(t.kind===`tool`){let n=e.tools.find(e=>e.id===t.toolId);return n?(0,W.jsx)(J,{tool:n,expandedByDefault:n.status===`error`},n.id):null}return(0,W.jsx)(be,{content:t.text,isStreaming:a&&r,className:`text-ink`},`segment-${n}`)})}):e.tools.length>0&&(0,W.jsx)(`div`,{"data-testid":`work-live-tools`,className:`space-y-1.5`,children:e.tools.map(e=>(0,W.jsx)(J,{tool:e,expandedByDefault:e.status===`running`||e.status===`error`},e.id))}),e.error&&(0,W.jsxs)(`div`,{role:`alert`,dir:`auto`,className:`mt-3 flex items-start gap-2 rounded-xl border border-error-500/30 bg-error-500/10 px-3 py-2.5 text-xs leading-relaxed text-error-600`,children:[(0,W.jsx)(A,{className:`mt-0.5 h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{children:e.error})]}),(u!==void 0||f!==void 0)&&(0,W.jsxs)(`div`,{className:`mt-3 flex flex-wrap items-center gap-x-3 gap-y-1 border-t border-line pt-2 text-[10px] tabular-nums text-ink-subtle`,children:[u!==void 0&&(0,W.jsxs)(`span`,{dir:`auto`,children:[n(`generationStats.generatedTokens`,{defaultValue:`Generated tokens:`}),` `,(0,W.jsxs)(`bdi`,{dir:`ltr`,children:[d&&`≈`,u.toLocaleString()]})]}),f!==void 0&&(0,W.jsxs)(`span`,{dir:`auto`,children:[n(`generationStats.speed`,{defaultValue:`Speed:`}),` `,(0,W.jsxs)(`bdi`,{dir:`ltr`,children:[f.toFixed(1),` t/s`]})]})]}),a&&!e.reasoning&&!e.response&&e.tools.length===0&&(0,W.jsxs)(`div`,{"aria-hidden":`true`,className:`flex h-5 items-center gap-1 text-[rgb(48,121,255)]`,children:[(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current motion-reduce:animate-none`}),(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current [animation-delay:160ms] motion-reduce:animate-none`}),(0,W.jsx)(`span`,{className:`h-1.5 w-1.5 animate-pulse rounded-full bg-current [animation-delay:320ms] motion-reduce:animate-none`})]}),t===`activity`&&e.tools.length===0&&(0,W.jsxs)(`div`,{className:`flex items-center gap-2 text-xs text-ink-muted`,children:[(0,W.jsx)(p,{className:`h-3.5 w-3.5`}),n(`work.activity.empty`,{defaultValue:`Commands, file operations, and tool results will appear here.`})]})]})}function Fe({role:e,user:t,size:n=`message`}){let[r,i]=(0,U.useState)(null);if(e===`assistant`)return(0,W.jsx)(`div`,{role:`img`,"aria-label":`Libre WebUI`,"data-testid":`work-assistant-avatar`,className:l(`flex shrink-0 items-center justify-center rounded-full border border-line bg-surface-raised text-ink shadow-subtle`,n===`empty`?`mx-auto mb-4 h-12 w-12`:`mt-0.5 h-8 w-8`),children:(0,W.jsx)(Se,{label:null,className:l(n===`empty`?`h-6 w-6`:`h-4 w-4`)})});let a=t?.username||`User`,o=t?.avatar?.trim()||``,s=!!o&&o!==r;return(0,W.jsx)(`div`,{role:s?void 0:`img`,"aria-label":s?void 0:a,"data-testid":`work-user-avatar`,className:l(`mt-0.5 flex h-8 w-8 shrink-0 items-center justify-center overflow-hidden rounded-full`,s?`border border-line bg-surface-raised`:`bg-ink text-ink-inverse`),title:a,children:s?(0,W.jsx)(`img`,{src:o,alt:a,className:`h-full w-full object-cover`,onError:()=>i(o)}):t?(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`text-xs font-medium uppercase leading-none`,children:t.username.charAt(0)}):(0,W.jsx)(k,{"aria-hidden":`true`,className:`h-4 w-4`})})}var Y=(e,t)=>{let n=e.metadata,r=n?.name??n?.toolName??n?.tool??n?.command;return typeof r==`string`&&r?r:t},Ie=e=>{let t=e.metadata?.toolCallId;return typeof t==`string`&&t?t:null},Le=(e,t,n)=>{let r=e??t,i=t?.kind===`error`||t?.metadata?.isError===!0||!t&&r?.kind===`error`,a=t?.metadata?.durationMs;return{id:(e??t)?.id??`tool`,name:r?Y(r,n):n,status:i?`error`:`completed`,arguments:e?.metadata,output:t?.content||(!t&&e?e.content:void 0),durationMs:typeof a==`number`?a:void 0}},Re=(e,t)=>{let n=[],r=new Map,i=(e,t)=>{let r=n[n.length-1];return r?.item.type===`tools`?(r.item.tools.push(e),r.item.tools.length-1):(n.push({key:t,item:{type:`tools`,tools:[e]}}),0)};for(let a of e){if(a.kind===`reasoning`){n.push({key:a.id,item:{type:`reasoning`,message:a}});continue}if(a.role!==`tool`&&a.kind===`message`){n.push({key:a.id,item:{type:`message`,message:a}});continue}let e=Ie(a);if(a.kind===`tool_call`&&e){let o=i(Le(a,void 0,t),a.id);r.set(e,{itemIndex:n.length-1,toolIndex:o,call:a});continue}if(a.kind===`tool_result`&&e){let i=r.get(e);if(i){let o=n[i.itemIndex];if(o.item.type===`tools`){o.item.tools[i.toolIndex]=Le(i.call,a,t),r.delete(e);continue}}}i(Le(a.kind===`tool_call`?a:void 0,a.kind===`tool_call`?void 0:a,t),a.id)}return n};function ze({message:e}){let{t}=c();return(0,W.jsxs)(`details`,{"data-testid":`work-provider-reasoning`,className:`group ms-14 overflow-hidden rounded-xl border border-line bg-surface-subtle/70`,children:[(0,W.jsxs)(`summary`,{className:`flex cursor-pointer list-none items-center justify-between gap-3 px-3 py-2 text-xs font-medium text-ink-muted marker:hidden [&::-webkit-details-marker]:hidden`,children:[(0,W.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,W.jsx)(j,{className:`h-3.5 w-3.5 shrink-0 text-[rgb(48,121,255)]`}),(0,W.jsx)(`span`,{className:`truncate`,children:t(`libreClaw.metrics.reasoning`,{defaultValue:`Reasoning`})})]}),(0,W.jsx)(I,{className:`h-3.5 w-3.5 shrink-0 transition-transform group-open:rotate-180`})]}),(0,W.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words border-t border-line px-3 py-2.5 text-xs leading-relaxed text-ink-muted`,children:e.content})]})}function Be({task:e,user:t,loading:n,loadingOlder:r,liveRun:i,onLoadOlder:a}){let{t:o}=c(),s=(0,U.useRef)(null),u=(0,U.useRef)(!0),[d,f]=(0,U.useState)(!1),p=(0,U.useMemo)(()=>[...e.messages||[]].sort((e,t)=>e.messageIndex-t.messageIndex||e.createdAt-t.createdAt||e.id.localeCompare(t.id)),[e.messages]),m=i?.runId,h=(0,U.useMemo)(()=>Re(p.filter(e=>!(m&&e.runId===m&&e.role!==`user`)),o(`work.activity.toolActivity`,{defaultValue:`Tool activity`})),[m,p,o]),g=[...p].reverse().find(e=>e.role===`assistant`&&e.kind===`message`)?.id;(0,U.useEffect)(()=>{u.current=!0;let e=s.current;e&&(e.scrollTop=e.scrollHeight);let t=window.requestAnimationFrame(()=>f(!1));return()=>window.cancelAnimationFrame(t)},[e.id]),(0,U.useEffect)(()=>{let e=s.current,t;return e&&u.current?(e.scrollTop=e.scrollHeight,t=window.requestAnimationFrame(()=>f(!1))):e&&i&&(t=window.requestAnimationFrame(()=>f(!0))),()=>{t!==void 0&&window.cancelAnimationFrame(t)}},[i,p,e.status]);let _=async()=>{let e=s.current,t=e?.scrollHeight??0,n=e?.scrollTop??0;u.current=!1;try{await a(),requestAnimationFrame(()=>{let e=s.current;e&&(e.scrollTop=n+e.scrollHeight-t)})}catch{}};return n&&p.length===0?(0,W.jsx)(`div`,{className:`flex min-h-0 flex-1 items-center justify-center text-ink-muted`,children:(0,W.jsx)(P,{className:`h-6 w-6 animate-spin`})}):(0,W.jsxs)(`div`,{className:`relative flex min-h-0 flex-1`,children:[(0,W.jsx)(`div`,{ref:s,onScroll:e=>{let t=e.currentTarget;u.current=t.scrollHeight-t.scrollTop-t.clientHeight<80,u.current&&f(!1)},className:`min-h-0 flex-1 overflow-y-auto`,children:(0,W.jsx)(`div`,{className:`mx-auto flex min-h-full max-w-3xl flex-col px-4 py-6 md:px-6`,children:p.length===0&&!i?(0,W.jsxs)(`div`,{className:`m-auto max-w-md text-center`,children:[(0,W.jsx)(Fe,{role:`assistant`,size:`empty`}),(0,W.jsx)(`h2`,{className:`text-lg font-semibold tracking-tight text-ink`,children:o(`work.conversation.ready`,{defaultValue:`Workspace ready`})}),(0,W.jsx)(`p`,{className:`mt-2 text-sm leading-relaxed text-ink-muted`,children:o(`work.conversation.empty`,{defaultValue:`Continue the task below. This conversation and its files stay attached to this workspace.`})})]}):(0,W.jsxs)(`div`,{className:`space-y-6`,children:[e.hasMoreMessages&&(0,W.jsx)(`div`,{className:`flex justify-center`,children:(0,W.jsxs)(`button`,{type:`button`,"data-testid":`work-load-older-messages`,disabled:r,onClick:()=>void _(),className:`inline-flex items-center gap-2 rounded-lg border border-line bg-surface-raised px-3 py-1.5 text-xs font-medium text-ink-muted transition-colors hover:bg-surface-subtle hover:text-ink disabled:cursor-not-allowed disabled:opacity-60`,children:[r&&(0,W.jsx)(P,{className:`h-3.5 w-3.5 animate-spin`}),o(`work.conversation.loadOlder`,{defaultValue:`Load older messages`})]})}),h.map(({key:n,item:r})=>{if(r.type===`reasoning`)return(0,W.jsx)(ze,{message:r.message},n);if(r.type===`tools`)return(0,W.jsx)(`div`,{className:`ms-14 space-y-1.5`,children:r.tools.map(e=>(0,W.jsx)(J,{tool:e,expandedByDefault:!1},e.id))},n);let i=r.message,a=i.role===`user`,o=!a&&e.status===`running`&&i.id===g&&i.runId===e.activeRun?.id;return(0,W.jsxs)(`article`,{className:l(`flex gap-3`,a&&`flex-row-reverse`),children:[(0,W.jsx)(Fe,{role:a?`user`:`assistant`,user:a?t:void 0}),(0,W.jsx)(`div`,{className:l(`min-w-0 max-w-[88%]`,a&&`rounded-2xl rounded-se-md bg-ink px-4 py-2.5 text-ink-inverse`),children:a?(0,W.jsx)(`p`,{dir:`auto`,className:`whitespace-pre-wrap break-words text-sm leading-relaxed`,children:i.content}):o?(0,W.jsx)(be,{content:i.content,className:`text-ink`}):(0,W.jsx)(Ce,{content:i.content,className:`text-sm text-ink`})})]},i.id)}),i&&(0,W.jsxs)(`article`,{className:`flex gap-3`,"data-testid":`work-live-run-message`,children:[(0,W.jsx)(Fe,{role:`assistant`}),(0,W.jsx)(`div`,{className:`min-w-0 max-w-[92%] flex-1`,children:(0,W.jsx)(Pe,{run:i})})]}),!i&&(e.status===`preparing`||e.status===`running`)&&(0,W.jsxs)(`div`,{className:`flex items-center gap-2 ps-14 text-xs text-ink-muted`,children:[(0,W.jsx)(P,{className:`h-3.5 w-3.5 animate-spin`}),e.status===`preparing`?o(`work.status.preparing`,{defaultValue:`Preparing isolated workspace…`}):o(`work.status.running`,{defaultValue:`Working in the local workspace…`})]})]})})}),d&&(0,W.jsxs)(`button`,{type:`button`,"data-testid":`work-new-activity-button`,onClick:()=>{let e=s.current;e&&(e.scrollTop=e.scrollHeight),u.current=!0,f(!1)},className:`absolute bottom-4 left-1/2 z-10 inline-flex -translate-x-1/2 items-center gap-1.5 rounded-full border border-line bg-surface-overlay/95 px-3 py-2 text-xs font-medium text-ink shadow-overlay backdrop-blur transition-colors hover:bg-surface-raised`,children:[(0,W.jsx)(O,{className:`h-3.5 w-3.5`}),o(`work.live.newActivity`,{defaultValue:`New activity`})]})]})}var Ve=45,He=30,Ue=70,X=360,We=480,Ge=9,Ke=2,qe=10,Je=`libre-webui-work-split:`,Ye=(e,t,n)=>Math.min(n,Math.max(t,e)),Xe=e=>`${Je}${encodeURIComponent(e||`local`)}`,Ze=e=>{if(typeof window>`u`)return Ve;try{let t=window.localStorage.getItem(e);if(t===null||t.trim()===``)return Ve;let n=Number(t);return Number.isFinite(n)?Ye(n,He,Ue):Ve}catch{return Ve}},Qe=(e,t)=>{if(!(typeof window>`u`))try{window.localStorage.setItem(e,t.toFixed(2))}catch{}},$e=e=>{let t=Math.max(0,e-Ge);if(t===0)return{min:He,max:Ue};let n=Math.max(He,X/t*100),r=Math.min(Ue,(t-We)/t*100);if(n<=r)return{min:n,max:r};let i=Ye(X/840*100,He,Ue);return{min:i,max:i}},et=(e,t)=>Ye(e,t.min,t.max);function tt({conversation:e,workspace:t,userId:n,mobileSurface:r=`conversation`,className:i}){let{t:a,i18n:o}=c(),s=u(o.language),d=Xe(n),[f,p]=(0,U.useState)(()=>({storageKey:d,percent:Ze(d)})),[m,h]=(0,U.useState)(0),[g,_]=(0,U.useState)(!1),v=(0,U.useRef)(null),y=(0,U.useRef)(null),b=(0,U.useRef)(null),x=(0,U.useRef)(d),S=(0,U.useRef)(f.percent),C=(0,U.useRef)(null),w=f.storageKey===d?f.percent:Ze(d),T=(0,U.useMemo)(()=>$e(m),[m]),E=et(w,T),ee=Math.round(E),te=100-ee,D=(0,U.useCallback)(e=>{p({storageKey:d,percent:e})},[d]),O=(0,U.useCallback)(e=>{let t=et(e,$e(v.current?.getBoundingClientRect().width??0));S.current=t,C.current===null&&(C.current=window.requestAnimationFrame(()=>{C.current=null,D(S.current)}))},[D]),ne=(0,U.useCallback)(()=>{if(b.current===null&&!g)return;C.current!==null&&(window.cancelAnimationFrame(C.current),C.current=null);let e=v.current?.getBoundingClientRect().width??0,t=et(S.current,$e(e));S.current=t,D(t),Qe(x.current,t);let n=b.current;b.current=null,n!==null&&y.current?.hasPointerCapture(n)&&y.current.releasePointerCapture(n),_(!1)},[g,D]),k=(0,U.useCallback)(e=>{let t=v.current?.getBoundingClientRect();if(!t)return S.current;let n=Math.max(1,t.width-Ge);return((s?t.right-e:e-t.left)-Ge/2)/n*100},[s]),A=e=>{e.button!==0||!e.isPrimary||(e.preventDefault(),e.stopPropagation(),b.current=e.pointerId,x.current=d,S.current=E,e.currentTarget.setPointerCapture(e.pointerId),_(!0))},re=(0,U.useCallback)(e=>{let t=et(e,T);S.current=t,D(t),Qe(d,t)},[T,D,d]),j=(0,U.useCallback)(()=>{re(Ve)},[re]),ie=e=>{let t=e.shiftKey?qe:Ke,n=null;e.key===`ArrowLeft`?n=E+(s?t:-t):e.key===`ArrowRight`?n=E+(s?-t:t):e.key===`Home`?n=T.min:e.key===`End`?n=T.max:e.key===`Enter`&&(n=Ve),n!==null&&(e.preventDefault(),re(n))};(0,U.useEffect)(()=>{let e=v.current;if(!e)return;if(typeof ResizeObserver>`u`){let t=()=>h(e.getBoundingClientRect().width);return t(),window.addEventListener(`resize`,t),()=>window.removeEventListener(`resize`,t)}let t=new ResizeObserver(e=>{let t=e[0];t&&h(t.contentRect.width)});return t.observe(e),()=>t.disconnect()},[]),(0,U.useEffect)(()=>{if(!g)return;let e=document.body.style.cursor,t=document.body.style.userSelect;document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let n=e=>{e.pointerId===b.current&&(e.preventDefault(),O(k(e.clientX)))},r=e=>{e.pointerId===b.current&&ne()};return window.addEventListener(`pointermove`,n,{passive:!1}),window.addEventListener(`pointerup`,r),window.addEventListener(`pointercancel`,r),window.addEventListener(`blur`,ne),()=>{window.removeEventListener(`pointermove`,n),window.removeEventListener(`pointerup`,r),window.removeEventListener(`pointercancel`,r),window.removeEventListener(`blur`,ne),document.body.style.cursor=e,document.body.style.userSelect=t}},[ne,g,k,O]),(0,U.useEffect)(()=>()=>{C.current!==null&&window.cancelAnimationFrame(C.current),b.current!==null&&Qe(x.current,S.current)},[]);let M={gridTemplateColumns:`minmax(0, ${E}fr) ${Ge}px minmax(0, ${100-E}fr)`};return(0,W.jsxs)(`div`,{ref:v,"data-testid":`work-split-pane`,"data-split-percent":E.toFixed(2),"data-resizing":g?`true`:`false`,className:l(`relative flex min-h-0 min-w-0 flex-1 overflow-hidden xl:grid`,i),style:M,children:[(0,W.jsx)(`section`,{id:`work-conversation-panel`,"data-testid":`work-conversation-panel`,className:l(`min-h-0 min-w-0 flex-1 flex-col bg-transparent xl:flex`,r===`conversation`?`flex`:`hidden`),children:e}),(0,W.jsxs)(`div`,{ref:y,role:`separator`,"aria-orientation":`vertical`,"aria-controls":`work-conversation-panel work-workspace-panel`,"aria-label":a(`work.workspace.resize`,{defaultValue:`Resize conversation and workspace`}),"aria-valuemin":Math.round(T.min),"aria-valuemax":Math.round(T.max),"aria-valuenow":ee,"aria-valuetext":a(`work.workspace.splitSize`,{conversation:ee,workspace:te,defaultValue:`Conversation {{conversation}}%, workspace {{workspace}}%`}),title:a(`work.workspace.resizeHint`,{defaultValue:`Drag to resize. Use arrow keys for precise control. Double-click or press Enter to reset.`}),tabIndex:0,"data-testid":`work-split-resizer`,onPointerDown:A,onDoubleClick:j,onKeyDown:ie,className:l(`group relative z-40 hidden h-full cursor-col-resize touch-none select-none items-center justify-center outline-none xl:flex`,`focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-[#ff7b52]`),children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:l(`pointer-events-none absolute inset-y-0 left-1/2 w-px -translate-x-1/2 bg-line transition-colors`,`group-hover:bg-[#ff7b52] group-focus-visible:bg-[#ff7b52]`,g&&`bg-[#ff7b52]`)}),(0,W.jsx)(`span`,{"aria-hidden":`true`,className:l(`pointer-events-none relative h-14 w-1 rounded-full bg-ink-subtle/50 opacity-60 transition-[height,background-color,opacity]`,`group-hover:h-20 group-hover:bg-[#ff7b52] group-hover:opacity-100`,`group-focus-visible:h-20 group-focus-visible:bg-[#ff7b52] group-focus-visible:opacity-100`,g&&`h-20 bg-[#ff7b52] opacity-100`)})]}),(0,W.jsx)(`section`,{id:`work-workspace-panel`,"data-testid":`work-workspace-panel`,className:l(`min-h-0 min-w-0 flex-1 flex-col bg-surface-raised/85 backdrop-blur-xl xl:flex`,r===`workspace`?`flex`:`hidden`),children:t}),g&&(0,W.jsx)(`div`,{"data-testid":`work-split-drag-shield`,"aria-hidden":`true`,className:`absolute inset-0 z-30 hidden cursor-col-resize select-none xl:block`})]})}var nt=1e5,rt=4e3,it={bash:`bash`,c:`c`,cc:`cpp`,cjs:`javascript`,cpp:`cpp`,cs:`csharp`,csh:`bash`,css:`css`,cts:`typescript`,cxx:`cpp`,diff:`diff`,go:`go`,h:`c`,hpp:`cpp`,htm:`markup`,html:`markup`,java:`java`,js:`javascript`,json:`json`,json5:`json`,jsonc:`json`,jsx:`jsx`,kt:`kotlin`,kts:`kotlin`,less:`css`,md:`markdown`,mdx:`markdown`,mjs:`javascript`,mts:`typescript`,patch:`diff`,php:`php`,py:`python`,rb:`ruby`,rs:`rust`,scss:`css`,sh:`bash`,sql:`sql`,svg:`markup`,swift:`swift`,ts:`typescript`,tsx:`tsx`,xml:`markup`,yaml:`yaml`,yml:`yaml`,zsh:`bash`},at={".bashrc":`bash`,".zshrc":`bash`},ot={cjs:{family:`babel`,parser:`babel`},css:{family:`postcss`,parser:`css`},cts:{family:`typescript`,parser:`typescript`},htm:{family:`html`,parser:`html`},html:{family:`html`,parser:`html`},js:{family:`babel`,parser:`babel`},json:{family:`babel`,parser:`json`},json5:{family:`babel`,parser:`json5`},jsonc:{family:`babel`,parser:`json`},jsx:{family:`babel`,parser:`babel`},less:{family:`postcss`,parser:`less`},md:{family:`markdown`,parser:`markdown`},mdx:{family:`markdown`,parser:`mdx`},mjs:{family:`babel`,parser:`babel`},mts:{family:`typescript`,parser:`typescript`},scss:{family:`postcss`,parser:`scss`},ts:{family:`typescript`,parser:`typescript`},tsx:{family:`typescript`,parser:`typescript`},yaml:{family:`yaml`,parser:`yaml`},yml:{family:`yaml`,parser:`yaml`}},Z=e=>e.split(/[\\/]/).pop()?.toLowerCase()??``,st=e=>{let t=Z(e),n=t.lastIndexOf(`.`);return n>-1?t.slice(n+1):``},ct=e=>at[Z(e)]??it[st(e)]??`text`,lt=e=>ot[st(e)],ut=e=>lt(e)!==void 0,dt=e=>{if(e.length>1e5)return!1;let t=1;for(let n=0;n<e.length;n+=1)if(e.charCodeAt(n)===10&&(t+=1,t>4e3))return!1;return!0},Q=async e=>(await e).default,ft=async(e,t)=>{switch(e.family){case`babel`:return Promise.all([Q(a(()=>import(`./babel-CmENXdZw.js`),__vite__mapDeps([0,1,2,3]))),Q(a(()=>import(`./estree-Lx6fK8Ug.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))]);case`typescript`:return Promise.all([Q(a(()=>import(`./typescript-YKxslwSt.js`),__vite__mapDeps([24,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),Q(a(()=>import(`./estree-Lx6fK8Ug.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))]);case`postcss`:return[await Q(a(()=>import(`./postcss-B5WIGhAY.js`),__vite__mapDeps([25,1,2,3])))];case`html`:{let e=[await Q(a(()=>import(`./html-Dx5reqmV.js`),__vite__mapDeps([26,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))];return/<script\b/i.test(t)&&e.push(await Q(a(()=>import(`./babel-CmENXdZw.js`),__vite__mapDeps([0,1,2,3]))),await Q(a(()=>import(`./estree-Lx6fK8Ug.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))),/<script\b[^>]*\blang\s*=\s*["']?(?:ts|typescript)/i.test(t)&&e.push(await Q(a(()=>import(`./typescript-YKxslwSt.js`),__vite__mapDeps([24,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))),/<style\b/i.test(t)&&e.push(await Q(a(()=>import(`./postcss-B5WIGhAY.js`),__vite__mapDeps([25,1,2,3])))),[...new Set(e)]}case`markdown`:{let n=[await Q(a(()=>import(`./markdown-Bd5G8zQB.js`),__vite__mapDeps([27,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))],r=e=>RegExp(`^(?: {0,3})(?:\`{3,}|~{3,})\\s*(?:${e})(?:\\s|$)`,`im`).test(t);return e.parser===`mdx`&&n.push(await Q(a(()=>import(`./babel-CmENXdZw.js`),__vite__mapDeps([0,1,2,3]))),await Q(a(()=>import(`./estree-Lx6fK8Ug.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))),r(`js|jsx|javascript|json|json5|jsonc`)&&n.push(await Q(a(()=>import(`./babel-CmENXdZw.js`),__vite__mapDeps([0,1,2,3]))),await Q(a(()=>import(`./estree-Lx6fK8Ug.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))),r(`ts|tsx|typescript`)&&n.push(await Q(a(()=>import(`./typescript-YKxslwSt.js`),__vite__mapDeps([24,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),await Q(a(()=>import(`./estree-Lx6fK8Ug.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])))),r(`css|scss|less`)&&n.push(await Q(a(()=>import(`./postcss-B5WIGhAY.js`),__vite__mapDeps([25,1,2,3])))),r(`html`)&&n.push(await Q(a(()=>import(`./html-Dx5reqmV.js`),__vite__mapDeps([26,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),await Q(a(()=>import(`./babel-CmENXdZw.js`),__vite__mapDeps([0,1,2,3]))),await Q(a(()=>import(`./estree-Lx6fK8Ug.js`),__vite__mapDeps([4,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),await Q(a(()=>import(`./typescript-YKxslwSt.js`),__vite__mapDeps([24,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23]))),await Q(a(()=>import(`./postcss-B5WIGhAY.js`),__vite__mapDeps([25,1,2,3])))),r(`yaml|yml`)&&n.push(await Q(a(()=>import(`./yaml-QD4znPfZ.js`),__vite__mapDeps([28,1,2,3])))),[...new Set(n)]}case`yaml`:return[await Q(a(()=>import(`./yaml-QD4znPfZ.js`),__vite__mapDeps([28,1,2,3])))]}},pt=async(e,t)=>{let n=lt(e);if(!n)throw Error(`Formatting is not supported for “${Z(e)||e}”.`);if(!dt(t))throw Error(`Could not format “${Z(e)||e}”: files are limited to ${nt.toLocaleString()} characters and ${rt.toLocaleString()} lines.`);try{let[{format:e},r]=await Promise.all([a(()=>import(`./standalone-DLNXiOUi.js`),__vite__mapDeps([29,1,2,3,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23])),ft(n,t)]);return await e(t,{parser:n.parser,plugins:r,tabWidth:2,useTabs:!1})}catch(t){let n=t instanceof Error?t.message:String(t);throw Error(`Could not format “${Z(e)||e}”: ${n}`)}},mt=(0,U.lazy)(async()=>({default:(await a(()=>import(`./OptimizedSyntaxHighlighter-CWYUn9Oe.js`).then(e=>e.n),__vite__mapDeps([30,2,3,31]))).OptimizedSyntaxHighlighter})),ht=8e3,gt=400,_t=500;function vt({path:e,value:t,ariaLabel:n,disabled:r=!1,onChange:i,onSaveShortcut:a,onFormatShortcut:o}){let{t:s}=c(),u=ye(e=>e.theme.mode===`dark`),d=(0,U.useRef)(null),f=(0,U.useRef)(null),[p,m]=(0,U.useState)(``),h=(0,U.useMemo)(()=>ct(e),[e]),g=(0,U.useMemo)(()=>{if(t.length>ht)return 401;let e=1;for(let n=0;n<t.length&&!(t.charCodeAt(n)===10&&(e+=1,e>gt));n+=1);return e},[t]),_=t.length>ht||g>gt,v=h!==`text`&&!_,y=v&&p===t;return(0,U.useEffect)(()=>{if(!v)return;let e=window.setTimeout(()=>m(t),_t);return()=>window.clearTimeout(e)},[v,e,t]),(0,U.useLayoutEffect)(()=>{!y||!d.current||!f.current||(d.current.style.transform=`translate3d(${-f.current.scrollLeft}px, ${-f.current.scrollTop}px, 0)`)},[y,e]),(0,W.jsxs)(`div`,{dir:`ltr`,className:l(`relative min-h-0 flex-1 overflow-hidden bg-surface focus-within:ring-1 focus-within:ring-inset focus-within:ring-primary-500/60`,r&&`opacity-60`),"data-language":h,"data-highlighted":y?`true`:`false`,children:[y&&(0,W.jsx)(`div`,{"aria-hidden":`true`,"data-testid":`work-file-highlight`,className:`pointer-events-none absolute inset-0 z-0 overflow-hidden`,children:(0,W.jsx)(`div`,{ref:d,"data-testid":`work-file-highlight-content`,className:`min-h-full min-w-full origin-top-left will-change-transform`,children:(0,W.jsx)(U.Suspense,{fallback:(0,W.jsx)(`pre`,{className:`m-0 min-h-full min-w-full whitespace-pre p-4 text-left font-mono text-[12px] leading-5 text-ink`,children:t||``}),children:(0,W.jsx)(mt,{language:h,isDark:u,backgroundColor:`transparent`,borderRadius:0,customStyle:{margin:0,minHeight:`100%`,minWidth:`100%`,width:`max-content`,overflow:`visible`,padding:`1rem`,fontSize:`12px`,lineHeight:`20px`,tabSize:2,whiteSpace:`pre`},children:p||``})})})}),(0,W.jsx)(`textarea`,{ref:f,"data-testid":`work-file-editor`,"data-language":h,"aria-label":n,value:t,onChange:e=>i(e.target.value),onScroll:e=>{d.current&&(d.current.style.transform=`translate3d(${-e.currentTarget.scrollLeft}px, ${-e.currentTarget.scrollTop}px, 0)`)},onKeyDown:e=>{let t=e.key.toLowerCase();if((e.metaKey||e.ctrlKey)&&t===`s`){e.preventDefault(),a();return}e.altKey&&e.shiftKey&&t===`f`&&(e.preventDefault(),o())},disabled:r,spellCheck:!1,wrap:`off`,className:l(`absolute inset-0 z-10 h-full w-full resize-none overflow-auto whitespace-pre border-0 bg-transparent p-4 text-left font-mono text-[12px] leading-5 outline-none selection:bg-primary-500/25 disabled:cursor-not-allowed`,y?`text-transparent caret-ink`:`text-ink`),style:y?{WebkitTextFillColor:`transparent`,caretColor:`rgb(var(--color-ink))`,tabSize:2}:{tabSize:2}}),_&&(0,W.jsx)(`span`,{dir:`auto`,className:`pointer-events-none absolute bottom-2 end-3 z-20 rounded-md border border-line bg-surface-overlay/90 px-2 py-1 text-[10px] text-ink-muted shadow-subtle`,title:s(`work.files.highlightPaused`,{defaultValue:`Live highlighting is paused for large files to keep editing responsive.`}),children:s(`work.files.plainTextLarge`,{defaultValue:`Plain text · large file`})})]})}var yt=4e6,bt=e=>{if(e===``)return[];let t=e.split(`
|
|
4
|
-
`);return t[t.length-1]===``&&t.pop(),t},xt=(e,t)=>{let n=bt(e),r=bt(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i+=1;let a=0;for(;a<n.length-i&&a<r.length-i&&n[n.length-1-a]===r[r.length-1-a];)a+=1;let o=n.slice(i,n.length-a),s=r.slice(i,r.length-a),c=[];for(let e=0;e<i;e+=1)c.push({type:`context`,text:n[e],beforeLine:e+1,afterLine:e+1});let l=St(o,s);for(let e of l){let t={type:e.type,text:e.text};e.beforeLine!==void 0&&(t.beforeLine=e.beforeLine+i),e.afterLine!==void 0&&(t.afterLine=e.afterLine+i),c.push(t)}for(let e=0;e<a;e+=1){let t=n.length-a+e,i=r.length-a+e;c.push({type:`context`,text:n[t],beforeLine:t+1,afterLine:i+1})}return c},St=(e,t)=>{if(e.length===0&&t.length===0)return[];if(e.length>0&&t.length>0&&e.length*t.length>yt)return[...e.map((e,t)=>({type:`removed`,text:e,beforeLine:t+1})),...t.map((e,t)=>({type:`added`,text:e,afterLine:t+1}))];let n=e.length+1,r=t.length+1,i=new Uint32Array(n*r);for(let n=e.length-1;n>=0;--n)for(let a=t.length-1;a>=0;--a)i[n*r+a]=e[n]===t[a]?i[(n+1)*r+a+1]+1:Math.max(i[(n+1)*r+a],i[n*r+a+1]);let a=[],o=0,s=0;for(;o<e.length&&s<t.length;)e[o]===t[s]?(a.push({type:`context`,text:e[o],beforeLine:o+1,afterLine:s+1}),o+=1,s+=1):i[(o+1)*r+s]>=i[o*r+s+1]?(a.push({type:`removed`,text:e[o],beforeLine:o+1}),o+=1):(a.push({type:`added`,text:t[s],afterLine:s+1}),s+=1);for(;o<e.length;)a.push({type:`removed`,text:e[o],beforeLine:o+1}),o+=1;for(;s<t.length;)a.push({type:`added`,text:t[s],afterLine:s+1}),s+=1;return a},Ct=e=>{let t=0,n=0;for(let r of e)r.type===`added`&&(t+=1),r.type===`removed`&&(n+=1);return{added:t,removed:n}},wt=3,Tt=e=>{let t=Array(e.length).fill(!1);for(let n=0;n<e.length;n+=1){if(e[n].type===`context`)continue;let r=Math.max(0,n-wt),i=Math.min(e.length-1,n+wt);for(let e=r;e<=i;e+=1)t[e]=!0}let n=[],r=[];for(let i=0;i<e.length;i+=1){if(!t[i]){r.push(e[i]);continue}r.length>0&&(n.push({type:`fold`,count:r.length,lines:r}),r=[]),n.push({type:`line`,line:e[i]})}return r.length>0&&n.push({type:`fold`,count:r.length,lines:r}),n};function $({line:e}){return(0,W.jsxs)(`tr`,{className:l(e.type===`added`&&`bg-[rgb(76,212,117)]/[0.12] text-ink`,e.type===`removed`&&`bg-[rgb(255,61,129)]/[0.10] text-ink-muted`,e.type===`context`&&`text-ink-muted`),children:[(0,W.jsx)(`td`,{className:`w-10 select-none px-2 text-right align-top text-[10px] tabular-nums text-ink-subtle`,children:e.beforeLine??``}),(0,W.jsx)(`td`,{className:`w-10 select-none px-2 text-right align-top text-[10px] tabular-nums text-ink-subtle`,children:e.afterLine??``}),(0,W.jsxs)(`td`,{className:`w-full whitespace-pre-wrap break-all px-3 align-top`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:l(`me-2 inline-block w-3 select-none text-center`,e.type===`added`&&`text-[rgb(46,164,79)]`,e.type===`removed`&&`text-[rgb(255,61,129)]`),children:e.type===`added`?`+`:e.type===`removed`?`−`:``}),e.text||``]})]})}var Et=new Set,Dt=e=>{let t=null;return e.map(e=>{let n=e.type===`line`?e.line:e.lines[0],r=t;return t=e.type===`line`?e.line:e.lines[e.lines.length-1],!r||!n?0:n.beforeLine!==void 0&&r.beforeLine!==void 0?n.beforeLine-r.beforeLine-1:n.afterLine!==void 0&&r.afterLine!==void 0?n.afterLine-r.afterLine-1:0})};function Ot({lines:e}){let{t}=c(),n=(0,U.useMemo)(()=>Tt(e),[e]),r=(0,U.useMemo)(()=>Dt(n),[n]),[i,a]=(0,U.useState)({rows:null,set:Et}),o=i.rows===n?i.set:Et,s=e=>a({rows:n,set:new Set(o).add(e)});return(0,W.jsx)(`table`,{className:`w-full border-collapse`,children:(0,W.jsx)(`tbody`,{children:n.map((e,n)=>{let i=r[n];return(0,W.jsxs)(U.Fragment,{children:[i>0&&(0,W.jsx)(`tr`,{"data-testid":`work-diff-gap`,children:(0,W.jsx)(`td`,{colSpan:3,className:`select-none border-y border-line bg-surface-subtle/70 px-4 py-1 text-center text-[11px] text-ink-subtle`,children:t(`work.files.diffFolded`,{count:i,defaultValue:`{{count}} unchanged lines`})})}),l(e,n)]},`row-${n}`)})})});function l(e,n){return e.type===`fold`?o.has(n)?(0,W.jsx)(U.Fragment,{children:e.lines.map((e,t)=>(0,W.jsx)($,{line:e},t))},`fold-${n}`):(0,W.jsx)(`tr`,{children:(0,W.jsx)(`td`,{colSpan:3,className:`p-0`,children:(0,W.jsxs)(`button`,{type:`button`,"data-testid":`work-diff-fold`,onClick:()=>s(n),className:`flex w-full select-none items-center justify-center gap-1.5 border-y border-line bg-surface-subtle/70 px-4 py-1 text-[11px] text-ink-subtle transition-colors hover:bg-surface-subtle hover:text-ink`,children:[(0,W.jsx)(R,{className:`h-3 w-3 shrink-0`}),t(`work.files.diffFolded`,{count:e.count,defaultValue:`{{count}} unchanged lines`})]})})},`fold-${n}`):(0,W.jsx)($,{line:e.line},`line-${n}`)}}function kt({lines:e,ariaLabel:t}){return(0,W.jsx)(`div`,{dir:`ltr`,role:`region`,"aria-label":t,"data-testid":`work-file-diff`,className:`min-h-0 flex-1 overflow-auto bg-surface font-mono text-[12px] leading-5`,children:(0,W.jsx)(Ot,{lines:e})})}var At=e=>{if(!e.startsWith(`"`)||!e.endsWith(`"`)||e.length<2)return e;let t=e.slice(1,-1),n=``;for(let e=0;e<t.length;e+=1){let r=t[e];if(r!==`\\`||e===t.length-1){n+=r;continue}e+=1;let i=t[e];if(i===`n`)n+=`
|
|
5
|
-
`;else if(i===`t`)n+=` `;else if(i===`\\`||i===`"`)n+=i;else if(i>=`0`&&i<=`7`){let r=i;for(;r.length<3&&e+1<t.length&&t[e+1]>=`0`&&t[e+1]<=`7`;)e+=1,r+=t[e];n+=String.fromCharCode(parseInt(r,8))}else n+=`\\${i}`}return n},jt=e=>{let t=At(e);return t.startsWith(`a/`)||t.startsWith(`b/`)?t.slice(2):t},Mt=e=>{let t=e.slice(11).trim();if(t.startsWith(`"`)){let e=t.indexOf(`" `,1);return e===-1?null:{oldPath:jt(t.slice(0,e+1)),newPath:jt(t.slice(e+2).trim())}}let n=t.lastIndexOf(` b/`);if(n===-1){let e=t.indexOf(` `);return e===-1?null:{oldPath:jt(t.slice(0,e)),newPath:jt(t.slice(e+1))}}return{oldPath:jt(t.slice(0,n)),newPath:jt(t.slice(n+1))}},Nt=/^@@ -(\d+)(?:,\d+)? \+(\d+)(?:,\d+)? @@/,Pt=e=>({path:e.status===`deleted`?e.oldPath:e.newPath,...e.status===`renamed`&&e.oldPath!==e.newPath?{oldPath:e.oldPath}:{},status:e.status,binary:e.binary,lines:e.lines,stats:Ct(e.lines)}),Ft=e=>{let t=[],n=null;for(let r of e.split(`
|
|
6
|
-
`)){if(r.startsWith(`diff --git `)){n&&t.push(Pt(n));let e=Mt(r);n={oldPath:e?.oldPath??``,newPath:e?.newPath??e?.oldPath??``,status:`modified`,binary:!1,lines:[]};continue}if(!n)continue;if(r.startsWith(`new file mode`)){n.status=`added`;continue}if(r.startsWith(`deleted file mode`)){n.status=`deleted`;continue}if(r.startsWith(`rename from `)){n.status=`renamed`,n.oldPath=At(r.slice(12));continue}if(r.startsWith(`rename to `)){n.status=`renamed`,n.newPath=At(r.slice(10));continue}if(r.startsWith(`Binary files `)||r===`GIT binary patch`){n.binary=!0;continue}if(r.startsWith(`--- `)){let e=r.slice(4).trim();e!==`/dev/null`&&n.status!==`renamed`&&(n.oldPath=jt(e));continue}if(r.startsWith(`+++ `)){let e=r.slice(4).trim();e!==`/dev/null`&&n.status!==`renamed`&&(n.newPath=jt(e));continue}let e=r.match(Nt);if(e){n.beforeLine=parseInt(e[1],10),n.afterLine=parseInt(e[2],10);continue}if(!(r.startsWith(`index `)||r.startsWith(`similarity index`)||r.startsWith(`dissimilarity index`)||r.startsWith(`old mode`)||r.startsWith(`new mode`)||r.startsWith(`copy from`)||r.startsWith(`copy to`)||r.startsWith(`\\`))){if(r.startsWith(`+`)){n.lines.push({type:`added`,text:r.slice(1),...n.afterLine===void 0?{}:{afterLine:n.afterLine++}});continue}if(r.startsWith(`-`)){n.lines.push({type:`removed`,text:r.slice(1),...n.beforeLine===void 0?{}:{beforeLine:n.beforeLine++}});continue}if(r.startsWith(` `)){n.lines.push({type:`context`,text:r.slice(1),...n.beforeLine===void 0?{}:{beforeLine:n.beforeLine++},...n.afterLine===void 0?{}:{afterLine:n.afterLine++}});continue}}}return n&&t.push(Pt(n)),t},It=e=>{let t=0,n=0;for(let r of e)t+=r.stats.added,n+=r.stats.removed;return{added:t,removed:n}},Lt=(e,t)=>{if(e.success&&e.data)return e.data;throw Error(e.error||t)},Rt=(e,t)=>{let n=e?.response?.data?.error;return typeof n==`string`&&n?n:e instanceof Error&&e.message?e.message:t},zt=e=>e.indexStatus===`?`,Bt=e=>zt(e)?`U`:e.workingTreeStatus===`.`?e.indexStatus:e.workingTreeStatus,Vt=e=>({modified:`M`,added:`A`,deleted:`D`,renamed:`R`})[e],Ht=e=>e===`A`||e===`U`?`text-[rgb(46,164,79)]`:e===`D`?`text-[rgb(255,61,129)]`:e===`R`||e===`C`?`text-sky-600 dark:text-sky-400`:`text-amber-600 dark:text-amber-500`,Ut=e=>{let t=e.lastIndexOf(`/`);return t===-1?{name:e,directory:``}:{name:e.slice(t+1),directory:e.slice(0,t)}};function Wt({added:e,removed:t,muted:n=!1}){return(0,W.jsxs)(`span`,{dir:`ltr`,className:`shrink-0 font-mono text-[10px] tabular-nums`,children:[(0,W.jsxs)(`span`,{className:n?`text-ink-subtle`:`text-[rgb(46,164,79)]`,children:[`+`,e]}),` `,(0,W.jsxs)(`span`,{className:n?`text-ink-subtle`:`text-[rgb(255,61,129)]`,children:[`−`,t]})]})}function Gt({letter:e,path:t,oldPath:n,added:r,removed:i}){return(0,W.jsxs)(`div`,{className:`sticky top-0 z-10 flex items-center gap-2 border-b border-line bg-surface-raised/95 px-3 py-1.5 backdrop-blur`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:l(`w-4 shrink-0 text-center font-mono text-[11px] font-semibold`,Ht(e)),children:e}),(0,W.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate text-start font-mono text-[11px] text-ink`,title:n?`${n} → ${t}`:t,children:n?`${n} → ${t}`:t}),(0,W.jsx)(Wt,{added:r,removed:i})]})}function Kt({taskId:e,mutationsDisabled:t=!1,disabledReason:n}){let{t:r}=c(),[i,a]=(0,U.useState)(null),[o,s]=(0,U.useState)(!0),[u,d]=(0,U.useState)(!1),[p,m]=(0,U.useState)(null),[g,_]=(0,U.useState)([]),[b,x]=(0,U.useState)(``),[C,T]=(0,U.useState)(``),[ee,te]=(0,U.useState)(``),[D,O]=(0,U.useState)(null),[ne,k]=(0,U.useState)(!1),[A,re]=(0,U.useState)(null),[j,ie]=(0,U.useState)(!1),M=(0,U.useRef)(0),N=(0,U.useRef)(0),F=(0,U.useCallback)(async()=>{let t=++M.current;s(!0),m(null);try{let n=Lt(await z.getGitStatus(e),r(`work.git.loadFailed`,{defaultValue:`Could not load Git status.`}));if(t!==M.current)return;a(n),_([])}catch(e){if(t!==M.current)return;m(Rt(e,r(`work.git.loadFailed`,{defaultValue:`Could not load Git status.`})))}finally{t===M.current&&s(!1)}},[r,e]);(0,U.useEffect)(()=>{let e=window.setTimeout(()=>void F(),0);return()=>{window.clearTimeout(e),M.current+=1}},[F]),(0,U.useEffect)(()=>{let t=!1,n=window.setTimeout(async()=>{if(!i?.initialized){re(null);return}if(!i.changes.some(e=>!zt(e))){re(i.changes.length>0?{files:[],truncated:!1}:null);return}ie(!0);try{let n=await z.getGitDiff(e);if(t||!n.success||!n.data)return;re({files:Ft(n.data.patch),truncated:n.data.truncated})}catch{}finally{t||ie(!1)}},0);return()=>{t=!0,window.clearTimeout(n)}},[i,e]);let ae=async(e,n)=>{if(t||u)return!1;d(!0),m(null);try{let t=Lt(await e(),r(`work.git.actionFailed`,{defaultValue:`Git action failed.`}));return N.current+=1,a(t),_([]),O(null),h.success(n),!0}catch(e){let t=Rt(e,r(`work.git.actionFailed`,{defaultValue:`Git action failed.`}));return m(t),h.error(t),!1}finally{d(!1)}},oe=async t=>{let n=++N.current;k(!0),m(null);try{if(zt(t)){let i=Lt(await z.getFile(e,t.path),r(`work.git.diffFailed`,{defaultValue:`Could not load this diff.`}));if(n!==N.current)return;O({path:t.path,status:`added`,lines:xt(``,i.content),binary:!1,truncated:!1})}else{let i=Lt(await z.getGitDiff(e,t.path),r(`work.git.diffFailed`,{defaultValue:`Could not load this diff.`}));if(n!==N.current)return;let a=Ft(i.patch)[0];O({path:t.path,status:a?.status??`modified`,lines:a?.lines??[],binary:a?.binary??!1,truncated:i.truncated})}}catch(e){if(n!==N.current)return;m(Rt(e,r(`work.git.diffFailed`,{defaultValue:`Could not load this diff.`})))}finally{n===N.current&&k(!1)}},I=(0,U.useMemo)(()=>{let e=new Map;for(let t of A?.files??[])e.set(t.path,t);return e},[A]),L=(0,U.useMemo)(()=>It(A?.files??[]),[A]),R=ee.trim().toLowerCase(),ce=(0,U.useMemo)(()=>{let e=i?.changes??[];return R?e.filter(e=>e.path.toLowerCase().includes(R)):e},[R,i]);if(o&&!i)return(0,W.jsx)(`div`,{className:`flex h-full items-center justify-center text-ink-muted`,children:(0,W.jsx)(P,{className:`h-5 w-5 animate-spin`})});if(!i)return(0,W.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-6 text-center`,children:[(0,W.jsx)(E,{className:`mb-3 h-8 w-8 text-error-500`}),(0,W.jsx)(`p`,{className:`max-w-sm text-xs leading-relaxed text-error-600`,children:p||r(`work.git.loadFailed`,{defaultValue:`Could not load Git status.`})}),(0,W.jsxs)(B,{size:`sm`,variant:`secondary`,className:`mt-4`,onClick:()=>void F(),children:[(0,W.jsx)(w,{className:`h-3.5 w-3.5`}),r(`common.retry`,{defaultValue:`Retry`})]})]});if(!i.initialized)return(0,W.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-6 text-center`,children:[(0,W.jsx)(E,{className:`mb-3 h-8 w-8 text-ink-subtle`}),(0,W.jsx)(`h3`,{className:`text-sm font-medium text-ink`,children:r(`work.git.notInitialized`,{defaultValue:`Git is not initialized`})}),(0,W.jsx)(`p`,{className:`mt-1 max-w-sm text-xs leading-relaxed text-ink-muted`,children:r(`work.git.initializeDescription`,{defaultValue:`Create a local repository for status, diffs, branches, and commits. No remote credentials are connected.`})}),p&&(0,W.jsx)(`p`,{className:`mt-3 text-xs text-error-600`,children:p}),(0,W.jsxs)(B,{"data-testid":`work-git-init-button`,size:`sm`,className:`mt-4 bg-[#ff7b52] text-[#3d120c] hover:bg-[#ff7b52]/90`,disabled:t||u,onClick:()=>void ae(()=>z.initializeGit(e),r(`work.git.initialized`,{defaultValue:`Git repository initialized.`})),children:[u?(0,W.jsx)(P,{className:`me-2 h-3.5 w-3.5 animate-spin`}):(0,W.jsx)(f,{className:`me-2 h-3.5 w-3.5`}),r(`work.git.initialize`,{defaultValue:`Initialize Git`})]}),t&&n&&(0,W.jsx)(`p`,{className:`mt-2 text-[11px] text-ink-subtle`,children:n})]});let le=i.changes.filter(e=>e.staged).length,de=i.changes.length>0,fe=ce.filter(zt),pe=R?(A?.files??[]).filter(e=>e.path.toLowerCase().includes(R)):A?.files??[];return(0,W.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`work-git-panel`,children:[(0,W.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 border-b border-line px-3 py-2`,children:[(0,W.jsxs)(`span`,{className:`inline-flex min-w-0 items-center gap-1.5 rounded-lg bg-surface-subtle px-2 py-1 font-mono text-[11px] text-ink`,children:[(0,W.jsx)(E,{className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`truncate`,children:i.detached?r(`work.git.detached`,{defaultValue:`detached HEAD`}):i.branch||`main`})]}),A&&(L.added>0||L.removed>0)&&(0,W.jsxs)(`span`,{"data-testid":`work-git-total-stats`,dir:`ltr`,className:`font-mono text-[11px] font-medium tabular-nums`,children:[(0,W.jsxs)(`span`,{className:`text-[rgb(46,164,79)]`,children:[`+`,L.added]}),` `,(0,W.jsxs)(`span`,{className:`text-[rgb(255,61,129)]`,children:[`−`,L.removed]})]}),(i.ahead>0||i.behind>0)&&(0,W.jsxs)(`span`,{className:`text-[10px] text-ink-muted`,children:[`↑`,i.ahead,` ↓`,i.behind]}),(0,W.jsxs)(`select`,{"data-testid":`work-git-branch-select`,"aria-label":r(`work.git.switchBranch`,{defaultValue:`Switch local branch`}),value:i.branch||``,disabled:t||u||de,onChange:t=>{let n=t.target.value;!n||n===i.branch||ae(()=>z.switchGitBranch(e,n),r(`work.git.branchSwitched`,{name:n,defaultValue:`Switched to {{name}}.`}))},className:`h-7 max-w-44 rounded-lg border border-line bg-surface px-2 text-[11px] text-ink outline-none disabled:opacity-50`,children:[i.detached&&(0,W.jsx)(`option`,{value:``,disabled:!0,children:r(`work.git.detached`,{defaultValue:`detached HEAD`})}),i.branches.map(e=>(0,W.jsx)(`option`,{value:e,children:e},e))]}),(0,W.jsxs)(`div`,{className:`flex min-w-44 flex-1 items-center gap-1`,children:[(0,W.jsx)(`input`,{"data-testid":`work-git-branch-input`,value:C,maxLength:200,onChange:e=>T(e.target.value),placeholder:r(`work.git.newBranch`,{defaultValue:`New local branch`}),className:`h-7 min-w-0 flex-1 rounded-lg border border-line bg-surface px-2 font-mono text-[11px] text-ink outline-none placeholder:text-ink-subtle focus:border-primary-500`}),(0,W.jsxs)(B,{"data-testid":`work-git-create-branch-button`,size:`sm`,variant:`ghost`,className:`h-7 px-2`,disabled:t||u||!i.head||!C.trim(),onClick:()=>{let t=C.trim();ae(()=>z.createGitBranch(e,t),r(`work.git.branchCreated`,{name:t,defaultValue:`Created {{name}}.`})).then(e=>{e&&T(``)})},children:[(0,W.jsx)(f,{className:`h-3.5 w-3.5`}),(0,W.jsx)(`span`,{className:`hidden sm:inline`,children:r(`work.git.createBranch`,{defaultValue:`Create`})})]})]}),(0,W.jsx)(`button`,{type:`button`,onClick:()=>void F(),disabled:o||u,"aria-label":r(`common.refresh`,{defaultValue:`Refresh`}),className:`inline-flex h-7 w-7 items-center justify-center rounded-lg text-ink-muted hover:bg-surface-subtle hover:text-ink disabled:opacity-50`,children:(0,W.jsx)(w,{className:l(`h-3.5 w-3.5`,o&&`animate-spin`)})})]}),p&&(0,W.jsx)(`div`,{className:`border-b border-error-200 bg-error-50 px-3 py-2 text-xs text-error-700 dark:border-error-900/60 dark:bg-error-900/30 dark:text-error-300`,children:p}),t&&n&&(0,W.jsx)(`div`,{className:`border-b border-line px-3 py-1.5 text-[11px] text-ink-subtle`,children:n}),(0,W.jsxs)(`div`,{className:`grid min-h-0 flex-1 grid-cols-1 lg:grid-cols-[minmax(15rem,0.75fr)_minmax(0,2.25fr)]`,children:[(0,W.jsxs)(`section`,{className:`flex min-h-0 flex-col border-b border-line lg:border-b-0 lg:border-e`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2 px-3 py-2`,children:[(0,W.jsxs)(`h3`,{className:`text-xs font-medium text-ink`,children:[r(`work.git.changes`,{defaultValue:`Changes`}),` `,(0,W.jsx)(`span`,{className:`text-ink-subtle`,children:i.changes.length})]}),(0,W.jsxs)(B,{"data-testid":`work-git-stage-button`,size:`sm`,variant:`ghost`,className:`h-7 px-2 text-[11px]`,disabled:t||u||g.length===0&&i.changes.length===0,onClick:()=>{let t=g.length>0?g:i.changes.map(e=>e.path);ae(()=>z.stageGitPaths(e,t),r(`work.git.staged`,{defaultValue:`Changes staged.`}))},children:[(0,W.jsx)(se,{className:`h-3.5 w-3.5`}),g.length>0?r(`work.git.stageSelected`,{count:g.length,defaultValue:`Stage {{count}}`}):r(`work.git.stageAll`,{defaultValue:`Stage all`})]})]}),i.changes.length>0&&(0,W.jsxs)(`div`,{className:`relative px-2 pb-1.5`,children:[(0,W.jsx)(S,{className:`pointer-events-none absolute start-4 top-1/2 h-3 w-3 -translate-y-[calc(50%+3px)] text-ink-subtle`}),(0,W.jsx)(`input`,{"data-testid":`work-git-filter`,value:ee,maxLength:500,onChange:e=>te(e.target.value),placeholder:r(`work.git.filterFiles`,{defaultValue:`Filter changed files`}),"aria-label":r(`work.git.filterFiles`,{defaultValue:`Filter changed files`}),className:`h-7 w-full rounded-lg border border-line bg-surface pe-2 ps-7 text-[11px] text-ink outline-none placeholder:text-ink-subtle focus:border-primary-500`})]}),(0,W.jsx)(`div`,{className:`min-h-32 flex-1 overflow-y-auto px-2 pb-2`,children:i.changes.length===0?(0,W.jsx)(`p`,{className:`px-2 py-8 text-center text-xs text-ink-muted`,children:r(`work.git.clean`,{defaultValue:`Working tree is clean.`})}):ce.length===0?(0,W.jsx)(`p`,{className:`px-2 py-8 text-center text-xs text-ink-muted`,children:r(`work.git.noFilterMatches`,{defaultValue:`No changed files match this filter.`})}):ce.map(e=>{let t=Bt(e),{name:n,directory:i}=Ut(e.path),a=I.get(e.path);return(0,W.jsxs)(`div`,{className:l(`flex items-center gap-1 rounded-lg hover:bg-surface-subtle`,D?.path===e.path&&`bg-surface-subtle`),children:[(0,W.jsx)(`input`,{type:`checkbox`,"aria-label":r(`work.git.selectPath`,{path:e.path,defaultValue:`Select {{path}}`}),checked:g.includes(e.path),onChange:t=>_(n=>t.target.checked?[...n,e.path]:n.filter(t=>t!==e.path)),className:`ms-2 h-3.5 w-3.5 accent-[#ff7b52]`}),(0,W.jsxs)(`button`,{type:`button`,"data-testid":`work-git-change`,onClick:()=>void oe(e),className:`flex min-w-0 flex-1 items-center gap-2 px-1.5 py-2 text-start`,title:e.path,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:l(`w-3.5 shrink-0 text-center font-mono text-[10px] font-semibold`,Ht(t),e.staged&&`underline underline-offset-2`),children:t}),(0,W.jsxs)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate text-start font-mono text-[11px]`,children:[(0,W.jsx)(`span`,{className:`text-ink`,children:n}),i&&(0,W.jsxs)(`span`,{className:`text-ink-subtle`,children:[` `,i]})]}),a&&(a.stats.added>0||a.stats.removed>0)&&(0,W.jsx)(Wt,{added:a.stats.added,removed:a.stats.removed})]})]},`${e.path}:${e.originalPath||``}`)})}),(0,W.jsxs)(`div`,{className:`border-t border-line p-2`,children:[(0,W.jsx)(`textarea`,{"data-testid":`work-git-commit-input`,value:b,maxLength:4e3,rows:2,onChange:e=>x(e.target.value),placeholder:r(`work.git.commitMessage`,{defaultValue:`Commit message`}),className:`w-full resize-none rounded-lg border border-line bg-surface px-2.5 py-2 text-xs text-ink outline-none placeholder:text-ink-subtle focus:border-primary-500`}),(0,W.jsxs)(B,{"data-testid":`work-git-commit-button`,size:`sm`,className:`mt-1.5 w-full bg-[#ff7b52] text-[#3d120c] hover:bg-[#ff7b52]/90`,disabled:t||u||le===0||!b.trim(),onClick:()=>{let t=b.trim();ae(()=>z.commitGit(e,t),r(`work.git.committed`,{defaultValue:`Commit created.`})).then(e=>{e&&x(``)})},children:[u&&(0,W.jsx)(P,{className:`h-3.5 w-3.5 animate-spin`}),r(`work.git.commit`,{defaultValue:`Commit staged changes`})]})]}),(0,W.jsxs)(`div`,{className:`max-h-56 shrink-0 overflow-y-auto border-t border-line p-3`,children:[(0,W.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-xs font-medium text-ink`,children:[(0,W.jsx)(v,{className:`h-3.5 w-3.5`}),r(`work.git.history`,{defaultValue:`Local history`})]}),i.commits.length===0?(0,W.jsx)(`p`,{className:`py-3 text-center text-xs text-ink-muted`,children:r(`work.git.noCommits`,{defaultValue:`No commits yet.`})}):(0,W.jsx)(`ol`,{className:`space-y-2`,children:i.commits.map(e=>(0,W.jsxs)(`li`,{className:`rounded-lg border border-line bg-surface px-2.5 py-2`,children:[(0,W.jsx)(`p`,{dir:`auto`,className:`text-xs text-ink`,children:e.subject}),(0,W.jsxs)(`p`,{className:`mt-1 flex flex-wrap gap-x-2 text-[10px] text-ink-subtle`,children:[(0,W.jsx)(`span`,{dir:`ltr`,className:`font-mono`,children:e.shortHash}),(0,W.jsx)(`span`,{dir:`auto`,children:e.author}),(0,W.jsx)(`time`,{dateTime:e.authoredAt,children:new Date(e.authoredAt).toLocaleDateString()})]})]},e.hash))}),(0,W.jsx)(`p`,{className:`mt-3 border-t border-line pt-2 text-[10px] leading-relaxed text-ink-subtle`,children:r(`work.git.localOnly`,{defaultValue:`Local Git only. Push, pull, and pull requests require a separate trusted credential broker.`})})]})]}),(0,W.jsx)(`section`,{className:`flex min-h-48 min-w-0 flex-col`,children:D||ne?(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex items-center gap-1.5 border-b border-line px-2 py-1.5`,children:[(0,W.jsxs)(`button`,{type:`button`,"data-testid":`work-git-all-changes-button`,onClick:()=>{N.current+=1,O(null),k(!1)},className:`inline-flex h-6 shrink-0 items-center gap-1 rounded-lg px-1.5 text-[11px] text-ink-muted hover:bg-surface-subtle hover:text-ink`,children:[(0,W.jsx)(ue,{className:`h-3 w-3 rtl:rotate-180`}),r(`work.git.allChanges`,{defaultValue:`All changes`})]}),D&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:l(`w-4 shrink-0 text-center font-mono text-[11px] font-semibold`,Ht(Vt(D.status))),children:Vt(D.status)}),(0,W.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-ink`,title:D.path,children:D.path}),!D.binary&&(0,W.jsx)(Wt,{added:D.lines.filter(e=>e.type===`added`).length,removed:D.lines.filter(e=>e.type===`removed`).length})]})]}),ne?(0,W.jsx)(P,{className:`m-auto h-5 w-5 animate-spin text-ink-muted`}):D?(0,W.jsxs)(`div`,{"data-testid":`work-git-diff`,dir:`ltr`,className:`min-h-0 flex-1 overflow-auto bg-surface font-mono text-[12px] leading-5`,children:[D.truncated&&(0,W.jsx)(`p`,{className:`border-b border-line bg-surface-subtle/70 px-3 py-1.5 text-center font-sans text-[11px] text-ink-subtle`,children:r(`work.git.diffTruncated`,{defaultValue:`This diff is truncated.`})}),D.binary?(0,W.jsx)(`p`,{className:`px-5 py-10 text-center font-sans text-xs text-ink-muted`,children:r(`work.git.binaryFile`,{defaultValue:`Binary file, no text diff.`})}):D.lines.length===0?(0,W.jsx)(`p`,{className:`px-5 py-10 text-center font-sans text-xs text-ink-muted`,children:r(`work.git.noDiff`,{defaultValue:`No textual diff is available yet. Untracked files appear after staging.`})}):(0,W.jsx)(Ot,{lines:D.lines})]}):null]}):i.changes.length===0?(0,W.jsx)(`p`,{className:`m-auto px-5 text-center text-xs text-ink-muted`,children:r(`work.git.clean`,{defaultValue:`Working tree is clean.`})}):j&&!A?(0,W.jsx)(P,{className:`m-auto h-5 w-5 animate-spin text-ink-muted`}):(0,W.jsxs)(`div`,{"data-testid":`work-git-review`,dir:`ltr`,className:`min-h-0 flex-1 overflow-auto bg-surface font-mono text-[12px] leading-5`,children:[A?.truncated&&(0,W.jsx)(`p`,{className:`border-b border-line bg-surface-subtle/70 px-3 py-1.5 text-center font-sans text-[11px] text-ink-subtle`,children:r(`work.git.diffTruncated`,{defaultValue:`This diff is truncated.`})}),pe.map(e=>(0,W.jsxs)(`div`,{"data-testid":`work-git-review-file`,children:[(0,W.jsx)(Gt,{letter:Vt(e.status),path:e.path,oldPath:e.oldPath,added:e.stats.added,removed:e.stats.removed}),e.binary?(0,W.jsx)(`p`,{className:`px-5 py-6 text-center font-sans text-xs text-ink-muted`,children:r(`work.git.binaryFile`,{defaultValue:`Binary file, no text diff.`})}):(0,W.jsx)(Ot,{lines:e.lines})]},e.path)),fe.map(e=>(0,W.jsx)(`div`,{"data-testid":`work-git-review-file`,children:(0,W.jsxs)(`button`,{type:`button`,onClick:()=>void oe(e),title:e.path,className:`flex w-full items-center gap-2 border-b border-line px-3 py-1.5 text-start hover:bg-surface-subtle`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,className:`w-4 shrink-0 text-center font-mono text-[11px] font-semibold text-[rgb(46,164,79)]`,children:`U`}),(0,W.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-ink`,children:e.path}),(0,W.jsx)(y,{className:`h-3 w-3 shrink-0 text-ink-subtle`})]})},e.path)),pe.length===0&&fe.length===0&&(0,W.jsx)(`p`,{className:`px-5 py-10 text-center font-sans text-xs text-ink-muted`,children:R?r(`work.git.noFilterMatches`,{defaultValue:`No changed files match this filter.`}):r(`work.git.selectChange`,{defaultValue:`Select a changed file to inspect its diff.`})})]})})]})]})}var qt=`/ws/work-terminal`;function Jt(e,t){let n;if(t.protocol===`file:`)n=`ws://localhost:3001`;else if(t.apiBaseUrl)n=t.apiBaseUrl.replace(/\/api$/,``).replace(/^http:/,`ws:`).replace(/^https:/,`wss:`);else{let e=t.protocol===`https:`?`wss:`:`ws:`;n=t.production?`${e}//${t.host}`:`${e}//${t.hostname}:3001`}let r=new URL(`${n}${qt}`);return r.searchParams.set(`taskId`,e),t.token&&r.searchParams.set(`token`,t.token),r.toString()}function Yt(e){return Jt(e,{protocol:window.location.protocol,host:window.location.host,hostname:window.location.hostname,apiBaseUrl:void 0,production:!0,token:localStorage.getItem(`auth-token`)})}var Xt={background:`#ffffff`,foreground:`#1f2328`,cursor:`#1f2328`,selectionBackground:`rgba(255, 123, 82, 0.28)`},Zt={background:`#0f1115`,foreground:`#e6e6e6`,cursor:`#ff7b52`,selectionBackground:`rgba(255, 123, 82, 0.32)`};function Qt({taskId:e,active:t,disabledReason:n}){let{t:r}=c(),i=ye(e=>e.theme.mode===`dark`),o=(0,U.useRef)(null),s=(0,U.useRef)(null),u=(0,U.useRef)(null),d=(0,U.useRef)(null),[f,m]=(0,U.useState)(`idle`),[h,g]=(0,U.useState)(null),[_,v]=(0,U.useState)(0),y=(0,U.useCallback)(()=>{let e=d.current,t=u.current,n=s.current;if(!(!e||!t||!n||n.readyState!==WebSocket.OPEN)){try{e.fit()}catch{return}n.send(JSON.stringify({type:`resize`,cols:t.cols,rows:t.rows}))}},[]);(0,U.useEffect)(()=>{if(!t||n)return;let r=!1,c,l;return(async()=>{m(`connecting`),g(null);let[{Terminal:t},{FitAddon:n}]=await Promise.all([a(()=>import(`./xterm-Da5ppSVt.js`),[]),a(()=>import(`./addon-fit-DIOBYJe3.js`),[])]);if(await a(()=>Promise.resolve({}),__vite__mapDeps([32])),r||!o.current)return;c=new t({allowProposedApi:!0,convertEol:!1,cursorBlink:!0,fontFamily:`ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace`,fontSize:12,scrollback:5e3,theme:i?Zt:Xt});let f=new n;c.loadAddon(f),c.open(o.current),u.current=c,d.current=f;try{f.fit()}catch{}l=new WebSocket(Yt(e)),l.binaryType=`arraybuffer`,s.current=l;let p=new TextDecoder;l.onmessage=e=>{if(typeof e.data!=`string`){c?.write(p.decode(new Uint8Array(e.data)));return}try{let t=JSON.parse(e.data);if(t.type===`ready`){m(`connected`),y(),c?.focus();return}if(t.type===`error`){m(`error`),g(t.message||null);return}t.type===`exit`&&m(`closed`)}catch{}},l.onclose=()=>{r||m(e=>e===`error`||e===`closed`?e:`closed`)},l.onerror=()=>{r||m(`error`)},c.onData(e=>{l?.readyState===WebSocket.OPEN&&l.send(JSON.stringify({type:`input`,data:e}))})})(),()=>{r=!0,l?.close(),s.current=null,c?.dispose(),u.current=null,d.current=null}},[t,n,_,i,y,e]),(0,U.useEffect)(()=>{let e=o.current;if(!e||!t)return;let n=new ResizeObserver(()=>y());return n.observe(e),()=>n.disconnect()},[t,y]);let b=()=>{s.current?.close(),v(e=>e+1)},x=n??(f===`error`?h??r(`work.terminal.failed`,{defaultValue:`The terminal session could not start.`}):f===`closed`?r(`work.terminal.closed`,{defaultValue:`Terminal session ended.`}):null);return(0,W.jsxs)(`div`,{"data-testid":`work-terminal-panel`,"data-status":n?`unavailable`:f,className:`relative flex min-h-0 flex-1 flex-col bg-surface`,children:[!n&&(0,W.jsx)(`div`,{ref:o,"data-testid":`work-terminal-surface`,dir:`ltr`,className:l(`min-h-0 flex-1 overflow-hidden p-2 text-left`,f!==`connected`&&`opacity-60`)}),f===`connecting`&&!n&&(0,W.jsxs)(`div`,{className:`pointer-events-none absolute inset-0 flex items-center justify-center gap-2 text-xs text-ink-muted`,children:[(0,W.jsx)(P,{className:`h-4 w-4 animate-spin`}),r(`work.terminal.connecting`,{defaultValue:`Opening a shell in the sandbox…`})]}),x&&(0,W.jsxs)(`div`,{role:f===`error`?`alert`:void 0,className:`flex flex-col items-center gap-3 border-t border-line bg-surface-raised px-6 py-4 text-center`,children:[(0,W.jsx)(p,{className:`h-6 w-6 text-ink-subtle`}),(0,W.jsx)(`p`,{dir:`auto`,"data-testid":`work-terminal-status`,className:`max-w-md text-xs leading-relaxed text-ink-muted`,children:x}),!n&&(0,W.jsx)(B,{size:`sm`,"data-testid":`work-terminal-reconnect-button`,className:`h-8 rounded-lg bg-[#ff7b52] px-3 text-[#3d120c] hover:bg-[#ff7b52]/90`,onClick:b,children:r(`work.terminal.reconnect`,{defaultValue:`Reconnect`})})]})]})}var $t=e=>{if(!e)return null;if(/^\/api\/work\/previews\/[A-Za-z0-9-]{1,100}\/\d{1,5}\.[A-Za-z0-9_-]{22}\.[A-Za-z0-9_-]{43}\//.test(e))try{let t=new URL(de,window.location.origin).origin;return new URL(e,`${t}/`).toString()}catch{return null}return null},en=e=>{let t=e.split(`/`).filter(Boolean);return t.pop(),t.join(`/`)},tn=(e,t)=>{let n=e.metadata?.name??e.metadata?.toolName??e.metadata?.tool??e.metadata?.command;return typeof n==`string`&&n?n:t};function nn({task:e,liveRun:t,files:n,selectedFile:r,loadingFiles:i,actionLoading:a,onLoadFiles:o,onLoadFile:s,onClearSelectedFile:d,onSaveFile:f,onStartPreview:_,onStopPreview:v,onDirtyChange:y,terminal:b}){let{t:S,i18n:T}=c(),D=u(T.language),[O,ne]=(0,U.useState)(`files`),[k,A]=(0,U.useState)(``),[j,M]=(0,U.useState)(``),[F,ae]=(0,U.useState)(),[oe,I]=(0,U.useState)(``),[L,se]=(0,U.useState)(!1),[R,de]=(0,U.useState)(!1),z=(0,U.useRef)(new Map),[fe,pe]=(0,U.useState)(()=>new Map),he=$t(e.previewUrl),ge=t?.runId,ye=t?.error,be=t?.tools,xe=(0,U.useMemo)(()=>{let t=new Set(be?.map(e=>e.id)||[]);return(e.messages||[]).filter(e=>{if(e.kind===`reasoning`||e.role!==`tool`&&e.kind===`message`)return!1;if(!ge||e.runId!==ge)return!0;if(e.kind===`error`&&ye)return!1;let n=e.metadata?.toolCallId;return typeof n!=`string`||!t.has(n)})},[ye,ge,be,e.messages]),Se=xe.length+(be?.length||0),Ce=!!r&&j!==(r?.content??``),V=e.status===`preparing`||e.status===`running`,we=(0,U.useRef)(V),H=(0,U.useRef)(0),G=(0,U.useRef)(j),K=(0,U.useRef)(F),Te=(0,U.useRef)(r),Ee=(0,U.useRef)(e.id),De=(0,U.useRef)(o),Oe=(0,U.useRef)(s),ke=(0,U.useRef)(y),q=(0,U.useRef)(!0),J=r?fe.get(r.path):void 0,Ae=(0,U.useMemo)(()=>r&&J!==void 0&&J!==r.content?xt(J,r.content):null,[J,r]),je=(0,U.useMemo)(()=>Ae?Ct(Ae):null,[Ae]),Me=!!(je&&(je.added>0||je.removed>0)),Ne=r?ut(r.path):!1,Fe=!r||dt(j),Y=Ne&&Fe;(0,U.useEffect)(()=>{G.current=j,K.current=F,Te.current=r,Ee.current=e.id,ke.current=y},[F,j,y,r,e.id]),(0,U.useEffect)(()=>{De.current=o,Oe.current=s},[s,o]),(0,U.useEffect)(()=>(q.current=!0,()=>{q.current=!1,H.current+=1,ke.current(!1)}),[]),(0,U.useEffect)(()=>{if(!we.current&&V&&pe(new Map(z.current)),we.current&&!V&&(De.current(k),r&&!Ce)){let e=++H.current,t=r.path,n=G.current,i=K.current;Oe.current(t).then(r=>{if(!q.current||e!==H.current||r.path!==t||G.current!==n||K.current!==i)return;z.current.set(r.path,r.content);let a=fe.get(r.path);a!==void 0&&a!==r.content&&de(!0),G.current=r.content,K.current=r.updatedAt??r.modifiedAt,M(r.content),ae(r.updatedAt??r.modifiedAt)}).catch(()=>void 0)}we.current=V},[k,Ce,r,V,fe]);let Ie=()=>!Ce||window.confirm(S(`work.files.discard`,{defaultValue:`Discard unsaved file changes?`})),Le=()=>{r&&me(e.id,r.path)},Re=async e=>{Ie()&&(H.current+=1,Le(),d(),y(!1),de(!1),A(e),await o(e).catch(()=>void 0))},ze=async t=>{if(!Ie())return;let n=++H.current;Le();let r=await s(t).catch(()=>void 0);if(!q.current||!r||n!==H.current)return;z.current.set(r.path,r.content);let i=fe.get(r.path);de(i!==void 0&&i!==r.content);let a=_e(e.id,r.path),o=a?.content??r.content,c=a?.baseUpdatedAt??r.updatedAt??r.modifiedAt;G.current=o,K.current=c,M(o),ae(c),y(a!==null&&a.content!==r.content)},Be=()=>{Ie()&&(H.current+=1,Le(),d(),y(!1),de(!1))},Ve=t=>{r&&(G.current=t,M(t),t===r.content?me(e.id,r.path):ve(e.id,r.path,{content:t,baseUpdatedAt:F??r.updatedAt??r.modifiedAt}),y(t!==r.content))},He=async()=>{if(!r)return;let t=e.id,n=r.path,i=j,a=H.current,o=await f(n,i,F).catch(()=>!1);if(!q.current||o===!1||a!==H.current||Ee.current!==t||Te.current?.path!==n)return;let s=o.updatedAt??o.modifiedAt;z.current.set(n,typeof o.content==`string`?o.content:i),K.current=s,ae(s);let c=G.current;if(c===i){me(t,n),y(!1);return}ve(t,n,{content:c,baseUpdatedAt:s}),y(!0)},Ue=async()=>{if(!r||V||L||!Y)return;se(!0);let e=H.current,t=r.path,n=G.current;try{let r=await pt(t,n);if(!q.current||e!==H.current||Te.current?.path!==t||G.current!==n)return;Ve(r),h.success(S(`work.files.formatted`,{defaultValue:`Code formatted.`}))}catch(r){if(!q.current||e!==H.current||Te.current?.path!==t||G.current!==n)return;h.error(r instanceof Error?r.message:S(`work.files.formatFailed`,{defaultValue:`Could not format this file.`}))}finally{q.current&&se(!1)}},X=[{id:`files`,label:S(`work.workspace.files`,{defaultValue:`Files`}),icon:C,testId:`work-files-tab`},{id:`activity`,label:S(`work.workspace.activity`,{defaultValue:`Activity`}),icon:m,testId:`work-activity-tab`},{id:`git`,label:S(`work.workspace.git`,{defaultValue:`Git`}),icon:E,testId:`work-git-tab`},{id:`terminal`,label:S(`work.workspace.terminal`,{defaultValue:`Terminal`}),icon:p,testId:`work-terminal-tab`},{id:`preview`,label:S(`work.workspace.preview`,{defaultValue:`Preview`}),icon:re,testId:`work-preview-tab`}],We=(e,t)=>{let n=null;if(e.key===`ArrowRight`&&(n=(t+(D?-1:1)+X.length)%X.length),e.key===`ArrowLeft`&&(n=(t+(D?1:-1)+X.length)%X.length),e.key===`Home`&&(n=0),e.key===`End`&&(n=X.length-1),n===null)return;e.preventDefault();let r=X[n];ne(r.id),e.currentTarget.parentElement?.querySelector(`#work-workspace-tab-${r.id}`)?.focus()};return(0,W.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col bg-transparent`,children:[(0,W.jsxs)(`div`,{"data-testid":`work-workspace-toolbar`,className:`flex h-12 shrink-0 items-center gap-2 border-b border-line bg-surface-raised/75 px-2 backdrop-blur-xl`,children:[(0,W.jsx)(`div`,{role:`tablist`,"aria-orientation":`horizontal`,"aria-label":S(`work.workspace.label`,{defaultValue:`Workspace views`}),className:`flex min-w-0 items-center overflow-x-auto rounded-xl border border-line bg-surface-subtle p-0.5 [-ms-overflow-style:none] [scrollbar-width:none] [&::-webkit-scrollbar]:hidden`,children:X.map((e,t)=>{let n=e.icon;return(0,W.jsxs)(`button`,{type:`button`,role:`tab`,id:`work-workspace-tab-${e.id}`,"aria-selected":O===e.id,"aria-controls":O===e.id?`work-workspace-panel-${e.id}`:void 0,"aria-label":e.label,tabIndex:O===e.id?0:-1,title:e.label,"data-testid":e.testId,onClick:()=>ne(e.id),onKeyDown:e=>We(e,t),className:l(`flex h-7 items-center gap-1.5 rounded-lg px-2 text-[11px] font-medium transition-[background-color,color,box-shadow]`,O===e.id?`bg-surface-raised text-ink shadow-subtle`:`text-ink-muted hover:text-ink`),children:[(0,W.jsx)(n,{className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`hidden xs:inline`,children:e.label}),e.id===`activity`&&Se>0&&(0,W.jsx)(`span`,{className:`rounded-full bg-surface px-1.5 text-[10px] text-ink-muted`,children:Se})]},e.id)})}),O===`files`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-1.5`,children:[r&&(0,W.jsx)(`button`,{type:`button`,className:`inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-lg text-ink-muted hover:bg-surface-subtle hover:text-ink sm:hidden`,onClick:Be,"aria-label":S(`work.files.back`,{defaultValue:`Back to files`}),children:(0,W.jsx)(ue,{className:`h-3.5 w-3.5 rtl:rotate-180`})}),(0,W.jsxs)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-ink-muted`,title:r?.path??`/workspace${k?`/${k}`:``}`,children:[r?.path??`/workspace${k?`/${k}`:``}`,Ce&&` •`]})]}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[(0,W.jsx)(`button`,{type:`button`,disabled:!k,onClick:()=>void Re(en(k)),className:l(`hidden h-8 w-8 items-center justify-center rounded-lg border border-transparent text-ink-muted hover:border-line hover:bg-surface-subtle hover:text-ink disabled:opacity-30 sm:inline-flex`,!r&&`inline-flex`),"aria-label":S(`work.files.up`,{defaultValue:`Parent folder`}),title:S(`work.files.up`,{defaultValue:`Parent folder`}),children:(0,W.jsx)(ue,{className:`h-3.5 w-3.5 rtl:rotate-180`})}),(0,W.jsx)(`button`,{type:`button`,"data-testid":`work-refresh-files-button`,onClick:()=>void o(k).catch(()=>void 0),className:`inline-flex h-8 w-8 items-center justify-center rounded-lg border border-transparent text-ink-muted hover:border-line hover:bg-surface-subtle hover:text-ink`,"aria-label":S(`common.refresh`,{defaultValue:`Refresh`}),title:S(`common.refresh`,{defaultValue:`Refresh`}),children:(0,W.jsx)(w,{className:l(`h-3.5 w-3.5`,i&&`animate-spin`)})}),r&&Me&&je&&(0,W.jsxs)(`button`,{type:`button`,"data-testid":`work-diff-toggle-button`,"aria-pressed":R,onClick:()=>de(e=>!e),title:S(`work.files.changesSince`,{defaultValue:`What changed since the last turn`}),className:l(`inline-flex h-8 items-center gap-1.5 rounded-lg border px-2 text-[11px] font-medium transition-colors`,R?`border-transparent bg-ink text-ink-inverse`:`border-line text-ink-muted hover:bg-surface-subtle hover:text-ink`),children:[(0,W.jsx)(ce,{className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`hidden sm:inline`,children:S(`work.files.changes`,{defaultValue:`Changes`})}),(0,W.jsxs)(`span`,{dir:`ltr`,className:`tabular-nums`,children:[(0,W.jsxs)(`span`,{className:R?void 0:`text-[rgb(46,164,79)]`,children:[`+`,je.added]}),` `,(0,W.jsxs)(`span`,{className:R?void 0:`text-[rgb(255,61,129)]`,children:[`−`,je.removed]})]})]}),r&&!R&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsxs)(B,{"data-testid":`work-format-file-button`,size:`sm`,variant:`ghost`,className:`h-8 w-8 rounded-lg px-0 sm:w-auto sm:px-2.5`,disabled:V||L||!Y,onClick:()=>void Ue(),"aria-busy":L||void 0,title:Y?S(`work.files.formatShortcut`,{defaultValue:`Format (Shift+Alt+F)`}):Ne?S(`work.files.formatTooLarge`,{defaultValue:`Formatting is limited to files under 100,000 characters and 4,000 lines.`}):S(`work.files.formatUnsupported`,{defaultValue:`Formatting is not available for this file type.`}),"aria-label":S(`work.files.format`,{defaultValue:`Format file`}),children:[L?(0,W.jsx)(P,{className:`h-3.5 w-3.5 animate-spin`}):(0,W.jsx)(ie,{className:`h-3.5 w-3.5`}),(0,W.jsx)(`span`,{className:`hidden 2xl:inline`,children:S(`work.files.format`,{defaultValue:`Format`})})]}),(0,W.jsxs)(B,{"data-testid":`work-save-file-button`,size:`sm`,className:`h-8 w-8 rounded-lg bg-[#ff7b52] px-0 text-[#3d120c] hover:bg-[#ff7b52]/90 sm:w-auto sm:px-2.5`,disabled:!Ce||V||L||a,onClick:()=>void He(),"aria-busy":a||void 0,title:S(`work.files.saveShortcut`,{defaultValue:`Save (⌘/Ctrl+S)`}),"aria-label":S(`common.save`),children:[a?(0,W.jsx)(P,{className:`h-3.5 w-3.5 animate-spin`}):(0,W.jsx)(g,{className:`h-3.5 w-3.5`}),(0,W.jsx)(`span`,{className:`hidden 2xl:inline`,children:S(`common.save`)})]})]})]})]}),(O===`activity`||O===`git`)&&(0,W.jsx)(`div`,{className:`min-w-0 flex-1`}),O===`terminal`&&(0,W.jsxs)(`div`,{className:`flex min-w-0 flex-1 items-center gap-2`,children:[(0,W.jsx)(`span`,{dir:`ltr`,className:`min-w-0 flex-1 truncate font-mono text-[11px] text-ink-muted`,children:`/workspace`}),V&&(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] text-ink-subtle`,children:S(`work.terminal.taskRunning`,{defaultValue:`Model turn in progress`})})]}),O===`preview`&&(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(`input`,{dir:`auto`,value:oe,onChange:e=>I(e.target.value),placeholder:S(`work.preview.command`,{defaultValue:`Optional start command`}),"aria-label":S(`work.preview.command`,{defaultValue:`Optional start command`}),className:`h-8 min-w-0 flex-1 rounded-lg border border-line bg-surface px-2.5 font-mono text-[11px] text-ink outline-none placeholder:text-ink-subtle focus:border-primary-500`}),(0,W.jsxs)(`div`,{className:`flex shrink-0 items-center gap-1`,children:[e.previewStatus===`running`||e.previewStatus===`starting`?(0,W.jsxs)(B,{"data-testid":`work-stop-preview-button`,variant:`danger`,size:`sm`,className:`h-8 w-8 rounded-lg px-0 sm:w-auto sm:px-2.5`,disabled:a,onClick:()=>void v(),"aria-busy":a||void 0,"aria-label":S(`work.preview.stop`,{defaultValue:`Stop preview`}),children:[a?(0,W.jsx)(P,{className:`h-3.5 w-3.5 animate-spin`}):(0,W.jsx)(le,{className:`h-3.5 w-3.5 fill-current`}),(0,W.jsx)(`span`,{className:`hidden 2xl:inline`,children:S(`work.preview.stop`,{defaultValue:`Stop preview`})})]}):(0,W.jsxs)(B,{"data-testid":`work-start-preview-button`,size:`sm`,className:`h-8 w-8 rounded-lg bg-[#ff7b52] px-0 text-[#3d120c] hover:bg-[#ff7b52]/90 sm:w-auto sm:px-2.5`,disabled:a,onClick:()=>void _(oe.trim()||void 0),"aria-busy":a||void 0,"aria-label":S(`work.preview.start`,{defaultValue:`Start preview`}),children:[a?(0,W.jsx)(P,{className:`h-3.5 w-3.5 animate-spin`}):(0,W.jsx)(ee,{className:`h-3.5 w-3.5 fill-current`}),(0,W.jsx)(`span`,{className:`hidden 2xl:inline`,children:S(`work.preview.start`,{defaultValue:`Start preview`})})]}),he&&(0,W.jsx)(`a`,{href:he,target:`_blank`,rel:`noopener noreferrer`,"aria-label":S(`work.preview.open`,{defaultValue:`Open`}),title:S(`work.preview.open`,{defaultValue:`Open`}),className:`inline-flex h-8 w-8 items-center justify-center rounded-lg border border-line text-ink-muted hover:bg-surface-subtle hover:text-ink`,children:(0,W.jsx)(te,{className:`h-3.5 w-3.5`})})]})]})]}),O===`files`&&(0,W.jsxs)(`div`,{id:`work-workspace-panel-files`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-files`,className:`flex min-h-0 flex-1`,children:[(0,W.jsx)(`div`,{className:l(`flex min-h-0 w-full flex-col border-e border-line bg-surface-raised`,r?`hidden sm:flex sm:w-52 xl:w-60`:`flex`),children:(0,W.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto p-1.5`,children:i&&n.length===0?(0,W.jsx)(`div`,{className:`flex justify-center py-8 text-ink-muted`,children:(0,W.jsx)(P,{className:`h-5 w-5 animate-spin`})}):n.length===0?(0,W.jsx)(`p`,{className:`px-3 py-8 text-center text-xs text-ink-muted`,children:S(`work.files.empty`,{defaultValue:`No files in this folder yet.`})}):[...n].sort((e,t)=>e.type===t.type?e.name.localeCompare(t.name):e.type===`directory`?-1:1).map(e=>(0,W.jsxs)(`button`,{type:`button`,"data-testid":`work-file-item`,"data-path":e.path,onClick:()=>{e.type===`directory`?Re(e.path):ze(e.path)},className:l(`flex w-full items-center gap-2 rounded-lg px-2 py-1.5 text-start text-xs hover:bg-surface-subtle`,r?.path===e.path?`bg-surface-subtle text-ink`:`text-ink-muted`),children:[e.type===`directory`?(0,W.jsx)(N,{className:`h-3.5 w-3.5 shrink-0 text-amber-500`}):(0,W.jsx)(x,{className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{dir:`auto`,className:`truncate`,children:e.name})]},e.path))})}),(0,W.jsx)(`div`,{className:l(`min-h-0 min-w-0 flex-1 flex-col`,r?`flex`:`hidden sm:flex`),children:r&&R&&Ae?(0,W.jsx)(kt,{lines:Ae,ariaLabel:S(`work.files.diffLabel`,{path:r.path,defaultValue:`Changes since the last turn: {{path}}`})}):r?(0,W.jsx)(vt,{path:r.path,value:j,ariaLabel:S(`work.files.editorLabel`,{path:r.path,defaultValue:`File editor: {{path}}`}),onChange:Ve,onSaveShortcut:()=>{Ce&&!V&&!a&&!L&&He()},onFormatShortcut:()=>void Ue(),disabled:V||L}):(0,W.jsxs)(`div`,{className:`m-auto px-6 text-center text-xs text-ink-muted`,children:[(0,W.jsx)(x,{className:`mx-auto mb-3 h-7 w-7 text-ink-subtle`}),S(`work.files.select`,{defaultValue:`Select a file to inspect and edit it.`})]})})]}),O===`activity`&&(0,W.jsxs)(`div`,{id:`work-workspace-panel-activity`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-activity`,className:`min-h-0 flex-1 overflow-y-auto p-3`,children:[t&&(0,W.jsx)(`div`,{className:`mb-3`,children:(0,W.jsx)(Pe,{run:t,variant:`activity`})}),xe.length===0&&!t?(0,W.jsxs)(`div`,{className:`flex h-full flex-col items-center justify-center px-6 text-center text-xs text-ink-muted`,children:[(0,W.jsx)(p,{className:`mb-3 h-7 w-7 text-ink-subtle`}),S(`work.activity.empty`,{defaultValue:`Commands, file operations, and tool results will appear here.`})]}):(0,W.jsx)(`div`,{className:`space-y-2`,children:xe.map(e=>(0,W.jsxs)(`div`,{className:`rounded-xl border border-line bg-surface p-3`,children:[(0,W.jsxs)(`div`,{className:`flex items-center justify-between gap-2`,children:[(0,W.jsx)(`span`,{dir:`auto`,className:`truncate font-mono text-xs font-medium text-ink`,children:tn(e,S(`work.activity.toolActivity`,{defaultValue:`Tool activity`}))}),(0,W.jsx)(`span`,{className:`shrink-0 text-[10px] uppercase tracking-wide text-ink-subtle rtl:tracking-normal`,children:{message:S(`work.activity.kinds.message`,{defaultValue:`Message`}),reasoning:S(`libreClaw.metrics.reasoning`,{defaultValue:`Reasoning`}),tool_call:S(`work.activity.kinds.toolCall`,{defaultValue:`Tool call`}),tool_result:S(`work.activity.kinds.toolResult`,{defaultValue:`Tool result`}),error:S(`work.activity.kinds.error`,{defaultValue:`Error`})}[e.kind]})]}),e.content&&(0,W.jsx)(`pre`,{dir:`ltr`,className:`mt-2 max-h-56 overflow-auto whitespace-pre-wrap break-words text-left font-mono text-[11px] leading-relaxed text-ink-muted`,children:e.content})]},e.id))})]}),O===`git`&&(0,W.jsx)(`div`,{id:`work-workspace-panel-git`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-git`,className:`min-h-0 flex-1`,children:(0,W.jsx)(Kt,{taskId:e.id,mutationsDisabled:V||e.previewStatus===`starting`||e.previewStatus===`running`,disabledReason:V?S(`work.git.blockedByRun`,{defaultValue:`Git write actions unlock when the model turn finishes.`}):e.previewStatus===`starting`||e.previewStatus===`running`?S(`work.git.blockedByPreview`,{defaultValue:`Stop the preview before changing Git state.`}):void 0})}),O===`terminal`&&(0,W.jsx)(`div`,{id:`work-workspace-panel-terminal`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-terminal`,className:`flex min-h-0 flex-1 flex-col`,children:(0,W.jsx)(Qt,{taskId:e.id,active:O===`terminal`,disabledReason:b&&!b.available?b.reason??S(`work.terminal.unavailable`,{defaultValue:`The interactive terminal is not available in this deployment.`}):V?S(`work.terminal.blockedByRun`,{defaultValue:`The model is using this container. The terminal opens when the turn finishes.`}):void 0})}),O===`preview`&&(0,W.jsx)(`div`,{id:`work-workspace-panel-preview`,role:`tabpanel`,"aria-labelledby":`work-workspace-tab-preview`,className:`flex min-h-0 flex-1 flex-col`,children:e.previewStatus===`starting`?(0,W.jsxs)(`div`,{className:`m-auto flex items-center gap-2 text-xs text-ink-muted`,children:[(0,W.jsx)(P,{className:`h-4 w-4 animate-spin`}),S(`work.preview.starting`,{defaultValue:`Starting preview…`})]}):he&&e.previewStatus===`running`?(0,W.jsx)(`iframe`,{"data-testid":`work-preview-frame`,title:S(`work.preview.frameTitle`,{defaultValue:`Workspace preview`}),src:he,sandbox:`allow-scripts allow-forms allow-modals allow-downloads`,referrerPolicy:`no-referrer`,className:`min-h-0 flex-1 border-0 bg-white`}):(0,W.jsxs)(`div`,{className:`m-auto max-w-sm px-6 text-center text-xs leading-relaxed text-ink-muted`,children:[(0,W.jsx)(re,{className:`mx-auto mb-3 h-8 w-8 text-ink-subtle`}),e.previewStatus===`failed`?S(`work.preview.failed`,{defaultValue:`The preview could not start. Check Activity, then try another command.`}):S(`work.preview.empty`,{defaultValue:`Start the app inside this workspace to inspect it here.`})]})})]})}var rn=e=>{let t=e.trim().toLowerCase();return!!t&&!t.includes(`embed`)},an=(e,t)=>e instanceof Error&&e.message?e.message:t,on=(e,t)=>new Promise(n=>{if(t.aborted){n();return}let r,i=()=>{r!==void 0&&window.clearTimeout(r),t.removeEventListener(`abort`,i),n()};r=window.setTimeout(i,e),t.addEventListener(`abort`,i,{once:!0})});function sn(){let{t:e}=c(),t=s(),n=r(),{taskId:a}=i(),u=ye(e=>e.preferences),f=ye(e=>e.setPreferences),p=ge(e=>e.user),m=p?.id??null,[g,v]=(0,U.useState)(!1),y=d(e=>e.models),b=d(e=>e.selectedModel),x=d(e=>e.selectedProviderType),S=d(e=>e.selectedProviderId),C=d(e=>e.loadModels),{capabilities:w,tasks:T,selectedTask:E,files:ee,selectedFile:te,liveRuns:O,loadingTask:k,loadingOlderMessages:j,loadingFiles:ie,actionLoading:N,error:P,loadCapabilities:oe,loadTasks:I,selectTask:se,loadTask:R,loadOlderMessages:ce,createTask:le,updateTask:ue,deleteTask:de,startRun:_e,cancelRun:ve,beginLiveRun:B,applyRunEvents:be,setLiveRunConnection:Se,clearLiveRun:Ce,loadFiles:V,loadFile:G,clearSelectedFile:K,saveFile:Te,startPreview:De,stopPreview:Oe,clearError:ke}=he(),q=(0,U.useMemo)(()=>y.filter(e=>!e.isPersona&&!e.isAgent&&rn(e.name)&&(!e.isPlugin||!!e.pluginId)),[y]),J=(0,U.useMemo)(()=>q.flatMap(e=>{if(e.isPlugin&&!e.pluginId)return[];let t=e.isPlugin?`plugin`:`ollama`,n=e.isPlugin?e.pluginId:void 0,r=e.name.trim().toLowerCase(),i={model:e.name,providerType:t,providerId:n};return[{...i,key:we(i),label:e.isPlugin&&e.pluginName?`${e.name} · ${e.pluginName}`:e.name,remote:e.isPlugin||r.endsWith(`:cloud`)||r.endsWith(`-cloud`)}]}),[q]),[Ae,je]=(0,U.useState)(``),[Me,Ne]=(0,U.useState)({locationKey:t.key,value:`conversation`}),Pe=Me.locationKey===t.key?Me.value:`conversation`,Fe=e=>Ne({locationKey:t.key,value:e}),[Y,Ie]=(0,U.useState)(!1),[Le,Re]=(0,U.useState)(``),ze=w?.hostWorkspaces?.enabled===!0,Ve=w?.hostWorkspaces?.roots??[],[He,Ue]=(0,U.useState)([]),[X,We]=(0,U.useState)(``),Ge=!E;(0,U.useEffect)(()=>{if(!Ge)return;let e=!1;return z.listPolicies().then(t=>{if(e||!t.success||!t.data)return;let n=t.data;Ue(n),We(e=>e&&!n.some(t=>t.id===e)?``:e)}).catch(()=>{}),()=>{e=!0}},[Ge]);let Ke=E?.id,qe=E?.previewStatus===`running`||E?.previewStatus===`starting`;(0,U.useEffect)(()=>{if(!Ke||!qe)return;let e=window.setInterval(()=>{document.visibilityState===`visible`&&R(Ke,!0).catch(()=>{})},3e4);return()=>window.clearInterval(e)},[Ke,qe,R]);let[Je,Ye]=(0,U.useState)({taskId:null,open:!1}),Xe=Je.open&&Je.taskId===E?.id,Ze=(0,U.useRef)(null),Qe=(0,U.useRef)(null),$e=(0,U.useRef)(null),et=(0,U.useCallback)((e=!1)=>{Ye(e=>({...e,open:!1})),e&&window.requestAnimationFrame(()=>Qe.current?.focus())},[]);(0,U.useEffect)(()=>{if(!Xe)return;let e=window.requestAnimationFrame(()=>{$e.current?.querySelector(`[role="menuitem"]`)?.focus()}),t=e=>{e.target instanceof Node&&!Ze.current?.contains(e.target)&&et()},n=e=>{e.key===`Escape`&&(e.preventDefault(),et(!0))};return document.addEventListener(`pointerdown`,t),document.addEventListener(`keydown`,n),()=>{window.cancelAnimationFrame(e),document.removeEventListener(`pointerdown`,t),document.removeEventListener(`keydown`,n)}},[et,Xe]);let nt=e=>{if(e.key===`Escape`){e.preventDefault(),e.stopPropagation(),et(!0);return}if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`&&e.key!==`Home`&&e.key!==`End`)return;let t=[...$e.current?.querySelectorAll(`[role="menuitem"]:not(:disabled)`)??[]];if(t.length===0)return;e.preventDefault();let n=t.indexOf(document.activeElement);t[e.key===`Home`?0:e.key===`End`?t.length-1:e.key===`ArrowUp`?(n-1+t.length)%t.length:(n+1)%t.length]?.focus()};(0,U.useEffect)(()=>{oe(),I()},[oe,I]),(0,U.useEffect)(()=>{if(!a){se(null);return}se(a),R(a).catch(()=>void 0),V(a,``).catch(()=>void 0)},[a,V,R,se]);let rt=J.find(e=>e.key===Ae)||J.find(e=>e.model===b&&(x===`plugin`?e.providerType===`plugin`&&e.providerId===S:e.providerType===`ollama`))||J[0],it=a?T.find(e=>e.id===a):void 0,at=it?.status??E?.status,ot=E?.activeRun??it?.activeRun??null,Z=ot?.id,st=ot?.status===`queued`||ot?.status===`preparing`||ot?.status===`running`,ct=a&&O[a]?.runId===Z?O[a]:void 0,lt=at===`preparing`||at===`running`?1e3:4e3;(0,U.useEffect)(()=>{let e,t=!1,n=async()=>{await I(!0),t||(e=setTimeout(n,lt))};return e=setTimeout(n,lt),()=>{t=!0,e&&clearTimeout(e)}},[I,lt]);let ut=(0,U.useRef)(null);(0,U.useEffect)(()=>{if(!a||!at){ut.current=null;return}let e=ut.current;ut.current={taskId:a,status:at},e?.taskId===a&&(e.status===`preparing`||e.status===`running`)&&at!==`preparing`&&at!==`running`&&(R(a,!0).catch(()=>void 0),V(a,``).catch(()=>void 0))},[V,R,at,a]),(0,U.useEffect)(()=>{if(!a||!Z||!st)return;let e=new AbortController,t=!1,n=0,r=he.getState().liveRuns[a]?.runId===Z&&he.getState().liveRuns[a]?.lastEventId||0,i=!1,o=[],s=null,c=()=>{if(s!==null&&(window.cancelAnimationFrame(s),s=null),o.length===0)return;let e=o;o=[],be(e)},l=e=>{if(e.type!==`snapshot`&&(n=0),r=Math.max(r,e.id),o.push(e),e.type===`done`||e.type===`error`&&e.data.terminal!==!1){i=!0,c();return}s===null&&(s=window.requestAnimationFrame(c))};return B(a,Z,ot?.startedAt||void 0),(async()=>{for(;!t&&!e.signal.aborted&&!i;){Se(a,Z,n>=3?`error`:n===0?`connecting`:`reconnecting`);let o=Date.now();try{if(await z.streamRunEvents({taskId:a,runId:Z,after:r,signal:e.signal,onEvent:l}),c(),i||t||e.signal.aborted)break;throw Error(`The live Work connection closed.`)}catch(r){if(c(),t||e.signal.aborted)return;Date.now()-o>=5e3&&(n=0),n+=1,Se(a,Z,n>=3?`error`:`reconnecting`,n>=3?an(r,`Live updates are reconnecting in the background.`):void 0),await on(Math.min(4e3,250*2**Math.min(n,4)),e.signal)}}if(c(),!(!i||e.signal.aborted)){Se(a,Z,`closed`);try{await Promise.all([R(a,!0),V(a,``),I(!0)])}catch{}finally{Ce(a,Z)}}})(),()=>{t=!0,e.abort(),c()}},[be,B,Ce,V,R,I,ot?.startedAt,st,Z,Se,a]),(0,U.useEffect)(()=>{if(!Y)return;let e=e=>{e.preventDefault()};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[Y]);let dt=(0,U.useCallback)(()=>!Y||window.confirm(e(`work.files.discard`,{defaultValue:`Discard unsaved file changes?`})),[e,Y]),Q=(0,U.useCallback)(()=>!Y||window.confirm(e(`work.files.leaveWithDraft`,{defaultValue:`Leave this file? Your unsaved edit will remain as a browser draft.`})),[e,Y]),ft=()=>{E&&te&&me(E.id,te.path)},pt=o(({currentLocation:e,nextLocation:t})=>{let n=t.state;return Y&&n?.deletedWorkTaskId!==a&&`${e.pathname}${e.search}${e.hash}`!=`${t.pathname}${t.search}${t.hash}`});(0,U.useEffect)(()=>{if(pt.state!==`blocked`)return;if(!Q()){pt.reset();return}let e=pt.proceed,t=window.setTimeout(()=>{Ie(!1),window.setTimeout(e,0)},0);return()=>window.clearTimeout(t)},[Q,pt]);let mt=()=>{ke(),Fe(`conversation`),n(`/work`)},ht=async t=>{if(E&&!dt())return!1;E&&Y&&(ft(),K(),Ie(!1));try{if(E)await _e(E.id,{message:t,model:E.model,providerType:E.providerType,providerId:E.providerId||void 0});else{if(!rt)throw Error(e(`work.composer.noModelSelected`,{defaultValue:`No Work-compatible model is selected.`}));let r=await le({message:t,model:rt.model,providerType:rt.providerType,providerId:rt.providerId,networkEnabled:!0,...ze&&Le.trim()?{hostPath:Le.trim()}:{},...X?{policyId:X}:{}});n(`/work/${r.id}`)}return!0}catch(t){return h.error(an(t,e(`work.toasts.runFailed`,{defaultValue:`Could not start the Work task.`}))),!1}},gt=async t=>{let n=Ot.find(e=>e.key===t);if(n){if(!E){je(t);return}try{await ue(E.id,{model:n.model,providerType:n.providerType,providerId:n.providerId})}catch(t){h.error(an(t,e(`work.toasts.updateFailed`,{defaultValue:`Could not update this task.`})))}}},_t=async()=>{if(E)try{await ve(E.id),h.success(e(`work.toasts.cancelled`,{defaultValue:`Work run stopped.`}))}catch(t){h.error(an(t,e(`work.toasts.cancelFailed`,{defaultValue:`Could not stop the Work run.`})))}},vt=async t=>{let r=T.find(e=>e.id===t);if(!window.confirm(e(`work.tasks.deleteConfirm`,{defaultValue:`Delete “{{title}}” and its workspace permanently?`,title:r?.title||e(`work.tasks.untitled`,{defaultValue:`Untitled task`})})))return;let i=a===t&&Y;i&&Ie(!1);try{await de(t),pe(t),a===t&&n(`/work`)}catch(t){i&&Ie(!0),h.error(an(t,e(`work.toasts.deleteFailed`,{defaultValue:`Could not delete this Work task.`})))}},yt=async t=>{if(!E)return!1;let n=t.trim();if(!n||n===E.title)return!!n;try{return await ue(E.id,{title:n}),!0}catch(t){return h.error(an(t,e(`work.toasts.renameFailed`,{defaultValue:`Could not rename this task.`}))),!1}},bt=async(e,t,n)=>{try{return await e(),n&&h.success(n),!0}catch(e){return h.error(an(e,t)),!1}},xt=async(t,n,r)=>{if(!E)return!1;let i=E.id;try{let a=await Te(i,t,n,r);return he.getState().selectedTaskId===i&&h.success(e(`work.toasts.saved`,{defaultValue:`File saved.`})),a}catch(t){return he.getState().selectedTaskId===i&&h.error(an(t,e(`work.toasts.saveFailed`,{defaultValue:`Could not save this file.`}))),!1}},St=w?.available===!1,Ct=w?.pluginAvailable?w.ollamaAvailable?e(`work.runtime.readyHybrid`,{defaultValue:`Docker + models ready`}):e(`work.runtime.readyPlugin`,{defaultValue:`Docker + plugin ready`}):e(`work.runtime.readyOllama`,{defaultValue:`Docker ready`}),wt=e(`work.runtime.ready`,{defaultValue:`Runtime ready`}),Tt=E?H(E):!1,$=E?{model:E.model,providerType:E.providerType,providerId:E.providerId||void 0}:void 0,Et=$?we($):rt?.key||``,Dt=$&&!J.some(e=>e.key===Et)?{...$,key:Et,label:`${$.model} · ${$.providerType===`plugin`?$.providerId||`plugin`:`Ollama`}`,remote:$.providerType===`plugin`||$.model.toLowerCase().endsWith(`:cloud`)||$.model.toLowerCase().endsWith(`-cloud`)}:void 0,Ot=Dt?[Dt,...J]:J,kt=xe[E?.status??`idle`],At=e(kt.labelKey,{defaultValue:kt.label}),jt=async()=>{if(u.workRemoteProviderDisclosureDismissed||g)return!1;let t=m;v(!0);try{let n=await fe.updatePreferences({workRemoteProviderDisclosureDismissed:!0});if(!n.success)throw Error(n.error||e(`work.composer.remoteDismissFailed`,{defaultValue:`Could not save the remote provider preference.`}));return(ge.getState().user?.id??null)===t&&(f({workRemoteProviderDisclosureDismissed:!0}),!0)}catch{return h.error(e(`work.composer.remoteDismissFailed`,{defaultValue:`Could not save the remote provider preference.`})),!1}finally{v(!1)}};return(0,W.jsx)(`div`,{"data-testid":`work-page`,className:`relative flex h-full min-h-0 overflow-hidden bg-transparent`,children:(0,W.jsxs)(`main`,{className:`flex min-h-0 min-w-0 flex-1 flex-col`,children:[(0,W.jsxs)(`header`,{className:`relative z-50 flex h-16 shrink-0 items-center gap-3 border-b border-line bg-surface/55 px-3 backdrop-blur-xl md:px-4`,children:[E?(0,W.jsx)(`input`,{"data-testid":`work-task-title`,dir:`auto`,defaultValue:E.title,onBlur:e=>{let t=e.currentTarget;if(!t.value.trim()){t.value=E.title;return}yt(t.value).then(e=>{e||(t.value=E.title)})},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur(),e.key===`Escape`&&(e.currentTarget.value=E.title,e.currentTarget.blur())},className:`min-w-0 max-w-sm flex-1 truncate rounded-lg border border-transparent bg-transparent px-2 py-1 text-sm font-semibold text-ink outline-none hover:border-line focus:border-primary-500 focus:bg-surface`,"aria-label":e(`work.tasks.rename`,{defaultValue:`Task title`})},`${E.id}:${E.title}`):(0,W.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,W.jsx)(`h1`,{className:`truncate text-sm font-semibold text-ink`,children:e(`work.title`,{defaultValue:`Work`})})}),E?.hostPath&&(0,W.jsxs)(`span`,{"data-testid":`work-host-path-chip`,title:E.hostPath,className:`hidden h-7 shrink-0 items-center gap-1.5 rounded-full border border-line bg-surface px-2.5 font-mono text-[11px] text-ink-muted sm:inline-flex`,children:[(0,W.jsx)(M,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),(0,W.jsx)(`span`,{className:`max-w-[16rem] truncate`,children:E.hostPath})]}),E&&(0,W.jsxs)(`span`,{"data-testid":`work-compact-status`,className:`inline-flex h-7 shrink-0 items-center gap-1.5 rounded-full border border-line bg-surface px-2 text-[11px] font-medium text-ink-muted xl:hidden`,"aria-label":e(`work.tasks.status`,{status:At,defaultValue:`Status: {{status}}`}),title:e(`work.tasks.status`,{status:At,defaultValue:`Status: {{status}}`}),children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`work-compact-status-indicator`,className:l(`h-1.5 w-1.5 rounded-full`,kt.animated&&`animate-pulse`,E.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:kt.color}}),(0,W.jsx)(`span`,{className:`hidden md:inline`,children:At})]}),E&&(0,W.jsxs)(`div`,{className:`ms-auto inline-flex h-9 shrink-0 items-center rounded-xl border border-line bg-surface-subtle p-1 shadow-subtle xl:hidden`,role:`group`,"aria-label":e(`work.mobile.surface`,{defaultValue:`Task surface`}),children:[(0,W.jsxs)(`button`,{type:`button`,onClick:()=>Fe(`conversation`),"aria-label":e(`work.mobile.conversation`,{defaultValue:`Conversation`}),"aria-pressed":Pe===`conversation`,className:l(`inline-flex h-7 items-center justify-center gap-1.5 rounded-lg px-2 text-[11px] font-medium transition-[background-color,color,box-shadow] sm:px-2.5`,Pe===`conversation`?`bg-surface-raised text-ink shadow-subtle`:`text-ink-muted hover:bg-surface-raised/70 hover:text-ink`),children:[(0,W.jsx)(L,{className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`hidden sm:inline`,children:e(`work.mobile.conversation`,{defaultValue:`Conversation`})})]}),(0,W.jsxs)(`button`,{type:`button`,onClick:()=>Fe(`workspace`),"aria-label":e(`work.mobile.workspace`,{defaultValue:`Workspace`}),"aria-pressed":Pe===`workspace`,className:l(`inline-flex h-7 items-center justify-center gap-1.5 rounded-lg px-2 text-[11px] font-medium transition-[background-color,color,box-shadow] sm:px-2.5`,Pe===`workspace`?`bg-surface-raised text-ink shadow-subtle`:`text-ink-muted hover:bg-surface-raised/70 hover:text-ink`),children:[(0,W.jsx)(re,{className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{className:`hidden sm:inline`,children:e(`work.mobile.workspace`,{defaultValue:`Workspace`})})]})]}),(0,W.jsxs)(`div`,{className:l(`ms-auto hidden min-w-0 items-center gap-2`,E?`xl:flex`:`sm:flex`),children:[E&&(0,W.jsxs)(`span`,{"data-testid":`work-status`,className:`inline-flex h-7 items-center gap-1.5 rounded-full border border-line bg-surface px-2.5 text-[11px] font-medium text-ink-muted`,children:[(0,W.jsx)(`span`,{"aria-hidden":`true`,"data-testid":`work-status-indicator`,className:l(`h-1.5 w-1.5 rounded-full`,kt.animated&&`animate-pulse`,E.status===`idle`&&`ring-1 ring-black/20 dark:ring-white/20`),style:{backgroundColor:kt.color}}),At]}),(0,W.jsxs)(`span`,{"data-testid":`work-runtime-status`,className:l(`inline-flex h-7 items-center gap-1.5 rounded-full border px-2.5 text-[11px] font-medium`,St?`border-transparent bg-error-500 text-[#0D0D0C]`:`border-transparent bg-success-500 text-[#0D0D0C]`),title:St?w?.reason||e(`work.runtime.unavailable`,{defaultValue:`Runtime unavailable`}):w?.image?`${Ct} · ${w.image}`:Ct,children:[(0,W.jsx)(ae,{className:`h-3.5 w-3.5`}),St?e(`work.runtime.unavailable`,{defaultValue:`Runtime unavailable`}):wt]}),E&&(0,W.jsxs)(`span`,{className:`hidden h-7 max-w-44 items-center gap-1.5 truncate rounded-full border border-line bg-surface px-2.5 text-[11px] font-medium text-ink-muted md:inline-flex`,children:[(0,W.jsx)(ne,{className:`h-3.5 w-3.5 shrink-0`}),(0,W.jsx)(`span`,{dir:`ltr`,className:`truncate`,children:E.model})]})]}),E&&(0,W.jsxs)(`div`,{ref:Ze,className:`relative shrink-0`,children:[(0,W.jsx)(`button`,{ref:Qe,id:`work-task-actions-trigger`,type:`button`,"data-testid":`work-task-actions-button`,onClick:()=>Ye(e=>({taskId:E.id,open:e.taskId!==E.id||!e.open})),onKeyDown:e=>{(e.key===`ArrowDown`||e.key===`ArrowUp`)&&(e.preventDefault(),Ye({taskId:E.id,open:!0}))},className:`inline-flex h-9 w-9 items-center justify-center rounded-lg text-ink-muted transition-colors hover:bg-surface-subtle hover:text-ink`,"aria-label":e(`work.tasks.actions`,{defaultValue:`Task actions`}),"aria-haspopup":`menu`,"aria-expanded":Xe,"aria-controls":Xe?`work-task-actions-menu`:void 0,children:(0,W.jsx)(_,{className:`h-4 w-4`})}),Xe&&(0,W.jsx)(`div`,{ref:$e,id:`work-task-actions-menu`,role:`menu`,"aria-labelledby":`work-task-actions-trigger`,onKeyDown:nt,className:`absolute end-0 top-10 z-40 min-w-44 rounded-xl border border-line bg-surface-overlay p-1.5 shadow-overlay`,children:(0,W.jsxs)(`button`,{type:`button`,role:`menuitem`,"data-testid":`work-delete-task-button`,onClick:()=>{et(!0),vt(E.id)},className:`flex h-9 w-full items-center gap-2 rounded-lg px-2.5 text-start text-xs font-medium text-error-600 transition-colors hover:bg-error-500/10`,children:[(0,W.jsx)(F,{className:`h-3.5 w-3.5`}),e(`work.tasks.delete`,{defaultValue:`Delete task`})]})})]})]}),(St||P)&&(0,W.jsxs)(`div`,{className:l(`flex shrink-0 items-center gap-2 border-b px-4 py-2 text-xs`,St?`border-error-500/20 bg-error-500/10 text-error-700`:`border-amber-500/20 bg-amber-500/10 text-ink`),children:[(0,W.jsx)(A,{className:`h-4 w-4 shrink-0`}),(0,W.jsx)(`span`,{dir:`auto`,className:`min-w-0 flex-1`,children:St?w?.reason||e(`work.runtime.reason`,{defaultValue:`Docker and an available Ollama or plugin model provider are required.`}):P}),P&&!St&&(0,W.jsx)(`button`,{type:`button`,className:`rounded-md p-1 hover:bg-black/5`,onClick:ke,"aria-label":e(`common.close`),children:`×`})]}),a?E?(0,W.jsx)(tt,{userId:m,mobileSurface:Pe,conversation:(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(Be,{task:E,user:p,liveRun:ct,loading:k,loadingOlder:j,onLoadOlder:()=>ce(E.id)}),(0,W.jsx)(Ee,{models:Ot,selectorModels:q,modelKey:Et,running:Tt,loading:N,disabled:St,remoteDisclosureDismissed:u.workRemoteProviderDisclosureDismissed,remoteDisclosureSaving:g,onModelChange:gt,onDismissRemoteDisclosure:jt,onModelsRefresh:C,onSubmit:ht,onCancel:_t},E.id)]}),workspace:(0,W.jsx)(`div`,{className:`min-h-0 min-w-0 flex-1`,children:(0,W.jsx)(nn,{task:E,liveRun:ct,files:ee,selectedFile:te,loadingFiles:ie,actionLoading:N,onLoadFiles:e=>V(E.id,e),onLoadFile:e=>G(E.id,e),onClearSelectedFile:K,onSaveFile:xt,onStartPreview:t=>bt(()=>De(E.id,t),e(`work.toasts.previewFailed`,{defaultValue:`Could not start the preview.`})),onStopPreview:()=>bt(()=>Oe(E.id),e(`work.toasts.previewStopFailed`,{defaultValue:`Could not stop the preview.`})),onDirtyChange:Ie,terminal:w?.terminal},E.id)})}):(0,W.jsx)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center justify-center px-6 text-center`,children:k?(0,W.jsx)(`div`,{className:`text-sm text-ink-muted`,children:e(`work.tasks.loading`,{defaultValue:`Loading task…`})}):(0,W.jsxs)(W.Fragment,{children:[(0,W.jsx)(A,{className:`mb-3 h-8 w-8 text-ink-subtle`}),(0,W.jsx)(`h2`,{className:`text-lg font-semibold text-ink`,children:e(`work.tasks.notFound`,{defaultValue:`This Work task is unavailable`})}),(0,W.jsxs)(`button`,{type:`button`,onClick:mt,className:`mt-4 inline-flex items-center gap-1.5 text-sm font-medium text-primary-600 hover:text-primary-700`,children:[(0,W.jsx)(D,{className:`h-4 w-4 rtl:rotate-180`}),e(`work.tasks.back`,{defaultValue:`Start a new task`})]})]})}):(0,W.jsxs)(`div`,{className:`relative min-h-0 flex-1 overflow-y-auto`,children:[(0,W.jsxs)(`div`,{"aria-hidden":`true`,className:`pointer-events-none absolute inset-0`,children:[(0,W.jsx)(`div`,{className:`absolute left-[12%] top-[18%] h-56 w-56 rounded-full bg-primary-500/[0.035] blur-3xl dark:bg-primary-400/[0.04]`}),(0,W.jsx)(`div`,{className:`absolute bottom-[16%] right-[10%] h-72 w-72 rounded-full bg-gray-900/[0.025] blur-3xl dark:bg-white/[0.025]`}),(0,W.jsx)(`div`,{className:`absolute left-1/2 top-0 h-16 w-px bg-gray-300/60 dark:bg-white/10`})]}),(0,W.jsxs)(`section`,{"data-testid":`work-landing`,className:`relative z-[1] mx-auto flex min-h-full w-full max-w-3xl flex-col items-center justify-center px-4 py-20 sm:px-8 sm:py-24`,children:[(0,W.jsxs)(`div`,{className:`flex flex-col items-center text-center`,children:[(0,W.jsx)(`h2`,{className:`max-w-3xl text-balance text-[clamp(2.65rem,7vw,5.25rem)] font-light leading-[0.98] tracking-[-0.055em] text-ink rtl:leading-[1.12] rtl:tracking-normal`,children:e(`work.landing.title`,{defaultValue:`Start a new Work task`})}),(0,W.jsx)(`p`,{className:`mt-4 max-w-xl text-balance text-base leading-relaxed text-ink-muted sm:text-lg`,children:e(`work.landing.description`,{defaultValue:`Give a local model a durable, isolated workspace. It can inspect files, run tools, and continue where it left off when you return.`})})]}),He.length>0&&(0,W.jsxs)(`div`,{className:`mt-8 w-full max-w-2xl`,children:[(0,W.jsx)(`label`,{htmlFor:`work-policy`,className:`mb-1.5 block text-xs font-medium text-ink-muted`,children:e(`work.policy.label`,{defaultValue:`Runtime policy`})}),(0,W.jsxs)(`select`,{id:`work-policy`,"data-testid":`work-policy`,value:X,onChange:e=>We(e.target.value),className:`w-full rounded-xl border border-line bg-surface px-3 py-2 text-[13px] text-ink outline-none transition-colors focus:border-line-strong focus-visible:ring-2 focus-visible:ring-primary-500/30`,children:[(0,W.jsx)(`option`,{value:``,children:e(`work.policy.default`,{defaultValue:`Default (global limits)`})}),He.map(e=>(0,W.jsx)(`option`,{value:e.id,children:e.name},e.id))]})]}),ze&&(0,W.jsxs)(`div`,{className:`mt-8 w-full max-w-2xl`,children:[(0,W.jsx)(`label`,{htmlFor:`work-host-path`,className:`mb-1.5 block text-xs font-medium text-ink-muted`,children:e(`work.hostWorkspace.label`,{defaultValue:`Workspace folder (optional)`})}),(0,W.jsx)(`input`,{id:`work-host-path`,"data-testid":`work-host-path`,value:Le,onChange:e=>Re(e.target.value),spellCheck:!1,placeholder:Ve[0]?`${Ve[0]}/my-project`:`/path/to/folder`,className:`w-full rounded-xl border border-line bg-surface px-3 py-2 font-mono text-[13px] text-ink outline-none transition-colors placeholder:text-ink-subtle focus:border-line-strong focus-visible:ring-2 focus-visible:ring-primary-500/30`}),(0,W.jsx)(`p`,{className:`mt-1.5 text-[11px] leading-relaxed text-ink-subtle`,children:Le.trim()?e(`work.hostWorkspace.warning`,{defaultValue:`The task can read and write this folder directly. Leave blank to use an isolated workspace instead.`}):e(`work.hostWorkspace.hint`,{defaultValue:`Leave blank for an isolated workspace, or point the task at a folder on this machine.`})})]}),(0,W.jsx)(Ee,{variant:`landing`,models:J,selectorModels:q,modelKey:rt?.key||``,running:!1,loading:N,disabled:St,remoteDisclosureDismissed:u.workRemoteProviderDisclosureDismissed,remoteDisclosureSaving:g,onModelChange:gt,onDismissRemoteDisclosure:jt,onModelsRefresh:C,onSubmit:ht,onCancel:_t}),(0,W.jsxs)(`div`,{"data-testid":`work-workspace-note`,role:`note`,className:`mt-4 flex max-w-2xl flex-wrap items-center justify-center gap-x-2 gap-y-1 text-center text-[10px] leading-relaxed text-ink-subtle`,children:[(0,W.jsx)(ae,{"aria-hidden":`true`,className:`h-3.5 w-3.5`}),(0,W.jsx)(`span`,{children:e(`work.composer.hint`,{defaultValue:`Each task keeps its own files and history. Review model output before using it.`})})]})]})]})]})})}export{sn as default};
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./rolldown-runtime-hePW80VL.js";import{i as t}from"./logger-DSXjF4ye.js";import{t as n}from"./config-CV8L89A5.js";import{a as r,i,r as a}from"./workApi-LrQmhNxb.js";var o={getModels:()=>t()?i([]):a.get(`/agent-clis/models`).then(e=>e.data)},s=`0.21.2`,c={login:e=>t()?i({user:{id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},token:`demo-token`,systemInfo:{requiresAuth:!0,hasUsers:!0,userCount:1,signupEnabled:!0,version:s}}):a.post(`/auth/login`,e).then(e=>e.data),signup:e=>t()?i({user:{id:`demo-user-new`,username:e.username,email:e.email||``,role:`user`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()},token:`demo-token-new`,systemInfo:{requiresAuth:!0,hasUsers:!0,userCount:1,signupEnabled:!0,version:s,turnstile:{enabled:!1}}}):a.post(`/auth/signup`,e).then(e=>e.data),logout:()=>t()?i(void 0):a.post(`/auth/logout`).then(e=>e.data),getSystemInfo:()=>(r.debug(`getSystemInfo called, demo mode:`,t()),t()?i({requiresAuth:!0,hasUsers:!0,userCount:1,signupEnabled:!0,version:s,turnstile:{enabled:!1}}):(r.debug(`Making API call to:`,n+`/auth/system-info`),r.debug(`Full URL from:`,window.location.origin,`-> API:`,n+`/auth/system-info`),a.get(`/auth/system-info`).then(e=>(r.debug(`getSystemInfo response:`,e.data),e.data)).catch(e=>{throw r.debug(`getSystemInfo error:`,e),e.response&&(r.debug(`Error response data:`,e.response.data),r.debug(`Error status:`,e.response.status),r.debug(`Error headers:`,e.response.headers)),e.request&&r.debug(`Network error - no response received:`,e.request),r.debug(`Error config:`,e.config),e}))),verifyToken:()=>t()?i({id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):a.get(`/auth/verify`).then(e=>e.data),getEncryptionKey:()=>t()?i({encryptionKey:`demo-encryption-key-not-real`}):a.get(`/auth/encryption-key`).then(e=>e.data)},l={getUsers:()=>t()?i([{id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}]):a.get(`/users`).then(e=>e.data),createUser:e=>t()?i({id:`new-user-`+Date.now(),username:e.username,email:e.email,role:e.role,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):a.post(`/users`,e).then(e=>e.data),updateUser:(e,n)=>t()?i({id:e,username:n.username||`demo`,email:n.email||`demo@example.com`,role:n.role||`user`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):a.patch(`/users/${e}`,n).then(e=>e.data),deleteUser:e=>t()?i(void 0):a.delete(`/users/${e}`).then(e=>e.data),getPendingApprovals:()=>t()?i({count:0,latestCreatedAt:null}):a.get(`/users/pending-approvals`).then(e=>e.data),approveUser:e=>t()?i({id:e,username:`demo-user`,email:`demo@example.com`,role:`user`,status:`active`,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):a.patch(`/users/${e}/approve`).then(e=>e.data),updateMyAvatar:e=>t()?i({id:`demo-user`,username:`demo`,email:`demo@example.com`,role:`admin`,status:`active`,avatar:e,createdAt:new Date().toISOString(),updatedAt:new Date().toISOString()}):a.patch(`/users/me/avatar`,{avatar:e}).then(e=>e.data)},u=[{name:`llama3.2:3b`,size:2048e6,digest:`demo-digest-1`,modified_at:new Date().toISOString(),details:{format:`gguf`,family:`llama`,families:[`llama`],parameter_size:`3B`,quantization_level:`Q4_0`}},{name:`qwen2.5:7b`,size:4096e6,digest:`demo-digest-2`,modified_at:new Date().toISOString(),details:{format:`gguf`,family:`qwen`,families:[`qwen`],parameter_size:`7B`,quantization_level:`Q4_0`}}],d=()=>[{id:`demo-session-1`,title:`Demo Chat Session`,model:u[0].name,providerType:`ollama`,providerId:null,messages:[{id:`demo-msg-1`,role:`user`,content:`Hello! Can you tell me about this demo?`,timestamp:Date.now()},{id:`demo-msg-2`,role:`assistant`,content:`This is a demo of Libre WebUI! In a real deployment, I would be powered by Ollama running locally on your machine. This demo shows the beautiful interface and features without the backend connection.`,timestamp:Date.now()}],createdAt:Date.now(),updatedAt:Date.now()}],f=d(),p={theme:{mode:`dark`,adaptToAccent:!1,accent:`blue`,customAccent:`#2563eb`},defaultModel:`llama3.2:3b`,defaultProviderType:`ollama`,defaultProviderId:null,visionModel:``,visionProviderType:null,visionProviderId:null,systemMessage:`You are a helpful assistant.`,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.7},titleSettings:{autoTitle:!1,taskModel:``,taskProviderType:null,taskProviderId:null},showUsername:!1,hapticFeedbackEnabled:!1,workRemoteProviderDisclosureDismissed:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}},m={...p,theme:{...p.theme},generationOptions:{...p.generationOptions},embeddingSettings:{...p.embeddingSettings},titleSettings:{...p.titleSettings},backgroundSettings:{...p.backgroundSettings}},h=()=>m,g=e=>{let t=m.backgroundSettings||p.backgroundSettings;return m={...m,...e,theme:{...m.theme,...e.theme},generationOptions:{...m.generationOptions,...e.generationOptions},embeddingSettings:{...m.embeddingSettings,...e.embeddingSettings},titleSettings:e.titleSettings?{...m.titleSettings||p.titleSettings,...e.titleSettings}:m.titleSettings,backgroundSettings:e.backgroundSettings?{...t,...e.backgroundSettings}:m.backgroundSettings},m},_={getSessions:()=>a.get(`/chat/sessions`).then(e=>e.data),createSession:(e,t,n,r,i)=>a.post(`/chat/sessions`,{model:e,title:t,personaId:n,providerType:r,providerId:i}).then(e=>e.data),getSession:e=>{if(t()){let t=d().find(t=>t.id===e);return t?i(t):Promise.resolve({success:!1,error:`Session not found in demo mode`})}return a.get(`/chat/sessions/${e}`).then(e=>e.data)},updateSession:(e,n)=>{if(t()){let t=f.findIndex(t=>t.id===e),r=f[t];if(r){let e={...r,...n,updatedAt:Date.now()};return f[t]=e,i(e)}return Promise.resolve({success:!1,error:`Session not found in demo mode`})}return a.put(`/chat/sessions/${e}`,n).then(e=>e.data)},deleteSession:e=>t()?i(null):a.delete(`/chat/sessions/${e}`).then(e=>e.data),clearAllSessions:()=>a.delete(`/chat/sessions`).then(e=>e.data),generateTitle:(e,n,r,o,s)=>{if(t()){let e=r.substring(0,30)+(r.length>30?`...`:``);return i({title:e,source:`fallback`,updatedAt:Date.now()})}return a.post(`/chat/sessions/${e}/generate-title`,{model:n,message:r,providerType:o,providerId:s}).then(e=>e.data)},getFolders:()=>t()?i([]):a.get(`/chat/folders`).then(e=>e.data),createFolder:e=>a.post(`/chat/folders`,{name:e}).then(e=>e.data),renameFolder:(e,t)=>a.put(`/chat/folders/${e}`,{name:t}).then(e=>e.data),deleteFolder:e=>a.delete(`/chat/folders/${e}`).then(e=>e.data),generateFollowUps:e=>t()?i({suggestions:[]}):a.post(`/chat/sessions/${e}/followups`).then(e=>e.data),sendMessage:(e,t,n)=>a.post(`/chat/sessions/${e}/messages`,{content:t,options:n}).then(e=>e.data),saveMessage:(e,t)=>a.post(`/chat/sessions/${e}/messages`,t).then(e=>e.data),updateMessage:(e,n,r)=>t()?i({}):a.put(`/chat/sessions/${e}/messages/${n}`,r).then(e=>e.data),generateChatResponse:(e,t,n)=>a.post(`/chat/sessions/${e}/generate`,{message:t,options:n}).then(e=>e.data),generateChatStreamResponse:(e,t,i)=>({subscribe:async(a,o,s)=>{try{let c=await fetch(`${n}/chat/sessions/${e}/generate/stream`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({message:t,options:i})});if(!c.ok)throw Error(`HTTP error! status: ${c.status}`);let l=c.body?.getReader();if(!l)throw Error(`No response body reader available`);let u=new TextDecoder,d=``,f=()=>{l.read().then(({done:e,value:t})=>{if(e){s?.();return}d+=u.decode(t,{stream:!0});let n=d.split(`
|
|
2
|
-
`);d=n.pop()||``;for(let e of n){let t=e.trim();if(t.startsWith(`data: `)){let e=t.slice(6);if(e===`[DONE]`){s?.();return}try{let t=JSON.parse(e);if(a(t),t.type===`done`||t.type===`error`){t.type===`error`?o?.(t.error):s?.();return}}catch(e){r.error(`Failed to parse SSE data:`,e)}}}f()}).catch(e=>{o?.(e instanceof Error?e:Error(String(e)))})};return f(),()=>l.cancel()}catch(e){return o?.(e instanceof Error?e:Error(String(e))),()=>{}}}}),getMessageBranches:(e,n)=>t()?i([]):a.get(`/chat/sessions/${e}/messages/${n}/branches`).then(e=>e.data),switchMessageBranch:(e,n,r)=>t()?i({}):a.post(`/chat/sessions/${e}/messages/${n}/branch`,{branchIndex:r}).then(e=>e.data),createMessageBranch:(e,n,r)=>t()?i({}):a.post(`/chat/sessions/${e}/messages/${n}/branches`,{...r}).then(e=>e.data)},v={uploadDocument:(e,n)=>{if(t())return i({id:`demo-doc-`+Date.now(),filename:e.name,fileType:e.name.endsWith(`.pdf`)?`pdf`:`txt`,size:e.size,sessionId:n,uploadedAt:Date.now()});let r=new FormData;return r.append(`document`,e),n&&r.append(`sessionId`,n),a.post(`/documents/upload`,r).then(e=>e.data)},getCollections:()=>t()?i([]):a.get(`/documents/collections`).then(e=>e.data),createCollection:e=>a.post(`/documents/collections`,{name:e}).then(e=>e.data),deleteCollection:e=>a.delete(`/documents/collections/${e}`).then(e=>e.data),setDocumentCollection:(e,t)=>a.put(`/documents/${e}/collection`,{collectionId:t}).then(e=>e.data),fetchWebpage:(e,n)=>t()?i({id:`demo-doc-`+Date.now(),filename:`demo-webpage.txt`,fileType:`txt`,size:0,sessionId:n,uploadedAt:Date.now()}):a.post(`/documents/fetch-url`,{url:e,sessionId:n}).then(e=>e.data),getDocuments:e=>{if(t())return i([]);let n=e?`/documents/session/${e}`:`/documents`;return a.get(n).then(e=>e.data)},getDocument:e=>t()?i({id:e,filename:`demo-document.pdf`,fileType:`pdf`,size:1024,content:`Demo document content...`,uploadedAt:Date.now()}):a.get(`/documents/${e}`).then(e=>e.data),searchDocuments:(e,n,r)=>t()?i([]):a.post(`/documents/search`,{query:e,sessionId:n,limit:r}).then(e=>e.data),deleteDocument:e=>t()?i(void 0):a.delete(`/documents/${e}`).then(e=>e.data),getEmbeddingStatus:()=>t()?i({available:!1,model:`nomic-embed-text`,chunksWithEmbeddings:0,totalChunks:0}):a.get(`/documents/embeddings/status`).then(e=>e.data),regenerateEmbeddings:()=>t()?i(void 0):a.post(`/documents/embeddings/regenerate`).then(e=>e.data)},y={getModels:()=>t()?i([{id:`nomic-embed-text`,name:`nomic-embed-text`,description:`Ollama - Default embedding model`,provider:`ollama`,dimensions:0,isDetectedEmbedding:!0}]):a.get(`/embeddings/models`).then(e=>e.data)},b={getNotes:()=>t()?i([]):a.get(`/notes`).then(e=>e.data),createNote:(e,t)=>a.post(`/notes`,{title:e,content:t}).then(e=>e.data),updateNote:(e,t)=>a.put(`/notes/${e}`,t).then(e=>e.data),deleteNote:e=>a.delete(`/notes/${e}`).then(e=>e.data)},x={getConfig:()=>t()?i({enabled:!1,available:!1,allowed:!1}):a.get(`/search/config`).then(e=>e.data),getAccess:()=>t()?i({mode:`admins`,allowed:!1}):a.get(`/search/access`).then(e=>e.data),setAccess:e=>t()?i({mode:e}):a.put(`/search/access`,{mode:e}).then(e=>e.data),setConfig:(e,n,r)=>t()?i({enabled:e,available:e,allowed:!1,url:n}):a.put(`/search/config`,{enabled:e,url:n,...r??{}}).then(e=>e.data),test:()=>t()?i({ok:!1,results:0},!1):a.post(`/search/test`).then(e=>e.data)},S={getModels:e=>t()?i([{id:`meta-llama/Llama-3.3-70B-Instruct`,modelId:`meta-llama/Llama-3.3-70B-Instruct`,author:`meta-llama`,downloads:1e6,likes:5e3,tags:[`text-generation`,`llama`],pipeline_tag:`text-generation`,gated:!1}]):a.get(`/huggingface-hub/models`,{params:e}).then(e=>e.data),getTrending:e=>t()?i([]):a.get(`/huggingface-hub/trending`,{params:e}).then(e=>e.data),getModel:(e,n)=>t()?i({id:`${e}/${n}`,modelId:`${e}/${n}`,author:e,downloads:0,likes:0,tags:[],gated:!1}):a.get(`/huggingface-hub/models/${e}/${n}`).then(e=>e.data),getTasks:()=>t()?i([`text-generation`,`text-to-speech`,`text-to-image`]):a.get(`/huggingface-hub/tasks`).then(e=>e.data),clearCache:()=>t()?i(!0):a.post(`/huggingface-hub/cache/clear`).then(e=>e.data),getGgufFiles:(e,n)=>t()?i([{filename:`model-Q4_K_M.gguf`,size:45e8,sizeFormatted:`4.19 GB`,quantization:`Q4_K_M`,url:`https://huggingface.co/${e}/${n}/resolve/main/model-Q4_K_M.gguf`,ollamaCommand:`hf.co/${e}/${n}:Q4_K_M`}]):a.get(`/huggingface-hub/models/${e}/${n}/gguf`).then(e=>e.data),hasGgufFiles:(e,n)=>t()?i({hasGguf:!1,count:0}):a.get(`/huggingface-hub/models/${e}/${n}/has-gguf`).then(e=>e.data)},C={getModels:()=>t()?i([{model:`gpt-image-2`,plugin:`openai`,config:{sizes:[`1024x1024`,`1536x1024`,`1024x1536`],default_size:`1024x1024`,qualities:[`auto`,`low`,`medium`,`high`],default_quality:`auto`}}]):a.get(`/image-gen/models`).then(e=>e.data),getPlugins:()=>t()?i([{id:`openai`,name:`OpenAI GPT Image`,models:[`gpt-image-2`,`gpt-image-1.5`,`gpt-image-1`,`gpt-image-1-mini`],config:{sizes:[`1024x1024`,`1536x1024`,`1024x1536`],default_size:`1024x1024`,qualities:[`auto`,`low`,`medium`,`high`],default_quality:`auto`}}]):a.get(`/image-gen/plugins`).then(e=>e.data),getConfig:e=>t()?i({sizes:[`1024x1024`,`1536x1024`,`1024x1536`],default_size:`1024x1024`,qualities:[`auto`,`low`,`medium`,`high`],default_quality:`auto`}):a.get(`/image-gen/config/${e}`).then(e=>e.data),generate:e=>t()?i({images:[{url:`https://placehold.co/1024x1024/purple/white?text=Demo+Image`,revised_prompt:e.prompt}],model:e.model,pluginId:e.pluginId}):a.post(`/image-gen/generate`,e).then(e=>e.data),getGallery:e=>t()?i({images:[],total:0}):a.get(`/image-gen/gallery`,{params:e}).then(e=>e.data),getGalleryImage:e=>t()?i({id:e,userId:`demo`,prompt:`Demo image prompt`,model:`dall-e-3`,imageData:`https://placehold.co/1024x1024/purple/white?text=Demo`,createdAt:Date.now()}):a.get(`/image-gen/gallery/${e}`).then(e=>e.data),deleteGalleryImage:e=>t()?i(void 0):a.delete(`/image-gen/gallery/${e}`).then(e=>e.data)},w={connected:!1,baseUrl:`http://127.0.0.1:8766`,dashboardUrl:`http://127.0.0.1:8766/dashboard`,error:`Libre Claw daemon is not connected in demo mode.`},T={access:()=>t()?i({enabled:!1,lockedByEnv:!1}):a.get(`/libre-claw/access`).then(e=>e.data),setAccess:e=>t()?i({enabled:e,lockedByEnv:!1}):a.put(`/libre-claw/access`,{enabled:e}).then(e=>e.data),status:()=>t()?i(w):a.get(`/libre-claw/status`).then(e=>e.data),dashboard:()=>t()?i({url:w.dashboardUrl}):a.get(`/libre-claw/dashboard`).then(e=>e.data),currentModel:()=>t()?i({provider:`openrouter`,model:`openrouter/auto`}):a.get(`/libre-claw/config/model`).then(e=>e.data),updateModel:(e,n,r=!1)=>t()?i({provider:e,model:n,persist_global:r}):a.patch(`/libre-claw/config/model`,{provider:e,model:n,persist_global:r}).then(e=>e.data),currentFallback:()=>t()?i({enabled:!1,routes:[]}):a.get(`/libre-claw/config/fallback`).then(e=>e.data),updateFallback:e=>t()?i(e):a.patch(`/libre-claw/config/fallback`,e).then(e=>e.data),updateTheme:(e,n=!0)=>t()?i({theme:e,label:e,persist_global:n}):a.patch(`/libre-claw/config/theme`,{theme:e,persist_global:n}).then(e=>e.data),usage:(e=``,n=250)=>{let r=new URLSearchParams({limit:String(n)});return e&&r.set(`provider`,e),t()?i({summary:{},records:[],text:``}):a.get(`/libre-claw/usage?${r.toString()}`).then(e=>e.data)},listRuns:(e=20)=>t()?i({runs:[]}):a.get(`/libre-claw/runs?limit=${e}`).then(e=>e.data),startRun:e=>{if(t()){let t=new Date().toISOString();return i({run:{run_id:`demo-${Date.now()}`,state:`queued`,title:e.message.slice(0,80)||`Libre Claw demo run`,kind:e.kind||`chat`,provider:e.provider||`openrouter`,model:e.model||`openrouter/auto`,working_directory:``,created_at:t,updated_at:t}})}return a.post(`/libre-claw/runs`,e).then(e=>e.data)},getRun:e=>t()?i({run_id:e}):a.get(`/libre-claw/runs/${encodeURIComponent(e)}`).then(e=>e.data),getEvents:(e,n=0)=>t()?i({events:[]}):a.get(`/libre-claw/runs/${encodeURIComponent(e)}/events?after=${n}`).then(e=>e.data),cancelRun:e=>t()?i({run_id:e,cancelled:!0}):a.post(`/libre-claw/runs/${encodeURIComponent(e)}/cancel`).then(e=>e.data),resolvePermission:(e,n,r)=>t()?i({run_id:e,tool_call_id:n,resolution:r}):a.post(`/libre-claw/runs/${encodeURIComponent(e)}/permissions/${encodeURIComponent(n)}`,{resolution:r}).then(e=>e.data),listAutomations:(e=50)=>t()?i({automations:[]}):a.get(`/libre-claw/automations?limit=${e}`).then(e=>e.data),createAutomation:e=>t()?i({...e,automation_id:`demo-${Date.now()}`}):a.post(`/libre-claw/automations`,e).then(e=>e.data),updateAutomation:(e,n)=>t()?i({...n,automation_id:e}):a.patch(`/libre-claw/automations/${encodeURIComponent(e)}`,n).then(e=>e.data),pauseAutomation:e=>t()?i({automation_id:e,status:`paused`}):a.post(`/libre-claw/automations/${encodeURIComponent(e)}/pause`).then(e=>e.data),resumeAutomation:e=>t()?i({automation_id:e,status:`active`}):a.post(`/libre-claw/automations/${encodeURIComponent(e)}/resume`).then(e=>e.data),runAutomationNow:e=>t()?i({automation_id:e,run:!0}):a.post(`/libre-claw/automations/${encodeURIComponent(e)}/run`).then(e=>e.data),deleteAutomation:e=>t()?i({automation_id:e,deleted:!0}):a.delete(`/libre-claw/automations/${encodeURIComponent(e)}`).then(e=>e.data)},E={getModels:()=>a.get(`/media/models`).then(e=>e.data),generateAudio:e=>a.post(`/media/audio/generate`,e).then(e=>e.data),generateSound:e=>a.post(`/media/sound/generate`,e).then(e=>e.data),generateVideo:e=>a.post(`/media/video/generate`,e).then(e=>e.data),getVideoJob:e=>a.get(`/media/video/jobs/${e}`).then(e=>e.data),getGallery:e=>a.get(`/media/gallery`,{params:e}).then(e=>e.data),deleteGalleryItem:e=>a.delete(`/media/gallery/${e}`).then(e=>e.data),getGalleryContent:e=>a.get(`/media/gallery/${e}/content`,{responseType:`blob`}).then(e=>e.data)},D=(e,t,n)=>{let r=new AbortController,i=localStorage.getItem(`auth-token`);return(async()=>{try{let n=await fetch(e,{headers:{Accept:`text/event-stream`,...i?{Authorization:`Bearer ${i}`}:{}},cache:`no-store`,credentials:`same-origin`,signal:r.signal});if(!n.ok){let e=`Request failed with status ${n.status}`;try{let t=await n.json();typeof t.error==`string`?e=t.error:typeof t.message==`string`&&(e=t.message)}catch{}throw Error(e)}if(!n.body)throw Error(`Response stream is unavailable`);let a=n.body.getReader(),o=new TextDecoder,s=``;try{for(;!r.signal.aborted;){let{done:e,value:n}=await a.read();s+=o.decode(n,{stream:!e});let r=s.split(/\r?\n\r?\n/);s=r.pop()||``;for(let e of r){let n=e.split(/\r?\n/).find(e=>e.startsWith(`data:`));n&&t(JSON.parse(n.slice(5).trim()))}if(e)break}}finally{a.releaseLock()}}catch(e){r.signal.aborted||n(e instanceof Error?e.message:`Connection lost`)}})(),()=>r.abort()},O=`libre:models-changed`,k=()=>{window.dispatchEvent(new Event(O))},A={checkHealth:()=>t()?i({status:`offline`},!1):a.get(`/ollama/health`).then(e=>e.data),getModels:()=>t()?i(u):a.get(`/ollama/models`).then(e=>e.data),getModelAccess:()=>t()?i({mode:`admins`,allowed:!1}):a.get(`/ollama/models/access`).then(e=>e.data),setModelAccess:e=>t()?i({mode:e}):a.put(`/ollama/models/access`,{mode:e}).then(e=>e.data),pullModel:e=>t()?i(null,!1):a.post(`/ollama/models/pull`,{name:e}).then(e=>(k(),e.data)),pullModelStream:(e,r,i,a)=>{if(t()){let e=0,t=setInterval(()=>{e+=Math.random()*20,e>=100?(e=100,r({status:`success`,total:100,completed:100,percent:100}),clearInterval(t),setTimeout(()=>{k(),i()},500)):r({status:`pulling`,total:100,completed:e,percent:Math.round(e)})},1e3);return()=>clearInterval(t)}let o=new URLSearchParams({model:e});return D(`${n}/ollama/pull/stream?${o.toString()}`,e=>{switch(e.type){case`progress`:r({status:typeof e.status==`string`?e.status:`pulling`,digest:typeof e.digest==`string`?e.digest:void 0,total:typeof e.total==`number`?e.total:void 0,completed:typeof e.completed==`number`?e.completed:void 0,percent:typeof e.percent==`number`?e.percent:void 0});break;case`complete`:k(),i();break;case`error`:a(String(e.error||`Model pull failed`))}},a)},deleteModel:e=>t()?i(null,!1):a.delete(`/ollama/models`,{params:{name:e}}).then(e=>(k(),e.data)),getModelDefaults:e=>a.get(`/ollama/models/${encodeURIComponent(e)}/defaults`).then(e=>e.data),showModel:(e,n=!1)=>{if(t()){let t=u.find(t=>t.name===e);return i(t||null,!!t)}return a.get(`/ollama/models/show`,{params:{name:e,verbose:n}}).then(e=>e.data)},createModel:e=>t()?i(null,!1):a.post(`/ollama/models`,e).then(e=>(k(),e.data)),copyModel:(e,n)=>t()?i(null,!1):a.post(`/ollama/models/copy`,{source:e,destination:n}).then(e=>(k(),e.data)),pushModel:e=>t()?i(null,!1):a.post(`/ollama/models/push`,{name:e}).then(e=>e.data),pullAllModels:()=>t()?i(null,!1):a.post(`/ollama/models/pull-all`).then(e=>e.data),pullAllModelsStream:(e,r,i)=>{if(t()){let t=u,n=0,i=setInterval(()=>{n++,n<=t.length&&e({current:n,total:t.length,modelName:t[n-1]?.name||`demo-model`,status:Math.random()>.1?`success`:`error`,error:Math.random()>.1?void 0:`Demo error`}),n>=t.length&&(clearInterval(i),setTimeout(()=>{k(),r()},500))},1e3);return}D(`${n}/ollama/models/pull-all/stream`,t=>{switch(t.type){case`progress`:{let n=t.status===`success`||t.status===`error`?t.status:`starting`;e({current:typeof t.current==`number`?t.current:0,total:typeof t.total==`number`?t.total:0,modelName:typeof t.modelName==`string`?t.modelName:`unknown`,status:n,error:typeof t.error==`string`?t.error:void 0});break}case`complete`:k(),r();break;case`error`:i(String(t.error||`Model update failed`))}},i)},generateEmbeddings:e=>t()?i({embeddings:[[]]},!1):a.post(`/ollama/embed`,e).then(e=>e.data),listRunningModels:()=>t()?i([]):a.get(`/ollama/running`).then(e=>e.data),unloadModel:e=>t()?i(null):a.post(`/ollama/models/unload`,{name:e}).then(e=>e.data),unloadAllModels:()=>t()?i(null):a.post(`/ollama/models/unload-all`).then(e=>e.data),getVersion:()=>t()?i({version:`demo-mode`},!1):a.get(`/ollama/version`).then(e=>e.data),chatCompletion:e=>t()?i({message:{content:`Demo response`,role:`assistant`}},!1):a.post(`/ollama/chat`,e).then(e=>e.data),checkBlobExists:e=>t()?Promise.resolve(!1):a.head(`/ollama/blobs/${e}`).then(()=>!0).catch(()=>!1),pushBlob:(e,n)=>t()?i(null,!1):a.post(`/ollama/blobs/${e}`,n,{headers:{"Content-Type":`application/octet-stream`}}).then(e=>e.data),generateLegacyEmbeddings:e=>t()?i({embedding:[]},!1):a.post(`/ollama/embeddings`,e).then(e=>e.data),getLibraryModels:e=>{if(t())return e?.category===`cloud`?i([{name:`gpt-oss:cloud`,description:`Demo cloud model using Ollama cloud naming`,category:`cloud`,sizes:[`cloud`],pulls:`Cloud`,tags:[`cloud`]}]):i([{name:`llama3.2`,description:`Meta's latest Llama model`,category:`general`,sizes:[`1b`,`3b`],pulls:`50M+`,tags:[`general`]},{name:`deepseek-r1`,description:`Open reasoning model`,category:`reasoning`,sizes:[`7b`,`14b`,`32b`],pulls:`200M+`,tags:[`reasoning`]}]);let n=new URLSearchParams;e?.search&&n.set(`search`,e.search),e?.sort&&n.set(`sort`,e.sort),e?.category&&n.set(`category`,e.category);let r=n.toString();return a.get(`/ollama/library${r?`?${r}`:``}`).then(e=>e.data)}},j=[[`#2563eb`,`#7c3aed`],[`#0891b2`,`#2563eb`],[`#0f766e`,`#2563eb`],[`#be123c`,`#7c3aed`],[`#ff7b52`,`#dc2626`]],M=e=>{let t=0;for(let n=0;n<e.length;n+=1)t=(t<<5)-t+e.charCodeAt(n),t|=0;return Math.abs(t)},N=e=>e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`),P=e=>{let t=e.trim().split(/[\s._-]+/).filter(Boolean);return t.length===0?`AI`:t.slice(0,2).map(e=>e[0]?.toUpperCase()).join(``)||`AI`},F=(e,t=128)=>{let n=e.trim()||`AI Persona`,r=M(n),[i,a]=j[r%j.length],o=N(P(n)),s=`persona-avatar-${r}-${t}`,c=t>=96?44:24,l=`
|
|
3
|
-
<svg xmlns="http://www.w3.org/2000/svg" width="${t}" height="${t}" viewBox="0 0 ${t} ${t}" role="img" aria-label="${N(n)} avatar">
|
|
4
|
-
<defs>
|
|
5
|
-
<linearGradient id="${s}" x1="0" y1="0" x2="1" y2="1">
|
|
6
|
-
<stop offset="0%" stop-color="${i}" />
|
|
7
|
-
<stop offset="100%" stop-color="${a}" />
|
|
8
|
-
</linearGradient>
|
|
9
|
-
</defs>
|
|
10
|
-
<rect width="${t}" height="${t}" rx="${Math.round(t*.22)}" fill="url(#${s})" />
|
|
11
|
-
<circle cx="${t*.22}" cy="${t*.22}" r="${t*.26}" fill="rgba(255,255,255,0.16)" />
|
|
12
|
-
<text x="50%" y="52%" dominant-baseline="middle" text-anchor="middle" fill="white" font-family="Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif" font-size="${c}" font-weight="700">${o}</text>
|
|
13
|
-
</svg>
|
|
14
|
-
`;return`data:image/svg+xml;charset=UTF-8,${encodeURIComponent(l)}`},I=(e,t=128)=>e.avatar?.trim()||F(e.name,t),L=(e,t,n=128)=>{e.onerror=null,e.src=F(t,n)},R={getPersonas:()=>{if(t()){let e=[{id:`demo-1`,user_id:`default`,name:`Creative Assistant`,description:`Helpful assistant for creative tasks`,model:`llama3.3:latest`,parameters:{temperature:.8,top_p:.9,context_window:4096,system_prompt:`You are a creative and helpful assistant. Provide thoughtful and engaging responses.`},avatar:F(`Creative Assistant`,128),created_at:Date.now()-864e5,updated_at:Date.now()-864e5},{id:`demo-2`,user_id:`default`,name:`Research Assistant`,description:`Academic assistant for research and learning`,model:`qwen3:7b`,parameters:{temperature:.3,top_p:.8,context_window:8192,system_prompt:`You are a knowledgeable research assistant. Provide detailed, informative explanations.`},avatar:F(`Research Assistant`,128),created_at:Date.now()-1728e5,updated_at:Date.now()-1728e5}];return i(e)}return a.get(`/personas`).then(e=>e.data)},getPersona:e=>t()?i({id:e,user_id:`default`,name:`Sample Assistant`,description:`A sample assistant for demonstration`,model:`llama3.2:latest`,parameters:{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},created_at:Date.now(),updated_at:Date.now()}):a.get(`/personas/${e}`).then(e=>e.data),createPersona:e=>{if(t()){let t={id:`demo-`+Date.now(),user_id:`default`,...e,created_at:Date.now(),updated_at:Date.now()};return i(t)}return a.post(`/personas`,e).then(e=>e.data)},updatePersona:(e,n)=>{if(t()){let t={id:e,user_id:`default`,name:n.name||`Updated Sample Assistant`,description:n.description,model:n.model||`llama3.2:latest`,parameters:n.parameters||{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},avatar:n.avatar,background:n.background,created_at:Date.now()-864e5,updated_at:Date.now()};return i(t)}return a.put(`/personas/${e}`,n).then(e=>e.data)},deletePersona:e=>t()?i(void 0):a.delete(`/personas/${e}`).then(e=>e.data),exportPersona:e=>{if(t()){let e={name:`Sample Assistant`,description:`A sample assistant for demonstration`,model:`llama3.2:latest`,params:{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},exportedAt:Date.now(),version:`1.0.0`};return Promise.resolve(e)}return a.get(`/personas/${e}/export`).then(e=>e.data)},importPersona:e=>{if(t()){let t={id:`demo-imported-`+Date.now(),user_id:`default`,name:e.name,description:e.description,model:e.model,parameters:e.params,avatar:e.avatar,background:e.background,created_at:Date.now(),updated_at:Date.now(),embedding_model:e.embedding_model,memory_settings:e.memory_settings,mutation_settings:e.mutation_settings};return i(t)}return a.post(`/personas/import`,e).then(e=>e.data)},getPersonasCount:()=>t()?i({count:2}):a.get(`/personas/stats/count`).then(e=>e.data),getDefaultParameters:()=>t()?i({temperature:.7,top_p:.9,top_k:40,context_window:4096,max_tokens:1024,system_prompt:``,repeat_penalty:1.1,presence_penalty:0,frequency_penalty:0}):a.get(`/personas/defaults/parameters`).then(e=>e.data),getMemoryStatus:e=>t()?i({status:`active`,memory_count:42,last_backup:Date.now()-864e5,size_mb:2.3}):a.get(`/personas/${e}/memory/status`).then(e=>e.data),wipeMemories:e=>t()?i({deleted_count:42}):a.delete(`/personas/${e}/memory`).then(e=>e.data),backupPersona:e=>{if(t()){let t=JSON.stringify({persona_id:e,backup_date:new Date().toISOString(),data:`demo backup data`});return Promise.resolve(new Blob([t],{type:`application/json`}))}return a.get(`/personas/${e}/backup`,{responseType:`blob`}).then(e=>e.data)},exportPersonaDNA:e=>{if(t()){let t=JSON.stringify({persona_id:e,export_date:new Date().toISOString(),dna:`demo DNA data`,memories:[],learned_behaviors:{}});return Promise.resolve(new Blob([t],{type:`application/json`}))}return a.get(`/personas/${e}/export/dna`,{responseType:`blob`}).then(e=>e.data)},importPersonaDNA:e=>{if(t()){let e={id:`demo-dna-`+Date.now(),user_id:`default`,name:`Imported Persona`,description:`Persona imported from DNA`,model:`llama3.2:latest`,parameters:{temperature:.7,top_p:.9,context_window:4096,system_prompt:`You are a helpful assistant.`},created_at:Date.now(),updated_at:Date.now()};return i(e)}let n=new FormData;return n.append(`dnaFile`,e),a.post(`/personas/import/dna`,n).then(e=>e.data)},downloadPersona:async(e,t)=>{try{let n=await R.exportPersona(e),r=new Blob([JSON.stringify(n,null,2)],{type:`application/json`}),i=URL.createObjectURL(r),a=document.createElement(`a`);a.href=i,a.download=`${t}.json`,document.body.appendChild(a),a.click(),document.body.removeChild(a),URL.revokeObjectURL(i)}catch(e){throw r.error(`Error while downloading persona:`,e),Error(`Failed to download persona: ${e instanceof Error?e.message:String(e)}`)}}},z=e=>{let t=Date.now();return{range:{from:t-Math.max(0,e-1)*864e5,to:t,days:e},totals:{calls:0,successfulCalls:0,failedCalls:0,cancelledCalls:0,meteredCalls:0,promptTokens:0,completionTokens:0,reportedTokens:0,averageLatencyMs:0,uniqueUsers:0},series:[],plugins:[],models:[],capabilities:[]}},B={getUsage:(e=30)=>t()?i(z(e)):a.get(`/plugins/usage`,{params:{days:e}}).then(e=>e.data),getAllPlugins:()=>t()?i([]):a.get(`/plugins`).then(e=>e.data),discoverModels:e=>t()?i({models:[],outcome:`unavailable`}):a.post(`/plugins/discover/${encodeURIComponent(e)}`).then(e=>e.data),uploadPlugin:e=>{if(t())return i({},!1);let n=new FormData;return n.append(`plugin`,e),a.post(`/plugins/upload`,n).then(e=>e.data)},installPlugin:e=>t()?i({},!1):a.post(`/plugins/install`,e).then(e=>e.data),updatePlugin:(e,n)=>t()?i({},!1):a.put(`/plugins/${e}`,n).then(e=>e.data),deletePlugin:e=>t()?i(void 0):a.delete(`/plugins/${e}`).then(e=>e.data),activatePlugin:e=>t()?i(!1,!1):a.post(`/plugins/activate/${e}`).then(e=>e.data),deactivatePlugin:e=>{if(t())return i(void 0);let n=e?`/plugins/deactivate/${e}`:`/plugins/deactivate`;return a.post(n).then(e=>e.data)},getActivePlugin:()=>t()?i(null):a.get(`/plugins/active`).then(e=>e.data),getPluginStatus:()=>t()?i([]):a.get(`/plugins/status`).then(e=>e.data),exportPlugin:e=>t()?Promise.resolve(new Blob([`{}`],{type:`application/json`})):a.get(`/plugins/${e}/export`,{responseType:`blob`}).then(e=>e.data),getCredentials:()=>t()?i([]):a.get(`/plugins/credentials/all`).then(e=>e.data),setApiKey:(e,n)=>t()?i(!1,!1):a.post(`/plugins/${e}/credentials`,{api_key:n}).then(e=>e.data),deleteApiKey:e=>t()?i(!1,!1):a.delete(`/plugins/${e}/credentials`).then(e=>e.data),checkApiKey:e=>t()?i(!1):a.get(`/plugins/${e}/credentials/check`).then(e=>e.data),getVariables:e=>t()?i({}):a.get(`/plugins/${e}/variables`).then(e=>e.data),setVariables:(e,n,r=[])=>t()?i(!0):a.put(`/plugins/${e}/variables`,{variables:n,unset:r}).then(e=>e.data),resetVariables:e=>t()?i(!0):a.delete(`/plugins/${e}/variables`).then(e=>e.data)},V={getPreferences:()=>t()?i(h()):a.get(`/preferences`).then(e=>e.data),updatePreferences:e=>t()?i(g(e)):a.put(`/preferences`,e).then(e=>e.data),setDefaultModel:(e,n,r)=>t()?i(g({defaultModel:e,defaultProviderType:n,defaultProviderId:n===`plugin`||n===`agent`?r:null})):a.put(`/preferences/default-model`,{model:e,providerType:n,providerId:r}).then(e=>e.data),setSystemMessage:e=>t()?i(g({systemMessage:e})):a.put(`/preferences/system-message`,{message:e}).then(e=>e.data),setGenerationOptions:e=>t()?i(g({generationOptions:e})):a.put(`/preferences/generation-options`,e).then(e=>e.data),setModelGenerationOptions:(e,t)=>a.put(`/preferences/model-generation-options`,{model:e,options:t}).then(e=>e.data),resetGenerationOptions:()=>t()?i(g({generationOptions:p.generationOptions})):a.post(`/preferences/generation-options/reset`).then(e=>e.data),setEmbeddingSettings:e=>t()?i(g({embeddingSettings:e})):a.put(`/preferences/embedding-settings`,e).then(e=>e.data),resetEmbeddingSettings:()=>t()?i(g({embeddingSettings:p.embeddingSettings})):a.post(`/preferences/embedding-settings/reset`).then(e=>e.data),importData:(e,n=`replace`)=>t()?i({theme:{mode:`dark`,adaptToAccent:!1,accent:`blue`,customAccent:`#2563eb`},defaultModel:`llama3.2`,systemMessage:`You are a helpful assistant.`,generationOptions:{},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.7},showUsername:!1,workRemoteProviderDisclosureDismissed:!1}):a.post(`/preferences/import`,{data:e,mergeStrategy:n}).then(e=>e.data)},H={getDiagnostics:()=>a.get(`/system`).then(e=>e.data)};function U(e,t,n){if(t)return e.find(e=>e.model===t&&(!n||e.plugin===n))}function W(e,t,n){return U(e,t,n)||e[0]}function G(e){return`${encodeURIComponent(e.plugin)}::${encodeURIComponent(e.model)}`}var K={getModels:()=>t()?i([{model:`tts-1`,plugin:`openai`,config:{voices:[`alloy`,`echo`,`fable`,`onyx`,`nova`,`shimmer`],default_voice:`alloy`,formats:[`mp3`,`opus`,`aac`,`flac`,`wav`],default_format:`mp3`,max_characters:4096}}]):a.get(`/tts/models`).then(e=>e.data),getPlugins:()=>t()?i([{id:`openai`,name:`OpenAI GPT`,models:[`tts-1`,`tts-1-hd`],config:{voices:[`alloy`,`echo`,`fable`,`onyx`,`nova`,`shimmer`],default_voice:`alloy`}}]):a.get(`/tts/plugins`).then(e=>e.data),getVoices:e=>t()?i({voices:[`alloy`,`echo`,`fable`,`onyx`,`nova`,`shimmer`],default_voice:`alloy`,formats:[`mp3`,`opus`,`aac`,`flac`,`wav`],default_format:`mp3`,max_characters:4096,supports_streaming:!1}):a.get(`/tts/voices/${e}`).then(e=>e.data),generateBase64:e=>{if(t())return i({audio:``,format:e.response_format||`mp3`,mimeType:`audio/mpeg`,size:0});let n={...e,pluginId:e.pluginId||void 0};return a.post(`/tts/generate-base64`,n).then(e=>e.data)},generate:async e=>{if(t())return new Blob([],{type:`audio/mpeg`});let n={...e,pluginId:e.pluginId||void 0};return(await a.post(`/tts/generate`,n,{responseType:`blob`})).data},speak:async(e,t={})=>{try{t.onStart?.();let n=await K.generateBase64({model:t.model||`tts-1`,pluginId:t.pluginId,input:e,voice:t.voice,speed:t.speed,response_format:t.responseFormat});if(!n.success||!n.data?.audio)throw Error(n.message||`Failed to generate speech`);let r=`data:${n.data.mimeType};base64,${n.data.audio}`,i=new Audio(r);return i.onended=()=>t.onEnd?.(),i.onerror=()=>t.onError?.(Error(`Audio playback failed`)),await i.play(),i}catch(e){let n=e instanceof Error?e:Error(`Unknown error`);return t.onError?.(n),null}}},q=e({MODELS_CHANGED_EVENT:()=>O,agentCliApi:()=>o,personaApi:()=>R,preferencesApi:()=>V});export{c as C,_ as S,S as _,K as a,v as b,B as c,L as d,O as f,C as g,T as h,W as i,R as l,E as m,U as n,H as o,A as p,G as r,V as s,q as t,I as u,x as v,l as w,y as x,b as y};
|
|
@@ -1,2 +0,0 @@
|
|
|
1
|
-
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["js/api-DhmVEJr2.js","js/rolldown-runtime-hePW80VL.js","js/logger-DSXjF4ye.js","js/config-CV8L89A5.js","js/workApi-LrQmhNxb.js","js/router-vendor-Ca9zqOqT.js","js/markdown-core-DHnR5Hw8.js","js/utils-vendor-1zob7nK9.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./router-vendor-Ca9zqOqT.js";import{o as t,t as n}from"./utils-vendor-1zob7nK9.js";import{i as r,r as i,t as a}from"./logger-DSXjF4ye.js";var o=`dark`,s=`blue`,c=`#2563eb`,l=[{id:`violet`,label:`Violet`,color:`#7c3aed`,foreground:`#ffffff`},{id:`blue`,label:`Blue`,color:`#2563eb`,foreground:`#ffffff`},{id:`cyan`,label:`Cyan`,color:`#0e7490`,foreground:`#ffffff`},{id:`teal`,label:`Teal`,color:`#0f766e`,foreground:`#ffffff`},{id:`emerald`,label:`Emerald`,color:`#15803d`,foreground:`#ffffff`},{id:`amber`,label:`Coral`,color:`#ff7b52`,foreground:`#3d120c`},{id:`rose`,label:`Rose`,color:`#e11d48`,foreground:`#ffffff`},{id:`slate`,label:`Slate`,color:`#475569`,foreground:`#ffffff`}],u=[`50`,`100`,`200`,`300`,`400`,`500`,`600`,`700`,`800`,`900`,`950`],d=[`25`,...u],f=[`canvas`,`surface`,`surface-subtle`,`surface-raised`,`surface-overlay`,`surface-inverse`,`ink`,`ink-muted`,`ink-subtle`,`ink-inverse`,`line`,`line-strong`],p={multiplier:.24,minimum:6,maximum:24},m={multiplier:.36,minimum:6,maximum:32},h={25:99,50:97,100:94,200:88,300:80,400:66,500:48,600:36,700:27,800:18,900:11,950:6},g={25:13,50:4,100:7,200:10,300:16,400:27,500:46,600:65,700:82,800:89,900:95,950:99},_={canvas:{lightness:96,saturationFactor:1},surface:{lightness:98,saturationFactor:.9},"surface-subtle":{lightness:93,saturationFactor:1},"surface-raised":{lightness:99,saturationFactor:.8},"surface-overlay":{lightness:100,saturationFactor:0},"surface-inverse":{lightness:10,saturationFactor:.7},ink:{lightness:10,saturationFactor:.45},"ink-muted":{lightness:38,saturationFactor:.35},"ink-subtle":{lightness:54,saturationFactor:.4},"ink-inverse":{lightness:98,saturationFactor:.4},line:{lightness:86,saturationFactor:.8},"line-strong":{lightness:75,saturationFactor:.65}},v={canvas:{lightness:5,saturationFactor:.9},surface:{lightness:7,saturationFactor:.9},"surface-subtle":{lightness:9,saturationFactor:1},"surface-raised":{lightness:11,saturationFactor:1},"surface-overlay":{lightness:13,saturationFactor:1},"surface-inverse":{lightness:96,saturationFactor:.35},ink:{lightness:96,saturationFactor:.3},"ink-muted":{lightness:67,saturationFactor:.35},"ink-subtle":{lightness:48,saturationFactor:.4},"ink-inverse":{lightness:7,saturationFactor:.45},line:{lightness:18,saturationFactor:.8},"line-strong":{lightness:28,saturationFactor:.65}},y={violet:{50:`#f5f3ff`,100:`#ede9fe`,200:`#ddd6fe`,300:`#c4b5fd`,400:`#a78bfa`,500:`#7c3aed`,600:`#6d28d9`,700:`#5b21b6`,800:`#4c1d95`,900:`#3b0764`,950:`#2e1065`},blue:{50:`#eff6ff`,100:`#dbeafe`,200:`#bfdbfe`,300:`#93c5fd`,400:`#60a5fa`,500:`#2563eb`,600:`#1d4ed8`,700:`#1e40af`,800:`#1e3a8a`,900:`#172554`,950:`#0f172a`},cyan:{50:`#ecfeff`,100:`#cffafe`,200:`#a5f3fc`,300:`#67e8f9`,400:`#22d3ee`,500:`#0e7490`,600:`#155e75`,700:`#164e63`,800:`#083344`,900:`#092f3f`,950:`#062634`},teal:{50:`#f0fdfa`,100:`#ccfbf1`,200:`#99f6e4`,300:`#5eead4`,400:`#2dd4bf`,500:`#0f766e`,600:`#0f625d`,700:`#115e59`,800:`#134e4a`,900:`#042f2e`,950:`#022c22`},emerald:{50:`#ecfdf5`,100:`#d1fae5`,200:`#a7f3d0`,300:`#6ee7b7`,400:`#34d399`,500:`#15803d`,600:`#166534`,700:`#14532d`,800:`#064e3b`,900:`#052e16`,950:`#022c22`},amber:{50:`#fff5f1`,100:`#ffe8df`,200:`#ffd0c2`,300:`#ffae96`,400:`#ff9273`,500:`#ff7b52`,600:`#c94a27`,700:`#a83a1f`,800:`#87301f`,900:`#70291e`,950:`#3d120c`},rose:{50:`#fff1f2`,100:`#ffe4e6`,200:`#fecdd3`,300:`#fda4af`,400:`#fb7185`,500:`#e11d48`,600:`#be123c`,700:`#9f1239`,800:`#881337`,900:`#4c0519`,950:`#2d0714`},slate:{50:`#f8fafc`,100:`#f1f5f9`,200:`#e2e8f0`,300:`#cbd5e1`,400:`#94a3b8`,500:`#475569`,600:`#334155`,700:`#1e293b`,800:`#0f172a`,900:`#020617`,950:`#010313`}},b={50:97,100:94,200:88,300:76,400:64,500:42,600:34,700:27,800:21,900:16,950:10},x=(e,t,n)=>Math.min(Math.max(e,t),n),S=e=>{if(!e)return null;let t=e.trim().match(/^#?([0-9a-f]{3}|[0-9a-f]{6})$/i);if(!t)return null;let n=t[1];return`#${(n.length===3?n.split(``).map(e=>`${e}${e}`).join(``):n).toLowerCase()}`},C=e=>{let t=S(e)||`#2563eb`,n=parseInt(t.slice(1),16);return{r:n>>16&255,g:n>>8&255,b:n&255}},w=(e,t,n)=>`#${[e,t,n].map(e=>x(Math.round(e),0,255).toString(16).padStart(2,`0`)).join(``)}`,T=(e,t,n)=>{let r=e/255,i=t/255,a=n/255,o=Math.max(r,i,a),s=Math.min(r,i,a),c=(o+s)/2;if(o===s)return{h:0,s:0,l:c*100};let l=o-s,u=c>.5?l/(2-o-s):l/(o+s),d=0;return d=o===r?(i-a)/l+(i<a?6:0):o===i?(a-r)/l+2:(r-i)/l+4,{h:d*60,s:u*100,l:c*100}},E=(e,t,n)=>{let r=x(t,0,100)/100,i=x(n,0,100)/100,a=(1-Math.abs(2*i-1))*r,o=(e%360+360)%360,s=a*(1-Math.abs(o/60%2-1)),c=i-a/2,l=0,u=0,d=0;return o<60?(l=a,u=s):o<120?(l=s,u=a):o<180?(u=a,d=s):o<240?(u=s,d=a):o<300?(l=s,d=a):(l=a,d=s),w((l+c)*255,(u+c)*255,(d+c)*255)},D=e=>{let{r:t,g:n,b:r}=C(e),i=[t,n,r].map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return i[0]*.2126+i[1]*.7152+i[2]*.0722},O=(e,t)=>{let n=D(e),r=D(t),i=Math.max(n,r),a=Math.min(n,r);return(i+.05)/(a+.05)},k=(e,t,n)=>{let r=n,i=E(e,t,r);for(;O(`#ffffff`,i)<4.5&&r>12;)r-=2,i=E(e,t,r);return i},A=e=>{let{r:t,g:n,b:r}=C(S(e)||`#2563eb`),{h:i,s:a}=T(t,n,r),o=a<8?a:x(a,42,88);return u.reduce((e,t)=>{let n=b[t],r=Number(t)<300?o*.72:o;return e[t]=t===`500`||t===`600`?k(i,r,n):E(i,r,n),e},{})},j=e=>{let t=e?.mode===`light`?`light`:o,n=e?.accent===`custom`?`custom`:e?.accent,r=l.some(e=>e.id===n)?n:s,i=S(e?.customAccent)||`#2563eb`;return{mode:t,adaptToAccent:e?.adaptToAccent===!0,accent:n===`custom`?`custom`:r,customAccent:i}},M=()=>j({mode:o}),N=e=>{let t=j(e);return t.accent===`custom`?A(t.customAccent):y[t.accent||`blue`]},P=e=>{let t=j(e);return t.accent===`custom`?t.customAccent||`#2563eb`:l.find(e=>e.id===t.accent)?.color||`#2563eb`},F=(e,t,n)=>t===0||e<8?e*t:x(e*n.multiplier*t,n.minimum*t,n.maximum*t),I=(e,t,n,r)=>d.reduce((i,a)=>(i[a]=E(e,F(t,1,r),n[a]),i),{}),L=(e,t,n,r)=>f.reduce((i,a)=>{let o=n[a];return i[a]=E(e,F(t,o.saturationFactor,r),o.lightness),i},{}),R=(e,t,n)=>{let{r,g:i,b:a}=C(n);e.style.setProperty(t,`${r} ${i} ${a}`)},z=e=>{for(let t of d)e.style.removeProperty(`--color-gray-${t}`),e.style.removeProperty(`--color-dark-${t}`);for(let t of f)e.style.removeProperty(`--color-${t}`)},B=(e,t)=>{let{r:n,g:r,b:i}=C(P(t)),{h:a,s:o}=T(n,r,i),s=t.mode===`light`?m:p,c=I(a,o,h,s),l=I(a,o,g,p),u=L(a,o,t.mode===`dark`?v:_,s);for(let t of d)R(e,`--color-gray-${t}`,c[t]),R(e,`--color-dark-${t}`,l[t]);for(let t of f)R(e,`--color-${t}`,u[t])},V=e=>{if(typeof document>`u`)return;let t=j(e),n=document.documentElement,r=N(t);n.classList.remove(`dark`,`ophelia`),t.mode===`dark`&&n.classList.add(`dark`),n.style.colorScheme=t.mode,n.dataset.accent=t.accent||`blue`,n.dataset.themeStyle=t.adaptToAccent?`accent`:`default`;for(let e of u){let{r:t,g:i,b:a}=C(r[e]),o=`${t} ${i} ${a}`;n.style.setProperty(`--color-primary-${e}`,o),n.style.setProperty(`--color-accent-${e}`,o)}t.adaptToAccent?B(n,t):z(n)},H=a(`store:app-store`),U=250,W=null,G=t()(n((t,n)=>({theme:M(),themeSyncPending:!1,syncThemePreference:async i=>{if(W&&(clearTimeout(W),W=null),!(!r()&&!localStorage.getItem(`auth-token`)))try{let{preferencesApi:r}=await e(async()=>{let{preferencesApi:e}=await import(`./api-DhmVEJr2.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]));if(!(await r.updatePreferences({theme:i})).success){H.warn(`Failed to save theme preference to backend`);return}let a=j(n().theme),o=j(i);a.mode===o.mode&&a.adaptToAccent===o.adaptToAccent&&a.accent===o.accent&&a.customAccent===o.customAccent?t({themeSyncPending:!1}):(t({themeSyncPending:!0}),n().scheduleThemePreferenceSync())}catch(e){H.warn(`Failed to save theme preference to backend:`,e)}},scheduleThemePreferenceSync:()=>{W&&clearTimeout(W),W=setTimeout(()=>{W=null,n().syncThemePreference(j(n().theme))},U)},setTheme:e=>{let n=j(e);t(e=>({theme:n,preferences:{...e.preferences,theme:n}})),V(n)},updateTheme:e=>{let r=j(e);n().setTheme(r),t({themeSyncPending:!0}),n().scheduleThemePreferenceSync()},toggleTheme:()=>{let e=n().theme,t=e.mode===`dark`?`light`:`dark`;n().updateTheme({...e,mode:t})},sidebarOpen:!0,sidebarCompact:!1,setSidebarOpen:e=>t({sidebarOpen:e}),setSidebarCompact:e=>t({sidebarCompact:e}),toggleSidebar:()=>t(e=>({sidebarOpen:!e.sidebarOpen})),toggleSidebarCompact:()=>t(e=>({sidebarCompact:!e.sidebarCompact})),artifactPanelOpen:!1,artifactPanelArtifact:null,openArtifactPanel:e=>t({artifactPanelOpen:!0,artifactPanelArtifact:e}),closeArtifactPanel:()=>t({artifactPanelOpen:!1,artifactPanelArtifact:null}),preferences:{theme:M(),defaultModel:``,defaultProviderType:null,defaultProviderId:null,visionModel:``,visionProviderType:null,visionProviderId:null,systemMessage:``,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.3},titleSettings:{autoTitle:!1,taskModel:``,taskProviderType:null,taskProviderId:null},showUsername:!1,hapticFeedbackEnabled:!1,workRemoteProviderDisclosureDismissed:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}},setPreferences:e=>{let n=e.theme?j(e.theme):null;t(t=>({...n&&{theme:n},preferences:{...t.preferences,...e,...n&&{theme:n}}})),n&&V(n)},loadPreferences:async()=>{try{let{preferencesApi:r}=await e(async()=>{let{preferencesApi:e}=await import(`./api-DhmVEJr2.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5,6,7])),i=await r.getPreferences();if(i.success&&i.data){let e=i.data,r=n().themeSyncPending?j(n().theme):null;n().setPreferences(r?{...e,theme:r}:e),t({backgroundImage:e.backgroundSettings?.imageUrl||null}),r&&n().syncThemePreference(r)}}catch(e){H.warn(`Failed to load preferences from backend:`,e)}},isGenerating:!1,setIsGenerating:e=>t({isGenerating:e}),hasSeenSettingsNotification:!1,markSettingsNotificationAsSeen:()=>t({hasSeenSettingsNotification:!0}),isDemoMode:r(),demoConfig:i(),setDemoMode:e=>{t({isDemoMode:e,demoConfig:i()})},backgroundImage:null,setBackgroundImage:async r=>{if(t({backgroundImage:r}),r){let t=n(),i={...t.preferences,backgroundSettings:{enabled:!0,imageUrl:r,blurAmount:t.preferences.backgroundSettings?.blurAmount||10,opacity:t.preferences.backgroundSettings?.opacity||.6}};t.setPreferences(i);try{let{preferencesApi:t}=await e(async()=>{let{preferencesApi:e}=await import(`./api-DhmVEJr2.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]));await t.updatePreferences({backgroundSettings:i.backgroundSettings})}catch(e){H.warn(`Failed to save background settings to backend:`,e)}}},uploadBackgroundImage:async e=>{try{let t=new FileReader;return new Promise((r,i)=>{t.onload=async e=>{try{let t=e.target?.result;await n().setBackgroundImage(t),r()}catch(e){i(e)}},t.onerror=i,t.readAsDataURL(e)})}catch(e){throw H.error(`Failed to upload background image:`,e),e}},removeBackgroundImage:async()=>{t({backgroundImage:null});let r=n(),i={enabled:!1,imageUrl:``,blurAmount:r.preferences.backgroundSettings?.blurAmount||10,opacity:r.preferences.backgroundSettings?.opacity||.6};r.setPreferences({backgroundSettings:i});try{let{preferencesApi:t}=await e(async()=>{let{preferencesApi:e}=await import(`./api-DhmVEJr2.js`).then(e=>e.t);return{preferencesApi:e}},__vite__mapDeps([0,1,2,3,4,5,6,7]));await t.updatePreferences({backgroundSettings:i})}catch(e){H.warn(`Failed to save background removal to backend:`,e)}},clearUserState:()=>{let e=M();W&&(clearTimeout(W),W=null),t({theme:e,themeSyncPending:!1,backgroundImage:null,preferences:{theme:e,defaultModel:``,defaultProviderType:null,defaultProviderId:null,visionModel:``,visionProviderType:null,visionProviderId:null,systemMessage:``,generationOptions:{temperature:.7,top_p:.9,top_k:40,num_predict:1024},embeddingSettings:{enabled:!1,model:`nomic-embed-text`,chunkSize:1e3,chunkOverlap:200,similarityThreshold:.3},titleSettings:{autoTitle:!1,taskModel:``,taskProviderType:null,taskProviderId:null},showUsername:!1,workRemoteProviderDisclosureDismissed:!1,backgroundSettings:{enabled:!1,imageUrl:``,blurAmount:10,opacity:.6}}}),V(e)}}),{name:`libre-webui-app-state`,onRehydrateStorage:()=>e=>{e&&e.setTheme(j(e.theme))},partialize:e=>{let{backgroundSettings:t,...n}=e.preferences;return{theme:e.theme,themeSyncPending:e.themeSyncPending,sidebarOpen:e.sidebarOpen,sidebarCompact:e.sidebarCompact,preferences:n,hasSeenSettingsNotification:e.hasSeenSettingsNotification}}}));typeof window<`u`&&(()=>{let{theme:e,setTheme:t}=G.getState();t(e)})();export{P as a,c as i,l as n,j as o,s as r,G as t};
|