@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,71 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* agent-mux integration bridge for agent-platform.
|
|
3
|
+
*
|
|
4
|
+
* Replaces the direct child-process invocation in `invoker.ts` for
|
|
5
|
+
* external harnesses by delegating to an AmuxClient instance. The
|
|
6
|
+
* client is injected so agent-platform never imports @agent-mux/core
|
|
7
|
+
* directly -- it only depends on the interfaces defined in amuxTypes.ts.
|
|
8
|
+
*
|
|
9
|
+
* @module harness/amux/amuxBridge
|
|
10
|
+
*/
|
|
11
|
+
import type { HarnessInvokeOptions, HarnessInvokeResult } from "../types";
|
|
12
|
+
import type { AmuxClient } from "./amuxTypes";
|
|
13
|
+
import { type BabysitterEvent } from "./amuxEventMapper";
|
|
14
|
+
/**
|
|
15
|
+
* Options that extend the standard HarnessInvokeOptions with fields
|
|
16
|
+
* specific to the agent-mux bridge.
|
|
17
|
+
*/
|
|
18
|
+
export interface AmuxBridgeOptions extends HarnessInvokeOptions {
|
|
19
|
+
/** Session ID for session resumption via agent-mux. */
|
|
20
|
+
sessionId?: string;
|
|
21
|
+
/** Whether to suppress interactive prompts (yolo mode). */
|
|
22
|
+
nonInteractive?: boolean;
|
|
23
|
+
/** Maximum agent turns before force-stop. */
|
|
24
|
+
maxTurns?: number;
|
|
25
|
+
/** Hook configuration forwarded to the agent. */
|
|
26
|
+
hooks?: unknown;
|
|
27
|
+
/** Skills to enable for this run. */
|
|
28
|
+
skills?: string[];
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Extended result that includes agent-mux-specific metadata on top of
|
|
32
|
+
* the standard HarnessInvokeResult.
|
|
33
|
+
*/
|
|
34
|
+
export interface AmuxBridgeResult extends HarnessInvokeResult {
|
|
35
|
+
/** Session ID returned by agent-mux (for session resumption). */
|
|
36
|
+
sessionId?: string;
|
|
37
|
+
/** Accumulated cost from cost events. */
|
|
38
|
+
totalCost: number;
|
|
39
|
+
/** All babysitter-mapped events collected during the run. */
|
|
40
|
+
events: BabysitterEvent[];
|
|
41
|
+
/** The last assistant text message accumulated from text_delta events. */
|
|
42
|
+
lastMessage: string;
|
|
43
|
+
}
|
|
44
|
+
/**
|
|
45
|
+
* Optional callback invoked for each mapped babysitter event during
|
|
46
|
+
* stream consumption. Useful for live governance checks, cost tracking,
|
|
47
|
+
* and webhook forwarding without waiting for the full run to complete.
|
|
48
|
+
*/
|
|
49
|
+
export type AmuxEventCallback = (event: BabysitterEvent) => void | Promise<void>;
|
|
50
|
+
/**
|
|
51
|
+
* Invoke a harness through agent-mux instead of spawning the CLI directly.
|
|
52
|
+
*
|
|
53
|
+
* The function:
|
|
54
|
+
* 1. Maps the babysitter harness name to an agent-mux adapter name.
|
|
55
|
+
* 2. Calls `client.run()` with the translated options.
|
|
56
|
+
* 3. Consumes the async event stream, mapping each AgentEvent to a
|
|
57
|
+
* BabysitterEvent.
|
|
58
|
+
* 4. Accumulates text deltas, cost totals, and error state.
|
|
59
|
+
* 5. Returns an AmuxBridgeResult compatible with HarnessInvokeResult.
|
|
60
|
+
*
|
|
61
|
+
* @param client - AmuxClient instance (injected, no hard dep on @agent-mux/core).
|
|
62
|
+
* @param harness - babysitter harness name (e.g. "claude-code", "codex").
|
|
63
|
+
* @param options - Invocation options.
|
|
64
|
+
* @param onEvent - Optional per-event callback for live processing.
|
|
65
|
+
* @returns Promise resolving to the bridge result.
|
|
66
|
+
*
|
|
67
|
+
* @throws {Error} if `harness` is "pi" / "internal" (use agent-core).
|
|
68
|
+
* @throws {Error} if the harness has no agent-mux adapter mapping.
|
|
69
|
+
*/
|
|
70
|
+
export declare function invokeViaAgentMux(client: AmuxClient, harness: string, options: AmuxBridgeOptions, onEvent?: AmuxEventCallback): Promise<AmuxBridgeResult>;
|
|
71
|
+
//# sourceMappingURL=amuxBridge.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amuxBridge.d.ts","sourceRoot":"","sources":["../../../src/harness/amux/amuxBridge.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,oBAAoB,EAAE,mBAAmB,EAAE,MAAM,UAAU,CAAC;AAC1E,OAAO,KAAK,EACV,UAAU,EAEX,MAAM,aAAa,CAAC;AAErB,OAAO,EAIL,KAAK,eAAe,EACrB,MAAM,mBAAmB,CAAC;AAM3B;;;GAGG;AACH,MAAM,WAAW,iBAAkB,SAAQ,oBAAoB;IAC7D,uDAAuD;IACvD,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,2DAA2D;IAC3D,cAAc,CAAC,EAAE,OAAO,CAAC;IACzB,6CAA6C;IAC7C,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,iDAAiD;IACjD,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,qCAAqC;IACrC,MAAM,CAAC,EAAE,MAAM,EAAE,CAAC;CACnB;AAED;;;GAGG;AACH,MAAM,WAAW,gBAAiB,SAAQ,mBAAmB;IAC3D,iEAAiE;IACjE,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,yCAAyC;IACzC,SAAS,EAAE,MAAM,CAAC;IAClB,6DAA6D;IAC7D,MAAM,EAAE,eAAe,EAAE,CAAC;IAC1B,0EAA0E;IAC1E,WAAW,EAAE,MAAM,CAAC;CACrB;AAMD;;;;GAIG;AACH,MAAM,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,eAAe,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;AAMjF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,UAAU,EAClB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,iBAAiB,EAC1B,OAAO,CAAC,EAAE,iBAAiB,GAC1B,OAAO,CAAC,gBAAgB,CAAC,CAuF3B"}
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* agent-mux integration bridge for agent-platform.
|
|
4
|
+
*
|
|
5
|
+
* Replaces the direct child-process invocation in `invoker.ts` for
|
|
6
|
+
* external harnesses by delegating to an AmuxClient instance. The
|
|
7
|
+
* client is injected so agent-platform never imports @agent-mux/core
|
|
8
|
+
* directly -- it only depends on the interfaces defined in amuxTypes.ts.
|
|
9
|
+
*
|
|
10
|
+
* @module harness/amux/amuxBridge
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.invokeViaAgentMux = invokeViaAgentMux;
|
|
14
|
+
const amuxHarnessMap_1 = require("./amuxHarnessMap");
|
|
15
|
+
const amuxEventMapper_1 = require("./amuxEventMapper");
|
|
16
|
+
// ---------------------------------------------------------------------------
|
|
17
|
+
// Bridge implementation
|
|
18
|
+
// ---------------------------------------------------------------------------
|
|
19
|
+
/**
|
|
20
|
+
* Invoke a harness through agent-mux instead of spawning the CLI directly.
|
|
21
|
+
*
|
|
22
|
+
* The function:
|
|
23
|
+
* 1. Maps the babysitter harness name to an agent-mux adapter name.
|
|
24
|
+
* 2. Calls `client.run()` with the translated options.
|
|
25
|
+
* 3. Consumes the async event stream, mapping each AgentEvent to a
|
|
26
|
+
* BabysitterEvent.
|
|
27
|
+
* 4. Accumulates text deltas, cost totals, and error state.
|
|
28
|
+
* 5. Returns an AmuxBridgeResult compatible with HarnessInvokeResult.
|
|
29
|
+
*
|
|
30
|
+
* @param client - AmuxClient instance (injected, no hard dep on @agent-mux/core).
|
|
31
|
+
* @param harness - babysitter harness name (e.g. "claude-code", "codex").
|
|
32
|
+
* @param options - Invocation options.
|
|
33
|
+
* @param onEvent - Optional per-event callback for live processing.
|
|
34
|
+
* @returns Promise resolving to the bridge result.
|
|
35
|
+
*
|
|
36
|
+
* @throws {Error} if `harness` is "pi" / "internal" (use agent-core).
|
|
37
|
+
* @throws {Error} if the harness has no agent-mux adapter mapping.
|
|
38
|
+
*/
|
|
39
|
+
async function invokeViaAgentMux(client, harness, options, onEvent) {
|
|
40
|
+
const adapterName = (0, amuxHarnessMap_1.mapHarnessToAmuxAdapter)(harness);
|
|
41
|
+
const startTime = Date.now();
|
|
42
|
+
const handle = client.run({
|
|
43
|
+
agent: adapterName,
|
|
44
|
+
prompt: options.prompt,
|
|
45
|
+
model: options.model,
|
|
46
|
+
cwd: options.workspace,
|
|
47
|
+
timeout: options.timeout,
|
|
48
|
+
sessionId: options.sessionId,
|
|
49
|
+
approvalMode: options.nonInteractive ? "yolo" : "prompt",
|
|
50
|
+
stream: true,
|
|
51
|
+
nonInteractive: options.nonInteractive,
|
|
52
|
+
maxTurns: options.maxTurns,
|
|
53
|
+
env: {
|
|
54
|
+
...(options.sessionId ? { AGENT_SESSION_ID: options.sessionId } : {}),
|
|
55
|
+
...options.env,
|
|
56
|
+
},
|
|
57
|
+
hooks: options.hooks,
|
|
58
|
+
skills: options.skills,
|
|
59
|
+
});
|
|
60
|
+
// Wire AbortSignal to agent-mux handle
|
|
61
|
+
if (options.signal) {
|
|
62
|
+
if (options.signal.aborted) {
|
|
63
|
+
handle.abort();
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
options.signal.addEventListener("abort", () => handle.abort(), {
|
|
67
|
+
once: true,
|
|
68
|
+
});
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
// Consume the event stream
|
|
72
|
+
const collectedEvents = [];
|
|
73
|
+
let lastMessage = "";
|
|
74
|
+
let totalCost = 0;
|
|
75
|
+
let hasError = false;
|
|
76
|
+
for await (const rawEvent of handle.events) {
|
|
77
|
+
const mapped = (0, amuxEventMapper_1.mapAmuxEvent)(rawEvent);
|
|
78
|
+
if (!mapped)
|
|
79
|
+
continue;
|
|
80
|
+
collectedEvents.push(mapped);
|
|
81
|
+
// Accumulate text deltas
|
|
82
|
+
if (mapped.kind === "text_delta") {
|
|
83
|
+
const text = mapped.data["text"];
|
|
84
|
+
if (typeof text === "string") {
|
|
85
|
+
lastMessage += text;
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
// Accumulate cost
|
|
89
|
+
if ((0, amuxEventMapper_1.isCostEvent)(mapped)) {
|
|
90
|
+
const eventCost = mapped.data["totalCost"];
|
|
91
|
+
if (typeof eventCost === "number") {
|
|
92
|
+
totalCost += eventCost;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
// Track errors
|
|
96
|
+
if ((0, amuxEventMapper_1.isErrorEvent)(mapped)) {
|
|
97
|
+
hasError = true;
|
|
98
|
+
}
|
|
99
|
+
// Forward to caller's live callback
|
|
100
|
+
if (onEvent) {
|
|
101
|
+
await onEvent(mapped);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
const duration = Date.now() - startTime;
|
|
105
|
+
const exitCode = handle.exitCode ?? (hasError ? 1 : 0);
|
|
106
|
+
return {
|
|
107
|
+
success: exitCode === 0 && !hasError,
|
|
108
|
+
output: lastMessage.trim(),
|
|
109
|
+
exitCode,
|
|
110
|
+
duration,
|
|
111
|
+
harness,
|
|
112
|
+
sessionId: handle.sessionId,
|
|
113
|
+
totalCost,
|
|
114
|
+
events: collectedEvents,
|
|
115
|
+
lastMessage: lastMessage.trim(),
|
|
116
|
+
};
|
|
117
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Factory for obtaining an AmuxClient instance.
|
|
3
|
+
*
|
|
4
|
+
* The package is a direct dependency, but some runtimes still cannot load the
|
|
5
|
+
* full agent-mux graph (for example when a required Node built-in is absent).
|
|
6
|
+
*/
|
|
7
|
+
import type { AmuxClient } from "./amuxTypes";
|
|
8
|
+
/**
|
|
9
|
+
* Get or create the singleton AmuxClient.
|
|
10
|
+
*/
|
|
11
|
+
export declare function getAmuxClient(): Promise<AmuxClient>;
|
|
12
|
+
/**
|
|
13
|
+
* Check whether agent-mux client can be created.
|
|
14
|
+
*/
|
|
15
|
+
export declare function isAmuxAvailable(): Promise<boolean>;
|
|
16
|
+
/**
|
|
17
|
+
* Reset the cached client. For testing.
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
20
|
+
export declare function _resetAmuxClientCache(): void;
|
|
21
|
+
/**
|
|
22
|
+
* Override the agent-mux module for testing.
|
|
23
|
+
* Pass `undefined` to restore require-based resolution.
|
|
24
|
+
* @internal
|
|
25
|
+
*/
|
|
26
|
+
export declare function _setAmuxModuleForTesting(mod: {
|
|
27
|
+
createClient: (options: Record<string, unknown>) => AmuxClient;
|
|
28
|
+
} | undefined): void;
|
|
29
|
+
//# sourceMappingURL=amuxClientFactory.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amuxClientFactory.d.ts","sourceRoot":"","sources":["../../../src/harness/amux/amuxClientFactory.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAuC9C;;GAEG;AACH,wBAAgB,aAAa,IAAI,OAAO,CAAC,UAAU,CAAC,CAqBnD;AAED;;GAEG;AACH,wBAAsB,eAAe,IAAI,OAAO,CAAC,OAAO,CAAC,CAOxD;AAED;;;GAGG;AACH,wBAAgB,qBAAqB,IAAI,IAAI,CAE5C;AAED;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,GAAG,EAAE;IAAE,YAAY,EAAE,CAAC,OAAO,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,KAAK,UAAU,CAAA;CAAE,GAAG,SAAS,GAClF,IAAI,CAGN"}
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Factory for obtaining an AmuxClient instance.
|
|
4
|
+
*
|
|
5
|
+
* The package is a direct dependency, but some runtimes still cannot load the
|
|
6
|
+
* full agent-mux graph (for example when a required Node built-in is absent).
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.getAmuxClient = getAmuxClient;
|
|
10
|
+
exports.isAmuxAvailable = isAmuxAvailable;
|
|
11
|
+
exports._resetAmuxClientCache = _resetAmuxClientCache;
|
|
12
|
+
exports._setAmuxModuleForTesting = _setAmuxModuleForTesting;
|
|
13
|
+
const node_module_1 = require("node:module");
|
|
14
|
+
let cachedClient = null;
|
|
15
|
+
let amuxOverride;
|
|
16
|
+
function hasNodeSqliteBuiltin() {
|
|
17
|
+
return node_module_1.builtinModules.includes("node:sqlite") || node_module_1.builtinModules.includes("sqlite");
|
|
18
|
+
}
|
|
19
|
+
function requireAmux() {
|
|
20
|
+
if (amuxOverride) {
|
|
21
|
+
return amuxOverride;
|
|
22
|
+
}
|
|
23
|
+
// eslint-disable-next-line @typescript-eslint/no-var-requires, @typescript-eslint/no-unsafe-assignment
|
|
24
|
+
const mod = require("@a5c-ai/agent-mux");
|
|
25
|
+
return mod;
|
|
26
|
+
}
|
|
27
|
+
function normalizeAmuxLoadError(error) {
|
|
28
|
+
const code = typeof error === "object" && error !== null && "code" in error
|
|
29
|
+
? String(error.code)
|
|
30
|
+
: "";
|
|
31
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
32
|
+
if (code === "ERR_UNKNOWN_BUILTIN_MODULE" ||
|
|
33
|
+
code === "ERR_MODULE_NOT_FOUND" ||
|
|
34
|
+
code === "MODULE_NOT_FOUND" ||
|
|
35
|
+
message.includes("node:sqlite")) {
|
|
36
|
+
return new Error(`agent-mux runtime is unavailable in this Node environment: ${message}`, { cause: error });
|
|
37
|
+
}
|
|
38
|
+
return error instanceof Error ? error : new Error(message);
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Get or create the singleton AmuxClient.
|
|
42
|
+
*/
|
|
43
|
+
function getAmuxClient() {
|
|
44
|
+
if (cachedClient) {
|
|
45
|
+
return Promise.resolve(cachedClient);
|
|
46
|
+
}
|
|
47
|
+
if (!amuxOverride && !hasNodeSqliteBuiltin()) {
|
|
48
|
+
throw normalizeAmuxLoadError(new Error("Missing required built-in module: node:sqlite"));
|
|
49
|
+
}
|
|
50
|
+
try {
|
|
51
|
+
const { createClient } = requireAmux();
|
|
52
|
+
const client = createClient({
|
|
53
|
+
stream: true,
|
|
54
|
+
debug: false,
|
|
55
|
+
});
|
|
56
|
+
cachedClient = client;
|
|
57
|
+
return Promise.resolve(cachedClient);
|
|
58
|
+
}
|
|
59
|
+
catch (error) {
|
|
60
|
+
throw normalizeAmuxLoadError(error);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Check whether agent-mux client can be created.
|
|
65
|
+
*/
|
|
66
|
+
async function isAmuxAvailable() {
|
|
67
|
+
try {
|
|
68
|
+
await getAmuxClient();
|
|
69
|
+
return true;
|
|
70
|
+
}
|
|
71
|
+
catch {
|
|
72
|
+
return false;
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
/**
|
|
76
|
+
* Reset the cached client. For testing.
|
|
77
|
+
* @internal
|
|
78
|
+
*/
|
|
79
|
+
function _resetAmuxClientCache() {
|
|
80
|
+
cachedClient = null;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Override the agent-mux module for testing.
|
|
84
|
+
* Pass `undefined` to restore require-based resolution.
|
|
85
|
+
* @internal
|
|
86
|
+
*/
|
|
87
|
+
function _setAmuxModuleForTesting(mod) {
|
|
88
|
+
amuxOverride = mod;
|
|
89
|
+
cachedClient = null;
|
|
90
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Emits agent-mux compatible JSONL events to stdout during harness execution.
|
|
3
|
+
*
|
|
4
|
+
* Used when `--output-format amux-events` is passed to `invoke` or
|
|
5
|
+
* `call`. Each event is a single JSON line matching the
|
|
6
|
+
* {@link AmuxAgentEvent} shape so the agent-mux babysitter adapter's
|
|
7
|
+
* `parseEvent()` can consume it directly.
|
|
8
|
+
*
|
|
9
|
+
* @module harness/amux/amuxEventEmitter
|
|
10
|
+
*/
|
|
11
|
+
import type { AmuxAgentEvent } from "./amuxTypes";
|
|
12
|
+
/**
|
|
13
|
+
* Stateful emitter that writes agent-mux compatible JSONL events to stdout.
|
|
14
|
+
*
|
|
15
|
+
* Each `emit()` call writes one JSON line to `process.stdout`. The emitter
|
|
16
|
+
* auto-stamps every event with `runId`, `agent`, and `timestamp` so callers
|
|
17
|
+
* only need to supply the event-specific fields.
|
|
18
|
+
*/
|
|
19
|
+
export declare class AmuxEventEmitter {
|
|
20
|
+
private readonly runId;
|
|
21
|
+
private readonly agent;
|
|
22
|
+
constructor(runId: string, agent?: string);
|
|
23
|
+
/**
|
|
24
|
+
* Write a single JSONL event to stdout.
|
|
25
|
+
*
|
|
26
|
+
* Base fields (`runId`, `agent`, `timestamp`) are merged automatically.
|
|
27
|
+
* Any field in `event` overrides the base fields.
|
|
28
|
+
*/
|
|
29
|
+
emit(event: Partial<AmuxAgentEvent>): void;
|
|
30
|
+
/** Mark the beginning of a session / run. */
|
|
31
|
+
sessionStart(sessionId?: string): void;
|
|
32
|
+
/** Mark the end of a session / run. */
|
|
33
|
+
sessionEnd(exitReason: string, turnCount?: number): void;
|
|
34
|
+
/** Emit a text output chunk. */
|
|
35
|
+
textDelta(text: string): void;
|
|
36
|
+
/** Signal the start of a tool invocation. */
|
|
37
|
+
toolCallStart(toolCallId: string, toolName: string, input?: unknown): void;
|
|
38
|
+
/** Signal a tool invocation result. */
|
|
39
|
+
toolResult(toolCallId: string, toolName: string, output: unknown): void;
|
|
40
|
+
/** Emit cost / token usage information. */
|
|
41
|
+
cost(inputTokens: number, outputTokens: number, totalCost: number): void;
|
|
42
|
+
/** Signal the start of an orchestration iteration / turn. */
|
|
43
|
+
turnStart(iteration: number): void;
|
|
44
|
+
/** Signal the end of an orchestration iteration / turn. */
|
|
45
|
+
turnEnd(iteration: number): void;
|
|
46
|
+
/** Emit an error event. */
|
|
47
|
+
error(message: string, code?: string): void;
|
|
48
|
+
/** Request user approval for an action. */
|
|
49
|
+
approvalRequest(id: string, description: string): void;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=amuxEventEmitter.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amuxEventEmitter.d.ts","sourceRoot":"","sources":["../../../src/harness/amux/amuxEventEmitter.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAElD;;;;;;GAMG;AACH,qBAAa,gBAAgB;IAEzB,OAAO,CAAC,QAAQ,CAAC,KAAK;IACtB,OAAO,CAAC,QAAQ,CAAC,KAAK;gBADL,KAAK,EAAE,MAAM,EACb,KAAK,GAAE,MAAqB;IAK/C;;;;;OAKG;IACH,IAAI,CAAC,KAAK,EAAE,OAAO,CAAC,cAAc,CAAC,GAAG,IAAI;IAa1C,6CAA6C;IAC7C,YAAY,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAQtC,uCAAuC;IACvC,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,IAAI;IAWxD,gCAAgC;IAChC,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI;IAU7B,6CAA6C;IAC7C,aAAa,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,CAAC,EAAE,OAAO,GAAG,IAAI;IAS1E,uCAAuC;IACvC,UAAU,CAAC,UAAU,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,IAAI;IAWvE,2CAA2C;IAC3C,IAAI,CAAC,WAAW,EAAE,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,GAAG,IAAI;IAgBxE,6DAA6D;IAC7D,SAAS,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAQlC,2DAA2D;IAC3D,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAUhC,2BAA2B;IAC3B,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,GAAG,IAAI;IAW3C,2CAA2C;IAC3C,eAAe,CAAC,EAAE,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI;CAOvD"}
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Emits agent-mux compatible JSONL events to stdout during harness execution.
|
|
4
|
+
*
|
|
5
|
+
* Used when `--output-format amux-events` is passed to `invoke` or
|
|
6
|
+
* `call`. Each event is a single JSON line matching the
|
|
7
|
+
* {@link AmuxAgentEvent} shape so the agent-mux babysitter adapter's
|
|
8
|
+
* `parseEvent()` can consume it directly.
|
|
9
|
+
*
|
|
10
|
+
* @module harness/amux/amuxEventEmitter
|
|
11
|
+
*/
|
|
12
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
13
|
+
exports.AmuxEventEmitter = void 0;
|
|
14
|
+
/**
|
|
15
|
+
* Stateful emitter that writes agent-mux compatible JSONL events to stdout.
|
|
16
|
+
*
|
|
17
|
+
* Each `emit()` call writes one JSON line to `process.stdout`. The emitter
|
|
18
|
+
* auto-stamps every event with `runId`, `agent`, and `timestamp` so callers
|
|
19
|
+
* only need to supply the event-specific fields.
|
|
20
|
+
*/
|
|
21
|
+
class AmuxEventEmitter {
|
|
22
|
+
runId;
|
|
23
|
+
agent;
|
|
24
|
+
constructor(runId, agent = "babysitter") {
|
|
25
|
+
this.runId = runId;
|
|
26
|
+
this.agent = agent;
|
|
27
|
+
}
|
|
28
|
+
// ── Core emit ───────────────────────────────────────────────────────
|
|
29
|
+
/**
|
|
30
|
+
* Write a single JSONL event to stdout.
|
|
31
|
+
*
|
|
32
|
+
* Base fields (`runId`, `agent`, `timestamp`) are merged automatically.
|
|
33
|
+
* Any field in `event` overrides the base fields.
|
|
34
|
+
*/
|
|
35
|
+
emit(event) {
|
|
36
|
+
const full = {
|
|
37
|
+
type: "unknown",
|
|
38
|
+
runId: this.runId,
|
|
39
|
+
agent: this.agent,
|
|
40
|
+
timestamp: new Date().toISOString(),
|
|
41
|
+
...event,
|
|
42
|
+
};
|
|
43
|
+
process.stdout.write(JSON.stringify(full) + "\n");
|
|
44
|
+
}
|
|
45
|
+
// ── Session lifecycle ───────────────────────────────────────────────
|
|
46
|
+
/** Mark the beginning of a session / run. */
|
|
47
|
+
sessionStart(sessionId) {
|
|
48
|
+
this.emit({
|
|
49
|
+
type: "session_start",
|
|
50
|
+
sessionId: sessionId ?? this.runId,
|
|
51
|
+
resumed: false,
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
/** Mark the end of a session / run. */
|
|
55
|
+
sessionEnd(exitReason, turnCount) {
|
|
56
|
+
this.emit({
|
|
57
|
+
type: "session_end",
|
|
58
|
+
sessionId: this.runId,
|
|
59
|
+
exitReason,
|
|
60
|
+
turnCount: turnCount ?? 0,
|
|
61
|
+
});
|
|
62
|
+
}
|
|
63
|
+
// ── Content streaming ───────────────────────────────────────────────
|
|
64
|
+
/** Emit a text output chunk. */
|
|
65
|
+
textDelta(text) {
|
|
66
|
+
this.emit({
|
|
67
|
+
type: "text_delta",
|
|
68
|
+
text,
|
|
69
|
+
delta: text,
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
// ── Tool calls ──────────────────────────────────────────────────────
|
|
73
|
+
/** Signal the start of a tool invocation. */
|
|
74
|
+
toolCallStart(toolCallId, toolName, input) {
|
|
75
|
+
this.emit({
|
|
76
|
+
type: "tool_call_start",
|
|
77
|
+
toolCallId,
|
|
78
|
+
toolName,
|
|
79
|
+
input: input ?? {},
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
/** Signal a tool invocation result. */
|
|
83
|
+
toolResult(toolCallId, toolName, output) {
|
|
84
|
+
this.emit({
|
|
85
|
+
type: "tool_result",
|
|
86
|
+
toolCallId,
|
|
87
|
+
toolName,
|
|
88
|
+
output,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
// ── Cost / usage ────────────────────────────────────────────────────
|
|
92
|
+
/** Emit cost / token usage information. */
|
|
93
|
+
cost(inputTokens, outputTokens, totalCost) {
|
|
94
|
+
this.emit({
|
|
95
|
+
type: "cost",
|
|
96
|
+
cost: {
|
|
97
|
+
inputTokens,
|
|
98
|
+
outputTokens,
|
|
99
|
+
totalCost,
|
|
100
|
+
},
|
|
101
|
+
inputTokens,
|
|
102
|
+
outputTokens,
|
|
103
|
+
totalCost,
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
// ── Turn / iteration boundaries ─────────────────────────────────────
|
|
107
|
+
/** Signal the start of an orchestration iteration / turn. */
|
|
108
|
+
turnStart(iteration) {
|
|
109
|
+
this.emit({
|
|
110
|
+
type: "turn_start",
|
|
111
|
+
turnIndex: iteration,
|
|
112
|
+
iteration,
|
|
113
|
+
});
|
|
114
|
+
}
|
|
115
|
+
/** Signal the end of an orchestration iteration / turn. */
|
|
116
|
+
turnEnd(iteration) {
|
|
117
|
+
this.emit({
|
|
118
|
+
type: "turn_end",
|
|
119
|
+
turnIndex: iteration,
|
|
120
|
+
iteration,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
// ── Errors ──────────────────────────────────────────────────────────
|
|
124
|
+
/** Emit an error event. */
|
|
125
|
+
error(message, code) {
|
|
126
|
+
this.emit({
|
|
127
|
+
type: "error",
|
|
128
|
+
message,
|
|
129
|
+
error: message,
|
|
130
|
+
code: code ?? "INTERNAL",
|
|
131
|
+
});
|
|
132
|
+
}
|
|
133
|
+
// ── Approval requests ───────────────────────────────────────────────
|
|
134
|
+
/** Request user approval for an action. */
|
|
135
|
+
approvalRequest(id, description) {
|
|
136
|
+
this.emit({
|
|
137
|
+
type: "approval_request",
|
|
138
|
+
id,
|
|
139
|
+
description,
|
|
140
|
+
});
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
exports.AmuxEventEmitter = AmuxEventEmitter;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Maps agent-mux AgentEvent instances to agent-platform internal events.
|
|
3
|
+
*
|
|
4
|
+
* agent-platform consumes these mapped events for:
|
|
5
|
+
* - Session history recording
|
|
6
|
+
* - Cost journaling
|
|
7
|
+
* - Governance checks
|
|
8
|
+
* - Webhook forwarding
|
|
9
|
+
* - Stop-hook orchestration loop
|
|
10
|
+
*
|
|
11
|
+
* @module harness/amux/amuxEventMapper
|
|
12
|
+
*/
|
|
13
|
+
import type { AmuxAgentEvent } from "./amuxTypes";
|
|
14
|
+
/**
|
|
15
|
+
* Internal event representation used within agent-platform.
|
|
16
|
+
*
|
|
17
|
+
* This is intentionally a simple tagged union so downstream consumers
|
|
18
|
+
* (session history, cost journal, webhooks) can switch on `kind`.
|
|
19
|
+
*/
|
|
20
|
+
export interface BabysitterEvent {
|
|
21
|
+
/** Discriminator. */
|
|
22
|
+
kind: BabysitterEventKind;
|
|
23
|
+
/** ISO-8601 timestamp from the source event. */
|
|
24
|
+
timestamp: string;
|
|
25
|
+
/** Agent/adapter that produced the event. */
|
|
26
|
+
agent: string;
|
|
27
|
+
/** agent-mux run ID. */
|
|
28
|
+
runId: string;
|
|
29
|
+
/** Payload varies by kind. */
|
|
30
|
+
data: Record<string, unknown>;
|
|
31
|
+
}
|
|
32
|
+
/**
|
|
33
|
+
* Known babysitter event kinds derived from agent-mux event types.
|
|
34
|
+
*/
|
|
35
|
+
export type BabysitterEventKind = "session_start" | "session_end" | "text_delta" | "thinking_delta" | "tool_call_start" | "tool_result" | "cost" | "token_usage" | "approval_request" | "input_required" | "error" | "crash" | "context_compacted" | "unknown";
|
|
36
|
+
/**
|
|
37
|
+
* Map an agent-mux AgentEvent to a agent-platform internal event.
|
|
38
|
+
*
|
|
39
|
+
* Returns `null` for event types agent-platform doesn't care about
|
|
40
|
+
* (e.g. internal debug events from agent-mux). Unknown but non-null
|
|
41
|
+
* events are mapped with kind "unknown" so downstream consumers can
|
|
42
|
+
* log or ignore them.
|
|
43
|
+
*
|
|
44
|
+
* @param event - The raw agent-mux event.
|
|
45
|
+
* @returns The mapped BabysitterEvent, or null to drop.
|
|
46
|
+
*/
|
|
47
|
+
export declare function mapAmuxEvent(event: AmuxAgentEvent): BabysitterEvent | null;
|
|
48
|
+
/** Returns true if the event represents a governance-relevant tool call. */
|
|
49
|
+
export declare function isToolEvent(event: BabysitterEvent): boolean;
|
|
50
|
+
/** Returns true if the event carries cost/token information. */
|
|
51
|
+
export declare function isCostEvent(event: BabysitterEvent): boolean;
|
|
52
|
+
/** Returns true if the event requires an interactive response. */
|
|
53
|
+
export declare function isInteractiveEvent(event: BabysitterEvent): boolean;
|
|
54
|
+
/** Returns true if the event signals an error condition. */
|
|
55
|
+
export declare function isErrorEvent(event: BabysitterEvent): boolean;
|
|
56
|
+
/** Returns true if the event represents a session lifecycle boundary. */
|
|
57
|
+
export declare function isSessionLifecycleEvent(event: BabysitterEvent): boolean;
|
|
58
|
+
//# sourceMappingURL=amuxEventMapper.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"amuxEventMapper.d.ts","sourceRoot":"","sources":["../../../src/harness/amux/amuxEventMapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,aAAa,CAAC;AAMlD;;;;;GAKG;AACH,MAAM,WAAW,eAAe;IAC9B,qBAAqB;IACrB,IAAI,EAAE,mBAAmB,CAAC;IAC1B,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,6CAA6C;IAC7C,KAAK,EAAE,MAAM,CAAC;IACd,wBAAwB;IACxB,KAAK,EAAE,MAAM,CAAC;IACd,8BAA8B;IAC9B,IAAI,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;CAC/B;AAED;;GAEG;AACH,MAAM,MAAM,mBAAmB,GAC3B,eAAe,GACf,aAAa,GACb,YAAY,GACZ,gBAAgB,GAChB,iBAAiB,GACjB,aAAa,GACb,MAAM,GACN,aAAa,GACb,kBAAkB,GAClB,gBAAgB,GAChB,OAAO,GACP,OAAO,GACP,mBAAmB,GACnB,SAAS,CAAC;AA0Bd;;;;;;;;;;GAUG;AACH,wBAAgB,YAAY,CAAC,KAAK,EAAE,cAAc,GAAG,eAAe,GAAG,IAAI,CAmB1E;AAMD,4EAA4E;AAC5E,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAE3D;AAED,gEAAgE;AAChE,wBAAgB,WAAW,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAE3D;AAED,kEAAkE;AAClE,wBAAgB,kBAAkB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAElE;AAED,4DAA4D;AAC5D,wBAAgB,YAAY,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAE5D;AAED,yEAAyE;AACzE,wBAAgB,uBAAuB,CAAC,KAAK,EAAE,eAAe,GAAG,OAAO,CAEvE"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Maps agent-mux AgentEvent instances to agent-platform internal events.
|
|
4
|
+
*
|
|
5
|
+
* agent-platform consumes these mapped events for:
|
|
6
|
+
* - Session history recording
|
|
7
|
+
* - Cost journaling
|
|
8
|
+
* - Governance checks
|
|
9
|
+
* - Webhook forwarding
|
|
10
|
+
* - Stop-hook orchestration loop
|
|
11
|
+
*
|
|
12
|
+
* @module harness/amux/amuxEventMapper
|
|
13
|
+
*/
|
|
14
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
+
exports.mapAmuxEvent = mapAmuxEvent;
|
|
16
|
+
exports.isToolEvent = isToolEvent;
|
|
17
|
+
exports.isCostEvent = isCostEvent;
|
|
18
|
+
exports.isInteractiveEvent = isInteractiveEvent;
|
|
19
|
+
exports.isErrorEvent = isErrorEvent;
|
|
20
|
+
exports.isSessionLifecycleEvent = isSessionLifecycleEvent;
|
|
21
|
+
// ---------------------------------------------------------------------------
|
|
22
|
+
// Well-known event type set
|
|
23
|
+
// ---------------------------------------------------------------------------
|
|
24
|
+
const KNOWN_EVENT_TYPES = new Set([
|
|
25
|
+
"session_start",
|
|
26
|
+
"session_end",
|
|
27
|
+
"text_delta",
|
|
28
|
+
"thinking_delta",
|
|
29
|
+
"tool_call_start",
|
|
30
|
+
"tool_result",
|
|
31
|
+
"cost",
|
|
32
|
+
"token_usage",
|
|
33
|
+
"approval_request",
|
|
34
|
+
"input_required",
|
|
35
|
+
"error",
|
|
36
|
+
"crash",
|
|
37
|
+
"context_compacted",
|
|
38
|
+
]);
|
|
39
|
+
// ---------------------------------------------------------------------------
|
|
40
|
+
// Mapper
|
|
41
|
+
// ---------------------------------------------------------------------------
|
|
42
|
+
/**
|
|
43
|
+
* Map an agent-mux AgentEvent to a agent-platform internal event.
|
|
44
|
+
*
|
|
45
|
+
* Returns `null` for event types agent-platform doesn't care about
|
|
46
|
+
* (e.g. internal debug events from agent-mux). Unknown but non-null
|
|
47
|
+
* events are mapped with kind "unknown" so downstream consumers can
|
|
48
|
+
* log or ignore them.
|
|
49
|
+
*
|
|
50
|
+
* @param event - The raw agent-mux event.
|
|
51
|
+
* @returns The mapped BabysitterEvent, or null to drop.
|
|
52
|
+
*/
|
|
53
|
+
function mapAmuxEvent(event) {
|
|
54
|
+
if (!event || !event.type) {
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
// Extract the base fields every BabysitterEvent needs.
|
|
58
|
+
const { type, runId, agent, timestamp, ...rest } = event;
|
|
59
|
+
const kind = KNOWN_EVENT_TYPES.has(type)
|
|
60
|
+
? type
|
|
61
|
+
: "unknown";
|
|
62
|
+
return {
|
|
63
|
+
kind,
|
|
64
|
+
timestamp: timestamp ?? new Date().toISOString(),
|
|
65
|
+
agent: agent ?? "unknown",
|
|
66
|
+
runId: runId ?? "",
|
|
67
|
+
data: { originalType: type, ...rest },
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// ---------------------------------------------------------------------------
|
|
71
|
+
// Convenience predicates
|
|
72
|
+
// ---------------------------------------------------------------------------
|
|
73
|
+
/** Returns true if the event represents a governance-relevant tool call. */
|
|
74
|
+
function isToolEvent(event) {
|
|
75
|
+
return event.kind === "tool_call_start" || event.kind === "tool_result";
|
|
76
|
+
}
|
|
77
|
+
/** Returns true if the event carries cost/token information. */
|
|
78
|
+
function isCostEvent(event) {
|
|
79
|
+
return event.kind === "cost" || event.kind === "token_usage";
|
|
80
|
+
}
|
|
81
|
+
/** Returns true if the event requires an interactive response. */
|
|
82
|
+
function isInteractiveEvent(event) {
|
|
83
|
+
return event.kind === "approval_request" || event.kind === "input_required";
|
|
84
|
+
}
|
|
85
|
+
/** Returns true if the event signals an error condition. */
|
|
86
|
+
function isErrorEvent(event) {
|
|
87
|
+
return event.kind === "error" || event.kind === "crash";
|
|
88
|
+
}
|
|
89
|
+
/** Returns true if the event represents a session lifecycle boundary. */
|
|
90
|
+
function isSessionLifecycleEvent(event) {
|
|
91
|
+
return event.kind === "session_start" || event.kind === "session_end";
|
|
92
|
+
}
|