@a5c-ai/genty-platform 5.1.1-staging.0ad6ac75ae4a
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/utils.d.ts +28 -0
- package/dist/api/utils.d.ts.map +1 -0
- package/dist/api/utils.js +74 -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/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 +8 -0
- package/dist/context/instructions.d.ts.map +1 -0
- package/dist/context/instructions.js +77 -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 +164 -0
- package/dist/cost/types.d.ts.map +1 -0
- package/dist/cost/types.js +228 -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/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/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/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 +63 -0
- package/dist/harness/hostContract.d.ts.map +1 -0
- package/dist/harness/hostContract.js +136 -0
- package/dist/harness/index.d.ts +18 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +91 -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 +865 -0
- package/dist/harness/internal/createRun/orchestration/effectsHelpers.d.ts +20 -0
- package/dist/harness/internal/createRun/orchestration/effectsHelpers.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/effectsHelpers.js +79 -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 +276 -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/operatorCommands.d.ts +38 -0
- package/dist/harness/operatorCommands.d.ts.map +1 -0
- package/dist/harness/operatorCommands.js +118 -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/selectionPolicies.d.ts +29 -0
- package/dist/harness/selectionPolicies.d.ts.map +1 -0
- package/dist/harness/selectionPolicies.js +165 -0
- package/dist/harness/types.d.ts +276 -0
- package/dist/harness/types.d.ts.map +1 -0
- package/dist/harness/types.js +34 -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/index.d.ts +8 -0
- package/dist/interaction/index.d.ts.map +1 -0
- package/dist/interaction/index.js +28 -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/steering.d.ts +17 -0
- package/dist/interaction/steering.d.ts.map +1 -0
- package/dist/interaction/steering.js +41 -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/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 +12 -0
- package/dist/mcp/client/index.d.ts.map +1 -0
- package/dist/mcp/client/index.js +27 -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/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/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 +7 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +22 -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/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/index.d.ts +11 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +18 -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/sandbox.d.ts +38 -0
- package/dist/plugins/sandbox.d.ts.map +1 -0
- package/dist/plugins/sandbox.js +109 -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/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/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/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 +7 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +70 -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/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,247 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Agent-core internal loop utilities.
|
|
4
|
+
*
|
|
5
|
+
* Prompt retry logic, session options builder, timeout constants, and
|
|
6
|
+
* metadata helpers used by the createRun orchestration phases.
|
|
7
|
+
*
|
|
8
|
+
* Previously lived in pi.ts — renamed to reflect that these are generic
|
|
9
|
+
* agent-core concerns, not Pi-specific.
|
|
10
|
+
*/
|
|
11
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
12
|
+
if (k2 === undefined) k2 = k;
|
|
13
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
14
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
15
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
16
|
+
}
|
|
17
|
+
Object.defineProperty(o, k2, desc);
|
|
18
|
+
}) : (function(o, m, k, k2) {
|
|
19
|
+
if (k2 === undefined) k2 = k;
|
|
20
|
+
o[k2] = m[k];
|
|
21
|
+
}));
|
|
22
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
23
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
24
|
+
}) : function(o, v) {
|
|
25
|
+
o["default"] = v;
|
|
26
|
+
});
|
|
27
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
28
|
+
var ownKeys = function(o) {
|
|
29
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
30
|
+
var ar = [];
|
|
31
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
32
|
+
return ar;
|
|
33
|
+
};
|
|
34
|
+
return ownKeys(o);
|
|
35
|
+
};
|
|
36
|
+
return function (mod) {
|
|
37
|
+
if (mod && mod.__esModule) return mod;
|
|
38
|
+
var result = {};
|
|
39
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
40
|
+
__setModuleDefault(result, mod);
|
|
41
|
+
return result;
|
|
42
|
+
};
|
|
43
|
+
})();
|
|
44
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
45
|
+
exports.WORKER_TIMEOUT_MS = exports.DEFAULT_PROMPT_TIMEOUT_MS = exports.PARENT_PROMPT_TIMEOUT_MS = exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS = void 0;
|
|
46
|
+
exports.readBooleanMetadata = readBooleanMetadata;
|
|
47
|
+
exports.readBashSandboxMetadata = readBashSandboxMetadata;
|
|
48
|
+
exports.readStringMetadata = readStringMetadata;
|
|
49
|
+
exports.isProcessModuleLoadFailure = isProcessModuleLoadFailure;
|
|
50
|
+
exports.isRetryablePromptFailure = isRetryablePromptFailure;
|
|
51
|
+
exports.isIgnorablePromptFailure = isIgnorablePromptFailure;
|
|
52
|
+
exports.promptWithRetry = promptWithRetry;
|
|
53
|
+
exports.buildWorkerSessionOptions = buildWorkerSessionOptions;
|
|
54
|
+
exports.resolveAgentCoreBackendForHarness = resolveAgentCoreBackendForHarness;
|
|
55
|
+
const path = __importStar(require("node:path"));
|
|
56
|
+
const node_fs_1 = require("node:fs");
|
|
57
|
+
const adapterHarnessMap_1 = require("../../adapters/adapterHarnessMap");
|
|
58
|
+
const builtInHarness_1 = require("../../builtInHarness");
|
|
59
|
+
// ---------------------------------------------------------------------------
|
|
60
|
+
// Timeout constants
|
|
61
|
+
// ---------------------------------------------------------------------------
|
|
62
|
+
exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS = process.env.VITEST
|
|
63
|
+
? [0, 0]
|
|
64
|
+
: [1_000, 3_000];
|
|
65
|
+
exports.PARENT_PROMPT_TIMEOUT_MS = 900_000;
|
|
66
|
+
exports.DEFAULT_PROMPT_TIMEOUT_MS = 900_000;
|
|
67
|
+
exports.WORKER_TIMEOUT_MS = 1_800_000;
|
|
68
|
+
// ---------------------------------------------------------------------------
|
|
69
|
+
// Metadata helpers
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
function readBooleanMetadata(metadata, key) {
|
|
72
|
+
const value = metadata?.[key];
|
|
73
|
+
if (typeof value === "boolean") {
|
|
74
|
+
return value;
|
|
75
|
+
}
|
|
76
|
+
if (value === "true") {
|
|
77
|
+
return true;
|
|
78
|
+
}
|
|
79
|
+
if (value === "false") {
|
|
80
|
+
return false;
|
|
81
|
+
}
|
|
82
|
+
return undefined;
|
|
83
|
+
}
|
|
84
|
+
function readBashSandboxMetadata(metadata) {
|
|
85
|
+
const value = metadata?.bashSandbox;
|
|
86
|
+
return value === "auto" || value === "secure" || value === "local"
|
|
87
|
+
? value
|
|
88
|
+
: undefined;
|
|
89
|
+
}
|
|
90
|
+
function readStringMetadata(metadata, key) {
|
|
91
|
+
const value = metadata?.[key];
|
|
92
|
+
return typeof value === "string" ? value : undefined;
|
|
93
|
+
}
|
|
94
|
+
// ---------------------------------------------------------------------------
|
|
95
|
+
// Error classification
|
|
96
|
+
// ---------------------------------------------------------------------------
|
|
97
|
+
function isProcessModuleLoadFailure(error) {
|
|
98
|
+
return error instanceof Error && /^Failed to load process module at /.test(error.message);
|
|
99
|
+
}
|
|
100
|
+
function isRetryablePromptFailure(error) {
|
|
101
|
+
const message = typeof error === "string"
|
|
102
|
+
? error
|
|
103
|
+
: error instanceof Error
|
|
104
|
+
? error.message
|
|
105
|
+
: typeof error === "object" && error !== null && "output" in error
|
|
106
|
+
? String(error.output ?? "")
|
|
107
|
+
: "";
|
|
108
|
+
if (!message) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
const normalized = message.toLowerCase();
|
|
112
|
+
return normalized.includes("the server had an error processing your request") ||
|
|
113
|
+
normalized.includes("please retry your request") ||
|
|
114
|
+
normalized.includes("temporarily unavailable") ||
|
|
115
|
+
normalized.includes("rate limit") ||
|
|
116
|
+
normalized.includes("too many requests") ||
|
|
117
|
+
normalized.includes("pitimeouterror") ||
|
|
118
|
+
normalized.includes("prompt timed out") ||
|
|
119
|
+
normalized.includes("deadline exceeded") ||
|
|
120
|
+
normalized.includes("already processing");
|
|
121
|
+
}
|
|
122
|
+
function isIgnorablePromptFailure(output) {
|
|
123
|
+
return output.includes("msg.content.filter is not a function");
|
|
124
|
+
}
|
|
125
|
+
async function promptWithRetry(args) {
|
|
126
|
+
let attempt = 0;
|
|
127
|
+
for (;;) {
|
|
128
|
+
try {
|
|
129
|
+
const result = await args.session.prompt(args.message, args.timeout);
|
|
130
|
+
if (result.success ||
|
|
131
|
+
!isRetryablePromptFailure(result.output) ||
|
|
132
|
+
attempt >= exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS.length) {
|
|
133
|
+
return result;
|
|
134
|
+
}
|
|
135
|
+
const delayMs = exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS[attempt] ?? 0;
|
|
136
|
+
if (attempt === 0)
|
|
137
|
+
process.stderr.write(`[babysitter] ${args.label}: transient failure, retrying...\n`);
|
|
138
|
+
attempt += 1;
|
|
139
|
+
args.writeVerbose?.(`[${args.label} retry] transient failure; retrying prompt attempt ${attempt}/${exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS.length} after ${delayMs}ms`);
|
|
140
|
+
args.writeVerboseData?.(`${args.label} retry failure output`, result.output);
|
|
141
|
+
if (delayMs > 0) {
|
|
142
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch (error) {
|
|
146
|
+
if (!isRetryablePromptFailure(error) || attempt >= exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS.length) {
|
|
147
|
+
throw error;
|
|
148
|
+
}
|
|
149
|
+
const delayMs = exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS[attempt] ?? 0;
|
|
150
|
+
if (attempt === 0)
|
|
151
|
+
process.stderr.write(`[babysitter] ${args.label}: transient failure, retrying...\n`);
|
|
152
|
+
attempt += 1;
|
|
153
|
+
args.writeVerbose?.(`[${args.label} retry] transient exception; retrying prompt attempt ${attempt}/${exports.TRANSIENT_PROMPT_RETRY_DELAYS_MS.length} after ${delayMs}ms`);
|
|
154
|
+
args.writeVerboseData?.(`${args.label} retry error`, error);
|
|
155
|
+
if (delayMs > 0) {
|
|
156
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// ---------------------------------------------------------------------------
|
|
162
|
+
// Worker session options
|
|
163
|
+
// ---------------------------------------------------------------------------
|
|
164
|
+
function buildWorkerSessionOptions(args) {
|
|
165
|
+
const metadata = args.action.taskDef?.metadata;
|
|
166
|
+
const isolated = readBooleanMetadata(metadata, "isolated");
|
|
167
|
+
const enableCompaction = readBooleanMetadata(metadata, "enableCompaction");
|
|
168
|
+
const effectiveModel = args.delegationConfig?.model ?? args.model;
|
|
169
|
+
const effectiveTimeout = args.delegationConfig?.timeout ?? exports.WORKER_TIMEOUT_MS;
|
|
170
|
+
const effectiveToolsMode = args.delegationConfig?.toolsMode
|
|
171
|
+
?? readStringMetadata(metadata, "toolsMode")
|
|
172
|
+
?? "coding";
|
|
173
|
+
const rawThinkingLevel = args.delegationConfig?.thinkingLevel
|
|
174
|
+
?? readStringMetadata(metadata, "thinkingLevel");
|
|
175
|
+
const effectiveThinkingLevel = rawThinkingLevel === "none" ? undefined : rawThinkingLevel;
|
|
176
|
+
const effectiveBashSandbox = args.delegationConfig?.bashSandbox
|
|
177
|
+
?? readBashSandboxMetadata(metadata);
|
|
178
|
+
let appendSystemPrompt;
|
|
179
|
+
const skillNames = args.delegationConfig?.skills ?? metadata?.skills;
|
|
180
|
+
if (skillNames?.length) {
|
|
181
|
+
const skillContents = [];
|
|
182
|
+
for (const skillName of skillNames) {
|
|
183
|
+
try {
|
|
184
|
+
const candidates = [
|
|
185
|
+
path.join(args.workspace ?? process.cwd(), ".a5c", "skills", skillName, "SKILL.md"),
|
|
186
|
+
path.join(args.workspace ?? process.cwd(), ".claude", "plugins", skillName, "SKILL.md"),
|
|
187
|
+
];
|
|
188
|
+
for (const candidate of candidates) {
|
|
189
|
+
if ((0, node_fs_1.existsSync)(candidate)) {
|
|
190
|
+
skillContents.push((0, node_fs_1.readFileSync)(candidate, "utf8"));
|
|
191
|
+
break;
|
|
192
|
+
}
|
|
193
|
+
}
|
|
194
|
+
}
|
|
195
|
+
catch { /* skip missing skills */ }
|
|
196
|
+
}
|
|
197
|
+
if (skillContents.length) {
|
|
198
|
+
appendSystemPrompt = [skillContents.join("\n\n---\n\n")];
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
const subagentName = args.delegationConfig?.subagentName ?? readStringMetadata(metadata, "subagentName");
|
|
202
|
+
let agentDir;
|
|
203
|
+
if (subagentName) {
|
|
204
|
+
const candidates = [
|
|
205
|
+
path.join(args.workspace ?? process.cwd(), ".claude", "agents", subagentName),
|
|
206
|
+
];
|
|
207
|
+
for (const candidate of candidates) {
|
|
208
|
+
if ((0, node_fs_1.existsSync)(candidate)) {
|
|
209
|
+
agentDir = candidate;
|
|
210
|
+
break;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
workspace: args.workspace,
|
|
216
|
+
model: effectiveModel,
|
|
217
|
+
timeout: effectiveTimeout,
|
|
218
|
+
toolsMode: effectiveToolsMode,
|
|
219
|
+
ephemeral: true,
|
|
220
|
+
...(args.customTools?.length ? { customTools: args.customTools } : {}),
|
|
221
|
+
...(isolated !== undefined ? { isolated } : {}),
|
|
222
|
+
...(enableCompaction !== undefined ? { enableCompaction } : {}),
|
|
223
|
+
...(effectiveBashSandbox ? { bashSandbox: effectiveBashSandbox } : {}),
|
|
224
|
+
...(effectiveThinkingLevel ? { thinkingLevel: effectiveThinkingLevel } : {}),
|
|
225
|
+
...(appendSystemPrompt ? { appendSystemPrompt } : {}),
|
|
226
|
+
...(agentDir ? { agentDir } : {}),
|
|
227
|
+
};
|
|
228
|
+
}
|
|
229
|
+
// ---------------------------------------------------------------------------
|
|
230
|
+
// Harness → backend resolution
|
|
231
|
+
// ---------------------------------------------------------------------------
|
|
232
|
+
function resolveAgentCoreBackendForHarness(harnessName) {
|
|
233
|
+
const normalizedHarness = (0, builtInHarness_1.normalizeBuiltInHarnessName)(harnessName?.trim() ?? "");
|
|
234
|
+
if (!normalizedHarness) {
|
|
235
|
+
return undefined;
|
|
236
|
+
}
|
|
237
|
+
if (normalizedHarness === "agent-core") {
|
|
238
|
+
return "agent-core";
|
|
239
|
+
}
|
|
240
|
+
if (normalizedHarness === "pi") {
|
|
241
|
+
return "pi";
|
|
242
|
+
}
|
|
243
|
+
if ((0, adapterHarnessMap_1.hasAmuxAdapter)(normalizedHarness)) {
|
|
244
|
+
return (0, adapterHarnessMap_1.mapHarnessToAmuxAdapter)(normalizedHarness);
|
|
245
|
+
}
|
|
246
|
+
return normalizedHarness;
|
|
247
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as readline from "node:readline";
|
|
2
|
+
import { type AskUserQuestionRequest, type AskUserQuestionResponse } from "../../../interaction";
|
|
3
|
+
import type { AskUserQuestionToolContext, OutputMode, ToolResultShape } from "./utils";
|
|
4
|
+
export declare const DEFAULT_INTERACTIVE_ASK_TIMEOUT_MS = 600000;
|
|
5
|
+
export declare function createReadlineInterface(): readline.Interface;
|
|
6
|
+
export declare function askLine(rl: readline.Interface, promptText: string): Promise<string | null>;
|
|
7
|
+
export declare function readInteractivePrompt(rl: readline.Interface, outputMode?: OutputMode): Promise<string | null>;
|
|
8
|
+
export declare function formatToolResult(data: unknown, message?: string): ToolResultShape;
|
|
9
|
+
export declare function isApprovalAskRequest(request: AskUserQuestionRequest): boolean;
|
|
10
|
+
export declare function askUserQuestionViaTool(request: AskUserQuestionRequest, interactive: boolean, rl: readline.Interface | null, toolContext?: AskUserQuestionToolContext): Promise<AskUserQuestionResponse>;
|
|
11
|
+
//# sourceMappingURL=askUserQuestion.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"askUserQuestion.d.ts","sourceRoot":"","sources":["../../../../src/harness/internal/createRun/askUserQuestion.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,QAAQ,MAAM,eAAe,CAAC;AAC1C,OAAO,EAML,KAAK,sBAAsB,EAC3B,KAAK,uBAAuB,EAC7B,MAAM,sBAAsB,CAAC;AAO9B,OAAO,KAAK,EACV,0BAA0B,EAC1B,UAAU,EACV,eAAe,EAChB,MAAM,SAAS,CAAC;AAEjB,eAAO,MAAM,kCAAkC,SAAU,CAAC;AAE1D,wBAAgB,uBAAuB,IAAI,QAAQ,CAAC,SAAS,CAM5D;AAED,wBAAgB,OAAO,CACrB,EAAE,EAAE,QAAQ,CAAC,SAAS,EACtB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAOxB;AAED,wBAAsB,qBAAqB,CACzC,EAAE,EAAE,QAAQ,CAAC,SAAS,EACtB,UAAU,CAAC,EAAE,UAAU,GACtB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CA2BxB;AAED,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,OAAO,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,eAAe,CAoBjF;AAED,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,sBAAsB,GAAG,OAAO,CAU7E;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,sBAAsB,EAC/B,WAAW,EAAE,OAAO,EACpB,EAAE,EAAE,QAAQ,CAAC,SAAS,GAAG,IAAI,EAC7B,WAAW,CAAC,EAAE,0BAA0B,GACvC,OAAO,CAAC,uBAAuB,CAAC,CA+ClC"}
|
|
@@ -0,0 +1,162 @@
|
|
|
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.DEFAULT_INTERACTIVE_ASK_TIMEOUT_MS = void 0;
|
|
37
|
+
exports.createReadlineInterface = createReadlineInterface;
|
|
38
|
+
exports.askLine = askLine;
|
|
39
|
+
exports.readInteractivePrompt = readInteractivePrompt;
|
|
40
|
+
exports.formatToolResult = formatToolResult;
|
|
41
|
+
exports.isApprovalAskRequest = isApprovalAskRequest;
|
|
42
|
+
exports.askUserQuestionViaTool = askUserQuestionViaTool;
|
|
43
|
+
const readline = __importStar(require("node:readline"));
|
|
44
|
+
const interaction_1 = require("../../../interaction");
|
|
45
|
+
const output_1 = require("./output");
|
|
46
|
+
exports.DEFAULT_INTERACTIVE_ASK_TIMEOUT_MS = 600_000;
|
|
47
|
+
function createReadlineInterface() {
|
|
48
|
+
return readline.createInterface({
|
|
49
|
+
input: process.stdin,
|
|
50
|
+
output: process.stderr,
|
|
51
|
+
terminal: true,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
function askLine(rl, promptText) {
|
|
55
|
+
return new Promise((resolve) => {
|
|
56
|
+
rl.question(`${promptText} `, (answer) => {
|
|
57
|
+
resolve(answer);
|
|
58
|
+
});
|
|
59
|
+
rl.once("close", () => resolve(null));
|
|
60
|
+
});
|
|
61
|
+
}
|
|
62
|
+
async function readInteractivePrompt(rl, outputMode) {
|
|
63
|
+
if (outputMode === "tui")
|
|
64
|
+
return null;
|
|
65
|
+
process.stderr.write("\n");
|
|
66
|
+
process.stderr.write(`${output_1.BOLD}${output_1.CYAN}agent-platform create-run${output_1.RESET}\n`);
|
|
67
|
+
process.stderr.write(`${output_1.DIM}Enter your request below. Press Enter to submit.${output_1.RESET}\n`);
|
|
68
|
+
process.stderr.write(`${output_1.DIM}(Use \\ at end of line for multi-line input, Ctrl+C to cancel)${output_1.RESET}\n\n`);
|
|
69
|
+
const lines = [];
|
|
70
|
+
for (;;) {
|
|
71
|
+
const line = await askLine(rl, lines.length === 0 ? ">" : "...");
|
|
72
|
+
if (line === null)
|
|
73
|
+
return null;
|
|
74
|
+
if (line.endsWith("\\")) {
|
|
75
|
+
lines.push(line.slice(0, -1));
|
|
76
|
+
continue;
|
|
77
|
+
}
|
|
78
|
+
lines.push(line);
|
|
79
|
+
const combined = lines.join("\n").trim();
|
|
80
|
+
if (combined)
|
|
81
|
+
return combined;
|
|
82
|
+
lines.length = 0;
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
function formatToolResult(data, message) {
|
|
86
|
+
if (typeof data === "string") {
|
|
87
|
+
return {
|
|
88
|
+
content: [{
|
|
89
|
+
type: "text",
|
|
90
|
+
text: message ? `${message}\n${data}` : data,
|
|
91
|
+
}],
|
|
92
|
+
details: data,
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
const content = message
|
|
96
|
+
? `${message}\n${JSON.stringify(data, null, 2)}`
|
|
97
|
+
: JSON.stringify(data, null, 2);
|
|
98
|
+
return {
|
|
99
|
+
content: [{
|
|
100
|
+
type: "text",
|
|
101
|
+
text: content,
|
|
102
|
+
}],
|
|
103
|
+
details: data,
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function isApprovalAskRequest(request) {
|
|
107
|
+
const question = request.questions[0];
|
|
108
|
+
if (!question || request.questions.length !== 1 || !question.options) {
|
|
109
|
+
return false;
|
|
110
|
+
}
|
|
111
|
+
const labels = question.options.map((option) => option.label);
|
|
112
|
+
return labels.length === 2 &&
|
|
113
|
+
labels[0] === "Approve" &&
|
|
114
|
+
labels[1] === "Reject" &&
|
|
115
|
+
question.allowOther === false;
|
|
116
|
+
}
|
|
117
|
+
async function askUserQuestionViaTool(request, interactive, rl, toolContext) {
|
|
118
|
+
const effectiveRequest = interactive && request.timeout == null
|
|
119
|
+
? {
|
|
120
|
+
...request,
|
|
121
|
+
timeout: exports.DEFAULT_INTERACTIVE_ASK_TIMEOUT_MS,
|
|
122
|
+
}
|
|
123
|
+
: request;
|
|
124
|
+
(0, interaction_1.validateAskUserQuestionRequest)(effectiveRequest);
|
|
125
|
+
if (interactive) {
|
|
126
|
+
try {
|
|
127
|
+
if (toolContext?.hasUI && toolContext.ui) {
|
|
128
|
+
return await (0, interaction_1.promptAskUserQuestionWithUiContext)(toolContext.ui, effectiveRequest);
|
|
129
|
+
}
|
|
130
|
+
if (rl) {
|
|
131
|
+
return await (0, interaction_1.promptAskUserQuestionWithReadline)(rl, effectiveRequest);
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
catch {
|
|
135
|
+
return (0, interaction_1.createDefaultAskUserQuestionResponse)(effectiveRequest);
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
const answers = {};
|
|
139
|
+
for (const [index, question] of effectiveRequest.questions.entries()) {
|
|
140
|
+
const key = question.header?.trim() || `Question ${index + 1}`;
|
|
141
|
+
if (question.recommended != null &&
|
|
142
|
+
question.options &&
|
|
143
|
+
question.options[question.recommended]) {
|
|
144
|
+
answers[key] = question.options[question.recommended].label;
|
|
145
|
+
}
|
|
146
|
+
else {
|
|
147
|
+
answers[key] = "";
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
if (isApprovalAskRequest(effectiveRequest)) {
|
|
151
|
+
const key = effectiveRequest.questions[0]?.header?.trim() || "Decision";
|
|
152
|
+
const rec = effectiveRequest.questions[0]?.recommended;
|
|
153
|
+
const opts = effectiveRequest.questions[0]?.options;
|
|
154
|
+
if (rec != null && opts && opts[rec]) {
|
|
155
|
+
answers[key] = opts[rec].label;
|
|
156
|
+
}
|
|
157
|
+
else {
|
|
158
|
+
answers[key] = "Approve";
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return (0, interaction_1.createAskUserQuestionResponse)(effectiveRequest, answers);
|
|
162
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* create-run command handler.
|
|
3
|
+
*
|
|
4
|
+
* Drives a full babysitter session lifecycle through three conceptual phases:
|
|
5
|
+
* PhaseUnderstandIntent - clarify intent and inspect the workspace
|
|
6
|
+
* PhasePlanProcess - author the process and establish the run
|
|
7
|
+
* PhaseOrchestration - drive the bound orchestration loop
|
|
8
|
+
*
|
|
9
|
+
* Both phases are driven through a Pi agent session and LLM-callable tools.
|
|
10
|
+
* Interactive user input is exposed through an AskUserQuestion tool instead of
|
|
11
|
+
* direct imperative prompts inside the host loop.
|
|
12
|
+
*
|
|
13
|
+
* This module is a thin coordinator that imports the phase implementations
|
|
14
|
+
* from separate modules and exports the public API.
|
|
15
|
+
*/
|
|
16
|
+
import { type HarnessCreateRunArgs } from "./utils";
|
|
17
|
+
export type { HarnessCreateRunArgs } from "./utils";
|
|
18
|
+
/** @deprecated Use HarnessCreateRunArgs instead */
|
|
19
|
+
export type { HarnessCreateRunArgs as SessionCreateArgs } from "./utils";
|
|
20
|
+
export { selectHarness } from "./utils";
|
|
21
|
+
export { runOrchestrationPhase } from "./orchestration";
|
|
22
|
+
export declare function handleHarnessCreateRun(parsed: HarnessCreateRunArgs): Promise<number>;
|
|
23
|
+
/** @deprecated Use handleHarnessCreateRun instead */
|
|
24
|
+
export declare const handleSessionCreate: typeof handleHarnessCreateRun;
|
|
25
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/harness/internal/createRun/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;GAcG;AAEH,OAAO,EACL,KAAK,oBAAoB,EAc1B,MAAM,SAAS,CAAC;AAUjB,YAAY,EAAE,oBAAoB,EAAE,MAAM,SAAS,CAAC;AACpD,mDAAmD;AACnD,YAAY,EAAE,oBAAoB,IAAI,iBAAiB,EAAE,MAAM,SAAS,CAAC;AACzE,OAAO,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACxC,OAAO,EAAE,qBAAqB,EAAE,MAAM,iBAAiB,CAAC;AAIxD,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,oBAAoB,GAC3B,OAAO,CAAC,MAAM,CAAC,CAwHjB;AA4BD,qDAAqD;AACrD,eAAO,MAAM,mBAAmB,+BAAyB,CAAC"}
|
|
@@ -0,0 +1,163 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* create-run command handler.
|
|
4
|
+
*
|
|
5
|
+
* Drives a full babysitter session lifecycle through three conceptual phases:
|
|
6
|
+
* PhaseUnderstandIntent - clarify intent and inspect the workspace
|
|
7
|
+
* PhasePlanProcess - author the process and establish the run
|
|
8
|
+
* PhaseOrchestration - drive the bound orchestration loop
|
|
9
|
+
*
|
|
10
|
+
* Both phases are driven through a Pi agent session and LLM-callable tools.
|
|
11
|
+
* Interactive user input is exposed through an AskUserQuestion tool instead of
|
|
12
|
+
* direct imperative prompts inside the host loop.
|
|
13
|
+
*
|
|
14
|
+
* This module is a thin coordinator that imports the phase implementations
|
|
15
|
+
* from separate modules and exports the public API.
|
|
16
|
+
*/
|
|
17
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
18
|
+
exports.handleSessionCreate = exports.runOrchestrationPhase = exports.selectHarness = void 0;
|
|
19
|
+
exports.handleHarnessCreateRun = handleHarnessCreateRun;
|
|
20
|
+
const utils_1 = require("./utils");
|
|
21
|
+
const babysitter_sdk_1 = require("@a5c-ai/babysitter-sdk");
|
|
22
|
+
const planProcess_1 = require("./planProcess");
|
|
23
|
+
const orchestration_1 = require("./orchestration");
|
|
24
|
+
const builtInHarness_1 = require("../../builtInHarness");
|
|
25
|
+
const history_1 = require("../../../session/history");
|
|
26
|
+
var utils_2 = require("./utils");
|
|
27
|
+
Object.defineProperty(exports, "selectHarness", { enumerable: true, get: function () { return utils_2.selectHarness; } });
|
|
28
|
+
var orchestration_2 = require("./orchestration");
|
|
29
|
+
Object.defineProperty(exports, "runOrchestrationPhase", { enumerable: true, get: function () { return orchestration_2.runOrchestrationPhase; } });
|
|
30
|
+
// ── Main Entry Point ─────────────────────────────────────────────────
|
|
31
|
+
async function handleHarnessCreateRun(parsed) {
|
|
32
|
+
const { prompt: initialPrompt, harness: preferredHarness, processPath: providedProcessPath, workspace, model, maxIterations = babysitter_sdk_1.DEFAULTS.maxIterations, runsDir: requestedRunsDir, json, verbose, } = parsed;
|
|
33
|
+
const runsDir = requestedRunsDir ?? (0, babysitter_sdk_1.resolveRunsDir)({ cwd: workspace ?? process.cwd() });
|
|
34
|
+
const mode = (0, utils_1.resolveOutputMode)(json, parsed.outputMode);
|
|
35
|
+
const interactive = parsed.interactive ?? (mode === "cli" && process.stdin.isTTY === true);
|
|
36
|
+
// TUI and adapters-events modes: never create a readline interface
|
|
37
|
+
const rl = (interactive && mode !== "tui" && mode !== "adapters-events") ? (0, utils_1.createReadlineInterface)() : null;
|
|
38
|
+
try {
|
|
39
|
+
let prompt = initialPrompt;
|
|
40
|
+
if (!prompt && !providedProcessPath) {
|
|
41
|
+
if (interactive && rl) {
|
|
42
|
+
const userPrompt = await (0, utils_1.readInteractivePrompt)(rl, mode);
|
|
43
|
+
if (!userPrompt) {
|
|
44
|
+
return 0; // User cancelled
|
|
45
|
+
}
|
|
46
|
+
prompt = userPrompt;
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
const error = "Either --prompt or --process must be provided";
|
|
50
|
+
if (mode === "json") {
|
|
51
|
+
console.error(JSON.stringify({ error: "MISSING_PROMPT", message: error }, null, 2));
|
|
52
|
+
}
|
|
53
|
+
else if (mode === "cli") {
|
|
54
|
+
process.stderr.write(`${utils_1.RED}Error:${utils_1.RESET} ${error}\n`);
|
|
55
|
+
}
|
|
56
|
+
return 1;
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
const discovered = await (0, utils_1.discoverHarnesses)();
|
|
60
|
+
const selectedHarnessName = (0, builtInHarness_1.normalizeBuiltInHarnessName)(preferredHarness ?? "agent-core");
|
|
61
|
+
const compressionConfig = (0, utils_1.loadSessionCompressionConfig)(workspace);
|
|
62
|
+
const sessionContext = await loadPromptSessionContext(selectedHarnessName);
|
|
63
|
+
const promptContext = (0, utils_1.buildPromptContext)({
|
|
64
|
+
workspace,
|
|
65
|
+
selectedHarnessName,
|
|
66
|
+
discovered,
|
|
67
|
+
compressionConfig,
|
|
68
|
+
sessionContext,
|
|
69
|
+
});
|
|
70
|
+
let processPath = providedProcessPath;
|
|
71
|
+
let planningConversationSummary;
|
|
72
|
+
if (processPath) {
|
|
73
|
+
(0, utils_1.emitProgress)({ phase: "1", status: "skipped", processPath }, json, verbose, mode);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const workDir = workspace ?? process.cwd();
|
|
77
|
+
const planReport = await (0, planProcess_1.runPlanProcessPhase)({
|
|
78
|
+
invocationCommand: parsed.invocationCommand,
|
|
79
|
+
prompt: prompt,
|
|
80
|
+
outputDir: (0, planProcess_1.getProcessOutputDir)(workDir),
|
|
81
|
+
workspace: workDir,
|
|
82
|
+
model,
|
|
83
|
+
runsDir,
|
|
84
|
+
maxIterations,
|
|
85
|
+
createRunOnReport: !parsed.planOnly,
|
|
86
|
+
interactive,
|
|
87
|
+
rl,
|
|
88
|
+
json,
|
|
89
|
+
verbose,
|
|
90
|
+
compressionConfig,
|
|
91
|
+
promptContext,
|
|
92
|
+
selectedHarnessName,
|
|
93
|
+
outputMode: mode,
|
|
94
|
+
});
|
|
95
|
+
processPath = planReport.processPath;
|
|
96
|
+
planningConversationSummary = planReport.conversationSummary;
|
|
97
|
+
parsed.existingRunId ??= planReport.runId;
|
|
98
|
+
parsed.existingRunDir ??= planReport.runDir;
|
|
99
|
+
parsed.existingSessionBound ??= planReport.sessionBound;
|
|
100
|
+
}
|
|
101
|
+
if (parsed.planOnly) {
|
|
102
|
+
(0, utils_1.emitProgress)({ phase: "2", status: "skipped-plan-only", processPath }, json, verbose, mode);
|
|
103
|
+
if (mode === "json") {
|
|
104
|
+
process.stdout.write(JSON.stringify({ ok: true, planOnly: true, processPath }) + "\n");
|
|
105
|
+
}
|
|
106
|
+
else if (mode === "cli") {
|
|
107
|
+
process.stderr.write(`${utils_1.GREEN}Process definition created: ${utils_1.BOLD}${processPath}${utils_1.RESET}\n`);
|
|
108
|
+
process.stderr.write(`${utils_1.DIM}Run /babysitter:call or agent-platform create-run --process ${processPath} to execute.${utils_1.RESET}\n`);
|
|
109
|
+
}
|
|
110
|
+
return 0;
|
|
111
|
+
}
|
|
112
|
+
return await (0, orchestration_1.runOrchestrationPhase)({
|
|
113
|
+
invocationCommand: parsed.invocationCommand,
|
|
114
|
+
processPath,
|
|
115
|
+
prompt,
|
|
116
|
+
workspace,
|
|
117
|
+
model,
|
|
118
|
+
runsDir,
|
|
119
|
+
maxIterations,
|
|
120
|
+
json,
|
|
121
|
+
verbose,
|
|
122
|
+
interactive,
|
|
123
|
+
rl,
|
|
124
|
+
selectedHarnessName,
|
|
125
|
+
discovered,
|
|
126
|
+
compressionConfig,
|
|
127
|
+
promptContext,
|
|
128
|
+
existingRunId: parsed.existingRunId,
|
|
129
|
+
existingRunDir: parsed.existingRunDir,
|
|
130
|
+
existingSessionBound: parsed.existingSessionBound,
|
|
131
|
+
planningConversationSummary,
|
|
132
|
+
outputMode: mode,
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
finally {
|
|
136
|
+
rl?.close();
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
async function loadPromptSessionContext(selectedHarnessName) {
|
|
140
|
+
const adapter = (0, babysitter_sdk_1.getAdapterByName)(selectedHarnessName);
|
|
141
|
+
if (!adapter) {
|
|
142
|
+
return undefined;
|
|
143
|
+
}
|
|
144
|
+
const sessionId = adapter.resolveSessionId({});
|
|
145
|
+
if (!sessionId) {
|
|
146
|
+
return undefined;
|
|
147
|
+
}
|
|
148
|
+
const pluginRoot = adapter.resolvePluginRoot({});
|
|
149
|
+
const stateDir = adapter.resolveStateDir({ pluginRoot });
|
|
150
|
+
if (!stateDir) {
|
|
151
|
+
return undefined;
|
|
152
|
+
}
|
|
153
|
+
const history = await (0, history_1.getSessionHistory)(stateDir, sessionId);
|
|
154
|
+
const hasContext = history.notes.length > 0
|
|
155
|
+
|| Object.keys(history.sharedKnowledge).length > 0
|
|
156
|
+
|| Boolean(history.worktree)
|
|
157
|
+
|| history.decisions.length > 0
|
|
158
|
+
|| history.runSummaries.length > 0
|
|
159
|
+
|| history.contextSnapshots.length > 0;
|
|
160
|
+
return hasContext ? history : undefined;
|
|
161
|
+
}
|
|
162
|
+
/** @deprecated Use handleHarnessCreateRun instead */
|
|
163
|
+
exports.handleSessionCreate = handleHarnessCreateRun;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const PROCESS_MODULE_LOAD_RETRY_DELAYS_MS: number[];
|
|
2
|
+
export declare const MAX_CONSECUTIVE_TIMEOUTS = 3;
|
|
3
|
+
export declare const MAX_CONSECUTIVE_STALLS = 5;
|
|
4
|
+
export declare const MAX_CONSECUTIVE_PROCESS_ERROR_STALLS = 5;
|
|
5
|
+
export declare const MAX_PROCESS_ERROR_RECOVERIES = 5;
|
|
6
|
+
export declare const EFFECT_RETRY_DELAYS_OVERRIDE: number[] | undefined;
|
|
7
|
+
//# sourceMappingURL=constants.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/orchestration/constants.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,mCAAmC,UAE7B,CAAC;AAGpB,eAAO,MAAM,wBAAwB,IAAI,CAAC;AAE1C,eAAO,MAAM,sBAAsB,IAAI,CAAC;AAExC,eAAO,MAAM,oCAAoC,IAAI,CAAC;AAEtD,eAAO,MAAM,4BAA4B,IAAI,CAAC;AAE9C,eAAO,MAAM,4BAA4B,sBAE5B,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.EFFECT_RETRY_DELAYS_OVERRIDE = exports.MAX_PROCESS_ERROR_RECOVERIES = exports.MAX_CONSECUTIVE_PROCESS_ERROR_STALLS = exports.MAX_CONSECUTIVE_STALLS = exports.MAX_CONSECUTIVE_TIMEOUTS = exports.PROCESS_MODULE_LOAD_RETRY_DELAYS_MS = void 0;
|
|
4
|
+
exports.PROCESS_MODULE_LOAD_RETRY_DELAYS_MS = process.env.VITEST
|
|
5
|
+
? [0, 0]
|
|
6
|
+
: [100, 250, 500];
|
|
7
|
+
// Max consecutive API timeouts before aborting the run (prevents infinite wait on unresponsive provider)
|
|
8
|
+
exports.MAX_CONSECUTIVE_TIMEOUTS = 3;
|
|
9
|
+
// Max consecutive iterations where no progress is made (effect dispatched but not resolved)
|
|
10
|
+
exports.MAX_CONSECUTIVE_STALLS = 5;
|
|
11
|
+
// Max consecutive iterations where the process itself errors (distinct from API/effect errors)
|
|
12
|
+
exports.MAX_CONSECUTIVE_PROCESS_ERROR_STALLS = 5;
|
|
13
|
+
// Total process-error recoveries allowed across the entire run lifetime
|
|
14
|
+
exports.MAX_PROCESS_ERROR_RECOVERIES = 5;
|
|
15
|
+
exports.EFFECT_RETRY_DELAYS_OVERRIDE = process.env.VITEST
|
|
16
|
+
? [0, 0, 0]
|
|
17
|
+
: undefined;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import type { EffectAction } from "@a5c-ai/babysitter-sdk";
|
|
2
|
+
import type { HarnessDiscoveryResult, ResolveEffectResult } from "../utils";
|
|
3
|
+
export type EffectDispatchCommit = {
|
|
4
|
+
action: EffectAction;
|
|
5
|
+
result: ResolveEffectResult;
|
|
6
|
+
startedAt: string;
|
|
7
|
+
finishedAt: string;
|
|
8
|
+
};
|
|
9
|
+
export type EffectDispatchSummary = {
|
|
10
|
+
resolved: number;
|
|
11
|
+
ok: number;
|
|
12
|
+
error: number;
|
|
13
|
+
background: number;
|
|
14
|
+
};
|
|
15
|
+
export type EffectDispatchOptions = {
|
|
16
|
+
actions: EffectAction[];
|
|
17
|
+
concurrentEffects?: boolean;
|
|
18
|
+
resolveAction(action: EffectAction): Promise<ResolveEffectResult>;
|
|
19
|
+
commitAction(commit: EffectDispatchCommit): Promise<void>;
|
|
20
|
+
};
|
|
21
|
+
export declare function harnessSupportsConcurrentEffects(harnessName: string, discovered?: readonly HarnessDiscoveryResult[]): boolean;
|
|
22
|
+
export declare function dispatchEffectActions(options: EffectDispatchOptions): Promise<EffectDispatchSummary>;
|
|
23
|
+
//# sourceMappingURL=dispatch.d.ts.map
|