charness 3.1.0 → 3.3.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/.env.example +11 -13
- package/DEVELOPMENT.md +27 -6
- package/MIGRATION_1_TO_2.md +1 -1
- package/MIGRATION_RENAME_TO_CHARNESS.md +133 -0
- package/README.md +185 -618
- package/SETUP.md +644 -0
- package/dist/adapters/adapterEventRouting.d.ts +2 -1
- package/dist/adapters/adapterEventRouting.d.ts.map +1 -1
- package/dist/adapters/adapterEventRouting.js +3 -0
- package/dist/adapters/adapterEventRouting.js.map +1 -1
- package/dist/adapters/adapterNames.d.ts +13 -0
- package/dist/adapters/adapterNames.d.ts.map +1 -1
- package/dist/adapters/adapterNames.js +16 -0
- package/dist/adapters/adapterNames.js.map +1 -1
- package/dist/adapters/backendUnavailableError.d.ts +11 -0
- package/dist/adapters/backendUnavailableError.d.ts.map +1 -0
- package/dist/adapters/backendUnavailableError.js +19 -0
- package/dist/adapters/backendUnavailableError.js.map +1 -0
- package/dist/adapters/claudeCliAdapter.d.ts +30 -7
- package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeCliAdapter.js +71 -17
- package/dist/adapters/claudeCliAdapter.js.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.d.ts +36 -3
- package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +95 -31
- package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
- package/dist/adapters/createAdapter.d.ts +3 -14
- package/dist/adapters/createAdapter.d.ts.map +1 -1
- package/dist/adapters/createAdapter.js +9 -19
- package/dist/adapters/createAdapter.js.map +1 -1
- package/dist/adapters/openCodeAdapter.d.ts +140 -12
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +386 -120
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/apiErrorRetry.d.ts +70 -6
- package/dist/apiErrorRetry.d.ts.map +1 -1
- package/dist/apiErrorRetry.js +312 -34
- package/dist/apiErrorRetry.js.map +1 -1
- package/dist/apiRetryKick.d.ts +26 -1
- package/dist/apiRetryKick.d.ts.map +1 -1
- package/dist/apiRetryKick.js +41 -2
- package/dist/apiRetryKick.js.map +1 -1
- package/dist/bot.d.ts +2 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +743 -190
- package/dist/bot.js.map +1 -1
- package/dist/cli/bot.d.ts +4 -2
- package/dist/cli/bot.d.ts.map +1 -1
- package/dist/cli/bot.js +11 -3
- package/dist/cli/bot.js.map +1 -1
- package/dist/cli/botEntry.js +3 -1
- package/dist/cli/botEntry.js.map +1 -1
- package/dist/cli/claudeProfiles.d.ts +4 -4
- package/dist/cli/claudeProfiles.js +5 -5
- package/dist/cli/claudeProfiles.js.map +1 -1
- package/dist/cli/envLoader.d.ts +6 -5
- package/dist/cli/envLoader.d.ts.map +1 -1
- package/dist/cli/envLoader.js +8 -27
- package/dist/cli/envLoader.js.map +1 -1
- package/dist/cli/hot.d.ts +9 -3
- package/dist/cli/hot.d.ts.map +1 -1
- package/dist/cli/hot.js +55 -19
- package/dist/cli/hot.js.map +1 -1
- package/dist/cli.js +12 -12
- package/dist/cli.js.map +1 -1
- package/dist/configDirFile.d.ts +73 -0
- package/dist/configDirFile.d.ts.map +1 -0
- package/dist/configDirFile.js +216 -0
- package/dist/configDirFile.js.map +1 -0
- package/dist/connectors/jira/adf.d.ts +21 -0
- package/dist/connectors/jira/adf.d.ts.map +1 -1
- package/dist/connectors/jira/adf.js +39 -0
- package/dist/connectors/jira/adf.js.map +1 -1
- package/dist/connectors/jira/answerSink.d.ts +20 -3
- package/dist/connectors/jira/answerSink.d.ts.map +1 -1
- package/dist/connectors/jira/answerSink.js +126 -13
- package/dist/connectors/jira/answerSink.js.map +1 -1
- package/dist/connectors/jira/client.d.ts +4 -0
- package/dist/connectors/jira/client.d.ts.map +1 -1
- package/dist/connectors/jira/client.js +3 -0
- package/dist/connectors/jira/client.js.map +1 -1
- package/dist/connectors/jira/config.d.ts +10 -1
- package/dist/connectors/jira/config.d.ts.map +1 -1
- package/dist/connectors/jira/config.js +11 -2
- package/dist/connectors/jira/config.js.map +1 -1
- package/dist/connectors/jira/connector.d.ts +7 -1
- package/dist/connectors/jira/connector.d.ts.map +1 -1
- package/dist/connectors/jira/connector.js +23 -4
- package/dist/connectors/jira/connector.js.map +1 -1
- package/dist/connectors/jira/contextLedger.d.ts +6 -0
- package/dist/connectors/jira/contextLedger.d.ts.map +1 -1
- package/dist/connectors/jira/contextLedger.js +16 -0
- package/dist/connectors/jira/contextLedger.js.map +1 -1
- package/dist/connectors/jira/contextPreamble.d.ts.map +1 -1
- package/dist/connectors/jira/contextPreamble.js +6 -3
- package/dist/connectors/jira/contextPreamble.js.map +1 -1
- package/dist/connectors/jira/inbound.d.ts +60 -7
- package/dist/connectors/jira/inbound.d.ts.map +1 -1
- package/dist/connectors/jira/inbound.js +169 -16
- package/dist/connectors/jira/inbound.js.map +1 -1
- package/dist/connectors/jira/issueBlocks.d.ts +6 -1
- package/dist/connectors/jira/issueBlocks.d.ts.map +1 -1
- package/dist/connectors/jira/issueBlocks.js +5 -1
- package/dist/connectors/jira/issueBlocks.js.map +1 -1
- package/dist/connectors/jira/prompt.d.ts +2 -0
- package/dist/connectors/jira/prompt.d.ts.map +1 -1
- package/dist/connectors/jira/prompt.js +16 -0
- package/dist/connectors/jira/prompt.js.map +1 -1
- package/dist/connectors/jira/trigger.d.ts +12 -3
- package/dist/connectors/jira/trigger.d.ts.map +1 -1
- package/dist/connectors/jira/trigger.js +8 -1
- package/dist/connectors/jira/trigger.js.map +1 -1
- package/dist/connectors/jira/triggerLog.d.ts +10 -3
- package/dist/connectors/jira/triggerLog.d.ts.map +1 -1
- package/dist/connectors/jira/triggerLog.js +18 -2
- package/dist/connectors/jira/triggerLog.js.map +1 -1
- package/dist/connectors/telegram/commands/autoContinueLimits.d.ts +2 -2
- package/dist/connectors/telegram/commands/autoContinueLimits.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/autoContinueLimits.js +4 -4
- package/dist/connectors/telegram/commands/autoContinueLimits.js.map +1 -1
- package/dist/connectors/telegram/commands/backendSwitch.d.ts +25 -0
- package/dist/connectors/telegram/commands/backendSwitch.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/backendSwitch.js +104 -0
- package/dist/connectors/telegram/commands/backendSwitch.js.map +1 -0
- package/dist/connectors/telegram/commands/callbackMessage.d.ts +12 -0
- package/dist/connectors/telegram/commands/callbackMessage.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/callbackMessage.js +24 -0
- package/dist/connectors/telegram/commands/callbackMessage.js.map +1 -1
- package/dist/connectors/telegram/commands/callbackToast.d.ts +36 -0
- package/dist/connectors/telegram/commands/callbackToast.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/callbackToast.js +83 -0
- package/dist/connectors/telegram/commands/callbackToast.js.map +1 -0
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts +18 -0
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.js +220 -66
- package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
- package/dist/connectors/telegram/commands/displayModes.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/displayModes.js +4 -2
- package/dist/connectors/telegram/commands/displayModes.js.map +1 -1
- package/dist/connectors/telegram/commands/fallbackChain.d.ts +5 -8
- package/dist/connectors/telegram/commands/fallbackChain.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/fallbackChain.js +183 -193
- package/dist/connectors/telegram/commands/fallbackChain.js.map +1 -1
- package/dist/connectors/telegram/commands/limitsBoard.d.ts +40 -0
- package/dist/connectors/telegram/commands/limitsBoard.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/limitsBoard.js +281 -0
- package/dist/connectors/telegram/commands/limitsBoard.js.map +1 -0
- package/dist/connectors/telegram/commands/modelPage.d.ts +130 -0
- package/dist/connectors/telegram/commands/modelPage.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/modelPage.js +120 -0
- package/dist/connectors/telegram/commands/modelPage.js.map +1 -0
- package/dist/connectors/telegram/commands/modelProviders.d.ts +9 -1
- package/dist/connectors/telegram/commands/modelProviders.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/modelProviders.js +203 -111
- package/dist/connectors/telegram/commands/modelProviders.js.map +1 -1
- package/dist/connectors/telegram/commands/stt.d.ts +32 -0
- package/dist/connectors/telegram/commands/stt.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/stt.js +460 -0
- package/dist/connectors/telegram/commands/stt.js.map +1 -0
- package/dist/effortLevels.d.ts +57 -7
- package/dist/effortLevels.d.ts.map +1 -1
- package/dist/effortLevels.js +65 -9
- package/dist/effortLevels.js.map +1 -1
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +160 -17
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +160 -17
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +160 -17
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +160 -17
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +160 -17
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +160 -17
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +160 -17
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +160 -17
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +160 -17
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +160 -17
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +160 -17
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +160 -17
- package/dist/i18n/zh.js.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/installManager.d.ts +36 -6
- package/dist/installManager.d.ts.map +1 -1
- package/dist/installManager.js +124 -26
- package/dist/installManager.js.map +1 -1
- package/dist/instanceLock.d.ts.map +1 -1
- package/dist/instanceLock.js +10 -8
- package/dist/instanceLock.js.map +1 -1
- package/dist/instanceSettings.d.ts +52 -0
- package/dist/instanceSettings.d.ts.map +1 -0
- package/dist/instanceSettings.js +136 -0
- package/dist/instanceSettings.js.map +1 -0
- package/dist/legacyMigration.d.ts +69 -0
- package/dist/legacyMigration.d.ts.map +1 -0
- package/dist/legacyMigration.js +338 -0
- package/dist/legacyMigration.js.map +1 -0
- package/dist/legacyNames.d.ts +107 -0
- package/dist/legacyNames.d.ts.map +1 -0
- package/dist/legacyNames.js +230 -0
- package/dist/legacyNames.js.map +1 -0
- package/dist/pinnedStatus.d.ts +7 -1
- package/dist/pinnedStatus.d.ts.map +1 -1
- package/dist/pinnedStatus.js +1 -1
- package/dist/pinnedStatus.js.map +1 -1
- package/dist/platform/answerSink.d.ts +5 -0
- package/dist/platform/answerSink.d.ts.map +1 -1
- package/dist/platform/answerSink.js.map +1 -1
- package/dist/requests/answerRequest.d.ts +2 -0
- package/dist/requests/answerRequest.d.ts.map +1 -1
- package/dist/requests/answerRequest.js +3 -1
- package/dist/requests/answerRequest.js.map +1 -1
- package/dist/requests/answerStyle.d.ts +11 -0
- package/dist/requests/answerStyle.d.ts.map +1 -0
- package/dist/requests/answerStyle.js +14 -0
- package/dist/requests/answerStyle.js.map +1 -0
- package/dist/requests/answerTail.d.ts.map +1 -1
- package/dist/requests/answerTail.js +2 -0
- package/dist/requests/answerTail.js.map +1 -1
- package/dist/requests/requestHeader.d.ts.map +1 -1
- package/dist/requests/requestHeader.js +3 -0
- package/dist/requests/requestHeader.js.map +1 -1
- package/dist/requests/requestLedger.d.ts +8 -0
- package/dist/requests/requestLedger.d.ts.map +1 -1
- package/dist/requests/requestLedger.js +20 -2
- package/dist/requests/requestLedger.js.map +1 -1
- package/dist/requests/types.d.ts +3 -1
- package/dist/requests/types.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +9 -1
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +49 -16
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/shutdown.d.ts +14 -0
- package/dist/shutdown.d.ts.map +1 -1
- package/dist/shutdown.js +16 -0
- package/dist/shutdown.js.map +1 -1
- package/dist/state.d.ts +57 -3
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +67 -3
- package/dist/state.js.map +1 -1
- package/dist/stt/sttAutoInstall.d.ts +39 -0
- package/dist/stt/sttAutoInstall.d.ts.map +1 -0
- package/dist/stt/sttAutoInstall.js +158 -0
- package/dist/stt/sttAutoInstall.js.map +1 -0
- package/dist/stt/sttChildEnv.d.ts +11 -0
- package/dist/stt/sttChildEnv.d.ts.map +1 -0
- package/dist/stt/sttChildEnv.js +30 -0
- package/dist/stt/sttChildEnv.js.map +1 -0
- package/dist/stt/sttConfigEdit.d.ts +71 -0
- package/dist/stt/sttConfigEdit.d.ts.map +1 -0
- package/dist/stt/sttConfigEdit.js +144 -0
- package/dist/stt/sttConfigEdit.js.map +1 -0
- package/dist/stt/sttInstall.d.ts +147 -0
- package/dist/stt/sttInstall.d.ts.map +1 -0
- package/dist/stt/sttInstall.js +491 -0
- package/dist/stt/sttInstall.js.map +1 -0
- package/dist/stt/sttInstallEntry.d.ts +2 -0
- package/dist/stt/sttInstallEntry.d.ts.map +1 -0
- package/dist/stt/sttInstallEntry.js +31 -0
- package/dist/stt/sttInstallEntry.js.map +1 -0
- package/dist/stt/sttInstallReporter.d.ts +45 -0
- package/dist/stt/sttInstallReporter.d.ts.map +1 -0
- package/dist/stt/sttInstallReporter.js +57 -0
- package/dist/stt/sttInstallReporter.js.map +1 -0
- package/dist/stt/sttRuntime.d.ts +35 -0
- package/dist/stt/sttRuntime.d.ts.map +1 -0
- package/dist/stt/sttRuntime.js +73 -0
- package/dist/stt/sttRuntime.js.map +1 -0
- package/dist/stt/sttScreenPlan.d.ts +193 -0
- package/dist/stt/sttScreenPlan.d.ts.map +1 -0
- package/dist/stt/sttScreenPlan.js +541 -0
- package/dist/stt/sttScreenPlan.js.map +1 -0
- package/dist/stt/sttSettings.d.ts +201 -0
- package/dist/stt/sttSettings.d.ts.map +1 -0
- package/dist/stt/sttSettings.js +387 -0
- package/dist/stt/sttSettings.js.map +1 -0
- package/dist/stt/sttSidecarOwner.d.ts +115 -0
- package/dist/stt/sttSidecarOwner.d.ts.map +1 -0
- package/dist/stt/sttSidecarOwner.js +475 -0
- package/dist/stt/sttSidecarOwner.js.map +1 -0
- package/dist/stt/transcribeChain.d.ts +36 -0
- package/dist/stt/transcribeChain.d.ts.map +1 -0
- package/dist/stt/transcribeChain.js +42 -0
- package/dist/stt/transcribeChain.js.map +1 -0
- package/dist/types.d.ts +77 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/adapterSwitchSessionIds.d.ts +32 -0
- package/dist/utils/adapterSwitchSessionIds.d.ts.map +1 -0
- package/dist/utils/adapterSwitchSessionIds.js +44 -0
- package/dist/utils/adapterSwitchSessionIds.js.map +1 -0
- package/dist/utils/backendSwitchPlan.d.ts +63 -0
- package/dist/utils/backendSwitchPlan.d.ts.map +1 -0
- package/dist/utils/backendSwitchPlan.js +73 -0
- package/dist/utils/backendSwitchPlan.js.map +1 -0
- package/dist/utils/claudeAccountPickerPlan.d.ts +12 -1
- package/dist/utils/claudeAccountPickerPlan.d.ts.map +1 -1
- package/dist/utils/claudeAccountPickerPlan.js +20 -1
- package/dist/utils/claudeAccountPickerPlan.js.map +1 -1
- package/dist/utils/claudeProfiles.d.ts +7 -0
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +19 -0
- package/dist/utils/claudeProfiles.js.map +1 -1
- package/dist/utils/claudeTranscriptContent.d.ts +24 -0
- package/dist/utils/claudeTranscriptContent.d.ts.map +1 -0
- package/dist/utils/claudeTranscriptContent.js +107 -0
- package/dist/utils/claudeTranscriptContent.js.map +1 -0
- package/dist/utils/claudeUsage.d.ts +47 -8
- package/dist/utils/claudeUsage.d.ts.map +1 -1
- package/dist/utils/claudeUsage.js +76 -14
- package/dist/utils/claudeUsage.js.map +1 -1
- package/dist/utils/claudeUsageRefresher.d.ts +8 -1
- package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
- package/dist/utils/claudeUsageRefresher.js +9 -4
- package/dist/utils/claudeUsageRefresher.js.map +1 -1
- package/dist/utils/effortPickerPlan.d.ts +54 -0
- package/dist/utils/effortPickerPlan.d.ts.map +1 -0
- package/dist/utils/effortPickerPlan.js +56 -0
- package/dist/utils/effortPickerPlan.js.map +1 -0
- package/dist/utils/ensureSessionPlan.d.ts +20 -4
- package/dist/utils/ensureSessionPlan.d.ts.map +1 -1
- package/dist/utils/ensureSessionPlan.js +17 -4
- package/dist/utils/ensureSessionPlan.js.map +1 -1
- package/dist/utils/fallbackBridge.d.ts +6 -2
- package/dist/utils/fallbackBridge.d.ts.map +1 -1
- package/dist/utils/fallbackBridge.js +10 -3
- package/dist/utils/fallbackBridge.js.map +1 -1
- package/dist/utils/fallbackChain.d.ts +36 -0
- package/dist/utils/fallbackChain.d.ts.map +1 -1
- package/dist/utils/fallbackChain.js +65 -1
- package/dist/utils/fallbackChain.js.map +1 -1
- package/dist/utils/fallbackSwitchNotice.d.ts +41 -0
- package/dist/utils/fallbackSwitchNotice.d.ts.map +1 -0
- package/dist/utils/fallbackSwitchNotice.js +75 -0
- package/dist/utils/fallbackSwitchNotice.js.map +1 -0
- package/dist/utils/fileSendService.d.ts +33 -10
- package/dist/utils/fileSendService.d.ts.map +1 -1
- package/dist/utils/fileSendService.js +78 -27
- package/dist/utils/fileSendService.js.map +1 -1
- package/dist/utils/jsonStreamHost.d.ts +39 -0
- package/dist/utils/jsonStreamHost.d.ts.map +1 -1
- package/dist/utils/jsonStreamHost.js +60 -1
- package/dist/utils/jsonStreamHost.js.map +1 -1
- package/dist/utils/limitEpisodeRecovery.d.ts +16 -2
- package/dist/utils/limitEpisodeRecovery.d.ts.map +1 -1
- package/dist/utils/limitEpisodeRecovery.js +44 -3
- package/dist/utils/limitEpisodeRecovery.js.map +1 -1
- package/dist/utils/limitSettings.d.ts +25 -0
- package/dist/utils/limitSettings.d.ts.map +1 -0
- package/dist/utils/limitSettings.js +31 -0
- package/dist/utils/limitSettings.js.map +1 -0
- package/dist/utils/limitsBoardPlan.d.ts +52 -0
- package/dist/utils/limitsBoardPlan.d.ts.map +1 -0
- package/dist/utils/limitsBoardPlan.js +93 -0
- package/dist/utils/limitsBoardPlan.js.map +1 -0
- package/dist/utils/openCodeCompactPlugin.d.ts +11 -3
- package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -1
- package/dist/utils/openCodeCompactPlugin.js +37 -5
- package/dist/utils/openCodeCompactPlugin.js.map +1 -1
- package/dist/utils/openCodeUsage.d.ts +93 -0
- package/dist/utils/openCodeUsage.d.ts.map +1 -0
- package/dist/utils/openCodeUsage.js +248 -0
- package/dist/utils/openCodeUsage.js.map +1 -0
- package/dist/utils/operatorSwitchPlan.d.ts +61 -0
- package/dist/utils/operatorSwitchPlan.d.ts.map +1 -0
- package/dist/utils/operatorSwitchPlan.js +32 -0
- package/dist/utils/operatorSwitchPlan.js.map +1 -0
- package/dist/utils/promptDelivery.d.ts +40 -0
- package/dist/utils/promptDelivery.d.ts.map +1 -1
- package/dist/utils/promptDelivery.js +31 -0
- package/dist/utils/promptDelivery.js.map +1 -1
- package/dist/utils/recvPreviewRedaction.d.ts +14 -4
- package/dist/utils/recvPreviewRedaction.d.ts.map +1 -1
- package/dist/utils/recvPreviewRedaction.js +19 -7
- package/dist/utils/recvPreviewRedaction.js.map +1 -1
- package/dist/utils/startupReadiness.d.ts +3 -3
- package/dist/utils/startupReadiness.d.ts.map +1 -1
- package/dist/utils/startupReadiness.js +2 -2
- package/dist/utils/startupReadiness.js.map +1 -1
- package/dist/utils/threadStatusReport.d.ts +3 -1
- package/dist/utils/threadStatusReport.d.ts.map +1 -1
- package/dist/utils/threadStatusReport.js +4 -3
- package/dist/utils/threadStatusReport.js.map +1 -1
- package/dist/utils/timezone.d.ts +23 -0
- package/dist/utils/timezone.d.ts.map +1 -1
- package/dist/utils/timezone.js +38 -0
- package/dist/utils/timezone.js.map +1 -1
- package/dist/utils/transcribeAudio.d.ts +25 -12
- package/dist/utils/transcribeAudio.d.ts.map +1 -1
- package/dist/utils/transcribeAudio.js +39 -21
- package/dist/utils/transcribeAudio.js.map +1 -1
- package/dist/utils/usageRefreshBudget.d.ts +9 -0
- package/dist/utils/usageRefreshBudget.d.ts.map +1 -0
- package/dist/utils/usageRefreshBudget.js +27 -0
- package/dist/utils/usageRefreshBudget.js.map +1 -0
- package/examples/.env.example +13 -9
- package/examples/docker-compose.yml +20 -17
- package/package.json +4 -1
- package/stt/gigaam_sidecar.py +800 -0
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.resetInstanceSettingsCache = exports.loadInstanceSettings = exports.instanceSettingsFileName = void 0;
|
|
37
|
+
exports.createEmptyInstanceSettings = createEmptyInstanceSettings;
|
|
38
|
+
exports.validateInstanceSettings = validateInstanceSettings;
|
|
39
|
+
exports.getInstanceSettingsPath = getInstanceSettingsPath;
|
|
40
|
+
exports.saveInstanceSettings = saveInstanceSettings;
|
|
41
|
+
exports.loadInstanceSettingsForUpdate = loadInstanceSettingsForUpdate;
|
|
42
|
+
exports.createInstanceDefaultEffortReader = createInstanceDefaultEffortReader;
|
|
43
|
+
const os = __importStar(require("os"));
|
|
44
|
+
const zod_1 = require("zod");
|
|
45
|
+
const configDirFile_1 = require("./configDirFile");
|
|
46
|
+
const effortLevels_1 = require("./effortLevels");
|
|
47
|
+
/**
|
|
48
|
+
* @description The instance-wide settings: ONE JSON file, `settings.json`, in the charness config directory
|
|
49
|
+
* (beside the instance's real `.env`, like `stt.json`). `/effort` in the General topic writes it; an operator may
|
|
50
|
+
* hand-edit it and the next read sees the edit (the load is cached by file stamp, no restart). More instance
|
|
51
|
+
* settings will move here later; today it holds `defaultEffort`.
|
|
52
|
+
*
|
|
53
|
+
* Validation is strict and all-or-nothing, like `stt.json`: a typo is an error that NAMES the field. Unlike
|
|
54
|
+
* `stt.json`, an invalid file is NOT served from its last good copy — the built-in defaults apply and one error
|
|
55
|
+
* line says why, so what runs is what the file visibly says or what the code says, never a stale third thing.
|
|
56
|
+
*/
|
|
57
|
+
/** The file in the config dir. */
|
|
58
|
+
exports.instanceSettingsFileName = 'settings.json';
|
|
59
|
+
/** Not secret: readable by the group, like any config file. */
|
|
60
|
+
const settingsFileMode = 0o644;
|
|
61
|
+
const rawSettingsSchema = zod_1.z.strictObject({
|
|
62
|
+
defaultEffort: zod_1.z.enum(effortLevels_1.claudeEffortLevels).optional(),
|
|
63
|
+
});
|
|
64
|
+
/** @description The settings of an instance that has no `settings.json`: nothing set. */
|
|
65
|
+
function createEmptyInstanceSettings() {
|
|
66
|
+
return { defaultEffort: null };
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* @description Validate a parsed `settings.json` object. Every error names its field
|
|
70
|
+
* (`settings.json defaultEffort: …`).
|
|
71
|
+
*/
|
|
72
|
+
function validateInstanceSettings(parsedJson) {
|
|
73
|
+
const parsed = rawSettingsSchema.safeParse(parsedJson);
|
|
74
|
+
if (!parsed.success) {
|
|
75
|
+
return {
|
|
76
|
+
ok: false,
|
|
77
|
+
errors: parsed.error.issues.map((issue) => `${exports.instanceSettingsFileName} ${issue.path.join('.') || '(root)'}: ${issue.message}`),
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
return { ok: true, config: { defaultEffort: parsed.data.defaultEffort ?? null } };
|
|
81
|
+
}
|
|
82
|
+
/** @description Where `settings.json` lives: the config directory of the instance's REAL env file (`getConfigDirFilePath`). */
|
|
83
|
+
function getInstanceSettingsPath(env = process.env, homeDir = os.homedir()) {
|
|
84
|
+
return (0, configDirFile_1.getConfigDirFilePath)(exports.instanceSettingsFileName, env, homeDir);
|
|
85
|
+
}
|
|
86
|
+
const instanceSettingsLoader = (0, configDirFile_1.createConfigFileLoader)({
|
|
87
|
+
fileName: exports.instanceSettingsFileName,
|
|
88
|
+
createEmpty: createEmptyInstanceSettings,
|
|
89
|
+
validate: validateInstanceSettings,
|
|
90
|
+
});
|
|
91
|
+
/**
|
|
92
|
+
* @description Read and validate `settings.json`, cached by the file's stamp (mtime, size, inode) so a repeated call
|
|
93
|
+
* costs one `stat`. A missing file is the empty settings; an invalid one reports its errors (its `config` is the
|
|
94
|
+
* last good copy, which {@link createInstanceDefaultEffortReader} deliberately ignores).
|
|
95
|
+
*/
|
|
96
|
+
exports.loadInstanceSettings = instanceSettingsLoader.load;
|
|
97
|
+
/** @description Forget every cached load — for tests, which swap files under one path. */
|
|
98
|
+
exports.resetInstanceSettingsCache = instanceSettingsLoader.resetCache;
|
|
99
|
+
/** @description Write `settings` to `filePath`: validated first, then through a temp file and a rename. */
|
|
100
|
+
function saveInstanceSettings(filePath, settings) {
|
|
101
|
+
const body = settings.defaultEffort === null ? {} : { defaultEffort: settings.defaultEffort };
|
|
102
|
+
const validation = validateInstanceSettings(body);
|
|
103
|
+
if (!validation.ok)
|
|
104
|
+
throw new Error(`refusing to write an invalid ${exports.instanceSettingsFileName}: ${validation.errors.join('; ')}`);
|
|
105
|
+
(0, configDirFile_1.writeJsonFileAtomically)(filePath, body, settingsFileMode);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* @description The settings a change starts from: the file's own when it is valid, else the empty ones. A change
|
|
109
|
+
* made on top of a broken file replaces it — the button the operator tapped is the fix.
|
|
110
|
+
*/
|
|
111
|
+
function loadInstanceSettingsForUpdate(filePath) {
|
|
112
|
+
const load = (0, exports.loadInstanceSettings)(filePath);
|
|
113
|
+
return load.status === 'invalid' ? createEmptyInstanceSettings() : load.config;
|
|
114
|
+
}
|
|
115
|
+
/**
|
|
116
|
+
* @description The reader that `effortLevels.setInstanceDefaultEffortReader` takes: `settings.json`'s
|
|
117
|
+
* `defaultEffort`, re-read when the file changes. A missing file, or a file without the field, is `null` (the
|
|
118
|
+
* code fallback). An invalid file is `null` too, and `logError` gets ONE line per distinct broken state of the
|
|
119
|
+
* file — not one per session start.
|
|
120
|
+
*/
|
|
121
|
+
function createInstanceDefaultEffortReader(getFilePath, logError) {
|
|
122
|
+
let lastReportedLoad = null;
|
|
123
|
+
return () => {
|
|
124
|
+
const load = (0, exports.loadInstanceSettings)(getFilePath());
|
|
125
|
+
if (load.status === 'invalid') {
|
|
126
|
+
if (load !== lastReportedLoad) {
|
|
127
|
+
lastReportedLoad = load;
|
|
128
|
+
logError(`[Settings] ${load.errors.join('; ')} (the built-in defaults apply until it is fixed)`);
|
|
129
|
+
}
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
lastReportedLoad = null;
|
|
133
|
+
return load.config.defaultEffort;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
//# sourceMappingURL=instanceSettings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"instanceSettings.js","sourceRoot":"","sources":["../src/instanceSettings.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAuCA,kEAEC;AAMD,4DASC;AAGD,0DAEC;AAqBD,oDAKC;AAMD,sEAGC;AAQD,8EAiBC;AAzHD,uCAAyB;AACzB,6BAAwB;AACxB,mDAMyB;AACzB,iDAA4E;AAE5E;;;;;;;;;GASG;AAEH,kCAAkC;AACrB,QAAA,wBAAwB,GAAG,eAAe,CAAC;AAExD,+DAA+D;AAC/D,MAAM,gBAAgB,GAAG,KAAK,CAAC;AAQ/B,MAAM,iB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ACnG,CAAC;YACD,OAAO,IAAI,CAAC;QACd,CAAC;QACD,gBAAgB,GAAG,IAAI,CAAC;QACxB,OAAO,IAAI,CAAC,MAAM,CAAC,aAAa,CAAC;IACnC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description The automatic, idempotent move from the pre-rename names to the
|
|
3
|
+
* Charness ones, run at a COLD start of the bot: the global config dir
|
|
4
|
+
* (`~/.config/telegramcode`, older `~/.config/telegram-code` → `~/.config/charness`)
|
|
5
|
+
* and the default data dir (`~/.telegramCode` → `~/.charness`). Each moved dir
|
|
6
|
+
* leaves a relative SYMLINK at its old path, so a tmux / json-stream agent that
|
|
7
|
+
* still holds an old absolute path, an external script and an older mirror keep
|
|
8
|
+
* working. `legacyNames.ts` stays the read-fallback for whatever this does not
|
|
9
|
+
* (or could not) move.
|
|
10
|
+
*
|
|
11
|
+
* WHEN it runs — and the rules that keep it safe:
|
|
12
|
+
* - cold start only: the plain `charness` start and the hot SUPERVISOR's start.
|
|
13
|
+
* A hot WORKER reload never migrates (its supervisor, possibly the pre-rename
|
|
14
|
+
* code, still holds paths in the data dir — the caller passes nothing and
|
|
15
|
+
* this module is never reached from the worker).
|
|
16
|
+
* - under the instance lock, before the state is loaded (the caller acquires
|
|
17
|
+
* it; {@link migrateLegacyNamesUnderLock} takes it itself for the supervisor).
|
|
18
|
+
* - never for an isolated instance (`ENV_FILE`): it reads only its own file and
|
|
19
|
+
* its own dirs, and the shared config and default data dir belong to another
|
|
20
|
+
* bot. Never for an explicit `DATA_DIR`, whatever it names.
|
|
21
|
+
* - idempotent: a target that exists, or an old path that is already a symlink
|
|
22
|
+
* (ours, or the operator's own), skips the step; nothing is ever deleted; a
|
|
23
|
+
* failed step is logged and leaves BOTH sides usable (a failed symlink rolls
|
|
24
|
+
* the move back).
|
|
25
|
+
* - `TELEGRAMCODE_*` keys are renamed to `CHARNESS_*` only in the global config
|
|
26
|
+
* file this migration moved (a `.bak` copy first). `ENV_FILE` and `$PWD/.env`
|
|
27
|
+
* are never rewritten: the first is the operator's own, possibly read-only
|
|
28
|
+
* and mounted into a container; the second belongs to whatever project the
|
|
29
|
+
* bot was launched from.
|
|
30
|
+
*
|
|
31
|
+
* One log line per action taken. A step that is skipped because there is nothing
|
|
32
|
+
* to do is silent, so a second start prints nothing.
|
|
33
|
+
*/
|
|
34
|
+
import * as fs from 'fs';
|
|
35
|
+
type FsOps = Pick<typeof fs, 'lstatSync' | 'renameSync' | 'symlinkSync' | 'realpathSync' | 'readFileSync' | 'writeFileSync' | 'copyFileSync' | 'chmodSync' | 'existsSync' | 'unlinkSync'>;
|
|
36
|
+
export interface LegacyMigrationOptions {
|
|
37
|
+
homeDir?: string;
|
|
38
|
+
env?: NodeJS.ProcessEnv;
|
|
39
|
+
/** One line per action taken. */
|
|
40
|
+
log?: (line: string) => void;
|
|
41
|
+
/** One line per failed step. */
|
|
42
|
+
warn?: (line: string) => void;
|
|
43
|
+
/** The file operations — injected by tests to make a step fail. */
|
|
44
|
+
fsOps?: FsOps;
|
|
45
|
+
}
|
|
46
|
+
export interface LegacyMigrationResult {
|
|
47
|
+
/** The lines logged for actions taken, in order. */
|
|
48
|
+
actions: string[];
|
|
49
|
+
/** The lines logged for steps that failed, in order. */
|
|
50
|
+
failures: string[];
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* @description Whether a start has anything to migrate — cheap, so the hot
|
|
54
|
+
* supervisor takes the instance lock only when it will use it.
|
|
55
|
+
*/
|
|
56
|
+
export declare function hasPendingLegacyMigration(options?: LegacyMigrationOptions): boolean;
|
|
57
|
+
/**
|
|
58
|
+
* @description Run the migration. The CALLER holds the instance lock. Safe to
|
|
59
|
+
* call on every cold start: with nothing to do it does nothing and says nothing.
|
|
60
|
+
*/
|
|
61
|
+
export declare function migrateLegacyNames(options?: LegacyMigrationOptions): LegacyMigrationResult;
|
|
62
|
+
/**
|
|
63
|
+
* @description The hot SUPERVISOR's cold start: take the instance lock for the
|
|
64
|
+
* length of the migration. A lock held by a live instance (or any failure to
|
|
65
|
+
* take it) skips the migration and says why; the next start tries again.
|
|
66
|
+
*/
|
|
67
|
+
export declare function migrateLegacyNamesUnderLock(options?: LegacyMigrationOptions): LegacyMigrationResult;
|
|
68
|
+
export {};
|
|
69
|
+
//# sourceMappingURL=legacyMigration.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacyMigration.d.ts","sourceRoot":"","sources":["../src/legacyMigration.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AAmBzB,KAAK,KAAK,GAAG,IAAI,CACf,OAAO,EAAE,EACP,WAAW,GACX,YAAY,GACZ,aAAa,GACb,cAAc,GACd,cAAc,GACd,eAAe,GACf,cAAc,GACd,WAAW,GACX,YAAY,GACZ,YAAY,CACf,CAAC;AAEF,MAAM,WAAW,sBAAsB;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;IACxB,iCAAiC;IACjC,GAAG,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC7B,gCAAgC;IAChC,IAAI,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC9B,mEAAmE;IACnE,KAAK,CAAC,EAAE,KAAK,CAAC;CACf;AAED,MAAM,WAAW,qBAAqB;IACpC,oDAAoD;IACpD,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,wDAAwD;IACxD,QAAQ,EAAE,MAAM,EAAE,CAAC;CACpB;AAoHD;;;GAGG;AACH,wBAAgB,yBAAyB,CAAC,OAAO,GAAE,sBAA2B,GAAG,OAAO,CAEvF;AAwED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,sBAA2B,GAAG,qBAAqB,CAgD9F;AAED;;;;GAIG;AACH,wBAAgB,2BAA2B,CAAC,OAAO,GAAE,sBAA2B,GAAG,qBAAqB,CAwBvG"}
|
|
@@ -0,0 +1,338 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description The automatic, idempotent move from the pre-rename names to the
|
|
4
|
+
* Charness ones, run at a COLD start of the bot: the global config dir
|
|
5
|
+
* (`~/.config/telegramcode`, older `~/.config/telegram-code` → `~/.config/charness`)
|
|
6
|
+
* and the default data dir (`~/.telegramCode` → `~/.charness`). Each moved dir
|
|
7
|
+
* leaves a relative SYMLINK at its old path, so a tmux / json-stream agent that
|
|
8
|
+
* still holds an old absolute path, an external script and an older mirror keep
|
|
9
|
+
* working. `legacyNames.ts` stays the read-fallback for whatever this does not
|
|
10
|
+
* (or could not) move.
|
|
11
|
+
*
|
|
12
|
+
* WHEN it runs — and the rules that keep it safe:
|
|
13
|
+
* - cold start only: the plain `charness` start and the hot SUPERVISOR's start.
|
|
14
|
+
* A hot WORKER reload never migrates (its supervisor, possibly the pre-rename
|
|
15
|
+
* code, still holds paths in the data dir — the caller passes nothing and
|
|
16
|
+
* this module is never reached from the worker).
|
|
17
|
+
* - under the instance lock, before the state is loaded (the caller acquires
|
|
18
|
+
* it; {@link migrateLegacyNamesUnderLock} takes it itself for the supervisor).
|
|
19
|
+
* - never for an isolated instance (`ENV_FILE`): it reads only its own file and
|
|
20
|
+
* its own dirs, and the shared config and default data dir belong to another
|
|
21
|
+
* bot. Never for an explicit `DATA_DIR`, whatever it names.
|
|
22
|
+
* - idempotent: a target that exists, or an old path that is already a symlink
|
|
23
|
+
* (ours, or the operator's own), skips the step; nothing is ever deleted; a
|
|
24
|
+
* failed step is logged and leaves BOTH sides usable (a failed symlink rolls
|
|
25
|
+
* the move back).
|
|
26
|
+
* - `TELEGRAMCODE_*` keys are renamed to `CHARNESS_*` only in the global config
|
|
27
|
+
* file this migration moved (a `.bak` copy first). `ENV_FILE` and `$PWD/.env`
|
|
28
|
+
* are never rewritten: the first is the operator's own, possibly read-only
|
|
29
|
+
* and mounted into a container; the second belongs to whatever project the
|
|
30
|
+
* bot was launched from.
|
|
31
|
+
*
|
|
32
|
+
* One log line per action taken. A step that is skipped because there is nothing
|
|
33
|
+
* to do is silent, so a second start prints nothing.
|
|
34
|
+
*/
|
|
35
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
36
|
+
if (k2 === undefined) k2 = k;
|
|
37
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
38
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
39
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
40
|
+
}
|
|
41
|
+
Object.defineProperty(o, k2, desc);
|
|
42
|
+
}) : (function(o, m, k, k2) {
|
|
43
|
+
if (k2 === undefined) k2 = k;
|
|
44
|
+
o[k2] = m[k];
|
|
45
|
+
}));
|
|
46
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
47
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
48
|
+
}) : function(o, v) {
|
|
49
|
+
o["default"] = v;
|
|
50
|
+
});
|
|
51
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
52
|
+
var ownKeys = function(o) {
|
|
53
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
54
|
+
var ar = [];
|
|
55
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
56
|
+
return ar;
|
|
57
|
+
};
|
|
58
|
+
return ownKeys(o);
|
|
59
|
+
};
|
|
60
|
+
return function (mod) {
|
|
61
|
+
if (mod && mod.__esModule) return mod;
|
|
62
|
+
var result = {};
|
|
63
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
64
|
+
__setModuleDefault(result, mod);
|
|
65
|
+
return result;
|
|
66
|
+
};
|
|
67
|
+
})();
|
|
68
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
69
|
+
exports.hasPendingLegacyMigration = hasPendingLegacyMigration;
|
|
70
|
+
exports.migrateLegacyNames = migrateLegacyNames;
|
|
71
|
+
exports.migrateLegacyNamesUnderLock = migrateLegacyNamesUnderLock;
|
|
72
|
+
const fs = __importStar(require("fs"));
|
|
73
|
+
const os = __importStar(require("os"));
|
|
74
|
+
const path = __importStar(require("path"));
|
|
75
|
+
const legacyNames_1 = require("./legacyNames");
|
|
76
|
+
const instanceLock_1 = require("./instanceLock");
|
|
77
|
+
/** The pre-rename key prefix in a config file, and what it becomes. */
|
|
78
|
+
const legacyEnvKeyPrefix = 'TELEGRAMCODE_';
|
|
79
|
+
const currentEnvKeyPrefix = 'CHARNESS_';
|
|
80
|
+
const envFileName = '.env';
|
|
81
|
+
const envBackupSuffix = '.bak';
|
|
82
|
+
function resolveOptions(options) {
|
|
83
|
+
return {
|
|
84
|
+
homeDir: options.homeDir ?? os.homedir(),
|
|
85
|
+
env: options.env ?? process.env,
|
|
86
|
+
log: options.log ?? ((line) => process.stderr.write(`${line}\n`)),
|
|
87
|
+
warn: options.warn ?? ((line) => process.stderr.write(`${line}\n`)),
|
|
88
|
+
fsOps: options.fsOps ?? fs,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
function getPathKind(fsOps, target) {
|
|
92
|
+
try {
|
|
93
|
+
const stat = fsOps.lstatSync(target);
|
|
94
|
+
if (stat.isSymbolicLink())
|
|
95
|
+
return 'symlink';
|
|
96
|
+
return stat.isDirectory() ? 'directory' : 'other';
|
|
97
|
+
}
|
|
98
|
+
catch (error) {
|
|
99
|
+
return error.code === 'ENOENT' ? 'missing' : 'other';
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
function describePath(homeDir, target) {
|
|
103
|
+
return target.startsWith(`${homeDir}${path.sep}`) ? `~${target.slice(homeDir.length)}` : target;
|
|
104
|
+
}
|
|
105
|
+
function describeError(error) {
|
|
106
|
+
return error instanceof Error ? error.message : String(error);
|
|
107
|
+
}
|
|
108
|
+
/** The pre-rename keys a config file still carries that can be renamed (no `CHARNESS_` twin yet). */
|
|
109
|
+
function findRenamableEnvKeys(content) {
|
|
110
|
+
const definedKeys = new Set();
|
|
111
|
+
for (const match of content.matchAll(/^[ \t]*(?:export[ \t]+)?([A-Za-z_][A-Za-z0-9_]*)[ \t]*=/gm)) {
|
|
112
|
+
definedKeys.add(match[1]);
|
|
113
|
+
}
|
|
114
|
+
const renamable = [];
|
|
115
|
+
for (const key of definedKeys) {
|
|
116
|
+
if (!key.startsWith(legacyEnvKeyPrefix) || key.length === legacyEnvKeyPrefix.length)
|
|
117
|
+
continue;
|
|
118
|
+
if (!definedKeys.has(`${currentEnvKeyPrefix}${key.slice(legacyEnvKeyPrefix.length)}`))
|
|
119
|
+
renamable.push(key);
|
|
120
|
+
}
|
|
121
|
+
return renamable;
|
|
122
|
+
}
|
|
123
|
+
function readEnvFileIfPresent(fsOps, filePath) {
|
|
124
|
+
try {
|
|
125
|
+
return String(fsOps.readFileSync(filePath, 'utf8'));
|
|
126
|
+
}
|
|
127
|
+
catch {
|
|
128
|
+
return null;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
/**
|
|
132
|
+
* @description What a migration would do right now, in order. Reads the file
|
|
133
|
+
* system only. An isolated instance (`ENV_FILE`) plans nothing.
|
|
134
|
+
*/
|
|
135
|
+
function planMigration(options) {
|
|
136
|
+
const { homeDir, env, fsOps } = options;
|
|
137
|
+
if (env.ENV_FILE)
|
|
138
|
+
return [];
|
|
139
|
+
const steps = [];
|
|
140
|
+
const configRoot = path.join(homeDir, '.config');
|
|
141
|
+
const canonicalConfigDir = path.join(configRoot, legacyNames_1.configDirName);
|
|
142
|
+
const canonicalConfigKind = getPathKind(fsOps, canonicalConfigDir);
|
|
143
|
+
const legacyConfigDirs = legacyNames_1.legacyConfigDirNames.map((name) => path.join(configRoot, name));
|
|
144
|
+
const movableConfigDir = canonicalConfigKind === 'missing'
|
|
145
|
+
? legacyConfigDirs.find((dir) => getPathKind(fsOps, dir) === 'directory')
|
|
146
|
+
: undefined;
|
|
147
|
+
if (movableConfigDir !== undefined) {
|
|
148
|
+
steps.push({ kind: 'move-dir', area: 'config', from: movableConfigDir, to: canonicalConfigDir });
|
|
149
|
+
steps.push({ kind: 'rename-env-keys', envFile: path.join(canonicalConfigDir, envFileName), legacyDir: movableConfigDir });
|
|
150
|
+
}
|
|
151
|
+
else if (canonicalConfigKind === 'directory') {
|
|
152
|
+
// A move of an earlier start whose key rename failed: the old path is our symlink to the canonical dir.
|
|
153
|
+
const envFile = path.join(canonicalConfigDir, envFileName);
|
|
154
|
+
const linkedLegacyDir = legacyConfigDirs.find((dir) => isSymlinkTo(fsOps, dir, canonicalConfigDir));
|
|
155
|
+
const content = linkedLegacyDir === undefined ? null : readEnvFileIfPresent(fsOps, envFile);
|
|
156
|
+
if (linkedLegacyDir !== undefined && content !== null && findRenamableEnvKeys(content).length > 0) {
|
|
157
|
+
steps.push({ kind: 'rename-env-keys', envFile, legacyDir: linkedLegacyDir });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
// An explicit DATA_DIR is the operator's, whatever it names.
|
|
161
|
+
if (!env.DATA_DIR) {
|
|
162
|
+
const legacyDataDir = path.join(homeDir, legacyNames_1.legacyDefaultDataDirName);
|
|
163
|
+
const canonicalDataDir = path.join(homeDir, legacyNames_1.defaultDataDirName);
|
|
164
|
+
if (getPathKind(fsOps, legacyDataDir) === 'directory' && getPathKind(fsOps, canonicalDataDir) === 'missing') {
|
|
165
|
+
steps.push({ kind: 'move-dir', area: 'data', from: legacyDataDir, to: canonicalDataDir });
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
return steps;
|
|
169
|
+
}
|
|
170
|
+
function isSymlinkTo(fsOps, linkPath, targetDir) {
|
|
171
|
+
if (getPathKind(fsOps, linkPath) !== 'symlink')
|
|
172
|
+
return false;
|
|
173
|
+
try {
|
|
174
|
+
return fsOps.realpathSync(linkPath) === fsOps.realpathSync(targetDir);
|
|
175
|
+
}
|
|
176
|
+
catch {
|
|
177
|
+
return false;
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
/**
|
|
181
|
+
* @description Whether a start has anything to migrate — cheap, so the hot
|
|
182
|
+
* supervisor takes the instance lock only when it will use it.
|
|
183
|
+
*/
|
|
184
|
+
function hasPendingLegacyMigration(options = {}) {
|
|
185
|
+
return planMigration(resolveOptions(options)).length > 0;
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* Rename the dir and leave a relative symlink at the old path. If the symlink
|
|
189
|
+
* cannot be made the move is undone, so the old path never ends up missing.
|
|
190
|
+
*/
|
|
191
|
+
function moveDirLeavingSymlink(fsOps, from, to, warn) {
|
|
192
|
+
fsOps.renameSync(from, to);
|
|
193
|
+
try {
|
|
194
|
+
fsOps.symlinkSync(path.basename(to), from);
|
|
195
|
+
}
|
|
196
|
+
catch (symlinkError) {
|
|
197
|
+
try {
|
|
198
|
+
fsOps.renameSync(to, from);
|
|
199
|
+
}
|
|
200
|
+
catch (rollbackError) {
|
|
201
|
+
warn(`[migrate] ${from} was moved to ${to} and the symlink back failed (${describeError(symlinkError)}), ` +
|
|
202
|
+
`and so did undoing the move (${describeError(rollbackError)}): link ${from} to ${to} by hand`);
|
|
203
|
+
}
|
|
204
|
+
throw symlinkError;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function findFreeBackupPath(fsOps, envFile) {
|
|
208
|
+
const firstChoice = `${envFile}${envBackupSuffix}`;
|
|
209
|
+
return fsOps.existsSync(firstChoice) ? `${firstChoice}.${Date.now()}` : firstChoice;
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Rename `TELEGRAMCODE_*` keys to `CHARNESS_*` in one file, after a backup copy.
|
|
213
|
+
* The file's mode and a symlinked file's link are kept (the real file is
|
|
214
|
+
* rewritten in place by rename). Returns the keys renamed.
|
|
215
|
+
*/
|
|
216
|
+
function renameEnvFileKeys(fsOps, envFile) {
|
|
217
|
+
let realFile;
|
|
218
|
+
try {
|
|
219
|
+
realFile = fsOps.realpathSync(envFile);
|
|
220
|
+
}
|
|
221
|
+
catch (error) {
|
|
222
|
+
// A config dir without a `.env` has no keys to rename.
|
|
223
|
+
if (error.code === 'ENOENT')
|
|
224
|
+
return null;
|
|
225
|
+
throw error;
|
|
226
|
+
}
|
|
227
|
+
const content = String(fsOps.readFileSync(realFile, 'utf8'));
|
|
228
|
+
const keys = findRenamableEnvKeys(content);
|
|
229
|
+
if (keys.length === 0)
|
|
230
|
+
return null;
|
|
231
|
+
const renamedKeys = new Set(keys);
|
|
232
|
+
const rewritten = content.replace(/^([ \t]*(?:export[ \t]+)?)(TELEGRAMCODE_[A-Za-z0-9_]+)(?=[ \t]*=)/gm, (whole, prefix, key) => renamedKeys.has(key) ? `${prefix}${currentEnvKeyPrefix}${key.slice(legacyEnvKeyPrefix.length)}` : whole);
|
|
233
|
+
if (rewritten === content)
|
|
234
|
+
return null;
|
|
235
|
+
const mode = fsOps.lstatSync(realFile).mode & 0o777;
|
|
236
|
+
const backupPath = findFreeBackupPath(fsOps, realFile);
|
|
237
|
+
fsOps.copyFileSync(realFile, backupPath, fs.constants.COPYFILE_EXCL);
|
|
238
|
+
const tempPath = `${realFile}.tmp-${process.pid}`;
|
|
239
|
+
try {
|
|
240
|
+
fsOps.writeFileSync(tempPath, rewritten, { mode });
|
|
241
|
+
fsOps.chmodSync(tempPath, mode);
|
|
242
|
+
fsOps.renameSync(tempPath, realFile);
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
try {
|
|
246
|
+
fsOps.unlinkSync(tempPath);
|
|
247
|
+
}
|
|
248
|
+
catch {
|
|
249
|
+
// never written
|
|
250
|
+
}
|
|
251
|
+
throw error;
|
|
252
|
+
}
|
|
253
|
+
return { keys, backupPath };
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* @description Run the migration. The CALLER holds the instance lock. Safe to
|
|
257
|
+
* call on every cold start: with nothing to do it does nothing and says nothing.
|
|
258
|
+
*/
|
|
259
|
+
function migrateLegacyNames(options = {}) {
|
|
260
|
+
const resolved = resolveOptions(options);
|
|
261
|
+
const { homeDir, fsOps } = resolved;
|
|
262
|
+
const result = { actions: [], failures: [] };
|
|
263
|
+
const logAction = (line) => {
|
|
264
|
+
result.actions.push(line);
|
|
265
|
+
resolved.log(line);
|
|
266
|
+
};
|
|
267
|
+
const logFailure = (line) => {
|
|
268
|
+
result.failures.push(line);
|
|
269
|
+
resolved.warn(line);
|
|
270
|
+
};
|
|
271
|
+
const failedMoves = new Set();
|
|
272
|
+
for (const step of planMigration(resolved)) {
|
|
273
|
+
if (step.kind === 'move-dir') {
|
|
274
|
+
const fromLabel = describePath(homeDir, step.from);
|
|
275
|
+
const toLabel = describePath(homeDir, step.to);
|
|
276
|
+
try {
|
|
277
|
+
moveDirLeavingSymlink(fsOps, step.from, step.to, resolved.warn);
|
|
278
|
+
logAction(`[migrate] moved ${fromLabel} to ${toLabel}; ${fromLabel} is now a symlink to it`);
|
|
279
|
+
if (step.area === 'data')
|
|
280
|
+
(0, legacyNames_1.redecideDefaultDataDir)(homeDir);
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
failedMoves.add(step.from);
|
|
284
|
+
logFailure(`[migrate] could not move ${fromLabel} to ${toLabel} (${describeError(error)}): it stays where it is and ` +
|
|
285
|
+
`is still used; move it by hand with the bot stopped (see ${legacyNames_1.renameMigrationDoc})`);
|
|
286
|
+
}
|
|
287
|
+
continue;
|
|
288
|
+
}
|
|
289
|
+
if (failedMoves.has(step.legacyDir))
|
|
290
|
+
continue;
|
|
291
|
+
const envLabel = describePath(homeDir, step.envFile);
|
|
292
|
+
try {
|
|
293
|
+
const renamed = renameEnvFileKeys(fsOps, step.envFile);
|
|
294
|
+
if (renamed === null)
|
|
295
|
+
continue;
|
|
296
|
+
logAction(`[migrate] renamed ${renamed.keys.length} key(s) ${legacyEnvKeyPrefix}* to ${currentEnvKeyPrefix}* in ` +
|
|
297
|
+
`${envLabel} (${renamed.keys.join(', ')}); the old file is kept as ${describePath(homeDir, renamed.backupPath)}`);
|
|
298
|
+
}
|
|
299
|
+
catch (error) {
|
|
300
|
+
logFailure(`[migrate] could not rename the ${legacyEnvKeyPrefix}* keys in ${envLabel} (${describeError(error)}): ` +
|
|
301
|
+
`rename them by hand (see ${legacyNames_1.renameMigrationDoc})`);
|
|
302
|
+
}
|
|
303
|
+
}
|
|
304
|
+
return result;
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* @description The hot SUPERVISOR's cold start: take the instance lock for the
|
|
308
|
+
* length of the migration. A lock held by a live instance (or any failure to
|
|
309
|
+
* take it) skips the migration and says why; the next start tries again.
|
|
310
|
+
*/
|
|
311
|
+
function migrateLegacyNamesUnderLock(options = {}) {
|
|
312
|
+
const resolved = resolveOptions(options);
|
|
313
|
+
const empty = { actions: [], failures: [] };
|
|
314
|
+
if (!hasPendingLegacyMigration(options))
|
|
315
|
+
return empty;
|
|
316
|
+
let lock;
|
|
317
|
+
try {
|
|
318
|
+
lock = (0, instanceLock_1.tryAcquireLock)();
|
|
319
|
+
}
|
|
320
|
+
catch (error) {
|
|
321
|
+
const line = `[migrate] skipped: the instance lock could not be taken (${describeError(error)})`;
|
|
322
|
+
resolved.warn(line);
|
|
323
|
+
return { actions: [], failures: [line] };
|
|
324
|
+
}
|
|
325
|
+
if (!lock.ok) {
|
|
326
|
+
const line = `[migrate] skipped: another instance holds the lock on this data dir (${lock.reason}); ` +
|
|
327
|
+
`the old names keep working and the next cold start tries again`;
|
|
328
|
+
resolved.warn(line);
|
|
329
|
+
return { actions: [], failures: [line] };
|
|
330
|
+
}
|
|
331
|
+
try {
|
|
332
|
+
return migrateLegacyNames(options);
|
|
333
|
+
}
|
|
334
|
+
finally {
|
|
335
|
+
(0, instanceLock_1.releaseLock)();
|
|
336
|
+
}
|
|
337
|
+
}
|
|
338
|
+
//# sourceMappingURL=legacyMigration.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"legacyMigration.js","sourceRoot":"","sources":["../src/legacyMigration.ts"],"names":[],"mappings":";AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA2KH,8DAEC;AA4ED,gDAgDC;AAOD,kEAwBC;AAtUD,uCAAyB;AACzB,uCAAyB;AACzB,2CAA6B;AAC7B,+CAOuB;AACvB,iDAA6D;AAE7D,uEAAuE;AACvE,MAAM,kBAAkB,GAAG,eAAe,CAAC;AAC3C,MAAM,mBAAmB,GAAG,WAAW,CAAC;AACxC,MAAM,WAAW,GAAG,MAAM,CAAC;AAC3B,MAAM,eAAe,GAAG,MAAM,CAAC;AA8C/B,SAAS,cAAc,CAAC,OAA+B;IACrD,OAAO;QACL,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,EAAE,CAAC,OAAO,EAAE;QACxC,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,OAAO,CAAC,GAAG;QAC/B,GAAG,EAAE,OAAO,CAAC,GAAG,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;QACjE,IAAI,EAAE,OAAO,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,IAAI,IAAI,CAAC,CAAC;QACnE,KAAK,EAAE,OAAO,CAAC,KAAK,IAAI,EAAE;KAC3B,CAAC;AACJ,CAAC;AAID,SAAS,WAAW,CAAC,KAAY,EAAE,MAAc;IAC/C,IAAI,CAAC;QACH,MAAM,IAAI,GAAG,KAAK,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC;QACrC,IAAI,IAAI,CAAC,cAAc,EA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