kynjal-cli 4.0.0 → 4.0.1
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/dist/src/appliance/gguf-engine.d.ts +91 -0
- package/dist/src/appliance/gguf-engine.d.ts.map +1 -0
- package/dist/src/appliance/gguf-engine.js +286 -525
- package/dist/src/appliance/gguf-engine.js.map +1 -1
- package/dist/src/appliance/ruvllm-bridge.d.ts +102 -0
- package/dist/src/appliance/ruvllm-bridge.d.ts.map +1 -0
- package/dist/src/appliance/ruvllm-bridge.js +203 -403
- package/dist/src/appliance/ruvllm-bridge.js.map +1 -1
- package/dist/src/appliance/rvfa-builder.d.ts +44 -0
- package/dist/src/appliance/rvfa-builder.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-builder.js +154 -208
- package/dist/src/appliance/rvfa-builder.js.map +1 -1
- package/dist/src/appliance/rvfa-distribution.d.ts +97 -0
- package/dist/src/appliance/rvfa-distribution.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-distribution.js +260 -423
- package/dist/src/appliance/rvfa-distribution.js.map +1 -1
- package/dist/src/appliance/rvfa-format.d.ts +111 -0
- package/dist/src/appliance/rvfa-format.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-format.js +128 -200
- package/dist/src/appliance/rvfa-format.js.map +1 -1
- package/dist/src/appliance/rvfa-runner.d.ts +69 -0
- package/dist/src/appliance/rvfa-runner.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-runner.js +168 -304
- package/dist/src/appliance/rvfa-runner.js.map +1 -1
- package/dist/src/appliance/rvfa-signing.d.ts +123 -0
- package/dist/src/appliance/rvfa-signing.d.ts.map +1 -0
- package/dist/src/appliance/rvfa-signing.js +173 -295
- package/dist/src/appliance/rvfa-signing.js.map +1 -1
- package/dist/src/benchmarks/pretrain/index.d.ts +58 -0
- package/dist/src/benchmarks/pretrain/index.d.ts.map +1 -0
- package/dist/src/benchmarks/pretrain/index.js +331 -542
- package/dist/src/benchmarks/pretrain/index.js.map +1 -1
- package/dist/src/commands/agent.js +574 -697
- package/dist/src/commands/agent.js.map +1 -1
- package/dist/src/commands/analyze.js +1218 -1548
- package/dist/src/commands/analyze.js.map +1 -1
- package/dist/src/commands/appliance-advanced.js +158 -267
- package/dist/src/commands/appliance-advanced.js.map +1 -1
- package/dist/src/commands/appliance.js +318 -493
- package/dist/src/commands/appliance.js.map +1 -1
- package/dist/src/commands/benchmark.js +372 -523
- package/dist/src/commands/benchmark.js.map +1 -1
- package/dist/src/commands/claims.js +274 -364
- package/dist/src/commands/claims.js.map +1 -1
- package/dist/src/commands/cleanup.js +113 -157
- package/dist/src/commands/cleanup.js.map +1 -1
- package/dist/src/commands/completions.js +477 -118
- package/dist/src/commands/completions.js.map +1 -1
- package/dist/src/commands/config.js +237 -303
- package/dist/src/commands/config.js.map +1 -1
- package/dist/src/commands/daemon.js +487 -596
- package/dist/src/commands/daemon.js.map +1 -1
- package/dist/src/commands/deployment.js +194 -275
- package/dist/src/commands/deployment.js.map +1 -1
- package/dist/src/commands/doctor.js +504 -686
- package/dist/src/commands/doctor.js.map +1 -1
- package/dist/src/commands/embeddings.js +1293 -1543
- package/dist/src/commands/embeddings.js.map +1 -1
- package/dist/src/commands/guidance.js +449 -596
- package/dist/src/commands/guidance.js.map +1 -1
- package/dist/src/commands/hive-mind.js +854 -938
- package/dist/src/commands/hive-mind.js.map +1 -1
- package/dist/src/commands/hooks.js +3112 -3519
- package/dist/src/commands/hooks.js.map +1 -1
- package/dist/src/commands/index.d.ts +115 -0
- package/dist/src/commands/index.d.ts.map +1 -0
- package/dist/src/commands/index.js +126 -308
- package/dist/src/commands/index.js.map +1 -1
- package/dist/src/commands/init.js +788 -940
- package/dist/src/commands/init.js.map +1 -1
- package/dist/src/commands/issues.js +383 -558
- package/dist/src/commands/issues.js.map +1 -1
- package/dist/src/commands/mcp.js +493 -605
- package/dist/src/commands/mcp.js.map +1 -1
- package/dist/src/commands/memory.js +833 -1026
- package/dist/src/commands/memory.js.map +1 -1
- package/dist/src/commands/migrate.js +282 -347
- package/dist/src/commands/migrate.js.map +1 -1
- package/dist/src/commands/neural.js +1289 -1563
- package/dist/src/commands/neural.js.map +1 -1
- package/dist/src/commands/performance.js +497 -643
- package/dist/src/commands/performance.js.map +1 -1
- package/dist/src/commands/plugins.js +668 -841
- package/dist/src/commands/plugins.js.map +1 -1
- package/dist/src/commands/process.js +392 -447
- package/dist/src/commands/process.js.map +1 -1
- package/dist/src/commands/progress.js +162 -256
- package/dist/src/commands/progress.js.map +1 -1
- package/dist/src/commands/providers.js +150 -220
- package/dist/src/commands/providers.js.map +1 -1
- package/dist/src/commands/route.js +520 -665
- package/dist/src/commands/route.js.map +1 -1
- package/dist/src/commands/ruvector/backup.js +505 -651
- package/dist/src/commands/ruvector/backup.js.map +1 -1
- package/dist/src/commands/ruvector/benchmark.js +349 -401
- package/dist/src/commands/ruvector/benchmark.js.map +1 -1
- package/dist/src/commands/ruvector/import.js +224 -266
- package/dist/src/commands/ruvector/import.js.map +1 -1
- package/dist/src/commands/ruvector/index.js +37 -75
- package/dist/src/commands/ruvector/index.js.map +1 -1
- package/dist/src/commands/ruvector/init.js +336 -359
- package/dist/src/commands/ruvector/init.js.map +1 -1
- package/dist/src/commands/ruvector/migrate.js +335 -322
- package/dist/src/commands/ruvector/migrate.js.map +1 -1
- package/dist/src/commands/ruvector/optimize.js +375 -431
- package/dist/src/commands/ruvector/optimize.js.map +1 -1
- package/dist/src/commands/ruvector/setup.js +703 -117
- package/dist/src/commands/ruvector/setup.js.map +1 -1
- package/dist/src/commands/ruvector/status.js +364 -419
- package/dist/src/commands/ruvector/status.js.map +1 -1
- package/dist/src/commands/security.js +485 -608
- package/dist/src/commands/security.js.map +1 -1
- package/dist/src/commands/session.js +504 -626
- package/dist/src/commands/session.js.map +1 -1
- package/dist/src/commands/start.js +267 -364
- package/dist/src/commands/start.js.map +1 -1
- package/dist/src/commands/status.js +380 -486
- package/dist/src/commands/status.js.map +1 -1
- package/dist/src/commands/swarm.js +408 -488
- package/dist/src/commands/swarm.js.map +1 -1
- package/dist/src/commands/task.js +423 -538
- package/dist/src/commands/task.js.map +1 -1
- package/dist/src/commands/transfer-store.js +322 -412
- package/dist/src/commands/transfer-store.js.map +1 -1
- package/dist/src/commands/update.js +196 -291
- package/dist/src/commands/update.js.map +1 -1
- package/dist/src/commands/workflow.js +386 -486
- package/dist/src/commands/workflow.js.map +1 -1
- package/dist/src/config-adapter.d.ts +15 -0
- package/dist/src/config-adapter.d.ts.map +1 -0
- package/dist/src/config-adapter.js +38 -39
- package/dist/src/config-adapter.js.map +1 -1
- package/dist/src/index.d.ts +77 -0
- package/dist/src/index.d.ts.map +1 -0
- package/dist/src/index.js +309 -411
- package/dist/src/index.js.map +1 -1
- package/dist/src/infrastructure/in-memory-repositories.d.ts +68 -0
- package/dist/src/infrastructure/in-memory-repositories.d.ts.map +1 -0
- package/dist/src/infrastructure/in-memory-repositories.js +246 -507
- package/dist/src/infrastructure/in-memory-repositories.js.map +1 -1
- package/dist/src/init/claudemd-generator.d.ts +25 -0
- package/dist/src/init/claudemd-generator.d.ts.map +1 -0
- package/dist/src/init/claudemd-generator.js +368 -78
- package/dist/src/init/claudemd-generator.js.map +1 -1
- package/dist/src/init/executor.d.ts +41 -0
- package/dist/src/init/executor.d.ts.map +1 -0
- package/dist/src/init/executor.js +1307 -996
- package/dist/src/init/executor.js.map +1 -1
- package/dist/src/init/helpers-generator.d.ts +60 -0
- package/dist/src/init/helpers-generator.d.ts.map +1 -0
- package/dist/src/init/helpers-generator.js +657 -12
- package/dist/src/init/helpers-generator.js.map +1 -1
- package/dist/src/init/index.d.ts +1 -1
- package/dist/src/init/index.d.ts.map +1 -1
- package/dist/src/init/index.js +1 -1
- package/dist/src/init/index.js.map +1 -1
- package/dist/src/init/mcp-generator.js +33 -37
- package/dist/src/init/mcp-generator.js.map +1 -1
- package/dist/src/init/settings-generator.js +76 -77
- package/dist/src/init/settings-generator.js.map +1 -1
- package/dist/src/init/statusline-generator.js +801 -3
- package/dist/src/init/statusline-generator.js.map +1 -1
- package/dist/src/init/types.d.ts +1 -1
- package/dist/src/init/types.d.ts.map +1 -1
- package/dist/src/init/types.js +76 -59
- package/dist/src/init/types.js.map +1 -1
- package/dist/src/mcp-client.d.ts +92 -0
- package/dist/src/mcp-client.d.ts.map +1 -0
- package/dist/src/mcp-client.js +81 -125
- package/dist/src/mcp-client.js.map +1 -1
- package/dist/src/mcp-server.d.ts +161 -0
- package/dist/src/mcp-server.d.ts.map +1 -0
- package/dist/src/mcp-server.js +470 -757
- package/dist/src/mcp-server.js.map +1 -1
- package/dist/src/mcp-tools/agent-tools.js +391 -492
- package/dist/src/mcp-tools/agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/agentdb-tools.js +332 -533
- package/dist/src/mcp-tools/agentdb-tools.js.map +1 -1
- package/dist/src/mcp-tools/analyze-tools.js +172 -236
- package/dist/src/mcp-tools/analyze-tools.js.map +1 -1
- package/dist/src/mcp-tools/auto-install.d.ts +83 -0
- package/dist/src/mcp-tools/auto-install.d.ts.map +1 -0
- package/dist/src/mcp-tools/auto-install.js +80 -142
- package/dist/src/mcp-tools/auto-install.js.map +1 -1
- package/dist/src/mcp-tools/browser-tools.js +252 -375
- package/dist/src/mcp-tools/browser-tools.js.map +1 -1
- package/dist/src/mcp-tools/claims-tools.js +473 -565
- package/dist/src/mcp-tools/claims-tools.js.map +1 -1
- package/dist/src/mcp-tools/config-tools.js +197 -272
- package/dist/src/mcp-tools/config-tools.js.map +1 -1
- package/dist/src/mcp-tools/coordination-tools.js +500 -572
- package/dist/src/mcp-tools/coordination-tools.js.map +1 -1
- package/dist/src/mcp-tools/daa-tools.js +286 -364
- package/dist/src/mcp-tools/daa-tools.js.map +1 -1
- package/dist/src/mcp-tools/embeddings-tools.js +582 -693
- package/dist/src/mcp-tools/embeddings-tools.js.map +1 -1
- package/dist/src/mcp-tools/github-tools.js +260 -311
- package/dist/src/mcp-tools/github-tools.js.map +1 -1
- package/dist/src/mcp-tools/hive-mind-tools.js +573 -640
- package/dist/src/mcp-tools/hive-mind-tools.js.map +1 -1
- package/dist/src/mcp-tools/hooks-tools.js +2215 -2648
- package/dist/src/mcp-tools/hooks-tools.js.map +1 -1
- package/dist/src/mcp-tools/memory-tools.js +350 -505
- package/dist/src/mcp-tools/memory-tools.js.map +1 -1
- package/dist/src/mcp-tools/neural-tools.js +315 -412
- package/dist/src/mcp-tools/neural-tools.js.map +1 -1
- package/dist/src/mcp-tools/performance-tools.js +420 -480
- package/dist/src/mcp-tools/performance-tools.js.map +1 -1
- package/dist/src/mcp-tools/progress-tools.js +204 -278
- package/dist/src/mcp-tools/progress-tools.js.map +1 -1
- package/dist/src/mcp-tools/ruvllm-tools.js +163 -279
- package/dist/src/mcp-tools/ruvllm-tools.js.map +1 -1
- package/dist/src/mcp-tools/security-tools.js +297 -429
- package/dist/src/mcp-tools/security-tools.js.map +1 -1
- package/dist/src/mcp-tools/session-tools.js +185 -234
- package/dist/src/mcp-tools/session-tools.js.map +1 -1
- package/dist/src/mcp-tools/swarm-tools.js +207 -260
- package/dist/src/mcp-tools/swarm-tools.js.map +1 -1
- package/dist/src/mcp-tools/system-tools.js +276 -325
- package/dist/src/mcp-tools/system-tools.js.map +1 -1
- package/dist/src/mcp-tools/task-tools.js +270 -336
- package/dist/src/mcp-tools/task-tools.js.map +1 -1
- package/dist/src/mcp-tools/terminal-tools.js +148 -196
- package/dist/src/mcp-tools/terminal-tools.js.map +1 -1
- package/dist/src/mcp-tools/transfer-tools.js +186 -333
- package/dist/src/mcp-tools/transfer-tools.js.map +1 -1
- package/dist/src/mcp-tools/types.d.ts +31 -0
- package/dist/src/mcp-tools/types.d.ts.map +1 -0
- package/dist/src/mcp-tools/wasm-agent-tools.js +133 -280
- package/dist/src/mcp-tools/wasm-agent-tools.js.map +1 -1
- package/dist/src/mcp-tools/workflow-tools.js +405 -450
- package/dist/src/mcp-tools/workflow-tools.js.map +1 -1
- package/dist/src/memory/ewc-consolidation.d.ts +295 -0
- package/dist/src/memory/ewc-consolidation.d.ts.map +1 -0
- package/dist/src/memory/ewc-consolidation.js +190 -303
- package/dist/src/memory/ewc-consolidation.js.map +1 -1
- package/dist/src/memory/intelligence.d.ts +338 -0
- package/dist/src/memory/intelligence.d.ts.map +1 -0
- package/dist/src/memory/intelligence.js +569 -794
- package/dist/src/memory/intelligence.js.map +1 -1
- package/dist/src/memory/memory-bridge.d.ts +407 -0
- package/dist/src/memory/memory-bridge.d.ts.map +1 -0
- package/dist/src/memory/memory-bridge.js +1170 -1640
- package/dist/src/memory/memory-bridge.js.map +1 -1
- package/dist/src/memory/memory-initializer.d.ts +412 -0
- package/dist/src/memory/memory-initializer.d.ts.map +1 -0
- package/dist/src/memory/memory-initializer.js +1836 -1851
- package/dist/src/memory/memory-initializer.js.map +1 -1
- package/dist/src/memory/sona-optimizer.d.ts +227 -0
- package/dist/src/memory/sona-optimizer.d.ts.map +1 -0
- package/dist/src/memory/sona-optimizer.js +199 -329
- package/dist/src/memory/sona-optimizer.js.map +1 -1
- package/dist/src/output.d.ts +2 -2
- package/dist/src/output.d.ts.map +1 -1
- package/dist/src/output.js +242 -272
- package/dist/src/output.js.map +1 -1
- package/dist/src/parser.d.ts +51 -0
- package/dist/src/parser.d.ts.map +1 -0
- package/dist/src/parser.js +140 -187
- package/dist/src/parser.js.map +1 -1
- package/dist/src/plugins/manager.d.ts +133 -0
- package/dist/src/plugins/manager.d.ts.map +1 -0
- package/dist/src/plugins/manager.js +285 -521
- package/dist/src/plugins/manager.js.map +1 -1
- package/dist/src/plugins/store/discovery.d.ts +88 -0
- package/dist/src/plugins/store/discovery.d.ts.map +1 -0
- package/dist/src/plugins/store/discovery.js +271 -358
- package/dist/src/plugins/store/discovery.js.map +1 -1
- package/dist/src/plugins/store/index.d.ts +76 -0
- package/dist/src/plugins/store/index.d.ts.map +1 -0
- package/dist/src/plugins/store/index.js +48 -105
- package/dist/src/plugins/store/index.js.map +1 -1
- package/dist/src/plugins/store/search.d.ts +46 -0
- package/dist/src/plugins/store/search.d.ts.map +1 -0
- package/dist/src/plugins/store/search.js +69 -107
- package/dist/src/plugins/store/search.js.map +1 -1
- package/dist/src/plugins/store/types.d.ts +274 -0
- package/dist/src/plugins/store/types.d.ts.map +1 -0
- package/dist/src/plugins/tests/demo-plugin-store.js +113 -160
- package/dist/src/plugins/tests/demo-plugin-store.js.map +1 -1
- package/dist/src/plugins/tests/standalone-test.js +172 -223
- package/dist/src/plugins/tests/standalone-test.js.map +1 -1
- package/dist/src/plugins/tests/test-plugin-store.js +190 -228
- package/dist/src/plugins/tests/test-plugin-store.js.map +1 -1
- package/dist/src/production/circuit-breaker.d.ts +101 -0
- package/dist/src/production/circuit-breaker.d.ts.map +1 -0
- package/dist/src/production/circuit-breaker.js +62 -126
- package/dist/src/production/circuit-breaker.js.map +1 -1
- package/dist/src/production/error-handler.d.ts +92 -0
- package/dist/src/production/error-handler.d.ts.map +1 -0
- package/dist/src/production/error-handler.js +86 -156
- package/dist/src/production/error-handler.js.map +1 -1
- package/dist/src/production/monitoring.d.ts +161 -0
- package/dist/src/production/monitoring.d.ts.map +1 -0
- package/dist/src/production/monitoring.js +139 -220
- package/dist/src/production/monitoring.js.map +1 -1
- package/dist/src/production/rate-limiter.d.ts +80 -0
- package/dist/src/production/rate-limiter.d.ts.map +1 -0
- package/dist/src/production/rate-limiter.js +74 -93
- package/dist/src/production/rate-limiter.js.map +1 -1
- package/dist/src/production/retry.d.ts +48 -0
- package/dist/src/production/retry.d.ts.map +1 -0
- package/dist/src/production/retry.js +75 -167
- package/dist/src/production/retry.js.map +1 -1
- package/dist/src/prompt.d.ts +44 -0
- package/dist/src/prompt.d.ts.map +1 -0
- package/dist/src/prompt.js +436 -560
- package/dist/src/prompt.js.map +1 -1
- package/dist/src/runtime/headless.d.ts +60 -0
- package/dist/src/runtime/headless.d.ts.map +1 -0
- package/dist/src/runtime/headless.js +197 -286
- package/dist/src/runtime/headless.js.map +1 -1
- package/dist/src/ruvector/agent-wasm.d.ts +182 -0
- package/dist/src/ruvector/agent-wasm.d.ts.map +1 -0
- package/dist/src/ruvector/agent-wasm.js +156 -351
- package/dist/src/ruvector/agent-wasm.js.map +1 -1
- package/dist/src/ruvector/ast-analyzer.d.ts +67 -0
- package/dist/src/ruvector/ast-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/ast-analyzer.js +145 -232
- package/dist/src/ruvector/ast-analyzer.js.map +1 -1
- package/dist/src/ruvector/coverage-router.d.ts +160 -0
- package/dist/src/ruvector/coverage-router.d.ts.map +1 -0
- package/dist/src/ruvector/coverage-router.js +287 -419
- package/dist/src/ruvector/coverage-router.js.map +1 -1
- package/dist/src/ruvector/coverage-tools.js +56 -101
- package/dist/src/ruvector/coverage-tools.js.map +1 -1
- package/dist/src/ruvector/diff-classifier.d.ts +175 -0
- package/dist/src/ruvector/diff-classifier.d.ts.map +1 -0
- package/dist/src/ruvector/diff-classifier.js +324 -451
- package/dist/src/ruvector/diff-classifier.js.map +1 -1
- package/dist/src/ruvector/enhanced-model-router.d.ts +146 -0
- package/dist/src/ruvector/enhanced-model-router.d.ts.map +1 -0
- package/dist/src/ruvector/enhanced-model-router.js +260 -336
- package/dist/src/ruvector/enhanced-model-router.js.map +1 -1
- package/dist/src/ruvector/flash-attention.d.ts +195 -0
- package/dist/src/ruvector/flash-attention.d.ts.map +1 -0
- package/dist/src/ruvector/flash-attention.js +223 -254
- package/dist/src/ruvector/flash-attention.js.map +1 -1
- package/dist/src/ruvector/graph-analyzer.d.ts +187 -0
- package/dist/src/ruvector/graph-analyzer.d.ts.map +1 -0
- package/dist/src/ruvector/graph-analyzer.js +486 -680
- package/dist/src/ruvector/graph-analyzer.js.map +1 -1
- package/dist/src/ruvector/index.d.ts +40 -0
- package/dist/src/ruvector/index.d.ts.map +1 -0
- package/dist/src/ruvector/index.js +36 -106
- package/dist/src/ruvector/index.js.map +1 -1
- package/dist/src/ruvector/lora-adapter.d.ts +218 -0
- package/dist/src/ruvector/lora-adapter.d.ts.map +1 -0
- package/dist/src/ruvector/lora-adapter.js +155 -248
- package/dist/src/ruvector/lora-adapter.js.map +1 -1
- package/dist/src/ruvector/model-router.d.ts +220 -0
- package/dist/src/ruvector/model-router.d.ts.map +1 -0
- package/dist/src/ruvector/model-router.js +175 -248
- package/dist/src/ruvector/model-router.js.map +1 -1
- package/dist/src/ruvector/moe-router.d.ts +206 -0
- package/dist/src/ruvector/moe-router.d.ts.map +1 -0
- package/dist/src/ruvector/moe-router.js +228 -286
- package/dist/src/ruvector/moe-router.js.map +1 -1
- package/dist/src/ruvector/q-learning-router.d.ts +211 -0
- package/dist/src/ruvector/q-learning-router.d.ts.map +1 -0
- package/dist/src/ruvector/q-learning-router.js +257 -338
- package/dist/src/ruvector/q-learning-router.js.map +1 -1
- package/dist/src/ruvector/ruvllm-wasm.d.ts +179 -0
- package/dist/src/ruvector/ruvllm-wasm.d.ts.map +1 -0
- package/dist/src/ruvector/ruvllm-wasm.js +270 -434
- package/dist/src/ruvector/ruvllm-wasm.js.map +1 -1
- package/dist/src/ruvector/semantic-router.d.ts +77 -0
- package/dist/src/ruvector/semantic-router.d.ts.map +1 -0
- package/dist/src/ruvector/semantic-router.js +60 -67
- package/dist/src/ruvector/semantic-router.js.map +1 -1
- package/dist/src/ruvector/vector-db.d.ts +69 -0
- package/dist/src/ruvector/vector-db.d.ts.map +1 -0
- package/dist/src/ruvector/vector-db.js +119 -205
- package/dist/src/ruvector/vector-db.js.map +1 -1
- package/dist/src/services/agentic-flow-bridge.d.ts +50 -0
- package/dist/src/services/agentic-flow-bridge.d.ts.map +1 -0
- package/dist/src/services/agentic-flow-bridge.js +32 -105
- package/dist/src/services/agentic-flow-bridge.js.map +1 -1
- package/dist/src/services/claim-service.d.ts +204 -0
- package/dist/src/services/claim-service.d.ts.map +1 -0
- package/dist/src/services/claim-service.js +615 -940
- package/dist/src/services/claim-service.js.map +1 -1
- package/dist/src/services/container-worker-pool.d.ts +197 -0
- package/dist/src/services/container-worker-pool.d.ts.map +1 -0
- package/dist/src/services/container-worker-pool.js +398 -666
- package/dist/src/services/container-worker-pool.js.map +1 -1
- package/dist/src/services/headless-worker-executor.d.ts +304 -0
- package/dist/src/services/headless-worker-executor.d.ts.map +1 -0
- package/dist/src/services/headless-worker-executor.js +441 -467
- package/dist/src/services/headless-worker-executor.js.map +1 -1
- package/dist/src/services/index.d.ts +4 -4
- package/dist/src/services/index.d.ts.map +1 -1
- package/dist/src/services/index.js +4 -4
- package/dist/src/services/index.js.map +1 -1
- package/dist/src/services/registry-api.d.ts +58 -0
- package/dist/src/services/registry-api.d.ts.map +1 -0
- package/dist/src/services/registry-api.js +92 -200
- package/dist/src/services/registry-api.js.map +1 -1
- package/dist/src/services/ruvector-training.d.ts +222 -0
- package/dist/src/services/ruvector-training.d.ts.map +1 -0
- package/dist/src/services/ruvector-training.js +257 -337
- package/dist/src/services/ruvector-training.js.map +1 -1
- package/dist/src/services/worker-daemon.d.ts +228 -0
- package/dist/src/services/worker-daemon.d.ts.map +1 -0
- package/dist/src/services/worker-daemon.js +591 -849
- package/dist/src/services/worker-daemon.js.map +1 -1
- package/dist/src/services/worker-queue.d.ts +194 -0
- package/dist/src/services/worker-queue.d.ts.map +1 -0
- package/dist/src/services/worker-queue.js +331 -548
- package/dist/src/services/worker-queue.js.map +1 -1
- package/dist/src/suggest.d.ts +53 -0
- package/dist/src/suggest.d.ts.map +1 -0
- package/dist/src/suggest.js +45 -55
- package/dist/src/suggest.js.map +1 -1
- package/dist/src/transfer/anonymization/index.js +29 -37
- package/dist/src/transfer/anonymization/index.js.map +1 -1
- package/dist/src/transfer/deploy-seraphine.js +128 -155
- package/dist/src/transfer/deploy-seraphine.js.map +1 -1
- package/dist/src/transfer/export.d.ts +25 -0
- package/dist/src/transfer/export.d.ts.map +1 -0
- package/dist/src/transfer/export.js +84 -142
- package/dist/src/transfer/export.js.map +1 -1
- package/dist/src/transfer/index.d.ts +1 -1
- package/dist/src/transfer/index.d.ts.map +1 -1
- package/dist/src/transfer/index.js +0 -2
- package/dist/src/transfer/index.js.map +1 -1
- package/dist/src/transfer/ipfs/client.d.ts +109 -0
- package/dist/src/transfer/ipfs/client.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/client.js +187 -337
- package/dist/src/transfer/ipfs/client.js.map +1 -1
- package/dist/src/transfer/ipfs/upload.d.ts +95 -0
- package/dist/src/transfer/ipfs/upload.d.ts.map +1 -0
- package/dist/src/transfer/ipfs/upload.js +288 -434
- package/dist/src/transfer/ipfs/upload.js.map +1 -1
- package/dist/src/transfer/models/seraphine.d.ts +72 -0
- package/dist/src/transfer/models/seraphine.d.ts.map +1 -0
- package/dist/src/transfer/models/seraphine.js +55 -55
- package/dist/src/transfer/models/seraphine.js.map +1 -1
- package/dist/src/transfer/serialization/cfp.d.ts +49 -0
- package/dist/src/transfer/serialization/cfp.d.ts.map +1 -0
- package/dist/src/transfer/serialization/cfp.js +30 -31
- package/dist/src/transfer/serialization/cfp.js.map +1 -1
- package/dist/src/transfer/storage/gcs.d.ts +82 -0
- package/dist/src/transfer/storage/gcs.d.ts.map +1 -0
- package/dist/src/transfer/storage/gcs.js +165 -232
- package/dist/src/transfer/storage/gcs.js.map +1 -1
- package/dist/src/transfer/store/discovery.d.ts +84 -0
- package/dist/src/transfer/store/discovery.d.ts.map +1 -0
- package/dist/src/transfer/store/discovery.js +239 -349
- package/dist/src/transfer/store/discovery.js.map +1 -1
- package/dist/src/transfer/store/download.d.ts +70 -0
- package/dist/src/transfer/store/download.d.ts.map +1 -0
- package/dist/src/transfer/store/download.js +243 -365
- package/dist/src/transfer/store/download.js.map +1 -1
- package/dist/src/transfer/store/index.d.ts +84 -0
- package/dist/src/transfer/store/index.d.ts.map +1 -0
- package/dist/src/transfer/store/index.js +63 -130
- package/dist/src/transfer/store/index.js.map +1 -1
- package/dist/src/transfer/store/publish.d.ts +76 -0
- package/dist/src/transfer/store/publish.d.ts.map +1 -0
- package/dist/src/transfer/store/publish.js +184 -258
- package/dist/src/transfer/store/publish.js.map +1 -1
- package/dist/src/transfer/store/registry.js +50 -72
- package/dist/src/transfer/store/registry.js.map +1 -1
- package/dist/src/transfer/store/search.d.ts +54 -0
- package/dist/src/transfer/store/search.d.ts.map +1 -0
- package/dist/src/transfer/store/search.js +64 -96
- package/dist/src/transfer/store/search.js.map +1 -1
- package/dist/src/transfer/store/tests/standalone-test.js +174 -231
- package/dist/src/transfer/store/tests/standalone-test.js.map +1 -1
- package/dist/src/transfer/test-seraphine.js +95 -130
- package/dist/src/transfer/test-seraphine.js.map +1 -1
- package/dist/src/transfer/tests/test-store.js +194 -239
- package/dist/src/transfer/tests/test-store.js.map +1 -1
- package/dist/src/transfer/types.d.ts +245 -0
- package/dist/src/transfer/types.d.ts.map +1 -0
- package/dist/src/types.d.ts +198 -0
- package/dist/src/types.d.ts.map +1 -0
- package/dist/src/types.js +26 -55
- package/dist/src/types.js.map +1 -1
- package/dist/src/update/checker.d.ts +34 -0
- package/dist/src/update/checker.d.ts.map +1 -0
- package/dist/src/update/checker.js +106 -183
- package/dist/src/update/checker.js.map +1 -1
- package/dist/src/update/executor.d.ts +32 -0
- package/dist/src/update/executor.d.ts.map +1 -0
- package/dist/src/update/executor.js +135 -198
- package/dist/src/update/executor.js.map +1 -1
- package/dist/src/update/index.d.ts +33 -0
- package/dist/src/update/index.d.ts.map +1 -0
- package/dist/src/update/index.js +38 -85
- package/dist/src/update/index.js.map +1 -1
- package/dist/src/update/rate-limiter.d.ts +20 -0
- package/dist/src/update/rate-limiter.d.ts.map +1 -0
- package/dist/src/update/rate-limiter.js +19 -31
- package/dist/src/update/rate-limiter.js.map +1 -1
- package/dist/src/update/validator.d.ts +17 -0
- package/dist/src/update/validator.d.ts.map +1 -0
- package/dist/src/update/validator.js +38 -64
- package/dist/src/update/validator.js.map +1 -1
- package/dist/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
|
@@ -2,42 +2,6 @@
|
|
|
2
2
|
* V3 CLI Session Command
|
|
3
3
|
* Session management for Claude Flow
|
|
4
4
|
*/
|
|
5
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
|
6
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
|
7
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
|
8
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
|
9
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
|
10
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
|
11
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
|
12
|
-
});
|
|
13
|
-
};
|
|
14
|
-
var __generator = (this && this.__generator) || function (thisArg, body) {
|
|
15
|
-
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
|
|
16
|
-
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
|
|
17
|
-
function verb(n) { return function (v) { return step([n, v]); }; }
|
|
18
|
-
function step(op) {
|
|
19
|
-
if (f) throw new TypeError("Generator is already executing.");
|
|
20
|
-
while (_) try {
|
|
21
|
-
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
|
|
22
|
-
if (y = 0, t) op = [op[0] & 2, t.value];
|
|
23
|
-
switch (op[0]) {
|
|
24
|
-
case 0: case 1: t = op; break;
|
|
25
|
-
case 4: _.label++; return { value: op[1], done: false };
|
|
26
|
-
case 5: _.label++; y = op[1]; op = [0]; continue;
|
|
27
|
-
case 7: op = _.ops.pop(); _.trys.pop(); continue;
|
|
28
|
-
default:
|
|
29
|
-
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
|
|
30
|
-
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
|
|
31
|
-
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
|
|
32
|
-
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
|
|
33
|
-
if (t[2]) _.ops.pop();
|
|
34
|
-
_.trys.pop(); continue;
|
|
35
|
-
}
|
|
36
|
-
op = body.call(thisArg, _);
|
|
37
|
-
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
|
|
38
|
-
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
|
|
39
|
-
}
|
|
40
|
-
};
|
|
41
5
|
import { output } from '../output.js';
|
|
42
6
|
import { confirm, input, select } from '../prompt.js';
|
|
43
7
|
import { callMCPTool, MCPClientError } from '../mcp-client.js';
|
|
@@ -45,17 +9,17 @@ import * as fs from 'fs';
|
|
|
45
9
|
import * as path from 'path';
|
|
46
10
|
// Format date for display
|
|
47
11
|
function formatDate(dateStr) {
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
12
|
+
const date = new Date(dateStr);
|
|
13
|
+
const now = new Date();
|
|
14
|
+
const diff = now.getTime() - date.getTime();
|
|
51
15
|
// Less than 24 hours - show relative time
|
|
52
16
|
if (diff < 24 * 60 * 60 * 1000) {
|
|
53
|
-
|
|
54
|
-
|
|
17
|
+
const hours = Math.floor(diff / (60 * 60 * 1000));
|
|
18
|
+
const minutes = Math.floor((diff % (60 * 60 * 1000)) / (60 * 1000));
|
|
55
19
|
if (hours > 0) {
|
|
56
|
-
return hours
|
|
20
|
+
return `${hours}h ${minutes}m ago`;
|
|
57
21
|
}
|
|
58
|
-
return minutes
|
|
22
|
+
return `${minutes}m ago`;
|
|
59
23
|
}
|
|
60
24
|
// Otherwise show date
|
|
61
25
|
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString();
|
|
@@ -74,7 +38,7 @@ function formatStatus(status) {
|
|
|
74
38
|
}
|
|
75
39
|
}
|
|
76
40
|
// List subcommand
|
|
77
|
-
|
|
41
|
+
const listCommand = {
|
|
78
42
|
name: 'list',
|
|
79
43
|
aliases: ['ls'],
|
|
80
44
|
description: 'List all sessions',
|
|
@@ -84,88 +48,78 @@ var listCommand = {
|
|
|
84
48
|
short: 'a',
|
|
85
49
|
description: 'Show only active sessions',
|
|
86
50
|
type: 'boolean',
|
|
87
|
-
|
|
51
|
+
default: false
|
|
88
52
|
},
|
|
89
53
|
{
|
|
90
54
|
name: 'all',
|
|
91
55
|
description: 'Include archived sessions',
|
|
92
56
|
type: 'boolean',
|
|
93
|
-
|
|
57
|
+
default: false
|
|
94
58
|
},
|
|
95
59
|
{
|
|
96
60
|
name: 'limit',
|
|
97
61
|
short: 'l',
|
|
98
62
|
description: 'Maximum sessions to show',
|
|
99
63
|
type: 'number',
|
|
100
|
-
|
|
64
|
+
default: 20
|
|
101
65
|
}
|
|
102
66
|
],
|
|
103
|
-
action:
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
153
|
-
case 3:
|
|
154
|
-
error_1 = _a.sent();
|
|
155
|
-
if (error_1 instanceof MCPClientError) {
|
|
156
|
-
output.printError("Failed to list sessions: " + error_1.message);
|
|
157
|
-
}
|
|
158
|
-
else {
|
|
159
|
-
output.printError("Unexpected error: " + String(error_1));
|
|
160
|
-
}
|
|
161
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
162
|
-
case 4: return [2 /*return*/];
|
|
67
|
+
action: async (ctx) => {
|
|
68
|
+
const activeOnly = ctx.flags.active;
|
|
69
|
+
const includeArchived = ctx.flags.all;
|
|
70
|
+
const limit = ctx.flags.limit;
|
|
71
|
+
try {
|
|
72
|
+
const result = await callMCPTool('session_list', {
|
|
73
|
+
status: activeOnly ? 'active' : includeArchived ? 'all' : 'active,saved',
|
|
74
|
+
limit
|
|
75
|
+
});
|
|
76
|
+
if (ctx.flags.format === 'json') {
|
|
77
|
+
output.printJson(result);
|
|
78
|
+
return { success: true, data: result };
|
|
79
|
+
}
|
|
80
|
+
output.writeln();
|
|
81
|
+
output.writeln(output.bold('Sessions'));
|
|
82
|
+
output.writeln();
|
|
83
|
+
if (result.sessions.length === 0) {
|
|
84
|
+
output.printInfo('No sessions found');
|
|
85
|
+
output.printInfo('Run "claude-flow session save" to create a session');
|
|
86
|
+
return { success: true, data: result };
|
|
87
|
+
}
|
|
88
|
+
output.printTable({
|
|
89
|
+
columns: [
|
|
90
|
+
{ key: 'id', header: 'ID', width: 20 },
|
|
91
|
+
{ key: 'name', header: 'Name', width: 20 },
|
|
92
|
+
{ key: 'status', header: 'Status', width: 10 },
|
|
93
|
+
{ key: 'agents', header: 'Agents', width: 8, align: 'right' },
|
|
94
|
+
{ key: 'tasks', header: 'Tasks', width: 8, align: 'right' },
|
|
95
|
+
{ key: 'updated', header: 'Last Updated', width: 18 }
|
|
96
|
+
],
|
|
97
|
+
data: result.sessions.map(s => ({
|
|
98
|
+
id: s.id,
|
|
99
|
+
name: s.name || '-',
|
|
100
|
+
status: formatStatus(s.status),
|
|
101
|
+
agents: s.agentCount,
|
|
102
|
+
tasks: s.taskCount,
|
|
103
|
+
updated: formatDate(s.updatedAt)
|
|
104
|
+
}))
|
|
105
|
+
});
|
|
106
|
+
output.writeln();
|
|
107
|
+
output.printInfo(`Showing ${result.sessions.length} of ${result.total} sessions`);
|
|
108
|
+
return { success: true, data: result };
|
|
109
|
+
}
|
|
110
|
+
catch (error) {
|
|
111
|
+
if (error instanceof MCPClientError) {
|
|
112
|
+
output.printError(`Failed to list sessions: ${error.message}`);
|
|
113
|
+
}
|
|
114
|
+
else {
|
|
115
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
163
116
|
}
|
|
164
|
-
|
|
165
|
-
|
|
117
|
+
return { success: false, exitCode: 1 };
|
|
118
|
+
}
|
|
119
|
+
}
|
|
166
120
|
};
|
|
167
121
|
// Save subcommand
|
|
168
|
-
|
|
122
|
+
const saveCommand = {
|
|
169
123
|
name: 'save',
|
|
170
124
|
aliases: ['create', 'checkpoint'],
|
|
171
125
|
description: 'Save current session state',
|
|
@@ -186,103 +140,88 @@ var saveCommand = {
|
|
|
186
140
|
name: 'include-memory',
|
|
187
141
|
description: 'Include memory state in session',
|
|
188
142
|
type: 'boolean',
|
|
189
|
-
|
|
143
|
+
default: true
|
|
190
144
|
},
|
|
191
145
|
{
|
|
192
146
|
name: 'include-agents',
|
|
193
147
|
description: 'Include agent state in session',
|
|
194
148
|
type: 'boolean',
|
|
195
|
-
|
|
149
|
+
default: true
|
|
196
150
|
},
|
|
197
151
|
{
|
|
198
152
|
name: 'include-tasks',
|
|
199
153
|
description: 'Include task state in session',
|
|
200
154
|
type: 'boolean',
|
|
201
|
-
|
|
155
|
+
default: true
|
|
202
156
|
}
|
|
203
157
|
],
|
|
204
|
-
action:
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
{ property: 'Description', value: result.description || '-' },
|
|
255
|
-
{ property: 'Saved At', value: new Date(result.savedAt).toLocaleString() },
|
|
256
|
-
{ property: 'Agents', value: result.stats.agentCount },
|
|
257
|
-
{ property: 'Tasks', value: result.stats.taskCount },
|
|
258
|
-
{ property: 'Memory Entries', value: result.stats.memoryEntries },
|
|
259
|
-
{ property: 'Total Size', value: formatSize(result.stats.totalSize) }
|
|
260
|
-
]
|
|
261
|
-
});
|
|
262
|
-
output.writeln();
|
|
263
|
-
output.printSuccess("Session saved: " + result.sessionId);
|
|
264
|
-
output.printInfo("Restore with: claude-flow session restore " + result.sessionId);
|
|
265
|
-
if (ctx.flags.format === 'json') {
|
|
266
|
-
output.printJson(result);
|
|
267
|
-
}
|
|
268
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
269
|
-
case 7:
|
|
270
|
-
error_2 = _a.sent();
|
|
271
|
-
spinner.fail('Failed to save session');
|
|
272
|
-
if (error_2 instanceof MCPClientError) {
|
|
273
|
-
output.printError("Error: " + error_2.message);
|
|
274
|
-
}
|
|
275
|
-
else {
|
|
276
|
-
output.printError("Unexpected error: " + String(error_2));
|
|
277
|
-
}
|
|
278
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
279
|
-
case 8: return [2 /*return*/];
|
|
158
|
+
action: async (ctx) => {
|
|
159
|
+
let sessionName = ctx.flags.name;
|
|
160
|
+
let description = ctx.flags.description;
|
|
161
|
+
// Interactive mode
|
|
162
|
+
if (!sessionName && ctx.interactive) {
|
|
163
|
+
sessionName = await input({
|
|
164
|
+
message: 'Session name:',
|
|
165
|
+
default: `session-${Date.now().toString(36)}`,
|
|
166
|
+
validate: (v) => v.length > 0 || 'Name is required'
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
if (!description && ctx.interactive) {
|
|
170
|
+
description = await input({
|
|
171
|
+
message: 'Session description (optional):',
|
|
172
|
+
default: ''
|
|
173
|
+
});
|
|
174
|
+
}
|
|
175
|
+
const spinner = output.createSpinner({ text: 'Saving session...' });
|
|
176
|
+
spinner.start();
|
|
177
|
+
try {
|
|
178
|
+
const result = await callMCPTool('session_save', {
|
|
179
|
+
name: sessionName,
|
|
180
|
+
description,
|
|
181
|
+
includeMemory: ctx.flags['include-memory'] !== false,
|
|
182
|
+
includeAgents: ctx.flags['include-agents'] !== false,
|
|
183
|
+
includeTasks: ctx.flags['include-tasks'] !== false
|
|
184
|
+
});
|
|
185
|
+
spinner.succeed('Session saved');
|
|
186
|
+
output.writeln();
|
|
187
|
+
output.printTable({
|
|
188
|
+
columns: [
|
|
189
|
+
{ key: 'property', header: 'Property', width: 18 },
|
|
190
|
+
{ key: 'value', header: 'Value', width: 35 }
|
|
191
|
+
],
|
|
192
|
+
data: [
|
|
193
|
+
{ property: 'Session ID', value: result.sessionId },
|
|
194
|
+
{ property: 'Name', value: result.name },
|
|
195
|
+
{ property: 'Description', value: result.description || '-' },
|
|
196
|
+
{ property: 'Saved At', value: new Date(result.savedAt).toLocaleString() },
|
|
197
|
+
{ property: 'Agents', value: result.stats.agentCount },
|
|
198
|
+
{ property: 'Tasks', value: result.stats.taskCount },
|
|
199
|
+
{ property: 'Memory Entries', value: result.stats.memoryEntries },
|
|
200
|
+
{ property: 'Total Size', value: formatSize(result.stats.totalSize) }
|
|
201
|
+
]
|
|
202
|
+
});
|
|
203
|
+
output.writeln();
|
|
204
|
+
output.printSuccess(`Session saved: ${result.sessionId}`);
|
|
205
|
+
output.printInfo(`Restore with: claude-flow session restore ${result.sessionId}`);
|
|
206
|
+
if (ctx.flags.format === 'json') {
|
|
207
|
+
output.printJson(result);
|
|
280
208
|
}
|
|
281
|
-
|
|
282
|
-
|
|
209
|
+
return { success: true, data: result };
|
|
210
|
+
}
|
|
211
|
+
catch (error) {
|
|
212
|
+
spinner.fail('Failed to save session');
|
|
213
|
+
if (error instanceof MCPClientError) {
|
|
214
|
+
output.printError(`Error: ${error.message}`);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
218
|
+
}
|
|
219
|
+
return { success: false, exitCode: 1 };
|
|
220
|
+
}
|
|
221
|
+
}
|
|
283
222
|
};
|
|
284
223
|
// Restore subcommand
|
|
285
|
-
|
|
224
|
+
const restoreCommand = {
|
|
286
225
|
name: 'restore',
|
|
287
226
|
aliases: ['load'],
|
|
288
227
|
description: 'Restore a saved session',
|
|
@@ -292,146 +231,130 @@ var restoreCommand = {
|
|
|
292
231
|
short: 'f',
|
|
293
232
|
description: 'Overwrite current state without confirmation',
|
|
294
233
|
type: 'boolean',
|
|
295
|
-
|
|
234
|
+
default: false
|
|
296
235
|
},
|
|
297
236
|
{
|
|
298
237
|
name: 'memory-only',
|
|
299
238
|
description: 'Only restore memory state',
|
|
300
239
|
type: 'boolean',
|
|
301
|
-
|
|
240
|
+
default: false
|
|
302
241
|
},
|
|
303
242
|
{
|
|
304
243
|
name: 'agents-only',
|
|
305
244
|
description: 'Only restore agent state',
|
|
306
245
|
type: 'boolean',
|
|
307
|
-
|
|
246
|
+
default: false
|
|
308
247
|
},
|
|
309
248
|
{
|
|
310
249
|
name: 'tasks-only',
|
|
311
250
|
description: 'Only restore task state',
|
|
312
251
|
type: 'boolean',
|
|
313
|
-
|
|
252
|
+
default: false
|
|
314
253
|
}
|
|
315
254
|
],
|
|
316
|
-
action:
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
sessions
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
|
|
352
|
-
|
|
353
|
-
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
|
|
362
|
-
|
|
363
|
-
|
|
364
|
-
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
output.writeln();
|
|
413
|
-
output.printSuccess("Session " + sessionId + " restored successfully");
|
|
414
|
-
if (ctx.flags.format === 'json') {
|
|
415
|
-
output.printJson(result);
|
|
416
|
-
}
|
|
417
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
418
|
-
case 10:
|
|
419
|
-
error_4 = _a.sent();
|
|
420
|
-
spinner.fail('Failed to restore session');
|
|
421
|
-
if (error_4 instanceof MCPClientError) {
|
|
422
|
-
output.printError("Error: " + error_4.message);
|
|
423
|
-
}
|
|
424
|
-
else {
|
|
425
|
-
output.printError("Unexpected error: " + String(error_4));
|
|
426
|
-
}
|
|
427
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
428
|
-
case 11: return [2 /*return*/];
|
|
255
|
+
action: async (ctx) => {
|
|
256
|
+
let sessionId = ctx.args[0];
|
|
257
|
+
const force = ctx.flags.force;
|
|
258
|
+
if (!sessionId && ctx.interactive) {
|
|
259
|
+
// Show list to select from
|
|
260
|
+
try {
|
|
261
|
+
const sessions = await callMCPTool('session_list', { status: 'saved', limit: 20 });
|
|
262
|
+
if (sessions.sessions.length === 0) {
|
|
263
|
+
output.printWarning('No saved sessions found');
|
|
264
|
+
return { success: false, exitCode: 1 };
|
|
265
|
+
}
|
|
266
|
+
sessionId = await select({
|
|
267
|
+
message: 'Select session to restore:',
|
|
268
|
+
options: sessions.sessions.map(s => ({
|
|
269
|
+
value: s.id,
|
|
270
|
+
label: s.name || s.id,
|
|
271
|
+
hint: formatDate(s.updatedAt)
|
|
272
|
+
}))
|
|
273
|
+
});
|
|
274
|
+
}
|
|
275
|
+
catch (error) {
|
|
276
|
+
if (error instanceof Error && error.message === 'User cancelled') {
|
|
277
|
+
output.printInfo('Operation cancelled');
|
|
278
|
+
return { success: true };
|
|
279
|
+
}
|
|
280
|
+
throw error;
|
|
281
|
+
}
|
|
282
|
+
}
|
|
283
|
+
if (!sessionId) {
|
|
284
|
+
output.printError('Session ID is required');
|
|
285
|
+
return { success: false, exitCode: 1 };
|
|
286
|
+
}
|
|
287
|
+
// Confirm unless forced
|
|
288
|
+
if (!force && ctx.interactive) {
|
|
289
|
+
const confirmed = await confirm({
|
|
290
|
+
message: 'This will overwrite current state. Continue?',
|
|
291
|
+
default: false
|
|
292
|
+
});
|
|
293
|
+
if (!confirmed) {
|
|
294
|
+
output.printInfo('Operation cancelled');
|
|
295
|
+
return { success: true };
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
const spinner = output.createSpinner({ text: 'Restoring session...' });
|
|
299
|
+
spinner.start();
|
|
300
|
+
try {
|
|
301
|
+
// Determine what to restore
|
|
302
|
+
const restoreMemory = !ctx.flags['agents-only'] && !ctx.flags['tasks-only'];
|
|
303
|
+
const restoreAgents = !ctx.flags['memory-only'] && !ctx.flags['tasks-only'];
|
|
304
|
+
const restoreTasks = !ctx.flags['memory-only'] && !ctx.flags['agents-only'];
|
|
305
|
+
const result = await callMCPTool('session_restore', {
|
|
306
|
+
sessionId,
|
|
307
|
+
restoreMemory,
|
|
308
|
+
restoreAgents,
|
|
309
|
+
restoreTasks
|
|
310
|
+
});
|
|
311
|
+
spinner.succeed('Session restored');
|
|
312
|
+
output.writeln();
|
|
313
|
+
output.printTable({
|
|
314
|
+
columns: [
|
|
315
|
+
{ key: 'component', header: 'Component', width: 20 },
|
|
316
|
+
{ key: 'status', header: 'Status', width: 15 },
|
|
317
|
+
{ key: 'count', header: 'Items', width: 10, align: 'right' }
|
|
318
|
+
],
|
|
319
|
+
data: [
|
|
320
|
+
{
|
|
321
|
+
component: 'Memory',
|
|
322
|
+
status: result.restored.memory ? output.success('Restored') : output.dim('Skipped'),
|
|
323
|
+
count: result.stats.memoryEntriesRestored
|
|
324
|
+
},
|
|
325
|
+
{
|
|
326
|
+
component: 'Agents',
|
|
327
|
+
status: result.restored.agents ? output.success('Restored') : output.dim('Skipped'),
|
|
328
|
+
count: result.stats.agentsRestored
|
|
329
|
+
},
|
|
330
|
+
{
|
|
331
|
+
component: 'Tasks',
|
|
332
|
+
status: result.restored.tasks ? output.success('Restored') : output.dim('Skipped'),
|
|
333
|
+
count: result.stats.tasksRestored
|
|
334
|
+
}
|
|
335
|
+
]
|
|
336
|
+
});
|
|
337
|
+
output.writeln();
|
|
338
|
+
output.printSuccess(`Session ${sessionId} restored successfully`);
|
|
339
|
+
if (ctx.flags.format === 'json') {
|
|
340
|
+
output.printJson(result);
|
|
341
|
+
}
|
|
342
|
+
return { success: true, data: result };
|
|
343
|
+
}
|
|
344
|
+
catch (error) {
|
|
345
|
+
spinner.fail('Failed to restore session');
|
|
346
|
+
if (error instanceof MCPClientError) {
|
|
347
|
+
output.printError(`Error: ${error.message}`);
|
|
348
|
+
}
|
|
349
|
+
else {
|
|
350
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
429
351
|
}
|
|
430
|
-
|
|
431
|
-
|
|
352
|
+
return { success: false, exitCode: 1 };
|
|
353
|
+
}
|
|
354
|
+
}
|
|
432
355
|
};
|
|
433
356
|
// Delete subcommand
|
|
434
|
-
|
|
357
|
+
const deleteCommand = {
|
|
435
358
|
name: 'delete',
|
|
436
359
|
aliases: ['rm', 'remove'],
|
|
437
360
|
description: 'Delete a saved session',
|
|
@@ -441,59 +364,48 @@ var deleteCommand = {
|
|
|
441
364
|
short: 'f',
|
|
442
365
|
description: 'Delete without confirmation',
|
|
443
366
|
type: 'boolean',
|
|
444
|
-
|
|
367
|
+
default: false
|
|
445
368
|
}
|
|
446
369
|
],
|
|
447
|
-
action:
|
|
448
|
-
|
|
449
|
-
|
|
450
|
-
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
|
|
464
|
-
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
}
|
|
480
|
-
return [2 /*return*/, { success: true, data: result }];
|
|
481
|
-
case 4:
|
|
482
|
-
error_5 = _a.sent();
|
|
483
|
-
if (error_5 instanceof MCPClientError) {
|
|
484
|
-
output.printError("Failed to delete session: " + error_5.message);
|
|
485
|
-
}
|
|
486
|
-
else {
|
|
487
|
-
output.printError("Unexpected error: " + String(error_5));
|
|
488
|
-
}
|
|
489
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
490
|
-
case 5: return [2 /*return*/];
|
|
370
|
+
action: async (ctx) => {
|
|
371
|
+
const sessionId = ctx.args[0];
|
|
372
|
+
const force = ctx.flags.force;
|
|
373
|
+
if (!sessionId) {
|
|
374
|
+
output.printError('Session ID is required');
|
|
375
|
+
return { success: false, exitCode: 1 };
|
|
376
|
+
}
|
|
377
|
+
if (!force && ctx.interactive) {
|
|
378
|
+
const confirmed = await confirm({
|
|
379
|
+
message: `Delete session ${sessionId}? This cannot be undone.`,
|
|
380
|
+
default: false
|
|
381
|
+
});
|
|
382
|
+
if (!confirmed) {
|
|
383
|
+
output.printInfo('Operation cancelled');
|
|
384
|
+
return { success: true };
|
|
385
|
+
}
|
|
386
|
+
}
|
|
387
|
+
try {
|
|
388
|
+
const result = await callMCPTool('session_delete', { sessionId });
|
|
389
|
+
output.writeln();
|
|
390
|
+
output.printSuccess(`Session ${sessionId} deleted`);
|
|
391
|
+
if (ctx.flags.format === 'json') {
|
|
392
|
+
output.printJson(result);
|
|
393
|
+
}
|
|
394
|
+
return { success: true, data: result };
|
|
395
|
+
}
|
|
396
|
+
catch (error) {
|
|
397
|
+
if (error instanceof MCPClientError) {
|
|
398
|
+
output.printError(`Failed to delete session: ${error.message}`);
|
|
399
|
+
}
|
|
400
|
+
else {
|
|
401
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
491
402
|
}
|
|
492
|
-
|
|
493
|
-
|
|
403
|
+
return { success: false, exitCode: 1 };
|
|
404
|
+
}
|
|
405
|
+
}
|
|
494
406
|
};
|
|
495
407
|
// Export subcommand
|
|
496
|
-
|
|
408
|
+
const exportCommand = {
|
|
497
409
|
name: 'export',
|
|
498
410
|
description: 'Export session to file',
|
|
499
411
|
options: [
|
|
@@ -509,111 +421,100 @@ var exportCommand = {
|
|
|
509
421
|
description: 'Export format (json, yaml)',
|
|
510
422
|
type: 'string',
|
|
511
423
|
choices: ['json', 'yaml'],
|
|
512
|
-
|
|
424
|
+
default: 'json'
|
|
513
425
|
},
|
|
514
426
|
{
|
|
515
427
|
name: 'include-memory',
|
|
516
428
|
description: 'Include memory data',
|
|
517
429
|
type: 'boolean',
|
|
518
|
-
|
|
430
|
+
default: true
|
|
519
431
|
},
|
|
520
432
|
{
|
|
521
433
|
name: 'compress',
|
|
522
434
|
description: 'Compress output',
|
|
523
435
|
type: 'boolean',
|
|
524
|
-
|
|
436
|
+
default: false
|
|
525
437
|
}
|
|
526
438
|
],
|
|
527
|
-
action:
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
includeMemory: ctx.flags['include-memory'] !== false
|
|
563
|
-
})];
|
|
564
|
-
case 6:
|
|
565
|
-
result = _b.sent();
|
|
566
|
-
content = void 0;
|
|
567
|
-
if (exportFormat === 'yaml') {
|
|
568
|
-
content = toSimpleYaml(result.data);
|
|
569
|
-
}
|
|
570
|
-
else {
|
|
571
|
-
content = JSON.stringify(result.data, null, 2);
|
|
572
|
-
}
|
|
573
|
-
absolutePath = path.isAbsolute(outputPath)
|
|
574
|
-
? outputPath
|
|
575
|
-
: path.join(ctx.cwd, outputPath);
|
|
576
|
-
fs.writeFileSync(absolutePath, content, 'utf-8');
|
|
577
|
-
spinner.succeed('Session exported');
|
|
578
|
-
output.writeln();
|
|
579
|
-
output.printTable({
|
|
580
|
-
columns: [
|
|
581
|
-
{ key: 'property', header: 'Property', width: 18 },
|
|
582
|
-
{ key: 'value', header: 'Value', width: 40 }
|
|
583
|
-
],
|
|
584
|
-
data: [
|
|
585
|
-
{ property: 'Session ID', value: sessionId },
|
|
586
|
-
{ property: 'Output File', value: absolutePath },
|
|
587
|
-
{ property: 'Format', value: exportFormat.toUpperCase() },
|
|
588
|
-
{ property: 'Agents', value: result.stats.agentCount },
|
|
589
|
-
{ property: 'Tasks', value: result.stats.taskCount },
|
|
590
|
-
{ property: 'Memory Entries', value: result.stats.memoryEntries },
|
|
591
|
-
{ property: 'File Size', value: formatSize(content.length) }
|
|
592
|
-
]
|
|
593
|
-
});
|
|
594
|
-
output.writeln();
|
|
595
|
-
output.printSuccess("Session exported to " + outputPath);
|
|
596
|
-
return [2 /*return*/, {
|
|
597
|
-
success: true,
|
|
598
|
-
data: { sessionId: sessionId, outputPath: outputPath, format: exportFormat, size: content.length }
|
|
599
|
-
}];
|
|
600
|
-
case 7:
|
|
601
|
-
error_6 = _b.sent();
|
|
602
|
-
spinner.fail('Failed to export session');
|
|
603
|
-
if (error_6 instanceof MCPClientError) {
|
|
604
|
-
output.printError("Error: " + error_6.message);
|
|
605
|
-
}
|
|
606
|
-
else {
|
|
607
|
-
output.printError("Unexpected error: " + String(error_6));
|
|
608
|
-
}
|
|
609
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
610
|
-
case 8: return [2 /*return*/];
|
|
439
|
+
action: async (ctx) => {
|
|
440
|
+
let sessionId = ctx.args[0];
|
|
441
|
+
let outputPath = ctx.flags.output;
|
|
442
|
+
const exportFormat = ctx.flags.format;
|
|
443
|
+
const compress = ctx.flags.compress;
|
|
444
|
+
// Get current session if no ID provided
|
|
445
|
+
if (!sessionId) {
|
|
446
|
+
try {
|
|
447
|
+
const current = await callMCPTool('session_current', {});
|
|
448
|
+
sessionId = current.sessionId;
|
|
449
|
+
}
|
|
450
|
+
catch {
|
|
451
|
+
output.printError('No active session. Provide a session ID to export.');
|
|
452
|
+
return { success: false, exitCode: 1 };
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
// Generate output path if not provided
|
|
456
|
+
if (!outputPath) {
|
|
457
|
+
const ext = compress ? '.gz' : '';
|
|
458
|
+
outputPath = `session-${sessionId}.${exportFormat}${ext}`;
|
|
459
|
+
}
|
|
460
|
+
const spinner = output.createSpinner({ text: 'Exporting session...' });
|
|
461
|
+
spinner.start();
|
|
462
|
+
try {
|
|
463
|
+
const result = await callMCPTool('session_export', {
|
|
464
|
+
sessionId,
|
|
465
|
+
includeMemory: ctx.flags['include-memory'] !== false
|
|
466
|
+
});
|
|
467
|
+
// Format output
|
|
468
|
+
let content;
|
|
469
|
+
if (exportFormat === 'yaml') {
|
|
470
|
+
content = toSimpleYaml(result.data);
|
|
471
|
+
}
|
|
472
|
+
else {
|
|
473
|
+
content = JSON.stringify(result.data, null, 2);
|
|
611
474
|
}
|
|
612
|
-
|
|
613
|
-
|
|
475
|
+
// Write to file
|
|
476
|
+
const absolutePath = path.isAbsolute(outputPath)
|
|
477
|
+
? outputPath
|
|
478
|
+
: path.join(ctx.cwd, outputPath);
|
|
479
|
+
fs.writeFileSync(absolutePath, content, 'utf-8');
|
|
480
|
+
spinner.succeed('Session exported');
|
|
481
|
+
output.writeln();
|
|
482
|
+
output.printTable({
|
|
483
|
+
columns: [
|
|
484
|
+
{ key: 'property', header: 'Property', width: 18 },
|
|
485
|
+
{ key: 'value', header: 'Value', width: 40 }
|
|
486
|
+
],
|
|
487
|
+
data: [
|
|
488
|
+
{ property: 'Session ID', value: sessionId },
|
|
489
|
+
{ property: 'Output File', value: absolutePath },
|
|
490
|
+
{ property: 'Format', value: exportFormat.toUpperCase() },
|
|
491
|
+
{ property: 'Agents', value: result.stats.agentCount },
|
|
492
|
+
{ property: 'Tasks', value: result.stats.taskCount },
|
|
493
|
+
{ property: 'Memory Entries', value: result.stats.memoryEntries },
|
|
494
|
+
{ property: 'File Size', value: formatSize(content.length) }
|
|
495
|
+
]
|
|
496
|
+
});
|
|
497
|
+
output.writeln();
|
|
498
|
+
output.printSuccess(`Session exported to ${outputPath}`);
|
|
499
|
+
return {
|
|
500
|
+
success: true,
|
|
501
|
+
data: { sessionId, outputPath, format: exportFormat, size: content.length }
|
|
502
|
+
};
|
|
503
|
+
}
|
|
504
|
+
catch (error) {
|
|
505
|
+
spinner.fail('Failed to export session');
|
|
506
|
+
if (error instanceof MCPClientError) {
|
|
507
|
+
output.printError(`Error: ${error.message}`);
|
|
508
|
+
}
|
|
509
|
+
else {
|
|
510
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
511
|
+
}
|
|
512
|
+
return { success: false, exitCode: 1 };
|
|
513
|
+
}
|
|
514
|
+
}
|
|
614
515
|
};
|
|
615
516
|
// Import subcommand
|
|
616
|
-
|
|
517
|
+
const importCommand = {
|
|
617
518
|
name: 'import',
|
|
618
519
|
description: 'Import session from file',
|
|
619
520
|
options: [
|
|
@@ -627,168 +528,149 @@ var importCommand = {
|
|
|
627
528
|
name: 'activate',
|
|
628
529
|
description: 'Activate session after import',
|
|
629
530
|
type: 'boolean',
|
|
630
|
-
|
|
531
|
+
default: false
|
|
631
532
|
}
|
|
632
533
|
],
|
|
633
|
-
action:
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
if (error_7 instanceof MCPClientError) {
|
|
704
|
-
output.printError("Error: " + error_7.message);
|
|
705
|
-
}
|
|
706
|
-
else if (error_7 instanceof SyntaxError) {
|
|
707
|
-
output.printError('Invalid file format. Expected JSON or YAML.');
|
|
708
|
-
}
|
|
709
|
-
else {
|
|
710
|
-
output.printError("Unexpected error: " + String(error_7));
|
|
711
|
-
}
|
|
712
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
713
|
-
case 4: return [2 /*return*/];
|
|
534
|
+
action: async (ctx) => {
|
|
535
|
+
const filePath = ctx.args[0];
|
|
536
|
+
const sessionName = ctx.flags.name;
|
|
537
|
+
const activate = ctx.flags.activate;
|
|
538
|
+
if (!filePath) {
|
|
539
|
+
output.printError('File path is required');
|
|
540
|
+
return { success: false, exitCode: 1 };
|
|
541
|
+
}
|
|
542
|
+
const absolutePath = path.isAbsolute(filePath)
|
|
543
|
+
? filePath
|
|
544
|
+
: path.join(ctx.cwd, filePath);
|
|
545
|
+
if (!fs.existsSync(absolutePath)) {
|
|
546
|
+
output.printError(`File not found: ${absolutePath}`);
|
|
547
|
+
return { success: false, exitCode: 1 };
|
|
548
|
+
}
|
|
549
|
+
const spinner = output.createSpinner({ text: 'Importing session...' });
|
|
550
|
+
spinner.start();
|
|
551
|
+
try {
|
|
552
|
+
const content = fs.readFileSync(absolutePath, 'utf-8');
|
|
553
|
+
let data;
|
|
554
|
+
// Parse based on extension
|
|
555
|
+
if (absolutePath.endsWith('.yaml') || absolutePath.endsWith('.yml')) {
|
|
556
|
+
// Simple YAML parsing (basic implementation)
|
|
557
|
+
data = JSON.parse(content); // Would need proper YAML parser
|
|
558
|
+
}
|
|
559
|
+
else {
|
|
560
|
+
data = JSON.parse(content);
|
|
561
|
+
}
|
|
562
|
+
const result = await callMCPTool('session_import', {
|
|
563
|
+
data,
|
|
564
|
+
name: sessionName,
|
|
565
|
+
activate
|
|
566
|
+
});
|
|
567
|
+
spinner.succeed('Session imported');
|
|
568
|
+
output.writeln();
|
|
569
|
+
output.printTable({
|
|
570
|
+
columns: [
|
|
571
|
+
{ key: 'property', header: 'Property', width: 20 },
|
|
572
|
+
{ key: 'value', header: 'Value', width: 35 }
|
|
573
|
+
],
|
|
574
|
+
data: [
|
|
575
|
+
{ property: 'Session ID', value: result.sessionId },
|
|
576
|
+
{ property: 'Name', value: result.name },
|
|
577
|
+
{ property: 'Source File', value: path.basename(absolutePath) },
|
|
578
|
+
{ property: 'Agents Imported', value: result.stats.agentsImported },
|
|
579
|
+
{ property: 'Tasks Imported', value: result.stats.tasksImported },
|
|
580
|
+
{ property: 'Memory Entries', value: result.stats.memoryEntriesImported },
|
|
581
|
+
{ property: 'Activated', value: result.activated ? 'Yes' : 'No' }
|
|
582
|
+
]
|
|
583
|
+
});
|
|
584
|
+
output.writeln();
|
|
585
|
+
output.printSuccess(`Session imported: ${result.sessionId}`);
|
|
586
|
+
if (!result.activated) {
|
|
587
|
+
output.printInfo(`Restore with: claude-flow session restore ${result.sessionId}`);
|
|
588
|
+
}
|
|
589
|
+
if (ctx.flags.format === 'json') {
|
|
590
|
+
output.printJson(result);
|
|
591
|
+
}
|
|
592
|
+
return { success: true, data: result };
|
|
593
|
+
}
|
|
594
|
+
catch (error) {
|
|
595
|
+
spinner.fail('Failed to import session');
|
|
596
|
+
if (error instanceof MCPClientError) {
|
|
597
|
+
output.printError(`Error: ${error.message}`);
|
|
598
|
+
}
|
|
599
|
+
else if (error instanceof SyntaxError) {
|
|
600
|
+
output.printError('Invalid file format. Expected JSON or YAML.');
|
|
601
|
+
}
|
|
602
|
+
else {
|
|
603
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
714
604
|
}
|
|
715
|
-
|
|
716
|
-
|
|
605
|
+
return { success: false, exitCode: 1 };
|
|
606
|
+
}
|
|
607
|
+
}
|
|
717
608
|
};
|
|
718
609
|
// Current subcommand
|
|
719
|
-
|
|
610
|
+
const currentCommand = {
|
|
720
611
|
name: 'current',
|
|
721
612
|
description: 'Show current active session',
|
|
722
|
-
action:
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
}
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
case 2:
|
|
756
|
-
error_8 = _a.sent();
|
|
757
|
-
if (error_8 instanceof MCPClientError) {
|
|
758
|
-
output.printWarning('No active session');
|
|
759
|
-
output.printInfo('Start a session with "claude-flow start"');
|
|
760
|
-
return [2 /*return*/, { success: true, data: { active: false } }];
|
|
761
|
-
}
|
|
762
|
-
output.printError("Unexpected error: " + String(error_8));
|
|
763
|
-
return [2 /*return*/, { success: false, exitCode: 1 }];
|
|
764
|
-
case 3: return [2 /*return*/];
|
|
613
|
+
action: async (ctx) => {
|
|
614
|
+
try {
|
|
615
|
+
const result = await callMCPTool('session_current', { includeStats: true });
|
|
616
|
+
if (ctx.flags.format === 'json') {
|
|
617
|
+
output.printJson(result);
|
|
618
|
+
return { success: true, data: result };
|
|
619
|
+
}
|
|
620
|
+
output.writeln();
|
|
621
|
+
output.writeln(output.bold('Current Session'));
|
|
622
|
+
output.writeln();
|
|
623
|
+
output.printTable({
|
|
624
|
+
columns: [
|
|
625
|
+
{ key: 'property', header: 'Property', width: 18 },
|
|
626
|
+
{ key: 'value', header: 'Value', width: 35 }
|
|
627
|
+
],
|
|
628
|
+
data: [
|
|
629
|
+
{ property: 'Session ID', value: result.sessionId },
|
|
630
|
+
{ property: 'Name', value: result.name || '-' },
|
|
631
|
+
{ property: 'Status', value: formatStatus(result.status) },
|
|
632
|
+
{ property: 'Started', value: new Date(result.startedAt).toLocaleString() },
|
|
633
|
+
{ property: 'Duration', value: formatDuration(result.stats.duration) },
|
|
634
|
+
{ property: 'Agents', value: result.stats.agentCount },
|
|
635
|
+
{ property: 'Tasks', value: result.stats.taskCount },
|
|
636
|
+
{ property: 'Memory Entries', value: result.stats.memoryEntries }
|
|
637
|
+
]
|
|
638
|
+
});
|
|
639
|
+
return { success: true, data: result };
|
|
640
|
+
}
|
|
641
|
+
catch (error) {
|
|
642
|
+
if (error instanceof MCPClientError) {
|
|
643
|
+
output.printWarning('No active session');
|
|
644
|
+
output.printInfo('Start a session with "claude-flow start"');
|
|
645
|
+
return { success: true, data: { active: false } };
|
|
765
646
|
}
|
|
766
|
-
|
|
767
|
-
|
|
647
|
+
output.printError(`Unexpected error: ${String(error)}`);
|
|
648
|
+
return { success: false, exitCode: 1 };
|
|
649
|
+
}
|
|
650
|
+
}
|
|
768
651
|
};
|
|
769
652
|
// Helper functions
|
|
770
653
|
function formatSize(bytes) {
|
|
771
654
|
if (bytes === 0)
|
|
772
655
|
return '0 B';
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
return parseFloat((bytes / Math.pow(k, i)).toFixed(1))
|
|
656
|
+
const k = 1024;
|
|
657
|
+
const sizes = ['B', 'KB', 'MB', 'GB'];
|
|
658
|
+
const i = Math.floor(Math.log(bytes) / Math.log(k));
|
|
659
|
+
return `${parseFloat((bytes / Math.pow(k, i)).toFixed(1))} ${sizes[i]}`;
|
|
777
660
|
}
|
|
778
661
|
function formatDuration(ms) {
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
662
|
+
const seconds = Math.floor(ms / 1000);
|
|
663
|
+
const minutes = Math.floor(seconds / 60);
|
|
664
|
+
const hours = Math.floor(minutes / 60);
|
|
782
665
|
if (hours > 0) {
|
|
783
|
-
return hours
|
|
666
|
+
return `${hours}h ${minutes % 60}m`;
|
|
784
667
|
}
|
|
785
668
|
else if (minutes > 0) {
|
|
786
|
-
return minutes
|
|
669
|
+
return `${minutes}m ${seconds % 60}s`;
|
|
787
670
|
}
|
|
788
|
-
return seconds
|
|
671
|
+
return `${seconds}s`;
|
|
789
672
|
}
|
|
790
|
-
function toSimpleYaml(obj, indent) {
|
|
791
|
-
if (indent === void 0) { indent = 0; }
|
|
673
|
+
function toSimpleYaml(obj, indent = 0) {
|
|
792
674
|
// Simple YAML serializer (for basic types)
|
|
793
675
|
if (obj === null)
|
|
794
676
|
return 'null';
|
|
@@ -797,24 +679,22 @@ function toSimpleYaml(obj, indent) {
|
|
|
797
679
|
if (typeof obj === 'number')
|
|
798
680
|
return String(obj);
|
|
799
681
|
if (typeof obj === 'string')
|
|
800
|
-
return obj.includes(':') ? "
|
|
801
|
-
|
|
802
|
-
|
|
682
|
+
return obj.includes(':') ? `"${obj}"` : obj;
|
|
683
|
+
const spaces = ' '.repeat(indent);
|
|
684
|
+
let result = '';
|
|
803
685
|
if (Array.isArray(obj)) {
|
|
804
|
-
for (
|
|
805
|
-
|
|
806
|
-
result += spaces + "- " + toSimpleYaml(item, indent + 1).trim() + "\n";
|
|
686
|
+
for (const item of obj) {
|
|
687
|
+
result += `${spaces}- ${toSimpleYaml(item, indent + 1).trim()}\n`;
|
|
807
688
|
}
|
|
808
689
|
return result;
|
|
809
690
|
}
|
|
810
691
|
if (typeof obj === 'object') {
|
|
811
|
-
for (
|
|
812
|
-
var _c = _b[_a], key = _c[0], value = _c[1];
|
|
692
|
+
for (const [key, value] of Object.entries(obj)) {
|
|
813
693
|
if (typeof value === 'object' && value !== null) {
|
|
814
|
-
result +=
|
|
694
|
+
result += `${spaces}${key}:\n${toSimpleYaml(value, indent + 1)}`;
|
|
815
695
|
}
|
|
816
696
|
else {
|
|
817
|
-
result +=
|
|
697
|
+
result += `${spaces}${key}: ${toSimpleYaml(value, indent)}\n`;
|
|
818
698
|
}
|
|
819
699
|
}
|
|
820
700
|
return result;
|
|
@@ -822,7 +702,7 @@ function toSimpleYaml(obj, indent) {
|
|
|
822
702
|
return String(obj);
|
|
823
703
|
}
|
|
824
704
|
// Main session command
|
|
825
|
-
export
|
|
705
|
+
export const sessionCommand = {
|
|
826
706
|
name: 'session',
|
|
827
707
|
description: 'Session management commands',
|
|
828
708
|
subcommands: [
|
|
@@ -844,29 +724,27 @@ export var sessionCommand = {
|
|
|
844
724
|
{ command: 'claude-flow session import backup.json', description: 'Import session from file' },
|
|
845
725
|
{ command: 'claude-flow session current', description: 'Show current session' }
|
|
846
726
|
],
|
|
847
|
-
action:
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
output.
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
});
|
|
869
|
-
}); }
|
|
727
|
+
action: async (ctx) => {
|
|
728
|
+
// Show help if no subcommand
|
|
729
|
+
output.writeln();
|
|
730
|
+
output.writeln(output.bold('Session Management Commands'));
|
|
731
|
+
output.writeln();
|
|
732
|
+
output.writeln('Usage: claude-flow session <subcommand> [options]');
|
|
733
|
+
output.writeln();
|
|
734
|
+
output.writeln('Subcommands:');
|
|
735
|
+
output.printList([
|
|
736
|
+
`${output.highlight('list')} - List all sessions`,
|
|
737
|
+
`${output.highlight('save')} - Save current session state`,
|
|
738
|
+
`${output.highlight('restore')} - Restore a saved session`,
|
|
739
|
+
`${output.highlight('delete')} - Delete a saved session`,
|
|
740
|
+
`${output.highlight('export')} - Export session to file`,
|
|
741
|
+
`${output.highlight('import')} - Import session from file`,
|
|
742
|
+
`${output.highlight('current')} - Show current active session`
|
|
743
|
+
]);
|
|
744
|
+
output.writeln();
|
|
745
|
+
output.writeln('Run "claude-flow session <subcommand> --help" for subcommand help');
|
|
746
|
+
return { success: true };
|
|
747
|
+
}
|
|
870
748
|
};
|
|
871
749
|
export default sessionCommand;
|
|
872
750
|
//# sourceMappingURL=session.js.map
|