@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.
Files changed (311) hide show
  1. package/.agents/plugins/marketplace.json +20 -0
  2. package/README.md +46 -317
  3. package/bin/codex-orchestrator.js +161 -0
  4. package/codex.orchestrator.json +149 -13
  5. package/dist/bin/codex-orchestrator.js +797 -1154
  6. package/dist/orchestrator/src/cli/adapters/CommandBuilder.js +50 -0
  7. package/dist/orchestrator/src/cli/adapters/CommandPlanner.js +22 -4
  8. package/dist/orchestrator/src/cli/adapters/CommandReviewer.js +3 -3
  9. package/dist/orchestrator/src/cli/adapters/CommandTester.js +2 -2
  10. package/dist/orchestrator/src/cli/adapters/cloudFailureDiagnostics.js +295 -11
  11. package/dist/orchestrator/src/cli/coStatusAttachCliShell.js +402 -0
  12. package/dist/orchestrator/src/cli/coStatusCliShell.js +451 -0
  13. package/dist/orchestrator/src/cli/coStatusOperatorAutopilotCliShell.js +120 -0
  14. package/dist/orchestrator/src/cli/codexCliShell.js +119 -0
  15. package/dist/orchestrator/src/cli/codexDefaultsSetup.js +265 -36
  16. package/dist/orchestrator/src/cli/config/delegationConfig.js +317 -5
  17. package/dist/orchestrator/src/cli/config/repoConfigPolicy.js +2 -3
  18. package/dist/orchestrator/src/cli/config/userConfig.js +28 -13
  19. package/dist/orchestrator/src/cli/control/authenticatedControlRouteGate.js +69 -0
  20. package/dist/orchestrator/src/cli/control/authenticatedRouteComposition.js +267 -0
  21. package/dist/orchestrator/src/cli/control/authenticatedRouteController.js +5 -0
  22. package/dist/orchestrator/src/cli/control/authenticatedRouteDispatcher.js +41 -0
  23. package/dist/orchestrator/src/cli/control/compatibilityIssuePresenter.js +1035 -0
  24. package/dist/orchestrator/src/cli/control/confirmationApproveController.js +62 -0
  25. package/dist/orchestrator/src/cli/control/confirmationCreateController.js +69 -0
  26. package/dist/orchestrator/src/cli/control/confirmationIssueConsumeController.js +43 -0
  27. package/dist/orchestrator/src/cli/control/confirmationListController.js +22 -0
  28. package/dist/orchestrator/src/cli/control/confirmationValidateController.js +58 -0
  29. package/dist/orchestrator/src/cli/control/confirmations.js +25 -3
  30. package/dist/orchestrator/src/cli/control/controlActionCancelConfirmation.js +65 -0
  31. package/dist/orchestrator/src/cli/control/controlActionController.js +77 -0
  32. package/dist/orchestrator/src/cli/control/controlActionControllerSequencing.js +161 -0
  33. package/dist/orchestrator/src/cli/control/controlActionExecution.js +142 -0
  34. package/dist/orchestrator/src/cli/control/controlActionFinalization.js +43 -0
  35. package/dist/orchestrator/src/cli/control/controlActionOutcome.js +60 -0
  36. package/dist/orchestrator/src/cli/control/controlActionPreflight.js +476 -0
  37. package/dist/orchestrator/src/cli/control/controlAuthenticatedRouteHandoff.js +57 -0
  38. package/dist/orchestrator/src/cli/control/controlBootstrapAssembly.js +39 -0
  39. package/dist/orchestrator/src/cli/control/controlBootstrapMetadataPersistence.js +16 -0
  40. package/dist/orchestrator/src/cli/control/controlEventTransport.js +49 -0
  41. package/dist/orchestrator/src/cli/control/controlExpiryLifecycle.js +102 -0
  42. package/dist/orchestrator/src/cli/control/controlHostOwnership.js +480 -0
  43. package/dist/orchestrator/src/cli/control/controlHostSupervision.js +630 -0
  44. package/dist/orchestrator/src/cli/control/controlOversightFacade.js +8 -0
  45. package/dist/orchestrator/src/cli/control/controlOversightReadContract.js +1 -0
  46. package/dist/orchestrator/src/cli/control/controlOversightReadService.js +16 -0
  47. package/dist/orchestrator/src/cli/control/controlOversightUpdateContract.js +1 -0
  48. package/dist/orchestrator/src/cli/control/controlPersistenceFiles.js +6 -0
  49. package/dist/orchestrator/src/cli/control/controlQuestionChildResolution.js +18 -0
  50. package/dist/orchestrator/src/cli/control/controlRequestContext.js +42 -0
  51. package/dist/orchestrator/src/cli/control/controlRequestController.js +9 -0
  52. package/dist/orchestrator/src/cli/control/controlRequestPredispatch.js +17 -0
  53. package/dist/orchestrator/src/cli/control/controlRequestRouteDispatch.js +44 -0
  54. package/dist/orchestrator/src/cli/control/controlRuntime.js +1003 -0
  55. package/dist/orchestrator/src/cli/control/controlServer.js +23 -1456
  56. package/dist/orchestrator/src/cli/control/controlServerAuditAndErrorHelpers.js +115 -0
  57. package/dist/orchestrator/src/cli/control/controlServerAuthenticatedRouteBranch.js +29 -0
  58. package/dist/orchestrator/src/cli/control/controlServerBootstrapLifecycle.js +30 -0
  59. package/dist/orchestrator/src/cli/control/controlServerBootstrapStartSequence.js +21 -0
  60. package/dist/orchestrator/src/cli/control/controlServerOwnedRuntimeLifecycle.js +67 -0
  61. package/dist/orchestrator/src/cli/control/controlServerPublicLifecycle.js +756 -0
  62. package/dist/orchestrator/src/cli/control/controlServerPublicRouteHelpers.js +86 -0
  63. package/dist/orchestrator/src/cli/control/controlServerReadyInstanceLifecycle.js +25 -0
  64. package/dist/orchestrator/src/cli/control/controlServerReadyInstanceStartup.js +18 -0
  65. package/dist/orchestrator/src/cli/control/controlServerRequestBodyHelpers.js +37 -0
  66. package/dist/orchestrator/src/cli/control/controlServerRequestShell.js +40 -0
  67. package/dist/orchestrator/src/cli/control/controlServerRequestShellBinding.js +17 -0
  68. package/dist/orchestrator/src/cli/control/controlServerSeedLoading.js +27 -0
  69. package/dist/orchestrator/src/cli/control/controlServerSeededRuntimeAssembly.js +186 -0
  70. package/dist/orchestrator/src/cli/control/controlServerStartupInputPreparation.js +31 -0
  71. package/dist/orchestrator/src/cli/control/controlServerStartupSequence.js +49 -0
  72. package/dist/orchestrator/src/cli/control/controlState.js +233 -2
  73. package/dist/orchestrator/src/cli/control/controlStatusDashboard.js +1904 -0
  74. package/dist/orchestrator/src/cli/control/controlTelegramBridgeBootstrapLifecycle.js +22 -0
  75. package/dist/orchestrator/src/cli/control/controlTelegramBridgeLifecycle.js +67 -0
  76. package/dist/orchestrator/src/cli/control/controlTelegramBridgeOversightFacadeFactory.js +8 -0
  77. package/dist/orchestrator/src/cli/control/controlTelegramCommandController.js +49 -0
  78. package/dist/orchestrator/src/cli/control/controlTelegramDispatchRead.js +40 -0
  79. package/dist/orchestrator/src/cli/control/controlTelegramPollingController.js +89 -0
  80. package/dist/orchestrator/src/cli/control/controlTelegramProjectionNotificationController.js +29 -0
  81. package/dist/orchestrator/src/cli/control/controlTelegramPushState.js +63 -0
  82. package/dist/orchestrator/src/cli/control/controlTelegramQuestionRead.js +13 -0
  83. package/dist/orchestrator/src/cli/control/controlTelegramReadController.js +216 -0
  84. package/dist/orchestrator/src/cli/control/controlTelegramUpdateHandler.js +63 -0
  85. package/dist/orchestrator/src/cli/control/controlWatcher.js +73 -5
  86. package/dist/orchestrator/src/cli/control/delegationRegisterController.js +35 -0
  87. package/dist/orchestrator/src/cli/control/dynamicToolBridgePolicy.js +139 -0
  88. package/dist/orchestrator/src/cli/control/eventsSseController.js +12 -0
  89. package/dist/orchestrator/src/cli/control/linearBudgetState.js +1789 -0
  90. package/dist/orchestrator/src/cli/control/linearDispatchSource.js +1137 -0
  91. package/dist/orchestrator/src/cli/control/linearGraphqlClient.js +150 -0
  92. package/dist/orchestrator/src/cli/control/linearRateLimit.js +102 -0
  93. package/dist/orchestrator/src/cli/control/linearWebhookController.js +499 -0
  94. package/dist/orchestrator/src/cli/control/liveLinearAdvisoryRuntime.js +70 -0
  95. package/dist/orchestrator/src/cli/control/observabilityApiController.js +173 -0
  96. package/dist/orchestrator/src/cli/control/observabilityReadModel.js +500 -0
  97. package/dist/orchestrator/src/cli/control/observabilitySurface.js +284 -0
  98. package/dist/orchestrator/src/cli/control/observabilityUpdateNotifier.js +22 -0
  99. package/dist/orchestrator/src/cli/control/operatorDashboardPresenter.js +252 -0
  100. package/dist/orchestrator/src/cli/control/providerAgentCapacity.js +70 -0
  101. package/dist/orchestrator/src/cli/control/providerControlHostFreshnessGauge.js +1068 -0
  102. package/dist/orchestrator/src/cli/control/providerIntakeState.js +473 -0
  103. package/dist/orchestrator/src/cli/control/providerIssueHandoff.js +6811 -0
  104. package/dist/orchestrator/src/cli/control/providerIssueObservability.js +1348 -0
  105. package/dist/orchestrator/src/cli/control/providerIssueRetryQueue.js +84 -0
  106. package/dist/orchestrator/src/cli/control/providerLinearRuntimeProof.js +588 -0
  107. package/dist/orchestrator/src/cli/control/providerLinearScreenshotProof.js +473 -0
  108. package/dist/orchestrator/src/cli/control/providerLinearWorkerTruth.js +383 -0
  109. package/dist/orchestrator/src/cli/control/providerLinearWorkflowAudit.js +254 -0
  110. package/dist/orchestrator/src/cli/control/providerLinearWorkflowFacade.js +5573 -0
  111. package/dist/orchestrator/src/cli/control/providerLinearWorkflowStates.js +115 -0
  112. package/dist/orchestrator/src/cli/control/providerMergeCloseout.js +1868 -0
  113. package/dist/orchestrator/src/cli/control/providerOperatorAutopilot.js +1580 -0
  114. package/dist/orchestrator/src/cli/control/providerOperatorAutopilotLifecycle.js +154 -0
  115. package/dist/orchestrator/src/cli/control/providerOperatorAutopilotLocalRolloutExecution.js +1006 -0
  116. package/dist/orchestrator/src/cli/control/providerPollingHealth.js +435 -0
  117. package/dist/orchestrator/src/cli/control/providerTerminalCleanup.js +516 -0
  118. package/dist/orchestrator/src/cli/control/providerWorkerHosts.js +191 -0
  119. package/dist/orchestrator/src/cli/control/providerWorkflowConfigStore.js +515 -0
  120. package/dist/orchestrator/src/cli/control/questionChildResolutionAdapter.js +361 -0
  121. package/dist/orchestrator/src/cli/control/questionQueueController.js +181 -0
  122. package/dist/orchestrator/src/cli/control/questionReadRetryDeduplication.js +9 -0
  123. package/dist/orchestrator/src/cli/control/questionReadSequence.js +10 -0
  124. package/dist/orchestrator/src/cli/control/securityViolationController.js +27 -0
  125. package/dist/orchestrator/src/cli/control/selectedRunProjection.js +1885 -0
  126. package/dist/orchestrator/src/cli/control/telegramOversightApiClient.js +48 -0
  127. package/dist/orchestrator/src/cli/control/telegramOversightBridge.js +180 -0
  128. package/dist/orchestrator/src/cli/control/telegramOversightBridgeProjectionDeliveryQueue.js +25 -0
  129. package/dist/orchestrator/src/cli/control/telegramOversightBridgeRuntimeLifecycle.js +45 -0
  130. package/dist/orchestrator/src/cli/control/telegramOversightBridgeStateStore.js +77 -0
  131. package/dist/orchestrator/src/cli/control/telegramOversightControlActionApiClient.js +45 -0
  132. package/dist/orchestrator/src/cli/control/trackerDispatchPilot.js +439 -0
  133. package/dist/orchestrator/src/cli/control/uiDataController.js +34 -0
  134. package/dist/orchestrator/src/cli/control/uiSessionController.js +100 -0
  135. package/dist/orchestrator/src/cli/controlHostCliShell.js +860 -0
  136. package/dist/orchestrator/src/cli/controlHostFreshnessGaugeCliShell.js +129 -0
  137. package/dist/orchestrator/src/cli/controlHostSupervisionCliShell.js +2127 -0
  138. package/dist/orchestrator/src/cli/delegationCliShell.js +62 -0
  139. package/dist/orchestrator/src/cli/delegationServer.js +567 -678
  140. package/dist/orchestrator/src/cli/delegationServerCliShell.js +52 -0
  141. package/dist/orchestrator/src/cli/delegationServerQuestionFlowShell.js +228 -0
  142. package/dist/orchestrator/src/cli/delegationServerToolDispatchShell.js +411 -0
  143. package/dist/orchestrator/src/cli/delegationServerTransport.js +274 -0
  144. package/dist/orchestrator/src/cli/delegationSetup.js +51 -171
  145. package/dist/orchestrator/src/cli/devtoolsCliShell.js +34 -0
  146. package/dist/orchestrator/src/cli/doctor.js +678 -164
  147. package/dist/orchestrator/src/cli/doctorCliRequestShell.js +72 -0
  148. package/dist/orchestrator/src/cli/doctorCliShell.js +138 -0
  149. package/dist/orchestrator/src/cli/doctorUsage.js +119 -15
  150. package/dist/orchestrator/src/cli/exec/experience.js +16 -2
  151. package/dist/orchestrator/src/cli/exec/summary.js +3 -0
  152. package/dist/orchestrator/src/cli/execCliShell.js +51 -0
  153. package/dist/orchestrator/src/cli/flowCliRequestShell.js +44 -0
  154. package/dist/orchestrator/src/cli/flowCliShell.js +239 -0
  155. package/dist/orchestrator/src/cli/frontendTestCliRequestShell.js +80 -0
  156. package/dist/orchestrator/src/cli/frontendTestCliShell.js +41 -0
  157. package/dist/orchestrator/src/cli/init.js +95 -1
  158. package/dist/orchestrator/src/cli/initCliShell.js +50 -0
  159. package/dist/orchestrator/src/cli/linearCliShell.js +1200 -0
  160. package/dist/orchestrator/src/cli/mcpEnableCliShell.js +132 -0
  161. package/dist/orchestrator/src/cli/metrics/metricsAggregator.js +3 -2
  162. package/dist/orchestrator/src/cli/metrics/metricsRecorder.js +56 -0
  163. package/dist/orchestrator/src/cli/orchestrator.js +66 -1376
  164. package/dist/orchestrator/src/cli/planCliShell.js +19 -0
  165. package/dist/orchestrator/src/cli/prCliShell.js +41 -0
  166. package/dist/orchestrator/src/cli/providerLinearChildLanePhaseContract.js +204 -0
  167. package/dist/orchestrator/src/cli/providerLinearChildLaneRunner.js +1835 -0
  168. package/dist/orchestrator/src/cli/providerLinearChildLaneShell.js +2420 -0
  169. package/dist/orchestrator/src/cli/providerLinearChildStreamShell.js +385 -0
  170. package/dist/orchestrator/src/cli/providerLinearWorkerRunner.js +6834 -0
  171. package/dist/orchestrator/src/cli/resumeCliShell.js +14 -0
  172. package/dist/orchestrator/src/cli/reviewCliLaunchShell.js +72 -0
  173. package/dist/orchestrator/src/cli/rlm/alignment.js +3 -3
  174. package/dist/orchestrator/src/cli/rlm/context.js +94 -7
  175. package/dist/orchestrator/src/cli/rlm/rlmCodexRuntimeShell.js +546 -0
  176. package/dist/orchestrator/src/cli/rlm/symbolic.js +4 -2
  177. package/dist/orchestrator/src/cli/rlmCliRequestShell.js +42 -0
  178. package/dist/orchestrator/src/cli/rlmCompletionCliShell.js +46 -0
  179. package/dist/orchestrator/src/cli/rlmLaunchCliShell.js +51 -0
  180. package/dist/orchestrator/src/cli/rlmRunner.js +83 -523
  181. package/dist/orchestrator/src/cli/run/blockMemory.js +500 -0
  182. package/dist/orchestrator/src/cli/run/manifest.js +410 -73
  183. package/dist/orchestrator/src/cli/run/manifestPersister.js +45 -14
  184. package/dist/orchestrator/src/cli/run/runMemoryController.js +216 -0
  185. package/dist/orchestrator/src/cli/run/source0.js +690 -0
  186. package/dist/orchestrator/src/cli/run/workspacePath.js +101 -0
  187. package/dist/orchestrator/src/cli/runtime/mode.js +2 -1
  188. package/dist/orchestrator/src/cli/runtime/provider.js +39 -2
  189. package/dist/orchestrator/src/cli/selfCheckCliShell.js +12 -0
  190. package/dist/orchestrator/src/cli/services/commandRunner.js +698 -18
  191. package/dist/orchestrator/src/cli/services/execRuntime.js +66 -1
  192. package/dist/orchestrator/src/cli/services/orchestratorAutoScoutEvidenceRecorder.js +71 -0
  193. package/dist/orchestrator/src/cli/services/orchestratorCloudBranchResolution.js +8 -0
  194. package/dist/orchestrator/src/cli/services/orchestratorCloudEnvironmentResolution.js +22 -0
  195. package/dist/orchestrator/src/cli/services/orchestratorCloudExecutionLifecycleShell.js +39 -0
  196. package/dist/orchestrator/src/cli/services/orchestratorCloudPromptBuilder.js +37 -0
  197. package/dist/orchestrator/src/cli/services/orchestratorCloudRouteFallbackContract.js +45 -0
  198. package/dist/orchestrator/src/cli/services/orchestratorCloudRouteShell.js +36 -0
  199. package/dist/orchestrator/src/cli/services/orchestratorCloudTargetExecutor.js +277 -0
  200. package/dist/orchestrator/src/cli/services/orchestratorControlPlaneLifecycle.js +98 -0
  201. package/dist/orchestrator/src/cli/services/orchestratorControlPlaneLifecycleShell.js +54 -0
  202. package/dist/orchestrator/src/cli/services/orchestratorExecutionLifecycle.js +112 -0
  203. package/dist/orchestrator/src/cli/services/orchestratorExecutionModePolicy.js +27 -0
  204. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteAdapterShell.js +59 -0
  205. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteDecisionShell.js +57 -0
  206. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouteState.js +21 -0
  207. package/dist/orchestrator/src/cli/services/orchestratorExecutionRouter.js +2 -0
  208. package/dist/orchestrator/src/cli/services/orchestratorLocalPipelineExecutor.js +149 -0
  209. package/dist/orchestrator/src/cli/services/orchestratorLocalRouteShell.js +63 -0
  210. package/dist/orchestrator/src/cli/services/orchestratorPlanShell.js +54 -0
  211. package/dist/orchestrator/src/cli/services/orchestratorPlanTargetTracker.js +16 -0
  212. package/dist/orchestrator/src/cli/services/orchestratorResumePreparationShell.js +84 -0
  213. package/dist/orchestrator/src/cli/services/orchestratorResumeTokenValidation.js +15 -0
  214. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleCompletion.js +31 -0
  215. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleExecutionRegistration.js +37 -0
  216. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleOrchestrationShell.js +83 -0
  217. package/dist/orchestrator/src/cli/services/orchestratorRunLifecycleTaskManagerShell.js +37 -0
  218. package/dist/orchestrator/src/cli/services/orchestratorRuntimeManifestMutation.js +20 -0
  219. package/dist/orchestrator/src/cli/services/orchestratorStartPreparationShell.js +56 -0
  220. package/dist/orchestrator/src/cli/services/orchestratorStatusShell.js +70 -0
  221. package/dist/orchestrator/src/cli/services/pipelineResolver.js +7 -3
  222. package/dist/orchestrator/src/cli/services/plannerMemory.js +119 -0
  223. package/dist/orchestrator/src/cli/services/runPreparation.js +7 -3
  224. package/dist/orchestrator/src/cli/services/runSummaryWriter.js +9 -0
  225. package/dist/orchestrator/src/cli/setupBootstrapShell.js +114 -0
  226. package/dist/orchestrator/src/cli/setupCliShell.js +51 -0
  227. package/dist/orchestrator/src/cli/skillsCliShell.js +56 -0
  228. package/dist/orchestrator/src/cli/startCliRequestShell.js +53 -0
  229. package/dist/orchestrator/src/cli/startCliShell.js +68 -0
  230. package/dist/orchestrator/src/cli/statusCliShell.js +22 -0
  231. package/dist/orchestrator/src/cli/utils/authProvenanceFingerprint.js +27 -0
  232. package/dist/orchestrator/src/cli/utils/cloudPreflight.js +285 -7
  233. package/dist/orchestrator/src/cli/utils/codexFeatures.js +60 -0
  234. package/dist/orchestrator/src/cli/utils/delegationConfigParser.js +250 -0
  235. package/dist/orchestrator/src/cli/utils/delegationMcpHealth.js +1382 -0
  236. package/dist/orchestrator/src/cli/utils/devtools.js +2 -54
  237. package/dist/orchestrator/src/cli/utils/mcpServerEntry.js +53 -0
  238. package/dist/orchestrator/src/cli/utils/packageProgramResolver.js +151 -0
  239. package/dist/orchestrator/src/cli/utils/providerOverrideEnv.js +71 -0
  240. package/dist/orchestrator/src/cli/utils/trailingJsonObject.js +59 -0
  241. package/dist/orchestrator/src/learning/crystalizer.js +2 -2
  242. package/dist/orchestrator/src/manager.js +74 -4
  243. package/dist/orchestrator/src/persistence/ExperienceStore.js +233 -49
  244. package/dist/orchestrator/src/persistence/TaskStateStore.js +6 -6
  245. package/dist/orchestrator/src/persistence/lockFile.js +70 -4
  246. package/dist/orchestrator/src/persistence/sanitizeIdentifier.js +39 -0
  247. package/dist/orchestrator/src/sync/createCloudSyncWorker.js +3 -2
  248. package/dist/orchestrator/src/utils/atomicWrite.js +17 -2
  249. package/dist/packages/orchestrator/src/exec/unified-exec.js +99 -6
  250. package/dist/packages/orchestrator/src/instructions/promptPacks.js +150 -19
  251. package/dist/packages/sdk-node/src/orchestrator.js +137 -13
  252. package/dist/packages/shared/config/designConfig.js +8 -1
  253. package/dist/packages/shared/streams/stdio.js +1 -1
  254. package/dist/scripts/design/pipeline/permit.js +15 -0
  255. package/dist/scripts/lib/docs-catalog.js +399 -0
  256. package/dist/scripts/lib/docs-helpers.js +87 -5
  257. package/dist/scripts/lib/pr-watch-merge.js +1088 -80
  258. package/dist/scripts/lib/provider-run-contract.js +26 -0
  259. package/dist/scripts/lib/review-command-intent-classification.js +532 -0
  260. package/dist/scripts/lib/review-command-probe-classification.js +385 -0
  261. package/dist/scripts/lib/review-execution-boundary-preflight.js +279 -0
  262. package/dist/scripts/lib/review-execution-runtime.js +753 -0
  263. package/dist/scripts/lib/review-execution-state.js +1144 -0
  264. package/dist/scripts/lib/review-execution-telemetry.js +215 -0
  265. package/dist/scripts/lib/review-inspection-target-parsing.js +78 -0
  266. package/dist/scripts/lib/review-launch-attempt.js +601 -0
  267. package/dist/scripts/lib/review-meta-surface-boundary-analysis.js +300 -0
  268. package/dist/scripts/lib/review-meta-surface-normalization.js +746 -0
  269. package/dist/scripts/lib/review-non-interactive-handoff.js +61 -0
  270. package/dist/scripts/lib/review-prompt-context.js +376 -0
  271. package/dist/scripts/lib/review-scope-advisory.js +286 -0
  272. package/dist/scripts/lib/review-scope-paths.js +123 -0
  273. package/dist/scripts/lib/review-shell-command-parser.js +389 -0
  274. package/dist/scripts/lib/review-shell-env-interpreter.js +340 -0
  275. package/dist/scripts/lib/run-manifests.js +192 -36
  276. package/dist/scripts/lib/spark-policy-classifier.js +593 -0
  277. package/dist/scripts/run-review.js +507 -1777
  278. package/docs/README.md +43 -20
  279. package/docs/book/README.md +19 -0
  280. package/docs/book/codex-cli-0124-adoption.md +68 -0
  281. package/docs/book/local-hook-impact.md +73 -0
  282. package/docs/book/operations.md +60 -0
  283. package/docs/book/public-posture.md +34 -0
  284. package/docs/book/setup.md +91 -0
  285. package/docs/book/skills.md +11 -0
  286. package/docs/guides/codex-version-policy.md +104 -0
  287. package/docs/public/downstream-setup.md +113 -0
  288. package/docs/public/provider-onboarding.md +173 -0
  289. package/package.json +23 -10
  290. package/plugins/codex-orchestrator/.codex-plugin/plugin.json +30 -0
  291. package/plugins/codex-orchestrator/.mcp.json +13 -0
  292. package/plugins/codex-orchestrator/launcher.mjs +361 -0
  293. package/schemas/manifest.json +411 -0
  294. package/skills/README.md +26 -0
  295. package/skills/collab-subagents-first/SKILL.md +1 -1
  296. package/skills/delegation-usage/DELEGATION_GUIDE.md +30 -12
  297. package/skills/delegation-usage/SKILL.md +25 -14
  298. package/skills/land/SKILL.md +77 -0
  299. package/skills/linear/SKILL.md +255 -0
  300. package/skills/release/SKILL.md +47 -3
  301. package/skills/standalone-review/SKILL.md +6 -1
  302. package/templates/README.md +4 -2
  303. package/templates/codex/.codex/agents/awaiter-high.toml +2 -2
  304. package/templates/codex/.codex/agents/worker-complex.toml +1 -1
  305. package/templates/codex/.codex/config.toml +3 -4
  306. package/templates/codex/.codex/providers/README.md +13 -0
  307. package/templates/codex/.codex/providers/control.example.json +18 -0
  308. package/templates/codex/.codex/providers/provider.env.example +15 -0
  309. package/templates/codex/AGENTS.md +15 -8
  310. package/templates/codex/mcp-client.json +5 -1
  311. package/docs/assets/setup.gif +0 -0
