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 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/coordination/v2/deadlock/resource-manager.ts"],"names":["EventEmitter","Logger","ResourceType","ResourceManager","logger","config","allocations","Map","waitQueues","agentResources","waitForGraph","resourceOrder","nextOrderNumber","overheadSamples","MAX_SAMPLES","metrics","totalAllocations","activeAllocations","totalRequests","pendingRequests","deadlocksDetected","timeoutReleases","averageOverheadMs","p95OverheadMs","allocationsByType","cleanupTimer","deadlockCheckTimer","operationLock","Promise","resolve","level","format","destination","namespace","defaultTimeoutMs","maxResourcesPerAgent","enableDeadlockDetection","deadlockCheckIntervalMs","enableResourceOrdering","cleanupIntervalMs","initialize","info","setInterval","cleanup","catch","err","error","checkForDeadlocks","emit","shutdown","clearInterval","undefined","withLock","allAllocations","Array","from","entries","resourceId","allocation","releaseInternal","holderId","clear","acquire","agentId","priority","timeoutMs","startTime","performance","now","timeout","request","timestamp","Date","enqueuedAt","get","debug","agentResourceCount","size","Error","enforceResourceOrdering","has","allocateResource","addToWaitQueue","waitForResource","overhead","trackOverhead","overheadMs","toFixed","message","String","release","releaseAll","resources","resourceCount","releases","map","all","getAllocations","getAgentResources","Set","detectCircularWaits","cycles","visited","recursionStack","path","detectCycle","add","push","edges","edge","holder","cycleStartIndex","indexOf","cycleAgents","slice","cycleResources","filter","e","includes","agents","detectedAt","pop","delete","allAgents","keys","length","warn","count","c","getMetrics","values","reduce","sum","queue","sorted","sort","a","b","val","p95Index","Math","floor","getHealthStatus","healthy","overheadPercentage","operation","currentLock","resolveLock","set","type","getResourceType","allocatedAt","currentCount","removeFromWaitGraph","actualHolder","max","processWaitQueue","sortWaitQueue","addToWaitGraph","queueLength","ageA","ageB","effectivePriorityA","effectivePriorityB","reject","checkInterval","stillWaiting","some","req","index","findIndex","splice","nextRequest","shift","requestedOrder","heldResources","heldResourceId","heldOrder","waiter","existing","find","waitingSince","filtered","allQueues","age","getTime","ageMs","staleThreshold","startsWith"],"mappings":"AAAA;;;;;;;;;;;;;;;;CAgBC,GAED,SAASA,YAAY,QAAQ,cAAc;AAC3C,SAASC,MAAM,QAAQ,0BAA0B;AAEjD;;CAEC,GACD,OAAO,IAAA,AAAKC,sCAAAA;IACV,mCAAmC;IAEnC,qBAAqB;IAErB,yBAAyB;IAEzB,wBAAwB;IAExB,mBAAmB;IAEnB,2BAA2B;IAE3B,4BAA4B;WAblBA;MAeX;AA4ID;;;;;;;;;;;;;;;;;;;;;;;;CAwBC,GACD,OAAO,MAAMC,wBAAwBH;IAClBI,OAAe;IACfC,OAA8B;IAE/C,0DAA0D,GAC1D,AAAQC,cAAc,IAAIC,MAAkC;IAE5D,0DAA0D,GAC1D,AAAQC,aAAa,IAAID,MAAiC;IAE1D,2DAA2D,GAC3D,AAAQE,iBAAiB,IAAIF,MAA2B;IAExD,gDAAgD,GAChD,AAAQG,eAAe,IAAIH,MAA6B;IAExD,2EAA2E,GAC3E,AAAQI,gBAAgB,IAAIJ,MAAsB;IAC1CK,kBAAkB,EAAE;IAE5B,yBAAyB,GACzB,AAAQC,kBAA4B,EAAE,CAAC;IACtBC,cAAc,KAAK;IAEpC,YAAY,GACZ,AAAQC,UAAkC;QACxCC,kBAAkB;QAClBC,mBAAmB;QACnBC,eAAe;QACfC,iBAAiB;QACjBC,mBAAmB;QACnBC,iBAAiB;QACjBC,mBAAmB;QACnBC,eAAe;QACfC,mBAAmB,IAAIjB;IACzB,EAAE;IAEF,mBAAmB,GACnB,AAAQkB,aAA8B;IAC9BC,mBAAoC;IAE5C,6CAA6C,GAC7C,AAAQC,gBAAgBC,QAAQC,OAAO,GAAG;IAE1C,YAAYxB,SAAyC,CAAC,CAAC,CAAE;QACvD,KAAK;QACL,IAAI,CAACD,MAAM,GAAG,IAAIH,OAChB;YACE6B,OAAO;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oBACxB,IAAI,CAACvL,MAAM,CAAC0H,IAAI,CAAC,8BAA8B;wBAC7CrE;wBACAM,SAASL,WAAWE,QAAQ;wBAC5B8H,OAAOF;oBACT;oBACA,IAAI,CAACzK,OAAO,CAACM,eAAe;oBAC5B,MAAM,IAAI,CAACsC,eAAe,CAACD,WAAWE,QAAQ,EAAEH;gBAClD;YACF;QACF;IACF;IAEA;;GAEC,GACD,MAAcV,oBAAmC;QAC/C,MAAMsD,SAAS,IAAI,CAACD,mBAAmB;QACvC,IAAIC,OAAOwB,MAAM,GAAG,GAAG;YACrB,IAAI,CAACzH,MAAM,CAAC0C,KAAK,CAAC,4CAA4C;gBAC5DiF,OAAO1B,OAAOwB,MAAM;gBACpBxB;YACF;QACF;IACF;IAEA;;GAEC,GACD,AAAQiD,gBAAgB7F,UAAkB,EAAgB;QACxD,IAAIA,WAAWmI,UAAU,CAAC,UAAU;QACpC,IAAInI,WAAWmI,UAAU,CAAC,YAAY;QACtC,IAAInI,WAAWmI,UAAU,CAAC,SAAS;QACnC,IAAInI,WAAWmI,UAAU,CAAC,QAAQ;QAClC,IAAInI,WAAWmI,UAAU,CAAC,SAAS;QACnC,IAAInI,WAAWmI,UAAU,CAAC,SAAS;QACnC;IACF;IAEA;;GAEC,GACD,AAAQvG,cAAcC,UAAkB,EAAQ;QAC9C,IAAI,CAACzE,eAAe,CAAC8F,IAAI,CAACrB;QAE1B,2BAA2B;QAC3B,IAAI,IAAI,CAACzE,eAAe,CAACgH,MAAM,GAAG,IAAI,CAAC/G,WAAW,EAAE;YAClD,IAAI,CAACD,eAAe,CAACgK,KAAK;QAC5B;IACF;AACF"}
|
|
@@ -0,0 +1,451 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Agent Coordination V2 - Dependency Artifact Storage Backend
|
|
3
|
+
*
|
|
4
|
+
* Binary-optimized storage backend for dependency graph artifacts using
|
|
5
|
+
* MessagePack serialization and gzip compression.
|
|
6
|
+
*
|
|
7
|
+
* Performance targets:
|
|
8
|
+
* - Storage latency: <12ms (p95) - 3.7x faster than JSON baseline (45ms)
|
|
9
|
+
* - Compression ratio: 60-70% size reduction
|
|
10
|
+
* - Indexed lookups: O(1) binary search
|
|
11
|
+
*
|
|
12
|
+
* @module coordination/v2/dependency/artifact-storage
|
|
13
|
+
*/ import { promises as fs } from 'fs';
|
|
14
|
+
import { join } from 'path';
|
|
15
|
+
import { gzip, gunzip } from 'zlib';
|
|
16
|
+
import { promisify } from 'util';
|
|
17
|
+
import { createHash } from 'crypto';
|
|
18
|
+
import * as msgpack from 'msgpack-lite';
|
|
19
|
+
const gzipAsync = promisify(gzip);
|
|
20
|
+
const gunzipAsync = promisify(gunzip);
|
|
21
|
+
/**
|
|
22
|
+
* DependencyArtifactStorage - High-performance binary storage backend
|
|
23
|
+
*
|
|
24
|
+
* Features:
|
|
25
|
+
* - MessagePack binary serialization (smaller payload vs JSON)
|
|
26
|
+
* - Gzip compression (60-70% size reduction)
|
|
27
|
+
* - Indexed binary lookups (O(1) access via in-memory index)
|
|
28
|
+
* - Integrity verification (SHA-256 checksums)
|
|
29
|
+
* - In-memory LRU cache (configurable size)
|
|
30
|
+
* - Performance monitoring (latency tracking, compression metrics)
|
|
31
|
+
*
|
|
32
|
+
* Storage format:
|
|
33
|
+
* - Index file: JSON mapping keys to file offsets
|
|
34
|
+
* - Data file: Binary stream of compressed MessagePack entries
|
|
35
|
+
*
|
|
36
|
+
* @example
|
|
37
|
+
* ```typescript
|
|
38
|
+
* const storage = new DependencyArtifactStorage({
|
|
39
|
+
* storagePath: '.claude-flow/artifacts/dependencies',
|
|
40
|
+
* cacheSize: 100
|
|
41
|
+
* });
|
|
42
|
+
* await storage.initialize();
|
|
43
|
+
*
|
|
44
|
+
* // Store dependency DAG
|
|
45
|
+
* await storage.store('graph-123', graphData);
|
|
46
|
+
*
|
|
47
|
+
* // Retrieve with <12ms latency
|
|
48
|
+
* const data = await storage.retrieve('graph-123');
|
|
49
|
+
*
|
|
50
|
+
* console.log(storage.getMetrics().p95StoreLatencyMs); // Target: <12ms
|
|
51
|
+
* ```
|
|
52
|
+
*/ export class DependencyArtifactStorage {
|
|
53
|
+
storagePath;
|
|
54
|
+
indexPath;
|
|
55
|
+
dataPath;
|
|
56
|
+
index;
|
|
57
|
+
cache;
|
|
58
|
+
cacheSize;
|
|
59
|
+
metrics;
|
|
60
|
+
latencyBuffer;
|
|
61
|
+
ready = false;
|
|
62
|
+
/**
|
|
63
|
+
* Creates a new dependency artifact storage backend
|
|
64
|
+
*
|
|
65
|
+
* @param config - Storage configuration
|
|
66
|
+
*/ constructor(config = {}){
|
|
67
|
+
this.storagePath = config.storagePath || '.claude-flow/artifacts/dependencies';
|
|
68
|
+
this.indexPath = join(this.storagePath, 'index.json');
|
|
69
|
+
this.dataPath = join(this.storagePath, 'data.bin');
|
|
70
|
+
this.index = new Map();
|
|
71
|
+
this.cache = new Map();
|
|
72
|
+
this.cacheSize = config.cacheSize || 100; // LRU cache size
|
|
73
|
+
this.metrics = this.initializeMetrics();
|
|
74
|
+
this.latencyBuffer = [];
|
|
75
|
+
}
|
|
76
|
+
// ===========================
|
|
77
|
+
// Lifecycle
|
|
78
|
+
// ===========================
|
|
79
|
+
/**
|
|
80
|
+
* Initialize storage backend
|
|
81
|
+
*
|
|
82
|
+
* Creates directories and loads existing index.
|
|
83
|
+
*/ async initialize() {
|
|
84
|
+
if (this.ready) return;
|
|
85
|
+
// Create storage directory
|
|
86
|
+
await fs.mkdir(this.storagePath, {
|
|
87
|
+
recursive: true
|
|
88
|
+
});
|
|
89
|
+
// Load existing index
|
|
90
|
+
await this.loadIndex();
|
|
91
|
+
this.ready = true;
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Close storage and persist index
|
|
95
|
+
*/ async close() {
|
|
96
|
+
if (!this.ready) return;
|
|
97
|
+
await this.persistIndex();
|
|
98
|
+
this.ready = false;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Check if storage is ready
|
|
102
|
+
*/ isReady() {
|
|
103
|
+
return this.ready;
|
|
104
|
+
}
|
|
105
|
+
// ===========================
|
|
106
|
+
// Core Storage Operations
|
|
107
|
+
// ===========================
|
|
108
|
+
/**
|
|
109
|
+
* Store artifact with binary serialization and compression
|
|
110
|
+
*
|
|
111
|
+
* Performance target: <12ms (p95)
|
|
112
|
+
*
|
|
113
|
+
* @param key - Unique artifact key
|
|
114
|
+
* @param data - Data to store (any JSON-serializable object)
|
|
115
|
+
* @throws Error if storage fails or key is invalid
|
|
116
|
+
*/ async store(key, data) {
|
|
117
|
+
this.ensureReady();
|
|
118
|
+
const startTime = Date.now();
|
|
119
|
+
try {
|
|
120
|
+
// Validate key
|
|
121
|
+
if (!key || typeof key !== 'string') {
|
|
122
|
+
throw new Error('Invalid artifact key');
|
|
123
|
+
}
|
|
124
|
+
// 1. Serialize with MessagePack (binary format)
|
|
125
|
+
const packed = msgpack.encode(data);
|
|
126
|
+
const uncompressedSize = packed.length;
|
|
127
|
+
// 2. Compress with gzip
|
|
128
|
+
const compressed = await gzipAsync(packed);
|
|
129
|
+
const compressedSize = compressed.length;
|
|
130
|
+
// 3. Calculate checksum
|
|
131
|
+
const checksum = this.calculateChecksum(compressed);
|
|
132
|
+
// 4. Append to data file
|
|
133
|
+
const offset = await this.appendToDataFile(compressed);
|
|
134
|
+
// 5. Update index
|
|
135
|
+
const compressionRatio = 1 - compressedSize / uncompressedSize;
|
|
136
|
+
const indexEntry = {
|
|
137
|
+
key,
|
|
138
|
+
offset,
|
|
139
|
+
size: compressedSize,
|
|
140
|
+
checksum,
|
|
141
|
+
timestamp: Date.now(),
|
|
142
|
+
uncompressedSize,
|
|
143
|
+
compressionRatio
|
|
144
|
+
};
|
|
145
|
+
this.index.set(key, indexEntry);
|
|
146
|
+
// 6. Update cache (LRU eviction)
|
|
147
|
+
this.updateCache(key, data);
|
|
148
|
+
// 7. Persist index
|
|
149
|
+
await this.persistIndex();
|
|
150
|
+
// Update metrics
|
|
151
|
+
const latency = Date.now() - startTime;
|
|
152
|
+
this.updateStoreMetrics(latency, uncompressedSize, compressedSize);
|
|
153
|
+
// Performance warning if exceeds target
|
|
154
|
+
if (latency > 12) {
|
|
155
|
+
console.warn(`[DependencyArtifactStorage] Store latency ${latency}ms exceeds 12ms target for key ${key}`);
|
|
156
|
+
}
|
|
157
|
+
} catch (error) {
|
|
158
|
+
throw new Error(`Failed to store artifact ${key}: ${error instanceof Error ? error.message : String(error)}`);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
/**
|
|
162
|
+
* Retrieve artifact with decompression and deserialization
|
|
163
|
+
*
|
|
164
|
+
* Performance target: <12ms (p95)
|
|
165
|
+
*
|
|
166
|
+
* @param key - Artifact key
|
|
167
|
+
* @returns Deserialized data
|
|
168
|
+
* @throws Error if artifact not found or retrieval fails
|
|
169
|
+
*/ async retrieve(key) {
|
|
170
|
+
this.ensureReady();
|
|
171
|
+
const startTime = Date.now();
|
|
172
|
+
try {
|
|
173
|
+
// Check cache first (fast path)
|
|
174
|
+
if (this.cache.has(key)) {
|
|
175
|
+
this.metrics.cacheHitRate = this.updateCacheHitRate(true);
|
|
176
|
+
return this.cache.get(key);
|
|
177
|
+
}
|
|
178
|
+
this.metrics.cacheHitRate = this.updateCacheHitRate(false);
|
|
179
|
+
// Get index entry
|
|
180
|
+
const entry = this.index.get(key);
|
|
181
|
+
if (!entry) {
|
|
182
|
+
throw new Error(`Artifact not found: ${key}`);
|
|
183
|
+
}
|
|
184
|
+
// Read from data file at offset
|
|
185
|
+
const compressed = await this.readFromDataFile(entry.offset, entry.size);
|
|
186
|
+
// Verify integrity
|
|
187
|
+
const checksum = this.calculateChecksum(compressed);
|
|
188
|
+
if (checksum !== entry.checksum) {
|
|
189
|
+
throw new Error(`Integrity check failed for artifact ${key}`);
|
|
190
|
+
}
|
|
191
|
+
// Decompress
|
|
192
|
+
const decompressed = await gunzipAsync(compressed);
|
|
193
|
+
// Deserialize MessagePack
|
|
194
|
+
const data = msgpack.decode(decompressed);
|
|
195
|
+
// Update cache
|
|
196
|
+
this.updateCache(key, data);
|
|
197
|
+
// Update metrics
|
|
198
|
+
const latency = Date.now() - startTime;
|
|
199
|
+
this.updateRetrieveMetrics(latency);
|
|
200
|
+
// Performance warning if exceeds target
|
|
201
|
+
if (latency > 12) {
|
|
202
|
+
console.warn(`[DependencyArtifactStorage] Retrieve latency ${latency}ms exceeds 12ms target for key ${key}`);
|
|
203
|
+
}
|
|
204
|
+
return data;
|
|
205
|
+
} catch (error) {
|
|
206
|
+
throw new Error(`Failed to retrieve artifact ${key}: ${error instanceof Error ? error.message : String(error)}`);
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
/**
|
|
210
|
+
* Delete artifact and update index
|
|
211
|
+
*
|
|
212
|
+
* @param key - Artifact key to delete
|
|
213
|
+
*/ async delete(key) {
|
|
214
|
+
this.ensureReady();
|
|
215
|
+
// Remove from index
|
|
216
|
+
this.index.delete(key);
|
|
217
|
+
// Remove from cache
|
|
218
|
+
this.cache.delete(key);
|
|
219
|
+
// Persist index
|
|
220
|
+
await this.persistIndex();
|
|
221
|
+
// Note: Data file is not compacted (garbage remains until optimize())
|
|
222
|
+
}
|
|
223
|
+
/**
|
|
224
|
+
* Check if artifact exists
|
|
225
|
+
*
|
|
226
|
+
* @param key - Artifact key
|
|
227
|
+
* @returns True if exists
|
|
228
|
+
*/ has(key) {
|
|
229
|
+
return this.index.has(key);
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* List all artifact keys
|
|
233
|
+
*
|
|
234
|
+
* @returns Array of keys
|
|
235
|
+
*/ keys() {
|
|
236
|
+
return Array.from(this.index.keys());
|
|
237
|
+
}
|
|
238
|
+
/**
|
|
239
|
+
* Clear all artifacts
|
|
240
|
+
*/ async clear() {
|
|
241
|
+
this.ensureReady();
|
|
242
|
+
// Clear index and cache
|
|
243
|
+
this.index.clear();
|
|
244
|
+
this.cache.clear();
|
|
245
|
+
// Delete data file
|
|
246
|
+
await fs.unlink(this.dataPath).catch(()=>{});
|
|
247
|
+
// Persist empty index
|
|
248
|
+
await this.persistIndex();
|
|
249
|
+
// Reset metrics
|
|
250
|
+
this.metrics = this.initializeMetrics();
|
|
251
|
+
}
|
|
252
|
+
// ===========================
|
|
253
|
+
// Maintenance Operations
|
|
254
|
+
// ===========================
|
|
255
|
+
/**
|
|
256
|
+
* Optimize storage by compacting data file
|
|
257
|
+
*
|
|
258
|
+
* Removes deleted entries and rebuilds index.
|
|
259
|
+
*/ async optimize() {
|
|
260
|
+
this.ensureReady();
|
|
261
|
+
// Create temporary file
|
|
262
|
+
const tempPath = this.dataPath + '.tmp';
|
|
263
|
+
const newIndex = new Map();
|
|
264
|
+
let currentOffset = 0;
|
|
265
|
+
// Rebuild data file with only active entries
|
|
266
|
+
for (const [key, entry] of Array.from(this.index.entries())){
|
|
267
|
+
// Read original data
|
|
268
|
+
const compressed = await this.readFromDataFile(entry.offset, entry.size);
|
|
269
|
+
// Write to temporary file
|
|
270
|
+
await fs.appendFile(tempPath, compressed);
|
|
271
|
+
// Update index with new offset
|
|
272
|
+
newIndex.set(key, {
|
|
273
|
+
...entry,
|
|
274
|
+
offset: currentOffset
|
|
275
|
+
});
|
|
276
|
+
currentOffset += entry.size;
|
|
277
|
+
}
|
|
278
|
+
// Replace original with compacted version
|
|
279
|
+
await fs.rename(tempPath, this.dataPath);
|
|
280
|
+
// Update index
|
|
281
|
+
this.index = newIndex;
|
|
282
|
+
await this.persistIndex();
|
|
283
|
+
}
|
|
284
|
+
/**
|
|
285
|
+
* Get storage metrics
|
|
286
|
+
*/ getMetrics() {
|
|
287
|
+
return {
|
|
288
|
+
...this.metrics
|
|
289
|
+
};
|
|
290
|
+
}
|
|
291
|
+
// ===========================
|
|
292
|
+
// Private Helpers
|
|
293
|
+
// ===========================
|
|
294
|
+
/**
|
|
295
|
+
* Ensure storage is ready
|
|
296
|
+
*/ ensureReady() {
|
|
297
|
+
if (!this.ready) {
|
|
298
|
+
throw new Error('DependencyArtifactStorage not initialized. Call initialize() first.');
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
/**
|
|
302
|
+
* Calculate SHA-256 checksum
|
|
303
|
+
*/ calculateChecksum(buffer) {
|
|
304
|
+
return createHash('sha256').update(buffer).digest('hex');
|
|
305
|
+
}
|
|
306
|
+
/**
|
|
307
|
+
* Append data to binary file
|
|
308
|
+
*
|
|
309
|
+
* @returns Byte offset where data was written
|
|
310
|
+
*/ async appendToDataFile(data) {
|
|
311
|
+
let offset = 0;
|
|
312
|
+
try {
|
|
313
|
+
const stats = await fs.stat(this.dataPath);
|
|
314
|
+
offset = stats.size;
|
|
315
|
+
} catch {
|
|
316
|
+
// File doesn't exist yet
|
|
317
|
+
}
|
|
318
|
+
await fs.appendFile(this.dataPath, data);
|
|
319
|
+
return offset;
|
|
320
|
+
}
|
|
321
|
+
/**
|
|
322
|
+
* Read data from binary file at offset
|
|
323
|
+
*/ async readFromDataFile(offset, size) {
|
|
324
|
+
const fileHandle = await fs.open(this.dataPath, 'r');
|
|
325
|
+
const buffer = Buffer.allocUnsafe(size);
|
|
326
|
+
try {
|
|
327
|
+
await fileHandle.read(buffer, 0, size, offset);
|
|
328
|
+
return buffer;
|
|
329
|
+
} finally{
|
|
330
|
+
await fileHandle.close();
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
/**
|
|
334
|
+
* Load index from disk
|
|
335
|
+
*/ async loadIndex() {
|
|
336
|
+
try {
|
|
337
|
+
const data = await fs.readFile(this.indexPath, 'utf-8');
|
|
338
|
+
const parsed = JSON.parse(data);
|
|
339
|
+
this.index.clear();
|
|
340
|
+
for (const [key, entry] of Object.entries(parsed)){
|
|
341
|
+
this.index.set(key, entry);
|
|
342
|
+
}
|
|
343
|
+
// Update metrics from index
|
|
344
|
+
this.metrics.totalArtifacts = this.index.size;
|
|
345
|
+
let totalCompressed = 0;
|
|
346
|
+
let totalUncompressed = 0;
|
|
347
|
+
for (const entry of Array.from(this.index.values())){
|
|
348
|
+
totalCompressed += entry.size;
|
|
349
|
+
totalUncompressed += entry.uncompressedSize;
|
|
350
|
+
}
|
|
351
|
+
this.metrics.totalStorageMb = totalUncompressed / (1024 * 1024);
|
|
352
|
+
this.metrics.totalCompressedMb = totalCompressed / (1024 * 1024);
|
|
353
|
+
this.metrics.averageCompressionRatio = totalUncompressed > 0 ? 1 - totalCompressed / totalUncompressed : 0;
|
|
354
|
+
} catch {
|
|
355
|
+
// Index doesn't exist yet
|
|
356
|
+
this.index.clear();
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
/**
|
|
360
|
+
* Persist index to disk
|
|
361
|
+
*/ async persistIndex() {
|
|
362
|
+
const serializable = Object.fromEntries(this.index.entries());
|
|
363
|
+
await fs.writeFile(this.indexPath, JSON.stringify(serializable, null, 2));
|
|
364
|
+
}
|
|
365
|
+
/**
|
|
366
|
+
* Update LRU cache with eviction
|
|
367
|
+
*/ updateCache(key, data) {
|
|
368
|
+
// Remove if exists (for LRU ordering)
|
|
369
|
+
if (this.cache.has(key)) {
|
|
370
|
+
this.cache.delete(key);
|
|
371
|
+
}
|
|
372
|
+
// Evict oldest if at capacity
|
|
373
|
+
if (this.cache.size >= this.cacheSize) {
|
|
374
|
+
const firstKey = this.cache.keys().next().value;
|
|
375
|
+
if (firstKey !== undefined) {
|
|
376
|
+
this.cache.delete(firstKey);
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
// Add to end (most recently used)
|
|
380
|
+
this.cache.set(key, data);
|
|
381
|
+
}
|
|
382
|
+
/**
|
|
383
|
+
* Initialize metrics structure
|
|
384
|
+
*/ initializeMetrics() {
|
|
385
|
+
return {
|
|
386
|
+
totalArtifacts: 0,
|
|
387
|
+
totalStores: 0,
|
|
388
|
+
totalRetrieves: 0,
|
|
389
|
+
averageStoreLatencyMs: 0,
|
|
390
|
+
averageRetrieveLatencyMs: 0,
|
|
391
|
+
p95StoreLatencyMs: 0,
|
|
392
|
+
p95RetrieveLatencyMs: 0,
|
|
393
|
+
totalStorageMb: 0,
|
|
394
|
+
totalCompressedMb: 0,
|
|
395
|
+
averageCompressionRatio: 0,
|
|
396
|
+
cacheHitRate: 0
|
|
397
|
+
};
|
|
398
|
+
}
|
|
399
|
+
/**
|
|
400
|
+
* Update store operation metrics
|
|
401
|
+
*/ updateStoreMetrics(latency, uncompressedSize, compressedSize) {
|
|
402
|
+
this.metrics.totalStores++;
|
|
403
|
+
this.metrics.totalArtifacts = this.index.size;
|
|
404
|
+
// Update average latency
|
|
405
|
+
const totalLatency = this.metrics.averageStoreLatencyMs * (this.metrics.totalStores - 1) + latency;
|
|
406
|
+
this.metrics.averageStoreLatencyMs = totalLatency / this.metrics.totalStores;
|
|
407
|
+
// Update latency buffer for P95 calculation
|
|
408
|
+
this.latencyBuffer.push(latency);
|
|
409
|
+
if (this.latencyBuffer.length > 1000) {
|
|
410
|
+
this.latencyBuffer = this.latencyBuffer.slice(-1000);
|
|
411
|
+
}
|
|
412
|
+
this.metrics.p95StoreLatencyMs = this.calculateP95(this.latencyBuffer);
|
|
413
|
+
// Update storage metrics
|
|
414
|
+
this.metrics.totalStorageMb += uncompressedSize / (1024 * 1024);
|
|
415
|
+
this.metrics.totalCompressedMb += compressedSize / (1024 * 1024);
|
|
416
|
+
this.metrics.averageCompressionRatio = this.metrics.totalStorageMb > 0 ? 1 - this.metrics.totalCompressedMb / this.metrics.totalStorageMb : 0;
|
|
417
|
+
}
|
|
418
|
+
/**
|
|
419
|
+
* Update retrieve operation metrics
|
|
420
|
+
*/ updateRetrieveMetrics(latency) {
|
|
421
|
+
this.metrics.totalRetrieves++;
|
|
422
|
+
// Update average latency
|
|
423
|
+
const totalLatency = this.metrics.averageRetrieveLatencyMs * (this.metrics.totalRetrieves - 1) + latency;
|
|
424
|
+
this.metrics.averageRetrieveLatencyMs = totalLatency / this.metrics.totalRetrieves;
|
|
425
|
+
// Update P95
|
|
426
|
+
this.latencyBuffer.push(latency);
|
|
427
|
+
if (this.latencyBuffer.length > 1000) {
|
|
428
|
+
this.latencyBuffer = this.latencyBuffer.slice(-1000);
|
|
429
|
+
}
|
|
430
|
+
this.metrics.p95RetrieveLatencyMs = this.calculateP95(this.latencyBuffer);
|
|
431
|
+
}
|
|
432
|
+
/**
|
|
433
|
+
* Update cache hit rate
|
|
434
|
+
*/ updateCacheHitRate(hit) {
|
|
435
|
+
const total = this.metrics.totalRetrieves + 1;
|
|
436
|
+
const hits = this.metrics.cacheHitRate * this.metrics.totalRetrieves + (hit ? 1 : 0);
|
|
437
|
+
return hits / total;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Calculate 95th percentile latency
|
|
441
|
+
*/ calculateP95(latencies) {
|
|
442
|
+
if (latencies.length === 0) return 0;
|
|
443
|
+
const sorted = [
|
|
444
|
+
...latencies
|
|
445
|
+
].sort((a, b)=>a - b);
|
|
446
|
+
const index = Math.floor(sorted.length * 0.95);
|
|
447
|
+
return sorted[index] || 0;
|
|
448
|
+
}
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
//# sourceMappingURL=artifact-storage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../../../src/coordination/v2/dependency/artifact-storage.ts"],"names":["promises","fs","join","gzip","gunzip","promisify","createHash","msgpack","gzipAsync","gunzipAsync","DependencyArtifactStorage","storagePath","indexPath","dataPath","index","cache","cacheSize","metrics","latencyBuffer","ready","config","Map","initializeMetrics","initialize","mkdir","recursive","loadIndex","close","persistIndex","isReady","store","key","data","ensureReady","startTime","Date","now","Error","packed","encode","uncompressedSize","length","compressed","compressedSize","checksum","calculateChecksum","offset","appendToDataFile","compressionRatio","indexEntry","size","timestamp","set","updateCache","latency","updateStoreMetrics","console","warn","error","message","String","retrieve","has","cacheHitRate","updateCacheHitRate","get","entry","readFromDataFile","decompressed","decode","updateRetrieveMetrics","delete","keys","Array","from","clear","unlink","catch","optimize","tempPath","newIndex","currentOffset","entries","appendFile","rename","getMetrics","buffer","update","digest","stats","stat","fileHandle","open","Buffer","allocUnsafe","read","readFile","parsed","JSON","parse","Object","totalArtifacts","totalCompressed","totalUncompressed","values","totalStorageMb","totalCompressedMb","averageCompressionRatio","serializable","fromEntries","writeFile","stringify","firstKey","next","value","undefined","totalStores","totalRetrieves","averageStoreLatencyMs","averageRetrieveLatencyMs","p95StoreLatencyMs","p95RetrieveLatencyMs","totalLatency","push","slice","calculateP95","hit","total","hits","latencies","sorted","sort","a","b","Math","floor"],"mappings":"AAAA;;;;;;;;;;;;CAYC,GAED,SAASA,YAAYC,EAAE,QAAQ,KAAK;AACpC,SAASC,IAAI,QAAQ,OAAO;AAC5B,SAASC,IAAI,EAAEC,MAAM,QAAQ,OAAO;AACpC,SAASC,SAAS,QAAQ,OAAO;AACjC,SAASC,UAAU,QAAQ,SAAS;AACpC,YAAYC,aAAa,eAAe;AAExC,MAAMC,YAAYH,UAAUF;AAC5B,MAAMM,cAAcJ,UAAUD;AAkE9B;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+BC,GACD,OAAO,MAAMM;IACHC,YAAoB;IACpBC,UAAkB;IAClBC,SAAiB;IACjBC,MAAqC;IACrCC,MAAwB;IACxBC,UAAkB;IAClBC,QAAgC;IAChCC,cAAwB;IACxBC,QAAiB,MAAM;IAE/B;;;;GAIC,GACD,YAAYC,SAGR,CAAC,CAAC,CAAE;QACN,IAAI,CAACT,WAAW,GAAGS,OAAOT,WAAW,IAAI;QACzC,IAAI,CAACC,SAAS,GAAGV,KAAK,IAAI,CAACS,WAAW,EAAE;QACxC,IAAI,CAACE,QAAQ,GAAGX,KAAK,IAAI,CAACS,WAAW,EAAE;QACvC,IAAI,CAACG,KAAK,GAAG,IAAIO;QACjB,IAAI,CAACN,KAAK,GAAG,IAAIM;QACjB,IAAI,CAACL,SAAS,GAAGI,OAAOJ,SAAS,IAAI,KAAK,iBAAiB;QAC3D,IAAI,CAACC,OAAO,GAAG,IAAI,CAACK,iBAAiB;QACrC,IAAI,CAACJ,aAAa,GAAG,EAAE;IACzB;IAEA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