@kbediako/codex-orchestrator 0.1.37 → 0.2.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/.agents/plugins/marketplace.json +20 -0
- package/README.md +73 -291
- package/bin/codex-orchestrator.js +161 -0
- package/codex.orchestrator.json +149 -13
- package/dist/bin/codex-orchestrator.js +795 -1154
- package/dist/orchestrator/src/cli/adapters/CommandPlanner.js +22 -4
- package/dist/orchestrator/src/cli/adapters/CommandReviewer.js +3 -3
- package/dist/orchestrator/src/cli/adapters/CommandTester.js +2 -2
- package/dist/orchestrator/src/cli/adapters/cloudFailureDiagnostics.js +183 -11
- package/dist/orchestrator/src/cli/coStatusAttachCliShell.js +402 -0
- package/dist/orchestrator/src/cli/coStatusCliShell.js +429 -0
- package/dist/orchestrator/src/cli/coStatusOperatorAutopilotCliShell.js +120 -0
- package/dist/orchestrator/src/cli/codexCliShell.js +72 -0
- package/dist/orchestrator/src/cli/codexDefaultsSetup.js +49 -11
- package/dist/orchestrator/src/cli/config/delegationConfig.js +317 -5
- package/dist/orchestrator/src/cli/config/repoConfigPolicy.js +2 -3
- package/dist/orchestrator/src/cli/config/userConfig.js +28 -13
- package/dist/orchestrator/src/cli/control/authenticatedControlRouteGate.js +69 -0
- package/dist/orchestrator/src/cli/control/authenticatedRouteComposition.js +267 -0
- package/dist/orchestrator/src/cli/control/authenticatedRouteController.js +5 -0
- package/dist/orchestrator/src/cli/control/authenticatedRouteDispatcher.js +41 -0
- package/dist/orchestrator/src/cli/control/compatibilityIssuePresenter.js +1035 -0
- package/dist/orchestrator/src/cli/control/confirmationApproveController.js +62 -0
- package/dist/orchestrator/src/cli/control/confirmationCreateController.js +69 -0
- package/dist/orchestrator/src/cli/control/confirmationIssueConsumeController.js +43 -0
- package/dist/orchestrator/src/cli/control/confirmationListController.js +22 -0
- package/dist/orchestrator/src/cli/control/confirmationValidateController.js +58 -0
- package/dist/orchestrator/src/cli/control/confirmations.js +25 -3
- package/dist/orchestrator/src/cli/control/controlActionCancelConfirmation.js +65 -0
- package/dist/orchestrator/src/cli/control/controlActionController.js +77 -0
- package/dist/orchestrator/src/cli/control/controlActionControllerSequencing.js +161 -0
- package/dist/orchestrator/src/cli/control/controlActionExecution.js +142 -0
- package/dist/orchestrator/src/cli/control/controlActionFinalization.js +43 -0
- package/dist/orchestrator/src/cli/control/controlActionOutcome.js +60 -0
- package/dist/orchestrator/src/cli/control/controlActionPreflight.js +476 -0
- package/dist/orchestrator/src/cli/control/controlAuthenticatedRouteHandoff.js +57 -0
- package/dist/orchestrator/src/cli/control/controlBootstrapAssembly.js +39 -0
- package/dist/orchestrator/src/cli/control/controlBootstrapMetadataPersistence.js +16 -0
- package/dist/orchestrator/src/cli/control/controlEventTransport.js +49 -0
- package/dist/orchestrator/src/cli/control/controlExpiryLifecycle.js +102 -0
- package/dist/orchestrator/src/cli/control/controlHostOwnership.js +480 -0
- package/dist/orchestrator/src/cli/control/controlHostSupervision.js +608 -0
- package/dist/orchestrator/src/cli/control/controlOversightFacade.js +8 -0
- package/dist/orchestrator/src/cli/control/controlOversightReadContract.js +1 -0
- package/dist/orchestrator/src/cli/control/controlOversightReadService.js +16 -0
- package/dist/orchestrator/src/cli/control/controlOversightUpdateContract.js +1 -0
- package/dist/orchestrator/src/cli/control/controlPersistenceFiles.js +6 -0
- package/dist/orchestrator/src/cli/control/controlQuestionChildResolution.js +18 -0
- package/dist/orchestrator/src/cli/control/controlRequestContext.js +42 -0
- package/dist/orchestrator/src/cli/control/controlRequestController.js +9 -0
- package/dist/orchestrator/src/cli/control/controlRequestPredispatch.js +17 -0
- package/dist/orchestrator/src/cli/control/controlRequestRouteDispatch.js +44 -0
- package/dist/orchestrator/src/cli/control/controlRuntime.js +992 -0
- package/dist/orchestrator/src/cli/control/controlServer.js +23 -1456
- package/dist/orchestrator/src/cli/control/controlServerAuditAndErrorHelpers.js +115 -0
- package/dist/orchestrator/src/cli/control/controlServerAuthenticatedRouteBranch.js +29 -0
- package/dist/orchestrator/src/cli/control/controlServerBootstrapLifecycle.js +30 -0
- package/dist/orchestrator/src/cli/control/controlServerBootstrapStartSequence.js +21 -0
- package/dist/orchestrator/src/cli/control/controlServerOwnedRuntimeLifecycle.js +67 -0
- package/dist/orchestrator/src/cli/control/controlServerPublicLifecycle.js +756 -0
- package/dist/orchestrator/src/cli/control/controlServerPublicRouteHelpers.js +86 -0
- package/dist/orchestrator/src/cli/control/controlServerReadyInstanceLifecycle.js +25 -0
- package/dist/orchestrator/src/cli/control/controlServerReadyInstanceStartup.js +18 -0
- package/dist/orchestrator/src/cli/control/controlServerRequestBodyHelpers.js +37 -0
- package/dist/orchestrator/src/cli/control/controlServerRequestShell.js +40 -0
- package/dist/orchestrator/src/cli/control/controlServerRequestShellBinding.js +17 -0
- package/dist/orchestrator/src/cli/control/controlServerSeedLoading.js +27 -0
- package/dist/orchestrator/src/cli/control/controlServerSeededRuntimeAssembly.js +186 -0
- package/dist/orchestrator/src/cli/control/controlServerStartupInputPreparation.js +31 -0
- package/dist/orchestrator/src/cli/control/controlServerStartupSequence.js +49 -0
- package/dist/orchestrator/src/cli/control/controlState.js +233 -2
- package/dist/orchestrator/src/cli/control/controlStatusDashboard.js +1899 -0
- package/dist/orchestrator/src/cli/control/controlTelegramBridgeBootstrapLifecycle.js +22 -0
- package/dist/orchestrator/src/cli/control/controlTelegramBridgeLifecycle.js +67 -0
- package/dist/orchestrator/src/cli/control/controlTelegramBridgeOversightFacadeFactory.js +8 -0
- package/dist/orchestrator/src/cli/control/controlTelegramCommandController.js +49 -0
- package/dist/orchestrator/src/cli/control/controlTelegramDispatchRead.js +40 -0
- package/dist/orchestrator/src/cli/control/controlTelegramPollingController.js +89 -0
- package/dist/orchestrator/src/cli/control/controlTelegramProjectionNotificationController.js +29 -0
- package/dist/orchestrator/src/cli/control/controlTelegramPushState.js +63 -0
- package/dist/orchestrator/src/cli/control/controlTelegramQuestionRead.js +13 -0
- package/dist/orchestrator/src/cli/control/controlTelegramReadController.js +216 -0
- package/dist/orchestrator/src/cli/control/controlTelegramUpdateHandler.js +63 -0
- package/dist/orchestrator/src/cli/control/controlWatcher.js +73 -5
- package/dist/orchestrator/src/cli/control/delegationRegisterController.js +35 -0
- package/dist/orchestrator/src/cli/control/dynamicToolBridgePolicy.js +139 -0
- package/dist/orchestrator/src/cli/control/eventsSseController.js +12 -0
- package/dist/orchestrator/src/cli/control/linearBudgetState.js +1789 -0
- package/dist/orchestrator/src/cli/control/linearDispatchSource.js +1137 -0
- package/dist/orchestrator/src/cli/control/linearGraphqlClient.js +150 -0
- package/dist/orchestrator/src/cli/control/linearRateLimit.js +102 -0
- package/dist/orchestrator/src/cli/control/linearWebhookController.js +499 -0
- package/dist/orchestrator/src/cli/control/liveLinearAdvisoryRuntime.js +70 -0
- package/dist/orchestrator/src/cli/control/observabilityApiController.js +173 -0
- package/dist/orchestrator/src/cli/control/observabilityReadModel.js +500 -0
- package/dist/orchestrator/src/cli/control/observabilitySurface.js +284 -0
- package/dist/orchestrator/src/cli/control/observabilityUpdateNotifier.js +22 -0
- package/dist/orchestrator/src/cli/control/operatorDashboardPresenter.js +252 -0
- package/dist/orchestrator/src/cli/control/providerAgentCapacity.js +70 -0
- package/dist/orchestrator/src/cli/control/providerControlHostFreshnessGauge.js +1068 -0
- package/dist/orchestrator/src/cli/control/providerIntakeState.js +473 -0
- package/dist/orchestrator/src/cli/control/providerIssueHandoff.js +6811 -0
- package/dist/orchestrator/src/cli/control/providerIssueObservability.js +1348 -0
- package/dist/orchestrator/src/cli/control/providerIssueRetryQueue.js +84 -0
- package/dist/orchestrator/src/cli/control/providerLinearRuntimeProof.js +588 -0
- package/dist/orchestrator/src/cli/control/providerLinearScreenshotProof.js +473 -0
- package/dist/orchestrator/src/cli/control/providerLinearWorkerTruth.js +383 -0
- package/dist/orchestrator/src/cli/control/providerLinearWorkflowAudit.js +254 -0
- package/dist/orchestrator/src/cli/control/providerLinearWorkflowFacade.js +5573 -0
- package/dist/orchestrator/src/cli/control/providerLinearWorkflowStates.js +115 -0
- package/dist/orchestrator/src/cli/control/providerMergeCloseout.js +1868 -0
- package/dist/orchestrator/src/cli/control/providerOperatorAutopilot.js +1580 -0
- package/dist/orchestrator/src/cli/control/providerOperatorAutopilotLifecycle.js +154 -0
- package/dist/orchestrator/src/cli/control/providerOperatorAutopilotLocalRolloutExecution.js +1006 -0
- package/dist/orchestrator/src/cli/control/providerPollingHealth.js +435 -0
- package/dist/orchestrator/src/cli/control/providerTerminalCleanup.js +516 -0
- package/dist/orchestrator/src/cli/control/providerWorkerHosts.js +191 -0
- package/dist/orchestrator/src/cli/control/providerWorkflowConfigStore.js +515 -0
- package/dist/orchestrator/src/cli/control/questionChildResolutionAdapter.js +361 -0
- package/dist/orchestrator/src/cli/control/questionQueueController.js +181 -0
- package/dist/orchestrator/src/cli/control/questionReadRetryDeduplication.js +9 -0
- package/dist/orchestrator/src/cli/control/questionReadSequence.js +10 -0
- package/dist/orchestrator/src/cli/control/securityViolationController.js +27 -0
- package/dist/orchestrator/src/cli/control/selectedRunProjection.js +1838 -0
- package/dist/orchestrator/src/cli/control/telegramOversightApiClient.js +48 -0
- package/dist/orchestrator/src/cli/control/telegramOversightBridge.js +180 -0
- package/dist/orchestrator/src/cli/control/telegramOversightBridgeProjectionDeliveryQueue.js +25 -0
- package/dist/orchestrator/src/cli/control/telegramOversightBridgeRuntimeLifecycle.js +45 -0
- package/dist/orchestrator/src/cli/control/telegramOversightBridgeStateStore.js +77 -0
- package/dist/orchestrator/src/cli/control/telegramOversightControlActionApiClient.js +45 -0
- package/dist/orchestrator/src/cli/control/trackerDispatchPilot.js +439 -0
- package/dist/orchestrator/src/cli/control/uiDataController.js +34 -0
- package/dist/orchestrator/src/cli/control/uiSessionController.js +100 -0
- package/dist/orchestrator/src/cli/controlHostCliShell.js +860 -0
- package/dist/orchestrator/src/cli/controlHostFreshnessGaugeCliShell.js +129 -0
- package/dist/orchestrator/src/cli/controlHostSupervisionCliShell.js +2127 -0
- package/dist/orchestrator/src/cli/delegationCliShell.js +62 -0
- package/dist/orchestrator/src/cli/delegationServer.js +567 -678
- package/dist/orchestrator/src/cli/delegationServerCliShell.js +52 -0
- package/dist/orchestrator/src/cli/delegationServerQuestionFlowShell.js +228 -0
- package/dist/orchestrator/src/cli/delegationServerToolDispatchShell.js +411 -0
- package/dist/orchestrator/src/cli/delegationServerTransport.js +274 -0
- package/dist/orchestrator/src/cli/delegationSetup.js +51 -171
- package/dist/orchestrator/src/cli/devtoolsCliShell.js +34 -0
- package/dist/orchestrator/src/cli/doctor.js +542 -122
- package/dist/orchestrator/src/cli/doctorCliRequestShell.js +72 -0
- package/dist/orchestrator/src/cli/doctorCliShell.js +138 -0
- package/dist/orchestrator/src/cli/doctorUsage.js +136 -16
- package/dist/orchestrator/src/cli/exec/experience.js +16 -2
- package/dist/orchestrator/src/cli/exec/summary.js +3 -0
- package/dist/orchestrator/src/cli/execCliShell.js +51 -0
- package/dist/orchestrator/src/cli/flowCliRequestShell.js +44 -0
- package/dist/orchestrator/src/cli/flowCliShell.js +239 -0
- package/dist/orchestrator/src/cli/frontendTestCliRequestShell.js +80 -0
- package/dist/orchestrator/src/cli/frontendTestCliShell.js +41 -0
- package/dist/orchestrator/src/cli/init.js +1 -0
- package/dist/orchestrator/src/cli/initCliShell.js +50 -0
- package/dist/orchestrator/src/cli/linearCliShell.js +1200 -0
- package/dist/orchestrator/src/cli/mcpEnableCliShell.js +132 -0
- package/dist/orchestrator/src/cli/metrics/metricsAggregator.js +3 -2
- package/dist/orchestrator/src/cli/metrics/metricsRecorder.js +56 -0
- package/dist/orchestrator/src/cli/orchestrator.js +66 -1376
- package/dist/orchestrator/src/cli/planCliShell.js +19 -0
- package/dist/orchestrator/src/cli/prCliShell.js +41 -0
- package/dist/orchestrator/src/cli/providerLinearChildLanePhaseContract.js +204 -0
- package/dist/orchestrator/src/cli/providerLinearChildLaneRunner.js +1772 -0
- package/dist/orchestrator/src/cli/providerLinearChildLaneShell.js +2420 -0
- package/dist/orchestrator/src/cli/providerLinearChildStreamShell.js +385 -0
- package/dist/orchestrator/src/cli/providerLinearWorkerRunner.js +5738 -0
- package/dist/orchestrator/src/cli/resumeCliShell.js +14 -0
- package/dist/orchestrator/src/cli/reviewCliLaunchShell.js +72 -0
- package/dist/orchestrator/src/cli/rlm/alignment.js +3 -3
- package/dist/orchestrator/src/cli/rlm/context.js +94 -7
- package/dist/orchestrator/src/cli/rlm/rlmCodexRuntimeShell.js +546 -0
- package/dist/orchestrator/src/cli/rlm/symbolic.js +4 -2
- package/dist/orchestrator/src/cli/rlmCliRequestShell.js +42 -0
- package/dist/orchestrator/src/cli/rlmCompletionCliShell.js +46 -0
- package/dist/orchestrator/src/cli/rlmLaunchCliShell.js +51 -0
- package/dist/orchestrator/src/cli/rlmRunner.js +83 -523
- package/dist/orchestrator/src/cli/run/blockMemory.js +500 -0
- package/dist/orchestrator/src/cli/run/manifest.js +410 -73
- package/dist/orchestrator/src/cli/run/manifestPersister.js +45 -14
- package/dist/orchestrator/src/cli/run/runMemoryController.js +216 -0
- package/dist/orchestrator/src/cli/run/source0.js +690 -0
- package/dist/orchestrator/src/cli/run/workspacePath.js +101 -0
- package/dist/orchestrator/src/cli/runtime/mode.js +2 -1
- package/dist/orchestrator/src/cli/runtime/provider.js +39 -2
- package/dist/orchestrator/src/cli/selfCheckCliShell.js +12 -0
- package/dist/orchestrator/src/cli/services/commandRunner.js +668 -18
- package/dist/orchestrator/src/cli/services/execRuntime.js +66 -1
- package/dist/orchestrator/src/cli/services/orchestratorAutoScoutEvidenceRecorder.js +71 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudBranchResolution.js +8 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudEnvironmentResolution.js +22 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudExecutionLifecycleShell.js +39 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudPromptBuilder.js +37 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudRouteFallbackContract.js +45 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudRouteShell.js +36 -0
- package/dist/orchestrator/src/cli/services/orchestratorCloudTargetExecutor.js +277 -0
- package/dist/orchestrator/src/cli/services/orchestratorControlPlaneLifecycle.js +98 -0
- package/dist/orchestrator/src/cli/services/orchestratorControlPlaneLifecycleShell.js +54 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionLifecycle.js +112 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionModePolicy.js +27 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteAdapterShell.js +59 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteDecisionShell.js +57 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteState.js +21 -0
- package/dist/orchestrator/src/cli/services/orchestratorExecutionRouter.js +2 -0
- package/dist/orchestrator/src/cli/services/orchestratorLocalPipelineExecutor.js +149 -0
- package/dist/orchestrator/src/cli/services/orchestratorLocalRouteShell.js +63 -0
- package/dist/orchestrator/src/cli/services/orchestratorPlanShell.js +54 -0
- package/dist/orchestrator/src/cli/services/orchestratorPlanTargetTracker.js +16 -0
- package/dist/orchestrator/src/cli/services/orchestratorResumePreparationShell.js +84 -0
- package/dist/orchestrator/src/cli/services/orchestratorResumeTokenValidation.js +15 -0
- package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleCompletion.js +31 -0
- package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleExecutionRegistration.js +37 -0
- package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleOrchestrationShell.js +83 -0
- package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleTaskManagerShell.js +37 -0
- package/dist/orchestrator/src/cli/services/orchestratorRuntimeManifestMutation.js +20 -0
- package/dist/orchestrator/src/cli/services/orchestratorStartPreparationShell.js +56 -0
- package/dist/orchestrator/src/cli/services/orchestratorStatusShell.js +70 -0
- package/dist/orchestrator/src/cli/services/pipelineResolver.js +7 -3
- package/dist/orchestrator/src/cli/services/plannerMemory.js +119 -0
- package/dist/orchestrator/src/cli/services/runPreparation.js +7 -3
- package/dist/orchestrator/src/cli/services/runSummaryWriter.js +9 -0
- package/dist/orchestrator/src/cli/setupBootstrapShell.js +114 -0
- package/dist/orchestrator/src/cli/setupCliShell.js +51 -0
- package/dist/orchestrator/src/cli/skillsCliShell.js +56 -0
- package/dist/orchestrator/src/cli/startCliRequestShell.js +53 -0
- package/dist/orchestrator/src/cli/startCliShell.js +68 -0
- package/dist/orchestrator/src/cli/statusCliShell.js +22 -0
- package/dist/orchestrator/src/cli/utils/authProvenanceFingerprint.js +27 -0
- package/dist/orchestrator/src/cli/utils/cloudPreflight.js +83 -1
- package/dist/orchestrator/src/cli/utils/delegationConfigParser.js +250 -0
- package/dist/orchestrator/src/cli/utils/delegationMcpHealth.js +1382 -0
- package/dist/orchestrator/src/cli/utils/devtools.js +2 -54
- package/dist/orchestrator/src/cli/utils/mcpServerEntry.js +53 -0
- package/dist/orchestrator/src/cli/utils/packageProgramResolver.js +151 -0
- package/dist/orchestrator/src/cli/utils/providerOverrideEnv.js +71 -0
- package/dist/orchestrator/src/cli/utils/trailingJsonObject.js +59 -0
- package/dist/orchestrator/src/learning/crystalizer.js +2 -2
- package/dist/orchestrator/src/persistence/ExperienceStore.js +233 -49
- package/dist/orchestrator/src/persistence/TaskStateStore.js +6 -6
- package/dist/orchestrator/src/persistence/lockFile.js +70 -4
- package/dist/orchestrator/src/persistence/sanitizeIdentifier.js +39 -0
- package/dist/orchestrator/src/sync/createCloudSyncWorker.js +3 -2
- package/dist/orchestrator/src/utils/atomicWrite.js +17 -2
- package/dist/packages/orchestrator/src/exec/unified-exec.js +99 -6
- package/dist/packages/orchestrator/src/instructions/promptPacks.js +150 -19
- package/dist/packages/sdk-node/src/orchestrator.js +137 -13
- package/dist/packages/shared/config/designConfig.js +8 -1
- package/dist/packages/shared/streams/stdio.js +1 -1
- package/dist/scripts/design/pipeline/permit.js +15 -0
- package/dist/scripts/lib/docs-catalog.js +365 -0
- package/dist/scripts/lib/docs-helpers.js +87 -5
- package/dist/scripts/lib/pr-watch-merge.js +1088 -80
- package/dist/scripts/lib/provider-run-contract.js +26 -0
- package/dist/scripts/lib/review-command-intent-classification.js +532 -0
- package/dist/scripts/lib/review-command-probe-classification.js +385 -0
- package/dist/scripts/lib/review-execution-boundary-preflight.js +279 -0
- package/dist/scripts/lib/review-execution-runtime.js +753 -0
- package/dist/scripts/lib/review-execution-state.js +1144 -0
- package/dist/scripts/lib/review-execution-telemetry.js +215 -0
- package/dist/scripts/lib/review-inspection-target-parsing.js +78 -0
- package/dist/scripts/lib/review-launch-attempt.js +601 -0
- package/dist/scripts/lib/review-meta-surface-boundary-analysis.js +300 -0
- package/dist/scripts/lib/review-meta-surface-normalization.js +746 -0
- package/dist/scripts/lib/review-non-interactive-handoff.js +61 -0
- package/dist/scripts/lib/review-prompt-context.js +376 -0
- package/dist/scripts/lib/review-scope-advisory.js +286 -0
- package/dist/scripts/lib/review-scope-paths.js +123 -0
- package/dist/scripts/lib/review-shell-command-parser.js +389 -0
- package/dist/scripts/lib/review-shell-env-interpreter.js +340 -0
- package/dist/scripts/lib/run-manifests.js +192 -36
- package/dist/scripts/lib/spark-policy-classifier.js +593 -0
- package/dist/scripts/run-review.js +507 -1777
- package/docs/public/downstream-setup.md +106 -0
- package/docs/public/provider-onboarding.md +173 -0
- package/package.json +30 -11
- package/plugins/codex-orchestrator/.codex-plugin/plugin.json +30 -0
- package/plugins/codex-orchestrator/.mcp.json +13 -0
- package/plugins/codex-orchestrator/launcher.mjs +359 -0
- package/schemas/manifest.json +395 -0
- package/skills/chrome-devtools/SKILL.md +1 -1
- package/skills/codex-orchestrator/SKILL.md +83 -0
- package/skills/collab-subagents-first/SKILL.md +2 -1
- package/skills/delegation-usage/DELEGATION_GUIDE.md +24 -11
- package/skills/delegation-usage/SKILL.md +20 -13
- package/skills/land/SKILL.md +77 -0
- package/skills/linear/SKILL.md +255 -0
- package/skills/release/SKILL.md +47 -3
- package/skills/standalone-review/SKILL.md +6 -1
- package/templates/README.md +4 -2
- package/templates/codex/.codex/agents/awaiter-high.toml +2 -2
- package/templates/codex/.codex/agents/explorer-fast.toml +1 -0
- package/templates/codex/.codex/agents/worker-complex.toml +1 -1
- package/templates/codex/.codex/config.toml +3 -4
- package/templates/codex/.codex/providers/README.md +13 -0
- package/templates/codex/.codex/providers/control.example.json +18 -0
- package/templates/codex/.codex/providers/provider.env.example +15 -0
- package/templates/codex/AGENTS.md +12 -7
- package/templates/codex/mcp-client.json +5 -1
- package/docs/README.md +0 -307
- package/docs/assets/setup.gif +0 -0
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { prepareRun } from './runPreparation.js';
|
|
2
|
+
export function buildOrchestratorPlanPreview(preparation, plan) {
|
|
3
|
+
const stages = preparation.pipeline.stages.map((stage, index) => {
|
|
4
|
+
if (stage.kind === 'command') {
|
|
5
|
+
return {
|
|
6
|
+
index: index + 1,
|
|
7
|
+
id: stage.id,
|
|
8
|
+
title: stage.title,
|
|
9
|
+
kind: stage.kind,
|
|
10
|
+
command: stage.command,
|
|
11
|
+
cwd: stage.cwd ?? null,
|
|
12
|
+
env: stage.env ?? null,
|
|
13
|
+
allowFailure: Boolean(stage.allowFailure),
|
|
14
|
+
summaryHint: stage.summaryHint ?? null
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
return {
|
|
18
|
+
index: index + 1,
|
|
19
|
+
id: stage.id,
|
|
20
|
+
title: stage.title,
|
|
21
|
+
kind: stage.kind,
|
|
22
|
+
pipeline: stage.pipeline,
|
|
23
|
+
optional: Boolean(stage.optional)
|
|
24
|
+
};
|
|
25
|
+
});
|
|
26
|
+
const pipelineSource = preparation.pipelineSource === 'user'
|
|
27
|
+
? 'user'
|
|
28
|
+
: preparation.pipelineSource === 'default'
|
|
29
|
+
? 'default'
|
|
30
|
+
: null;
|
|
31
|
+
return {
|
|
32
|
+
pipeline: {
|
|
33
|
+
id: preparation.pipeline.id,
|
|
34
|
+
title: preparation.pipeline.title,
|
|
35
|
+
description: preparation.pipeline.description ?? null,
|
|
36
|
+
source: pipelineSource
|
|
37
|
+
},
|
|
38
|
+
stages,
|
|
39
|
+
plan,
|
|
40
|
+
targetId: plan.targetId ?? null
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
export async function runOrchestratorPlanShell(params) {
|
|
44
|
+
const prepareRunImpl = params.prepareRunImpl ?? prepareRun;
|
|
45
|
+
const preparation = await prepareRunImpl({
|
|
46
|
+
baseEnv: params.baseEnv,
|
|
47
|
+
taskIdOverride: params.options.taskId,
|
|
48
|
+
pipelineId: params.options.pipelineId,
|
|
49
|
+
targetStageId: params.options.targetStageId,
|
|
50
|
+
planTargetFallback: null
|
|
51
|
+
});
|
|
52
|
+
const plan = preparation.planPreview ?? (await preparation.planner.plan(preparation.taskContext));
|
|
53
|
+
return buildOrchestratorPlanPreview(preparation, plan);
|
|
54
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { logger } from '../../logger.js';
|
|
2
|
+
import { persistManifest } from '../run/manifestPersister.js';
|
|
3
|
+
export function attachOrchestratorPlanTargetTracker(params) {
|
|
4
|
+
const persist = params.persistManifestImpl ?? persistManifest;
|
|
5
|
+
const warn = params.warn ?? ((message) => logger.warn(message));
|
|
6
|
+
params.manager.bus.on('plan:completed', (event) => {
|
|
7
|
+
const targetId = event.payload.plan.targetId ?? null;
|
|
8
|
+
if (params.manifest.plan_target_id === targetId) {
|
|
9
|
+
return;
|
|
10
|
+
}
|
|
11
|
+
params.manifest.plan_target_id = targetId;
|
|
12
|
+
void persist(params.paths, params.manifest, params.persister, { force: true }).catch((error) => {
|
|
13
|
+
warn(`Failed to persist plan target for run ${params.manifest.run_id}: ${error?.message ?? String(error)}`);
|
|
14
|
+
});
|
|
15
|
+
});
|
|
16
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { loadManifest, appendSummary, backfillProviderControlHostLocatorFromEnv, updateHeartbeat, resetForResume, recordResumeEvent } from '../run/manifest.js';
|
|
3
|
+
import { ManifestPersister } from '../run/manifestPersister.js';
|
|
4
|
+
import { resolveRuntimeMode } from '../runtime/index.js';
|
|
5
|
+
import { prepareRun, resolvePipelineForResume, overrideTaskEnvironment } from './runPreparation.js';
|
|
6
|
+
import { PipelineResolver } from './pipelineResolver.js';
|
|
7
|
+
import { formatRepoConfigRequiredError, isRepoConfigRequired } from '../config/repoConfigPolicy.js';
|
|
8
|
+
import { loadPackageConfig, loadUserConfig, resolveRepoConfigPath } from '../config/userConfig.js';
|
|
9
|
+
export async function runOrchestratorResumePreparationShell(params) {
|
|
10
|
+
const loadManifestImpl = params.loadManifestImpl ?? loadManifest;
|
|
11
|
+
const overrideTaskEnvironmentImpl = params.overrideTaskEnvironmentImpl ?? overrideTaskEnvironment;
|
|
12
|
+
const createResolver = params.createResolver ?? (() => new PipelineResolver());
|
|
13
|
+
const isRepoConfigRequiredImpl = params.isRepoConfigRequiredImpl ?? isRepoConfigRequired;
|
|
14
|
+
const loadUserConfigImpl = params.loadUserConfigImpl ?? loadUserConfig;
|
|
15
|
+
const loadPackageConfigImpl = params.loadPackageConfigImpl ?? loadPackageConfig;
|
|
16
|
+
const resolveRepoConfigPathImpl = params.resolveRepoConfigPathImpl ?? resolveRepoConfigPath;
|
|
17
|
+
const formatRepoConfigRequiredErrorImpl = params.formatRepoConfigRequiredErrorImpl ?? formatRepoConfigRequiredError;
|
|
18
|
+
const resolvePipelineForResumeImpl = params.resolvePipelineForResumeImpl ?? resolvePipelineForResume;
|
|
19
|
+
const recordResumeEventImpl = params.recordResumeEventImpl ?? recordResumeEvent;
|
|
20
|
+
const resetForResumeImpl = params.resetForResumeImpl ?? resetForResume;
|
|
21
|
+
const updateHeartbeatImpl = params.updateHeartbeatImpl ?? updateHeartbeat;
|
|
22
|
+
const prepareRunImpl = params.prepareRunImpl ?? prepareRun;
|
|
23
|
+
const resolveRuntimeModeImpl = params.resolveRuntimeModeImpl ?? resolveRuntimeMode;
|
|
24
|
+
const appendSummaryImpl = params.appendSummaryImpl ?? appendSummary;
|
|
25
|
+
const createPersister = params.createPersister ?? ((options) => new ManifestPersister(options));
|
|
26
|
+
const { manifest, paths } = await loadManifestImpl(params.baseEnv, params.options.runId);
|
|
27
|
+
const actualEnv = overrideTaskEnvironmentImpl(params.baseEnv, manifest.task_id);
|
|
28
|
+
const resolver = createResolver();
|
|
29
|
+
const designConfig = await resolver.loadDesignConfig(actualEnv.repoRoot);
|
|
30
|
+
const repoConfigRequired = isRepoConfigRequiredImpl(process.env);
|
|
31
|
+
const userConfig = await loadUserConfigImpl(actualEnv, { allowPackageFallback: !repoConfigRequired });
|
|
32
|
+
if (repoConfigRequired && userConfig?.source !== 'repo') {
|
|
33
|
+
throw new Error(formatRepoConfigRequiredErrorImpl(resolveRepoConfigPathImpl(actualEnv, process.env)));
|
|
34
|
+
}
|
|
35
|
+
const fallbackConfig = !repoConfigRequired && manifest.pipeline_id === 'rlm' && userConfig?.source === 'repo'
|
|
36
|
+
? await loadPackageConfigImpl(actualEnv)
|
|
37
|
+
: null;
|
|
38
|
+
const pipeline = resolvePipelineForResumeImpl(actualEnv, manifest, userConfig, fallbackConfig);
|
|
39
|
+
const envOverrides = resolver.resolveDesignEnvOverrides(designConfig, pipeline.id);
|
|
40
|
+
await params.validateResumeToken(paths, manifest, params.options.resumeToken ?? null);
|
|
41
|
+
backfillProviderControlHostLocatorFromEnv(manifest, process.env, { overwriteConflicts: true });
|
|
42
|
+
recordResumeEventImpl(manifest, {
|
|
43
|
+
actor: params.options.actor ?? 'cli',
|
|
44
|
+
reason: params.options.reason ?? 'manual-resume',
|
|
45
|
+
outcome: 'accepted'
|
|
46
|
+
});
|
|
47
|
+
resetForResumeImpl(manifest);
|
|
48
|
+
updateHeartbeatImpl(manifest);
|
|
49
|
+
const preparation = await prepareRunImpl({
|
|
50
|
+
baseEnv: actualEnv,
|
|
51
|
+
pipeline,
|
|
52
|
+
runtimeModeDefault: userConfig?.runtimeMode ?? null,
|
|
53
|
+
resolver,
|
|
54
|
+
taskIdOverride: manifest.task_id,
|
|
55
|
+
targetStageId: params.options.targetStageId,
|
|
56
|
+
planTargetFallback: manifest.plan_target_id ?? null,
|
|
57
|
+
envOverrides
|
|
58
|
+
});
|
|
59
|
+
if (preparation.configNotice && !(manifest.summary ?? '').includes(preparation.configNotice)) {
|
|
60
|
+
appendSummaryImpl(manifest, preparation.configNotice);
|
|
61
|
+
}
|
|
62
|
+
const runtimeModeResolution = resolveRuntimeModeImpl({
|
|
63
|
+
flag: params.options.runtimeMode,
|
|
64
|
+
env: { ...process.env, ...(preparation.envOverrides ?? {}) },
|
|
65
|
+
configDefault: preparation.runtimeModeDefault,
|
|
66
|
+
manifestMode: manifest.runtime_mode_requested ?? manifest.runtime_mode ?? null,
|
|
67
|
+
preferManifest: true
|
|
68
|
+
});
|
|
69
|
+
params.applyRequestedRuntimeMode(manifest, runtimeModeResolution.mode);
|
|
70
|
+
manifest.plan_target_id = preparation.planPreview?.targetId ?? preparation.plannerTargetId ?? null;
|
|
71
|
+
const persister = createPersister({
|
|
72
|
+
manifest,
|
|
73
|
+
paths,
|
|
74
|
+
persistIntervalMs: Math.max(1000, manifest.heartbeat_interval_seconds * 1000)
|
|
75
|
+
});
|
|
76
|
+
await persister.schedule({ manifest: true, heartbeat: true, force: true });
|
|
77
|
+
return {
|
|
78
|
+
preparation,
|
|
79
|
+
runtimeModeResolution,
|
|
80
|
+
manifest,
|
|
81
|
+
paths,
|
|
82
|
+
persister
|
|
83
|
+
};
|
|
84
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
export async function validateOrchestratorResumeToken(paths, manifest, provided, readFileImpl = readFile) {
|
|
3
|
+
let stored = manifest.resume_token;
|
|
4
|
+
if (!stored) {
|
|
5
|
+
try {
|
|
6
|
+
stored = (await readFileImpl(paths.resumeTokenPath, 'utf8')).trim();
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
throw new Error(`Resume token missing for run ${manifest.run_id}: ${error?.message ?? String(error)}`);
|
|
10
|
+
}
|
|
11
|
+
}
|
|
12
|
+
if (provided && stored !== provided) {
|
|
13
|
+
throw new Error('Resume token mismatch.');
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { join } from 'node:path';
|
|
2
|
+
import { applyCloudExecutionToRunSummary, applyCloudFallbackToRunSummary, applyHandlesToRunSummary, applyPrivacyToRunSummary, applyRuntimeToRunSummary, applyUsageKpiToRunSummary, persistRunSummary } from './runSummaryWriter.js';
|
|
3
|
+
export async function completeOrchestratorRunLifecycle(options) {
|
|
4
|
+
await options.finalizePlan({
|
|
5
|
+
manifest: options.manifest,
|
|
6
|
+
paths: options.paths,
|
|
7
|
+
plan: options.schedulerPlan,
|
|
8
|
+
persister: options.persister
|
|
9
|
+
});
|
|
10
|
+
options.applySchedulerToRunSummary(options.runSummary, options.schedulerPlan);
|
|
11
|
+
applyRuntimeToRunSummary(options.runSummary, options.manifest);
|
|
12
|
+
applyHandlesToRunSummary(options.runSummary, options.manifest);
|
|
13
|
+
applyPrivacyToRunSummary(options.runSummary, options.manifest);
|
|
14
|
+
applyCloudExecutionToRunSummary(options.runSummary, options.manifest);
|
|
15
|
+
applyCloudFallbackToRunSummary(options.runSummary, options.manifest);
|
|
16
|
+
applyUsageKpiToRunSummary(options.runSummary, options.manifest);
|
|
17
|
+
options.applyControlPlaneToRunSummary(options.runSummary, options.controlPlaneResult);
|
|
18
|
+
await persistRunSummary(options.env, options.paths, options.manifest, options.runSummary, options.persister);
|
|
19
|
+
options.runEvents?.runCompleted({
|
|
20
|
+
pipelineId: options.pipeline.id,
|
|
21
|
+
status: options.manifest.status,
|
|
22
|
+
manifestPath: options.paths.manifestPath,
|
|
23
|
+
runSummaryPath: options.manifest.run_summary_path,
|
|
24
|
+
metricsPath: join(options.env.runsRoot, options.env.taskId, 'metrics.json'),
|
|
25
|
+
summary: options.manifest.summary ?? null
|
|
26
|
+
});
|
|
27
|
+
return {
|
|
28
|
+
manifest: options.manifest,
|
|
29
|
+
runSummary: options.runSummary
|
|
30
|
+
};
|
|
31
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
export function createOrchestratorRunLifecycleExecutionRegistration(options) {
|
|
2
|
+
let latestPipelineResult = null;
|
|
3
|
+
const executingByKey = new Map();
|
|
4
|
+
const executePipeline = async (input) => {
|
|
5
|
+
const key = `${input.mode}:${input.target.id}`;
|
|
6
|
+
const existing = executingByKey.get(key);
|
|
7
|
+
if (existing) {
|
|
8
|
+
return existing;
|
|
9
|
+
}
|
|
10
|
+
const executing = options
|
|
11
|
+
.executePipeline({
|
|
12
|
+
env: options.env,
|
|
13
|
+
pipeline: options.pipeline,
|
|
14
|
+
manifest: options.manifest,
|
|
15
|
+
paths: options.paths,
|
|
16
|
+
mode: input.mode,
|
|
17
|
+
runtimeModeRequested: options.runtimeModeRequested,
|
|
18
|
+
runtimeModeSource: options.runtimeModeSource,
|
|
19
|
+
executionModeOverride: options.executionModeOverride,
|
|
20
|
+
target: input.target,
|
|
21
|
+
task: options.taskContext,
|
|
22
|
+
runEvents: options.runEvents,
|
|
23
|
+
eventStream: options.eventStream,
|
|
24
|
+
onEventEntry: options.onEventEntry,
|
|
25
|
+
persister: options.persister,
|
|
26
|
+
envOverrides: options.envOverrides
|
|
27
|
+
})
|
|
28
|
+
.then((result) => {
|
|
29
|
+
latestPipelineResult = result;
|
|
30
|
+
return result;
|
|
31
|
+
});
|
|
32
|
+
executingByKey.set(key, executing);
|
|
33
|
+
return executing;
|
|
34
|
+
};
|
|
35
|
+
const getResult = () => latestPipelineResult;
|
|
36
|
+
return { executePipeline, getResult };
|
|
37
|
+
}
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import { getPrivacyGuard } from './execRuntime.js';
|
|
2
|
+
import { completeOrchestratorRunLifecycle } from './orchestratorRunLifecycleCompletion.js';
|
|
3
|
+
import { createOrchestratorRunLifecycleTaskManager } from './orchestratorRunLifecycleTaskManagerShell.js';
|
|
4
|
+
export async function executeOrchestratorRunLifecycleTask(manager, taskContext, pipelineId, runEvents) {
|
|
5
|
+
try {
|
|
6
|
+
return await manager.execute(taskContext);
|
|
7
|
+
}
|
|
8
|
+
catch (error) {
|
|
9
|
+
runEvents?.runError({
|
|
10
|
+
pipelineId,
|
|
11
|
+
message: error?.message ?? String(error),
|
|
12
|
+
stageId: null
|
|
13
|
+
});
|
|
14
|
+
throw error;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export async function runOrchestratorRunLifecycleGuardAndPlanning(options) {
|
|
18
|
+
const controlPlaneResult = await options.controlPlaneGuard({
|
|
19
|
+
env: options.env,
|
|
20
|
+
manifest: options.manifest,
|
|
21
|
+
paths: options.paths,
|
|
22
|
+
pipeline: options.pipeline,
|
|
23
|
+
task: options.taskContext,
|
|
24
|
+
runId: options.runId,
|
|
25
|
+
requestedBy: { actorId: 'codex-cli', channel: 'cli', name: 'Codex CLI' },
|
|
26
|
+
persister: options.persister
|
|
27
|
+
});
|
|
28
|
+
const schedulerPlan = await options.createSchedulerPlan({
|
|
29
|
+
env: options.env,
|
|
30
|
+
manifest: options.manifest,
|
|
31
|
+
paths: options.paths,
|
|
32
|
+
controlPlaneResult,
|
|
33
|
+
persister: options.persister
|
|
34
|
+
});
|
|
35
|
+
return { controlPlaneResult, schedulerPlan };
|
|
36
|
+
}
|
|
37
|
+
export async function runOrchestratorRunLifecycle(options) {
|
|
38
|
+
const manager = createOrchestratorRunLifecycleTaskManager({
|
|
39
|
+
runId: options.runId,
|
|
40
|
+
env: options.env,
|
|
41
|
+
pipeline: options.pipeline,
|
|
42
|
+
manifest: options.manifest,
|
|
43
|
+
paths: options.paths,
|
|
44
|
+
planner: options.planner,
|
|
45
|
+
taskContext: options.taskContext,
|
|
46
|
+
runEvents: options.runEvents,
|
|
47
|
+
eventStream: options.eventStream,
|
|
48
|
+
onEventEntry: options.onEventEntry,
|
|
49
|
+
persister: options.persister,
|
|
50
|
+
envOverrides: options.envOverrides,
|
|
51
|
+
runtimeModeRequested: options.runtimeModeRequested,
|
|
52
|
+
runtimeModeSource: options.runtimeModeSource,
|
|
53
|
+
executionModeOverride: options.executionModeOverride,
|
|
54
|
+
executePipeline: options.executePipeline
|
|
55
|
+
});
|
|
56
|
+
getPrivacyGuard().reset();
|
|
57
|
+
const { controlPlaneResult, schedulerPlan } = await runOrchestratorRunLifecycleGuardAndPlanning({
|
|
58
|
+
env: options.env,
|
|
59
|
+
pipeline: options.pipeline,
|
|
60
|
+
manifest: options.manifest,
|
|
61
|
+
paths: options.paths,
|
|
62
|
+
taskContext: options.taskContext,
|
|
63
|
+
runId: options.runId,
|
|
64
|
+
persister: options.persister,
|
|
65
|
+
controlPlaneGuard: options.controlPlaneGuard,
|
|
66
|
+
createSchedulerPlan: options.createSchedulerPlan
|
|
67
|
+
});
|
|
68
|
+
const runSummary = await executeOrchestratorRunLifecycleTask(manager, options.taskContext, options.pipeline.id, options.runEvents);
|
|
69
|
+
return await completeOrchestratorRunLifecycle({
|
|
70
|
+
env: options.env,
|
|
71
|
+
pipeline: options.pipeline,
|
|
72
|
+
manifest: options.manifest,
|
|
73
|
+
paths: options.paths,
|
|
74
|
+
runSummary,
|
|
75
|
+
schedulerPlan,
|
|
76
|
+
controlPlaneResult,
|
|
77
|
+
runEvents: options.runEvents,
|
|
78
|
+
persister: options.persister,
|
|
79
|
+
finalizePlan: options.finalizePlan,
|
|
80
|
+
applySchedulerToRunSummary: options.applySchedulerToRunSummary,
|
|
81
|
+
applyControlPlaneToRunSummary: options.applyControlPlaneToRunSummary
|
|
82
|
+
});
|
|
83
|
+
}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import { createOrchestratorTaskManager } from './orchestratorExecutionRouteAdapterShell.js';
|
|
2
|
+
import { attachOrchestratorPlanTargetTracker } from './orchestratorPlanTargetTracker.js';
|
|
3
|
+
import { createOrchestratorRunLifecycleExecutionRegistration } from './orchestratorRunLifecycleExecutionRegistration.js';
|
|
4
|
+
export function createOrchestratorRunLifecycleTaskManager(params) {
|
|
5
|
+
const registration = createOrchestratorRunLifecycleExecutionRegistration({
|
|
6
|
+
env: params.env,
|
|
7
|
+
pipeline: params.pipeline,
|
|
8
|
+
manifest: params.manifest,
|
|
9
|
+
paths: params.paths,
|
|
10
|
+
taskContext: params.taskContext,
|
|
11
|
+
runEvents: params.runEvents,
|
|
12
|
+
eventStream: params.eventStream,
|
|
13
|
+
onEventEntry: params.onEventEntry,
|
|
14
|
+
persister: params.persister,
|
|
15
|
+
envOverrides: params.envOverrides,
|
|
16
|
+
runtimeModeRequested: params.runtimeModeRequested,
|
|
17
|
+
runtimeModeSource: params.runtimeModeSource,
|
|
18
|
+
executionModeOverride: params.executionModeOverride,
|
|
19
|
+
executePipeline: params.executePipeline
|
|
20
|
+
});
|
|
21
|
+
const manager = createOrchestratorTaskManager({
|
|
22
|
+
runId: params.runId,
|
|
23
|
+
pipeline: params.pipeline,
|
|
24
|
+
executePipeline: registration.executePipeline,
|
|
25
|
+
getResult: registration.getResult,
|
|
26
|
+
plannerInstance: params.planner,
|
|
27
|
+
env: params.env,
|
|
28
|
+
modeOverride: params.executionModeOverride
|
|
29
|
+
});
|
|
30
|
+
attachOrchestratorPlanTargetTracker({
|
|
31
|
+
manager,
|
|
32
|
+
manifest: params.manifest,
|
|
33
|
+
paths: params.paths,
|
|
34
|
+
persister: params.persister
|
|
35
|
+
});
|
|
36
|
+
return manager;
|
|
37
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { isoTimestamp } from '../utils/time.js';
|
|
2
|
+
export function applyRequestedRuntimeModeToManifest(manifest, mode, isoTimestampImpl = isoTimestamp) {
|
|
3
|
+
manifest.runtime_mode_requested = mode;
|
|
4
|
+
manifest.runtime_mode = mode;
|
|
5
|
+
manifest.runtime_provider = mode === 'appserver' ? 'AppServerRuntimeProvider' : 'CliRuntimeProvider';
|
|
6
|
+
manifest.runtime_fallback = {
|
|
7
|
+
occurred: false,
|
|
8
|
+
code: null,
|
|
9
|
+
reason: null,
|
|
10
|
+
from_mode: null,
|
|
11
|
+
to_mode: null,
|
|
12
|
+
checked_at: isoTimestampImpl()
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
export function applyRuntimeSelectionToManifest(manifest, selection) {
|
|
16
|
+
manifest.runtime_mode_requested = selection.requested_mode;
|
|
17
|
+
manifest.runtime_mode = selection.selected_mode;
|
|
18
|
+
manifest.runtime_provider = selection.provider;
|
|
19
|
+
manifest.runtime_fallback = selection.fallback;
|
|
20
|
+
}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { bootstrapManifest, appendSummary } from '../run/manifest.js';
|
|
3
|
+
import { ManifestPersister } from '../run/manifestPersister.js';
|
|
4
|
+
import { resolveRuntimeMode } from '../runtime/index.js';
|
|
5
|
+
import { prepareRun } from './runPreparation.js';
|
|
6
|
+
import { generateRunId } from '../utils/runId.js';
|
|
7
|
+
export async function runOrchestratorStartPreparationShell(params) {
|
|
8
|
+
const prepareRunImpl = params.prepareRunImpl ?? prepareRun;
|
|
9
|
+
const generateRunIdImpl = params.generateRunIdImpl ?? generateRunId;
|
|
10
|
+
const resolveRuntimeModeImpl = params.resolveRuntimeModeImpl ?? resolveRuntimeMode;
|
|
11
|
+
const bootstrapManifestImpl = params.bootstrapManifestImpl ?? bootstrapManifest;
|
|
12
|
+
const appendSummaryImpl = params.appendSummaryImpl ?? appendSummary;
|
|
13
|
+
const createPersister = params.createPersister ?? ((options) => new ManifestPersister(options));
|
|
14
|
+
const preparation = await prepareRunImpl({
|
|
15
|
+
baseEnv: params.baseEnv,
|
|
16
|
+
taskIdOverride: params.options.taskId,
|
|
17
|
+
pipelineId: params.options.pipelineId,
|
|
18
|
+
targetStageId: params.options.targetStageId ?? null,
|
|
19
|
+
planTargetFallback: null
|
|
20
|
+
});
|
|
21
|
+
const runId = generateRunIdImpl();
|
|
22
|
+
const runtimeModeResolution = resolveRuntimeModeImpl({
|
|
23
|
+
flag: params.options.runtimeMode,
|
|
24
|
+
env: { ...process.env, ...(preparation.envOverrides ?? {}) },
|
|
25
|
+
configDefault: preparation.runtimeModeDefault
|
|
26
|
+
});
|
|
27
|
+
const { manifest, paths } = await bootstrapManifestImpl(runId, {
|
|
28
|
+
env: preparation.env,
|
|
29
|
+
pipeline: preparation.pipeline,
|
|
30
|
+
parentRunId: params.options.parentRunId ?? null,
|
|
31
|
+
taskSlug: preparation.metadata.slug,
|
|
32
|
+
approvalPolicy: params.options.approvalPolicy ?? null,
|
|
33
|
+
planTargetId: preparation.planPreview?.targetId ?? preparation.plannerTargetId ?? null,
|
|
34
|
+
issueProvider: params.options.issueProvider ?? null,
|
|
35
|
+
issueId: params.options.issueId ?? null,
|
|
36
|
+
issueIdentifier: params.options.issueIdentifier ?? null,
|
|
37
|
+
issueUpdatedAt: params.options.issueUpdatedAt ?? null
|
|
38
|
+
});
|
|
39
|
+
params.applyRequestedRuntimeMode(manifest, runtimeModeResolution.mode);
|
|
40
|
+
if (preparation.configNotice) {
|
|
41
|
+
appendSummaryImpl(manifest, preparation.configNotice);
|
|
42
|
+
}
|
|
43
|
+
const persister = createPersister({
|
|
44
|
+
manifest,
|
|
45
|
+
paths,
|
|
46
|
+
persistIntervalMs: Math.max(1000, manifest.heartbeat_interval_seconds * 1000)
|
|
47
|
+
});
|
|
48
|
+
return {
|
|
49
|
+
preparation,
|
|
50
|
+
runId,
|
|
51
|
+
runtimeModeResolution,
|
|
52
|
+
manifest,
|
|
53
|
+
paths,
|
|
54
|
+
persister
|
|
55
|
+
};
|
|
56
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import process from 'node:process';
|
|
2
|
+
import { logger } from '../../logger.js';
|
|
3
|
+
import { loadManifest } from '../run/manifest.js';
|
|
4
|
+
import { resolveRuntimeActivitySnapshot } from '../run/runtimeActivity.js';
|
|
5
|
+
import { relativeToRepo } from '../run/runPaths.js';
|
|
6
|
+
export function buildOrchestratorStatusPayload(env, manifest, paths, activity) {
|
|
7
|
+
return {
|
|
8
|
+
run_id: manifest.run_id,
|
|
9
|
+
status: manifest.status,
|
|
10
|
+
status_detail: manifest.status_detail,
|
|
11
|
+
started_at: manifest.started_at,
|
|
12
|
+
completed_at: manifest.completed_at,
|
|
13
|
+
manifest: relativeToRepo(env, paths.manifestPath),
|
|
14
|
+
artifact_root: manifest.artifact_root,
|
|
15
|
+
log_path: manifest.log_path,
|
|
16
|
+
heartbeat_at: manifest.heartbeat_at,
|
|
17
|
+
activity,
|
|
18
|
+
commands: manifest.commands,
|
|
19
|
+
child_runs: manifest.child_runs,
|
|
20
|
+
runtime_mode_requested: manifest.runtime_mode_requested,
|
|
21
|
+
runtime_mode: manifest.runtime_mode,
|
|
22
|
+
runtime_provider: manifest.runtime_provider,
|
|
23
|
+
runtime_fallback: manifest.runtime_fallback ?? null,
|
|
24
|
+
cloud_execution: manifest.cloud_execution ?? null,
|
|
25
|
+
cloud_fallback: manifest.cloud_fallback ?? null
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
export function renderOrchestratorStatus(manifest, activity) {
|
|
29
|
+
logger.info(`Run: ${manifest.run_id}`);
|
|
30
|
+
logger.info(`Status: ${manifest.status}${manifest.status_detail ? ` (${manifest.status_detail})` : ''}`);
|
|
31
|
+
logger.info(`Started: ${manifest.started_at}`);
|
|
32
|
+
logger.info(`Completed: ${manifest.completed_at ?? 'in-progress'}`);
|
|
33
|
+
logger.info(`Manifest: ${manifest.artifact_root}/manifest.json`);
|
|
34
|
+
if (manifest.runtime_mode || manifest.runtime_mode_requested || manifest.runtime_provider) {
|
|
35
|
+
const selectedMode = manifest.runtime_mode ?? 'unknown';
|
|
36
|
+
logger.info(`Runtime: ${selectedMode}${manifest.runtime_mode_requested ? ` (requested ${manifest.runtime_mode_requested})` : ''}` +
|
|
37
|
+
(manifest.runtime_provider ? ` via ${manifest.runtime_provider}` : ''));
|
|
38
|
+
}
|
|
39
|
+
if (manifest.runtime_fallback?.occurred) {
|
|
40
|
+
const fallbackCode = manifest.runtime_fallback.code ?? 'runtime-fallback';
|
|
41
|
+
logger.info(`Runtime fallback: ${fallbackCode} — ${manifest.runtime_fallback.reason ?? 'n/a'}`);
|
|
42
|
+
}
|
|
43
|
+
if (activity.observed_at) {
|
|
44
|
+
const staleSuffix = activity.stale === null ? '' : activity.stale ? ' [stale]' : ' [active]';
|
|
45
|
+
const sourceLabel = activity.observed_source ? ` via ${activity.observed_source}` : '';
|
|
46
|
+
const ageLabel = activity.age_seconds === null ? '' : ` age=${activity.age_seconds}s`;
|
|
47
|
+
logger.info(`Activity: ${activity.observed_at}${sourceLabel}${ageLabel}${staleSuffix}`);
|
|
48
|
+
}
|
|
49
|
+
if (manifest.cloud_execution?.task_id) {
|
|
50
|
+
logger.info(`Cloud: ${manifest.cloud_execution.task_id} [${manifest.cloud_execution.status}]` +
|
|
51
|
+
(manifest.cloud_execution.status_url ? ` ${manifest.cloud_execution.status_url}` : ''));
|
|
52
|
+
}
|
|
53
|
+
logger.info('Commands:');
|
|
54
|
+
for (const command of manifest.commands) {
|
|
55
|
+
const summary = command.summary ? ` — ${command.summary}` : '';
|
|
56
|
+
logger.info(` [${command.status}] ${command.title}${summary}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
export async function runOrchestratorStatusShell(params) {
|
|
60
|
+
const loadManifestImpl = params.loadManifestImpl ?? loadManifest;
|
|
61
|
+
const resolveRuntimeActivitySnapshotImpl = params.resolveRuntimeActivitySnapshotImpl ?? resolveRuntimeActivitySnapshot;
|
|
62
|
+
const { manifest, paths } = await loadManifestImpl(params.baseEnv, params.options.runId);
|
|
63
|
+
const activity = await resolveRuntimeActivitySnapshotImpl(manifest, paths);
|
|
64
|
+
if (params.options.format === 'json') {
|
|
65
|
+
process.stdout.write(`${JSON.stringify(buildOrchestratorStatusPayload(params.baseEnv, manifest, paths, activity), null, 2)}\n`);
|
|
66
|
+
return manifest;
|
|
67
|
+
}
|
|
68
|
+
renderOrchestratorStatus(manifest, activity);
|
|
69
|
+
return manifest;
|
|
70
|
+
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import process from 'node:process';
|
|
2
|
-
import { loadPackageConfig, loadUserConfig } from '../config/userConfig.js';
|
|
2
|
+
import { loadPackageConfig, loadUserConfig, resolveRepoConfigPath } from '../config/userConfig.js';
|
|
3
3
|
import { resolvePipeline } from '../pipelines/index.js';
|
|
4
4
|
import { loadDesignConfig, shouldActivateDesignPipeline, designPipelineId } from '../../../../packages/shared/config/index.js';
|
|
5
5
|
import { logger } from '../../logger.js';
|
|
@@ -45,9 +45,13 @@ export class PipelineResolver {
|
|
|
45
45
|
this.logInfo(`[design-config] using defaults (missing file at ${designConfig.path})`, quiet);
|
|
46
46
|
}
|
|
47
47
|
const repoConfigRequired = isRepoConfigRequired(runtimeEnv);
|
|
48
|
-
const userConfig = await loadUserConfig(env, {
|
|
48
|
+
const userConfig = await loadUserConfig(env, {
|
|
49
|
+
allowPackageFallback: !repoConfigRequired,
|
|
50
|
+
quiet,
|
|
51
|
+
processEnv: runtimeEnv
|
|
52
|
+
});
|
|
49
53
|
if (repoConfigRequired && userConfig?.source !== 'repo') {
|
|
50
|
-
throw new Error(formatRepoConfigRequiredError(env
|
|
54
|
+
throw new Error(formatRepoConfigRequiredError(resolveRepoConfigPath(env, runtimeEnv)));
|
|
51
55
|
}
|
|
52
56
|
let configNotice = null;
|
|
53
57
|
if (userConfig?.source === 'package') {
|
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
export const TASK_MEMORY_SOURCE0_REF_ID = 'source_0';
|
|
2
|
+
const TASK_MEMORY_PROMPT_PACK_REF_PREFIX = 'prompt_pack:';
|
|
3
|
+
function normalizeNonEmptyString(value) {
|
|
4
|
+
if (typeof value !== 'string') {
|
|
5
|
+
return null;
|
|
6
|
+
}
|
|
7
|
+
const trimmed = value.trim();
|
|
8
|
+
return trimmed.length > 0 ? trimmed : null;
|
|
9
|
+
}
|
|
10
|
+
function readPromptPackRefDomain(ref) {
|
|
11
|
+
return normalizeNonEmptyString(ref.domain)?.toLowerCase() ?? null;
|
|
12
|
+
}
|
|
13
|
+
function readSelectedMemoryRefArray(value) {
|
|
14
|
+
if (!Array.isArray(value)) {
|
|
15
|
+
return [];
|
|
16
|
+
}
|
|
17
|
+
return value
|
|
18
|
+
.filter((entry) => typeof entry === 'string')
|
|
19
|
+
.map((entry) => entry.trim())
|
|
20
|
+
.filter((entry) => entry.length > 0);
|
|
21
|
+
}
|
|
22
|
+
export function createPromptPackTaskMemoryRefId(packId) {
|
|
23
|
+
return `${TASK_MEMORY_PROMPT_PACK_REF_PREFIX}${packId}`;
|
|
24
|
+
}
|
|
25
|
+
export function readPromptPackIdFromTaskMemoryRefId(refId) {
|
|
26
|
+
if (!refId.startsWith(TASK_MEMORY_PROMPT_PACK_REF_PREFIX)) {
|
|
27
|
+
return null;
|
|
28
|
+
}
|
|
29
|
+
const packId = refId.slice(TASK_MEMORY_PROMPT_PACK_REF_PREFIX.length).trim();
|
|
30
|
+
return packId.length > 0 ? packId : null;
|
|
31
|
+
}
|
|
32
|
+
export function buildTaskMemoryContext(promptPacks) {
|
|
33
|
+
const refs = [
|
|
34
|
+
{
|
|
35
|
+
id: TASK_MEMORY_SOURCE0_REF_ID,
|
|
36
|
+
kind: 'source_0',
|
|
37
|
+
label: 'Shared source 0 anchor'
|
|
38
|
+
}
|
|
39
|
+
];
|
|
40
|
+
for (const pack of promptPacks) {
|
|
41
|
+
const packId = normalizeNonEmptyString(pack.id);
|
|
42
|
+
const domain = normalizeNonEmptyString(pack.domain);
|
|
43
|
+
if (!packId || !domain || !Number.isInteger(pack.experienceSlots) || pack.experienceSlots <= 0) {
|
|
44
|
+
continue;
|
|
45
|
+
}
|
|
46
|
+
refs.push({
|
|
47
|
+
id: createPromptPackTaskMemoryRefId(packId),
|
|
48
|
+
kind: 'prompt_pack',
|
|
49
|
+
label: `Prompt pack ${packId}`,
|
|
50
|
+
domain,
|
|
51
|
+
packId,
|
|
52
|
+
experienceSlots: pack.experienceSlots
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
return { refs };
|
|
56
|
+
}
|
|
57
|
+
export function readSelectedMemoryRefs(target) {
|
|
58
|
+
const metadata = target.metadata ?? {};
|
|
59
|
+
return [
|
|
60
|
+
...readSelectedMemoryRefArray(metadata.selectedMemoryRefs),
|
|
61
|
+
...readSelectedMemoryRefArray(metadata.selected_memory_refs)
|
|
62
|
+
].filter((value, index, entries) => entries.indexOf(value) === index);
|
|
63
|
+
}
|
|
64
|
+
function selectPromptPackTaskMemoryRef(params) {
|
|
65
|
+
const candidates = params.refs.filter((ref) => ref.kind === 'prompt_pack' && readPromptPackRefDomain(ref) !== null);
|
|
66
|
+
if (candidates.length === 0) {
|
|
67
|
+
return null;
|
|
68
|
+
}
|
|
69
|
+
const haystack = [
|
|
70
|
+
params.pipeline.id,
|
|
71
|
+
params.pipeline.title,
|
|
72
|
+
(params.pipeline.tags ?? []).join(' '),
|
|
73
|
+
params.target.id,
|
|
74
|
+
params.target.description ?? '',
|
|
75
|
+
params.stage.id,
|
|
76
|
+
params.stage.title
|
|
77
|
+
]
|
|
78
|
+
.join(' ')
|
|
79
|
+
.toLowerCase();
|
|
80
|
+
const directMatch = candidates.find((ref) => {
|
|
81
|
+
const domain = readPromptPackRefDomain(ref);
|
|
82
|
+
return domain !== null && domain !== 'implementation' && haystack.includes(domain);
|
|
83
|
+
});
|
|
84
|
+
if (directMatch) {
|
|
85
|
+
return directMatch;
|
|
86
|
+
}
|
|
87
|
+
const broadDirectMatch = candidates.find((ref) => {
|
|
88
|
+
const domain = readPromptPackRefDomain(ref);
|
|
89
|
+
return domain !== null && haystack.includes(domain);
|
|
90
|
+
});
|
|
91
|
+
if (broadDirectMatch) {
|
|
92
|
+
return broadDirectMatch;
|
|
93
|
+
}
|
|
94
|
+
const implementation = candidates.find((ref) => readPromptPackRefDomain(ref) === 'implementation');
|
|
95
|
+
if (implementation) {
|
|
96
|
+
return implementation;
|
|
97
|
+
}
|
|
98
|
+
return candidates[0] ?? null;
|
|
99
|
+
}
|
|
100
|
+
export function selectTaskMemoryRefs(params) {
|
|
101
|
+
const refs = params.task.memory?.refs ?? [];
|
|
102
|
+
if (refs.length === 0) {
|
|
103
|
+
return [];
|
|
104
|
+
}
|
|
105
|
+
const selected = [];
|
|
106
|
+
if (refs.some((ref) => ref.id === TASK_MEMORY_SOURCE0_REF_ID)) {
|
|
107
|
+
selected.push(TASK_MEMORY_SOURCE0_REF_ID);
|
|
108
|
+
}
|
|
109
|
+
const promptPackRef = selectPromptPackTaskMemoryRef({
|
|
110
|
+
refs,
|
|
111
|
+
pipeline: params.pipeline,
|
|
112
|
+
target: params.target,
|
|
113
|
+
stage: params.stage
|
|
114
|
+
});
|
|
115
|
+
if (promptPackRef && !selected.includes(promptPackRef.id)) {
|
|
116
|
+
selected.push(promptPackRef.id);
|
|
117
|
+
}
|
|
118
|
+
return selected;
|
|
119
|
+
}
|