@@ -0,0 +1,48 @@
1
+ const TELEGRAM_API_ROOT = 'https://api.telegram.org';
2
+ export function createTelegramOversightApiClient(options) {
3
+ const telegramUrl = (method) => `${TELEGRAM_API_ROOT}/bot${options.botToken}/${method}`;
4
+ const callTelegram = async (method) => {
5
+ const response = await options.fetchImpl(telegramUrl(method));
6
+ const payload = (await response.json());
7
+ if (!response.ok || !payload.ok || payload.result === undefined) {
8
+ throw new Error(payload.description ?? `telegram_${method}_failed_${response.status}`);
9
+ }
10
+ return payload.result;
11
+ };
12
+ return {
13
+ getMe() {
14
+ return callTelegram('getMe');
15
+ },
16
+ async getUpdates(input) {
17
+ const query = new URLSearchParams({
18
+ offset: String(input.offset),
19
+ timeout: String(input.timeoutSeconds),
20
+ allowed_updates: JSON.stringify(['message'])
21
+ });
22
+ const response = await options.fetchImpl(telegramUrl(`getUpdates?${query.toString()}`), {
23
+ signal: input.signal
24
+ });
25
+ const payload = (await response.json());
26
+ if (!response.ok || !payload.ok) {
27
+ throw new Error(payload.description ?? `telegram_get_updates_failed_${response.status}`);
28
+ }
29
+ return Array.isArray(payload.result) ? payload.result : [];
30
+ },
31
+ async sendMessage(chatId, text) {
32
+ const response = await options.fetchImpl(telegramUrl('sendMessage'), {
33
+ method: 'POST',
34
+ headers: {
35
+ 'Content-Type': 'application/json'
36
+ },
37
+ body: JSON.stringify({
38
+ chat_id: chatId,
39
+ text
40
+ })
41
+ });
42
+ const payload = (await response.json());
43
+ if (!response.ok || !payload.ok) {
44
+ throw new Error(payload.description ?? `telegram_send_message_failed_${response.status}`);
45
+ }
46
+ }
47
+ };
48
+ }
@@ -0,0 +1,180 @@
1
+ import { logger } from '../../logger.js';
2
+ import { createControlTelegramCommandController } from './controlTelegramCommandController.js';
3
+ import { createControlTelegramReadController } from './controlTelegramReadController.js';
4
+ import { createControlTelegramProjectionNotificationController } from './controlTelegramProjectionNotificationController.js';
5
+ import { createControlTelegramPollingController } from './controlTelegramPollingController.js';
6
+ import { createControlTelegramUpdateHandler } from './controlTelegramUpdateHandler.js';
7
+ import { createDefaultTelegramOversightState, } from './controlTelegramPushState.js';
8
+ import { createTelegramOversightApiClient } from './telegramOversightApiClient.js';
9
+ import { createTelegramOversightControlActionApiClient } from './telegramOversightControlActionApiClient.js';
10
+ import { createTelegramOversightBridgeRuntimeLifecycle } from './telegramOversightBridgeRuntimeLifecycle.js';
11
+ import { createTelegramOversightBridgeProjectionDeliveryQueue } from './telegramOversightBridgeProjectionDeliveryQueue.js';
12
+ import { advanceTelegramOversightBridgeStateNextUpdateId, applyTelegramOversightBridgeStatePatch, createTelegramOversightBridgeStateStore } from './telegramOversightBridgeStateStore.js';
13
+ const DEFAULT_POLL_INTERVAL_MS = 1_000;
14
+ const DEFAULT_PUSH_COOLDOWN_MS = 30_000;
15
+ export async function startTelegramOversightBridge(options) {
16
+ const config = resolveTelegramOversightBridgeConfig(options.env ?? process.env);
17
+ if (!config) {
18
+ return null;
19
+ }
20
+ const bridge = new TelegramOversightBridgeRuntime({
21
+ config,
22
+ runDir: options.runDir,
23
+ readAdapter: options.readAdapter,
24
+ baseUrl: options.baseUrl,
25
+ controlToken: options.controlToken,
26
+ fetchImpl: options.fetchImpl ?? fetch
27
+ });
28
+ await bridge.start();
29
+ return bridge;
30
+ }
31
+ class TelegramOversightBridgeRuntime {
32
+ config;
33
+ readController;
34
+ stateStore;
35
+ telegramClient;
36
+ commandController;
37
+ updateHandler;
38
+ pollingController;
39
+ projectionNotificationController;
40
+ runtimeLifecycle;
41
+ projectionDeliveryQueue;
42
+ state = createDefaultTelegramOversightState();
43
+ constructor(options) {
44
+ this.config = options.config;
45
+ this.readController = createControlTelegramReadController({
46
+ readAdapter: options.readAdapter,
47
+ mutationsEnabled: options.config.mutationsEnabled
48
+ });
49
+ this.stateStore = createTelegramOversightBridgeStateStore(options.runDir);
50
+ this.telegramClient = createTelegramOversightApiClient({
51
+ botToken: options.config.botToken,
52
+ fetchImpl: options.fetchImpl
53
+ });
54
+ const controlActionClient = createTelegramOversightControlActionApiClient({
55
+ baseUrl: options.baseUrl,
56
+ controlToken: options.controlToken,
57
+ fetchImpl: options.fetchImpl
58
+ });
59
+ this.commandController = createControlTelegramCommandController({
60
+ mutationsEnabled: options.config.mutationsEnabled,
61
+ controlActionClient
62
+ });
63
+ this.updateHandler = createControlTelegramUpdateHandler({
64
+ allowedChatIds: options.config.allowedChatIds,
65
+ readController: this.readController,
66
+ commandController: this.commandController,
67
+ sendMessage: (chatId, text) => this.telegramClient.sendMessage(chatId, text)
68
+ });
69
+ this.pollingController = createControlTelegramPollingController({
70
+ pollIntervalMs: options.config.pollIntervalMs,
71
+ telegramClient: this.telegramClient,
72
+ updateHandler: this.updateHandler
73
+ });
74
+ this.projectionNotificationController = createControlTelegramProjectionNotificationController({
75
+ allowedChatIds: options.config.allowedChatIds,
76
+ pushCooldownMs: options.config.pushCooldownMs,
77
+ renderProjectionDeltaMessage: () => this.readController.renderProjectionDeltaMessage(),
78
+ sendMessage: (chatId, text) => this.telegramClient.sendMessage(chatId, text)
79
+ });
80
+ let readRuntimeClosed = null;
81
+ this.projectionDeliveryQueue = createTelegramOversightBridgeProjectionDeliveryQueue({
82
+ pushEnabled: this.config.pushEnabled,
83
+ isClosed: () => readRuntimeClosed?.() ?? false,
84
+ readPushState: () => this.state.push,
85
+ notifyProjectionDelta: ({ pushState, eventSeq }) => this.projectionNotificationController.notifyProjectionDelta({
86
+ pushState,
87
+ eventSeq
88
+ }),
89
+ applyStatePatchAndSave: async (statePatch) => {
90
+ this.state = applyTelegramOversightBridgeStatePatch(this.state, statePatch);
91
+ await this.stateStore.saveState(this.state);
92
+ },
93
+ logDeliveryFailure: (error) => {
94
+ logger.warn(`[telegram-oversight] push notification failed: ${error?.message ?? String(error)}`);
95
+ }
96
+ });
97
+ this.runtimeLifecycle = createTelegramOversightBridgeRuntimeLifecycle({
98
+ loadState: () => this.stateStore.loadState(),
99
+ setState: (state) => {
100
+ this.state = state;
101
+ },
102
+ getBotIdentity: () => this.telegramClient.getMe(),
103
+ runPolling: (runtime) => this.pollingController.run({
104
+ isClosed: runtime.isClosed,
105
+ readNextUpdateId: () => this.state.next_update_id,
106
+ persistNextUpdateId: (nextUpdateId, observedAt) => this.persistNextUpdateId(nextUpdateId, observedAt),
107
+ readBotUsername: runtime.readBotUsername
108
+ }),
109
+ abortPolling: () => this.pollingController.abort(),
110
+ flushNotifications: async () => {
111
+ await this.projectionDeliveryQueue.flushNotifications();
112
+ },
113
+ logEnabled: (botUsername) => {
114
+ logger.info(`[telegram-oversight] enabled for ${Array.from(this.config.allowedChatIds).length} chat(s) as @${botUsername ?? 'bot'}`);
115
+ }
116
+ });
117
+ readRuntimeClosed = () => this.runtimeLifecycle.isClosed();
118
+ }
119
+ async start() {
120
+ await this.runtimeLifecycle.start();
121
+ }
122
+ async close() {
123
+ await this.runtimeLifecycle.close();
124
+ }
125
+ async notifyProjectionDelta(input = {}) {
126
+ await this.projectionDeliveryQueue.notifyProjectionDelta(input);
127
+ }
128
+ async persistNextUpdateId(nextUpdateId, observedAt) {
129
+ this.state = advanceTelegramOversightBridgeStateNextUpdateId(this.state, nextUpdateId, observedAt);
130
+ await this.stateStore.saveState(this.state);
131
+ }
132
+ }
133
+ function resolveTelegramOversightBridgeConfig(env) {
134
+ if (!parseBooleanEnv(env.CO_TELEGRAM_POLLING_ENABLED)) {
135
+ return null;
136
+ }
137
+ const botToken = env.CO_TELEGRAM_BOT_TOKEN?.trim();
138
+ if (!botToken) {
139
+ return null;
140
+ }
141
+ const allowedChatIds = parseCsvSet(env.CO_TELEGRAM_ALLOWED_CHAT_IDS);
142
+ if (allowedChatIds.size === 0) {
143
+ return null;
144
+ }
145
+ return {
146
+ botToken,
147
+ allowedChatIds,
148
+ mutationsEnabled: parseBooleanEnv(env.CO_TELEGRAM_ENABLE_MUTATIONS),
149
+ pollIntervalMs: parsePositiveIntegerEnv(env.CO_TELEGRAM_POLL_INTERVAL_MS, DEFAULT_POLL_INTERVAL_MS),
150
+ pushEnabled: parseBooleanEnv(env.CO_TELEGRAM_PUSH_ENABLED),
151
+ pushCooldownMs: parsePositiveIntegerEnv(env.CO_TELEGRAM_PUSH_INTERVAL_MS, DEFAULT_PUSH_COOLDOWN_MS)
152
+ };
153
+ }
154
+ function parseCsvSet(value) {
155
+ if (!value) {
156
+ return new Set();
157
+ }
158
+ const entries = value
159
+ .split(',')
160
+ .map((entry) => entry.trim())
161
+ .filter((entry) => entry.length > 0);
162
+ return new Set(entries);
163
+ }
164
+ function parseBooleanEnv(value) {
165
+ if (!value) {
166
+ return false;
167
+ }
168
+ const normalized = value.trim().toLowerCase();
169
+ return normalized === '1' || normalized === 'true' || normalized === 'yes' || normalized === 'on';
170
+ }
171
+ function parsePositiveIntegerEnv(value, fallback) {
172
+ if (!value) {
173
+ return fallback;
174
+ }
175
+ const parsed = Number.parseInt(value, 10);
176
+ if (!Number.isFinite(parsed) || parsed <= 0) {
177
+ return fallback;
178
+ }
179
+ return parsed;
180
+ }
@@ -0,0 +1,25 @@
1
+ export function createTelegramOversightBridgeProjectionDeliveryQueue(input) {
2
+ let notificationQueue = Promise.resolve();
3
+ return {
4
+ async notifyProjectionDelta(request = {}) {
5
+ if (!input.pushEnabled || input.isClosed()) {
6
+ return;
7
+ }
8
+ notificationQueue = notificationQueue
9
+ .then(async () => {
10
+ const result = await input.notifyProjectionDelta({
11
+ pushState: input.readPushState(),
12
+ eventSeq: request.eventSeq
13
+ });
14
+ await input.applyStatePatchAndSave(result.statePatch);
15
+ })
16
+ .catch((error) => {
17
+ input.logDeliveryFailure(error);
18
+ });
19
+ await notificationQueue;
20
+ },
21
+ async flushNotifications() {
22
+ await notificationQueue;
23
+ }
24
+ };
25
+ }
@@ -0,0 +1,45 @@
1
+ const DEFAULT_CLOSE_POLL_GRACE_MS = 1_000;
2
+ export function createTelegramOversightBridgeRuntimeLifecycle(input) {
3
+ let closed = false;
4
+ let loopPromise = null;
5
+ let botIdentity = null;
6
+ const closePollGraceMs = Math.max(0, input.closePollGraceMs ?? DEFAULT_CLOSE_POLL_GRACE_MS);
7
+ return {
8
+ async start() {
9
+ input.setState(await input.loadState());
10
+ botIdentity = await input.getBotIdentity();
11
+ input.logEnabled(botIdentity.username ?? null);
12
+ loopPromise = input.runPolling({
13
+ isClosed: () => closed,
14
+ readBotUsername: () => botIdentity?.username ?? null
15
+ });
16
+ },
17
+ async close() {
18
+ closed = true;
19
+ input.abortPolling();
20
+ if (loopPromise) {
21
+ const activeLoopPromise = loopPromise;
22
+ loopPromise = null;
23
+ await Promise.race([
24
+ activeLoopPromise.catch(() => undefined),
25
+ delay(closePollGraceMs)
26
+ ]);
27
+ }
28
+ try {
29
+ await input.flushNotifications();
30
+ }
31
+ catch {
32
+ // Ignore queued notification errors during shutdown.
33
+ }
34
+ },
35
+ isClosed() {
36
+ return closed;
37
+ },
38
+ };
39
+ }
40
+ function delay(ms) {
41
+ return new Promise((resolve) => {
42
+ const timer = setTimeout(resolve, ms);
43
+ timer.unref?.();
44
+ });
45
+ }
@@ -0,0 +1,77 @@
1
+ import { readFile } from 'node:fs/promises';
2
+ import { join } from 'node:path';
3
+ import { writeJsonAtomic } from '../utils/fs.js';
4
+ import { createDefaultTelegramOversightState } from './controlTelegramPushState.js';
5
+ const TELEGRAM_STATE_FILE = 'telegram-oversight-state.json';
6
+ export function createTelegramOversightBridgeStateStore(runDir) {
7
+ const statePath = join(runDir, TELEGRAM_STATE_FILE);
8
+ return {
9
+ loadState: async () => readTelegramOversightState(statePath),
10
+ saveState: async (state) => writeJsonAtomic(statePath, state)
11
+ };
12
+ }
13
+ export function advanceTelegramOversightBridgeStateNextUpdateId(state, nextUpdateId, observedAt) {
14
+ return {
15
+ ...state,
16
+ next_update_id: nextUpdateId,
17
+ updated_at: pickLatestTimestamp(state.updated_at, observedAt)
18
+ };
19
+ }
20
+ export function applyTelegramOversightBridgeStatePatch(state, patch) {
21
+ return {
22
+ ...state,
23
+ updated_at: pickLatestTimestamp(state.updated_at, patch.updated_at),
24
+ push: patch.push
25
+ };
26
+ }
27
+ async function readTelegramOversightState(path) {
28
+ try {
29
+ const raw = await readFile(path, 'utf8');
30
+ const parsed = JSON.parse(raw);
31
+ const parsedPush = isRecord(parsed.push) ? parsed.push : null;
32
+ const nextUpdateId = typeof parsed.next_update_id === 'number' && Number.isInteger(parsed.next_update_id) && parsed.next_update_id >= 0
33
+ ? parsed.next_update_id
34
+ : 0;
35
+ return {
36
+ next_update_id: nextUpdateId,
37
+ updated_at: typeof parsed.updated_at === 'string' && parsed.updated_at.trim().length > 0
38
+ ? parsed.updated_at
39
+ : new Date(0).toISOString(),
40
+ push: {
41
+ last_sent_projection_hash: parsedPush ? readStringValue(parsedPush, 'last_sent_projection_hash') ?? null : null,
42
+ last_sent_at: parsedPush ? readStringValue(parsedPush, 'last_sent_at') ?? null : null,
43
+ last_event_seq: parsedPush && typeof parsedPush.last_event_seq === 'number' && Number.isInteger(parsedPush.last_event_seq)
44
+ ? parsedPush.last_event_seq
45
+ : null,
46
+ pending_projection_hash: parsedPush ? readStringValue(parsedPush, 'pending_projection_hash') ?? null : null,
47
+ pending_projection_observed_at: parsedPush ? readStringValue(parsedPush, 'pending_projection_observed_at') ?? null : null
48
+ }
49
+ };
50
+ }
51
+ catch {
52
+ return createDefaultTelegramOversightState();
53
+ }
54
+ }
55
+ function pickLatestTimestamp(currentIso, candidateIso) {
56
+ const currentMs = Date.parse(currentIso);
57
+ const candidateMs = Date.parse(candidateIso);
58
+ if (!Number.isFinite(currentMs)) {
59
+ return candidateIso;
60
+ }
61
+ if (!Number.isFinite(candidateMs)) {
62
+ return currentIso;
63
+ }
64
+ return candidateMs >= currentMs ? candidateIso : currentIso;
65
+ }
66
+ function readStringValue(record, ...keys) {
67
+ for (const key of keys) {
68
+ const value = record[key];
69
+ if (typeof value === 'string' && value.trim().length > 0) {
70
+ return value.trim();
71
+ }
72
+ }
73
+ return undefined;
74
+ }
75
+ function isRecord(value) {
76
+ return typeof value === 'object' && value !== null && !Array.isArray(value);
77
+ }
@@ -0,0 +1,45 @@
1
+ export function createTelegramOversightControlActionApiClient(input) {
2
+ return {
3
+ postAction: async (body) => readControlActionResponse(await input.fetchImpl(new URL('/control/action', input.baseUrl), {
4
+ method: 'POST',
5
+ headers: {
6
+ Authorization: `Bearer ${input.controlToken}`,
7
+ 'x-csrf-token': input.controlToken,
8
+ 'Content-Type': 'application/json'
9
+ },
10
+ body: JSON.stringify(body)
11
+ }))
12
+ };
13
+ }
14
+ async function readControlActionResponse(response) {
15
+ const payload = (await response.json());
16
+ if (!response.ok) {
17
+ throw new Error(resolveErrorMessage(payload));
18
+ }
19
+ return payload;
20
+ }
21
+ function resolveErrorMessage(payload) {
22
+ if (!payload || typeof payload !== 'object') {
23
+ return 'request_failed';
24
+ }
25
+ const record = payload;
26
+ if (typeof record.error === 'string' && record.error.trim().length > 0) {
27
+ return record.error.trim();
28
+ }
29
+ const error = record.error;
30
+ if (error && typeof error === 'object' && !Array.isArray(error)) {
31
+ const errorRecord = error;
32
+ const code = typeof errorRecord.code === 'string' ? errorRecord.code : null;
33
+ const message = typeof errorRecord.message === 'string' ? errorRecord.message : null;
34
+ if (code && message) {
35
+ return `${code}: ${message}`;
36
+ }
37
+ if (code) {
38
+ return code;
39
+ }
40
+ if (message) {
41
+ return message;
42
+ }
43
+ }
44
+ return 'request_failed';
45
+ }