monomind 1.11.11 → 1.11.13

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.
Files changed (227) hide show
  1. package/.claude/commands/mastermind/idea.md +1 -1
  2. package/.claude/commands/mastermind/master.md +1 -1
  3. package/.claude/skills/mastermind/_protocol.md +4 -4
  4. package/.claude/skills/mastermind/architect.md +7 -4
  5. package/.claude/skills/mastermind/autodev.md +4 -2
  6. package/.claude/skills/mastermind/build.md +3 -3
  7. package/.claude/skills/mastermind/content.md +3 -3
  8. package/.claude/skills/mastermind/createorg.md +2 -2
  9. package/.claude/skills/mastermind/finance.md +3 -3
  10. package/.claude/skills/mastermind/idea.md +8 -0
  11. package/.claude/skills/mastermind/marketing.md +3 -3
  12. package/.claude/skills/mastermind/ops.md +3 -3
  13. package/.claude/skills/mastermind/release.md +3 -3
  14. package/.claude/skills/mastermind/research.md +3 -3
  15. package/.claude/skills/mastermind/review.md +3 -3
  16. package/.claude/skills/mastermind/sales.md +3 -3
  17. package/package.json +1 -1
  18. package/packages/@monomind/cli/dist/src/index.js +19 -14
  19. package/packages/@monomind/cli/dist/src/init/statusline-generator.js +3 -3
  20. package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +1 -1
  21. package/packages/@monomind/cli/dist/src/update/checker.js +24 -7
  22. package/packages/@monomind/cli/dist/src/update/index.d.ts +10 -0
  23. package/packages/@monomind/cli/dist/src/update/index.js +29 -2
  24. package/packages/@monomind/cli/package.json +1 -1
  25. package/packages/@monomind/cli/dist/src/agents/halt-signal.d.ts +0 -25
  26. package/packages/@monomind/cli/dist/src/agents/halt-signal.js +0 -76
  27. package/packages/@monomind/cli/dist/src/agents/index.d.ts +0 -18
  28. package/packages/@monomind/cli/dist/src/agents/index.js +0 -13
  29. package/packages/@monomind/cli/dist/src/agents/managed-agent.d.ts +0 -41
  30. package/packages/@monomind/cli/dist/src/agents/managed-agent.js +0 -69
  31. package/packages/@monomind/cli/dist/src/agents/prompt-experiment.d.ts +0 -23
  32. package/packages/@monomind/cli/dist/src/agents/prompt-experiment.js +0 -49
  33. package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.d.ts +0 -22
  34. package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.js +0 -80
  35. package/packages/@monomind/cli/dist/src/agents/registry-query.d.ts +0 -71
  36. package/packages/@monomind/cli/dist/src/agents/registry-query.js +0 -125
  37. package/packages/@monomind/cli/dist/src/agents/score-decay.d.ts +0 -19
  38. package/packages/@monomind/cli/dist/src/agents/score-decay.js +0 -22
  39. package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.d.ts +0 -13
  40. package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.js +0 -40
  41. package/packages/@monomind/cli/dist/src/agents/specialization-scorer.d.ts +0 -54
  42. package/packages/@monomind/cli/dist/src/agents/specialization-scorer.js +0 -212
  43. package/packages/@monomind/cli/dist/src/agents/termination-watcher.d.ts +0 -30
  44. package/packages/@monomind/cli/dist/src/agents/termination-watcher.js +0 -84
  45. package/packages/@monomind/cli/dist/src/agents/trigger-index.d.ts +0 -20
  46. package/packages/@monomind/cli/dist/src/agents/trigger-index.js +0 -38
  47. package/packages/@monomind/cli/dist/src/agents/trigger-scanner.d.ts +0 -64
  48. package/packages/@monomind/cli/dist/src/agents/trigger-scanner.js +0 -308
  49. package/packages/@monomind/cli/dist/src/agents/version-diff.d.ts +0 -18
  50. package/packages/@monomind/cli/dist/src/agents/version-diff.js +0 -64
  51. package/packages/@monomind/cli/dist/src/agents/version-store.d.ts +0 -60
  52. package/packages/@monomind/cli/dist/src/agents/version-store.js +0 -235
  53. package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.d.ts +0 -45
  54. package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.js +0 -404
  55. package/packages/@monomind/cli/dist/src/commands/agent-wasm.d.ts +0 -14
  56. package/packages/@monomind/cli/dist/src/commands/agent-wasm.js +0 -333
  57. package/packages/@monomind/cli/dist/src/commands/ui.js +0 -68
  58. package/packages/@monomind/cli/dist/src/consensus/index.d.ts +0 -7
  59. package/packages/@monomind/cli/dist/src/consensus/index.js +0 -6
  60. package/packages/@monomind/cli/dist/src/context/context-provider.d.ts +0 -44
  61. package/packages/@monomind/cli/dist/src/context/context-provider.js +0 -25
  62. package/packages/@monomind/cli/dist/src/context/git-state-provider.d.ts +0 -12
  63. package/packages/@monomind/cli/dist/src/context/git-state-provider.js +0 -34
  64. package/packages/@monomind/cli/dist/src/context/index.d.ts +0 -12
  65. package/packages/@monomind/cli/dist/src/context/index.js +0 -12
  66. package/packages/@monomind/cli/dist/src/context/project-conventions-provider.d.ts +0 -15
  67. package/packages/@monomind/cli/dist/src/context/project-conventions-provider.js +0 -19
  68. package/packages/@monomind/cli/dist/src/context/prompt-assembler.d.ts +0 -26
  69. package/packages/@monomind/cli/dist/src/context/prompt-assembler.js +0 -93
  70. package/packages/@monomind/cli/dist/src/context/task-history-provider.d.ts +0 -24
  71. package/packages/@monomind/cli/dist/src/context/task-history-provider.js +0 -32
  72. package/packages/@monomind/cli/dist/src/context/user-preferences-provider.d.ts +0 -14
  73. package/packages/@monomind/cli/dist/src/context/user-preferences-provider.js +0 -27
  74. package/packages/@monomind/cli/dist/src/dlq/dlq-reader.d.ts +0 -31
  75. package/packages/@monomind/cli/dist/src/dlq/dlq-reader.js +0 -81
  76. package/packages/@monomind/cli/dist/src/dlq/dlq-writer.d.ts +0 -24
  77. package/packages/@monomind/cli/dist/src/dlq/dlq-writer.js +0 -65
  78. package/packages/@monomind/cli/dist/src/dlq/index.d.ts +0 -10
  79. package/packages/@monomind/cli/dist/src/dlq/index.js +0 -7
  80. package/packages/@monomind/cli/dist/src/eval/dataset-manager.d.ts +0 -33
  81. package/packages/@monomind/cli/dist/src/eval/dataset-manager.js +0 -107
  82. package/packages/@monomind/cli/dist/src/eval/dataset-runner.d.ts +0 -23
  83. package/packages/@monomind/cli/dist/src/eval/dataset-runner.js +0 -59
  84. package/packages/@monomind/cli/dist/src/eval/index.d.ts +0 -10
  85. package/packages/@monomind/cli/dist/src/eval/index.js +0 -7
  86. package/packages/@monomind/cli/dist/src/eval/trace-collector.d.ts +0 -40
  87. package/packages/@monomind/cli/dist/src/eval/trace-collector.js +0 -102
  88. package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
  89. package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.js +0 -264
  90. package/packages/@monomind/cli/dist/src/interactive/interrupt.d.ts +0 -22
  91. package/packages/@monomind/cli/dist/src/interactive/interrupt.js +0 -71
  92. package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.d.ts +0 -25
  93. package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.js +0 -48
  94. package/packages/@monomind/cli/dist/src/mcp/tool-registry.d.ts +0 -61
  95. package/packages/@monomind/cli/dist/src/mcp/tool-registry.js +0 -246
  96. package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +0 -9
  97. package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.js +0 -230
  98. package/packages/@monomind/cli/dist/src/model/complexity-scorer.d.ts +0 -21
  99. package/packages/@monomind/cli/dist/src/model/complexity-scorer.js +0 -106
  100. package/packages/@monomind/cli/dist/src/model/index.d.ts +0 -4
  101. package/packages/@monomind/cli/dist/src/model/index.js +0 -4
  102. package/packages/@monomind/cli/dist/src/model/model-settings.d.ts +0 -22
  103. package/packages/@monomind/cli/dist/src/model/model-settings.js +0 -33
  104. package/packages/@monomind/cli/dist/src/model/model-tier-resolver.d.ts +0 -24
  105. package/packages/@monomind/cli/dist/src/model/model-tier-resolver.js +0 -65
  106. package/packages/@monomind/cli/dist/src/monovector/capabilities.d.ts +0 -34
  107. package/packages/@monomind/cli/dist/src/monovector/capabilities.js +0 -37
  108. package/packages/@monomind/cli/dist/src/orchestration/index.d.ts +0 -7
  109. package/packages/@monomind/cli/dist/src/orchestration/index.js +0 -6
  110. package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.d.ts +0 -11
  111. package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.js +0 -31
  112. package/packages/@monomind/cli/dist/src/orchestration/routing-modes.d.ts +0 -68
  113. package/packages/@monomind/cli/dist/src/orchestration/routing-modes.js +0 -180
  114. package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +0 -7
  115. package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.js +0 -126
  116. package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.d.ts +0 -12
  117. package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.js +0 -188
  118. package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.d.ts +0 -7
  119. package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.js +0 -206
  120. package/packages/@monomind/cli/dist/src/runtime/headless.d.ts +0 -60
  121. package/packages/@monomind/cli/dist/src/runtime/headless.js +0 -284
  122. package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.d.ts +0 -50
  123. package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.js +0 -95
  124. package/packages/@monomind/cli/dist/src/services/container-worker-pool.d.ts +0 -197
  125. package/packages/@monomind/cli/dist/src/services/container-worker-pool.js +0 -623
  126. package/packages/@monomind/cli/dist/src/services/index.d.ts +0 -13
  127. package/packages/@monomind/cli/dist/src/services/index.js +0 -11
  128. package/packages/@monomind/cli/dist/src/services/worker-queue.d.ts +0 -201
  129. package/packages/@monomind/cli/dist/src/services/worker-queue.js +0 -594
  130. package/packages/@monomind/cli/dist/src/swarm/communication-graph.d.ts +0 -25
  131. package/packages/@monomind/cli/dist/src/swarm/communication-graph.js +0 -77
  132. package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.d.ts +0 -31
  133. package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.js +0 -61
  134. package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.d.ts +0 -19
  135. package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.js +0 -68
  136. package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.d.ts +0 -13
  137. package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.js +0 -205
  138. package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.d.ts +0 -12
  139. package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.js +0 -190
  140. package/packages/@monomind/cli/dist/src/transfer/test-seraphine.d.ts +0 -6
  141. package/packages/@monomind/cli/dist/src/transfer/test-seraphine.js +0 -105
  142. package/packages/@monomind/cli/dist/src/transfer/tests/test-store.d.ts +0 -7
  143. package/packages/@monomind/cli/dist/src/transfer/tests/test-store.js +0 -214
  144. package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.d.ts +0 -10
  145. package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.js +0 -82
  146. package/packages/@monomind/cli/dist/src/workflow/context-resolver.d.ts +0 -12
  147. package/packages/@monomind/cli/dist/src/workflow/context-resolver.js +0 -23
  148. package/packages/@monomind/cli/dist/src/workflow/dag-builder.d.ts +0 -17
  149. package/packages/@monomind/cli/dist/src/workflow/dag-builder.js +0 -129
  150. package/packages/@monomind/cli/dist/src/workflow/dag-executor.d.ts +0 -9
  151. package/packages/@monomind/cli/dist/src/workflow/dag-executor.js +0 -116
  152. package/packages/@monomind/cli/dist/src/workflow/dag-types.d.ts +0 -41
  153. package/packages/@monomind/cli/dist/src/workflow/dag-types.js +0 -8
  154. package/packages/@monomind/cli/dist/src/workflow/dsl-parser.d.ts +0 -12
  155. package/packages/@monomind/cli/dist/src/workflow/dsl-parser.js +0 -20
  156. package/packages/@monomind/cli/dist/src/workflow/dsl-schema.d.ts +0 -165
  157. package/packages/@monomind/cli/dist/src/workflow/dsl-schema.js +0 -82
  158. package/packages/@monomind/cli/dist/src/workflow/index.d.ts +0 -13
  159. package/packages/@monomind/cli/dist/src/workflow/index.js +0 -11
  160. package/packages/@monomind/cli/dist/src/workflow/template-engine.d.ts +0 -11
  161. package/packages/@monomind/cli/dist/src/workflow/template-engine.js +0 -40
  162. package/packages/@monomind/cli/dist/src/workflow/workflow-executor.d.ts +0 -29
  163. package/packages/@monomind/cli/dist/src/workflow/workflow-executor.js +0 -227
  164. package/packages/@monomind/guidance/dist/adversarial.d.ts +0 -284
  165. package/packages/@monomind/guidance/dist/adversarial.js +0 -572
  166. package/packages/@monomind/guidance/dist/analyzer.d.ts +0 -530
  167. package/packages/@monomind/guidance/dist/analyzer.js +0 -2518
  168. package/packages/@monomind/guidance/dist/artifacts.d.ts +0 -283
  169. package/packages/@monomind/guidance/dist/artifacts.js +0 -356
  170. package/packages/@monomind/guidance/dist/authority.d.ts +0 -290
  171. package/packages/@monomind/guidance/dist/authority.js +0 -558
  172. package/packages/@monomind/guidance/dist/capabilities.d.ts +0 -209
  173. package/packages/@monomind/guidance/dist/capabilities.js +0 -485
  174. package/packages/@monomind/guidance/dist/coherence.d.ts +0 -233
  175. package/packages/@monomind/guidance/dist/coherence.js +0 -372
  176. package/packages/@monomind/guidance/dist/compiler.d.ts +0 -87
  177. package/packages/@monomind/guidance/dist/compiler.js +0 -419
  178. package/packages/@monomind/guidance/dist/conformance-kit.d.ts +0 -225
  179. package/packages/@monomind/guidance/dist/conformance-kit.js +0 -629
  180. package/packages/@monomind/guidance/dist/continue-gate.d.ts +0 -214
  181. package/packages/@monomind/guidance/dist/continue-gate.js +0 -353
  182. package/packages/@monomind/guidance/dist/crypto-utils.d.ts +0 -17
  183. package/packages/@monomind/guidance/dist/crypto-utils.js +0 -24
  184. package/packages/@monomind/guidance/dist/evolution.d.ts +0 -282
  185. package/packages/@monomind/guidance/dist/evolution.js +0 -500
  186. package/packages/@monomind/guidance/dist/gates.d.ts +0 -79
  187. package/packages/@monomind/guidance/dist/gates.js +0 -302
  188. package/packages/@monomind/guidance/dist/gateway.d.ts +0 -206
  189. package/packages/@monomind/guidance/dist/gateway.js +0 -452
  190. package/packages/@monomind/guidance/dist/generators.d.ts +0 -153
  191. package/packages/@monomind/guidance/dist/generators.js +0 -682
  192. package/packages/@monomind/guidance/dist/headless.d.ts +0 -177
  193. package/packages/@monomind/guidance/dist/headless.js +0 -342
  194. package/packages/@monomind/guidance/dist/hooks.d.ts +0 -109
  195. package/packages/@monomind/guidance/dist/hooks.js +0 -347
  196. package/packages/@monomind/guidance/dist/index.d.ts +0 -205
  197. package/packages/@monomind/guidance/dist/index.js +0 -321
  198. package/packages/@monomind/guidance/dist/ledger.d.ts +0 -162
  199. package/packages/@monomind/guidance/dist/ledger.js +0 -375
  200. package/packages/@monomind/guidance/dist/manifest-validator.d.ts +0 -289
  201. package/packages/@monomind/guidance/dist/manifest-validator.js +0 -838
  202. package/packages/@monomind/guidance/dist/memory-gate.d.ts +0 -222
  203. package/packages/@monomind/guidance/dist/memory-gate.js +0 -382
  204. package/packages/@monomind/guidance/dist/meta-governance.d.ts +0 -265
  205. package/packages/@monomind/guidance/dist/meta-governance.js +0 -348
  206. package/packages/@monomind/guidance/dist/optimizer.d.ts +0 -104
  207. package/packages/@monomind/guidance/dist/optimizer.js +0 -329
  208. package/packages/@monomind/guidance/dist/persistence.d.ts +0 -189
  209. package/packages/@monomind/guidance/dist/persistence.js +0 -464
  210. package/packages/@monomind/guidance/dist/proof.d.ts +0 -185
  211. package/packages/@monomind/guidance/dist/proof.js +0 -238
  212. package/packages/@monomind/guidance/dist/retriever.d.ts +0 -116
  213. package/packages/@monomind/guidance/dist/retriever.js +0 -394
  214. package/packages/@monomind/guidance/dist/ruvbot-integration.d.ts +0 -370
  215. package/packages/@monomind/guidance/dist/ruvbot-integration.js +0 -738
  216. package/packages/@monomind/guidance/dist/temporal.d.ts +0 -426
  217. package/packages/@monomind/guidance/dist/temporal.js +0 -658
  218. package/packages/@monomind/guidance/dist/trust.d.ts +0 -283
  219. package/packages/@monomind/guidance/dist/trust.js +0 -473
  220. package/packages/@monomind/guidance/dist/truth-anchors.d.ts +0 -276
  221. package/packages/@monomind/guidance/dist/truth-anchors.js +0 -488
  222. package/packages/@monomind/guidance/dist/types.d.ts +0 -378
  223. package/packages/@monomind/guidance/dist/types.js +0 -10
  224. package/packages/@monomind/guidance/dist/uncertainty.d.ts +0 -372
  225. package/packages/@monomind/guidance/dist/uncertainty.js +0 -619
  226. package/packages/@monomind/guidance/dist/wasm-kernel.d.ts +0 -48
  227. package/packages/@monomind/guidance/dist/wasm-kernel.js +0 -158
