@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,284 @@
|
|
|
1
|
+
import { isoTimestamp } from '../utils/time.js';
|
|
2
|
+
import { serializeProviderIntakeSummary } from './observabilityReadModel.js';
|
|
3
|
+
import { findCompatibilityProjectionIssueRecord } from './compatibilityIssuePresenter.js';
|
|
4
|
+
import { buildCompatibilityIssueRecordLookups, resolveRetryIssueRecord, resolveRunningIssueRecord } from './operatorDashboardPresenter.js';
|
|
5
|
+
const READ_ONLY_COMPAT_ACTION = 'refresh';
|
|
6
|
+
const COMPATIBILITY_MUTATING_ACTIONS = new Set(['pause', 'resume', 'cancel', 'fail', 'rerun']);
|
|
7
|
+
const JSON_HEADERS = { 'Content-Type': 'application/json' };
|
|
8
|
+
export function buildCompatibilityErrorResponse(input) {
|
|
9
|
+
return {
|
|
10
|
+
status: input.status,
|
|
11
|
+
headers: JSON_HEADERS,
|
|
12
|
+
body: {
|
|
13
|
+
error: {
|
|
14
|
+
code: input.code,
|
|
15
|
+
message: input.message,
|
|
16
|
+
...(input.details ? { details: input.details } : {})
|
|
17
|
+
},
|
|
18
|
+
...(input.traceability ? { traceability: input.traceability } : {})
|
|
19
|
+
}
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
export function buildCompatibilityMethodNotAllowedResponse(context, allowedMethod, issueIdentifier) {
|
|
23
|
+
return buildCompatibilityErrorResponse({
|
|
24
|
+
status: 405,
|
|
25
|
+
code: 'method_not_allowed',
|
|
26
|
+
message: 'Method not allowed',
|
|
27
|
+
details: {
|
|
28
|
+
surface: 'api_v1',
|
|
29
|
+
allowed_method: allowedMethod,
|
|
30
|
+
...(issueIdentifier ? { issue_identifier: issueIdentifier } : {})
|
|
31
|
+
},
|
|
32
|
+
traceability: buildCompatibilityTraceability(context, {
|
|
33
|
+
decision: 'rejected',
|
|
34
|
+
reason: 'method_not_allowed',
|
|
35
|
+
...(issueIdentifier ? { issueIdentifier } : {})
|
|
36
|
+
})
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
export function buildCompatibilityIssueNotFoundResponse(context, issueIdentifier) {
|
|
40
|
+
return buildCompatibilityErrorResponse({
|
|
41
|
+
status: 404,
|
|
42
|
+
code: 'issue_not_found',
|
|
43
|
+
message: 'Issue not found',
|
|
44
|
+
details: {
|
|
45
|
+
surface: 'api_v1',
|
|
46
|
+
issue_identifier: issueIdentifier
|
|
47
|
+
},
|
|
48
|
+
traceability: buildCompatibilityTraceability(context, {
|
|
49
|
+
decision: 'rejected',
|
|
50
|
+
reason: 'issue_not_found',
|
|
51
|
+
issueIdentifier
|
|
52
|
+
})
|
|
53
|
+
});
|
|
54
|
+
}
|
|
55
|
+
export function buildCompatibilityNotFoundResponse(context) {
|
|
56
|
+
return buildCompatibilityErrorResponse({
|
|
57
|
+
status: 404,
|
|
58
|
+
code: 'not_found',
|
|
59
|
+
message: 'Route not found',
|
|
60
|
+
details: {
|
|
61
|
+
surface: 'api_v1'
|
|
62
|
+
},
|
|
63
|
+
traceability: buildCompatibilityTraceability(context, {
|
|
64
|
+
decision: 'rejected',
|
|
65
|
+
reason: 'route_not_found'
|
|
66
|
+
})
|
|
67
|
+
});
|
|
68
|
+
}
|
|
69
|
+
export function buildCompatibilityRefreshRejectedResponse(context, rejection) {
|
|
70
|
+
return buildCompatibilityErrorResponse({
|
|
71
|
+
status: resolveCompatibilityRefreshRejectionStatus(rejection.reason),
|
|
72
|
+
code: 'read_only_action_rejected',
|
|
73
|
+
message: 'Compatibility surface is read-only; only refresh acknowledgements are supported.',
|
|
74
|
+
details: {
|
|
75
|
+
surface: 'api_v1',
|
|
76
|
+
mode: 'read_only',
|
|
77
|
+
reason: rejection.reason,
|
|
78
|
+
allowed_actions: ['refresh'],
|
|
79
|
+
allowed_tools: [],
|
|
80
|
+
requested_action: rejection.requestAction,
|
|
81
|
+
requested_tool: rejection.requestTool
|
|
82
|
+
},
|
|
83
|
+
traceability: buildCompatibilityTraceability(context, {
|
|
84
|
+
decision: 'rejected',
|
|
85
|
+
reason: rejection.reason,
|
|
86
|
+
requestAction: rejection.requestAction,
|
|
87
|
+
requestTool: rejection.requestTool
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// `/api/v1/dispatch` is a CO-specific extension over the Symphony-aligned
|
|
92
|
+
// compatibility surface, so keep the dispatch payload seam explicit.
|
|
93
|
+
export async function readDispatchExtension(context) {
|
|
94
|
+
const { issueIdentifier, evaluation } = await context.readDispatchEvaluation();
|
|
95
|
+
if (evaluation.failure) {
|
|
96
|
+
return {
|
|
97
|
+
kind: 'fail_closed',
|
|
98
|
+
issueIdentifier,
|
|
99
|
+
evaluation,
|
|
100
|
+
failure: evaluation.failure,
|
|
101
|
+
details: {
|
|
102
|
+
surface: 'api_v1',
|
|
103
|
+
mode: 'read_only',
|
|
104
|
+
advisory_only: true,
|
|
105
|
+
reason: evaluation.failure.reason,
|
|
106
|
+
dispatch_pilot: evaluation.summary
|
|
107
|
+
}
|
|
108
|
+
};
|
|
109
|
+
}
|
|
110
|
+
return {
|
|
111
|
+
kind: 'ok',
|
|
112
|
+
issueIdentifier,
|
|
113
|
+
evaluation,
|
|
114
|
+
payload: {
|
|
115
|
+
generated_at: isoTimestamp(),
|
|
116
|
+
mode: 'read_only',
|
|
117
|
+
advisory_only: true,
|
|
118
|
+
dispatch_pilot: evaluation.summary,
|
|
119
|
+
recommendation: evaluation.recommendation
|
|
120
|
+
}
|
|
121
|
+
};
|
|
122
|
+
}
|
|
123
|
+
export async function readCompatibilityRefresh(context, body = {}) {
|
|
124
|
+
const rejection = resolveCompatibilityActionEnvelopeRejection(body);
|
|
125
|
+
if (rejection) {
|
|
126
|
+
return {
|
|
127
|
+
kind: 'rejected',
|
|
128
|
+
reason: rejection.reason,
|
|
129
|
+
requestAction: rejection.requestAction,
|
|
130
|
+
requestTool: rejection.requestTool
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
const refreshAcknowledgement = normalizeRefreshAcknowledgement(await context.requestRefresh());
|
|
134
|
+
const requestBody = isRecordLike(body) ? body : {};
|
|
135
|
+
const requestedAction = readStringValue(requestBody, 'action');
|
|
136
|
+
return {
|
|
137
|
+
kind: 'accepted',
|
|
138
|
+
payload: {
|
|
139
|
+
...refreshAcknowledgement,
|
|
140
|
+
traceability: buildCompatibilityTraceability(context, {
|
|
141
|
+
decision: 'acknowledged',
|
|
142
|
+
reason: 'refresh_requested',
|
|
143
|
+
requestAction: requestedAction ? requestedAction.toLowerCase() : READ_ONLY_COMPAT_ACTION
|
|
144
|
+
})
|
|
145
|
+
}
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
function normalizeRefreshAcknowledgement(value) {
|
|
149
|
+
return {
|
|
150
|
+
queued: value?.queued ?? true,
|
|
151
|
+
coalesced: value?.coalesced ?? false,
|
|
152
|
+
requested_at: value?.requested_at ?? isoTimestamp(),
|
|
153
|
+
operations: value?.operations ?? ['poll', 'reconcile'],
|
|
154
|
+
stuck: value?.stuck ?? false,
|
|
155
|
+
restart_required: value?.restart_required ?? false,
|
|
156
|
+
reason: value?.reason ?? null
|
|
157
|
+
};
|
|
158
|
+
}
|
|
159
|
+
export function buildCompatibilityTraceability(context, input) {
|
|
160
|
+
const snapshot = context.controlStore.snapshot();
|
|
161
|
+
return {
|
|
162
|
+
task_id: resolveTaskIdFromManifestPath(context.paths.manifestPath),
|
|
163
|
+
run_id: snapshot.run_id,
|
|
164
|
+
manifest_path: context.paths.manifestPath,
|
|
165
|
+
surface: 'api_v1',
|
|
166
|
+
issue_identifier: input.issueIdentifier ?? null,
|
|
167
|
+
requested_action: input.requestAction ?? null,
|
|
168
|
+
requested_tool: input.requestTool ?? null,
|
|
169
|
+
decision: input.decision,
|
|
170
|
+
reason: input.reason,
|
|
171
|
+
timestamp: isoTimestamp()
|
|
172
|
+
};
|
|
173
|
+
}
|
|
174
|
+
export async function readCompatibilityState(context) {
|
|
175
|
+
const projection = await context.readCompatibilityProjection();
|
|
176
|
+
const generatedAt = isoTimestamp();
|
|
177
|
+
const issueRecordLookups = buildCompatibilityIssueRecordLookups(projection.issues);
|
|
178
|
+
return {
|
|
179
|
+
generated_at: generatedAt,
|
|
180
|
+
counts: { running: projection.running.length, retrying: projection.retrying.length },
|
|
181
|
+
running_ids: projection.running.map((entry) => resolveRunningIssueRecord(entry, issueRecordLookups)?.issueIdentifier ?? entry.issue_identifier),
|
|
182
|
+
retrying_ids: projection.retrying.map((entry) => resolveRetryIssueRecord(entry, issueRecordLookups)?.issueIdentifier ?? entry.issue_identifier),
|
|
183
|
+
running: projection.running,
|
|
184
|
+
retrying: projection.retrying,
|
|
185
|
+
codex_totals: projection.codexTotals,
|
|
186
|
+
rate_limits: projection.rateLimits,
|
|
187
|
+
selected: projection.selected,
|
|
188
|
+
...(projection.providerIntake
|
|
189
|
+
? { provider_intake: serializeProviderIntakeSummary(projection.providerIntake) }
|
|
190
|
+
: {}),
|
|
191
|
+
...(projection.providerWorkflow ? { provider_workflow: projection.providerWorkflow } : {}),
|
|
192
|
+
...(projection.polling ? { polling: projection.polling } : {}),
|
|
193
|
+
...(projection.dispatchPilot ? { dispatch_pilot: projection.dispatchPilot } : {}),
|
|
194
|
+
...(projection.tracked ? { tracked: projection.tracked } : {})
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
export async function readCompatibilityIssue(context, issueIdentifier) {
|
|
198
|
+
const projection = await context.readCompatibilityProjection();
|
|
199
|
+
const issue = findCompatibilityProjectionIssueRecord(projection, issueIdentifier);
|
|
200
|
+
if (!issue) {
|
|
201
|
+
return { kind: 'issue_not_found' };
|
|
202
|
+
}
|
|
203
|
+
return {
|
|
204
|
+
kind: 'ok',
|
|
205
|
+
payload: issue.payload
|
|
206
|
+
};
|
|
207
|
+
}
|
|
208
|
+
function resolveCompatibilityActionEnvelopeRejection(body) {
|
|
209
|
+
if (!isRecordLike(body)) {
|
|
210
|
+
return {
|
|
211
|
+
reason: 'malformed_action_request',
|
|
212
|
+
requestAction: null,
|
|
213
|
+
requestTool: null
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
const hasAction = Object.prototype.hasOwnProperty.call(body, 'action');
|
|
217
|
+
const hasTool = Object.prototype.hasOwnProperty.call(body, 'tool');
|
|
218
|
+
if (!hasAction && !hasTool) {
|
|
219
|
+
return null;
|
|
220
|
+
}
|
|
221
|
+
const actionValue = readStringValue(body, 'action');
|
|
222
|
+
const normalizedAction = actionValue ? actionValue.toLowerCase() : null;
|
|
223
|
+
const toolValue = readStringValue(body, 'tool');
|
|
224
|
+
const normalizedTool = toolValue ? toolValue.toLowerCase() : null;
|
|
225
|
+
if (hasAction && !normalizedAction) {
|
|
226
|
+
return {
|
|
227
|
+
reason: 'malformed_action_request',
|
|
228
|
+
requestAction: null,
|
|
229
|
+
requestTool: normalizedTool
|
|
230
|
+
};
|
|
231
|
+
}
|
|
232
|
+
if (normalizedAction && COMPATIBILITY_MUTATING_ACTIONS.has(normalizedAction)) {
|
|
233
|
+
return {
|
|
234
|
+
reason: 'forbidden_mutating_action',
|
|
235
|
+
requestAction: normalizedAction,
|
|
236
|
+
requestTool: normalizedTool
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
if (normalizedAction && normalizedAction !== READ_ONLY_COMPAT_ACTION) {
|
|
240
|
+
return {
|
|
241
|
+
reason: 'unsupported_action',
|
|
242
|
+
requestAction: normalizedAction,
|
|
243
|
+
requestTool: normalizedTool
|
|
244
|
+
};
|
|
245
|
+
}
|
|
246
|
+
if (hasTool) {
|
|
247
|
+
return {
|
|
248
|
+
reason: 'unsupported_tool',
|
|
249
|
+
requestAction: normalizedAction,
|
|
250
|
+
requestTool: normalizedTool
|
|
251
|
+
};
|
|
252
|
+
}
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
function resolveCompatibilityRefreshRejectionStatus(reason) {
|
|
256
|
+
switch (reason) {
|
|
257
|
+
case 'forbidden_mutating_action':
|
|
258
|
+
case 'unsupported_tool':
|
|
259
|
+
return 403;
|
|
260
|
+
case 'malformed_action_request':
|
|
261
|
+
case 'unsupported_action':
|
|
262
|
+
return 400;
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
function isRecordLike(value) {
|
|
266
|
+
return typeof value === 'object' && value !== null && !Array.isArray(value);
|
|
267
|
+
}
|
|
268
|
+
function resolveTaskIdFromManifestPath(manifestPath) {
|
|
269
|
+
const normalizedPath = manifestPath.replace(/\\/g, '/');
|
|
270
|
+
const match = normalizedPath.match(/\.runs\/([^/]+)\/cli\//);
|
|
271
|
+
return match?.[1] ?? null;
|
|
272
|
+
}
|
|
273
|
+
function readStringValue(record, ...keys) {
|
|
274
|
+
for (const key of keys) {
|
|
275
|
+
const value = record[key];
|
|
276
|
+
if (typeof value === 'string') {
|
|
277
|
+
const trimmed = value.trim();
|
|
278
|
+
if (trimmed.length > 0) {
|
|
279
|
+
return trimmed;
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
return undefined;
|
|
284
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { logger } from '../../logger.js';
|
|
2
|
+
export function createObservabilityUpdateNotifier() {
|
|
3
|
+
const listeners = new Set();
|
|
4
|
+
return {
|
|
5
|
+
publish(input) {
|
|
6
|
+
const snapshot = Array.from(listeners);
|
|
7
|
+
for (const listener of snapshot) {
|
|
8
|
+
Promise.resolve()
|
|
9
|
+
.then(() => listener(input))
|
|
10
|
+
.catch((error) => {
|
|
11
|
+
logger.warn(`Failed to handle observability update: ${error?.message ?? String(error)}`);
|
|
12
|
+
});
|
|
13
|
+
}
|
|
14
|
+
},
|
|
15
|
+
subscribe(listener) {
|
|
16
|
+
listeners.add(listener);
|
|
17
|
+
return () => {
|
|
18
|
+
listeners.delete(listener);
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
};
|
|
22
|
+
}
|
|
@@ -0,0 +1,252 @@
|
|
|
1
|
+
import { hostname } from 'node:os';
|
|
2
|
+
import { resolveProviderWorkerHost } from './observabilityReadModel.js';
|
|
3
|
+
import { isoTimestamp } from '../utils/time.js';
|
|
4
|
+
const LOCAL_HOSTNAME = hostname();
|
|
5
|
+
export function buildUiDataset(input) {
|
|
6
|
+
const generatedAt = input.generatedAt ?? isoTimestamp();
|
|
7
|
+
const selectedIssueIdentifier = input.projection.selected?.issue_identifier ?? null;
|
|
8
|
+
const issueRecords = input.projection.issues;
|
|
9
|
+
const issuePayloads = issueRecords.map((record) => record.payload);
|
|
10
|
+
const issueRecordLookups = buildCompatibilityIssueRecordLookups(issueRecords);
|
|
11
|
+
return {
|
|
12
|
+
generated_at: generatedAt,
|
|
13
|
+
mode: 'operator_dashboard',
|
|
14
|
+
read_only: true,
|
|
15
|
+
host: LOCAL_HOSTNAME,
|
|
16
|
+
counts: {
|
|
17
|
+
running: input.projection.running.length,
|
|
18
|
+
retrying: input.projection.retrying.length,
|
|
19
|
+
issues: issuePayloads.length,
|
|
20
|
+
max_allowed: input.projection.maxConcurrentAgents ?? null
|
|
21
|
+
},
|
|
22
|
+
totals: input.projection.codexTotals,
|
|
23
|
+
rate_limits: input.projection.rateLimits,
|
|
24
|
+
polling: input.projection.polling ?? null,
|
|
25
|
+
selected_issue_identifier: selectedIssueIdentifier,
|
|
26
|
+
selected: input.projection.selected,
|
|
27
|
+
running: input.projection.running.map((entry) => buildRunningSessionPayload(entry, resolveRunningIssueRecord(entry, issueRecordLookups))),
|
|
28
|
+
retrying: input.projection.retrying.map((entry) => buildRetryQueuePayload(entry, resolveRetryIssueRecord(entry, issueRecordLookups))),
|
|
29
|
+
issues: issuePayloads.map((issue) => buildIssuePayload(issue, issue.issue_identifier === selectedIssueIdentifier)),
|
|
30
|
+
...(input.projection.providerWorkflow ? { provider_workflow: input.projection.providerWorkflow } : {}),
|
|
31
|
+
...(input.projection.providerIntake ? { provider_intake: input.projection.providerIntake } : {}),
|
|
32
|
+
...(input.projection.dispatchPilot ? { dispatch_pilot: input.projection.dispatchPilot } : {}),
|
|
33
|
+
...(input.projection.tracked ? { tracked: input.projection.tracked } : {})
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
export function buildCompatibilityIssueRecordLookups(issueRecords) {
|
|
37
|
+
const records = issueRecords ?? [];
|
|
38
|
+
return {
|
|
39
|
+
byId: new Map(records.flatMap((issue) => issue.payload.issue_id === null ? [] : [[issue.payload.issue_id, issue]])),
|
|
40
|
+
byRunId: new Map(records.flatMap((issue) => issue.payload.run_id === null ? [] : [[issue.payload.run_id, issue]])),
|
|
41
|
+
byIdentifier: new Map(records.map((issue) => [issue.payload.issue_identifier, issue]))
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
export async function readUiDataset(context) {
|
|
45
|
+
const projection = await context.readCompatibilityProjection();
|
|
46
|
+
return buildUiDataset({
|
|
47
|
+
projection
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
function buildIssuePayload(issue, isSelected) {
|
|
51
|
+
const proof = issue.provider_linear_worker_proof ?? null;
|
|
52
|
+
const trackedLinear = issue.tracked && 'linear' in issue.tracked ? issue.tracked.linear : null;
|
|
53
|
+
const running = issue.running ?? null;
|
|
54
|
+
const stageStartedAt = running?.started_at ??
|
|
55
|
+
issue.retry?.started_at ??
|
|
56
|
+
issue.provider_debug_snapshot?.claim?.launch_started_at ??
|
|
57
|
+
null;
|
|
58
|
+
const workerHost = issue.worker_host ??
|
|
59
|
+
resolveProviderWorkerHost({
|
|
60
|
+
providerLinearWorkerProof: proof,
|
|
61
|
+
providerDebugSnapshot: issue.provider_debug_snapshot ?? null,
|
|
62
|
+
stageStartedAt
|
|
63
|
+
});
|
|
64
|
+
return {
|
|
65
|
+
issue_identifier: issue.issue_identifier,
|
|
66
|
+
issue_id: issue.issue_id,
|
|
67
|
+
task_id: issue.task_id,
|
|
68
|
+
run_id: issue.run_id,
|
|
69
|
+
status: issue.status,
|
|
70
|
+
raw_status: issue.raw_status,
|
|
71
|
+
display_status: issue.display_status,
|
|
72
|
+
status_reason: issue.status_reason,
|
|
73
|
+
title: trackedLinear?.title ?? null,
|
|
74
|
+
url: trackedLinear?.url ?? null,
|
|
75
|
+
workspace: {
|
|
76
|
+
path: issue.workspace.path ?? proof?.workspace_path ?? null,
|
|
77
|
+
host: LOCAL_HOSTNAME
|
|
78
|
+
},
|
|
79
|
+
...(workerHost !== null ? { worker_host: workerHost } : {}),
|
|
80
|
+
session: {
|
|
81
|
+
session_id: proof?.latest_session_id ?? running?.session_id ?? issue.retry?.session_id ?? null,
|
|
82
|
+
thread_id: proof?.thread_id ?? null,
|
|
83
|
+
turn_count: proof?.turn_count ?? running?.turn_count ?? null
|
|
84
|
+
},
|
|
85
|
+
owner: {
|
|
86
|
+
phase: proof?.owner_phase ?? null,
|
|
87
|
+
status: proof?.owner_status ?? null
|
|
88
|
+
},
|
|
89
|
+
tokens: proof?.tokens ?? running?.tokens ?? null,
|
|
90
|
+
rate_limits: proof?.rate_limits ?? null,
|
|
91
|
+
summary: issue.summary,
|
|
92
|
+
last_error: issue.last_error,
|
|
93
|
+
latest_event: issue.latest_event,
|
|
94
|
+
recent_agent_activity: normalizeRecentAgentActivity(issue, proof),
|
|
95
|
+
linear_activity: normalizeLinearActivity(trackedLinear?.recent_activity),
|
|
96
|
+
running: issue.running,
|
|
97
|
+
retry: issue.retry,
|
|
98
|
+
attempts: issue.attempts,
|
|
99
|
+
tracked: issue.tracked,
|
|
100
|
+
provider_linear_worker_proof: proof,
|
|
101
|
+
provider_debug_snapshot: issue.provider_debug_snapshot ?? null,
|
|
102
|
+
is_selected: isSelected
|
|
103
|
+
};
|
|
104
|
+
}
|
|
105
|
+
function buildRunningSessionPayload(entry, issueRecord) {
|
|
106
|
+
const issue = issueRecord?.payload ?? null;
|
|
107
|
+
const proof = issue?.provider_linear_worker_proof ?? null;
|
|
108
|
+
const workerHost = entry.worker_host ??
|
|
109
|
+
issue?.worker_host ??
|
|
110
|
+
resolveProviderWorkerHost({
|
|
111
|
+
providerLinearWorkerProof: proof,
|
|
112
|
+
providerDebugSnapshot: issue?.provider_debug_snapshot ?? null,
|
|
113
|
+
stageStartedAt: entry.started_at ??
|
|
114
|
+
issue?.running?.started_at ??
|
|
115
|
+
issue?.provider_debug_snapshot?.claim?.launch_started_at ??
|
|
116
|
+
null
|
|
117
|
+
});
|
|
118
|
+
return {
|
|
119
|
+
issue_identifier: entry.issue_identifier,
|
|
120
|
+
issue_id: entry.issue_id,
|
|
121
|
+
id: issueRecord?.issueIdentifier ?? entry.issue_identifier,
|
|
122
|
+
bucket: 'running',
|
|
123
|
+
state: entry.state,
|
|
124
|
+
reason: entry.status_reason,
|
|
125
|
+
aliases: resolveCompatibilityAliases({
|
|
126
|
+
issueRecord,
|
|
127
|
+
issueIdentifier: entry.issue_identifier,
|
|
128
|
+
issueId: entry.issue_id,
|
|
129
|
+
taskId: issue?.task_id ?? null,
|
|
130
|
+
runId: issue?.run_id ?? null
|
|
131
|
+
}),
|
|
132
|
+
task_id: issue?.task_id ?? null,
|
|
133
|
+
run_id: issue?.run_id ?? null,
|
|
134
|
+
summary: issue?.summary ?? null,
|
|
135
|
+
display_state: entry.display_state,
|
|
136
|
+
status_reason: entry.status_reason,
|
|
137
|
+
pid: proof === null ? (entry.pid ?? null) : (proof.pid ?? null),
|
|
138
|
+
session_id: proof?.latest_session_id ?? entry.session_id,
|
|
139
|
+
thread_id: proof?.thread_id ?? null,
|
|
140
|
+
turn_count: proof?.turn_count ?? entry.turn_count,
|
|
141
|
+
workspace_path: issue?.workspace.path ?? proof?.workspace_path ?? null,
|
|
142
|
+
host: LOCAL_HOSTNAME,
|
|
143
|
+
...(workerHost !== null ? { worker_host: workerHost } : {}),
|
|
144
|
+
last_event: entry.last_event,
|
|
145
|
+
last_message: entry.last_message,
|
|
146
|
+
display_event: entry.display_event ?? null,
|
|
147
|
+
started_at: entry.started_at,
|
|
148
|
+
last_event_at: entry.last_event_at,
|
|
149
|
+
tokens: proof?.tokens ?? entry.tokens
|
|
150
|
+
};
|
|
151
|
+
}
|
|
152
|
+
function buildRetryQueuePayload(entry, issueRecord) {
|
|
153
|
+
const issue = issueRecord?.payload ?? null;
|
|
154
|
+
const proof = issue?.provider_linear_worker_proof ?? null;
|
|
155
|
+
const workerHost = entry.worker_host ??
|
|
156
|
+
issue?.worker_host ??
|
|
157
|
+
resolveProviderWorkerHost({
|
|
158
|
+
providerLinearWorkerProof: proof,
|
|
159
|
+
providerDebugSnapshot: issue?.provider_debug_snapshot ?? null,
|
|
160
|
+
stageStartedAt: entry.started_at ??
|
|
161
|
+
issue?.retry?.started_at ??
|
|
162
|
+
issue?.provider_debug_snapshot?.claim?.launch_started_at ??
|
|
163
|
+
null
|
|
164
|
+
});
|
|
165
|
+
return {
|
|
166
|
+
issue_identifier: entry.issue_identifier,
|
|
167
|
+
issue_id: entry.issue_id,
|
|
168
|
+
id: issueRecord?.issueIdentifier ?? entry.issue_identifier,
|
|
169
|
+
bucket: 'retrying',
|
|
170
|
+
state: entry.state,
|
|
171
|
+
reason: entry.status_reason,
|
|
172
|
+
aliases: resolveCompatibilityAliases({
|
|
173
|
+
issueRecord,
|
|
174
|
+
issueIdentifier: entry.issue_identifier,
|
|
175
|
+
issueId: entry.issue_id,
|
|
176
|
+
taskId: entry.task_id ?? issue?.task_id ?? null,
|
|
177
|
+
runId: entry.run_id ?? issue?.run_id ?? null
|
|
178
|
+
}),
|
|
179
|
+
task_id: entry.task_id ?? issue?.task_id ?? null,
|
|
180
|
+
run_id: entry.run_id ?? issue?.run_id ?? null,
|
|
181
|
+
summary: issue?.summary ?? null,
|
|
182
|
+
display_state: entry.display_state,
|
|
183
|
+
status_reason: entry.status_reason,
|
|
184
|
+
session_id: entry.session_id,
|
|
185
|
+
thread_id: entry.thread_id ?? null,
|
|
186
|
+
turn_count: entry.turn_count ?? null,
|
|
187
|
+
workspace_path: entry.workspace_path ?? null,
|
|
188
|
+
host: LOCAL_HOSTNAME,
|
|
189
|
+
...(workerHost !== null ? { worker_host: workerHost } : {}),
|
|
190
|
+
attempt: entry.attempt,
|
|
191
|
+
due_at: entry.due_at,
|
|
192
|
+
error: entry.error,
|
|
193
|
+
last_event: entry.last_event,
|
|
194
|
+
last_message: entry.last_message,
|
|
195
|
+
started_at: entry.started_at,
|
|
196
|
+
last_event_at: entry.last_event_at
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
export function resolveRunningIssueRecord(entry, issueRecordLookups) {
|
|
200
|
+
if (entry.issue_id !== null) {
|
|
201
|
+
const issueById = issueRecordLookups.byId.get(entry.issue_id);
|
|
202
|
+
if (issueById) {
|
|
203
|
+
return issueById;
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
return issueRecordLookups.byIdentifier.get(entry.issue_identifier) ?? null;
|
|
207
|
+
}
|
|
208
|
+
export function resolveRetryIssueRecord(entry, issueRecordLookups) {
|
|
209
|
+
if (entry.run_id) {
|
|
210
|
+
const issueByRunId = issueRecordLookups.byRunId.get(entry.run_id);
|
|
211
|
+
if (issueByRunId) {
|
|
212
|
+
return issueByRunId;
|
|
213
|
+
}
|
|
214
|
+
}
|
|
215
|
+
if (entry.issue_id !== null) {
|
|
216
|
+
const issueById = issueRecordLookups.byId.get(entry.issue_id);
|
|
217
|
+
if (issueById) {
|
|
218
|
+
return issueById;
|
|
219
|
+
}
|
|
220
|
+
}
|
|
221
|
+
return issueRecordLookups.byIdentifier.get(entry.issue_identifier) ?? null;
|
|
222
|
+
}
|
|
223
|
+
function resolveCompatibilityAliases(input) {
|
|
224
|
+
const aliases = [
|
|
225
|
+
...(input.issueRecord?.aliases ?? []),
|
|
226
|
+
input.issueIdentifier,
|
|
227
|
+
input.issueId,
|
|
228
|
+
input.taskId,
|
|
229
|
+
input.runId
|
|
230
|
+
];
|
|
231
|
+
return Array.from(new Set(aliases.filter((alias) => typeof alias === 'string' && alias.length > 0)));
|
|
232
|
+
}
|
|
233
|
+
function normalizeRecentAgentActivity(issue, proof) {
|
|
234
|
+
if (issue.recent_events.length > 0) {
|
|
235
|
+
return issue.recent_events;
|
|
236
|
+
}
|
|
237
|
+
const event = issue.latest_event?.event ?? proof?.last_event ?? null;
|
|
238
|
+
const message = issue.latest_event?.message ?? proof?.last_message ?? null;
|
|
239
|
+
if (!event && !message) {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
return [
|
|
243
|
+
{
|
|
244
|
+
at: issue.latest_event?.at ?? proof?.last_event_at ?? null,
|
|
245
|
+
event,
|
|
246
|
+
message
|
|
247
|
+
}
|
|
248
|
+
];
|
|
249
|
+
}
|
|
250
|
+
function normalizeLinearActivity(recentActivity) {
|
|
251
|
+
return Array.isArray(recentActivity) ? recentActivity : [];
|
|
252
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { normalizeProviderLinearWorkflowState } from './providerLinearWorkflowStates.js';
|
|
2
|
+
export const DEFAULT_PROVIDER_MAX_CONCURRENT_AGENTS = 10;
|
|
3
|
+
export const DEFAULT_LOCAL_PROVIDER_MAX_CONCURRENT_AGENTS = 3;
|
|
4
|
+
export function resolveProviderPollDispatchLimits(featureToggles, options = {}) {
|
|
5
|
+
const agentConfig = readProviderPollAgentConfig(featureToggles);
|
|
6
|
+
const explicitMaxConcurrentAgents = readPositiveIntegerValue(agentConfig, 'max_concurrent_agents', 'maxConcurrentAgents');
|
|
7
|
+
const maxConcurrentAgentsByState = readPositiveIntegerMap(agentConfig, 'max_concurrent_agents_by_state', 'maxConcurrentAgentsByState');
|
|
8
|
+
return {
|
|
9
|
+
maxConcurrentAgents: explicitMaxConcurrentAgents ??
|
|
10
|
+
(options.localWorkerOnly === true
|
|
11
|
+
? DEFAULT_LOCAL_PROVIDER_MAX_CONCURRENT_AGENTS
|
|
12
|
+
: DEFAULT_PROVIDER_MAX_CONCURRENT_AGENTS),
|
|
13
|
+
maxConcurrentAgentsByState
|
|
14
|
+
};
|
|
15
|
+
}
|
|
16
|
+
function readProviderPollAgentConfig(featureToggles) {
|
|
17
|
+
const direct = readRecordValue(featureToggles, 'agent');
|
|
18
|
+
const nested = readRecordValue(readRecordValue(featureToggles, 'coordinator'), 'agent');
|
|
19
|
+
if (!direct && !nested) {
|
|
20
|
+
return null;
|
|
21
|
+
}
|
|
22
|
+
return {
|
|
23
|
+
...(nested ?? {}),
|
|
24
|
+
...(direct ?? {})
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
function readPositiveIntegerMap(record, ...keys) {
|
|
28
|
+
const value = readRecordValue(record, ...keys);
|
|
29
|
+
if (!value) {
|
|
30
|
+
return new Map();
|
|
31
|
+
}
|
|
32
|
+
const entries = new Map();
|
|
33
|
+
for (const [rawKey, rawValue] of Object.entries(value)) {
|
|
34
|
+
const normalizedKey = normalizeProviderLinearWorkflowState(rawKey);
|
|
35
|
+
const parsedValue = readPositiveIntegerValue({ value: rawValue }, 'value');
|
|
36
|
+
if (!normalizedKey || parsedValue === null) {
|
|
37
|
+
continue;
|
|
38
|
+
}
|
|
39
|
+
entries.set(normalizedKey, parsedValue);
|
|
40
|
+
}
|
|
41
|
+
return entries;
|
|
42
|
+
}
|
|
43
|
+
function readPositiveIntegerValue(record, ...keys) {
|
|
44
|
+
for (const key of keys) {
|
|
45
|
+
const value = record?.[key];
|
|
46
|
+
if (typeof value === 'number' && Number.isInteger(value) && value > 0) {
|
|
47
|
+
return value;
|
|
48
|
+
}
|
|
49
|
+
if (typeof value === 'string') {
|
|
50
|
+
const trimmed = value.trim();
|
|
51
|
+
if (!trimmed || !/^\d+$/.test(trimmed)) {
|
|
52
|
+
continue;
|
|
53
|
+
}
|
|
54
|
+
const parsed = Number.parseInt(trimmed, 10);
|
|
55
|
+
if (Number.isInteger(parsed) && parsed > 0) {
|
|
56
|
+
return parsed;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
function readRecordValue(record, ...keys) {
|
|
63
|
+
for (const key of keys) {
|
|
64
|
+
const value = record?.[key];
|
|
65
|
+
if (value && typeof value === 'object' && !Array.isArray(value)) {
|
|
66
|
+
return value;
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
return null;
|
|
70
|
+
}
|