charness 3.11.0 → 3.13.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.env.example +5 -0
- package/CHANGELOG.md +169 -0
- package/DEVELOPMENT.md +81 -18
- package/README.md +3 -2
- package/SETUP.md +71 -25
- package/agent-plugin/README.md +15 -6
- package/agent-plugin/skills/charness-delegate-claude/SKILL.md +37 -18
- package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +10 -6
- package/agent-plugin/skills/charness-delivery-loop/SKILL.md +92 -0
- package/agent-plugin/skills/charness-orchestration/SKILL.md +116 -0
- package/dist/accessControl.d.ts +43 -0
- package/dist/accessControl.d.ts.map +1 -1
- package/dist/accessControl.js +50 -1
- package/dist/accessControl.js.map +1 -1
- package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeCliAdapter.js +9 -4
- package/dist/adapters/claudeCliAdapter.js.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
- package/dist/adapters/claudePlatformFlags.d.ts +4 -3
- package/dist/adapters/claudePlatformFlags.d.ts.map +1 -1
- package/dist/adapters/claudePlatformFlags.js +4 -3
- package/dist/adapters/claudePlatformFlags.js.map +1 -1
- package/dist/adapters/openCodeAdapter.d.ts +52 -13
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +121 -45
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/adapters/terminalAdapter.d.ts.map +1 -1
- package/dist/adapters/terminalAdapter.js +5 -3
- package/dist/adapters/terminalAdapter.js.map +1 -1
- package/dist/agentLogin/agentLogin.d.ts +11 -0
- package/dist/agentLogin/agentLogin.d.ts.map +1 -1
- package/dist/agentLogin/agentLogin.js +20 -20
- package/dist/agentLogin/agentLogin.js.map +1 -1
- package/dist/apiErrorRetry.d.ts +5 -0
- package/dist/apiErrorRetry.d.ts.map +1 -1
- package/dist/apiErrorRetry.js +3 -3
- package/dist/apiErrorRetry.js.map +1 -1
- package/dist/bot.d.ts +12 -3
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +634 -153
- package/dist/bot.js.map +1 -1
- package/dist/cli/claudeProfiles.d.ts +5 -2
- package/dist/cli/claudeProfiles.d.ts.map +1 -1
- package/dist/cli/claudeProfiles.js +45 -22
- package/dist/cli/claudeProfiles.js.map +1 -1
- package/dist/cli/claudeProfilesCredit.d.ts +49 -0
- package/dist/cli/claudeProfilesCredit.d.ts.map +1 -0
- package/dist/cli/claudeProfilesCredit.js +160 -0
- package/dist/cli/claudeProfilesCredit.js.map +1 -0
- package/dist/cli/flagValue.d.ts +10 -0
- package/dist/cli/flagValue.d.ts.map +1 -0
- package/dist/cli/flagValue.js +17 -0
- package/dist/cli/flagValue.js.map +1 -0
- package/dist/connectors/jira/client.js +1 -1
- package/dist/connectors/jira/client.js.map +1 -1
- package/dist/connectors/jira/config.d.ts +7 -0
- package/dist/connectors/jira/config.d.ts.map +1 -1
- package/dist/connectors/jira/config.js +12 -1
- package/dist/connectors/jira/config.js.map +1 -1
- package/dist/connectors/jira/connector.d.ts +7 -0
- package/dist/connectors/jira/connector.d.ts.map +1 -1
- package/dist/connectors/jira/connector.js +20 -3
- package/dist/connectors/jira/connector.js.map +1 -1
- package/dist/connectors/jira/inbound.d.ts.map +1 -1
- package/dist/connectors/jira/inbound.js +4 -3
- package/dist/connectors/jira/inbound.js.map +1 -1
- package/dist/connectors/jira/issueBlocks.d.ts +1 -1
- package/dist/connectors/jira/trustedGroup.d.ts +21 -6
- package/dist/connectors/jira/trustedGroup.d.ts.map +1 -1
- package/dist/connectors/jira/trustedGroup.js +46 -6
- package/dist/connectors/jira/trustedGroup.js.map +1 -1
- package/dist/connectors/telegram/commands/botCore.d.ts +19 -2
- package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/botSkills.js +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts +6 -1
- package/dist/connectors/telegram/commands/claudeAccounts.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/claudeAccounts.js +9 -6
- package/dist/connectors/telegram/commands/claudeAccounts.js.map +1 -1
- package/dist/connectors/telegram/commands/compaction.d.ts +16 -3
- package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/compaction.js +216 -27
- package/dist/connectors/telegram/commands/compaction.js.map +1 -1
- package/dist/connectors/telegram/commands/runners.d.ts +5 -1
- package/dist/connectors/telegram/commands/runners.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/runners.js +146 -31
- package/dist/connectors/telegram/commands/runners.js.map +1 -1
- package/dist/connectors/telegram/commands/todo.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/todo.js +2 -2
- package/dist/connectors/telegram/commands/todo.js.map +1 -1
- package/dist/connectors/telegram/commands/topicAccess.d.ts +30 -0
- package/dist/connectors/telegram/commands/topicAccess.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/topicAccess.js +399 -0
- package/dist/connectors/telegram/commands/topicAccess.js.map +1 -0
- package/dist/connectors/telegram/inbound.d.ts +44 -7
- package/dist/connectors/telegram/inbound.d.ts.map +1 -1
- package/dist/connectors/telegram/inbound.js +142 -24
- package/dist/connectors/telegram/inbound.js.map +1 -1
- package/dist/connectors/telegram/runnerPairingMessages.d.ts +2 -7
- package/dist/connectors/telegram/runnerPairingMessages.d.ts.map +1 -1
- package/dist/connectors/telegram/runnerPairingMessages.js +5 -19
- package/dist/connectors/telegram/runnerPairingMessages.js.map +1 -1
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +120 -8
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +120 -8
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +120 -8
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +120 -8
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +120 -8
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +120 -8
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +120 -8
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +120 -8
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +120 -8
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +120 -8
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +120 -8
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +120 -8
- package/dist/i18n/zh.js.map +1 -1
- package/dist/installManager.d.ts +37 -1
- package/dist/installManager.d.ts.map +1 -1
- package/dist/installManager.js +208 -14
- package/dist/installManager.js.map +1 -1
- package/dist/instanceLock.d.ts.map +1 -1
- package/dist/instanceLock.js +2 -1
- package/dist/instanceLock.js.map +1 -1
- package/dist/platform/commandRouter.d.ts +13 -1
- package/dist/platform/commandRouter.d.ts.map +1 -1
- package/dist/platform/commandRouter.js +14 -2
- package/dist/platform/commandRouter.js.map +1 -1
- package/dist/platform/inbound.d.ts +2 -0
- package/dist/platform/inbound.d.ts.map +1 -1
- package/dist/platform/outbound.d.ts +14 -1
- package/dist/platform/outbound.d.ts.map +1 -1
- package/dist/platform/outbound.js.map +1 -1
- package/dist/remoteRun/cleanReport.d.ts +45 -0
- package/dist/remoteRun/cleanReport.d.ts.map +1 -0
- package/dist/remoteRun/cleanReport.js +84 -0
- package/dist/remoteRun/cleanReport.js.map +1 -0
- package/dist/remoteRun/cliArgs.d.ts +18 -0
- package/dist/remoteRun/cliArgs.d.ts.map +1 -1
- package/dist/remoteRun/cliArgs.js +100 -4
- package/dist/remoteRun/cliArgs.js.map +1 -1
- package/dist/remoteRun/commands.d.ts +30 -1
- package/dist/remoteRun/commands.d.ts.map +1 -1
- package/dist/remoteRun/commands.js +84 -9
- package/dist/remoteRun/commands.js.map +1 -1
- package/dist/remoteRun/exitCodes.d.ts +5 -0
- package/dist/remoteRun/exitCodes.d.ts.map +1 -1
- package/dist/remoteRun/exitCodes.js +6 -1
- package/dist/remoteRun/exitCodes.js.map +1 -1
- package/dist/remoteRun/foreground.d.ts +6 -0
- package/dist/remoteRun/foreground.d.ts.map +1 -1
- package/dist/remoteRun/foreground.js +13 -1
- package/dist/remoteRun/foreground.js.map +1 -1
- package/dist/remoteRun/interrupts.d.ts.map +1 -1
- package/dist/remoteRun/interrupts.js +2 -2
- package/dist/remoteRun/interrupts.js.map +1 -1
- package/dist/remoteRun/jobFiles.d.ts +6 -1
- package/dist/remoteRun/jobFiles.d.ts.map +1 -1
- package/dist/remoteRun/jobFiles.js +14 -0
- package/dist/remoteRun/jobFiles.js.map +1 -1
- package/dist/remoteRun/jobId.d.ts +5 -0
- package/dist/remoteRun/jobId.d.ts.map +1 -1
- package/dist/remoteRun/jobId.js +10 -0
- package/dist/remoteRun/jobId.js.map +1 -1
- package/dist/remoteRun/jobState.d.ts.map +1 -1
- package/dist/remoteRun/jobState.js +3 -2
- package/dist/remoteRun/jobState.js.map +1 -1
- package/dist/remoteRun/pairedRunners.d.ts +1 -1
- package/dist/remoteRun/pairedRunners.d.ts.map +1 -1
- package/dist/remoteRun/pairedRunners.js +4 -0
- package/dist/remoteRun/pairedRunners.js.map +1 -1
- package/dist/remoteRun/pathPatterns.d.ts +1 -1
- package/dist/remoteRun/pathPatterns.js +1 -1
- package/dist/remoteRun/probe.d.ts +58 -5
- package/dist/remoteRun/probe.d.ts.map +1 -1
- package/dist/remoteRun/probe.js +107 -11
- package/dist/remoteRun/probe.js.map +1 -1
- package/dist/remoteRun/probeTiming.d.ts +15 -0
- package/dist/remoteRun/probeTiming.d.ts.map +1 -0
- package/dist/remoteRun/probeTiming.js +23 -0
- package/dist/remoteRun/probeTiming.js.map +1 -0
- package/dist/remoteRun/project.d.ts +5 -0
- package/dist/remoteRun/project.d.ts.map +1 -1
- package/dist/remoteRun/project.js +10 -0
- package/dist/remoteRun/project.js.map +1 -1
- package/dist/remoteRun/projectConfig.d.ts +8 -1
- package/dist/remoteRun/projectConfig.d.ts.map +1 -1
- package/dist/remoteRun/projectConfig.js +18 -5
- package/dist/remoteRun/projectConfig.js.map +1 -1
- package/dist/remoteRun/pruneReport.d.ts +48 -0
- package/dist/remoteRun/pruneReport.d.ts.map +1 -0
- package/dist/remoteRun/pruneReport.js +80 -0
- package/dist/remoteRun/pruneReport.js.map +1 -0
- package/dist/remoteRun/remoteRunCli.d.ts +1 -1
- package/dist/remoteRun/remoteRunCli.d.ts.map +1 -1
- package/dist/remoteRun/remoteRunCli.js +20 -0
- package/dist/remoteRun/remoteRunCli.js.map +1 -1
- package/dist/remoteRun/runnerClient.d.ts +10 -0
- package/dist/remoteRun/runnerClient.d.ts.map +1 -1
- package/dist/remoteRun/runnerClient.js +19 -5
- package/dist/remoteRun/runnerClient.js.map +1 -1
- package/dist/remoteRun/runnerWait.d.ts.map +1 -1
- package/dist/remoteRun/runnerWait.js +2 -1
- package/dist/remoteRun/runnerWait.js.map +1 -1
- package/dist/remoteRun/runners.d.ts +48 -7
- package/dist/remoteRun/runners.d.ts.map +1 -1
- package/dist/remoteRun/runners.js +105 -40
- package/dist/remoteRun/runners.js.map +1 -1
- package/dist/remoteRun/runnersConfig.d.ts +24 -0
- package/dist/remoteRun/runnersConfig.d.ts.map +1 -1
- package/dist/remoteRun/runnersConfig.js +29 -2
- package/dist/remoteRun/runnersConfig.js.map +1 -1
- package/dist/remoteRun/ssh.d.ts +3 -3
- package/dist/remoteRun/ssh.d.ts.map +1 -1
- package/dist/remoteRun/ssh.js +19 -5
- package/dist/remoteRun/ssh.js.map +1 -1
- package/dist/remoteRun/submit.d.ts +1 -1
- package/dist/remoteRun/submit.d.ts.map +1 -1
- package/dist/remoteRun/submit.js +30 -2
- package/dist/remoteRun/submit.js.map +1 -1
- package/dist/runnerUtility/adminService.d.ts.map +1 -1
- package/dist/runnerUtility/adminService.js +5 -5
- package/dist/runnerUtility/adminService.js.map +1 -1
- package/dist/runnerUtility/appInstall.d.ts +9 -0
- package/dist/runnerUtility/appInstall.d.ts.map +1 -1
- package/dist/runnerUtility/appInstall.js +12 -2
- package/dist/runnerUtility/appInstall.js.map +1 -1
- package/dist/runnerUtility/execEnv.d.ts +1 -1
- package/dist/runnerUtility/execEnv.d.ts.map +1 -1
- package/dist/runnerUtility/execEnv.js +23 -5
- package/dist/runnerUtility/execEnv.js.map +1 -1
- package/dist/runnerUtility/guiAgentHeal.d.ts +3 -3
- package/dist/runnerUtility/guiAgentHeal.d.ts.map +1 -1
- package/dist/runnerUtility/guiAgentHeal.js +4 -2
- package/dist/runnerUtility/guiAgentHeal.js.map +1 -1
- package/dist/runnerUtility/homeFolders.d.ts +1 -0
- package/dist/runnerUtility/homeFolders.d.ts.map +1 -1
- package/dist/runnerUtility/homeFolders.js +2 -1
- package/dist/runnerUtility/homeFolders.js.map +1 -1
- package/dist/runnerUtility/iosCheck.d.ts +2 -0
- package/dist/runnerUtility/iosCheck.d.ts.map +1 -1
- package/dist/runnerUtility/iosCheck.js +12 -3
- package/dist/runnerUtility/iosCheck.js.map +1 -1
- package/dist/runnerUtility/keepAwake.d.ts +47 -10
- package/dist/runnerUtility/keepAwake.d.ts.map +1 -1
- package/dist/runnerUtility/keepAwake.js +108 -31
- package/dist/runnerUtility/keepAwake.js.map +1 -1
- package/dist/runnerUtility/launcher.d.ts +4 -0
- package/dist/runnerUtility/launcher.d.ts.map +1 -1
- package/dist/runnerUtility/launcher.js +31 -13
- package/dist/runnerUtility/launcher.js.map +1 -1
- package/dist/runnerUtility/linkLoop.d.ts +4 -0
- package/dist/runnerUtility/linkLoop.d.ts.map +1 -1
- package/dist/runnerUtility/linkLoop.js +15 -6
- package/dist/runnerUtility/linkLoop.js.map +1 -1
- package/dist/runnerUtility/managedNode.d.ts +84 -0
- package/dist/runnerUtility/managedNode.d.ts.map +1 -0
- package/dist/runnerUtility/managedNode.js +165 -0
- package/dist/runnerUtility/managedNode.js.map +1 -0
- package/dist/runnerUtility/nodeOnPath.d.ts +10 -0
- package/dist/runnerUtility/nodeOnPath.d.ts.map +1 -0
- package/dist/runnerUtility/nodeOnPath.js +49 -0
- package/dist/runnerUtility/nodeOnPath.js.map +1 -0
- package/dist/runnerUtility/nodeUpkeep.d.ts +140 -0
- package/dist/runnerUtility/nodeUpkeep.d.ts.map +1 -0
- package/dist/runnerUtility/nodeUpkeep.js +348 -0
- package/dist/runnerUtility/nodeUpkeep.js.map +1 -0
- package/dist/runnerUtility/nodeUpkeepTiming.d.ts +14 -0
- package/dist/runnerUtility/nodeUpkeepTiming.d.ts.map +1 -0
- package/dist/runnerUtility/nodeUpkeepTiming.js +21 -0
- package/dist/runnerUtility/nodeUpkeepTiming.js.map +1 -0
- package/dist/runnerUtility/packageManagerShims.d.ts +10 -0
- package/dist/runnerUtility/packageManagerShims.d.ts.map +1 -1
- package/dist/runnerUtility/packageManagerShims.js +67 -3
- package/dist/runnerUtility/packageManagerShims.js.map +1 -1
- package/dist/runnerUtility/pueueDaemon.d.ts +73 -8
- package/dist/runnerUtility/pueueDaemon.d.ts.map +1 -1
- package/dist/runnerUtility/pueueDaemon.js +90 -15
- package/dist/runnerUtility/pueueDaemon.js.map +1 -1
- package/dist/runnerUtility/runnerCommands.d.ts +7 -1
- package/dist/runnerUtility/runnerCommands.d.ts.map +1 -1
- package/dist/runnerUtility/runnerCommands.js +119 -16
- package/dist/runnerUtility/runnerCommands.js.map +1 -1
- package/dist/runnerUtility/runnerHome.d.ts +34 -0
- package/dist/runnerUtility/runnerHome.d.ts.map +1 -1
- package/dist/runnerUtility/runnerHome.js +17 -3
- package/dist/runnerUtility/runnerHome.js.map +1 -1
- package/dist/runnerUtility/serviceCommon.d.ts +2 -0
- package/dist/runnerUtility/serviceCommon.d.ts.map +1 -1
- package/dist/runnerUtility/serviceCommon.js +3 -1
- package/dist/runnerUtility/serviceCommon.js.map +1 -1
- package/dist/runnerUtility/serviceManager.d.ts.map +1 -1
- package/dist/runnerUtility/serviceManager.js +7 -2
- package/dist/runnerUtility/serviceManager.js.map +1 -1
- package/dist/runnerUtility/simctlGuard.d.ts +38 -0
- package/dist/runnerUtility/simctlGuard.d.ts.map +1 -0
- package/dist/runnerUtility/simctlGuard.js +166 -0
- package/dist/runnerUtility/simctlGuard.js.map +1 -0
- package/dist/runners/bootstrapLine.d.ts +3 -4
- package/dist/runners/bootstrapLine.d.ts.map +1 -1
- package/dist/runners/bootstrapLine.js +108 -83
- package/dist/runners/bootstrapLine.js.map +1 -1
- package/dist/runners/hubPackage.d.ts +1 -1
- package/dist/runners/hubPackage.d.ts.map +1 -1
- package/dist/runners/hubPackage.js +5 -6
- package/dist/runners/hubPackage.js.map +1 -1
- package/dist/runners/hubPairing.d.ts +19 -0
- package/dist/runners/hubPairing.d.ts.map +1 -1
- package/dist/runners/hubPairing.js +38 -0
- package/dist/runners/hubPairing.js.map +1 -1
- package/dist/runners/hubRegistry.d.ts +8 -0
- package/dist/runners/hubRegistry.d.ts.map +1 -1
- package/dist/runners/hubRegistry.js +6 -0
- package/dist/runners/hubRegistry.js.map +1 -1
- package/dist/runners/pairCode.d.ts +34 -3
- package/dist/runners/pairCode.d.ts.map +1 -1
- package/dist/runners/pairCode.js +65 -13
- package/dist/runners/pairCode.js.map +1 -1
- package/dist/runners/runnerGroups.d.ts +22 -0
- package/dist/runners/runnerGroups.d.ts.map +1 -0
- package/dist/runners/runnerGroups.js +41 -0
- package/dist/runners/runnerGroups.js.map +1 -0
- package/dist/runners/runnerLock.d.ts +36 -1
- package/dist/runners/runnerLock.d.ts.map +1 -1
- package/dist/runners/runnerLock.js +94 -30
- package/dist/runners/runnerLock.js.map +1 -1
- package/dist/runners/runnersCli.d.ts +5 -2
- package/dist/runners/runnersCli.d.ts.map +1 -1
- package/dist/runners/runnersCli.js +59 -9
- package/dist/runners/runnersCli.js.map +1 -1
- package/dist/runners/runnersList.d.ts +1 -1
- package/dist/runners/runnersList.d.ts.map +1 -1
- package/dist/runners/runnersList.js +3 -1
- package/dist/runners/runnersList.js.map +1 -1
- package/dist/runners/runnersOverview.d.ts.map +1 -1
- package/dist/runners/runnersOverview.js +8 -4
- package/dist/runners/runnersOverview.js.map +1 -1
- package/dist/scheduler/checkRun.d.ts +0 -2
- package/dist/scheduler/checkRun.d.ts.map +1 -1
- package/dist/scheduler/checkRun.js +0 -10
- package/dist/scheduler/checkRun.js.map +1 -1
- package/dist/scheduler/checkStatus.d.ts +2 -0
- package/dist/scheduler/checkStatus.d.ts.map +1 -1
- package/dist/scheduler/checkStatus.js +5 -4
- package/dist/scheduler/checkStatus.js.map +1 -1
- package/dist/scheduler/delivery.d.ts +2 -1
- package/dist/scheduler/delivery.d.ts.map +1 -1
- package/dist/scheduler/delivery.js +5 -1
- package/dist/scheduler/delivery.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +7 -3
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +48 -22
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/scheduler/workerWatch.d.ts +33 -10
- package/dist/scheduler/workerWatch.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.js +37 -11
- package/dist/scheduler/workerWatch.js.map +1 -1
- package/dist/selfUpdate/bootRollback.d.ts.map +1 -1
- package/dist/selfUpdate/bootRollback.js +3 -2
- package/dist/selfUpdate/bootRollback.js.map +1 -1
- package/dist/selfUpdate/updateRuntime.d.ts.map +1 -1
- package/dist/selfUpdate/updateRuntime.js +6 -3
- package/dist/selfUpdate/updateRuntime.js.map +1 -1
- package/dist/state.d.ts +144 -2
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +257 -7
- package/dist/state.js.map +1 -1
- package/dist/testTimings.d.ts +6 -2
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +12 -1
- package/dist/testTimings.js.map +1 -1
- package/dist/threadContextPreamble.d.ts +15 -1
- package/dist/threadContextPreamble.d.ts.map +1 -1
- package/dist/threadContextPreamble.js +15 -3
- package/dist/threadContextPreamble.js.map +1 -1
- package/dist/threadRouting.d.ts +47 -4
- package/dist/threadRouting.d.ts.map +1 -1
- package/dist/threadRouting.js +31 -4
- package/dist/threadRouting.js.map +1 -1
- package/dist/todos/projects.d.ts +1 -1
- package/dist/todos/projects.d.ts.map +1 -1
- package/dist/todos/projects.js +3 -14
- package/dist/todos/projects.js.map +1 -1
- package/dist/topicTalkerMemory.d.ts +37 -0
- package/dist/topicTalkerMemory.d.ts.map +1 -0
- package/dist/topicTalkerMemory.js +61 -0
- package/dist/topicTalkerMemory.js.map +1 -0
- package/dist/topicTalkers.d.ts +123 -0
- package/dist/topicTalkers.d.ts.map +1 -0
- package/dist/topicTalkers.js +276 -0
- package/dist/topicTalkers.js.map +1 -0
- package/dist/types.d.ts +7 -5
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/agentEnvironment.d.ts +23 -0
- package/dist/utils/agentEnvironment.d.ts.map +1 -1
- package/dist/utils/agentEnvironment.js +33 -1
- package/dist/utils/agentEnvironment.js.map +1 -1
- package/dist/utils/agentPlugin.d.ts +9 -3
- package/dist/utils/agentPlugin.d.ts.map +1 -1
- package/dist/utils/agentPlugin.js +13 -6
- package/dist/utils/agentPlugin.js.map +1 -1
- package/dist/utils/authorMark.d.ts +59 -0
- package/dist/utils/authorMark.d.ts.map +1 -0
- package/dist/utils/authorMark.js +86 -0
- package/dist/utils/authorMark.js.map +1 -0
- package/dist/utils/botSkills.d.ts +1 -1
- package/dist/utils/claudeApiAgentStop.d.ts +64 -0
- package/dist/utils/claudeApiAgentStop.d.ts.map +1 -0
- package/dist/utils/claudeApiAgentStop.js +85 -0
- package/dist/utils/claudeApiAgentStop.js.map +1 -0
- package/dist/utils/claudeApiCredit.d.ts +168 -0
- package/dist/utils/claudeApiCredit.d.ts.map +1 -0
- package/dist/utils/claudeApiCredit.js +260 -0
- package/dist/utils/claudeApiCredit.js.map +1 -0
- package/dist/utils/claudeApiCreditRecheck.d.ts +120 -0
- package/dist/utils/claudeApiCreditRecheck.d.ts.map +1 -0
- package/dist/utils/claudeApiCreditRecheck.js +173 -0
- package/dist/utils/claudeApiCreditRecheck.js.map +1 -0
- package/dist/utils/claudeCompactHook.d.ts +18 -10
- package/dist/utils/claudeCompactHook.d.ts.map +1 -1
- package/dist/utils/claudeCompactHook.js +35 -14
- package/dist/utils/claudeCompactHook.js.map +1 -1
- package/dist/utils/claudeLimitSwitch.d.ts +5 -1
- package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
- package/dist/utils/claudeLimitSwitch.js +6 -2
- package/dist/utils/claudeLimitSwitch.js.map +1 -1
- package/dist/utils/claudeProfileUsageLines.d.ts +14 -2
- package/dist/utils/claudeProfileUsageLines.d.ts.map +1 -1
- package/dist/utils/claudeProfileUsageLines.js +78 -7
- package/dist/utils/claudeProfileUsageLines.js.map +1 -1
- package/dist/utils/claudeProfileUsageViews.d.ts +46 -0
- package/dist/utils/claudeProfileUsageViews.d.ts.map +1 -0
- package/dist/utils/claudeProfileUsageViews.js +114 -0
- package/dist/utils/claudeProfileUsageViews.js.map +1 -0
- package/dist/utils/claudeProfiles.d.ts +22 -0
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +69 -0
- package/dist/utils/claudeProfiles.js.map +1 -1
- package/dist/utils/claudeUsage.d.ts +145 -51
- package/dist/utils/claudeUsage.d.ts.map +1 -1
- package/dist/utils/claudeUsage.js +211 -94
- package/dist/utils/claudeUsage.js.map +1 -1
- package/dist/utils/compactOnIdle.d.ts +140 -15
- package/dist/utils/compactOnIdle.d.ts.map +1 -1
- package/dist/utils/compactOnIdle.js +209 -23
- package/dist/utils/compactOnIdle.js.map +1 -1
- package/dist/utils/compactSelfReviewFlags.d.ts +50 -0
- package/dist/utils/compactSelfReviewFlags.d.ts.map +1 -0
- package/dist/utils/compactSelfReviewFlags.js +120 -0
- package/dist/utils/compactSelfReviewFlags.js.map +1 -0
- package/dist/utils/fallbackChain.d.ts +18 -7
- package/dist/utils/fallbackChain.d.ts.map +1 -1
- package/dist/utils/fallbackChain.js +36 -16
- package/dist/utils/fallbackChain.js.map +1 -1
- package/dist/utils/folderGit.d.ts +9 -0
- package/dist/utils/folderGit.d.ts.map +1 -0
- package/dist/utils/folderGit.js +33 -0
- package/dist/utils/folderGit.js.map +1 -0
- package/dist/utils/forwardedMark.d.ts +8 -0
- package/dist/utils/forwardedMark.d.ts.map +1 -1
- package/dist/utils/forwardedMark.js +2 -0
- package/dist/utils/forwardedMark.js.map +1 -1
- package/dist/utils/jsonStreamHost.d.ts +2 -1
- package/dist/utils/jsonStreamHost.d.ts.map +1 -1
- package/dist/utils/jsonStreamHost.js +4 -2
- package/dist/utils/jsonStreamHost.js.map +1 -1
- package/dist/utils/messageContext.d.ts +22 -7
- package/dist/utils/messageContext.d.ts.map +1 -1
- package/dist/utils/messageContext.js +19 -5
- package/dist/utils/messageContext.js.map +1 -1
- package/dist/utils/openCodeCompactPlugin.d.ts +28 -7
- package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -1
- package/dist/utils/openCodeCompactPlugin.js +80 -15
- package/dist/utils/openCodeCompactPlugin.js.map +1 -1
- package/dist/utils/personLabel.d.ts +13 -0
- package/dist/utils/personLabel.d.ts.map +1 -0
- package/dist/utils/personLabel.js +15 -0
- package/dist/utils/personLabel.js.map +1 -0
- package/dist/utils/replyQuote.d.ts +17 -3
- package/dist/utils/replyQuote.d.ts.map +1 -1
- package/dist/utils/replyQuote.js +25 -2
- package/dist/utils/replyQuote.js.map +1 -1
- package/dist/utils/runnersScreenPlan.d.ts +51 -20
- package/dist/utils/runnersScreenPlan.d.ts.map +1 -1
- package/dist/utils/runnersScreenPlan.js +143 -28
- package/dist/utils/runnersScreenPlan.js.map +1 -1
- package/dist/utils/streamedCompactionSummary.d.ts +65 -0
- package/dist/utils/streamedCompactionSummary.d.ts.map +1 -0
- package/dist/utils/streamedCompactionSummary.js +108 -0
- package/dist/utils/streamedCompactionSummary.js.map +1 -0
- package/dist/utils/talkerAccess.d.ts +9 -0
- package/dist/utils/talkerAccess.d.ts.map +1 -0
- package/dist/utils/talkerAccess.js +20 -0
- package/dist/utils/talkerAccess.js.map +1 -0
- package/dist/utils/tmuxExec.d.ts +20 -8
- package/dist/utils/tmuxExec.d.ts.map +1 -1
- package/dist/utils/tmuxExec.js +27 -7
- package/dist/utils/tmuxExec.js.map +1 -1
- package/dist/utils/topicAccessScreenPlan.d.ts +253 -0
- package/dist/utils/topicAccessScreenPlan.d.ts.map +1 -0
- package/dist/utils/topicAccessScreenPlan.js +287 -0
- package/dist/utils/topicAccessScreenPlan.js.map +1 -0
- package/dist/utils/topicLabel.d.ts +12 -0
- package/dist/utils/topicLabel.d.ts.map +1 -0
- package/dist/utils/topicLabel.js +12 -0
- package/dist/utils/topicLabel.js.map +1 -0
- package/dist/utils/topicRequest.d.ts +8 -5
- package/dist/utils/topicRequest.d.ts.map +1 -1
- package/dist/utils/topicRequest.js +9 -7
- package/dist/utils/topicRequest.js.map +1 -1
- package/npm-shrinkwrap.json +1003 -0
- package/package.json +5 -3
- package/remoteRun/ensureNode.sh +288 -0
- package/remoteRun/runner.sh +2252 -115
- package/agent-plugin/skills/charness-manager/SKILL.md +0 -157
- package/remoteRun/pickNode.sh +0 -65
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import type { PueueActivity } from './pueueDaemon';
|
|
3
|
+
import { type NodeMoveDeps } from './managedNode';
|
|
4
|
+
import type { RunnerHomePaths } from './runnerHome';
|
|
5
|
+
/**
|
|
6
|
+
* @description Looking after the runner's own Node.js while the link is up — never before it, and never at the cost of a job:
|
|
7
|
+
*
|
|
8
|
+
* move a runner that runs on a system or Homebrew Node gets its own (`managedNode.ts`), as the account
|
|
9
|
+
* update a runner on its own Node asks for the newest release of its line, so it gets security fixes
|
|
10
|
+
* restart a Node that is newer or new is used by the launcher's NEXT start; the link leaves for that (exit {@link nodeMovedExitCode}) only when
|
|
11
|
+
* no command runs over it ({@link createIdleRestart}), as it does for an update of its program
|
|
12
|
+
* prune the folder of a version is removed only {@link nodeVersionGraceMs} after it stopped being the runner's Node (the moment is recorded) AND only while
|
|
13
|
+
* Pueue has no unfinished task: a job keeps the PATH it was queued with, and a process started through that PATH cannot be told from outside
|
|
14
|
+
* (macOS `ps` shows `node`, not where it lives). The work folders a killed install left are removed too
|
|
15
|
+
* failure an attempt that failed (no network, a full disk, a download that does not run here) is written down with the app copy it happened under;
|
|
16
|
+
* the next attempt is made {@link nodeMoveRetryMs} after the failure or after the next update of the program ({@link getNextLookDelayMs}) — never
|
|
17
|
+
* a download at every start
|
|
18
|
+
*
|
|
19
|
+
* The shared Node of an admin line (root-owned) is never touched here: only the next admin line refreshes it.
|
|
20
|
+
*/
|
|
21
|
+
/** How long a failed attempt is left alone (unless the program was updated since). */
|
|
22
|
+
export declare const nodeMoveRetryMs: number;
|
|
23
|
+
/** How long a version's folder stays after it stopped being the runner's Node: a job queued on it, or one that runs for days, still finds its `node` there. */
|
|
24
|
+
export declare const nodeVersionGraceMs: number;
|
|
25
|
+
declare const nodeFailureSchema: z.ZodObject<{
|
|
26
|
+
failedAtMs: z.ZodNumber;
|
|
27
|
+
appId: z.ZodNullable<z.ZodString>;
|
|
28
|
+
reason: z.ZodString;
|
|
29
|
+
}, z.core.$strict>;
|
|
30
|
+
/** @name NodeFailure @description `node-failure.json`. */
|
|
31
|
+
export type NodeFailure = z.infer<typeof nodeFailureSchema>;
|
|
32
|
+
/** @description The recorded failure, or `null` when there is none (or the file is not a valid record: it is then as good as none). */
|
|
33
|
+
export declare function readNodeFailure(paths: Pick<RunnerHomePaths, 'nodeFailure'>): NodeFailure | null;
|
|
34
|
+
/** @description Is an attempt to be made now? Not while a failure under the same app copy is younger than {@link nodeMoveRetryMs}. */
|
|
35
|
+
export declare function checkIsAttemptDue(failure: NodeFailure | null, appId: string | null, nowMs: number): boolean;
|
|
36
|
+
export interface PruneDeps {
|
|
37
|
+
now: () => number;
|
|
38
|
+
log: (line: string) => void;
|
|
39
|
+
/** What Pueue is doing: a job queued with the old PATH must not lose its Node, so anything unfinished — or an answer that could not be had — keeps the old versions. */
|
|
40
|
+
getPueueActivity: () => Promise<PueueActivity>;
|
|
41
|
+
}
|
|
42
|
+
/**
|
|
43
|
+
* @description Look after the version folders of `paths.ownNodeDir`. `current` are the folders (real paths) that are the runner's Node right now: they are stamped with the
|
|
44
|
+
* time of this look, and so is a folder seen for the first time (its grace starts then). A folder that is not current is removed only when its stamp is
|
|
45
|
+
* {@link nodeVersionGraceMs} old — and then only if Pueue has no unfinished task (a stuck one keeps it too, and the log names it). A stamp from the future (a clock that was
|
|
46
|
+
* wrong) counts as now. The work folders of installs that were killed (older than an hour: a fresh
|
|
47
|
+
* one is an install in progress) go always. Returns the names removed.
|
|
48
|
+
*/
|
|
49
|
+
export declare function pruneOwnNodes(paths: Pick<RunnerHomePaths, 'ownNodeDir' | 'nodeCurrent'>, current: readonly string[], deps: PruneDeps): Promise<string[]>;
|
|
50
|
+
/**
|
|
51
|
+
* @description Make the launcher start `runningNodePath`, the Node that runs this link — except when the launcher already names one of the runner's own Nodes
|
|
52
|
+
* while the link runs on another: that is a launcher process that was started before the runner moved (an update of the program restarts the app through the
|
|
53
|
+
* OLD launcher, whose Node is still the old one), and rewriting the file for the Node that happens to run would undo the move.
|
|
54
|
+
*/
|
|
55
|
+
export declare function ensureLauncherForRunningNode(paths: RunnerHomePaths, runningNodePath: string): void;
|
|
56
|
+
export interface NodeUpkeepResult {
|
|
57
|
+
/** `restart`: a Node is in place that the launcher now names and this link does not run on — the caller leaves for the launcher's new start when it is idle. */
|
|
58
|
+
step: 'restart' | 'stay';
|
|
59
|
+
/** When the next look is due, from now. */
|
|
60
|
+
nextLookInMs: number;
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* @description When the next look is due: `intervalMs` after a look that worked, but {@link nodeMoveRetryMs} after the FAILURE that is on record (plus a second for the
|
|
64
|
+
* timer's rounding) — a failure is written when the attempt ENDS, which can be minutes after it began, so a fixed interval from the start would find the retry
|
|
65
|
+
* not yet due and skip it, and the real retry would come a whole interval later. A failure recorded under another app copy is due at once.
|
|
66
|
+
*/
|
|
67
|
+
export declare function getNextLookDelayMs(failure: NodeFailure | null, appId: string | null, nowMs: number, intervalMs: number): number;
|
|
68
|
+
export interface NodeUpkeepDeps {
|
|
69
|
+
paths: RunnerHomePaths;
|
|
70
|
+
move: NodeMoveDeps;
|
|
71
|
+
/** Lines for the log (stderr) and for what the operator should see (stdout). */
|
|
72
|
+
log: (line: string) => void;
|
|
73
|
+
say: (line: string) => void;
|
|
74
|
+
now: () => number;
|
|
75
|
+
/** The app copy that runs (`app.<id>`); `null` when it cannot be read. */
|
|
76
|
+
getAppId: () => string | null;
|
|
77
|
+
getPueueActivity: () => Promise<PueueActivity>;
|
|
78
|
+
/** How often a look is made when nothing failed ({@link nodeUpkeepIntervalMs}, or a flow's shorter one). */
|
|
79
|
+
intervalMs: number;
|
|
80
|
+
environment: NodeJS.ProcessEnv;
|
|
81
|
+
}
|
|
82
|
+
/** What the log says about the end of a link's life under the old launcher: a service manager restarts it; a terminal run has to be started again by hand. */
|
|
83
|
+
export declare const restartHint = "a service manager starts the launcher again by itself; started from a terminal, start `charness-runner run` again";
|
|
84
|
+
/**
|
|
85
|
+
* @description One look after the Node.js of the runner (see the head of the file). `restart` when a Node is in place that the launcher now names and this link
|
|
86
|
+
* does not run on: the caller leaves for the launcher's new start when it is idle. Never throws.
|
|
87
|
+
*/
|
|
88
|
+
export declare function runNodeUpkeep(deps: NodeUpkeepDeps): Promise<NodeUpkeepResult>;
|
|
89
|
+
/**
|
|
90
|
+
* @description Run `look` now and then again when it says: each look is scheduled by the END of the one before it, so a failure — written when its attempt ENDS,
|
|
91
|
+
* minutes after the look began — is never found "not yet due" by a timer that was set when the look began. `look` returns the delay to the next one.
|
|
92
|
+
*/
|
|
93
|
+
export declare function startNodeUpkeepSchedule(look: () => Promise<number>, setTimer?: (callback: () => void, ms: number) => unknown): void;
|
|
94
|
+
/** How long a restart for a new Node waits for Pueue tasks that only wait for a person (paused, locked, queued in a paused group) IN ALL, from the restart's request: the old Node's folder is kept a week anyway. */
|
|
95
|
+
export declare const stuckPueueWaitMs: number;
|
|
96
|
+
/** @description The log line for what a restart for a new Node waits on (`isGivingUp` false), or stops waiting on after {@link stuckPueueWaitMs} in all (true): the day is the restart's own, not the task's. */
|
|
97
|
+
export declare function formatBlockerLine(description: string, isGivingUp: boolean): string;
|
|
98
|
+
export interface LinkIdleChecks {
|
|
99
|
+
getActiveExecCount: () => number;
|
|
100
|
+
/** Is an update of the program being installed? */
|
|
101
|
+
isUpdating: () => boolean;
|
|
102
|
+
getPueueActivity: () => Promise<PueueActivity>;
|
|
103
|
+
/** How long the restart has been waiting. */
|
|
104
|
+
waitedMs: number;
|
|
105
|
+
/** Told why the restart still waits (`isGivingUp` false), or that it stops waiting for a stuck task (`true`). */
|
|
106
|
+
onBlocked?: (description: string, isGivingUp: boolean) => void;
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* @description Is nothing under way that a restart of the link would cut or strand — no command over it, no update of the program being installed (its download
|
|
110
|
+
* and `npm ci` would be orphaned), and no Pueue task running or queued (a job queued with the old PATH keeps its Node)? A task that only waits for a person (paused,
|
|
111
|
+
* locked, queued in a paused group) is waited for {@link stuckPueueWaitMs} IN ALL — counted from the restart's request, not from when the task became stuck — and then left behind, with a word. The cheap questions come first, and they are asked AGAIN
|
|
112
|
+
* after Pueue has answered: a command or an update that began during that wait must not be cut.
|
|
113
|
+
*/
|
|
114
|
+
export declare function checkIsLinkIdle(checks: LinkIdleChecks): Promise<boolean>;
|
|
115
|
+
export interface IdleRestartDeps {
|
|
116
|
+
/** True when nothing a restart would cut is under way ({@link checkIsLinkIdle}); it is told how long the restart has waited. A check that fails counts as not idle. */
|
|
117
|
+
checkIsIdle: (waitedMs: number) => Promise<boolean>;
|
|
118
|
+
/** Ends the link so that the launcher starts again; called once. */
|
|
119
|
+
leave: () => void;
|
|
120
|
+
/** How long to wait before looking again while something is under way (Pueue tasks end without an event for the link). */
|
|
121
|
+
pollMs: number;
|
|
122
|
+
/** A timer for the next look (default: `setTimeout`, unref'd); a test's own. */
|
|
123
|
+
setTimer?: (callback: () => void, ms: number) => {
|
|
124
|
+
clear: () => void;
|
|
125
|
+
};
|
|
126
|
+
/** The clock (default `Date.now`); a test's own. */
|
|
127
|
+
now?: () => number;
|
|
128
|
+
}
|
|
129
|
+
export interface IdleRestart {
|
|
130
|
+
/** The launcher must start again on a new Node: leave as soon as nothing is under way. */
|
|
131
|
+
request: () => void;
|
|
132
|
+
/** Whether {@link IdleRestart.request} was called. */
|
|
133
|
+
isRequested: () => boolean;
|
|
134
|
+
/** Something that was under way may have ended (the last command, an update that settled): look at once. */
|
|
135
|
+
notifyChange: () => void;
|
|
136
|
+
}
|
|
137
|
+
/** @description The hand-over of a wanted restart to the moment nothing is under way (the way an update of the program waits for idleness). Looks again on a change and every `pollMs`. */
|
|
138
|
+
export declare function createIdleRestart(deps: IdleRestartDeps): IdleRestart;
|
|
139
|
+
export {};
|
|
140
|
+
//# sourceMappingURL=nodeUpkeep.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeUpkeep.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/nodeUpkeep.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,KAAK,EAAE,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(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.stuckPueueWaitMs = exports.restartHint = exports.nodeVersionGraceMs = exports.nodeMoveRetryMs = void 0;
|
|
37
|
+
exports.readNodeFailure = readNodeFailure;
|
|
38
|
+
exports.checkIsAttemptDue = checkIsAttemptDue;
|
|
39
|
+
exports.pruneOwnNodes = pruneOwnNodes;
|
|
40
|
+
exports.ensureLauncherForRunningNode = ensureLauncherForRunningNode;
|
|
41
|
+
exports.getNextLookDelayMs = getNextLookDelayMs;
|
|
42
|
+
exports.runNodeUpkeep = runNodeUpkeep;
|
|
43
|
+
exports.startNodeUpkeepSchedule = startNodeUpkeepSchedule;
|
|
44
|
+
exports.formatBlockerLine = formatBlockerLine;
|
|
45
|
+
exports.checkIsLinkIdle = checkIsLinkIdle;
|
|
46
|
+
exports.createIdleRestart = createIdleRestart;
|
|
47
|
+
const fs = __importStar(require("fs"));
|
|
48
|
+
const path = __importStar(require("path"));
|
|
49
|
+
const zod_1 = require("zod");
|
|
50
|
+
const configDirFile_1 = require("../configDirFile");
|
|
51
|
+
const launcher_1 = require("./launcher");
|
|
52
|
+
const managedNode_1 = require("./managedNode");
|
|
53
|
+
/**
|
|
54
|
+
* @description Looking after the runner's own Node.js while the link is up — never before it, and never at the cost of a job:
|
|
55
|
+
*
|
|
56
|
+
* move a runner that runs on a system or Homebrew Node gets its own (`managedNode.ts`), as the account
|
|
57
|
+
* update a runner on its own Node asks for the newest release of its line, so it gets security fixes
|
|
58
|
+
* restart a Node that is newer or new is used by the launcher's NEXT start; the link leaves for that (exit {@link nodeMovedExitCode}) only when
|
|
59
|
+
* no command runs over it ({@link createIdleRestart}), as it does for an update of its program
|
|
60
|
+
* prune the folder of a version is removed only {@link nodeVersionGraceMs} after it stopped being the runner's Node (the moment is recorded) AND only while
|
|
61
|
+
* Pueue has no unfinished task: a job keeps the PATH it was queued with, and a process started through that PATH cannot be told from outside
|
|
62
|
+
* (macOS `ps` shows `node`, not where it lives). The work folders a killed install left are removed too
|
|
63
|
+
* failure an attempt that failed (no network, a full disk, a download that does not run here) is written down with the app copy it happened under;
|
|
64
|
+
* the next attempt is made {@link nodeMoveRetryMs} after the failure or after the next update of the program ({@link getNextLookDelayMs}) — never
|
|
65
|
+
* a download at every start
|
|
66
|
+
*
|
|
67
|
+
* The shared Node of an admin line (root-owned) is never touched here: only the next admin line refreshes it.
|
|
68
|
+
*/
|
|
69
|
+
/** How long a failed attempt is left alone (unless the program was updated since). */
|
|
70
|
+
exports.nodeMoveRetryMs = 24 * 60 * 60 * 1000;
|
|
71
|
+
/** A work folder of an install that is older than this belongs to an install that was killed. */
|
|
72
|
+
const staleInstallMs = 60 * 60 * 1000;
|
|
73
|
+
/** How long a version's folder stays after it stopped being the runner's Node: a job queued on it, or one that runs for days, still finds its `node` there. */
|
|
74
|
+
exports.nodeVersionGraceMs = 7 * 24 * 60 * 60 * 1000;
|
|
75
|
+
/** A timer that fires a moment early (timers are rounded) must not find the retry not yet due. */
|
|
76
|
+
const retrySlackMs = 1000;
|
|
77
|
+
const recordFileMode = 0o600;
|
|
78
|
+
const failureFileMode = recordFileMode;
|
|
79
|
+
const installFolderPattern = /^v\d+\.\d+\.\d+$/;
|
|
80
|
+
const workFolderPrefix = '.install.';
|
|
81
|
+
const nodeFailureSchema = zod_1.z.strictObject({
|
|
82
|
+
failedAtMs: zod_1.z.number().int().nonnegative(),
|
|
83
|
+
/** The app copy (`app.<id>`) the link ran when it failed; another one means the program was updated since. */
|
|
84
|
+
appId: zod_1.z.string().nullable(),
|
|
85
|
+
reason: zod_1.z.string(),
|
|
86
|
+
});
|
|
87
|
+
/** @description The recorded failure, or `null` when there is none (or the file is not a valid record: it is then as good as none). */
|
|
88
|
+
function readNodeFailure(paths) {
|
|
89
|
+
try {
|
|
90
|
+
return nodeFailureSchema.parse(JSON.parse(fs.readFileSync(paths.nodeFailure, 'utf8')));
|
|
91
|
+
}
|
|
92
|
+
catch {
|
|
93
|
+
return null;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
function writeNodeFailure(paths, failure) {
|
|
97
|
+
if (failure === null)
|
|
98
|
+
fs.rmSync(paths.nodeFailure, { force: true });
|
|
99
|
+
else
|
|
100
|
+
(0, configDirFile_1.writeJsonFileAtomically)(paths.nodeFailure, nodeFailureSchema.parse(failure), failureFileMode);
|
|
101
|
+
}
|
|
102
|
+
/** @description Is an attempt to be made now? Not while a failure under the same app copy is younger than {@link nodeMoveRetryMs}. */
|
|
103
|
+
function checkIsAttemptDue(failure, appId, nowMs) {
|
|
104
|
+
return failure === null || failure.appId !== appId || nowMs - failure.failedAtMs >= exports.nodeMoveRetryMs;
|
|
105
|
+
}
|
|
106
|
+
/** When `target` was last changed, or `null` when it is gone (an install that finished while the folders were being looked at). */
|
|
107
|
+
function getModifiedAtMs(target) {
|
|
108
|
+
try {
|
|
109
|
+
return fs.statSync(target).mtimeMs;
|
|
110
|
+
}
|
|
111
|
+
catch {
|
|
112
|
+
return null;
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
const currentRecordSchema = zod_1.z.strictObject({
|
|
116
|
+
/** `v24.22.2` → when the folder was last the runner's Node (running, named by the launcher or just installed), or first seen. */
|
|
117
|
+
lastCurrentMs: zod_1.z.record(zod_1.z.string(), zod_1.z.number().int().nonnegative()),
|
|
118
|
+
});
|
|
119
|
+
function readLastCurrentMs(paths) {
|
|
120
|
+
try {
|
|
121
|
+
return currentRecordSchema.parse(JSON.parse(fs.readFileSync(paths.nodeCurrent, 'utf8'))).lastCurrentMs;
|
|
122
|
+
}
|
|
123
|
+
catch {
|
|
124
|
+
return {};
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* @description Look after the version folders of `paths.ownNodeDir`. `current` are the folders (real paths) that are the runner's Node right now: they are stamped with the
|
|
129
|
+
* time of this look, and so is a folder seen for the first time (its grace starts then). A folder that is not current is removed only when its stamp is
|
|
130
|
+
* {@link nodeVersionGraceMs} old — and then only if Pueue has no unfinished task (a stuck one keeps it too, and the log names it). A stamp from the future (a clock that was
|
|
131
|
+
* wrong) counts as now. The work folders of installs that were killed (older than an hour: a fresh
|
|
132
|
+
* one is an install in progress) go always. Returns the names removed.
|
|
133
|
+
*/
|
|
134
|
+
async function pruneOwnNodes(paths, current, deps) {
|
|
135
|
+
let ownDir;
|
|
136
|
+
let names;
|
|
137
|
+
try {
|
|
138
|
+
ownDir = fs.realpathSync(paths.ownNodeDir);
|
|
139
|
+
names = fs.readdirSync(ownDir);
|
|
140
|
+
}
|
|
141
|
+
catch {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
const removed = [];
|
|
145
|
+
const nowMs = deps.now();
|
|
146
|
+
for (const name of names.filter((candidate) => candidate.startsWith(workFolderPrefix))) {
|
|
147
|
+
const folder = path.join(ownDir, name);
|
|
148
|
+
if (nowMs - (getModifiedAtMs(folder) ?? nowMs) < staleInstallMs)
|
|
149
|
+
continue;
|
|
150
|
+
fs.rmSync(folder, { recursive: true, force: true });
|
|
151
|
+
removed.push(name);
|
|
152
|
+
deps.log(`removed the leftover of an interrupted Node.js install (${name})`);
|
|
153
|
+
}
|
|
154
|
+
const previous = readLastCurrentMs(paths);
|
|
155
|
+
const stamps = {};
|
|
156
|
+
const versions = names.filter((name) => installFolderPattern.test(name));
|
|
157
|
+
for (const name of versions)
|
|
158
|
+
stamps[name] = current.includes(path.join(ownDir, name)) ? nowMs : Math.min(previous[name] ?? nowMs, nowMs);
|
|
159
|
+
const expired = versions.filter((name) => !current.includes(path.join(ownDir, name)) && nowMs - stamps[name] >= exports.nodeVersionGraceMs);
|
|
160
|
+
const activity = expired.length > 0 ? await deps.getPueueActivity() : { kind: 'idle' };
|
|
161
|
+
if (activity.kind !== 'idle') {
|
|
162
|
+
deps.log(`keeps ${expired.map((name) => name.slice(1)).join(', ')}: Node.js version(s) the runner left more than ${exports.nodeVersionGraceMs / 86_400_000} days ago, while Pueue has ${activity.description}`);
|
|
163
|
+
}
|
|
164
|
+
else {
|
|
165
|
+
for (const name of expired) {
|
|
166
|
+
fs.rmSync(path.join(ownDir, name), { recursive: true, force: true });
|
|
167
|
+
delete stamps[name];
|
|
168
|
+
removed.push(name);
|
|
169
|
+
deps.log(`removed Node.js ${name.slice(1)}, which the runner left more than ${exports.nodeVersionGraceMs / 86_400_000} days ago`);
|
|
170
|
+
}
|
|
171
|
+
}
|
|
172
|
+
(0, configDirFile_1.writeJsonFileAtomically)(paths.nodeCurrent, currentRecordSchema.parse({ lastCurrentMs: stamps }), recordFileMode);
|
|
173
|
+
return removed;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* @description Make the launcher start `runningNodePath`, the Node that runs this link — except when the launcher already names one of the runner's own Nodes
|
|
177
|
+
* while the link runs on another: that is a launcher process that was started before the runner moved (an update of the program restarts the app through the
|
|
178
|
+
* OLD launcher, whose Node is still the old one), and rewriting the file for the Node that happens to run would undo the move.
|
|
179
|
+
*/
|
|
180
|
+
function ensureLauncherForRunningNode(paths, runningNodePath) {
|
|
181
|
+
const named = (0, launcher_1.readLauncherNodePath)(paths);
|
|
182
|
+
const isNamingOwnNode = named !== null && (0, managedNode_1.checkIsManagedNode)(named, paths) && !(0, managedNode_1.checkIsManagedNode)(runningNodePath, paths);
|
|
183
|
+
if (!isNamingOwnNode)
|
|
184
|
+
(0, launcher_1.ensureLauncher)(paths, runningNodePath);
|
|
185
|
+
}
|
|
186
|
+
/**
|
|
187
|
+
* @description When the next look is due: `intervalMs` after a look that worked, but {@link nodeMoveRetryMs} after the FAILURE that is on record (plus a second for the
|
|
188
|
+
* timer's rounding) — a failure is written when the attempt ENDS, which can be minutes after it began, so a fixed interval from the start would find the retry
|
|
189
|
+
* not yet due and skip it, and the real retry would come a whole interval later. A failure recorded under another app copy is due at once.
|
|
190
|
+
*/
|
|
191
|
+
function getNextLookDelayMs(failure, appId, nowMs, intervalMs) {
|
|
192
|
+
if (failure === null || failure.appId !== appId)
|
|
193
|
+
return intervalMs;
|
|
194
|
+
const untilDueMs = failure.failedAtMs + exports.nodeMoveRetryMs - nowMs;
|
|
195
|
+
return untilDueMs <= 0 ? intervalMs : untilDueMs + retrySlackMs;
|
|
196
|
+
}
|
|
197
|
+
/** What the log says about the end of a link's life under the old launcher: a service manager restarts it; a terminal run has to be started again by hand. */
|
|
198
|
+
exports.restartHint = 'a service manager starts the launcher again by itself; started from a terminal, start `charness-runner run` again';
|
|
199
|
+
/**
|
|
200
|
+
* @description One look after the Node.js of the runner (see the head of the file). `restart` when a Node is in place that the launcher now names and this link
|
|
201
|
+
* does not run on: the caller leaves for the launcher's new start when it is idle. Never throws.
|
|
202
|
+
*/
|
|
203
|
+
async function runNodeUpkeep(deps) {
|
|
204
|
+
const { paths, move } = deps;
|
|
205
|
+
const stay = () => ({ step: 'stay', nextLookInMs: getNextLookDelayMs(readNodeFailure(paths), deps.getAppId(), deps.now(), deps.intervalMs) });
|
|
206
|
+
if (deps.environment[managedNode_1.testKeepNodeEnvName] === '1')
|
|
207
|
+
return stay();
|
|
208
|
+
const failure = readNodeFailure(paths);
|
|
209
|
+
if (!checkIsAttemptDue(failure, deps.getAppId(), deps.now())) {
|
|
210
|
+
deps.log(`this runner's last attempt to get a Node.js of its own (or a newer one) failed — ${failure?.reason ?? 'no reason recorded'} — and is tried again after 24 hours or the next update of the program`);
|
|
211
|
+
return stay();
|
|
212
|
+
}
|
|
213
|
+
const outcome = await (0, managedNode_1.ensureOwnNode)(paths, move);
|
|
214
|
+
if (outcome.kind === 'failed') {
|
|
215
|
+
writeNodeFailure(paths, { failedAtMs: deps.now(), appId: deps.getAppId(), reason: outcome.reason });
|
|
216
|
+
deps.log(`this runner runs on ${(0, managedNode_1.describeNode)(move.currentNodePath, move.currentNodeVersion)} and could not get a Node.js of its own or a newer one: ${outcome.reason}. It tries again after 24 hours or the next update of the program.`);
|
|
217
|
+
return stay();
|
|
218
|
+
}
|
|
219
|
+
writeNodeFailure(paths, null);
|
|
220
|
+
let step = 'stay';
|
|
221
|
+
if (outcome.kind === 'installed') {
|
|
222
|
+
if (outcome.log !== '')
|
|
223
|
+
deps.log(outcome.log);
|
|
224
|
+
if ((0, launcher_1.checkLauncherIsFor)(paths, outcome.nodePath)) {
|
|
225
|
+
deps.log(`the launcher already names ${outcome.nodePath}, but this link still runs on ${(0, managedNode_1.describeNode)(move.currentNodePath, move.currentNodeVersion)}: start the launcher again to use it`);
|
|
226
|
+
}
|
|
227
|
+
else {
|
|
228
|
+
(0, launcher_1.ensureLauncher)(paths, outcome.nodePath);
|
|
229
|
+
const leaving = (0, managedNode_1.describeNode)(move.currentNodePath, move.currentNodeVersion);
|
|
230
|
+
const arriving = (0, managedNode_1.describeNode)(outcome.nodePath, (0, managedNode_1.getInstalledVersion)(outcome.nodePath));
|
|
231
|
+
deps.say(outcome.isMove
|
|
232
|
+
? `charness-runner: this runner now has its own ${arriving} and leaves ${leaving}: jobs will run the new one (to keep them on the old one, see «A runner's Node» in docs/remote-run.md); the link starts again on it when no command, app update or Pueue task is under way — ${exports.restartHint}`
|
|
233
|
+
: `charness-runner: a newer release of this runner's own Node.js is in place: ${arriving}, replacing ${leaving}; the link starts again on it when no command, app update or Pueue task is under way — ${exports.restartHint}`);
|
|
234
|
+
step = 'restart';
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
// Current right now: the Node this link runs on, the one the launcher names (after the rewrite above) and the new one — each stamped, so it is the OLD ones that age.
|
|
238
|
+
const current = [(0, managedNode_1.getOwnInstallFolder)(move.currentNodePath, paths), outcome.kind === 'installed' ? (0, managedNode_1.getOwnInstallFolder)(outcome.nodePath, paths) : null, ...getLauncherInstallFolder(paths)]
|
|
239
|
+
.filter((folder) => folder !== null);
|
|
240
|
+
// The Node is in place and the launcher names it: whatever goes wrong while old versions are looked after (a full disk for the record, a folder that cannot be removed) must not take the restart away.
|
|
241
|
+
try {
|
|
242
|
+
await pruneOwnNodes(paths, current, { now: deps.now, log: (line) => { deps.log(line); }, getPueueActivity: deps.getPueueActivity });
|
|
243
|
+
}
|
|
244
|
+
catch (error) {
|
|
245
|
+
deps.log(`could not look after the old Node.js versions (${error instanceof Error ? error.message : 'unknown error'}); the restart for the new Node does not wait for that`);
|
|
246
|
+
}
|
|
247
|
+
return { step, nextLookInMs: deps.intervalMs };
|
|
248
|
+
}
|
|
249
|
+
/** The version folder of the Node the launcher on disk names, as a list of zero or one folder (a launcher that names a Node outside the runner's folder keeps nothing). */
|
|
250
|
+
function getLauncherInstallFolder(paths) {
|
|
251
|
+
const named = (0, launcher_1.readLauncherNodePath)(paths);
|
|
252
|
+
const folder = named === null ? null : (0, managedNode_1.getOwnInstallFolder)(named, paths);
|
|
253
|
+
return folder === null ? [] : [folder];
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* @description Run `look` now and then again when it says: each look is scheduled by the END of the one before it, so a failure — written when its attempt ENDS,
|
|
257
|
+
* minutes after the look began — is never found "not yet due" by a timer that was set when the look began. `look` returns the delay to the next one.
|
|
258
|
+
*/
|
|
259
|
+
function startNodeUpkeepSchedule(look, setTimer = setUnrefTimer) {
|
|
260
|
+
const run = async () => {
|
|
261
|
+
const nextLookInMs = await look();
|
|
262
|
+
setTimer(() => { void run(); }, nextLookInMs);
|
|
263
|
+
};
|
|
264
|
+
void run();
|
|
265
|
+
}
|
|
266
|
+
/** How long a restart for a new Node waits for Pueue tasks that only wait for a person (paused, locked, queued in a paused group) IN ALL, from the restart's request: the old Node's folder is kept a week anyway. */
|
|
267
|
+
exports.stuckPueueWaitMs = 24 * 60 * 60 * 1000;
|
|
268
|
+
/** @description The log line for what a restart for a new Node waits on (`isGivingUp` false), or stops waiting on after {@link stuckPueueWaitMs} in all (true): the day is the restart's own, not the task's. */
|
|
269
|
+
function formatBlockerLine(description, isGivingUp) {
|
|
270
|
+
return isGivingUp
|
|
271
|
+
? `the restart has waited a day for Pueue: the link leaves for the new Node.js without waiting for ${description} any longer (the old Node.js's folder is kept for a week)`
|
|
272
|
+
: `the link will start again on the new Node.js when Pueue is done with ${description}`;
|
|
273
|
+
}
|
|
274
|
+
/**
|
|
275
|
+
* @description Is nothing under way that a restart of the link would cut or strand — no command over it, no update of the program being installed (its download
|
|
276
|
+
* and `npm ci` would be orphaned), and no Pueue task running or queued (a job queued with the old PATH keeps its Node)? A task that only waits for a person (paused,
|
|
277
|
+
* locked, queued in a paused group) is waited for {@link stuckPueueWaitMs} IN ALL — counted from the restart's request, not from when the task became stuck — and then left behind, with a word. The cheap questions come first, and they are asked AGAIN
|
|
278
|
+
* after Pueue has answered: a command or an update that began during that wait must not be cut.
|
|
279
|
+
*/
|
|
280
|
+
async function checkIsLinkIdle(checks) {
|
|
281
|
+
const isQuiet = () => checks.getActiveExecCount() === 0 && !checks.isUpdating();
|
|
282
|
+
if (!isQuiet())
|
|
283
|
+
return false;
|
|
284
|
+
const activity = await checks.getPueueActivity();
|
|
285
|
+
if (!isQuiet())
|
|
286
|
+
return false;
|
|
287
|
+
if (activity.kind === 'idle')
|
|
288
|
+
return true;
|
|
289
|
+
const isGivingUp = activity.kind === 'stuck' && checks.waitedMs >= exports.stuckPueueWaitMs;
|
|
290
|
+
checks.onBlocked?.(activity.description, isGivingUp);
|
|
291
|
+
return isGivingUp;
|
|
292
|
+
}
|
|
293
|
+
function setUnrefTimer(callback, ms) {
|
|
294
|
+
const timer = setTimeout(callback, ms);
|
|
295
|
+
timer.unref();
|
|
296
|
+
return { clear: () => { clearTimeout(timer); } };
|
|
297
|
+
}
|
|
298
|
+
/** @description The hand-over of a wanted restart to the moment nothing is under way (the way an update of the program waits for idleness). Looks again on a change and every `pollMs`. */
|
|
299
|
+
function createIdleRestart(deps) {
|
|
300
|
+
const setTimer = deps.setTimer ?? setUnrefTimer;
|
|
301
|
+
const now = deps.now ?? Date.now;
|
|
302
|
+
let requestedAtMs = 0;
|
|
303
|
+
let isRequested = false;
|
|
304
|
+
let hasLeft = false;
|
|
305
|
+
let isChecking = false;
|
|
306
|
+
let isLookAgainWanted = false;
|
|
307
|
+
let timer = null;
|
|
308
|
+
const look = async () => {
|
|
309
|
+
if (!isRequested || hasLeft)
|
|
310
|
+
return;
|
|
311
|
+
if (isChecking) {
|
|
312
|
+
isLookAgainWanted = true;
|
|
313
|
+
return;
|
|
314
|
+
}
|
|
315
|
+
isChecking = true;
|
|
316
|
+
try {
|
|
317
|
+
let isIdle = false;
|
|
318
|
+
// A change that arrived while the check ran may have made its answer stale — whatever the answer was, the check is made again (an "idle" that began before a command did is not idle).
|
|
319
|
+
do {
|
|
320
|
+
isLookAgainWanted = false;
|
|
321
|
+
timer?.clear();
|
|
322
|
+
timer = null;
|
|
323
|
+
isIdle = await deps.checkIsIdle(now() - requestedAtMs).catch(() => false);
|
|
324
|
+
} while (isLookAgainWanted);
|
|
325
|
+
if (isIdle) {
|
|
326
|
+
hasLeft = true;
|
|
327
|
+
deps.leave();
|
|
328
|
+
}
|
|
329
|
+
else {
|
|
330
|
+
timer = setTimer(() => { timer = null; void look(); }, deps.pollMs);
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
finally {
|
|
334
|
+
isChecking = false;
|
|
335
|
+
}
|
|
336
|
+
};
|
|
337
|
+
return {
|
|
338
|
+
request: () => {
|
|
339
|
+
if (!isRequested)
|
|
340
|
+
requestedAtMs = now();
|
|
341
|
+
isRequested = true;
|
|
342
|
+
void look();
|
|
343
|
+
},
|
|
344
|
+
isRequested: () => isRequested,
|
|
345
|
+
notifyChange: () => { void look(); },
|
|
346
|
+
};
|
|
347
|
+
}
|
|
348
|
+
//# sourceMappingURL=nodeUpkeep.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeUpkeep.js","sourceRoot":"","sources":["../../src/runnerUtility/nodeUpkeep.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAiDA,0CAMC;AAQD,8CAEC;AAsCD,sCAoCC;AAOD,oEAIC;AAcD,gDAIC;AAwBD,sCAyCC;AAaD,0DAMC;AAMD,8CAIC;AAmBD,0CASC;AA+BD,8CA4CC;AA7WD,uCAAyB;AACzB,2CAA6B;AAC7B,6BAAwB;AACxB,oDAA2D;AAC3D,yCAAsF;AAEtF,+CAAkK;AAGlK;;;;;;;;;;;;;;;GAeG;AAEH,sFAAsF;AACzE,QAAA,eAAe,GAAG,EAAE,GAAG,EAAE,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ACd,CAAC;QACD,WAAW,EAAE,GAAG,EAAE,CAAC,WAAW;QAC9B,YAAY,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,EAAE,CAAC,CAAC,CAAC;KACrC,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description How often a linked runner looks after its own Node.js again (a newer release of its line; `nodeUpkeep.ts`) after the look it makes when its
|
|
3
|
+
* link starts. In a module of its own so the runner utility reads it without loading the bot.
|
|
4
|
+
*
|
|
5
|
+
* The test seam `CHARNESS_TEST_TIMINGS` (`testTimings.ts`) may only SHORTEN it (key `runnerNodeUpkeepMs`); it is read through `testTimingsSeam.ts`, because this
|
|
6
|
+
* module cannot import `testTimings.ts` (its graph reaches the bot).
|
|
7
|
+
*/
|
|
8
|
+
/** Production: once a day. */
|
|
9
|
+
export declare const nodeUpkeepIntervalMs: number;
|
|
10
|
+
/** A shorter look than this is a request loop, not a check. */
|
|
11
|
+
export declare const nodeUpkeepMinMs = 1000;
|
|
12
|
+
/** @description The interval in force: the production one, or the seam's shorter `runnerNodeUpkeepMs` when it is a whole number of ms within [min, production]. */
|
|
13
|
+
export declare function readNodeUpkeepIntervalMs(env: NodeJS.ProcessEnv): number;
|
|
14
|
+
//# sourceMappingURL=nodeUpkeepTiming.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeUpkeepTiming.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/nodeUpkeepTiming.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAIH,8BAA8B;AAC9B,eAAO,MAAM,oBAAoB,QAAsB,CAAC;AACxD,+DAA+D;AAC/D,eAAO,MAAM,eAAe,OAAO,CAAC;AAEpC,mKAAmK;AACnK,wBAAgB,wBAAwB,CAAC,GAAG,EAAE,MAAM,CAAC,UAAU,GAAG,MAAM,CAEvE"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* @description How often a linked runner looks after its own Node.js again (a newer release of its line; `nodeUpkeep.ts`) after the look it makes when its
|
|
4
|
+
* link starts. In a module of its own so the runner utility reads it without loading the bot.
|
|
5
|
+
*
|
|
6
|
+
* The test seam `CHARNESS_TEST_TIMINGS` (`testTimings.ts`) may only SHORTEN it (key `runnerNodeUpkeepMs`); it is read through `testTimingsSeam.ts`, because this
|
|
7
|
+
* module cannot import `testTimings.ts` (its graph reaches the bot).
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.nodeUpkeepMinMs = exports.nodeUpkeepIntervalMs = void 0;
|
|
11
|
+
exports.readNodeUpkeepIntervalMs = readNodeUpkeepIntervalMs;
|
|
12
|
+
const testTimingsSeam_1 = require("../testTimingsSeam");
|
|
13
|
+
/** Production: once a day. */
|
|
14
|
+
exports.nodeUpkeepIntervalMs = 24 * 60 * 60 * 1000;
|
|
15
|
+
/** A shorter look than this is a request loop, not a check. */
|
|
16
|
+
exports.nodeUpkeepMinMs = 1000;
|
|
17
|
+
/** @description The interval in force: the production one, or the seam's shorter `runnerNodeUpkeepMs` when it is a whole number of ms within [min, production]. */
|
|
18
|
+
function readNodeUpkeepIntervalMs(env) {
|
|
19
|
+
return (0, testTimingsSeam_1.readShorterTestWindowMs)(env, 'runnerNodeUpkeepMs', exports.nodeUpkeepIntervalMs, exports.nodeUpkeepMinMs);
|
|
20
|
+
}
|
|
21
|
+
//# sourceMappingURL=nodeUpkeepTiming.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"nodeUpkeepTiming.js","sourceRoot":"","sources":["../../src/runnerUtility/nodeUpkeepTiming.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;AAUH,4DAEC;AAVD,wDAA6D;AAE7D,8BAA8B;AACjB,QAAA,oBAAoB,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACxD,+DAA+D;AAClD,QAAA,eAAe,GAAG,IAAI,CAAC;AAEpC,mKAAmK;AACnK,SAAgB,wBAAwB,CAAC,GAAsB;IAC7D,OAAO,IAAA,yCAAuB,EAAC,GAAG,EAAE,oBAAoB,EAAE,4BAAoB,EAAE,uBAAe,CAAC,CAAC;AACnG,CAAC"}
|
|
@@ -11,6 +11,11 @@ import type { RunnerHomePaths } from './runnerHome';
|
|
|
11
11
|
* first runs the manager); a shim made earlier for a manager that is now offered by the Node or the system is removed again, so a Node's own
|
|
12
12
|
* `yarn` is never shadowed by a stale one. A Node without Corepack (25 and later) cannot be helped: the manager is reported as missing, with
|
|
13
13
|
* the way out, and `charness remote-run runners` shows it.
|
|
14
|
+
*
|
|
15
|
+
* The Node's own folder is one the account cannot write (the runner's Node is the shared one, owned by root), and a bare `corepack enable` — what a
|
|
16
|
+
* project's install step runs — writes its shims right there and fails. So `<root>/bin` also gets a `corepack` wrapper, first on a job's PATH: it hands
|
|
17
|
+
* `enable` / `disable` the same `--install-directory <root>/bin` when the job named none, and passes everything else through. Its cache is
|
|
18
|
+
* `COREPACK_HOME` (`execEnv.ts`), also the account's.
|
|
14
19
|
*/
|
|
15
20
|
export declare const jobPackageManagers: readonly ["yarn", "pnpm"];
|
|
16
21
|
export type JobPackageManager = (typeof jobPackageManagers)[number];
|
|
@@ -37,6 +42,11 @@ export interface ShimDeps {
|
|
|
37
42
|
checkIsExecutable: (candidate: string) => boolean;
|
|
38
43
|
}
|
|
39
44
|
export declare function createShimDeps(): ShimDeps;
|
|
45
|
+
/**
|
|
46
|
+
* @description The `corepack` wrapper for `<root>/bin` (see the head of the file): `enable` and `disable` get `--install-directory` unless the job gave one.
|
|
47
|
+
* The real Corepack and the folder are single-quoted into the text; nothing else varies.
|
|
48
|
+
*/
|
|
49
|
+
export declare function renderCorepackWrapper(realCorepack: string, installDirectory: string): string;
|
|
40
50
|
/** @description Make the job PATH offer `yarn` and `pnpm` where a Corepack is at hand; never throws — what cannot be done is a `missing` outcome with its reason. */
|
|
41
51
|
export declare function ensurePackageManagerShims(paths: RunnerHomePaths, deps: ShimDeps): Promise<ShimOutcome[]>;
|
|
42
52
|
/** @description One line: what the job PATH offers of each manager, and for a missing one why. */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"packageManagerShims.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/packageManagerShims.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"packageManagerShims.d.ts","sourceRoot":"","sources":["../../src/runnerUtility/packageManagerShims.ts"],"names":[],"mappings":"AAGA,OAAO,EAAc,KAAK,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAI7E,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAEpD;;;;;;;;;;;;;;;;GAgBG;AAEH,eAAO,MAAM,kBAAkB,2BAA4B,CAAC;AAC5D,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAQpE,2KAA2K;AAC3K,MAAM,MAAM,WAAW,GACnB;IAAE,OAAO,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,GAC/D;IAAE,OAAO,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,MAAM,CAAA;CAAE,GAC5C;IAAE,OAAO,EAAE,iBAAiB,CAAC;IAAC,IAAI,EAAE,SAAS,CAAC;IAAC,MAAM,EAAE,MAAM,CAAA;CAAE,CAAC;AAEpE,MAAM,WAAW,QAAQ;IACvB,MAAM,EAAE,aAAa,CAAC;IACtB,wHAAwH;IACxH,OAAO,EAAE,MAAM,CAAC;IAChB,4GAA4G;IAC5G,WAAW,EAAE,MAAM,CAAC,UAAU,CAAC;IAC/B,kDAAkD;IAClD,iBAAiB,EAAE,CAAC,SAAS,EAAE,MAAM,KAAK,OAAO,CAAC;CACnD;AAED,wBAAgB,cAAc,IAAI,QAAQ,CAczC;AAWD;;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