monomind 1.11.12 → 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 (222) 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/build.md +3 -3
  5. package/.claude/skills/mastermind/content.md +3 -3
  6. package/.claude/skills/mastermind/createorg.md +2 -2
  7. package/.claude/skills/mastermind/finance.md +3 -3
  8. package/.claude/skills/mastermind/marketing.md +3 -3
  9. package/.claude/skills/mastermind/ops.md +3 -3
  10. package/.claude/skills/mastermind/release.md +3 -3
  11. package/.claude/skills/mastermind/research.md +3 -3
  12. package/.claude/skills/mastermind/review.md +3 -3
  13. package/.claude/skills/mastermind/sales.md +3 -3
  14. package/package.json +1 -1
  15. package/packages/@monomind/cli/dist/src/init/statusline-generator.js +3 -3
  16. package/packages/@monomind/cli/dist/src/observability/replay-reader.d.ts +1 -1
  17. package/packages/@monomind/cli/dist/src/update/checker.js +24 -7
  18. package/packages/@monomind/cli/dist/src/update/index.js +3 -6
  19. package/packages/@monomind/cli/package.json +1 -1
  20. package/packages/@monomind/cli/dist/src/agents/halt-signal.d.ts +0 -25
  21. package/packages/@monomind/cli/dist/src/agents/halt-signal.js +0 -76
  22. package/packages/@monomind/cli/dist/src/agents/index.d.ts +0 -18
  23. package/packages/@monomind/cli/dist/src/agents/index.js +0 -13
  24. package/packages/@monomind/cli/dist/src/agents/managed-agent.d.ts +0 -41
  25. package/packages/@monomind/cli/dist/src/agents/managed-agent.js +0 -69
  26. package/packages/@monomind/cli/dist/src/agents/prompt-experiment.d.ts +0 -23
  27. package/packages/@monomind/cli/dist/src/agents/prompt-experiment.js +0 -49
  28. package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.d.ts +0 -22
  29. package/packages/@monomind/cli/dist/src/agents/prompt-version-manager.js +0 -80
  30. package/packages/@monomind/cli/dist/src/agents/registry-query.d.ts +0 -71
  31. package/packages/@monomind/cli/dist/src/agents/registry-query.js +0 -125
  32. package/packages/@monomind/cli/dist/src/agents/score-decay.d.ts +0 -19
  33. package/packages/@monomind/cli/dist/src/agents/score-decay.js +0 -22
  34. package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.d.ts +0 -13
  35. package/packages/@monomind/cli/dist/src/agents/shared-instructions-loader.js +0 -40
  36. package/packages/@monomind/cli/dist/src/agents/specialization-scorer.d.ts +0 -54
  37. package/packages/@monomind/cli/dist/src/agents/specialization-scorer.js +0 -212
  38. package/packages/@monomind/cli/dist/src/agents/termination-watcher.d.ts +0 -30
  39. package/packages/@monomind/cli/dist/src/agents/termination-watcher.js +0 -84
  40. package/packages/@monomind/cli/dist/src/agents/trigger-index.d.ts +0 -20
  41. package/packages/@monomind/cli/dist/src/agents/trigger-index.js +0 -38
  42. package/packages/@monomind/cli/dist/src/agents/trigger-scanner.d.ts +0 -64
  43. package/packages/@monomind/cli/dist/src/agents/trigger-scanner.js +0 -308
  44. package/packages/@monomind/cli/dist/src/agents/version-diff.d.ts +0 -18
  45. package/packages/@monomind/cli/dist/src/agents/version-diff.js +0 -64
  46. package/packages/@monomind/cli/dist/src/agents/version-store.d.ts +0 -60
  47. package/packages/@monomind/cli/dist/src/agents/version-store.js +0 -235
  48. package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.d.ts +0 -45
  49. package/packages/@monomind/cli/dist/src/benchmarks/pretrain/index.js +0 -404
  50. package/packages/@monomind/cli/dist/src/commands/agent-wasm.d.ts +0 -14
  51. package/packages/@monomind/cli/dist/src/commands/agent-wasm.js +0 -333
  52. package/packages/@monomind/cli/dist/src/commands/ui.js +0 -68
  53. package/packages/@monomind/cli/dist/src/consensus/index.d.ts +0 -7
  54. package/packages/@monomind/cli/dist/src/consensus/index.js +0 -6
  55. package/packages/@monomind/cli/dist/src/context/context-provider.d.ts +0 -44
  56. package/packages/@monomind/cli/dist/src/context/context-provider.js +0 -25
  57. package/packages/@monomind/cli/dist/src/context/git-state-provider.d.ts +0 -12
  58. package/packages/@monomind/cli/dist/src/context/git-state-provider.js +0 -34
  59. package/packages/@monomind/cli/dist/src/context/index.d.ts +0 -12
  60. package/packages/@monomind/cli/dist/src/context/index.js +0 -12
  61. package/packages/@monomind/cli/dist/src/context/project-conventions-provider.d.ts +0 -15
  62. package/packages/@monomind/cli/dist/src/context/project-conventions-provider.js +0 -19
  63. package/packages/@monomind/cli/dist/src/context/prompt-assembler.d.ts +0 -26
  64. package/packages/@monomind/cli/dist/src/context/prompt-assembler.js +0 -93
  65. package/packages/@monomind/cli/dist/src/context/task-history-provider.d.ts +0 -24
  66. package/packages/@monomind/cli/dist/src/context/task-history-provider.js +0 -32
  67. package/packages/@monomind/cli/dist/src/context/user-preferences-provider.d.ts +0 -14
  68. package/packages/@monomind/cli/dist/src/context/user-preferences-provider.js +0 -27
  69. package/packages/@monomind/cli/dist/src/dlq/dlq-reader.d.ts +0 -31
  70. package/packages/@monomind/cli/dist/src/dlq/dlq-reader.js +0 -81
  71. package/packages/@monomind/cli/dist/src/dlq/dlq-writer.d.ts +0 -24
  72. package/packages/@monomind/cli/dist/src/dlq/dlq-writer.js +0 -65
  73. package/packages/@monomind/cli/dist/src/dlq/index.d.ts +0 -10
  74. package/packages/@monomind/cli/dist/src/dlq/index.js +0 -7
  75. package/packages/@monomind/cli/dist/src/eval/dataset-manager.d.ts +0 -33
  76. package/packages/@monomind/cli/dist/src/eval/dataset-manager.js +0 -107
  77. package/packages/@monomind/cli/dist/src/eval/dataset-runner.d.ts +0 -23
  78. package/packages/@monomind/cli/dist/src/eval/dataset-runner.js +0 -59
  79. package/packages/@monomind/cli/dist/src/eval/index.d.ts +0 -10
  80. package/packages/@monomind/cli/dist/src/eval/index.js +0 -7
  81. package/packages/@monomind/cli/dist/src/eval/trace-collector.d.ts +0 -40
  82. package/packages/@monomind/cli/dist/src/eval/trace-collector.js +0 -102
  83. package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.d.ts +0 -68
  84. package/packages/@monomind/cli/dist/src/infrastructure/in-memory-repositories.js +0 -264
  85. package/packages/@monomind/cli/dist/src/interactive/interrupt.d.ts +0 -22
  86. package/packages/@monomind/cli/dist/src/interactive/interrupt.js +0 -71
  87. package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.d.ts +0 -25
  88. package/packages/@monomind/cli/dist/src/mcp/deprecation-injector.js +0 -48
  89. package/packages/@monomind/cli/dist/src/mcp/tool-registry.d.ts +0 -61
  90. package/packages/@monomind/cli/dist/src/mcp/tool-registry.js +0 -246
  91. package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.d.ts +0 -9
  92. package/packages/@monomind/cli/dist/src/mcp-tools/wasm-agent-tools.js +0 -230
  93. package/packages/@monomind/cli/dist/src/model/complexity-scorer.d.ts +0 -21
  94. package/packages/@monomind/cli/dist/src/model/complexity-scorer.js +0 -106
  95. package/packages/@monomind/cli/dist/src/model/index.d.ts +0 -4
  96. package/packages/@monomind/cli/dist/src/model/index.js +0 -4
  97. package/packages/@monomind/cli/dist/src/model/model-settings.d.ts +0 -22
  98. package/packages/@monomind/cli/dist/src/model/model-settings.js +0 -33
  99. package/packages/@monomind/cli/dist/src/model/model-tier-resolver.d.ts +0 -24
  100. package/packages/@monomind/cli/dist/src/model/model-tier-resolver.js +0 -65
  101. package/packages/@monomind/cli/dist/src/monovector/capabilities.d.ts +0 -34
  102. package/packages/@monomind/cli/dist/src/monovector/capabilities.js +0 -37
  103. package/packages/@monomind/cli/dist/src/orchestration/index.d.ts +0 -7
  104. package/packages/@monomind/cli/dist/src/orchestration/index.js +0 -6
  105. package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.d.ts +0 -11
  106. package/packages/@monomind/cli/dist/src/orchestration/mode-dispatcher.js +0 -31
  107. package/packages/@monomind/cli/dist/src/orchestration/routing-modes.d.ts +0 -68
  108. package/packages/@monomind/cli/dist/src/orchestration/routing-modes.js +0 -180
  109. package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.d.ts +0 -7
  110. package/packages/@monomind/cli/dist/src/plugins/tests/demo-plugin-store.js +0 -126
  111. package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.d.ts +0 -12
  112. package/packages/@monomind/cli/dist/src/plugins/tests/standalone-test.js +0 -188
  113. package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.d.ts +0 -7
  114. package/packages/@monomind/cli/dist/src/plugins/tests/test-plugin-store.js +0 -206
  115. package/packages/@monomind/cli/dist/src/runtime/headless.d.ts +0 -60
  116. package/packages/@monomind/cli/dist/src/runtime/headless.js +0 -284
  117. package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.d.ts +0 -50
  118. package/packages/@monomind/cli/dist/src/services/agentic-flow-bridge.js +0 -95
  119. package/packages/@monomind/cli/dist/src/services/container-worker-pool.d.ts +0 -197
  120. package/packages/@monomind/cli/dist/src/services/container-worker-pool.js +0 -623
  121. package/packages/@monomind/cli/dist/src/services/index.d.ts +0 -13
  122. package/packages/@monomind/cli/dist/src/services/index.js +0 -11
  123. package/packages/@monomind/cli/dist/src/services/worker-queue.d.ts +0 -201
  124. package/packages/@monomind/cli/dist/src/services/worker-queue.js +0 -594
  125. package/packages/@monomind/cli/dist/src/swarm/communication-graph.d.ts +0 -25
  126. package/packages/@monomind/cli/dist/src/swarm/communication-graph.js +0 -77
  127. package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.d.ts +0 -31
  128. package/packages/@monomind/cli/dist/src/swarm/flow-enforcer.js +0 -61
  129. package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.d.ts +0 -19
  130. package/packages/@monomind/cli/dist/src/swarm/flow-visualizer.js +0 -68
  131. package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.d.ts +0 -13
  132. package/packages/@monomind/cli/dist/src/transfer/deploy-seraphine.js +0 -205
  133. package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.d.ts +0 -12
  134. package/packages/@monomind/cli/dist/src/transfer/store/tests/standalone-test.js +0 -190
  135. package/packages/@monomind/cli/dist/src/transfer/test-seraphine.d.ts +0 -6
  136. package/packages/@monomind/cli/dist/src/transfer/test-seraphine.js +0 -105
  137. package/packages/@monomind/cli/dist/src/transfer/tests/test-store.d.ts +0 -7
  138. package/packages/@monomind/cli/dist/src/transfer/tests/test-store.js +0 -214
  139. package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.d.ts +0 -10
  140. package/packages/@monomind/cli/dist/src/workflow/condition-evaluator.js +0 -82
  141. package/packages/@monomind/cli/dist/src/workflow/context-resolver.d.ts +0 -12
  142. package/packages/@monomind/cli/dist/src/workflow/context-resolver.js +0 -23
  143. package/packages/@monomind/cli/dist/src/workflow/dag-builder.d.ts +0 -17
  144. package/packages/@monomind/cli/dist/src/workflow/dag-builder.js +0 -129
  145. package/packages/@monomind/cli/dist/src/workflow/dag-executor.d.ts +0 -9
  146. package/packages/@monomind/cli/dist/src/workflow/dag-executor.js +0 -116
  147. package/packages/@monomind/cli/dist/src/workflow/dag-types.d.ts +0 -41
  148. package/packages/@monomind/cli/dist/src/workflow/dag-types.js +0 -8
  149. package/packages/@monomind/cli/dist/src/workflow/dsl-parser.d.ts +0 -12
  150. package/packages/@monomind/cli/dist/src/workflow/dsl-parser.js +0 -20
  151. package/packages/@monomind/cli/dist/src/workflow/dsl-schema.d.ts +0 -165
  152. package/packages/@monomind/cli/dist/src/workflow/dsl-schema.js +0 -82
  153. package/packages/@monomind/cli/dist/src/workflow/index.d.ts +0 -13
  154. package/packages/@monomind/cli/dist/src/workflow/index.js +0 -11
  155. package/packages/@monomind/cli/dist/src/workflow/template-engine.d.ts +0 -11
  156. package/packages/@monomind/cli/dist/src/workflow/template-engine.js +0 -40
  157. package/packages/@monomind/cli/dist/src/workflow/workflow-executor.d.ts +0 -29
  158. package/packages/@monomind/cli/dist/src/workflow/workflow-executor.js +0 -227
  159. package/packages/@monomind/guidance/dist/adversarial.d.ts +0 -284
  160. package/packages/@monomind/guidance/dist/adversarial.js +0 -572
  161. package/packages/@monomind/guidance/dist/analyzer.d.ts +0 -530
  162. package/packages/@monomind/guidance/dist/analyzer.js +0 -2518
  163. package/packages/@monomind/guidance/dist/artifacts.d.ts +0 -283
  164. package/packages/@monomind/guidance/dist/artifacts.js +0 -356
  165. package/packages/@monomind/guidance/dist/authority.d.ts +0 -290
  166. package/packages/@monomind/guidance/dist/authority.js +0 -558
  167. package/packages/@monomind/guidance/dist/capabilities.d.ts +0 -209
  168. package/packages/@monomind/guidance/dist/capabilities.js +0 -485
  169. package/packages/@monomind/guidance/dist/coherence.d.ts +0 -233
  170. package/packages/@monomind/guidance/dist/coherence.js +0 -372
  171. package/packages/@monomind/guidance/dist/compiler.d.ts +0 -87
  172. package/packages/@monomind/guidance/dist/compiler.js +0 -419
  173. package/packages/@monomind/guidance/dist/conformance-kit.d.ts +0 -225
  174. package/packages/@monomind/guidance/dist/conformance-kit.js +0 -629
  175. package/packages/@monomind/guidance/dist/continue-gate.d.ts +0 -214
  176. package/packages/@monomind/guidance/dist/continue-gate.js +0 -353
  177. package/packages/@monomind/guidance/dist/crypto-utils.d.ts +0 -17
  178. package/packages/@monomind/guidance/dist/crypto-utils.js +0 -24
  179. package/packages/@monomind/guidance/dist/evolution.d.ts +0 -282
  180. package/packages/@monomind/guidance/dist/evolution.js +0 -500
  181. package/packages/@monomind/guidance/dist/gates.d.ts +0 -79
  182. package/packages/@monomind/guidance/dist/gates.js +0 -302
  183. package/packages/@monomind/guidance/dist/gateway.d.ts +0 -206
  184. package/packages/@monomind/guidance/dist/gateway.js +0 -452
  185. package/packages/@monomind/guidance/dist/generators.d.ts +0 -153
  186. package/packages/@monomind/guidance/dist/generators.js +0 -682
  187. package/packages/@monomind/guidance/dist/headless.d.ts +0 -177
  188. package/packages/@monomind/guidance/dist/headless.js +0 -342
  189. package/packages/@monomind/guidance/dist/hooks.d.ts +0 -109
  190. package/packages/@monomind/guidance/dist/hooks.js +0 -347
  191. package/packages/@monomind/guidance/dist/index.d.ts +0 -205
  192. package/packages/@monomind/guidance/dist/index.js +0 -321
  193. package/packages/@monomind/guidance/dist/ledger.d.ts +0 -162
  194. package/packages/@monomind/guidance/dist/ledger.js +0 -375
  195. package/packages/@monomind/guidance/dist/manifest-validator.d.ts +0 -289
  196. package/packages/@monomind/guidance/dist/manifest-validator.js +0 -838
  197. package/packages/@monomind/guidance/dist/memory-gate.d.ts +0 -222
  198. package/packages/@monomind/guidance/dist/memory-gate.js +0 -382
  199. package/packages/@monomind/guidance/dist/meta-governance.d.ts +0 -265
  200. package/packages/@monomind/guidance/dist/meta-governance.js +0 -348
  201. package/packages/@monomind/guidance/dist/optimizer.d.ts +0 -104
  202. package/packages/@monomind/guidance/dist/optimizer.js +0 -329
  203. package/packages/@monomind/guidance/dist/persistence.d.ts +0 -189
  204. package/packages/@monomind/guidance/dist/persistence.js +0 -464
  205. package/packages/@monomind/guidance/dist/proof.d.ts +0 -185
  206. package/packages/@monomind/guidance/dist/proof.js +0 -238
  207. package/packages/@monomind/guidance/dist/retriever.d.ts +0 -116
  208. package/packages/@monomind/guidance/dist/retriever.js +0 -394
  209. package/packages/@monomind/guidance/dist/ruvbot-integration.d.ts +0 -370
  210. package/packages/@monomind/guidance/dist/ruvbot-integration.js +0 -738
  211. package/packages/@monomind/guidance/dist/temporal.d.ts +0 -426
  212. package/packages/@monomind/guidance/dist/temporal.js +0 -658
  213. package/packages/@monomind/guidance/dist/trust.d.ts +0 -283
  214. package/packages/@monomind/guidance/dist/trust.js +0 -473
  215. package/packages/@monomind/guidance/dist/truth-anchors.d.ts +0 -276
  216. package/packages/@monomind/guidance/dist/truth-anchors.js +0 -488
  217. package/packages/@monomind/guidance/dist/types.d.ts +0 -378
  218. package/packages/@monomind/guidance/dist/types.js +0 -10
  219. package/packages/@monomind/guidance/dist/uncertainty.d.ts +0 -372
  220. package/packages/@monomind/guidance/dist/uncertainty.js +0 -619
  221. package/packages/@monomind/guidance/dist/wasm-kernel.d.ts +0 -48
  222. package/packages/@monomind/guidance/dist/wasm-kernel.js +0 -158
