claude-flow 3.25.6 → 3.26.0
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/.claude/helpers/.helpers-version +1 -1
- package/.claude/helpers/helpers.manifest.json +5 -4
- package/.claude/helpers/hook-handler.cjs +129 -0
- package/.claude/helpers/intelligence.cjs +10 -0
- package/.claude/helpers/statusline.cjs +300 -123
- package/.claude/proven-config.json +1 -1
- package/.claude/security-scans/scan-all-standard.json +321 -0
- package/.claude/security-scans/scan-code-deep.json +1209 -0
- package/.claude/security-scans/scan-deps-full.json +14 -0
- package/package.json +3 -1
- package/v3/@claude-flow/cli/catalog-manifest.json +12 -0
- package/v3/@claude-flow/cli/dist/src/commands/advisor.d.ts +15 -0
- package/v3/@claude-flow/cli/dist/src/commands/advisor.js +94 -0
- package/v3/@claude-flow/cli/dist/src/commands/doctor.js +77 -3
- package/v3/@claude-flow/cli/dist/src/commands/funnel.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/commands/funnel.js +103 -0
- package/v3/@claude-flow/cli/dist/src/commands/hooks.js +112 -46
- package/v3/@claude-flow/cli/dist/src/commands/index.js +10 -0
- package/v3/@claude-flow/cli/dist/src/commands/init.js +44 -0
- package/v3/@claude-flow/cli/dist/src/commands/proxy.d.ts +21 -0
- package/v3/@claude-flow/cli/dist/src/commands/proxy.js +310 -0
- package/v3/@claude-flow/cli/dist/src/commands/security.js +29 -0
- package/v3/@claude-flow/cli/dist/src/commands/settings.d.ts +19 -0
- package/v3/@claude-flow/cli/dist/src/commands/settings.js +180 -0
- package/v3/@claude-flow/cli/dist/src/commands/version.d.ts +42 -0
- package/v3/@claude-flow/cli/dist/src/commands/version.js +106 -0
- package/v3/@claude-flow/cli/dist/src/funnel/advisor-tip.d.ts +58 -0
- package/v3/@claude-flow/cli/dist/src/funnel/advisor-tip.js +92 -0
- package/v3/@claude-flow/cli/dist/src/funnel/attribution.d.ts +37 -0
- package/v3/@claude-flow/cli/dist/src/funnel/attribution.js +101 -0
- package/v3/@claude-flow/cli/dist/src/funnel/consent.d.ts +22 -0
- package/v3/@claude-flow/cli/dist/src/funnel/consent.js +55 -0
- package/v3/@claude-flow/cli/dist/src/funnel/credit-errors.d.ts +31 -0
- package/v3/@claude-flow/cli/dist/src/funnel/credit-errors.js +88 -0
- package/v3/@claude-flow/cli/dist/src/funnel/credit-notifier.d.ts +44 -0
- package/v3/@claude-flow/cli/dist/src/funnel/credit-notifier.js +74 -0
- package/v3/@claude-flow/cli/dist/src/funnel/disclosure.d.ts +46 -0
- package/v3/@claude-flow/cli/dist/src/funnel/disclosure.js +97 -0
- package/v3/@claude-flow/cli/dist/src/funnel/enrollment.d.ts +36 -0
- package/v3/@claude-flow/cli/dist/src/funnel/enrollment.js +64 -0
- package/v3/@claude-flow/cli/dist/src/funnel/environment.d.ts +17 -0
- package/v3/@claude-flow/cli/dist/src/funnel/environment.js +39 -0
- package/v3/@claude-flow/cli/dist/src/funnel/event-transport.d.ts +51 -0
- package/v3/@claude-flow/cli/dist/src/funnel/event-transport.js +199 -0
- package/v3/@claude-flow/cli/dist/src/funnel/events.d.ts +42 -0
- package/v3/@claude-flow/cli/dist/src/funnel/events.js +150 -0
- package/v3/@claude-flow/cli/dist/src/funnel/index.d.ts +20 -0
- package/v3/@claude-flow/cli/dist/src/funnel/index.js +20 -0
- package/v3/@claude-flow/cli/dist/src/funnel/insights.d.ts +49 -0
- package/v3/@claude-flow/cli/dist/src/funnel/insights.js +120 -0
- package/v3/@claude-flow/cli/dist/src/funnel/local-signals.d.ts +15 -0
- package/v3/@claude-flow/cli/dist/src/funnel/local-signals.js +68 -0
- package/v3/@claude-flow/cli/dist/src/funnel/message-transport.d.ts +51 -0
- package/v3/@claude-flow/cli/dist/src/funnel/message-transport.js +149 -0
- package/v3/@claude-flow/cli/dist/src/funnel/messages.d.ts +55 -0
- package/v3/@claude-flow/cli/dist/src/funnel/messages.js +160 -0
- package/v3/@claude-flow/cli/dist/src/funnel/power-saver-notifier.d.ts +44 -0
- package/v3/@claude-flow/cli/dist/src/funnel/power-saver-notifier.js +92 -0
- package/v3/@claude-flow/cli/dist/src/funnel/precedence.d.ts +16 -0
- package/v3/@claude-flow/cli/dist/src/funnel/precedence.js +85 -0
- package/v3/@claude-flow/cli/dist/src/funnel/promo.d.ts +41 -0
- package/v3/@claude-flow/cli/dist/src/funnel/promo.js +144 -0
- package/v3/@claude-flow/cli/dist/src/funnel/rate-limit-notifier.d.ts +55 -0
- package/v3/@claude-flow/cli/dist/src/funnel/rate-limit-notifier.js +102 -0
- package/v3/@claude-flow/cli/dist/src/funnel/rotation.d.ts +19 -0
- package/v3/@claude-flow/cli/dist/src/funnel/rotation.js +70 -0
- package/v3/@claude-flow/cli/dist/src/funnel/state.d.ts +13 -0
- package/v3/@claude-flow/cli/dist/src/funnel/state.js +52 -0
- package/v3/@claude-flow/cli/dist/src/funnel/toggle-cooldown.d.ts +17 -0
- package/v3/@claude-flow/cli/dist/src/funnel/toggle-cooldown.js +32 -0
- package/v3/@claude-flow/cli/dist/src/funnel/types.d.ts +86 -0
- package/v3/@claude-flow/cli/dist/src/funnel/types.js +26 -0
- package/v3/@claude-flow/cli/dist/src/init/executor.js +9 -3
- package/v3/@claude-flow/cli/dist/src/init/helper-refresh.d.ts +33 -2
- package/v3/@claude-flow/cli/dist/src/init/helper-refresh.js +102 -12
- package/v3/@claude-flow/cli/dist/src/init/helpers-generator.js +52 -0
- package/v3/@claude-flow/cli/dist/src/init/statusline-generator.js +282 -116
- package/v3/@claude-flow/cli/dist/src/services/daemon-autostart.js +28 -5
- package/v3/@claude-flow/cli/dist/src/services/fable-harness.d.ts +39 -0
- package/v3/@claude-flow/cli/dist/src/services/fable-harness.js +41 -0
- package/v3/@claude-flow/cli/package.json +13 -4
- package/.claude/coordinator/config.json +0 -24
- package/.claude/coordinator/state.json +0 -37
- package/.claude/coordinator/tick-log/tick-01.json +0 -17
- package/.claude/coordinator/tick-log/tick-02.json +0 -17
- package/.claude/coordinator/tick-log/tick-03.json +0 -17
- package/.claude/coordinator/tick-log/tick-04.json +0 -14
- package/.claude/coordinator/tick-log/tick-05.json +0 -16
- package/.claude/settings.local.json +0 -11
- package/v3/@claude-flow/cli/dist/src/ruvector/lattice-wasm.d.ts +0 -14
- package/v3/@claude-flow/cli/dist/src/ruvector/lattice-wasm.js +0 -144
- package/v3/@claude-flow/guidance/dist/adversarial.d.ts +0 -284
- package/v3/@claude-flow/guidance/dist/adversarial.js +0 -572
- package/v3/@claude-flow/guidance/dist/analyzer.d.ts +0 -530
- package/v3/@claude-flow/guidance/dist/analyzer.js +0 -2587
- package/v3/@claude-flow/guidance/dist/artifacts.d.ts +0 -283
- package/v3/@claude-flow/guidance/dist/artifacts.js +0 -356
- package/v3/@claude-flow/guidance/dist/authority.d.ts +0 -290
- package/v3/@claude-flow/guidance/dist/authority.js +0 -558
- package/v3/@claude-flow/guidance/dist/capabilities.d.ts +0 -209
- package/v3/@claude-flow/guidance/dist/capabilities.js +0 -485
- package/v3/@claude-flow/guidance/dist/coherence.d.ts +0 -233
- package/v3/@claude-flow/guidance/dist/coherence.js +0 -372
- package/v3/@claude-flow/guidance/dist/compiler.d.ts +0 -87
- package/v3/@claude-flow/guidance/dist/compiler.js +0 -410
- package/v3/@claude-flow/guidance/dist/conformance-kit.d.ts +0 -225
- package/v3/@claude-flow/guidance/dist/conformance-kit.js +0 -629
- package/v3/@claude-flow/guidance/dist/continue-gate.d.ts +0 -214
- package/v3/@claude-flow/guidance/dist/continue-gate.js +0 -353
- package/v3/@claude-flow/guidance/dist/crypto-utils.d.ts +0 -17
- package/v3/@claude-flow/guidance/dist/crypto-utils.js +0 -24
- package/v3/@claude-flow/guidance/dist/evolution.d.ts +0 -282
- package/v3/@claude-flow/guidance/dist/evolution.js +0 -500
- package/v3/@claude-flow/guidance/dist/gates.d.ts +0 -79
- package/v3/@claude-flow/guidance/dist/gates.js +0 -302
- package/v3/@claude-flow/guidance/dist/gateway.d.ts +0 -206
- package/v3/@claude-flow/guidance/dist/gateway.js +0 -452
- package/v3/@claude-flow/guidance/dist/generators.d.ts +0 -153
- package/v3/@claude-flow/guidance/dist/generators.js +0 -682
- package/v3/@claude-flow/guidance/dist/headless.d.ts +0 -177
- package/v3/@claude-flow/guidance/dist/headless.js +0 -342
- package/v3/@claude-flow/guidance/dist/hooks.d.ts +0 -109
- package/v3/@claude-flow/guidance/dist/hooks.js +0 -347
- package/v3/@claude-flow/guidance/dist/index.d.ts +0 -205
- package/v3/@claude-flow/guidance/dist/index.js +0 -321
- package/v3/@claude-flow/guidance/dist/ledger.d.ts +0 -162
- package/v3/@claude-flow/guidance/dist/ledger.js +0 -375
- package/v3/@claude-flow/guidance/dist/manifest-validator.d.ts +0 -289
- package/v3/@claude-flow/guidance/dist/manifest-validator.js +0 -838
- package/v3/@claude-flow/guidance/dist/memory-gate.d.ts +0 -222
- package/v3/@claude-flow/guidance/dist/memory-gate.js +0 -382
- package/v3/@claude-flow/guidance/dist/meta-governance.d.ts +0 -265
- package/v3/@claude-flow/guidance/dist/meta-governance.js +0 -348
- package/v3/@claude-flow/guidance/dist/optimizer.d.ts +0 -104
- package/v3/@claude-flow/guidance/dist/optimizer.js +0 -329
- package/v3/@claude-flow/guidance/dist/persistence.d.ts +0 -189
- package/v3/@claude-flow/guidance/dist/persistence.js +0 -464
- package/v3/@claude-flow/guidance/dist/proof.d.ts +0 -185
- package/v3/@claude-flow/guidance/dist/proof.js +0 -238
- package/v3/@claude-flow/guidance/dist/retriever.d.ts +0 -172
- package/v3/@claude-flow/guidance/dist/retriever.js +0 -596
- package/v3/@claude-flow/guidance/dist/ruvbot-integration.d.ts +0 -370
- package/v3/@claude-flow/guidance/dist/ruvbot-integration.js +0 -738
- package/v3/@claude-flow/guidance/dist/temporal.d.ts +0 -426
- package/v3/@claude-flow/guidance/dist/temporal.js +0 -658
- package/v3/@claude-flow/guidance/dist/trust.d.ts +0 -283
- package/v3/@claude-flow/guidance/dist/trust.js +0 -473
- package/v3/@claude-flow/guidance/dist/truth-anchors.d.ts +0 -276
- package/v3/@claude-flow/guidance/dist/truth-anchors.js +0 -488
- package/v3/@claude-flow/guidance/dist/types.d.ts +0 -378
- package/v3/@claude-flow/guidance/dist/types.js +0 -10
- package/v3/@claude-flow/guidance/dist/uncertainty.d.ts +0 -372
- package/v3/@claude-flow/guidance/dist/uncertainty.js +0 -619
- package/v3/@claude-flow/guidance/dist/wasm-kernel.d.ts +0 -48
- package/v3/@claude-flow/guidance/dist/wasm-kernel.js +0 -158
- package/v3/@claude-flow/shared/dist/core/config/defaults.d.ts +0 -41
- package/v3/@claude-flow/shared/dist/core/config/defaults.js +0 -186
- package/v3/@claude-flow/shared/dist/core/config/index.d.ts +0 -8
- package/v3/@claude-flow/shared/dist/core/config/index.js +0 -12
- package/v3/@claude-flow/shared/dist/core/config/loader.d.ts +0 -45
- package/v3/@claude-flow/shared/dist/core/config/loader.js +0 -238
- package/v3/@claude-flow/shared/dist/core/config/schema.d.ts +0 -1728
- package/v3/@claude-flow/shared/dist/core/config/schema.js +0 -160
- package/v3/@claude-flow/shared/dist/core/config/validator.d.ts +0 -92
- package/v3/@claude-flow/shared/dist/core/config/validator.js +0 -147
- package/v3/@claude-flow/shared/dist/core/event-bus.d.ts +0 -31
- package/v3/@claude-flow/shared/dist/core/event-bus.js +0 -197
- package/v3/@claude-flow/shared/dist/core/index.d.ts +0 -15
- package/v3/@claude-flow/shared/dist/core/index.js +0 -19
- package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.d.ts +0 -200
- package/v3/@claude-flow/shared/dist/core/interfaces/agent.interface.js +0 -6
- package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.d.ts +0 -310
- package/v3/@claude-flow/shared/dist/core/interfaces/coordinator.interface.js +0 -7
- package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.d.ts +0 -224
- package/v3/@claude-flow/shared/dist/core/interfaces/event.interface.js +0 -46
- package/v3/@claude-flow/shared/dist/core/interfaces/index.d.ts +0 -10
- package/v3/@claude-flow/shared/dist/core/interfaces/index.js +0 -15
- package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.d.ts +0 -298
- package/v3/@claude-flow/shared/dist/core/interfaces/memory.interface.js +0 -7
- package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.d.ts +0 -185
- package/v3/@claude-flow/shared/dist/core/interfaces/task.interface.js +0 -6
- package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.d.ts +0 -35
- package/v3/@claude-flow/shared/dist/core/orchestrator/event-coordinator.js +0 -101
- package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.d.ts +0 -60
- package/v3/@claude-flow/shared/dist/core/orchestrator/health-monitor.js +0 -166
- package/v3/@claude-flow/shared/dist/core/orchestrator/index.d.ts +0 -46
- package/v3/@claude-flow/shared/dist/core/orchestrator/index.js +0 -64
- package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.d.ts +0 -56
- package/v3/@claude-flow/shared/dist/core/orchestrator/lifecycle-manager.js +0 -195
- package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.d.ts +0 -83
- package/v3/@claude-flow/shared/dist/core/orchestrator/session-manager.js +0 -193
- package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.d.ts +0 -49
- package/v3/@claude-flow/shared/dist/core/orchestrator/task-manager.js +0 -253
- package/v3/@claude-flow/shared/dist/events/domain-events.d.ts +0 -282
- package/v3/@claude-flow/shared/dist/events/domain-events.js +0 -165
- package/v3/@claude-flow/shared/dist/events/event-store.d.ts +0 -126
- package/v3/@claude-flow/shared/dist/events/event-store.js +0 -427
- package/v3/@claude-flow/shared/dist/events/event-store.test.d.ts +0 -8
- package/v3/@claude-flow/shared/dist/events/event-store.test.js +0 -293
- package/v3/@claude-flow/shared/dist/events/example-usage.d.ts +0 -10
- package/v3/@claude-flow/shared/dist/events/example-usage.js +0 -193
- package/v3/@claude-flow/shared/dist/events/index.d.ts +0 -21
- package/v3/@claude-flow/shared/dist/events/index.js +0 -22
- package/v3/@claude-flow/shared/dist/events/projections.d.ts +0 -177
- package/v3/@claude-flow/shared/dist/events/projections.js +0 -421
- package/v3/@claude-flow/shared/dist/events/rvf-event-log.d.ts +0 -82
- package/v3/@claude-flow/shared/dist/events/rvf-event-log.js +0 -340
- package/v3/@claude-flow/shared/dist/events/state-reconstructor.d.ts +0 -101
- package/v3/@claude-flow/shared/dist/events/state-reconstructor.js +0 -263
- package/v3/@claude-flow/shared/dist/events.d.ts +0 -80
- package/v3/@claude-flow/shared/dist/events.js +0 -249
- package/v3/@claude-flow/shared/dist/hooks/example-usage.d.ts +0 -42
- package/v3/@claude-flow/shared/dist/hooks/example-usage.js +0 -351
- package/v3/@claude-flow/shared/dist/hooks/executor.d.ts +0 -100
- package/v3/@claude-flow/shared/dist/hooks/executor.js +0 -267
- package/v3/@claude-flow/shared/dist/hooks/hooks.test.d.ts +0 -9
- package/v3/@claude-flow/shared/dist/hooks/hooks.test.js +0 -322
- package/v3/@claude-flow/shared/dist/hooks/index.d.ts +0 -52
- package/v3/@claude-flow/shared/dist/hooks/index.js +0 -51
- package/v3/@claude-flow/shared/dist/hooks/registry.d.ts +0 -133
- package/v3/@claude-flow/shared/dist/hooks/registry.js +0 -277
- package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.d.ts +0 -105
- package/v3/@claude-flow/shared/dist/hooks/safety/bash-safety.js +0 -481
- package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.d.ts +0 -144
- package/v3/@claude-flow/shared/dist/hooks/safety/file-organization.js +0 -328
- package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.d.ts +0 -158
- package/v3/@claude-flow/shared/dist/hooks/safety/git-commit.js +0 -450
- package/v3/@claude-flow/shared/dist/hooks/safety/index.d.ts +0 -17
- package/v3/@claude-flow/shared/dist/hooks/safety/index.js +0 -17
- package/v3/@claude-flow/shared/dist/hooks/session-hooks.d.ts +0 -234
- package/v3/@claude-flow/shared/dist/hooks/session-hooks.js +0 -334
- package/v3/@claude-flow/shared/dist/hooks/task-hooks.d.ts +0 -163
- package/v3/@claude-flow/shared/dist/hooks/task-hooks.js +0 -326
- package/v3/@claude-flow/shared/dist/hooks/types.d.ts +0 -267
- package/v3/@claude-flow/shared/dist/hooks/types.js +0 -62
- package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.d.ts +0 -9
- package/v3/@claude-flow/shared/dist/hooks/verify-exports.test.js +0 -93
- package/v3/@claude-flow/shared/dist/index.d.ts +0 -20
- package/v3/@claude-flow/shared/dist/index.js +0 -50
- package/v3/@claude-flow/shared/dist/mcp/connection-pool.d.ts +0 -98
- package/v3/@claude-flow/shared/dist/mcp/connection-pool.js +0 -364
- package/v3/@claude-flow/shared/dist/mcp/index.d.ts +0 -69
- package/v3/@claude-flow/shared/dist/mcp/index.js +0 -84
- package/v3/@claude-flow/shared/dist/mcp/server.d.ts +0 -166
- package/v3/@claude-flow/shared/dist/mcp/server.js +0 -590
- package/v3/@claude-flow/shared/dist/mcp/session-manager.d.ts +0 -136
- package/v3/@claude-flow/shared/dist/mcp/session-manager.js +0 -335
- package/v3/@claude-flow/shared/dist/mcp/tool-registry.d.ts +0 -178
- package/v3/@claude-flow/shared/dist/mcp/tool-registry.js +0 -439
- package/v3/@claude-flow/shared/dist/mcp/transport/http.d.ts +0 -104
- package/v3/@claude-flow/shared/dist/mcp/transport/http.js +0 -476
- package/v3/@claude-flow/shared/dist/mcp/transport/index.d.ts +0 -102
- package/v3/@claude-flow/shared/dist/mcp/transport/index.js +0 -238
- package/v3/@claude-flow/shared/dist/mcp/transport/stdio.d.ts +0 -104
- package/v3/@claude-flow/shared/dist/mcp/transport/stdio.js +0 -263
- package/v3/@claude-flow/shared/dist/mcp/transport/websocket.d.ts +0 -133
- package/v3/@claude-flow/shared/dist/mcp/transport/websocket.js +0 -396
- package/v3/@claude-flow/shared/dist/mcp/types.d.ts +0 -436
- package/v3/@claude-flow/shared/dist/mcp/types.js +0 -54
- package/v3/@claude-flow/shared/dist/plugin-interface.d.ts +0 -544
- package/v3/@claude-flow/shared/dist/plugin-interface.js +0 -23
- package/v3/@claude-flow/shared/dist/plugin-loader.d.ts +0 -139
- package/v3/@claude-flow/shared/dist/plugin-loader.js +0 -434
- package/v3/@claude-flow/shared/dist/plugin-registry.d.ts +0 -183
- package/v3/@claude-flow/shared/dist/plugin-registry.js +0 -457
- package/v3/@claude-flow/shared/dist/plugins/index.d.ts +0 -10
- package/v3/@claude-flow/shared/dist/plugins/index.js +0 -10
- package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.d.ts +0 -106
- package/v3/@claude-flow/shared/dist/plugins/official/hive-mind-plugin.js +0 -241
- package/v3/@claude-flow/shared/dist/plugins/official/index.d.ts +0 -10
- package/v3/@claude-flow/shared/dist/plugins/official/index.js +0 -10
- package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.d.ts +0 -121
- package/v3/@claude-flow/shared/dist/plugins/official/maestro-plugin.js +0 -355
- package/v3/@claude-flow/shared/dist/plugins/types.d.ts +0 -93
- package/v3/@claude-flow/shared/dist/plugins/types.js +0 -9
- package/v3/@claude-flow/shared/dist/resilience/bulkhead.d.ts +0 -105
- package/v3/@claude-flow/shared/dist/resilience/bulkhead.js +0 -206
- package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.d.ts +0 -132
- package/v3/@claude-flow/shared/dist/resilience/circuit-breaker.js +0 -233
- package/v3/@claude-flow/shared/dist/resilience/index.d.ts +0 -19
- package/v3/@claude-flow/shared/dist/resilience/index.js +0 -19
- package/v3/@claude-flow/shared/dist/resilience/rate-limiter.d.ts +0 -168
- package/v3/@claude-flow/shared/dist/resilience/rate-limiter.js +0 -314
- package/v3/@claude-flow/shared/dist/resilience/retry.d.ts +0 -91
- package/v3/@claude-flow/shared/dist/resilience/retry.js +0 -159
- package/v3/@claude-flow/shared/dist/security/index.d.ts +0 -10
- package/v3/@claude-flow/shared/dist/security/index.js +0 -12
- package/v3/@claude-flow/shared/dist/security/input-validation.d.ts +0 -73
- package/v3/@claude-flow/shared/dist/security/input-validation.js +0 -201
- package/v3/@claude-flow/shared/dist/security/secure-random.d.ts +0 -92
- package/v3/@claude-flow/shared/dist/security/secure-random.js +0 -142
- package/v3/@claude-flow/shared/dist/services/index.d.ts +0 -7
- package/v3/@claude-flow/shared/dist/services/index.js +0 -7
- package/v3/@claude-flow/shared/dist/services/v3-progress.service.d.ts +0 -124
- package/v3/@claude-flow/shared/dist/services/v3-progress.service.js +0 -402
- package/v3/@claude-flow/shared/dist/types/agent.types.d.ts +0 -137
- package/v3/@claude-flow/shared/dist/types/agent.types.js +0 -6
- package/v3/@claude-flow/shared/dist/types/index.d.ts +0 -11
- package/v3/@claude-flow/shared/dist/types/index.js +0 -17
- package/v3/@claude-flow/shared/dist/types/mcp.types.d.ts +0 -266
- package/v3/@claude-flow/shared/dist/types/mcp.types.js +0 -7
- package/v3/@claude-flow/shared/dist/types/memory.types.d.ts +0 -236
- package/v3/@claude-flow/shared/dist/types/memory.types.js +0 -7
- package/v3/@claude-flow/shared/dist/types/swarm.types.d.ts +0 -186
- package/v3/@claude-flow/shared/dist/types/swarm.types.js +0 -65
- package/v3/@claude-flow/shared/dist/types/task.types.d.ts +0 -178
- package/v3/@claude-flow/shared/dist/types/task.types.js +0 -32
- package/v3/@claude-flow/shared/dist/types.d.ts +0 -197
- package/v3/@claude-flow/shared/dist/types.js +0 -21
- package/v3/@claude-flow/shared/dist/utils/secure-logger.d.ts +0 -69
- package/v3/@claude-flow/shared/dist/utils/secure-logger.js +0 -208
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 Lifecycle Manager
|
|
3
|
-
* Decomposed from orchestrator.ts - Agent spawn/terminate
|
|
4
|
-
* ~150 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import type { IAgent, IAgentConfig, IAgentLifecycleManager, IAgentPool, AgentStatus } from '../interfaces/agent.interface.js';
|
|
7
|
-
import type { IEventBus } from '../interfaces/event.interface.js';
|
|
8
|
-
/**
|
|
9
|
-
* Agent pool implementation
|
|
10
|
-
*/
|
|
11
|
-
export declare class AgentPool implements IAgentPool {
|
|
12
|
-
private agents;
|
|
13
|
-
add(agent: IAgent): void;
|
|
14
|
-
remove(agentId: string): boolean;
|
|
15
|
-
get(agentId: string): IAgent | undefined;
|
|
16
|
-
getAll(): IAgent[];
|
|
17
|
-
getByStatus(status: AgentStatus): IAgent[];
|
|
18
|
-
getByType(type: string): IAgent[];
|
|
19
|
-
getAvailable(): IAgent[];
|
|
20
|
-
size(): number;
|
|
21
|
-
hasCapacity(maxSize: number): boolean;
|
|
22
|
-
clear(): void;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Lifecycle manager configuration
|
|
26
|
-
*/
|
|
27
|
-
export interface LifecycleManagerConfig {
|
|
28
|
-
maxConcurrentAgents: number;
|
|
29
|
-
spawnTimeout: number;
|
|
30
|
-
terminateTimeout: number;
|
|
31
|
-
maxSpawnRetries: number;
|
|
32
|
-
}
|
|
33
|
-
/**
|
|
34
|
-
* Lifecycle manager implementation
|
|
35
|
-
*/
|
|
36
|
-
export declare class LifecycleManager implements IAgentLifecycleManager {
|
|
37
|
-
private eventBus;
|
|
38
|
-
private config;
|
|
39
|
-
private pool;
|
|
40
|
-
constructor(eventBus: IEventBus, config: LifecycleManagerConfig, pool?: IAgentPool);
|
|
41
|
-
spawn(config: IAgentConfig): Promise<IAgent>;
|
|
42
|
-
spawnBatch(configs: IAgentConfig[]): Promise<Map<string, IAgent>>;
|
|
43
|
-
terminate(agentId: string, reason?: string): Promise<void>;
|
|
44
|
-
terminateAll(reason?: string): Promise<void>;
|
|
45
|
-
restart(agentId: string): Promise<IAgent>;
|
|
46
|
-
updateConfig(agentId: string, config: Partial<IAgentConfig>): Promise<void>;
|
|
47
|
-
getAgent(agentId: string): IAgent | undefined;
|
|
48
|
-
getAllAgents(): IAgent[];
|
|
49
|
-
getActiveCount(): number;
|
|
50
|
-
checkHealth(agentId: string): Promise<IAgent['health']>;
|
|
51
|
-
/**
|
|
52
|
-
* Get agent pool
|
|
53
|
-
*/
|
|
54
|
-
getPool(): IAgentPool;
|
|
55
|
-
}
|
|
56
|
-
//# sourceMappingURL=lifecycle-manager.d.ts.map
|
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 Lifecycle Manager
|
|
3
|
-
* Decomposed from orchestrator.ts - Agent spawn/terminate
|
|
4
|
-
* ~150 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import { SystemEventTypes } from '../interfaces/event.interface.js';
|
|
7
|
-
/**
|
|
8
|
-
* Agent pool implementation
|
|
9
|
-
*/
|
|
10
|
-
export class AgentPool {
|
|
11
|
-
agents = new Map();
|
|
12
|
-
add(agent) {
|
|
13
|
-
this.agents.set(agent.id, agent);
|
|
14
|
-
}
|
|
15
|
-
remove(agentId) {
|
|
16
|
-
return this.agents.delete(agentId);
|
|
17
|
-
}
|
|
18
|
-
get(agentId) {
|
|
19
|
-
return this.agents.get(agentId);
|
|
20
|
-
}
|
|
21
|
-
getAll() {
|
|
22
|
-
return Array.from(this.agents.values());
|
|
23
|
-
}
|
|
24
|
-
getByStatus(status) {
|
|
25
|
-
return this.getAll().filter(agent => agent.status === status);
|
|
26
|
-
}
|
|
27
|
-
getByType(type) {
|
|
28
|
-
return this.getAll().filter(agent => agent.type === type);
|
|
29
|
-
}
|
|
30
|
-
getAvailable() {
|
|
31
|
-
return this.getAll().filter(agent => (agent.status === 'active' || agent.status === 'idle') &&
|
|
32
|
-
agent.currentTaskCount < agent.config.maxConcurrentTasks);
|
|
33
|
-
}
|
|
34
|
-
size() {
|
|
35
|
-
return this.agents.size;
|
|
36
|
-
}
|
|
37
|
-
hasCapacity(maxSize) {
|
|
38
|
-
return this.agents.size < maxSize;
|
|
39
|
-
}
|
|
40
|
-
clear() {
|
|
41
|
-
this.agents.clear();
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Lifecycle manager implementation
|
|
46
|
-
*/
|
|
47
|
-
export class LifecycleManager {
|
|
48
|
-
eventBus;
|
|
49
|
-
config;
|
|
50
|
-
pool;
|
|
51
|
-
constructor(eventBus, config, pool) {
|
|
52
|
-
this.eventBus = eventBus;
|
|
53
|
-
this.config = config;
|
|
54
|
-
this.pool = pool ?? new AgentPool();
|
|
55
|
-
}
|
|
56
|
-
async spawn(config) {
|
|
57
|
-
// Validate capacity
|
|
58
|
-
if (!this.pool.hasCapacity(this.config.maxConcurrentAgents)) {
|
|
59
|
-
throw new Error('Maximum concurrent agents reached');
|
|
60
|
-
}
|
|
61
|
-
// Validate agent doesn't already exist
|
|
62
|
-
if (this.pool.get(config.id)) {
|
|
63
|
-
throw new Error(`Agent with ID ${config.id} already exists`);
|
|
64
|
-
}
|
|
65
|
-
const agent = {
|
|
66
|
-
id: config.id,
|
|
67
|
-
name: config.name,
|
|
68
|
-
type: config.type,
|
|
69
|
-
config,
|
|
70
|
-
createdAt: new Date(),
|
|
71
|
-
status: 'spawning',
|
|
72
|
-
currentTaskCount: 0,
|
|
73
|
-
lastActivity: new Date(),
|
|
74
|
-
metrics: {
|
|
75
|
-
tasksCompleted: 0,
|
|
76
|
-
tasksFailed: 0,
|
|
77
|
-
avgTaskDuration: 0,
|
|
78
|
-
errorCount: 0,
|
|
79
|
-
uptime: 0,
|
|
80
|
-
},
|
|
81
|
-
};
|
|
82
|
-
// Add to pool
|
|
83
|
-
this.pool.add(agent);
|
|
84
|
-
// Mark as active
|
|
85
|
-
agent.status = 'active';
|
|
86
|
-
this.eventBus.emit(SystemEventTypes.AGENT_SPAWNED, {
|
|
87
|
-
agentId: agent.id,
|
|
88
|
-
profile: config,
|
|
89
|
-
sessionId: undefined,
|
|
90
|
-
});
|
|
91
|
-
return agent;
|
|
92
|
-
}
|
|
93
|
-
async spawnBatch(configs) {
|
|
94
|
-
const results = new Map();
|
|
95
|
-
// Check total capacity
|
|
96
|
-
if (this.pool.size() + configs.length > this.config.maxConcurrentAgents) {
|
|
97
|
-
throw new Error('Batch would exceed maximum concurrent agents');
|
|
98
|
-
}
|
|
99
|
-
// Spawn in parallel
|
|
100
|
-
const spawnPromises = configs.map(async (config) => {
|
|
101
|
-
try {
|
|
102
|
-
const agent = await this.spawn(config);
|
|
103
|
-
return { id: config.id, agent, error: null };
|
|
104
|
-
}
|
|
105
|
-
catch (error) {
|
|
106
|
-
return { id: config.id, agent: null, error };
|
|
107
|
-
}
|
|
108
|
-
});
|
|
109
|
-
const settled = await Promise.allSettled(spawnPromises);
|
|
110
|
-
for (const result of settled) {
|
|
111
|
-
if (result.status === 'fulfilled' && result.value.agent) {
|
|
112
|
-
results.set(result.value.id, result.value.agent);
|
|
113
|
-
}
|
|
114
|
-
}
|
|
115
|
-
return results;
|
|
116
|
-
}
|
|
117
|
-
async terminate(agentId, reason) {
|
|
118
|
-
const agent = this.pool.get(agentId);
|
|
119
|
-
if (!agent) {
|
|
120
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
121
|
-
}
|
|
122
|
-
agent.status = 'terminated';
|
|
123
|
-
// Remove from pool
|
|
124
|
-
this.pool.remove(agentId);
|
|
125
|
-
this.eventBus.emit(SystemEventTypes.AGENT_TERMINATED, {
|
|
126
|
-
agentId,
|
|
127
|
-
reason: reason ?? 'User requested',
|
|
128
|
-
});
|
|
129
|
-
}
|
|
130
|
-
async terminateAll(reason) {
|
|
131
|
-
const agents = this.pool.getAll();
|
|
132
|
-
await Promise.allSettled(agents.map(agent => this.terminate(agent.id, reason)));
|
|
133
|
-
}
|
|
134
|
-
async restart(agentId) {
|
|
135
|
-
const agent = this.pool.get(agentId);
|
|
136
|
-
if (!agent) {
|
|
137
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
138
|
-
}
|
|
139
|
-
const config = agent.config;
|
|
140
|
-
await this.terminate(agentId, 'Restart requested');
|
|
141
|
-
return this.spawn(config);
|
|
142
|
-
}
|
|
143
|
-
async updateConfig(agentId, config) {
|
|
144
|
-
const agent = this.pool.get(agentId);
|
|
145
|
-
if (!agent) {
|
|
146
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
147
|
-
}
|
|
148
|
-
Object.assign(agent.config, config);
|
|
149
|
-
}
|
|
150
|
-
getAgent(agentId) {
|
|
151
|
-
return this.pool.get(agentId);
|
|
152
|
-
}
|
|
153
|
-
getAllAgents() {
|
|
154
|
-
return this.pool.getAll();
|
|
155
|
-
}
|
|
156
|
-
getActiveCount() {
|
|
157
|
-
return this.pool.getByStatus('active').length +
|
|
158
|
-
this.pool.getByStatus('idle').length;
|
|
159
|
-
}
|
|
160
|
-
async checkHealth(agentId) {
|
|
161
|
-
const agent = this.pool.get(agentId);
|
|
162
|
-
if (!agent) {
|
|
163
|
-
throw new Error(`Agent not found: ${agentId}`);
|
|
164
|
-
}
|
|
165
|
-
// Simple health check based on metrics
|
|
166
|
-
const errorRate = agent.metrics
|
|
167
|
-
? agent.metrics.errorCount / Math.max(1, agent.metrics.tasksCompleted + agent.metrics.tasksFailed)
|
|
168
|
-
: 0;
|
|
169
|
-
const health = {
|
|
170
|
-
status: errorRate > 0.5 ? 'unhealthy' : errorRate > 0.2 ? 'degraded' : 'healthy',
|
|
171
|
-
lastCheck: new Date(),
|
|
172
|
-
issues: [],
|
|
173
|
-
};
|
|
174
|
-
if (errorRate > 0.2) {
|
|
175
|
-
health.issues?.push(`High error rate: ${(errorRate * 100).toFixed(1)}%`);
|
|
176
|
-
}
|
|
177
|
-
agent.health = health;
|
|
178
|
-
if (health.status !== 'healthy') {
|
|
179
|
-
this.eventBus.emit(SystemEventTypes.AGENT_HEALTH_CHANGED, {
|
|
180
|
-
agentId,
|
|
181
|
-
previousStatus: agent.status,
|
|
182
|
-
currentStatus: agent.status,
|
|
183
|
-
issues: health.issues,
|
|
184
|
-
});
|
|
185
|
-
}
|
|
186
|
-
return health;
|
|
187
|
-
}
|
|
188
|
-
/**
|
|
189
|
-
* Get agent pool
|
|
190
|
-
*/
|
|
191
|
-
getPool() {
|
|
192
|
-
return this.pool;
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
//# sourceMappingURL=lifecycle-manager.js.map
|
|
@@ -1,83 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 Session Manager
|
|
3
|
-
* Decomposed from orchestrator.ts - Session handling
|
|
4
|
-
* ~200 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import type { IAgentSession } from '../interfaces/agent.interface.js';
|
|
7
|
-
import type { IEventBus } from '../interfaces/event.interface.js';
|
|
8
|
-
import type { AgentProfile } from '../../types/agent.types.js';
|
|
9
|
-
/**
|
|
10
|
-
* Session persistence structure
|
|
11
|
-
*/
|
|
12
|
-
export interface SessionPersistence {
|
|
13
|
-
sessions: Array<IAgentSession & {
|
|
14
|
-
profile: AgentProfile;
|
|
15
|
-
}>;
|
|
16
|
-
metrics: {
|
|
17
|
-
completedTasks: number;
|
|
18
|
-
failedTasks: number;
|
|
19
|
-
totalTaskDuration: number;
|
|
20
|
-
};
|
|
21
|
-
savedAt: Date;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Session manager configuration
|
|
25
|
-
*/
|
|
26
|
-
export interface SessionManagerConfig {
|
|
27
|
-
persistSessions: boolean;
|
|
28
|
-
dataDir: string;
|
|
29
|
-
sessionRetentionMs?: number;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Session manager interface
|
|
33
|
-
*/
|
|
34
|
-
export interface ISessionManager {
|
|
35
|
-
createSession(profile: AgentProfile, terminalId: string, memoryBankId: string): Promise<IAgentSession>;
|
|
36
|
-
getSession(sessionId: string): IAgentSession | undefined;
|
|
37
|
-
getActiveSessions(): IAgentSession[];
|
|
38
|
-
getSessionsByAgent(agentId: string): IAgentSession[];
|
|
39
|
-
terminateSession(sessionId: string): Promise<void>;
|
|
40
|
-
terminateAllSessions(): Promise<void>;
|
|
41
|
-
persistSessions(): Promise<void>;
|
|
42
|
-
restoreSessions(): Promise<SessionPersistence | null>;
|
|
43
|
-
removeSession(sessionId: string): void;
|
|
44
|
-
updateSessionActivity(sessionId: string): void;
|
|
45
|
-
}
|
|
46
|
-
/**
|
|
47
|
-
* Session manager implementation
|
|
48
|
-
*/
|
|
49
|
-
export declare class SessionManager implements ISessionManager {
|
|
50
|
-
private eventBus;
|
|
51
|
-
private config;
|
|
52
|
-
private sessions;
|
|
53
|
-
private sessionProfiles;
|
|
54
|
-
private persistencePath;
|
|
55
|
-
constructor(eventBus: IEventBus, config: SessionManagerConfig);
|
|
56
|
-
createSession(profile: AgentProfile, terminalId: string, memoryBankId: string): Promise<IAgentSession>;
|
|
57
|
-
getSession(sessionId: string): IAgentSession | undefined;
|
|
58
|
-
getActiveSessions(): IAgentSession[];
|
|
59
|
-
getSessionsByAgent(agentId: string): IAgentSession[];
|
|
60
|
-
terminateSession(sessionId: string): Promise<void>;
|
|
61
|
-
terminateAllSessions(): Promise<void>;
|
|
62
|
-
removeSession(sessionId: string): void;
|
|
63
|
-
updateSessionActivity(sessionId: string): void;
|
|
64
|
-
persistSessions(): Promise<void>;
|
|
65
|
-
restoreSessions(): Promise<SessionPersistence | null>;
|
|
66
|
-
/**
|
|
67
|
-
* Clean up old terminated sessions
|
|
68
|
-
*/
|
|
69
|
-
cleanupTerminatedSessions(retentionMs?: number): Promise<number>;
|
|
70
|
-
/**
|
|
71
|
-
* Get session profile
|
|
72
|
-
*/
|
|
73
|
-
getSessionProfile(sessionId: string): AgentProfile | undefined;
|
|
74
|
-
/**
|
|
75
|
-
* Get session count
|
|
76
|
-
*/
|
|
77
|
-
getSessionCount(): number;
|
|
78
|
-
/**
|
|
79
|
-
* Get active session count
|
|
80
|
-
*/
|
|
81
|
-
getActiveSessionCount(): number;
|
|
82
|
-
}
|
|
83
|
-
//# sourceMappingURL=session-manager.d.ts.map
|
|
@@ -1,193 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 Session Manager
|
|
3
|
-
* Decomposed from orchestrator.ts - Session handling
|
|
4
|
-
* ~200 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import { SystemEventTypes } from '../interfaces/event.interface.js';
|
|
7
|
-
import { mkdir, writeFile, readFile } from 'fs/promises';
|
|
8
|
-
import { join, dirname } from 'path';
|
|
9
|
-
import { randomBytes } from 'crypto';
|
|
10
|
-
// Secure session ID generation
|
|
11
|
-
function generateSecureSessionId() {
|
|
12
|
-
const timestamp = Date.now().toString(36);
|
|
13
|
-
const random = randomBytes(12).toString('hex');
|
|
14
|
-
return `session_${timestamp}_${random}`;
|
|
15
|
-
}
|
|
16
|
-
/**
|
|
17
|
-
* Session manager implementation
|
|
18
|
-
*/
|
|
19
|
-
export class SessionManager {
|
|
20
|
-
eventBus;
|
|
21
|
-
config;
|
|
22
|
-
sessions = new Map();
|
|
23
|
-
sessionProfiles = new Map();
|
|
24
|
-
persistencePath;
|
|
25
|
-
constructor(eventBus, config) {
|
|
26
|
-
this.eventBus = eventBus;
|
|
27
|
-
this.config = config;
|
|
28
|
-
this.persistencePath = join(config.dataDir || './data', 'sessions.json');
|
|
29
|
-
}
|
|
30
|
-
async createSession(profile, terminalId, memoryBankId) {
|
|
31
|
-
const session = {
|
|
32
|
-
id: generateSecureSessionId(),
|
|
33
|
-
agentId: profile.id,
|
|
34
|
-
terminalId,
|
|
35
|
-
startTime: new Date(),
|
|
36
|
-
status: 'active',
|
|
37
|
-
lastActivity: new Date(),
|
|
38
|
-
memoryBankId,
|
|
39
|
-
};
|
|
40
|
-
this.sessions.set(session.id, session);
|
|
41
|
-
this.sessionProfiles.set(session.id, profile);
|
|
42
|
-
this.eventBus.emit(SystemEventTypes.SESSION_CREATED, {
|
|
43
|
-
sessionId: session.id,
|
|
44
|
-
agentId: profile.id,
|
|
45
|
-
terminalId,
|
|
46
|
-
memoryBankId,
|
|
47
|
-
});
|
|
48
|
-
// Persist sessions asynchronously
|
|
49
|
-
this.persistSessions().catch(() => {
|
|
50
|
-
// Silently ignore persistence errors
|
|
51
|
-
});
|
|
52
|
-
return session;
|
|
53
|
-
}
|
|
54
|
-
getSession(sessionId) {
|
|
55
|
-
return this.sessions.get(sessionId);
|
|
56
|
-
}
|
|
57
|
-
getActiveSessions() {
|
|
58
|
-
return Array.from(this.sessions.values()).filter(session => session.status === 'active' || session.status === 'idle');
|
|
59
|
-
}
|
|
60
|
-
getSessionsByAgent(agentId) {
|
|
61
|
-
return Array.from(this.sessions.values()).filter(session => session.agentId === agentId);
|
|
62
|
-
}
|
|
63
|
-
async terminateSession(sessionId) {
|
|
64
|
-
const session = this.sessions.get(sessionId);
|
|
65
|
-
if (!session) {
|
|
66
|
-
throw new Error(`Session not found: ${sessionId}`);
|
|
67
|
-
}
|
|
68
|
-
session.status = 'terminated';
|
|
69
|
-
session.endTime = new Date();
|
|
70
|
-
const duration = session.endTime.getTime() - session.startTime.getTime();
|
|
71
|
-
this.eventBus.emit(SystemEventTypes.SESSION_TERMINATED, {
|
|
72
|
-
sessionId,
|
|
73
|
-
agentId: session.agentId,
|
|
74
|
-
duration,
|
|
75
|
-
});
|
|
76
|
-
// Clean up profile reference
|
|
77
|
-
this.sessionProfiles.delete(sessionId);
|
|
78
|
-
// Persist sessions asynchronously
|
|
79
|
-
this.persistSessions().catch(() => {
|
|
80
|
-
// Silently ignore persistence errors
|
|
81
|
-
});
|
|
82
|
-
}
|
|
83
|
-
async terminateAllSessions() {
|
|
84
|
-
const sessions = this.getActiveSessions();
|
|
85
|
-
const batchSize = 5;
|
|
86
|
-
for (let i = 0; i < sessions.length; i += batchSize) {
|
|
87
|
-
const batch = sessions.slice(i, i + batchSize);
|
|
88
|
-
await Promise.allSettled(batch.map(session => this.terminateSession(session.id)));
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
removeSession(sessionId) {
|
|
92
|
-
this.sessions.delete(sessionId);
|
|
93
|
-
this.sessionProfiles.delete(sessionId);
|
|
94
|
-
}
|
|
95
|
-
updateSessionActivity(sessionId) {
|
|
96
|
-
const session = this.sessions.get(sessionId);
|
|
97
|
-
if (session) {
|
|
98
|
-
session.lastActivity = new Date();
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
async persistSessions() {
|
|
102
|
-
if (!this.config.persistSessions) {
|
|
103
|
-
return;
|
|
104
|
-
}
|
|
105
|
-
try {
|
|
106
|
-
const data = {
|
|
107
|
-
sessions: Array.from(this.sessions.values())
|
|
108
|
-
.map(session => ({
|
|
109
|
-
...session,
|
|
110
|
-
profile: this.sessionProfiles.get(session.id),
|
|
111
|
-
}))
|
|
112
|
-
.filter(s => s.profile),
|
|
113
|
-
metrics: {
|
|
114
|
-
completedTasks: 0,
|
|
115
|
-
failedTasks: 0,
|
|
116
|
-
totalTaskDuration: 0,
|
|
117
|
-
},
|
|
118
|
-
savedAt: new Date(),
|
|
119
|
-
};
|
|
120
|
-
await mkdir(dirname(this.persistencePath), { recursive: true });
|
|
121
|
-
await writeFile(this.persistencePath, JSON.stringify(data, null, 2), 'utf8');
|
|
122
|
-
this.eventBus.emit(SystemEventTypes.SESSION_PERSISTED, {
|
|
123
|
-
sessionCount: data.sessions.length,
|
|
124
|
-
path: this.persistencePath,
|
|
125
|
-
});
|
|
126
|
-
}
|
|
127
|
-
catch (error) {
|
|
128
|
-
// Let caller handle persistence errors
|
|
129
|
-
throw error;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
async restoreSessions() {
|
|
133
|
-
if (!this.config.persistSessions) {
|
|
134
|
-
return null;
|
|
135
|
-
}
|
|
136
|
-
try {
|
|
137
|
-
const data = await readFile(this.persistencePath, 'utf8');
|
|
138
|
-
const persistence = JSON.parse(data);
|
|
139
|
-
// Filter to only active/idle sessions
|
|
140
|
-
const sessionsToRestore = persistence.sessions.filter(s => s.status === 'active' || s.status === 'idle');
|
|
141
|
-
this.eventBus.emit(SystemEventTypes.SESSION_RESTORED, {
|
|
142
|
-
sessionCount: sessionsToRestore.length,
|
|
143
|
-
path: this.persistencePath,
|
|
144
|
-
});
|
|
145
|
-
return {
|
|
146
|
-
...persistence,
|
|
147
|
-
sessions: sessionsToRestore,
|
|
148
|
-
};
|
|
149
|
-
}
|
|
150
|
-
catch (error) {
|
|
151
|
-
if (error.code === 'ENOENT') {
|
|
152
|
-
return null;
|
|
153
|
-
}
|
|
154
|
-
throw error;
|
|
155
|
-
}
|
|
156
|
-
}
|
|
157
|
-
/**
|
|
158
|
-
* Clean up old terminated sessions
|
|
159
|
-
*/
|
|
160
|
-
async cleanupTerminatedSessions(retentionMs) {
|
|
161
|
-
const cutoffTime = Date.now() - (retentionMs ?? this.config.sessionRetentionMs ?? 3600000);
|
|
162
|
-
let cleaned = 0;
|
|
163
|
-
for (const [sessionId, session] of this.sessions.entries()) {
|
|
164
|
-
if (session.status === 'terminated' && session.endTime) {
|
|
165
|
-
if (session.endTime.getTime() < cutoffTime) {
|
|
166
|
-
this.sessions.delete(sessionId);
|
|
167
|
-
this.sessionProfiles.delete(sessionId);
|
|
168
|
-
cleaned++;
|
|
169
|
-
}
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return cleaned;
|
|
173
|
-
}
|
|
174
|
-
/**
|
|
175
|
-
* Get session profile
|
|
176
|
-
*/
|
|
177
|
-
getSessionProfile(sessionId) {
|
|
178
|
-
return this.sessionProfiles.get(sessionId);
|
|
179
|
-
}
|
|
180
|
-
/**
|
|
181
|
-
* Get session count
|
|
182
|
-
*/
|
|
183
|
-
getSessionCount() {
|
|
184
|
-
return this.sessions.size;
|
|
185
|
-
}
|
|
186
|
-
/**
|
|
187
|
-
* Get active session count
|
|
188
|
-
*/
|
|
189
|
-
getActiveSessionCount() {
|
|
190
|
-
return this.getActiveSessions().length;
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
//# sourceMappingURL=session-manager.js.map
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* V3 Task Manager
|
|
3
|
-
* Decomposed from orchestrator.ts - Task lifecycle management
|
|
4
|
-
* ~200 lines (target achieved)
|
|
5
|
-
*/
|
|
6
|
-
import type { ITask, ITaskCreate, ITaskResult, ITaskManager, ITaskQueue, TaskManagerMetrics } from '../interfaces/task.interface.js';
|
|
7
|
-
import type { IEventBus } from '../interfaces/event.interface.js';
|
|
8
|
-
/**
|
|
9
|
-
* Priority queue implementation for tasks
|
|
10
|
-
*/
|
|
11
|
-
export declare class TaskQueue implements ITaskQueue {
|
|
12
|
-
private tasks;
|
|
13
|
-
enqueue(task: ITask): Promise<void>;
|
|
14
|
-
dequeue(): Promise<ITask | undefined>;
|
|
15
|
-
peek(): Promise<ITask | undefined>;
|
|
16
|
-
size(): number;
|
|
17
|
-
isEmpty(): boolean;
|
|
18
|
-
clear(): Promise<void>;
|
|
19
|
-
getAll(): Promise<ITask[]>;
|
|
20
|
-
remove(taskId: string): Promise<boolean>;
|
|
21
|
-
updatePriority(taskId: string, priority: number): Promise<boolean>;
|
|
22
|
-
}
|
|
23
|
-
/**
|
|
24
|
-
* Task manager implementation
|
|
25
|
-
*/
|
|
26
|
-
export declare class TaskManager implements ITaskManager {
|
|
27
|
-
private eventBus;
|
|
28
|
-
private tasks;
|
|
29
|
-
private queue;
|
|
30
|
-
private metrics;
|
|
31
|
-
constructor(eventBus: IEventBus, queue?: ITaskQueue);
|
|
32
|
-
createTask(params: ITaskCreate): Promise<ITask>;
|
|
33
|
-
getTask(taskId: string): ITask | undefined;
|
|
34
|
-
getTasks(filter?: Partial<Pick<ITask, 'status' | 'type' | 'assignedAgent'>>): ITask[];
|
|
35
|
-
assignTask(taskId: string, agentId: string): Promise<void>;
|
|
36
|
-
startTask(taskId: string): Promise<void>;
|
|
37
|
-
completeTask(taskId: string, result: ITaskResult): Promise<void>;
|
|
38
|
-
failTask(taskId: string, error: Error): Promise<void>;
|
|
39
|
-
cancelTask(taskId: string, reason?: string): Promise<void>;
|
|
40
|
-
retryTask(taskId: string): Promise<void>;
|
|
41
|
-
getMetrics(): TaskManagerMetrics;
|
|
42
|
-
cleanup(olderThan: Date): Promise<number>;
|
|
43
|
-
private isRetryable;
|
|
44
|
-
/**
|
|
45
|
-
* Get the task queue
|
|
46
|
-
*/
|
|
47
|
-
getQueue(): ITaskQueue;
|
|
48
|
-
}
|
|
49
|
-
//# sourceMappingURL=task-manager.d.ts.map
|