@a5c-ai/genty-platform 5.1.1-staging.00ceebd28cf2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +48 -0
- package/dist/anycli/cache.d.ts +45 -0
- package/dist/anycli/cache.d.ts.map +1 -0
- package/dist/anycli/cache.js +118 -0
- package/dist/anycli/index.d.ts +10 -0
- package/dist/anycli/index.d.ts.map +1 -0
- package/dist/anycli/index.js +25 -0
- package/dist/anycli/types.d.ts +32 -0
- package/dist/anycli/types.d.ts.map +1 -0
- package/dist/anycli/types.js +9 -0
- package/dist/api/breakpoints.d.ts +93 -0
- package/dist/api/breakpoints.d.ts.map +1 -0
- package/dist/api/breakpoints.js +334 -0
- package/dist/api/effects.d.ts +14 -0
- package/dist/api/effects.d.ts.map +1 -0
- package/dist/api/effects.js +306 -0
- package/dist/api/effectsTypes.d.ts +79 -0
- package/dist/api/effectsTypes.d.ts.map +1 -0
- package/dist/api/effectsTypes.js +6 -0
- package/dist/api/eventStream.d.ts +34 -0
- package/dist/api/eventStream.d.ts.map +1 -0
- package/dist/api/eventStream.js +126 -0
- package/dist/api/index.d.ts +10 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +27 -0
- package/dist/api/runs.d.ts +85 -0
- package/dist/api/runs.d.ts.map +1 -0
- package/dist/api/runs.js +247 -0
- package/dist/api/sessions.d.ts +17 -0
- package/dist/api/sessions.d.ts.map +1 -0
- package/dist/api/sessions.js +58 -0
- package/dist/api/utils.d.ts +28 -0
- package/dist/api/utils.d.ts.map +1 -0
- package/dist/api/utils.js +74 -0
- package/dist/breakpoints/analytics.d.ts +46 -0
- package/dist/breakpoints/analytics.d.ts.map +1 -0
- package/dist/breakpoints/analytics.js +64 -0
- package/dist/breakpoints/approvalChains.d.ts +68 -0
- package/dist/breakpoints/approvalChains.d.ts.map +1 -0
- package/dist/breakpoints/approvalChains.js +111 -0
- package/dist/breakpoints/delegation.d.ts +42 -0
- package/dist/breakpoints/delegation.d.ts.map +1 -0
- package/dist/breakpoints/delegation.js +199 -0
- package/dist/breakpoints/delegationTypes.d.ts +46 -0
- package/dist/breakpoints/delegationTypes.d.ts.map +1 -0
- package/dist/breakpoints/delegationTypes.js +10 -0
- package/dist/breakpoints/postures.d.ts +28 -0
- package/dist/breakpoints/postures.d.ts.map +1 -0
- package/dist/breakpoints/postures.js +100 -0
- package/dist/compression/compaction.d.ts +82 -0
- package/dist/compression/compaction.d.ts.map +1 -0
- package/dist/compression/compaction.js +310 -0
- package/dist/compression/compactionStrategy.d.ts +37 -0
- package/dist/compression/compactionStrategy.d.ts.map +1 -0
- package/dist/compression/compactionStrategy.js +52 -0
- package/dist/compression/compressionFamilies.d.ts +39 -0
- package/dist/compression/compressionFamilies.d.ts.map +1 -0
- package/dist/compression/compressionFamilies.js +123 -0
- package/dist/context/dynamic.d.ts +16 -0
- package/dist/context/dynamic.d.ts.map +1 -0
- package/dist/context/dynamic.js +55 -0
- package/dist/context/instructions.d.ts +15 -0
- package/dist/context/instructions.d.ts.map +1 -0
- package/dist/context/instructions.js +97 -0
- package/dist/cost/claudeCodeParser.d.ts +81 -0
- package/dist/cost/claudeCodeParser.d.ts.map +1 -0
- package/dist/cost/claudeCodeParser.js +232 -0
- package/dist/cost/collector.d.ts +42 -0
- package/dist/cost/collector.d.ts.map +1 -0
- package/dist/cost/collector.js +105 -0
- package/dist/cost/effectCost.d.ts +23 -0
- package/dist/cost/effectCost.d.ts.map +1 -0
- package/dist/cost/effectCost.js +26 -0
- package/dist/cost/index.d.ts +7 -0
- package/dist/cost/index.d.ts.map +1 -0
- package/dist/cost/index.js +28 -0
- package/dist/cost/journal.d.ts +40 -0
- package/dist/cost/journal.d.ts.map +1 -0
- package/dist/cost/journal.js +158 -0
- package/dist/cost/types.d.ts +172 -0
- package/dist/cost/types.d.ts.map +1 -0
- package/dist/cost/types.js +229 -0
- package/dist/daemon/automationExecutor.d.ts +16 -0
- package/dist/daemon/automationExecutor.d.ts.map +1 -0
- package/dist/daemon/automationExecutor.js +222 -0
- package/dist/daemon/config.d.ts +8 -0
- package/dist/daemon/config.d.ts.map +1 -0
- package/dist/daemon/config.js +245 -0
- package/dist/daemon/daemonLog.d.ts +13 -0
- package/dist/daemon/daemonLog.d.ts.map +1 -0
- package/dist/daemon/daemonLog.js +64 -0
- package/dist/daemon/durableQueue.d.ts +41 -0
- package/dist/daemon/durableQueue.d.ts.map +1 -0
- package/dist/daemon/durableQueue.js +183 -0
- package/dist/daemon/fileWatcher.d.ts +9 -0
- package/dist/daemon/fileWatcher.d.ts.map +1 -0
- package/dist/daemon/fileWatcher.js +144 -0
- package/dist/daemon/index.d.ts +9 -0
- package/dist/daemon/index.d.ts.map +1 -0
- package/dist/daemon/index.js +26 -0
- package/dist/daemon/lifecycle.d.ts +12 -0
- package/dist/daemon/lifecycle.d.ts.map +1 -0
- package/dist/daemon/lifecycle.js +257 -0
- package/dist/daemon/loop.d.ts +27 -0
- package/dist/daemon/loop.d.ts.map +1 -0
- package/dist/daemon/loop.js +387 -0
- package/dist/daemon/timerScheduler.d.ts +13 -0
- package/dist/daemon/timerScheduler.d.ts.map +1 -0
- package/dist/daemon/timerScheduler.js +212 -0
- package/dist/daemon/types.d.ts +122 -0
- package/dist/daemon/types.d.ts.map +1 -0
- package/dist/daemon/types.js +25 -0
- package/dist/daemon/webhookListener.d.ts +6 -0
- package/dist/daemon/webhookListener.d.ts.map +1 -0
- package/dist/daemon/webhookListener.js +132 -0
- package/dist/extensions/discovery.d.ts +15 -0
- package/dist/extensions/discovery.d.ts.map +1 -0
- package/dist/extensions/discovery.js +119 -0
- package/dist/extensions/installer.d.ts +14 -0
- package/dist/extensions/installer.d.ts.map +1 -0
- package/dist/extensions/installer.js +100 -0
- package/dist/governance/authority.d.ts +68 -0
- package/dist/governance/authority.d.ts.map +1 -0
- package/dist/governance/authority.js +136 -0
- package/dist/governance/bridge.d.ts +17 -0
- package/dist/governance/bridge.d.ts.map +1 -0
- package/dist/governance/bridge.js +46 -0
- package/dist/governance/builtins.d.ts +25 -0
- package/dist/governance/builtins.d.ts.map +1 -0
- package/dist/governance/builtins.js +67 -0
- package/dist/governance/categories.d.ts +58 -0
- package/dist/governance/categories.d.ts.map +1 -0
- package/dist/governance/categories.js +120 -0
- package/dist/governance/decisionTrail.d.ts +60 -0
- package/dist/governance/decisionTrail.d.ts.map +1 -0
- package/dist/governance/decisionTrail.js +68 -0
- package/dist/governance/engine.d.ts +20 -0
- package/dist/governance/engine.d.ts.map +1 -0
- package/dist/governance/engine.js +124 -0
- package/dist/governance/index.d.ts +20 -0
- package/dist/governance/index.d.ts.map +1 -0
- package/dist/governance/index.js +75 -0
- package/dist/governance/logging.d.ts +18 -0
- package/dist/governance/logging.d.ts.map +1 -0
- package/dist/governance/logging.js +83 -0
- package/dist/governance/mandate.d.ts +83 -0
- package/dist/governance/mandate.d.ts.map +1 -0
- package/dist/governance/mandate.js +180 -0
- package/dist/governance/permissionEvents.d.ts +51 -0
- package/dist/governance/permissionEvents.d.ts.map +1 -0
- package/dist/governance/permissionEvents.js +52 -0
- package/dist/governance/permissionPropagation.d.ts +18 -0
- package/dist/governance/permissionPropagation.d.ts.map +1 -0
- package/dist/governance/permissionPropagation.js +58 -0
- package/dist/governance/postureBridge.d.ts +17 -0
- package/dist/governance/postureBridge.d.ts.map +1 -0
- package/dist/governance/postureBridge.js +117 -0
- package/dist/governance/privacySettings.d.ts +31 -0
- package/dist/governance/privacySettings.d.ts.map +1 -0
- package/dist/governance/privacySettings.js +104 -0
- package/dist/governance/sandboxBridge.d.ts +49 -0
- package/dist/governance/sandboxBridge.d.ts.map +1 -0
- package/dist/governance/sandboxBridge.js +77 -0
- package/dist/governance/sandboxPolicy.d.ts +51 -0
- package/dist/governance/sandboxPolicy.d.ts.map +1 -0
- package/dist/governance/sandboxPolicy.js +177 -0
- package/dist/governance/types.d.ts +3 -0
- package/dist/governance/types.d.ts.map +1 -0
- package/dist/governance/types.js +5 -0
- package/dist/harness/adapters/adapterBridge.d.ts +71 -0
- package/dist/harness/adapters/adapterBridge.d.ts.map +1 -0
- package/dist/harness/adapters/adapterBridge.js +117 -0
- package/dist/harness/adapters/adapterClientFactory.d.ts +29 -0
- package/dist/harness/adapters/adapterClientFactory.d.ts.map +1 -0
- package/dist/harness/adapters/adapterClientFactory.js +90 -0
- package/dist/harness/adapters/adapterEventEmitter.d.ts +51 -0
- package/dist/harness/adapters/adapterEventEmitter.d.ts.map +1 -0
- package/dist/harness/adapters/adapterEventEmitter.js +143 -0
- package/dist/harness/adapters/adapterEventMapper.d.ts +63 -0
- package/dist/harness/adapters/adapterEventMapper.d.ts.map +1 -0
- package/dist/harness/adapters/adapterEventMapper.js +100 -0
- package/dist/harness/adapters/adapterHarnessMap.d.ts +25 -0
- package/dist/harness/adapters/adapterHarnessMap.d.ts.map +1 -0
- package/dist/harness/adapters/adapterHarnessMap.js +55 -0
- package/dist/harness/adapters/adapterStdinReader.d.ts +45 -0
- package/dist/harness/adapters/adapterStdinReader.d.ts.map +1 -0
- package/dist/harness/adapters/adapterStdinReader.js +106 -0
- package/dist/harness/adapters/adapterTypes.d.ts +122 -0
- package/dist/harness/adapters/adapterTypes.d.ts.map +1 -0
- package/dist/harness/adapters/adapterTypes.js +11 -0
- package/dist/harness/adapters/index.d.ts +17 -0
- package/dist/harness/adapters/index.d.ts.map +1 -0
- package/dist/harness/adapters/index.js +34 -0
- package/dist/harness/backgroundTracker.d.ts +64 -0
- package/dist/harness/backgroundTracker.d.ts.map +1 -0
- package/dist/harness/backgroundTracker.js +107 -0
- package/dist/harness/budgetDowngrade.d.ts +12 -0
- package/dist/harness/budgetDowngrade.d.ts.map +1 -0
- package/dist/harness/budgetDowngrade.js +71 -0
- package/dist/harness/builtInHarness.d.ts +3 -0
- package/dist/harness/builtInHarness.d.ts.map +1 -0
- package/dist/harness/builtInHarness.js +18 -0
- package/dist/harness/capabilityRouter.d.ts +76 -0
- package/dist/harness/capabilityRouter.d.ts.map +1 -0
- package/dist/harness/capabilityRouter.js +176 -0
- package/dist/harness/circuitBreaker.d.ts +51 -0
- package/dist/harness/circuitBreaker.d.ts.map +1 -0
- package/dist/harness/circuitBreaker.js +110 -0
- package/dist/harness/concurrentEffects.d.ts +39 -0
- package/dist/harness/concurrentEffects.d.ts.map +1 -0
- package/dist/harness/concurrentEffects.js +90 -0
- package/dist/harness/effectRouting.d.ts +57 -0
- package/dist/harness/effectRouting.d.ts.map +1 -0
- package/dist/harness/effectRouting.js +130 -0
- package/dist/harness/extensionToolBridge.d.ts +13 -0
- package/dist/harness/extensionToolBridge.d.ts.map +1 -0
- package/dist/harness/extensionToolBridge.js +23 -0
- package/dist/harness/fallbackChains.d.ts +42 -0
- package/dist/harness/fallbackChains.d.ts.map +1 -0
- package/dist/harness/fallbackChains.js +69 -0
- package/dist/harness/gentySessionContext.d.ts +31 -0
- package/dist/harness/gentySessionContext.d.ts.map +1 -0
- package/dist/harness/gentySessionContext.js +49 -0
- package/dist/harness/gentySessionIntegration.d.ts +16 -0
- package/dist/harness/gentySessionIntegration.d.ts.map +1 -0
- package/dist/harness/gentySessionIntegration.js +66 -0
- package/dist/harness/hostContract.d.ts +69 -0
- package/dist/harness/hostContract.d.ts.map +1 -0
- package/dist/harness/hostContract.js +169 -0
- package/dist/harness/index.d.ts +25 -0
- package/dist/harness/index.d.ts.map +1 -0
- package/dist/harness/index.js +122 -0
- package/dist/harness/internal/createRun/agent-core-loop.d.ts +43 -0
- package/dist/harness/internal/createRun/agent-core-loop.d.ts.map +1 -0
- package/dist/harness/internal/createRun/agent-core-loop.js +247 -0
- package/dist/harness/internal/createRun/askUserQuestion.d.ts +11 -0
- package/dist/harness/internal/createRun/askUserQuestion.d.ts.map +1 -0
- package/dist/harness/internal/createRun/askUserQuestion.js +162 -0
- package/dist/harness/internal/createRun/index.d.ts +25 -0
- package/dist/harness/internal/createRun/index.d.ts.map +1 -0
- package/dist/harness/internal/createRun/index.js +163 -0
- package/dist/harness/internal/createRun/orchestration/constants.d.ts +7 -0
- package/dist/harness/internal/createRun/orchestration/constants.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/constants.js +17 -0
- package/dist/harness/internal/createRun/orchestration/dispatch.d.ts +23 -0
- package/dist/harness/internal/createRun/orchestration/dispatch.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/dispatch.js +135 -0
- package/dist/harness/internal/createRun/orchestration/effects.d.ts +135 -0
- package/dist/harness/internal/createRun/orchestration/effects.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/effects.js +904 -0
- package/dist/harness/internal/createRun/orchestration/effectsHelpers.d.ts +21 -0
- package/dist/harness/internal/createRun/orchestration/effectsHelpers.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/effectsHelpers.js +80 -0
- package/dist/harness/internal/createRun/orchestration/externalPhase.d.ts +3 -0
- package/dist/harness/internal/createRun/orchestration/externalPhase.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/externalPhase.js +403 -0
- package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.d.ts +16 -0
- package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/externalPhaseHelpers.js +106 -0
- package/dist/harness/internal/createRun/orchestration/hookDecisionEffects.d.ts +32 -0
- package/dist/harness/internal/createRun/orchestration/hookDecisionEffects.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/hookDecisionEffects.js +76 -0
- package/dist/harness/internal/createRun/orchestration/index.d.ts +29 -0
- package/dist/harness/internal/createRun/orchestration/index.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/index.js +370 -0
- package/dist/harness/internal/createRun/orchestration/internalPhase.d.ts +3 -0
- package/dist/harness/internal/createRun/orchestration/internalPhase.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/internalPhase.js +656 -0
- package/dist/harness/internal/createRun/orchestration/internalTools.d.ts +27 -0
- package/dist/harness/internal/createRun/orchestration/internalTools.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/internalTools.js +264 -0
- package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.d.ts +17 -0
- package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/internalToolsHelpers.js +23 -0
- package/dist/harness/internal/createRun/orchestration/taskResult.d.ts +10 -0
- package/dist/harness/internal/createRun/orchestration/taskResult.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/taskResult.js +67 -0
- package/dist/harness/internal/createRun/orchestration/types.d.ts +48 -0
- package/dist/harness/internal/createRun/orchestration/types.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/types.js +2 -0
- package/dist/harness/internal/createRun/orchestration/verbose.d.ts +7 -0
- package/dist/harness/internal/createRun/orchestration/verbose.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/verbose.js +240 -0
- package/dist/harness/internal/createRun/orchestration/workerSessionEnhancer.d.ts +4 -0
- package/dist/harness/internal/createRun/orchestration/workerSessionEnhancer.d.ts.map +1 -0
- package/dist/harness/internal/createRun/orchestration/workerSessionEnhancer.js +36 -0
- package/dist/harness/internal/createRun/output.d.ts +40 -0
- package/dist/harness/internal/createRun/output.d.ts.map +1 -0
- package/dist/harness/internal/createRun/output.js +467 -0
- package/dist/harness/internal/createRun/pi.d.ts +10 -0
- package/dist/harness/internal/createRun/pi.d.ts.map +1 -0
- package/dist/harness/internal/createRun/pi.js +35 -0
- package/dist/harness/internal/createRun/planProcess/agentOutput.d.ts +5 -0
- package/dist/harness/internal/createRun/planProcess/agentOutput.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/agentOutput.js +113 -0
- package/dist/harness/internal/createRun/planProcess/delegation.d.ts +23 -0
- package/dist/harness/internal/createRun/planProcess/delegation.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/delegation.js +176 -0
- package/dist/harness/internal/createRun/planProcess/external.d.ts +14 -0
- package/dist/harness/internal/createRun/planProcess/external.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/external.js +139 -0
- package/dist/harness/internal/createRun/planProcess/index.d.ts +12 -0
- package/dist/harness/internal/createRun/planProcess/index.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/index.js +24 -0
- package/dist/harness/internal/createRun/planProcess/paths.d.ts +7 -0
- package/dist/harness/internal/createRun/planProcess/paths.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/paths.js +98 -0
- package/dist/harness/internal/createRun/planProcess/phase.d.ts +6 -0
- package/dist/harness/internal/createRun/planProcess/phase.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/phase.js +424 -0
- package/dist/harness/internal/createRun/planProcess/phaseHelpers.d.ts +37 -0
- package/dist/harness/internal/createRun/planProcess/phaseHelpers.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/phaseHelpers.js +159 -0
- package/dist/harness/internal/createRun/planProcess/phaseTypes.d.ts +25 -0
- package/dist/harness/internal/createRun/planProcess/phaseTypes.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/phaseTypes.js +6 -0
- package/dist/harness/internal/createRun/planProcess/prompts.d.ts +22 -0
- package/dist/harness/internal/createRun/planProcess/prompts.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/prompts.js +239 -0
- package/dist/harness/internal/createRun/planProcess/recovery.d.ts +18 -0
- package/dist/harness/internal/createRun/planProcess/recovery.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/recovery.js +205 -0
- package/dist/harness/internal/createRun/planProcess/runState.d.ts +40 -0
- package/dist/harness/internal/createRun/planProcess/runState.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/runState.js +179 -0
- package/dist/harness/internal/createRun/planProcess/understandIntent.d.ts +22 -0
- package/dist/harness/internal/createRun/planProcess/understandIntent.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/understandIntent.js +65 -0
- package/dist/harness/internal/createRun/planProcess/validation.d.ts +4 -0
- package/dist/harness/internal/createRun/planProcess/validation.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/validation.js +260 -0
- package/dist/harness/internal/createRun/planProcess/validationSource.d.ts +13 -0
- package/dist/harness/internal/createRun/planProcess/validationSource.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/validationSource.js +345 -0
- package/dist/harness/internal/createRun/planProcess/validationText.d.ts +3 -0
- package/dist/harness/internal/createRun/planProcess/validationText.d.ts.map +1 -0
- package/dist/harness/internal/createRun/planProcess/validationText.js +145 -0
- package/dist/harness/internal/createRun/prompts.d.ts +59 -0
- package/dist/harness/internal/createRun/prompts.d.ts.map +1 -0
- package/dist/harness/internal/createRun/prompts.js +427 -0
- package/dist/harness/internal/createRun/resumeState.d.ts +28 -0
- package/dist/harness/internal/createRun/resumeState.d.ts.map +1 -0
- package/dist/harness/internal/createRun/resumeState.js +133 -0
- package/dist/harness/internal/createRun/utils.d.ts +184 -0
- package/dist/harness/internal/createRun/utils.d.ts.map +1 -0
- package/dist/harness/internal/createRun/utils.js +218 -0
- package/dist/harness/internal.d.ts +13 -0
- package/dist/harness/internal.d.ts.map +1 -0
- package/dist/harness/internal.js +149 -0
- package/dist/harness/invoker/launch.d.ts +20 -0
- package/dist/harness/invoker/launch.d.ts.map +1 -0
- package/dist/harness/invoker/launch.js +23 -0
- package/dist/harness/invoker/processControl.d.ts +11 -0
- package/dist/harness/invoker/processControl.d.ts.map +1 -0
- package/dist/harness/invoker/processControl.js +50 -0
- package/dist/harness/invoker.d.ts +44 -0
- package/dist/harness/invoker.d.ts.map +1 -0
- package/dist/harness/invoker.js +341 -0
- package/dist/harness/lspIntegration.d.ts +48 -0
- package/dist/harness/lspIntegration.d.ts.map +1 -0
- package/dist/harness/lspIntegration.js +45 -0
- package/dist/harness/modeSelector.d.ts +50 -0
- package/dist/harness/modeSelector.d.ts.map +1 -0
- package/dist/harness/modeSelector.js +124 -0
- package/dist/harness/modelSelection.d.ts +37 -0
- package/dist/harness/modelSelection.d.ts.map +1 -0
- package/dist/harness/modelSelection.js +81 -0
- package/dist/harness/multiHarnessDispatch.d.ts +49 -0
- package/dist/harness/multiHarnessDispatch.d.ts.map +1 -0
- package/dist/harness/multiHarnessDispatch.js +73 -0
- package/dist/harness/oauthIntegration.d.ts +55 -0
- package/dist/harness/oauthIntegration.d.ts.map +1 -0
- package/dist/harness/oauthIntegration.js +84 -0
- package/dist/harness/operatorCommands.d.ts +38 -0
- package/dist/harness/operatorCommands.d.ts.map +1 -0
- package/dist/harness/operatorCommands.js +118 -0
- package/dist/harness/parallelFileOps.d.ts +56 -0
- package/dist/harness/parallelFileOps.d.ts.map +1 -0
- package/dist/harness/parallelFileOps.js +166 -0
- package/dist/harness/piSecureSandbox.d.ts +8 -0
- package/dist/harness/piSecureSandbox.d.ts.map +1 -0
- package/dist/harness/piSecureSandbox.js +366 -0
- package/dist/harness/piSecureSandboxTypes.d.ts +51 -0
- package/dist/harness/piSecureSandboxTypes.d.ts.map +1 -0
- package/dist/harness/piSecureSandboxTypes.js +6 -0
- package/dist/harness/piWrapper/compaction.d.ts +13 -0
- package/dist/harness/piWrapper/compaction.d.ts.map +1 -0
- package/dist/harness/piWrapper/compaction.js +38 -0
- package/dist/harness/piWrapper/instructionPrompts.d.ts +2 -0
- package/dist/harness/piWrapper/instructionPrompts.d.ts.map +1 -0
- package/dist/harness/piWrapper/instructionPrompts.js +97 -0
- package/dist/harness/piWrapper/moduleSupport.d.ts +78 -0
- package/dist/harness/piWrapper/moduleSupport.d.ts.map +1 -0
- package/dist/harness/piWrapper/moduleSupport.js +207 -0
- package/dist/harness/piWrapper.d.ts +82 -0
- package/dist/harness/piWrapper.d.ts.map +1 -0
- package/dist/harness/piWrapper.js +406 -0
- package/dist/harness/planMode.d.ts +68 -0
- package/dist/harness/planMode.d.ts.map +1 -0
- package/dist/harness/planMode.js +145 -0
- package/dist/harness/profileOrchestration.d.ts +55 -0
- package/dist/harness/profileOrchestration.d.ts.map +1 -0
- package/dist/harness/profileOrchestration.js +61 -0
- package/dist/harness/selectionPolicies.d.ts +29 -0
- package/dist/harness/selectionPolicies.d.ts.map +1 -0
- package/dist/harness/selectionPolicies.js +165 -0
- package/dist/harness/streamingParallelism.d.ts +43 -0
- package/dist/harness/streamingParallelism.d.ts.map +1 -0
- package/dist/harness/streamingParallelism.js +113 -0
- package/dist/harness/streamingRenderer.d.ts +64 -0
- package/dist/harness/streamingRenderer.d.ts.map +1 -0
- package/dist/harness/streamingRenderer.js +85 -0
- package/dist/harness/types.d.ts +278 -0
- package/dist/harness/types.d.ts.map +1 -0
- package/dist/harness/types.js +34 -0
- package/dist/harness/websocketSession.d.ts +63 -0
- package/dist/harness/websocketSession.d.ts.map +1 -0
- package/dist/harness/websocketSession.js +113 -0
- package/dist/harness/worktreeIsolation.d.ts +39 -0
- package/dist/harness/worktreeIsolation.d.ts.map +1 -0
- package/dist/harness/worktreeIsolation.js +85 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +54 -0
- package/dist/interaction/askUserQuestion/core.d.ts +8 -0
- package/dist/interaction/askUserQuestion/core.d.ts.map +1 -0
- package/dist/interaction/askUserQuestion/core.js +112 -0
- package/dist/interaction/askUserQuestion/terminal.d.ts +15 -0
- package/dist/interaction/askUserQuestion/terminal.d.ts.map +1 -0
- package/dist/interaction/askUserQuestion/terminal.js +128 -0
- package/dist/interaction/askUserQuestion.d.ts +10 -0
- package/dist/interaction/askUserQuestion.d.ts.map +1 -0
- package/dist/interaction/askUserQuestion.js +295 -0
- package/dist/interaction/askUserQuestionTypes.d.ts +31 -0
- package/dist/interaction/askUserQuestionTypes.d.ts.map +1 -0
- package/dist/interaction/askUserQuestionTypes.js +6 -0
- package/dist/interaction/commandDiscovery.d.ts +38 -0
- package/dist/interaction/commandDiscovery.d.ts.map +1 -0
- package/dist/interaction/commandDiscovery.js +106 -0
- package/dist/interaction/index.d.ts +11 -0
- package/dist/interaction/index.d.ts.map +1 -0
- package/dist/interaction/index.js +42 -0
- package/dist/interaction/interactionRouter.d.ts +25 -0
- package/dist/interaction/interactionRouter.d.ts.map +1 -0
- package/dist/interaction/interactionRouter.js +55 -0
- package/dist/interaction/model-switch.d.ts +16 -0
- package/dist/interaction/model-switch.d.ts.map +1 -0
- package/dist/interaction/model-switch.js +41 -0
- package/dist/interaction/permissionApprovalUi.d.ts +32 -0
- package/dist/interaction/permissionApprovalUi.d.ts.map +1 -0
- package/dist/interaction/permissionApprovalUi.js +96 -0
- package/dist/interaction/steering.d.ts +17 -0
- package/dist/interaction/steering.d.ts.map +1 -0
- package/dist/interaction/steering.js +41 -0
- package/dist/interaction/typedEffectPatterns.d.ts +55 -0
- package/dist/interaction/typedEffectPatterns.d.ts.map +1 -0
- package/dist/interaction/typedEffectPatterns.js +190 -0
- package/dist/mcp/channels/allowlist.d.ts +19 -0
- package/dist/mcp/channels/allowlist.d.ts.map +1 -0
- package/dist/mcp/channels/allowlist.js +140 -0
- package/dist/mcp/channels/channelManager.d.ts +64 -0
- package/dist/mcp/channels/channelManager.d.ts.map +1 -0
- package/dist/mcp/channels/channelManager.js +137 -0
- package/dist/mcp/channels/inboundQueue.d.ts +47 -0
- package/dist/mcp/channels/inboundQueue.d.ts.map +1 -0
- package/dist/mcp/channels/inboundQueue.js +96 -0
- package/dist/mcp/channels/index.d.ts +16 -0
- package/dist/mcp/channels/index.d.ts.map +1 -0
- package/dist/mcp/channels/index.js +38 -0
- package/dist/mcp/channels/outbound.d.ts +33 -0
- package/dist/mcp/channels/outbound.d.ts.map +1 -0
- package/dist/mcp/channels/outbound.js +94 -0
- package/dist/mcp/channels/permissionRelay.d.ts +62 -0
- package/dist/mcp/channels/permissionRelay.d.ts.map +1 -0
- package/dist/mcp/channels/permissionRelay.js +159 -0
- package/dist/mcp/channels/types.d.ts +135 -0
- package/dist/mcp/channels/types.d.ts.map +1 -0
- package/dist/mcp/channels/types.js +16 -0
- package/dist/mcp/client/auth.d.ts +57 -0
- package/dist/mcp/client/auth.d.ts.map +1 -0
- package/dist/mcp/client/auth.js +99 -0
- package/dist/mcp/client/config.d.ts +28 -0
- package/dist/mcp/client/config.d.ts.map +1 -0
- package/dist/mcp/client/config.js +144 -0
- package/dist/mcp/client/executor.d.ts +30 -0
- package/dist/mcp/client/executor.d.ts.map +1 -0
- package/dist/mcp/client/executor.js +61 -0
- package/dist/mcp/client/index.d.ts +13 -0
- package/dist/mcp/client/index.d.ts.map +1 -0
- package/dist/mcp/client/index.js +30 -0
- package/dist/mcp/client/manager.d.ts +74 -0
- package/dist/mcp/client/manager.d.ts.map +1 -0
- package/dist/mcp/client/manager.js +215 -0
- package/dist/mcp/client/resourceBrowser.d.ts +52 -0
- package/dist/mcp/client/resourceBrowser.d.ts.map +1 -0
- package/dist/mcp/client/resourceBrowser.js +80 -0
- package/dist/mcp/client/toolRegistry.d.ts +113 -0
- package/dist/mcp/client/toolRegistry.d.ts.map +1 -0
- package/dist/mcp/client/toolRegistry.js +190 -0
- package/dist/mcp/client/types.d.ts +96 -0
- package/dist/mcp/client/types.d.ts.map +1 -0
- package/dist/mcp/client/types.js +15 -0
- package/dist/mcp/transport/index.d.ts +9 -0
- package/dist/mcp/transport/index.d.ts.map +1 -0
- package/dist/mcp/transport/index.js +13 -0
- package/dist/mcp/transport/session.d.ts +18 -0
- package/dist/mcp/transport/session.d.ts.map +1 -0
- package/dist/mcp/transport/session.js +78 -0
- package/dist/mcp/transport/types.d.ts +19 -0
- package/dist/mcp/transport/types.d.ts.map +1 -0
- package/dist/mcp/transport/types.js +7 -0
- package/dist/mcp/transport/websocket.d.ts +41 -0
- package/dist/mcp/transport/websocket.d.ts.map +1 -0
- package/dist/mcp/transport/websocket.js +271 -0
- package/dist/observability/alertWebhooks.d.ts +35 -0
- package/dist/observability/alertWebhooks.d.ts.map +1 -0
- package/dist/observability/alertWebhooks.js +68 -0
- package/dist/observability/analytics.d.ts +66 -0
- package/dist/observability/analytics.d.ts.map +1 -0
- package/dist/observability/analytics.js +104 -0
- package/dist/observability/auditExport.d.ts +25 -0
- package/dist/observability/auditExport.d.ts.map +1 -0
- package/dist/observability/auditExport.js +108 -0
- package/dist/observability/contextIntrospection.d.ts +40 -0
- package/dist/observability/contextIntrospection.d.ts.map +1 -0
- package/dist/observability/contextIntrospection.js +93 -0
- package/dist/observability/failureTriage.d.ts +28 -0
- package/dist/observability/failureTriage.d.ts.map +1 -0
- package/dist/observability/failureTriage.js +168 -0
- package/dist/observability/health.d.ts +19 -0
- package/dist/observability/health.d.ts.map +1 -0
- package/dist/observability/health.js +129 -0
- package/dist/observability/index.d.ts +14 -0
- package/dist/observability/index.d.ts.map +1 -0
- package/dist/observability/index.js +53 -0
- package/dist/observability/progressSummarizer.d.ts +27 -0
- package/dist/observability/progressSummarizer.d.ts.map +1 -0
- package/dist/observability/progressSummarizer.js +143 -0
- package/dist/observability/promptPlan.d.ts +52 -0
- package/dist/observability/promptPlan.d.ts.map +1 -0
- package/dist/observability/promptPlan.js +101 -0
- package/dist/observability/resumeDashboard.d.ts +32 -0
- package/dist/observability/resumeDashboard.d.ts.map +1 -0
- package/dist/observability/resumeDashboard.js +204 -0
- package/dist/observability/runStatus.d.ts +44 -0
- package/dist/observability/runStatus.d.ts.map +1 -0
- package/dist/observability/runStatus.js +169 -0
- package/dist/observability/subagentHealth.d.ts +66 -0
- package/dist/observability/subagentHealth.d.ts.map +1 -0
- package/dist/observability/subagentHealth.js +107 -0
- package/dist/observability/subagentProgress.d.ts +64 -0
- package/dist/observability/subagentProgress.d.ts.map +1 -0
- package/dist/observability/subagentProgress.js +91 -0
- package/dist/observability/timeline.d.ts +11 -0
- package/dist/observability/timeline.d.ts.map +1 -0
- package/dist/observability/timeline.js +176 -0
- package/dist/observability/types.d.ts +62 -0
- package/dist/observability/types.d.ts.map +1 -0
- package/dist/observability/types.js +8 -0
- package/dist/observability/webhooks.d.ts +68 -0
- package/dist/observability/webhooks.d.ts.map +1 -0
- package/dist/observability/webhooks.js +132 -0
- package/dist/plugins/ccCompatibility.d.ts +79 -0
- package/dist/plugins/ccCompatibility.d.ts.map +1 -0
- package/dist/plugins/ccCompatibility.js +139 -0
- package/dist/plugins/index.d.ts +16 -0
- package/dist/plugins/index.d.ts.map +1 -0
- package/dist/plugins/index.js +38 -0
- package/dist/plugins/loader.d.ts +37 -0
- package/dist/plugins/loader.d.ts.map +1 -0
- package/dist/plugins/loader.js +112 -0
- package/dist/plugins/management.d.ts +33 -0
- package/dist/plugins/management.d.ts.map +1 -0
- package/dist/plugins/management.js +99 -0
- package/dist/plugins/marketplace.d.ts +64 -0
- package/dist/plugins/marketplace.d.ts.map +1 -0
- package/dist/plugins/marketplace.js +101 -0
- package/dist/plugins/sandbox.d.ts +38 -0
- package/dist/plugins/sandbox.d.ts.map +1 -0
- package/dist/plugins/sandbox.js +109 -0
- package/dist/plugins/trust.d.ts +31 -0
- package/dist/plugins/trust.d.ts.map +1 -0
- package/dist/plugins/trust.js +66 -0
- package/dist/plugins/types.d.ts +27 -0
- package/dist/plugins/types.d.ts.map +1 -0
- package/dist/plugins/types.js +7 -0
- package/dist/plugins/validation.d.ts +32 -0
- package/dist/plugins/validation.d.ts.map +1 -0
- package/dist/plugins/validation.js +117 -0
- package/dist/plugins/version-check.d.ts +23 -0
- package/dist/plugins/version-check.d.ts.map +1 -0
- package/dist/plugins/version-check.js +70 -0
- package/dist/plugins/versioning.d.ts +40 -0
- package/dist/plugins/versioning.d.ts.map +1 -0
- package/dist/plugins/versioning.js +101 -0
- package/dist/processes/index.d.ts +12 -0
- package/dist/processes/index.d.ts.map +1 -0
- package/dist/processes/index.js +15 -0
- package/dist/processes/recommender.d.ts +36 -0
- package/dist/processes/recommender.d.ts.map +1 -0
- package/dist/processes/recommender.js +73 -0
- package/dist/processes/scorer.d.ts +26 -0
- package/dist/processes/scorer.d.ts.map +1 -0
- package/dist/processes/scorer.js +104 -0
- package/dist/processes/types.d.ts +48 -0
- package/dist/processes/types.d.ts.map +1 -0
- package/dist/processes/types.js +9 -0
- package/dist/runtime/index.d.ts +3 -0
- package/dist/runtime/index.d.ts.map +1 -0
- package/dist/runtime/index.js +28 -0
- package/dist/seams/contract.d.ts +63 -0
- package/dist/seams/contract.d.ts.map +1 -0
- package/dist/seams/contract.js +141 -0
- package/dist/seams/index.d.ts +3 -0
- package/dist/seams/index.d.ts.map +1 -0
- package/dist/seams/index.js +8 -0
- package/dist/session/context.d.ts +22 -0
- package/dist/session/context.d.ts.map +1 -0
- package/dist/session/context.js +113 -0
- package/dist/session/continuityState.d.ts +39 -0
- package/dist/session/continuityState.d.ts.map +1 -0
- package/dist/session/continuityState.js +164 -0
- package/dist/session/cost.d.ts +72 -0
- package/dist/session/cost.d.ts.map +1 -0
- package/dist/session/cost.js +221 -0
- package/dist/session/crossRunComm.d.ts +40 -0
- package/dist/session/crossRunComm.d.ts.map +1 -0
- package/dist/session/crossRunComm.js +86 -0
- package/dist/session/crossRunState.d.ts +8 -0
- package/dist/session/crossRunState.d.ts.map +1 -0
- package/dist/session/crossRunState.js +45 -0
- package/dist/session/discovery.d.ts +22 -0
- package/dist/session/discovery.d.ts.map +1 -0
- package/dist/session/discovery.js +35 -0
- package/dist/session/history.d.ts +30 -0
- package/dist/session/history.d.ts.map +1 -0
- package/dist/session/history.js +144 -0
- package/dist/session/index.d.ts +8 -0
- package/dist/session/index.d.ts.map +1 -0
- package/dist/session/index.js +73 -0
- package/dist/session/memoryConsolidation.d.ts +31 -0
- package/dist/session/memoryConsolidation.d.ts.map +1 -0
- package/dist/session/memoryConsolidation.js +135 -0
- package/dist/session/memoryExtraction.d.ts +65 -0
- package/dist/session/memoryExtraction.d.ts.map +1 -0
- package/dist/session/memoryExtraction.js +201 -0
- package/dist/session/parse.d.ts +45 -0
- package/dist/session/parse.d.ts.map +1 -0
- package/dist/session/parse.js +170 -0
- package/dist/session/persistence.d.ts +46 -0
- package/dist/session/persistence.d.ts.map +1 -0
- package/dist/session/persistence.js +180 -0
- package/dist/session/sessionSharing.d.ts +55 -0
- package/dist/session/sessionSharing.d.ts.map +1 -0
- package/dist/session/sessionSharing.js +113 -0
- package/dist/session/sessionTemplates.d.ts +57 -0
- package/dist/session/sessionTemplates.d.ts.map +1 -0
- package/dist/session/sessionTemplates.js +93 -0
- package/dist/session/types.d.ts +267 -0
- package/dist/session/types.d.ts.map +1 -0
- package/dist/session/types.js +45 -0
- package/dist/session/write.d.ts +61 -0
- package/dist/session/write.d.ts.map +1 -0
- package/dist/session/write.js +213 -0
- package/dist/skills/chain.d.ts +31 -0
- package/dist/skills/chain.d.ts.map +1 -0
- package/dist/skills/chain.js +113 -0
- package/dist/skills/discovery.d.ts +34 -0
- package/dist/skills/discovery.d.ts.map +1 -0
- package/dist/skills/discovery.js +185 -0
- package/dist/skills/index.d.ts +12 -0
- package/dist/skills/index.d.ts.map +1 -0
- package/dist/skills/index.js +18 -0
- package/dist/skills/router.d.ts +35 -0
- package/dist/skills/router.d.ts.map +1 -0
- package/dist/skills/router.js +143 -0
- package/dist/skills/types.d.ts +33 -0
- package/dist/skills/types.d.ts.map +1 -0
- package/dist/skills/types.js +5 -0
- package/dist/storage/atomic.d.ts +2 -0
- package/dist/storage/atomic.d.ts.map +1 -0
- package/dist/storage/atomic.js +54 -0
- package/dist/storage/clock.d.ts +2 -0
- package/dist/storage/clock.d.ts.map +1 -0
- package/dist/storage/clock.js +6 -0
- package/dist/storage/index.d.ts +7 -0
- package/dist/storage/index.d.ts.map +1 -0
- package/dist/storage/index.js +9 -0
- package/dist/storage/journalWatcher.d.ts +24 -0
- package/dist/storage/journalWatcher.d.ts.map +1 -0
- package/dist/storage/journalWatcher.js +173 -0
- package/dist/storage/paths.d.ts +5 -0
- package/dist/storage/paths.d.ts.map +1 -0
- package/dist/storage/paths.js +26 -0
- package/dist/storage/snapshotState.d.ts +10 -0
- package/dist/storage/snapshotState.d.ts.map +1 -0
- package/dist/storage/snapshotState.js +15 -0
- package/dist/storage/storeTaskArtifacts.d.ts +6 -0
- package/dist/storage/storeTaskArtifacts.d.ts.map +1 -0
- package/dist/storage/storeTaskArtifacts.js +55 -0
- package/dist/storage/types.d.ts +21 -0
- package/dist/storage/types.d.ts.map +1 -0
- package/dist/storage/types.js +2 -0
- package/dist/tasks/crud.d.ts +33 -0
- package/dist/tasks/crud.d.ts.map +1 -0
- package/dist/tasks/crud.js +150 -0
- package/dist/tasks/index.d.ts +2 -0
- package/dist/tasks/index.d.ts.map +1 -0
- package/dist/tasks/index.js +9 -0
- package/dist/trust/harness-signing.d.ts +15 -0
- package/dist/trust/harness-signing.d.ts.map +1 -0
- package/dist/trust/harness-signing.js +46 -0
- package/dist/trust/key-store.d.ts +15 -0
- package/dist/trust/key-store.d.ts.map +1 -0
- package/dist/trust/key-store.js +66 -0
- package/package.json +161 -0
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parallel file operations (GAP-PAR-005).
|
|
3
|
+
*
|
|
4
|
+
* Provides concurrency-limited helpers for reading, writing, and globbing
|
|
5
|
+
* files in parallel. Uses a simple semaphore to cap concurrency without
|
|
6
|
+
* external dependencies.
|
|
7
|
+
*/
|
|
8
|
+
export interface FileReadResult {
|
|
9
|
+
path: string;
|
|
10
|
+
content: string;
|
|
11
|
+
error?: undefined;
|
|
12
|
+
}
|
|
13
|
+
export interface FileReadError {
|
|
14
|
+
path: string;
|
|
15
|
+
content?: undefined;
|
|
16
|
+
error: string;
|
|
17
|
+
}
|
|
18
|
+
export type FileReadOutcome = FileReadResult | FileReadError;
|
|
19
|
+
/**
|
|
20
|
+
* Read multiple files concurrently with a configurable concurrency limit.
|
|
21
|
+
*
|
|
22
|
+
* @param paths - Absolute or relative file paths to read.
|
|
23
|
+
* @param concurrency - Max concurrent reads. Default: 8.
|
|
24
|
+
* @returns An array of outcomes (one per input path, preserving order).
|
|
25
|
+
*/
|
|
26
|
+
export declare function readFilesParallel(paths: string[], concurrency?: number): Promise<FileReadOutcome[]>;
|
|
27
|
+
export interface FileWriteEntry {
|
|
28
|
+
path: string;
|
|
29
|
+
content: string;
|
|
30
|
+
}
|
|
31
|
+
export interface FileWriteResult {
|
|
32
|
+
path: string;
|
|
33
|
+
ok: boolean;
|
|
34
|
+
error?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Write multiple files concurrently with a configurable concurrency limit.
|
|
38
|
+
* Creates parent directories as needed.
|
|
39
|
+
*
|
|
40
|
+
* @param entries - File path + content pairs.
|
|
41
|
+
* @param concurrency - Max concurrent writes. Default: 8.
|
|
42
|
+
*/
|
|
43
|
+
export declare function writeFilesParallel(entries: FileWriteEntry[], concurrency?: number): Promise<FileWriteResult[]>;
|
|
44
|
+
/**
|
|
45
|
+
* Run multiple glob patterns in parallel and return merged results.
|
|
46
|
+
*
|
|
47
|
+
* Uses a simple recursive readdir + minimatch-style check.
|
|
48
|
+
* For production use, consider swapping in a dedicated glob library.
|
|
49
|
+
*
|
|
50
|
+
* @param patterns - Glob patterns (only `*` and `**` are supported in
|
|
51
|
+
* the simple built-in matcher).
|
|
52
|
+
* @param cwd - Base directory to resolve against.
|
|
53
|
+
* @param concurrency - Max concurrent pattern evaluations. Default: 4.
|
|
54
|
+
*/
|
|
55
|
+
export declare function globParallel(patterns: string[], cwd: string, concurrency?: number): Promise<string[]>;
|
|
56
|
+
//# sourceMappingURL=parallelFileOps.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"parallelFileOps.d.ts","sourceRoot":"","sources":["../../src/harness/parallelFileOps.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAgCH,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,SAAS,CAAC;CACnB;AAED,MAAM,WAAW,aAAa;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,CAAC,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,MAAM,MAAM,eAAe,GAAG,cAAc,GAAG,aAAa,CAAC;AAE7D;;;;;;GAMG;AACH,wBAAsB,iBAAiB,CACrC,KAAK,EAAE,MAAM,EAAE,EACf,WAAW,SAAI,GACd,OAAO,CAAC,eAAe,EAAE,CAAC,CAU5B;AAMD,MAAM,WAAW,cAAc;IAC7B,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,CAAC;IACb,EAAE,EAAE,OAAO,CAAC;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED;;;;;;GAMG;AACH,wBAAsB,kBAAkB,CACtC,OAAO,EAAE,cAAc,EAAE,EACzB,WAAW,SAAI,GACd,OAAO,CAAC,eAAe,EAAE,CAAC,CAgB5B;AAMD;;;;;;;;;;GAUG;AACH,wBAAsB,YAAY,CAChC,QAAQ,EAAE,MAAM,EAAE,EAClB,GAAG,EAAE,MAAM,EACX,WAAW,SAAI,GACd,OAAO,CAAC,MAAM,EAAE,CAAC,CAiBnB"}
|
|
@@ -0,0 +1,166 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Parallel file operations (GAP-PAR-005).
|
|
4
|
+
*
|
|
5
|
+
* Provides concurrency-limited helpers for reading, writing, and globbing
|
|
6
|
+
* files in parallel. Uses a simple semaphore to cap concurrency without
|
|
7
|
+
* external dependencies.
|
|
8
|
+
*/
|
|
9
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
10
|
+
exports.readFilesParallel = readFilesParallel;
|
|
11
|
+
exports.writeFilesParallel = writeFilesParallel;
|
|
12
|
+
exports.globParallel = globParallel;
|
|
13
|
+
const node_fs_1 = require("node:fs");
|
|
14
|
+
const node_path_1 = require("node:path");
|
|
15
|
+
// ---------------------------------------------------------------------------
|
|
16
|
+
// Concurrency limiter
|
|
17
|
+
// ---------------------------------------------------------------------------
|
|
18
|
+
async function runWithConcurrency(tasks, concurrency) {
|
|
19
|
+
const results = new Array(tasks.length);
|
|
20
|
+
let nextIndex = 0;
|
|
21
|
+
async function worker() {
|
|
22
|
+
while (nextIndex < tasks.length) {
|
|
23
|
+
const idx = nextIndex++;
|
|
24
|
+
results[idx] = await tasks[idx]();
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
const workers = Array.from({ length: Math.min(concurrency, tasks.length) }, () => worker());
|
|
28
|
+
await Promise.all(workers);
|
|
29
|
+
return results;
|
|
30
|
+
}
|
|
31
|
+
/**
|
|
32
|
+
* Read multiple files concurrently with a configurable concurrency limit.
|
|
33
|
+
*
|
|
34
|
+
* @param paths - Absolute or relative file paths to read.
|
|
35
|
+
* @param concurrency - Max concurrent reads. Default: 8.
|
|
36
|
+
* @returns An array of outcomes (one per input path, preserving order).
|
|
37
|
+
*/
|
|
38
|
+
async function readFilesParallel(paths, concurrency = 8) {
|
|
39
|
+
const tasks = paths.map((p) => async () => {
|
|
40
|
+
try {
|
|
41
|
+
const content = await node_fs_1.promises.readFile(p, 'utf-8');
|
|
42
|
+
return { path: p, content };
|
|
43
|
+
}
|
|
44
|
+
catch (err) {
|
|
45
|
+
return { path: p, error: err instanceof Error ? err.message : String(err) };
|
|
46
|
+
}
|
|
47
|
+
});
|
|
48
|
+
return runWithConcurrency(tasks, concurrency);
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Write multiple files concurrently with a configurable concurrency limit.
|
|
52
|
+
* Creates parent directories as needed.
|
|
53
|
+
*
|
|
54
|
+
* @param entries - File path + content pairs.
|
|
55
|
+
* @param concurrency - Max concurrent writes. Default: 8.
|
|
56
|
+
*/
|
|
57
|
+
async function writeFilesParallel(entries, concurrency = 8) {
|
|
58
|
+
const tasks = entries.map((entry) => async () => {
|
|
59
|
+
try {
|
|
60
|
+
const dir = entry.path.replace(/[\\/][^\\/]+$/, '');
|
|
61
|
+
await node_fs_1.promises.mkdir(dir, { recursive: true });
|
|
62
|
+
await node_fs_1.promises.writeFile(entry.path, entry.content, 'utf-8');
|
|
63
|
+
return { path: entry.path, ok: true };
|
|
64
|
+
}
|
|
65
|
+
catch (err) {
|
|
66
|
+
return {
|
|
67
|
+
path: entry.path,
|
|
68
|
+
ok: false,
|
|
69
|
+
error: err instanceof Error ? err.message : String(err),
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
});
|
|
73
|
+
return runWithConcurrency(tasks, concurrency);
|
|
74
|
+
}
|
|
75
|
+
// ---------------------------------------------------------------------------
|
|
76
|
+
// globParallel
|
|
77
|
+
// ---------------------------------------------------------------------------
|
|
78
|
+
/**
|
|
79
|
+
* Run multiple glob patterns in parallel and return merged results.
|
|
80
|
+
*
|
|
81
|
+
* Uses a simple recursive readdir + minimatch-style check.
|
|
82
|
+
* For production use, consider swapping in a dedicated glob library.
|
|
83
|
+
*
|
|
84
|
+
* @param patterns - Glob patterns (only `*` and `**` are supported in
|
|
85
|
+
* the simple built-in matcher).
|
|
86
|
+
* @param cwd - Base directory to resolve against.
|
|
87
|
+
* @param concurrency - Max concurrent pattern evaluations. Default: 4.
|
|
88
|
+
*/
|
|
89
|
+
async function globParallel(patterns, cwd, concurrency = 4) {
|
|
90
|
+
const tasks = patterns.map((pattern) => async () => {
|
|
91
|
+
return matchGlob(pattern, cwd);
|
|
92
|
+
});
|
|
93
|
+
const perPattern = await runWithConcurrency(tasks, concurrency);
|
|
94
|
+
// Deduplicate
|
|
95
|
+
const seen = new Set();
|
|
96
|
+
const result = [];
|
|
97
|
+
for (const group of perPattern) {
|
|
98
|
+
for (const p of group) {
|
|
99
|
+
if (!seen.has(p)) {
|
|
100
|
+
seen.add(p);
|
|
101
|
+
result.push(p);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
return result;
|
|
106
|
+
}
|
|
107
|
+
// ---------------------------------------------------------------------------
|
|
108
|
+
// Simple glob matcher (no external dep)
|
|
109
|
+
// ---------------------------------------------------------------------------
|
|
110
|
+
function globToRegExp(pattern) {
|
|
111
|
+
let re = '';
|
|
112
|
+
let i = 0;
|
|
113
|
+
while (i < pattern.length) {
|
|
114
|
+
const ch = pattern[i];
|
|
115
|
+
if (ch === '*' && pattern[i + 1] === '*') {
|
|
116
|
+
// Match any path segments
|
|
117
|
+
if (pattern[i + 2] === '/' || pattern[i + 2] === '\\') {
|
|
118
|
+
re += '(?:.+[\\\\/])?';
|
|
119
|
+
i += 3;
|
|
120
|
+
}
|
|
121
|
+
else {
|
|
122
|
+
re += '.*';
|
|
123
|
+
i += 2;
|
|
124
|
+
}
|
|
125
|
+
}
|
|
126
|
+
else if (ch === '*') {
|
|
127
|
+
re += '[^\\\\/]*';
|
|
128
|
+
i++;
|
|
129
|
+
}
|
|
130
|
+
else if (ch === '?') {
|
|
131
|
+
re += '[^\\\\/]';
|
|
132
|
+
i++;
|
|
133
|
+
}
|
|
134
|
+
else if (ch === '/' || ch === '\\') {
|
|
135
|
+
re += '[\\\\/]';
|
|
136
|
+
i++;
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
re += ch.replace(/[.+^${}()|[\]\\]/g, '\\$&');
|
|
140
|
+
i++;
|
|
141
|
+
}
|
|
142
|
+
}
|
|
143
|
+
return new RegExp(`^${re}$`);
|
|
144
|
+
}
|
|
145
|
+
async function listRecursive(dir) {
|
|
146
|
+
const entries = await node_fs_1.promises.readdir(dir, { withFileTypes: true });
|
|
147
|
+
const results = [];
|
|
148
|
+
for (const entry of entries) {
|
|
149
|
+
const full = (0, node_path_1.join)(dir, entry.name);
|
|
150
|
+
if (entry.isDirectory()) {
|
|
151
|
+
results.push(...(await listRecursive(full)));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
results.push(full);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
return results;
|
|
158
|
+
}
|
|
159
|
+
async function matchGlob(pattern, cwd) {
|
|
160
|
+
const regex = globToRegExp(pattern);
|
|
161
|
+
const allFiles = await listRecursive(cwd);
|
|
162
|
+
return allFiles.filter((f) => {
|
|
163
|
+
const relative = f.slice(cwd.length).replace(/^[\\/]/, '');
|
|
164
|
+
return regex.test(relative);
|
|
165
|
+
});
|
|
166
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SecureBashBackend } from "./piSecureSandboxTypes";
|
|
2
|
+
export type { PiBashOperations, SecureBashBackend } from "./piSecureSandboxTypes";
|
|
3
|
+
export declare function createSecureBashBackend(options: {
|
|
4
|
+
workspace: string;
|
|
5
|
+
mode: "auto" | "secure" | "local";
|
|
6
|
+
image?: string;
|
|
7
|
+
}): Promise<SecureBashBackend | null>;
|
|
8
|
+
//# sourceMappingURL=piSecureSandbox.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piSecureSandbox.d.ts","sourceRoot":"","sources":["../../src/harness/piSecureSandbox.ts"],"names":[],"mappings":"AAQA,OAAO,KAAK,EAAuF,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AACrJ,YAAY,EAAE,gBAAgB,EAAE,iBAAiB,EAAE,MAAM,wBAAwB,CAAC;AAqUlF,wBAAsB,uBAAuB,CAAC,OAAO,EAAE;IACrD,SAAS,EAAE,MAAM,CAAC;IAClB,IAAI,EAAE,MAAM,GAAG,QAAQ,GAAG,OAAO,CAAC;IAClC,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB,GAAG,OAAO,CAAC,iBAAiB,GAAG,IAAI,CAAC,CAkBpC"}
|
|
@@ -0,0 +1,366 @@
|
|
|
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.createSecureBashBackend = createSecureBashBackend;
|
|
37
|
+
const path = __importStar(require("node:path"));
|
|
38
|
+
const node_child_process_1 = require("node:child_process");
|
|
39
|
+
const AGENTSH_MODULE_ID = "@agentsh/secure-sandbox";
|
|
40
|
+
const DEFAULT_SANDBOX_IMAGE = process.env.BABYSITTER_PI_SANDBOX_IMAGE || "node:22-bookworm";
|
|
41
|
+
const DEFAULT_INSTALL_STRATEGY = process.env.BABYSITTER_PI_SANDBOX_INSTALL_STRATEGY || "download";
|
|
42
|
+
const CONTAINER_WORKSPACE = "/workspace";
|
|
43
|
+
const dynamicImportAgentSH = (() => {
|
|
44
|
+
if (process.env.VITEST) {
|
|
45
|
+
return (specifier) => Promise.resolve(`${specifier}`).then(s => __importStar(require(s)));
|
|
46
|
+
}
|
|
47
|
+
// eslint-disable-next-line @typescript-eslint/no-implied-eval
|
|
48
|
+
return new Function("id", "return import(id)");
|
|
49
|
+
})();
|
|
50
|
+
async function loadAgentSHModule() {
|
|
51
|
+
return await dynamicImportAgentSH(AGENTSH_MODULE_ID);
|
|
52
|
+
}
|
|
53
|
+
function isAbortError(error) {
|
|
54
|
+
return error instanceof Error
|
|
55
|
+
&& (error.name === "AbortError" || error.message.toLowerCase().includes("aborted"));
|
|
56
|
+
}
|
|
57
|
+
function shellQuote(value) {
|
|
58
|
+
return `'${value.replace(/'/g, `'"'"'`)}'`;
|
|
59
|
+
}
|
|
60
|
+
function buildEnvPrefix(env) {
|
|
61
|
+
if (!env)
|
|
62
|
+
return "";
|
|
63
|
+
const parts = Object.entries(env)
|
|
64
|
+
.filter((entry) => typeof entry[1] === "string")
|
|
65
|
+
.map(([key, value]) => `${key}=${shellQuote(value)}`);
|
|
66
|
+
return parts.length > 0 ? `${parts.join(" ")} ` : "";
|
|
67
|
+
}
|
|
68
|
+
function toDockerExecArgs(containerName, options) {
|
|
69
|
+
const args = ["exec"];
|
|
70
|
+
if (options?.detached)
|
|
71
|
+
args.push("-d");
|
|
72
|
+
if (options?.cwd)
|
|
73
|
+
args.push("-w", options.cwd);
|
|
74
|
+
if (options?.sudo)
|
|
75
|
+
args.push("--user", "root");
|
|
76
|
+
if (options?.env) {
|
|
77
|
+
for (const [key, value] of Object.entries(options.env)) {
|
|
78
|
+
args.push("-e", `${key}=${value}`);
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
args.push(containerName);
|
|
82
|
+
return args;
|
|
83
|
+
}
|
|
84
|
+
function mapHostPathToContainer(workspaceHost, targetPath) {
|
|
85
|
+
if (!targetPath)
|
|
86
|
+
return CONTAINER_WORKSPACE;
|
|
87
|
+
const base = path.resolve(workspaceHost);
|
|
88
|
+
const target = path.resolve(targetPath);
|
|
89
|
+
const relative = path.relative(base, target);
|
|
90
|
+
if (!relative || relative === ".")
|
|
91
|
+
return CONTAINER_WORKSPACE;
|
|
92
|
+
if (relative.startsWith("..") || path.isAbsolute(relative))
|
|
93
|
+
return CONTAINER_WORKSPACE;
|
|
94
|
+
return path.posix.join(CONTAINER_WORKSPACE, ...relative.split(path.sep).filter(Boolean));
|
|
95
|
+
}
|
|
96
|
+
function normalizeContainerPath(workspaceHost, targetPath) {
|
|
97
|
+
if (!targetPath)
|
|
98
|
+
return CONTAINER_WORKSPACE;
|
|
99
|
+
if (targetPath.startsWith("/"))
|
|
100
|
+
return targetPath;
|
|
101
|
+
return mapHostPathToContainer(workspaceHost, targetPath);
|
|
102
|
+
}
|
|
103
|
+
function createContainerName() {
|
|
104
|
+
const random = Math.random().toString(36).slice(2, 10);
|
|
105
|
+
return `babysitter-pi-${process.pid}-${random}`;
|
|
106
|
+
}
|
|
107
|
+
function runCommand(command, args, options) {
|
|
108
|
+
return new Promise((resolve, reject) => {
|
|
109
|
+
let settled = false;
|
|
110
|
+
const child = (0, node_child_process_1.spawn)(command, args, {
|
|
111
|
+
cwd: options?.cwd,
|
|
112
|
+
env: options?.env,
|
|
113
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
114
|
+
windowsHide: true,
|
|
115
|
+
});
|
|
116
|
+
const stdout = [];
|
|
117
|
+
const stderr = [];
|
|
118
|
+
let timedOut = false;
|
|
119
|
+
let timer;
|
|
120
|
+
if (options?.timeout && options.timeout > 0) {
|
|
121
|
+
timer = setTimeout(() => {
|
|
122
|
+
timedOut = true;
|
|
123
|
+
child.kill("SIGTERM");
|
|
124
|
+
}, options.timeout);
|
|
125
|
+
}
|
|
126
|
+
child.stdout.on("data", (chunk) => stdout.push(chunk));
|
|
127
|
+
child.stderr.on("data", (chunk) => stderr.push(chunk));
|
|
128
|
+
child.stdin.on("error", (error) => {
|
|
129
|
+
if (error.code === "EPIPE")
|
|
130
|
+
return;
|
|
131
|
+
if (!settled) {
|
|
132
|
+
settled = true;
|
|
133
|
+
reject(error);
|
|
134
|
+
}
|
|
135
|
+
});
|
|
136
|
+
child.on("error", (error) => {
|
|
137
|
+
if (!settled) {
|
|
138
|
+
settled = true;
|
|
139
|
+
reject(error);
|
|
140
|
+
}
|
|
141
|
+
});
|
|
142
|
+
child.on("close", (code) => {
|
|
143
|
+
if (settled)
|
|
144
|
+
return;
|
|
145
|
+
settled = true;
|
|
146
|
+
if (timer)
|
|
147
|
+
clearTimeout(timer);
|
|
148
|
+
if (timedOut) {
|
|
149
|
+
reject(new Error(`${command} timed out after ${options?.timeout}ms`));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
resolve({
|
|
153
|
+
stdout: Buffer.concat(stdout).toString("utf8"),
|
|
154
|
+
stderr: Buffer.concat(stderr).toString("utf8"),
|
|
155
|
+
exitCode: code ?? 1,
|
|
156
|
+
});
|
|
157
|
+
});
|
|
158
|
+
if (options?.input !== undefined) {
|
|
159
|
+
try {
|
|
160
|
+
child.stdin.write(options.input);
|
|
161
|
+
}
|
|
162
|
+
catch (error) {
|
|
163
|
+
const err = error;
|
|
164
|
+
if (err.code !== "EPIPE") {
|
|
165
|
+
settled = true;
|
|
166
|
+
reject(error);
|
|
167
|
+
return;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
child.stdin.end();
|
|
172
|
+
});
|
|
173
|
+
}
|
|
174
|
+
class DockerSandboxAdapter {
|
|
175
|
+
containerName;
|
|
176
|
+
workspaceHost;
|
|
177
|
+
constructor(containerName, workspaceHost) {
|
|
178
|
+
this.containerName = containerName;
|
|
179
|
+
this.workspaceHost = workspaceHost;
|
|
180
|
+
}
|
|
181
|
+
async exec(cmd, args, opts) {
|
|
182
|
+
const dockerArgs = [
|
|
183
|
+
...toDockerExecArgs(this.containerName, {
|
|
184
|
+
cwd: normalizeContainerPath(this.workspaceHost, opts?.cwd),
|
|
185
|
+
env: opts?.env,
|
|
186
|
+
detached: opts?.detached,
|
|
187
|
+
sudo: opts?.sudo,
|
|
188
|
+
}),
|
|
189
|
+
cmd,
|
|
190
|
+
...(args ?? []),
|
|
191
|
+
];
|
|
192
|
+
const result = await runCommand("docker", dockerArgs);
|
|
193
|
+
if (opts?.detached) {
|
|
194
|
+
return { stdout: "", stderr: "", exitCode: result.exitCode };
|
|
195
|
+
}
|
|
196
|
+
return result;
|
|
197
|
+
}
|
|
198
|
+
async writeFile(filePath, content, opts) {
|
|
199
|
+
const result = await runCommand("docker", [
|
|
200
|
+
...toDockerExecArgs(this.containerName, {
|
|
201
|
+
cwd: CONTAINER_WORKSPACE,
|
|
202
|
+
sudo: opts?.sudo,
|
|
203
|
+
}),
|
|
204
|
+
"sh",
|
|
205
|
+
"-lc",
|
|
206
|
+
"mkdir -p \"$(dirname \"$1\")\" && cat > \"$1\"",
|
|
207
|
+
"--",
|
|
208
|
+
filePath,
|
|
209
|
+
], { input: content });
|
|
210
|
+
if (result.exitCode !== 0) {
|
|
211
|
+
throw new Error(result.stderr || result.stdout || `writeFile failed for ${filePath}`);
|
|
212
|
+
}
|
|
213
|
+
}
|
|
214
|
+
async readFile(filePath) {
|
|
215
|
+
const result = await runCommand("docker", [
|
|
216
|
+
...toDockerExecArgs(this.containerName, { cwd: CONTAINER_WORKSPACE }),
|
|
217
|
+
"sh",
|
|
218
|
+
"-lc",
|
|
219
|
+
"cat \"$1\"",
|
|
220
|
+
"--",
|
|
221
|
+
filePath,
|
|
222
|
+
]);
|
|
223
|
+
if (result.exitCode !== 0) {
|
|
224
|
+
throw new Error(result.stderr || result.stdout || `readFile failed for ${filePath}`);
|
|
225
|
+
}
|
|
226
|
+
return result.stdout;
|
|
227
|
+
}
|
|
228
|
+
async fileExists(filePath) {
|
|
229
|
+
const result = await runCommand("docker", [
|
|
230
|
+
...toDockerExecArgs(this.containerName, { cwd: CONTAINER_WORKSPACE }),
|
|
231
|
+
"sh",
|
|
232
|
+
"-lc",
|
|
233
|
+
"test -f \"$1\"",
|
|
234
|
+
"--",
|
|
235
|
+
filePath,
|
|
236
|
+
]);
|
|
237
|
+
return result.exitCode === 0;
|
|
238
|
+
}
|
|
239
|
+
async stop() {
|
|
240
|
+
await runCommand("docker", ["rm", "-f", this.containerName]).catch(() => undefined);
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
class DockerSecureBashBackend {
|
|
244
|
+
workspaceHost;
|
|
245
|
+
image;
|
|
246
|
+
containerName = createContainerName();
|
|
247
|
+
adapter;
|
|
248
|
+
securedSandbox = null;
|
|
249
|
+
containerStarted = false;
|
|
250
|
+
constructor(workspaceHost, image) {
|
|
251
|
+
this.workspaceHost = workspaceHost;
|
|
252
|
+
this.image = image;
|
|
253
|
+
this.adapter = new DockerSandboxAdapter(this.containerName, this.workspaceHost);
|
|
254
|
+
}
|
|
255
|
+
get promptNote() {
|
|
256
|
+
return [
|
|
257
|
+
"The bash tool runs inside a secure Docker sandbox protected by AgentSH.",
|
|
258
|
+
`The project workspace is mounted inside that sandbox at ${CONTAINER_WORKSPACE}.`,
|
|
259
|
+
"Filesystem tools operate on the host mirror of the same workspace files.",
|
|
260
|
+
].join(" ");
|
|
261
|
+
}
|
|
262
|
+
get operations() {
|
|
263
|
+
return {
|
|
264
|
+
exec: async (command, cwd, options) => {
|
|
265
|
+
if (options.signal?.aborted) {
|
|
266
|
+
return { exitCode: null };
|
|
267
|
+
}
|
|
268
|
+
const sandbox = await this.initialize();
|
|
269
|
+
const sandboxCommand = `${buildEnvPrefix(options.env)}${command}`;
|
|
270
|
+
try {
|
|
271
|
+
const result = await sandbox.exec(sandboxCommand, {
|
|
272
|
+
cwd: mapHostPathToContainer(this.workspaceHost, cwd),
|
|
273
|
+
timeout: options.timeout,
|
|
274
|
+
});
|
|
275
|
+
if (result.stdout)
|
|
276
|
+
options.onData(Buffer.from(result.stdout));
|
|
277
|
+
if (result.stderr)
|
|
278
|
+
options.onData(Buffer.from(result.stderr));
|
|
279
|
+
if (options.signal?.aborted) {
|
|
280
|
+
return { exitCode: null };
|
|
281
|
+
}
|
|
282
|
+
return { exitCode: result.exitCode };
|
|
283
|
+
}
|
|
284
|
+
catch (error) {
|
|
285
|
+
if (isAbortError(error) || options.signal?.aborted) {
|
|
286
|
+
return { exitCode: null };
|
|
287
|
+
}
|
|
288
|
+
throw error;
|
|
289
|
+
}
|
|
290
|
+
},
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
async dispose() {
|
|
294
|
+
if (this.securedSandbox) {
|
|
295
|
+
await this.securedSandbox.stop().catch(() => undefined);
|
|
296
|
+
this.securedSandbox = null;
|
|
297
|
+
this.containerStarted = false;
|
|
298
|
+
return;
|
|
299
|
+
}
|
|
300
|
+
if (this.containerStarted) {
|
|
301
|
+
await this.adapter.stop?.();
|
|
302
|
+
this.containerStarted = false;
|
|
303
|
+
}
|
|
304
|
+
}
|
|
305
|
+
async ensureReady() {
|
|
306
|
+
await this.initialize();
|
|
307
|
+
}
|
|
308
|
+
async initialize() {
|
|
309
|
+
if (this.securedSandbox)
|
|
310
|
+
return this.securedSandbox;
|
|
311
|
+
await this.startContainer();
|
|
312
|
+
try {
|
|
313
|
+
const mod = await loadAgentSHModule();
|
|
314
|
+
this.securedSandbox = await mod.secureSandbox(this.adapter, {
|
|
315
|
+
workspace: CONTAINER_WORKSPACE,
|
|
316
|
+
realPaths: true,
|
|
317
|
+
installStrategy: DEFAULT_INSTALL_STRATEGY,
|
|
318
|
+
});
|
|
319
|
+
return this.securedSandbox;
|
|
320
|
+
}
|
|
321
|
+
catch (error) {
|
|
322
|
+
await this.adapter.stop?.();
|
|
323
|
+
throw error;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
async startContainer() {
|
|
327
|
+
if (this.containerStarted)
|
|
328
|
+
return;
|
|
329
|
+
const result = await runCommand("docker", [
|
|
330
|
+
"run",
|
|
331
|
+
"-d",
|
|
332
|
+
"--rm",
|
|
333
|
+
"--name",
|
|
334
|
+
this.containerName,
|
|
335
|
+
"-v",
|
|
336
|
+
`${path.resolve(this.workspaceHost)}:${CONTAINER_WORKSPACE}`,
|
|
337
|
+
"-w",
|
|
338
|
+
CONTAINER_WORKSPACE,
|
|
339
|
+
this.image,
|
|
340
|
+
"tail",
|
|
341
|
+
"-f",
|
|
342
|
+
"/dev/null",
|
|
343
|
+
]);
|
|
344
|
+
if (result.exitCode !== 0) {
|
|
345
|
+
throw new Error(result.stderr || result.stdout || "Failed to start PI secure sandbox container.");
|
|
346
|
+
}
|
|
347
|
+
this.containerStarted = true;
|
|
348
|
+
}
|
|
349
|
+
}
|
|
350
|
+
async function createSecureBashBackend(options) {
|
|
351
|
+
if (options.mode === "local") {
|
|
352
|
+
return null;
|
|
353
|
+
}
|
|
354
|
+
const backend = new DockerSecureBashBackend(path.resolve(options.workspace), options.image || DEFAULT_SANDBOX_IMAGE);
|
|
355
|
+
try {
|
|
356
|
+
await backend.ensureReady();
|
|
357
|
+
}
|
|
358
|
+
catch (error) {
|
|
359
|
+
await backend.dispose().catch(() => undefined);
|
|
360
|
+
if (options.mode === "auto") {
|
|
361
|
+
return null;
|
|
362
|
+
}
|
|
363
|
+
throw error;
|
|
364
|
+
}
|
|
365
|
+
return backend;
|
|
366
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Type definitions for Pi secure sandbox.
|
|
3
|
+
* Extracted from piSecureSandbox.ts for max-lines compliance.
|
|
4
|
+
*/
|
|
5
|
+
export interface PiBashOperations {
|
|
6
|
+
exec: (command: string, cwd: string, options: {
|
|
7
|
+
onData: (data: Buffer) => void;
|
|
8
|
+
signal?: AbortSignal;
|
|
9
|
+
timeout?: number;
|
|
10
|
+
env?: NodeJS.ProcessEnv;
|
|
11
|
+
}) => Promise<{
|
|
12
|
+
exitCode: number | null;
|
|
13
|
+
}>;
|
|
14
|
+
}
|
|
15
|
+
export interface ExecResult {
|
|
16
|
+
stdout: string;
|
|
17
|
+
stderr: string;
|
|
18
|
+
exitCode: number;
|
|
19
|
+
}
|
|
20
|
+
export interface SandboxAdapterLike {
|
|
21
|
+
exec(cmd: string, args?: string[], opts?: {
|
|
22
|
+
cwd?: string;
|
|
23
|
+
sudo?: boolean;
|
|
24
|
+
detached?: boolean;
|
|
25
|
+
env?: Record<string, string>;
|
|
26
|
+
}): Promise<ExecResult>;
|
|
27
|
+
writeFile(path: string, content: string | Buffer, opts?: {
|
|
28
|
+
sudo?: boolean;
|
|
29
|
+
}): Promise<void>;
|
|
30
|
+
readFile(path: string): Promise<string>;
|
|
31
|
+
stop?(): Promise<void>;
|
|
32
|
+
fileExists?(path: string): Promise<boolean>;
|
|
33
|
+
}
|
|
34
|
+
export interface SecuredSandboxLike {
|
|
35
|
+
exec(command: string, opts?: {
|
|
36
|
+
cwd?: string;
|
|
37
|
+
timeout?: number;
|
|
38
|
+
}): Promise<ExecResult>;
|
|
39
|
+
stop(): Promise<void>;
|
|
40
|
+
readonly sessionId: string;
|
|
41
|
+
readonly securityMode: string;
|
|
42
|
+
}
|
|
43
|
+
export interface AgentSHModule {
|
|
44
|
+
secureSandbox(adapter: SandboxAdapterLike, config?: Record<string, unknown>): Promise<SecuredSandboxLike>;
|
|
45
|
+
}
|
|
46
|
+
export interface SecureBashBackend {
|
|
47
|
+
operations: PiBashOperations;
|
|
48
|
+
dispose(): Promise<void>;
|
|
49
|
+
promptNote: string;
|
|
50
|
+
}
|
|
51
|
+
//# sourceMappingURL=piSecureSandboxTypes.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"piSecureSandboxTypes.d.ts","sourceRoot":"","sources":["../../src/harness/piSecureSandboxTypes.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,MAAM,WAAW,gBAAgB;IAC/B,IAAI,EAAE,CACJ,OAAO,EAAE,MAAM,EACf,GAAG,EAAE,MAAM,EACX,OAAO,EAAE;QACP,MAAM,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;QAC/B,MAAM,CAAC,EAAE,WAAW,CAAC;QACrB,OAAO,CAAC,EAAE,MAAM,CAAC;QACjB,GAAG,CAAC,EAAE,MAAM,CAAC,UAAU,CAAC;KACzB,KACE,OAAO,CAAC;QAAE,QAAQ,EAAE,MAAM,GAAG,IAAI,CAAA;KAAE,CAAC,CAAC;CAC3C;AAED,MAAM,WAAW,UAAU;IACzB,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,GAAG,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,OAAO,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAC;QAAC,GAAG,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACnJ,SAAS,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,GAAG,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,OAAO,CAAA;KAAE,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC5F,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAAC;IACxC,IAAI,CAAC,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,UAAU,CAAC,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,kBAAkB;IACjC,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,GAAG,CAAC,EAAE,MAAM,CAAC;QAAC,OAAO,CAAC,EAAE,MAAM,CAAA;KAAE,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACtF,IAAI,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACtB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;IAC3B,QAAQ,CAAC,YAAY,EAAE,MAAM,CAAC;CAC/B;AAED,MAAM,WAAW,aAAa;IAC5B,aAAa,CAAC,OAAO,EAAE,kBAAkB,EAAE,MAAM,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAC3G;AAED,MAAM,WAAW,iBAAiB;IAChC,UAAU,EAAE,gBAAgB,CAAC;IAC7B,OAAO,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACzB,UAAU,EAAE,MAAM,CAAC;CACpB"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export declare function loadCompressionConfigSafe(cwd: string): import("@a5c-ai/babysitter-sdk").CompressionConfig | null;
|
|
2
|
+
export declare function buildCompactionSettings(enabled: boolean): {
|
|
3
|
+
compaction: {
|
|
4
|
+
enabled: boolean;
|
|
5
|
+
reserveTokens?: number;
|
|
6
|
+
keepRecentTokens?: number;
|
|
7
|
+
};
|
|
8
|
+
branchSummary?: {
|
|
9
|
+
reserveTokens?: number;
|
|
10
|
+
skipPrompt?: boolean;
|
|
11
|
+
};
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=compaction.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"compaction.d.ts","sourceRoot":"","sources":["../../../src/harness/piWrapper/compaction.ts"],"names":[],"mappings":"AAEA,wBAAgB,yBAAyB,CAAC,GAAG,EAAE,MAAM,6DAMpD;AASD,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG;IACzD,UAAU,EAAE;QACV,OAAO,EAAE,OAAO,CAAC;QACjB,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,gBAAgB,CAAC,EAAE,MAAM,CAAC;KAC3B,CAAC;IACF,aAAa,CAAC,EAAE;QACd,aAAa,CAAC,EAAE,MAAM,CAAC;QACvB,UAAU,CAAC,EAAE,OAAO,CAAC;KACtB,CAAC;CACH,CAkBA"}
|