@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,183 @@
|
|
|
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.DurableTriggerQueue = void 0;
|
|
37
|
+
const node_crypto_1 = require("node:crypto");
|
|
38
|
+
const node_fs_1 = require("node:fs");
|
|
39
|
+
const path = __importStar(require("node:path"));
|
|
40
|
+
const QUEUE_FILE = "trigger-queue.json";
|
|
41
|
+
class DurableTriggerQueue {
|
|
42
|
+
filePath;
|
|
43
|
+
maxAttempts;
|
|
44
|
+
baseBackoffMs;
|
|
45
|
+
now;
|
|
46
|
+
events = [];
|
|
47
|
+
writeChain = Promise.resolve();
|
|
48
|
+
constructor(daemonDir, options) {
|
|
49
|
+
this.filePath = path.join(daemonDir, QUEUE_FILE);
|
|
50
|
+
this.maxAttempts = options?.maxAttempts ?? 3;
|
|
51
|
+
this.baseBackoffMs = options?.baseBackoffMs ?? 1_000;
|
|
52
|
+
this.now = options?.now ?? Date.now;
|
|
53
|
+
}
|
|
54
|
+
static async open(daemonDir, options) {
|
|
55
|
+
const queue = new DurableTriggerQueue(daemonDir, options);
|
|
56
|
+
await queue.load();
|
|
57
|
+
return queue;
|
|
58
|
+
}
|
|
59
|
+
async enqueue(trigger) {
|
|
60
|
+
const timestamp = new Date(this.now()).toISOString();
|
|
61
|
+
const record = {
|
|
62
|
+
id: (0, node_crypto_1.randomUUID)(),
|
|
63
|
+
trigger: redactTrigger(trigger),
|
|
64
|
+
state: "pending",
|
|
65
|
+
attempts: 0,
|
|
66
|
+
enqueuedAt: timestamp,
|
|
67
|
+
updatedAt: timestamp,
|
|
68
|
+
};
|
|
69
|
+
this.events.push(record);
|
|
70
|
+
await this.persist();
|
|
71
|
+
return { ...record };
|
|
72
|
+
}
|
|
73
|
+
async claimDue(limit = Number.POSITIVE_INFINITY) {
|
|
74
|
+
const now = this.now;
|
|
75
|
+
const timestamp = new Date(now()).toISOString();
|
|
76
|
+
const claimed = [];
|
|
77
|
+
for (const event of this.events) {
|
|
78
|
+
if (claimed.length >= limit)
|
|
79
|
+
break;
|
|
80
|
+
if (event.state !== "pending" && event.state !== "failed")
|
|
81
|
+
continue;
|
|
82
|
+
if (event.nextAttemptAt && Date.parse(event.nextAttemptAt) > now())
|
|
83
|
+
continue;
|
|
84
|
+
event.state = "running";
|
|
85
|
+
event.attempts += 1;
|
|
86
|
+
event.updatedAt = timestamp;
|
|
87
|
+
claimed.push({ ...event, trigger: cloneTrigger(event.trigger) });
|
|
88
|
+
}
|
|
89
|
+
if (claimed.length > 0) {
|
|
90
|
+
await this.persist();
|
|
91
|
+
}
|
|
92
|
+
return claimed;
|
|
93
|
+
}
|
|
94
|
+
async ack(id) {
|
|
95
|
+
const event = this.events.find((item) => item.id === id);
|
|
96
|
+
if (!event)
|
|
97
|
+
return;
|
|
98
|
+
const timestamp = new Date(this.now()).toISOString();
|
|
99
|
+
event.state = "succeeded";
|
|
100
|
+
event.ackedAt = timestamp;
|
|
101
|
+
event.updatedAt = timestamp;
|
|
102
|
+
await this.persist();
|
|
103
|
+
}
|
|
104
|
+
async fail(id, error) {
|
|
105
|
+
const event = this.events.find((item) => item.id === id);
|
|
106
|
+
if (!event || event.state === "succeeded")
|
|
107
|
+
return;
|
|
108
|
+
const timestamp = new Date(this.now()).toISOString();
|
|
109
|
+
event.lastError = error instanceof Error ? error.message : String(error);
|
|
110
|
+
event.updatedAt = timestamp;
|
|
111
|
+
if (event.attempts >= this.maxAttempts) {
|
|
112
|
+
event.state = "dead-letter";
|
|
113
|
+
delete event.nextAttemptAt;
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
event.state = "failed";
|
|
117
|
+
const delay = this.baseBackoffMs * Math.max(1, 2 ** Math.max(0, event.attempts - 1));
|
|
118
|
+
event.nextAttemptAt = new Date(this.now() + delay).toISOString();
|
|
119
|
+
}
|
|
120
|
+
await this.persist();
|
|
121
|
+
}
|
|
122
|
+
async snapshot() {
|
|
123
|
+
return this.events.map((event) => ({ ...event, trigger: cloneTrigger(event.trigger) }));
|
|
124
|
+
}
|
|
125
|
+
counts() {
|
|
126
|
+
return {
|
|
127
|
+
active: this.events.filter((event) => event.state === "running").length,
|
|
128
|
+
pending: this.events.filter((event) => event.state === "pending" || event.state === "failed").length,
|
|
129
|
+
deadLetter: this.events.filter((event) => event.state === "dead-letter").length,
|
|
130
|
+
};
|
|
131
|
+
}
|
|
132
|
+
async load() {
|
|
133
|
+
try {
|
|
134
|
+
const raw = await node_fs_1.promises.readFile(this.filePath, "utf-8");
|
|
135
|
+
const parsed = JSON.parse(raw);
|
|
136
|
+
this.events = (parsed.events ?? []).map((event) => ({
|
|
137
|
+
...event,
|
|
138
|
+
state: event.state === "running" ? "pending" : event.state,
|
|
139
|
+
trigger: cloneTrigger(event.trigger),
|
|
140
|
+
}));
|
|
141
|
+
if (this.events.some((event) => event.state === "pending" && event.updatedAt)) {
|
|
142
|
+
await this.persist();
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
catch {
|
|
146
|
+
this.events = [];
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
async persist() {
|
|
150
|
+
const content = JSON.stringify({ version: 1, events: this.events }, null, 2);
|
|
151
|
+
this.writeChain = this.writeChain.then(async () => {
|
|
152
|
+
await node_fs_1.promises.mkdir(path.dirname(this.filePath), { recursive: true });
|
|
153
|
+
const tmpPath = `${this.filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
154
|
+
await node_fs_1.promises.writeFile(tmpPath, content, "utf-8");
|
|
155
|
+
await node_fs_1.promises.rename(tmpPath, this.filePath);
|
|
156
|
+
});
|
|
157
|
+
await this.writeChain;
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
exports.DurableTriggerQueue = DurableTriggerQueue;
|
|
161
|
+
function cloneTrigger(trigger) {
|
|
162
|
+
return JSON.parse(JSON.stringify(trigger));
|
|
163
|
+
}
|
|
164
|
+
const SECRET_KEY_PATTERN = /(secret|token|api[-_]?key|authorization|password|credential|private[-_]?key)/i;
|
|
165
|
+
function redactTrigger(trigger) {
|
|
166
|
+
return redactValue(cloneTrigger(trigger), "");
|
|
167
|
+
}
|
|
168
|
+
function redactValue(value, key) {
|
|
169
|
+
if (SECRET_KEY_PATTERN.test(key)) {
|
|
170
|
+
return "[REDACTED]";
|
|
171
|
+
}
|
|
172
|
+
if (Array.isArray(value)) {
|
|
173
|
+
return value.map((item) => redactValue(item, ""));
|
|
174
|
+
}
|
|
175
|
+
if (value && typeof value === "object") {
|
|
176
|
+
const result = {};
|
|
177
|
+
for (const [childKey, childValue] of Object.entries(value)) {
|
|
178
|
+
result[childKey] = redactValue(childValue, childKey);
|
|
179
|
+
}
|
|
180
|
+
return result;
|
|
181
|
+
}
|
|
182
|
+
return value;
|
|
183
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GAP-REMOTE-001: File Watcher — debounced fs.watch trigger.
|
|
3
|
+
*
|
|
4
|
+
* Watches directories for file changes matching glob patterns,
|
|
5
|
+
* firing trigger callbacks with configurable debounce.
|
|
6
|
+
*/
|
|
7
|
+
import type { FileTriggerConfig, FileWatcherHandle, TriggerCallback } from "./types";
|
|
8
|
+
export declare function createFileWatcher(triggers: FileTriggerConfig[], onTrigger: TriggerCallback): FileWatcherHandle;
|
|
9
|
+
//# sourceMappingURL=fileWatcher.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"fileWatcher.d.ts","sourceRoot":"","sources":["../../src/daemon/fileWatcher.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,eAAe,EAAE,MAAM,SAAS,CAAC;AAoDrF,wBAAgB,iBAAiB,CAC/B,QAAQ,EAAE,iBAAiB,EAAE,EAC7B,SAAS,EAAE,eAAe,GACzB,iBAAiB,CAgEnB"}
|
|
@@ -0,0 +1,144 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GAP-REMOTE-001: File Watcher — debounced fs.watch trigger.
|
|
4
|
+
*
|
|
5
|
+
* Watches directories for file changes matching glob patterns,
|
|
6
|
+
* firing trigger callbacks with configurable debounce.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.createFileWatcher = createFileWatcher;
|
|
43
|
+
const fsSync = __importStar(require("node:fs"));
|
|
44
|
+
const path = __importStar(require("node:path"));
|
|
45
|
+
const DEFAULT_DEBOUNCE_MS = 500;
|
|
46
|
+
/**
|
|
47
|
+
* Extract the extension pattern from a glob (e.g., "**\/*.ts" -> ".ts").
|
|
48
|
+
* Returns null if no extension can be extracted.
|
|
49
|
+
*/
|
|
50
|
+
function extractExtension(pattern) {
|
|
51
|
+
const normalized = pattern.replace(/\\/g, "/");
|
|
52
|
+
// Match patterns like **/*.ts, **/*.test.ts, *.js
|
|
53
|
+
const match = normalized.match(/\*(\.[a-zA-Z0-9.]+)$/);
|
|
54
|
+
return match ? match[1] : null;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Check if a filename matches the pattern's file extension filter.
|
|
58
|
+
* This is a simplified matcher that works with common glob patterns like:
|
|
59
|
+
* - path/to/**\/*.ts -> matches any .ts file under path/to/
|
|
60
|
+
* - path/to/**\/*.test.ts -> matches any .test.ts file under path/to/
|
|
61
|
+
*/
|
|
62
|
+
function matchesExtension(filename, pattern) {
|
|
63
|
+
const ext = extractExtension(pattern);
|
|
64
|
+
if (!ext)
|
|
65
|
+
return true; // No extension filter = match all
|
|
66
|
+
return filename.endsWith(ext);
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Extract the base directory from a glob pattern (everything before the first glob segment).
|
|
70
|
+
*/
|
|
71
|
+
function getWatchDir(pattern) {
|
|
72
|
+
const normalized = pattern.replace(/\\/g, "/");
|
|
73
|
+
const parts = normalized.split("/");
|
|
74
|
+
const dirParts = [];
|
|
75
|
+
for (const part of parts) {
|
|
76
|
+
if (part.includes("*") || part.includes("?") || part.includes("{")) {
|
|
77
|
+
break;
|
|
78
|
+
}
|
|
79
|
+
dirParts.push(part);
|
|
80
|
+
}
|
|
81
|
+
return dirParts.join(path.sep) || ".";
|
|
82
|
+
}
|
|
83
|
+
function createFileWatcher(triggers, onTrigger) {
|
|
84
|
+
const entries = [];
|
|
85
|
+
let disposed = false;
|
|
86
|
+
for (const trigger of triggers) {
|
|
87
|
+
const watchDir = getWatchDir(trigger.pattern);
|
|
88
|
+
const debounceMs = trigger.debounceMs ?? DEFAULT_DEBOUNCE_MS;
|
|
89
|
+
const entry = {
|
|
90
|
+
trigger,
|
|
91
|
+
watcher: null,
|
|
92
|
+
debounceTimer: null,
|
|
93
|
+
lastPath: null,
|
|
94
|
+
};
|
|
95
|
+
try {
|
|
96
|
+
entry.watcher = fsSync.watch(watchDir, { recursive: true }, (_eventType, filename) => {
|
|
97
|
+
if (disposed || !filename)
|
|
98
|
+
return;
|
|
99
|
+
if (!matchesExtension(filename, trigger.pattern))
|
|
100
|
+
return;
|
|
101
|
+
entry.lastPath = path.resolve(watchDir, filename.toString());
|
|
102
|
+
// Debounce: clear previous timer and set a new one
|
|
103
|
+
if (entry.debounceTimer) {
|
|
104
|
+
clearTimeout(entry.debounceTimer);
|
|
105
|
+
}
|
|
106
|
+
entry.debounceTimer = setTimeout(() => {
|
|
107
|
+
if (disposed)
|
|
108
|
+
return;
|
|
109
|
+
void onTrigger({
|
|
110
|
+
type: "file",
|
|
111
|
+
processId: trigger.processId,
|
|
112
|
+
entrypoint: trigger.entrypoint,
|
|
113
|
+
inputs: entry.lastPath ? { path: entry.lastPath } : undefined,
|
|
114
|
+
});
|
|
115
|
+
}, debounceMs);
|
|
116
|
+
});
|
|
117
|
+
entry.watcher.on("error", () => {
|
|
118
|
+
if (entry.watcher) {
|
|
119
|
+
entry.watcher.close();
|
|
120
|
+
entry.watcher = null;
|
|
121
|
+
}
|
|
122
|
+
});
|
|
123
|
+
}
|
|
124
|
+
catch {
|
|
125
|
+
// Watch dir doesn't exist yet — skip
|
|
126
|
+
}
|
|
127
|
+
entries.push(entry);
|
|
128
|
+
}
|
|
129
|
+
return {
|
|
130
|
+
dispose() {
|
|
131
|
+
disposed = true;
|
|
132
|
+
for (const entry of entries) {
|
|
133
|
+
if (entry.debounceTimer) {
|
|
134
|
+
clearTimeout(entry.debounceTimer);
|
|
135
|
+
entry.debounceTimer = null;
|
|
136
|
+
}
|
|
137
|
+
if (entry.watcher) {
|
|
138
|
+
entry.watcher.close();
|
|
139
|
+
entry.watcher = null;
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
},
|
|
143
|
+
};
|
|
144
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Re-export shim — canonical implementation lives in @a5c-ai/genty-runtime.
|
|
3
|
+
* Internal agent-platform consumers continue to import via relative paths
|
|
4
|
+
* through this barrel file.
|
|
5
|
+
*/
|
|
6
|
+
export { startDaemon, stopDaemon, getDaemonStatus, loadDaemonConfig, writeDaemonConfig, createFileWatcher, createWebhookListener, createTimerScheduler, runDaemonLoop, readDaemonLoopStatus, appendDaemonLog, readDaemonLog, DurableTriggerQueue, type DaemonConfig, type DaemonStartOptions, type DaemonStartOutput, type DaemonStopOptions, type DaemonStopOutput, type DaemonStatusOptions, type DaemonStatusOutput, type DaemonMetadata, type TriggerConfig, type TriggerEvent, type FileTriggerEvent, type AutomationTriggerEvent, type FileTriggerConfig, type FileWatcherHandle, type WebhookListenerOptions, type WebhookListenerHandle, type TriggerCallback, type TriggerAdmissionConfig, type TriggerAdmissionResult, type TriggerAdmissionStatus, type TriggerRateLimitConfig, type TimerSchedulerHandle, type DaemonLoopOptions, type DaemonLoopStatus, type DaemonLogEntry, type DurableTriggerQueueOptions, type DurableTriggerRecord, type DurableTriggerState, } from "@a5c-ai/genty-runtime/daemon";
|
|
7
|
+
export { executeAutomationTrigger } from "./automationExecutor";
|
|
8
|
+
export { isAutomationTriggerEvent } from "./types";
|
|
9
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/daemon/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,EACL,WAAW,EACX,UAAU,EACV,eAAe,EACf,gBAAgB,EAChB,iBAAiB,EACjB,iBAAiB,EACjB,qBAAqB,EACrB,oBAAoB,EACpB,aAAa,EACb,oBAAoB,EACpB,eAAe,EACf,aAAa,EACb,mBAAmB,EACnB,KAAK,YAAY,EACjB,KAAK,kBAAkB,EACvB,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,mBAAmB,EACxB,KAAK,kBAAkB,EACvB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,iBAAiB,EACtB,KAAK,iBAAiB,EACtB,KAAK,sBAAsB,EAC3B,KAAK,qBAAqB,EAC1B,KAAK,eAAe,EACpB,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACrB,KAAK,cAAc,EACnB,KAAK,0BAA0B,EAC/B,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,GACzB,MAAM,8BAA8B,CAAC;AACtC,OAAO,EAAE,wBAAwB,EAAE,MAAM,sBAAsB,CAAC;AAChE,OAAO,EAAE,wBAAwB,EAAE,MAAM,SAAS,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isAutomationTriggerEvent = exports.executeAutomationTrigger = exports.DurableTriggerQueue = exports.readDaemonLog = exports.appendDaemonLog = exports.readDaemonLoopStatus = exports.runDaemonLoop = exports.createTimerScheduler = exports.createWebhookListener = exports.createFileWatcher = exports.writeDaemonConfig = exports.loadDaemonConfig = exports.getDaemonStatus = exports.stopDaemon = exports.startDaemon = void 0;
|
|
4
|
+
/**
|
|
5
|
+
* Re-export shim — canonical implementation lives in @a5c-ai/genty-runtime.
|
|
6
|
+
* Internal agent-platform consumers continue to import via relative paths
|
|
7
|
+
* through this barrel file.
|
|
8
|
+
*/
|
|
9
|
+
var daemon_1 = require("@a5c-ai/genty-runtime/daemon");
|
|
10
|
+
Object.defineProperty(exports, "startDaemon", { enumerable: true, get: function () { return daemon_1.startDaemon; } });
|
|
11
|
+
Object.defineProperty(exports, "stopDaemon", { enumerable: true, get: function () { return daemon_1.stopDaemon; } });
|
|
12
|
+
Object.defineProperty(exports, "getDaemonStatus", { enumerable: true, get: function () { return daemon_1.getDaemonStatus; } });
|
|
13
|
+
Object.defineProperty(exports, "loadDaemonConfig", { enumerable: true, get: function () { return daemon_1.loadDaemonConfig; } });
|
|
14
|
+
Object.defineProperty(exports, "writeDaemonConfig", { enumerable: true, get: function () { return daemon_1.writeDaemonConfig; } });
|
|
15
|
+
Object.defineProperty(exports, "createFileWatcher", { enumerable: true, get: function () { return daemon_1.createFileWatcher; } });
|
|
16
|
+
Object.defineProperty(exports, "createWebhookListener", { enumerable: true, get: function () { return daemon_1.createWebhookListener; } });
|
|
17
|
+
Object.defineProperty(exports, "createTimerScheduler", { enumerable: true, get: function () { return daemon_1.createTimerScheduler; } });
|
|
18
|
+
Object.defineProperty(exports, "runDaemonLoop", { enumerable: true, get: function () { return daemon_1.runDaemonLoop; } });
|
|
19
|
+
Object.defineProperty(exports, "readDaemonLoopStatus", { enumerable: true, get: function () { return daemon_1.readDaemonLoopStatus; } });
|
|
20
|
+
Object.defineProperty(exports, "appendDaemonLog", { enumerable: true, get: function () { return daemon_1.appendDaemonLog; } });
|
|
21
|
+
Object.defineProperty(exports, "readDaemonLog", { enumerable: true, get: function () { return daemon_1.readDaemonLog; } });
|
|
22
|
+
Object.defineProperty(exports, "DurableTriggerQueue", { enumerable: true, get: function () { return daemon_1.DurableTriggerQueue; } });
|
|
23
|
+
var automationExecutor_1 = require("./automationExecutor");
|
|
24
|
+
Object.defineProperty(exports, "executeAutomationTrigger", { enumerable: true, get: function () { return automationExecutor_1.executeAutomationTrigger; } });
|
|
25
|
+
var types_1 = require("./types");
|
|
26
|
+
Object.defineProperty(exports, "isAutomationTriggerEvent", { enumerable: true, get: function () { return types_1.isAutomationTriggerEvent; } });
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* GAP-REMOTE-001: Daemon Lifecycle — start/stop/status management.
|
|
3
|
+
*
|
|
4
|
+
* In foreground mode, the daemon runs in the current process (for dev/debug).
|
|
5
|
+
* In background mode, it spawns a detached child process.
|
|
6
|
+
*/
|
|
7
|
+
import type { ApiResult } from "../api/runs";
|
|
8
|
+
import type { DaemonStartOptions, DaemonStartOutput, DaemonStopOptions, DaemonStopOutput, DaemonStatusOptions, DaemonStatusOutput } from "./types";
|
|
9
|
+
export declare function startDaemon(options: DaemonStartOptions): Promise<ApiResult<DaemonStartOutput>>;
|
|
10
|
+
export declare function stopDaemon(options: DaemonStopOptions): Promise<ApiResult<DaemonStopOutput>>;
|
|
11
|
+
export declare function getDaemonStatus(options: DaemonStatusOptions): Promise<ApiResult<DaemonStatusOutput>>;
|
|
12
|
+
//# sourceMappingURL=lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lifecycle.d.ts","sourceRoot":"","sources":["../../src/daemon/lifecycle.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,KAAK,EACV,kBAAkB,EAClB,iBAAiB,EACjB,iBAAiB,EACjB,gBAAgB,EAChB,mBAAmB,EACnB,kBAAkB,EAEnB,MAAM,SAAS,CAAC;AAwDjB,wBAAsB,WAAW,CAC/B,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,SAAS,CAAC,iBAAiB,CAAC,CAAC,CAoEvC;AAID,wBAAsB,UAAU,CAC9B,OAAO,EAAE,iBAAiB,GACzB,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAwEtC;AAID,wBAAsB,eAAe,CACnC,OAAO,EAAE,mBAAmB,GAC3B,OAAO,CAAC,SAAS,CAAC,kBAAkB,CAAC,CAAC,CAmCxC"}
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* GAP-REMOTE-001: Daemon Lifecycle — start/stop/status management.
|
|
4
|
+
*
|
|
5
|
+
* In foreground mode, the daemon runs in the current process (for dev/debug).
|
|
6
|
+
* In background mode, it spawns a detached child process.
|
|
7
|
+
*/
|
|
8
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
9
|
+
if (k2 === undefined) k2 = k;
|
|
10
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
11
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
12
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
13
|
+
}
|
|
14
|
+
Object.defineProperty(o, k2, desc);
|
|
15
|
+
}) : (function(o, m, k, k2) {
|
|
16
|
+
if (k2 === undefined) k2 = k;
|
|
17
|
+
o[k2] = m[k];
|
|
18
|
+
}));
|
|
19
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
20
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
21
|
+
}) : function(o, v) {
|
|
22
|
+
o["default"] = v;
|
|
23
|
+
});
|
|
24
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
25
|
+
var ownKeys = function(o) {
|
|
26
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
27
|
+
var ar = [];
|
|
28
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
29
|
+
return ar;
|
|
30
|
+
};
|
|
31
|
+
return ownKeys(o);
|
|
32
|
+
};
|
|
33
|
+
return function (mod) {
|
|
34
|
+
if (mod && mod.__esModule) return mod;
|
|
35
|
+
var result = {};
|
|
36
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
37
|
+
__setModuleDefault(result, mod);
|
|
38
|
+
return result;
|
|
39
|
+
};
|
|
40
|
+
})();
|
|
41
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
42
|
+
exports.startDaemon = startDaemon;
|
|
43
|
+
exports.stopDaemon = stopDaemon;
|
|
44
|
+
exports.getDaemonStatus = getDaemonStatus;
|
|
45
|
+
const node_fs_1 = require("node:fs");
|
|
46
|
+
const node_child_process_1 = require("node:child_process");
|
|
47
|
+
const path = __importStar(require("node:path"));
|
|
48
|
+
const utils_1 = require("../api/utils");
|
|
49
|
+
const loop_1 = require("./loop");
|
|
50
|
+
const daemonLog_1 = require("./daemonLog");
|
|
51
|
+
const DEFAULT_GRACE_PERIOD_MS = 10_000;
|
|
52
|
+
// ── Atomic write helper ─────────────────────────────────────────────────────
|
|
53
|
+
async function atomicWrite(filePath, content) {
|
|
54
|
+
const dir = path.dirname(filePath);
|
|
55
|
+
await node_fs_1.promises.mkdir(dir, { recursive: true });
|
|
56
|
+
const tmpPath = `${filePath}.tmp-${process.pid}-${Date.now()}`;
|
|
57
|
+
await node_fs_1.promises.writeFile(tmpPath, content, "utf-8");
|
|
58
|
+
await node_fs_1.promises.rename(tmpPath, filePath);
|
|
59
|
+
}
|
|
60
|
+
// ── PID checking ────────────────────────────────────────────────────────────
|
|
61
|
+
function isProcessAlive(pid) {
|
|
62
|
+
try {
|
|
63
|
+
process.kill(pid, 0);
|
|
64
|
+
return true;
|
|
65
|
+
}
|
|
66
|
+
catch {
|
|
67
|
+
return false;
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
async function readPidFile(daemonDir) {
|
|
71
|
+
try {
|
|
72
|
+
const content = await node_fs_1.promises.readFile(path.join(daemonDir, "daemon.pid"), "utf-8");
|
|
73
|
+
const pid = parseInt(content.trim(), 10);
|
|
74
|
+
return isNaN(pid) ? null : pid;
|
|
75
|
+
}
|
|
76
|
+
catch {
|
|
77
|
+
return null;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
async function readDaemonMetadata(daemonDir) {
|
|
81
|
+
try {
|
|
82
|
+
const content = await node_fs_1.promises.readFile(path.join(daemonDir, "daemon.json"), "utf-8");
|
|
83
|
+
return JSON.parse(content);
|
|
84
|
+
}
|
|
85
|
+
catch {
|
|
86
|
+
return null;
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
async function cleanupDaemonFiles(daemonDir) {
|
|
90
|
+
await node_fs_1.promises.unlink(path.join(daemonDir, "daemon.pid")).catch(() => { });
|
|
91
|
+
await node_fs_1.promises.unlink(path.join(daemonDir, "daemon.json")).catch(() => { });
|
|
92
|
+
}
|
|
93
|
+
function sleep(ms) {
|
|
94
|
+
return new Promise((resolve) => setTimeout(resolve, ms));
|
|
95
|
+
}
|
|
96
|
+
// ── startDaemon ─────────────────────────────────────────────────────────────
|
|
97
|
+
async function startDaemon(options) {
|
|
98
|
+
try {
|
|
99
|
+
const { daemonDir, workspace, foreground = false, config } = options;
|
|
100
|
+
// Check for existing daemon
|
|
101
|
+
const existingPid = await readPidFile(daemonDir);
|
|
102
|
+
if (existingPid !== null) {
|
|
103
|
+
if (isProcessAlive(existingPid)) {
|
|
104
|
+
return (0, utils_1.fail)("DAEMON_RUNNING", `Daemon already running with PID ${existingPid}`);
|
|
105
|
+
}
|
|
106
|
+
// Stale PID — clean up both files
|
|
107
|
+
await cleanupDaemonFiles(daemonDir);
|
|
108
|
+
}
|
|
109
|
+
await node_fs_1.promises.mkdir(daemonDir, { recursive: true });
|
|
110
|
+
let pid;
|
|
111
|
+
const startedAt = new Date().toISOString();
|
|
112
|
+
const maxConcurrentRuns = config?.maxConcurrentRuns ?? 4;
|
|
113
|
+
if (foreground) {
|
|
114
|
+
pid = process.pid;
|
|
115
|
+
}
|
|
116
|
+
else {
|
|
117
|
+
// Spawn detached child process running daemon:run
|
|
118
|
+
const child = (0, node_child_process_1.spawn)(process.execPath, [process.argv[1], "daemon:run", "--daemon-dir", daemonDir], {
|
|
119
|
+
detached: true,
|
|
120
|
+
stdio: "ignore",
|
|
121
|
+
cwd: workspace,
|
|
122
|
+
});
|
|
123
|
+
child.unref();
|
|
124
|
+
if (child.pid == null) {
|
|
125
|
+
return (0, utils_1.fail)("SPAWN_FAILED", "Failed to spawn daemon process — no PID returned");
|
|
126
|
+
}
|
|
127
|
+
pid = child.pid;
|
|
128
|
+
}
|
|
129
|
+
// Write PID file atomically
|
|
130
|
+
await atomicWrite(path.join(daemonDir, "daemon.pid"), String(pid));
|
|
131
|
+
// Write daemon.json metadata atomically
|
|
132
|
+
const metadata = {
|
|
133
|
+
workspace,
|
|
134
|
+
startedAt,
|
|
135
|
+
triggers: config?.triggers ?? [],
|
|
136
|
+
maxConcurrentRuns,
|
|
137
|
+
pid,
|
|
138
|
+
};
|
|
139
|
+
await atomicWrite(path.join(daemonDir, "daemon.json"), JSON.stringify(metadata, null, 2));
|
|
140
|
+
// Log daemon start
|
|
141
|
+
await (0, daemonLog_1.appendDaemonLog)(daemonDir, {
|
|
142
|
+
timestamp: startedAt,
|
|
143
|
+
event: "DAEMON_STARTED",
|
|
144
|
+
data: { pid, workspace, foreground },
|
|
145
|
+
});
|
|
146
|
+
return (0, utils_1.ok)({
|
|
147
|
+
pid,
|
|
148
|
+
daemonDir,
|
|
149
|
+
startedAt,
|
|
150
|
+
});
|
|
151
|
+
}
|
|
152
|
+
catch (error) {
|
|
153
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
154
|
+
return (0, utils_1.fail)("INTERNAL_ERROR", msg);
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
// ── stopDaemon ──────────────────────────────────────────────────────────────
|
|
158
|
+
async function stopDaemon(options) {
|
|
159
|
+
try {
|
|
160
|
+
const { daemonDir, gracePeriodMs = DEFAULT_GRACE_PERIOD_MS } = options;
|
|
161
|
+
const pid = await readPidFile(daemonDir);
|
|
162
|
+
if (pid === null) {
|
|
163
|
+
return (0, utils_1.fail)("DAEMON_NOT_RUNNING", "No daemon PID file found");
|
|
164
|
+
}
|
|
165
|
+
const stoppedAt = new Date().toISOString();
|
|
166
|
+
if (!isProcessAlive(pid)) {
|
|
167
|
+
// PID exists but process is dead — clean up stale files
|
|
168
|
+
await cleanupDaemonFiles(daemonDir);
|
|
169
|
+
return (0, utils_1.ok)({ pid, stoppedAt });
|
|
170
|
+
}
|
|
171
|
+
// For foreground mode (same process), just clean up files
|
|
172
|
+
if (pid === process.pid) {
|
|
173
|
+
await cleanupDaemonFiles(daemonDir);
|
|
174
|
+
await (0, daemonLog_1.appendDaemonLog)(daemonDir, {
|
|
175
|
+
timestamp: stoppedAt,
|
|
176
|
+
event: "DAEMON_STOPPED",
|
|
177
|
+
data: { pid, reason: "foreground-stop" },
|
|
178
|
+
}).catch(() => { });
|
|
179
|
+
return (0, utils_1.ok)({ pid, stoppedAt });
|
|
180
|
+
}
|
|
181
|
+
// Send SIGTERM first
|
|
182
|
+
try {
|
|
183
|
+
process.kill(pid, "SIGTERM");
|
|
184
|
+
}
|
|
185
|
+
catch {
|
|
186
|
+
// Process may have exited between check and kill
|
|
187
|
+
await cleanupDaemonFiles(daemonDir);
|
|
188
|
+
return (0, utils_1.ok)({ pid, stoppedAt });
|
|
189
|
+
}
|
|
190
|
+
// Wait for graceful shutdown with polling
|
|
191
|
+
const pollInterval = 100;
|
|
192
|
+
const maxPolls = Math.ceil(gracePeriodMs / pollInterval);
|
|
193
|
+
for (let i = 0; i < maxPolls; i++) {
|
|
194
|
+
await sleep(pollInterval);
|
|
195
|
+
if (!isProcessAlive(pid)) {
|
|
196
|
+
await cleanupDaemonFiles(daemonDir);
|
|
197
|
+
await (0, daemonLog_1.appendDaemonLog)(daemonDir, {
|
|
198
|
+
timestamp: new Date().toISOString(),
|
|
199
|
+
event: "DAEMON_STOPPED",
|
|
200
|
+
data: { pid, reason: "sigterm" },
|
|
201
|
+
}).catch(() => { });
|
|
202
|
+
return (0, utils_1.ok)({ pid, stoppedAt: new Date().toISOString() });
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
// Escalate to SIGKILL after grace period
|
|
206
|
+
try {
|
|
207
|
+
process.kill(pid, "SIGKILL");
|
|
208
|
+
}
|
|
209
|
+
catch {
|
|
210
|
+
// Already exited
|
|
211
|
+
}
|
|
212
|
+
await cleanupDaemonFiles(daemonDir);
|
|
213
|
+
await (0, daemonLog_1.appendDaemonLog)(daemonDir, {
|
|
214
|
+
timestamp: new Date().toISOString(),
|
|
215
|
+
event: "DAEMON_KILLED",
|
|
216
|
+
data: { pid, reason: "sigkill-after-grace-period", gracePeriodMs },
|
|
217
|
+
}).catch(() => { });
|
|
218
|
+
return (0, utils_1.ok)({ pid, stoppedAt: new Date().toISOString() });
|
|
219
|
+
}
|
|
220
|
+
catch (error) {
|
|
221
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
222
|
+
return (0, utils_1.fail)("INTERNAL_ERROR", msg);
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
// ── getDaemonStatus ─────────────────────────────────────────────────────────
|
|
226
|
+
async function getDaemonStatus(options) {
|
|
227
|
+
try {
|
|
228
|
+
const { daemonDir } = options;
|
|
229
|
+
const pid = await readPidFile(daemonDir);
|
|
230
|
+
if (pid === null) {
|
|
231
|
+
return (0, utils_1.ok)({ running: false });
|
|
232
|
+
}
|
|
233
|
+
if (!isProcessAlive(pid)) {
|
|
234
|
+
// Stale PID — clean up
|
|
235
|
+
await node_fs_1.promises.unlink(path.join(daemonDir, "daemon.pid")).catch(() => { });
|
|
236
|
+
return (0, utils_1.ok)({ running: false });
|
|
237
|
+
}
|
|
238
|
+
const metadata = await readDaemonMetadata(daemonDir);
|
|
239
|
+
const startedAt = metadata?.startedAt;
|
|
240
|
+
const uptime = startedAt
|
|
241
|
+
? Math.floor((Date.now() - new Date(startedAt).getTime()) / 1000)
|
|
242
|
+
: 0;
|
|
243
|
+
const loopStatus = await (0, loop_1.readDaemonLoopStatus)(daemonDir);
|
|
244
|
+
return (0, utils_1.ok)({
|
|
245
|
+
running: true,
|
|
246
|
+
pid,
|
|
247
|
+
uptime,
|
|
248
|
+
startedAt,
|
|
249
|
+
activeTriggers: metadata?.triggers?.length ?? 0,
|
|
250
|
+
pendingRuns: loopStatus?.pendingRuns ?? 0,
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
catch (error) {
|
|
254
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
255
|
+
return (0, utils_1.fail)("INTERNAL_ERROR", msg);
|
|
256
|
+
}
|
|
257
|
+
}
|