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,318 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Checkpoint Compressor - Multi-layer compression for state snapshots
|
|
3
|
+
*
|
|
4
|
+
* Compression Strategy:
|
|
5
|
+
* 1. Structural compression (MessagePack binary encoding)
|
|
6
|
+
* 2. Delta encoding (reference previous checkpoints)
|
|
7
|
+
* 3. Deduplication (shared data structures)
|
|
8
|
+
* 4. Gzip final pass
|
|
9
|
+
*
|
|
10
|
+
* Target: ≥60% compression ratio
|
|
11
|
+
*
|
|
12
|
+
* @module coordination/v2/checkpoints/checkpoint-compressor
|
|
13
|
+
*/ import { gzip, gunzip } from 'zlib';
|
|
14
|
+
import { promisify } from 'util';
|
|
15
|
+
import * as msgpack from 'msgpack-lite';
|
|
16
|
+
import { createHash } from 'crypto';
|
|
17
|
+
const gzipAsync = promisify(gzip);
|
|
18
|
+
const gunzipAsync = promisify(gunzip);
|
|
19
|
+
/**
|
|
20
|
+
* Checkpoint Compressor - Multi-layer compression engine
|
|
21
|
+
*/ export class CheckpointCompressor {
|
|
22
|
+
previousCheckpoints = new Map();
|
|
23
|
+
maxPreviousCheckpoints = 10;
|
|
24
|
+
minCompressionRatio = 0.6;
|
|
25
|
+
/**
|
|
26
|
+
* Compress checkpoint data with multi-layer strategy
|
|
27
|
+
*
|
|
28
|
+
* @param data - State snapshot to compress
|
|
29
|
+
* @param sessionId - Session identifier for delta compression
|
|
30
|
+
* @param previousCheckpointId - Optional reference for delta compression
|
|
31
|
+
* @returns Compression result with metrics
|
|
32
|
+
*/ async compress(data, sessionId, previousCheckpointId) {
|
|
33
|
+
const uncompressedData = JSON.stringify(data);
|
|
34
|
+
const uncompressedSize = Buffer.byteLength(uncompressedData, 'utf8');
|
|
35
|
+
// Try delta compression if previous checkpoint available
|
|
36
|
+
if (previousCheckpointId && this.previousCheckpoints.has(previousCheckpointId)) {
|
|
37
|
+
const deltaResult = await this.compressWithDelta(data, sessionId, previousCheckpointId, uncompressedSize);
|
|
38
|
+
if (deltaResult.compressionRatio >= this.minCompressionRatio) {
|
|
39
|
+
return deltaResult;
|
|
40
|
+
}
|
|
41
|
+
// Fall back to full compression if delta didn't achieve target
|
|
42
|
+
console.warn(`Delta compression ratio ${deltaResult.compressionRatio.toFixed(2)} below target ${this.minCompressionRatio}, using full compression`);
|
|
43
|
+
}
|
|
44
|
+
// Full compression: MessagePack + deduplication + gzip
|
|
45
|
+
return this.compressFull(data, sessionId, uncompressedSize);
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Decompress checkpoint data
|
|
49
|
+
*
|
|
50
|
+
* @param compressedBuffer - Compressed data buffer
|
|
51
|
+
* @param compressionStrategy - Strategy used for compression
|
|
52
|
+
* @param referenceCheckpointId - Reference checkpoint for delta decompression
|
|
53
|
+
* @returns Decompressed data
|
|
54
|
+
*/ async decompress(compressedBuffer, compressionStrategy, referenceCheckpointId) {
|
|
55
|
+
const startTime = performance.now();
|
|
56
|
+
if (compressionStrategy === 'delta' && referenceCheckpointId) {
|
|
57
|
+
const data = await this.decompressDelta(compressedBuffer, referenceCheckpointId);
|
|
58
|
+
return {
|
|
59
|
+
data,
|
|
60
|
+
latencyMs: performance.now() - startTime
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
// Full decompression: gunzip + MessagePack decode
|
|
64
|
+
const data = await this.decompressFull(compressedBuffer);
|
|
65
|
+
return {
|
|
66
|
+
data,
|
|
67
|
+
latencyMs: performance.now() - startTime
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Full compression: MessagePack + gzip (with small data optimization)
|
|
72
|
+
*/ async compressFull(data, sessionId, uncompressedSize) {
|
|
73
|
+
// Step 1: Deduplication (extract shared structures)
|
|
74
|
+
const deduplicated = this.deduplicateData(data);
|
|
75
|
+
// Step 2: MessagePack encoding (structural compression)
|
|
76
|
+
const msgpackBuffer = msgpack.encode(deduplicated);
|
|
77
|
+
// Step 3: Gzip compression (skip for tiny data to avoid overhead)
|
|
78
|
+
let compressedBuffer;
|
|
79
|
+
if (msgpackBuffer.length < 256) {
|
|
80
|
+
// For small data, gzip overhead exceeds savings - use MessagePack only
|
|
81
|
+
compressedBuffer = msgpackBuffer;
|
|
82
|
+
} else {
|
|
83
|
+
// For larger data, apply gzip with maximum compression
|
|
84
|
+
compressedBuffer = await gzipAsync(msgpackBuffer, {
|
|
85
|
+
level: 9
|
|
86
|
+
});
|
|
87
|
+
// Fallback: if gzip made it bigger, use MessagePack only
|
|
88
|
+
if (compressedBuffer.length > msgpackBuffer.length) {
|
|
89
|
+
compressedBuffer = msgpackBuffer;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
const compressedSize = compressedBuffer.length;
|
|
93
|
+
const compressionRatio = 1 - compressedSize / uncompressedSize;
|
|
94
|
+
// Store for potential delta compression
|
|
95
|
+
this.storePreviousCheckpoint(sessionId, data);
|
|
96
|
+
return {
|
|
97
|
+
compressedBuffer,
|
|
98
|
+
uncompressedSize,
|
|
99
|
+
compressedSize,
|
|
100
|
+
compressionRatio,
|
|
101
|
+
strategy: 'full'
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Delta compression: Encode differences from previous checkpoint
|
|
106
|
+
*/ async compressWithDelta(data, sessionId, previousCheckpointId, uncompressedSize) {
|
|
107
|
+
const previousData = this.previousCheckpoints.get(previousCheckpointId);
|
|
108
|
+
if (!previousData) {
|
|
109
|
+
// Fallback to full compression
|
|
110
|
+
return this.compressFull(data, sessionId, uncompressedSize);
|
|
111
|
+
}
|
|
112
|
+
// Calculate delta (differences only)
|
|
113
|
+
const delta = this.calculateDelta(previousData, data);
|
|
114
|
+
// Compress delta with MessagePack + gzip
|
|
115
|
+
const msgpackBuffer = msgpack.encode({
|
|
116
|
+
_delta: true,
|
|
117
|
+
_reference: previousCheckpointId,
|
|
118
|
+
changes: delta
|
|
119
|
+
});
|
|
120
|
+
const compressedBuffer = await gzipAsync(msgpackBuffer, {
|
|
121
|
+
level: 9
|
|
122
|
+
});
|
|
123
|
+
const compressedSize = compressedBuffer.length;
|
|
124
|
+
const compressionRatio = 1 - compressedSize / uncompressedSize;
|
|
125
|
+
// Store for future delta compression
|
|
126
|
+
this.storePreviousCheckpoint(sessionId, data);
|
|
127
|
+
return {
|
|
128
|
+
compressedBuffer,
|
|
129
|
+
uncompressedSize,
|
|
130
|
+
compressedSize,
|
|
131
|
+
compressionRatio,
|
|
132
|
+
strategy: 'delta',
|
|
133
|
+
referenceCheckpointId: previousCheckpointId
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Decompress full checkpoint
|
|
138
|
+
*/ async decompressFull(compressedBuffer) {
|
|
139
|
+
// Step 1: Gunzip
|
|
140
|
+
const msgpackBuffer = await gunzipAsync(compressedBuffer);
|
|
141
|
+
// Step 2: MessagePack decode
|
|
142
|
+
const data = msgpack.decode(msgpackBuffer);
|
|
143
|
+
return data;
|
|
144
|
+
}
|
|
145
|
+
/**
|
|
146
|
+
* Decompress delta checkpoint
|
|
147
|
+
*/ async decompressDelta(compressedBuffer, referenceCheckpointId) {
|
|
148
|
+
const previousData = this.previousCheckpoints.get(referenceCheckpointId);
|
|
149
|
+
if (!previousData) {
|
|
150
|
+
throw new Error(`Reference checkpoint ${referenceCheckpointId} not found for delta decompression`);
|
|
151
|
+
}
|
|
152
|
+
// Decompress delta
|
|
153
|
+
const msgpackBuffer = await gunzipAsync(compressedBuffer);
|
|
154
|
+
const deltaPackage = msgpack.decode(msgpackBuffer);
|
|
155
|
+
if (!deltaPackage._delta) {
|
|
156
|
+
throw new Error('Invalid delta checkpoint format');
|
|
157
|
+
}
|
|
158
|
+
// Apply delta to previous data
|
|
159
|
+
const reconstructed = this.applyDelta(previousData, deltaPackage.changes);
|
|
160
|
+
return reconstructed;
|
|
161
|
+
}
|
|
162
|
+
/**
|
|
163
|
+
* Calculate delta between previous and current data
|
|
164
|
+
*/ calculateDelta(previous, current) {
|
|
165
|
+
const delta = {};
|
|
166
|
+
// Find added/modified keys
|
|
167
|
+
for (const [key, value] of Object.entries(current)){
|
|
168
|
+
const previousValue = previous[key];
|
|
169
|
+
if (previousValue === undefined) {
|
|
170
|
+
// New key
|
|
171
|
+
delta[key] = {
|
|
172
|
+
_op: 'add',
|
|
173
|
+
value
|
|
174
|
+
};
|
|
175
|
+
} else if (JSON.stringify(previousValue) !== JSON.stringify(value)) {
|
|
176
|
+
// Modified key
|
|
177
|
+
if (typeof value === 'object' && value !== null && !Array.isArray(value)) {
|
|
178
|
+
// Nested object - recurse
|
|
179
|
+
delta[key] = {
|
|
180
|
+
_op: 'modify',
|
|
181
|
+
delta: this.calculateDelta(previousValue, value)
|
|
182
|
+
};
|
|
183
|
+
} else {
|
|
184
|
+
// Primitive or array - replace
|
|
185
|
+
delta[key] = {
|
|
186
|
+
_op: 'replace',
|
|
187
|
+
value
|
|
188
|
+
};
|
|
189
|
+
}
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
// Find deleted keys
|
|
193
|
+
for (const key of Object.keys(previous)){
|
|
194
|
+
if (!(key in current)) {
|
|
195
|
+
delta[key] = {
|
|
196
|
+
_op: 'delete'
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
}
|
|
200
|
+
return delta;
|
|
201
|
+
}
|
|
202
|
+
/**
|
|
203
|
+
* Apply delta to reconstruct current data from previous
|
|
204
|
+
*/ applyDelta(previous, delta) {
|
|
205
|
+
const result = {
|
|
206
|
+
...previous
|
|
207
|
+
};
|
|
208
|
+
for (const [key, change] of Object.entries(delta)){
|
|
209
|
+
const op = change._op;
|
|
210
|
+
if (op === 'add' || op === 'replace') {
|
|
211
|
+
result[key] = change.value;
|
|
212
|
+
} else if (op === 'delete') {
|
|
213
|
+
delete result[key];
|
|
214
|
+
} else if (op === 'modify') {
|
|
215
|
+
result[key] = this.applyDelta(previous[key], change.delta);
|
|
216
|
+
}
|
|
217
|
+
}
|
|
218
|
+
return result;
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Deduplicate data structures (extract shared patterns)
|
|
222
|
+
*/ deduplicateData(data) {
|
|
223
|
+
const sharedStructures = new Map();
|
|
224
|
+
const deduplicatedData = this.deduplicateRecursive(data, sharedStructures);
|
|
225
|
+
// Only wrap if deduplication found shared structures
|
|
226
|
+
if (sharedStructures.size > 0) {
|
|
227
|
+
return {
|
|
228
|
+
_deduplicated: true,
|
|
229
|
+
_shared: Array.from(sharedStructures.entries()),
|
|
230
|
+
data: deduplicatedData
|
|
231
|
+
};
|
|
232
|
+
}
|
|
233
|
+
// No shared structures found, return original
|
|
234
|
+
return deduplicatedData;
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Recursive deduplication helper
|
|
238
|
+
*/ deduplicateRecursive(obj, sharedStructures, depth = 0) {
|
|
239
|
+
if (depth > 10 || obj === null || typeof obj !== 'object') {
|
|
240
|
+
return obj;
|
|
241
|
+
}
|
|
242
|
+
// For arrays - detect repeated patterns
|
|
243
|
+
if (Array.isArray(obj)) {
|
|
244
|
+
if (obj.length > 3) {
|
|
245
|
+
// Check if all items are identical
|
|
246
|
+
const firstItemStr = JSON.stringify(obj[0]);
|
|
247
|
+
const allIdentical = obj.every((item)=>JSON.stringify(item) === firstItemStr);
|
|
248
|
+
if (allIdentical && obj.length > 5) {
|
|
249
|
+
// Store pattern and return reference
|
|
250
|
+
const hash = this.hashObject(obj[0]);
|
|
251
|
+
if (!sharedStructures.has(hash)) {
|
|
252
|
+
sharedStructures.set(hash, obj[0]);
|
|
253
|
+
}
|
|
254
|
+
return {
|
|
255
|
+
_repeat: obj.length,
|
|
256
|
+
_ref: hash
|
|
257
|
+
};
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
return obj.map((item)=>this.deduplicateRecursive(item, sharedStructures, depth + 1));
|
|
261
|
+
}
|
|
262
|
+
// For objects - check for duplicate structures
|
|
263
|
+
const hash = this.hashObject(obj);
|
|
264
|
+
const existingStructures = Array.from(sharedStructures.keys());
|
|
265
|
+
// Find if this exact structure already exists
|
|
266
|
+
for (const existingHash of existingStructures){
|
|
267
|
+
const existing = sharedStructures.get(existingHash);
|
|
268
|
+
if (JSON.stringify(existing) === JSON.stringify(obj)) {
|
|
269
|
+
return {
|
|
270
|
+
_ref: existingHash
|
|
271
|
+
};
|
|
272
|
+
}
|
|
273
|
+
}
|
|
274
|
+
// New structure - recurse into properties
|
|
275
|
+
const deduplicated = {};
|
|
276
|
+
for (const [key, value] of Object.entries(obj)){
|
|
277
|
+
deduplicated[key] = this.deduplicateRecursive(value, sharedStructures, depth + 1);
|
|
278
|
+
}
|
|
279
|
+
return deduplicated;
|
|
280
|
+
}
|
|
281
|
+
/**
|
|
282
|
+
* Hash object for deduplication
|
|
283
|
+
*/ hashObject(obj) {
|
|
284
|
+
const json = JSON.stringify(obj, Object.keys(obj || {}).sort());
|
|
285
|
+
return createHash('sha256').update(json).digest('hex').substring(0, 8);
|
|
286
|
+
}
|
|
287
|
+
/**
|
|
288
|
+
* Store previous checkpoint for delta compression
|
|
289
|
+
*/ storePreviousCheckpoint(sessionId, data) {
|
|
290
|
+
const checkpointId = `${sessionId}-${Date.now()}`;
|
|
291
|
+
this.previousCheckpoints.set(checkpointId, data);
|
|
292
|
+
// Maintain LRU cache
|
|
293
|
+
if (this.previousCheckpoints.size > this.maxPreviousCheckpoints) {
|
|
294
|
+
const oldestKey = Array.from(this.previousCheckpoints.keys())[0];
|
|
295
|
+
this.previousCheckpoints.delete(oldestKey);
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
/**
|
|
299
|
+
* Clear compression cache
|
|
300
|
+
*/ clearCache() {
|
|
301
|
+
this.previousCheckpoints.clear();
|
|
302
|
+
}
|
|
303
|
+
/**
|
|
304
|
+
* Get compression statistics
|
|
305
|
+
*/ getStats() {
|
|
306
|
+
let totalSize = 0;
|
|
307
|
+
const values = Array.from(this.previousCheckpoints.values());
|
|
308
|
+
for (const data of values){
|
|
309
|
+
totalSize += Buffer.byteLength(JSON.stringify(data), 'utf8');
|
|
310
|
+
}
|
|
311
|
+
return {
|
|
312
|
+
cachedCheckpoints: this.previousCheckpoints.size,
|
|
313
|
+
cacheMemoryMB: totalSize / (1024 * 1024)
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
}
|
|
317
|
+
|
|
318
|
+
//# sourceMappingURL=checkpoint-compressor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/coordination/v2/checkpoints/checkpoint-compressor.ts"],"names":["gzip","gunzip","promisify","msgpack","createHash","gzipAsync","gunzipAsync","CheckpointCompressor","previousCheckpoints","Map","maxPreviousCheckpoints","minCompressionRatio","compress","data","sessionId","previousCheckpointId","uncompressedData","JSON","stringify","uncompressedSize","Buffer","byteLength","has","deltaResult","compressWithDelta","compressionRatio","console","warn","toFixed","compressFull","decompress","compressedBuffer","compressionStrategy","referenceCheckpointId","startTime","performance","now","decompressDelta","latencyMs","decompressFull","deduplicated","deduplicateData","msgpackBuffer","encode","length","level","compressedSize","storePreviousCheckpoint","strategy","previousData","get","delta","calculateDelta","_delta","_reference","changes","decode","Error","deltaPackage","reconstructed","applyDelta","previous","current","key","value","Object","entries","previousValue","undefined","_op","Array","isArray","keys","result","change","op","sharedStructures","deduplicatedData","deduplicateRecursive","size","_deduplicated","_shared","from","obj","depth","firstItemStr","allIdentical","every","item","hash","hashObject","set","_repeat","_ref","map","existingStructures","existingHash","existing","json","sort","update","digest","substring","checkpointId","Date","oldestKey","delete","clearCache","clear","getStats","totalSize","values","cachedCheckpoints","cacheMemoryMB"],"mappings":"AAAA;;;;;;;;;;;;CAYC,GAED,SAASA,IAAI,EAAEC,MAAM,QAAQ,OAAO;AACpC,SAASC,SAAS,QAAQ,OAAO;AACjC,YAAYC,a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