@a5c-ai/genty-platform 5.1.1-staging.00ceebd28cf2
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/README.md +48 -0
- package/dist/anycli/cache.d.ts +45 -0
- package/dist/anycli/cache.d.ts.map +1 -0
- package/dist/anycli/cache.js +118 -0
- package/dist/anycli/index.d.ts +10 -0
- package/dist/anycli/index.d.ts.map +1 -0
- package/dist/anycli/index.js +25 -0
- package/dist/anycli/types.d.ts +32 -0
- package/dist/anycli/types.d.ts.map +1 -0
- package/dist/anycli/types.js +9 -0
- package/dist/api/breakpoints.d.ts +93 -0
- package/dist/api/breakpoints.d.ts.map +1 -0
- package/dist/api/breakpoints.js +334 -0
- package/dist/api/effects.d.ts +14 -0
- package/dist/api/effects.d.ts.map +1 -0
- package/dist/api/effects.js +306 -0
- package/dist/api/effectsTypes.d.ts +79 -0
- package/dist/api/effectsTypes.d.ts.map +1 -0
- package/dist/api/effectsTypes.js +6 -0
- package/dist/api/eventStream.d.ts +34 -0
- package/dist/api/eventStream.d.ts.map +1 -0
- package/dist/api/eventStream.js +126 -0
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +27 -0
- package/dist/api/runs.d.ts +85 -0
- package/dist/api/runs.d.ts.map +1 -0
- package/dist/api/runs.js +247 -0
- package/dist/api/sessions.d.ts +17 -0
- package/dist/api/sessions.d.ts.map +1 -0
- package/dist/api/sessions.js +58 -0
- package/dist/api/utils.d.ts +28 -0
- package/dist/api/utils.d.ts.map +1 -0
- package/dist/api/utils.js +74 -0
- package/dist/breakpoints/analytics.d.ts +46 -0
- package/dist/breakpoints/analytics.d.ts.map +1 -0
- package/dist/breakpoints/analytics.js +64 -0
- package/dist/breakpoints/approvalChains.d.ts +68 -0
- package/dist/breakpoints/approvalChains.d.ts.map +1 -0
- package/dist/breakpoints/approvalChains.js +111 -0
- package/dist/breakpoints/delegation.d.ts +42 -0
- package/dist/breakpoints/delegation.d.ts.map +1 -0
- package/dist/breakpoints/delegation.js +199 -0
- package/dist/breakpoints/delegationTypes.d.ts +46 -0
- package/dist/breakpoints/delegationTypes.d.ts.map +1 -0
- package/dist/breakpoints/delegationTypes.js +10 -0
- package/dist/breakpoints/postures.d.ts +28 -0
- package/dist/breakpoints/postures.d.ts.map +1 -0
- package/dist/breakpoints/postures.js +100 -0
- package/dist/compression/compaction.d.ts +82 -0
- package/dist/compression/compaction.d.ts.map +1 -0
- package/dist/compression/compaction.js +310 -0
- package/dist/compression/compactionStrategy.d.ts +37 -0
- package/dist/compression/compactionStrategy.d.ts.map +1 -0
- package/dist/compression/compactionStrategy.js +52 -0
- package/dist/compression/compressionFamilies.d.ts +39 -0
- package/dist/compression/compressionFamilies.d.ts.map +1 -0
- package/dist/compression/compressionFamilies.js +123 -0
- package/dist/context/dynamic.d.ts +16 -0
- package/dist/context/dynamic.d.ts.map +1 -0
- package/dist/context/dynamic.js +55 -0
- package/dist/context/instructions.d.ts +15 -0
- package/dist/context/instructions.d.ts.map +1 -0
- package/dist/context/instructions.js +97 -0
- package/dist/cost/claudeCodeParser.d.ts +81 -0
- package/dist/cost/claudeCodeParser.d.ts.map +1 -0
- package/dist/cost/claudeCodeParser.js +232 -0
- package/dist/cost/collector.d.ts +42 -0
- package/dist/cost/collector.d.ts.map +1 -0
- package/dist/cost/collector.js +105 -0
- package/dist/cost/effectCost.d.ts +23 -0
- package/dist/cost/effectCost.d.ts.map +1 -0
- package/dist/cost/effectCost.js +26 -0
- package/dist/cost/index.d.ts +7 -0
- package/dist/cost/index.d.ts.map +1 -0
- package/dist/cost/index.js +28 -0
- package/dist/cost/journal.d.ts +40 -0
- package/dist/cost/journal.d.ts.map +1 -0
- package/dist/cost/journal.js +158 -0
- package/dist/cost/types.d.ts +172 -0
- package/dist/cost/types.d.ts.map +1 -0
- package/dist/cost/types.js +229 -0
- package/dist/daemon/automationExecutor.d.ts +16 -0
- package/dist/daemon/automationExecutor.d.ts.map +1 -0
- package/dist/daemon/automationExecutor.js +222 -0
- package/dist/daemon/config.d.ts +8 -0
- package/dist/daemon/config.d.ts.map +1 -0
- package/dist/daemon/config.js +245 -0
- package/dist/daemon/daemonLog.d.ts +13 -0
- package/dist/daemon/daemonLog.d.ts.map +1 -0
- package/dist/daemon/daemonLog.js +64 -0
- package/dist/daemon/durableQueue.d.ts +41 -0
- package/dist/daemon/durableQueue.d.ts.map +1 -0
- package/dist/daemon/durableQueue.js +183 -0
- package/dist/daemon/fileWatcher.d.ts +9 -0
- package/dist/daemon/fileWatcher.d.ts.map +1 -0
- package/dist/daemon/fileWatcher.js +144 -0
- package/dist/daemon/index.d.ts +9 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/daemon/index.js +26 -0
- package/dist/daemon/lifecycle.d.ts +12 -0
- package/dist/daemon/lifecycle.d.ts.map +1 -0
- package/dist/daemon/lifecycle.js +257 -0
- package/dist/daemon/loop.d.ts +27 -0
- package/dist/daemon/loop.d.ts.map +1 -0
- package/dist/daemon/loop.js +387 -0
- package/dist/daemon/timerScheduler.d.ts +13 -0
- package/dist/daemon/timerScheduler.d.ts.map +1 -0
- package/dist/daemon/timerScheduler.js +212 -0
- package/dist/daemon/types.d.ts +122 -0
- package/dist/daemon/types.d.ts.map +1 -0
- package/dist/daemon/types.js +25 -0
- package/dist/daemon/webhookListener.d.ts +6 -0
- package/dist/daemon/webhookListener.d.ts.map +1 -0
- package/dist/daemon/webhookListener.js +132 -0
- package/dist/extensions/discovery.d.ts +15 -0
- package/dist/extensions/discovery.d.ts.map +1 -0
- package/dist/extensions/discovery.js +119 -0
- package/dist/extensions/installer.d.ts +14 -0
- package/dist/extensions/installer.d.ts.map +1 -0
- package/dist/extensions/installer.js +100 -0
- package/dist/governance/authority.d.ts +68 -0
- package/dist/governance/authority.d.ts.map +1 -0
- package/dist/governance/authority.js +136 -0
- package/dist/governance/bridge.d.ts +17 -0
- package/dist/governance/bridge.d.ts.map +1 -0
- package/dist/governance/bridge.js +46 -0
- package/dist/governance/builtins.d.ts +25 -0
- package/dist/governance/builtins.d.ts.map +1 -0
- package/dist/governance/builtins.js +67 -0
- package/dist/governance/categories.d.ts +58 -0
- package/dist/governance/categories.d.ts.map +1 -0
- package/dist/governance/categories.js +120 -0
- package/dist/governance/decisionTrail.d.ts +60 -0
- package/dist/governance/decisionTrail.d.ts.map +1 -0
- package/dist/governance/decisionTrail.js +68 -0
- package/dist/governance/engine.d.ts +20 -0
- package/dist/governance/engine.d.ts.map +1 -0
- package/dist/governance/engine.js +124 -0
- package/dist/governance/index.d.ts +20 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +75 -0
- package/dist/governance/logging.d.ts +18 -0
- package/dist/governance/logging.d.ts.map +1 -0
- package/dist/governance/logging.js +83 -0
- package/dist/governance/mandate.d.ts +83 -0
- package/dist/governance/mandate.d.ts.map +1 -0
- package/dist/governance/mandate.js +180 -0
- package/dist/governance/permissionEvents.d.ts +51 -0
- package/dist/governance/permissionEvents.d.ts.map +1 -0
- package/dist/governance/permissionEvents.js +52 -0
- package/dist/governance/permissionPropagation.d.ts +18 -0
- package/dist/governance/permissionPropagation.d.ts.map +1 -0
- package/dist/governance/permissionPropagation.js +58 -0
- package/dist/governance/postureBridge.d.ts +17 -0
- package/dist/governance/postureBridge.d.ts.map +1 -0
- package/dist/governance/postureBridge.js +117 -0
- package/dist/governance/privacySettings.d.ts +31 -0
- package/dist/governance/privacySettings.d.ts.map +1 -0
- package/dist/governance/privacySettings.js +104 -0
- package/dist/governance/sandboxBridge.d.ts +49 -0
- package/dist/governance/sandboxBridge.d.ts.map +1 -0
- package/dist/governance/sandboxBridge.js +77 -0
- package/dist/governance/sandboxPolicy.d.ts +51 -0
- package/dist/governance/sandboxPolicy.d.ts.map +1 -0
- package/dist/governance/sandboxPolicy.js +177 -0
- package/dist/governance/types.d.ts +3 -0
- package/dist/governance/types.d.ts.map +1 -0
- package/dist/governance/types.js +5 -0
- package/dist/harness/adapters/adapterBridge.d.ts +71 -0
- package/dist/harness/adapters/adapterBridge.d.ts.map +1 -0
- package/dist/harness/adapters/adapterBridge.js +117 -0
- package/dist/harness/adapters/adapterClientFactory.d.ts +29 -0
- package/dist/harness/adapters/adapterClientFactory.d.ts.map +1 -0
- package/dist/harness/adapters/adapterClientFactory.js +90 -0
- package/dist/harness/adapters/adapterEventEmitter.d.ts +51 -0
- package/dist/harness/adapters/adapterEventEmitter.d.ts.map +1 -0
- package/dist/harness/adapters/adapterEventEmitter.js +143 -0
- package/dist/harness/adapters/adapterEventMapper.d.ts +63 -0
- package/dist/harness/adapters/adapterEventMapper.d.ts.map +1 -0
- package/dist/harness/adapters/adapterEventMapper.js +100 -0
- package/dist/harness/adapters/adapterHarnessMap.d.ts +25 -0
- package/dist/harness/adapters/adapterHarnessMap.d.ts.map +1 -0
- package/dist/harness/adapters/adapterHarnessMap.js +55 -0
- package/dist/harness/adapters/adapterStdinReader.d.ts +45 -0
- package/dist/harness/adapters/adapterStdinReader.d.ts.map +1 -0
- package/dist/harness/adapters/adapterStdinReader.js +106 -0
- package/dist/harness/adapters/adapterTypes.d.ts +122 -0
- package/dist/harness/adapters/adapterTypes.d.ts.map +1 -0
- package/dist/harness/adapters/adapterTypes.js +11 -0
- package/dist/harness/adapters/index.d.ts +17 -0
- package/dist/harness/adapters/index.d.ts.map +1 -0
- package/dist/harness/adapters/index.js +34 -0
- package/dist/harness/backgroundTracker.d.ts +64 -0
- package/dist/harness/backgroundTracker.d.ts.map +1 -0
- package/dist/harness/backgroundTracker.js +107 -0
- package/dist/harness/budgetDowngrade.d.ts +12 -0
- package/dist/harness/budgetDowngrade.d.ts.map +1 -0
- package/dist/harness/budgetDowngrade.js +71 -0
- package/dist/harness/builtInHarness.d.ts +3 -0
- package/dist/harness/builtInHarness.d.ts.map +1 -0
- package/dist/harness/builtInHarness.js +18 -0
- package/dist/harness/capabilityRouter.d.ts +76 -0
- package/dist/harness/capabilityRouter.d.ts.map +1 -0
- package/dist/harness/capabilityRouter.js +176 -0
- package/dist/harness/circuitBreaker.d.ts +51 -0
- package/dist/harness/circuitBreaker.d.ts.map +1 -0
- package/dist/harness/circuitBreaker.js +110 -0
- package/dist/harness/concurrentEffects.d.ts +39 -0
- package/dist/harness/concurrentEffects.d.ts.map +1 -0
- package/dist/harness/concurrentEffects.js +90 -0
- package/dist/harness/effectRouting.d.ts +57 -0
- package/dist/harness/effectRouting.d.ts.map +1 -0
- package/dist/harness/effectRouting.js +130 -0
- package/dist/harness/extensionToolBridge.d.ts +13 -0
- package/dist/harness/extensionToolBridge.d.ts.map +1 -0
- package/dist/harness/extensionToolBridge.js +23 -0
- package/dist/harness/fallbackChains.d.ts +42 -0
- package/dist/harness/fallbackChains.d.ts.map +1 -0
- package/dist/harness/fallbackChains.js +69 -0
- package/dist/harness/gentySessionContext.d.ts +31 -0
- package/dist/harness/gentySessionContext.d.ts.map +1 -0
- package/dist/harness/gentySessionContext.js +49 -0
- package/dist/harness/gentySessionIntegration.d.ts +16 -0
- package/dist/harness/gentySessionIntegration.d.ts.map +1 -0
- package/dist/harness/gentySessionIntegration.js +66 -0
- package/dist/harness/hostContract.d.ts +69 -0
- package/dist/harness/hostContract.d.ts.map +1 -0
- package/dist/harness/hostContract.js +169 -0
- package/dist/harness/index.d.ts +25 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +122 -0
- package/dist/harness/internal/createRun/agent-core-loop.d.ts +43 -0
- package/dist/harness/internal/createRun/agent-core-loop.d.ts.map +1 -0
- package/dist/harness/internal/createRun/agent-core-loop.js +247 -0
- package/dist/harness/internal/createRun/askUserQuestion.d.ts +11 -0
- package/dist/harness/internal/createRun/askUserQuestion.d.ts.map +1 -0
- package/dist/harness/internal/createRun/askUserQuestion.js +162 -0
- package/dist/harness/internal/createRun/index.d.ts +25 -0
- package/dist/harness/internal/createRun/index.d.ts.map +1 -0
- package/dist/harness/internal/createRun/index.js +163 -0
- package/dist/harness/internal/createRun/orchestration/constants.d.ts +7 -0
- package/dist/harness/internal/createRun/orchestration/constants.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/constants.js +17 -0
- package/dist/harness/internal/createRun/orchestration/dispatch.d.ts +23 -0
- package/dist/harness/internal/createRun/orchestration/dispatch.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/dispatch.js +135 -0
- package/dist/harness/internal/createRun/orchestration/effects.d.ts +135 -0
- package/dist/harness/internal/createRun/orchestration/effects.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/effects.js +904 -0
- package/dist/harness/internal/createRun/orchestration/effectsHelpers.d.ts +21 -0
- package/dist/harness/internal/createRun/orchestration/effectsHelpers.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/effectsHelpers.js +80 -0
- package/dist/harness/internal/createRun/orchestration/externalPhase.d.ts +3 -0
- package/dist/harness/internal/createRun/orchestration/externalPhase.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/externalPhase.js +403 -0
- package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.d.ts +16 -0
- package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.js +106 -0
- package/dist/harness/internal/createRun/orchestration/hookDecisionEffects.d.ts +32 -0
- package/dist/harness/internal/createRun/orchestration/hookDecisionEffects.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/hookDecisionEffects.js +76 -0
- package/dist/harness/internal/createRun/orchestration/index.d.ts +29 -0
- package/dist/harness/internal/createRun/orchestration/index.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/index.js +370 -0
- package/dist/harness/internal/createRun/orchestration/internalPhase.d.ts +3 -0
- package/dist/harness/internal/createRun/orchestration/internalPhase.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/internalPhase.js +656 -0
- package/dist/harness/internal/createRun/orchestration/internalTools.d.ts +27 -0
- package/dist/harness/internal/createRun/orchestration/internalTools.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/internalTools.js +264 -0
- package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.d.ts +17 -0
- package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.js +23 -0
- package/dist/harness/internal/createRun/orchestration/taskResult.d.ts +10 -0
- package/dist/harness/internal/createRun/orchestration/taskResult.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/taskResult.js +67 -0
- package/dist/harness/internal/createRun/orchestration/types.d.ts +48 -0
- package/dist/harness/internal/createRun/orchestration/types.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/types.js +2 -0
- package/dist/harness/internal/createRun/orchestration/verbose.d.ts +7 -0
- package/dist/harness/internal/createRun/orchestration/verbose.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/verbose.js +240 -0
- package/dist/harness/internal/createRun/orchestration/workerSessionEnhancer.d.ts +4 -0
- package/dist/harness/internal/createRun/orchestration/workerSessionEnhancer.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/workerSessionEnhancer.js +36 -0
- package/dist/harness/internal/createRun/output.d.ts +40 -0
- package/dist/harness/internal/createRun/output.d.ts.map +1 -0
- package/dist/harness/internal/createRun/output.js +467 -0
- package/dist/harness/internal/createRun/pi.d.ts +10 -0
- package/dist/harness/internal/createRun/pi.d.ts.map +1 -0
- package/dist/harness/internal/createRun/pi.js +35 -0
- package/dist/harness/internal/createRun/planProcess/agentOutput.d.ts +5 -0
- package/dist/harness/internal/createRun/planProcess/agentOutput.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/agentOutput.js +113 -0
- package/dist/harness/internal/createRun/planProcess/delegation.d.ts +23 -0
- package/dist/harness/internal/createRun/planProcess/delegation.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/delegation.js +176 -0
- package/dist/harness/internal/createRun/planProcess/external.d.ts +14 -0
- package/dist/harness/internal/createRun/planProcess/external.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/external.js +139 -0
- package/dist/harness/internal/createRun/planProcess/index.d.ts +12 -0
- package/dist/harness/internal/createRun/planProcess/index.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/index.js +24 -0
- package/dist/harness/internal/createRun/planProcess/paths.d.ts +7 -0
- package/dist/harness/internal/createRun/planProcess/paths.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/paths.js +98 -0
- package/dist/harness/internal/createRun/planProcess/phase.d.ts +6 -0
- package/dist/harness/internal/createRun/planProcess/phase.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/phase.js +424 -0
- package/dist/harness/internal/createRun/planProcess/phaseHelpers.d.ts +37 -0
- package/dist/harness/internal/createRun/planProcess/phaseHelpers.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/phaseHelpers.js +159 -0
- package/dist/harness/internal/createRun/planProcess/phaseTypes.d.ts +25 -0
- package/dist/harness/internal/createRun/planProcess/phaseTypes.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/phaseTypes.js +6 -0
- package/dist/harness/internal/createRun/planProcess/prompts.d.ts +22 -0
- package/dist/harness/internal/createRun/planProcess/prompts.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/prompts.js +239 -0
- package/dist/harness/internal/createRun/planProcess/recovery.d.ts +18 -0
- package/dist/harness/internal/createRun/planProcess/recovery.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/recovery.js +205 -0
- package/dist/harness/internal/createRun/planProcess/runState.d.ts +40 -0
- package/dist/harness/internal/createRun/planProcess/runState.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/runState.js +179 -0
- package/dist/harness/internal/createRun/planProcess/understandIntent.d.ts +22 -0
- package/dist/harness/internal/createRun/planProcess/understandIntent.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/understandIntent.js +65 -0
- package/dist/harness/internal/createRun/planProcess/validation.d.ts +4 -0
- package/dist/harness/internal/createRun/planProcess/validation.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/validation.js +260 -0
- package/dist/harness/internal/createRun/planProcess/validationSource.d.ts +13 -0
- package/dist/harness/internal/createRun/planProcess/validationSource.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/validationSource.js +345 -0
- package/dist/harness/internal/createRun/planProcess/validationText.d.ts +3 -0
- package/dist/harness/internal/createRun/planProcess/validationText.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/validationText.js +145 -0
- package/dist/harness/internal/createRun/prompts.d.ts +59 -0
- package/dist/harness/internal/createRun/prompts.d.ts.map +1 -0
- package/dist/harness/internal/createRun/prompts.js +427 -0
- package/dist/harness/internal/createRun/resumeState.d.ts +28 -0
- package/dist/harness/internal/createRun/resumeState.d.ts.map +1 -0
- package/dist/harness/internal/createRun/resumeState.js +133 -0
- package/dist/harness/internal/createRun/utils.d.ts +184 -0
- package/dist/harness/internal/createRun/utils.d.ts.map +1 -0
- package/dist/harness/internal/createRun/utils.js +218 -0
- package/dist/harness/internal.d.ts +13 -0
- package/dist/harness/internal.d.ts.map +1 -0
- package/dist/harness/internal.js +149 -0
- package/dist/harness/invoker/launch.d.ts +20 -0
- package/dist/harness/invoker/launch.d.ts.map +1 -0
- package/dist/harness/invoker/launch.js +23 -0
- package/dist/harness/invoker/processControl.d.ts +11 -0
- package/dist/harness/invoker/processControl.d.ts.map +1 -0
- package/dist/harness/invoker/processControl.js +50 -0
- package/dist/harness/invoker.d.ts +44 -0
- package/dist/harness/invoker.d.ts.map +1 -0
- package/dist/harness/invoker.js +341 -0
- package/dist/harness/lspIntegration.d.ts +48 -0
- package/dist/harness/lspIntegration.d.ts.map +1 -0
- package/dist/harness/lspIntegration.js +45 -0
- package/dist/harness/modeSelector.d.ts +50 -0
- package/dist/harness/modeSelector.d.ts.map +1 -0
- package/dist/harness/modeSelector.js +124 -0
- package/dist/harness/modelSelection.d.ts +37 -0
- package/dist/harness/modelSelection.d.ts.map +1 -0
- package/dist/harness/modelSelection.js +81 -0
- package/dist/harness/multiHarnessDispatch.d.ts +49 -0
- package/dist/harness/multiHarnessDispatch.d.ts.map +1 -0
- package/dist/harness/multiHarnessDispatch.js +73 -0
- package/dist/harness/oauthIntegration.d.ts +55 -0
- package/dist/harness/oauthIntegration.d.ts.map +1 -0
- package/dist/harness/oauthIntegration.js +84 -0
- package/dist/harness/operatorCommands.d.ts +38 -0
- package/dist/harness/operatorCommands.d.ts.map +1 -0
- package/dist/harness/operatorCommands.js +118 -0
- package/dist/harness/parallelFileOps.d.ts +56 -0
- package/dist/harness/parallelFileOps.d.ts.map +1 -0
- package/dist/harness/parallelFileOps.js +166 -0
- package/dist/harness/piSecureSandbox.d.ts +8 -0
- package/dist/harness/piSecureSandbox.d.ts.map +1 -0
- package/dist/harness/piSecureSandbox.js +366 -0
- package/dist/harness/piSecureSandboxTypes.d.ts +51 -0
- package/dist/harness/piSecureSandboxTypes.d.ts.map +1 -0
- package/dist/harness/piSecureSandboxTypes.js +6 -0
- package/dist/harness/piWrapper/compaction.d.ts +13 -0
- package/dist/harness/piWrapper/compaction.d.ts.map +1 -0
- package/dist/harness/piWrapper/compaction.js +38 -0
- package/dist/harness/piWrapper/instructionPrompts.d.ts +2 -0
- package/dist/harness/piWrapper/instructionPrompts.d.ts.map +1 -0
- package/dist/harness/piWrapper/instructionPrompts.js +97 -0
- package/dist/harness/piWrapper/moduleSupport.d.ts +78 -0
- package/dist/harness/piWrapper/moduleSupport.d.ts.map +1 -0
- package/dist/harness/piWrapper/moduleSupport.js +207 -0
- package/dist/harness/piWrapper.d.ts +82 -0
- package/dist/harness/piWrapper.d.ts.map +1 -0
- package/dist/harness/piWrapper.js +406 -0
- package/dist/harness/planMode.d.ts +68 -0
- package/dist/harness/planMode.d.ts.map +1 -0
- package/dist/harness/planMode.js +145 -0
- package/dist/harness/profileOrchestration.d.ts +55 -0
- package/dist/harness/profileOrchestration.d.ts.map +1 -0
- package/dist/harness/profileOrchestration.js +61 -0
- package/dist/harness/selectionPolicies.d.ts +29 -0
- package/dist/harness/selectionPolicies.d.ts.map +1 -0
- package/dist/harness/selectionPolicies.js +165 -0
- package/dist/harness/streamingParallelism.d.ts +43 -0
- package/dist/harness/streamingParallelism.d.ts.map +1 -0
- package/dist/harness/streamingParallelism.js +113 -0
- package/dist/harness/streamingRenderer.d.ts +64 -0
- package/dist/harness/streamingRenderer.d.ts.map +1 -0
- package/dist/harness/streamingRenderer.js +85 -0
- package/dist/harness/types.d.ts +278 -0
- package/dist/harness/types.d.ts.map +1 -0
- package/dist/harness/types.js +34 -0
- package/dist/harness/websocketSession.d.ts +63 -0
- package/dist/harness/websocketSession.d.ts.map +1 -0
- package/dist/harness/websocketSession.js +113 -0
- package/dist/harness/worktreeIsolation.d.ts +39 -0
- package/dist/harness/worktreeIsolation.d.ts.map +1 -0
- package/dist/harness/worktreeIsolation.js +85 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/interaction/askUserQuestion/core.d.ts +8 -0
- package/dist/interaction/askUserQuestion/core.d.ts.map +1 -0
- package/dist/interaction/askUserQuestion/core.js +112 -0
- package/dist/interaction/askUserQuestion/terminal.d.ts +15 -0
- package/dist/interaction/askUserQuestion/terminal.d.ts.map +1 -0
- package/dist/interaction/askUserQuestion/terminal.js +128 -0
- package/dist/interaction/askUserQuestion.d.ts +10 -0
- package/dist/interaction/askUserQuestion.d.ts.map +1 -0
- package/dist/interaction/askUserQuestion.js +295 -0
- package/dist/interaction/askUserQuestionTypes.d.ts +31 -0
- package/dist/interaction/askUserQuestionTypes.d.ts.map +1 -0
- package/dist/interaction/askUserQuestionTypes.js +6 -0
- package/dist/interaction/commandDiscovery.d.ts +38 -0
- package/dist/interaction/commandDiscovery.d.ts.map +1 -0
- package/dist/interaction/commandDiscovery.js +106 -0
- package/dist/interaction/index.d.ts +11 -0
- package/dist/interaction/index.d.ts.map +1 -0
- package/dist/interaction/index.js +42 -0
- package/dist/interaction/interactionRouter.d.ts +25 -0
- package/dist/interaction/interactionRouter.d.ts.map +1 -0
- package/dist/interaction/interactionRouter.js +55 -0
- package/dist/interaction/model-switch.d.ts +16 -0
- package/dist/interaction/model-switch.d.ts.map +1 -0
- package/dist/interaction/model-switch.js +41 -0
- package/dist/interaction/permissionApprovalUi.d.ts +32 -0
- package/dist/interaction/permissionApprovalUi.d.ts.map +1 -0
- package/dist/interaction/permissionApprovalUi.js +96 -0
- package/dist/interaction/steering.d.ts +17 -0
- package/dist/interaction/steering.d.ts.map +1 -0
- package/dist/interaction/steering.js +41 -0
- package/dist/interaction/typedEffectPatterns.d.ts +55 -0
- package/dist/interaction/typedEffectPatterns.d.ts.map +1 -0
- package/dist/interaction/typedEffectPatterns.js +190 -0
- package/dist/mcp/channels/allowlist.d.ts +19 -0
- package/dist/mcp/channels/allowlist.d.ts.map +1 -0
- package/dist/mcp/channels/allowlist.js +140 -0
- package/dist/mcp/channels/channelManager.d.ts +64 -0
- package/dist/mcp/channels/channelManager.d.ts.map +1 -0
- package/dist/mcp/channels/channelManager.js +137 -0
- package/dist/mcp/channels/inboundQueue.d.ts +47 -0
- package/dist/mcp/channels/inboundQueue.d.ts.map +1 -0
- package/dist/mcp/channels/inboundQueue.js +96 -0
- package/dist/mcp/channels/index.d.ts +16 -0
- package/dist/mcp/channels/index.d.ts.map +1 -0
- package/dist/mcp/channels/index.js +38 -0
- package/dist/mcp/channels/outbound.d.ts +33 -0
- package/dist/mcp/channels/outbound.d.ts.map +1 -0
- package/dist/mcp/channels/outbound.js +94 -0
- package/dist/mcp/channels/permissionRelay.d.ts +62 -0
- package/dist/mcp/channels/permissionRelay.d.ts.map +1 -0
- package/dist/mcp/channels/permissionRelay.js +159 -0
- package/dist/mcp/channels/types.d.ts +135 -0
- package/dist/mcp/channels/types.d.ts.map +1 -0
- package/dist/mcp/channels/types.js +16 -0
- package/dist/mcp/client/auth.d.ts +57 -0
- package/dist/mcp/client/auth.d.ts.map +1 -0
- package/dist/mcp/client/auth.js +99 -0
- package/dist/mcp/client/config.d.ts +28 -0
- package/dist/mcp/client/config.d.ts.map +1 -0
- package/dist/mcp/client/config.js +144 -0
- package/dist/mcp/client/executor.d.ts +30 -0
- package/dist/mcp/client/executor.d.ts.map +1 -0
- package/dist/mcp/client/executor.js +61 -0
- package/dist/mcp/client/index.d.ts +13 -0
- package/dist/mcp/client/index.d.ts.map +1 -0
- package/dist/mcp/client/index.js +30 -0
- package/dist/mcp/client/manager.d.ts +74 -0
- package/dist/mcp/client/manager.d.ts.map +1 -0
- package/dist/mcp/client/manager.js +215 -0
- package/dist/mcp/client/resourceBrowser.d.ts +52 -0
- package/dist/mcp/client/resourceBrowser.d.ts.map +1 -0
- package/dist/mcp/client/resourceBrowser.js +80 -0
- package/dist/mcp/client/toolRegistry.d.ts +113 -0
- package/dist/mcp/client/toolRegistry.d.ts.map +1 -0
- package/dist/mcp/client/toolRegistry.js +190 -0
- package/dist/mcp/client/types.d.ts +96 -0
- package/dist/mcp/client/types.d.ts.map +1 -0
- package/dist/mcp/client/types.js +15 -0
- package/dist/mcp/transport/index.d.ts +9 -0
- package/dist/mcp/transport/index.d.ts.map +1 -0
- package/dist/mcp/transport/index.js +13 -0
- package/dist/mcp/transport/session.d.ts +18 -0
- package/dist/mcp/transport/session.d.ts.map +1 -0
- package/dist/mcp/transport/session.js +78 -0
- package/dist/mcp/transport/types.d.ts +19 -0
- package/dist/mcp/transport/types.d.ts.map +1 -0
- package/dist/mcp/transport/types.js +7 -0
- package/dist/mcp/transport/websocket.d.ts +41 -0
- package/dist/mcp/transport/websocket.d.ts.map +1 -0
- package/dist/mcp/transport/websocket.js +271 -0
- package/dist/observability/alertWebhooks.d.ts +35 -0
- package/dist/observability/alertWebhooks.d.ts.map +1 -0
- package/dist/observability/alertWebhooks.js +68 -0
- package/dist/observability/analytics.d.ts +66 -0
- package/dist/observability/analytics.d.ts.map +1 -0
- package/dist/observability/analytics.js +104 -0
- package/dist/observability/auditExport.d.ts +25 -0
- package/dist/observability/auditExport.d.ts.map +1 -0
- package/dist/observability/auditExport.js +108 -0
- package/dist/observability/contextIntrospection.d.ts +40 -0
- package/dist/observability/contextIntrospection.d.ts.map +1 -0
- package/dist/observability/contextIntrospection.js +93 -0
- package/dist/observability/failureTriage.d.ts +28 -0
- package/dist/observability/failureTriage.d.ts.map +1 -0
- package/dist/observability/failureTriage.js +168 -0
- package/dist/observability/health.d.ts +19 -0
- package/dist/observability/health.d.ts.map +1 -0
- package/dist/observability/health.js +129 -0
- package/dist/observability/index.d.ts +14 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +53 -0
- package/dist/observability/progressSummarizer.d.ts +27 -0
- package/dist/observability/progressSummarizer.d.ts.map +1 -0
- package/dist/observability/progressSummarizer.js +143 -0
- package/dist/observability/promptPlan.d.ts +52 -0
- package/dist/observability/promptPlan.d.ts.map +1 -0
- package/dist/observability/promptPlan.js +101 -0
- package/dist/observability/resumeDashboard.d.ts +32 -0
- package/dist/observability/resumeDashboard.d.ts.map +1 -0
- package/dist/observability/resumeDashboard.js +204 -0
- package/dist/observability/runStatus.d.ts +44 -0
- package/dist/observability/runStatus.d.ts.map +1 -0
- package/dist/observability/runStatus.js +169 -0
- package/dist/observability/subagentHealth.d.ts +66 -0
- package/dist/observability/subagentHealth.d.ts.map +1 -0
- package/dist/observability/subagentHealth.js +107 -0
- package/dist/observability/subagentProgress.d.ts +64 -0
- package/dist/observability/subagentProgress.d.ts.map +1 -0
- package/dist/observability/subagentProgress.js +91 -0
- package/dist/observability/timeline.d.ts +11 -0
- package/dist/observability/timeline.d.ts.map +1 -0
- package/dist/observability/timeline.js +176 -0
- package/dist/observability/types.d.ts +62 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/observability/types.js +8 -0
- package/dist/observability/webhooks.d.ts +68 -0
- package/dist/observability/webhooks.d.ts.map +1 -0
- package/dist/observability/webhooks.js +132 -0
- package/dist/plugins/ccCompatibility.d.ts +79 -0
- package/dist/plugins/ccCompatibility.d.ts.map +1 -0
- package/dist/plugins/ccCompatibility.js +139 -0
- package/dist/plugins/index.d.ts +16 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +38 -0
- package/dist/plugins/loader.d.ts +37 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +112 -0
- package/dist/plugins/management.d.ts +33 -0
- package/dist/plugins/management.d.ts.map +1 -0
- package/dist/plugins/management.js +99 -0
- package/dist/plugins/marketplace.d.ts +64 -0
- package/dist/plugins/marketplace.d.ts.map +1 -0
- package/dist/plugins/marketplace.js +101 -0
- package/dist/plugins/sandbox.d.ts +38 -0
- package/dist/plugins/sandbox.d.ts.map +1 -0
- package/dist/plugins/sandbox.js +109 -0
- package/dist/plugins/trust.d.ts +31 -0
- package/dist/plugins/trust.d.ts.map +1 -0
- package/dist/plugins/trust.js +66 -0
- package/dist/plugins/types.d.ts +27 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +7 -0
- package/dist/plugins/validation.d.ts +32 -0
- package/dist/plugins/validation.d.ts.map +1 -0
- package/dist/plugins/validation.js +117 -0
- package/dist/plugins/version-check.d.ts +23 -0
- package/dist/plugins/version-check.d.ts.map +1 -0
- package/dist/plugins/version-check.js +70 -0
- package/dist/plugins/versioning.d.ts +40 -0
- package/dist/plugins/versioning.d.ts.map +1 -0
- package/dist/plugins/versioning.js +101 -0
- package/dist/processes/index.d.ts +12 -0
- package/dist/processes/index.d.ts.map +1 -0
- package/dist/processes/index.js +15 -0
- package/dist/processes/recommender.d.ts +36 -0
- package/dist/processes/recommender.d.ts.map +1 -0
- package/dist/processes/recommender.js +73 -0
- package/dist/processes/scorer.d.ts +26 -0
- package/dist/processes/scorer.d.ts.map +1 -0
- package/dist/processes/scorer.js +104 -0
- package/dist/processes/types.d.ts +48 -0
- package/dist/processes/types.d.ts.map +1 -0
- package/dist/processes/types.js +9 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +28 -0
- package/dist/seams/contract.d.ts +63 -0
- package/dist/seams/contract.d.ts.map +1 -0
- package/dist/seams/contract.js +141 -0
- package/dist/seams/index.d.ts +3 -0
- package/dist/seams/index.d.ts.map +1 -0
- package/dist/seams/index.js +8 -0
- package/dist/session/context.d.ts +22 -0
- package/dist/session/context.d.ts.map +1 -0
- package/dist/session/context.js +113 -0
- package/dist/session/continuityState.d.ts +39 -0
- package/dist/session/continuityState.d.ts.map +1 -0
- package/dist/session/continuityState.js +164 -0
- package/dist/session/cost.d.ts +72 -0
- package/dist/session/cost.d.ts.map +1 -0
- package/dist/session/cost.js +221 -0
- package/dist/session/crossRunComm.d.ts +40 -0
- package/dist/session/crossRunComm.d.ts.map +1 -0
- package/dist/session/crossRunComm.js +86 -0
- package/dist/session/crossRunState.d.ts +8 -0
- package/dist/session/crossRunState.d.ts.map +1 -0
- package/dist/session/crossRunState.js +45 -0
- package/dist/session/discovery.d.ts +22 -0
- package/dist/session/discovery.d.ts.map +1 -0
- package/dist/session/discovery.js +35 -0
- package/dist/session/history.d.ts +30 -0
- package/dist/session/history.d.ts.map +1 -0
- package/dist/session/history.js +144 -0
- package/dist/session/index.d.ts +8 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +73 -0
- package/dist/session/memoryConsolidation.d.ts +31 -0
- package/dist/session/memoryConsolidation.d.ts.map +1 -0
- package/dist/session/memoryConsolidation.js +135 -0
- package/dist/session/memoryExtraction.d.ts +65 -0
- package/dist/session/memoryExtraction.d.ts.map +1 -0
- package/dist/session/memoryExtraction.js +201 -0
- package/dist/session/parse.d.ts +45 -0
- package/dist/session/parse.d.ts.map +1 -0
- package/dist/session/parse.js +170 -0
- package/dist/session/persistence.d.ts +46 -0
- package/dist/session/persistence.d.ts.map +1 -0
- package/dist/session/persistence.js +180 -0
- package/dist/session/sessionSharing.d.ts +55 -0
- package/dist/session/sessionSharing.d.ts.map +1 -0
- package/dist/session/sessionSharing.js +113 -0
- package/dist/session/sessionTemplates.d.ts +57 -0
- package/dist/session/sessionTemplates.d.ts.map +1 -0
- package/dist/session/sessionTemplates.js +93 -0
- package/dist/session/types.d.ts +267 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +45 -0
- package/dist/session/write.d.ts +61 -0
- package/dist/session/write.d.ts.map +1 -0
- package/dist/session/write.js +213 -0
- package/dist/skills/chain.d.ts +31 -0
- package/dist/skills/chain.d.ts.map +1 -0
- package/dist/skills/chain.js +113 -0
- package/dist/skills/discovery.d.ts +34 -0
- package/dist/skills/discovery.d.ts.map +1 -0
- package/dist/skills/discovery.js +185 -0
- package/dist/skills/index.d.ts +12 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +18 -0
- package/dist/skills/router.d.ts +35 -0
- package/dist/skills/router.d.ts.map +1 -0
- package/dist/skills/router.js +143 -0
- package/dist/skills/types.d.ts +33 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +5 -0
- package/dist/storage/atomic.d.ts +2 -0
- package/dist/storage/atomic.d.ts.map +1 -0
- package/dist/storage/atomic.js +54 -0
- package/dist/storage/clock.d.ts +2 -0
- package/dist/storage/clock.d.ts.map +1 -0
- package/dist/storage/clock.js +6 -0
- package/dist/storage/index.d.ts +7 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +9 -0
- package/dist/storage/journalWatcher.d.ts +24 -0
- package/dist/storage/journalWatcher.d.ts.map +1 -0
- package/dist/storage/journalWatcher.js +173 -0
- package/dist/storage/paths.d.ts +5 -0
- package/dist/storage/paths.d.ts.map +1 -0
- package/dist/storage/paths.js +26 -0
- package/dist/storage/snapshotState.d.ts +10 -0
- package/dist/storage/snapshotState.d.ts.map +1 -0
- package/dist/storage/snapshotState.js +15 -0
- package/dist/storage/storeTaskArtifacts.d.ts +6 -0
- package/dist/storage/storeTaskArtifacts.d.ts.map +1 -0
- package/dist/storage/storeTaskArtifacts.js +55 -0
- package/dist/storage/types.d.ts +21 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +2 -0
- package/dist/tasks/crud.d.ts +33 -0
- package/dist/tasks/crud.d.ts.map +1 -0
- package/dist/tasks/crud.js +150 -0
- package/dist/tasks/index.d.ts +2 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +9 -0
- package/dist/trust/harness-signing.d.ts +15 -0
- package/dist/trust/harness-signing.d.ts.map +1 -0
- package/dist/trust/harness-signing.js +46 -0
- package/dist/trust/key-store.d.ts +15 -0
- package/dist/trust/key-store.d.ts.map +1 -0
- package/dist/trust/key-store.js +66 -0
- package/package.json +161 -0
|
@@ -0,0 +1,904 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
36
|
+
exports.readProcessFileFingerprint = void 0;
|
|
37
|
+
exports.resolveHarnessSessionIdForBinding = resolveHarnessSessionIdForBinding;
|
|
38
|
+
exports.resolveEffect = resolveEffect;
|
|
39
|
+
exports.applyPostEffectOrchestrationOverlays = applyPostEffectOrchestrationOverlays;
|
|
40
|
+
exports.resolveEffectWithRetry = resolveEffectWithRetry;
|
|
41
|
+
exports.orchestrateIterationWithProcessLoadRetry = orchestrateIterationWithProcessLoadRetry;
|
|
42
|
+
const path = __importStar(require("node:path"));
|
|
43
|
+
const effectsHelpers_1 = require("./effectsHelpers");
|
|
44
|
+
const hookDecisionEffects_1 = require("./hookDecisionEffects");
|
|
45
|
+
var effectsHelpers_2 = require("./effectsHelpers");
|
|
46
|
+
Object.defineProperty(exports, "readProcessFileFingerprint", { enumerable: true, get: function () { return effectsHelpers_2.readProcessFileFingerprint; } });
|
|
47
|
+
const workerSessionEnhancer_1 = require("./workerSessionEnhancer");
|
|
48
|
+
const approvalChains_1 = require("../../../../breakpoints/approvalChains");
|
|
49
|
+
const compaction_1 = require("../../../../compression/compaction");
|
|
50
|
+
const executor_1 = require("../../../../mcp/client/executor");
|
|
51
|
+
const manager_1 = require("../../../../mcp/client/manager");
|
|
52
|
+
const toolRegistry_1 = require("../../../../mcp/client/toolRegistry");
|
|
53
|
+
const cost_1 = require("../../../../session/cost");
|
|
54
|
+
const history_1 = require("../../../../session/history");
|
|
55
|
+
const babysitter_sdk_1 = require("@a5c-ai/babysitter-sdk");
|
|
56
|
+
const utils_1 = require("../utils");
|
|
57
|
+
const planProcess_1 = require("../planProcess");
|
|
58
|
+
const constants_1 = require("./constants");
|
|
59
|
+
const dispatch_1 = require("./dispatch");
|
|
60
|
+
async function importOptionalModule(specifier) {
|
|
61
|
+
return Promise.resolve(`${specifier}`).then(s => __importStar(require(s)));
|
|
62
|
+
}
|
|
63
|
+
function resolveHarnessSessionIdForBinding(args, adapter, orchestrationSession) {
|
|
64
|
+
if ((0, utils_1.isInternalHarness)(args.selectedHarnessName) && orchestrationSession?.sessionId) {
|
|
65
|
+
process.env.PI_SESSION_ID = process.env.PI_SESSION_ID || orchestrationSession.sessionId;
|
|
66
|
+
process.env.OMP_SESSION_ID = process.env.OMP_SESSION_ID || orchestrationSession.sessionId;
|
|
67
|
+
}
|
|
68
|
+
const resolved = adapter.resolveSessionId({});
|
|
69
|
+
if (resolved) {
|
|
70
|
+
return resolved;
|
|
71
|
+
}
|
|
72
|
+
return (0, utils_1.isInternalHarness)(args.selectedHarnessName)
|
|
73
|
+
? orchestrationSession?.sessionId
|
|
74
|
+
: undefined;
|
|
75
|
+
}
|
|
76
|
+
async function resolveEffect(action, harnessName, options, piSession, discovered, rl, json, askUserQuestionHandler) {
|
|
77
|
+
const hookResult = (0, hookDecisionEffects_1.getHookDecisionResult)(action);
|
|
78
|
+
if (hookResult) {
|
|
79
|
+
const hookResolution = (0, hookDecisionEffects_1.resolveHookDecisionResult)(action, hookResult, {
|
|
80
|
+
maxRetries: action.taskDef?.metadata?.maxRetries,
|
|
81
|
+
});
|
|
82
|
+
if (hookResolution) {
|
|
83
|
+
return hookResolution;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
const kind = action.kind;
|
|
87
|
+
if (kind === "mcp" || getMcpTaskConfig(action)) {
|
|
88
|
+
return resolveMcpEffect(action, options);
|
|
89
|
+
}
|
|
90
|
+
const tasksMuxResult = await resolveViaTasksMuxIfRoutable(action, options, rl, json, askUserQuestionHandler);
|
|
91
|
+
if (tasksMuxResult) {
|
|
92
|
+
return tasksMuxResult;
|
|
93
|
+
}
|
|
94
|
+
if (kind === "node" || kind === "orchestrator_task") {
|
|
95
|
+
const meta = action.taskDef?.metadata;
|
|
96
|
+
const prompt = typeof meta?.prompt === "string"
|
|
97
|
+
? meta.prompt
|
|
98
|
+
: action.taskDef?.title ?? `Execute task ${action.taskId ?? action.effectId}`;
|
|
99
|
+
return (0, effectsHelpers_1.invokePromptEffect)(action, discovered ? (0, utils_1.resolveTaskHarness)(action, harnessName, discovered) : harnessName, prompt, options, piSession);
|
|
100
|
+
}
|
|
101
|
+
if (kind === "shell") {
|
|
102
|
+
const shellDef = action.taskDef?.shell;
|
|
103
|
+
const shellMeta = action.taskDef?.metadata;
|
|
104
|
+
const command = typeof shellDef?.command === "string"
|
|
105
|
+
? shellDef.command
|
|
106
|
+
: typeof shellMeta?.command === "string"
|
|
107
|
+
? shellMeta.command
|
|
108
|
+
: "echo";
|
|
109
|
+
const shellArgs = Array.isArray(shellDef?.args)
|
|
110
|
+
? shellDef.args.filter((arg) => typeof arg === "string")
|
|
111
|
+
: Array.isArray(shellMeta?.args)
|
|
112
|
+
? shellMeta.args.filter((arg) => typeof arg === "string")
|
|
113
|
+
: [];
|
|
114
|
+
const cwd = typeof shellDef?.cwd === "string"
|
|
115
|
+
? shellDef.cwd
|
|
116
|
+
: typeof shellMeta?.cwd === "string"
|
|
117
|
+
? shellMeta.cwd
|
|
118
|
+
: options.workspace;
|
|
119
|
+
if (piSession) {
|
|
120
|
+
const bashResult = await piSession.executeBash([command, ...shellArgs.map(utils_1.shellQuoteArg)].join(" "));
|
|
121
|
+
if (bashResult.exitCode === 0) {
|
|
122
|
+
return { status: "ok", value: bashResult.output, stdout: bashResult.output };
|
|
123
|
+
}
|
|
124
|
+
return {
|
|
125
|
+
status: "ok",
|
|
126
|
+
value: {
|
|
127
|
+
success: false,
|
|
128
|
+
exitCode: bashResult.exitCode ?? 1,
|
|
129
|
+
stdout: bashResult.output,
|
|
130
|
+
stderr: "",
|
|
131
|
+
error: `Shell command exited with code ${bashResult.exitCode ?? "null"}`,
|
|
132
|
+
},
|
|
133
|
+
stdout: bashResult.output,
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
const shellResult = await (0, planProcess_1.execShellEffect)(command, shellArgs, cwd);
|
|
137
|
+
if (shellResult.exitCode === 0) {
|
|
138
|
+
return {
|
|
139
|
+
status: "ok",
|
|
140
|
+
value: shellResult.stdout,
|
|
141
|
+
stdout: shellResult.stdout,
|
|
142
|
+
stderr: shellResult.stderr,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
status: "ok",
|
|
147
|
+
value: {
|
|
148
|
+
success: false,
|
|
149
|
+
exitCode: shellResult.exitCode,
|
|
150
|
+
stdout: shellResult.stdout,
|
|
151
|
+
stderr: shellResult.stderr,
|
|
152
|
+
error: `Shell command exited with code ${shellResult.exitCode}`,
|
|
153
|
+
},
|
|
154
|
+
stdout: shellResult.stdout,
|
|
155
|
+
stderr: shellResult.stderr,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
if (kind === "breakpoint") {
|
|
159
|
+
const chainResult = resolveConfiguredApprovalChain(action);
|
|
160
|
+
if (chainResult && chainResult.status !== "approved") {
|
|
161
|
+
return {
|
|
162
|
+
status: "ok",
|
|
163
|
+
value: {
|
|
164
|
+
approved: false,
|
|
165
|
+
option: chainResult.status,
|
|
166
|
+
approvalChain: chainResult,
|
|
167
|
+
},
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
return resolveBreakpointLikeEffect(action, options, rl, json, askUserQuestionHandler);
|
|
171
|
+
}
|
|
172
|
+
if (kind === "sleep") {
|
|
173
|
+
const targetMs = action.taskDef?.sleep?.targetEpochMs;
|
|
174
|
+
if (typeof targetMs === "number") {
|
|
175
|
+
const delay = Math.max(0, targetMs - Date.now());
|
|
176
|
+
if (delay > 0) {
|
|
177
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
return { status: "ok", value: { sleptUntil: new Date().toISOString() } };
|
|
181
|
+
}
|
|
182
|
+
if (kind === "agent") {
|
|
183
|
+
const prompt = (0, planProcess_1.buildAgentPrompt)(action.taskDef);
|
|
184
|
+
const taskHarness = discovered ? (0, utils_1.resolveTaskHarness)(action, harnessName, discovered) : harnessName;
|
|
185
|
+
if (taskHarness !== harnessName && !(0, utils_1.isInternalHarness)(taskHarness)) {
|
|
186
|
+
return (0, effectsHelpers_1.invokeAgentHarness)(action, taskHarness, prompt, options);
|
|
187
|
+
}
|
|
188
|
+
if (piSession) {
|
|
189
|
+
const piResult = await (0, utils_1.promptPiWithRetry)({
|
|
190
|
+
session: piSession,
|
|
191
|
+
message: prompt,
|
|
192
|
+
timeout: utils_1.WORKER_TIMEOUT_MS,
|
|
193
|
+
label: `effect ${action.effectId}`,
|
|
194
|
+
});
|
|
195
|
+
return {
|
|
196
|
+
status: piResult.success ? "ok" : "error",
|
|
197
|
+
value: piResult.success
|
|
198
|
+
? (0, planProcess_1.coerceAgentResultValue)(action.taskDef, piResult.output)
|
|
199
|
+
: undefined,
|
|
200
|
+
error: piResult.success ? undefined : new Error(piResult.output),
|
|
201
|
+
stdout: piResult.output,
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
return (0, effectsHelpers_1.invokeAgentHarness)(action, taskHarness, prompt, options);
|
|
205
|
+
}
|
|
206
|
+
if (kind === "subprocess") {
|
|
207
|
+
return invokeSubprocessEffect(action, discovered ? (0, utils_1.resolveTaskHarness)(action, harnessName, discovered) : harnessName, options, discovered, rl, json, askUserQuestionHandler);
|
|
208
|
+
}
|
|
209
|
+
const fallbackPrompt = action.taskDef?.title ?? `Handle effect ${action.effectId} (kind: ${kind})`;
|
|
210
|
+
return (0, effectsHelpers_1.invokePromptEffect)(action, harnessName, fallbackPrompt, options, undefined);
|
|
211
|
+
}
|
|
212
|
+
function getMcpTaskConfig(action) {
|
|
213
|
+
const taskDef = action.taskDef;
|
|
214
|
+
const direct = taskDef?.mcp;
|
|
215
|
+
if (isPlainRecord(direct)) {
|
|
216
|
+
return direct;
|
|
217
|
+
}
|
|
218
|
+
const metadata = taskDef?.metadata;
|
|
219
|
+
if (isPlainRecord(metadata) && isPlainRecord(metadata.mcp)) {
|
|
220
|
+
return metadata.mcp;
|
|
221
|
+
}
|
|
222
|
+
return undefined;
|
|
223
|
+
}
|
|
224
|
+
function getMcpRequest(action, options) {
|
|
225
|
+
const config = getMcpTaskConfig(action);
|
|
226
|
+
if (!config) {
|
|
227
|
+
throw new Error(`MCP effect ${action.effectId} is missing taskDef.mcp configuration`);
|
|
228
|
+
}
|
|
229
|
+
const qualifiedName = typeof config.qualifiedName === "string"
|
|
230
|
+
? config.qualifiedName
|
|
231
|
+
: typeof config.tool === "string"
|
|
232
|
+
? config.tool
|
|
233
|
+
: undefined;
|
|
234
|
+
const colonIdx = qualifiedName?.indexOf(":") ?? -1;
|
|
235
|
+
const serverName = typeof config.serverName === "string"
|
|
236
|
+
? config.serverName
|
|
237
|
+
: colonIdx > 0 && qualifiedName
|
|
238
|
+
? qualifiedName.slice(0, colonIdx)
|
|
239
|
+
: undefined;
|
|
240
|
+
const toolName = typeof config.toolName === "string"
|
|
241
|
+
? config.toolName
|
|
242
|
+
: colonIdx > 0 && qualifiedName
|
|
243
|
+
? qualifiedName.slice(colonIdx + 1)
|
|
244
|
+
: undefined;
|
|
245
|
+
if (!serverName || !toolName) {
|
|
246
|
+
throw new Error(`MCP effect ${action.effectId} requires serverName and toolName`);
|
|
247
|
+
}
|
|
248
|
+
const args = isPlainRecord(config.args) ? config.args : {};
|
|
249
|
+
const context = {
|
|
250
|
+
...(isPlainRecord(args.context) ? args.context : {}),
|
|
251
|
+
...(options.runId ? { runId: options.runId } : {}),
|
|
252
|
+
...(options.runDir ? { runDir: options.runDir } : {}),
|
|
253
|
+
...(options.sessionId ? { sessionId: options.sessionId } : {}),
|
|
254
|
+
...(options.workspace ? { workspace: options.workspace } : {}),
|
|
255
|
+
};
|
|
256
|
+
return {
|
|
257
|
+
serverName,
|
|
258
|
+
toolName,
|
|
259
|
+
args: {
|
|
260
|
+
...args,
|
|
261
|
+
context,
|
|
262
|
+
},
|
|
263
|
+
};
|
|
264
|
+
}
|
|
265
|
+
async function resolveMcpExecutor(options) {
|
|
266
|
+
if (options.mcp?.executor) {
|
|
267
|
+
return options.mcp.executor;
|
|
268
|
+
}
|
|
269
|
+
const manager = options.mcp?.manager ?? (options.mcp?.transportFactory
|
|
270
|
+
? new manager_1.McpClientManager({
|
|
271
|
+
stateDir: options.mcp.stateDir ?? options.runDir ?? process.cwd(),
|
|
272
|
+
transportFactory: options.mcp.transportFactory,
|
|
273
|
+
})
|
|
274
|
+
: undefined);
|
|
275
|
+
if (!manager) {
|
|
276
|
+
throw new Error("MCP effect routing requires an executor, manager, or transportFactory");
|
|
277
|
+
}
|
|
278
|
+
await manager.initialize(options.mcp?.autoConnect ?? true);
|
|
279
|
+
const registry = options.mcp?.registry ?? new toolRegistry_1.McpToolRegistry(manager, {
|
|
280
|
+
cacheTtlMs: options.mcp?.cacheTtlMs,
|
|
281
|
+
unifiedRegistry: options.mcp?.toolRegistry,
|
|
282
|
+
mcpBridge: options.mcp?.mcpBridge,
|
|
283
|
+
});
|
|
284
|
+
await registry.refreshAll();
|
|
285
|
+
return new executor_1.McpToolExecutor(manager);
|
|
286
|
+
}
|
|
287
|
+
function mcpResultToStdout(result) {
|
|
288
|
+
return result.content
|
|
289
|
+
.map((item) => typeof item.text === "string" ? item.text : typeof item.data === "string" ? item.data : "")
|
|
290
|
+
.filter(Boolean)
|
|
291
|
+
.join("\n");
|
|
292
|
+
}
|
|
293
|
+
function streamMcpOutput(text, streaming) {
|
|
294
|
+
if (!streaming?.onLine || !text) {
|
|
295
|
+
return;
|
|
296
|
+
}
|
|
297
|
+
for (const line of text.split(/\r?\n/)) {
|
|
298
|
+
if (line.length > 0) {
|
|
299
|
+
streaming.onLine(line, "stdout");
|
|
300
|
+
}
|
|
301
|
+
}
|
|
302
|
+
}
|
|
303
|
+
async function resolveMcpEffect(action, options) {
|
|
304
|
+
const executor = await resolveMcpExecutor(options);
|
|
305
|
+
const request = getMcpRequest(action, options);
|
|
306
|
+
const result = options.mcp?.dispatcher
|
|
307
|
+
? await dispatchMcpTool(options.mcp.dispatcher, executor, request, options)
|
|
308
|
+
: await executor.execute(request);
|
|
309
|
+
const stdout = mcpResultToStdout(result);
|
|
310
|
+
streamMcpOutput(stdout, options.streaming);
|
|
311
|
+
return {
|
|
312
|
+
status: result.success ? "ok" : "error",
|
|
313
|
+
value: result,
|
|
314
|
+
error: result.success ? undefined : new Error(result.error ?? stdout),
|
|
315
|
+
stdout,
|
|
316
|
+
stderr: result.success ? undefined : result.error,
|
|
317
|
+
};
|
|
318
|
+
}
|
|
319
|
+
async function dispatchMcpTool(dispatcher, executor, request, options) {
|
|
320
|
+
const dispatched = await dispatcher.dispatch({
|
|
321
|
+
toolName: request.toolName,
|
|
322
|
+
input: request.args,
|
|
323
|
+
caller: "agent-platform:mcp",
|
|
324
|
+
...(options.runId ? { runId: options.runId } : {}),
|
|
325
|
+
...(options.sessionId ? { sessionId: options.sessionId } : {}),
|
|
326
|
+
}, async () => executor.execute(request));
|
|
327
|
+
if (dispatched.error) {
|
|
328
|
+
return {
|
|
329
|
+
success: false,
|
|
330
|
+
content: [],
|
|
331
|
+
error: typeof dispatched.error === "string"
|
|
332
|
+
? dispatched.error
|
|
333
|
+
: dispatched.error.message ?? "MCP tool dispatch failed",
|
|
334
|
+
durationMs: dispatched.durationMs,
|
|
335
|
+
};
|
|
336
|
+
}
|
|
337
|
+
return dispatched.output;
|
|
338
|
+
}
|
|
339
|
+
function resolveConfiguredApprovalChain(action) {
|
|
340
|
+
const metadata = action.taskDef?.metadata;
|
|
341
|
+
if (!isPlainRecord(metadata)) {
|
|
342
|
+
return undefined;
|
|
343
|
+
}
|
|
344
|
+
if (!isApprovalChainDefinition(metadata.approvalChain) || !isApprovalChainState(metadata.approvalChainState)) {
|
|
345
|
+
return undefined;
|
|
346
|
+
}
|
|
347
|
+
return (0, approvalChains_1.evaluateApprovalChain)(metadata.approvalChain, metadata.approvalChainState);
|
|
348
|
+
}
|
|
349
|
+
function isApprovalChainDefinition(value) {
|
|
350
|
+
return isPlainRecord(value)
|
|
351
|
+
&& typeof value.chainId === "string"
|
|
352
|
+
&& Array.isArray(value.steps);
|
|
353
|
+
}
|
|
354
|
+
function isApprovalChainState(value) {
|
|
355
|
+
return isPlainRecord(value)
|
|
356
|
+
&& typeof value.chainId === "string"
|
|
357
|
+
&& typeof value.currentStepIndex === "number"
|
|
358
|
+
&& Array.isArray(value.completedSteps);
|
|
359
|
+
}
|
|
360
|
+
async function applyPostEffectOrchestrationOverlays(args) {
|
|
361
|
+
const result = {};
|
|
362
|
+
const updateSessionCost = args.updateSessionCost ?? cost_1.updateSessionCost;
|
|
363
|
+
const checkBudget = args.checkBudget ?? cost_1.checkBudget;
|
|
364
|
+
const compactSession = args.compactSession ?? compaction_1.compactSession;
|
|
365
|
+
const shouldAutoCompact = args.shouldAutoCompact ?? compaction_1.shouldAutoCompact;
|
|
366
|
+
const markThresholdsTriggered = args.markThresholdsTriggered ?? cost_1.markThresholdsTriggered;
|
|
367
|
+
const setSessionPaused = args.setSessionPaused ?? cost_1.setSessionPaused;
|
|
368
|
+
const addDecision = args.addDecision ?? history_1.addDecision;
|
|
369
|
+
const saveContextSnapshot = args.saveContextSnapshot ?? history_1.saveContextSnapshot;
|
|
370
|
+
if (args.stateDir && args.sessionId && args.runId && args.effectCost) {
|
|
371
|
+
const costState = await updateSessionCost(args.stateDir, args.sessionId, {
|
|
372
|
+
runId: args.runId,
|
|
373
|
+
costUsd: args.effectCost.totalCostUsd ?? 0,
|
|
374
|
+
inputTokens: args.effectCost.inputTokens ?? 0,
|
|
375
|
+
outputTokens: args.effectCost.outputTokens ?? 0,
|
|
376
|
+
});
|
|
377
|
+
result.budget = checkBudget(costState);
|
|
378
|
+
await markThresholdsTriggered(args.stateDir, args.sessionId, result.budget.alerts.map((alert) => alert.thresholdPct));
|
|
379
|
+
if (result.budget.shouldPause) {
|
|
380
|
+
await setSessionPaused(args.stateDir, args.sessionId, true);
|
|
381
|
+
result.budgetEnforcement = {
|
|
382
|
+
paused: true,
|
|
383
|
+
pauseReason: result.budget.pauseReason,
|
|
384
|
+
};
|
|
385
|
+
}
|
|
386
|
+
else {
|
|
387
|
+
result.budgetEnforcement = { paused: false };
|
|
388
|
+
}
|
|
389
|
+
}
|
|
390
|
+
if (args.stateDir && args.sessionId && args.runId && args.effectSummary) {
|
|
391
|
+
const title = args.effectSummary.title ?? args.effectSummary.taskId ?? args.effectSummary.effectId;
|
|
392
|
+
await addDecision(args.stateDir, args.sessionId, {
|
|
393
|
+
runId: args.runId,
|
|
394
|
+
description: `Resolved ${args.effectSummary.kind ?? "unknown"} effect: ${title}`,
|
|
395
|
+
rationale: `Effect ${args.effectSummary.effectId} completed with status ${args.effectSummary.status}`,
|
|
396
|
+
});
|
|
397
|
+
await saveContextSnapshot(args.stateDir, args.sessionId, {
|
|
398
|
+
runId: args.runId,
|
|
399
|
+
snapshot: {
|
|
400
|
+
effectId: args.effectSummary.effectId,
|
|
401
|
+
taskId: args.effectSummary.taskId,
|
|
402
|
+
kind: args.effectSummary.kind,
|
|
403
|
+
title: args.effectSummary.title,
|
|
404
|
+
status: args.effectSummary.status,
|
|
405
|
+
},
|
|
406
|
+
});
|
|
407
|
+
}
|
|
408
|
+
if (args.stateDir &&
|
|
409
|
+
args.sessionId &&
|
|
410
|
+
args.runsDir &&
|
|
411
|
+
args.compactionConfig &&
|
|
412
|
+
typeof args.estimatedStateTokens === "number" &&
|
|
413
|
+
shouldAutoCompact(args.estimatedStateTokens, args.compactionConfig)) {
|
|
414
|
+
result.compaction = {
|
|
415
|
+
triggered: true,
|
|
416
|
+
results: await compactSession(args.stateDir, args.sessionId, args.runsDir, args.compactionConfig),
|
|
417
|
+
};
|
|
418
|
+
}
|
|
419
|
+
else {
|
|
420
|
+
result.compaction = { triggered: false, results: [] };
|
|
421
|
+
}
|
|
422
|
+
return result;
|
|
423
|
+
}
|
|
424
|
+
async function resolveViaTasksMuxIfRoutable(action, options, rl, json, askUserQuestionHandler) {
|
|
425
|
+
if (action.kind !== "agent" && action.kind !== "breakpoint") {
|
|
426
|
+
return undefined;
|
|
427
|
+
}
|
|
428
|
+
let adapter;
|
|
429
|
+
try {
|
|
430
|
+
adapter = await importOptionalModule("@a5c-ai/tasks-adapter");
|
|
431
|
+
}
|
|
432
|
+
catch {
|
|
433
|
+
return undefined;
|
|
434
|
+
}
|
|
435
|
+
if (typeof adapter.routeTask !== "function") {
|
|
436
|
+
return undefined;
|
|
437
|
+
}
|
|
438
|
+
const decision = adapter.routeTask(action.taskDef);
|
|
439
|
+
if (decision.responderType === "internal") {
|
|
440
|
+
return undefined;
|
|
441
|
+
}
|
|
442
|
+
if (decision.responderType === "human") {
|
|
443
|
+
return resolveBreakpointLikeEffect(action, options, rl, json, askUserQuestionHandler);
|
|
444
|
+
}
|
|
445
|
+
if (decision.responderType === "tracker") {
|
|
446
|
+
if (decision.unavailable) {
|
|
447
|
+
return {
|
|
448
|
+
status: "ok",
|
|
449
|
+
value: {
|
|
450
|
+
success: false,
|
|
451
|
+
routedThrough: "tasks-adapter",
|
|
452
|
+
responderType: "tracker",
|
|
453
|
+
error: decision.reason ?? "ExternalTrackerBackend unavailable",
|
|
454
|
+
},
|
|
455
|
+
stdout: decision.reason,
|
|
456
|
+
};
|
|
457
|
+
}
|
|
458
|
+
return undefined;
|
|
459
|
+
}
|
|
460
|
+
if (decision.responderType !== "agent") {
|
|
461
|
+
return undefined;
|
|
462
|
+
}
|
|
463
|
+
const fallbackToInternal = shouldFallbackExternalAgentToInternal(action.taskDef);
|
|
464
|
+
if (typeof adapter.AgentMuxResponderBackend !== "function") {
|
|
465
|
+
if (fallbackToInternal) {
|
|
466
|
+
return undefined;
|
|
467
|
+
}
|
|
468
|
+
return {
|
|
469
|
+
status: "error",
|
|
470
|
+
error: new Error("tasks-adapter AgentMuxResponderBackend is unavailable"),
|
|
471
|
+
};
|
|
472
|
+
}
|
|
473
|
+
const prompt = (0, planProcess_1.buildAgentPrompt)(action.taskDef);
|
|
474
|
+
let breakpoint;
|
|
475
|
+
try {
|
|
476
|
+
const backend = new adapter.AgentMuxResponderBackend({
|
|
477
|
+
adapter: decision.responder?.adapter ?? decision.responder?.id,
|
|
478
|
+
model: decision.responder?.model ?? options.model,
|
|
479
|
+
cwd: options.workspace,
|
|
480
|
+
});
|
|
481
|
+
breakpoint = await backend.submitBreakpoint({
|
|
482
|
+
text: prompt,
|
|
483
|
+
context: {
|
|
484
|
+
description: action.taskDef?.title ?? action.taskId ?? action.effectId,
|
|
485
|
+
codeSnippets: [],
|
|
486
|
+
fileReferences: [],
|
|
487
|
+
tags: action.labels ?? [],
|
|
488
|
+
},
|
|
489
|
+
routing: {
|
|
490
|
+
strategy: "single",
|
|
491
|
+
targetResponders: decision.responder?.id ? [decision.responder.id] : [],
|
|
492
|
+
timeoutMs: readExternalAgentTimeoutMs(action.taskDef) ?? 300_000,
|
|
493
|
+
presentToUser: false,
|
|
494
|
+
responderType: "agent",
|
|
495
|
+
adapter: decision.responder?.adapter ?? decision.responder?.id,
|
|
496
|
+
model: decision.responder?.model ?? options.model,
|
|
497
|
+
},
|
|
498
|
+
});
|
|
499
|
+
}
|
|
500
|
+
catch (err) {
|
|
501
|
+
if (fallbackToInternal) {
|
|
502
|
+
return undefined;
|
|
503
|
+
}
|
|
504
|
+
return {
|
|
505
|
+
status: "error",
|
|
506
|
+
error: err instanceof Error ? err : new Error(String(err)),
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
const answer = breakpoint.answers[0];
|
|
510
|
+
return {
|
|
511
|
+
status: "ok",
|
|
512
|
+
value: (0, planProcess_1.coerceAgentResultValue)(action.taskDef, answer?.text ?? ""),
|
|
513
|
+
stdout: answer?.text ?? "",
|
|
514
|
+
};
|
|
515
|
+
}
|
|
516
|
+
async function resolveBreakpointLikeEffect(action, options, rl, json, askUserQuestionHandler) {
|
|
517
|
+
const question = action.taskDef?.question
|
|
518
|
+
?? action.taskDef?.title
|
|
519
|
+
?? "Breakpoint reached. Continue?";
|
|
520
|
+
const approvalPrompt = (0, utils_1.createApprovalAskUserQuestion)(question);
|
|
521
|
+
const approvalKey = approvalPrompt.questions[0]?.header ?? "Decision";
|
|
522
|
+
// GAP-MCPC-003: Try channel relay before local interaction
|
|
523
|
+
const channelResult = await tryChannelRelay(action, options, approvalKey);
|
|
524
|
+
if (channelResult)
|
|
525
|
+
return channelResult;
|
|
526
|
+
if (options.interactive && rl) {
|
|
527
|
+
if (!json) {
|
|
528
|
+
process.stderr.write(`\n${utils_1.YELLOW}${utils_1.BOLD}BREAKPOINT ${question}\n`);
|
|
529
|
+
}
|
|
530
|
+
const { promptAskUserQuestionWithReadline } = await Promise.resolve().then(() => __importStar(require("../../../../interaction")));
|
|
531
|
+
const response = await promptAskUserQuestionWithReadline(rl, approvalPrompt);
|
|
532
|
+
return (0, effectsHelpers_1.buildBreakpointResult)(response, approvalKey);
|
|
533
|
+
}
|
|
534
|
+
if (options.interactive && askUserQuestionHandler) {
|
|
535
|
+
const response = await askUserQuestionHandler(approvalPrompt);
|
|
536
|
+
return (0, effectsHelpers_1.buildBreakpointResult)(response, approvalKey);
|
|
537
|
+
}
|
|
538
|
+
return (0, effectsHelpers_1.buildBreakpointResult)((0, utils_1.createAskUserQuestionResponse)(approvalPrompt, { [approvalKey]: "Approve" }), approvalKey);
|
|
539
|
+
}
|
|
540
|
+
async function tryChannelRelay(action, options, _approvalKey) {
|
|
541
|
+
try {
|
|
542
|
+
const { ChannelPermissionRelay, createApprovalRace } = await Promise.resolve().then(() => __importStar(require("../../../../mcp/channels/permissionRelay")));
|
|
543
|
+
const { DEFAULT_APPROVAL_SECURITY } = await Promise.resolve().then(() => __importStar(require("../../../../mcp/channels/types")));
|
|
544
|
+
const breakpointId = action.effectId;
|
|
545
|
+
const tags = action.labels ?? [];
|
|
546
|
+
// Without a configured outbound sender, channel relay is a no-op.
|
|
547
|
+
// The relay infrastructure is available but requires explicit channel
|
|
548
|
+
// configuration (MCP servers for Slack/Discord/etc). When configured,
|
|
549
|
+
// the relay attempts to dispatch the breakpoint via channels and races
|
|
550
|
+
// against local terminal approval.
|
|
551
|
+
//
|
|
552
|
+
// To enable: configure MCP channels in ~/.a5c/channel-allowlist.json
|
|
553
|
+
// and ensure a ChannelManager is bound to the session.
|
|
554
|
+
//
|
|
555
|
+
// For now, check if the security policy allows relay and log the attempt.
|
|
556
|
+
const security = DEFAULT_APPROVAL_SECURITY;
|
|
557
|
+
if (!security.enabled)
|
|
558
|
+
return undefined;
|
|
559
|
+
// Validate terminal-only restrictions
|
|
560
|
+
if (tags.some(t => security.terminalOnlyTags.includes(t)))
|
|
561
|
+
return undefined;
|
|
562
|
+
for (const restricted of security.terminalOnlyTags) {
|
|
563
|
+
if (breakpointId.startsWith(`${restricted}.`))
|
|
564
|
+
return undefined;
|
|
565
|
+
}
|
|
566
|
+
// Channel relay is eligible but requires active MCP channel bindings.
|
|
567
|
+
// When fully configured, this returns a breakpoint result from the
|
|
568
|
+
// channel response. Without active channels, falls through to local.
|
|
569
|
+
}
|
|
570
|
+
catch {
|
|
571
|
+
// Channel modules not available — relay disabled
|
|
572
|
+
}
|
|
573
|
+
return undefined;
|
|
574
|
+
}
|
|
575
|
+
function shouldFallbackExternalAgentToInternal(taskDef) {
|
|
576
|
+
const agent = isPlainRecord(taskDef?.agent) ? taskDef.agent : {};
|
|
577
|
+
const metadata = isPlainRecord(taskDef?.metadata) ? taskDef.metadata : {};
|
|
578
|
+
return agent.fallbackToInternal === true
|
|
579
|
+
|| metadata.fallbackToInternal === true
|
|
580
|
+
|| agent.fallbackType === "internal"
|
|
581
|
+
|| metadata.fallbackType === "internal";
|
|
582
|
+
}
|
|
583
|
+
function readExternalAgentTimeoutMs(taskDef) {
|
|
584
|
+
const agent = isPlainRecord(taskDef?.agent) ? taskDef.agent : {};
|
|
585
|
+
return typeof agent.timeoutMs === "number" ? agent.timeoutMs : undefined;
|
|
586
|
+
}
|
|
587
|
+
function parseSubprocessSpec(action, workspace) {
|
|
588
|
+
const subprocess = action.taskDef?.subprocess;
|
|
589
|
+
if (!subprocess || typeof subprocess.processPath !== "string" || !subprocess.processPath.trim()) {
|
|
590
|
+
throw new Error(`Subprocess effect ${action.effectId} is missing subprocess.processPath`);
|
|
591
|
+
}
|
|
592
|
+
const resolvedProcessPath = path.isAbsolute(subprocess.processPath)
|
|
593
|
+
? path.resolve(subprocess.processPath)
|
|
594
|
+
: path.resolve(workspace ?? process.cwd(), subprocess.processPath);
|
|
595
|
+
const processId = typeof subprocess.processId === "string" && subprocess.processId.trim()
|
|
596
|
+
? subprocess.processId.trim()
|
|
597
|
+
: path.basename(resolvedProcessPath, path.extname(resolvedProcessPath));
|
|
598
|
+
return {
|
|
599
|
+
processPath: resolvedProcessPath,
|
|
600
|
+
exportName: typeof subprocess.exportName === "string" ? subprocess.exportName : undefined,
|
|
601
|
+
processId,
|
|
602
|
+
prompt: typeof subprocess.prompt === "string" ? subprocess.prompt : undefined,
|
|
603
|
+
inputs: subprocess.inputs,
|
|
604
|
+
inputSchema: isPlainRecord(subprocess.inputSchema) ? subprocess.inputSchema : undefined,
|
|
605
|
+
outputSchema: isPlainRecord(subprocess.outputSchema) ? subprocess.outputSchema : undefined,
|
|
606
|
+
harness: typeof subprocess.harness === "string" ? subprocess.harness : undefined,
|
|
607
|
+
model: typeof subprocess.model === "string" ? subprocess.model : undefined,
|
|
608
|
+
maxIterations: typeof subprocess.maxIterations === "number" ? subprocess.maxIterations : undefined,
|
|
609
|
+
shareSession: subprocess.shareSession !== false,
|
|
610
|
+
metadata: subprocess.metadata,
|
|
611
|
+
};
|
|
612
|
+
}
|
|
613
|
+
function isPlainRecord(value) {
|
|
614
|
+
return Boolean(value) && typeof value === "object" && !Array.isArray(value);
|
|
615
|
+
}
|
|
616
|
+
function summarizeSubprocessValue(value) {
|
|
617
|
+
if (typeof value === "string") {
|
|
618
|
+
return value.length > 240 ? `${value.slice(0, 237)}...` : value;
|
|
619
|
+
}
|
|
620
|
+
if (value instanceof Error) {
|
|
621
|
+
return value.message;
|
|
622
|
+
}
|
|
623
|
+
try {
|
|
624
|
+
const serialized = JSON.stringify(value);
|
|
625
|
+
return serialized.length > 240 ? `${serialized.slice(0, 237)}...` : serialized;
|
|
626
|
+
}
|
|
627
|
+
catch {
|
|
628
|
+
return String(value);
|
|
629
|
+
}
|
|
630
|
+
}
|
|
631
|
+
async function disposeWorkerSession(session) {
|
|
632
|
+
if (!session) {
|
|
633
|
+
return;
|
|
634
|
+
}
|
|
635
|
+
await session.abort().catch(() => undefined);
|
|
636
|
+
session.dispose();
|
|
637
|
+
}
|
|
638
|
+
async function invokeSubprocessEffect(action, harnessName, options, discovered, rl, json, askUserQuestionHandler) {
|
|
639
|
+
if (!options.runsDir || !options.runId) {
|
|
640
|
+
return {
|
|
641
|
+
status: "error",
|
|
642
|
+
error: new Error("Subprocess effects require runsDir and parent runId in the harness resolver."),
|
|
643
|
+
};
|
|
644
|
+
}
|
|
645
|
+
const spec = parseSubprocessSpec(action, options.workspace);
|
|
646
|
+
const childHarness = spec.harness ?? harnessName;
|
|
647
|
+
const childModel = spec.model ?? options.model;
|
|
648
|
+
const maxIterations = spec.maxIterations ?? options.maxIterations ?? 65_000;
|
|
649
|
+
const childPrompt = spec.prompt ?? action.taskDef?.title ?? `Run subprocess ${spec.processId}`;
|
|
650
|
+
const childRun = await (0, babysitter_sdk_1.createRun)({
|
|
651
|
+
runsDir: options.runsDir,
|
|
652
|
+
harness: childHarness,
|
|
653
|
+
process: {
|
|
654
|
+
processId: spec.processId,
|
|
655
|
+
importPath: spec.processPath,
|
|
656
|
+
...(spec.exportName ? { exportName: spec.exportName } : {}),
|
|
657
|
+
},
|
|
658
|
+
prompt: spec.prompt,
|
|
659
|
+
inputs: spec.inputs,
|
|
660
|
+
inputSchema: spec.inputSchema,
|
|
661
|
+
outputSchema: spec.outputSchema,
|
|
662
|
+
metadata: spec.metadata,
|
|
663
|
+
nested: {
|
|
664
|
+
parentRunId: options.runId,
|
|
665
|
+
parentEffectId: action.effectId,
|
|
666
|
+
parentInvocationKey: action.invocationKey,
|
|
667
|
+
...(spec.shareSession && options.sessionId ? { sessionId: options.sessionId } : {}),
|
|
668
|
+
shareSession: spec.shareSession,
|
|
669
|
+
skipRunStartHook: true,
|
|
670
|
+
},
|
|
671
|
+
});
|
|
672
|
+
(0, utils_1.emitAmuxEvent)({
|
|
673
|
+
type: "subagent_spawn",
|
|
674
|
+
runId: options.runId,
|
|
675
|
+
agent: "babysitter",
|
|
676
|
+
timestamp: new Date().toISOString(),
|
|
677
|
+
subagentId: childRun.runId,
|
|
678
|
+
agentName: "babysitter",
|
|
679
|
+
prompt: childPrompt,
|
|
680
|
+
}, Boolean(json), options.outputMode);
|
|
681
|
+
for (let iteration = 0; iteration < maxIterations; iteration += 1) {
|
|
682
|
+
const iterationResult = await orchestrateIterationWithProcessLoadRetry({ runDir: childRun.runDir });
|
|
683
|
+
if (iterationResult.status === "waiting") {
|
|
684
|
+
await (0, dispatch_1.dispatchEffectActions)({
|
|
685
|
+
actions: iterationResult.nextActions,
|
|
686
|
+
concurrentEffects: (0, dispatch_1.harnessSupportsConcurrentEffects)(childHarness, discovered),
|
|
687
|
+
resolveAction: async (childAction) => {
|
|
688
|
+
const effectiveHarness = discovered
|
|
689
|
+
? (0, utils_1.resolveTaskHarness)(childAction, childHarness, discovered)
|
|
690
|
+
: childHarness;
|
|
691
|
+
let workerSession = null;
|
|
692
|
+
let workerSessionFactory;
|
|
693
|
+
if (childAction.kind === "shell" || (0, utils_1.isInternalHarness)(effectiveHarness)) {
|
|
694
|
+
const baseOpts = (0, utils_1.buildPiWorkerSessionOptions)({
|
|
695
|
+
action: childAction,
|
|
696
|
+
workspace: options.workspace,
|
|
697
|
+
model: childModel,
|
|
698
|
+
});
|
|
699
|
+
const enhancedOpts = options.gentyContext
|
|
700
|
+
? (0, workerSessionEnhancer_1.enhanceWorkerSessionOptions)(baseOpts, options.gentyContext)
|
|
701
|
+
: baseOpts;
|
|
702
|
+
const createWorkerSession = () => (0, utils_1.createAgentCoreSession)(enhancedOpts);
|
|
703
|
+
workerSession = createWorkerSession();
|
|
704
|
+
workerSessionFactory = createWorkerSession;
|
|
705
|
+
}
|
|
706
|
+
try {
|
|
707
|
+
const childEffectResult = await resolveEffectWithRetry(childAction, childHarness, {
|
|
708
|
+
workspace: options.workspace,
|
|
709
|
+
model: childModel,
|
|
710
|
+
interactive: options.interactive,
|
|
711
|
+
compressionConfig: options.compressionConfig,
|
|
712
|
+
streaming: options.streaming,
|
|
713
|
+
runsDir: options.runsDir,
|
|
714
|
+
runId: childRun.runId,
|
|
715
|
+
runDir: childRun.runDir,
|
|
716
|
+
sessionId: spec.shareSession ? options.sessionId : undefined,
|
|
717
|
+
maxIterations,
|
|
718
|
+
verbose: options.verbose,
|
|
719
|
+
outputMode: options.outputMode,
|
|
720
|
+
gentyContext: options.gentyContext,
|
|
721
|
+
}, workerSession, discovered, rl, json, workerSessionFactory, disposeWorkerSession, askUserQuestionHandler);
|
|
722
|
+
return childEffectResult;
|
|
723
|
+
}
|
|
724
|
+
finally {
|
|
725
|
+
await disposeWorkerSession(workerSession);
|
|
726
|
+
}
|
|
727
|
+
},
|
|
728
|
+
commitAction: async ({ action: childAction, result: childEffectResult, startedAt, finishedAt }) => {
|
|
729
|
+
await (0, babysitter_sdk_1.commitEffectResult)({
|
|
730
|
+
runDir: childRun.runDir,
|
|
731
|
+
effectId: childAction.effectId,
|
|
732
|
+
invocationKey: childAction.invocationKey,
|
|
733
|
+
result: {
|
|
734
|
+
status: childEffectResult.status,
|
|
735
|
+
value: childEffectResult.value,
|
|
736
|
+
error: childEffectResult.error,
|
|
737
|
+
stdout: childEffectResult.stdout,
|
|
738
|
+
stderr: childEffectResult.stderr,
|
|
739
|
+
startedAt,
|
|
740
|
+
finishedAt,
|
|
741
|
+
},
|
|
742
|
+
});
|
|
743
|
+
},
|
|
744
|
+
});
|
|
745
|
+
continue;
|
|
746
|
+
}
|
|
747
|
+
if (iterationResult.status === "completed") {
|
|
748
|
+
(0, utils_1.emitAmuxEvent)({
|
|
749
|
+
type: "subagent_result",
|
|
750
|
+
runId: options.runId,
|
|
751
|
+
agent: "babysitter",
|
|
752
|
+
timestamp: new Date().toISOString(),
|
|
753
|
+
subagentId: childRun.runId,
|
|
754
|
+
agentName: "babysitter",
|
|
755
|
+
summary: summarizeSubprocessValue(iterationResult.output),
|
|
756
|
+
}, Boolean(json), options.outputMode);
|
|
757
|
+
return {
|
|
758
|
+
status: "ok",
|
|
759
|
+
value: {
|
|
760
|
+
runId: childRun.runId,
|
|
761
|
+
runDir: childRun.runDir,
|
|
762
|
+
output: iterationResult.output,
|
|
763
|
+
},
|
|
764
|
+
};
|
|
765
|
+
}
|
|
766
|
+
const message = iterationResult.status === "halted"
|
|
767
|
+
? iterationResult.reason
|
|
768
|
+
: "error" in iterationResult && iterationResult.error instanceof Error
|
|
769
|
+
? iterationResult.error.message
|
|
770
|
+
: "error" in iterationResult
|
|
771
|
+
? summarizeSubprocessValue(iterationResult.error)
|
|
772
|
+
: summarizeSubprocessValue(iterationResult);
|
|
773
|
+
(0, utils_1.emitAmuxEvent)({
|
|
774
|
+
type: "subagent_error",
|
|
775
|
+
runId: options.runId,
|
|
776
|
+
agent: "babysitter",
|
|
777
|
+
timestamp: new Date().toISOString(),
|
|
778
|
+
subagentId: childRun.runId,
|
|
779
|
+
agentName: "babysitter",
|
|
780
|
+
error: message,
|
|
781
|
+
}, Boolean(json), options.outputMode);
|
|
782
|
+
return {
|
|
783
|
+
status: "error",
|
|
784
|
+
error: new Error(`Nested run ${childRun.runId} failed: ${message}`),
|
|
785
|
+
stderr: message,
|
|
786
|
+
};
|
|
787
|
+
}
|
|
788
|
+
const timeoutMessage = `Nested run ${childRun.runId} reached max iterations (${maxIterations}) without completion.`;
|
|
789
|
+
(0, utils_1.emitAmuxEvent)({
|
|
790
|
+
type: "subagent_error",
|
|
791
|
+
runId: options.runId,
|
|
792
|
+
agent: "babysitter",
|
|
793
|
+
timestamp: new Date().toISOString(),
|
|
794
|
+
subagentId: childRun.runId,
|
|
795
|
+
agentName: "babysitter",
|
|
796
|
+
error: timeoutMessage,
|
|
797
|
+
}, Boolean(json), options.outputMode);
|
|
798
|
+
return {
|
|
799
|
+
status: "error",
|
|
800
|
+
error: new Error(timeoutMessage),
|
|
801
|
+
stderr: timeoutMessage,
|
|
802
|
+
};
|
|
803
|
+
}
|
|
804
|
+
async function resolveEffectWithRetry(action, harnessName, options, piSession, discovered, rl, json, piSessionFactory, disposePiSession, askUserQuestionHandler) {
|
|
805
|
+
const config = { ...utils_1.DEFAULT_EFFECT_RETRY_CONFIG, ...options.retryConfig };
|
|
806
|
+
const metadata = action.taskDef?.metadata;
|
|
807
|
+
if (typeof metadata?.maxRetries === "number") {
|
|
808
|
+
config.maxRetries = metadata.maxRetries;
|
|
809
|
+
}
|
|
810
|
+
if (metadata?.noRetry === true) {
|
|
811
|
+
config.maxRetries = 0;
|
|
812
|
+
}
|
|
813
|
+
if (config.nonRetryableKinds.includes(action.kind)) {
|
|
814
|
+
return resolveEffect(action, harnessName, options, piSession, discovered, rl, json, askUserQuestionHandler);
|
|
815
|
+
}
|
|
816
|
+
let lastResult;
|
|
817
|
+
let currentPiSession = piSession;
|
|
818
|
+
for (let attempt = 0; attempt <= config.maxRetries; attempt += 1) {
|
|
819
|
+
try {
|
|
820
|
+
lastResult = await resolveEffect(action, harnessName, options, currentPiSession, discovered, rl, json, askUserQuestionHandler);
|
|
821
|
+
if (lastResult.status === "ok") {
|
|
822
|
+
return lastResult;
|
|
823
|
+
}
|
|
824
|
+
if (attempt >= config.maxRetries ||
|
|
825
|
+
!(0, effectsHelpers_1.isRetryableEffectError)(lastResult.error instanceof Error
|
|
826
|
+
? lastResult.error.message
|
|
827
|
+
: String(lastResult.error ?? ""))) {
|
|
828
|
+
return lastResult;
|
|
829
|
+
}
|
|
830
|
+
}
|
|
831
|
+
catch (error) {
|
|
832
|
+
if (attempt >= config.maxRetries || !(0, effectsHelpers_1.isRetryableEffectError)(error)) {
|
|
833
|
+
return {
|
|
834
|
+
status: "error",
|
|
835
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
836
|
+
stderr: error instanceof Error ? error.message : String(error),
|
|
837
|
+
};
|
|
838
|
+
}
|
|
839
|
+
lastResult = {
|
|
840
|
+
status: "error",
|
|
841
|
+
error: error instanceof Error ? error : new Error(String(error)),
|
|
842
|
+
};
|
|
843
|
+
}
|
|
844
|
+
process.stderr.write(`[babysitter] effect ${action.effectId ?? action.taskDef?.id ?? 'unknown'} retry ${attempt + 1}/${config.maxRetries}: ${lastResult?.error instanceof Error ? lastResult.error.message : String(lastResult?.error ?? 'unknown')}\n`);
|
|
845
|
+
const baseDelay = constants_1.EFFECT_RETRY_DELAYS_OVERRIDE
|
|
846
|
+
? (constants_1.EFFECT_RETRY_DELAYS_OVERRIDE[attempt] ?? 0)
|
|
847
|
+
: Math.min(config.baseDelayMs * Math.pow(config.backoffMultiplier, attempt), config.maxDelayMs);
|
|
848
|
+
const jitter = constants_1.EFFECT_RETRY_DELAYS_OVERRIDE
|
|
849
|
+
? 0
|
|
850
|
+
: baseDelay * 0.2 * (Math.random() * 2 - 1);
|
|
851
|
+
const delay = Math.max(0, Math.round(baseDelay + jitter));
|
|
852
|
+
if (currentPiSession && piSessionFactory) {
|
|
853
|
+
if (disposePiSession) {
|
|
854
|
+
await disposePiSession(currentPiSession);
|
|
855
|
+
}
|
|
856
|
+
else {
|
|
857
|
+
currentPiSession.dispose();
|
|
858
|
+
}
|
|
859
|
+
currentPiSession = piSessionFactory();
|
|
860
|
+
}
|
|
861
|
+
if (delay > 0) {
|
|
862
|
+
await new Promise((resolve) => setTimeout(resolve, delay));
|
|
863
|
+
}
|
|
864
|
+
}
|
|
865
|
+
return lastResult;
|
|
866
|
+
}
|
|
867
|
+
async function orchestrateIterationWithProcessLoadRetry(args) {
|
|
868
|
+
let attempt = 0;
|
|
869
|
+
for (;;) {
|
|
870
|
+
try {
|
|
871
|
+
return await (0, babysitter_sdk_1.orchestrateIteration)({
|
|
872
|
+
runDir: args.runDir,
|
|
873
|
+
subprocessSupport: "agent-platform",
|
|
874
|
+
});
|
|
875
|
+
}
|
|
876
|
+
catch (error) {
|
|
877
|
+
if (!(0, utils_1.isProcessModuleLoadFailure)(error) ||
|
|
878
|
+
attempt >= constants_1.PROCESS_MODULE_LOAD_RETRY_DELAYS_MS.length) {
|
|
879
|
+
throw error;
|
|
880
|
+
}
|
|
881
|
+
const delayMs = constants_1.PROCESS_MODULE_LOAD_RETRY_DELAYS_MS[attempt] ?? 0;
|
|
882
|
+
attempt += 1;
|
|
883
|
+
process.stderr.write(`[babysitter] process module load attempt ${attempt} failed: ${error instanceof Error ? error.message : String(error)}, retrying...\n`);
|
|
884
|
+
args.writeVerbose?.(`[phaseOrchestration retry] process module load failed for ${args.runDir}; retrying iteration import (attempt ${attempt}/${constants_1.PROCESS_MODULE_LOAD_RETRY_DELAYS_MS.length}) after ${delayMs}ms`);
|
|
885
|
+
args.writeVerboseData?.("phaseOrchestration retry cause", error instanceof Error
|
|
886
|
+
? {
|
|
887
|
+
name: error.name,
|
|
888
|
+
message: error.message,
|
|
889
|
+
stack: error.stack,
|
|
890
|
+
cause: error.cause instanceof Error
|
|
891
|
+
? {
|
|
892
|
+
name: error.cause.name,
|
|
893
|
+
message: error.cause.message,
|
|
894
|
+
stack: error.cause.stack,
|
|
895
|
+
}
|
|
896
|
+
: error.cause,
|
|
897
|
+
}
|
|
898
|
+
: error);
|
|
899
|
+
if (delayMs > 0) {
|
|
900
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
901
|
+
}
|
|
902
|
+
}
|
|
903
|
+
}
|
|
904
|
+
}
|