@a5c-ai/agent-platform 5.0.1-staging.b436b3b3e611
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 +53 -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/cli/amuxEventsFormatter.d.ts +26 -0
- package/dist/cli/amuxEventsFormatter.d.ts.map +1 -0
- package/dist/cli/amuxEventsFormatter.js +86 -0
- package/dist/cli/args/argFlags.d.ts +6 -0
- package/dist/cli/args/argFlags.d.ts.map +1 -0
- package/dist/cli/args/argFlags.js +72 -0
- package/dist/cli/args/argPositionals.d.ts +3 -0
- package/dist/cli/args/argPositionals.d.ts.map +1 -0
- package/dist/cli/args/argPositionals.js +18 -0
- package/dist/cli/args/index.d.ts +4 -0
- package/dist/cli/args/index.d.ts.map +1 -0
- package/dist/cli/args/index.js +75 -0
- package/dist/cli/args/types.d.ts +13 -0
- package/dist/cli/args/types.d.ts.map +1 -0
- package/dist/cli/args/types.js +2 -0
- package/dist/cli/commands/daemon.d.ts +31 -0
- package/dist/cli/commands/daemon.d.ts.map +1 -0
- package/dist/cli/commands/daemon.js +156 -0
- package/dist/cli/commands/harness/createRun.d.ts +3 -0
- package/dist/cli/commands/harness/createRun.d.ts.map +1 -0
- package/dist/cli/commands/harness/createRun.js +8 -0
- package/dist/cli/commands/harness/resumeRun.d.ts +20 -0
- package/dist/cli/commands/harness/resumeRun.d.ts.map +1 -0
- package/dist/cli/commands/harness/resumeRun.js +341 -0
- package/dist/cli/commands/jsonlInteractive.d.ts +35 -0
- package/dist/cli/commands/jsonlInteractive.d.ts.map +1 -0
- package/dist/cli/commands/jsonlInteractive.js +302 -0
- package/dist/cli/commands/mcpServe.d.ts +18 -0
- package/dist/cli/commands/mcpServe.d.ts.map +1 -0
- package/dist/cli/commands/mcpServe.js +59 -0
- package/dist/cli/commands/session/history.d.ts +14 -0
- package/dist/cli/commands/session/history.d.ts.map +1 -0
- package/dist/cli/commands/session/history.js +100 -0
- package/dist/cli/commands/tui.d.ts +23 -0
- package/dist/cli/commands/tui.d.ts.map +1 -0
- package/dist/cli/commands/tui.js +183 -0
- package/dist/cli/dispatch.d.ts +4 -0
- package/dist/cli/dispatch.d.ts.map +1 -0
- package/dist/cli/dispatch.js +332 -0
- package/dist/cli/main.d.ts +7 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +41 -0
- package/dist/cli/program.d.ts +7 -0
- package/dist/cli/program.d.ts.map +1 -0
- package/dist/cli/program.js +8 -0
- package/dist/cli/ui.d.ts +9 -0
- package/dist/cli/ui.d.ts.map +1 -0
- package/dist/cli/ui.js +125 -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/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 +137 -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 +209 -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/fileWatcher.d.ts +9 -0
- package/dist/daemon/fileWatcher.d.ts.map +1 -0
- package/dist/daemon/fileWatcher.js +141 -0
- package/dist/daemon/index.d.ts +7 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/daemon/index.js +21 -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 +21 -0
- package/dist/daemon/loop.d.ts.map +1 -0
- package/dist/daemon/loop.js +196 -0
- package/dist/daemon/timerScheduler.d.ts +13 -0
- package/dist/daemon/timerScheduler.d.ts.map +1 -0
- package/dist/daemon/timerScheduler.js +122 -0
- package/dist/daemon/types.d.ts +93 -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 +110 -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/amux/amuxBridge.d.ts +71 -0
- package/dist/harness/amux/amuxBridge.d.ts.map +1 -0
- package/dist/harness/amux/amuxBridge.js +117 -0
- package/dist/harness/amux/amuxClientFactory.d.ts +29 -0
- package/dist/harness/amux/amuxClientFactory.d.ts.map +1 -0
- package/dist/harness/amux/amuxClientFactory.js +90 -0
- package/dist/harness/amux/amuxEventEmitter.d.ts +51 -0
- package/dist/harness/amux/amuxEventEmitter.d.ts.map +1 -0
- package/dist/harness/amux/amuxEventEmitter.js +143 -0
- package/dist/harness/amux/amuxEventMapper.d.ts +58 -0
- package/dist/harness/amux/amuxEventMapper.d.ts.map +1 -0
- package/dist/harness/amux/amuxEventMapper.js +92 -0
- package/dist/harness/amux/amuxHarnessMap.d.ts +25 -0
- package/dist/harness/amux/amuxHarnessMap.d.ts.map +1 -0
- package/dist/harness/amux/amuxHarnessMap.js +55 -0
- package/dist/harness/amux/amuxStdinReader.d.ts +45 -0
- package/dist/harness/amux/amuxStdinReader.d.ts.map +1 -0
- package/dist/harness/amux/amuxStdinReader.js +106 -0
- package/dist/harness/amux/amuxTypes.d.ts +122 -0
- package/dist/harness/amux/amuxTypes.d.ts.map +1 -0
- package/dist/harness/amux/amuxTypes.js +11 -0
- package/dist/harness/amux/index.d.ts +17 -0
- package/dist/harness/amux/index.d.ts.map +1 -0
- package/dist/harness/amux/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/fallbackChains.d.ts +42 -0
- package/dist/harness/fallbackChains.d.ts.map +1 -0
- package/dist/harness/fallbackChains.js +69 -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 +10 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +66 -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 +137 -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 +13 -0
- package/dist/harness/internal/createRun/orchestration/effects.d.ts +43 -0
- package/dist/harness/internal/createRun/orchestration/effects.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/effects.js +490 -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 +319 -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 +104 -0
- package/dist/harness/internal/createRun/orchestration/index.d.ts +14 -0
- package/dist/harness/internal/createRun/orchestration/index.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/index.js +36 -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 +464 -0
- package/dist/harness/internal/createRun/orchestration/internalTools.d.ts +26 -0
- package/dist/harness/internal/createRun/orchestration/internalTools.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/internalTools.js +262 -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 +46 -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/output.d.ts +38 -0
- package/dist/harness/internal/createRun/output.d.ts.map +1 -0
- package/dist/harness/internal/createRun/output.js +415 -0
- package/dist/harness/internal/createRun/pi.d.ts +34 -0
- package/dist/harness/internal/createRun/pi.d.ts.map +1 -0
- package/dist/harness/internal/createRun/pi.js +216 -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 +361 -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 +20 -0
- package/dist/harness/internal/createRun/planProcess/prompts.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/prompts.js +208 -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 +188 -0
- package/dist/harness/internal/createRun/planProcess/recovery.test.d.ts +2 -0
- package/dist/harness/internal/createRun/planProcess/recovery.test.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/recovery.test.js +68 -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 +2 -0
- package/dist/harness/internal/createRun/planProcess/validation.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/validation.js +212 -0
- package/dist/harness/internal/createRun/planProcess/validationSource.d.ts +11 -0
- package/dist/harness/internal/createRun/planProcess/validationSource.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/validationSource.js +328 -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 +49 -0
- package/dist/harness/internal/createRun/prompts.d.ts.map +1 -0
- package/dist/harness/internal/createRun/prompts.js +307 -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 +182 -0
- package/dist/harness/internal/createRun/utils.d.ts.map +1 -0
- package/dist/harness/internal/createRun/utils.js +133 -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 +43 -0
- package/dist/harness/invoker.d.ts.map +1 -0
- package/dist/harness/invoker.js +210 -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 +77 -0
- package/dist/harness/piWrapper/moduleSupport.d.ts.map +1 -0
- package/dist/harness/piWrapper/moduleSupport.js +204 -0
- package/dist/harness/piWrapper.d.ts +80 -0
- package/dist/harness/piWrapper.d.ts.map +1 -0
- package/dist/harness/piWrapper.js +389 -0
- package/dist/harness/piWrapper.test.d.ts +2 -0
- package/dist/harness/piWrapper.test.d.ts.map +1 -0
- package/dist/harness/piWrapper.test.js +193 -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 +266 -0
- package/dist/harness/types.d.ts.map +1 -0
- package/dist/harness/types.js +34 -0
- package/dist/index.d.ts +14 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +52 -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 +4 -0
- package/dist/interaction/index.d.ts.map +1 -0
- package/dist/interaction/index.js +20 -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/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 +17 -0
- package/dist/mcp/channels/index.d.ts.map +1 -0
- package/dist/mcp/channels/index.js +39 -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 +142 -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 +60 -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 +214 -0
- package/dist/mcp/client/toolRegistry.d.ts +50 -0
- package/dist/mcp/client/toolRegistry.d.ts.map +1 -0
- package/dist/mcp/client/toolRegistry.js +118 -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/prompts/commandTemplates.d.ts +3 -0
- package/dist/prompts/commandTemplates.d.ts.map +1 -0
- package/dist/prompts/commandTemplates.js +238 -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 +55 -0
- package/dist/seams/contract.d.ts.map +1 -0
- package/dist/seams/contract.js +120 -0
- package/dist/seams/contract.test.d.ts +2 -0
- package/dist/seams/contract.test.d.ts.map +1 -0
- package/dist/seams/contract.test.js +96 -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 +63 -0
- package/dist/session/cost.d.ts.map +1 -0
- package/dist/session/cost.js +194 -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 +143 -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/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 +172 -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/package.json +141 -0
|
@@ -0,0 +1,415 @@
|
|
|
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.PROCESS_LIBRARY_SEARCH_DEFAULT_LIMIT = exports.PROCESS_LIBRARY_READ_MAX_CHARS = exports.VERBOSE_LOG_LIMIT = exports.MAGENTA = exports.RED = exports.YELLOW = exports.GREEN = exports.CYAN = exports.BOLD = exports.RESET = exports.DIM = void 0;
|
|
37
|
+
exports.resolveOutputMode = resolveOutputMode;
|
|
38
|
+
exports.isAmuxEventsMode = isAmuxEventsMode;
|
|
39
|
+
exports.truncateForVerboseLog = truncateForVerboseLog;
|
|
40
|
+
exports.stringifyForVerboseLog = stringifyForVerboseLog;
|
|
41
|
+
exports.writeVerboseLine = writeVerboseLine;
|
|
42
|
+
exports.writeVerboseBlock = writeVerboseBlock;
|
|
43
|
+
exports.emitProgress = emitProgress;
|
|
44
|
+
exports.emitAmuxEvent = emitAmuxEvent;
|
|
45
|
+
exports.formatElapsed = formatElapsed;
|
|
46
|
+
exports.createStreamingProgressCallbacks = createStreamingProgressCallbacks;
|
|
47
|
+
exports.loadSessionCompressionConfig = loadSessionCompressionConfig;
|
|
48
|
+
exports.compressInternalHarnessPrompt = compressInternalHarnessPrompt;
|
|
49
|
+
exports.buildPromptContext = buildPromptContext;
|
|
50
|
+
exports.selectHarness = selectHarness;
|
|
51
|
+
const path = __importStar(require("node:path"));
|
|
52
|
+
const babysitter_sdk_1 = require("@a5c-ai/babysitter-sdk");
|
|
53
|
+
exports.DIM = "\x1b[2m";
|
|
54
|
+
exports.RESET = "\x1b[0m";
|
|
55
|
+
exports.BOLD = "\x1b[1m";
|
|
56
|
+
exports.CYAN = "\x1b[36m";
|
|
57
|
+
exports.GREEN = "\x1b[32m";
|
|
58
|
+
exports.YELLOW = "\x1b[33m";
|
|
59
|
+
exports.RED = "\x1b[31m";
|
|
60
|
+
exports.MAGENTA = "\x1b[35m";
|
|
61
|
+
exports.VERBOSE_LOG_LIMIT = 4_000;
|
|
62
|
+
exports.PROCESS_LIBRARY_READ_MAX_CHARS = 24_000;
|
|
63
|
+
exports.PROCESS_LIBRARY_SEARCH_DEFAULT_LIMIT = 12;
|
|
64
|
+
/**
|
|
65
|
+
* Harness selection priority. Pi / built-in programmatic harnesses are preferred;
|
|
66
|
+
* external harnesses are discovered dynamically via agent-mux.
|
|
67
|
+
*/
|
|
68
|
+
const HARNESS_PRIORITY = [
|
|
69
|
+
"agent-core",
|
|
70
|
+
"oh-my-pi",
|
|
71
|
+
"pi",
|
|
72
|
+
];
|
|
73
|
+
function resolveOutputMode(json, outputMode) {
|
|
74
|
+
if (outputMode)
|
|
75
|
+
return outputMode;
|
|
76
|
+
return json ? "json" : "cli";
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Check whether the given output mode is the amux-events JSONL protocol.
|
|
80
|
+
*/
|
|
81
|
+
function isAmuxEventsMode(outputMode) {
|
|
82
|
+
return outputMode === "amux-events";
|
|
83
|
+
}
|
|
84
|
+
function truncateForVerboseLog(text, maxChars = exports.VERBOSE_LOG_LIMIT) {
|
|
85
|
+
const normalized = text.replace(/\r\n/g, "\n");
|
|
86
|
+
if (normalized.length <= maxChars) {
|
|
87
|
+
return normalized;
|
|
88
|
+
}
|
|
89
|
+
return `${normalized.slice(0, maxChars)}\n... [truncated ${normalized.length - maxChars} chars]`;
|
|
90
|
+
}
|
|
91
|
+
function stringifyForVerboseLog(value, maxChars = exports.VERBOSE_LOG_LIMIT) {
|
|
92
|
+
try {
|
|
93
|
+
const raw = typeof value === "string" ? value : JSON.stringify(value, null, 2);
|
|
94
|
+
return truncateForVerboseLog(raw, maxChars);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return truncateForVerboseLog(String(value), maxChars);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function writeVerboseLine(enabled, json, message, outputMode) {
|
|
101
|
+
const mode = resolveOutputMode(json, outputMode);
|
|
102
|
+
if (mode === "cli" && enabled) {
|
|
103
|
+
process.stderr.write(`${exports.DIM}${message}${exports.RESET}\n`);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function writeVerboseBlock(enabled, json, label, value, maxChars = exports.VERBOSE_LOG_LIMIT, outputMode) {
|
|
107
|
+
const mode = resolveOutputMode(json, outputMode);
|
|
108
|
+
if (mode !== "cli" || !enabled) {
|
|
109
|
+
return;
|
|
110
|
+
}
|
|
111
|
+
process.stderr.write(`${exports.DIM}[${label}]${exports.RESET}\n${exports.DIM}${stringifyForVerboseLog(value, maxChars)}${exports.RESET}\n`);
|
|
112
|
+
}
|
|
113
|
+
function emitProgress(payload, json, verbose, outputMode) {
|
|
114
|
+
const mode = resolveOutputMode(json, outputMode);
|
|
115
|
+
if (mode === "tui")
|
|
116
|
+
return;
|
|
117
|
+
// amux-events mode: translate progress payloads to agent-mux JSONL events
|
|
118
|
+
if (mode === "amux-events") {
|
|
119
|
+
emitProgressAsAmuxEvent(payload);
|
|
120
|
+
return;
|
|
121
|
+
}
|
|
122
|
+
if (mode === "json") {
|
|
123
|
+
console.log(JSON.stringify(payload, null, 2));
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
switch (payload.phase) {
|
|
127
|
+
case "1":
|
|
128
|
+
if (payload.status === "skipped") {
|
|
129
|
+
process.stderr.write(`${exports.DIM}PhasePlanProcess skipped (--process provided)${exports.RESET}\n`);
|
|
130
|
+
}
|
|
131
|
+
else if (payload.status === "started") {
|
|
132
|
+
process.stderr.write(`\n${exports.BOLD}PhasePlanProcess${exports.RESET} ${exports.DIM}Process planning via ${payload.harness}...${exports.RESET}\n`);
|
|
133
|
+
}
|
|
134
|
+
else if (payload.status === "completed") {
|
|
135
|
+
process.stderr.write(`${exports.GREEN}PhasePlanProcess complete${exports.RESET} ${exports.DIM}${payload.processPath}${exports.RESET}\n`);
|
|
136
|
+
}
|
|
137
|
+
else if (payload.status === "failed") {
|
|
138
|
+
process.stderr.write(`${exports.RED}PhasePlanProcess failed:${exports.RESET} ${payload.error}\n`);
|
|
139
|
+
}
|
|
140
|
+
else if (payload.status === "intent") {
|
|
141
|
+
process.stderr.write(`${exports.DIM}PhaseUnderstandIntent: ${payload.answer}${exports.RESET}\n`);
|
|
142
|
+
}
|
|
143
|
+
else if (payload.status === "planning") {
|
|
144
|
+
process.stderr.write(`${exports.DIM}PhasePlanProcess: ${payload.answer}${exports.RESET}\n`);
|
|
145
|
+
}
|
|
146
|
+
else if (payload.status === "interview") {
|
|
147
|
+
process.stderr.write(`${exports.DIM}Interview answers: ${payload.answer}${exports.RESET}\n`);
|
|
148
|
+
}
|
|
149
|
+
break;
|
|
150
|
+
case "2":
|
|
151
|
+
if (payload.status === "started") {
|
|
152
|
+
process.stderr.write(`\n${exports.BOLD}PhaseOrchestration${exports.RESET} ${exports.DIM}Bound orchestration loop${exports.RESET}\n`);
|
|
153
|
+
}
|
|
154
|
+
else if (payload.status === "run-created") {
|
|
155
|
+
process.stderr.write(`${exports.GREEN}Run created${exports.RESET} runId=${exports.CYAN}${payload.runId}${exports.RESET}\n`);
|
|
156
|
+
if (verbose)
|
|
157
|
+
process.stderr.write(` ${exports.DIM}runDir: ${payload.runDir}${exports.RESET}\n`);
|
|
158
|
+
}
|
|
159
|
+
else if (payload.status === "bound") {
|
|
160
|
+
if (payload.error) {
|
|
161
|
+
process.stderr.write(`${exports.YELLOW}Session binding warning:${exports.RESET} ${payload.error}\n`);
|
|
162
|
+
}
|
|
163
|
+
else {
|
|
164
|
+
process.stderr.write(`${exports.DIM}session bound via ${payload.harness}: ${payload.sessionId}${exports.RESET}\n`);
|
|
165
|
+
}
|
|
166
|
+
}
|
|
167
|
+
else if (payload.status === "iteration-start") {
|
|
168
|
+
const elapsed = payload.elapsedMs != null ? ` [${formatElapsed(payload.elapsedMs)}]` : "";
|
|
169
|
+
process.stderr.write(`\n${exports.DIM}-- iteration ${payload.iteration} starting...${elapsed} --${exports.RESET}\n`);
|
|
170
|
+
}
|
|
171
|
+
else if (payload.status === "iteration") {
|
|
172
|
+
process.stderr.write(`\n${exports.DIM}-- iteration ${payload.iteration} --${exports.RESET} status=${payload.runStatus} pending=${payload.pendingEffects}\n`);
|
|
173
|
+
}
|
|
174
|
+
else if (payload.status === "effect-start") {
|
|
175
|
+
const label = payload.effectTitle ?? payload.effectId ?? "unknown";
|
|
176
|
+
const via = payload.effectHarness ? ` ${exports.DIM}via ${payload.effectHarness}${exports.RESET}` : "";
|
|
177
|
+
process.stderr.write(` ${exports.CYAN}▸${exports.RESET} ${exports.MAGENTA}${payload.effectKind}${exports.RESET} ${label}${via}...\n`);
|
|
178
|
+
}
|
|
179
|
+
else if (payload.status === "effect") {
|
|
180
|
+
const icon = payload.effectStatus === "ok" ? `${exports.GREEN}✓${exports.RESET}` : `${exports.RED}✗${exports.RESET}`;
|
|
181
|
+
const elapsed = payload.elapsedMs != null ? ` ${exports.DIM}${formatElapsed(payload.elapsedMs)}${exports.RESET}` : "";
|
|
182
|
+
const errorSuffix = payload.effectStatus === "error" ? ` ${exports.RED}${payload.error}${exports.RESET}` : "";
|
|
183
|
+
process.stderr.write(` ${icon} ${exports.MAGENTA}${payload.effectKind}${exports.RESET} ${payload.effectTitle ?? payload.effectId}${elapsed}${errorSuffix}\n`);
|
|
184
|
+
if (payload.output) {
|
|
185
|
+
const lines = payload.output.split("\n").filter((l) => l.trim());
|
|
186
|
+
const tail = lines.slice(-5);
|
|
187
|
+
for (const line of tail) {
|
|
188
|
+
const trimmed = line.length > 160 ? line.slice(0, 160) + "..." : line;
|
|
189
|
+
process.stderr.write(` ${exports.DIM}${trimmed}${exports.RESET}\n`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
else if (payload.status === "iteration-summary") {
|
|
194
|
+
const elapsed = payload.elapsedMs != null ? formatElapsed(payload.elapsedMs) : "?";
|
|
195
|
+
const tokens = payload.tokenEstimate != null ? ` | ~${payload.tokenEstimate} tokens` : "";
|
|
196
|
+
process.stderr.write(` ${exports.DIM}${payload.effectsResolved ?? 0} effect(s) resolved in ${elapsed}${tokens}${exports.RESET}\n`);
|
|
197
|
+
}
|
|
198
|
+
else if (payload.status === "completed") {
|
|
199
|
+
process.stderr.write(`\n${exports.GREEN}${exports.BOLD}Run completed${exports.RESET} ${exports.DIM}(${payload.iteration} iterations)${exports.RESET}\n`);
|
|
200
|
+
}
|
|
201
|
+
else if (payload.status === "failed") {
|
|
202
|
+
process.stderr.write(`\n${exports.RED}${exports.BOLD}Run failed:${exports.RESET} ${payload.error}\n`);
|
|
203
|
+
}
|
|
204
|
+
break;
|
|
205
|
+
}
|
|
206
|
+
}
|
|
207
|
+
function emitAmuxEvent(event, json, outputMode) {
|
|
208
|
+
const mode = resolveOutputMode(json, outputMode);
|
|
209
|
+
if (mode !== "amux-events") {
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
process.stdout.write(JSON.stringify(event) + "\n");
|
|
213
|
+
}
|
|
214
|
+
function formatElapsed(ms) {
|
|
215
|
+
if (ms < 1000)
|
|
216
|
+
return "<1s";
|
|
217
|
+
const totalSec = Math.floor(ms / 1000);
|
|
218
|
+
if (totalSec < 60)
|
|
219
|
+
return `${totalSec}s`;
|
|
220
|
+
const min = Math.floor(totalSec / 60);
|
|
221
|
+
const sec = totalSec % 60;
|
|
222
|
+
return `${min}m ${sec}s`;
|
|
223
|
+
}
|
|
224
|
+
function createStreamingProgressCallbacks(outputMode, _harnessName) {
|
|
225
|
+
if (outputMode !== "cli")
|
|
226
|
+
return undefined;
|
|
227
|
+
const MAX_LINE_LENGTH = 200;
|
|
228
|
+
return {
|
|
229
|
+
onLine: (line) => {
|
|
230
|
+
const trimmed = line.length > MAX_LINE_LENGTH
|
|
231
|
+
? line.slice(0, MAX_LINE_LENGTH) + "..."
|
|
232
|
+
: line;
|
|
233
|
+
process.stderr.write(`${exports.DIM} | ${trimmed}${exports.RESET}\n`);
|
|
234
|
+
},
|
|
235
|
+
};
|
|
236
|
+
}
|
|
237
|
+
function loadSessionCompressionConfig(workspace) {
|
|
238
|
+
try {
|
|
239
|
+
return (0, babysitter_sdk_1.loadCompressionConfig)(workspace ?? process.cwd());
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
return null;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
function compressInternalHarnessPrompt(text, compressionConfig, taskKind = "agent") {
|
|
246
|
+
if (!compressionConfig?.enabled || !compressionConfig.layers.sdkContextHook.enabled) {
|
|
247
|
+
return text;
|
|
248
|
+
}
|
|
249
|
+
const layer = compressionConfig.layers.sdkContextHook;
|
|
250
|
+
if ((0, babysitter_sdk_1.estimateTokens)(text) <= layer.minCompressionTokens) {
|
|
251
|
+
return text;
|
|
252
|
+
}
|
|
253
|
+
const targetReduction = layer.perTaskKind?.[taskKind] ?? layer.targetReduction;
|
|
254
|
+
return (0, babysitter_sdk_1.densityFilterText)(text, targetReduction);
|
|
255
|
+
}
|
|
256
|
+
function buildPromptContext(args) {
|
|
257
|
+
const envNames = [
|
|
258
|
+
"CI",
|
|
259
|
+
"BABYSITTER_COMPRESSION_ENABLED",
|
|
260
|
+
"BABYSITTER_PI_SANDBOX_IMAGE",
|
|
261
|
+
"AZURE_OPENAI_API_KEY",
|
|
262
|
+
"AZURE_OPENAI_PROJECT_NAME",
|
|
263
|
+
"AZURE_OPENAI_DEPLOYMENT",
|
|
264
|
+
"OPENAI_API_KEY",
|
|
265
|
+
"ANTHROPIC_API_KEY",
|
|
266
|
+
];
|
|
267
|
+
return {
|
|
268
|
+
platform: process.platform,
|
|
269
|
+
arch: process.arch,
|
|
270
|
+
nodeVersion: process.version,
|
|
271
|
+
cwd: process.cwd(),
|
|
272
|
+
workspace: path.resolve(args.workspace ?? process.cwd()),
|
|
273
|
+
selectedHarnessName: args.selectedHarnessName,
|
|
274
|
+
discoveredHarnesses: args.discovered,
|
|
275
|
+
compressionEnabled: Boolean(args.compressionConfig?.enabled &&
|
|
276
|
+
args.compressionConfig.layers.sdkContextHook.enabled),
|
|
277
|
+
secureSandboxImage: process.env.BABYSITTER_PI_SANDBOX_IMAGE || "node:22-bookworm",
|
|
278
|
+
piDefaultBashSandbox: "local",
|
|
279
|
+
piIsolationDefault: false,
|
|
280
|
+
envFlags: envNames.map((name) => ({
|
|
281
|
+
name,
|
|
282
|
+
value: process.env[name]
|
|
283
|
+
? (name.endsWith("_API_KEY") ? "set" : process.env[name])
|
|
284
|
+
: "unset",
|
|
285
|
+
})),
|
|
286
|
+
};
|
|
287
|
+
}
|
|
288
|
+
function selectHarness(discovered, preferred) {
|
|
289
|
+
if (preferred) {
|
|
290
|
+
const match = discovered.find((h) => h.name === preferred && h.installed);
|
|
291
|
+
if (match)
|
|
292
|
+
return match;
|
|
293
|
+
}
|
|
294
|
+
const caller = (0, babysitter_sdk_1.detectCallerHarness)();
|
|
295
|
+
if (caller) {
|
|
296
|
+
const callerMatch = discovered.find((h) => h.name === caller.name && h.installed);
|
|
297
|
+
if (callerMatch)
|
|
298
|
+
return callerMatch;
|
|
299
|
+
}
|
|
300
|
+
for (const name of HARNESS_PRIORITY) {
|
|
301
|
+
const match = discovered.find((h) => h.name === name && h.installed);
|
|
302
|
+
if (match)
|
|
303
|
+
return match;
|
|
304
|
+
}
|
|
305
|
+
return undefined;
|
|
306
|
+
}
|
|
307
|
+
// ---------------------------------------------------------------------------
|
|
308
|
+
// amux-events progress translation
|
|
309
|
+
// ---------------------------------------------------------------------------
|
|
310
|
+
/**
|
|
311
|
+
* Translate an internal ProgressPayload to an agent-mux compatible JSONL
|
|
312
|
+
* event and write it to stdout.
|
|
313
|
+
*
|
|
314
|
+
* This function maps the agent-platform internal progress structure to
|
|
315
|
+
* the event types that the agent-mux babysitter adapter's `parseEvent()`
|
|
316
|
+
* understands: `session_start`, `turn_start`, `turn_end`, `tool_call_start`,
|
|
317
|
+
* `tool_result`, `text_delta`, `error`, `session_end`.
|
|
318
|
+
*/
|
|
319
|
+
function emitProgressAsAmuxEvent(payload) {
|
|
320
|
+
const now = new Date().toISOString();
|
|
321
|
+
const runId = payload["runId"] ?? "";
|
|
322
|
+
const agent = "babysitter";
|
|
323
|
+
const writeEvent = (event) => {
|
|
324
|
+
process.stdout.write(JSON.stringify({
|
|
325
|
+
runId,
|
|
326
|
+
agent,
|
|
327
|
+
timestamp: now,
|
|
328
|
+
...event,
|
|
329
|
+
}) + "\n");
|
|
330
|
+
};
|
|
331
|
+
if (payload.phase === "2") {
|
|
332
|
+
switch (payload.status) {
|
|
333
|
+
case "started":
|
|
334
|
+
writeEvent({ type: "session_start", sessionId: runId, harness: payload.harness });
|
|
335
|
+
break;
|
|
336
|
+
case "run-created":
|
|
337
|
+
writeEvent({ type: "session_start", sessionId: payload.runId ?? runId, resumed: false });
|
|
338
|
+
break;
|
|
339
|
+
case "resuming":
|
|
340
|
+
writeEvent({ type: "session_start", sessionId: payload.runId ?? runId, resumed: true });
|
|
341
|
+
break;
|
|
342
|
+
case "iteration-start":
|
|
343
|
+
writeEvent({ type: "turn_start", turnIndex: payload.iteration ?? 0, iteration: payload.iteration });
|
|
344
|
+
break;
|
|
345
|
+
case "effect-start":
|
|
346
|
+
writeEvent({
|
|
347
|
+
type: "tool_call_start",
|
|
348
|
+
toolCallId: payload.effectId ?? "",
|
|
349
|
+
toolName: payload.effectKind ?? "unknown",
|
|
350
|
+
input: { title: payload.effectTitle, harness: payload.effectHarness },
|
|
351
|
+
});
|
|
352
|
+
break;
|
|
353
|
+
case "effect":
|
|
354
|
+
writeEvent({
|
|
355
|
+
type: "tool_result",
|
|
356
|
+
toolCallId: payload.effectId ?? "",
|
|
357
|
+
toolName: payload.effectKind ?? "unknown",
|
|
358
|
+
output: payload.output ?? "",
|
|
359
|
+
status: payload.effectStatus,
|
|
360
|
+
});
|
|
361
|
+
break;
|
|
362
|
+
case "iteration-summary":
|
|
363
|
+
writeEvent({
|
|
364
|
+
type: "turn_end",
|
|
365
|
+
turnIndex: payload.iteration ?? 0,
|
|
366
|
+
iteration: payload.iteration,
|
|
367
|
+
effectsResolved: payload.effectsResolved,
|
|
368
|
+
elapsedMs: payload.elapsedMs,
|
|
369
|
+
});
|
|
370
|
+
break;
|
|
371
|
+
case "completed":
|
|
372
|
+
writeEvent({
|
|
373
|
+
type: "session_end",
|
|
374
|
+
sessionId: payload.runId ?? runId,
|
|
375
|
+
exitReason: "completed",
|
|
376
|
+
turnCount: payload.iteration ?? 0,
|
|
377
|
+
});
|
|
378
|
+
break;
|
|
379
|
+
case "failed":
|
|
380
|
+
writeEvent({ type: "error", message: payload.error ?? "Run failed", code: "RUN_FAILED" });
|
|
381
|
+
writeEvent({
|
|
382
|
+
type: "session_end",
|
|
383
|
+
sessionId: payload.runId ?? runId,
|
|
384
|
+
exitReason: "failed",
|
|
385
|
+
turnCount: payload.iteration ?? 0,
|
|
386
|
+
});
|
|
387
|
+
break;
|
|
388
|
+
case "process-error-recovery":
|
|
389
|
+
writeEvent({
|
|
390
|
+
type: "error",
|
|
391
|
+
message: payload.error ?? "Process error",
|
|
392
|
+
code: "PROCESS_ERROR",
|
|
393
|
+
recoverable: true,
|
|
394
|
+
attempt: payload.attempt,
|
|
395
|
+
maxAttempts: payload.maxAttempts,
|
|
396
|
+
});
|
|
397
|
+
break;
|
|
398
|
+
// bound, iteration, skipped-plan-only -- no direct amux equivalent
|
|
399
|
+
default:
|
|
400
|
+
break;
|
|
401
|
+
}
|
|
402
|
+
}
|
|
403
|
+
else if (payload.phase === "1") {
|
|
404
|
+
// Phase 1 (planning) events: emit as text_delta so the adapter sees progress
|
|
405
|
+
if (payload.status === "started") {
|
|
406
|
+
writeEvent({ type: "text_delta", text: `[planning] Process planning started via ${payload.harness ?? "unknown"}\n` });
|
|
407
|
+
}
|
|
408
|
+
else if (payload.status === "completed") {
|
|
409
|
+
writeEvent({ type: "text_delta", text: `[planning] Process created: ${payload.processPath ?? "unknown"}\n` });
|
|
410
|
+
}
|
|
411
|
+
else if (payload.status === "failed") {
|
|
412
|
+
writeEvent({ type: "error", message: payload.error ?? "Planning failed", code: "PLANNING_FAILED" });
|
|
413
|
+
}
|
|
414
|
+
}
|
|
415
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { EffectAction } from "@a5c-ai/babysitter-sdk";
|
|
2
|
+
import type { AgentCorePromptResult, AgentCoreSessionOptions } from "../../types";
|
|
3
|
+
import type { DelegationConfig } from "./utils";
|
|
4
|
+
export declare const TRANSIENT_PI_PROMPT_RETRY_DELAYS_MS: number[];
|
|
5
|
+
export declare const PI_PARENT_PROMPT_TIMEOUT_MS = 0;
|
|
6
|
+
export declare const PI_DEFAULT_PROMPT_TIMEOUT_MS = 900000;
|
|
7
|
+
export declare const PI_WORKER_TIMEOUT_MS = 1800000;
|
|
8
|
+
export declare function readBooleanMetadata(metadata: Record<string, unknown> | undefined, key: string): boolean | undefined;
|
|
9
|
+
export declare function readBashSandboxMetadata(metadata: Record<string, unknown> | undefined): AgentCoreSessionOptions["bashSandbox"] | undefined;
|
|
10
|
+
export declare function readStringMetadata(metadata: Record<string, unknown> | undefined, key: string): string | undefined;
|
|
11
|
+
export declare function isProcessModuleLoadFailure(error: unknown): boolean;
|
|
12
|
+
export declare function isRetryablePiPromptFailure(error: unknown): boolean;
|
|
13
|
+
export declare function isIgnorablePiPromptFailure(output: string): boolean;
|
|
14
|
+
type PromptCapableSession = {
|
|
15
|
+
prompt(text: string, timeout?: number): Promise<AgentCorePromptResult>;
|
|
16
|
+
};
|
|
17
|
+
export declare function promptPiWithRetry(args: {
|
|
18
|
+
session: PromptCapableSession;
|
|
19
|
+
message: string;
|
|
20
|
+
timeout: number;
|
|
21
|
+
label: string;
|
|
22
|
+
writeVerbose?: (message: string) => void;
|
|
23
|
+
writeVerboseData?: (label: string, value: unknown, maxChars?: number) => void;
|
|
24
|
+
}): Promise<AgentCorePromptResult>;
|
|
25
|
+
export declare function buildPiWorkerSessionOptions(args: {
|
|
26
|
+
action: EffectAction;
|
|
27
|
+
workspace?: string;
|
|
28
|
+
model?: string;
|
|
29
|
+
customTools?: unknown[];
|
|
30
|
+
delegationConfig?: DelegationConfig;
|
|
31
|
+
}): AgentCoreSessionOptions;
|
|
32
|
+
export declare function resolveAgentCoreBackendForHarness(harnessName?: string): string | undefined;
|
|
33
|
+
export {};
|
|
34
|
+
//# sourceMappingURL=pi.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pi.d.ts","sourceRoot":"","sources":["../../../../src/harness/internal/createRun/pi.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,wBAAwB,CAAC;AAC3D,OAAO,KAAK,EACV,qBAAqB,EACrB,uBAAuB,EACxB,MAAM,aAAa,CAAC;AAGrB,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AAEhD,eAAO,MAAM,mCAAmC,UAE9B,CAAC;AAEnB,eAAO,MAAM,2BAA2B,IAAI,CAAC;AAC7C,eAAO,MAAM,4BAA4B,SAAU,CAAC;AACpD,eAAO,MAAM,oBAAoB,UAAY,CAAC;AAE9C,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7C,GAAG,EAAE,MAAM,GACV,OAAO,GAAG,SAAS,CAYrB;AAED,wBAAgB,uBAAuB,CACrC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,GAC5C,uBAAuB,CAAC,aAAa,CAAC,GAAG,SAAS,CAKpD;AAED,wBAAgB,kBAAkB,CAChC,QAAQ,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,EAC7C,GAAG,EAAE,MAAM,GACV,MAAM,GAAG,SAAS,CAGpB;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAElE;AAED,wBAAgB,0BAA0B,CAAC,KAAK,EAAE,OAAO,GAAG,OAAO,CAwBlE;AAED,wBAAgB,0BAA0B,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAElE;AAED,KAAK,oBAAoB,GAAG;IAC1B,MAAM,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAAC;CACxE,CAAC;AAEF,wBAAsB,iBAAiB,CAAC,IAAI,EAAE;IAC5C,OAAO,EAAE,oBAAoB,CAAC;IAC9B,OAAO,EAAE,MAAM,CAAC;IAChB,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;IACzC,gBAAgB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,QAAQ,CAAC,EAAE,MAAM,KAAK,IAAI,CAAC;CAC/E,GAAG,OAAO,CAAC,qBAAqB,CAAC,CAuCjC;AAED,wBAAgB,2BAA2B,CAAC,IAAI,EAAE;IAChD,MAAM,EAAE,YAAY,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,WAAW,CAAC,EAAE,OAAO,EAAE,CAAC;IACxB,gBAAgB,CAAC,EAAE,gBAAgB,CAAC;CACrC,GAAG,uBAAuB,CAoE1B;AAED,wBAAgB,iCAAiC,CAAC,WAAW,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,SAAS,CAY1F"}
|
|
@@ -0,0 +1,216 @@
|
|
|
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.PI_WORKER_TIMEOUT_MS = exports.PI_DEFAULT_PROMPT_TIMEOUT_MS = exports.PI_PARENT_PROMPT_TIMEOUT_MS = exports.TRANSIENT_PI_PROMPT_RETRY_DELAYS_MS = void 0;
|
|
37
|
+
exports.readBooleanMetadata = readBooleanMetadata;
|
|
38
|
+
exports.readBashSandboxMetadata = readBashSandboxMetadata;
|
|
39
|
+
exports.readStringMetadata = readStringMetadata;
|
|
40
|
+
exports.isProcessModuleLoadFailure = isProcessModuleLoadFailure;
|
|
41
|
+
exports.isRetryablePiPromptFailure = isRetryablePiPromptFailure;
|
|
42
|
+
exports.isIgnorablePiPromptFailure = isIgnorablePiPromptFailure;
|
|
43
|
+
exports.promptPiWithRetry = promptPiWithRetry;
|
|
44
|
+
exports.buildPiWorkerSessionOptions = buildPiWorkerSessionOptions;
|
|
45
|
+
exports.resolveAgentCoreBackendForHarness = resolveAgentCoreBackendForHarness;
|
|
46
|
+
const path = __importStar(require("node:path"));
|
|
47
|
+
const node_fs_1 = require("node:fs");
|
|
48
|
+
const amuxHarnessMap_1 = require("../../amux/amuxHarnessMap");
|
|
49
|
+
const builtInHarness_1 = require("../../builtInHarness");
|
|
50
|
+
exports.TRANSIENT_PI_PROMPT_RETRY_DELAYS_MS = process.env.VITEST
|
|
51
|
+
? [0, 0]
|
|
52
|
+
: [1_000, 3_000];
|
|
53
|
+
exports.PI_PARENT_PROMPT_TIMEOUT_MS = 0;
|
|
54
|
+
exports.PI_DEFAULT_PROMPT_TIMEOUT_MS = 900_000;
|
|
55
|
+
exports.PI_WORKER_TIMEOUT_MS = 1_800_000;
|
|
56
|
+
function readBooleanMetadata(metadata, key) {
|
|
57
|
+
const value = metadata?.[key];
|
|
58
|
+
if (typeof value === "boolean") {
|
|
59
|
+
return value;
|
|
60
|
+
}
|
|
61
|
+
if (value === "true") {
|
|
62
|
+
return true;
|
|
63
|
+
}
|
|
64
|
+
if (value === "false") {
|
|
65
|
+
return false;
|
|
66
|
+
}
|
|
67
|
+
return undefined;
|
|
68
|
+
}
|
|
69
|
+
function readBashSandboxMetadata(metadata) {
|
|
70
|
+
const value = metadata?.bashSandbox;
|
|
71
|
+
return value === "auto" || value === "secure" || value === "local"
|
|
72
|
+
? value
|
|
73
|
+
: undefined;
|
|
74
|
+
}
|
|
75
|
+
function readStringMetadata(metadata, key) {
|
|
76
|
+
const value = metadata?.[key];
|
|
77
|
+
return typeof value === "string" ? value : undefined;
|
|
78
|
+
}
|
|
79
|
+
function isProcessModuleLoadFailure(error) {
|
|
80
|
+
return error instanceof Error && /^Failed to load process module at /.test(error.message);
|
|
81
|
+
}
|
|
82
|
+
function isRetryablePiPromptFailure(error) {
|
|
83
|
+
const message = typeof error === "string"
|
|
84
|
+
? error
|
|
85
|
+
: error instanceof Error
|
|
86
|
+
? error.message
|
|
87
|
+
: typeof error === "object" && error !== null && "output" in error
|
|
88
|
+
? String(error.output ?? "")
|
|
89
|
+
: "";
|
|
90
|
+
if (!message) {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
const normalized = message.toLowerCase();
|
|
94
|
+
return normalized.includes("the server had an error processing your request") ||
|
|
95
|
+
normalized.includes("please retry your request") ||
|
|
96
|
+
normalized.includes("temporarily unavailable") ||
|
|
97
|
+
normalized.includes("rate limit") ||
|
|
98
|
+
normalized.includes("too many requests") ||
|
|
99
|
+
normalized.includes("pitimeouterror") ||
|
|
100
|
+
normalized.includes("pi prompt timed out") ||
|
|
101
|
+
normalized.includes("deadline exceeded") ||
|
|
102
|
+
normalized.includes("already processing");
|
|
103
|
+
}
|
|
104
|
+
function isIgnorablePiPromptFailure(output) {
|
|
105
|
+
return output.includes("msg.content.filter is not a function");
|
|
106
|
+
}
|
|
107
|
+
async function promptPiWithRetry(args) {
|
|
108
|
+
let attempt = 0;
|
|
109
|
+
for (;;) {
|
|
110
|
+
try {
|
|
111
|
+
const result = await args.session.prompt(args.message, args.timeout);
|
|
112
|
+
if (result.success ||
|
|
113
|
+
!isRetryablePiPromptFailure(result.output) ||
|
|
114
|
+
attempt >= exports.TRANSIENT_PI_PROMPT_RETRY_DELAYS_MS.length) {
|
|
115
|
+
return result;
|
|
116
|
+
}
|
|
117
|
+
const delayMs = exports.TRANSIENT_PI_PROMPT_RETRY_DELAYS_MS[attempt] ?? 0;
|
|
118
|
+
attempt += 1;
|
|
119
|
+
args.writeVerbose?.(`[${args.label} retry] transient PI failure; retrying prompt attempt ${attempt}/${exports.TRANSIENT_PI_PROMPT_RETRY_DELAYS_MS.length} after ${delayMs}ms`);
|
|
120
|
+
args.writeVerboseData?.(`${args.label} retry failure output`, result.output);
|
|
121
|
+
if (delayMs > 0) {
|
|
122
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
catch (error) {
|
|
126
|
+
if (!isRetryablePiPromptFailure(error) || attempt >= exports.TRANSIENT_PI_PROMPT_RETRY_DELAYS_MS.length) {
|
|
127
|
+
throw error;
|
|
128
|
+
}
|
|
129
|
+
const delayMs = exports.TRANSIENT_PI_PROMPT_RETRY_DELAYS_MS[attempt] ?? 0;
|
|
130
|
+
attempt += 1;
|
|
131
|
+
args.writeVerbose?.(`[${args.label} retry] transient PI exception; retrying prompt attempt ${attempt}/${exports.TRANSIENT_PI_PROMPT_RETRY_DELAYS_MS.length} after ${delayMs}ms`);
|
|
132
|
+
args.writeVerboseData?.(`${args.label} retry error`, error);
|
|
133
|
+
if (delayMs > 0) {
|
|
134
|
+
await new Promise((resolve) => setTimeout(resolve, delayMs));
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
function buildPiWorkerSessionOptions(args) {
|
|
140
|
+
const metadata = args.action.taskDef?.metadata;
|
|
141
|
+
const isolated = readBooleanMetadata(metadata, "isolated");
|
|
142
|
+
const enableCompaction = readBooleanMetadata(metadata, "enableCompaction");
|
|
143
|
+
const effectiveModel = args.delegationConfig?.model ?? args.model;
|
|
144
|
+
const effectiveTimeout = args.delegationConfig?.timeout ?? exports.PI_WORKER_TIMEOUT_MS;
|
|
145
|
+
const effectiveToolsMode = args.delegationConfig?.toolsMode
|
|
146
|
+
?? readStringMetadata(metadata, "toolsMode")
|
|
147
|
+
?? "coding";
|
|
148
|
+
const rawThinkingLevel = args.delegationConfig?.thinkingLevel
|
|
149
|
+
?? readStringMetadata(metadata, "thinkingLevel");
|
|
150
|
+
const effectiveThinkingLevel = rawThinkingLevel === "none" ? undefined : rawThinkingLevel;
|
|
151
|
+
const effectiveBashSandbox = args.delegationConfig?.bashSandbox
|
|
152
|
+
?? readBashSandboxMetadata(metadata);
|
|
153
|
+
let appendSystemPrompt;
|
|
154
|
+
const skillNames = args.delegationConfig?.skills ?? metadata?.skills;
|
|
155
|
+
if (skillNames?.length) {
|
|
156
|
+
const skillContents = [];
|
|
157
|
+
for (const skillName of skillNames) {
|
|
158
|
+
try {
|
|
159
|
+
const candidates = [
|
|
160
|
+
path.join(args.workspace ?? process.cwd(), ".a5c", "skills", skillName, "SKILL.md"),
|
|
161
|
+
path.join(args.workspace ?? process.cwd(), ".claude", "plugins", skillName, "SKILL.md"),
|
|
162
|
+
];
|
|
163
|
+
for (const candidate of candidates) {
|
|
164
|
+
if ((0, node_fs_1.existsSync)(candidate)) {
|
|
165
|
+
skillContents.push((0, node_fs_1.readFileSync)(candidate, "utf8"));
|
|
166
|
+
break;
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
catch { /* skip missing skills */ }
|
|
171
|
+
}
|
|
172
|
+
if (skillContents.length) {
|
|
173
|
+
appendSystemPrompt = [skillContents.join("\n\n---\n\n")];
|
|
174
|
+
}
|
|
175
|
+
}
|
|
176
|
+
const subagentName = args.delegationConfig?.subagentName ?? readStringMetadata(metadata, "subagentName");
|
|
177
|
+
let agentDir;
|
|
178
|
+
if (subagentName) {
|
|
179
|
+
const candidates = [
|
|
180
|
+
path.join(args.workspace ?? process.cwd(), ".claude", "agents", subagentName),
|
|
181
|
+
];
|
|
182
|
+
for (const candidate of candidates) {
|
|
183
|
+
if ((0, node_fs_1.existsSync)(candidate)) {
|
|
184
|
+
agentDir = candidate;
|
|
185
|
+
break;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
return {
|
|
190
|
+
workspace: args.workspace,
|
|
191
|
+
model: effectiveModel,
|
|
192
|
+
timeout: effectiveTimeout,
|
|
193
|
+
toolsMode: effectiveToolsMode,
|
|
194
|
+
ephemeral: true,
|
|
195
|
+
...(args.customTools?.length ? { customTools: args.customTools } : {}),
|
|
196
|
+
...(isolated !== undefined ? { isolated } : {}),
|
|
197
|
+
...(enableCompaction !== undefined ? { enableCompaction } : {}),
|
|
198
|
+
...(effectiveBashSandbox ? { bashSandbox: effectiveBashSandbox } : {}),
|
|
199
|
+
...(effectiveThinkingLevel ? { thinkingLevel: effectiveThinkingLevel } : {}),
|
|
200
|
+
...(appendSystemPrompt ? { appendSystemPrompt } : {}),
|
|
201
|
+
...(agentDir ? { agentDir } : {}),
|
|
202
|
+
};
|
|
203
|
+
}
|
|
204
|
+
function resolveAgentCoreBackendForHarness(harnessName) {
|
|
205
|
+
const normalizedHarness = (0, builtInHarness_1.normalizeBuiltInHarnessName)(harnessName?.trim() ?? "");
|
|
206
|
+
if (!normalizedHarness || normalizedHarness === "agent-core") {
|
|
207
|
+
return undefined;
|
|
208
|
+
}
|
|
209
|
+
if (normalizedHarness === "pi") {
|
|
210
|
+
return "pi";
|
|
211
|
+
}
|
|
212
|
+
if ((0, amuxHarnessMap_1.hasAmuxAdapter)(normalizedHarness)) {
|
|
213
|
+
return (0, amuxHarnessMap_1.mapHarnessToAmuxAdapter)(normalizedHarness);
|
|
214
|
+
}
|
|
215
|
+
return normalizedHarness;
|
|
216
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export declare function buildAgentPrompt(taskDef: Record<string, unknown>): string;
|
|
2
|
+
export declare function buildStructuredAgentOutputInstructions(agent: Record<string, unknown>): string[];
|
|
3
|
+
export declare function extractJsonObjectFromText(text: string): string | null;
|
|
4
|
+
export declare function coerceAgentResultValue(taskDef: Record<string, unknown>, output: string): unknown;
|
|
5
|
+
//# sourceMappingURL=agentOutput.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"agentOutput.d.ts","sourceRoot":"","sources":["../../../../../src/harness/internal/createRun/planProcess/agentOutput.ts"],"names":[],"mappings":"AAKA,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,CA+DzE;AAED,wBAAgB,sCAAsC,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,MAAM,EAAE,CAU/F;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,GAAG,IAAI,CAkBrE;AAED,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,EAAE,MAAM,GAAG,OAAO,CAwBhG"}
|