@shivaedev/work-fleet 0.2.1 → 0.4.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 +55 -0
- package/README.md +61 -19
- package/dist/DispatchRequest.d.ts +13 -0
- package/dist/DispatchRequest.d.ts.map +1 -0
- package/dist/DispatchRequest.js +12 -0
- package/dist/DispatchRequest.js.map +1 -0
- package/dist/admit.d.ts +11 -0
- package/dist/admit.d.ts.map +1 -1
- package/dist/attention.d.ts +1 -0
- package/dist/attention.d.ts.map +1 -1
- package/dist/attention.js +4 -0
- package/dist/attention.js.map +1 -1
- package/dist/board/fleetField.d.ts +1 -0
- package/dist/board/fleetField.d.ts.map +1 -1
- package/dist/board/fleetField.js +4 -0
- package/dist/board/fleetField.js.map +1 -1
- package/dist/board/markdown.d.ts.map +1 -1
- package/dist/board/markdown.js +7 -2
- package/dist/board/markdown.js.map +1 -1
- package/dist/board/publish.d.ts +2 -0
- package/dist/board/publish.d.ts.map +1 -1
- package/dist/board/publishReport.d.ts +1 -0
- package/dist/board/publishReport.d.ts.map +1 -1
- package/dist/board/readPass.d.ts +1 -0
- package/dist/board/readPass.d.ts.map +1 -1
- package/dist/cli.js +13 -6
- package/dist/cli.js.map +1 -1
- package/dist/engine/abandonStalled.d.ts +1171 -1004
- package/dist/engine/abandonStalled.d.ts.map +1 -1
- package/dist/engine/admissionOrder.d.ts +1091 -0
- package/dist/engine/admissionOrder.d.ts.map +1 -0
- package/dist/engine/admissionOrder.js +15 -0
- package/dist/engine/admissionOrder.js.map +1 -0
- package/dist/engine/applyResolution.d.ts +20 -0
- package/dist/engine/applyResolution.d.ts.map +1 -1
- package/dist/engine/approveBrief.d.ts +31 -0
- package/dist/engine/approveBrief.d.ts.map +1 -1
- package/dist/engine/authorizeResolution.d.ts +1160 -1003
- package/dist/engine/authorizeResolution.d.ts.map +1 -1
- package/dist/engine/boardBrief.d.ts +32 -0
- package/dist/engine/boardBrief.d.ts.map +1 -1
- package/dist/engine/capacityRetry.d.ts +3488 -3007
- package/dist/engine/capacityRetry.d.ts.map +1 -1
- package/dist/engine/closeDecisions.d.ts +20 -0
- package/dist/engine/closeDecisions.d.ts.map +1 -1
- package/dist/engine/completeBoardWork.d.ts +20 -0
- package/dist/engine/completeBoardWork.d.ts.map +1 -1
- package/dist/engine/completeReport.d.ts +21 -0
- package/dist/engine/completeReport.d.ts.map +1 -1
- package/dist/engine/continueCommand.d.ts +10 -0
- package/dist/engine/continueCommand.d.ts.map +1 -1
- package/dist/engine/continueWorker.d.ts +20 -0
- package/dist/engine/continueWorker.d.ts.map +1 -1
- package/dist/engine/deliverPendingAnswers.d.ts +1085 -898
- package/dist/engine/deliverPendingAnswers.d.ts.map +1 -1
- package/dist/engine/dispatchCommand.d.ts +14 -1
- package/dist/engine/dispatchCommand.d.ts.map +1 -1
- package/dist/engine/dispatchCommand.js +25 -5
- package/dist/engine/dispatchCommand.js.map +1 -1
- package/dist/engine/ensureDecisionOwner.d.ts +20 -0
- package/dist/engine/ensureDecisionOwner.d.ts.map +1 -1
- package/dist/engine/ensurePublication.d.ts +20 -0
- package/dist/engine/ensurePublication.d.ts.map +1 -1
- package/dist/engine/failureContext.d.ts +1 -0
- package/dist/engine/failureContext.d.ts.map +1 -1
- package/dist/engine/failureContext.js.map +1 -1
- package/dist/engine/failureMessage.js +11 -1
- package/dist/engine/failureMessage.js.map +1 -1
- package/dist/engine/health.d.ts +10 -0
- package/dist/engine/health.d.ts.map +1 -1
- package/dist/engine/inspectRenewal.d.ts +21 -0
- package/dist/engine/inspectRenewal.d.ts.map +1 -1
- package/dist/engine/launchInput.d.ts +10 -0
- package/dist/engine/launchInput.d.ts.map +1 -1
- package/dist/engine/launchReceipt.d.ts +10 -0
- package/dist/engine/launchReceipt.d.ts.map +1 -1
- package/dist/engine/localOnlyCriteria.d.ts +1 -0
- package/dist/engine/localOnlyCriteria.d.ts.map +1 -1
- package/dist/engine/localOnlyCriteria.js +5 -1
- package/dist/engine/localOnlyCriteria.js.map +1 -1
- package/dist/engine/makeAdopt.d.ts +21 -0
- package/dist/engine/makeAdopt.d.ts.map +1 -1
- package/dist/engine/makeAdvance.d.ts +10 -0
- package/dist/engine/makeAdvance.d.ts.map +1 -1
- package/dist/engine/makeDeliver.d.ts +20 -0
- package/dist/engine/makeDeliver.d.ts.map +1 -1
- package/dist/engine/makeHuman.d.ts +20 -0
- package/dist/engine/makeHuman.d.ts.map +1 -1
- package/dist/engine/makeLaunch.d.ts +20 -0
- package/dist/engine/makeLaunch.d.ts.map +1 -1
- package/dist/engine/makeLaunch.js +4 -13
- package/dist/engine/makeLaunch.js.map +1 -1
- package/dist/engine/makeObserve.d.ts +20 -0
- package/dist/engine/makeObserve.d.ts.map +1 -1
- package/dist/engine/makeReview.d.ts +21 -0
- package/dist/engine/makeReview.d.ts.map +1 -1
- package/dist/engine/makeState.d.ts +1164 -1010
- package/dist/engine/makeState.d.ts.map +1 -1
- package/dist/engine/makeState.js +19 -11
- package/dist/engine/makeState.js.map +1 -1
- package/dist/engine/makeValidate.d.ts +21 -0
- package/dist/engine/makeValidate.d.ts.map +1 -1
- package/dist/engine/mergeReadiness.d.ts +1425 -1764
- package/dist/engine/mergeReadiness.d.ts.map +1 -1
- package/dist/engine/mergeReadiness.js +3 -4
- package/dist/engine/mergeReadiness.js.map +1 -1
- package/dist/engine/observeDeliveryFailure.d.ts +1170 -1003
- package/dist/engine/observeDeliveryFailure.d.ts.map +1 -1
- package/dist/engine/observeRenewal.d.ts +33 -0
- package/dist/engine/observeRenewal.d.ts.map +1 -1
- package/dist/engine/obtainReview.d.ts +11 -0
- package/dist/engine/obtainReview.d.ts.map +1 -1
- package/dist/engine/obtainReview.js +2 -1
- package/dist/engine/obtainReview.js.map +1 -1
- package/dist/engine/operationRecord.d.ts +1898 -1779
- package/dist/engine/operationRecord.d.ts.map +1 -1
- package/dist/engine/persistTerminalReceipts.d.ts +20 -0
- package/dist/engine/persistTerminalReceipts.d.ts.map +1 -1
- package/dist/engine/prepareCommand.d.ts +10 -0
- package/dist/engine/prepareCommand.d.ts.map +1 -1
- package/dist/engine/prepareCommand.js +1 -1
- package/dist/engine/prepareCommand.js.map +1 -1
- package/dist/engine/queueAnswerCommand.d.ts +10 -0
- package/dist/engine/queueAnswerCommand.d.ts.map +1 -1
- package/dist/engine/readOrContinueReview.d.ts +11 -0
- package/dist/engine/readOrContinueReview.d.ts.map +1 -1
- package/dist/engine/readOrContinueReview.js +2 -1
- package/dist/engine/readOrContinueReview.js.map +1 -1
- package/dist/engine/readResolution.d.ts +1 -0
- package/dist/engine/readResolution.d.ts.map +1 -1
- package/dist/engine/readRetry.d.ts +2345 -2010
- package/dist/engine/readRetry.d.ts.map +1 -1
- package/dist/engine/readRetry.js +22 -2
- package/dist/engine/readRetry.js.map +1 -1
- package/dist/engine/reassignCommand.d.ts +10 -0
- package/dist/engine/reassignCommand.d.ts.map +1 -1
- package/dist/engine/reconcileAttempt.d.ts +12 -1
- package/dist/engine/reconcileAttempt.d.ts.map +1 -1
- package/dist/engine/reconcileAttempt.js +2 -1
- package/dist/engine/reconcileAttempt.js.map +1 -1
- package/dist/engine/reconcileCommand.d.ts +10 -0
- package/dist/engine/reconcileCommand.d.ts.map +1 -1
- package/dist/engine/recordResponseCommand.d.ts +551 -0
- package/dist/engine/recordResponseCommand.d.ts.map +1 -0
- package/dist/engine/recordResponseCommand.js +30 -0
- package/dist/engine/recordResponseCommand.js.map +1 -0
- package/dist/engine/recoverStall.d.ts +1172 -1004
- package/dist/engine/recoverStall.d.ts.map +1 -1
- package/dist/engine/recoverStall.js +1 -1
- package/dist/engine/recoverStall.js.map +1 -1
- package/dist/engine/recoverUnobservable.d.ts +1172 -1004
- package/dist/engine/recoverUnobservable.d.ts.map +1 -1
- package/dist/engine/refreshBrief.d.ts +2344 -2009
- package/dist/engine/refreshBrief.d.ts.map +1 -1
- package/dist/engine/refreshReviewResult.d.ts +21 -0
- package/dist/engine/refreshReviewResult.d.ts.map +1 -1
- package/dist/engine/releaseClosedPreparation.d.ts +1171 -1003
- package/dist/engine/releaseClosedPreparation.d.ts.map +1 -1
- package/dist/engine/releaseExecution.d.ts +1170 -1003
- package/dist/engine/releaseExecution.d.ts.map +1 -1
- package/dist/engine/releaseFinishedWork.d.ts +10 -0
- package/dist/engine/releaseFinishedWork.d.ts.map +1 -1
- package/dist/engine/repository.d.ts +1115 -1003
- package/dist/engine/repository.d.ts.map +1 -1
- package/dist/engine/repository.js +12 -12
- package/dist/engine/repository.js.map +1 -1
- package/dist/engine/requestConflictRepair.d.ts +1170 -1003
- package/dist/engine/requestConflictRepair.d.ts.map +1 -1
- package/dist/engine/requestRework.d.ts +20 -0
- package/dist/engine/requestRework.d.ts.map +1 -1
- package/dist/engine/resolveCommand.d.ts +10 -0
- package/dist/engine/resolveCommand.d.ts.map +1 -1
- package/dist/engine/resolveExecution.d.ts +1170 -1003
- package/dist/engine/resolveExecution.d.ts.map +1 -1
- package/dist/engine/resumeAttempt.d.ts +1171 -1003
- package/dist/engine/resumeAttempt.d.ts.map +1 -1
- package/dist/engine/retireUnacknowledged.d.ts +20 -0
- package/dist/engine/retireUnacknowledged.d.ts.map +1 -1
- package/dist/engine/retryTerminal.d.ts +1160 -1003
- package/dist/engine/retryTerminal.d.ts.map +1 -1
- package/dist/engine/saveLaunch.d.ts +10598 -0
- package/dist/engine/saveLaunch.d.ts.map +1 -0
- package/dist/engine/saveLaunch.js +30 -0
- package/dist/engine/saveLaunch.js.map +1 -0
- package/dist/engine/scheduler.d.ts +21 -1
- package/dist/engine/scheduler.d.ts.map +1 -1
- package/dist/engine/scheduler.js +3 -5
- package/dist/engine/scheduler.js.map +1 -1
- package/dist/engine/sessionCleanup.d.ts +20 -0
- package/dist/engine/sessionCleanup.d.ts.map +1 -1
- package/dist/engine/settleMergedDelivery.d.ts +1170 -1003
- package/dist/engine/settleMergedDelivery.d.ts.map +1 -1
- package/dist/engine/steerBrief.d.ts +1075 -898
- package/dist/engine/steerBrief.d.ts.map +1 -1
- package/dist/engine/submissionFailure.d.ts +1150 -1003
- package/dist/engine/submissionFailure.d.ts.map +1 -1
- package/dist/engine/submitLaunch.d.ts +1160 -1003
- package/dist/engine/submitLaunch.d.ts.map +1 -1
- package/dist/engine/views.d.ts.map +1 -1
- package/dist/engine/views.js +4 -0
- package/dist/engine/views.js.map +1 -1
- package/dist/engine/workerReport.d.ts +30 -0
- package/dist/engine/workerReport.d.ts.map +1 -1
- package/dist/fleet.d.ts +2716 -983
- package/dist/fleet.d.ts.map +1 -1
- package/dist/fleet.js +4 -0
- package/dist/fleet.js.map +1 -1
- package/dist/host/actionCommands.d.ts.map +1 -1
- package/dist/host/actionCommands.js +7 -6
- package/dist/host/actionCommands.js.map +1 -1
- package/dist/host/admission.d.ts +24 -1
- package/dist/host/admission.d.ts.map +1 -1
- package/dist/host/admission.js +2 -2
- package/dist/host/admission.js.map +1 -1
- package/dist/host/answerWork.d.ts +12 -2
- package/dist/host/answerWork.d.ts.map +1 -1
- package/dist/host/answerWork.js +19 -23
- package/dist/host/answerWork.js.map +1 -1
- package/dist/host/cliOptions.d.ts +1 -1
- package/dist/host/cliOptions.d.ts.map +1 -1
- package/dist/host/cliOptions.js +1 -1
- package/dist/host/cliOptions.js.map +1 -1
- package/dist/host/commands.d.ts +28 -4
- package/dist/host/commands.d.ts.map +1 -1
- package/dist/host/commands.js +19 -5
- package/dist/host/commands.js.map +1 -1
- package/dist/host/config.d.ts +20 -5
- package/dist/host/config.d.ts.map +1 -1
- package/dist/host/config.js +17 -19
- package/dist/host/config.js.map +1 -1
- package/dist/host/configFile.d.ts +66 -0
- package/dist/host/configFile.d.ts.map +1 -0
- package/dist/host/configFile.js +37 -0
- package/dist/host/configFile.js.map +1 -0
- package/dist/host/configSettings.d.ts +488 -0
- package/dist/host/configSettings.d.ts.map +1 -0
- package/dist/host/configSettings.js +115 -0
- package/dist/host/configSettings.js.map +1 -0
- package/dist/host/daemon.d.ts +881 -1185
- package/dist/host/daemon.d.ts.map +1 -1
- package/dist/host/daemon.js +2 -1
- package/dist/host/daemon.js.map +1 -1
- package/dist/host/daemonClient.d.ts +301 -605
- package/dist/host/daemonClient.d.ts.map +1 -1
- package/dist/host/daemonClient.js +28 -7
- package/dist/host/daemonClient.js.map +1 -1
- package/dist/host/daemonContract.d.ts +1973 -3075
- package/dist/host/daemonContract.d.ts.map +1 -1
- package/dist/host/daemonContract.js +12 -4
- package/dist/host/daemonContract.js.map +1 -1
- package/dist/host/daemonDiagnostics.d.ts.map +1 -1
- package/dist/host/daemonDiagnostics.js +9 -3
- package/dist/host/daemonDiagnostics.js.map +1 -1
- package/dist/host/daemonHandlers.d.ts +2 -1
- package/dist/host/daemonHandlers.d.ts.map +1 -1
- package/dist/host/daemonHandlers.js +20 -7
- package/dist/host/daemonHandlers.js.map +1 -1
- package/dist/host/daemonSnapshots.d.ts.map +1 -1
- package/dist/host/daemonSnapshots.js +21 -1
- package/dist/host/daemonSnapshots.js.map +1 -1
- package/dist/host/dispatchRequests.d.ts +30 -0
- package/dist/host/dispatchRequests.d.ts.map +1 -0
- package/dist/host/dispatchRequests.js +40 -0
- package/dist/host/dispatchRequests.js.map +1 -0
- package/dist/host/follow.js +1 -1
- package/dist/host/follow.js.map +1 -1
- package/dist/host/followState.d.ts.map +1 -1
- package/dist/host/followState.js +5 -4
- package/dist/host/followState.js.map +1 -1
- package/dist/host/github.d.ts +5 -6
- package/dist/host/github.d.ts.map +1 -1
- package/dist/host/github.js +3 -4
- package/dist/host/github.js.map +1 -1
- package/dist/host/githubApi.d.ts +15 -0
- package/dist/host/githubApi.d.ts.map +1 -0
- package/dist/host/githubApi.js +117 -0
- package/dist/host/githubApi.js.map +1 -0
- package/dist/host/githubChecks.d.ts +13 -3
- package/dist/host/githubChecks.d.ts.map +1 -1
- package/dist/host/githubChecks.js +5 -5
- package/dist/host/githubChecks.js.map +1 -1
- package/dist/host/githubDelivery.d.ts +13 -1
- package/dist/host/githubDelivery.d.ts.map +1 -1
- package/dist/host/githubDelivery.js +39 -6
- package/dist/host/githubDelivery.js.map +1 -1
- package/dist/host/githubRateLimit.d.ts +23 -0
- package/dist/host/githubRateLimit.d.ts.map +1 -0
- package/dist/host/githubRateLimit.js +70 -0
- package/dist/host/githubRateLimit.js.map +1 -0
- package/dist/host/githubRequiredChecks.d.ts +1 -2
- package/dist/host/githubRequiredChecks.d.ts.map +1 -1
- package/dist/host/githubRequiredChecks.js +2 -2
- package/dist/host/githubRequiredChecks.js.map +1 -1
- package/dist/host/githubResponse.d.ts +10 -0
- package/dist/host/githubResponse.d.ts.map +1 -0
- package/dist/host/githubResponse.js +29 -0
- package/dist/host/githubResponse.js.map +1 -0
- package/dist/host/githubResult.d.ts +3 -2
- package/dist/host/githubResult.d.ts.map +1 -1
- package/dist/host/githubResult.js +9 -12
- package/dist/host/githubResult.js.map +1 -1
- package/dist/host/githubTransport.d.ts +13 -0
- package/dist/host/githubTransport.d.ts.map +1 -0
- package/dist/host/{githubRead.js → githubTransport.js} +9 -10
- package/dist/host/githubTransport.js.map +1 -0
- package/dist/host/integrations.d.ts +6 -0
- package/dist/host/integrations.d.ts.map +1 -0
- package/dist/host/integrations.js +34 -0
- package/dist/host/integrations.js.map +1 -0
- package/dist/host/liveConfig.d.ts +21 -0
- package/dist/host/liveConfig.d.ts.map +1 -0
- package/dist/host/liveConfig.js +75 -0
- package/dist/host/liveConfig.js.map +1 -0
- package/dist/host/providers.d.ts.map +1 -1
- package/dist/host/providers.js +2 -2
- package/dist/host/providers.js.map +1 -1
- package/dist/host/readWaitStates.d.ts.map +1 -1
- package/dist/host/readWaitStates.js +8 -18
- package/dist/host/readWaitStates.js.map +1 -1
- package/dist/host/reassignWork.d.ts +10 -0
- package/dist/host/reassignWork.d.ts.map +1 -1
- package/dist/host/recordDecisionResponse.d.ts +1 -0
- package/dist/host/recordDecisionResponse.d.ts.map +1 -1
- package/dist/host/releaseWork.d.ts +24 -3
- package/dist/host/releaseWork.d.ts.map +1 -1
- package/dist/host/releaseWork.js +11 -7
- package/dist/host/releaseWork.js.map +1 -1
- package/dist/host/renderStatus.d.ts +2 -2
- package/dist/host/renderStatus.d.ts.map +1 -1
- package/dist/host/renderStatus.js +8 -2
- package/dist/host/renderStatus.js.map +1 -1
- package/dist/host/reportBoard.d.ts +1 -1
- package/dist/host/reportBoard.d.ts.map +1 -1
- package/dist/host/reportBoard.js +6 -3
- package/dist/host/reportBoard.js.map +1 -1
- package/dist/host/reportPublication.d.ts +2 -1
- package/dist/host/reportPublication.d.ts.map +1 -1
- package/dist/host/reportPublication.js +5 -2
- package/dist/host/reportPublication.js.map +1 -1
- package/dist/host/runtime.d.ts +8 -6
- package/dist/host/runtime.d.ts.map +1 -1
- package/dist/host/runtime.js +38 -46
- package/dist/host/runtime.js.map +1 -1
- package/dist/host/snapshotStream.d.ts.map +1 -1
- package/dist/host/snapshotStream.js +4 -1
- package/dist/host/snapshotStream.js.map +1 -1
- package/dist/host/status.d.ts +22 -2
- package/dist/host/status.d.ts.map +1 -1
- package/dist/host/status.js +19 -5
- package/dist/host/status.js.map +1 -1
- package/dist/host/statusLayer.d.ts +3 -3
- package/dist/host/statusLayer.d.ts.map +1 -1
- package/dist/host/statusLayer.js +13 -3
- package/dist/host/statusLayer.js.map +1 -1
- package/dist/host/waitOutcome.d.ts.map +1 -1
- package/dist/host/waitOutcome.js +5 -2
- package/dist/host/waitOutcome.js.map +1 -1
- package/dist/model.d.ts +39 -0
- package/dist/model.d.ts.map +1 -1
- package/dist/model.js +5 -0
- package/dist/model.js.map +1 -1
- package/dist/operations.d.ts +270 -0
- package/dist/operations.d.ts.map +1 -1
- package/dist/packageInfo.d.ts +1 -1
- package/dist/packageInfo.js +1 -1
- package/dist/policy.d.ts +8 -0
- package/dist/policy.d.ts.map +1 -1
- package/dist/policy.js +2 -0
- package/dist/policy.js.map +1 -1
- package/dist/providers/codexCloud.d.ts +2 -0
- package/dist/providers/codexCloud.d.ts.map +1 -1
- package/dist/providers/codexCloud.js +2 -1
- package/dist/providers/codexCloud.js.map +1 -1
- package/dist/qualifyDependencies.d.ts +10 -0
- package/dist/qualifyDependencies.d.ts.map +1 -1
- package/dist/scheduling/admission.d.ts +1635 -0
- package/dist/scheduling/admission.d.ts.map +1 -0
- package/dist/scheduling/admission.js +11 -0
- package/dist/scheduling/admission.js.map +1 -0
- package/dist/scheduling/areas.d.ts +30 -0
- package/dist/scheduling/areas.d.ts.map +1 -1
- package/dist/scheduling/areas.js +1 -0
- package/dist/scheduling/areas.js.map +1 -1
- package/dist/scheduling/backPressure.d.ts +1637 -0
- package/dist/scheduling/backPressure.d.ts.map +1 -0
- package/dist/scheduling/backPressure.js +44 -0
- package/dist/scheduling/backPressure.js.map +1 -0
- package/dist/storage/FleetStoreOptions.d.ts +2 -2
- package/dist/storage/FleetStoreOptions.d.ts.map +1 -1
- package/dist/storage/addShapeColumns.d.ts +5 -0
- package/dist/storage/addShapeColumns.d.ts.map +1 -0
- package/dist/storage/addShapeColumns.js +24 -0
- package/dist/storage/addShapeColumns.js.map +1 -0
- package/dist/storage/dispatchStore.d.ts +47 -0
- package/dist/storage/dispatchStore.d.ts.map +1 -0
- package/dist/storage/dispatchStore.js +89 -0
- package/dist/storage/dispatchStore.js.map +1 -0
- package/dist/storage/errors.d.ts +2 -1
- package/dist/storage/errors.d.ts.map +1 -1
- package/dist/storage/errors.js +2 -1
- package/dist/storage/errors.js.map +1 -1
- package/dist/storage/fleetMigrations.d.ts +1 -1
- package/dist/storage/fleetMigrations.d.ts.map +1 -1
- package/dist/storage/fleetMigrations.js +24 -17
- package/dist/storage/fleetMigrations.js.map +1 -1
- package/dist/storage/listedRecords.d.ts +9 -0
- package/dist/storage/listedRecords.d.ts.map +1 -0
- package/dist/storage/listedRecords.js +40 -0
- package/dist/storage/listedRecords.js.map +1 -0
- package/dist/storage/makePostgresFleetStore.d.ts +2 -6
- package/dist/storage/makePostgresFleetStore.d.ts.map +1 -1
- package/dist/storage/makePostgresFleetStore.js +4 -10
- package/dist/storage/makePostgresFleetStore.js.map +1 -1
- package/dist/storage/model.d.ts +9 -0
- package/dist/storage/model.d.ts.map +1 -1
- package/dist/storage/model.js.map +1 -1
- package/dist/storage/shapeV14.d.ts +808 -0
- package/dist/storage/shapeV14.d.ts.map +1 -0
- package/dist/storage/shapeV14.js +18 -0
- package/dist/storage/shapeV14.js.map +1 -0
- package/package.json +6 -6
- package/src/DispatchRequest.ts +13 -0
- package/src/attention.ts +5 -0
- package/src/board/fleetField.ts +5 -0
- package/src/board/markdown.ts +7 -2
- package/src/cli.ts +24 -10
- package/src/engine/admissionOrder.ts +25 -0
- package/src/engine/dispatchCommand.ts +29 -5
- package/src/engine/failureContext.ts +1 -0
- package/src/engine/failureMessage.ts +12 -1
- package/src/engine/localOnlyCriteria.ts +6 -1
- package/src/engine/makeLaunch.ts +4 -17
- package/src/engine/makeState.ts +30 -26
- package/src/engine/mergeReadiness.ts +6 -5
- package/src/engine/obtainReview.ts +2 -1
- package/src/engine/prepareCommand.ts +1 -1
- package/src/engine/readOrContinueReview.ts +2 -1
- package/src/engine/readRetry.ts +26 -2
- package/src/engine/reconcileAttempt.ts +2 -1
- package/src/engine/recordResponseCommand.ts +38 -0
- package/src/engine/recoverStall.ts +1 -1
- package/src/engine/repository.ts +17 -16
- package/src/engine/saveLaunch.ts +45 -0
- package/src/engine/scheduler.ts +4 -6
- package/src/engine/views.ts +5 -0
- package/src/fleet.ts +4 -0
- package/src/host/actionCommands.ts +22 -7
- package/src/host/admission.ts +3 -3
- package/src/host/answerWork.ts +28 -27
- package/src/host/cliOptions.ts +1 -1
- package/src/host/commands.ts +29 -8
- package/src/host/config.ts +26 -22
- package/src/host/configFile.ts +40 -0
- package/src/host/configSettings.ts +126 -0
- package/src/host/daemon.ts +2 -1
- package/src/host/daemonClient.ts +42 -7
- package/src/host/daemonContract.ts +12 -4
- package/src/host/daemonDiagnostics.ts +11 -3
- package/src/host/daemonHandlers.ts +24 -7
- package/src/host/daemonSnapshots.ts +24 -1
- package/src/host/dispatchRequests.ts +53 -0
- package/src/host/follow.ts +1 -1
- package/src/host/followState.ts +6 -6
- package/src/host/github.ts +8 -6
- package/src/host/githubApi.ts +142 -0
- package/src/host/githubChecks.ts +6 -5
- package/src/host/githubDelivery.ts +47 -10
- package/src/host/githubRateLimit.ts +91 -0
- package/src/host/githubRequiredChecks.ts +2 -2
- package/src/host/githubResponse.ts +37 -0
- package/src/host/githubResult.ts +15 -17
- package/src/host/githubTransport.ts +31 -0
- package/src/host/integrations.ts +40 -0
- package/src/host/liveConfig.ts +135 -0
- package/src/host/providers.ts +4 -2
- package/src/host/readWaitStates.ts +8 -20
- package/src/host/releaseWork.ts +12 -9
- package/src/host/renderStatus.ts +10 -3
- package/src/host/reportBoard.ts +6 -3
- package/src/host/reportPublication.ts +6 -4
- package/src/host/runtime.ts +49 -56
- package/src/host/snapshotStream.ts +6 -1
- package/src/host/status.ts +24 -7
- package/src/host/statusLayer.ts +21 -5
- package/src/host/waitOutcome.ts +5 -2
- package/src/model.ts +6 -0
- package/src/packageInfo.ts +1 -1
- package/src/policy.ts +8 -0
- package/src/providers/codexCloud.ts +2 -1
- package/src/scheduling/admission.ts +19 -0
- package/src/scheduling/areas.ts +1 -0
- package/src/scheduling/backPressure.ts +55 -0
- package/src/storage/FleetStoreOptions.ts +7 -2
- package/src/storage/addShapeColumns.ts +24 -0
- package/src/storage/dispatchStore.ts +104 -0
- package/src/storage/errors.ts +2 -1
- package/src/storage/fleetMigrations.ts +24 -17
- package/src/storage/listedRecords.ts +53 -0
- package/src/storage/makePostgresFleetStore.ts +4 -10
- package/src/storage/model.ts +7 -0
- package/src/storage/shapeV14.ts +19 -0
- package/dist/host/githubRead.d.ts +0 -5
- package/dist/host/githubRead.d.ts.map +0 -1
- package/dist/host/githubRead.js.map +0 -1
- package/dist/host/recordPayloads.d.ts +0 -4
- package/dist/host/recordPayloads.d.ts.map +0 -1
- package/dist/host/recordPayloads.js +0 -21
- package/dist/host/recordPayloads.js.map +0 -1
- package/dist/storage/migrateFleet.d.ts +0 -3
- package/dist/storage/migrateFleet.d.ts.map +0 -1
- package/dist/storage/migrateFleet.js +0 -11
- package/dist/storage/migrateFleet.js.map +0 -1
- package/src/host/githubRead.ts +0 -20
- package/src/host/recordPayloads.ts +0 -24
- package/src/storage/migrateFleet.ts +0 -11
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { Clock, Effect, Layer } from "effect";
|
|
2
|
+
import { defineService } from "@shivaedev/effect-service/define-service.ts";
|
|
3
|
+
import { ServiceUnavailable } from "@shivaedev/platform/errors/taxonomy.ts";
|
|
4
|
+
import { githubPaused, pace, rateLimitWait, readObservation, reservedUntil, } from "#host/githubRateLimit.ts";
|
|
5
|
+
import { nextLink, parseResponse, requestResource } from "#host/githubResponse.ts";
|
|
6
|
+
import { GithubTransport, ghTransport } from "#host/githubTransport.ts";
|
|
7
|
+
const CACHE_LIMIT = 1000;
|
|
8
|
+
const PAGE_LIMIT = 100;
|
|
9
|
+
export const GithubApi = defineService({
|
|
10
|
+
id: "Fleet/GithubApi",
|
|
11
|
+
initialize: Effect.gen(function* () {
|
|
12
|
+
return {
|
|
13
|
+
blocks: new Map(),
|
|
14
|
+
cache: new Map(),
|
|
15
|
+
observations: new Map(),
|
|
16
|
+
transport: yield* GithubTransport,
|
|
17
|
+
};
|
|
18
|
+
}),
|
|
19
|
+
methods: (state) => {
|
|
20
|
+
function remember(url, page) {
|
|
21
|
+
state.cache.delete(url);
|
|
22
|
+
state.cache.set(url, page);
|
|
23
|
+
for (const key of state.cache.keys()) {
|
|
24
|
+
if (state.cache.size <= CACHE_LIMIT) {
|
|
25
|
+
break;
|
|
26
|
+
}
|
|
27
|
+
state.cache.delete(key);
|
|
28
|
+
}
|
|
29
|
+
return page;
|
|
30
|
+
}
|
|
31
|
+
function paused(resource, now) {
|
|
32
|
+
const blocked = state.blocks.get(resource)?.until;
|
|
33
|
+
if (blocked !== undefined && blocked > now) {
|
|
34
|
+
return { by: "rate-limit", until: blocked };
|
|
35
|
+
}
|
|
36
|
+
const reserved = reservedUntil(state.observations.get(resource), now);
|
|
37
|
+
return reserved === undefined ? undefined : { by: "reserve", until: reserved };
|
|
38
|
+
}
|
|
39
|
+
function limited(observation, now) {
|
|
40
|
+
const pause = paused(observation.resource, now);
|
|
41
|
+
return { ...observation, limitedBy: pause?.by ?? null, limitedUntil: pause?.until ?? null };
|
|
42
|
+
}
|
|
43
|
+
const settle = Effect.fn("Fleet.settle")(function* (url, exitCode, response, now) {
|
|
44
|
+
const observation = readObservation(response.headers, now);
|
|
45
|
+
const resource = observation?.resource ?? requestResource(url);
|
|
46
|
+
if (observation !== undefined) {
|
|
47
|
+
state.observations.set(resource, observation);
|
|
48
|
+
}
|
|
49
|
+
const previous = state.blocks.get(resource);
|
|
50
|
+
const wait = rateLimitWait(response, observation, now, previous?.failures ?? 0);
|
|
51
|
+
if (wait !== undefined) {
|
|
52
|
+
const until = Math.max(wait, previous?.until ?? 0);
|
|
53
|
+
state.blocks.set(resource, { failures: (previous?.failures ?? 0) + 1, until });
|
|
54
|
+
return yield* githubPaused("rate-limit", until);
|
|
55
|
+
}
|
|
56
|
+
state.blocks.delete(resource);
|
|
57
|
+
const cached = state.cache.get(url);
|
|
58
|
+
if (response.status === 304 && cached !== undefined) {
|
|
59
|
+
return remember(url, cached);
|
|
60
|
+
}
|
|
61
|
+
if (exitCode !== 0 || response.status < 200 || response.status > 299) {
|
|
62
|
+
return yield* new ServiceUnavailable({ message: `GitHub request failed with HTTP ${response.status}` });
|
|
63
|
+
}
|
|
64
|
+
return remember(url, { body: response.body, etag: response.headers.get("etag"), next: nextLink(response.headers) });
|
|
65
|
+
});
|
|
66
|
+
const request = Effect.fn("Fleet.request")(function* (url) {
|
|
67
|
+
const pause = paused(requestResource(url), yield* Clock.currentTimeMillis);
|
|
68
|
+
if (pause !== undefined) {
|
|
69
|
+
return yield* githubPaused(pause.by, pause.until);
|
|
70
|
+
}
|
|
71
|
+
const etag = state.cache.get(url)?.etag;
|
|
72
|
+
const { exitCode, output } = yield* state.transport([
|
|
73
|
+
"api",
|
|
74
|
+
"--include",
|
|
75
|
+
"--method",
|
|
76
|
+
"GET",
|
|
77
|
+
...(etag === undefined ? [] : ["--header", `If-None-Match: ${etag}`]),
|
|
78
|
+
url,
|
|
79
|
+
]);
|
|
80
|
+
const response = parseResponse(output);
|
|
81
|
+
if (response === undefined) {
|
|
82
|
+
return yield* new ServiceUnavailable({ message: "GitHub returned a response without an HTTP status" });
|
|
83
|
+
}
|
|
84
|
+
return yield* settle(url, exitCode, response, yield* Clock.currentTimeMillis);
|
|
85
|
+
});
|
|
86
|
+
return {
|
|
87
|
+
get: (endpoint) => request(endpoint).pipe(Effect.map(({ body }) => body)),
|
|
88
|
+
observations: () => Effect.gen(function* () {
|
|
89
|
+
const now = yield* Clock.currentTimeMillis;
|
|
90
|
+
return [...state.observations.values()]
|
|
91
|
+
.map((observation) => limited(observation, now))
|
|
92
|
+
.sort((left, right) => left.resource.localeCompare(right.resource));
|
|
93
|
+
}),
|
|
94
|
+
pace: (intervalMs) => Effect.gen(function* () {
|
|
95
|
+
const now = yield* Clock.currentTimeMillis;
|
|
96
|
+
const core = state.observations.get("core");
|
|
97
|
+
return pace(core === undefined ? undefined : limited(core, now), intervalMs, now);
|
|
98
|
+
}),
|
|
99
|
+
pages: (endpoint) => Effect.gen(function* () {
|
|
100
|
+
const bodies = [];
|
|
101
|
+
let next = endpoint;
|
|
102
|
+
while (next !== undefined) {
|
|
103
|
+
if (bodies.length >= PAGE_LIMIT) {
|
|
104
|
+
return yield* new ServiceUnavailable({ message: `GitHub returned more than ${PAGE_LIMIT} pages` });
|
|
105
|
+
}
|
|
106
|
+
const page = yield* request(next);
|
|
107
|
+
bodies.push(page.body);
|
|
108
|
+
next = page.next;
|
|
109
|
+
}
|
|
110
|
+
return `[${bodies.join(",")}]`;
|
|
111
|
+
}),
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
requires: [GithubTransport],
|
|
115
|
+
});
|
|
116
|
+
export const githubApiLayer = GithubApi.layer.pipe(Layer.provide(ghTransport));
|
|
117
|
+
//# sourceMappingURL=githubApi.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubApi.js","sourceRoot":"","sources":["../../src/host/githubApi.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,QAAQ,CAAC;AAC9C,OAAO,EAAE,aAAa,EAAE,MAAM,6CAA6C,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAGN,YAAY,EACZ,IAAI,EAEJ,aAAa,EACb,eAAe,EACf,aAAa,GACb,MAAM,0BAA0B,CAAC;AAClC,OAAO,EAAE,QAAQ,EAAuB,aAAa,EAAE,eAAe,EAAE,MAAM,yBAAyB,CAAC;AACxG,OAAO,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAYxE,MAAM,WAAW,GAAG,IAAI,CAAC;AACzB,MAAM,UAAU,GAAG,GAAG,CAAC;AAEvB,MAAM,CAAC,MAAM,SAAS,GAAG,aAAa,CAAC;IACtC,EAAE,EAAE,iBAAiB;IACrB,UAAU,EAAE,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC/B,OAAO;YACN,MAAM,EAAE,IAAI,GAAG,EAAiB;YAChC,KAAK,EAAE,IAAI,GAAG,EAAgB;YAC9B,YAAY,EAAE,IAAI,GAAG,EAA+B;YACpD,SAAS,EAAE,KAAK,CAAC,CAAC,eAAe;SACjC,CAAC;IACH,CAAC,CAAC;IACF,OAAO,EAAE,CAAC,KAAK,EAAE,EAAE;QAClB,SAAS,QAAQ,CAAC,GAAW,EAAE,IAAU;YACxC,KAAK,CAAC,KAAK,CAAC,MAAM,CAAC,GAAG,CAAC,CAAC;YACxB,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;YAC3B,KAAK,MAAM,GAAG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,CAAC,CAAC,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,EAAE,UAAU,EAAE,GAAG,CAAC,CAAC;YACnF,CAAC,CAAC;YACH,KAAK,EAAE,CAAC,QAAgB,EAAE,EAAE,CAC3B,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;gBACnB,MAAM,MAAM,GAAa,EAAE,CAAC;gBAC5B,IAAI,IAAI,GAAuB,QAAQ,CAAC;gBACxC,OAAO,IAAI,KAAK,SAAS,EAAE,CAAC;oBAC3B,IAAI,MAAM,CAAC,MAAM,IAAI,UAAU,EAAE,CAAC;wBACjC,OAAO,KAAK,CAAC,CAAC,IAAI,kBAAkB,CAAC,EAAE,OAAO,EAAE,6BAA6B,UAAU,QAAQ,EAAE,CAAC,CAAC;oBACpG,CAAC;oBACD,MAAM,IAAI,GAAS,KAAK,CAAC,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;oBACxC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;oBACvB,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC;gBAClB,CAAC;gBACD,OAAO,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,CAAC;YAChC,CAAC,CAAC;SACH,CAAC;IACH,CAAC;IACD,QAAQ,EAAE,CAAC,eAAe,CAAC;CAC3B,CAAC,CAAC;AAGH,MAAM,CAAC,MAAM,cAAc,GAAG,SAAS,CAAC,KAAK,CAAC,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,WAAW,CAAC,CAAC,CAAC"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { ServiceUnavailable } from "@shivaedev/platform/errors/taxonomy.ts";
|
|
3
3
|
import type { FleetError } from "#errors.ts";
|
|
4
|
-
import type {
|
|
4
|
+
import type { GithubRead } from "#host/github.ts";
|
|
5
5
|
export declare function makeGithubChecks<R>(read: (endpoint: string) => Effect.Effect<string, FleetError, R>, branch?: string): (result: {
|
|
6
6
|
readonly head: string;
|
|
7
7
|
readonly kind: "change";
|
|
@@ -20,12 +20,22 @@ export declare function makeGithubChecks<R>(read: (endpoint: string) => Effect.E
|
|
|
20
20
|
readonly pending?: boolean | undefined;
|
|
21
21
|
readonly repairPrompt?: string | undefined;
|
|
22
22
|
}, ServiceUnavailable, R>;
|
|
23
|
-
export declare function githubChecks(
|
|
23
|
+
export declare function githubChecks(read: GithubRead, branch?: string): (result: {
|
|
24
|
+
readonly head: string;
|
|
25
|
+
readonly kind: "change";
|
|
26
|
+
readonly paths: readonly string[];
|
|
27
|
+
readonly pr: string;
|
|
28
|
+
readonly prNumber?: number | undefined;
|
|
29
|
+
} | {
|
|
30
|
+
readonly evidence: readonly string[];
|
|
31
|
+
readonly head: string;
|
|
32
|
+
readonly kind: "no-change";
|
|
33
|
+
}) => Effect.Effect<{
|
|
24
34
|
readonly evidence: readonly string[];
|
|
25
35
|
readonly failedChecks?: readonly string[] | undefined;
|
|
26
36
|
readonly head: string;
|
|
27
37
|
readonly passed: boolean;
|
|
28
38
|
readonly pending?: boolean | undefined;
|
|
29
39
|
readonly repairPrompt?: string | undefined;
|
|
30
|
-
}, ServiceUnavailable,
|
|
40
|
+
}, ServiceUnavailable, never>;
|
|
31
41
|
//# sourceMappingURL=githubChecks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubChecks.d.ts","sourceRoot":"","sources":["../../src/host/githubChecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAE5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;
|
|
1
|
+
{"version":3,"file":"githubChecks.d.ts","sourceRoot":"","sources":["../../src/host/githubChecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAE5E,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AAUlD,wBAAgB,gBAAgB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,MAAM,SAAS;;;;;;;;;;;;;;;;;0BAmCpH;AAED,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,EAAE,MAAM,SAAS;;;;;;;;;;;;;;;;;8BAE7D"}
|
|
@@ -2,7 +2,7 @@ import { Effect, Schema } from "effect";
|
|
|
2
2
|
import { ServiceUnavailable } from "@shivaedev/platform/errors/taxonomy.ts";
|
|
3
3
|
import { withFailureContext } from "#engine/failureContext.ts";
|
|
4
4
|
import { CheckPages, githubCheckState, StatusPages } from "#host/githubCheckState.ts";
|
|
5
|
-
import {
|
|
5
|
+
import { githubFailure } from "#host/githubRateLimit.ts";
|
|
6
6
|
import { githubRequiredChecks } from "#host/githubRequiredChecks.ts";
|
|
7
7
|
function failure(message) {
|
|
8
8
|
return new ServiceUnavailable({ message });
|
|
@@ -21,8 +21,8 @@ export function makeGithubChecks(read, branch = "main") {
|
|
|
21
21
|
}), { code: "checks-result-invalid" });
|
|
22
22
|
}
|
|
23
23
|
const commit = `repos/${owner}/${repository}/commits/${result.head}`;
|
|
24
|
-
const checks = yield* read(`${commit}/check-runs?per_page=100&filter=latest`).pipe(Effect.flatMap(Schema.decodeUnknownEffect(Schema.fromJsonString(CheckPages))), Effect.mapError((
|
|
25
|
-
const statuses = yield* read(`${commit}/status?per_page=100`).pipe(Effect.flatMap(Schema.decodeUnknownEffect(Schema.fromJsonString(StatusPages))), Effect.mapError((
|
|
24
|
+
const checks = yield* read(`${commit}/check-runs?per_page=100&filter=latest`).pipe(Effect.flatMap(Schema.decodeUnknownEffect(Schema.fromJsonString(CheckPages))), Effect.mapError(githubFailure("GitHub check runs are unavailable or invalid")));
|
|
25
|
+
const statuses = yield* read(`${commit}/status?per_page=100`).pipe(Effect.flatMap(Schema.decodeUnknownEffect(Schema.fromJsonString(StatusPages))), Effect.mapError(githubFailure("GitHub commit statuses are unavailable or invalid")));
|
|
26
26
|
if (statuses.length === 0
|
|
27
27
|
|| checks.some((page) => page.checkRuns.some((check) => check.headSha !== result.head))
|
|
28
28
|
|| statuses.some((page) => page.sha !== result.head)) {
|
|
@@ -32,7 +32,7 @@ export function makeGithubChecks(read, branch = "main") {
|
|
|
32
32
|
return githubCheckState(result.head, result.pr, checks, statuses, required);
|
|
33
33
|
});
|
|
34
34
|
}
|
|
35
|
-
export function githubChecks(
|
|
36
|
-
return makeGithubChecks(
|
|
35
|
+
export function githubChecks(read, branch = "main") {
|
|
36
|
+
return makeGithubChecks(read.pages, branch);
|
|
37
37
|
}
|
|
38
38
|
//# sourceMappingURL=githubChecks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubChecks.js","sourceRoot":"","sources":["../../src/host/githubChecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;
|
|
1
|
+
{"version":3,"file":"githubChecks.js","sourceRoot":"","sources":["../../src/host/githubChecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAE,UAAU,EAAE,gBAAgB,EAAE,WAAW,EAAE,MAAM,2BA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,OAAO,gBAAgB,CAAC,IAAI,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;AAC7C,CAAC"}
|
|
@@ -1,7 +1,19 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { BadRequest, ServiceUnavailable } from "@shivaedev/platform/errors/taxonomy.ts";
|
|
3
3
|
import type { FleetError } from "#errors.ts";
|
|
4
|
-
|
|
4
|
+
import type { GithubRead } from "#host/github.ts";
|
|
5
|
+
export declare function readPullRequest(read: GithubRead["get"]): (pr: string) => Effect.Effect<{
|
|
6
|
+
readonly baseRefOid?: string | undefined;
|
|
7
|
+
readonly headRefOid: string;
|
|
8
|
+
readonly mergeable?: "CONFLICTING" | "MERGEABLE" | "UNKNOWN" | undefined;
|
|
9
|
+
readonly mergeCommit: {
|
|
10
|
+
readonly oid: string;
|
|
11
|
+
} | null;
|
|
12
|
+
readonly mergedAt: string | null;
|
|
13
|
+
readonly state: "CLOSED" | "MERGED" | "OPEN";
|
|
14
|
+
readonly url: string;
|
|
15
|
+
}, ServiceUnavailable, never>;
|
|
16
|
+
export declare function githubDelivery(read: (pr: string) => Effect.Effect<unknown, FleetError>): (result: {
|
|
5
17
|
readonly head: string;
|
|
6
18
|
readonly kind: "change";
|
|
7
19
|
readonly paths: readonly string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubDelivery.d.ts","sourceRoot":"","sources":["../../src/host/githubDelivery.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"githubDelivery.d.ts","sourceRoot":"","sources":["../../src/host/githubDelivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAGxF,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,iBAAiB,CAAC;AA4ClD,wBAAgB,eAAe,CAAC,IAAI,EAAE,UAAU,CAAC,KAAK,CAAC,QAC1C,MAAM;;;;;;;;;;8BAgBlB;AAED,wBAAgB,cAAc,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,OAAO,EAAE,UAAU,CAAC;;;;;;;;;;4OAiBtF"}
|
|
@@ -1,9 +1,8 @@
|
|
|
1
|
-
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
2
1
|
import { Effect, Schema } from "effect";
|
|
3
2
|
import { BadRequest, ServiceUnavailable } from "@shivaedev/platform/errors/taxonomy.ts";
|
|
4
3
|
import { conflictingPr, movedPrHead } from "#engine/deliveryFailure.ts";
|
|
5
4
|
import { withFailureContext } from "#engine/failureContext.ts";
|
|
6
|
-
import {
|
|
5
|
+
import { githubFailure } from "#host/githubRateLimit.ts";
|
|
7
6
|
const PullRequest = Schema.Struct({
|
|
8
7
|
baseRefOid: Schema.optional(Schema.NonEmptyString),
|
|
9
8
|
headRefOid: Schema.NonEmptyString,
|
|
@@ -16,15 +15,49 @@ const PullRequest = Schema.Struct({
|
|
|
16
15
|
function failure(message, reason = "invalid") {
|
|
17
16
|
return reason === "integration" ? new ServiceUnavailable({ message }) : new BadRequest({ message });
|
|
18
17
|
}
|
|
19
|
-
|
|
20
|
-
|
|
18
|
+
const Sha = Schema.String.check(Schema.isPattern(/^[a-f\d]{40}$/u));
|
|
19
|
+
const RestPullRequest = Schema.Struct({
|
|
20
|
+
base: Schema.Struct({ sha: Sha }),
|
|
21
|
+
head: Schema.Struct({ sha: Sha }),
|
|
22
|
+
htmlUrl: Schema.NonEmptyString,
|
|
23
|
+
mergeable: Schema.NullOr(Schema.Boolean),
|
|
24
|
+
mergeCommitSha: Schema.NullOr(Schema.String),
|
|
25
|
+
merged: Schema.Boolean,
|
|
26
|
+
mergedAt: Schema.NullOr(Schema.NonEmptyString),
|
|
27
|
+
state: Schema.Literals(["open", "closed"]),
|
|
28
|
+
}).pipe(Schema.encodeKeys({ htmlUrl: "html_url", mergeCommitSha: "merge_commit_sha", mergedAt: "merged_at" }));
|
|
29
|
+
function mergeability(mergeable) {
|
|
30
|
+
if (mergeable === null) {
|
|
31
|
+
return "UNKNOWN";
|
|
32
|
+
}
|
|
33
|
+
return mergeable ? "MERGEABLE" : "CONFLICTING";
|
|
34
|
+
}
|
|
35
|
+
function deliveryState(observed) {
|
|
36
|
+
if (observed.merged) {
|
|
37
|
+
return "MERGED";
|
|
38
|
+
}
|
|
39
|
+
return observed.state === "open" ? "OPEN" : "CLOSED";
|
|
40
|
+
}
|
|
41
|
+
export function readPullRequest(read) {
|
|
42
|
+
return (pr) => {
|
|
43
|
+
const match = /^https:\/\/github\.com\/(?<repository>[^/]+\/[^/]+)\/pull\/(?<number>[1-9]\d*)$/u.exec(pr)?.groups;
|
|
44
|
+
return read(`repos/${match?.repository}/pulls/${match?.number}`).pipe(Effect.flatMap(Schema.decodeUnknownEffect(Schema.fromJsonString(RestPullRequest))), Effect.map((observed) => ({
|
|
45
|
+
baseRefOid: observed.base.sha,
|
|
46
|
+
headRefOid: observed.head.sha,
|
|
47
|
+
mergeable: mergeability(observed.mergeable),
|
|
48
|
+
mergeCommit: observed.merged && observed.mergeCommitSha !== null ? { oid: observed.mergeCommitSha } : null,
|
|
49
|
+
mergedAt: observed.mergedAt,
|
|
50
|
+
state: deliveryState(observed),
|
|
51
|
+
url: observed.htmlUrl,
|
|
52
|
+
})), Effect.mapError(githubFailure("PR delivery observation failed; check GitHub CLI access and response")));
|
|
53
|
+
};
|
|
21
54
|
}
|
|
22
|
-
export function githubDelivery(
|
|
55
|
+
export function githubDelivery(read) {
|
|
23
56
|
return Effect.fn("FleetHost.githubDelivery")(function* (result) {
|
|
24
57
|
if (result.pr.match(/^https:\/\/github\.com\/[^/]+\/[^/]+\/pull\/[1-9]\d*$/u) === null) {
|
|
25
58
|
return yield* withFailureContext(new BadRequest({ message: "Delivery requires the adopted GitHub PR URL" }), { code: "delivery-pr-required" });
|
|
26
59
|
}
|
|
27
|
-
const pr = yield* Schema.decodeUnknownEffect(PullRequest)(yield* read(
|
|
60
|
+
const pr = yield* Schema.decodeUnknownEffect(PullRequest)(yield* read(result.pr)).pipe(Effect.mapError(() => failure("PR delivery observation returned an unknown shape", "integration")));
|
|
28
61
|
yield* validateDelivery(pr, result);
|
|
29
62
|
if (pr.state === "MERGED" && pr.mergedAt !== null && pr.mergeCommit !== null) {
|
|
30
63
|
return { head: pr.headRefOid, revision: pr.mergeCommit.oid, url: pr.url };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubDelivery.js","sourceRoot":"","sources":["../../src/host/githubDelivery.ts"],"names":[],"mappings":"AAAA,OAAO,
|
|
1
|
+
{"version":3,"file":"githubDelivery.js","sourceRoot":"","sources":["../../src/host/githubDelivery.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,UAAU,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AACxF,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACxE,OAAO,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAG/D,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAGzD,MAAM,WAAW,GAAG,MAAM,CAAC,MAAM,CAAC;IACjC,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,cAAc,CAAC;IAClD,UAAU,EAAE,MAAM,CAAC,cAAc;IACjC,SAAS,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,WAAW,EAAE,aAAa,EAAE,SAAS,CAAC,CAAC,CAAC;IACpF,WAAW,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,GAAG,EAAE,MAAM,CAAC,cAAc,EAAE,CAAC,CAAC;IACzE,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
|
|
|
1
|
+
import { ServiceUnavailable } from "@shivaedev/platform/errors/taxonomy.ts";
|
|
2
|
+
import { type ParsedResponse } from "#host/githubResponse.ts";
|
|
3
|
+
export type GithubPause = "rate-limit" | "reserve";
|
|
4
|
+
export interface GithubObservation {
|
|
5
|
+
readonly limit: number;
|
|
6
|
+
readonly limitedBy: GithubPause | null;
|
|
7
|
+
readonly limitedUntil: number | null;
|
|
8
|
+
readonly observedAt: number;
|
|
9
|
+
readonly remaining: number;
|
|
10
|
+
readonly reset: number;
|
|
11
|
+
readonly resource: string;
|
|
12
|
+
readonly used: number;
|
|
13
|
+
}
|
|
14
|
+
export type RecordedObservation = Omit<GithubObservation, "limitedBy" | "limitedUntil">;
|
|
15
|
+
export declare const RESERVE_SHARE = 0.2;
|
|
16
|
+
export declare function githubRateLimited(error: unknown): error is ServiceUnavailable;
|
|
17
|
+
export declare function githubFailure(message: string): (error: unknown) => ServiceUnavailable;
|
|
18
|
+
export declare function githubPaused(by: GithubPause, until: number): ServiceUnavailable;
|
|
19
|
+
export declare function reservedUntil(observation: RecordedObservation | undefined, now: number): number | undefined;
|
|
20
|
+
export declare function readObservation(headers: ReadonlyMap<string, string>, observedAt: number): RecordedObservation | undefined;
|
|
21
|
+
export declare function rateLimitWait(response: ParsedResponse, observation: RecordedObservation | undefined, now: number, failures: number): number | undefined;
|
|
22
|
+
export declare function pace(observation: GithubObservation | undefined, intervalMs: number, now: number): number;
|
|
23
|
+
//# sourceMappingURL=githubRateLimit.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubRateLimit.d.ts","sourceRoot":"","sources":["../../src/host/githubRateLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAE5E,OAAO,EAAe,KAAK,cAAc,EAAE,MAAM,yBAAyB,CAAC;AAE3E,MAAM,MAAM,WAAW,GAAG,YAAY,GAAG,SAAS,CAAC;AACnD,MAAM,WAAW,i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@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { ServiceUnavailable } from "@shivaedev/platform/errors/taxonomy.ts";
|
|
2
|
+
import { failureContext, withFailureContext } from "#engine/failureContext.ts";
|
|
3
|
+
import { headerCount } from "#host/githubResponse.ts";
|
|
4
|
+
// Every local tool shares one GitHub token, so Fleet leaves the last fifth of each budget to agents and people.
|
|
5
|
+
export const RESERVE_SHARE = 0.2;
|
|
6
|
+
const FULL_SPEED_SHARE = 0.5;
|
|
7
|
+
const SLOWEST_PACE_MS = 5 * 60_000;
|
|
8
|
+
const BACKOFF_MS = 60_000;
|
|
9
|
+
const BACKOFF_LIMIT_MS = 15 * 60_000;
|
|
10
|
+
export function githubRateLimited(error) {
|
|
11
|
+
return error instanceof ServiceUnavailable && failureContext(error).retryAt !== undefined;
|
|
12
|
+
}
|
|
13
|
+
export function githubFailure(message) {
|
|
14
|
+
return (error) => (githubRateLimited(error) ? error : new ServiceUnavailable({ message }));
|
|
15
|
+
}
|
|
16
|
+
const PAUSE_MESSAGES = {
|
|
17
|
+
"rate-limit": "GitHub is rate-limited until",
|
|
18
|
+
reserve: `GitHub paused below the ${RESERVE_SHARE * 100}% reserve until`,
|
|
19
|
+
};
|
|
20
|
+
export function githubPaused(by, until) {
|
|
21
|
+
return withFailureContext(new ServiceUnavailable({ message: `${PAUSE_MESSAGES[by]} ${new Date(until).toISOString()}` }), {
|
|
22
|
+
attentionOwner: "automation",
|
|
23
|
+
retryAt: until,
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
export function reservedUntil(observation, now) {
|
|
27
|
+
if (observation === undefined || observation.reset * 1000 <= now) {
|
|
28
|
+
return undefined;
|
|
29
|
+
}
|
|
30
|
+
return observation.remaining < observation.limit * RESERVE_SHARE ? observation.reset * 1000 : undefined;
|
|
31
|
+
}
|
|
32
|
+
export function readObservation(headers, observedAt) {
|
|
33
|
+
const resource = headers.get("x-ratelimit-resource");
|
|
34
|
+
const limit = headerCount(headers, "x-ratelimit-limit");
|
|
35
|
+
const remaining = headerCount(headers, "x-ratelimit-remaining");
|
|
36
|
+
const reset = headerCount(headers, "x-ratelimit-reset");
|
|
37
|
+
if (resource === undefined || limit === undefined || remaining === undefined || reset === undefined) {
|
|
38
|
+
return undefined;
|
|
39
|
+
}
|
|
40
|
+
return { limit, observedAt, remaining, reset, resource, used: headerCount(headers, "x-ratelimit-used") ?? limit - remaining };
|
|
41
|
+
}
|
|
42
|
+
export function rateLimitWait(response, observation, now, failures) {
|
|
43
|
+
const retryAfter = headerCount(response.headers, "retry-after");
|
|
44
|
+
const exhausted = observation?.remaining === 0 && observation.reset * 1000 > now ? observation.reset * 1000 : undefined;
|
|
45
|
+
const limited = observation?.remaining === 0 || retryAfter !== undefined || /rate limit/iu.test(response.body);
|
|
46
|
+
if (!([403, 429].includes(response.status) && limited)) {
|
|
47
|
+
return undefined;
|
|
48
|
+
}
|
|
49
|
+
if (retryAfter !== undefined) {
|
|
50
|
+
return now + retryAfter * 1000;
|
|
51
|
+
}
|
|
52
|
+
return exhausted ?? now + Math.min(BACKOFF_LIMIT_MS, BACKOFF_MS * 2 ** failures);
|
|
53
|
+
}
|
|
54
|
+
export function pace(observation, intervalMs, now) {
|
|
55
|
+
if (observation === undefined) {
|
|
56
|
+
return intervalMs;
|
|
57
|
+
}
|
|
58
|
+
if (observation.limitedUntil !== null && observation.limitedUntil > now) {
|
|
59
|
+
return Math.max(intervalMs, observation.limitedUntil - now);
|
|
60
|
+
}
|
|
61
|
+
const reset = observation.reset * 1000;
|
|
62
|
+
const share = observation.remaining / Math.max(1, observation.limit);
|
|
63
|
+
if (reset <= now || share >= FULL_SPEED_SHARE) {
|
|
64
|
+
return intervalMs;
|
|
65
|
+
}
|
|
66
|
+
const stretch = Math.min(1, (FULL_SPEED_SHARE - share) / (FULL_SPEED_SHARE - RESERVE_SHARE)) ** 2;
|
|
67
|
+
const paced = intervalMs + (Math.max(intervalMs, SLOWEST_PACE_MS) - intervalMs) * stretch;
|
|
68
|
+
return Math.round(Math.max(intervalMs, Math.min(paced, reset - now)));
|
|
69
|
+
}
|
|
70
|
+
//# sourceMappingURL=githubRateLimit.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubRateLimit.js","sourceRoot":"","sources":["../../src/host/githubRateLimit.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAC5E,OAAO,EAAE,cAAc,EAAE,kBAAkB,EAAE,MAAM,2BAA2B,CAAC;AAC/E,OAAO,EAAE,WAAW,EAAuB,MAAM,yBAAyB,CAAC;AAe3E,gHAAgH;AAChH,MAAM,CAAC,MAAM,aAAa,GAAG,GAAG,CAAC;AACjC,MAAM,gBAAgB,GAAG,GAAG,CAAC;AAC7B,MAAM,eAAe,GAAG,CAAC,GAAG,MAAM,CAAC;AACnC,MAAM,UAAU,GAAG,MAAM,CAAC;AAC1B,MAAM,gBAAgB,GAAG,EAAE,GAAG,MAAM,CAAC;AAErC,MAAM,UAAU,iBAAiB,CAAC,KAAc;IAC/C,OAAO,KAAK,YAAY,kBAAkB,IAAI,cAAc,CAAC,KAAK,CAAC,CAAC,OAAO,KAAK,SAAS,CAAC;AAC3F,CAAC;AAED,MAAM,UAAU,aAAa,CAAC,OAAe;IAC5C,OAAO,CAAC,KAAc,EAAsB,EAAE,CAAC,CAAC,iBAAiB,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,kBAAkB,CAAC,EAAE,OAAO,EAAE,CAAC,CAAC,CAAC;AACzH,CAAC;AAED,MAAM,cAAc,GAA0C;IAC7D,YAAY,EAAE,8BAA8B;IAC5C,OAAO,EAAE,2BAA2B,aAAa,GAAG,GAAG,iBAAiB;CACxE,CAAC;AAEF,MAAM,UAAU,YAAY,CAAC,EAAe,EAAE,KAAa;IAC1D,OAAO,kBAAkB,CAAC,IAAI,kBAAkB,CAAC,EAAE,OAAO,EAAE,GAAG,cAAc,CAAC,EAA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AI,CAAC,GAAG,CAAC,CAAC,EAAE,WAAW,CAAC,KAAK,CAAC,CAAC;IACrE,IAAI,KAAK,IAAI,GAAG,IAAI,KAAK,IAAI,gBAAgB,EAAE,CAAC;QAC/C,OAAO,UAAU,CAAC;IACnB,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC,gBAAgB,GAAG,KAAK,CAAC,GAAG,CAAC,gBAAgB,GAAG,aAAa,CAAC,CAAC,IAAI,CAAC,CAAC;IAClG,MAAM,KAAK,GAAG,UAAU,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,eAAe,CAAC,GAAG,UAAU,CAAC,GAAG,OAAO,CAAC;IAC1F,OAAO,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,UAAU,EAAE,IAAI,CAAC,GAAG,CAAC,KAAK,EAAE,KAAK,GAAG,GAAG,CAAC,CAAC,CAAC,CAAC;AACvE,CAAC"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
|
-
import { ServiceUnavailable } from "@shivaedev/platform/errors/taxonomy.ts";
|
|
3
2
|
import type { FleetError } from "#errors.ts";
|
|
4
|
-
export declare function githubRequiredChecks<R>(read: (endpoint: string) => Effect.Effect<string, FleetError, R>, repository: string, branch: string): Effect.Effect<string[], ServiceUnavailable, R>;
|
|
3
|
+
export declare function githubRequiredChecks<R>(read: (endpoint: string) => Effect.Effect<string, FleetError, R>, repository: string, branch: string): Effect.Effect<string[], import("@shivaedev/platform/errors/taxonomy.ts").ServiceUnavailable, R>;
|
|
5
4
|
//# sourceMappingURL=githubRequiredChecks.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubRequiredChecks.d.ts","sourceRoot":"","sources":["../../src/host/githubRequiredChecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,
|
|
1
|
+
{"version":3,"file":"githubRequiredChecks.d.ts","sourceRoot":"","sources":["../../src/host/githubRequiredChecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAU,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAQ7C,wBAAgB,oBAAoB,CAAC,CAAC,EAAE,IAAI,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,EAAE,CAAC,CAAC,EAAE,UAAU,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,mGAS3I"}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Effect, Schema } from "effect";
|
|
2
|
-
import {
|
|
2
|
+
import { githubFailure } from "#host/githubRateLimit.ts";
|
|
3
3
|
const RulePages = Schema.Array(Schema.Array(Schema.Struct({ parameters: Schema.optional(Schema.Unknown), type: Schema.String })));
|
|
4
4
|
const RequiredParameters = Schema.Struct({ requiredStatusChecks: Schema.Array(Schema.Struct({ context: Schema.String })) }).pipe(Schema.encodeKeys({ requiredStatusChecks: "required_status_checks" }));
|
|
5
5
|
export function githubRequiredChecks(read, repository, branch) {
|
|
@@ -8,6 +8,6 @@ export function githubRequiredChecks(read, repository, branch) {
|
|
|
8
8
|
const rules = pages.flat().filter((rule) => rule.type === "required_status_checks");
|
|
9
9
|
const parameters = yield* Effect.forEach(rules, (rule) => Schema.decodeUnknownEffect(RequiredParameters)(rule.parameters));
|
|
10
10
|
return [...new Set(parameters.flatMap((rule) => rule.requiredStatusChecks.map((check) => check.context)))];
|
|
11
|
-
}).pipe(Effect.mapError((
|
|
11
|
+
}).pipe(Effect.mapError(githubFailure("GitHub required status checks are unavailable or invalid")));
|
|
12
12
|
}
|
|
13
13
|
//# sourceMappingURL=githubRequiredChecks.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubRequiredChecks.js","sourceRoot":"","sources":["../../src/host/githubRequiredChecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;
|
|
1
|
+
{"version":3,"file":"githubRequiredChecks.js","sourceRoot":"","sources":["../../src/host/githubRequiredChecks.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AAEzD,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,UAAU,EAAE,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,OAAO,CAAC,EAAE,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC;AAClI,MAAM,kBAAkB,GAAG,MAAM,CAAC,MAAM,CAAC,EAAE,oBAAoB,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,CAAC,CAAC,EAAE,CAAC,CAAC,IAAI,CAC/H,MAAM,CAAC,UAAU,CAAC,EAAE,oBAAoB,EAAE,wBAAwB,EAAE,CAAC,CACrE,CAAC;AAEF,MAAM,UAAU,oBAAoB,CAAI,IAAgE,EAAE,UAAkB,EAAE,MAAc;IAC3I,OAAO,MAAM,CAAC,GAAG,CAAC,QAAQ,CAAC;QAC1B,MAAM,KAAK,GAAG,KAAK,CAAC,CAAC,IAAI,CAAC,SAAS,UAAU,mBAAmB,kBAAkB,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,IAAI,CACjG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,mBAAmB,CAAC,MAAM,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC,CAAC,CAC5E,CAAC;QACF,MAAM,KAAK,GAAG,KAAK,CAAC,IAAI,EAAE,CAAC,MAAM,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,KAAK,wBAAwB,CAAC,CAAC;QACpF,MAAM,UAAU,GAAG,KAAK,CAAC,CAAC,MAAM,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,kBAAkB,CAAC,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,CAAC;QAC3H,OAAO,CAAC,GAAG,IAAI,GAAG,CAAC,UAAU,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,oBAAoB,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC;IAC5G,CAAC,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,QAAQ,CAAC,aAAa,CAAC,0DAA0D,CAAC,CAAC,CAAC,CAAC;AACrG,CAAC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export interface ParsedResponse {
|
|
2
|
+
readonly body: string;
|
|
3
|
+
readonly headers: ReadonlyMap<string, string>;
|
|
4
|
+
readonly status: number;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseResponse(output: string): ParsedResponse | undefined;
|
|
7
|
+
export declare function headerCount(headers: ReadonlyMap<string, string>, name: string): number | undefined;
|
|
8
|
+
export declare function nextLink(headers: ReadonlyMap<string, string>): string | undefined;
|
|
9
|
+
export declare function requestResource(endpoint: string): "core" | "search";
|
|
10
|
+
//# sourceMappingURL=githubResponse.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubResponse.d.ts","sourceRoot":"","sources":["../../src/host/githubResponse.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC9B,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC;IACtB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9C,QAAQ,CAAC,MAAM,EAAE,MAAM,CAAC;CACxB;AAED,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAgBxE;AAED,wBAAgB,WAAW,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,EAAE,IAAI,EAAE,MAAM,sBAG7E;AAED,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,sBAE5D;AAED,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,qBAG/C"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
export function parseResponse(output) {
|
|
2
|
+
const split = /\r?\n\r?\n/u.exec(output);
|
|
3
|
+
const head = split === null ? output : output.slice(0, split.index);
|
|
4
|
+
const [statusLine = "", ...lines] = head.split(/\r?\n/u);
|
|
5
|
+
const status = Number(/^HTTP\/\S+ (?<status>\d{3})/u.exec(statusLine)?.groups?.status);
|
|
6
|
+
if (!Number.isInteger(status)) {
|
|
7
|
+
return undefined;
|
|
8
|
+
}
|
|
9
|
+
const headers = new Map();
|
|
10
|
+
for (const line of lines) {
|
|
11
|
+
const colon = line.indexOf(":");
|
|
12
|
+
if (colon > 0) {
|
|
13
|
+
headers.set(line.slice(0, colon).trim().toLowerCase(), line.slice(colon + 1).trim());
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
return { body: split === null ? "" : output.slice(split.index + split[0].length), headers, status };
|
|
17
|
+
}
|
|
18
|
+
export function headerCount(headers, name) {
|
|
19
|
+
const value = headers.get(name);
|
|
20
|
+
return value !== undefined && /^\d+$/u.test(value) ? Number(value) : undefined;
|
|
21
|
+
}
|
|
22
|
+
export function nextLink(headers) {
|
|
23
|
+
return /<(?<url>[^>]+)>;\s*rel="next"/u.exec(headers.get("link") ?? "")?.groups?.url;
|
|
24
|
+
}
|
|
25
|
+
export function requestResource(endpoint) {
|
|
26
|
+
const path = endpoint.replace(/^https:\/\/api\.github\.com\//u, "");
|
|
27
|
+
return path.startsWith("search/") ? "search" : "core";
|
|
28
|
+
}
|
|
29
|
+
//# sourceMappingURL=githubResponse.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"githubResponse.js","sourceRoot":"","sources":["../../src/host/githubResponse.ts"],"names":[],"mappings":"AAMA,MAAM,UAAU,aAAa,CAAC,MAAc;IAC3C,MAAM,KAAK,GAAG,aAAa,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IACzC,MAAM,IAAI,GAAG,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,KAAK,CAAC,CAAC;IACpE,MAAM,CAAC,UAAU,GAAG,EAAE,EAAE,GAAG,KAAK,CAAC,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC;IACzD,MAAM,MAAM,GAAG,MAAM,CAAC,8BAA8B,CAAC,IAAI,CAAC,UAAU,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IACvF,IAAI,CAAC,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,EAAE,CAAC;QAC/B,OAAO,SAAS,CAAC;IAClB,CAAC;IACD,MAAM,OAAO,GAAG,IAAI,GAAG,EAAkB,CAAC;IAC1C,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QAC1B,MAAM,KAAK,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC;QAChC,IAAI,KAAK,GAAG,CAAC,EAAE,CAAC;YACf,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,KAAK,CAAC,CAAC,IAAI,EAAE,CAAC,WAAW,EAAE,EAAE,IAAI,CAAC,KAAK,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC;QACtF,CAAC;IACF,CAAC;IACD,OAAO,EAAE,IAAI,EAAE,KAAK,KAAK,IAAI,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,KAAK,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,EAAE,OAAO,EAAE,MAAM,EAAE,CAAC;AACrG,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,OAAoC,EAAE,IAAY;IAC7E,MAAM,KAAK,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;IAChC,OAAO,KAAK,KAAK,SAAS,IAAI,QAAQ,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;AAChF,CAAC;AAED,MAAM,UAAU,QAAQ,CAAC,OAAoC;IAC5D,OAAO,gCAAgC,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC;AACtF,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,QAAgB;IAC/C,MAAM,IAAI,GAAG,QAAQ,CAAC,OAAO,CAAC,gCAAgC,EAAE,EAAE,CAAC,CAAC;IACpE,OAAO,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC;AACvD,CAAC"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { Effect } from "effect";
|
|
2
2
|
import { BadRequest, Conflict, ServiceUnavailable } from "@shivaedev/platform/errors/taxonomy.ts";
|
|
3
|
+
import type { FleetError } from "#errors.ts";
|
|
3
4
|
import type { FleetHost } from "#host/config.ts";
|
|
4
5
|
import { type GithubRead } from "#host/github.ts";
|
|
5
|
-
|
|
6
|
-
export declare function githubResult(host: FleetHost, main: MainSource["Service"], read?: GithubRead): (_work: {
|
|
6
|
+
export declare function githubResult(host: FleetHost, read: GithubRead, repository: Effect.Effect<string, FleetError>): (_work: {
|
|
7
7
|
readonly approved: boolean;
|
|
8
8
|
readonly areas?: readonly string[] | undefined;
|
|
9
9
|
readonly context: string;
|
|
10
10
|
readonly deliverable?: "report" | undefined;
|
|
11
11
|
readonly dependsOn: readonly string[];
|
|
12
|
+
readonly priority?: "high" | "normal" | "urgent" | undefined;
|
|
12
13
|
readonly revision: string;
|
|
13
14
|
readonly sourcePath: string;
|
|
14
15
|
readonly status?: string | undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"githubResult.d.ts","sourceRoot":"","sources":["../../src/host/githubResult.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"githubResult.d.ts","sourceRoot":"","sources":["../../src/host/githubResult.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChC,OAAO,EAAE,UAAU,EAAE,QAAQ,EAAE,kBAAkB,EAAE,MAAM,wCAAwC,CAAC;AAElG,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,YAAY,CAAC;AAC7C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,iBAAiB,CAAC;AACjD,OAAO,EAAa,KAAK,UAAU,EAA2B,MAAM,iBAAiB,CAAC;AAKtF,wBAAgB,YAAY,CAAC,IAAI,EAAE,SAAS,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+KAW5G"}
|
|
@@ -1,11 +1,9 @@
|
|
|
1
|
-
import * as NodeServices from "@effect/platform-node/NodeServices";
|
|
2
1
|
import { Effect } from "effect";
|
|
3
2
|
import { BadRequest, Conflict, ServiceUnavailable } from "@shivaedev/platform/errors/taxonomy.ts";
|
|
4
3
|
import { withFailureContext } from "#engine/failureContext.ts";
|
|
5
|
-
import { FilePages, githubJson, PullRequest
|
|
6
|
-
import { githubRead } from "#host/githubRead.ts";
|
|
4
|
+
import { FilePages, githubJson, PullRequest } from "#host/github.ts";
|
|
7
5
|
import { resultReport } from "#host/resultReport.ts";
|
|
8
|
-
export function githubResult(host,
|
|
6
|
+
export function githubResult(host, read, repository) {
|
|
9
7
|
return Effect.fn("FleetHost.githubResult")(function* (_work, observation) {
|
|
10
8
|
if (observation.execution !== "completed") {
|
|
11
9
|
return yield* new BadRequest({ message: "Result adoption requires completed worker execution" });
|
|
@@ -14,24 +12,23 @@ export function githubResult(host, main, read = (args) => githubRead(args, main.
|
|
|
14
12
|
if (report.pr.kind === "none") {
|
|
15
13
|
return { evidence: [observation.output], head: report.head, kind: "no-change" };
|
|
16
14
|
}
|
|
17
|
-
return yield* adoptPullRequest(host, read, report.head, report.pr.url);
|
|
15
|
+
return yield* adoptPullRequest(host, read, yield* repository, report.head, report.pr.url);
|
|
18
16
|
});
|
|
19
17
|
}
|
|
20
|
-
const adoptPullRequest = Effect.fn("FleetHost.adoptPullRequest")(function* (host, read, head, prUrl) {
|
|
21
|
-
const repository = yield* githubJson(Repository, read, ["repo", "view", "--json", "nameWithOwner"]);
|
|
18
|
+
const adoptPullRequest = Effect.fn("FleetHost.adoptPullRequest")(function* (host, read, repository, head, prUrl) {
|
|
22
19
|
const url = new URL(prUrl);
|
|
23
20
|
const parts = url.pathname.split("/");
|
|
24
21
|
const owner = parts[1];
|
|
25
22
|
const name = parts[2];
|
|
26
23
|
const number = Number(parts[4]);
|
|
27
|
-
if (!Number.isSafeInteger(number) || `${owner}/${name}`.toLowerCase() !== repository.
|
|
24
|
+
if (!Number.isSafeInteger(number) || `${owner}/${name}`.toLowerCase() !== repository.toLowerCase()) {
|
|
28
25
|
return yield* withFailureContext(new BadRequest({ message: "Reported PR must belong to the host repository" }), { code: "foreign-pr" });
|
|
29
26
|
}
|
|
30
|
-
const endpoint = `repos/${repository
|
|
31
|
-
const before = yield* githubJson(PullRequest, read
|
|
27
|
+
const endpoint = `repos/${repository}/pulls/${number}`;
|
|
28
|
+
const before = yield* githubJson(PullRequest, read.get(endpoint));
|
|
32
29
|
yield* validatePullRequest(before, head, number, prUrl, host.repository.branch);
|
|
33
|
-
const files = (yield* githubJson(FilePages, read
|
|
34
|
-
const after = yield* githubJson(PullRequest, read
|
|
30
|
+
const files = (yield* githubJson(FilePages, read.pages(`${endpoint}/files?per_page=100`))).flat();
|
|
31
|
+
const after = yield* githubJson(PullRequest, read.get(endpoint));
|
|
35
32
|
yield* validatePullRequest(after, head, number, prUrl, host.repository.branch);
|
|
36
33
|
if (before.changedFiles !== after.changedFiles) {
|
|
37
34
|
return yield* new Conflict({ message: "PR changed paths moved during observation" });
|