charness 3.9.0 → 3.10.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 +132 -0
- package/DEVELOPMENT.md +4 -1
- package/SETUP.md +6 -4
- package/agent-plugin/README.md +2 -2
- package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +1 -1
- package/agent-plugin/skills/charness-manager/SKILL.md +8 -4
- package/dist/bot.d.ts +27 -18
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +217 -99
- package/dist/bot.js.map +1 -1
- package/dist/connectors/jira/adf.d.ts.map +1 -1
- package/dist/connectors/jira/adf.js +2 -3
- package/dist/connectors/jira/adf.js.map +1 -1
- package/dist/connectors/jira/inbound.d.ts +25 -1
- package/dist/connectors/jira/inbound.d.ts.map +1 -1
- package/dist/connectors/jira/inbound.js +74 -2
- package/dist/connectors/jira/inbound.js.map +1 -1
- package/dist/connectors/jira/issueContext.d.ts +11 -2
- package/dist/connectors/jira/issueContext.d.ts.map +1 -1
- package/dist/connectors/jira/issueContext.js +22 -2
- package/dist/connectors/jira/issueContext.js.map +1 -1
- package/dist/connectors/jira/prompt.d.ts +12 -2
- package/dist/connectors/jira/prompt.d.ts.map +1 -1
- package/dist/connectors/jira/prompt.js +59 -5
- package/dist/connectors/jira/prompt.js.map +1 -1
- package/dist/connectors/telegram/commands/botCore.d.ts +16 -0
- package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.d.ts +10 -1
- package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.js +75 -13
- package/dist/connectors/telegram/commands/runners.js.map +1 -1
- package/dist/connectors/telegram/runnerLinkNotices.d.ts +24 -0
- package/dist/connectors/telegram/runnerLinkNotices.d.ts.map +1 -0
- package/dist/connectors/telegram/runnerLinkNotices.js +95 -0
- package/dist/connectors/telegram/runnerLinkNotices.js.map +1 -0
- package/dist/connectors/telegram/runnerPairingMessages.d.ts +9 -0
- package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -1
- package/dist/connectors/telegram/runnerPairingMessages.js +17 -1
- package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -1
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +19 -0
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +19 -0
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +19 -0
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +19 -0
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +19 -0
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +19 -0
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +19 -0
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +19 -0
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +19 -0
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +19 -0
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +19 -0
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +19 -0
- package/dist/i18n/zh.js.map +1 -1
- package/dist/outputTrace.d.ts.map +1 -1
- package/dist/outputTrace.js +2 -9
- package/dist/outputTrace.js.map +1 -1
- package/dist/rateLimiter.d.ts +3 -1
- package/dist/rateLimiter.d.ts.map +1 -1
- package/dist/rateLimiter.js +3 -1
- package/dist/rateLimiter.js.map +1 -1
- package/dist/remoteRun/cliArgs.d.ts +6 -1
- package/dist/remoteRun/cliArgs.d.ts.map +1 -1
- package/dist/remoteRun/cliArgs.js +39 -2
- package/dist/remoteRun/cliArgs.js.map +1 -1
- package/dist/remoteRun/exitCodes.d.ts +12 -2
- package/dist/remoteRun/exitCodes.d.ts.map +1 -1
- package/dist/remoteRun/exitCodes.js +3 -0
- package/dist/remoteRun/exitCodes.js.map +1 -1
- package/dist/remoteRun/foreground.d.ts +13 -0
- package/dist/remoteRun/foreground.d.ts.map +1 -1
- package/dist/remoteRun/foreground.js +15 -2
- package/dist/remoteRun/foreground.js.map +1 -1
- package/dist/remoteRun/heldBackNotice.d.ts +7 -0
- package/dist/remoteRun/heldBackNotice.d.ts.map +1 -0
- package/dist/remoteRun/heldBackNotice.js +92 -0
- package/dist/remoteRun/heldBackNotice.js.map +1 -0
- package/dist/remoteRun/interrupts.d.ts +6 -2
- package/dist/remoteRun/interrupts.d.ts.map +1 -1
- package/dist/remoteRun/interrupts.js +18 -3
- package/dist/remoteRun/interrupts.js.map +1 -1
- package/dist/remoteRun/leaseTiming.d.ts +1 -2
- package/dist/remoteRun/leaseTiming.d.ts.map +1 -1
- package/dist/remoteRun/leaseTiming.js +3 -17
- package/dist/remoteRun/leaseTiming.js.map +1 -1
- package/dist/remoteRun/output.d.ts +16 -1
- package/dist/remoteRun/output.d.ts.map +1 -1
- package/dist/remoteRun/output.js +28 -2
- package/dist/remoteRun/output.js.map +1 -1
- package/dist/remoteRun/probe.d.ts +40 -2
- package/dist/remoteRun/probe.d.ts.map +1 -1
- package/dist/remoteRun/probe.js +58 -2
- package/dist/remoteRun/probe.js.map +1 -1
- package/dist/remoteRun/project.d.ts +2 -2
- package/dist/remoteRun/project.d.ts.map +1 -1
- package/dist/remoteRun/project.js +5 -4
- package/dist/remoteRun/project.js.map +1 -1
- package/dist/remoteRun/remoteRunCli.d.ts +1 -1
- package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
- package/dist/remoteRun/remoteRunCli.js +6 -3
- package/dist/remoteRun/remoteRunCli.js.map +1 -1
- package/dist/remoteRun/runnerWait.d.ts +3 -3
- package/dist/remoteRun/runnerWait.d.ts.map +1 -1
- package/dist/remoteRun/runnerWait.js +12 -6
- package/dist/remoteRun/runnerWait.js.map +1 -1
- package/dist/remoteRun/runnerWaitTiming.d.ts +1 -1
- package/dist/remoteRun/runnerWaitTiming.d.ts.map +1 -1
- package/dist/remoteRun/runnerWaitTiming.js +3 -16
- package/dist/remoteRun/runnerWaitTiming.js.map +1 -1
- package/dist/remoteRun/runners.d.ts +16 -3
- package/dist/remoteRun/runners.d.ts.map +1 -1
- package/dist/remoteRun/runners.js +42 -4
- package/dist/remoteRun/runners.js.map +1 -1
- package/dist/remoteRun/sendPlan.d.ts +11 -1
- package/dist/remoteRun/sendPlan.d.ts.map +1 -1
- package/dist/remoteRun/sendPlan.js +29 -5
- package/dist/remoteRun/sendPlan.js.map +1 -1
- package/dist/remoteRun/submit.d.ts.map +1 -1
- package/dist/remoteRun/submit.js +13 -3
- package/dist/remoteRun/submit.js.map +1 -1
- package/dist/requests/requestHeader.d.ts +2 -1
- package/dist/requests/requestHeader.d.ts.map +1 -1
- package/dist/requests/requestHeader.js +6 -2
- package/dist/requests/requestHeader.js.map +1 -1
- package/dist/requests/storedPromptRefresh.d.ts +16 -0
- package/dist/requests/storedPromptRefresh.d.ts.map +1 -0
- package/dist/requests/storedPromptRefresh.js +36 -0
- package/dist/requests/storedPromptRefresh.js.map +1 -0
- package/dist/runnerUtility/adminService.d.ts +30 -2
- package/dist/runnerUtility/adminService.d.ts.map +1 -1
- package/dist/runnerUtility/adminService.js +104 -6
- package/dist/runnerUtility/adminService.js.map +1 -1
- package/dist/runnerUtility/appInstall.d.ts +13 -4
- package/dist/runnerUtility/appInstall.d.ts.map +1 -1
- package/dist/runnerUtility/appInstall.js +46 -19
- package/dist/runnerUtility/appInstall.js.map +1 -1
- package/dist/runnerUtility/appUpdate.js +1 -1
- package/dist/runnerUtility/appUpdate.js.map +1 -1
- package/dist/runnerUtility/execEnv.d.ts +2 -0
- package/dist/runnerUtility/execEnv.d.ts.map +1 -1
- package/dist/runnerUtility/execEnv.js +6 -2
- package/dist/runnerUtility/execEnv.js.map +1 -1
- package/dist/runnerUtility/guiAgent.d.ts +126 -0
- package/dist/runnerUtility/guiAgent.d.ts.map +1 -0
- package/dist/runnerUtility/guiAgent.js +591 -0
- package/dist/runnerUtility/guiAgent.js.map +1 -0
- package/dist/runnerUtility/guiAgentHeal.d.ts +128 -0
- package/dist/runnerUtility/guiAgentHeal.d.ts.map +1 -0
- package/dist/runnerUtility/guiAgentHeal.js +284 -0
- package/dist/runnerUtility/guiAgentHeal.js.map +1 -0
- package/dist/runnerUtility/homeFolders.d.ts +33 -0
- package/dist/runnerUtility/homeFolders.d.ts.map +1 -0
- package/dist/runnerUtility/homeFolders.js +158 -0
- package/dist/runnerUtility/homeFolders.js.map +1 -0
- package/dist/runnerUtility/hubClient.d.ts +12 -2
- package/dist/runnerUtility/hubClient.d.ts.map +1 -1
- package/dist/runnerUtility/hubClient.js +24 -3
- package/dist/runnerUtility/hubClient.js.map +1 -1
- package/dist/runnerUtility/iosCheck.d.ts +7 -1
- package/dist/runnerUtility/iosCheck.d.ts.map +1 -1
- package/dist/runnerUtility/iosCheck.js +14 -5
- package/dist/runnerUtility/iosCheck.js.map +1 -1
- package/dist/runnerUtility/isolatedCommand.d.ts +33 -0
- package/dist/runnerUtility/isolatedCommand.d.ts.map +1 -0
- package/dist/runnerUtility/isolatedCommand.js +139 -0
- package/dist/runnerUtility/isolatedCommand.js.map +1 -0
- package/dist/runnerUtility/keepAwake.d.ts +67 -0
- package/dist/runnerUtility/keepAwake.d.ts.map +1 -0
- package/dist/runnerUtility/keepAwake.js +211 -0
- package/dist/runnerUtility/keepAwake.js.map +1 -0
- package/dist/runnerUtility/lidPollTiming.d.ts +11 -0
- package/dist/runnerUtility/lidPollTiming.d.ts.map +1 -0
- package/dist/runnerUtility/lidPollTiming.js +18 -0
- package/dist/runnerUtility/lidPollTiming.js.map +1 -0
- package/dist/runnerUtility/lidState.d.ts +57 -0
- package/dist/runnerUtility/lidState.d.ts.map +1 -0
- package/dist/runnerUtility/lidState.js +195 -0
- package/dist/runnerUtility/lidState.js.map +1 -0
- package/dist/runnerUtility/linkLoop.d.ts +5 -0
- package/dist/runnerUtility/linkLoop.d.ts.map +1 -1
- package/dist/runnerUtility/linkLoop.js +37 -1
- package/dist/runnerUtility/linkLoop.js.map +1 -1
- package/dist/runnerUtility/packageManagerShims.d.ts +44 -0
- package/dist/runnerUtility/packageManagerShims.d.ts.map +1 -0
- package/dist/runnerUtility/packageManagerShims.js +130 -0
- package/dist/runnerUtility/packageManagerShims.js.map +1 -0
- package/dist/runnerUtility/progress.d.ts +43 -0
- package/dist/runnerUtility/progress.d.ts.map +1 -0
- package/dist/runnerUtility/progress.js +78 -0
- package/dist/runnerUtility/progress.js.map +1 -0
- package/dist/runnerUtility/pueueDaemon.d.ts +8 -4
- package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
- package/dist/runnerUtility/pueueDaemon.js +12 -7
- package/dist/runnerUtility/pueueDaemon.js.map +1 -1
- package/dist/runnerUtility/rootServiceCli.d.ts +23 -3
- package/dist/runnerUtility/rootServiceCli.d.ts.map +1 -1
- package/dist/runnerUtility/rootServiceCli.js +56 -10
- package/dist/runnerUtility/rootServiceCli.js.map +1 -1
- package/dist/runnerUtility/runnerCli.d.ts +1 -0
- package/dist/runnerUtility/runnerCli.d.ts.map +1 -1
- package/dist/runnerUtility/runnerCli.js +14 -7
- package/dist/runnerUtility/runnerCli.js.map +1 -1
- package/dist/runnerUtility/runnerCommands.d.ts +45 -0
- package/dist/runnerUtility/runnerCommands.d.ts.map +1 -1
- package/dist/runnerUtility/runnerCommands.js +188 -21
- package/dist/runnerUtility/runnerCommands.js.map +1 -1
- package/dist/runnerUtility/runnerHome.d.ts +8 -0
- package/dist/runnerUtility/runnerHome.d.ts.map +1 -1
- package/dist/runnerUtility/runnerHome.js +7 -0
- package/dist/runnerUtility/runnerHome.js.map +1 -1
- package/dist/runnerUtility/serviceCommon.d.ts +4 -0
- package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
- package/dist/runnerUtility/serviceCommon.js +8 -1
- package/dist/runnerUtility/serviceCommon.js.map +1 -1
- package/dist/runnerUtility/serviceManager.d.ts +5 -2
- package/dist/runnerUtility/serviceManager.d.ts.map +1 -1
- package/dist/runnerUtility/serviceManager.js +40 -17
- package/dist/runnerUtility/serviceManager.js.map +1 -1
- package/dist/runnerUtility/serviceUnits.d.ts +11 -0
- package/dist/runnerUtility/serviceUnits.d.ts.map +1 -1
- package/dist/runnerUtility/serviceUnits.js +8 -2
- package/dist/runnerUtility/serviceUnits.js.map +1 -1
- package/dist/runnerUtility/simulatorSilencer.d.ts +55 -0
- package/dist/runnerUtility/simulatorSilencer.d.ts.map +1 -0
- package/dist/runnerUtility/simulatorSilencer.js +203 -0
- package/dist/runnerUtility/simulatorSilencer.js.map +1 -0
- package/dist/runnerUtility/stopSignals.d.ts +10 -0
- package/dist/runnerUtility/stopSignals.d.ts.map +1 -0
- package/dist/runnerUtility/stopSignals.js +27 -0
- package/dist/runnerUtility/stopSignals.js.map +1 -0
- package/dist/runnerUtility/versionPollTiming.d.ts +2 -3
- package/dist/runnerUtility/versionPollTiming.d.ts.map +1 -1
- package/dist/runnerUtility/versionPollTiming.js +4 -18
- package/dist/runnerUtility/versionPollTiming.js.map +1 -1
- package/dist/runners/bootstrapLine.d.ts.map +1 -1
- package/dist/runners/bootstrapLine.js +35 -19
- package/dist/runners/bootstrapLine.js.map +1 -1
- package/dist/runners/gate.d.ts.map +1 -1
- package/dist/runners/gate.js +28 -1
- package/dist/runners/gate.js.map +1 -1
- package/dist/runners/gateLink.d.ts +7 -0
- package/dist/runners/gateLink.d.ts.map +1 -1
- package/dist/runners/gateLink.js +36 -3
- package/dist/runners/gateLink.js.map +1 -1
- package/dist/runners/gateProtocol.d.ts +37 -2
- package/dist/runners/gateProtocol.d.ts.map +1 -1
- package/dist/runners/gateProtocol.js +45 -4
- package/dist/runners/gateProtocol.js.map +1 -1
- package/dist/runners/hubPackage.d.ts +2 -1
- package/dist/runners/hubPackage.d.ts.map +1 -1
- package/dist/runners/hubPackage.js +32 -11
- package/dist/runners/hubPackage.js.map +1 -1
- package/dist/runners/hubPairing.d.ts +1 -1
- package/dist/runners/hubPairing.d.ts.map +1 -1
- package/dist/runners/hubPairing.js +8 -1
- package/dist/runners/hubPairing.js.map +1 -1
- package/dist/runners/hubPaths.d.ts +2 -0
- package/dist/runners/hubPaths.d.ts.map +1 -1
- package/dist/runners/hubPaths.js +1 -1
- package/dist/runners/hubPaths.js.map +1 -1
- package/dist/runners/linkConcern.d.ts +75 -0
- package/dist/runners/linkConcern.d.ts.map +1 -0
- package/dist/runners/linkConcern.js +85 -0
- package/dist/runners/linkConcern.js.map +1 -0
- package/dist/runners/linkControl.d.ts +25 -1
- package/dist/runners/linkControl.d.ts.map +1 -1
- package/dist/runners/linkControl.js +46 -4
- package/dist/runners/linkControl.js.map +1 -1
- package/dist/runners/pairingTiming.d.ts +2 -3
- package/dist/runners/pairingTiming.d.ts.map +1 -1
- package/dist/runners/pairingTiming.js +4 -18
- package/dist/runners/pairingTiming.js.map +1 -1
- package/dist/runners/runnerLock.d.ts +112 -0
- package/dist/runners/runnerLock.d.ts.map +1 -0
- package/dist/runners/runnerLock.js +292 -0
- package/dist/runners/runnerLock.js.map +1 -0
- package/dist/runners/runnersCli.d.ts +6 -3
- package/dist/runners/runnersCli.d.ts.map +1 -1
- package/dist/runners/runnersCli.js +33 -6
- package/dist/runners/runnersCli.js.map +1 -1
- package/dist/runners/runnersList.d.ts +3 -3
- package/dist/runners/runnersList.d.ts.map +1 -1
- package/dist/runners/runnersList.js +9 -2
- package/dist/runners/runnersList.js.map +1 -1
- package/dist/runners/runnersOverview.d.ts +29 -3
- package/dist/runners/runnersOverview.d.ts.map +1 -1
- package/dist/runners/runnersOverview.js +71 -6
- package/dist/runners/runnersOverview.js.map +1 -1
- package/dist/runners/serviceRemoval.d.ts +43 -0
- package/dist/runners/serviceRemoval.d.ts.map +1 -0
- package/dist/runners/serviceRemoval.js +114 -0
- package/dist/runners/serviceRemoval.js.map +1 -0
- package/dist/scheduler/checkStatus.d.ts +78 -0
- package/dist/scheduler/checkStatus.d.ts.map +1 -0
- package/dist/scheduler/checkStatus.js +122 -0
- package/dist/scheduler/checkStatus.js.map +1 -0
- package/dist/scheduler/delivery.d.ts +27 -1
- package/dist/scheduler/delivery.d.ts.map +1 -1
- package/dist/scheduler/delivery.js +83 -6
- package/dist/scheduler/delivery.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +2 -0
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +62 -10
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/scheduler/store.d.ts +16 -1
- package/dist/scheduler/store.d.ts.map +1 -1
- package/dist/scheduler/store.js +33 -0
- package/dist/scheduler/store.js.map +1 -1
- package/dist/scheduler/types.d.ts +22 -0
- package/dist/scheduler/types.d.ts.map +1 -1
- package/dist/scheduler/unbindPause.d.ts +27 -0
- package/dist/scheduler/unbindPause.d.ts.map +1 -0
- package/dist/scheduler/unbindPause.js +21 -0
- package/dist/scheduler/unbindPause.js.map +1 -0
- package/dist/scheduler/workerActivity.d.ts +25 -0
- package/dist/scheduler/workerActivity.d.ts.map +1 -0
- package/dist/scheduler/workerActivity.js +195 -0
- package/dist/scheduler/workerActivity.js.map +1 -0
- package/dist/scheduler/workerWatch.d.ts +14 -2
- package/dist/scheduler/workerWatch.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.js +15 -3
- package/dist/scheduler/workerWatch.js.map +1 -1
- package/dist/state.d.ts +8 -0
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +30 -0
- package/dist/state.js.map +1 -1
- package/dist/stt/sttRuntime.d.ts.map +1 -1
- package/dist/stt/sttRuntime.js +8 -1
- package/dist/stt/sttRuntime.js.map +1 -1
- package/dist/stt/sttSettings.d.ts +56 -6
- package/dist/stt/sttSettings.d.ts.map +1 -1
- package/dist/stt/sttSettings.js +128 -7
- package/dist/stt/sttSettings.js.map +1 -1
- package/dist/stt/sttSidecarOwner.d.ts +13 -5
- package/dist/stt/sttSidecarOwner.d.ts.map +1 -1
- package/dist/stt/sttSidecarOwner.js +72 -31
- package/dist/stt/sttSidecarOwner.js.map +1 -1
- package/dist/stt/transcribeChain.d.ts +23 -1
- package/dist/stt/transcribeChain.d.ts.map +1 -1
- package/dist/stt/transcribeChain.js +59 -4
- package/dist/stt/transcribeChain.js.map +1 -1
- package/dist/testTimings.d.ts +4 -2
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +7 -1
- package/dist/testTimings.js.map +1 -1
- package/dist/testTimingsSeam.d.ts +10 -0
- package/dist/testTimingsSeam.d.ts.map +1 -0
- package/dist/testTimingsSeam.js +29 -0
- package/dist/testTimingsSeam.js.map +1 -0
- package/dist/utils/runnersScreenPlan.d.ts +14 -0
- package/dist/utils/runnersScreenPlan.d.ts.map +1 -1
- package/dist/utils/runnersScreenPlan.js +49 -5
- package/dist/utils/runnersScreenPlan.js.map +1 -1
- package/dist/utils/surrogateSafeCut.d.ts +14 -0
- package/dist/utils/surrogateSafeCut.d.ts.map +1 -0
- package/dist/utils/surrogateSafeCut.js +30 -0
- package/dist/utils/surrogateSafeCut.js.map +1 -0
- package/dist/utils/telegramError.d.ts +7 -0
- package/dist/utils/telegramError.d.ts.map +1 -1
- package/dist/utils/telegramError.js +15 -0
- package/dist/utils/telegramError.js.map +1 -1
- package/dist/utils/transientFrames.d.ts +51 -6
- package/dist/utils/transientFrames.d.ts.map +1 -1
- package/dist/utils/transientFrames.js +52 -2
- package/dist/utils/transientFrames.js.map +1 -1
- package/dist/voiceProgressNote.d.ts +73 -0
- package/dist/voiceProgressNote.d.ts.map +1 -0
- package/dist/voiceProgressNote.js +142 -0
- package/dist/voiceProgressNote.js.map +1 -0
- package/package.json +4 -1
- package/remoteRun/pickNode.sh +65 -0
- package/remoteRun/runner-package-lock.json +59 -0
- package/remoteRun/runner.sh +304 -6
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description Stop on SIGINT / SIGTERM — gracefully, ONCE, and without a second signal ever finding the default action waiting. A runner is stopped by more than
|
|
4
|
+
* one signal: the launcher passes the TERM it got on to the app while a terminal's Ctrl-C or a group kill hands the app its own, a few milliseconds apart. A handler
|
|
5
|
+
* that is `once` is gone after the first: the second signal then takes the default action and kills the process under its own clean-up (no `finally`, no `exit`
|
|
6
|
+
* handlers) — the sleep assertion's state file stayed behind, a login-session agent's heartbeat with it. So the handlers stay, the first signal calls `stop`, and the
|
|
7
|
+
* later ones are ignored (`stop` has its own forced exit for a clean-up that hangs).
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.onStopSignals = onStopSignals;
|
|
11
|
+
/** @description Call `stop` at the first SIGINT or SIGTERM; returns the function that takes the handlers off again. */
|
|
12
|
+
function onStopSignals(stop) {
|
|
13
|
+
let isStopping = false;
|
|
14
|
+
const handler = () => {
|
|
15
|
+
if (isStopping)
|
|
16
|
+
return;
|
|
17
|
+
isStopping = true;
|
|
18
|
+
stop();
|
|
19
|
+
};
|
|
20
|
+
process.on('SIGINT', handler);
|
|
21
|
+
process.on('SIGTERM', handler);
|
|
22
|
+
return () => {
|
|
23
|
+
process.off('SIGINT', handler);
|
|
24
|
+
process.off('SIGTERM', handler);
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=stopSignals.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"stopSignals.js","sourceRoot":"","sources":["../../src/runnerUtility/stopSignals.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAGH,sCAaC;AAdD,uHAAuH;AACvH,SAAgB,aAAa,CAAC,IAAgB;IAC5C,IAAI,UAAU,GAAG,KAAK,CAAC;IACvB,MAAM,OAAO,GAAG,GAAS,EAAE;QACzB,IAAI,UAAU;YAAE,OAAO;QACvB,UAAU,GAAG,IAAI,CAAC;QAClB,IAAI,EAAE,CAAC;IACT,CAAC,CAAC;IACF,OAAO,CAAC,EAAE,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;IAC9B,OAAO,CAAC,EAAE,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAC/B,OAAO,GAAG,EAAE;QACV,OAAO,CAAC,GAAG,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAC/B,OAAO,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;IAClC,CAAC,CAAC;AACJ,CAAC"}
|
|
@@ -3,9 +3,8 @@
|
|
|
3
3
|
* holds). A link that stays healthy for days would otherwise never learn of a hub update: the `link` answer names the package once, when
|
|
4
4
|
* the link starts. In a module of its own so the runner utility reads it without loading the bot.
|
|
5
5
|
*
|
|
6
|
-
* The test seam `CHARNESS_TEST_TIMINGS` (`testTimings.ts`) may only SHORTEN it (key `runnerVersionPollMs`);
|
|
7
|
-
*
|
|
8
|
-
* carries a bad value is what refuses it by name.
|
|
6
|
+
* The test seam `CHARNESS_TEST_TIMINGS` (`testTimings.ts`) may only SHORTEN it (key `runnerVersionPollMs`); it is read through `testTimingsSeam.ts`, because this module
|
|
7
|
+
* cannot import `testTimings.ts` (its graph reaches the bot).
|
|
9
8
|
*/
|
|
10
9
|
/** Production: ask every five minutes. */
|
|
11
10
|
export declare const runnerVersionPollMs: number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versionPollTiming.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/versionPollTiming.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"versionPollTiming.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/versionPollTiming.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAIH,0CAA0C;AAC1C,eAAO,MAAM,mBAAmB,QAAgB,CAAC;AACjD,+DAA+D;AAC/D,eAAO,MAAM,sBAAsB,OAAO,CAAC;AAE3C,yKAAyK;AACzK,wBAAgB,uBAAuB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAEtE"}
|
|
@@ -4,33 +4,19 @@
|
|
|
4
4
|
* holds). A link that stays healthy for days would otherwise never learn of a hub update: the `link` answer names the package once, when
|
|
5
5
|
* the link starts. In a module of its own so the runner utility reads it without loading the bot.
|
|
6
6
|
*
|
|
7
|
-
* The test seam `CHARNESS_TEST_TIMINGS` (`testTimings.ts`) may only SHORTEN it (key `runnerVersionPollMs`);
|
|
8
|
-
*
|
|
9
|
-
* carries a bad value is what refuses it by name.
|
|
7
|
+
* The test seam `CHARNESS_TEST_TIMINGS` (`testTimings.ts`) may only SHORTEN it (key `runnerVersionPollMs`); it is read through `testTimingsSeam.ts`, because this module
|
|
8
|
+
* cannot import `testTimings.ts` (its graph reaches the bot).
|
|
10
9
|
*/
|
|
11
10
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
12
11
|
exports.runnerVersionPollMinMs = exports.runnerVersionPollMs = void 0;
|
|
13
12
|
exports.readRunnerVersionPollMs = readRunnerVersionPollMs;
|
|
13
|
+
const testTimingsSeam_1 = require("../testTimingsSeam");
|
|
14
14
|
/** Production: ask every five minutes. */
|
|
15
15
|
exports.runnerVersionPollMs = 5 * 60 * 1000;
|
|
16
16
|
/** A shorter poll than this is a request loop, not a check. */
|
|
17
17
|
exports.runnerVersionPollMinMs = 1000;
|
|
18
|
-
const testTimingsVariableName = 'CHARNESS_TEST_TIMINGS';
|
|
19
18
|
/** @description The poll interval in force: the production one, or the seam's shorter `runnerVersionPollMs` when it is a whole number of ms within [min, production]. */
|
|
20
19
|
function readRunnerVersionPollMs(env) {
|
|
21
|
-
|
|
22
|
-
if (rawTestTimings === undefined || rawTestTimings.trim() === '')
|
|
23
|
-
return exports.runnerVersionPollMs;
|
|
24
|
-
let overrides;
|
|
25
|
-
try {
|
|
26
|
-
overrides = JSON.parse(rawTestTimings);
|
|
27
|
-
}
|
|
28
|
-
catch {
|
|
29
|
-
return exports.runnerVersionPollMs;
|
|
30
|
-
}
|
|
31
|
-
const overrideMs = overrides?.runnerVersionPollMs;
|
|
32
|
-
if (overrideMs === undefined || !Number.isInteger(overrideMs))
|
|
33
|
-
return exports.runnerVersionPollMs;
|
|
34
|
-
return overrideMs >= exports.runnerVersionPollMinMs && overrideMs <= exports.runnerVersionPollMs ? overrideMs : exports.runnerVersionPollMs;
|
|
20
|
+
return (0, testTimingsSeam_1.readShorterTestWindowMs)(env, 'runnerVersionPollMs', exports.runnerVersionPollMs, exports.runnerVersionPollMinMs);
|
|
35
21
|
}
|
|
36
22
|
//# sourceMappingURL=versionPollTiming.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"versionPollTiming.js","sourceRoot":"","sources":["../../src/runnerUtility/versionPollTiming.ts"],"names":[],"mappings":";AAAA
|
|
1
|
+
{"version":3,"file":"versionPollTiming.js","sourceRoot":"","sources":["../../src/runnerUtility/versionPollTiming.ts"],"names":[],"mappings":";AAAA;;;;;;;GAOG;;;AAUH,0DAEC;AAVD,wDAA6D;AAE7D,0CAA0C;AAC7B,QAAA,mBAAmB,GAAG,CAAC,GAAG,EAAE,GAAG,IAAI,CAAC;AACjD,+DAA+D;AAClD,QAAA,sBAAsB,GAAG,IAAI,CAAC;AAE3C,yKAAyK;AACzK,SAAgB,uBAAuB,CAAC,GAAsB;IAC5D,OAAO,IAAA,yCAAuB,EAAC,GAAG,EAAE,qBAAqB,EAAE,2BAAmB,EAAE,8BAAsB,CAAC,CAAC;AAC1G,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrapLine.d.ts","sourceRoot":"","sources":["../../src/runners/bootstrapLine.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"bootstrapLine.d.ts","sourceRoot":"","sources":["../../src/runners/bootstrapLine.ts"],"names":[],"mappings":"AAEA,OAAO,EAAkB,KAAK,eAAe,EAAE,MAAM,YAAY,CAAC;AAwElE,+FAA+F;AAC/F,eAAO,MAAM,oBAAoB,WAAW,CAAC;AAK7C,0IAA0I;AAC1I,wBAAgB,kBAAkB,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAExD;AAmDD,6HAA6H;AAC7H,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,eAAe,GAAG,MAAM,CAGnE;AA4BD;;;GAGG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,eAAe,EAAE,OAAO,GAAE,MAA6B,GAAG,MAAM,CAGhH"}
|
|
@@ -5,7 +5,6 @@ exports.checkIsAccountName = checkIsAccountName;
|
|
|
5
5
|
exports.buildBootstrapLine = buildBootstrapLine;
|
|
6
6
|
exports.buildAdminBootstrapLine = buildAdminBootstrapLine;
|
|
7
7
|
const adminCheck_1 = require("../runnerUtility/adminCheck");
|
|
8
|
-
const pairArgs_1 = require("../runnerUtility/pairArgs");
|
|
9
8
|
const gateProtocol_1 = require("./gateProtocol");
|
|
10
9
|
const pairCode_1 = require("./pairCode");
|
|
11
10
|
/**
|
|
@@ -16,7 +15,7 @@ const pairCode_1 = require("./pairCode");
|
|
|
16
15
|
* which `grep -b` finds among the first {@link maxGateNoiseBytes} bytes, and the archive is cut out from the byte after it.
|
|
17
16
|
*
|
|
18
17
|
* Contract with the runner utility: `runnerCli.js pair --bootstrap <unpacked folder> --archive <file> --package-id <id> <code>` is started with a package that has NO
|
|
19
|
-
* `node_modules` yet, so it reaches its install step (`npm
|
|
18
|
+
* `node_modules` yet, so it reaches its install step (`npm ci --omit=dev --ignore-scripts` into its own app folder, against the lock the package carries) using
|
|
20
19
|
* Node's built-ins only.
|
|
21
20
|
*
|
|
22
21
|
* Every value in the line passed a strict pattern (`pairCode.ts`) that has no quote, space, `$`, backtick or backslash; the line
|
|
@@ -28,10 +27,12 @@ const pairCode_1 = require("./pairCode");
|
|
|
28
27
|
* for the account named by its last word. The runner account runs the agents' code, so ROOT never executes, reads through or writes into
|
|
29
28
|
* anything that account can change. As root the script (1) checks the account (it exists; not root; not an admin; the OS is known),
|
|
30
29
|
* (2) downloads the package into a folder of ITS OWN in `/tmp` — root-owned, readable by the account, extracted with `--no-same-owner`
|
|
31
|
-
* — (3)
|
|
32
|
-
*
|
|
33
|
-
* the
|
|
34
|
-
*
|
|
30
|
+
* — and (3) runs the root step from the same root-owned copy (`rootServiceCli.js install <account> --bootstrap …`: Node built-ins only,
|
|
31
|
+
* because the copy has no dependencies). The root step has the account pair itself from that copy (`sudo -u <account> -H node
|
|
32
|
+
* …/runnerCli.js pair`: its files are the account's, never root's) and then installs the always-on service. EVERY step that runs as the
|
|
33
|
+
* account goes through one runner with no terminal attached (a session of its own, no standard input, its output piped through the root
|
|
34
|
+
* step with the control characters stripped), see `runnerUtility/adminService.ts` and `isolatedCommand.ts`: the account runs the agents'
|
|
35
|
+
* code, and code it can change must not get the admin's terminal. The pairing code stays single use, 10 minutes, a secret; sudo logs the command line, so a code that
|
|
35
36
|
* is neither used nor closed stays live in that log until it runs out: a refused line (no such account, an admin account) leaves it open ON
|
|
36
37
|
* PURPOSE — the operator fixes the last word and pastes the same line again — and an already-paired account's line closes its own code (the
|
|
37
38
|
* gate's `cancel`). Nothing creates an account. Run again for an account that is already paired, the line pairs nothing twice and installs
|
|
@@ -44,13 +45,26 @@ const pairCode_1 = require("./pairCode");
|
|
|
44
45
|
*/
|
|
45
46
|
const minNodeMajor = 22;
|
|
46
47
|
const minNodeMinor = 12;
|
|
47
|
-
const hubHostAlias = '
|
|
48
|
+
const hubHostAlias = 'hub';
|
|
48
49
|
const privateKeyFoldWidth = 70;
|
|
49
50
|
const privateKeyHeader = '-----BEGIN OPENSSH PRIVATE KEY-----';
|
|
50
51
|
const privateKeyFooter = '-----END OPENSSH PRIVATE KEY-----';
|
|
51
52
|
const connectTimeoutSeconds = 20;
|
|
52
53
|
/** The marker line of a `bootstrap` answer as an extended regular expression: the marker, the request, optional `key=value` fields. */
|
|
53
54
|
const bootstrapMarkerPattern = `^${gateProtocol_1.gateMarker} bootstrap( [a-z]+=[A-Za-z0-9._:@/-]*)*$`;
|
|
55
|
+
/**
|
|
56
|
+
* The step line of the shell part, before Node starts (the runner utility's own steps are `runnerUtility/progress.ts`): `s checking the account` prints
|
|
57
|
+
* `charness-runner: checking the account`. A function in the script, defined once, so each step costs a few characters of the Telegram message.
|
|
58
|
+
*/
|
|
59
|
+
const sayFunction = 's() { echo "charness-runner: $*"; }';
|
|
60
|
+
/** The same for a refusal: the line on stderr, then out. A function, defined once — three refusals of the fetch steps and the admin checks share it. */
|
|
61
|
+
const failFunction = 'f() { echo "charness-runner: $*" >&2; exit 1; }';
|
|
62
|
+
/** The test of a `node` program (`$1` is the program): exit status 0 when it is `minNodeMajor.minNodeMinor` or newer. */
|
|
63
|
+
function nodeVersionCheck(program) {
|
|
64
|
+
return `${program} -e "var v=process.versions.node.split(/[.]/);process.exit(v[0]>${minNodeMajor}||v[0]==${minNodeMajor}&&v[1]>=${minNodeMinor}?0:1)"`;
|
|
65
|
+
}
|
|
66
|
+
/** The Node pick the admin line runs as root from its copy of the package (see the script's own head): prints the real path of the Node root and the service run under. */
|
|
67
|
+
const pickNodeInPackage = 'remoteRun/pickNode.sh';
|
|
54
68
|
const runnerCliInPackage = 'dist/runnerUtility/runnerCli.js';
|
|
55
69
|
const rootServiceCliInPackage = 'dist/runnerUtility/rootServiceCli.js';
|
|
56
70
|
/** Where the admin line's root-owned copy is made: a folder the account can read, which `$TMPDIR` (the admin's own, private) is not. */
|
|
@@ -91,12 +105,13 @@ function renderFetchSteps(payload, isForAccount) {
|
|
|
91
105
|
`p="${payload.port}"`,
|
|
92
106
|
`k="${payload.hostKey}"`,
|
|
93
107
|
`b="${getPrivateKeyBody(payload.privateKey)}"`,
|
|
94
|
-
`command -v node >/dev/null 2>&1 && node
|
|
108
|
+
...(isForAccount ? [] : [`command -v node >/dev/null 2>&1 && ${nodeVersionCheck('node')} || f "Node.js ${minNodeMajor}.${minNodeMinor} or newer is needed on this machine (https://nodejs.org)"`]),
|
|
95
109
|
`{ printf "%s\\n" "${privateKeyHeader}"; printf "%s" "$b" | fold -w ${privateKeyFoldWidth}; printf "\\n%s\\n" "${privateKeyFooter}"; } > "$d/key"`,
|
|
96
110
|
`printf "%s %s\\n" ${hubHostAlias} "$k" > "$d/kh"`,
|
|
97
|
-
|
|
111
|
+
's "downloading the package from the hub"',
|
|
112
|
+
`ssh ${sshOptions} "$u@$h" bootstrap > "$d/answer" || f "the hub refused or did not answer: expired or used line? see the ssh message above"`,
|
|
98
113
|
`hit=$(head -c ${gateProtocol_1.maxGateNoiseBytes} "$d/answer" | LC_ALL=C grep -a -b -o -E -e "${bootstrapMarkerPattern}" | head -n 1)`,
|
|
99
|
-
'[ -n "$hit" ] ||
|
|
114
|
+
'[ -n "$hit" ] || f "no package from the hub: expired or used line?"',
|
|
100
115
|
'o=${hit%%:*}; t=${hit#*:}',
|
|
101
116
|
...(isForAccount ? ['umask 022'] : []),
|
|
102
117
|
'tail -c +$((o + ${#t} + 2)) "$d/answer" > "$d/package.tgz"',
|
|
@@ -104,9 +119,9 @@ function renderFetchSteps(payload, isForAccount) {
|
|
|
104
119
|
`tar ${isForAccount ? '--no-same-owner ' : ''}-xzf "$d/package.tgz" -C "$d/pkg"`,
|
|
105
120
|
];
|
|
106
121
|
}
|
|
107
|
-
/** The
|
|
108
|
-
function
|
|
109
|
-
return
|
|
122
|
+
/** The arguments of a pairing from the unpacked package, for the pairing `code`: the folder, the archive and the id the hub announced for it. */
|
|
123
|
+
function renderPairArguments(code) {
|
|
124
|
+
return `--bootstrap "$d/pkg" --archive "$d/package.tgz" --package-id "\${t##*id=}" ${code}`;
|
|
110
125
|
}
|
|
111
126
|
function checkScriptHasNoQuote(script, what) {
|
|
112
127
|
if (script.includes("'"))
|
|
@@ -115,8 +130,8 @@ function checkScriptHasNoQuote(script, what) {
|
|
|
115
130
|
}
|
|
116
131
|
/** @description The command to paste on the runner machine, as the account that will run jobs, for the pairing `payload`. */
|
|
117
132
|
function buildBootstrapLine(payload) {
|
|
118
|
-
const script = [...renderFetchSteps(payload, false), `node ${
|
|
119
|
-
return `sh -c '${checkScriptHasNoQuote(['set -eu', ...script].join('; '), 'bootstrap')}'`;
|
|
133
|
+
const script = [...renderFetchSteps(payload, false), `node "$d/pkg/${runnerCliInPackage}" pair ${renderPairArguments((0, pairCode_1.encodePairCode)(payload))}`];
|
|
134
|
+
return `sh -c '${checkScriptHasNoQuote(['set -eu', sayFunction, failFunction, ...script].join('; '), 'bootstrap')}'`;
|
|
120
135
|
}
|
|
121
136
|
/**
|
|
122
137
|
* The admin script. `$1` is the account. Messages are plain ASCII with no apostrophe (the whole line sits in single quotes) and short: the
|
|
@@ -124,9 +139,11 @@ function buildBootstrapLine(payload) {
|
|
|
124
139
|
*/
|
|
125
140
|
function renderAdminScript(payload) {
|
|
126
141
|
const checks = [
|
|
127
|
-
|
|
142
|
+
sayFunction,
|
|
143
|
+
failFunction,
|
|
128
144
|
'a=$1',
|
|
129
145
|
'[ "$(id -u)" = 0 ] || f "run this line with sudo"',
|
|
146
|
+
's "checking the account $a"',
|
|
130
147
|
`case $a in ""|-*|*[!${accountNameChars}]*) f "$a is not an account name";; esac`,
|
|
131
148
|
'i=$(id -u "$a" 2>/dev/null) || f "no account $a here: create a standard user or fix the last word"',
|
|
132
149
|
'[ "$i" != 0 ] || f "$a is root: use a standard user"',
|
|
@@ -136,9 +153,8 @@ function renderAdminScript(payload) {
|
|
|
136
153
|
];
|
|
137
154
|
const steps = [
|
|
138
155
|
...renderFetchSteps(payload, true),
|
|
139
|
-
|
|
140
|
-
`
|
|
141
|
-
`"$n" "$d/pkg/${rootServiceCliInPackage}" install "$a" || f "$a is paired, but has no service: fix the above and paste a fresh admin line"`,
|
|
156
|
+
`n=$(sh "$d/pkg/${pickNodeInPackage}" "$a")`,
|
|
157
|
+
`"$n" "$d/pkg/${rootServiceCliInPackage}" install "$a" ${renderPairArguments((0, pairCode_1.encodePairCode)(payload))}`,
|
|
142
158
|
];
|
|
143
159
|
return checkScriptHasNoQuote(['set -eu', ...checks, ...steps].join('; '), 'admin');
|
|
144
160
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"bootstrapLine.js","sourceRoot":"","sources":["../../src/runners/bootstrapLine.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"bootstrapLine.js","sourceRoot":"","sources":["../../src/runners/bootstrapLine.ts"],"names":[],"mappings":";;;AAiFA,gDAEC;AAoDD,gDAGC;AAgCD,0DAGC;AA7KD,4DAA8E;AAC9E,iDAA+D;AAC/D,yCAAkE;AAElE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AAEH,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,EAAE,CAAC;AACxB,MAAM,YAAY,GAAG,KAAK,CAAC;AAC3B,MAAM,mBAAmB,GAAG,EAAE,CAAC;AAC/B,MAAM,gBAAgB,GAAG,qCAAqC,CAAC;AAC/D,MAAM,gBAAgB,GAAG,mCAAmC,CAAC;AAC7D,MAAM,qBAAqB,GAAG,EAAE,CAAC;AACjC,uIAAuI;AACvI,MAAM,sBAAsB,GAAG,IAAI,yBAAU,0CAA0C,CAAC;AACxF;;;GAGG;AACH,MAAM,WAAW,GAAG,qCAAqC,CAAC;AAC1D,wJAAwJ;AACxJ,MAAM,YAAY,GAAG,iDAAiD,CAAC;AACvE,yHAAyH;AACzH,SAAS,gBAAgB,CAAC,OAAe;IACvC,OAAO,GAAG,OAAO,mEAAmE,YAAY,WAAW,YAAY,WAAW,YAAY,QAAQ,CAAC;AACzJ,CAAC;AAED,2KAA2K;AAC3K,MAAM,iBAAiB,GAAG,uBAAuB,CA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AC;IACjB,+CAA+C;IAC/C,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;CAC7B;AAED,MAAM,WAAW,WAAW;IAC1B,mGAAmG;IACnG,OAAO,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;IAC9B,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;IACnB,WAAW,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;CACxC;AAkHD,qGAAqG;AACrG,wBAAsB,aAAa,CAAC,IAAI,EAAE,SAAS,MAAM,EAAE,EAAE,GAAG,EAAE,MAAM,CAAC,UAAU,EAAE,EAAE,EAAE,MAAM,EAAE,OAAO,GAAE,WAAgB,GAAG,OAAO,CAAC,MAAM,CAAC,CAsD3I"}
|
package/dist/runners/gate.js
CHANGED
|
@@ -47,6 +47,7 @@ const hubPaths_1 = require("./hubPaths");
|
|
|
47
47
|
const hubRegistry_1 = require("./hubRegistry");
|
|
48
48
|
const hubPackage_1 = require("./hubPackage");
|
|
49
49
|
const hubPairing_1 = require("./hubPairing");
|
|
50
|
+
const linkConcern_1 = require("./linkConcern");
|
|
50
51
|
const linkControl_1 = require("./linkControl");
|
|
51
52
|
/**
|
|
52
53
|
* @description `charness runner-gate` — what sshd starts for a runner's key (the forced command of its `authorized_keys` line, via
|
|
@@ -78,6 +79,9 @@ function parseGateArgs(argv) {
|
|
|
78
79
|
/** @description The request the runner may make with a key of `role`: `originalCommand` as a whole must be one of the role's words. */
|
|
79
80
|
function routeGateRequest(role, originalCommand) {
|
|
80
81
|
const allowed = role === 'temporary' ? gateProtocol_1.temporaryKeyRequests : gateProtocol_1.runnerKeyRequests;
|
|
82
|
+
// A runner's `link` may carry the lid (`link lid=closed|open`): exactly that text and no other argument.
|
|
83
|
+
if (role === 'runner' && (0, gateProtocol_1.parseLinkLidArgument)(originalCommand) !== null)
|
|
84
|
+
return 'link';
|
|
81
85
|
return allowed.find((request) => request === originalCommand) ?? null;
|
|
82
86
|
}
|
|
83
87
|
async function readLimitedText(stream, maxBytes) {
|
|
@@ -157,6 +161,27 @@ async function handleVersion(ctx, io) {
|
|
|
157
161
|
io.stdout.write((0, gateProtocol_1.formatGateAnswerHead)('version', { package: getPackageIdOrNull(ctx, io.log) ?? gateProtocol_1.noPackageMarker }));
|
|
158
162
|
return 0;
|
|
159
163
|
}
|
|
164
|
+
/**
|
|
165
|
+
* `lid`: the runner says whether its lid is closed with nothing keeping the Mac awake, and — when its link named one — the epoch of the link it says so on. The report
|
|
166
|
+
* is recorded as it came, with the hub's own clock; anything else in the body is refused. A report from a link that began EARLIER than the one on record is dropped (and
|
|
167
|
+
* answered like a taken one — the sender can do nothing about it): a Mac that fell asleep with a report in flight can have it delivered after its next link has already said
|
|
168
|
+
* where its lid is, and the old word must not overwrite the new.
|
|
169
|
+
*/
|
|
170
|
+
async function handleLid(ctx, runnerId, io, now) {
|
|
171
|
+
const body = await readLimitedText(io.stdin, gateProtocol_1.maxGateRequestBytes);
|
|
172
|
+
const report = body === null ? null : (0, gateProtocol_1.parseLidReportBody)(body);
|
|
173
|
+
if (report !== null) {
|
|
174
|
+
const onRecord = (0, linkControl_1.readLidState)(ctx.dir, runnerId);
|
|
175
|
+
const isFromEarlierLink = report.linkEpochMs !== null && onRecord?.linkEpochMs !== undefined && report.linkEpochMs < onRecord.linkEpochMs;
|
|
176
|
+
if (!isFromEarlierLink) {
|
|
177
|
+
(0, linkControl_1.writeLidState)(ctx.dir, runnerId, { isClosed: report.isClosed, reportedAtMs: now(), linkEpochMs: report.linkEpochMs ?? onRecord?.linkEpochMs });
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
const reply = { ok: report !== null };
|
|
181
|
+
io.stdout.write((0, gateProtocol_1.formatGateAnswerHead)('lid'));
|
|
182
|
+
io.stdout.write(`${JSON.stringify(reply)}\n`);
|
|
183
|
+
return report !== null ? 0 : failedExitCode;
|
|
184
|
+
}
|
|
160
185
|
function getPackageIdOrNull(ctx, log) {
|
|
161
186
|
try {
|
|
162
187
|
return (0, hubPackage_1.getHubPackage)(ctx).id;
|
|
@@ -204,7 +229,7 @@ async function runRunnerGate(argv, env, io, options = {}) {
|
|
|
204
229
|
}
|
|
205
230
|
switch (request) {
|
|
206
231
|
case 'link':
|
|
207
|
-
return await (0, gateLink_1.runGateLink)({ ctx, runnerId: invocation.runnerId, input: io.stdin, output: io.stdout, packageId: getPackageIdOrNull(ctx, io.log), log: io.log, timings: options.linkTimings, now });
|
|
232
|
+
return await (0, gateLink_1.runGateLink)({ ctx, runnerId: invocation.runnerId, input: io.stdin, output: io.stdout, packageId: getPackageIdOrNull(ctx, io.log), source: (0, linkConcern_1.parseSshClientSource)(env.SSH_CLIENT), lidIsClosed: (0, gateProtocol_1.parseLinkLidArgument)(env.SSH_ORIGINAL_COMMAND), log: io.log, timings: options.linkTimings, now });
|
|
208
233
|
case 'package':
|
|
209
234
|
return await writePackage(ctx, io, 'package');
|
|
210
235
|
case 'version':
|
|
@@ -213,6 +238,8 @@ async function runRunnerGate(argv, env, io, options = {}) {
|
|
|
213
238
|
return await handleIdentity(ctx, invocation.runnerId, io);
|
|
214
239
|
case 'unpair':
|
|
215
240
|
return await handleUnpair(ctx, invocation.runnerId, io, now);
|
|
241
|
+
case 'lid':
|
|
242
|
+
return await handleLid(ctx, invocation.runnerId, io, now);
|
|
216
243
|
default:
|
|
217
244
|
return refusedExitCode;
|
|
218
245
|
}
|
package/dist/runners/gate.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../../src/runners/gate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"gate.js","sourceRoot":"","sources":["../../src/runners/gate.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,sCAUC;AAGD,4CAKC;AAiID,sCAsDC;AA1PD,2CAA6B;AAC7B,8CAA2C;A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EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,EAAE,CAAC,MAAM,EAAE,SAAS,EAAE,kBAAkB,CAAC,GAAG,EAAE,EAAE,CAAC,GAAG,CAAC,EAAE,MAAM,EAAE,IAAA,kCAAoB,EAAC,GAAG,CAAC,UAAU,CAAC,EAAE,WAAW,EAAE,IAAA,mCAAoB,EAAC,GAAG,CAAC,oBAAoB,CAAC,EAAE,GAAG,EAAE,EAAE,CAAC,GAAG,EAAE,OAAO,EAAE,OAAO,CAAC,WAAW,EAAE,GAAG,EAAE,CAAC,CAAC;YAC9S,KAAK,SAAS;gBACZ,OAAO,MAAM,YAAY,CAAC,GAAG,EAAE,EAAE,EAAE,SAAS,CAAC,CAAC;YAChD,KAAK,SAAS;gBACZ,OAAO,MAAM,aAAa,CAAC,GAAG,EAAE,EAAE,CAAC,CAAC;YACtC,KAAK,UAAU;gBACb,OAAO,MAAM,cAAc,CAAC,GAAG,EAAE,UAAU,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;YAC5D,KAAK,QAAQ;gBACX,OAAO,MAAM,YAAY,CAAC,GAAG,EAAE,UAAU,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;YAC/D,KAAK,KAAK;gBACR,OAAO,MAAM,SAAS,CAAC,GAAG,EAAE,UAAU,CAAC,QAAQ,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;YAC5D;gBACE,OAAO,eAAe,CAAC;QAC3B,CAAC;IACH,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,EAAE,CAAC,GAAG,CAAC,WAAW,eAAe,CAAC,KAAK,CAAC,EAAE,CAAC,CAAC;QAC5C,OAAO,cAAc,CAAC;IACxB,CAAC;AACH,CAAC"}
|
|
@@ -17,6 +17,13 @@ export interface GateLinkParams {
|
|
|
17
17
|
output: Writable;
|
|
18
18
|
/** The id of the hub's current package, told to the runner in the marker line (`null` when it cannot be packed). */
|
|
19
19
|
packageId: string | null;
|
|
20
|
+
/** The address the link connects from, as sshd told the gate (`parseSshClientSource`); `null`/absent when it did not. Recorded in the status file. */
|
|
21
|
+
source?: string | null;
|
|
22
|
+
/**
|
|
23
|
+
* The lid at the moment the runner connected (`link lid=closed|open`): `true` closed, `false` open, `null`/absent when the runner did not say. Recorded BEFORE the link's
|
|
24
|
+
* marker is sent and its socket is bound, so the hub never counts the runner online with a lid it has not heard about.
|
|
25
|
+
*/
|
|
26
|
+
lidIsClosed?: boolean | null;
|
|
20
27
|
log: (line: string) => void;
|
|
21
28
|
timings?: Partial<GateLinkTimings>;
|
|
22
29
|
now?: () => number;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateLink.d.ts","sourceRoot":"","sources":["../../src/runners/gateLink.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAIzD,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"gateLink.d.ts","sourceRoot":"","sources":["../../src/runners/gateLink.ts"],"names":[],"mappings":"AAIA,OAAO,EAAU,QAAQ,EAAE,KAAK,QAAQ,EAAE,MAAM,QAAQ,CAAC;AAIzD,OAAO,EAAsB,KAAK,UAAU,EAAE,MAAM,YAAY,CAAC;AAsCjE,MAAM,WAAW,eAAe;IAC9B,oGAAoG;IACpG,eAAe,EAAE,MAAM,CAAC;IACxB,oDAAoD;IACpD,mBAAmB,EAAE,MAAM,CAAC;IAC5B,2DAA2D;IAC3D,cAAc,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,sBAAsB,EAAE,eAA2G,CAAC;AAEjJ,MAAM,WAAW,cAAc;IAC7B,GAAG,EAAE,UAAU,CAAC;IAChB,QAAQ,EAAE,MAAM,CAAC;IACjB,yEAAyE;IACzE,KAAK,EAAE,QAAQ,CAAC;IAChB,MAAM,EAAE,QAAQ,CAAC;IACjB,oHAAoH;IACpH,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;IACzB,sJAAsJ;IACtJ,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACvB;;;OAGG;IACH,WAAW,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IAC7B,GAAG,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IAC5B,OAAO,CAAC,EAAE,OAAO,CAAC,eAAe,CAAC,CAAC;IACnC,GAAG,CAAC,EAAE,MAAM,MAAM,CAAC;CACpB;AAcD,gJAAgJ;AAChJ,wBAAgB,WAAW,CAAC,MAAM,EAAE,cAAc,GAAG,OAAO,CAAC,MAAM,CAAC,CAoLnE"}
|
package/dist/runners/gateLink.js
CHANGED
|
@@ -46,6 +46,7 @@ const gateProtocol_1 = require("./gateProtocol");
|
|
|
46
46
|
const hubPaths_1 = require("./hubPaths");
|
|
47
47
|
const hubKey_1 = require("./hubKey");
|
|
48
48
|
const hubRegistry_1 = require("./hubRegistry");
|
|
49
|
+
const linkConcern_1 = require("./linkConcern");
|
|
49
50
|
const linkControl_1 = require("./linkControl");
|
|
50
51
|
const sshKeys_1 = require("./sshKeys");
|
|
51
52
|
/**
|
|
@@ -74,6 +75,8 @@ const socketMode = 0o600;
|
|
|
74
75
|
const linkDirMode = 0o700;
|
|
75
76
|
const socketSuffixBytes = 3;
|
|
76
77
|
const keepaliveCountMax = 3;
|
|
78
|
+
/** A link whose heartbeat is younger than this many check intervals was still up when a newer one took its place (see `linkConcern.ts`). */
|
|
79
|
+
const liveLinkHeartbeats = 3;
|
|
77
80
|
const sshHostKeyAlgorithm = 'ssh-ed25519';
|
|
78
81
|
exports.defaultGateLinkTimings = { checkIntervalMs: 10 * 1000, keepaliveIntervalMs: 15 * 1000, readyTimeoutMs: 20 * 1000 };
|
|
79
82
|
/**
|
|
@@ -101,10 +104,28 @@ function runGateLink(params) {
|
|
|
101
104
|
return Promise.resolve(1);
|
|
102
105
|
}
|
|
103
106
|
const pinnedBlob = pinnedHostKey.blob;
|
|
107
|
+
// The link's epoch: when this gate began, by the hub's clock. The lid it was told is recorded under it first of all — before the socket exists.
|
|
108
|
+
const linkEpochMs = now();
|
|
109
|
+
// Whether the lid the runner carried is on record now: the marker says so, and a runner that is not told reports it itself.
|
|
110
|
+
let isLidRecorded = false;
|
|
111
|
+
if (params.lidIsClosed !== undefined && params.lidIsClosed !== null) {
|
|
112
|
+
try {
|
|
113
|
+
// A link that began after this one has said where the lid is already (two links racing for the same runner): its word is the later one.
|
|
114
|
+
const onRecord = (0, linkControl_1.readLidState)(ctx.dir, runnerId)?.linkEpochMs;
|
|
115
|
+
if (onRecord === undefined || onRecord <= linkEpochMs) {
|
|
116
|
+
(0, linkControl_1.writeLidState)(ctx.dir, runnerId, { isClosed: params.lidIsClosed, reportedAtMs: linkEpochMs, linkEpochMs });
|
|
117
|
+
isLidRecorded = true;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
catch (error) {
|
|
121
|
+
// The link works without it: the record of the link before stands, as it did before the lid was part of the request — and the marker does not claim it was recorded.
|
|
122
|
+
log(`cannot record the lid the runner reported (${(0, configDirFile_1.getCaughtErrnoCode)(error)})`);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
104
125
|
return new Promise((resolve) => {
|
|
105
126
|
const client = new ssh2_1.Client();
|
|
106
127
|
const openConnections = new Set();
|
|
107
|
-
const sinceMs =
|
|
128
|
+
const sinceMs = linkEpochMs;
|
|
108
129
|
let server = null;
|
|
109
130
|
let boundInode = null;
|
|
110
131
|
let checkTimer = null;
|
|
@@ -148,8 +169,19 @@ function runGateLink(params) {
|
|
|
148
169
|
duplex.destroy();
|
|
149
170
|
resolve(isReady ? 0 : 1);
|
|
150
171
|
};
|
|
172
|
+
// Where this link comes from, and whether that is another place than the link before it (and whether that one was still up): decided once, when
|
|
173
|
+
// this gate takes the socket over, from the status file the previous gate left, and written with every heartbeat.
|
|
174
|
+
let linkSource = params.source ?? null;
|
|
175
|
+
let sourceChanges = [];
|
|
176
|
+
const recordSource = () => {
|
|
177
|
+
const previous = (0, linkControl_1.readLinkState)(ctx.dir, runnerId);
|
|
178
|
+
const isPreviousLive = previous !== null && previous.endedAtMs === null && now() - previous.lastBeatMs < timings.checkIntervalMs * liveLinkHeartbeats;
|
|
179
|
+
const recorded = (0, linkConcern_1.recordLinkSource)(previous === null ? null : { source: previous.source ?? null, sourceChanges: previous.sourceChanges ?? [] }, params.source ?? null, now(), isPreviousLive);
|
|
180
|
+
linkSource = recorded.source;
|
|
181
|
+
sourceChanges = recorded.sourceChanges;
|
|
182
|
+
};
|
|
151
183
|
const beat = () => {
|
|
152
|
-
writeState({ pid: process.pid, sinceMs, lastBeatMs: now(), endedAtMs: null });
|
|
184
|
+
writeState({ pid: process.pid, sinceMs, lastBeatMs: now(), endedAtMs: null, source: linkSource, sourceChanges });
|
|
153
185
|
};
|
|
154
186
|
const check = () => {
|
|
155
187
|
if (readSocketInode() !== boundInode) {
|
|
@@ -212,11 +244,12 @@ function runGateLink(params) {
|
|
|
212
244
|
return;
|
|
213
245
|
}
|
|
214
246
|
isReady = true;
|
|
247
|
+
recordSource();
|
|
215
248
|
beat();
|
|
216
249
|
checkTimer = setInterval(check, timings.checkIntervalMs);
|
|
217
250
|
});
|
|
218
251
|
};
|
|
219
|
-
params.output.write((0, gateProtocol_1.formatGateAnswerHead)('link', { package: params.packageId ?? gateProtocol_1.noPackageMarker }));
|
|
252
|
+
params.output.write((0, gateProtocol_1.formatGateAnswerHead)('link', { package: params.packageId ?? gateProtocol_1.noPackageMarker, epoch: linkEpochMs.toString(), ...(isLidRecorded ? { lid: gateProtocol_1.lidRecordedMarkerValue } : {}) }));
|
|
220
253
|
duplex.on('error', () => finish('the connection to the runner failed'));
|
|
221
254
|
// The channel from the runner ended cleanly (EOF: the ssh session that carried it is gone). A duplex whose readable side ended stays half
|
|
222
255
|
// open, so the ssh client never sees a close — only a failed write or the keepalive's silence would tell, and until then the hub shows a
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateLink.js","sourceRoot":"","sources":["../../src/runners/gateLink.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"gateLink.js","sourceRoot":"","sources":["../../src/runners/gateLink.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0FA,kCAoLC;AA9QD,mCAAqC;AACrC,uCAAyB;AACzB,yCAA2B;AAC3B,2CAA6B;AAC7B,mCAAyD;AACzD,+BAA8B;AAC9B,oDAAsD;AACtD,iDAA6G;AAC7G,yCAAiE;AACjE,qCAAsC;AACtC,+CAA+C;AAC/C,+CAAwE;AACxE,+CAA2G;AAC3G,uCAA2C;AAE3C;;;;;;;;;;;;;;;;;;GAkBG;AAEH,MAAM,eAAe,GAAG,WAAW,CAAC;AACpC,wHAAwH;AACxH,MAAM,gBAAgB,GAAG,EAAE,CAAC;AAC5B,MAAM,UAAU,GAAG,KAAK,CAAC;AACzB,MAAM,WAAW,GAAG,KAAK,CAAC;AAC1B,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,MAAM,iBAAiB,GAAG,CAAC,CAAC;AAC5B,4IAA4I;AAC5I,MAAM,kBAAkB,GAAG,CAAC,CAAC;AAC7B,MAAM,mBAAmB,GAAG,aAAa,CAAC;AAW7B,QAAA,sBAAsB,GAAoB,EAAE,eAAe,EAAE,EAAE,GAAG,IAAI,EAAE,mBAAmB,EAAE,EAAE,GAAG,IAAI,EAAE,cAAc,EAAE,EAAE,GAAG,IAAI,EAAE,CAAC;AAsBjJ;;;GAGG;AACH,SAAS,wBAAwB,CAAC,MAAgB;IAChD,OAAO,IAAI,iBAAQ,CAAC;QAClB,KAAK,CAAC,KAAa,EAAE,SAAS,EAAE,QAAQ;YACtC,MAAM,CAAC,KAAK,CAAC,KAAK,EAAE,QAAQ,CAAC,CAAC;QAChC,CAAC;KACF,CAAC,CAAC;AACL,CAAC;AAED,gJAAgJ;AAChJ,S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M,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,MAAM,CAAC,UAAU,CAAC;YACtF,iBAAiB,EAAE,OAAO,CAAC,mBAAmB;YAC9C,iBAAiB;YACjB,YAAY,EAAE,OAAO,CAAC,cAAc;SACrC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -6,7 +6,7 @@ import { z } from 'zod';
|
|
|
6
6
|
*
|
|
7
7
|
* temporary key (a pairing code): `bootstrap` marker line, then the packed charness package (raw gzip)
|
|
8
8
|
* `redeem` stdin: a {@link RedeemRequest} as JSON; stdout: marker line, then a {@link RedeemReply}
|
|
9
|
-
* permanent key (a paired runner): `link` marker line, then an ssh session in which the GATE is the client (see gateLink.ts)
|
|
9
|
+
* permanent key (a paired runner): `link` marker line (`package=<id> epoch=<the link's start in ms>`, and `lid=recorded` when the lid the request carried was recorded), then an ssh session in which the GATE is the client (see gateLink.ts)
|
|
10
10
|
* `package` marker line, then the packed package (raw gzip)
|
|
11
11
|
* `version` marker line with the hub's current `package=<id>`, nothing else — asked every few minutes over
|
|
12
12
|
* the connection that is already open, so a linked runner learns of an update
|
|
@@ -14,18 +14,37 @@ import { z } from 'zod';
|
|
|
14
14
|
* way back for a runner whose redeem answer was lost: the hub committed the pairing and
|
|
15
15
|
* removed the temporary key, so only the permanent key can still ask
|
|
16
16
|
* `unpair` marker line, then {@link UnpairReply}
|
|
17
|
+
* `lid` stdin: `closed` or `open`, then (when the `link` marker named one) the link's epoch; marker line, then a
|
|
18
|
+
* {@link LidReply}. A Mac runner tells the hub when its lid is closed with nothing keeping it awake: it
|
|
19
|
+
* will sleep, and takes no new job meanwhile (`linkControl.ts`). The `link` request itself may carry
|
|
20
|
+
* the lid at the moment of connecting (`link lid=closed|open`, {@link formatLinkCommand}): the hub records it
|
|
21
|
+
* BEFORE the link's socket exists, so a runner is never online with a lid the hub has not heard about
|
|
17
22
|
*
|
|
18
23
|
* Every answer starts with a MARKER line (after a line break, see {@link formatGateAnswerHead}): a shell that prints something before the
|
|
19
24
|
* forced command (a chatty `.bashrc`) would otherwise corrupt the stream; the reader discards everything up to the marker — the runner
|
|
20
25
|
* utility with {@link readUntilGateMarker}, the pasted `sh` line with `grep -b` over the first {@link maxGateNoiseBytes} bytes.
|
|
21
26
|
*/
|
|
27
|
+
/** What a `lid` report (and the lid argument of a `link`) says: the lid is closed with nothing keeping the Mac awake, or it is not. */
|
|
28
|
+
export declare const lidReportBodies: {
|
|
29
|
+
readonly closed: "closed";
|
|
30
|
+
readonly open: "open";
|
|
31
|
+
};
|
|
32
|
+
/** The value of the `lid` field of a `link` marker: the hub recorded the lid the request carried. A marker without it says the lid was not recorded — an older hub, or a record that could not be written. */
|
|
33
|
+
export declare const lidRecordedMarkerValue = "recorded";
|
|
22
34
|
/** The text every marker line starts with; the `1` is the protocol version. */
|
|
23
35
|
export declare const gateMarker = "--charness-gate-1--";
|
|
24
|
-
export declare const gateRequests: readonly ["bootstrap", "redeem", "cancel", "link", "package", "version", "identity", "unpair"];
|
|
36
|
+
export declare const gateRequests: readonly ["bootstrap", "redeem", "cancel", "link", "package", "version", "identity", "unpair", "lid"];
|
|
25
37
|
/** @name GateRequest @description One of the words a runner may send. */
|
|
26
38
|
export type GateRequest = (typeof gateRequests)[number];
|
|
27
39
|
export declare const temporaryKeyRequests: readonly GateRequest[];
|
|
28
40
|
export declare const runnerKeyRequests: readonly GateRequest[];
|
|
41
|
+
/**
|
|
42
|
+
* @description The command a runner runs for a link: `link`, or — a Mac that knows its lid — `link lid=closed` / `link lid=open`. The forced command of its key matches the whole
|
|
43
|
+
* text against exactly these (`parseLinkLidArgument`), so no other argument is ever passed on.
|
|
44
|
+
*/
|
|
45
|
+
export declare function formatLinkCommand(isLidClosed: boolean | null): string;
|
|
46
|
+
/** @description The lid a `link` command carries: `true` closed, `false` open, `null` for a plain `link` (or any other text). */
|
|
47
|
+
export declare function parseLinkLidArgument(command: string | undefined): boolean | null;
|
|
29
48
|
/** What a `link` / `version` answer names as the package when the hub cannot pack one. */
|
|
30
49
|
export declare const noPackageMarker = "none";
|
|
31
50
|
/** The username the gate's ssh client logs in with inside the link (the runner's server ignores it). */
|
|
@@ -93,6 +112,22 @@ export type RedeemReply = z.infer<typeof redeemReplySchema>;
|
|
|
93
112
|
export declare const unpairReplySchema: z.ZodObject<{
|
|
94
113
|
ok: z.ZodBoolean;
|
|
95
114
|
}, z.core.$strict>;
|
|
115
|
+
/**
|
|
116
|
+
* `ok`: the hub took the report (or knew better: a report from an older link than the one now in force is dropped, and answered the same way, because the sender can do
|
|
117
|
+
* nothing about it); `false`: the body was neither of {@link lidReportBodies} nor followed by a number.
|
|
118
|
+
*/
|
|
119
|
+
export declare const lidReplySchema: z.ZodObject<{
|
|
120
|
+
ok: z.ZodBoolean;
|
|
121
|
+
}, z.core.$strict>;
|
|
122
|
+
/** @name LidReply @description What `lid` answers. */
|
|
123
|
+
export type LidReply = z.infer<typeof lidReplySchema>;
|
|
124
|
+
/** @description What the body of a `lid` request says: closed or open, and the epoch of the link it was made on (`null` when none was named); `null` for anything else. */
|
|
125
|
+
export declare function parseLidReportBody(body: string): {
|
|
126
|
+
isClosed: boolean;
|
|
127
|
+
linkEpochMs: number | null;
|
|
128
|
+
} | null;
|
|
129
|
+
/** @description The body of a `lid` request. */
|
|
130
|
+
export declare function formatLidReportBody(isClosed: boolean, linkEpochMs: number | null): string;
|
|
96
131
|
/** `ok`: the code was open and is closed now; `false`: there was nothing to close (spent, expired, or cancelled already). */
|
|
97
132
|
export declare const cancelReplySchema: z.ZodObject<{
|
|
98
133
|
ok: z.ZodBoolean;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"gateProtocol.d.ts","sourceRoot":"","sources":["../../src/runners/gateProtocol.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,QAAQ,CAAC;AACvC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAMxB
|
|
1
|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