@@ -1,45 +0,0 @@
1
- export interface BenchmarkResult {
2
- name: string;
3
- iterations: number;
4
- meanMs: number;
5
- medianMs: number;
6
- p95Ms: number;
7
- p99Ms: number;
8
- minMs: number;
9
- maxMs: number;
10
- stdDev: number;
11
- opsPerSecond: number;
12
- targetMet: boolean;
13
- targetMs?: number;
14
- }
15
- export interface BenchmarkSuite {
16
- name: string;
17
- results: BenchmarkResult[];
18
- totalDurationMs: number;
19
- timestamp: string;
20
- environment: {
21
- nodeVersion: string;
22
- platform: string;
23
- arch: string;
24
- cpuCount: number;
25
- };
26
- }
27
- export interface BenchmarkConfig {
28
- iterations: number;
29
- warmupIterations: number;
30
- targetMs?: number;
31
- verbose?: boolean;
32
- }
33
- export declare function formatBenchmarkResult(result: BenchmarkResult): string;
34
- export declare function runBenchmark(name: string, fn: () => Promise<void> | void, config: BenchmarkConfig): Promise<BenchmarkResult>;
35
- export declare function benchmarkSONAAdaptation(config: BenchmarkConfig): Promise<BenchmarkResult>;
36
- export declare function benchmarkPatternLearning(config: BenchmarkConfig): Promise<BenchmarkResult>;
37
- export declare function benchmarkEWCConsolidation(config: BenchmarkConfig): Promise<BenchmarkResult>;
38
- export declare function benchmarkMemoryRetrieval(config: BenchmarkConfig): Promise<BenchmarkResult>;
39
- export declare function benchmarkEmbeddingGeneration(config: BenchmarkConfig): Promise<BenchmarkResult>;
40
- export declare function benchmarkMoERouting(config: BenchmarkConfig): Promise<BenchmarkResult>;
41
- export declare function benchmarkBatchCosine(config: BenchmarkConfig): Promise<BenchmarkResult>;
42
- export declare function benchmarkPretrainPipeline(config: BenchmarkConfig): Promise<BenchmarkResult>;
43
- export declare function runPretrainBenchmarkSuite(config?: Partial<BenchmarkConfig>): Promise<BenchmarkSuite>;
44
- export default runPretrainBenchmarkSuite;
45
- //# sourceMappingURL=index.d.ts.map
@@ -1,404 +0,0 @@
1
- /**
2
- * Self-Learning Pre-Training Benchmark Suite
3
- * Comprehensive benchmarks for SONA, EWC++, MoE, pattern learning
4
- *
5
- * Metrics measured:
6
- * - SONA adaptation latency (<0.05ms target)
7
- * - Pattern learning throughput
8
- * - EWC++ consolidation effectiveness
9
- * - Memory retrieval accuracy
10
- * - Pre-training convergence speed
11
- *
12
- * @module v1/cli/benchmarks/pretrain
13
- */
14
- import { performance } from 'node:perf_hooks';
15
- // ============================================================================
16
- // Utility Functions
17
- // ============================================================================
18
- function percentile(sorted, p) {
19
- const idx = Math.ceil((p / 100) * sorted.length) - 1;
20
- return sorted[Math.max(0, idx)];
21
- }
22
- function mean(arr) {
23
- return arr.reduce((a, b) => a + b, 0) / arr.length;
24
- }
25
- function stdDev(arr, avg) {
26
- const squaredDiffs = arr.map(x => Math.pow(x - avg, 2));
27
- return Math.sqrt(mean(squaredDiffs));
28
- }
29
- export function formatBenchmarkResult(result) {
30
- const status = result.targetMet ? '\x1b[32m✓\x1b[0m' : '\x1b[31m✗\x1b[0m';
31
- const target = result.targetMs ? ` (target: ${result.targetMs}ms)` : '';
32
- return [
33
- `${status} ${result.name}${target}`,
34
- ` Mean: ${result.meanMs.toFixed(4)}ms | Median: ${result.medianMs.toFixed(4)}ms`,
35
- ` p95: ${result.p95Ms.toFixed(4)}ms | p99: ${result.p99Ms.toFixed(4)}ms`,
36
- ` Min: ${result.minMs.toFixed(4)}ms | Max: ${result.maxMs.toFixed(4)}ms`,
37
- ` StdDev: ${result.stdDev.toFixed(4)}ms | Ops/s: ${result.opsPerSecond.toFixed(0)}`,
38
- ].join('\n');
39
- }
40
- // ============================================================================
41
- // Core Benchmark Runner
42
- // ============================================================================
43
- export async function runBenchmark(name, fn, config) {
44
- const { iterations, warmupIterations, targetMs, verbose } = config;
45
- const times = [];
46
- // Warmup phase
47
- if (verbose)
48
- console.log(` Warming up ${name} (${warmupIterations} iterations)...`);
49
- for (let i = 0; i < warmupIterations; i++) {
50
- await fn();
51
- }
52
- // Measurement phase
53
- if (verbose)
54
- console.log(` Running ${name} (${iterations} iterations)...`);
55
- for (let i = 0; i < iterations; i++) {
56
- const start = performance.now();
57
- await fn();
58
- times.push(performance.now() - start);
59
- }
60
- // Calculate statistics
61
- const sorted = [...times].sort((a, b) => a - b);
62
- const avg = mean(times);
63
- const std = stdDev(times, avg);
64
- return {
65
- name,
66
- iterations,
67
- meanMs: avg,
68
- medianMs: percentile(sorted, 50),
69
- p95Ms: percentile(sorted, 95),
70
- p99Ms: percentile(sorted, 99),
71
- minMs: sorted[0],
72
- maxMs: sorted[sorted.length - 1],
73
- stdDev: std,
74
- opsPerSecond: 1000 / avg,
75
- targetMet: targetMs ? avg <= targetMs : true,
76
- targetMs,
77
- };
78
- }
79
- // ============================================================================
80
- // SONA Adaptation Benchmarks
81
- // ============================================================================
82
- export async function benchmarkSONAAdaptation(config) {
83
- // Fallback implementation for SONA adaptation
84
- const sonaAdapt = async (_signal) => {
85
- // Simulate SONA adaptation with minimal computation
86
- const start = performance.now();
87
- // Simple computation to simulate adaptation
88
- let sum = 0;
89
- for (let i = 0; i < 100; i++) {
90
- sum += Math.sin(i) * Math.cos(i);
91
- }
92
- const latency = performance.now() - start;
93
- return { adapted: sum > -1000, latencyMs: latency };
94
- };
95
- const testSignals = [
96
- { type: 'observation', content: 'User requested feature implementation' },
97
- { type: 'action', content: 'Created new component file' },
98
- { type: 'result', content: 'Component successfully rendered' },
99
- { type: 'thought', content: 'Should add error handling' },
100
- ];
101
- let signalIdx = 0;
102
- return runBenchmark('SONA Adaptation', async () => {
103
- await sonaAdapt(testSignals[signalIdx % testSignals.length]);
104
- signalIdx++;
105
- }, { ...config, targetMs: config.targetMs || 0.05 });
106
- }
107
- // ============================================================================
108
- // Pattern Learning Benchmarks
109
- // ============================================================================
110
- export async function benchmarkPatternLearning(config) {
111
- // Simulate pattern learning step recording
112
- const recordStep = async (_step) => {
113
- // Simulate recording - just a hash computation
114
- let hash = 0;
115
- const str = _step.content;
116
- for (let i = 0; i < str.length; i++) {
117
- hash = ((hash << 5) - hash + str.charCodeAt(i)) | 0;
118
- }
119
- return hash;
120
- };
121
- const testSteps = [
122
- { type: 'observation', content: 'Analyzing codebase structure' },
123
- { type: 'thought', content: 'Identified potential optimization' },
124
- { type: 'action', content: 'Refactored module imports' },
125
- { type: 'result', content: 'Build time reduced by 15%' },
126
- ];
127
- let stepIdx = 0;
128
- return runBenchmark('Pattern Learning (Record Step)', async () => {
129
- await recordStep(testSteps[stepIdx % testSteps.length]);
130
- stepIdx++;
131
- }, { ...config, targetMs: config.targetMs || 0.1 });
132
- }
133
- // ============================================================================
134
- // EWC++ Consolidation Benchmarks
135
- // ============================================================================
136
- export async function benchmarkEWCConsolidation(config) {
137
- // Simulate EWC++ consolidation
138
- const consolidate = async () => {
139
- // Simulate consolidation computation
140
- const patterns = 100;
141
- let consolidated = 0;
142
- for (let i = 0; i < patterns; i++) {
143
- // Simulate Fisher information computation
144
- const importance = Math.random();
145
- if (importance > 0.3) {
146
- consolidated++;
147
- }
148
- }
149
- return { consolidated, preserved: patterns - consolidated };
150
- };
151
- return runBenchmark('EWC++ Consolidation', async () => {
152
- await consolidate();
153
- }, { ...config, targetMs: config.targetMs || 5.0 });
154
- }
155
- // ============================================================================
156
- // Memory Retrieval Benchmarks
157
- // ============================================================================
158
- export async function benchmarkMemoryRetrieval(config) {
159
- // Simulate memory search
160
- const searchEntries = async (_options) => {
161
- // Simulate vector search with cosine similarity
162
- const numVectors = 1000;
163
- const dim = 384;
164
- const queryVec = new Float32Array(dim).map(() => Math.random());
165
- const results = [];
166
- for (let i = 0; i < Math.min(numVectors, 100); i++) {
167
- const vec = new Float32Array(dim).map(() => Math.random());
168
- let dot = 0, normQ = 0, normV = 0;
169
- for (let j = 0; j < dim; j++) {
170
- dot += queryVec[j] * vec[j];
171
- normQ += queryVec[j] * queryVec[j];
172
- normV += vec[j] * vec[j];
173
- }
174
- results.push({ score: dot / (Math.sqrt(normQ) * Math.sqrt(normV)) });
175
- }
176
- return { results: results.slice(0, _options.limit || 10), searchTime: 1.0 };
177
- };
178
- const testQueries = [
179
- 'authentication patterns',
180
- 'error handling best practices',
181
- 'performance optimization techniques',
182
- 'testing strategies',
183
- 'security vulnerability fixes',
184
- ];
185
- let queryIdx = 0;
186
- return runBenchmark('Memory Retrieval (HNSW Search)', async () => {
187
- await searchEntries({
188
- query: testQueries[queryIdx % testQueries.length],
189
- namespace: 'patterns',
190
- limit: 10,
191
- });
192
- queryIdx++;
193
- }, { ...config, targetMs: config.targetMs || 10.0 });
194
- }
195
- // ============================================================================
196
- // Embedding Generation Benchmarks
197
- // ============================================================================
198
- export async function benchmarkEmbeddingGeneration(config) {
199
- // Simulate embedding generation
200
- const generateEmbedding = async (text) => {
201
- const dim = 384;
202
- const embedding = new Float32Array(dim);
203
- for (let i = 0; i < dim; i++) {
204
- let hash = 0;
205
- for (let j = 0; j < text.length; j++) {
206
- hash = ((hash << 5) - hash + text.charCodeAt(j) * (i + 1)) | 0;
207
- }
208
- embedding[i] = Math.sin(hash) * 0.5;
209
- }
210
- // Normalize
211
- let norm = 0;
212
- for (let i = 0; i < dim; i++) {
213
- norm += embedding[i] * embedding[i];
214
- }
215
- norm = Math.sqrt(norm);
216
- for (let i = 0; i < dim; i++) {
217
- embedding[i] /= norm;
218
- }
219
- return embedding;
220
- };
221
- const testTexts = [
222
- 'Implement user authentication with JWT tokens',
223
- 'Fix memory leak in event handler cleanup',
224
- 'Add unit tests for payment processing module',
225
- 'Refactor database connection pooling',
226
- 'Optimize React component rendering performance',
227
- ];
228
- let textIdx = 0;
229
- return runBenchmark('Embedding Generation', async () => {
230
- await generateEmbedding(testTexts[textIdx % testTexts.length]);
231
- textIdx++;
232
- }, { ...config, targetMs: config.targetMs || 5.0 });
233
- }
234
- // ============================================================================
235
- // MoE Routing Benchmarks
236
- // ============================================================================
237
- export async function benchmarkMoERouting(config) {
238
- // Simulate MoE routing
239
- const experts = ['coder', 'tester', 'reviewer', 'architect', 'security'];
240
- const route = async (task) => {
241
- // Simple keyword-based routing simulation
242
- const keywords = {
243
- coder: ['implement', 'fix', 'code', 'function'],
244
- tester: ['test', 'spec', 'coverage', 'unit'],
245
- reviewer: ['review', 'quality', 'check'],
246
- architect: ['design', 'architecture', 'pattern'],
247
- security: ['security', 'auth', 'vulnerability'],
248
- };
249
- let bestExpert = 'coder';
250
- let bestScore = 0;
251
- for (const [expert, words] of Object.entries(keywords)) {
252
- let score = 0;
253
- for (const word of words) {
254
- if (task.toLowerCase().includes(word)) {
255
- score++;
256
- }
257
- }
258
- if (score > bestScore) {
259
- bestScore = score;
260
- bestExpert = expert;
261
- }
262
- }
263
- return { expert: bestExpert, confidence: 0.7 + Math.random() * 0.25 };
264
- };
265
- const testTasks = [
266
- 'Fix authentication bug in login flow',
267
- 'Add new REST API endpoint for users',
268
- 'Write integration tests for checkout',
269
- 'Optimize database query performance',
270
- 'Review security of payment processing',
271
- ];
272
- let taskIdx = 0;
273
- return runBenchmark('MoE Expert Routing', async () => {
274
- await route(testTasks[taskIdx % testTasks.length]);
275
- taskIdx++;
276
- }, { ...config, targetMs: config.targetMs || 1.0 });
277
- }
278
- // ============================================================================
279
- // Batch Operations Benchmarks
280
- // ============================================================================
281
- export async function benchmarkBatchCosine(config) {
282
- // Batch cosine similarity
283
- const batchCosineSim = (query, vectors) => {
284
- const results = new Float32Array(vectors.length);
285
- for (let i = 0; i < vectors.length; i++) {
286
- let dot = 0, normQ = 0, normV = 0;
287
- for (let j = 0; j < query.length; j++) {
288
- dot += query[j] * vectors[i][j];
289
- normQ += query[j] * query[j];
290
- normV += vectors[i][j] * vectors[i][j];
291
- }
292
- results[i] = dot / (Math.sqrt(normQ) * Math.sqrt(normV));
293
- }
294
- return results;
295
- };
296
- // Generate test vectors
297
- const dim = 384;
298
- const numVectors = 1000;
299
- const query = new Float32Array(dim).map(() => Math.random());
300
- const vectors = Array.from({ length: numVectors }, () => new Float32Array(dim).map(() => Math.random()));
301
- return runBenchmark(`Batch Cosine Similarity (${numVectors} vectors)`, async () => {
302
- batchCosineSim(query, vectors);
303
- }, { ...config, targetMs: config.targetMs || 2.0 });
304
- }
305
- // ============================================================================
306
- // Full Pre-Training Pipeline Benchmark
307
- // ============================================================================
308
- export async function benchmarkPretrainPipeline(config) {
309
- // Simulate full pre-training pipeline
310
- const pipeline = async () => {
311
- // Step 1: Analyze repository structure (simulated)
312
- const files = Array.from({ length: 50 }, (_, i) => ({
313
- path: `src/module${i}/index.ts`,
314
- content: `export function fn${i}() { return ${i}; }`,
315
- }));
316
- // Step 2: Generate embeddings for each file
317
- const embeddings = [];
318
- for (const file of files) {
319
- const embedding = new Float32Array(384);
320
- for (let i = 0; i < 384; i++) {
321
- embedding[i] = Math.sin(file.path.charCodeAt(i % file.path.length) * (i + 1));
322
- }
323
- embeddings.push(embedding);
324
- }
325
- // Step 3: Build pattern index (simulated HNSW construction)
326
- const index = new Map();
327
- embeddings.forEach((emb, i) => index.set(i, emb));
328
- // Step 4: Extract patterns
329
- const patterns = files.slice(0, 10).map((f, i) => ({
330
- id: `pattern-${i}`,
331
- type: 'code-structure',
332
- embedding: embeddings[i],
333
- confidence: embeddings[i] ? 1.0 : 0, // real: has embedding = confident
334
- }));
335
- return { files: files.length, patterns: patterns.length };
336
- };
337
- return runBenchmark('Pre-Training Pipeline (50 files)', async () => {
338
- await pipeline();
339
- }, { ...config, targetMs: config.targetMs || 100.0 });
340
- }
341
- // ============================================================================
342
- // Full Benchmark Suite
343
- // ============================================================================
344
- export async function runPretrainBenchmarkSuite(config = {}) {
345
- const fullConfig = {
346
- iterations: config.iterations || 100,
347
- warmupIterations: config.warmupIterations || 10,
348
- verbose: config.verbose ?? false,
349
- };
350
- console.log('\n\x1b[1m\x1b[36m═══════════════════════════════════════════════════════════════\x1b[0m');
351
- console.log('\x1b[1m\x1b[36m Self-Learning Pre-Training Benchmark Suite\x1b[0m');
352
- console.log('\x1b[1m\x1b[36m═══════════════════════════════════════════════════════════════\x1b[0m\n');
353
- const startTime = performance.now();
354
- const results = [];
355
- // Run all benchmarks
356
- const benchmarks = [
357
- { name: 'SONA', fn: () => benchmarkSONAAdaptation(fullConfig) },
358
- { name: 'Pattern Learning', fn: () => benchmarkPatternLearning(fullConfig) },
359
- { name: 'EWC++', fn: () => benchmarkEWCConsolidation({ ...fullConfig, iterations: 20 }) },
360
- { name: 'Memory Retrieval', fn: () => benchmarkMemoryRetrieval(fullConfig) },
361
- { name: 'Embedding Gen', fn: () => benchmarkEmbeddingGeneration(fullConfig) },
362
- { name: 'MoE Routing', fn: () => benchmarkMoERouting(fullConfig) },
363
- { name: 'Batch Cosine', fn: () => benchmarkBatchCosine(fullConfig) },
364
- { name: 'Pretrain Pipeline', fn: () => benchmarkPretrainPipeline({ ...fullConfig, iterations: 10 }) },
365
- ];
366
- for (const benchmark of benchmarks) {
367
- console.log(`\x1b[33m► Running ${benchmark.name} benchmark...\x1b[0m`);
368
- try {
369
- const result = await benchmark.fn();
370
- results.push(result);
371
- console.log(formatBenchmarkResult(result));
372
- console.log();
373
- }
374
- catch (error) {
375
- console.error(`\x1b[31m✗ ${benchmark.name} failed: ${error}\x1b[0m\n`);
376
- }
377
- }
378
- const totalDuration = performance.now() - startTime;
379
- // Summary
380
- console.log('\x1b[1m\x1b[36m═══════════════════════════════════════════════════════════════\x1b[0m');
381
- console.log('\x1b[1m Summary\x1b[0m');
382
- console.log('\x1b[36m───────────────────────────────────────────────────────────────\x1b[0m');
383
- const passed = results.filter(r => r.targetMet).length;
384
- const total = results.length;
385
- console.log(` Total benchmarks: ${total}`);
386
- console.log(` Targets met: \x1b[${passed === total ? '32' : '33'}m${passed}/${total}\x1b[0m`);
387
- console.log(` Total duration: ${(totalDuration / 1000).toFixed(2)}s`);
388
- console.log('\x1b[1m\x1b[36m═══════════════════════════════════════════════════════════════\x1b[0m\n');
389
- return {
390
- name: 'pretrain-benchmark-suite',
391
- results,
392
- totalDurationMs: totalDuration,
393
- timestamp: new Date().toISOString(),
394
- environment: {
395
- nodeVersion: process.version,
396
- platform: process.platform,
397
- arch: process.arch,
398
- cpuCount: (await import('node:os')).cpus().length,
399
- },
400
- };
401
- }
402
- // Export for CLI usage
403
- export default runPretrainBenchmarkSuite;
404
- //# sourceMappingURL=index.js.map
@@ -1,14 +0,0 @@
1
- /**
2
- * WASM Agent CLI Subcommands
3
- *
4
- * Exposes @monoes/rvagent-wasm operations via the `agent` CLI command.
5
- * Wraps functions from monovector/agent-wasm.ts for CLI usage.
6
- */
7
- import type { Command } from '../types.js';
8
- export declare const wasmStatusCommand: Command;
9
- export declare const wasmCreateCommand: Command;
10
- export declare const wasmPromptCommand: Command;
11
- export declare const wasmGalleryCommand: Command;
12
- /** All WASM subcommands for the agent command */
13
- export declare const wasmSubcommands: Command[];
14
- //# sourceMappingURL=agent-wasm.d.ts.map