charness 3.7.0 → 3.9.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/CHANGELOG.md +36 -0
- package/DEVELOPMENT.md +8 -2
- package/README.md +5 -5
- package/SETUP.md +17 -5
- package/agent-plugin/skills/charness-manager/SKILL.md +3 -3
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +2 -1
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +50 -9
- package/dist/bot.js.map +1 -1
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -1
- package/dist/cli.js +56 -6
- package/dist/cli.js.map +1 -1
- package/dist/configDirFile.d.ts +7 -3
- package/dist/configDirFile.d.ts.map +1 -1
- package/dist/configDirFile.js +12 -5
- package/dist/configDirFile.js.map +1 -1
- package/dist/connectors/telegram/commands/botCore.d.ts +5 -1
- package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.d.ts +52 -0
- package/dist/connectors/telegram/commands/runners.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/runners.js +524 -0
- package/dist/connectors/telegram/commands/runners.js.map +1 -0
- package/dist/connectors/telegram/runnerPairingMessages.d.ts +29 -0
- package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -0
- package/dist/connectors/telegram/runnerPairingMessages.js +112 -0
- package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -0
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +60 -0
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +60 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +60 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +60 -0
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +60 -0
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +60 -0
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +60 -0
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +60 -0
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +60 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +60 -0
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +60 -0
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +60 -0
- package/dist/i18n/zh.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/installManager.d.ts +57 -1
- package/dist/installManager.d.ts.map +1 -1
- package/dist/installManager.js +88 -10
- package/dist/installManager.js.map +1 -1
- package/dist/instanceSettings.d.ts +12 -2
- package/dist/instanceSettings.d.ts.map +1 -1
- package/dist/instanceSettings.js +17 -3
- package/dist/instanceSettings.js.map +1 -1
- package/dist/outputTrace.d.ts +6 -0
- package/dist/outputTrace.d.ts.map +1 -1
- package/dist/outputTrace.js +24 -1
- package/dist/outputTrace.js.map +1 -1
- package/dist/remoteRun/cliArgs.d.ts +2 -0
- package/dist/remoteRun/cliArgs.d.ts.map +1 -1
- package/dist/remoteRun/cliArgs.js +11 -2
- package/dist/remoteRun/cliArgs.js.map +1 -1
- package/dist/remoteRun/commands.d.ts +21 -0
- package/dist/remoteRun/commands.d.ts.map +1 -1
- package/dist/remoteRun/commands.js +38 -17
- package/dist/remoteRun/commands.js.map +1 -1
- package/dist/remoteRun/interrupts.d.ts +10 -0
- package/dist/remoteRun/interrupts.d.ts.map +1 -1
- package/dist/remoteRun/interrupts.js +43 -6
- package/dist/remoteRun/interrupts.js.map +1 -1
- package/dist/remoteRun/output.d.ts +2 -0
- package/dist/remoteRun/output.d.ts.map +1 -1
- package/dist/remoteRun/output.js +45 -0
- package/dist/remoteRun/output.js.map +1 -1
- package/dist/remoteRun/pairedRunners.d.ts +51 -0
- package/dist/remoteRun/pairedRunners.d.ts.map +1 -0
- package/dist/remoteRun/pairedRunners.js +165 -0
- package/dist/remoteRun/pairedRunners.js.map +1 -0
- package/dist/remoteRun/probe.d.ts +23 -1
- package/dist/remoteRun/probe.d.ts.map +1 -1
- package/dist/remoteRun/probe.js +45 -11
- package/dist/remoteRun/probe.js.map +1 -1
- package/dist/remoteRun/remoteRunCli.d.ts +13 -6
- package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
- package/dist/remoteRun/remoteRunCli.js +34 -59
- package/dist/remoteRun/remoteRunCli.js.map +1 -1
- package/dist/remoteRun/runnerClient.d.ts +2 -0
- package/dist/remoteRun/runnerClient.d.ts.map +1 -1
- package/dist/remoteRun/runnerClient.js +5 -1
- package/dist/remoteRun/runnerClient.js.map +1 -1
- package/dist/remoteRun/runnerSummary.d.ts +24 -0
- package/dist/remoteRun/runnerSummary.d.ts.map +1 -0
- package/dist/remoteRun/runnerSummary.js +86 -0
- package/dist/remoteRun/runnerSummary.js.map +1 -0
- package/dist/remoteRun/runnerWait.d.ts +68 -0
- package/dist/remoteRun/runnerWait.d.ts.map +1 -0
- package/dist/remoteRun/runnerWait.js +137 -0
- package/dist/remoteRun/runnerWait.js.map +1 -0
- package/dist/remoteRun/runnerWaitTiming.d.ts +16 -0
- package/dist/remoteRun/runnerWaitTiming.d.ts.map +1 -0
- package/dist/remoteRun/runnerWaitTiming.js +37 -0
- package/dist/remoteRun/runnerWaitTiming.js.map +1 -0
- package/dist/remoteRun/runners.d.ts +15 -8
- package/dist/remoteRun/runners.d.ts.map +1 -1
- package/dist/remoteRun/runners.js +59 -19
- package/dist/remoteRun/runners.js.map +1 -1
- package/dist/remoteRun/runnersCatalog.d.ts +14 -0
- package/dist/remoteRun/runnersCatalog.d.ts.map +1 -0
- package/dist/remoteRun/runnersCatalog.js +68 -0
- package/dist/remoteRun/runnersCatalog.js.map +1 -0
- package/dist/remoteRun/runnersConfig.d.ts +31 -20
- package/dist/remoteRun/runnersConfig.d.ts.map +1 -1
- package/dist/remoteRun/runnersConfig.js +14 -12
- package/dist/remoteRun/runnersConfig.js.map +1 -1
- package/dist/remoteRun/ssh.d.ts +22 -2
- package/dist/remoteRun/ssh.d.ts.map +1 -1
- package/dist/remoteRun/ssh.js +41 -7
- package/dist/remoteRun/ssh.js.map +1 -1
- package/dist/runnerUtility/adminCheck.d.ts +18 -0
- package/dist/runnerUtility/adminCheck.d.ts.map +1 -0
- package/dist/runnerUtility/adminCheck.js +69 -0
- package/dist/runnerUtility/adminCheck.js.map +1 -0
- package/dist/runnerUtility/adminService.d.ts +22 -0
- package/dist/runnerUtility/adminService.d.ts.map +1 -0
- package/dist/runnerUtility/adminService.js +145 -0
- package/dist/runnerUtility/adminService.js.map +1 -0
- package/dist/runnerUtility/appInstall.d.ts +25 -0
- package/dist/runnerUtility/appInstall.d.ts.map +1 -0
- package/dist/runnerUtility/appInstall.js +147 -0
- package/dist/runnerUtility/appInstall.js.map +1 -0
- package/dist/runnerUtility/appUpdate.d.ts +39 -0
- package/dist/runnerUtility/appUpdate.d.ts.map +1 -0
- package/dist/runnerUtility/appUpdate.js +90 -0
- package/dist/runnerUtility/appUpdate.js.map +1 -0
- package/dist/runnerUtility/execEnv.d.ts +21 -0
- package/dist/runnerUtility/execEnv.d.ts.map +1 -0
- package/dist/runnerUtility/execEnv.js +109 -0
- package/dist/runnerUtility/execEnv.js.map +1 -0
- package/dist/runnerUtility/execSession.d.ts +13 -0
- package/dist/runnerUtility/execSession.d.ts.map +1 -0
- package/dist/runnerUtility/execSession.js +58 -0
- package/dist/runnerUtility/execSession.js.map +1 -0
- package/dist/runnerUtility/hubClient.d.ts +30 -0
- package/dist/runnerUtility/hubClient.d.ts.map +1 -0
- package/dist/runnerUtility/hubClient.js +127 -0
- package/dist/runnerUtility/hubClient.js.map +1 -0
- package/dist/runnerUtility/injectStream.d.ts +9 -0
- package/dist/runnerUtility/injectStream.d.ts.map +1 -0
- package/dist/runnerUtility/injectStream.js +12 -0
- package/dist/runnerUtility/injectStream.js.map +1 -0
- package/dist/runnerUtility/iosCheck.d.ts +62 -0
- package/dist/runnerUtility/iosCheck.d.ts.map +1 -0
- package/dist/runnerUtility/iosCheck.js +200 -0
- package/dist/runnerUtility/iosCheck.js.map +1 -0
- package/dist/runnerUtility/launcher.d.ts +5 -0
- package/dist/runnerUtility/launcher.d.ts.map +1 -0
- package/dist/runnerUtility/launcher.js +85 -0
- package/dist/runnerUtility/launcher.js.map +1 -0
- package/dist/runnerUtility/linkLoop.d.ts +39 -0
- package/dist/runnerUtility/linkLoop.d.ts.map +1 -0
- package/dist/runnerUtility/linkLoop.js +274 -0
- package/dist/runnerUtility/linkLoop.js.map +1 -0
- package/dist/runnerUtility/localLinkStop.d.ts +23 -0
- package/dist/runnerUtility/localLinkStop.d.ts.map +1 -0
- package/dist/runnerUtility/localLinkStop.js +79 -0
- package/dist/runnerUtility/localLinkStop.js.map +1 -0
- package/dist/runnerUtility/machineReport.d.ts +39 -0
- package/dist/runnerUtility/machineReport.d.ts.map +1 -0
- package/dist/runnerUtility/machineReport.js +161 -0
- package/dist/runnerUtility/machineReport.js.map +1 -0
- package/dist/runnerUtility/packageId.d.ts +5 -0
- package/dist/runnerUtility/packageId.d.ts.map +1 -0
- package/dist/runnerUtility/packageId.js +64 -0
- package/dist/runnerUtility/packageId.js.map +1 -0
- package/dist/runnerUtility/pairArgs.d.ts +16 -0
- package/dist/runnerUtility/pairArgs.d.ts.map +1 -0
- package/dist/runnerUtility/pairArgs.js +17 -0
- package/dist/runnerUtility/pairArgs.js.map +1 -0
- package/dist/runnerUtility/pairingRecovery.d.ts +31 -0
- package/dist/runnerUtility/pairingRecovery.d.ts.map +1 -0
- package/dist/runnerUtility/pairingRecovery.js +24 -0
- package/dist/runnerUtility/pairingRecovery.js.map +1 -0
- package/dist/runnerUtility/pueueDaemon.d.ts +36 -0
- package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -0
- package/dist/runnerUtility/pueueDaemon.js +165 -0
- package/dist/runnerUtility/pueueDaemon.js.map +1 -0
- package/dist/runnerUtility/rootServiceCli.d.ts +8 -0
- package/dist/runnerUtility/rootServiceCli.d.ts.map +1 -0
- package/dist/runnerUtility/rootServiceCli.js +31 -0
- package/dist/runnerUtility/rootServiceCli.js.map +1 -0
- package/dist/runnerUtility/runnerCli.d.ts +18 -0
- package/dist/runnerUtility/runnerCli.d.ts.map +1 -0
- package/dist/runnerUtility/runnerCli.js +190 -0
- package/dist/runnerUtility/runnerCli.js.map +1 -0
- package/dist/runnerUtility/runnerCommands.d.ts +76 -0
- package/dist/runnerUtility/runnerCommands.d.ts.map +1 -0
- package/dist/runnerUtility/runnerCommands.js +464 -0
- package/dist/runnerUtility/runnerCommands.js.map +1 -0
- package/dist/runnerUtility/runnerConfig.d.ts +63 -0
- package/dist/runnerUtility/runnerConfig.d.ts.map +1 -0
- package/dist/runnerUtility/runnerConfig.js +153 -0
- package/dist/runnerUtility/runnerConfig.js.map +1 -0
- package/dist/runnerUtility/runnerFlags.d.ts +9 -0
- package/dist/runnerUtility/runnerFlags.d.ts.map +1 -0
- package/dist/runnerUtility/runnerFlags.js +53 -0
- package/dist/runnerUtility/runnerFlags.js.map +1 -0
- package/dist/runnerUtility/runnerHome.d.ts +30 -0
- package/dist/runnerUtility/runnerHome.d.ts.map +1 -0
- package/dist/runnerUtility/runnerHome.js +82 -0
- package/dist/runnerUtility/runnerHome.js.map +1 -0
- package/dist/runnerUtility/runnerKeys.d.ts +11 -0
- package/dist/runnerUtility/runnerKeys.d.ts.map +1 -0
- package/dist/runnerUtility/runnerKeys.js +80 -0
- package/dist/runnerUtility/runnerKeys.js.map +1 -0
- package/dist/runnerUtility/runnerServers.d.ts +40 -0
- package/dist/runnerUtility/runnerServers.d.ts.map +1 -0
- package/dist/runnerUtility/runnerServers.js +79 -0
- package/dist/runnerUtility/runnerServers.js.map +1 -0
- package/dist/runnerUtility/serviceCommon.d.ts +97 -0
- package/dist/runnerUtility/serviceCommon.d.ts.map +1 -0
- package/dist/runnerUtility/serviceCommon.js +209 -0
- package/dist/runnerUtility/serviceCommon.js.map +1 -0
- package/dist/runnerUtility/serviceManager.d.ts +51 -0
- package/dist/runnerUtility/serviceManager.d.ts.map +1 -0
- package/dist/runnerUtility/serviceManager.js +344 -0
- package/dist/runnerUtility/serviceManager.js.map +1 -0
- package/dist/runnerUtility/serviceUnits.d.ts +38 -0
- package/dist/runnerUtility/serviceUnits.d.ts.map +1 -0
- package/dist/runnerUtility/serviceUnits.js +189 -0
- package/dist/runnerUtility/serviceUnits.js.map +1 -0
- package/dist/runnerUtility/toolInstall.d.ts +95 -0
- package/dist/runnerUtility/toolInstall.d.ts.map +1 -0
- package/dist/runnerUtility/toolInstall.js +232 -0
- package/dist/runnerUtility/toolInstall.js.map +1 -0
- package/dist/runnerUtility/versionPollTiming.d.ts +16 -0
- package/dist/runnerUtility/versionPollTiming.d.ts.map +1 -0
- package/dist/runnerUtility/versionPollTiming.js +36 -0
- package/dist/runnerUtility/versionPollTiming.js.map +1 -0
- package/dist/runners/authorizedKeys.d.ts +52 -0
- package/dist/runners/authorizedKeys.d.ts.map +1 -0
- package/dist/runners/authorizedKeys.js +153 -0
- package/dist/runners/authorizedKeys.js.map +1 -0
- package/dist/runners/bootstrapLine.d.ts +13 -0
- package/dist/runners/bootstrapLine.d.ts.map +1 -0
- package/dist/runners/bootstrapLine.js +154 -0
- package/dist/runners/bootstrapLine.js.map +1 -0
- package/dist/runners/gate.d.ts +41 -0
- package/dist/runners/gate.d.ts.map +1 -0
- package/dist/runners/gate.js +225 -0
- package/dist/runners/gate.js.map +1 -0
- package/dist/runners/gateLink.d.ts +26 -0
- package/dist/runners/gateLink.d.ts.map +1 -0
- package/dist/runners/gateLink.js +240 -0
- package/dist/runners/gateLink.js.map +1 -0
- package/dist/runners/gateProtocol.d.ts +104 -0
- package/dist/runners/gateProtocol.d.ts.map +1 -0
- package/dist/runners/gateProtocol.js +151 -0
- package/dist/runners/gateProtocol.js.map +1 -0
- package/dist/runners/gateWrapper.d.ts +6 -0
- package/dist/runners/gateWrapper.d.ts.map +1 -0
- package/dist/runners/gateWrapper.js +70 -0
- package/dist/runners/gateWrapper.js.map +1 -0
- package/dist/runners/hubAddress.d.ts +33 -0
- package/dist/runners/hubAddress.d.ts.map +1 -0
- package/dist/runners/hubAddress.js +88 -0
- package/dist/runners/hubAddress.js.map +1 -0
- package/dist/runners/hubAddressCandidates.d.ts +16 -0
- package/dist/runners/hubAddressCandidates.d.ts.map +1 -0
- package/dist/runners/hubAddressCandidates.js +96 -0
- package/dist/runners/hubAddressCandidates.js.map +1 -0
- package/dist/runners/hubIds.d.ts +16 -0
- package/dist/runners/hubIds.d.ts.map +1 -0
- package/dist/runners/hubIds.js +25 -0
- package/dist/runners/hubIds.js.map +1 -0
- package/dist/runners/hubKey.d.ts +6 -0
- package/dist/runners/hubKey.d.ts.map +1 -0
- package/dist/runners/hubKey.js +78 -0
- package/dist/runners/hubKey.js.map +1 -0
- package/dist/runners/hubLock.d.ts +7 -0
- package/dist/runners/hubLock.d.ts.map +1 -0
- package/dist/runners/hubLock.js +230 -0
- package/dist/runners/hubLock.js.map +1 -0
- package/dist/runners/hubPackage.d.ts +23 -0
- package/dist/runners/hubPackage.d.ts.map +1 -0
- package/dist/runners/hubPackage.js +184 -0
- package/dist/runners/hubPackage.js.map +1 -0
- package/dist/runners/hubPairing.d.ts +70 -0
- package/dist/runners/hubPairing.d.ts.map +1 -0
- package/dist/runners/hubPairing.js +277 -0
- package/dist/runners/hubPairing.js.map +1 -0
- package/dist/runners/hubPaths.d.ts +42 -0
- package/dist/runners/hubPaths.d.ts.map +1 -0
- package/dist/runners/hubPaths.js +96 -0
- package/dist/runners/hubPaths.js.map +1 -0
- package/dist/runners/hubRegistry.d.ts +134 -0
- package/dist/runners/hubRegistry.d.ts.map +1 -0
- package/dist/runners/hubRegistry.js +256 -0
- package/dist/runners/hubRegistry.js.map +1 -0
- package/dist/runners/linkControl.d.ts +38 -0
- package/dist/runners/linkControl.d.ts.map +1 -0
- package/dist/runners/linkControl.js +171 -0
- package/dist/runners/linkControl.js.map +1 -0
- package/dist/runners/pairCode.d.ts +30 -0
- package/dist/runners/pairCode.d.ts.map +1 -0
- package/dist/runners/pairCode.js +46 -0
- package/dist/runners/pairCode.js.map +1 -0
- package/dist/runners/pairingTiming.d.ts +18 -0
- package/dist/runners/pairingTiming.d.ts.map +1 -0
- package/dist/runners/pairingTiming.js +42 -0
- package/dist/runners/pairingTiming.js.map +1 -0
- package/dist/runners/removalTiming.d.ts +13 -0
- package/dist/runners/removalTiming.d.ts.map +1 -0
- package/dist/runners/removalTiming.js +17 -0
- package/dist/runners/removalTiming.js.map +1 -0
- package/dist/runners/runnerProxy.d.ts +9 -0
- package/dist/runners/runnerProxy.d.ts.map +1 -0
- package/dist/runners/runnerProxy.js +67 -0
- package/dist/runners/runnerProxy.js.map +1 -0
- package/dist/runners/runnerRemoval.d.ts +21 -0
- package/dist/runners/runnerRemoval.d.ts.map +1 -0
- package/dist/runners/runnerRemoval.js +94 -0
- package/dist/runners/runnerRemoval.js.map +1 -0
- package/dist/runners/runnerServiceKind.d.ts +10 -0
- package/dist/runners/runnerServiceKind.d.ts.map +1 -0
- package/dist/runners/runnerServiceKind.js +13 -0
- package/dist/runners/runnerServiceKind.js.map +1 -0
- package/dist/runners/runnersCli.d.ts +25 -0
- package/dist/runners/runnersCli.d.ts.map +1 -0
- package/dist/runners/runnersCli.js +239 -0
- package/dist/runners/runnersCli.js.map +1 -0
- package/dist/runners/runnersList.d.ts +14 -0
- package/dist/runners/runnersList.d.ts.map +1 -0
- package/dist/runners/runnersList.js +51 -0
- package/dist/runners/runnersList.js.map +1 -0
- package/dist/runners/runnersOverview.d.ts +20 -0
- package/dist/runners/runnersOverview.d.ts.map +1 -0
- package/dist/runners/runnersOverview.js +56 -0
- package/dist/runners/runnersOverview.js.map +1 -0
- package/dist/runners/sshKeys.d.ts +26 -0
- package/dist/runners/sshKeys.d.ts.map +1 -0
- package/dist/runners/sshKeys.js +60 -0
- package/dist/runners/sshKeys.js.map +1 -0
- package/dist/runners/tarArchive.d.ts +20 -0
- package/dist/runners/tarArchive.d.ts.map +1 -0
- package/dist/runners/tarArchive.js +70 -0
- package/dist/runners/tarArchive.js.map +1 -0
- package/dist/scheduler/mcpSurface.d.ts +11 -5
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +59 -26
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/selfUpdate/selfCheck.d.ts +13 -0
- package/dist/selfUpdate/selfCheck.d.ts.map +1 -1
- package/dist/selfUpdate/selfCheck.js +9 -3
- package/dist/selfUpdate/selfCheck.js.map +1 -1
- package/dist/stt/sttInstallEntry.js +7 -4
- package/dist/stt/sttInstallEntry.js.map +1 -1
- package/dist/testTimings.d.ts +5 -2
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +10 -1
- package/dist/testTimings.js.map +1 -1
- package/dist/utils/agentEnvironment.d.ts +6 -2
- package/dist/utils/agentEnvironment.d.ts.map +1 -1
- package/dist/utils/agentEnvironment.js +13 -2
- package/dist/utils/agentEnvironment.js.map +1 -1
- package/dist/utils/runnersScreenPlan.d.ts +141 -0
- package/dist/utils/runnersScreenPlan.d.ts.map +1 -0
- package/dist/utils/runnersScreenPlan.js +272 -0
- package/dist/utils/runnersScreenPlan.js.map +1 -0
- package/package.json +5 -2
- package/remoteRun/runner.sh +81 -6
|
@@ -0,0 +1,153 @@
|
|
|
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.RunnerConfigError = exports.linkStates = void 0;
|
|
37
|
+
exports.readRunnerConfig = readRunnerConfig;
|
|
38
|
+
exports.writeRunnerConfig = writeRunnerConfig;
|
|
39
|
+
exports.readRunnerStatus = readRunnerStatus;
|
|
40
|
+
exports.writeRunnerStatus = writeRunnerStatus;
|
|
41
|
+
exports.readPairingInProgress = readPairingInProgress;
|
|
42
|
+
exports.writePairingInProgress = writePairingInProgress;
|
|
43
|
+
exports.removePairingInProgress = removePairingInProgress;
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const zod_1 = require("zod");
|
|
46
|
+
const configDirFile_1 = require("../configDirFile");
|
|
47
|
+
const hubIds_1 = require("../runners/hubIds");
|
|
48
|
+
const sshKeys_1 = require("../runners/sshKeys");
|
|
49
|
+
/**
|
|
50
|
+
* @description The runner's two files: `config.json` (who it serves — written once at pairing, changed only by an update's package id) and
|
|
51
|
+
* `status.json` (what the link is doing — written by `run`, read by `status`). Strict, and an invalid file names the problem without
|
|
52
|
+
* echoing a value.
|
|
53
|
+
*/
|
|
54
|
+
const fileMode = 0o600;
|
|
55
|
+
const maxTextLength = 200;
|
|
56
|
+
const runnerConfigSchema = zod_1.z.strictObject({
|
|
57
|
+
runnerId: hubIds_1.hubIdSchema,
|
|
58
|
+
name: zod_1.z.string().min(1).max(maxTextLength),
|
|
59
|
+
hub: zod_1.z.strictObject({
|
|
60
|
+
host: hubIds_1.hubHostSchema,
|
|
61
|
+
port: hubIds_1.hubPortSchema,
|
|
62
|
+
user: hubIds_1.hubSshUserSchema,
|
|
63
|
+
/** Pinned: the link and every call to the hub verify exactly this key. */
|
|
64
|
+
hostKey: hubIds_1.hubHostKeySchema,
|
|
65
|
+
/** The only key the built-in server accepts. */
|
|
66
|
+
publicKey: zod_1.z.string().refine(sshKeys_1.checkIsEd25519PublicKey, 'must be an ed25519 public key'),
|
|
67
|
+
/** Whose charness it is, as the hub named itself (`@ExampleBot`). */
|
|
68
|
+
label: zod_1.z.string().min(1).max(maxTextLength),
|
|
69
|
+
}),
|
|
70
|
+
/** The id of the hub package this runner runs; compared with the one the hub names at every link. */
|
|
71
|
+
packageId: zod_1.z.string().max(maxTextLength).nullable(),
|
|
72
|
+
pairedAtMs: zod_1.z.number().int().nonnegative(),
|
|
73
|
+
});
|
|
74
|
+
exports.linkStates = ['connecting', 'linked', 'removed', 'error'];
|
|
75
|
+
const runnerStatusSchema = zod_1.z.strictObject({
|
|
76
|
+
pid: zod_1.z.number().int().positive(),
|
|
77
|
+
state: zod_1.z.enum(exports.linkStates),
|
|
78
|
+
/** When the state began. */
|
|
79
|
+
sinceMs: zod_1.z.number().int().nonnegative(),
|
|
80
|
+
updatedAtMs: zod_1.z.number().int().nonnegative(),
|
|
81
|
+
lastError: zod_1.z.string().max(maxTextLength * 2).nullable(),
|
|
82
|
+
activeJobs: zod_1.z.number().int().nonnegative(),
|
|
83
|
+
packageId: zod_1.z.string().max(maxTextLength).nullable(),
|
|
84
|
+
});
|
|
85
|
+
const pairingInProgressSchema = zod_1.z.strictObject({
|
|
86
|
+
pairId: hubIds_1.hubIdSchema,
|
|
87
|
+
host: hubIds_1.hubHostSchema,
|
|
88
|
+
port: hubIds_1.hubPortSchema,
|
|
89
|
+
user: hubIds_1.hubSshUserSchema,
|
|
90
|
+
hostKey: hubIds_1.hubHostKeySchema,
|
|
91
|
+
startedAtMs: zod_1.z.number().int().nonnegative(),
|
|
92
|
+
/** The id of the archive this runner installed from (told by the pasted line), kept for the config. */
|
|
93
|
+
packageId: zod_1.z.string().max(maxTextLength).nullable(),
|
|
94
|
+
});
|
|
95
|
+
class RunnerConfigError extends Error {
|
|
96
|
+
constructor(message) {
|
|
97
|
+
super(message);
|
|
98
|
+
this.name = 'RunnerConfigError';
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
exports.RunnerConfigError = RunnerConfigError;
|
|
102
|
+
function readJsonFile(filePath, fileName, schema) {
|
|
103
|
+
let text;
|
|
104
|
+
try {
|
|
105
|
+
text = fs.readFileSync(filePath, 'utf8');
|
|
106
|
+
}
|
|
107
|
+
catch (error) {
|
|
108
|
+
if ((0, configDirFile_1.getCaughtErrnoCode)(error) === 'ENOENT')
|
|
109
|
+
return null;
|
|
110
|
+
throw new RunnerConfigError(`${fileName} could not be read (${(0, configDirFile_1.getCaughtErrnoCode)(error)})`);
|
|
111
|
+
}
|
|
112
|
+
let parsedJson;
|
|
113
|
+
try {
|
|
114
|
+
parsedJson = JSON.parse(text);
|
|
115
|
+
}
|
|
116
|
+
catch {
|
|
117
|
+
throw new RunnerConfigError(`${fileName} is not valid JSON`);
|
|
118
|
+
}
|
|
119
|
+
const parsed = schema.safeParse(parsedJson);
|
|
120
|
+
if (parsed.success)
|
|
121
|
+
return parsed.data;
|
|
122
|
+
throw new RunnerConfigError(`${fileName} is invalid: ${parsed.error.issues.map((issue) => `${issue.path.join('.') || '(root)'} ${issue.message}`).join('; ')}`);
|
|
123
|
+
}
|
|
124
|
+
/** @description `config.json`, or `null` when this account is not paired. */
|
|
125
|
+
function readRunnerConfig(paths) {
|
|
126
|
+
return readJsonFile(paths.config, 'config.json', runnerConfigSchema);
|
|
127
|
+
}
|
|
128
|
+
function writeRunnerConfig(paths, config) {
|
|
129
|
+
(0, configDirFile_1.writeJsonFileAtomically)(paths.config, runnerConfigSchema.parse(config), fileMode);
|
|
130
|
+
}
|
|
131
|
+
/** @description `status.json`, or `null` when `run` never wrote one (an unreadable one reads as none: it is only a report). */
|
|
132
|
+
function readRunnerStatus(paths) {
|
|
133
|
+
try {
|
|
134
|
+
return readJsonFile(paths.status, 'status.json', runnerStatusSchema);
|
|
135
|
+
}
|
|
136
|
+
catch {
|
|
137
|
+
return null;
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
function writeRunnerStatus(paths, status) {
|
|
141
|
+
(0, configDirFile_1.writeJsonFileAtomically)(paths.status, runnerStatusSchema.parse(status), fileMode);
|
|
142
|
+
}
|
|
143
|
+
/** @description `pairing.json`, or `null` when no pairing is half done. */
|
|
144
|
+
function readPairingInProgress(paths) {
|
|
145
|
+
return readJsonFile(paths.pairing, 'pairing.json', pairingInProgressSchema);
|
|
146
|
+
}
|
|
147
|
+
function writePairingInProgress(paths, pairing) {
|
|
148
|
+
(0, configDirFile_1.writeJsonFileAtomically)(paths.pairing, pairingInProgressSchema.parse(pairing), fileMode);
|
|
149
|
+
}
|
|
150
|
+
function removePairingInProgress(paths) {
|
|
151
|
+
fs.rmSync(paths.pairing, { force: true });
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=runnerConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerConfig.js","sourceRoot":"","sources":["../../src/runnerUtility/runnerConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiGA,4CAEC;AAED,8CAEC;AAGD,4CAMC;AAED,8CAEC;AAGD,sDAEC;AAED,wDAEC;AAED,0DAEC;AAjID,uCAAyB;AACzB,6BAAwB;AACxB,oDAA+E;AAC/E,8CAAkH;AAClH,gDAA6D;AAG7D;;;;GAIG;AAEH,MAAM,QAAQ,GAAG,KAAK,CAAC;AACvB,MAAM,aAAa,GAAG,GAAG,CAAC;AAE1B,MAAM,kBAAkB,GAAG,OAAC,CAAC,YAAY,CAAC;IACxC,QAAQ,EAAE,oBAAW;IACrB,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,aAAa,CAAC;IAC1C,GAAG,EAAE,OAAC,CAAC,YAAY,CAAC;QAClB,IAAI,EAAE,sBAAa;QACnB,IAAI,EAAE,sBAAa;QACnB,IAAI,EAAE,yBAAgB;QACtB,0EAA0E;QAC1E,OAAO,EAAE,yBAAgB;QACzB,gDAAgD;QAChD,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,MAAM,CAAC,iCAAuB,EAAE,+BAA+B,CAAC;QACtF,qEAAqE;QACrE,KAAK,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,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AK,CAAC,OAAO,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AAC5C,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { RunnerHomePaths } from './runnerHome';
|
|
2
|
+
/**
|
|
3
|
+
* @description The runner's own pause: an empty file, `~/.charness-runner/paused`. A paused runner stays linked but says so in its probe
|
|
4
|
+
* (`paused=1`), and `remote-run` never picks it for a job — the operator's way to take a machine out of rotation from the machine itself
|
|
5
|
+
* (the hub has its own pause for the same purpose, set from `/runners`).
|
|
6
|
+
*/
|
|
7
|
+
export declare function checkIsRunnerPaused(paths: RunnerHomePaths): boolean;
|
|
8
|
+
export declare function setRunnerPaused(paths: RunnerHomePaths, isPaused: boolean): void;
|
|
9
|
+
//# sourceMappingURL=runnerFlags.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerFlags.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/runnerFlags.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;GAIG;AAEH,wBAAgB,mBAAmB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAEnE;AAED,wBAAgB,eAAe,CAAC,KAAK,EAAE,eAAe,EAAE,QAAQ,EAAE,OAAO,GAAG,IAAI,CAG/E"}
|
|
@@ -0,0 +1,53 @@
|
|
|
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.checkIsRunnerPaused = checkIsRunnerPaused;
|
|
37
|
+
exports.setRunnerPaused = setRunnerPaused;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
/**
|
|
40
|
+
* @description The runner's own pause: an empty file, `~/.charness-runner/paused`. A paused runner stays linked but says so in its probe
|
|
41
|
+
* (`paused=1`), and `remote-run` never picks it for a job — the operator's way to take a machine out of rotation from the machine itself
|
|
42
|
+
* (the hub has its own pause for the same purpose, set from `/runners`).
|
|
43
|
+
*/
|
|
44
|
+
function checkIsRunnerPaused(paths) {
|
|
45
|
+
return fs.existsSync(paths.pausedFlag);
|
|
46
|
+
}
|
|
47
|
+
function setRunnerPaused(paths, isPaused) {
|
|
48
|
+
if (isPaused)
|
|
49
|
+
fs.writeFileSync(paths.pausedFlag, '', { mode: 0o644 });
|
|
50
|
+
else
|
|
51
|
+
fs.rmSync(paths.pausedFlag, { force: true });
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=runnerFlags.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerFlags.js","sourceRoot":"","sources":["../../src/runnerUtility/runnerFlags.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AASA,kDAEC;AAED,0CAGC;AAhBD,uCAAyB;AAGzB;;;;GAIG;AAEH,SAAgB,mBAAmB,CAAC,KAAsB;IACxD,OAAO,EAAE,CAAC,UAAU,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;AACzC,CAAC;AAED,SAAgB,eAAe,CAAC,KAAsB,EAAE,QAAiB;IACvE,IAAI,QAAQ;QAAE,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;;QACjE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;AACpD,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
export interface RunnerHomePaths {
|
|
2
|
+
homeDir: string;
|
|
3
|
+
root: string;
|
|
4
|
+
config: string;
|
|
5
|
+
status: string;
|
|
6
|
+
/** A pairing that was started and not finished (see `pairingRecovery.ts`). */
|
|
7
|
+
pairing: string;
|
|
8
|
+
/** An empty file: the operator paused this runner ("is this machine busy"). Read by `runner.sh probe` as `paused=`. */
|
|
9
|
+
pausedFlag: string;
|
|
10
|
+
/** One word, `user-service` or `system-service`, while a service is installed. Read by `runner.sh probe` as `service=`. */
|
|
11
|
+
serviceMarker: string;
|
|
12
|
+
/** The iOS Simulator boot check's last result (`iosCheck.ts`). Read by `runner.sh probe` as `ios_boot=`. */
|
|
13
|
+
iosCheck: string;
|
|
14
|
+
keysDir: string;
|
|
15
|
+
clientKey: string;
|
|
16
|
+
serverKey: string;
|
|
17
|
+
currentApp: string;
|
|
18
|
+
binDir: string;
|
|
19
|
+
launcher: string;
|
|
20
|
+
envFile: string;
|
|
21
|
+
workDir: string;
|
|
22
|
+
pueueDir: string;
|
|
23
|
+
pueueConfig: string;
|
|
24
|
+
logsDir: string;
|
|
25
|
+
buildDir: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function getRunnerHomePaths(homeDir?: string): RunnerHomePaths;
|
|
28
|
+
/** @description The folder of one installed copy of the package. */
|
|
29
|
+
export declare function getAppDirPath(paths: RunnerHomePaths, appId: string): string;
|
|
30
|
+
//# sourceMappingURL=runnerHome.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerHome.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/runnerHome.ts"],"names":[],"mappings":"AAkBA,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,IAAI,EAAE,MAAM,CAAC;IACb,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,8EAA8E;IAC9E,OAAO,EAAE,MAAM,CAAC;IAChB,uHAAuH;IACvH,UAAU,EAAE,MAAM,CAAC;IACnB,2HAA2H;IAC3H,aAAa,EAAE,MAAM,CAAC;IACtB,4GAA4G;IAC5G,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,OAAO,EAAE,MAAM,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,wBAAgB,kBAAkB,CAAC,OAAO,GAAE,MAAqB,GAAG,eAAe,CAwBlF;AAED,oEAAoE;AACpE,wBAAgB,aAAa,CAAC,KAAK,EAAE,eAAe,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,CAE3E"}
|
|
@@ -0,0 +1,82 @@
|
|
|
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.getRunnerHomePaths = getRunnerHomePaths;
|
|
37
|
+
exports.getAppDirPath = getAppDirPath;
|
|
38
|
+
const os = __importStar(require("os"));
|
|
39
|
+
const path = __importStar(require("path"));
|
|
40
|
+
/**
|
|
41
|
+
* @description Where the runner utility keeps its state: `~/.charness-runner/` (0700) of the account that runs the jobs. Builtins only:
|
|
42
|
+
* the very first step of a pairing (before any dependency is installed) already needs these paths.
|
|
43
|
+
*
|
|
44
|
+
* config.json who the runner serves (hub address and pinned host key, the hub's public key, its own id and name)
|
|
45
|
+
* status.json what the link is doing right now (written by `run`, read by `status`)
|
|
46
|
+
* keys/ the runner's client key (logs in to the hub) and the host key of its built-in ssh server
|
|
47
|
+
* app.<id>/ an installed copy of the hub's charness package; `current` points at the one in use
|
|
48
|
+
* bin/ the `charness-runner` launcher, pueue, pueued, rsync when built
|
|
49
|
+
* env the operator's KEY=VALUE lines, added to every job's environment
|
|
50
|
+
* work/ the work dir of remote-run (phase 1); pueue/ the private Pueue; logs/; build/ scratch for the rsync build
|
|
51
|
+
*/
|
|
52
|
+
const stateDirName = '.charness-runner';
|
|
53
|
+
function getRunnerHomePaths(homeDir = os.homedir()) {
|
|
54
|
+
const root = path.join(homeDir, stateDirName);
|
|
55
|
+
return {
|
|
56
|
+
homeDir,
|
|
57
|
+
root,
|
|
58
|
+
config: path.join(root, 'config.json'),
|
|
59
|
+
status: path.join(root, 'status.json'),
|
|
60
|
+
pairing: path.join(root, 'pairing.json'),
|
|
61
|
+
pausedFlag: path.join(root, 'paused'),
|
|
62
|
+
serviceMarker: path.join(root, 'service'),
|
|
63
|
+
iosCheck: path.join(root, 'ios-check.json'),
|
|
64
|
+
keysDir: path.join(root, 'keys'),
|
|
65
|
+
clientKey: path.join(root, 'keys', 'client_ed25519'),
|
|
66
|
+
serverKey: path.join(root, 'keys', 'server_host_ed25519'),
|
|
67
|
+
currentApp: path.join(root, 'current'),
|
|
68
|
+
binDir: path.join(root, 'bin'),
|
|
69
|
+
launcher: path.join(root, 'bin', 'charness-runner'),
|
|
70
|
+
envFile: path.join(root, 'env'),
|
|
71
|
+
workDir: path.join(root, 'work'),
|
|
72
|
+
pueueDir: path.join(root, 'pueue'),
|
|
73
|
+
pueueConfig: path.join(root, 'pueue', 'pueue.yml'),
|
|
74
|
+
logsDir: path.join(root, 'logs'),
|
|
75
|
+
buildDir: path.join(root, 'build'),
|
|
76
|
+
};
|
|
77
|
+
}
|
|
78
|
+
/** @description The folder of one installed copy of the package. */
|
|
79
|
+
function getAppDirPath(paths, appId) {
|
|
80
|
+
return path.join(paths.root, `app.${appId}`);
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=runnerHome.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerHome.js","sourceRoot":"","sources":["../../src/runnerUtility/runnerHome.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,gDAwBC;AAGD,sCAEC;AA1ED,uCAAyB;AACzB,2CAA6B;AAE7B;;;;;;;;;;;GAWG;AAEH,MAAM,YAAY,GAAG,kBAAkB,CAAC;AA6BxC,SAAgB,kBAAkB,CAAC,UAAkB,EAAE,CAAC,OAAO,EAAE;IAC/D,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC;IAC9C,OAAO;QACL,OAAO;QACP,IAAI;QACJ,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC;QACtC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,aAAa,CAAC;QACtC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,IAAI,EAAE,cAAc,CAAC;QACxC,UAA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AC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type SshKeyPair } from '../runners/sshKeys';
|
|
2
|
+
import type { RunnerHomePaths } from './runnerHome';
|
|
3
|
+
export interface RunnerKeys {
|
|
4
|
+
client: SshKeyPair;
|
|
5
|
+
server: SshKeyPair;
|
|
6
|
+
}
|
|
7
|
+
/** @description Both keys, made now when missing. */
|
|
8
|
+
export declare function ensureRunnerKeys(paths: RunnerHomePaths): RunnerKeys;
|
|
9
|
+
/** @description Both keys, or `null` when any is missing (not paired on this account). */
|
|
10
|
+
export declare function readRunnerKeys(paths: RunnerHomePaths): RunnerKeys | null;
|
|
11
|
+
//# sourceMappingURL=runnerKeys.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerKeys.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/runnerKeys.ts"],"names":[],"mappings":"AAEA,OAAO,EAA0B,KAAK,UAAU,EAAE,MAAM,oBAAoB,CAAC;AAC7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAgCpD,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,UAAU,CAAC;IACnB,MAAM,EAAE,UAAU,CAAC;CACpB;AAED,qDAAqD;AACrD,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,eAAe,GAAG,UAAU,CAGnE;AAED,0FAA0F;AAC1F,wBAAgB,cAAc,CAAC,KAAK,EAAE,eAAe,GAAG,UAAU,GAAG,IAAI,CAIxE"}
|
|
@@ -0,0 +1,80 @@
|
|
|
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.ensureRunnerKeys = ensureRunnerKeys;
|
|
37
|
+
exports.readRunnerKeys = readRunnerKeys;
|
|
38
|
+
const fs = __importStar(require("fs"));
|
|
39
|
+
const configDirFile_1 = require("../configDirFile");
|
|
40
|
+
const sshKeys_1 = require("../runners/sshKeys");
|
|
41
|
+
/**
|
|
42
|
+
* @description The runner's two keys, made at pairing and never changed: the CLIENT key (the hub's `authorized_keys` line holds its
|
|
43
|
+
* public half — it is how the runner logs in and may do nothing but speak to the gate) and the HOST key of its built-in ssh server (the
|
|
44
|
+
* hub pins its public half, so nobody else can answer in the runner's name). Both are made with `generateEd25519KeyPair`, which
|
|
45
|
+
* reads every key back (ssh2's generator now and then writes a key nothing can read).
|
|
46
|
+
*/
|
|
47
|
+
const privateKeyMode = 0o600;
|
|
48
|
+
const publicKeyMode = 0o644;
|
|
49
|
+
const publicKeySuffix = '.pub';
|
|
50
|
+
function readKeyPair(privatePath) {
|
|
51
|
+
try {
|
|
52
|
+
const privateKey = fs.readFileSync(privatePath, 'utf8');
|
|
53
|
+
const publicKey = fs.readFileSync(`${privatePath}${publicKeySuffix}`, 'utf8').trim().split(' ').slice(0, 2).join(' ');
|
|
54
|
+
return { privateKey, publicKey };
|
|
55
|
+
}
|
|
56
|
+
catch {
|
|
57
|
+
return null;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
function ensureKeyPair(privatePath, comment) {
|
|
61
|
+
const existing = readKeyPair(privatePath);
|
|
62
|
+
if (existing !== null)
|
|
63
|
+
return existing;
|
|
64
|
+
const created = (0, sshKeys_1.generateEd25519KeyPair)(comment);
|
|
65
|
+
(0, configDirFile_1.writeTextFileAtomically)(privatePath, created.privateKey, privateKeyMode);
|
|
66
|
+
(0, configDirFile_1.writeTextFileAtomically)(`${privatePath}${publicKeySuffix}`, `${created.publicKey} ${comment}\n`, publicKeyMode);
|
|
67
|
+
return created;
|
|
68
|
+
}
|
|
69
|
+
/** @description Both keys, made now when missing. */
|
|
70
|
+
function ensureRunnerKeys(paths) {
|
|
71
|
+
fs.mkdirSync(paths.keysDir, { recursive: true, mode: 0o700 });
|
|
72
|
+
return { client: ensureKeyPair(paths.clientKey, 'charness-runner-client'), server: ensureKeyPair(paths.serverKey, 'charness-runner-host') };
|
|
73
|
+
}
|
|
74
|
+
/** @description Both keys, or `null` when any is missing (not paired on this account). */
|
|
75
|
+
function readRunnerKeys(paths) {
|
|
76
|
+
const client = readKeyPair(paths.clientKey);
|
|
77
|
+
const server = readKeyPair(paths.serverKey);
|
|
78
|
+
return client === null || server === null ? null : { client, server };
|
|
79
|
+
}
|
|
80
|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,CAAC,SAAS,IAAI,OAAO,IAAI,EAAE,aAAa,CAAC,CAAC;IAChH,OAAO,OAAO,CAAC;AACjB,CAAC;AAOD,qDAAqD;AACrD,SAAgB,gBAAgB,CAAC,KAAsB;IACrD,EAAE,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IAC9D,OAAO,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,SAAS,EAAE,wBAAwB,CAAC,EAAE,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC,SAAS,EAAE,sBAAsB,CAAC,EAAE,CAAC;AAC9I,CAAC;AAED,0FAA0F;AAC1F,SAAgB,cAAc,CAAC,KAAsB;IACnD,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC5C,MAAM,MAAM,GAAG,WAAW,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAC5C,OAAO,MAAM,KAAK,IAAI,IAAI,MAAM,KAAK,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,EAAE,CAAC;AACxE,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { Duplex } from 'stream';
|
|
2
|
+
import { type AuthContext } from 'ssh2';
|
|
3
|
+
/**
|
|
4
|
+
* @description The runner's built-in ssh servers. There is no sshd on the runner and nothing listens: the hub's gate speaks ssh over the
|
|
5
|
+
* channel of the runner's own outbound connection, with the runner as the SERVER (see `src/runners/gateLink.ts`). Two servers, one inside
|
|
6
|
+
* the other:
|
|
7
|
+
*
|
|
8
|
+
* link server the ssh session of the gate itself; it accepts a `direct-tcpip` channel and hands that channel to
|
|
9
|
+
* session server an ordinary ssh server for the hub's stock `ssh` (ControlMaster, rsync, `exec`) — one channel per connection of the
|
|
10
|
+
* hub's socket
|
|
11
|
+
*
|
|
12
|
+
* Both accept ONE key — the hub's, checked with a real signature — and both refuse everything that is not an `exec`: no shell, no pty,
|
|
13
|
+
* no subsystem, no x11, no agent, no port or unix-socket forwarding in either direction. `env` requests are accepted and ignored: a job
|
|
14
|
+
* never gets variables from the hub's ssh client.
|
|
15
|
+
*/
|
|
16
|
+
export interface RunnerServersOptions {
|
|
17
|
+
/** The PEM/OpenSSH private key of the built-in server (its public half is pinned by the hub). */
|
|
18
|
+
serverPrivateKey: string;
|
|
19
|
+
/** `ssh-ed25519 <base64>`: the only key that may log in. */
|
|
20
|
+
hubPublicKey: string;
|
|
21
|
+
/** The environment for the next command; asked per command. */
|
|
22
|
+
readEnv: () => NodeJS.ProcessEnv;
|
|
23
|
+
cwd: string;
|
|
24
|
+
/** Called with the number of running commands whenever it changes. */
|
|
25
|
+
onActiveCountChange?: (activeCount: number) => void;
|
|
26
|
+
}
|
|
27
|
+
export interface RunnerServers {
|
|
28
|
+
/** Serve ssh over `stream` (the exec channel to the hub) as the link server. */
|
|
29
|
+
acceptLinkStream: (stream: Duplex) => void;
|
|
30
|
+
getActiveExecCount: () => number;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* @description The check shared by both servers: the hub's key only — the blob AND the algorithm name it was offered under must be the
|
|
34
|
+
* pinned key's (a request that carries the right public key under another algorithm, say RSA-SHA2, makes `verify` return an Error) —
|
|
35
|
+
* and the signature must verify. `verify` answers `boolean | Error`: only `true` is a pass. The first, unsigned query only asks «would
|
|
36
|
+
* this key do?».
|
|
37
|
+
*/
|
|
38
|
+
export declare function createHubAuthenticator(hubPublicKey: string): (auth: AuthContext) => void;
|
|
39
|
+
export declare function createRunnerServers(options: RunnerServersOptions): RunnerServers;
|
|
40
|
+
//# sourceMappingURL=runnerServers.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerServers.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/runnerServers.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACrC,OAAO,EAAiB,KAAK,WAAW,EAAE,MAAM,MAAM,CAAC;AAKvD;;;;;;;;;;;;GAYG;AAEH,MAAM,WAAW,oBAAoB;IACnC,iGAAiG;IACjG,gBAAgB,EAAE,MAAM,CAAC;IACzB,4DAA4D;IAC5D,YAAY,EAAE,MAAM,CAAC;IACrB,+DAA+D;IAC/D,OAAO,EAAE,MAAM,MAAM,CAAC,UAAU,CAAC;IACjC,GAAG,EAAE,MAAM,CAAC;IACZ,sEAAsE;IACtE,mBAAmB,CAAC,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,IAAI,CAAC;CACrD;AAED,MAAM,WAAW,aAAa;IAC5B,gFAAgF;IAChF,gBAAgB,EAAE,CAAC,MAAM,EAAE,MAAM,KAAK,IAAI,CAAC;IAC3C,kBAAkB,EAAE,MAAM,MAAM,CAAC;CAClC;AAED;;;;;GAKG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,GAAG,CAAC,IAAI,EAAE,WAAW,KAAK,IAAI,CAgBxF;AAED,wBAAgB,mBAAmB,CAAC,OAAO,EAAE,oBAAoB,GAAG,aAAa,CA6ChF"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createHubAuthenticator = createHubAuthenticator;
|
|
4
|
+
exports.createRunnerServers = createRunnerServers;
|
|
5
|
+
const ssh2_1 = require("ssh2");
|
|
6
|
+
const sshKeys_1 = require("../runners/sshKeys");
|
|
7
|
+
const execSession_1 = require("./execSession");
|
|
8
|
+
const injectStream_1 = require("./injectStream");
|
|
9
|
+
/**
|
|
10
|
+
* @description The check shared by both servers: the hub's key only — the blob AND the algorithm name it was offered under must be the
|
|
11
|
+
* pinned key's (a request that carries the right public key under another algorithm, say RSA-SHA2, makes `verify` return an Error) —
|
|
12
|
+
* and the signature must verify. `verify` answers `boolean | Error`: only `true` is a pass. The first, unsigned query only asks «would
|
|
13
|
+
* this key do?».
|
|
14
|
+
*/
|
|
15
|
+
function createHubAuthenticator(hubPublicKey) {
|
|
16
|
+
const hub = (0, sshKeys_1.parsePublicKey)(hubPublicKey);
|
|
17
|
+
const hubKey = ssh2_1.utils.parseKey(hubPublicKey);
|
|
18
|
+
if (hub === null || hubKey instanceof Error)
|
|
19
|
+
throw new Error('the hub key does not read as an ssh public key');
|
|
20
|
+
return (auth) => {
|
|
21
|
+
if (auth.method !== 'publickey' || auth.key.algo !== hub.type || !auth.key.data.equals(hub.blob)) {
|
|
22
|
+
auth.reject();
|
|
23
|
+
return;
|
|
24
|
+
}
|
|
25
|
+
if (auth.signature === undefined) {
|
|
26
|
+
auth.accept();
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
if (auth.blob !== undefined && hubKey.verify(auth.blob, auth.signature, auth.hashAlgo) === true)
|
|
30
|
+
auth.accept();
|
|
31
|
+
else
|
|
32
|
+
auth.reject();
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
function createRunnerServers(options) {
|
|
36
|
+
const authenticate = createHubAuthenticator(options.hubPublicKey);
|
|
37
|
+
let activeExecCount = 0;
|
|
38
|
+
const tracker = {
|
|
39
|
+
started: () => {
|
|
40
|
+
activeExecCount += 1;
|
|
41
|
+
options.onActiveCountChange?.(activeExecCount);
|
|
42
|
+
},
|
|
43
|
+
ended: () => {
|
|
44
|
+
activeExecCount -= 1;
|
|
45
|
+
options.onActiveCountChange?.(activeExecCount);
|
|
46
|
+
},
|
|
47
|
+
};
|
|
48
|
+
const sessionServer = new ssh2_1.Server({ hostKeys: [options.serverPrivateKey] }, (connection) => {
|
|
49
|
+
connection.on('error', () => undefined);
|
|
50
|
+
connection.on('authentication', authenticate);
|
|
51
|
+
connection.on('request', (_accept, reject) => reject?.());
|
|
52
|
+
connection.on('tcpip', (_accept, reject) => reject());
|
|
53
|
+
connection.on('openssh.streamlocal', (_accept, reject) => reject());
|
|
54
|
+
connection.on('ready', () => {
|
|
55
|
+
connection.on('session', (acceptSession) => {
|
|
56
|
+
const session = acceptSession();
|
|
57
|
+
session.on('env', (accept) => accept?.());
|
|
58
|
+
for (const refused of ['pty', 'shell', 'subsystem', 'x11'])
|
|
59
|
+
session.on(refused, (_accept, reject) => reject?.());
|
|
60
|
+
session.on('exec', (accept, _reject, info) => {
|
|
61
|
+
(0, execSession_1.serveExec)(accept(), info.command, { env: options.readEnv(), cwd: options.cwd, tracker });
|
|
62
|
+
});
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
});
|
|
66
|
+
const linkServer = new ssh2_1.Server({ hostKeys: [options.serverPrivateKey] }, (connection) => {
|
|
67
|
+
connection.on('error', () => undefined);
|
|
68
|
+
connection.on('authentication', authenticate);
|
|
69
|
+
connection.on('request', (_accept, reject) => reject?.());
|
|
70
|
+
connection.on('ready', () => {
|
|
71
|
+
connection.on('tcpip', (accept) => (0, injectStream_1.injectStreamIntoSshServer)(sessionServer, accept()));
|
|
72
|
+
});
|
|
73
|
+
});
|
|
74
|
+
return {
|
|
75
|
+
acceptLinkStream: (stream) => (0, injectStream_1.injectStreamIntoSshServer)(linkServer, stream),
|
|
76
|
+
getActiveExecCount: () => activeExecCount,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=runnerServers.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerServers.js","sourceRoot":"","sources":["../../src/runnerUtility/runnerServers.ts"],"names":[],"mappings":";;AA4CA,wDAgBC;AAED,kDA6CC;AA1GD,+BAAuD;AACvD,gDAAoD;AACpD,+CAA4D;AAC5D,iDAA2D;AAkC3D;;;;;GAKG;AACH,SAAgB,sBAAsB,CAAC,YAAoB;IACzD,MAAM,GAAG,GAAG,IAAA,wBAAc,EAAC,YAAY,CAAC,CAAC;IACzC,MAAM,MAAM,GAAG,YAAK,CAAC,QAAQ,CAAC,YAAY,CAAC,CAAC;IAC5C,IAAI,GAAG,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