charness 3.7.0 → 3.8.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 +30 -0
- package/DEVELOPMENT.md +6 -2
- package/README.md +5 -5
- package/SETUP.md +16 -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.js +44 -1
- 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 +486 -0
- package/dist/connectors/telegram/commands/runners.js.map +1 -0
- package/dist/connectors/telegram/runnerPairingMessages.d.ts +27 -0
- package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -0
- package/dist/connectors/telegram/runnerPairingMessages.js +105 -0
- package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -0
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +58 -0
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +58 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +58 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +58 -0
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +58 -0
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +58 -0
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +58 -0
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +58 -0
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +58 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +58 -0
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +58 -0
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +58 -0
- package/dist/i18n/zh.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 +7 -7
- package/dist/remoteRun/runners.d.ts.map +1 -1
- package/dist/remoteRun/runners.js +45 -17
- 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 +29 -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 +11 -0
- package/dist/runnerUtility/adminCheck.d.ts.map +1 -0
- package/dist/runnerUtility/adminCheck.js +68 -0
- package/dist/runnerUtility/adminCheck.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 +47 -0
- package/dist/runnerUtility/linkLoop.d.ts.map +1 -0
- package/dist/runnerUtility/linkLoop.js +281 -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/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/runnerCli.d.ts +18 -0
- package/dist/runnerUtility/runnerCli.d.ts.map +1 -0
- package/dist/runnerUtility/runnerCli.js +184 -0
- package/dist/runnerUtility/runnerCli.js.map +1 -0
- package/dist/runnerUtility/runnerCommands.d.ts +67 -0
- package/dist/runnerUtility/runnerCommands.d.ts.map +1 -0
- package/dist/runnerUtility/runnerCommands.js +418 -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/serviceManager.d.ts +54 -0
- package/dist/runnerUtility/serviceManager.d.ts.map +1 -0
- package/dist/runnerUtility/serviceManager.js +413 -0
- package/dist/runnerUtility/serviceManager.js.map +1 -0
- package/dist/runnerUtility/serviceUnits.d.ts +36 -0
- package/dist/runnerUtility/serviceUnits.d.ts.map +1 -0
- package/dist/runnerUtility/serviceUnits.js +169 -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 +4 -0
- package/dist/runners/bootstrapLine.d.ts.map +1 -0
- package/dist/runners/bootstrapLine.js +69 -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 +216 -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 +98 -0
- package/dist/runners/gateProtocol.d.ts.map +1 -0
- package/dist/runners/gateProtocol.js +149 -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 +63 -0
- package/dist/runners/hubPairing.d.ts.map +1 -0
- package/dist/runners/hubPairing.js +261 -0
- package/dist/runners/hubPairing.js.map +1 -0
- package/dist/runners/hubPaths.d.ts +38 -0
- package/dist/runners/hubPaths.d.ts.map +1 -0
- package/dist/runners/hubPaths.js +94 -0
- package/dist/runners/hubPaths.js.map +1 -0
- package/dist/runners/hubRegistry.d.ts +112 -0
- package/dist/runners/hubRegistry.d.ts.map +1 -0
- package/dist/runners/hubRegistry.js +210 -0
- package/dist/runners/hubRegistry.js.map +1 -0
- package/dist/runners/linkControl.d.ts +27 -0
- package/dist/runners/linkControl.d.ts.map +1 -0
- package/dist/runners/linkControl.js +124 -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/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 +82 -0
- package/dist/runners/runnerRemoval.js.map +1 -0
- package/dist/runners/runnersCli.d.ts +16 -0
- package/dist/runners/runnersCli.d.ts.map +1 -0
- package/dist/runners/runnersCli.js +214 -0
- package/dist/runners/runnersCli.js.map +1 -0
- package/dist/runners/runnersList.d.ts +17 -0
- package/dist/runners/runnersList.d.ts.map +1 -0
- package/dist/runners/runnersList.js +49 -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 +55 -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.js +2 -2
- package/dist/selfUpdate/selfCheck.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 +130 -0
- package/dist/utils/runnersScreenPlan.d.ts.map +1 -0
- package/dist/utils/runnersScreenPlan.js +257 -0
- package/dist/utils/runnersScreenPlan.js.map +1 -0
- package/package.json +5 -2
- package/remoteRun/runner.sh +81 -6
|
@@ -0,0 +1,94 @@
|
|
|
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.getHandMadeRunnersPath = getHandMadeRunnersPath;
|
|
37
|
+
exports.createHubContext = createHubContext;
|
|
38
|
+
exports.getHubFilePaths = getHubFilePaths;
|
|
39
|
+
exports.getRunnerLinkPaths = getRunnerLinkPaths;
|
|
40
|
+
exports.getRunnerHostAlias = getRunnerHostAlias;
|
|
41
|
+
const os = __importStar(require("os"));
|
|
42
|
+
const path = __importStar(require("path"));
|
|
43
|
+
const runnersConfig_1 = require("../remoteRun/runnersConfig");
|
|
44
|
+
/**
|
|
45
|
+
* @description Where the hub keeps what paired runners need. ONE folder per OS user — `~/.config/charness/runners/`, beside the
|
|
46
|
+
* hand-made `runners.json` — and every `authorized_keys` line NAMES it (`gate --dir <dir>`), so nothing the gate does depends on
|
|
47
|
+
* `$HOME`, `DATA_DIR` or which instance runs it: any charness instance of the user, the bot and the CLI alike, shares one registry.
|
|
48
|
+
*/
|
|
49
|
+
const runnersDirName = 'runners';
|
|
50
|
+
const sshDirName = '.ssh';
|
|
51
|
+
const authorizedKeysFileName = 'authorized_keys';
|
|
52
|
+
const cliFileName = 'cli.js';
|
|
53
|
+
/** @description The hand-made `runners.json` that sits beside the registry folder (see {@link createHubContext}). */
|
|
54
|
+
function getHandMadeRunnersPath(dir) {
|
|
55
|
+
return path.join(path.dirname(dir), 'runners.json');
|
|
56
|
+
}
|
|
57
|
+
/** @description `dist/cli.js` of the running charness: this file is `dist/runners/hubPaths.js`. */
|
|
58
|
+
function getOwnCliPath() {
|
|
59
|
+
return path.resolve(__dirname, '..', cliFileName);
|
|
60
|
+
}
|
|
61
|
+
/** @description The context of the real machine for `homeDir`; every field can be overridden. */
|
|
62
|
+
function createHubContext(overrides = {}) {
|
|
63
|
+
const homeDir = overrides.homeDir ?? os.homedir();
|
|
64
|
+
const cliPath = overrides.cliPath ?? getOwnCliPath();
|
|
65
|
+
return {
|
|
66
|
+
dir: overrides.dir ?? path.join(path.dirname((0, runnersConfig_1.getRunnersConfigPath)(homeDir)), runnersDirName),
|
|
67
|
+
authorizedKeysPath: overrides.authorizedKeysPath ?? path.join(homeDir, sshDirName, authorizedKeysFileName),
|
|
68
|
+
nodePath: overrides.nodePath ?? process.execPath,
|
|
69
|
+
cliPath,
|
|
70
|
+
packageRoot: overrides.packageRoot ?? path.resolve(path.dirname(cliPath), '..'),
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
function getHubFilePaths(dir) {
|
|
74
|
+
return {
|
|
75
|
+
paired: path.join(dir, 'paired.json'),
|
|
76
|
+
pending: path.join(dir, 'pending.json'),
|
|
77
|
+
hubKey: path.join(dir, 'hub_ed25519'),
|
|
78
|
+
hubPublicKey: path.join(dir, 'hub_ed25519.pub'),
|
|
79
|
+
knownHosts: path.join(dir, 'known_hosts'),
|
|
80
|
+
gate: path.join(dir, 'gate'),
|
|
81
|
+
linkDir: path.join(dir, 'link'),
|
|
82
|
+
packageDir: path.join(dir, 'package'),
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
/** @description The socket the gate of runner `runnerId` listens on, and the file that says who holds it. */
|
|
86
|
+
function getRunnerLinkPaths(dir, runnerId) {
|
|
87
|
+
const linkDir = getHubFilePaths(dir).linkDir;
|
|
88
|
+
return { socket: path.join(linkDir, `${runnerId}.sock`), state: path.join(linkDir, `${runnerId}.json`) };
|
|
89
|
+
}
|
|
90
|
+
/** @description The host alias of a runner in the hub's `known_hosts` (and the `HostKeyAlias` of the ssh calls to it). */
|
|
91
|
+
function getRunnerHostAlias(runnerId) {
|
|
92
|
+
return `charness-runner-${runnerId}`;
|
|
93
|
+
}
|
|
94
|
+
//# sourceMappingURL=hubPaths.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hubPaths.js","sourceRoot":"","sources":["../../src/runners/hubPaths.ts"],"names":[],"mappings":";;;;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AAO,CAAC,EAAE,IAAI,CAAC;KAChF,CAAC;AACJ,CAAC;AAED,SAAgB,eAAe,CAAC,GAAW;IACzC,OAAO;QACL,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC;QACrC,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC;QACvC,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC;QACrC,YAAY,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,iBAAiB,CAAC;QAC/C,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,aAAa,CAAC;QACzC,IAAI,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC;QAC5B,OAAO,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,MAAM,CAAC;QAC/B,UAAU,EAAE,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC;KACtC,CAAC;AACJ,CAAC;AAED,6GAA6G;AAC7G,SAAgB,kBAAkB,CAAC,GAAW,EAAE,QAAgB;IAC9D,MAAM,OAAO,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC;IAC7C,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,QAAQ,OAAO,CAAC,EAAE,KAAK,EAAE,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,GAAG,QAAQ,OAAO,CAAC,EAAE,CAAC;AAC3G,CAAC;AAED,0HAA0H;AAC1H,SAAgB,kBAAkB,CAAC,QAAgB;IACjD,OAAO,mBAAmB,QAAQ,EAAE,CAAC;AACvC,CAAC"}
|
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type HubContext } from './hubPaths';
|
|
3
|
+
/** @description How the runner utility says it is kept running (reported at pairing). */
|
|
4
|
+
export declare const runnerServiceKinds: readonly ["foreground", "user-service", "system-service", "unknown"];
|
|
5
|
+
export type RunnerServiceKind = (typeof runnerServiceKinds)[number];
|
|
6
|
+
declare const pairedRunnerSchema: z.ZodObject<{
|
|
7
|
+
id: z.ZodString;
|
|
8
|
+
name: z.ZodString;
|
|
9
|
+
publicKey: z.ZodString;
|
|
10
|
+
keyFingerprint: z.ZodString;
|
|
11
|
+
hostKey: z.ZodString;
|
|
12
|
+
workDir: z.ZodString;
|
|
13
|
+
os: z.ZodString;
|
|
14
|
+
arch: z.ZodString;
|
|
15
|
+
version: z.ZodString;
|
|
16
|
+
serviceKind: z.ZodEnum<{
|
|
17
|
+
unknown: "unknown";
|
|
18
|
+
foreground: "foreground";
|
|
19
|
+
"user-service": "user-service";
|
|
20
|
+
"system-service": "system-service";
|
|
21
|
+
}>;
|
|
22
|
+
pairedAtMs: z.ZodNumber;
|
|
23
|
+
pairId: z.ZodString;
|
|
24
|
+
label: z.ZodString;
|
|
25
|
+
host: z.ZodString;
|
|
26
|
+
port: z.ZodNumber;
|
|
27
|
+
isPaused: z.ZodBoolean;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
export declare const pairedFileSchema: z.ZodObject<{
|
|
30
|
+
rev: z.ZodNumber;
|
|
31
|
+
runners: z.ZodArray<z.ZodObject<{
|
|
32
|
+
id: z.ZodString;
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
publicKey: z.ZodString;
|
|
35
|
+
keyFingerprint: z.ZodString;
|
|
36
|
+
hostKey: z.ZodString;
|
|
37
|
+
workDir: z.ZodString;
|
|
38
|
+
os: z.ZodString;
|
|
39
|
+
arch: z.ZodString;
|
|
40
|
+
version: z.ZodString;
|
|
41
|
+
serviceKind: z.ZodEnum<{
|
|
42
|
+
unknown: "unknown";
|
|
43
|
+
foreground: "foreground";
|
|
44
|
+
"user-service": "user-service";
|
|
45
|
+
"system-service": "system-service";
|
|
46
|
+
}>;
|
|
47
|
+
pairedAtMs: z.ZodNumber;
|
|
48
|
+
pairId: z.ZodString;
|
|
49
|
+
label: z.ZodString;
|
|
50
|
+
host: z.ZodString;
|
|
51
|
+
port: z.ZodNumber;
|
|
52
|
+
isPaused: z.ZodBoolean;
|
|
53
|
+
}, z.core.$strict>>;
|
|
54
|
+
}, z.core.$strict>;
|
|
55
|
+
declare const pendingPairingSchema: z.ZodObject<{
|
|
56
|
+
pairId: z.ZodString;
|
|
57
|
+
publicKey: z.ZodString;
|
|
58
|
+
keyFingerprint: z.ZodString;
|
|
59
|
+
expiresAtMs: z.ZodNumber;
|
|
60
|
+
host: z.ZodString;
|
|
61
|
+
port: z.ZodNumber;
|
|
62
|
+
label: z.ZodString;
|
|
63
|
+
messageRef: z.ZodNullable<z.ZodString>;
|
|
64
|
+
}, z.core.$strict>;
|
|
65
|
+
declare const pendingFileSchema: z.ZodObject<{
|
|
66
|
+
pending: z.ZodArray<z.ZodObject<{
|
|
67
|
+
pairId: z.ZodString;
|
|
68
|
+
publicKey: z.ZodString;
|
|
69
|
+
keyFingerprint: z.ZodString;
|
|
70
|
+
expiresAtMs: z.ZodNumber;
|
|
71
|
+
host: z.ZodString;
|
|
72
|
+
port: z.ZodNumber;
|
|
73
|
+
label: z.ZodString;
|
|
74
|
+
messageRef: z.ZodNullable<z.ZodString>;
|
|
75
|
+
}, z.core.$strict>>;
|
|
76
|
+
}, z.core.$strict>;
|
|
77
|
+
/** @name PairedRunner @description One attached machine. */
|
|
78
|
+
export type PairedRunner = z.infer<typeof pairedRunnerSchema>;
|
|
79
|
+
/** @name PairedFile @description `paired.json`. */
|
|
80
|
+
export type PairedFile = z.infer<typeof pairedFileSchema>;
|
|
81
|
+
/** @name PendingPairing @description One pairing code that is out. */
|
|
82
|
+
export type PendingPairing = z.infer<typeof pendingPairingSchema>;
|
|
83
|
+
/** @name PendingFile @description `pending.json`. */
|
|
84
|
+
export type PendingFile = z.infer<typeof pendingFileSchema>;
|
|
85
|
+
export declare class HubRegistryError extends Error {
|
|
86
|
+
constructor(message: string);
|
|
87
|
+
}
|
|
88
|
+
/** @description The registry files were written but a file derived from them could not be; the next locked operation repairs it. */
|
|
89
|
+
export declare class HubDerivedFilesError extends HubRegistryError {
|
|
90
|
+
constructor(fileName: string, errnoCode: string);
|
|
91
|
+
}
|
|
92
|
+
/** @description `paired.json` right now (missing = nobody paired). */
|
|
93
|
+
export declare function readPairedFile(dir: string): PairedFile;
|
|
94
|
+
/** @description `pending.json` right now (missing = no code out). */
|
|
95
|
+
export declare function readPendingFile(dir: string): PendingFile;
|
|
96
|
+
/** @description Write `paired.json`; the registry lock must be held. */
|
|
97
|
+
export declare function writePairedFile(dir: string, file: PairedFile): void;
|
|
98
|
+
/** @description Write `pending.json`; the registry lock must be held. */
|
|
99
|
+
export declare function writePendingFile(dir: string, file: PendingFile): void;
|
|
100
|
+
/** @description The `known_hosts` text for the ssh calls through the links: one line per runner, under its alias. */
|
|
101
|
+
export declare function renderKnownHosts(runners: readonly PairedRunner[]): string;
|
|
102
|
+
/** @description The lines of the managed `authorized_keys` block: every pairing code still open, then every paired runner. */
|
|
103
|
+
export declare function renderManagedBlockLines(ctx: HubContext, pending: readonly PendingPairing[], runners: readonly PairedRunner[], nowMs: number): string[];
|
|
104
|
+
/**
|
|
105
|
+
* @description Bring the derived files in line with the two registry files: `known_hosts` and the `authorized_keys` block, each written
|
|
106
|
+
* only when it differs. The registry lock must be held. The block goes LAST, so a key is never allowed before the files its gate reads
|
|
107
|
+
* are in place. The registry files are authoritative and are written BEFORE this runs; a failure here is reported as
|
|
108
|
+
* {@link HubDerivedFilesError} and mends itself, because every locked operation ends with this same call.
|
|
109
|
+
*/
|
|
110
|
+
export declare function syncDerivedHubFiles(ctx: HubContext, pending: PendingFile, paired: PairedFile, nowMs: number): void;
|
|
111
|
+
export {};
|
|
112
|
+
//# sourceMappingURL=hubRegistry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hubRegistry.d.ts","sourceRoot":"","sources":["../../src/runners/hubRegistry.ts"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AACxE,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,UAAU,GAAG,IAAI,CAGnE;AAED,yEAAyE;AACzE,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,GAAG,IAAI,CAGrE;AAED,qHAAqH;AACrH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,SAAS,YAAY,EAAE,GAAG,MAAM,CAEzE;AAED,8HAA8H;AAC9H,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,SAAS,cAAc,EAAE,EAAE,OAAO,EAAE,SAAS,YAAY,EAAE,EAAE,KAAK,EAAE,MAAM,GAAG,MAAM,EAAE,CAOtJ;AAUD;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,GAAG,EAAE,UAAU,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,MAAM,GAAG,IAAI,CAalH"}
|
|
@@ -0,0 +1,210 @@
|
|
|
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.HubDerivedFilesError = exports.HubRegistryError = exports.pairedFileSchema = exports.runnerServiceKinds = void 0;
|
|
37
|
+
exports.readPairedFile = readPairedFile;
|
|
38
|
+
exports.readPendingFile = readPendingFile;
|
|
39
|
+
exports.writePairedFile = writePairedFile;
|
|
40
|
+
exports.writePendingFile = writePendingFile;
|
|
41
|
+
exports.renderKnownHosts = renderKnownHosts;
|
|
42
|
+
exports.renderManagedBlockLines = renderManagedBlockLines;
|
|
43
|
+
exports.syncDerivedHubFiles = syncDerivedHubFiles;
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const zod_1 = require("zod");
|
|
46
|
+
const configDirFile_1 = require("../configDirFile");
|
|
47
|
+
const runnersConfig_1 = require("../remoteRun/runnersConfig");
|
|
48
|
+
const authorizedKeys_1 = require("./authorizedKeys");
|
|
49
|
+
const hubIds_1 = require("./hubIds");
|
|
50
|
+
const hubPaths_1 = require("./hubPaths");
|
|
51
|
+
const hubLock_1 = require("./hubLock");
|
|
52
|
+
const configDirFile_2 = require("../configDirFile");
|
|
53
|
+
const sshKeys_1 = require("./sshKeys");
|
|
54
|
+
/**
|
|
55
|
+
* @description The hub's two registry files and what is derived from them. `paired.json` is the machines that are attached,
|
|
56
|
+
* `pending.json` the pairing codes that are out. Both are read freely (every write is a rename, a reader sees a whole file) and
|
|
57
|
+
* written only under the registry lock (`hubLock.ts`). `known_hosts` (the runners' host keys, for the ssh calls through the link)
|
|
58
|
+
* and the managed `authorized_keys` block are DERIVED from the two on every change — never edited on their own.
|
|
59
|
+
*
|
|
60
|
+
* A file that does not parse or validate stops the caller with the problem named (field and rule, no values): a registry that is
|
|
61
|
+
* silently treated as empty would be rewritten empty and lose every pairing.
|
|
62
|
+
*/
|
|
63
|
+
const registryFileMode = 0o600;
|
|
64
|
+
const knownHostsMode = 0o644;
|
|
65
|
+
const maxTextLength = 200;
|
|
66
|
+
const publicKeySchema = zod_1.z.string().refine(sshKeys_1.checkIsEd25519PublicKey, 'must be an ed25519 public key (type and key, no comment)');
|
|
67
|
+
/** @description How the runner utility says it is kept running (reported at pairing). */
|
|
68
|
+
exports.runnerServiceKinds = ['foreground', 'user-service', 'system-service', 'unknown'];
|
|
69
|
+
const pairedRunnerSchema = zod_1.z.strictObject({
|
|
70
|
+
id: hubIds_1.hubIdSchema,
|
|
71
|
+
name: zod_1.z.string().regex(runnersConfig_1.runnerNamePattern, 'must be lowercase letters, digits and single dashes').max(40),
|
|
72
|
+
/** The runner's own client key: what its `authorized_keys` line holds. */
|
|
73
|
+
publicKey: publicKeySchema,
|
|
74
|
+
keyFingerprint: zod_1.z.string().max(maxTextLength),
|
|
75
|
+
/** The host key of the runner's built-in ssh server: pinned by the gate and by `known_hosts`. */
|
|
76
|
+
hostKey: publicKeySchema,
|
|
77
|
+
workDir: runnersConfig_1.runnerWorkDirSchema,
|
|
78
|
+
os: zod_1.z.string().max(maxTextLength),
|
|
79
|
+
arch: zod_1.z.string().max(maxTextLength),
|
|
80
|
+
version: zod_1.z.string().max(maxTextLength),
|
|
81
|
+
serviceKind: zod_1.z.enum(exports.runnerServiceKinds),
|
|
82
|
+
pairedAtMs: zod_1.z.number().int().nonnegative(),
|
|
83
|
+
/** The pairing that made it: how the instance that offered the code finds out that it was used, and what makes a retry of `redeem` idempotent. */
|
|
84
|
+
pairId: hubIds_1.hubIdSchema,
|
|
85
|
+
/** What the runner was told about this hub (kept so a retried `redeem` is answered the same way after the pending entry is gone). */
|
|
86
|
+
label: zod_1.z.string().min(1).max(maxTextLength),
|
|
87
|
+
host: hubIds_1.hubHostSchema,
|
|
88
|
+
port: hubIds_1.hubPortSchema,
|
|
89
|
+
/** Set from the hub: the runner stays attached, but no job is sent to it. */
|
|
90
|
+
isPaused: zod_1.z.boolean(),
|
|
91
|
+
});
|
|
92
|
+
exports.pairedFileSchema = zod_1.z.strictObject({
|
|
93
|
+
/** Counts every change: a keyboard built from one revision never acts on a later list. */
|
|
94
|
+
rev: zod_1.z.number().int().nonnegative(),
|
|
95
|
+
runners: zod_1.z.array(pairedRunnerSchema),
|
|
96
|
+
});
|
|
97
|
+
const pendingPairingSchema = zod_1.z.strictObject({
|
|
98
|
+
pairId: hubIds_1.hubIdSchema,
|
|
99
|
+
/** The temporary key's PUBLIC half (the private half is in the code only). */
|
|
100
|
+
publicKey: publicKeySchema,
|
|
101
|
+
keyFingerprint: zod_1.z.string().max(maxTextLength),
|
|
102
|
+
expiresAtMs: zod_1.z.number().int().nonnegative(),
|
|
103
|
+
host: hubIds_1.hubHostSchema,
|
|
104
|
+
port: hubIds_1.hubPortSchema,
|
|
105
|
+
/** Whose charness it is, as the runner shows it (`@ExampleBot`, a host name). */
|
|
106
|
+
label: zod_1.z.string().min(1).max(maxTextLength),
|
|
107
|
+
/** The message the offering instance edits when the code is used or expires (opaque to the hub); `null` for the CLI. */
|
|
108
|
+
messageRef: zod_1.z.string().max(maxTextLength).nullable(),
|
|
109
|
+
});
|
|
110
|
+
const pendingFileSchema = zod_1.z.strictObject({ pending: zod_1.z.array(pendingPairingSchema) });
|
|
111
|
+
class HubRegistryError extends Error {
|
|
112
|
+
constructor(message) {
|
|
113
|
+
super(message);
|
|
114
|
+
this.name = 'HubRegistryError';
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
exports.HubRegistryError = HubRegistryError;
|
|
118
|
+
/** @description The registry files were written but a file derived from them could not be; the next locked operation repairs it. */
|
|
119
|
+
class HubDerivedFilesError extends HubRegistryError {
|
|
120
|
+
constructor(fileName, errnoCode) {
|
|
121
|
+
super(`the registry was updated but ${fileName} could not be written (${errnoCode}); the next runners command repairs it`);
|
|
122
|
+
this.name = 'HubDerivedFilesError';
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
exports.HubDerivedFilesError = HubDerivedFilesError;
|
|
126
|
+
function readRegistryFile(filePath, fileName, schema, createEmpty) {
|
|
127
|
+
let text;
|
|
128
|
+
try {
|
|
129
|
+
text = fs.readFileSync(filePath, 'utf8');
|
|
130
|
+
}
|
|
131
|
+
catch (error) {
|
|
132
|
+
if (error instanceof Error && 'code' in error && error.code === 'ENOENT')
|
|
133
|
+
return createEmpty();
|
|
134
|
+
throw new HubRegistryError(`${fileName} could not be read`);
|
|
135
|
+
}
|
|
136
|
+
let parsedJson;
|
|
137
|
+
try {
|
|
138
|
+
parsedJson = JSON.parse(text);
|
|
139
|
+
}
|
|
140
|
+
catch {
|
|
141
|
+
throw new HubRegistryError(`${fileName} is not valid JSON; fix or remove it by hand (nothing was changed)`);
|
|
142
|
+
}
|
|
143
|
+
const parsed = schema.safeParse(parsedJson);
|
|
144
|
+
if (parsed.success)
|
|
145
|
+
return parsed.data;
|
|
146
|
+
throw new HubRegistryError(`${fileName} is invalid: ${parsed.error.issues.map((issue) => `${issue.path.join('.') || '(root)'} ${issue.message}`).join('; ')}`);
|
|
147
|
+
}
|
|
148
|
+
/** @description `paired.json` right now (missing = nobody paired). */
|
|
149
|
+
function readPairedFile(dir) {
|
|
150
|
+
return readRegistryFile((0, hubPaths_1.getHubFilePaths)(dir).paired, 'paired.json', exports.pairedFileSchema, () => ({ rev: 0, runners: [] }));
|
|
151
|
+
}
|
|
152
|
+
/** @description `pending.json` right now (missing = no code out). */
|
|
153
|
+
function readPendingFile(dir) {
|
|
154
|
+
return readRegistryFile((0, hubPaths_1.getHubFilePaths)(dir).pending, 'pending.json', pendingFileSchema, () => ({ pending: [] }));
|
|
155
|
+
}
|
|
156
|
+
/** @description Write `paired.json`; the registry lock must be held. */
|
|
157
|
+
function writePairedFile(dir, file) {
|
|
158
|
+
(0, hubLock_1.ensureHubDir)(dir);
|
|
159
|
+
(0, configDirFile_1.writeJsonFileAtomically)((0, hubPaths_1.getHubFilePaths)(dir).paired, exports.pairedFileSchema.parse(file), registryFileMode);
|
|
160
|
+
}
|
|
161
|
+
/** @description Write `pending.json`; the registry lock must be held. */
|
|
162
|
+
function writePendingFile(dir, file) {
|
|
163
|
+
(0, hubLock_1.ensureHubDir)(dir);
|
|
164
|
+
(0, configDirFile_1.writeJsonFileAtomically)((0, hubPaths_1.getHubFilePaths)(dir).pending, pendingFileSchema.parse(file), registryFileMode);
|
|
165
|
+
}
|
|
166
|
+
/** @description The `known_hosts` text for the ssh calls through the links: one line per runner, under its alias. */
|
|
167
|
+
function renderKnownHosts(runners) {
|
|
168
|
+
return runners.map((runner) => `${(0, hubPaths_1.getRunnerHostAlias)(runner.id)} ${runner.hostKey}\n`).join('');
|
|
169
|
+
}
|
|
170
|
+
/** @description The lines of the managed `authorized_keys` block: every pairing code still open, then every paired runner. */
|
|
171
|
+
function renderManagedBlockLines(ctx, pending, runners, nowMs) {
|
|
172
|
+
const gatePath = (0, hubPaths_1.getHubFilePaths)(ctx.dir).gate;
|
|
173
|
+
const common = { gatePath, keysPath: ctx.authorizedKeysPath, dir: ctx.dir };
|
|
174
|
+
return [
|
|
175
|
+
...pending.filter((pairing) => pairing.expiresAtMs > nowMs).map((pairing) => (0, authorizedKeys_1.buildTempKeyLine)({ ...common, publicKey: pairing.publicKey, expiresAtMs: pairing.expiresAtMs, pairId: pairing.pairId })),
|
|
176
|
+
...runners.map((runner) => (0, authorizedKeys_1.buildRunnerKeyLine)({ ...common, publicKey: runner.publicKey, runnerId: runner.id })),
|
|
177
|
+
];
|
|
178
|
+
}
|
|
179
|
+
function readTextIfPresent(filePath) {
|
|
180
|
+
try {
|
|
181
|
+
return fs.readFileSync(filePath, 'utf8');
|
|
182
|
+
}
|
|
183
|
+
catch {
|
|
184
|
+
return null;
|
|
185
|
+
}
|
|
186
|
+
}
|
|
187
|
+
/**
|
|
188
|
+
* @description Bring the derived files in line with the two registry files: `known_hosts` and the `authorized_keys` block, each written
|
|
189
|
+
* only when it differs. The registry lock must be held. The block goes LAST, so a key is never allowed before the files its gate reads
|
|
190
|
+
* are in place. The registry files are authoritative and are written BEFORE this runs; a failure here is reported as
|
|
191
|
+
* {@link HubDerivedFilesError} and mends itself, because every locked operation ends with this same call.
|
|
192
|
+
*/
|
|
193
|
+
function syncDerivedHubFiles(ctx, pending, paired, nowMs) {
|
|
194
|
+
const knownHostsPath = (0, hubPaths_1.getHubFilePaths)(ctx.dir).knownHosts;
|
|
195
|
+
const knownHosts = renderKnownHosts(paired.runners);
|
|
196
|
+
try {
|
|
197
|
+
if (readTextIfPresent(knownHostsPath) !== knownHosts)
|
|
198
|
+
(0, configDirFile_1.writeTextFileAtomically)(knownHostsPath, knownHosts, knownHostsMode);
|
|
199
|
+
}
|
|
200
|
+
catch (error) {
|
|
201
|
+
throw new HubDerivedFilesError('known_hosts', (0, configDirFile_2.getCaughtErrnoCode)(error));
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
(0, authorizedKeys_1.writeManagedBlock)(ctx.authorizedKeysPath, renderManagedBlockLines(ctx, pending.pending, paired.runners, nowMs));
|
|
205
|
+
}
|
|
206
|
+
catch (error) {
|
|
207
|
+
throw new HubDerivedFilesError('authorized_keys', (0, configDirFile_2.getCaughtErrnoCode)(error));
|
|
208
|
+
}
|
|
209
|
+
}
|
|
210
|
+
//# sourceMappingURL=hubRegistry.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
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s: z.ZodNumber;
|
|
6
|
+
endedAtMs: z.ZodNullable<z.ZodNumber>;
|
|
7
|
+
}, z.core.$strict>;
|
|
8
|
+
/** @name LinkState @description `link/<id>.json`. */
|
|
9
|
+
export type LinkState = z.infer<typeof linkStateSchema>;
|
|
10
|
+
export interface RunnerLinkStatus {
|
|
11
|
+
isOnline: boolean;
|
|
12
|
+
/** When the link in force started (only while online). */
|
|
13
|
+
sinceMs: number | null;
|
|
14
|
+
/** The last time the hub knew the link alive; `null` if it never was. */
|
|
15
|
+
lastSeenMs: number | null;
|
|
16
|
+
}
|
|
17
|
+
export declare function readLinkState(dir: string, runnerId: string): LinkState | null;
|
|
18
|
+
export declare function writeLinkState(dir: string, runnerId: string, state: LinkState): void;
|
|
19
|
+
/** @description Does anything accept a connection on the unix socket `socketPath` right now? */
|
|
20
|
+
export declare function probeSocket(socketPath: string, timeoutMs?: number): Promise<boolean>;
|
|
21
|
+
export declare function getRunnerLinkStatus(dir: string, runnerId: string): Promise<RunnerLinkStatus>;
|
|
22
|
+
/** @description Is `pid` a charness gate serving runner `runnerId`? (A pid in an old json may belong to anything by now.) */
|
|
23
|
+
export declare function checkIsGateProcessOf(pid: number, runnerId: string): boolean;
|
|
24
|
+
/** @description Cut the link of a runner that was removed: no new connection reaches it, and its gate leaves. */
|
|
25
|
+
export declare function cutRunnerLink(dir: string, runnerId: string): void;
|
|
26
|
+
export {};
|
|
27
|
+
//# sourceMappingURL=linkControl.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkControl.d.ts","sourceRoot":"","sources":["../../src/runners/linkControl.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAcxB,QAAA,MAAM,eAAe;;;;;kBAMnB,CAAC;AAEH,qDAAqD;AACrD,MAAM,MAAM,SAAS,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,eAAe,CAAC,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,QAAQ,EAAE,OAAO,CAAC;IAClB,0DAA0D;IAC1D,OAAO,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB,yEAAyE;IACzE,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;CAC3B;AAED,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,CAO7E;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,SAAS,GAAG,IAAI,CAGpF;AAED,gGAAgG;AAChG,wBAAgB,WAAW,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,GAAE,MAAuB,GAAG,OAAO,CAAC,OAAO,CAAC,CAYpG;AAED,wBAAsB,mBAAmB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAQlG;AAED,6HAA6H;AAC7H,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,OAAO,CAG3E;AAED,iHAAiH;AACjH,wBAAgB,aAAa,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAcjE"}
|
|
@@ -0,0 +1,124 @@
|
|
|
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.readLinkState = readLinkState;
|
|
37
|
+
exports.writeLinkState = writeLinkState;
|
|
38
|
+
exports.probeSocket = probeSocket;
|
|
39
|
+
exports.getRunnerLinkStatus = getRunnerLinkStatus;
|
|
40
|
+
exports.checkIsGateProcessOf = checkIsGateProcessOf;
|
|
41
|
+
exports.cutRunnerLink = cutRunnerLink;
|
|
42
|
+
const child_process_1 = require("child_process");
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const net = __importStar(require("net"));
|
|
45
|
+
const zod_1 = require("zod");
|
|
46
|
+
const configDirFile_1 = require("../configDirFile");
|
|
47
|
+
const hubPaths_1 = require("./hubPaths");
|
|
48
|
+
/**
|
|
49
|
+
* @description The hub's view of a runner's link: the gate that holds it writes `link/<id>.json` (its pid, since when, a heartbeat) and
|
|
50
|
+
* listens on `link/<id>.sock`. A runner is ONLINE when its socket accepts a connection; the json only says who holds the socket and
|
|
51
|
+
* when it was last seen. A removed runner's link is cut by deleting the socket (the gate notices within one check interval and
|
|
52
|
+
* leaves) and, when the recorded pid still is that runner's gate, by stopping it at once.
|
|
53
|
+
*/
|
|
54
|
+
const stateFileMode = 0o600;
|
|
55
|
+
const probeTimeoutMs = 1000;
|
|
56
|
+
const linkStateSchema = zod_1.z.strictObject({
|
|
57
|
+
pid: zod_1.z.number().int().positive(),
|
|
58
|
+
sinceMs: zod_1.z.number().int().nonnegative(),
|
|
59
|
+
lastBeatMs: zod_1.z.number().int().nonnegative(),
|
|
60
|
+
/** Set by the gate when it leaves; `null` while it holds the link. */
|
|
61
|
+
endedAtMs: zod_1.z.number().int().nonnegative().nullable(),
|
|
62
|
+
});
|
|
63
|
+
function readLinkState(dir, runnerId) {
|
|
64
|
+
try {
|
|
65
|
+
const parsed = linkStateSchema.safeParse(JSON.parse(fs.readFileSync((0, hubPaths_1.getRunnerLinkPaths)(dir, runnerId).state, 'utf8')));
|
|
66
|
+
return parsed.success ? parsed.data : null;
|
|
67
|
+
}
|
|
68
|
+
catch {
|
|
69
|
+
return null;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
function writeLinkState(dir, runnerId, state) {
|
|
73
|
+
fs.mkdirSync((0, hubPaths_1.getHubFilePaths)(dir).linkDir, { recursive: true, mode: 0o700 });
|
|
74
|
+
(0, configDirFile_1.writeJsonFileAtomically)((0, hubPaths_1.getRunnerLinkPaths)(dir, runnerId).state, linkStateSchema.parse(state), stateFileMode);
|
|
75
|
+
}
|
|
76
|
+
/** @description Does anything accept a connection on the unix socket `socketPath` right now? */
|
|
77
|
+
function probeSocket(socketPath, timeoutMs = probeTimeoutMs) {
|
|
78
|
+
return new Promise((resolve) => {
|
|
79
|
+
const socket = net.connect(socketPath);
|
|
80
|
+
const settle = (isAccepted) => {
|
|
81
|
+
clearTimeout(timer);
|
|
82
|
+
socket.destroy();
|
|
83
|
+
resolve(isAccepted);
|
|
84
|
+
};
|
|
85
|
+
const timer = setTimeout(() => settle(false), timeoutMs);
|
|
86
|
+
socket.once('connect', () => settle(true));
|
|
87
|
+
socket.once('error', () => settle(false));
|
|
88
|
+
});
|
|
89
|
+
}
|
|
90
|
+
async function getRunnerLinkStatus(dir, runnerId) {
|
|
91
|
+
const state = readLinkState(dir, runnerId);
|
|
92
|
+
const isOnline = await probeSocket((0, hubPaths_1.getRunnerLinkPaths)(dir, runnerId).socket);
|
|
93
|
+
return {
|
|
94
|
+
isOnline,
|
|
95
|
+
sinceMs: isOnline ? (state?.sinceMs ?? null) : null,
|
|
96
|
+
lastSeenMs: state === null ? null : (state.endedAtMs ?? state.lastBeatMs),
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
/** @description Is `pid` a charness gate serving runner `runnerId`? (A pid in an old json may belong to anything by now.) */
|
|
100
|
+
function checkIsGateProcessOf(pid, runnerId) {
|
|
101
|
+
const listing = (0, child_process_1.spawnSync)('ps', ['-p', pid.toString(), '-o', 'command='], { encoding: 'utf8', timeout: probeTimeoutMs * 5 });
|
|
102
|
+
return listing.status === 0 && listing.stdout.includes('runner-gate') && listing.stdout.includes(` runner ${runnerId}`);
|
|
103
|
+
}
|
|
104
|
+
/** @description Cut the link of a runner that was removed: no new connection reaches it, and its gate leaves. */
|
|
105
|
+
function cutRunnerLink(dir, runnerId) {
|
|
106
|
+
const state = readLinkState(dir, runnerId);
|
|
107
|
+
try {
|
|
108
|
+
fs.rmSync((0, hubPaths_1.getRunnerLinkPaths)(dir, runnerId).socket, { force: true });
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if ((0, configDirFile_1.getCaughtErrnoCode)(error) !== 'ENOENT')
|
|
112
|
+
throw error;
|
|
113
|
+
}
|
|
114
|
+
if (state !== null && state.endedAtMs === null && checkIsGateProcessOf(state.pid, runnerId)) {
|
|
115
|
+
try {
|
|
116
|
+
process.kill(state.pid, 'SIGTERM');
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
if ((0, configDirFile_1.getCaughtErrnoCode)(error) !== 'ESRCH')
|
|
120
|
+
throw error;
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
//# sourceMappingURL=linkControl.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"linkControl.js","sourceRoot":"","sources":["../../src/runners/linkControl.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,sCAOC;AAED,wCAGC;AAGD,kCAYC;AAED,kDAQC;AAGD,oDAGC;AAGD,sCAcC;AAhGD,iDAA0C;AAC1C,uCAAyB;AACzB,yCAA2B;AAC3B,6BAAwB;AACxB,oDAA+E;AAC/E,yCAAiE;AAEjE;;;;;GAKG;AAEH,MAAM,aAAa,GAAG,KAAK,CAAC;AAC5B,MAAM,cAAc,GAAG,IAAI,CAAC;AAE5B,MAAM,eAAe,GAAG,OAAC,CAAC,YAAY,CAAC;IACrC,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,QAAQ,EAAE;IAChC,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IACvC,UAAU,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE;IAC1C,sEAAsE;IACtE,SAAS,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,EAAE,CAAC,WAAW,EAAE,CAAC,QAAQ,EAAE;CACrD,CAAC,CAAC;AAaH,SAAgB,aAAa,CAAC,GAAW,EAAE,QAAgB;IACzD,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,eAAe,CAAC,SAAS,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,YAAY,CAAC,IAAA,6BAAkB,EAAC,GAAG,EAAE,QAAQ,CAAC,CAAC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EAAE,QAAQ,CAAC,CAAC,MAAM,EAAE,EAAE,KAAK,EAAE,IAAI,EAAE,CAAC,CAAC;IACvE,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,IAAA,kCAAkB,EAAC,KAAK,CAAC,KAAK,QAAQ;YAAE,MAAM,KAAK,CAAC;IAC1D,CAAC;IACD,IAAI,KAAK,KAAK,IAAI,IAAI,KAAK,CAAC,SAAS,KAAK,IAAI,IAAI,oBAAoB,CAAC,KAAK,CAAC,GAAG,EAAE,QAAQ,CAAC,EAAE,CAAC;QAC5F,IAAI,CAAC;YACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACrC,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,IAAI,IAAA,kCAAkB,EAAC,KAAK,CAAC,KAAK,OAAO;gBAAE,MAAM,KAAK,CAAC;QACzD,CAAC;IACH,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
/**
|
|
3
|
+
* @description The pairing code: everything a runner needs to reach the hub ONCE — the address, the hub's ssh host key to pin, the
|
|
4
|
+
* account to log in as, a private key that is good for one `redeem` (and the package download), and the pairing's id. Text
|
|
5
|
+
* `cr1.<base64url of a JSON object>`; the `1` is the format version. It is a secret until it is used or has expired: it is never
|
|
6
|
+
* logged, and a decode error names a field, never a value.
|
|
7
|
+
*/
|
|
8
|
+
export declare const pairCodePrefix = "cr1.";
|
|
9
|
+
declare const pairCodePayloadSchema: z.ZodObject<{
|
|
10
|
+
host: z.ZodString;
|
|
11
|
+
port: z.ZodNumber;
|
|
12
|
+
user: z.ZodString;
|
|
13
|
+
hostKey: z.ZodString;
|
|
14
|
+
privateKey: z.ZodString;
|
|
15
|
+
pairId: z.ZodString;
|
|
16
|
+
}, z.core.$strict>;
|
|
17
|
+
/** @name PairCodePayload @description What a pairing code carries. */
|
|
18
|
+
export type PairCodePayload = z.infer<typeof pairCodePayloadSchema>;
|
|
19
|
+
export type PairCodeDecoding = {
|
|
20
|
+
ok: true;
|
|
21
|
+
payload: PairCodePayload;
|
|
22
|
+
} | {
|
|
23
|
+
ok: false;
|
|
24
|
+
error: string;
|
|
25
|
+
};
|
|
26
|
+
export declare function encodePairCode(payload: PairCodePayload): string;
|
|
27
|
+
/** @description The payload of `code`, or why it is not one (the reason never quotes the code). */
|
|
28
|
+
export declare function decodePairCode(code: string): PairCodeDecoding;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=pairCode.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pairCode.d.ts","sourceRoot":"","sources":["../../src/runners/pairCode.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB;;;;;GAKG;AAEH,eAAO,MAAM,cAAc,SAAS,CAAC;AAIrC,QAAA,MAAM,qBAAqB;;;;;;;kBAOzB,CAAC;AAEH,sEAAsE;AACtE,MAAM,MAAM,eAAe,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,qBAAqB,CAAC,CAAC;AAEpE,MAAM,MAAM,gBAAgB,GAAG;IAAE,EAAE,EAAE,IAAI,CAAC;IAAC,OAAO,EAAE,eAAe,CAAA;CAAE,GAAG;IAAE,EAAE,EAAE,KAAK,CAAC;IAAC,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC;AAErG,wBAAgB,cAAc,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAE/D;AAED,mGAAmG;AACnG,wBAAgB,cAAc,CAAC,IAAI,EAAE,MAAM,GAAG,gBAAgB,CAY7D"}
|