claude-flow-novice 1.6.1 → 1.6.2
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/agents/cfn-loop/product-owner.md +54 -4
- package/.claude/commands/cfn-claude-sync.md +303 -0
- package/.claude/commands/cfn-loop-epic.md +290 -0
- package/.claude/commands/cfn-loop-single.md +168 -0
- package/.claude/commands/cfn-loop-sprints.md +384 -0
- package/.claude/commands/cfn-loop.md +180 -0
- package/.claude/commands/metrics-summary.md +58 -0
- package/.claude/commands/parse-epic.md +357 -0
- package/.claude/settings.json +4 -4
- package/.claude/settings.local.json +9 -2
- package/.claude-flow-novice/.claude/agents/cfn-loop/product-owner.md +792 -0
- package/.claude-flow-novice/dist/mcp/server.js +21 -2
- package/.claude-flow-novice/dist/src/api/claude-client.js +138 -3
- package/.claude-flow-novice/dist/src/api/claude-client.js.map +1 -1
- package/.claude-flow-novice/dist/src/cfn-loop/phase-orchestrator-example.js +1 -1
- package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js +247 -0
- package/.claude-flow-novice/dist/src/cfn-loop/scope-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js +32 -15
- package/.claude-flow-novice/dist/src/cli/commands/swarm.js.map +1 -1
- package/.claude-flow-novice/dist/src/cli/commands/transparency.js +455 -0
- package/.claude-flow-novice/dist/src/cli/commands/transparency.js.map +1 -0
- package/.claude-flow-novice/dist/src/cli/simple-commands/init/templates/CLAUDE.md +129 -13
- package/.claude-flow-novice/dist/src/components/visualizations/index.js +9 -0
- package/.claude-flow-novice/dist/src/components/visualizations/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js +462 -0
- package/.claude-flow-novice/dist/src/coordination/adapters/v1-coordinator-adapter.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js +248 -0
- package/.claude-flow-novice/dist/src/coordination/config-translator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js +287 -0
- package/.claude-flow-novice/dist/src/coordination/coordination-toggle.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js +68 -9
- package/.claude-flow-novice/dist/src/coordination/distributed-consensus.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/feature-flags.js +166 -0
- package/.claude-flow-novice/dist/src/coordination/feature-flags.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/queen-agent.js +18 -4
- package/.claude-flow-novice/dist/src/coordination/queen-agent.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/role-assignment.js +6 -110
- package/.claude-flow-novice/dist/src/coordination/role-assignment.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js +632 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/artifact-cache-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js +11 -0
- package/.claude-flow-novice/dist/src/coordination/v2/cache/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js +318 -0
- package/.claude-flow-novice/dist/src/coordination/v2/checkpoints/checkpoint-compressor.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js +364 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js +492 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/cascading-shutdown.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js +786 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/hierarchical-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js +342 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/parent-child-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js +601 -0
- package/.claude-flow-novice/dist/src/coordination/v2/coordinators/swarm-coordinator-v2.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js +211 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/help-request-metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/index.js +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js +365 -6
- package/.claude-flow-novice/dist/src/coordination/v2/core/message-broker.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js +478 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/resource-manager-safe.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js +5 -2
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine-config.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js +189 -0
- package/.claude-flow-novice/dist/src/coordination/v2/core/state-machine.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/deadlock-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js +9 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js +669 -0
- package/.claude-flow-novice/dist/src/coordination/v2/deadlock/resource-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js +451 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/artifact-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js +271 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/cycle-detector.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js +335 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-graph.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js +439 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-manager.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js +92 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/dependency-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js +21 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js +223 -0
- package/.claude-flow-novice/dist/src/coordination/v2/dependency/topological-sort.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js +436 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js +278 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-matcher.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js +317 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js +273 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/help-request.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js +15 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js +512 -0
- package/.claude-flow-novice/dist/src/coordination/v2/help-system/waiting-agent-pool.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/index.js +6 -0
- package/.claude-flow-novice/dist/src/coordination/v2/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js +557 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/help-deadlock-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js +212 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.example.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js +552 -0
- package/.claude-flow-novice/dist/src/coordination/v2/integration/message-bus-completion-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js +367 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/dependency-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/memory/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js +371 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js +355 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/dependency-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js +424 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/help-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js +16 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js +295 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/state-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js +411 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/channels/task-channel.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js +14 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js +387 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-bus.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js +589 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-persistence.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js +444 -0
- package/.claude-flow-novice/dist/src/coordination/v2/messaging/message-router.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js +29 -8
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/checkpoint-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js +470 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/help-coordinator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js +450 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/hierarchical-background-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js +5 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/index.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js +545 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/multi-level-control.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js +44 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-controller.js.map +1 -1
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js +415 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/query-message-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js +615 -0
- package/.claude-flow-novice/dist/src/coordination/v2/sdk/session-pool-optimizer.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js +259 -0
- package/.claude-flow-novice/dist/src/coordination/v2/security/payload-validator.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js +17 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js +357 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-integration.js.map +1 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js +679 -0
- package/.claude-flow-novice/dist/src/coordination/v2/transparency/transparency-system.js.map +1 -0
- package/.claude-flow-novice/dist/src/core/agent-manager.js +30 -0
- package/.claude-flow-novice/dist/src/core/agent-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/mcp/server.js +21 -2
- package/.claude-flow-novice/dist/src/mcp/server.js.map +1 -1
- package/.claude-flow-novice/dist/src/observability/metrics-counter.js +268 -0
- package/.claude-flow-novice/dist/src/observability/metrics-counter.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/metrics-storage.js +265 -0
- package/.claude-flow-novice/dist/src/observability/metrics-storage.js.map +1 -0
- package/.claude-flow-novice/dist/src/observability/telemetry.js +26 -0
- package/.claude-flow-novice/dist/src/observability/telemetry.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/tiered-router.js +64 -10
- package/.claude-flow-novice/dist/src/providers/tiered-router.js.map +1 -1
- package/.claude-flow-novice/dist/src/providers/zai-provider.js +196 -97
- package/.claude-flow-novice/dist/src/providers/zai-provider.js.map +1 -1
- package/.claude-flow-novice/dist/src/slash-commands/cfn-claude-sync.js +533 -0
- package/.claude-flow-novice/dist/src/slash-commands/index.js +5 -0
- package/.claude-flow-novice/dist/src/slash-commands/metrics-summary-class.js +74 -0
- package/.claude-flow-novice/dist/src/slash-commands/metrics-summary.js +335 -0
- package/.claude-flow-novice/dist/src/slash-commands/register-all-commands.js +12 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js +96 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression-demo.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js +406 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-compression.js.map +1 -0
- package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js +35 -5
- package/.claude-flow-novice/dist/src/verification/checkpoint-manager.js.map +1 -1
- package/.claude-flow-novice/dist/src/web/api/config/api-config.js +186 -0
- package/.claude-flow-novice/dist/src/web/api/config/api-config.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/auth.js +205 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/auth.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/cache.js +262 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/cache.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js +250 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/error-handler.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js +217 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/request-logger.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/validation.js +325 -0
- package/.claude-flow-novice/dist/src/web/api/middleware/validation.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/events.js +465 -0
- package/.claude-flow-novice/dist/src/web/api/routes/events.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js +302 -0
- package/.claude-flow-novice/dist/src/web/api/routes/hierarchy.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/index.js +14 -0
- package/.claude-flow-novice/dist/src/web/api/routes/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/metrics.js +561 -0
- package/.claude-flow-novice/dist/src/web/api/routes/metrics.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/routes/status.js +450 -0
- package/.claude-flow-novice/dist/src/web/api/routes/status.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/api/server.js +451 -0
- package/.claude-flow-novice/dist/src/web/api/server.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js +385 -0
- package/.claude-flow-novice/dist/src/web/dashboard/hooks/useWebSocket.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/index.js +87 -0
- package/.claude-flow-novice/dist/src/web/dashboard/index.js.map +1 -0
- package/.claude-flow-novice/dist/src/web/dashboard/types.js +6 -0
- package/.claude-flow-novice/dist/src/web/dashboard/types.js.map +1 -0
- package/.claude-flow-novice/metrics.db +0 -0
- package/.claude-flow-novice/metrics.db-shm +0 -0
- package/.claude-flow-novice/metrics.db-wal +0 -0
- package/CLAUDE.md +29 -0
- package/README.md +27 -0
- package/config/hooks/post-edit-pipeline.js +36 -2
- package/examples/metrics-counter-demo.ts +106 -0
- package/examples/persistent-metrics-demo.ts +83 -0
- package/examples/phase-5-multi-level-control.ts +282 -0
- package/examples/session-pool-optimizer-example.ts +311 -0
- package/package.json +15 -3
- package/scripts/check-routing-stats.cjs +122 -0
- package/scripts/pre-publish-validation.cjs +212 -0
- package/scripts/test-provider-routing.cjs +228 -0
- package/scripts/test-routing-telemetry.cjs +147 -0
- package/scripts/test-zai-10k.cjs +81 -0
- package/scripts/test-zai-api.cjs +191 -0
- package/scripts/test-zai-diagnostic.cjs +151 -0
- package/scripts/test-zai-final.cjs +128 -0
- package/scripts/test-zai-with-env.cjs +85 -0
- package/scripts/validate-coordination-cli.js +69 -0
- package/scripts/validate-coordination-toggle-integration.cjs +501 -0
- package/src/cli/simple-commands/init/templates/CLAUDE.md +29 -0
- package/src/observability/metrics-counter.ts +347 -0
- package/src/observability/metrics-storage.ts +356 -0
- package/src/observability/telemetry.ts +658 -0
- package/src/slash-commands/cfn-claude-sync.js +533 -0
- package/src/slash-commands/index.js +5 -0
- package/src/slash-commands/metrics-summary-class.js +74 -0
- package/src/slash-commands/metrics-summary.js +335 -0
- package/src/slash-commands/register-all-commands.js +12 -0
|
@@ -0,0 +1,335 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Metrics Summary Slash Command
|
|
5
|
+
*
|
|
6
|
+
* Displays aggregated metrics statistics with configurable time frame.
|
|
7
|
+
*
|
|
8
|
+
* Usage:
|
|
9
|
+
* /metrics-summary [--minutes=60] [--provider=all] [--model=all]
|
|
10
|
+
*/
|
|
11
|
+
|
|
12
|
+
import Database from 'better-sqlite3';
|
|
13
|
+
import { fileURLToPath } from 'url';
|
|
14
|
+
import { dirname, join } from 'path';
|
|
15
|
+
import { readFile, writeFile } from 'fs/promises';
|
|
16
|
+
|
|
17
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
18
|
+
const __dirname = dirname(__filename);
|
|
19
|
+
|
|
20
|
+
// Parse command line arguments
|
|
21
|
+
function parseArgs(args) {
|
|
22
|
+
const options = {
|
|
23
|
+
minutes: 60, // Default: last hour
|
|
24
|
+
provider: 'all',
|
|
25
|
+
model: 'all',
|
|
26
|
+
action: null, // enable, disable, status
|
|
27
|
+
};
|
|
28
|
+
|
|
29
|
+
for (const arg of args) {
|
|
30
|
+
if (arg.startsWith('--minutes=')) {
|
|
31
|
+
options.minutes = parseInt(arg.split('=')[1], 10);
|
|
32
|
+
} else if (arg.startsWith('--provider=')) {
|
|
33
|
+
options.provider = arg.split('=')[1];
|
|
34
|
+
} else if (arg.startsWith('--model=')) {
|
|
35
|
+
options.model = arg.split('=')[1];
|
|
36
|
+
} else if (arg === '--enable' || arg === 'enable') {
|
|
37
|
+
options.action = 'enable';
|
|
38
|
+
} else if (arg === '--disable' || arg === 'disable') {
|
|
39
|
+
options.action = 'disable';
|
|
40
|
+
} else if (arg === '--status' || arg === 'status') {
|
|
41
|
+
options.action = 'status';
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
return options;
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
// Format large numbers
|
|
49
|
+
function formatNumber(num) {
|
|
50
|
+
return num.toLocaleString();
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
// Format duration
|
|
54
|
+
function formatDuration(ms) {
|
|
55
|
+
if (ms < 1000) return `${ms.toFixed(0)}ms`;
|
|
56
|
+
return `${(ms / 1000).toFixed(2)}s`;
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Calculate cost estimate
|
|
60
|
+
function estimateCost(inputTokens, outputTokens, model, provider) {
|
|
61
|
+
// Pricing per 1K tokens (USD)
|
|
62
|
+
const pricing = {
|
|
63
|
+
'anthropic': {
|
|
64
|
+
'claude-3-5-sonnet-20241022': { input: 0.003, output: 0.015 },
|
|
65
|
+
'claude-3-sonnet-20240229': { input: 0.003, output: 0.015 },
|
|
66
|
+
},
|
|
67
|
+
'z.ai': {
|
|
68
|
+
'glm-4.5': { input: 0.003, output: 0.015 },
|
|
69
|
+
'glm-4.6': { input: 0.003, output: 0.015 },
|
|
70
|
+
'claude-3-5-sonnet-20241022': { input: 0.003, output: 0.015 },
|
|
71
|
+
},
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
const providerPricing = pricing[provider];
|
|
75
|
+
if (!providerPricing || !providerPricing[model]) {
|
|
76
|
+
return null;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
const modelPricing = providerPricing[model];
|
|
80
|
+
const inputCost = (inputTokens / 1000) * modelPricing.input;
|
|
81
|
+
const outputCost = (outputTokens / 1000) * modelPricing.output;
|
|
82
|
+
|
|
83
|
+
return inputCost + outputCost;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
// Generate metrics summary
|
|
87
|
+
function generateSummary(options) {
|
|
88
|
+
const dbPath = join(__dirname, '../../.claude-flow-novice/metrics.db');
|
|
89
|
+
const db = new Database(dbPath, { readonly: true });
|
|
90
|
+
|
|
91
|
+
// Calculate time threshold
|
|
92
|
+
const now = Date.now();
|
|
93
|
+
const timeThreshold = now - (options.minutes * 60 * 1000);
|
|
94
|
+
|
|
95
|
+
console.log(`\n📊 Metrics Summary (Last ${options.minutes} minutes)\n`);
|
|
96
|
+
console.log(`Time Range: ${new Date(timeThreshold).toLocaleString()} → ${new Date(now).toLocaleString()}\n`);
|
|
97
|
+
console.log('─'.repeat(80) + '\n');
|
|
98
|
+
|
|
99
|
+
// Query: API Requests by Provider
|
|
100
|
+
const requestQuery = `
|
|
101
|
+
SELECT
|
|
102
|
+
json_extract(tags, '$.provider') as provider,
|
|
103
|
+
COUNT(*) as count
|
|
104
|
+
FROM metrics
|
|
105
|
+
WHERE name = 'claude.api.request'
|
|
106
|
+
AND timestamp >= ?
|
|
107
|
+
${options.provider !== 'all' ? `AND json_extract(tags, '$.provider') = '${options.provider}'` : ''}
|
|
108
|
+
${options.model !== 'all' ? `AND json_extract(tags, '$.model') = '${options.model}'` : ''}
|
|
109
|
+
GROUP BY provider
|
|
110
|
+
ORDER BY count DESC
|
|
111
|
+
`;
|
|
112
|
+
|
|
113
|
+
const requests = db.prepare(requestQuery).all(timeThreshold);
|
|
114
|
+
|
|
115
|
+
if (requests.length > 0) {
|
|
116
|
+
console.log('🌐 API Requests by Provider:');
|
|
117
|
+
let totalRequests = 0;
|
|
118
|
+
requests.forEach(row => {
|
|
119
|
+
console.log(` ${row.provider || 'unknown'}: ${formatNumber(row.count)}`);
|
|
120
|
+
totalRequests += row.count;
|
|
121
|
+
});
|
|
122
|
+
console.log(` TOTAL: ${formatNumber(totalRequests)}\n`);
|
|
123
|
+
} else {
|
|
124
|
+
console.log('🌐 API Requests: No data in time range\n');
|
|
125
|
+
}
|
|
126
|
+
|
|
127
|
+
// Query: Token Usage by Provider and Model
|
|
128
|
+
const tokenQuery = `
|
|
129
|
+
SELECT
|
|
130
|
+
json_extract(tags, '$.provider') as provider,
|
|
131
|
+
json_extract(tags, '$.model') as model,
|
|
132
|
+
SUM(CASE WHEN name = 'claude.tokens.input' THEN value ELSE 0 END) as input_tokens,
|
|
133
|
+
SUM(CASE WHEN name = 'claude.tokens.output' THEN value ELSE 0 END) as output_tokens,
|
|
134
|
+
SUM(CASE WHEN name = 'claude.tokens.total' THEN value ELSE 0 END) as total_tokens
|
|
135
|
+
FROM metrics
|
|
136
|
+
WHERE name IN ('claude.tokens.input', 'claude.tokens.output', 'claude.tokens.total')
|
|
137
|
+
AND timestamp >= ?
|
|
138
|
+
${options.provider !== 'all' ? `AND json_extract(tags, '$.provider') = '${options.provider}'` : ''}
|
|
139
|
+
${options.model !== 'all' ? `AND json_extract(tags, '$.model') = '${options.model}'` : ''}
|
|
140
|
+
GROUP BY provider, model
|
|
141
|
+
ORDER BY total_tokens DESC
|
|
142
|
+
`;
|
|
143
|
+
|
|
144
|
+
const tokens = db.prepare(tokenQuery).all(timeThreshold);
|
|
145
|
+
|
|
146
|
+
if (tokens.length > 0) {
|
|
147
|
+
console.log('🎯 Token Usage by Provider & Model:');
|
|
148
|
+
let totalInput = 0;
|
|
149
|
+
let totalOutput = 0;
|
|
150
|
+
let totalCost = 0;
|
|
151
|
+
|
|
152
|
+
tokens.forEach(row => {
|
|
153
|
+
const inputTokens = row.input_tokens || 0;
|
|
154
|
+
const outputTokens = row.output_tokens || 0;
|
|
155
|
+
const totalTokens = row.total_tokens || 0;
|
|
156
|
+
|
|
157
|
+
totalInput += inputTokens;
|
|
158
|
+
totalOutput += outputTokens;
|
|
159
|
+
|
|
160
|
+
const cost = estimateCost(inputTokens, outputTokens, row.model, row.provider);
|
|
161
|
+
if (cost !== null) {
|
|
162
|
+
totalCost += cost;
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
console.log(` ${row.provider || 'unknown'} / ${row.model || 'unknown'}:`);
|
|
166
|
+
console.log(` Input: ${formatNumber(inputTokens)}`);
|
|
167
|
+
console.log(` Output: ${formatNumber(outputTokens)}`);
|
|
168
|
+
console.log(` Total: ${formatNumber(totalTokens)}`);
|
|
169
|
+
if (cost !== null) {
|
|
170
|
+
console.log(` Cost: $${cost.toFixed(4)}`);
|
|
171
|
+
}
|
|
172
|
+
});
|
|
173
|
+
|
|
174
|
+
console.log(` TOTAL:`);
|
|
175
|
+
console.log(` Input: ${formatNumber(totalInput)}`);
|
|
176
|
+
console.log(` Output: ${formatNumber(totalOutput)}`);
|
|
177
|
+
console.log(` Total: ${formatNumber(totalInput + totalOutput)}`);
|
|
178
|
+
if (totalCost > 0) {
|
|
179
|
+
console.log(` Cost: $${totalCost.toFixed(4)}`);
|
|
180
|
+
}
|
|
181
|
+
console.log();
|
|
182
|
+
} else {
|
|
183
|
+
console.log('🎯 Token Usage: No data in time range\n');
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
// Query: Error Rate
|
|
187
|
+
const errorQuery = `
|
|
188
|
+
SELECT
|
|
189
|
+
COUNT(*) as total_errors
|
|
190
|
+
FROM metrics
|
|
191
|
+
WHERE name = 'claude.api.error'
|
|
192
|
+
AND timestamp >= ?
|
|
193
|
+
${options.provider !== 'all' ? `AND json_extract(tags, '$.provider') = '${options.provider}'` : ''}
|
|
194
|
+
${options.model !== 'all' ? `AND json_extract(tags, '$.model') = '${options.model}'` : ''}
|
|
195
|
+
`;
|
|
196
|
+
|
|
197
|
+
const errors = db.prepare(errorQuery).get(timeThreshold);
|
|
198
|
+
const totalRequests = requests.reduce((sum, r) => sum + r.count, 0);
|
|
199
|
+
|
|
200
|
+
if (totalRequests > 0) {
|
|
201
|
+
const errorRate = ((errors.total_errors || 0) / totalRequests) * 100;
|
|
202
|
+
console.log('⚠️ Error Rate:');
|
|
203
|
+
console.log(` Errors: ${formatNumber(errors.total_errors || 0)} / ${formatNumber(totalRequests)}`);
|
|
204
|
+
console.log(` Rate: ${errorRate.toFixed(2)}%\n`);
|
|
205
|
+
} else {
|
|
206
|
+
console.log('⚠️ Error Rate: No requests in time range\n');
|
|
207
|
+
}
|
|
208
|
+
|
|
209
|
+
// Query: Average Duration by Provider
|
|
210
|
+
const durationQuery = `
|
|
211
|
+
SELECT
|
|
212
|
+
json_extract(tags, '$.provider') as provider,
|
|
213
|
+
json_extract(tags, '$.status') as status,
|
|
214
|
+
AVG(value) as avg_duration,
|
|
215
|
+
MIN(value) as min_duration,
|
|
216
|
+
MAX(value) as max_duration,
|
|
217
|
+
COUNT(*) as count
|
|
218
|
+
FROM metrics
|
|
219
|
+
WHERE name = 'claude.api.duration'
|
|
220
|
+
AND timestamp >= ?
|
|
221
|
+
${options.provider !== 'all' ? `AND json_extract(tags, '$.provider') = '${options.provider}'` : ''}
|
|
222
|
+
${options.model !== 'all' ? `AND json_extract(tags, '$.model') = '${options.model}'` : ''}
|
|
223
|
+
GROUP BY provider, status
|
|
224
|
+
ORDER BY provider, status
|
|
225
|
+
`;
|
|
226
|
+
|
|
227
|
+
const durations = db.prepare(durationQuery).all(timeThreshold);
|
|
228
|
+
|
|
229
|
+
if (durations.length > 0) {
|
|
230
|
+
console.log('⏱️ API Duration by Provider:');
|
|
231
|
+
durations.forEach(row => {
|
|
232
|
+
console.log(` ${row.provider || 'unknown'} (${row.status || 'unknown'}):`);
|
|
233
|
+
console.log(` Avg: ${formatDuration(row.avg_duration)}`);
|
|
234
|
+
console.log(` Min: ${formatDuration(row.min_duration)}`);
|
|
235
|
+
console.log(` Max: ${formatDuration(row.max_duration)}`);
|
|
236
|
+
console.log(` Count: ${formatNumber(row.count)}`);
|
|
237
|
+
});
|
|
238
|
+
console.log();
|
|
239
|
+
} else {
|
|
240
|
+
console.log('⏱️ API Duration: No data in time range\n');
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Query: Top Models
|
|
244
|
+
const modelQuery = `
|
|
245
|
+
SELECT
|
|
246
|
+
json_extract(tags, '$.model') as model,
|
|
247
|
+
COUNT(*) as count
|
|
248
|
+
FROM metrics
|
|
249
|
+
WHERE name = 'claude.api.request'
|
|
250
|
+
AND timestamp >= ?
|
|
251
|
+
${options.provider !== 'all' ? `AND json_extract(tags, '$.provider') = '${options.provider}'` : ''}
|
|
252
|
+
${options.model !== 'all' ? `AND json_extract(tags, '$.model') = '${options.model}'` : ''}
|
|
253
|
+
GROUP BY model
|
|
254
|
+
ORDER BY count DESC
|
|
255
|
+
LIMIT 5
|
|
256
|
+
`;
|
|
257
|
+
|
|
258
|
+
const topModels = db.prepare(modelQuery).all(timeThreshold);
|
|
259
|
+
|
|
260
|
+
if (topModels.length > 0) {
|
|
261
|
+
console.log('🏆 Top Models:');
|
|
262
|
+
topModels.forEach((row, idx) => {
|
|
263
|
+
console.log(` ${idx + 1}. ${row.model || 'unknown'}: ${formatNumber(row.count)} requests`);
|
|
264
|
+
});
|
|
265
|
+
console.log();
|
|
266
|
+
} else {
|
|
267
|
+
console.log('🏆 Top Models: No data in time range\n');
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
console.log('─'.repeat(80) + '\n');
|
|
271
|
+
|
|
272
|
+
db.close();
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
// Manage metrics tracking toggle
|
|
276
|
+
async function manageTracking(action) {
|
|
277
|
+
const configPath = join(__dirname, '../../.claude/settings.json');
|
|
278
|
+
|
|
279
|
+
try {
|
|
280
|
+
// Read current settings
|
|
281
|
+
const settingsContent = await readFile(configPath, 'utf8');
|
|
282
|
+
const settings = JSON.parse(settingsContent);
|
|
283
|
+
|
|
284
|
+
if (action === 'status') {
|
|
285
|
+
const enabled = settings.env?.CLAUDE_FLOW_TELEMETRY_ENABLED !== 'false';
|
|
286
|
+
console.log('\n📊 Metrics Tracking Status:\n');
|
|
287
|
+
console.log(`Status: ${enabled ? '✅ ENABLED' : '❌ DISABLED'}`);
|
|
288
|
+
console.log(`Setting: CLAUDE_FLOW_TELEMETRY_ENABLED=${settings.env?.CLAUDE_FLOW_TELEMETRY_ENABLED || 'true'}`);
|
|
289
|
+
console.log(`\nTo change: /metrics-summary --enable OR /metrics-summary --disable\n`);
|
|
290
|
+
return;
|
|
291
|
+
}
|
|
292
|
+
|
|
293
|
+
if (action === 'enable') {
|
|
294
|
+
settings.env = settings.env || {};
|
|
295
|
+
settings.env.CLAUDE_FLOW_TELEMETRY_ENABLED = 'true';
|
|
296
|
+
await writeFile(configPath, JSON.stringify(settings, null, 2));
|
|
297
|
+
console.log('\n✅ Metrics tracking ENABLED');
|
|
298
|
+
console.log('All API requests, tokens, and performance metrics will now be tracked.\n');
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if (action === 'disable') {
|
|
303
|
+
settings.env = settings.env || {};
|
|
304
|
+
settings.env.CLAUDE_FLOW_TELEMETRY_ENABLED = 'false';
|
|
305
|
+
await writeFile(configPath, JSON.stringify(settings, null, 2));
|
|
306
|
+
console.log('\n❌ Metrics tracking DISABLED');
|
|
307
|
+
console.log('No metrics will be collected until re-enabled.\n');
|
|
308
|
+
return;
|
|
309
|
+
}
|
|
310
|
+
} catch (error) {
|
|
311
|
+
console.error('❌ Error managing tracking settings:', error.message);
|
|
312
|
+
process.exit(1);
|
|
313
|
+
}
|
|
314
|
+
}
|
|
315
|
+
|
|
316
|
+
// Main execution
|
|
317
|
+
(async () => {
|
|
318
|
+
try {
|
|
319
|
+
const args = process.argv.slice(2);
|
|
320
|
+
const options = parseArgs(args);
|
|
321
|
+
|
|
322
|
+
// Handle tracking management actions
|
|
323
|
+
if (options.action) {
|
|
324
|
+
await manageTracking(options.action);
|
|
325
|
+
process.exit(0);
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// Generate summary
|
|
329
|
+
generateSummary(options);
|
|
330
|
+
process.exit(0);
|
|
331
|
+
} catch (error) {
|
|
332
|
+
console.error('❌ Error:', error.message);
|
|
333
|
+
process.exit(1);
|
|
334
|
+
}
|
|
335
|
+
})();
|
|
@@ -18,10 +18,12 @@ import { CfnLoopCommand } from './cfn-loop.js';
|
|
|
18
18
|
import { CfnLoopSingleCommand } from './cfn-loop-single.js';
|
|
19
19
|
import { CfnLoopSprintsCommand } from './cfn-loop-sprints.js';
|
|
20
20
|
import { CfnLoopEpicCommand } from './cfn-loop-epic.js';
|
|
21
|
+
import { CfnClaudeSyncCommand } from './cfn-claude-sync.js';
|
|
21
22
|
import { executeClaudeSoulCommand } from './claude-soul.js';
|
|
22
23
|
import { ParseEpicCommand } from './parse-epic.js';
|
|
23
24
|
import { CustomRoutingActivateCommand } from './custom-routing-activate-class.js';
|
|
24
25
|
import { CustomRoutingDeactivateCommand } from './custom-routing-deactivate-class.js';
|
|
26
|
+
import { MetricsSummaryCommand } from './metrics-summary-class.js';
|
|
25
27
|
|
|
26
28
|
/**
|
|
27
29
|
* Command Registry Class
|
|
@@ -54,6 +56,11 @@ export class SlashCommandRegistry {
|
|
|
54
56
|
this.register(new CfnLoopEpicCommand());
|
|
55
57
|
this.addAlias('cfn-loop-epic', 'cfn-epic');
|
|
56
58
|
|
|
59
|
+
// CFN Claude Sync - Sync CFN Loop rules from CLAUDE.md
|
|
60
|
+
this.register(new CfnClaudeSyncCommand());
|
|
61
|
+
this.addAlias('cfn-claude-sync', 'cfn-sync');
|
|
62
|
+
this.addAlias('cfn-claude-sync', 'sync');
|
|
63
|
+
|
|
57
64
|
// Core SPARC methodology command
|
|
58
65
|
this.register(new SparcCommand());
|
|
59
66
|
|
|
@@ -93,6 +100,11 @@ export class SlashCommandRegistry {
|
|
|
93
100
|
this.register(new CustomRoutingActivateCommand());
|
|
94
101
|
this.register(new CustomRoutingDeactivateCommand());
|
|
95
102
|
|
|
103
|
+
// Metrics summary command
|
|
104
|
+
this.register(new MetricsSummaryCommand());
|
|
105
|
+
this.addAlias('metrics-summary', 'metrics');
|
|
106
|
+
this.addAlias('metrics-summary', 'stats');
|
|
107
|
+
|
|
96
108
|
// Legacy function-based commands
|
|
97
109
|
this.registerLegacyCommand('claude-md', {
|
|
98
110
|
description: 'Generate CLAUDE.md configuration file',
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoint Compression Demonstration
|
|
3
|
+
*
|
|
4
|
+
* Shows 60% storage reduction through compression techniques
|
|
5
|
+
*/ import { CheckpointManager } from './checkpoint-manager.js';
|
|
6
|
+
async function demonstrateCompression() {
|
|
7
|
+
console.log('=== Checkpoint Compression Demonstration ===\n');
|
|
8
|
+
// Create checkpoint manager with compression enabled
|
|
9
|
+
const managerCompressed = new CheckpointManager('.claude-flow/checkpoints-compressed', true);
|
|
10
|
+
const managerUncompressed = new CheckpointManager('.claude-flow/checkpoints-raw', false);
|
|
11
|
+
// Create multiple checkpoints
|
|
12
|
+
console.log('Creating 10 checkpoints...\n');
|
|
13
|
+
for(let i = 1; i <= 10; i++){
|
|
14
|
+
const description = `Checkpoint ${i}: Implementation phase ${Math.floor(i / 3) + 1}`;
|
|
15
|
+
const agentId = `coder-${i % 3 + 1}`;
|
|
16
|
+
const taskId = `task-${Math.floor(i / 2) + 1}`;
|
|
17
|
+
// Create with compression
|
|
18
|
+
await managerCompressed.createCheckpoint(description, 'task', agentId, taskId, [
|
|
19
|
+
{
|
|
20
|
+
name: 'tests',
|
|
21
|
+
type: 'test',
|
|
22
|
+
command: 'npm test',
|
|
23
|
+
expected_result: true,
|
|
24
|
+
passed: true,
|
|
25
|
+
weight: 1.0,
|
|
26
|
+
execution_time_ms: 1000 + i * 100
|
|
27
|
+
},
|
|
28
|
+
{
|
|
29
|
+
name: 'lint',
|
|
30
|
+
type: 'lint',
|
|
31
|
+
command: 'npm run lint',
|
|
32
|
+
expected_result: true,
|
|
33
|
+
passed: true,
|
|
34
|
+
weight: 0.5,
|
|
35
|
+
execution_time_ms: 500 + i * 50
|
|
36
|
+
}
|
|
37
|
+
]);
|
|
38
|
+
// Create without compression (for comparison)
|
|
39
|
+
await managerUncompressed.createCheckpoint(description, 'task', agentId, taskId, [
|
|
40
|
+
{
|
|
41
|
+
name: 'tests',
|
|
42
|
+
type: 'test',
|
|
43
|
+
command: 'npm test',
|
|
44
|
+
expected_result: true,
|
|
45
|
+
passed: true,
|
|
46
|
+
weight: 1.0,
|
|
47
|
+
execution_time_ms: 1000 + i * 100
|
|
48
|
+
},
|
|
49
|
+
{
|
|
50
|
+
name: 'lint',
|
|
51
|
+
type: 'lint',
|
|
52
|
+
command: 'npm run lint',
|
|
53
|
+
expected_result: true,
|
|
54
|
+
passed: true,
|
|
55
|
+
weight: 0.5,
|
|
56
|
+
execution_time_ms: 500 + i * 50
|
|
57
|
+
}
|
|
58
|
+
]);
|
|
59
|
+
}
|
|
60
|
+
console.log('Checkpoints created successfully!\n');
|
|
61
|
+
// Get compression statistics
|
|
62
|
+
const stats = managerCompressed.getCompressionStats();
|
|
63
|
+
if (stats) {
|
|
64
|
+
console.log('=== COMPRESSION STATISTICS ===');
|
|
65
|
+
console.log(`Total Checkpoints: ${stats.totalCheckpoints}`);
|
|
66
|
+
console.log(`Original Size: ${stats.totalOriginalSize.toLocaleString()} bytes`);
|
|
67
|
+
console.log(`Compressed Size: ${stats.totalCompressedSize.toLocaleString()} bytes`);
|
|
68
|
+
console.log(`Total Savings: ${stats.totalSavings.toLocaleString()} bytes`);
|
|
69
|
+
console.log(`Compression Ratio: ${(stats.averageCompressionRatio * 100).toFixed(2)}% of original`);
|
|
70
|
+
console.log(`Storage Reduction: ${((1 - stats.averageCompressionRatio) * 100).toFixed(2)}%`);
|
|
71
|
+
console.log(`Shared State Count: ${stats.sharedStateCount}`);
|
|
72
|
+
console.log('\n=== COMPRESSION TECHNIQUES APPLIED ===');
|
|
73
|
+
console.log('1. Structural Optimization: Removed redundant fields');
|
|
74
|
+
console.log('2. Delta Compression: Subsequent checkpoints store only changes');
|
|
75
|
+
console.log('3. Deduplication: Shared state stored once, referenced multiple times');
|
|
76
|
+
console.log('4. Gzip Compression: Applied to validations and delta data (level 6)');
|
|
77
|
+
console.log('\n=== TARGET VALIDATION ===');
|
|
78
|
+
const reductionPercent = (1 - stats.averageCompressionRatio) * 100;
|
|
79
|
+
if (reductionPercent >= 60) {
|
|
80
|
+
console.log(`✅ SUCCESS: Achieved ${reductionPercent.toFixed(2)}% reduction (target: 60%)`);
|
|
81
|
+
} else {
|
|
82
|
+
console.log(`⚠️ PARTIAL: Achieved ${reductionPercent.toFixed(2)}% reduction (target: 60%)`);
|
|
83
|
+
console.log(' Note: Reduction varies with checkpoint size and similarity. Larger datasets show better compression.');
|
|
84
|
+
}
|
|
85
|
+
} else {
|
|
86
|
+
console.log('Compression is disabled for this manager.');
|
|
87
|
+
}
|
|
88
|
+
// Cleanup
|
|
89
|
+
console.log('\n=== CLEANUP ===');
|
|
90
|
+
await managerCompressed.cleanup(0); // Delete all checkpoints
|
|
91
|
+
await managerUncompressed.cleanup(0);
|
|
92
|
+
console.log('Cleanup complete.');
|
|
93
|
+
}
|
|
94
|
+
export { demonstrateCompression };
|
|
95
|
+
|
|
96
|
+
//# sourceMappingURL=checkpoint-compression-demo.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/verification/checkpoint-compression-demo.ts"],"names":["CheckpointManager","demonstrateCompression","console","log","managerCompressed","managerUncompressed","i","description","Math","floor","agentId","taskId","createCheckpoint","name","type","command","expected_result","passed","weight","execution_time_ms","stats","getCompressionStats","totalCheckpoints","totalOriginalSize","toLocaleString","totalCompressedSize","totalSavings","averageCompressionRatio","toFixed","sharedStateCount","reductionPercent","cleanup"],"mappings":"AAAA;;;;CAIC,GAED,SAASA,iBAAiB,QAAQ,0BAA0B;AAI5D,eAAeC;IACbC,QAAQC,GAAG,CAAC;IAEZ,qDAAqD;IACrD,MAAMC,oBAAoB,IAAIJ,kBAAkB,uCAAuC;IACvF,MAAMK,sBAAsB,IAAIL,kBAAkB,gCAAgC;IAElF,8BAA8B;IAC9BE,QAAQC,GAAG,CAAC;IAEZ,IAAK,IAAIG,IAAI,GAAGA,KAAK,IAAIA,IAAK;QAC5B,MAAMC,cAAc,CAAC,WAAW,EAAED,EAAE,uBAAuB,EAAEE,KAAKC,KAAK,CAACH,IAAI,KAAK,GAAG;QACpF,MAAMI,UAAU,CAAC,MAAM,EAAE,AAACJ,IAAI,IAAK,GAAG;QACtC,MAAMK,SAAS,CAAC,KAAK,EAAEH,KAAKC,KAAK,CAACH,IAAI,KAAK,GAAG;QAE9C,0BAA0B;QAC1B,MAAMF,kBAAkBQ,gBAAgB,CAACL,aAAa,QAAQG,SAASC,QAAQ;YAC7E;gBACEE,MAAM;gBACNC,MAAM;gBACNC,SAAS;gBACTC,iBAAiB;gBACjBC,QAAQ;gBACRC,QAAQ;gBACRC,mBAAmB,OAAOb,IAAI;YAChC;YACA;gBACEO,MAAM;gBACNC,MAAM;gBACNC,SAAS;gBACTC,iBAAiB;gBACjBC,QAAQ;gBACRC,QAAQ;gBACRC,mBAAmB,MAAMb,IAAI;YAC/B;SACD;QAED,8CAA8C;QAC9C,MAAMD,oBAAoBO,gBAAgB,CAACL,aAAa,QAAQG,SAASC,QAAQ;YAC/E;gBACEE,MAAM;gBACNC,MAAM;gBACNC,SAAS;gBACTC,iBAAiB;gBACjBC,QAAQ;gBACRC,QAAQ;gBACRC,mBAAmB,OAAOb,IAAI;YAChC;YACA;gBACEO,MAAM;gBACNC,MAAM;gBACNC,SAAS;gBACTC,iBAAiB;gBACjBC,QAAQ;gBACRC,QAAQ;gBACRC,mBAAmB,MAAMb,IAAI;YAC/B;SACD;IACH;IAEAJ,QAAQC,GAAG,CAAC;IAEZ,6BAA6B;IAC7B,MAAMiB,QAAQhB,kBAAkBiB,mBAAmB;IAEnD,IAAID,OAAO;QACTlB,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC,CAAC,mBAAmB,EAAEiB,MAAME,gBAAgB,EAAE;QAC1DpB,QAAQC,GAAG,CAAC,CAAC,eAAe,EAAEiB,MAAMG,iBAAiB,CAACC,cAAc,GAAG,MAAM,CAAC;QAC9EtB,QAAQC,GAAG,CAAC,CAAC,iBAAiB,EAAEiB,MAAMK,mBAAmB,CAACD,cAAc,GAAG,MAAM,CAAC;QAClFtB,QAAQC,GAAG,CAAC,CAAC,eAAe,EAAEiB,MAAMM,YAAY,CAACF,cAAc,GAAG,MAAM,CAAC;QACzEtB,QAAQC,GAAG,CACT,CAAC,mBAAmB,EAAE,AAACiB,CAAAA,MAAMO,uBAAuB,GAAG,GAAE,EAAGC,OAAO,CAAC,GAAG,aAAa,CAAC;QAEvF1B,QAAQC,GAAG,CAAC,CAAC,mBAAmB,EAAE,AAAC,CAAA,AAAC,CAAA,IAAIiB,MAAMO,uBAAuB,AAAD,IAAK,GAAE,EAAGC,OAAO,CAAC,GAAG,CAAC,CAAC;QAC3F1B,QAAQC,GAAG,CAAC,CAAC,oBAAoB,EAAEiB,MAAMS,gBAAgB,EAAE;QAE3D3B,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QACZD,QAAQC,GAAG,CAAC;QAEZD,QAAQC,GAAG,CAAC;QACZ,MAAM2B,mBAAmB,AAAC,CAAA,IAAIV,MAAMO,uBAAuB,AAAD,IAAK;QAC/D,IAAIG,oBAAoB,IAAI;YAC1B5B,QAAQC,GAAG,CAAC,CAAC,oBAAoB,EAAE2B,iBAAiBF,OAAO,CAAC,GAAG,yBAAyB,CAAC;QAC3F,OAAO;YACL1B,QAAQC,GAAG,CACT,CAAC,sBAAsB,EAAE2B,iBAAiBF,OAAO,CAAC,GAAG,yBAAyB,CAAC;YAEjF1B,QAAQC,GAAG,CACT;QAEJ;IACF,OAAO;QACLD,QAAQC,GAAG,CAAC;IACd;IAEA,UAAU;IACVD,QAAQC,GAAG,CAAC;IACZ,MAAMC,kBAAkB2B,OAAO,CAAC,IAAI,yBAAyB;IAC7D,MAAM1B,oBAAoB0B,OAAO,CAAC;IAClC7B,QAAQC,GAAG,CAAC;AACd;AAEA,SAASF,sBAAsB,GAAG"}
|