charness 3.6.0 → 3.7.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 +274 -0
- package/DEVELOPMENT.md +31 -5
- package/MIGRATION_RENAME_TO_CHARNESS.md +3 -2
- package/README.md +84 -782
- package/SETUP.md +37 -10
- package/agent-plugin/.claude-plugin/plugin.json +7 -0
- package/agent-plugin/README.md +35 -0
- package/agent-plugin/skills/charness-delegate-claude/SKILL.md +85 -0
- package/agent-plugin/skills/charness-delegate-claude/summarize-events.py +90 -0
- package/agent-plugin/skills/charness-delegate-opencode/SKILL.md +68 -0
- package/agent-plugin/skills/charness-manager/SKILL.md +152 -0
- package/dist/adapters/adapterNames.d.ts +6 -0
- package/dist/adapters/adapterNames.d.ts.map +1 -1
- package/dist/adapters/adapterNames.js +8 -2
- package/dist/adapters/adapterNames.js.map +1 -1
- package/dist/adapters/claudeCliAdapter.d.ts +8 -0
- package/dist/adapters/claudeCliAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeCliAdapter.js +42 -5
- package/dist/adapters/claudeCliAdapter.js.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.d.ts +10 -9
- package/dist/adapters/claudeJsonStreamAdapter.d.ts.map +1 -1
- package/dist/adapters/claudeJsonStreamAdapter.js +53 -55
- package/dist/adapters/claudeJsonStreamAdapter.js.map +1 -1
- package/dist/adapters/createAdapter.d.ts +8 -0
- package/dist/adapters/createAdapter.d.ts.map +1 -1
- package/dist/adapters/createAdapter.js +14 -2
- package/dist/adapters/createAdapter.js.map +1 -1
- package/dist/adapters/openCodeAdapter.d.ts +43 -6
- package/dist/adapters/openCodeAdapter.d.ts.map +1 -1
- package/dist/adapters/openCodeAdapter.js +95 -6
- package/dist/adapters/openCodeAdapter.js.map +1 -1
- package/dist/agentLogin/agentLogin.d.ts +1 -1
- package/dist/agentLogin/agentLogin.d.ts.map +1 -1
- package/dist/apiRetryKick.d.ts +4 -3
- package/dist/apiRetryKick.d.ts.map +1 -1
- package/dist/apiRetryKick.js +16 -9
- package/dist/apiRetryKick.js.map +1 -1
- package/dist/bot.d.ts.map +1 -1
- package/dist/bot.js +1313 -381
- package/dist/bot.js.map +1 -1
- package/dist/cli/claudeProfiles.d.ts +11 -6
- package/dist/cli/claudeProfiles.d.ts.map +1 -1
- package/dist/cli/claudeProfiles.js +50 -22
- package/dist/cli/claudeProfiles.js.map +1 -1
- package/dist/cli/hot.d.ts +5 -0
- package/dist/cli/hot.d.ts.map +1 -1
- package/dist/cli/hot.js +71 -25
- package/dist/cli/hot.js.map +1 -1
- package/dist/cli/tscWatchGuard.d.ts +95 -0
- package/dist/cli/tscWatchGuard.d.ts.map +1 -0
- package/dist/cli/tscWatchGuard.js +295 -0
- package/dist/cli/tscWatchGuard.js.map +1 -0
- package/dist/cli.js +12 -1
- package/dist/cli.js.map +1 -1
- package/dist/connectors/jira/answerSink.d.ts +10 -0
- package/dist/connectors/jira/answerSink.d.ts.map +1 -1
- package/dist/connectors/jira/answerSink.js +13 -0
- package/dist/connectors/jira/answerSink.js.map +1 -1
- package/dist/connectors/jira/config.d.ts +2 -0
- package/dist/connectors/jira/config.d.ts.map +1 -1
- package/dist/connectors/jira/config.js +9 -1
- package/dist/connectors/jira/config.js.map +1 -1
- package/dist/connectors/jira/connector.d.ts +11 -1
- package/dist/connectors/jira/connector.d.ts.map +1 -1
- package/dist/connectors/jira/connector.js +13 -1
- package/dist/connectors/jira/connector.js.map +1 -1
- package/dist/connectors/jira/inbound.d.ts +29 -4
- package/dist/connectors/jira/inbound.d.ts.map +1 -1
- package/dist/connectors/jira/inbound.js +71 -8
- package/dist/connectors/jira/inbound.js.map +1 -1
- package/dist/connectors/jira/issueBlocks.d.ts +5 -0
- package/dist/connectors/jira/issueBlocks.d.ts.map +1 -1
- package/dist/connectors/jira/issueBlocks.js +11 -0
- package/dist/connectors/jira/issueBlocks.js.map +1 -1
- package/dist/connectors/jira/prompt.d.ts +4 -0
- package/dist/connectors/jira/prompt.d.ts.map +1 -1
- package/dist/connectors/jira/prompt.js +11 -2
- package/dist/connectors/jira/prompt.js.map +1 -1
- package/dist/connectors/telegram/bindPicker.d.ts +5 -0
- package/dist/connectors/telegram/bindPicker.d.ts.map +1 -1
- package/dist/connectors/telegram/bindPicker.js +18 -1
- package/dist/connectors/telegram/bindPicker.js.map +1 -1
- package/dist/connectors/telegram/bindPickerClaims.d.ts +46 -0
- package/dist/connectors/telegram/bindPickerClaims.d.ts.map +1 -0
- package/dist/connectors/telegram/bindPickerClaims.js +83 -0
- package/dist/connectors/telegram/bindPickerClaims.js.map +1 -0
- package/dist/connectors/telegram/bindSweep.d.ts +32 -0
- package/dist/connectors/telegram/bindSweep.d.ts.map +1 -0
- package/dist/connectors/telegram/bindSweep.js +47 -0
- package/dist/connectors/telegram/bindSweep.js.map +1 -0
- package/dist/connectors/telegram/bindingWelcome.d.ts +23 -0
- package/dist/connectors/telegram/bindingWelcome.d.ts.map +1 -0
- package/dist/connectors/telegram/bindingWelcome.js +26 -0
- package/dist/connectors/telegram/bindingWelcome.js.map +1 -0
- package/dist/connectors/telegram/botApiConnection.d.ts +74 -0
- package/dist/connectors/telegram/botApiConnection.d.ts.map +1 -0
- package/dist/connectors/telegram/botApiConnection.js +201 -0
- package/dist/connectors/telegram/botApiConnection.js.map +1 -0
- package/dist/connectors/telegram/commands/botCore.d.ts +8 -2
- package/dist/connectors/telegram/commands/botCore.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/botSkills.d.ts +21 -0
- package/dist/connectors/telegram/commands/botSkills.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/botSkills.js +133 -0
- package/dist/connectors/telegram/commands/botSkills.js.map +1 -0
- package/dist/connectors/telegram/commands/callbackMessage.d.ts +5 -0
- package/dist/connectors/telegram/commands/callbackMessage.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/callbackMessage.js +9 -0
- package/dist/connectors/telegram/commands/callbackMessage.js.map +1 -1
- package/dist/connectors/telegram/commands/compaction.d.ts +65 -3
- package/dist/connectors/telegram/commands/compaction.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/compaction.js +512 -94
- package/dist/connectors/telegram/commands/compaction.js.map +1 -1
- package/dist/connectors/telegram/commands/displayModes.d.ts +1 -1
- package/dist/connectors/telegram/commands/displayModes.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/displayModes.js +6 -18
- package/dist/connectors/telegram/commands/displayModes.js.map +1 -1
- package/dist/connectors/telegram/commands/fallbackChain.js +5 -5
- package/dist/connectors/telegram/commands/fallbackChain.js.map +1 -1
- package/dist/connectors/telegram/commands/reminders.d.ts +1 -1
- package/dist/connectors/telegram/commands/reminders.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/reminders.js +4 -15
- package/dist/connectors/telegram/commands/reminders.js.map +1 -1
- package/dist/connectors/telegram/commands/selfUpdate.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/selfUpdate.js +1 -11
- package/dist/connectors/telegram/commands/selfUpdate.js.map +1 -1
- package/dist/connectors/telegram/commands/taskAgents.d.ts +22 -0
- package/dist/connectors/telegram/commands/taskAgents.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/taskAgents.js +104 -0
- package/dist/connectors/telegram/commands/taskAgents.js.map +1 -0
- package/dist/connectors/telegram/commands/todo.d.ts +82 -0
- package/dist/connectors/telegram/commands/todo.d.ts.map +1 -0
- package/dist/connectors/telegram/commands/todo.js +384 -0
- package/dist/connectors/telegram/commands/todo.js.map +1 -0
- package/dist/connectors/telegram/commands/topicCommand.d.ts +6 -2
- package/dist/connectors/telegram/commands/topicCommand.d.ts.map +1 -1
- package/dist/connectors/telegram/commands/topicCommand.js +6 -9
- package/dist/connectors/telegram/commands/topicCommand.js.map +1 -1
- package/dist/connectors/telegram/openBindMessages.d.ts +45 -0
- package/dist/connectors/telegram/openBindMessages.d.ts.map +1 -0
- package/dist/connectors/telegram/openBindMessages.js +67 -0
- package/dist/connectors/telegram/openBindMessages.js.map +1 -0
- package/dist/connectors/telegram/outputFlushPlan.d.ts +49 -0
- package/dist/connectors/telegram/outputFlushPlan.d.ts.map +1 -1
- package/dist/connectors/telegram/outputFlushPlan.js +46 -0
- package/dist/connectors/telegram/outputFlushPlan.js.map +1 -1
- package/dist/connectors/telegram/pendingTopicName.d.ts +26 -0
- package/dist/connectors/telegram/pendingTopicName.d.ts.map +1 -0
- package/dist/connectors/telegram/pendingTopicName.js +27 -0
- package/dist/connectors/telegram/pendingTopicName.js.map +1 -0
- package/dist/connectors/test/connector.d.ts.map +1 -1
- package/dist/connectors/test/connector.js +6 -1
- package/dist/connectors/test/connector.js.map +1 -1
- package/dist/i18n/de.d.ts.map +1 -1
- package/dist/i18n/de.js +90 -7
- package/dist/i18n/de.js.map +1 -1
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +90 -7
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/es.d.ts.map +1 -1
- package/dist/i18n/es.js +90 -7
- package/dist/i18n/es.js.map +1 -1
- package/dist/i18n/fr.d.ts.map +1 -1
- package/dist/i18n/fr.js +90 -7
- package/dist/i18n/fr.js.map +1 -1
- package/dist/i18n/hi.d.ts.map +1 -1
- package/dist/i18n/hi.js +90 -7
- package/dist/i18n/hi.js.map +1 -1
- package/dist/i18n/ja.d.ts.map +1 -1
- package/dist/i18n/ja.js +90 -7
- package/dist/i18n/ja.js.map +1 -1
- package/dist/i18n/ka.d.ts.map +1 -1
- package/dist/i18n/ka.js +90 -7
- package/dist/i18n/ka.js.map +1 -1
- package/dist/i18n/pt.d.ts.map +1 -1
- package/dist/i18n/pt.js +90 -7
- package/dist/i18n/pt.js.map +1 -1
- package/dist/i18n/ru.d.ts.map +1 -1
- package/dist/i18n/ru.js +90 -7
- package/dist/i18n/ru.js.map +1 -1
- package/dist/i18n/uk.d.ts.map +1 -1
- package/dist/i18n/uk.js +90 -7
- package/dist/i18n/uk.js.map +1 -1
- package/dist/i18n/uz.d.ts.map +1 -1
- package/dist/i18n/uz.js +90 -7
- package/dist/i18n/uz.js.map +1 -1
- package/dist/i18n/zh.d.ts.map +1 -1
- package/dist/i18n/zh.js +90 -7
- package/dist/i18n/zh.js.map +1 -1
- package/dist/i18n.d.ts +1 -1
- package/dist/i18n.js +1 -1
- package/dist/installManager.d.ts +13 -0
- package/dist/installManager.d.ts.map +1 -1
- package/dist/installManager.js +38 -4
- package/dist/installManager.js.map +1 -1
- package/dist/instanceSettings.d.ts +40 -1
- package/dist/instanceSettings.d.ts.map +1 -1
- package/dist/instanceSettings.js +105 -26
- package/dist/instanceSettings.js.map +1 -1
- package/dist/openCodeQuestionFlow.d.ts +30 -0
- package/dist/openCodeQuestionFlow.d.ts.map +1 -1
- package/dist/openCodeQuestionFlow.js +43 -0
- package/dist/openCodeQuestionFlow.js.map +1 -1
- package/dist/postToSession.d.ts +20 -5
- package/dist/postToSession.d.ts.map +1 -1
- package/dist/postToSession.js +38 -7
- package/dist/postToSession.js.map +1 -1
- package/dist/remoteRun/cliArgs.d.ts +73 -0
- package/dist/remoteRun/cliArgs.d.ts.map +1 -0
- package/dist/remoteRun/cliArgs.js +197 -0
- package/dist/remoteRun/cliArgs.js.map +1 -0
- package/dist/remoteRun/commands.d.ts +56 -0
- package/dist/remoteRun/commands.d.ts.map +1 -0
- package/dist/remoteRun/commands.js +306 -0
- package/dist/remoteRun/commands.js.map +1 -0
- package/dist/remoteRun/depsPlan.d.ts +16 -0
- package/dist/remoteRun/depsPlan.d.ts.map +1 -0
- package/dist/remoteRun/depsPlan.js +82 -0
- package/dist/remoteRun/depsPlan.js.map +1 -0
- package/dist/remoteRun/exitCodes.d.ts +34 -0
- package/dist/remoteRun/exitCodes.d.ts.map +1 -0
- package/dist/remoteRun/exitCodes.js +38 -0
- package/dist/remoteRun/exitCodes.js.map +1 -0
- package/dist/remoteRun/foreground.d.ts +29 -0
- package/dist/remoteRun/foreground.d.ts.map +1 -0
- package/dist/remoteRun/foreground.js +159 -0
- package/dist/remoteRun/foreground.js.map +1 -0
- package/dist/remoteRun/interrupts.d.ts +17 -0
- package/dist/remoteRun/interrupts.d.ts.map +1 -0
- package/dist/remoteRun/interrupts.js +41 -0
- package/dist/remoteRun/interrupts.js.map +1 -0
- package/dist/remoteRun/jobFiles.d.ts +31 -0
- package/dist/remoteRun/jobFiles.d.ts.map +1 -0
- package/dist/remoteRun/jobFiles.js +84 -0
- package/dist/remoteRun/jobFiles.js.map +1 -0
- package/dist/remoteRun/jobFormat.d.ts +16 -0
- package/dist/remoteRun/jobFormat.d.ts.map +1 -0
- package/dist/remoteRun/jobFormat.js +130 -0
- package/dist/remoteRun/jobFormat.js.map +1 -0
- package/dist/remoteRun/jobId.d.ts +15 -0
- package/dist/remoteRun/jobId.d.ts.map +1 -0
- package/dist/remoteRun/jobId.js +85 -0
- package/dist/remoteRun/jobId.js.map +1 -0
- package/dist/remoteRun/jobMeta.d.ts +18 -0
- package/dist/remoteRun/jobMeta.d.ts.map +1 -0
- package/dist/remoteRun/jobMeta.js +33 -0
- package/dist/remoteRun/jobMeta.js.map +1 -0
- package/dist/remoteRun/jobQuery.d.ts +12 -0
- package/dist/remoteRun/jobQuery.d.ts.map +1 -0
- package/dist/remoteRun/jobQuery.js +22 -0
- package/dist/remoteRun/jobQuery.js.map +1 -0
- package/dist/remoteRun/jobRecords.d.ts +22 -0
- package/dist/remoteRun/jobRecords.d.ts.map +1 -0
- package/dist/remoteRun/jobRecords.js +145 -0
- package/dist/remoteRun/jobRecords.js.map +1 -0
- package/dist/remoteRun/jobState.d.ts +62 -0
- package/dist/remoteRun/jobState.d.ts.map +1 -0
- package/dist/remoteRun/jobState.js +132 -0
- package/dist/remoteRun/jobState.js.map +1 -0
- package/dist/remoteRun/leaseTiming.d.ts +18 -0
- package/dist/remoteRun/leaseTiming.d.ts.map +1 -0
- package/dist/remoteRun/leaseTiming.js +43 -0
- package/dist/remoteRun/leaseTiming.js.map +1 -0
- package/dist/remoteRun/output.d.ts +35 -0
- package/dist/remoteRun/output.d.ts.map +1 -0
- package/dist/remoteRun/output.js +82 -0
- package/dist/remoteRun/output.js.map +1 -0
- package/dist/remoteRun/pathPatterns.d.ts +33 -0
- package/dist/remoteRun/pathPatterns.d.ts.map +1 -0
- package/dist/remoteRun/pathPatterns.js +115 -0
- package/dist/remoteRun/pathPatterns.js.map +1 -0
- package/dist/remoteRun/probe.d.ts +56 -0
- package/dist/remoteRun/probe.d.ts.map +1 -0
- package/dist/remoteRun/probe.js +123 -0
- package/dist/remoteRun/probe.js.map +1 -0
- package/dist/remoteRun/project.d.ts +26 -0
- package/dist/remoteRun/project.d.ts.map +1 -0
- package/dist/remoteRun/project.js +159 -0
- package/dist/remoteRun/project.js.map +1 -0
- package/dist/remoteRun/projectConfig.d.ts +38 -0
- package/dist/remoteRun/projectConfig.d.ts.map +1 -0
- package/dist/remoteRun/projectConfig.js +87 -0
- package/dist/remoteRun/projectConfig.js.map +1 -0
- package/dist/remoteRun/remoteRunCli.d.ts +15 -0
- package/dist/remoteRun/remoteRunCli.d.ts.map +1 -0
- package/dist/remoteRun/remoteRunCli.js +144 -0
- package/dist/remoteRun/remoteRunCli.js.map +1 -0
- package/dist/remoteRun/remoteRunError.d.ts +14 -0
- package/dist/remoteRun/remoteRunError.d.ts.map +1 -0
- package/dist/remoteRun/remoteRunError.js +28 -0
- package/dist/remoteRun/remoteRunError.js.map +1 -0
- package/dist/remoteRun/rsync.d.ts +17 -0
- package/dist/remoteRun/rsync.d.ts.map +1 -0
- package/dist/remoteRun/rsync.js +39 -0
- package/dist/remoteRun/rsync.js.map +1 -0
- package/dist/remoteRun/runnerClient.d.ts +50 -0
- package/dist/remoteRun/runnerClient.d.ts.map +1 -0
- package/dist/remoteRun/runnerClient.js +139 -0
- package/dist/remoteRun/runnerClient.js.map +1 -0
- package/dist/remoteRun/runners.d.ts +57 -0
- package/dist/remoteRun/runners.d.ts.map +1 -0
- package/dist/remoteRun/runners.js +181 -0
- package/dist/remoteRun/runners.js.map +1 -0
- package/dist/remoteRun/runnersConfig.d.ts +44 -0
- package/dist/remoteRun/runnersConfig.d.ts.map +1 -0
- package/dist/remoteRun/runnersConfig.js +107 -0
- package/dist/remoteRun/runnersConfig.js.map +1 -0
- package/dist/remoteRun/safeCopy.d.ts +31 -0
- package/dist/remoteRun/safeCopy.d.ts.map +1 -0
- package/dist/remoteRun/safeCopy.js +137 -0
- package/dist/remoteRun/safeCopy.js.map +1 -0
- package/dist/remoteRun/sendPlan.d.ts +67 -0
- package/dist/remoteRun/sendPlan.d.ts.map +1 -0
- package/dist/remoteRun/sendPlan.js +139 -0
- package/dist/remoteRun/sendPlan.js.map +1 -0
- package/dist/remoteRun/ssh.d.ts +62 -0
- package/dist/remoteRun/ssh.d.ts.map +1 -0
- package/dist/remoteRun/ssh.js +202 -0
- package/dist/remoteRun/ssh.js.map +1 -0
- package/dist/remoteRun/submit.d.ts +29 -0
- package/dist/remoteRun/submit.d.ts.map +1 -0
- package/dist/remoteRun/submit.js +142 -0
- package/dist/remoteRun/submit.js.map +1 -0
- package/dist/requests/answerRequest.d.ts +5 -0
- package/dist/requests/answerRequest.d.ts.map +1 -1
- package/dist/requests/answerRequest.js +16 -1
- package/dist/requests/answerRequest.js.map +1 -1
- package/dist/requests/requestLedger.d.ts +13 -0
- package/dist/requests/requestLedger.d.ts.map +1 -1
- package/dist/requests/requestLedger.js +9 -0
- package/dist/requests/requestLedger.js.map +1 -1
- package/dist/requests/topicRequestSettle.d.ts +30 -0
- package/dist/requests/topicRequestSettle.d.ts.map +1 -0
- package/dist/requests/topicRequestSettle.js +23 -0
- package/dist/requests/topicRequestSettle.js.map +1 -0
- package/dist/requests/wakeUpEngine.d.ts +4 -0
- package/dist/requests/wakeUpEngine.d.ts.map +1 -1
- package/dist/requests/wakeUpEngine.js +5 -1
- package/dist/requests/wakeUpEngine.js.map +1 -1
- package/dist/scheduler/delivery.d.ts +2 -0
- package/dist/scheduler/delivery.d.ts.map +1 -1
- package/dist/scheduler/delivery.js +8 -4
- package/dist/scheduler/delivery.js.map +1 -1
- package/dist/scheduler/mcpSurface.d.ts +59 -10
- package/dist/scheduler/mcpSurface.d.ts.map +1 -1
- package/dist/scheduler/mcpSurface.js +276 -79
- package/dist/scheduler/mcpSurface.js.map +1 -1
- package/dist/scheduler/recurrence.d.ts +5 -0
- package/dist/scheduler/recurrence.d.ts.map +1 -1
- package/dist/scheduler/recurrence.js +12 -2
- package/dist/scheduler/recurrence.js.map +1 -1
- package/dist/scheduler/strictToolInput.d.ts +45 -0
- package/dist/scheduler/strictToolInput.d.ts.map +1 -0
- package/dist/scheduler/strictToolInput.js +155 -0
- package/dist/scheduler/strictToolInput.js.map +1 -0
- package/dist/scheduler/types.d.ts +5 -0
- package/dist/scheduler/types.d.ts.map +1 -1
- package/dist/scheduler/workerWatch.d.ts +23 -0
- package/dist/scheduler/workerWatch.d.ts.map +1 -0
- package/dist/scheduler/workerWatch.js +26 -0
- package/dist/scheduler/workerWatch.js.map +1 -0
- package/dist/selfUpdate/emittedSource.d.ts +11 -0
- package/dist/selfUpdate/emittedSource.d.ts.map +1 -0
- package/dist/selfUpdate/emittedSource.js +24 -0
- package/dist/selfUpdate/emittedSource.js.map +1 -0
- package/dist/selfUpdate/gitSource.d.ts +0 -6
- package/dist/selfUpdate/gitSource.d.ts.map +1 -1
- package/dist/selfUpdate/gitSource.js +2 -18
- package/dist/selfUpdate/gitSource.js.map +1 -1
- package/dist/selfUpdate/updatePending.d.ts +1 -1
- package/dist/sendErrorClassifier.d.ts +10 -0
- package/dist/sendErrorClassifier.d.ts.map +1 -1
- package/dist/sendErrorClassifier.js +22 -0
- package/dist/sendErrorClassifier.js.map +1 -1
- package/dist/state.d.ts +78 -7
- package/dist/state.d.ts.map +1 -1
- package/dist/state.js +125 -8
- package/dist/state.js.map +1 -1
- package/dist/stateFile.d.ts +9 -0
- package/dist/stateFile.d.ts.map +1 -0
- package/dist/stateFile.js +57 -0
- package/dist/stateFile.js.map +1 -0
- package/dist/stt/sttInstall.d.ts +7 -3
- package/dist/stt/sttInstall.d.ts.map +1 -1
- package/dist/stt/sttInstall.js +8 -4
- package/dist/stt/sttInstall.js.map +1 -1
- package/dist/stt/sttSettings.d.ts +2 -1
- package/dist/stt/sttSettings.d.ts.map +1 -1
- package/dist/stt/sttSettings.js +3 -2
- package/dist/stt/sttSettings.js.map +1 -1
- package/dist/stt/transcribeChain.js +2 -0
- package/dist/stt/transcribeChain.js.map +1 -1
- package/dist/testTimings.d.ts +13 -3
- package/dist/testTimings.d.ts.map +1 -1
- package/dist/testTimings.js +26 -2
- package/dist/testTimings.js.map +1 -1
- package/dist/todos/board.d.ts +83 -0
- package/dist/todos/board.d.ts.map +1 -0
- package/dist/todos/board.js +227 -0
- package/dist/todos/board.js.map +1 -0
- package/dist/todos/format.d.ts +33 -0
- package/dist/todos/format.d.ts.map +1 -0
- package/dist/todos/format.js +90 -0
- package/dist/todos/format.js.map +1 -0
- package/dist/todos/merge.d.ts +46 -0
- package/dist/todos/merge.d.ts.map +1 -0
- package/dist/todos/merge.js +137 -0
- package/dist/todos/merge.js.map +1 -0
- package/dist/todos/midTurn.d.ts +75 -0
- package/dist/todos/midTurn.d.ts.map +1 -0
- package/dist/todos/midTurn.js +214 -0
- package/dist/todos/midTurn.js.map +1 -0
- package/dist/todos/nag.d.ts +85 -0
- package/dist/todos/nag.d.ts.map +1 -0
- package/dist/todos/nag.js +103 -0
- package/dist/todos/nag.js.map +1 -0
- package/dist/todos/order.d.ts +25 -0
- package/dist/todos/order.d.ts.map +1 -0
- package/dist/todos/order.js +61 -0
- package/dist/todos/order.js.map +1 -0
- package/dist/todos/projects.d.ts +102 -0
- package/dist/todos/projects.d.ts.map +1 -0
- package/dist/todos/projects.js +342 -0
- package/dist/todos/projects.js.map +1 -0
- package/dist/todos/registry.d.ts +64 -0
- package/dist/todos/registry.d.ts.map +1 -0
- package/dist/todos/registry.js +116 -0
- package/dist/todos/registry.js.map +1 -0
- package/dist/todos/reminderEngine.d.ts +78 -0
- package/dist/todos/reminderEngine.d.ts.map +1 -0
- package/dist/todos/reminderEngine.js +162 -0
- package/dist/todos/reminderEngine.js.map +1 -0
- package/dist/todos/store.d.ts +34 -0
- package/dist/todos/store.d.ts.map +1 -0
- package/dist/todos/store.js +208 -0
- package/dist/todos/store.js.map +1 -0
- package/dist/todos/tools.d.ts +26 -0
- package/dist/todos/tools.d.ts.map +1 -0
- package/dist/todos/tools.js +25 -0
- package/dist/todos/tools.js.map +1 -0
- package/dist/todos/types.d.ts +85 -0
- package/dist/todos/types.d.ts.map +1 -0
- package/dist/todos/types.js +30 -0
- package/dist/todos/types.js.map +1 -0
- package/dist/trackers/taskAgentLimit.d.ts +58 -0
- package/dist/trackers/taskAgentLimit.d.ts.map +1 -0
- package/dist/trackers/taskAgentLimit.js +62 -0
- package/dist/trackers/taskAgentLimit.js.map +1 -0
- package/dist/trackers/taskAgentSlots.d.ts +109 -0
- package/dist/trackers/taskAgentSlots.d.ts.map +1 -0
- package/dist/trackers/taskAgentSlots.js +227 -0
- package/dist/trackers/taskAgentSlots.js.map +1 -0
- package/dist/trackers/types.d.ts +14 -0
- package/dist/trackers/types.d.ts.map +1 -0
- package/dist/trackers/types.js +3 -0
- package/dist/trackers/types.js.map +1 -0
- package/dist/types.d.ts +80 -4
- package/dist/types.d.ts.map +1 -1
- package/dist/utils/adoptReplayGate.d.ts +16 -0
- package/dist/utils/adoptReplayGate.d.ts.map +1 -0
- package/dist/utils/adoptReplayGate.js +35 -0
- package/dist/utils/adoptReplayGate.js.map +1 -0
- package/dist/utils/agentPlugin.d.ts +113 -0
- package/dist/utils/agentPlugin.d.ts.map +1 -0
- package/dist/utils/agentPlugin.js +192 -0
- package/dist/utils/agentPlugin.js.map +1 -0
- package/dist/utils/autoContinueOnLimit.d.ts +7 -4
- package/dist/utils/autoContinueOnLimit.d.ts.map +1 -1
- package/dist/utils/autoContinueOnLimit.js +8 -5
- package/dist/utils/autoContinueOnLimit.js.map +1 -1
- package/dist/utils/botSkills.d.ts +62 -0
- package/dist/utils/botSkills.d.ts.map +1 -0
- package/dist/utils/botSkills.js +53 -0
- package/dist/utils/botSkills.js.map +1 -0
- package/dist/utils/botSkillsSetting.d.ts +7 -0
- package/dist/utils/botSkillsSetting.d.ts.map +1 -0
- package/dist/utils/botSkillsSetting.js +9 -0
- package/dist/utils/botSkillsSetting.js.map +1 -0
- package/dist/utils/claudeCodeVersion.d.ts +7 -0
- package/dist/utils/claudeCodeVersion.d.ts.map +1 -1
- package/dist/utils/claudeCodeVersion.js +14 -1
- package/dist/utils/claudeCodeVersion.js.map +1 -1
- package/dist/utils/claudeCompactHook.d.ts +33 -15
- package/dist/utils/claudeCompactHook.d.ts.map +1 -1
- package/dist/utils/claudeCompactHook.js +36 -17
- package/dist/utils/claudeCompactHook.js.map +1 -1
- package/dist/utils/claudeCompactSummary.d.ts +15 -0
- package/dist/utils/claudeCompactSummary.d.ts.map +1 -0
- package/dist/utils/claudeCompactSummary.js +96 -0
- package/dist/utils/claudeCompactSummary.js.map +1 -0
- package/dist/utils/claudeLimitSwitch.d.ts +11 -9
- package/dist/utils/claudeLimitSwitch.d.ts.map +1 -1
- package/dist/utils/claudeLimitSwitch.js +18 -16
- package/dist/utils/claudeLimitSwitch.js.map +1 -1
- package/dist/utils/claudeProfiles.d.ts +5 -0
- package/dist/utils/claudeProfiles.d.ts.map +1 -1
- package/dist/utils/claudeProfiles.js +14 -0
- package/dist/utils/claudeProfiles.js.map +1 -1
- package/dist/utils/claudeSessionTitle.d.ts +2 -1
- package/dist/utils/claudeSessionTitle.d.ts.map +1 -1
- package/dist/utils/claudeSessionTitle.js +14 -14
- package/dist/utils/claudeSessionTitle.js.map +1 -1
- package/dist/utils/claudeUsage.d.ts +95 -15
- package/dist/utils/claudeUsage.d.ts.map +1 -1
- package/dist/utils/claudeUsage.js +241 -41
- package/dist/utils/claudeUsage.js.map +1 -1
- package/dist/utils/claudeUsageRefresher.d.ts +10 -0
- package/dist/utils/claudeUsageRefresher.d.ts.map +1 -1
- package/dist/utils/claudeUsageRefresher.js +11 -0
- package/dist/utils/claudeUsageRefresher.js.map +1 -1
- package/dist/utils/claudeUserEntry.d.ts +50 -0
- package/dist/utils/claudeUserEntry.d.ts.map +1 -0
- package/dist/utils/claudeUserEntry.js +120 -0
- package/dist/utils/claudeUserEntry.js.map +1 -0
- package/dist/utils/clearThreadOutputQueues.d.ts +4 -3
- package/dist/utils/clearThreadOutputQueues.d.ts.map +1 -1
- package/dist/utils/clearThreadOutputQueues.js +1 -1
- package/dist/utils/clearThreadOutputQueues.js.map +1 -1
- package/dist/utils/compactOnIdle.d.ts +33 -13
- package/dist/utils/compactOnIdle.d.ts.map +1 -1
- package/dist/utils/compactOnIdle.js +35 -15
- package/dist/utils/compactOnIdle.js.map +1 -1
- package/dist/utils/fallbackBridge.d.ts +5 -0
- package/dist/utils/fallbackBridge.d.ts.map +1 -1
- package/dist/utils/fallbackBridge.js +19 -3
- package/dist/utils/fallbackBridge.js.map +1 -1
- package/dist/utils/fallbackChain.d.ts +9 -3
- package/dist/utils/fallbackChain.d.ts.map +1 -1
- package/dist/utils/fallbackChain.js +21 -3
- package/dist/utils/fallbackChain.js.map +1 -1
- package/dist/utils/fileSendPlan.d.ts +6 -0
- package/dist/utils/fileSendPlan.d.ts.map +1 -1
- package/dist/utils/fileSendPlan.js +11 -0
- package/dist/utils/fileSendPlan.js.map +1 -1
- package/dist/utils/fileSendService.d.ts +7 -1
- package/dist/utils/fileSendService.d.ts.map +1 -1
- package/dist/utils/fileSendService.js +6 -2
- package/dist/utils/fileSendService.js.map +1 -1
- package/dist/utils/groupFinalizePlan.d.ts +8 -10
- package/dist/utils/groupFinalizePlan.d.ts.map +1 -1
- package/dist/utils/groupFinalizePlan.js +8 -12
- package/dist/utils/groupFinalizePlan.js.map +1 -1
- package/dist/utils/jsonStreamHost.d.ts +13 -0
- package/dist/utils/jsonStreamHost.d.ts.map +1 -1
- package/dist/utils/jsonStreamHost.js +13 -0
- package/dist/utils/jsonStreamHost.js.map +1 -1
- package/dist/utils/messageSendService.d.ts +5 -3
- package/dist/utils/messageSendService.d.ts.map +1 -1
- package/dist/utils/messageSendService.js +12 -5
- package/dist/utils/messageSendService.js.map +1 -1
- package/dist/utils/openCodeCompactPlugin.d.ts +39 -14
- package/dist/utils/openCodeCompactPlugin.d.ts.map +1 -1
- package/dist/utils/openCodeCompactPlugin.js +106 -38
- package/dist/utils/openCodeCompactPlugin.js.map +1 -1
- package/dist/utils/promptDelivery.d.ts +29 -12
- package/dist/utils/promptDelivery.d.ts.map +1 -1
- package/dist/utils/promptDelivery.js +13 -5
- package/dist/utils/promptDelivery.js.map +1 -1
- package/dist/utils/sentKindsSummary.d.ts +10 -0
- package/dist/utils/sentKindsSummary.d.ts.map +1 -0
- package/dist/utils/sentKindsSummary.js +18 -0
- package/dist/utils/sentKindsSummary.js.map +1 -0
- package/dist/utils/telegramError.d.ts +6 -0
- package/dist/utils/telegramError.d.ts.map +1 -1
- package/dist/utils/telegramError.js +12 -0
- package/dist/utils/telegramError.js.map +1 -1
- package/dist/utils/topicView.d.ts +1 -1
- package/dist/utils/topicView.js +1 -1
- package/dist/utils/transcribeAudio.d.ts +10 -0
- package/dist/utils/transcribeAudio.d.ts.map +1 -1
- package/dist/utils/transcribeAudio.js +22 -3
- package/dist/utils/transcribeAudio.js.map +1 -1
- package/dist/utils/transcriptErrorTime.d.ts +8 -0
- package/dist/utils/transcriptErrorTime.d.ts.map +1 -0
- package/dist/utils/transcriptErrorTime.js +56 -0
- package/dist/utils/transcriptErrorTime.js.map +1 -0
- package/dist/utils/wedgeRecovery.d.ts +2 -0
- package/dist/utils/wedgeRecovery.d.ts.map +1 -1
- package/dist/utils/wedgeRecovery.js +1 -1
- package/dist/utils/wedgeRecovery.js.map +1 -1
- package/package.json +11 -3
- package/remoteRun/runner.sh +1242 -0
- package/stt/gigaam_sidecar.py +555 -50
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.shortCallTimeoutMs = void 0;
|
|
37
|
+
exports.getRunnerScriptPath = getRunnerScriptPath;
|
|
38
|
+
exports.readRunnerScript = readRunnerScript;
|
|
39
|
+
exports.describeSshFailure = describeSshFailure;
|
|
40
|
+
exports.describeRunnerRefusal = describeRunnerRefusal;
|
|
41
|
+
exports.createRunnerClient = createRunnerClient;
|
|
42
|
+
const crypto_1 = require("crypto");
|
|
43
|
+
const fs = __importStar(require("fs"));
|
|
44
|
+
const path = __importStar(require("path"));
|
|
45
|
+
const remoteRunError_1 = require("./remoteRunError");
|
|
46
|
+
const ssh_1 = require("./ssh");
|
|
47
|
+
/**
|
|
48
|
+
* @description One runner as the rest of remote-run uses it: the uploaded script's subcommands as calls, Pueue through the same
|
|
49
|
+
* script, and the pieces rsync needs. The script is `remoteRun/runner.sh` at the package root (shipped in `files`, like the STT
|
|
50
|
+
* sidecar); it is uploaded to `<workDir>/bin/runner-<sha8>.sh` when that file is missing, so two versions of charness on one
|
|
51
|
+
* runner never clash.
|
|
52
|
+
*/
|
|
53
|
+
const scriptHashLength = 8;
|
|
54
|
+
/** An ordinary call: a prepare may start the Pueue daemon, a result or a kill is quicker. */
|
|
55
|
+
exports.shortCallTimeoutMs = 60 * 1000;
|
|
56
|
+
const scriptUploadTimeoutMs = 60 * 1000;
|
|
57
|
+
/** @description `remoteRun/runner.sh` at the package root, resolved from both `src/remoteRun` (tsx) and `dist/remoteRun` (built): two levels up. */
|
|
58
|
+
function getRunnerScriptPath() {
|
|
59
|
+
return path.join(fs.realpathSync(__dirname), '..', '..', 'remoteRun', 'runner.sh');
|
|
60
|
+
}
|
|
61
|
+
function readRunnerScript(scriptPath = getRunnerScriptPath()) {
|
|
62
|
+
const text = fs.readFileSync(scriptPath, 'utf8');
|
|
63
|
+
return { name: `runner-${(0, crypto_1.createHash)('sha256').update(text).digest('hex').slice(0, scriptHashLength)}.sh`, text };
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* @description The first useful line of a failed ssh's stderr, for a message (never the whole text: it may quote the destination). A
|
|
67
|
+
* rejected key from a process with no ssh-agent (`SSH_AUTH_SOCK` unset — a tracker agent such as Jira's starts with a minimal environment
|
|
68
|
+
* that has none) says what that means and the way out: a key that is only held by an agent works for a Telegram agent and not for that one.
|
|
69
|
+
*/
|
|
70
|
+
function describeSshFailure(result, env = process.env) {
|
|
71
|
+
if (result.isTimedOut)
|
|
72
|
+
return 'ssh: the command ran past its deadline';
|
|
73
|
+
const lines = result.stderr.split('\n').map((line) => line.trim()).filter((line) => line !== '');
|
|
74
|
+
const text = lines.length === 0 ? `ssh exited with ${result.exitCode ?? 'a signal'}` : lines[lines.length - 1];
|
|
75
|
+
if (/host key verification failed/i.test(result.stderr))
|
|
76
|
+
return `ssh: the host key is not trusted yet — connect once by hand (ssh to this runner) so it is known`;
|
|
77
|
+
if (/permission denied/i.test(result.stderr)) {
|
|
78
|
+
const hasAgent = env.SSH_AUTH_SOCK !== undefined && env.SSH_AUTH_SOCK !== '';
|
|
79
|
+
return hasAgent
|
|
80
|
+
? 'ssh: the key was rejected (permission denied)'
|
|
81
|
+
: 'ssh: the key was rejected (permission denied) — this process has no ssh-agent (SSH_AUTH_SOCK is unset, as for a Jira agent), so the key must work without one: a key file with no passphrase, given as "sshOptions": ["-i", "<path>"] in runners.json';
|
|
82
|
+
}
|
|
83
|
+
return text.length > 200 ? `${text.slice(0, 200)}…` : text;
|
|
84
|
+
}
|
|
85
|
+
/** @description The runner script's own refusal in a stderr text («remote-run-runner: no such job: x» → «no such job: x»): the last line, without the script's prefix. */
|
|
86
|
+
function describeRunnerRefusal(stderr, fallback) {
|
|
87
|
+
const lastLine = stderr.split('\n').map((line) => line.trim()).filter((line) => line !== '').pop();
|
|
88
|
+
return lastLine === undefined ? fallback : lastLine.replace(/^remote-run-runner: /, '');
|
|
89
|
+
}
|
|
90
|
+
/** @description Create the client of `runner`. `script` and the spawn functions are injectable for the tests. */
|
|
91
|
+
function createRunnerClient(runner, cacheDir, script = readRunnerScript()) {
|
|
92
|
+
const call = (subcommand, args, options = {}) => (0, ssh_1.runSshCommand)({
|
|
93
|
+
runner,
|
|
94
|
+
cacheDir,
|
|
95
|
+
remoteCommand: (0, ssh_1.buildRunnerScriptCommand)({ runner, scriptName: script.name, subcommand, args }),
|
|
96
|
+
input: options.input,
|
|
97
|
+
timeoutMs: options.timeoutMs ?? exports.shortCallTimeoutMs,
|
|
98
|
+
signal: options.signal,
|
|
99
|
+
});
|
|
100
|
+
let absoluteWorkDir = runner.workDir.startsWith('/') ? runner.workDir : null;
|
|
101
|
+
return {
|
|
102
|
+
runner,
|
|
103
|
+
cacheDir,
|
|
104
|
+
rsyncSshCommand: (0, ssh_1.buildRsyncSshCommand)(runner, cacheDir),
|
|
105
|
+
async getAbsoluteWorkDir() {
|
|
106
|
+
if (absoluteWorkDir === null) {
|
|
107
|
+
const resolved = await call('workdir', []);
|
|
108
|
+
const first = resolved.stdout.trim().split('\n')[0];
|
|
109
|
+
if (resolved.exitCode !== 0 || !first.startsWith('/'))
|
|
110
|
+
throw new remoteRunError_1.RemoteRunError(`runner "${runner.name}": could not resolve its work dir ${runner.workDir} — ${describeSshFailure(resolved)}`);
|
|
111
|
+
absoluteWorkDir = first;
|
|
112
|
+
}
|
|
113
|
+
return absoluteWorkDir;
|
|
114
|
+
},
|
|
115
|
+
async ensureScript(signal) {
|
|
116
|
+
const exists = await (0, ssh_1.runSshCommand)({ runner, cacheDir, remoteCommand: (0, ssh_1.buildScriptExistsCommand)(runner, script.name), timeoutMs: scriptUploadTimeoutMs, signal });
|
|
117
|
+
if (exists.exitCode === 0)
|
|
118
|
+
return;
|
|
119
|
+
if ((0, ssh_1.checkIsConnectionLost)(exists.exitCode))
|
|
120
|
+
throw new remoteRunError_1.RunnerUnreachableError(runner.name, describeSshFailure(exists));
|
|
121
|
+
const upload = await (0, ssh_1.runSshCommand)({ runner, cacheDir, remoteCommand: (0, ssh_1.buildScriptUploadCommand)(runner, script.name), input: script.text, timeoutMs: scriptUploadTimeoutMs, signal });
|
|
122
|
+
if (upload.exitCode !== 0)
|
|
123
|
+
throw new remoteRunError_1.RemoteRunError(`could not put the runner script on "${runner.name}" (${runner.workDir}/bin) — ${describeSshFailure(upload)}`);
|
|
124
|
+
},
|
|
125
|
+
call,
|
|
126
|
+
async callOrThrow(subcommand, args, options) {
|
|
127
|
+
const result = await call(subcommand, args, options);
|
|
128
|
+
if (result.exitCode !== 0) {
|
|
129
|
+
const detail = result.stderr.trim() === '' ? describeSshFailure(result) : result.stderr.trim().split('\n').slice(-3).join(' / ');
|
|
130
|
+
throw new remoteRunError_1.RemoteRunError(`runner "${runner.name}": ${subcommand} failed — ${detail}`);
|
|
131
|
+
}
|
|
132
|
+
return result.stdout;
|
|
133
|
+
},
|
|
134
|
+
stream(subcommand, args) {
|
|
135
|
+
return (0, ssh_1.spawnSshStream)({ runner, cacheDir, remoteCommand: (0, ssh_1.buildRunnerScriptCommand)({ runner, scriptName: script.name, subcommand, args }) });
|
|
136
|
+
},
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
//# sourceMappingURL=runnerClient.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnerClient.js","sourceRoot":"","sources":["../../src/remoteRun/runnerClient.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAmCA,kDAEC;AAED,4CAGC;AA2BD,gDAYC;AAGD,sDAGC;AAGD,gDA8CC;AAxID,mCAAoC;AACpC,uCAAyB;AACzB,2CAA6B;AAC7B,qDAA0E;AAE1E,+BASe;AAEf;;;;;GAKG;AAEH,MAAM,gBAAgB,GAAG,CAAC,CAAC;AAC3B,6FAA6F;AAChF,QAAA,kBAAkB,GAAG,EAAE,GAAG,IAAI,CAAC;AAC5C,MAAM,qBAAqB,GAAG,EAAE,GAAG,IAAI,CAAC;AAQxC,oJAAoJ;AACpJ,SAAgB,mBAAmB;IACjC,OAAO,IAAI,CAAC,IAAI,CAAC,EAAE,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,IAAI,EAAE,IAAI,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC;AACrF,CAAC;AAED,SAAgB,gBAAgB,CAAC,aAAqB,mBAAmB,EAAE;IACzE,MAAM,IAAI,GAA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nerCapability, type RunnerProbe, type RunnerReport } from './probe';
|
|
2
|
+
import { type RunnerClient } from './runnerClient';
|
|
3
|
+
import type { RunnerConfig, RunnersConfig } from './runnersConfig';
|
|
4
|
+
/**
|
|
5
|
+
* @description Which runners exist right now: probe them (in parallel, bounded), remember each one's last answer so an offline runner
|
|
6
|
+
* still shows what it was, and pick the one a command should use — the named one, or the first in `runners.json` that answers and, with
|
|
7
|
+
* `--needs`, has the capability.
|
|
8
|
+
*/
|
|
9
|
+
/** The whole probing of all runners ends by then (a dead host costs its ssh connect timeout, once, in parallel with the others). */
|
|
10
|
+
export declare const probeAllTimeoutMs: number;
|
|
11
|
+
export declare function readLastProbe(cacheDir: string, runnerName: string): {
|
|
12
|
+
seenAtMs: number;
|
|
13
|
+
probe: RunnerProbe;
|
|
14
|
+
} | null;
|
|
15
|
+
/**
|
|
16
|
+
* @description Probe one runner: its report is `online` with what it said, or `offline` with why and the last snapshot taken when it
|
|
17
|
+
* was seen. `signal` is the deadline of the whole view (see {@link probeRunners}): when it fires the ssh calls in flight are killed and the
|
|
18
|
+
* runner is reported offline — with the snapshot, like any other way of not answering.
|
|
19
|
+
*/
|
|
20
|
+
export declare function probeRunner(client: RunnerClient, nowMs?: number, signal?: AbortSignal, deadlineMs?: number): Promise<RunnerReport>;
|
|
21
|
+
/**
|
|
22
|
+
* @description Probe every client at once under ONE deadline (20 s): a runner that has not answered by then is reported offline with its
|
|
23
|
+
* last snapshot and its ssh calls are killed, so the view ends on time and nothing keeps the process alive afterwards. The others are not
|
|
24
|
+
* held back by it.
|
|
25
|
+
*/
|
|
26
|
+
export declare function probeRunners(clients: readonly RunnerClient[], nowMs?: number, deadlineMs?: number): Promise<RunnerReport[]>;
|
|
27
|
+
export type RunnerPick = {
|
|
28
|
+
ok: true;
|
|
29
|
+
runnerName: string;
|
|
30
|
+
} | {
|
|
31
|
+
ok: false;
|
|
32
|
+
message: string;
|
|
33
|
+
exitCode: number;
|
|
34
|
+
};
|
|
35
|
+
/** The `runners` view of why nothing fits, one block per runner. */
|
|
36
|
+
export declare function formatRunnersView(reports: readonly RunnerReport[]): string;
|
|
37
|
+
/**
|
|
38
|
+
* @description The runner a command should use. `wanted.runner` names one (it must exist, answer and have Pueue); otherwise the first
|
|
39
|
+
* runner in `config` order that answers, has Pueue and — with `wanted.needs` — the capability. None: the reason and the `runners`
|
|
40
|
+
* view, exit 125.
|
|
41
|
+
*/
|
|
42
|
+
export declare function pickRunner(config: RunnersConfig, reports: readonly RunnerReport[], wanted: {
|
|
43
|
+
runner: string | null;
|
|
44
|
+
needs: RunnerCapability | null;
|
|
45
|
+
}): RunnerPick;
|
|
46
|
+
/**
|
|
47
|
+
* @description The runner `exec` goes to. `exec` runs in the runner's copy "as the last job left it", so without `--runner` that is the
|
|
48
|
+
* runner of this project's last job (`lastRunnerName`), not the first one that answers — with several runners the first could hold no copy
|
|
49
|
+
* of the project, or an old one. No job yet: `null` (any online runner); a last runner that left `runners.json`: `null` and a note.
|
|
50
|
+
*/
|
|
51
|
+
export declare function chooseExecRunnerName(config: RunnersConfig, named: string | null, lastRunnerName: string | null): {
|
|
52
|
+
runnerName: string | null;
|
|
53
|
+
note: string | null;
|
|
54
|
+
};
|
|
55
|
+
/** @description The runner of a job id, from the config: an id of a runner that is no longer listed is an error. */
|
|
56
|
+
export declare function findRunnerOfJob(config: RunnersConfig, runnerName: string): RunnerConfig;
|
|
57
|
+
//# sourceMappingURL=runners.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runners.d.ts","sourceRoot":"","sources":["../../src/remoteRun/runners.ts"],"names":[],"mappings":"AAEA,OAAO,EAIL,KAAK,gBAAgB,EACrB,KAAK,WAAW,EAChB,KAAK,YAAY,EAClB,MAAM,SAAS,CAAC;AAGjB,OAAO,EAAsB,KAAK,YAAY,EAAE,MAAM,gBAAgB,CAAC;AACvE,OAAO,KAAK,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEnE;;;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E,UAAU,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;CAAE,CAInK;AAED,oHAAoH;AACpH,wBAAgB,eAAe,CAAC,MAAM,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,GAAG,YAAY,CAIvF"}
|
|
@@ -0,0 +1,181 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.probeAllTimeoutMs = void 0;
|
|
37
|
+
exports.readLastProbe = readLastProbe;
|
|
38
|
+
exports.probeRunner = probeRunner;
|
|
39
|
+
exports.probeRunners = probeRunners;
|
|
40
|
+
exports.formatRunnersView = formatRunnersView;
|
|
41
|
+
exports.pickRunner = pickRunner;
|
|
42
|
+
exports.chooseExecRunnerName = chooseExecRunnerName;
|
|
43
|
+
exports.findRunnerOfJob = findRunnerOfJob;
|
|
44
|
+
const fs = __importStar(require("fs"));
|
|
45
|
+
const path = __importStar(require("path"));
|
|
46
|
+
const probe_1 = require("./probe");
|
|
47
|
+
const remoteRunError_1 = require("./remoteRunError");
|
|
48
|
+
const exitCodes_1 = require("./exitCodes");
|
|
49
|
+
const runnerClient_1 = require("./runnerClient");
|
|
50
|
+
/**
|
|
51
|
+
* @description Which runners exist right now: probe them (in parallel, bounded), remember each one's last answer so an offline runner
|
|
52
|
+
* still shows what it was, and pick the one a command should use — the named one, or the first in `runners.json` that answers and, with
|
|
53
|
+
* `--needs`, has the capability.
|
|
54
|
+
*/
|
|
55
|
+
/** The whole probing of all runners ends by then (a dead host costs its ssh connect timeout, once, in parallel with the others). */
|
|
56
|
+
exports.probeAllTimeoutMs = 20 * 1000;
|
|
57
|
+
const probeFileSuffix = '.probe.json';
|
|
58
|
+
const millisecondsPerSecond = 1000;
|
|
59
|
+
function getStoredProbePath(cacheDir, runnerName) {
|
|
60
|
+
return path.join(cacheDir, `${runnerName}${probeFileSuffix}`);
|
|
61
|
+
}
|
|
62
|
+
function readLastProbe(cacheDir, runnerName) {
|
|
63
|
+
try {
|
|
64
|
+
const stored = JSON.parse(fs.readFileSync(getStoredProbePath(cacheDir, runnerName), 'utf8'));
|
|
65
|
+
if (typeof stored.seenAtMs !== 'number' || typeof stored.text !== 'string')
|
|
66
|
+
return null;
|
|
67
|
+
return { seenAtMs: stored.seenAtMs, probe: (0, probe_1.parseProbeOutput)(stored.text) };
|
|
68
|
+
}
|
|
69
|
+
catch {
|
|
70
|
+
return null;
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
function writeLastProbe(cacheDir, runnerName, text, seenAtMs) {
|
|
74
|
+
const stored = { seenAtMs, text };
|
|
75
|
+
fs.writeFileSync(getStoredProbePath(cacheDir, runnerName), JSON.stringify(stored), { mode: 0o600 });
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* @description Probe one runner: its report is `online` with what it said, or `offline` with why and the last snapshot taken when it
|
|
79
|
+
* was seen. `signal` is the deadline of the whole view (see {@link probeRunners}): when it fires the ssh calls in flight are killed and the
|
|
80
|
+
* runner is reported offline — with the snapshot, like any other way of not answering.
|
|
81
|
+
*/
|
|
82
|
+
async function probeRunner(client, nowMs = Date.now(), signal, deadlineMs = exports.probeAllTimeoutMs) {
|
|
83
|
+
const runner = client.runner;
|
|
84
|
+
const groupLimits = { ...(runner.groups ?? {}) };
|
|
85
|
+
const offline = (reason) => {
|
|
86
|
+
const last = readLastProbe(client.cacheDir, runner.name);
|
|
87
|
+
return {
|
|
88
|
+
name: runner.name,
|
|
89
|
+
status: 'offline',
|
|
90
|
+
reason: signal?.aborted === true ? `no answer within ${Math.round(deadlineMs / millisecondsPerSecond)} s` : reason,
|
|
91
|
+
lastSeenAtMs: last?.seenAtMs ?? null,
|
|
92
|
+
lastProbe: last?.probe ?? null,
|
|
93
|
+
groupLimits,
|
|
94
|
+
};
|
|
95
|
+
};
|
|
96
|
+
try {
|
|
97
|
+
await client.ensureScript(signal);
|
|
98
|
+
}
|
|
99
|
+
catch (error) {
|
|
100
|
+
if (error instanceof remoteRunError_1.RunnerUnreachableError)
|
|
101
|
+
return offline(error.reason);
|
|
102
|
+
return offline(error instanceof Error ? error.message : 'could not prepare the runner');
|
|
103
|
+
}
|
|
104
|
+
const result = await client.call('probe', [], { timeoutMs: deadlineMs, signal });
|
|
105
|
+
if (result.exitCode !== 0)
|
|
106
|
+
return offline((0, runnerClient_1.describeSshFailure)(result));
|
|
107
|
+
writeLastProbe(client.cacheDir, runner.name, result.stdout, nowMs);
|
|
108
|
+
return { name: runner.name, status: 'online', probe: (0, probe_1.parseProbeOutput)(result.stdout), groupLimits };
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @description Probe every client at once under ONE deadline (20 s): a runner that has not answered by then is reported offline with its
|
|
112
|
+
* last snapshot and its ssh calls are killed, so the view ends on time and nothing keeps the process alive afterwards. The others are not
|
|
113
|
+
* held back by it.
|
|
114
|
+
*/
|
|
115
|
+
async function probeRunners(clients, nowMs = Date.now(), deadlineMs = exports.probeAllTimeoutMs) {
|
|
116
|
+
const deadline = new AbortController();
|
|
117
|
+
const timer = setTimeout(() => deadline.abort(), deadlineMs);
|
|
118
|
+
try {
|
|
119
|
+
return await Promise.all(clients.map((client) => probeRunner(client, nowMs, deadline.signal, deadlineMs)));
|
|
120
|
+
}
|
|
121
|
+
finally {
|
|
122
|
+
clearTimeout(timer);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
/** The `runners` view of why nothing fits, one block per runner. */
|
|
126
|
+
function formatRunnersView(reports) {
|
|
127
|
+
return reports.map(probe_1.formatRunnerBlock).join('\n\n');
|
|
128
|
+
}
|
|
129
|
+
function checkIsUsable(report) {
|
|
130
|
+
return report.status === 'online' && report.probe.pueueVersion !== null;
|
|
131
|
+
}
|
|
132
|
+
/**
|
|
133
|
+
* @description The runner a command should use. `wanted.runner` names one (it must exist, answer and have Pueue); otherwise the first
|
|
134
|
+
* runner in `config` order that answers, has Pueue and — with `wanted.needs` — the capability. None: the reason and the `runners`
|
|
135
|
+
* view, exit 125.
|
|
136
|
+
*/
|
|
137
|
+
function pickRunner(config, reports, wanted) {
|
|
138
|
+
if (wanted.runner !== null) {
|
|
139
|
+
const report = reports.find((candidate) => candidate.name === wanted.runner);
|
|
140
|
+
if (report === undefined) {
|
|
141
|
+
return { ok: false, exitCode: exitCodes_1.remoteRunExitCodes.usage, message: `no runner named "${wanted.runner}" in runners.json (configured: ${config.runners.map((runner) => runner.name).join(', ')})` };
|
|
142
|
+
}
|
|
143
|
+
if (report.status === 'offline')
|
|
144
|
+
return { ok: false, exitCode: exitCodes_1.remoteRunExitCodes.failed, message: `runner "${wanted.runner}" is offline (${report.reason})\n${formatRunnersView([report])}` };
|
|
145
|
+
if (!checkIsUsable(report))
|
|
146
|
+
return { ok: false, exitCode: exitCodes_1.remoteRunExitCodes.failed, message: `runner "${wanted.runner}" has no Pueue (install it there, see docs/remote-run.md)\n${formatRunnersView([report])}` };
|
|
147
|
+
if (wanted.needs !== null && !(0, probe_1.checkHasCapability)(report.probe, wanted.needs)) {
|
|
148
|
+
return { ok: false, exitCode: exitCodes_1.remoteRunExitCodes.failed, message: `runner "${wanted.runner}" cannot do "${wanted.needs}"\n${formatRunnersView([report])}` };
|
|
149
|
+
}
|
|
150
|
+
return { ok: true, runnerName: report.name };
|
|
151
|
+
}
|
|
152
|
+
for (const runner of config.runners) {
|
|
153
|
+
const report = reports.find((candidate) => candidate.name === runner.name);
|
|
154
|
+
if (report === undefined || !checkIsUsable(report))
|
|
155
|
+
continue;
|
|
156
|
+
if (wanted.needs === null || (0, probe_1.checkHasCapability)(report.probe, wanted.needs))
|
|
157
|
+
return { ok: true, runnerName: runner.name };
|
|
158
|
+
}
|
|
159
|
+
const reason = wanted.needs === null ? 'no runner is online' : `no online runner can do "${wanted.needs}"`;
|
|
160
|
+
return { ok: false, exitCode: exitCodes_1.remoteRunExitCodes.failed, message: `${reason}\n${formatRunnersView(reports)}` };
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* @description The runner `exec` goes to. `exec` runs in the runner's copy "as the last job left it", so without `--runner` that is the
|
|
164
|
+
* runner of this project's last job (`lastRunnerName`), not the first one that answers — with several runners the first could hold no copy
|
|
165
|
+
* of the project, or an old one. No job yet: `null` (any online runner); a last runner that left `runners.json`: `null` and a note.
|
|
166
|
+
*/
|
|
167
|
+
function chooseExecRunnerName(config, named, lastRunnerName) {
|
|
168
|
+
if (named !== null || lastRunnerName === null)
|
|
169
|
+
return { runnerName: named, note: null };
|
|
170
|
+
if (config.runners.some((runner) => runner.name === lastRunnerName))
|
|
171
|
+
return { runnerName: lastRunnerName, note: null };
|
|
172
|
+
return { runnerName: null, note: `the runner of this project's last job, "${lastRunnerName}", is not in runners.json any more — using the first online runner` };
|
|
173
|
+
}
|
|
174
|
+
/** @description The runner of a job id, from the config: an id of a runner that is no longer listed is an error. */
|
|
175
|
+
function findRunnerOfJob(config, runnerName) {
|
|
176
|
+
const runner = config.runners.find((candidate) => candidate.name === runnerName);
|
|
177
|
+
if (runner === undefined)
|
|
178
|
+
throw new remoteRunError_1.RemoteRunError(`the job belongs to runner "${runnerName}", which is not in runners.json any more`);
|
|
179
|
+
return runner;
|
|
180
|
+
}
|
|
181
|
+
//# sourceMappingURL=runners.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runners.js","sourceRoot":"","sources":["../../src/remoteRun/runners.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAoCA,sCAQC;AAYD,kCAwBC;AAOD,oCAQC;AAKD,8CAEC;AAWD,gCAoBC;AAOD,oDAIC;AAGD,0CAIC;AAvJD,uCAAyB;AACzB,2CAA6B;AAC7B,mCAOiB;AACjB,qDAA0E;AAC1E,2CAAiD;AACjD,iDAAuE;AAGvE;;;;GAIG;AAEH,oIAAoI;AACvH,QAAA,iBAAiB,GAAG,EAAE,GAAG,IAAI,CAAC;AAC3C,MAAM,eAAe,GAAG,aAAa,CAAC;AACtC,MAAM,qBAAqB,GAAG,IAAI,CAAC;AAQnC,SAAS,kBAAkB,CAAC,QAAgB,EAAE,UAAkB;IAC9D,OAAO,IAAI,CAAC,IAAI,CAAC,QAAQ,EAAE,GAAG,UAAU,GAAG,eAAe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B,EAAE,UAAkB;IACvE,MAAM,MAAM,GAAG,MAAM,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,SAAS,EAAE,EAAE,CAAC,SAAS,CAAC,IAAI,KAAK,UAAU,CAAC,CAAC;IACjF,IAAI,MAAM,KAAK,SAAS;QAAE,MAAM,IAAI,+BAAc,CAAC,8BAA8B,UAAU,0CAA0C,CAAC,CAAC;IACvI,OAAO,MAAM,CAAC;AAChB,CAAC"}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
import { type ConfigFileLoad } from '../configDirFile';
|
|
3
|
+
/** The group every runner has; its parallel limit may be set, it never needs `group add`. */
|
|
4
|
+
export declare const defaultPueueGroup = "default";
|
|
5
|
+
declare const runnerSchema: z.ZodObject<{
|
|
6
|
+
name: z.ZodString;
|
|
7
|
+
ssh: z.ZodString;
|
|
8
|
+
sshOptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
9
|
+
workDir: z.ZodString;
|
|
10
|
+
pueue: z.ZodOptional<z.ZodObject<{
|
|
11
|
+
bin: z.ZodOptional<z.ZodString>;
|
|
12
|
+
config: z.ZodOptional<z.ZodString>;
|
|
13
|
+
}, z.core.$strict>>;
|
|
14
|
+
groups: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
15
|
+
}, z.core.$strict>;
|
|
16
|
+
declare const runnersConfigSchema: z.ZodObject<{
|
|
17
|
+
runners: z.ZodArray<z.ZodObject<{
|
|
18
|
+
name: z.ZodString;
|
|
19
|
+
ssh: z.ZodString;
|
|
20
|
+
sshOptions: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
21
|
+
workDir: z.ZodString;
|
|
22
|
+
pueue: z.ZodOptional<z.ZodObject<{
|
|
23
|
+
bin: z.ZodOptional<z.ZodString>;
|
|
24
|
+
config: z.ZodOptional<z.ZodString>;
|
|
25
|
+
}, z.core.$strict>>;
|
|
26
|
+
groups: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodNumber>>;
|
|
27
|
+
}, z.core.$strict>>;
|
|
28
|
+
}, z.core.$strict>;
|
|
29
|
+
/** @name RunnerConfig @description One runner as the file describes it. */
|
|
30
|
+
export type RunnerConfig = z.infer<typeof runnerSchema>;
|
|
31
|
+
/** @name RunnersConfig @description The whole file. */
|
|
32
|
+
export type RunnersConfig = z.infer<typeof runnersConfigSchema>;
|
|
33
|
+
/** @description Where the file lives: beside the user's global charness env file, whatever `ENV_FILE` says (it is per OS user, not per instance). */
|
|
34
|
+
export declare function getRunnersConfigPath(homeDir?: string): string;
|
|
35
|
+
/** @description The file's current content (stamp-cached): missing = no runners, invalid = its errors and the last good config of this process, if any. */
|
|
36
|
+
export declare function loadRunnersConfig(homeDir?: string): ConfigFileLoad<RunnersConfig>;
|
|
37
|
+
/** @description Forget the cached loads (tests that swap files under one path). */
|
|
38
|
+
export declare function resetRunnersConfigCache(): void;
|
|
39
|
+
/** @description Does any runner exist right now? The bot MCP's instructions mention remote-run only while one does. */
|
|
40
|
+
export declare function checkIsRemoteRunOffered(homeDir?: string): boolean;
|
|
41
|
+
/** @description The parallel limits of a runner's groups as the `name=n,name=n` string the runner script applies, in the order of the file (the runner applies each pair on its own, so the order carries no meaning). */
|
|
42
|
+
export declare function formatGroupLimits(groups: RunnerConfig['groups']): string;
|
|
43
|
+
export {};
|
|
44
|
+
//# sourceMappingURL=runnersConfig.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnersConfig.d.ts","sourceRoot":"","sources":["../../src/remoteRun/runnersConfig.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AACxB,OAAO,EAA0B,KAAK,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAoB/E,6FAA6F;AAC7F,eAAO,MAAM,iBAAiB,YAAY,CAAC;AAE3C,QAAA,MAAM,YAAY;;;;;;;;;;kBAOhB,CAAC;AAEH,QAAA,MAAM,mBAAmB;;;;;;;;;;;;kBAEgJ,CAAC;AAE1K,2EAA2E;AAC3E,MAAM,MAAM,YAAY,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,YAAY,CAAC,CAAC;AACxD,uDAAuD;AACvD,MAAM,MAAM,aAAa,GAAG,CAAC,CAAC,KAAK,CAAC,OAAO,mBAAmB,CAAC,CAAC;AAEhE,qJAAqJ;AACrJ,wBAAgB,oBAAoB,CAAC,OAAO,GAAE,MAAqB,GAAG,MAAM,CAE3E;AAYD,2JAA2J;AAC3J,wBAAgB,iBAAiB,CAAC,OAAO,GAAE,MAAqB,GAAG,cAAc,CAAC,aAAa,CAAC,CAE/F;AAED,mFAAmF;AACnF,wBAAgB,uBAAuB,IAAI,IAAI,CAE9C;AAED,uHAAuH;AACvH,wBAAgB,uBAAuB,CAAC,OAAO,GAAE,MAAqB,GAAG,OAAO,CAG/E;AAED,0NAA0N;AAC1N,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,YAAY,CAAC,QAAQ,CAAC,GAAG,MAAM,CAExE"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.defaultPueueGroup = void 0;
|
|
37
|
+
exports.getRunnersConfigPath = getRunnersConfigPath;
|
|
38
|
+
exports.loadRunnersConfig = loadRunnersConfig;
|
|
39
|
+
exports.resetRunnersConfigCache = resetRunnersConfigCache;
|
|
40
|
+
exports.checkIsRemoteRunOffered = checkIsRemoteRunOffered;
|
|
41
|
+
exports.formatGroupLimits = formatGroupLimits;
|
|
42
|
+
const os = __importStar(require("os"));
|
|
43
|
+
const path = __importStar(require("path"));
|
|
44
|
+
const zod_1 = require("zod");
|
|
45
|
+
const configDirFile_1 = require("../configDirFile");
|
|
46
|
+
const legacyNames_1 = require("../legacyNames");
|
|
47
|
+
/**
|
|
48
|
+
* @description `~/.config/charness/runners.json` — the machines `charness remote-run` may use, written by hand (phase 1). ONE file per
|
|
49
|
+
* OS user, deliberately NOT in an instance's `DATA_DIR`: an agent's environment does not say which instance it belongs to (a Jira agent
|
|
50
|
+
* has neither `ENV_FILE` nor `DATA_DIR`), so every charness instance of the user shares it.
|
|
51
|
+
*
|
|
52
|
+
* { "runners": [{ "name": "box1", "ssh": "runner@box1.example", "workDir": "/home/runner/charness-runner",
|
|
53
|
+
* "sshOptions": ["-i", "/home/user/.ssh/runner_key"],
|
|
54
|
+
* "pueue": { "bin": "/home/runner/.local/bin/pueue", "config": "/home/runner/.config/pueue/pueue.yml" },
|
|
55
|
+
* "groups": { "default": 2, "emulator": 1 } }] }
|
|
56
|
+
*
|
|
57
|
+
* Validation is strict (an unknown key, a bad name, a duplicate is an error that names the field and echoes no value). The loader is
|
|
58
|
+
* the shared stamp-cached one, so the bot's MCP can ask "is any runner listed?" on every connect for the cost of one `stat`.
|
|
59
|
+
*/
|
|
60
|
+
const configFileName = 'runners.json';
|
|
61
|
+
const runnerNamePattern = /^[a-z0-9]+(?:-[a-z0-9]+)*$/;
|
|
62
|
+
const groupNamePattern = /^[A-Za-z0-9][A-Za-z0-9_-]*$/;
|
|
63
|
+
/** The group every runner has; its parallel limit may be set, it never needs `group add`. */
|
|
64
|
+
exports.defaultPueueGroup = 'default';
|
|
65
|
+
const runnerSchema = zod_1.z.strictObject({
|
|
66
|
+
name: zod_1.z.string().regex(runnerNamePattern, 'must be lowercase letters, digits and single dashes'),
|
|
67
|
+
ssh: zod_1.z.string().min(1).refine((destination) => !destination.startsWith('-') && !/\s/.test(destination), 'must be an ssh destination (user@host or a host alias): no spaces, not an option'),
|
|
68
|
+
sshOptions: zod_1.z.array(zod_1.z.string()).optional(),
|
|
69
|
+
workDir: zod_1.z.string().min(1).refine((workDir) => workDir.startsWith('/') || workDir === '~' || workDir.startsWith('~/'), 'must be an absolute path on the runner or start with ~/'),
|
|
70
|
+
pueue: zod_1.z.strictObject({ bin: zod_1.z.string().min(1).optional(), config: zod_1.z.string().min(1).optional() }).optional(),
|
|
71
|
+
groups: zod_1.z.record(zod_1.z.string().regex(groupNamePattern, 'is not a valid group name'), zod_1.z.number().int().positive()).optional(),
|
|
72
|
+
});
|
|
73
|
+
const runnersConfigSchema = zod_1.z.strictObject({
|
|
74
|
+
runners: zod_1.z.array(runnerSchema),
|
|
75
|
+
}).refine((config) => new Set(config.runners.map((runner) => runner.name)).size === config.runners.length, { path: ['runners'], message: 'runner names must be unique' });
|
|
76
|
+
/** @description Where the file lives: beside the user's global charness env file, whatever `ENV_FILE` says (it is per OS user, not per instance). */
|
|
77
|
+
function getRunnersConfigPath(homeDir = os.homedir()) {
|
|
78
|
+
return path.join(path.dirname((0, legacyNames_1.resolveGlobalConfigEnvPath)(homeDir)), configFileName);
|
|
79
|
+
}
|
|
80
|
+
const loader = (0, configDirFile_1.createConfigFileLoader)({
|
|
81
|
+
fileName: configFileName,
|
|
82
|
+
createEmpty: () => ({ runners: [] }),
|
|
83
|
+
validate: (parsedJson) => {
|
|
84
|
+
const parsed = runnersConfigSchema.safeParse(parsedJson);
|
|
85
|
+
if (parsed.success)
|
|
86
|
+
return { ok: true, config: parsed.data };
|
|
87
|
+
return { ok: false, errors: parsed.error.issues.map((issue) => `${configFileName} ${issue.path.join('.') || '(root)'}: ${issue.message}`) };
|
|
88
|
+
},
|
|
89
|
+
});
|
|
90
|
+
/** @description The file's current content (stamp-cached): missing = no runners, invalid = its errors and the last good config of this process, if any. */
|
|
91
|
+
function loadRunnersConfig(homeDir = os.homedir()) {
|
|
92
|
+
return loader.load(getRunnersConfigPath(homeDir));
|
|
93
|
+
}
|
|
94
|
+
/** @description Forget the cached loads (tests that swap files under one path). */
|
|
95
|
+
function resetRunnersConfigCache() {
|
|
96
|
+
loader.resetCache();
|
|
97
|
+
}
|
|
98
|
+
/** @description Does any runner exist right now? The bot MCP's instructions mention remote-run only while one does. */
|
|
99
|
+
function checkIsRemoteRunOffered(homeDir = os.homedir()) {
|
|
100
|
+
const load = loadRunnersConfig(homeDir);
|
|
101
|
+
return (load.config?.runners.length ?? 0) > 0;
|
|
102
|
+
}
|
|
103
|
+
/** @description The parallel limits of a runner's groups as the `name=n,name=n` string the runner script applies, in the order of the file (the runner applies each pair on its own, so the order carries no meaning). */
|
|
104
|
+
function formatGroupLimits(groups) {
|
|
105
|
+
return Object.entries(groups ?? {}).map(([groupName, parallel]) => `${groupName}=${parallel}`).join(',');
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=runnersConfig.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"runnersConfig.js","sourceRoot":"","sources":["../../src/remoteRun/runnersConfig.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA6CA,oDAEC;AAaD,8CAEC;AAGD,0DAEC;AAGD,0DAGC;AAGD,8CAEC;AA9ED,uCAAyB;AACzB,2CAA6B;AAC7B,6BAAwB;AACxB,oDAA+E;AAC/E,gDAA4D;AAE5D;;;;;;;;;;;;GAYG;AAEH,MAAM,cAAc,GAAG,cAAc,CAAC;AACtC,MAAM,iBAAiB,GAAG,4BAA4B,CAAC;AACvD,MAAM,gBAAgB,GAAG,6BAA6B,CAAC;AACvD,6FAA6F;AAChF,QAAA,iBAAiB,GAAG,SAAS,CAAC;AAE3C,MAAM,YAAY,GAAG,OAAC,CAAC,YAAY,CAAC;IAClC,IAAI,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,KAAK,CAAC,iBAAiB,EAAE,qDAAqD,CAAC;IAChG,GAAG,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,EAAE,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,WAAW,CAAC,EAAE,kFAAkF,CAAC;IAC3L,UAAU,EAAE,OAAC,CAAC,KAAK,CAAC,OAAC,CAAC,MAAM,EAAE,CAAC,CAAC,QAAQ,EAAE;IAC1C,OAAO,EAAE,OAAC,CAAC,MAAM,EAAE,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,OAAO,EAAE,EAAE,CAAC,OAAO,CAAC,UAAU,CAAC,GAAG,CAAC,IA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CAAC,CAAC,CAAC,SAAS,EAAE,QAAQ,CAAC,EAAE,EAAE,CAAC,GAAG,SAAS,IAAI,QAAQ,EAAE,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;AAC3G,CAAC"}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @description Bring a job's result files into the project, from a temp folder the runner's files were rsynced into. The runner is not
|
|
3
|
+
* trusted to write into the main box: only REGULAR files whose project-relative path a `pull:` pattern names are copied — never one that
|
|
4
|
+
* {@link getProtectedPathReason} protects; a symlink,
|
|
5
|
+
* a special file, a path no pattern names, or a destination that would pass through a symlink or over a directory of the project is
|
|
6
|
+
* refused and only counted. Nothing outside the project root can be reached: paths come from walking the temp folder, and every
|
|
7
|
+
* destination directory is checked component by component.
|
|
8
|
+
*/
|
|
9
|
+
export interface SafeCopyResult {
|
|
10
|
+
copied: string[];
|
|
11
|
+
/** Files seen in the fetched folder that were not copied (symlinks, special files, paths no pattern names, unsafe destinations). */
|
|
12
|
+
refusedCount: number;
|
|
13
|
+
}
|
|
14
|
+
/**
|
|
15
|
+
* @description Why a path may never be copied in, whatever a `pull:` pattern says — or `null`. A broad pattern (`**`) is a trust in the
|
|
16
|
+
* runner for what it names, but some files turn that into code running on the MAIN box: anything under a `.git` (a hook, or
|
|
17
|
+
* `core.hooksPath` / `fsmonitor` in its `config`, run at the next git command), the project's own `.remote-run` (it decides what is sent,
|
|
18
|
+
* installed and pulled next time), and anything in a folder git takes hooks from (`hookDirectories`: `getHookDirectories` in `project.ts` —
|
|
19
|
+
* husky's `.husky`, a `core.hooksPath` inside the project). Compared case-insensitively: on a case-insensitive disk `.Git/hooks` IS
|
|
20
|
+
* `.git/hooks`. Other tools that run commands at commit (lint-staged and lefthook configs, `package.json` scripts) are not recognised:
|
|
21
|
+
* that is what keeping `pull:` narrow is for.
|
|
22
|
+
*/
|
|
23
|
+
export declare function getProtectedPathReason(relativePath: string, hookDirectories?: readonly string[]): string | null;
|
|
24
|
+
/** @description Copy the files of `fetchedRoot` that `patterns` name into `projectRoot`, as the module comment says. */
|
|
25
|
+
export declare function copyFetchedFiles(params: {
|
|
26
|
+
fetchedRoot: string;
|
|
27
|
+
projectRoot: string;
|
|
28
|
+
patterns: readonly string[];
|
|
29
|
+
hookDirectories?: readonly string[];
|
|
30
|
+
}): SafeCopyResult;
|
|
31
|
+
//# sourceMappingURL=safeCopy.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"safeCopy.d.ts","sourceRoot":"","sources":["../../src/remoteRun/safeCopy.ts"],"names":[],"mappings":"AAKA;;;;;;;GAOG;AAEH,MAAM,WAAW,cAAc;IAC7B,MAAM,EAAE,MAAM,EAAE,CAAC;IACjB,oIAAoI;IACpI,YAAY,EAAE,MAAM,CAAC;CACtB;AAuCD;;;;;;;;GAQG;AACH,wBAAgB,sBAAsB,CAAC,YAAY,EAAE,MAAM,EAAE,eAAe,GAAE,SAAS,MAAM,EAAO,GAAG,MAAM,GAAG,IAAI,CAMnH;AAED,wHAAwH;AACxH,wBAAgB,gBAAgB,CAAC,MAAM,EAAE;IAAE,WAAW,EAAE,MAAM,CAAC;IAAC,WAAW,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,SAAS,MAAM,EAAE,CAAC;IAAC,eAAe,CAAC,EAAE,SAAS,MAAM,EAAE,CAAA;CAAE,GAAG,cAAc,CAmCvK"}
|