@kbediako/codex-orchestrator 0.1.38 → 0.2.1
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 +46 -317
- package/bin/codex-orchestrator.js +161 -0
- package/codex.orchestrator.json +149 -13
- package/dist/bin/codex-orchestrator.js +797 -1154
- package/dist/orchestrator/src/cli/adapters/CommandBuilder.js +50 -0
- 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 +295 -11
- package/dist/orchestrator/src/cli/coStatusAttachCliShell.js +402 -0
- package/dist/orchestrator/src/cli/coStatusCliShell.js +451 -0
- package/dist/orchestrator/src/cli/coStatusOperatorAutopilotCliShell.js +120 -0
- package/dist/orchestrator/src/cli/codexCliShell.js +119 -0
- package/dist/orchestrator/src/cli/codexDefaultsSetup.js +265 -36
- 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 +630 -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 +1003 -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 +1904 -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 +1885 -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 +678 -164
- 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 +119 -15
- 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 +95 -1
- 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 +1835 -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 +6834 -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 +698 -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 +285 -7
- package/dist/orchestrator/src/cli/utils/codexFeatures.js +60 -0
- 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/manager.js +74 -4
- 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 +399 -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/README.md +43 -20
- package/docs/book/README.md +19 -0
- package/docs/book/codex-cli-0124-adoption.md +68 -0
- package/docs/book/local-hook-impact.md +73 -0
- package/docs/book/operations.md +60 -0
- package/docs/book/public-posture.md +34 -0
- package/docs/book/setup.md +91 -0
- package/docs/book/skills.md +11 -0
- package/docs/guides/codex-version-policy.md +104 -0
- package/docs/public/downstream-setup.md +113 -0
- package/docs/public/provider-onboarding.md +173 -0
- package/package.json +23 -10
- package/plugins/codex-orchestrator/.codex-plugin/plugin.json +30 -0
- package/plugins/codex-orchestrator/.mcp.json +13 -0
- package/plugins/codex-orchestrator/launcher.mjs +361 -0
- package/schemas/manifest.json +411 -0
- package/skills/README.md +26 -0
- package/skills/collab-subagents-first/SKILL.md +1 -1
- package/skills/delegation-usage/DELEGATION_GUIDE.md +30 -12
- package/skills/delegation-usage/SKILL.md +25 -14
- 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/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 +15 -8
- package/templates/codex/mcp-client.json +5 -1
- package/docs/assets/setup.gif +0 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/* eslint-disable patterns/prefer-logger-over-console */
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { runDoctorCliShell } from './doctorCliShell.js';
|
|
4
|
+
const DEFAULT_DEPENDENCIES = {
|
|
5
|
+
runDoctorCliShell,
|
|
6
|
+
getCwd: () => process.cwd()
|
|
7
|
+
};
|
|
8
|
+
export async function runDoctorCliRequestShell(params, overrides = {}) {
|
|
9
|
+
const dependencies = { ...DEFAULT_DEPENDENCIES, ...overrides };
|
|
10
|
+
const format = resolveOutputFormat(params.flags);
|
|
11
|
+
const includeUsage = Boolean(params.flags['usage']);
|
|
12
|
+
const includeCloudPreflight = Boolean(params.flags['cloud-preflight']);
|
|
13
|
+
const includeIssueLog = Boolean(params.flags['issue-log']);
|
|
14
|
+
const cloudEnvIdOverride = readStringFlag(params.flags, 'cloud-env-id');
|
|
15
|
+
const cloudBranchOverride = readStringFlag(params.flags, 'cloud-branch');
|
|
16
|
+
const issueTitle = readStringFlag(params.flags, 'issue-title');
|
|
17
|
+
const issueNotes = readStringFlag(params.flags, 'issue-notes');
|
|
18
|
+
const issueLogPath = readStringFlag(params.flags, 'issue-log-path');
|
|
19
|
+
if (!includeCloudPreflight && (cloudEnvIdOverride || cloudBranchOverride)) {
|
|
20
|
+
throw new Error('--cloud-env-id/--cloud-branch require --cloud-preflight.');
|
|
21
|
+
}
|
|
22
|
+
if (!includeIssueLog && (issueTitle || issueNotes || issueLogPath)) {
|
|
23
|
+
throw new Error('--issue-title/--issue-notes/--issue-log-path require --issue-log.');
|
|
24
|
+
}
|
|
25
|
+
const wantsApply = Boolean(params.flags['apply']);
|
|
26
|
+
const apply = Boolean(params.flags['yes']);
|
|
27
|
+
if (wantsApply && format === 'json') {
|
|
28
|
+
throw new Error('doctor --apply does not support --format json.');
|
|
29
|
+
}
|
|
30
|
+
const windowDays = parseWindowDays(readStringFlag(params.flags, 'window-days'));
|
|
31
|
+
const taskFilter = readStringFlag(params.flags, 'task') ?? null;
|
|
32
|
+
await dependencies.runDoctorCliShell({
|
|
33
|
+
format,
|
|
34
|
+
includeUsage,
|
|
35
|
+
includeCloudPreflight,
|
|
36
|
+
includeIssueLog,
|
|
37
|
+
cloudEnvIdOverride: cloudEnvIdOverride ?? undefined,
|
|
38
|
+
cloudBranchOverride: cloudBranchOverride ?? undefined,
|
|
39
|
+
issueTitle: issueTitle ?? undefined,
|
|
40
|
+
issueNotes: issueNotes ?? undefined,
|
|
41
|
+
issueLogPath: issueLogPath ?? undefined,
|
|
42
|
+
wantsApply,
|
|
43
|
+
apply,
|
|
44
|
+
windowDays,
|
|
45
|
+
taskFilter,
|
|
46
|
+
repoRoot: dependencies.getCwd()
|
|
47
|
+
});
|
|
48
|
+
}
|
|
49
|
+
function resolveOutputFormat(flags) {
|
|
50
|
+
return flags['format'] === 'json' ? 'json' : 'text';
|
|
51
|
+
}
|
|
52
|
+
function readStringFlag(flags, key) {
|
|
53
|
+
const value = flags[key];
|
|
54
|
+
if (typeof value !== 'string') {
|
|
55
|
+
return undefined;
|
|
56
|
+
}
|
|
57
|
+
const trimmed = value.trim();
|
|
58
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
59
|
+
}
|
|
60
|
+
function parseWindowDays(windowDaysRaw) {
|
|
61
|
+
if (!windowDaysRaw) {
|
|
62
|
+
return undefined;
|
|
63
|
+
}
|
|
64
|
+
if (!/^\d+$/u.test(windowDaysRaw)) {
|
|
65
|
+
throw new Error(`Invalid --window-days value '${windowDaysRaw}'. Expected a positive integer.`);
|
|
66
|
+
}
|
|
67
|
+
const parsed = Number(windowDaysRaw);
|
|
68
|
+
if (!Number.isInteger(parsed) || parsed <= 0) {
|
|
69
|
+
throw new Error(`Invalid --window-days value '${windowDaysRaw}'. Expected a positive integer.`);
|
|
70
|
+
}
|
|
71
|
+
return parsed;
|
|
72
|
+
}
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/* eslint-disable patterns/prefer-logger-over-console */
|
|
2
|
+
import { formatDoctorCloudPreflightSummary, formatDoctorSummary, runDoctor, runDoctorCloudPreflight } from './doctor.js';
|
|
3
|
+
import { formatDoctorUsageSummary, runDoctorUsage } from './doctorUsage.js';
|
|
4
|
+
import { formatDoctorIssueLogSummary, writeDoctorIssueLog } from './doctorIssueLog.js';
|
|
5
|
+
import { formatDevtoolsSetupSummary, runDevtoolsSetup } from './devtoolsSetup.js';
|
|
6
|
+
import { formatDelegationSetupSummary, runDelegationSetup } from './delegationSetup.js';
|
|
7
|
+
import { formatSkillsInstallSummary, installSkills } from './skills.js';
|
|
8
|
+
const DEFAULT_DEPENDENCIES = {
|
|
9
|
+
runDoctor,
|
|
10
|
+
runDoctorUsage,
|
|
11
|
+
runDoctorCloudPreflight,
|
|
12
|
+
writeDoctorIssueLog,
|
|
13
|
+
runDelegationSetup,
|
|
14
|
+
runDevtoolsSetup,
|
|
15
|
+
installSkills,
|
|
16
|
+
formatDoctorSummary,
|
|
17
|
+
formatDoctorUsageSummary,
|
|
18
|
+
formatDoctorCloudPreflightSummary,
|
|
19
|
+
formatDoctorIssueLogSummary,
|
|
20
|
+
formatSkillsInstallSummary,
|
|
21
|
+
formatDelegationSetupSummary,
|
|
22
|
+
formatDevtoolsSetupSummary,
|
|
23
|
+
log: (line) => console.log(line)
|
|
24
|
+
};
|
|
25
|
+
export async function runDoctorCliShell(params, overrides = {}) {
|
|
26
|
+
const dependencies = { ...DEFAULT_DEPENDENCIES, ...overrides };
|
|
27
|
+
const doctorResult = dependencies.runDoctor(params.repoRoot);
|
|
28
|
+
const usageResult = params.includeUsage
|
|
29
|
+
? await dependencies.runDoctorUsage({ windowDays: params.windowDays, taskFilter: params.taskFilter })
|
|
30
|
+
: null;
|
|
31
|
+
const cloudPreflightResult = params.includeCloudPreflight
|
|
32
|
+
? await dependencies.runDoctorCloudPreflight({
|
|
33
|
+
cwd: params.repoRoot,
|
|
34
|
+
environmentId: params.cloudEnvIdOverride,
|
|
35
|
+
branch: params.cloudBranchOverride,
|
|
36
|
+
taskId: params.taskFilter
|
|
37
|
+
})
|
|
38
|
+
: null;
|
|
39
|
+
const issueLogResult = params.includeIssueLog
|
|
40
|
+
? await dependencies.writeDoctorIssueLog({
|
|
41
|
+
doctor: doctorResult,
|
|
42
|
+
usage: usageResult,
|
|
43
|
+
cloudPreflight: cloudPreflightResult,
|
|
44
|
+
issueTitle: params.issueTitle,
|
|
45
|
+
issueNotes: params.issueNotes,
|
|
46
|
+
issueLogPath: params.issueLogPath,
|
|
47
|
+
taskFilter: params.taskFilter
|
|
48
|
+
})
|
|
49
|
+
: null;
|
|
50
|
+
if (params.format === 'json') {
|
|
51
|
+
const payload = { ...doctorResult };
|
|
52
|
+
if (usageResult) {
|
|
53
|
+
payload.usage = usageResult;
|
|
54
|
+
}
|
|
55
|
+
if (cloudPreflightResult) {
|
|
56
|
+
payload.cloud_preflight = cloudPreflightResult;
|
|
57
|
+
}
|
|
58
|
+
if (issueLogResult) {
|
|
59
|
+
payload.issue_log = issueLogResult;
|
|
60
|
+
}
|
|
61
|
+
dependencies.log(JSON.stringify(payload, null, 2));
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
for (const line of dependencies.formatDoctorSummary(doctorResult)) {
|
|
65
|
+
dependencies.log(line);
|
|
66
|
+
}
|
|
67
|
+
if (usageResult) {
|
|
68
|
+
for (const line of dependencies.formatDoctorUsageSummary(usageResult)) {
|
|
69
|
+
dependencies.log(line);
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (cloudPreflightResult) {
|
|
73
|
+
for (const line of dependencies.formatDoctorCloudPreflightSummary(cloudPreflightResult)) {
|
|
74
|
+
dependencies.log(line);
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
if (issueLogResult) {
|
|
78
|
+
for (const line of dependencies.formatDoctorIssueLogSummary(issueLogResult)) {
|
|
79
|
+
dependencies.log(line);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
if (!params.wantsApply) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
const delegationPlan = await dependencies.runDelegationSetup({ repoRoot: params.repoRoot });
|
|
86
|
+
const devtoolsPlan = await dependencies.runDevtoolsSetup();
|
|
87
|
+
const needsDelegation = !delegationPlan.readiness.configured;
|
|
88
|
+
const needsDevtoolsSkill = devtoolsPlan.readiness.skill.status !== 'ok';
|
|
89
|
+
const devtoolsConfigStatus = devtoolsPlan.readiness.config.status;
|
|
90
|
+
const needsDevtoolsConfig = devtoolsConfigStatus === 'missing';
|
|
91
|
+
const hasInvalidDevtoolsConfig = devtoolsConfigStatus === 'invalid';
|
|
92
|
+
if (!needsDelegation && !needsDevtoolsSkill && !needsDevtoolsConfig && !hasInvalidDevtoolsConfig) {
|
|
93
|
+
dependencies.log('Doctor apply: nothing to do.');
|
|
94
|
+
return;
|
|
95
|
+
}
|
|
96
|
+
dependencies.log('Doctor apply plan:');
|
|
97
|
+
if (needsDevtoolsSkill) {
|
|
98
|
+
dependencies.log('- Install skill: chrome-devtools (codex-orchestrator skills install --only chrome-devtools)');
|
|
99
|
+
}
|
|
100
|
+
if (hasInvalidDevtoolsConfig) {
|
|
101
|
+
dependencies.log(`- DevTools MCP config is invalid: ${devtoolsPlan.readiness.config.path} (fix config.toml then rerun doctor --apply)`);
|
|
102
|
+
}
|
|
103
|
+
if (needsDevtoolsConfig) {
|
|
104
|
+
dependencies.log('- Configure DevTools MCP: codex-orchestrator devtools setup --yes');
|
|
105
|
+
}
|
|
106
|
+
if (needsDelegation) {
|
|
107
|
+
dependencies.log('- Configure delegation MCP: codex-orchestrator delegation setup --yes');
|
|
108
|
+
}
|
|
109
|
+
if (!params.apply) {
|
|
110
|
+
dependencies.log('Run with --apply --yes to apply these fixes.');
|
|
111
|
+
return;
|
|
112
|
+
}
|
|
113
|
+
if (needsDevtoolsSkill) {
|
|
114
|
+
const skills = await dependencies.installSkills({ only: ['chrome-devtools'] });
|
|
115
|
+
for (const line of dependencies.formatSkillsInstallSummary(skills)) {
|
|
116
|
+
dependencies.log(line);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
if (needsDelegation) {
|
|
120
|
+
const delegation = await dependencies.runDelegationSetup({ apply: true, repoRoot: params.repoRoot });
|
|
121
|
+
for (const line of dependencies.formatDelegationSetupSummary(delegation)) {
|
|
122
|
+
dependencies.log(line);
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
if (hasInvalidDevtoolsConfig) {
|
|
126
|
+
dependencies.log(`DevTools setup: skipped (config.toml is invalid: ${devtoolsPlan.readiness.config.path}). Fix it and rerun doctor --apply --yes.`);
|
|
127
|
+
}
|
|
128
|
+
else if (needsDevtoolsConfig) {
|
|
129
|
+
const devtools = await dependencies.runDevtoolsSetup({ apply: true });
|
|
130
|
+
for (const line of dependencies.formatDevtoolsSetupSummary(devtools)) {
|
|
131
|
+
dependencies.log(line);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
const doctorAfter = dependencies.runDoctor(params.repoRoot);
|
|
135
|
+
for (const line of dependencies.formatDoctorSummary(doctorAfter)) {
|
|
136
|
+
dependencies.log(line);
|
|
137
|
+
}
|
|
138
|
+
}
|
|
@@ -136,8 +136,8 @@ export async function runDoctorUsage(options = {}) {
|
|
|
136
136
|
if (collabEventsPossiblyTruncated) {
|
|
137
137
|
collabRunsWithPotentiallyTruncatedToolCalls += 1;
|
|
138
138
|
}
|
|
139
|
-
const
|
|
140
|
-
const
|
|
139
|
+
const spawnedAgentAliases = [];
|
|
140
|
+
const closedSpawnIndexes = new Set();
|
|
141
141
|
const failedSpawnIds = new Set();
|
|
142
142
|
let failedSpawnCalls = 0;
|
|
143
143
|
if (typeof manifest.task_id === 'string' && manifest.task_id) {
|
|
@@ -147,11 +147,7 @@ export async function runDoctorUsage(options = {}) {
|
|
|
147
147
|
const tool = typeof entry?.tool === 'string' && entry.tool ? entry.tool : 'unknown';
|
|
148
148
|
const status = typeof entry?.status === 'string' && entry.status ? entry.status : 'unknown';
|
|
149
149
|
const eventType = typeof entry?.event_type === 'string' && entry.event_type ? entry.event_type : 'unknown';
|
|
150
|
-
const
|
|
151
|
-
? entry.receiver_thread_ids
|
|
152
|
-
.map((id) => (typeof id === 'string' ? id.trim() : ''))
|
|
153
|
-
.filter((id) => id.length > 0)
|
|
154
|
-
: [];
|
|
150
|
+
const receiverIdentifierGroups = resolveCollabReceiverIdentifierGroups(entry);
|
|
155
151
|
const completedEventWithoutStatus = eventType === 'item.completed' && status !== 'failed';
|
|
156
152
|
const isCompleted = status === 'completed' || completedEventWithoutStatus;
|
|
157
153
|
const isFailed = status === 'failed';
|
|
@@ -186,25 +182,34 @@ export async function runDoctorUsage(options = {}) {
|
|
|
186
182
|
if (!isCompleted) {
|
|
187
183
|
continue;
|
|
188
184
|
}
|
|
189
|
-
if (
|
|
190
|
-
for (const
|
|
191
|
-
|
|
185
|
+
if (receiverIdentifierGroups.length > 0) {
|
|
186
|
+
for (const receiverIdentifiers of receiverIdentifierGroups) {
|
|
187
|
+
spawnedAgentAliases.push(new Set(receiverIdentifiers));
|
|
192
188
|
}
|
|
193
189
|
}
|
|
194
190
|
else {
|
|
195
|
-
|
|
196
|
-
spawnedAgents.add(fallbackId);
|
|
191
|
+
spawnedAgentAliases.push(new Set([`spawn@${entry?.item_id ?? entryIndex}`]));
|
|
197
192
|
}
|
|
198
193
|
continue;
|
|
199
194
|
}
|
|
200
195
|
if (tool === 'close_agent' && isCompleted) {
|
|
201
|
-
|
|
202
|
-
|
|
196
|
+
if (receiverIdentifierGroups.length === 0) {
|
|
197
|
+
continue;
|
|
198
|
+
}
|
|
199
|
+
for (const receiverIdentifiers of receiverIdentifierGroups) {
|
|
200
|
+
for (const [spawnIndex, aliases] of spawnedAgentAliases.entries()) {
|
|
201
|
+
if (closedSpawnIndexes.has(spawnIndex)) {
|
|
202
|
+
continue;
|
|
203
|
+
}
|
|
204
|
+
if (collabReceiverGroupMatches(receiverIdentifiers, aliases)) {
|
|
205
|
+
closedSpawnIndexes.add(spawnIndex);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
203
208
|
}
|
|
204
209
|
}
|
|
205
210
|
}
|
|
206
211
|
if (collabCaptureLimitKnown && !collabEventsPossiblyTruncated) {
|
|
207
|
-
const unclosedSpawnAgents =
|
|
212
|
+
const unclosedSpawnAgents = spawnedAgentAliases.filter((_aliases, spawnIndex) => !closedSpawnIndexes.has(spawnIndex));
|
|
208
213
|
if (unclosedSpawnAgents.length > 0) {
|
|
209
214
|
collabRunsWithUnclosedSpawnAgents += 1;
|
|
210
215
|
collabUnclosedSpawnAgents += unclosedSpawnAgents.length;
|
|
@@ -459,6 +464,105 @@ function resolveManifestCollabCaptureLimit(manifest) {
|
|
|
459
464
|
}
|
|
460
465
|
return Math.trunc(value);
|
|
461
466
|
}
|
|
467
|
+
function resolveCollabReceiverIdentifierGroups(entry) {
|
|
468
|
+
const receiverThreadIdSlots = normalizeCollabAliasSlots('thread', entry?.receiver_thread_ids);
|
|
469
|
+
const receiverAgentPathSlots = normalizeCollabAliasSlots('path', entry?.receiver_agent_paths);
|
|
470
|
+
const receiverAgents = Array.isArray(entry?.receiver_agents) ? entry.receiver_agents : [];
|
|
471
|
+
const groups = [];
|
|
472
|
+
const consumedThreadIndexes = new Set();
|
|
473
|
+
const consumedPathIndexes = new Set();
|
|
474
|
+
if (receiverAgents.length > 0) {
|
|
475
|
+
for (const agent of receiverAgents) {
|
|
476
|
+
const identifiers = dedupeCollabAliases([
|
|
477
|
+
normalizeCollabAlias('thread', agent?.thread_id),
|
|
478
|
+
normalizeCollabAlias('path', agent?.agent_path)
|
|
479
|
+
]);
|
|
480
|
+
if (identifiers.length > 0) {
|
|
481
|
+
groups.push(identifiers);
|
|
482
|
+
consumeMatchingAliasIndex(receiverThreadIdSlots, identifiers, consumedThreadIndexes);
|
|
483
|
+
consumeMatchingAliasIndex(receiverAgentPathSlots, identifiers, consumedPathIndexes);
|
|
484
|
+
}
|
|
485
|
+
}
|
|
486
|
+
}
|
|
487
|
+
const pairCount = Math.max(receiverThreadIdSlots.length, receiverAgentPathSlots.length);
|
|
488
|
+
for (let index = 0; index < pairCount; index += 1) {
|
|
489
|
+
if (consumedThreadIndexes.has(index) || consumedPathIndexes.has(index)) {
|
|
490
|
+
continue;
|
|
491
|
+
}
|
|
492
|
+
const receiverThreadId = receiverThreadIdSlots[index] ?? null;
|
|
493
|
+
const receiverAgentPath = receiverAgentPathSlots[index] ?? null;
|
|
494
|
+
if (receiverThreadId === null || receiverAgentPath === null) {
|
|
495
|
+
continue;
|
|
496
|
+
}
|
|
497
|
+
const identifiers = dedupeCollabAliases([receiverThreadId, receiverAgentPath]);
|
|
498
|
+
if (identifiers.length > 0) {
|
|
499
|
+
const existingGroup = groups.find((group) => group.includes(receiverThreadId));
|
|
500
|
+
if (existingGroup) {
|
|
501
|
+
for (const identifier of identifiers) {
|
|
502
|
+
if (!existingGroup.includes(identifier)) {
|
|
503
|
+
existingGroup.push(identifier);
|
|
504
|
+
}
|
|
505
|
+
}
|
|
506
|
+
}
|
|
507
|
+
else {
|
|
508
|
+
groups.push(identifiers);
|
|
509
|
+
}
|
|
510
|
+
}
|
|
511
|
+
consumedThreadIndexes.add(index);
|
|
512
|
+
consumedPathIndexes.add(index);
|
|
513
|
+
}
|
|
514
|
+
const groupedAliases = new Set(groups.flat());
|
|
515
|
+
for (const [index, receiverThreadId] of receiverThreadIdSlots.entries()) {
|
|
516
|
+
if (receiverThreadId !== null && !consumedThreadIndexes.has(index) && !groupedAliases.has(receiverThreadId)) {
|
|
517
|
+
groups.push([receiverThreadId]);
|
|
518
|
+
groupedAliases.add(receiverThreadId);
|
|
519
|
+
}
|
|
520
|
+
}
|
|
521
|
+
for (const [index, receiverAgentPath] of receiverAgentPathSlots.entries()) {
|
|
522
|
+
if (receiverAgentPath !== null && !consumedPathIndexes.has(index) && !groupedAliases.has(receiverAgentPath)) {
|
|
523
|
+
groups.push([receiverAgentPath]);
|
|
524
|
+
groupedAliases.add(receiverAgentPath);
|
|
525
|
+
}
|
|
526
|
+
}
|
|
527
|
+
return groups;
|
|
528
|
+
}
|
|
529
|
+
function normalizeCollabAliasSlots(prefix, values) {
|
|
530
|
+
return Array.isArray(values) ? values.map((value) => normalizeCollabAlias(prefix, value)) : [];
|
|
531
|
+
}
|
|
532
|
+
function normalizeCollabAlias(prefix, value) {
|
|
533
|
+
if (typeof value !== 'string') {
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
const trimmed = value.trim();
|
|
537
|
+
return trimmed ? `${prefix}:${trimmed}` : null;
|
|
538
|
+
}
|
|
539
|
+
function consumeMatchingAliasIndex(slots, aliases, consumedIndexes) {
|
|
540
|
+
for (const alias of aliases) {
|
|
541
|
+
const index = slots.findIndex((slotAlias, slotIndex) => slotAlias === alias && !consumedIndexes.has(slotIndex));
|
|
542
|
+
if (index >= 0) {
|
|
543
|
+
consumedIndexes.add(index);
|
|
544
|
+
}
|
|
545
|
+
}
|
|
546
|
+
}
|
|
547
|
+
function collabReceiverGroupMatches(receiverIdentifiers, aliases) {
|
|
548
|
+
const threadIdentifiers = receiverIdentifiers.filter((identifier) => identifier.startsWith('thread:'));
|
|
549
|
+
if (threadIdentifiers.length > 0) {
|
|
550
|
+
return threadIdentifiers.some((identifier) => aliases.has(identifier));
|
|
551
|
+
}
|
|
552
|
+
return receiverIdentifiers.some((identifier) => aliases.has(identifier));
|
|
553
|
+
}
|
|
554
|
+
function dedupeCollabAliases(values) {
|
|
555
|
+
const seen = new Set();
|
|
556
|
+
const deduped = [];
|
|
557
|
+
for (const value of values) {
|
|
558
|
+
if (!value || seen.has(value)) {
|
|
559
|
+
continue;
|
|
560
|
+
}
|
|
561
|
+
seen.add(value);
|
|
562
|
+
deduped.push(value);
|
|
563
|
+
}
|
|
564
|
+
return deduped;
|
|
565
|
+
}
|
|
462
566
|
function clampInt(value, min, max) {
|
|
463
567
|
const rounded = Math.floor(value);
|
|
464
568
|
if (!Number.isFinite(rounded)) {
|
|
@@ -38,16 +38,30 @@ export function framesFromToolMetrics(metrics, representativeEvent) {
|
|
|
38
38
|
latencyMs: metric.latencyMs
|
|
39
39
|
}));
|
|
40
40
|
}
|
|
41
|
-
export function formatExperienceInjections(experiences, slots) {
|
|
41
|
+
export function formatExperienceInjections(experiences, slots, diagnostics) {
|
|
42
42
|
if (slots <= 0) {
|
|
43
43
|
return [];
|
|
44
44
|
}
|
|
45
|
+
const selectedMetadata = new Map((diagnostics?.selected ?? []).map((entry) => [entry.id, entry]));
|
|
45
46
|
return experiences.slice(0, slots).map((experience) => {
|
|
47
|
+
const selected = selectedMetadata.get(experience.id);
|
|
46
48
|
const rewardScore = (experience.reward.gtScore + experience.reward.relativeRank).toFixed(2);
|
|
47
49
|
const statText = experience.toolStats
|
|
48
50
|
.map((stat) => `${stat.tool}: ${stat.tokens}t/${stat.costUsd.toFixed(3)}usd/${Math.round(stat.latencyMs)}ms`)
|
|
49
51
|
.join('; ');
|
|
50
|
-
|
|
52
|
+
const metadataParts = [
|
|
53
|
+
`exp ${experience.id}`,
|
|
54
|
+
`epoch ${experience.epoch ?? 'n/a'}`,
|
|
55
|
+
`reward ${rewardScore}`
|
|
56
|
+
];
|
|
57
|
+
if (selected) {
|
|
58
|
+
metadataParts.push(`source ${selected.source_kind}:${selected.source_key}`);
|
|
59
|
+
metadataParts.push(`competitive ${selected.competitive_score.toFixed(2)}`);
|
|
60
|
+
if (selected.dominance_penalty > 0) {
|
|
61
|
+
metadataParts.push(`anti-dom ${selected.dominance_penalty.toFixed(2)}`);
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
return `[${metadataParts.join(' | ')}] ${experience.summary32} (stats: ${statText})`;
|
|
51
65
|
});
|
|
52
66
|
}
|
|
53
67
|
function buildTrajectorySummary(frames, fallback) {
|
|
@@ -2,6 +2,7 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { relativeToRepo } from '../run/runPaths.js';
|
|
3
3
|
import { writeJsonAtomic } from '../utils/fs.js';
|
|
4
4
|
import { persistManifest } from '../run/manifestPersister.js';
|
|
5
|
+
import { refreshRunMemoryObservability } from '../run/source0.js';
|
|
5
6
|
import { readExecMetadata } from './finalization.js';
|
|
6
7
|
export function createRunSummaryPayload(params) {
|
|
7
8
|
const { env, paths, manifest, runStatus, shellCommand, argv, resultSummary, toolRecord, execEvents, exitCode, signal, notificationTargets, cwd, metrics } = params;
|
|
@@ -16,6 +17,7 @@ export function createRunSummaryPayload(params) {
|
|
|
16
17
|
const persisted = Boolean(execMetadata?.persisted);
|
|
17
18
|
const metadataSandbox = execMetadata?.sandboxState;
|
|
18
19
|
const sandboxState = resultSummary?.sandboxState ?? toolRecord?.sandboxState ?? metadataSandbox ?? 'sandboxed';
|
|
20
|
+
refreshRunMemoryObservability(manifest);
|
|
19
21
|
return {
|
|
20
22
|
status: runStatus === 'succeeded' ? 'succeeded' : 'failed',
|
|
21
23
|
run: {
|
|
@@ -52,6 +54,7 @@ export function createRunSummaryPayload(params) {
|
|
|
52
54
|
},
|
|
53
55
|
toolRun: toolRecord,
|
|
54
56
|
metrics: metrics ?? undefined,
|
|
57
|
+
memory: manifest.memory?.observability ?? undefined,
|
|
55
58
|
notifications: {
|
|
56
59
|
targets: notificationTargets,
|
|
57
60
|
delivered: [],
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/* eslint-disable patterns/prefer-logger-over-console */
|
|
2
|
+
import process from 'node:process';
|
|
3
|
+
import { resolveEnvironmentPaths } from '../../../scripts/lib/run-manifests.js';
|
|
4
|
+
import { executeExecCommand } from './exec/command.js';
|
|
5
|
+
import { normalizeEnvironmentPaths, sanitizeTaskId } from './run/environment.js';
|
|
6
|
+
const DEFAULT_DEPENDENCIES = {
|
|
7
|
+
resolveEnvironmentPaths,
|
|
8
|
+
normalizeEnvironmentPaths,
|
|
9
|
+
sanitizeTaskId,
|
|
10
|
+
executeExecCommand,
|
|
11
|
+
stdout: process.stdout,
|
|
12
|
+
stderr: process.stderr,
|
|
13
|
+
maybeEmitAdoptionHint: async () => undefined,
|
|
14
|
+
setExitCode: (code) => {
|
|
15
|
+
process.exitCode = code;
|
|
16
|
+
}
|
|
17
|
+
};
|
|
18
|
+
export async function runExecCliShell(params, overrides = {}) {
|
|
19
|
+
const dependencies = { ...DEFAULT_DEPENDENCIES, ...overrides };
|
|
20
|
+
if (params.commandTokens.length === 0) {
|
|
21
|
+
throw new Error('exec requires a command to run.');
|
|
22
|
+
}
|
|
23
|
+
const isInteractive = dependencies.stdout.isTTY === true && dependencies.stderr.isTTY === true;
|
|
24
|
+
const outputMode = params.requestedMode ?? (isInteractive ? 'interactive' : 'jsonl');
|
|
25
|
+
const env = dependencies.normalizeEnvironmentPaths(dependencies.resolveEnvironmentPaths());
|
|
26
|
+
if (params.taskId) {
|
|
27
|
+
env.taskId = dependencies.sanitizeTaskId(params.taskId);
|
|
28
|
+
}
|
|
29
|
+
const result = await dependencies.executeExecCommand({
|
|
30
|
+
env,
|
|
31
|
+
stdout: dependencies.stdout,
|
|
32
|
+
stderr: dependencies.stderr
|
|
33
|
+
}, {
|
|
34
|
+
command: params.commandTokens[0],
|
|
35
|
+
args: params.commandTokens.slice(1),
|
|
36
|
+
cwd: params.cwd,
|
|
37
|
+
outputMode,
|
|
38
|
+
notifyTargets: params.notifyTargets,
|
|
39
|
+
otelEndpoint: params.otelEndpoint,
|
|
40
|
+
jsonPretty: params.jsonPretty
|
|
41
|
+
});
|
|
42
|
+
if (result.exitCode !== null) {
|
|
43
|
+
dependencies.setExitCode(result.exitCode);
|
|
44
|
+
}
|
|
45
|
+
else if (result.status !== 'succeeded') {
|
|
46
|
+
dependencies.setExitCode(1);
|
|
47
|
+
}
|
|
48
|
+
if (outputMode === 'interactive') {
|
|
49
|
+
await dependencies.maybeEmitAdoptionHint(env.taskId);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { runFlowCliShell } from './flowCliShell.js';
|
|
2
|
+
const DEFAULT_DEPENDENCIES = {
|
|
3
|
+
runFlowCliShell
|
|
4
|
+
};
|
|
5
|
+
export async function runFlowCliRequestShell(params, overrides = {}) {
|
|
6
|
+
const dependencies = { ...DEFAULT_DEPENDENCIES, ...overrides };
|
|
7
|
+
if (params.positionals.length > 0) {
|
|
8
|
+
throw new Error(`flow does not accept positional arguments: ${params.positionals.join(' ')}`);
|
|
9
|
+
}
|
|
10
|
+
const format = resolveOutputFormat(params.flags);
|
|
11
|
+
const executionMode = params.resolveExecutionModeFlag(params.flags);
|
|
12
|
+
const runtimeMode = params.resolveRuntimeModeFlag(params.flags);
|
|
13
|
+
params.applyRepoConfigRequiredPolicy(params.flags);
|
|
14
|
+
const autoIssueLogEnabled = params.resolveAutoIssueLogEnabled(params.flags);
|
|
15
|
+
await dependencies.runFlowCliShell({
|
|
16
|
+
orchestrator: params.orchestrator,
|
|
17
|
+
format,
|
|
18
|
+
executionMode,
|
|
19
|
+
runtimeMode,
|
|
20
|
+
autoIssueLogEnabled,
|
|
21
|
+
taskId: readStringFlagValue(params.flags['task']),
|
|
22
|
+
parentRunId: readStringFlagValue(params.flags['parent-run']),
|
|
23
|
+
approvalPolicy: readStringFlagValue(params.flags['approval-policy']),
|
|
24
|
+
targetStageId: params.resolveTargetStageId(params.flags),
|
|
25
|
+
runWithUi: async (action) => await params.runWithUi(format, action),
|
|
26
|
+
emitRunOutput: params.emitRunOutput,
|
|
27
|
+
formatIssueLogSummary: params.formatIssueLogSummary,
|
|
28
|
+
toRunOutputPayload: params.toRunOutputPayload,
|
|
29
|
+
maybeCaptureAutoIssueLog: params.maybeCaptureAutoIssueLog,
|
|
30
|
+
resolveTaskFilter: params.resolveTaskFilter,
|
|
31
|
+
withAutoIssueLogContext: params.withAutoIssueLogContext,
|
|
32
|
+
maybeEmitRunAdoptionHint: params.maybeEmitRunAdoptionHint
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
function resolveOutputFormat(flags) {
|
|
36
|
+
return flags['format'] === 'json' ? 'json' : 'text';
|
|
37
|
+
}
|
|
38
|
+
function readStringFlagValue(value) {
|
|
39
|
+
if (typeof value !== 'string') {
|
|
40
|
+
return undefined;
|
|
41
|
+
}
|
|
42
|
+
const trimmed = value.trim();
|
|
43
|
+
return trimmed.length > 0 ? trimmed : undefined;
|
|
44
|
+
}
|