@@ -1,105 +0,0 @@
1
- /**
2
- * Test Seraphine Genesis Model
3
- * Quick validation of the transfer pipeline
4
- */
5
- import * as fs from 'fs';
6
- import * as path from 'path';
7
- import { fileURLToPath } from 'url';
8
- const __filename = fileURLToPath(import.meta.url);
9
- const __dirname = path.dirname(__filename);
10
- // Simple test without complex imports
11
- async function test() {
12
- console.log('');
13
- console.log('╔══════════════════════════════════════════════════════════╗');
14
- console.log('║ SERAPHINE GENESIS TEST SUITE ║');
15
- console.log('╚══════════════════════════════════════════════════════════╝');
16
- console.log('');
17
- let passed = 0;
18
- let failed = 0;
19
- // Test 1: Types file exists
20
- const typesPath = path.join(__dirname, 'types.ts');
21
- if (fs.existsSync(typesPath)) {
22
- console.log('✅ Test 1: Types module exists');
23
- passed++;
24
- }
25
- else {
26
- console.log('❌ Test 1: Types module missing');
27
- failed++;
28
- }
29
- // Test 2: Seraphine model exists
30
- const seraphPath = path.join(__dirname, 'models', 'seraphine.ts');
31
- if (fs.existsSync(seraphPath)) {
32
- console.log('✅ Test 2: Seraphine model exists');
33
- passed++;
34
- }
35
- else {
36
- console.log('❌ Test 2: Seraphine model missing');
37
- failed++;
38
- }
39
- // Test 3: CFP serializer exists
40
- const cfpPath = path.join(__dirname, 'serialization', 'cfp.ts');
41
- if (fs.existsSync(cfpPath)) {
42
- console.log('✅ Test 3: CFP serializer exists');
43
- passed++;
44
- }
45
- else {
46
- console.log('❌ Test 3: CFP serializer missing');
47
- failed++;
48
- }
49
- // Test 4: Anonymization module exists
50
- const anonPath = path.join(__dirname, 'anonymization', 'index.ts');
51
- if (fs.existsSync(anonPath)) {
52
- console.log('✅ Test 4: Anonymization module exists');
53
- passed++;
54
- }
55
- else {
56
- console.log('❌ Test 4: Anonymization module missing');
57
- failed++;
58
- }
59
- // Test 5: IPFS upload module exists
60
- const ipfsPath = path.join(__dirname, 'ipfs', 'upload.ts');
61
- if (fs.existsSync(ipfsPath)) {
62
- console.log('✅ Test 5: IPFS upload module exists');
63
- passed++;
64
- }
65
- else {
66
- console.log('❌ Test 5: IPFS upload module missing');
67
- failed++;
68
- }
69
- // Test 6: Export module exists
70
- const exportPath = path.join(__dirname, 'export.ts');
71
- if (fs.existsSync(exportPath)) {
72
- console.log('✅ Test 6: Export module exists');
73
- passed++;
74
- }
75
- else {
76
- console.log('❌ Test 6: Export module missing');
77
- failed++;
78
- }
79
- // Test 7: Index module exists
80
- const indexPath = path.join(__dirname, 'index.ts');
81
- if (fs.existsSync(indexPath)) {
82
- console.log('✅ Test 7: Index module exists');
83
- passed++;
84
- }
85
- else {
86
- console.log('❌ Test 7: Index module missing');
87
- failed++;
88
- }
89
- console.log('');
90
- console.log('═══════════════════════════════════════════════════════════');
91
- console.log(` Results: ${passed} passed, ${failed} failed`);
92
- console.log('═══════════════════════════════════════════════════════════');
93
- console.log('');
94
- if (failed === 0) {
95
- console.log('🎉 All module tests passed!');
96
- console.log('');
97
- console.log('Next steps:');
98
- console.log(' 1. Compile TypeScript: cd packages/@monoes/cli && npm run build');
99
- console.log(' 2. Run deployment: npx ts-node src/transfer/deploy-seraphine.ts --to-ipfs');
100
- console.log('');
101
- }
102
- process.exit(failed > 0 ? 1 : 0);
103
- }
104
- test().catch(console.error);
105
- //# sourceMappingURL=test-seraphine.js.map
@@ -1,7 +0,0 @@
1
- #!/usr/bin/env npx tsx
2
- /**
3
- * Pattern Store Test Suite
4
- * Tests list, search, download, and publish functionality
5
- */
6
- export {};
7
- //# sourceMappingURL=test-store.d.ts.map
@@ -1,214 +0,0 @@
1
- #!/usr/bin/env npx tsx
2
- /**
3
- * Pattern Store Test Suite
4
- * Tests list, search, download, and publish functionality
5
- */
6
- import { createDiscoveryService } from '../store/discovery.js';
7
- import { searchPatterns, getSearchSuggestions, getTagCloud } from '../store/search.js';
8
- import { createDownloader } from '../store/download.js';
9
- import { createPublisher } from '../store/publish.js';
10
- import { createSeraphineGenesis } from '../models/seraphine.js';
11
- // Test results tracking
12
- const results = [];
13
- function logTest(name, passed, details) {
14
- results.push({ test: name, passed, details });
15
- const icon = passed ? '✅' : '❌';
16
- console.log(`${icon} ${name}${details ? `: ${details}` : ''}`);
17
- }
18
- async function runTests() {
19
- console.log('');
20
- console.log('╔══════════════════════════════════════════════════════════╗');
21
- console.log('║ PATTERN STORE TEST SUITE ║');
22
- console.log('║ Testing List, Search, Download, Publish ║');
23
- console.log('╚══════════════════════════════════════════════════════════╝');
24
- console.log('');
25
- // ==========================================================================
26
- // 1. DISCOVERY TESTS
27
- // ==========================================================================
28
- console.log('─── Discovery Tests ───────────────────────────────────────');
29
- try {
30
- const discovery = createDiscoveryService();
31
- logTest('Discovery service created', true);
32
- // List registries
33
- const registries = discovery.listRegistries();
34
- logTest('List registries', registries.length > 0, `Found ${registries.length} registries`);
35
- // Discover registry
36
- const result = await discovery.discoverRegistry();
37
- logTest('Discover registry', result.success, result.success
38
- ? `Loaded ${result.registry?.patterns.length || 0} patterns`
39
- : result.error);
40
- // Cache test
41
- if (result.success) {
42
- const cachedResult = await discovery.discoverRegistry();
43
- logTest('Cache hit', cachedResult.fromCache, 'Second request from cache');
44
- }
45
- console.log('');
46
- // ==========================================================================
47
- // 2. SEARCH TESTS
48
- // ==========================================================================
49
- console.log('─── Search Tests ──────────────────────────────────────────');
50
- if (result.success && result.registry) {
51
- const registry = result.registry;
52
- // Basic search
53
- const basicSearch = searchPatterns(registry);
54
- logTest('Basic search', basicSearch.patterns.length > 0, `Found ${basicSearch.total} patterns`);
55
- // Query search
56
- const querySearch = searchPatterns(registry, { query: 'routing' });
57
- logTest('Query search', true, `Query "routing" found ${querySearch.patterns.length} patterns`);
58
- // Category filter
59
- const categorySearch = searchPatterns(registry, { category: 'routing' });
60
- logTest('Category filter', true, `Category "routing" found ${categorySearch.patterns.length} patterns`);
61
- // Tag search
62
- const tagSearch = searchPatterns(registry, { tags: ['genesis'] });
63
- logTest('Tag search', true, `Tag "genesis" found ${tagSearch.patterns.length} patterns`);
64
- // Verified filter
65
- const verifiedSearch = searchPatterns(registry, { verified: true });
66
- logTest('Verified filter', true, `Verified patterns: ${verifiedSearch.patterns.length}`);
67
- // Sort by downloads
68
- const sortedSearch = searchPatterns(registry, {
69
- sortBy: 'downloads',
70
- sortOrder: 'desc',
71
- });
72
- logTest('Sort by downloads', true, `Top pattern: ${sortedSearch.patterns[0]?.displayName || 'none'}`);
73
- // Pagination
74
- const page1 = searchPatterns(registry, { limit: 5, offset: 0 });
75
- logTest('Pagination', page1.pageSize === 5, `Page 1 with ${page1.patterns.length} patterns, hasMore: ${page1.hasMore}`);
76
- // Search suggestions
77
- const suggestions = getSearchSuggestions(registry, 'rou');
78
- logTest('Search suggestions', suggestions.length >= 0, `Suggestions for "rou": ${suggestions.slice(0, 3).join(', ')}`);
79
- // Tag cloud
80
- const tagCloud = getTagCloud(registry);
81
- logTest('Tag cloud', tagCloud.size > 0, `${tagCloud.size} unique tags`);
82
- }
83
- console.log('');
84
- // ==========================================================================
85
- // 3. DOWNLOAD TESTS
86
- // ==========================================================================
87
- console.log('─── Download Tests ────────────────────────────────────────');
88
- if (result.success && result.registry && result.registry.patterns.length > 0) {
89
- const pattern = result.registry.patterns[0];
90
- const downloader = createDownloader();
91
- logTest('Downloader created', true);
92
- // Download with progress
93
- let progressCalled = false;
94
- const downloadResult = await downloader.downloadPattern(pattern, {
95
- verify: true,
96
- }, (progress) => {
97
- progressCalled = true;
98
- });
99
- logTest('Download pattern', downloadResult.success, downloadResult.success
100
- ? `Downloaded ${downloadResult.size} bytes`
101
- : 'Failed');
102
- logTest('Progress callback', progressCalled, progressCalled ? 'Progress events received' : 'No progress events');
103
- logTest('Checksum verification', downloadResult.verified !== undefined, `Verified: ${downloadResult.verified}`);
104
- // Cache stats
105
- const cacheStats = downloader.getCacheStats();
106
- logTest('Cache statistics', cacheStats.count >= 0, `${cacheStats.count} items, ${cacheStats.totalSize} bytes`);
107
- }
108
- console.log('');
109
- // ==========================================================================
110
- // 4. PUBLISH TESTS
111
- // ==========================================================================
112
- console.log('─── Publish Tests ─────────────────────────────────────────');
113
- const cfp = createSeraphineGenesis();
114
- const publisher = createPublisher();
115
- logTest('Publisher created', true);
116
- // Validation
117
- const validation = publisher.validateForPublish(cfp, {
118
- name: 'test-pattern',
119
- displayName: 'Test Pattern',
120
- description: 'A test pattern for validation',
121
- categories: ['testing'],
122
- tags: ['test', 'validation', 'demo'],
123
- license: 'MIT',
124
- anonymize: 'standard',
125
- });
126
- logTest('Publish validation', validation.length === 0, validation.length === 0 ? 'All validations passed' : validation.join(', '));
127
- // Preview
128
- const preview = publisher.createPreview(cfp, {
129
- name: 'seraphine-genesis',
130
- displayName: 'Seraphine Genesis',
131
- description: 'The foundational pattern model',
132
- categories: ['routing', 'coordination'],
133
- tags: ['genesis', 'foundational'],
134
- license: 'MIT',
135
- anonymize: 'standard',
136
- });
137
- logTest('Publish preview', preview !== null, `Preview created for ${preview.name}`);
138
- // Publish (mock)
139
- const publishResult = await publisher.publishPattern(cfp, {
140
- name: 'test-pattern',
141
- displayName: 'Test Pattern',
142
- description: 'A test pattern published to IPFS',
143
- categories: ['testing'],
144
- tags: ['test', 'demo', 'hello-world'],
145
- license: 'MIT',
146
- anonymize: 'standard',
147
- });
148
- logTest('Publish to IPFS', publishResult.success, publishResult.success
149
- ? `CID: ${publishResult.cid.slice(0, 20)}...`
150
- : publishResult.message);
151
- console.log('');
152
- // ==========================================================================
153
- // 5. INTEGRATION TEST
154
- // ==========================================================================
155
- console.log('─── Integration Test ──────────────────────────────────────');
156
- // Full workflow: discover -> search -> download
157
- const store = createDiscoveryService();
158
- const discoverResult = await store.discoverRegistry();
159
- if (discoverResult.success && discoverResult.registry) {
160
- const searchResult = searchPatterns(discoverResult.registry, {
161
- query: 'seraphine',
162
- });
163
- if (searchResult.patterns.length > 0) {
164
- const dl = createDownloader();
165
- const dlResult = await dl.downloadPattern(searchResult.patterns[0], {
166
- verify: true,
167
- });
168
- logTest('Full workflow', dlResult.success, 'Discover → Search → Download completed');
169
- }
170
- else {
171
- logTest('Full workflow', true, 'Discover → Search completed (no download)');
172
- }
173
- }
174
- }
175
- catch (error) {
176
- console.error('Test error:', error);
177
- logTest('Test suite', false, `Error: ${error}`);
178
- }
179
- // ==========================================================================
180
- // SUMMARY
181
- // ==========================================================================
182
- console.log('');
183
- console.log('═══════════════════════════════════════════════════════════');
184
- console.log(' TEST SUMMARY ');
185
- console.log('═══════════════════════════════════════════════════════════');
186
- console.log('');
187
- const passed = results.filter(r => r.passed).length;
188
- const failed = results.filter(r => !r.passed).length;
189
- const total = results.length;
190
- console.log(` Total Tests: ${total}`);
191
- console.log(` ✅ Passed: ${passed}`);
192
- console.log(` ❌ Failed: ${failed}`);
193
- console.log('');
194
- if (failed === 0) {
195
- console.log(' 🎉 All tests passed!');
196
- console.log('');
197
- console.log(' 📦 Store Features Verified:');
198
- console.log(' - Registry discovery via IPNS');
199
- console.log(' - Pattern search with filters');
200
- console.log(' - Download with verification');
201
- console.log(' - Publish with anonymization');
202
- console.log('');
203
- }
204
- else {
205
- console.log(' ⚠️ Some tests failed. Please review the output above.');
206
- }
207
- process.exit(failed > 0 ? 1 : 0);
208
- }
209
- // Run tests
210
- runTests().catch(error => {
211
- console.error('Fatal error:', error);
212
- process.exit(1);
213
- });
214
- //# sourceMappingURL=test-store.js.map
@@ -1,10 +0,0 @@
1
- /**
2
- * Evaluate a simple boolean expression with variable substitution.
3
- *
4
- * 1. Replace `{{variable}}` references using the provided context.
5
- * 2. Reject any expression containing dangerous patterns.
6
- * 3. Validate that all remaining tokens are safe.
7
- * 4. Evaluate using `new Function` with strict mode.
8
- */
9
- export declare function evaluateCondition(expression: string, context: Record<string, unknown>): boolean;
10
- //# sourceMappingURL=condition-evaluator.d.ts.map
@@ -1,82 +0,0 @@
1
- /**
2
- * Substitute context values into a condition expression, JSON-encoding string
3
- * values to prevent quote injection via user-controlled context data.
4
- */
5
- function substituteCondition(expression, context) {
6
- return expression.replace(/\{\{([\w./-]+)\}\}/g, (_match, path) => {
7
- const segments = path.split('.');
8
- let current = context;
9
- for (const seg of segments) {
10
- if (current === null || current === undefined || typeof current !== 'object') {
11
- current = undefined;
12
- break;
13
- }
14
- if (seg === '__proto__' || seg === 'constructor' || seg === 'prototype') {
15
- current = undefined;
16
- break;
17
- }
18
- current = current[seg];
19
- }
20
- if (current === undefined)
21
- return `{{${path}}}`;
22
- if (typeof current === 'string')
23
- return JSON.stringify(current);
24
- if (typeof current === 'number' || typeof current === 'boolean')
25
- return String(current);
26
- return JSON.stringify(current);
27
- });
28
- }
29
- /**
30
- * Dangerous patterns that must never appear in condition expressions.
31
- */
32
- const DANGEROUS_PATTERNS = [
33
- /\beval\b/,
34
- /\brequire\b/,
35
- /\bimport\b/,
36
- /\bprocess\b/,
37
- /\bglobal\b/,
38
- /\bglobalThis\b/,
39
- /\bFunction\b/,
40
- /\b__proto__\b/,
41
- /\bconstructor\b/,
42
- /\bprototype\b/,
43
- ];
44
- /**
45
- * Allowed token pattern — only permits strings, numbers, booleans,
46
- * comparison/logical operators, parentheses, and whitespace.
47
- */
48
- const SAFE_TOKEN = /^(\s*('([^']*)'|"([^"]*)"|-?\d+(\.\d+)?|true|false|null|undefined|===|!==|==|!=|>=|<=|>|<|&&|\|\||!|\(|\)|\s+))+\s*$/;
49
- /**
50
- * Evaluate a simple boolean expression with variable substitution.
51
- *
52
- * 1. Replace `{{variable}}` references using the provided context.
53
- * 2. Reject any expression containing dangerous patterns.
54
- * 3. Validate that all remaining tokens are safe.
55
- * 4. Evaluate using `new Function` with strict mode.
56
- */
57
- export function evaluateCondition(expression, context) {
58
- if (expression.length > 500) {
59
- throw new Error('Condition expression too long (max 500 characters)');
60
- }
61
- // Step 1: substitute variables (string values JSON-encoded to prevent quote injection)
62
- const resolved = substituteCondition(expression, context);
63
- // Re-check length after substitution — injected values can expand the expression
64
- if (resolved.length > 500) {
65
- throw new Error('Condition expression too long after variable substitution (max 500 characters)');
66
- }
67
- // Step 2: reject dangerous patterns
68
- for (const pattern of DANGEROUS_PATTERNS) {
69
- if (pattern.test(resolved)) {
70
- throw new Error(`Unsafe expression rejected: contains forbidden pattern "${pattern.source}"`);
71
- }
72
- }
73
- // Step 3: validate tokens
74
- if (!SAFE_TOKEN.test(resolved)) {
75
- throw new Error(`Unsafe expression rejected: contains disallowed tokens in "${resolved}"`);
76
- }
77
- // Step 4: evaluate safely
78
- // eslint-disable-next-line @typescript-eslint/no-implied-eval
79
- const fn = new Function(`"use strict"; return (${resolved});`);
80
- return Boolean(fn());
81
- }
82
- //# sourceMappingURL=condition-evaluator.js.map
@@ -1,12 +0,0 @@
1
- import type { DAGTask, TaskResult } from './dag-types.js';
2
- export declare class ContextResolutionError extends Error {
3
- readonly taskId: string;
4
- readonly missingDeps: string[];
5
- constructor(taskId: string, missingDeps: string[]);
6
- }
7
- /**
8
- * Resolves upstream context for a task by collecting results from its dependencies.
9
- * Throws ContextResolutionError if any dependency result is missing.
10
- */
11
- export declare function resolveContext(task: DAGTask, results: Map<string, TaskResult>): TaskResult[];
12
- //# sourceMappingURL=context-resolver.d.ts.map
@@ -1,23 +0,0 @@
1
- export class ContextResolutionError extends Error {
2
- taskId;
3
- missingDeps;
4
- constructor(taskId, missingDeps) {
5
- super(`Task "${taskId}" has unresolved dependencies: ${missingDeps.join(', ')}`);
6
- this.taskId = taskId;
7
- this.missingDeps = missingDeps;
8
- this.name = 'ContextResolutionError';
9
- }
10
- }
11
- /**
12
- * Resolves upstream context for a task by collecting results from its dependencies.
13
- * Throws ContextResolutionError if any dependency result is missing.
14
- */
15
- export function resolveContext(task, results) {
16
- const deps = task.contextDeps ?? [];
17
- const missing = deps.filter((dep) => !results.has(dep));
18
- if (missing.length > 0) {
19
- throw new ContextResolutionError(task.id, missing);
20
- }
21
- return deps.map((dep) => results.get(dep));
22
- }
23
- //# sourceMappingURL=context-resolver.js.map
@@ -1,17 +0,0 @@
1
- import type { DAG, DAGTask, DAGLevel } from './dag-types.js';
2
- /**
3
- * Builds a DAG from an array of tasks using their contextDeps.
4
- * Throws if any task references a dependency that doesn't exist.
5
- */
6
- export declare function buildDAG(tasks: DAGTask[]): DAG;
7
- /**
8
- * Detects cycles in the DAG using DFS.
9
- * Returns an array of cycles, where each cycle is an array of task IDs.
10
- */
11
- export declare function detectCycles(dag: DAG): string[][];
12
- /**
13
- * Performs topological sort using Kahn's algorithm.
14
- * Returns levels (arrays of tasks that can execute in parallel).
15
- */
16
- export declare function topologicalSort(dag: DAG): DAGLevel[];
17
- //# sourceMappingURL=dag-builder.d.ts.map
@@ -1,129 +0,0 @@
1
- /**
2
- * Builds a DAG from an array of tasks using their contextDeps.
3
- * Throws if any task references a dependency that doesn't exist.
4
- */
5
- export function buildDAG(tasks) {
6
- const taskMap = new Map();
7
- const edges = new Map();
8
- const reverseEdges = new Map();
9
- // Register all tasks
10
- for (const task of tasks) {
11
- taskMap.set(task.id, task);
12
- edges.set(task.id, new Set());
13
- reverseEdges.set(task.id, new Set());
14
- }
15
- // Build edges from contextDeps
16
- for (const task of tasks) {
17
- const deps = task.contextDeps ?? [];
18
- for (const dep of deps) {
19
- if (!taskMap.has(dep)) {
20
- throw new Error(`Task "${task.id}" depends on "${dep}" which does not exist in the task list`);
21
- }
22
- // dep → task (dep is upstream, task is downstream)
23
- edges.get(dep).add(task.id);
24
- reverseEdges.get(task.id).add(dep);
25
- }
26
- }
27
- return { tasks: taskMap, edges, reverseEdges };
28
- }
29
- /**
30
- * Detects cycles in the DAG using DFS.
31
- * Returns an array of cycles, where each cycle is an array of task IDs.
32
- */
33
- export function detectCycles(dag) {
34
- const WHITE = 0; // unvisited
35
- const GRAY = 1; // in current DFS path
36
- const BLACK = 2; // fully processed
37
- const color = new Map();
38
- const parent = new Map();
39
- const cycles = [];
40
- for (const id of dag.tasks.keys()) {
41
- color.set(id, WHITE);
42
- parent.set(id, null);
43
- }
44
- // Iterative DFS to avoid call-stack overflow on deep linear DAGs
45
- function dfs(start) {
46
- const stack = [
47
- { u: start, neighbors: (dag.edges.get(start) ?? new Set()).values(), entered: false },
48
- ];
49
- while (stack.length > 0) {
50
- const frame = stack[stack.length - 1];
51
- if (!frame.entered) {
52
- frame.entered = true;
53
- color.set(frame.u, GRAY);
54
- }
55
- const { value: v, done } = frame.neighbors.next();
56
- if (done) {
57
- color.set(frame.u, BLACK);
58
- stack.pop();
59
- continue;
60
- }
61
- const vColor = color.get(v);
62
- if (vColor === GRAY) {
63
- // Found a cycle — reconstruct it
64
- const cycle = [v];
65
- let curr = frame.u;
66
- while (curr !== v) {
67
- cycle.push(curr);
68
- const next = parent.get(curr);
69
- if (next == null)
70
- break;
71
- curr = next;
72
- }
73
- cycle.push(v);
74
- cycle.reverse();
75
- cycles.push(cycle);
76
- }
77
- else if (vColor === WHITE) {
78
- parent.set(v, frame.u);
79
- stack.push({ u: v, neighbors: (dag.edges.get(v) ?? new Set()).values(), entered: false });
80
- }
81
- }
82
- }
83
- for (const id of dag.tasks.keys()) {
84
- if (color.get(id) === WHITE) {
85
- dfs(id);
86
- }
87
- }
88
- return cycles;
89
- }
90
- /**
91
- * Performs topological sort using Kahn's algorithm.
92
- * Returns levels (arrays of tasks that can execute in parallel).
93
- */
94
- export function topologicalSort(dag) {
95
- if (dag.tasks.size === 0)
96
- return [];
97
- // Compute in-degree for each node
98
- const inDegree = new Map();
99
- for (const id of dag.tasks.keys()) {
100
- inDegree.set(id, (dag.reverseEdges.get(id) ?? new Set()).size);
101
- }
102
- // Start with nodes that have no dependencies
103
- let currentLevel = [];
104
- for (const [id, deg] of inDegree) {
105
- if (deg === 0) {
106
- currentLevel.push(id);
107
- }
108
- }
109
- const levels = [];
110
- while (currentLevel.length > 0) {
111
- // Resolve current level tasks
112
- const levelTasks = currentLevel.map(id => dag.tasks.get(id));
113
- levels.push(levelTasks);
114
- const nextLevel = [];
115
- for (const id of currentLevel) {
116
- const dependents = dag.edges.get(id) ?? new Set();
117
- for (const dep of dependents) {
118
- const newDeg = inDegree.get(dep) - 1;
119
- inDegree.set(dep, newDeg);
120
- if (newDeg === 0) {
121
- nextLevel.push(dep);
122
- }
123
- }
124
- }
125
- currentLevel = nextLevel;
126
- }
127
- return levels;
128
- }
129
- //# sourceMappingURL=dag-builder.js.map
@@ -1,9 +0,0 @@
1
- import type { DAGTask, TaskResult } from './dag-types.js';
2
- export type TaskRunner = (task: DAGTask, upstreamContext: TaskResult[]) => Promise<TaskResult>;
3
- export declare class DAGExecutor {
4
- private readonly runner;
5
- constructor(runner: TaskRunner);
6
- execute(tasks: DAGTask[]): Promise<Map<string, TaskResult>>;
7
- private runWithRetry;
8
- }
9
- //# sourceMappingURL=dag-executor.d.ts.map