snow-flow 3.0.8 → 3.0.10

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 (295) hide show
  1. package/claude-flow.bat +0 -0
  2. package/claude-flow.ps1 +0 -0
  3. package/dist/mcp/servicenow-automation-mcp.js +0 -0
  4. package/dist/mcp/servicenow-deployment-mcp.js +0 -0
  5. package/dist/mcp/servicenow-integration-mcp.js +0 -0
  6. package/dist/mcp/servicenow-mcp-server.js +0 -0
  7. package/dist/mcp/servicenow-operations-mcp.js +0 -0
  8. package/dist/mcp/servicenow-platform-development-mcp.js +0 -0
  9. package/dist/mcp/servicenow-progressive-indexer.js +0 -0
  10. package/dist/mcp/servicenow-reporting-analytics-mcp.js +133 -19
  11. package/dist/mcp/servicenow-security-compliance-mcp.js +0 -0
  12. package/dist/mcp/servicenow-update-set-mcp.js +0 -0
  13. package/dist/mcp/start-all-mcp-servers.js +0 -0
  14. package/dist/mcp/start-servicenow-mcp.js +0 -0
  15. package/dist/utils/snow-oauth.js +53 -16
  16. package/memory/agents/README.md +1 -1
  17. package/memory/claude-flow-data.json +1 -1
  18. package/memory/sessions/README.md +1 -1
  19. package/package.json +2 -2
  20. package/.mcp.json +0 -22
  21. package/claude-flow.config.json +0 -20
  22. package/dist/agents/app-creator.agent.d.ts +0 -55
  23. package/dist/agents/app-creator.agent.js +0 -1292
  24. package/dist/agents/base/base-snow-agent.d.ts +0 -75
  25. package/dist/agents/base/base-snow-agent.js +0 -169
  26. package/dist/agents/base-snow-agent.d.ts +0 -63
  27. package/dist/agents/base-snow-agent.js +0 -296
  28. package/dist/agents/coordinator.d.ts +0 -200
  29. package/dist/agents/coordinator.js +0 -777
  30. package/dist/agents/flow-builder-agent.d.ts +0 -18
  31. package/dist/agents/flow-builder-agent.js +0 -197
  32. package/dist/agents/queen-403-handler.d.ts +0 -47
  33. package/dist/agents/queen-403-handler.js +0 -175
  34. package/dist/agents/queen-agent-example.d.ts +0 -23
  35. package/dist/agents/queen-agent-example.js +0 -240
  36. package/dist/agents/queen-agent.test.d.ts +0 -6
  37. package/dist/agents/script-generator.agent.d.ts +0 -32
  38. package/dist/agents/script-generator.agent.js +0 -772
  39. package/dist/agents/script-writer-agent.d.ts +0 -22
  40. package/dist/agents/script-writer-agent.js +0 -695
  41. package/dist/agents/security-agent.d.ts +0 -23
  42. package/dist/agents/security-agent.js +0 -619
  43. package/dist/agents/specialists/automation-specialist.agent.d.ts +0 -44
  44. package/dist/agents/specialists/automation-specialist.agent.js +0 -204
  45. package/dist/agents/specialists/data-specialist.agent.d.ts +0 -165
  46. package/dist/agents/specialists/data-specialist.agent.js +0 -484
  47. package/dist/agents/specialists/integration-specialist.agent.d.ts +0 -227
  48. package/dist/agents/specialists/integration-specialist.agent.js +0 -725
  49. package/dist/agents/specialists/reporting-specialist.agent.d.ts +0 -54
  50. package/dist/agents/specialists/reporting-specialist.agent.js +0 -193
  51. package/dist/agents/specialists/security-specialist.agent.d.ts +0 -85
  52. package/dist/agents/specialists/security-specialist.agent.js +0 -309
  53. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.d.ts +0 -111
  54. package/dist/agents/teams/adaptive/adaptive-coordinator.agent.js +0 -383
  55. package/dist/agents/teams/base-team.d.ts +0 -72
  56. package/dist/agents/teams/base-team.js +0 -253
  57. package/dist/agents/teams/team-types.d.ts +0 -265
  58. package/dist/agents/teams/team-types.js +0 -3
  59. package/dist/agents/teams/widget/widget-architect.agent.d.ts +0 -61
  60. package/dist/agents/teams/widget/widget-architect.agent.js +0 -436
  61. package/dist/agents/teams/widget/widget-backend.agent.d.ts +0 -74
  62. package/dist/agents/teams/widget/widget-backend.agent.js +0 -1531
  63. package/dist/agents/teams/widget/widget-frontend.agent.d.ts +0 -67
  64. package/dist/agents/teams/widget/widget-frontend.agent.js +0 -1014
  65. package/dist/agents/teams/widget/widget-platform.agent.d.ts +0 -90
  66. package/dist/agents/teams/widget/widget-platform.agent.js +0 -1190
  67. package/dist/agents/teams/widget/widget-uiux.agent.d.ts +0 -107
  68. package/dist/agents/teams/widget/widget-uiux.agent.js +0 -1033
  69. package/dist/agents/test-agent.d.ts +0 -26
  70. package/dist/agents/test-agent.js +0 -734
  71. package/dist/agents/test-agents.d.ts +0 -7
  72. package/dist/agents/test-agents.js +0 -64
  73. package/dist/agents/ui-builder.agent.d.ts +0 -50
  74. package/dist/agents/ui-builder.agent.js +0 -1539
  75. package/dist/agents/widget-builder.agent.d.ts +0 -32
  76. package/dist/agents/widget-builder.agent.js +0 -439
  77. package/dist/agents/widget-creator-agent.d.ts +0 -18
  78. package/dist/agents/widget-creator-agent.js +0 -498
  79. package/dist/agents/workflow-designer.agent.d.ts +0 -31
  80. package/dist/agents/workflow-designer.agent.js +0 -583
  81. package/dist/api/error-handling.d.ts +0 -325
  82. package/dist/api/error-handling.js +0 -1488
  83. package/dist/api/flow-designer-api.d.ts +0 -167
  84. package/dist/api/flow-designer-api.js +0 -554
  85. package/dist/api/natural-language-mapper.d.ts +0 -124
  86. package/dist/api/natural-language-mapper.js +0 -501
  87. package/dist/api/performance-optimizer.d.ts +0 -240
  88. package/dist/api/performance-optimizer.js +0 -706
  89. package/dist/api/transaction-manager.d.ts +0 -189
  90. package/dist/api/transaction-manager.js +0 -576
  91. package/dist/assembly/team-assembler.d.ts +0 -140
  92. package/dist/assembly/team-assembler.js +0 -502
  93. package/dist/benchmark-performance.d.ts +0 -41
  94. package/dist/benchmark-performance.js +0 -230
  95. package/dist/cli/snow-flow-cli-integration.d.ts +0 -30
  96. package/dist/cli/snow-flow-cli-integration.js +0 -396
  97. package/dist/coordination/coordination-engine.d.ts +0 -41
  98. package/dist/coordination/coordination-engine.js +0 -324
  99. package/dist/coordination/coordination.test.d.ts +0 -6
  100. package/dist/coordination/example.d.ts +0 -31
  101. package/dist/coordination/example.js +0 -394
  102. package/dist/coordination/execution-patterns.d.ts +0 -43
  103. package/dist/coordination/execution-patterns.js +0 -507
  104. package/dist/coordination/factory.d.ts +0 -94
  105. package/dist/coordination/factory.js +0 -433
  106. package/dist/coordination/index.d.ts +0 -71
  107. package/dist/coordination/index.js +0 -135
  108. package/dist/coordination/progress-monitor.d.ts +0 -71
  109. package/dist/coordination/progress-monitor.js +0 -505
  110. package/dist/coordination/quality-gates.d.ts +0 -124
  111. package/dist/coordination/quality-gates.js +0 -577
  112. package/dist/coordination/shared-memory.d.ts +0 -39
  113. package/dist/coordination/shared-memory.js +0 -289
  114. package/dist/coordination/task-dependencies.d.ts +0 -50
  115. package/dist/coordination/task-dependencies.js +0 -407
  116. package/dist/coordination/team-coordinator.d.ts +0 -59
  117. package/dist/coordination/team-coordinator.js +0 -550
  118. package/dist/coordination/types.d.ts +0 -152
  119. package/dist/coordination/types.js +0 -3
  120. package/dist/mcp/mcp-wrapper.d.ts +0 -8
  121. package/dist/mcp/mcp-wrapper.js +0 -77
  122. package/dist/mcp/servicenow-flow-composer-enhanced.js +0 -396
  123. package/dist/mcp/servicenow-flow-composer-mcp.d.ts +0 -7
  124. package/dist/mcp/servicenow-flow-composer-mcp.js +0 -3103
  125. package/dist/mcp/servicenow-graph-memory-mcp.d.ts +0 -7
  126. package/dist/mcp/servicenow-intelligent-mcp.d.ts +0 -143
  127. package/dist/mcp/servicenow-intelligent-mcp.js +0 -4156
  128. package/dist/mcp/servicenow-xml-flow-mcp.d.ts +0 -53
  129. package/dist/mcp/servicenow-xml-flow-mcp.js +0 -1704
  130. package/dist/mcp/singleton-check.js +0 -31
  131. package/dist/mcp/test-simple-mcp.d.ts +0 -6
  132. package/dist/mcp/test-simple-mcp.js +0 -63
  133. package/dist/memory/hierarchical-memory-system.d.ts +0 -90
  134. package/dist/memory/hierarchical-memory-system.js +0 -400
  135. package/dist/memory/index.d.ts +0 -9
  136. package/dist/memory/index.js +0 -20
  137. package/dist/memory/mcp-integration-example.d.ts +0 -6
  138. package/dist/memory/mcp-integration-example.js +0 -281
  139. package/dist/memory/memory-client.d.ts +0 -199
  140. package/dist/memory/memory-client.js +0 -364
  141. package/dist/memory/memory-manager.d.ts +0 -29
  142. package/dist/memory/memory-manager.js +0 -280
  143. package/dist/memory/memory-operations.d.ts +0 -179
  144. package/dist/memory/memory-operations.js +0 -691
  145. package/dist/memory/memory-system.d.ts +0 -153
  146. package/dist/memory/memory-system.js +0 -651
  147. package/dist/memory/memory-test.d.ts +0 -6
  148. package/dist/memory/memory-test.js +0 -161
  149. package/dist/memory/snow-flow-memory-patterns.d.ts +0 -213
  150. package/dist/memory/snow-flow-memory-patterns.js +0 -200
  151. package/dist/memory/snow-memory.d.ts +0 -54
  152. package/dist/memory/snow-memory.js +0 -301
  153. package/dist/memory/swarm-memory.d.ts +0 -135
  154. package/dist/memory/swarm-memory.js +0 -378
  155. package/dist/optimization/flow-performance-optimizer.js +0 -723
  156. package/dist/orchestration/discovery/service-discovery.d.ts +0 -81
  157. package/dist/orchestration/discovery/service-discovery.js +0 -808
  158. package/dist/orchestration/distributed-orchestrator.d.ts +0 -131
  159. package/dist/orchestration/distributed-orchestrator.js +0 -712
  160. package/dist/orchestration/distribution/task-distribution-engine.d.ts +0 -53
  161. package/dist/orchestration/distribution/task-distribution-engine.js +0 -586
  162. package/dist/orchestration/flow-update-orchestrator.js +0 -648
  163. package/dist/orchestration/interfaces/distributed-orchestration.interface.d.ts +0 -606
  164. package/dist/orchestration/interfaces/distributed-orchestration.interface.js +0 -65
  165. package/dist/orchestration/protocols/mcpx-protocol.d.ts +0 -71
  166. package/dist/orchestration/protocols/mcpx-protocol.js +0 -668
  167. package/dist/orchestration/state/distributed-state-manager.d.ts +0 -89
  168. package/dist/orchestration/state/distributed-state-manager.js +0 -716
  169. package/dist/orchestrator/flow-composer.d.ts +0 -105
  170. package/dist/orchestrator/flow-composer.js +0 -404
  171. package/dist/orchestrator/flow-pattern-templates.d.ts +0 -260
  172. package/dist/orchestrator/flow-pattern-templates.js +0 -908
  173. package/dist/orchestrator/flow-subflow-decision-engine.d.ts +0 -202
  174. package/dist/orchestrator/flow-subflow-decision-engine.js +0 -769
  175. package/dist/orchestrator/flow-validation-engine.d.ts +0 -169
  176. package/dist/orchestrator/flow-validation-engine.js +0 -913
  177. package/dist/orchestrator/snow-orchestrator.d.ts +0 -49
  178. package/dist/orchestrator/snow-orchestrator.js +0 -235
  179. package/dist/orchestrator/subflow-creation-handler.d.ts +0 -230
  180. package/dist/orchestrator/subflow-creation-handler.js +0 -791
  181. package/dist/patterns/adaptive-patterns.d.ts +0 -140
  182. package/dist/patterns/adaptive-patterns.js +0 -549
  183. package/dist/queen/advanced-integration-test.d.ts +0 -48
  184. package/dist/queen/advanced-integration-test.js +0 -473
  185. package/dist/queen/integration-example.d.ts +0 -82
  186. package/dist/queen/integration-example.js +0 -219
  187. package/dist/queen/integration-test.d.ts +0 -72
  188. package/dist/queen/integration-test.js +0 -563
  189. package/dist/queen/mock-mcp-client.d.ts +0 -71
  190. package/dist/queen/mock-mcp-client.js +0 -317
  191. package/dist/queen/run-integration-tests.d.ts +0 -9
  192. package/dist/queen/run-integration-tests.js +0 -27
  193. package/dist/sparc/coordinators/adaptive-coordinator.d.ts +0 -54
  194. package/dist/sparc/coordinators/adaptive-coordinator.js +0 -367
  195. package/dist/sparc/coordinators/team-coordinator.d.ts +0 -66
  196. package/dist/sparc/coordinators/team-coordinator.js +0 -402
  197. package/dist/sparc/modes/team-modes.d.ts +0 -33
  198. package/dist/sparc/modes/team-modes.js +0 -399
  199. package/dist/sparc/teams/application-team.d.ts +0 -73
  200. package/dist/sparc/teams/application-team.js +0 -463
  201. package/dist/sparc/teams/flow-team.d.ts +0 -67
  202. package/dist/sparc/teams/flow-team.js +0 -373
  203. package/dist/sparc/teams/widget-team.d.ts +0 -61
  204. package/dist/sparc/teams/widget-team.js +0 -280
  205. package/dist/specialists/app-specialists.d.ts +0 -93
  206. package/dist/specialists/app-specialists.js +0 -1639
  207. package/dist/specialists/base-specialist.d.ts +0 -19
  208. package/dist/specialists/base-specialist.js +0 -54
  209. package/dist/specialists/flow-specialists.d.ts +0 -113
  210. package/dist/specialists/flow-specialists.js +0 -1787
  211. package/dist/specialists/individual-specialists.d.ts +0 -67
  212. package/dist/specialists/individual-specialists.js +0 -632
  213. package/dist/specialists/widget-specialists.d.ts +0 -70
  214. package/dist/specialists/widget-specialists.js +0 -1264
  215. package/dist/src/utils/agent-detector.js +0 -655
  216. package/dist/teams/adaptive-team.d.ts +0 -81
  217. package/dist/teams/adaptive-team.js +0 -1153
  218. package/dist/teams/application-team.d.ts +0 -30
  219. package/dist/teams/application-team.js +0 -547
  220. package/dist/teams/base-team.d.ts +0 -55
  221. package/dist/teams/base-team.js +0 -243
  222. package/dist/teams/flow-team.d.ts +0 -28
  223. package/dist/teams/flow-team.js +0 -525
  224. package/dist/teams/widget-team.d.ts +0 -26
  225. package/dist/teams/widget-team.js +0 -459
  226. package/dist/templates/flow-template-system.js +0 -625
  227. package/dist/test-fetch-incidents.d.ts +0 -2
  228. package/dist/test-fetch-incidents.js +0 -84
  229. package/dist/test-incident-access.d.ts +0 -2
  230. package/dist/test-incident-access.js +0 -72
  231. package/dist/test-iphone-flow.js +0 -189
  232. package/dist/test-limit-problem.d.ts +0 -2
  233. package/dist/test-limit-problem.js +0 -60
  234. package/dist/test-ml-batch-fix.d.ts +0 -2
  235. package/dist/test-ml-batch-fix.js +0 -104
  236. package/dist/test-ml-batch.d.ts +0 -2
  237. package/dist/test-ml-batch.js +0 -87
  238. package/dist/test-ml-query.d.ts +0 -2
  239. package/dist/test-ml-query.js +0 -100
  240. package/dist/test-ml-training-fix.d.ts +0 -12
  241. package/dist/test-ml-training-fix.js +0 -113
  242. package/dist/test-ml-training.d.ts +0 -2
  243. package/dist/test-ml-training.js +0 -32
  244. package/dist/test-operations-query.d.ts +0 -2
  245. package/dist/test-operations-query.js +0 -84
  246. package/dist/test-performance-query.d.ts +0 -2
  247. package/dist/test-performance-query.js +0 -52
  248. package/dist/test-singleton-protection.d.ts +0 -8
  249. package/dist/test-singleton-protection.js +0 -110
  250. package/dist/test-smart-limits.d.ts +0 -13
  251. package/dist/test-smart-limits.js +0 -100
  252. package/dist/test-snow-query-incidents.d.ts +0 -2
  253. package/dist/test-snow-query-incidents.js +0 -66
  254. package/dist/test-universal-query.d.ts +0 -2
  255. package/dist/test-universal-query.js +0 -106
  256. package/dist/testing/flow-testing-automation.js +0 -641
  257. package/dist/utils/complete-flow-xml-generator.js +0 -1285
  258. package/dist/utils/file-storage-fallback.d.ts +0 -62
  259. package/dist/utils/file-storage-fallback.js +0 -289
  260. package/dist/utils/flow-api-discovery.d.ts +0 -151
  261. package/dist/utils/flow-api-discovery.js +0 -439
  262. package/dist/utils/flow-examples.js +0 -720
  263. package/dist/utils/flow-structure-builder.js +0 -677
  264. package/dist/utils/flow-xml-generator.d.ts +0 -41
  265. package/dist/utils/flow-xml-generator.js +0 -258
  266. package/dist/utils/improved-flow-xml-generator.js +0 -820
  267. package/dist/utils/mcp-process-manager.backup.d.ts +0 -58
  268. package/dist/utils/mcp-process-manager.backup.js +0 -220
  269. package/dist/utils/mcp-singleton-enforcer.d.ts +0 -36
  270. package/dist/utils/mcp-singleton-enforcer.js +0 -201
  271. package/dist/utils/mcp-timeout-fix.d.ts +0 -53
  272. package/dist/utils/mcp-timeout-fix.js +0 -221
  273. package/dist/utils/migrate-claude-flow.d.ts +0 -22
  274. package/dist/utils/migrate-claude-flow.js +0 -120
  275. package/dist/utils/scope-utils.d.ts +0 -72
  276. package/dist/utils/scope-utils.js +0 -386
  277. package/dist/utils/snow-oauth-old.d.ts +0 -65
  278. package/dist/utils/snow-oauth-old.js +0 -345
  279. package/dist/utils/xml-first-flow-generator.js +0 -513
  280. package/memory/servicenow_artifacts/000d9224c895221055906c7518aa2d3d.json +0 -30
  281. package/memory/servicenow_artifacts/0196b66173303010e46b4a2214f6a7a2.json +0 -36
  282. package/memory/servicenow_artifacts/125e5d1d837e2a102a7ea130ceaad397.json +0 -30
  283. package/memory/servicenow_artifacts/7637c1f2b7112210a5e5911cde11a972.json +0 -30
  284. package/memory/servicenow_artifacts/default_documentation_tables_1754056582292.json +0 -55
  285. package/memory/servicenow_artifacts/default_documentation_tables_1754057477189.json +0 -55
  286. package/memory/update-set-sessions/01f82af583faea102a7ea130ceaad3d4.json +0 -9
  287. package/memory/update-set-sessions/27718fb983faea102a7ea130ceaad34b.json +0 -9
  288. package/memory/update-set-sessions/412e9bf6833e22502a7ea130ceaad30a.json +0 -8
  289. package/memory/update-set-sessions/66fc5a79837aea102a7ea130ceaad3ab.json +0 -9
  290. package/memory/update-set-sessions/71a30ff5837eea102a7ea130ceaad37f.json +0 -9
  291. package/memory/update-set-sessions/74fba27983faea102a7ea130ceaad3bd.json +0 -9
  292. package/memory/update-set-sessions/a0b147b5837eea102a7ea130ceaad344.json +0 -58
  293. package/memory/update-set-sessions/b13f5eb983baea102a7ea130ceaad33e.json +0 -9
  294. package/reports/swarm-auto-centralized-1752649029776.json +0 -13
  295. package/src/memory/README.md +0 -240
@@ -1,31 +0,0 @@
1
-
2
- const fs = require('fs');
3
- const path = require('path');
4
-
5
- const lockFile = path.join(process.env.HOME, '.claude', 'mcp-singleton.lock');
6
- const pid = process.pid;
7
-
8
- // Check if lock exists
9
- if (fs.existsSync(lockFile)) {
10
- const existingPid = fs.readFileSync(lockFile, 'utf8');
11
- try {
12
- // Check if process is still running
13
- process.kill(existingPid, 0);
14
- console.error('MCP servers already running with PID:', existingPid);
15
- process.exit(1);
16
- } catch (e) {
17
- // Process not running, remove stale lock
18
- fs.unlinkSync(lockFile);
19
- }
20
- }
21
-
22
- // Create lock
23
- fs.mkdirSync(path.dirname(lockFile), { recursive: true });
24
- fs.writeFileSync(lockFile, pid.toString());
25
-
26
- // Clean up on exit
27
- process.on('exit', () => {
28
- try {
29
- fs.unlinkSync(lockFile);
30
- } catch (e) {}
31
- });
@@ -1,6 +0,0 @@
1
- #!/usr/bin/env node
2
- /**
3
- * Simple Test MCP Server - minimal implementation for Claude Code compatibility
4
- */
5
- export {};
6
- //# sourceMappingURL=test-simple-mcp.d.ts.map
@@ -1,63 +0,0 @@
1
- #!/usr/bin/env node
2
- "use strict";
3
- /**
4
- * Simple Test MCP Server - minimal implementation for Claude Code compatibility
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- const index_js_1 = require("@modelcontextprotocol/sdk/server/index.js");
8
- const stdio_js_1 = require("@modelcontextprotocol/sdk/server/stdio.js");
9
- const types_js_1 = require("@modelcontextprotocol/sdk/types.js");
10
- class SimpleTestMCP {
11
- constructor() {
12
- this.server = new index_js_1.Server({
13
- name: 'simple-test',
14
- version: '1.0.0',
15
- }, {
16
- capabilities: {
17
- tools: {},
18
- },
19
- });
20
- this.setupHandlers();
21
- }
22
- setupHandlers() {
23
- this.server.setRequestHandler(types_js_1.ListToolsRequestSchema, async () => ({
24
- tools: [
25
- {
26
- name: 'test_tool',
27
- description: 'A simple test tool',
28
- inputSchema: {
29
- type: 'object',
30
- properties: {
31
- message: { type: 'string', description: 'Test message' }
32
- },
33
- required: ['message'],
34
- },
35
- },
36
- ],
37
- }));
38
- this.server.setRequestHandler(types_js_1.CallToolRequestSchema, async (request) => {
39
- const { name, arguments: args } = request.params;
40
- if (name === 'test_tool') {
41
- return {
42
- content: [
43
- {
44
- type: 'text',
45
- text: `Test tool called with message: ${args?.message || 'no message'}`,
46
- },
47
- ],
48
- };
49
- }
50
- throw new Error(`Unknown tool: ${name}`);
51
- });
52
- }
53
- async start() {
54
- const transport = new stdio_js_1.StdioServerTransport();
55
- await this.server.connect(transport);
56
- }
57
- }
58
- // Start the server
59
- const server = new SimpleTestMCP();
60
- server.start().catch((error) => {
61
- console.error('Failed to start Simple Test MCP:', error);
62
- process.exit(1);
63
- });
@@ -1,90 +0,0 @@
1
- /**
2
- * Hierarchical Memory System for Snow-Flow
3
- * Extends base MemorySystem with ServiceNow-specific patterns
4
- */
5
- import { MemorySystem, MemoryOptions } from './memory-system';
6
- export interface HierarchicalMemoryEntry {
7
- key: string;
8
- value: any;
9
- namespace: string;
10
- type: string;
11
- metadata?: {
12
- created: string;
13
- updated: string;
14
- version: number;
15
- tags: string[];
16
- relationships?: Record<string, string[]>;
17
- dependencies?: Record<string, string[]>;
18
- };
19
- ttl?: number;
20
- }
21
- export interface MemorySearchOptions {
22
- namespace?: string;
23
- type?: string;
24
- tags?: string[];
25
- pattern?: string;
26
- limit?: number;
27
- includeExpired?: boolean;
28
- }
29
- export declare class HierarchicalMemorySystem extends MemorySystem {
30
- private namespaceIndex;
31
- private typeIndex;
32
- private tagIndex;
33
- constructor(options: MemoryOptions);
34
- /**
35
- * Initialize with enhanced tables for hierarchical storage
36
- */
37
- initialize(): Promise<void>;
38
- /**
39
- * Create additional tables for hierarchical organization
40
- */
41
- private createHierarchicalTables;
42
- /**
43
- * Store with hierarchical organization
44
- */
45
- storeHierarchical(entry: Partial<HierarchicalMemoryEntry>): Promise<void>;
46
- /**
47
- * Get with full hierarchical metadata
48
- */
49
- getHierarchical(key: string): Promise<HierarchicalMemoryEntry | null>;
50
- /**
51
- * Search with hierarchical patterns
52
- */
53
- search(options: MemorySearchOptions): Promise<HierarchicalMemoryEntry[]>;
54
- /**
55
- * Create relationship between entries
56
- */
57
- createRelationship(sourceKey: string, targetKey: string, relationshipType: string, metadata?: any): Promise<void>;
58
- /**
59
- * Get related entries
60
- */
61
- getRelated(key: string, relationshipType?: string): Promise<HierarchicalMemoryEntry[]>;
62
- /**
63
- * Associate memory with agent
64
- */
65
- associateWithAgent(agentId: string, memoryKey: string, accessType: 'read' | 'write' | 'owner'): Promise<void>;
66
- /**
67
- * Get agent's memory entries
68
- */
69
- getAgentMemory(agentId: string, accessType?: string): Promise<HierarchicalMemoryEntry[]>;
70
- /**
71
- * Track access pattern for learning
72
- */
73
- trackAccessPattern(patternType: string, metadata?: any): Promise<void>;
74
- /**
75
- * Get namespace statistics
76
- */
77
- getNamespaceStats(): Promise<Record<string, number>>;
78
- /**
79
- * Helper methods
80
- */
81
- private updateTags;
82
- private getTags;
83
- private updateLocalIndexes;
84
- private buildIndexes;
85
- /**
86
- * Cleanup expired entries
87
- */
88
- cleanupExpired(): Promise<number>;
89
- }
90
- //# sourceMappingURL=hierarchical-memory-system.d.ts.map
@@ -1,400 +0,0 @@
1
- "use strict";
2
- /**
3
- * Hierarchical Memory System for Snow-Flow
4
- * Extends base MemorySystem with ServiceNow-specific patterns
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.HierarchicalMemorySystem = void 0;
8
- const memory_system_1 = require("./memory-system");
9
- class HierarchicalMemorySystem extends memory_system_1.MemorySystem {
10
- constructor(options) {
11
- super(options);
12
- this.namespaceIndex = new Map();
13
- this.typeIndex = new Map();
14
- this.tagIndex = new Map();
15
- }
16
- /**
17
- * Initialize with enhanced tables for hierarchical storage
18
- */
19
- async initialize() {
20
- await super.initialize();
21
- await this.createHierarchicalTables();
22
- await this.buildIndexes();
23
- }
24
- /**
25
- * Create additional tables for hierarchical organization
26
- */
27
- async createHierarchicalTables() {
28
- const tables = [
29
- // Enhanced memory store with namespace and type
30
- `CREATE TABLE IF NOT EXISTS hierarchical_memory (
31
- key TEXT PRIMARY KEY,
32
- namespace TEXT NOT NULL,
33
- type TEXT NOT NULL,
34
- value TEXT NOT NULL,
35
- metadata TEXT,
36
- ttl INTEGER,
37
- created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
38
- updated_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
39
- expires_at INTEGER,
40
- version INTEGER DEFAULT 1
41
- )`,
42
- // Tag associations
43
- `CREATE TABLE IF NOT EXISTS memory_tags (
44
- key TEXT NOT NULL,
45
- tag TEXT NOT NULL,
46
- PRIMARY KEY (key, tag),
47
- FOREIGN KEY (key) REFERENCES hierarchical_memory(key) ON DELETE CASCADE
48
- )`,
49
- // Relationships between memory entries
50
- `CREATE TABLE IF NOT EXISTS memory_relationships (
51
- source_key TEXT NOT NULL,
52
- target_key TEXT NOT NULL,
53
- relationship_type TEXT NOT NULL,
54
- metadata TEXT,
55
- created_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
56
- PRIMARY KEY (source_key, target_key, relationship_type),
57
- FOREIGN KEY (source_key) REFERENCES hierarchical_memory(key) ON DELETE CASCADE,
58
- FOREIGN KEY (target_key) REFERENCES hierarchical_memory(key) ON DELETE CASCADE
59
- )`,
60
- // Agent memory associations
61
- `CREATE TABLE IF NOT EXISTS agent_memory (
62
- agent_id TEXT NOT NULL,
63
- memory_key TEXT NOT NULL,
64
- access_type TEXT NOT NULL, -- 'read', 'write', 'owner'
65
- accessed_at INTEGER DEFAULT (strftime('%s', 'now') * 1000),
66
- PRIMARY KEY (agent_id, memory_key),
67
- FOREIGN KEY (memory_key) REFERENCES hierarchical_memory(key) ON DELETE CASCADE
68
- )`,
69
- // Memory access patterns for learning
70
- `CREATE TABLE IF NOT EXISTS memory_access_patterns (
71
- pattern_id TEXT PRIMARY KEY,
72
- pattern_type TEXT NOT NULL,
73
- frequency INTEGER DEFAULT 1,
74
- last_accessed INTEGER DEFAULT (strftime('%s', 'now') * 1000),
75
- metadata TEXT
76
- )`,
77
- ];
78
- for (const table of tables) {
79
- await this.execute(table);
80
- }
81
- // Create indexes for performance
82
- const indexes = [
83
- 'CREATE INDEX IF NOT EXISTS idx_namespace ON hierarchical_memory(namespace)',
84
- 'CREATE INDEX IF NOT EXISTS idx_type ON hierarchical_memory(type)',
85
- 'CREATE INDEX IF NOT EXISTS idx_expires ON hierarchical_memory(expires_at)',
86
- 'CREATE INDEX IF NOT EXISTS idx_tags ON memory_tags(tag)',
87
- 'CREATE INDEX IF NOT EXISTS idx_relationships ON memory_relationships(relationship_type)',
88
- 'CREATE INDEX IF NOT EXISTS idx_agent_memory ON agent_memory(agent_id)',
89
- ];
90
- for (const index of indexes) {
91
- await this.execute(index);
92
- }
93
- }
94
- /**
95
- * Store with hierarchical organization
96
- */
97
- async storeHierarchical(entry) {
98
- if (!entry.key)
99
- throw new Error('Key is required');
100
- // Extract namespace and type from key pattern
101
- const keyParts = entry.key.split('/');
102
- const namespace = entry.namespace || keyParts[0] || 'default';
103
- const type = entry.type || keyParts[1] || 'general';
104
- const metadata = {
105
- created: new Date().toISOString(),
106
- updated: new Date().toISOString(),
107
- version: 1,
108
- tags: entry.metadata?.tags || [],
109
- relationships: entry.metadata?.relationships || {},
110
- dependencies: entry.metadata?.dependencies || {},
111
- ...entry.metadata,
112
- };
113
- const ttl = entry.ttl || 86400000 * 7; // 7 days default
114
- const expiresAt = Date.now() + ttl;
115
- // Check if exists for versioning
116
- const existing = await this.getHierarchical(entry.key);
117
- if (existing) {
118
- metadata.version = (existing.metadata?.version || 0) + 1;
119
- metadata.created = existing.metadata?.created || metadata.created;
120
- }
121
- // Store in hierarchical table
122
- await this.execute(`
123
- INSERT OR REPLACE INTO hierarchical_memory
124
- (key, namespace, type, value, metadata, ttl, expires_at, version, updated_at)
125
- VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)
126
- `, [
127
- entry.key,
128
- namespace,
129
- type,
130
- JSON.stringify(entry.value),
131
- JSON.stringify(metadata),
132
- ttl,
133
- expiresAt,
134
- metadata.version,
135
- Date.now()
136
- ]);
137
- // Update tags
138
- if (metadata.tags.length > 0) {
139
- await this.updateTags(entry.key, metadata.tags);
140
- }
141
- // Update indexes
142
- this.updateLocalIndexes(entry.key, namespace, type, metadata.tags);
143
- // Store in base system for compatibility
144
- await super.store(entry.key, entry.value, ttl);
145
- this.emit('memory:hierarchical:stored', { key: entry.key, namespace, type });
146
- }
147
- /**
148
- * Get with full hierarchical metadata
149
- */
150
- async getHierarchical(key) {
151
- const result = await this.query(`
152
- SELECT * FROM hierarchical_memory
153
- WHERE key = ? AND expires_at > ?
154
- `, [key, Date.now()]);
155
- if (!result || result.length === 0)
156
- return null;
157
- const row = result[0];
158
- const tags = await this.getTags(key);
159
- return {
160
- key: row.key,
161
- namespace: row.namespace,
162
- type: row.type,
163
- value: JSON.parse(row.value),
164
- metadata: {
165
- ...JSON.parse(row.metadata || '{}'),
166
- tags,
167
- },
168
- ttl: row.ttl,
169
- };
170
- }
171
- /**
172
- * Search with hierarchical patterns
173
- */
174
- async search(options) {
175
- let sql = 'SELECT DISTINCT h.* FROM hierarchical_memory h';
176
- const params = [];
177
- const conditions = [];
178
- // Join with tags if needed
179
- if (options.tags && options.tags.length > 0) {
180
- sql += ' INNER JOIN memory_tags t ON h.key = t.key';
181
- conditions.push(`t.tag IN (${options.tags.map(() => '?').join(',')})`);
182
- params.push(...options.tags);
183
- }
184
- // Add namespace filter
185
- if (options.namespace) {
186
- conditions.push('h.namespace = ?');
187
- params.push(options.namespace);
188
- }
189
- // Add type filter
190
- if (options.type) {
191
- conditions.push('h.type = ?');
192
- params.push(options.type);
193
- }
194
- // Add pattern matching
195
- if (options.pattern) {
196
- conditions.push('h.key LIKE ?');
197
- params.push(`%${options.pattern}%`);
198
- }
199
- // Add expiration filter
200
- if (!options.includeExpired) {
201
- conditions.push('h.expires_at > ?');
202
- params.push(Date.now());
203
- }
204
- // Combine conditions
205
- if (conditions.length > 0) {
206
- sql += ' WHERE ' + conditions.join(' AND ');
207
- }
208
- // Add ordering and limit
209
- sql += ' ORDER BY h.updated_at DESC';
210
- if (options.limit) {
211
- sql += ' LIMIT ?';
212
- params.push(options.limit);
213
- }
214
- const results = await this.query(sql, params);
215
- // Fetch tags and format results
216
- const entries = [];
217
- for (const row of results) {
218
- const tags = await this.getTags(row.key);
219
- entries.push({
220
- key: row.key,
221
- namespace: row.namespace,
222
- type: row.type,
223
- value: JSON.parse(row.value),
224
- metadata: {
225
- ...JSON.parse(row.metadata || '{}'),
226
- tags,
227
- },
228
- ttl: row.ttl,
229
- });
230
- }
231
- return entries;
232
- }
233
- /**
234
- * Create relationship between entries
235
- */
236
- async createRelationship(sourceKey, targetKey, relationshipType, metadata) {
237
- await this.execute(`
238
- INSERT OR REPLACE INTO memory_relationships
239
- (source_key, target_key, relationship_type, metadata)
240
- VALUES (?, ?, ?, ?)
241
- `, [sourceKey, targetKey, relationshipType, JSON.stringify(metadata || {})]);
242
- this.emit('memory:relationship:created', { sourceKey, targetKey, relationshipType });
243
- }
244
- /**
245
- * Get related entries
246
- */
247
- async getRelated(key, relationshipType) {
248
- let sql = `
249
- SELECT DISTINCT h.*
250
- FROM hierarchical_memory h
251
- INNER JOIN memory_relationships r ON (h.key = r.target_key OR h.key = r.source_key)
252
- WHERE (r.source_key = ? OR r.target_key = ?) AND h.key != ?
253
- `;
254
- const params = [key, key, key];
255
- if (relationshipType) {
256
- sql += ' AND r.relationship_type = ?';
257
- params.push(relationshipType);
258
- }
259
- const results = await this.query(sql, params);
260
- const entries = [];
261
- for (const row of results) {
262
- const entry = await this.getHierarchical(row.key);
263
- if (entry)
264
- entries.push(entry);
265
- }
266
- return entries;
267
- }
268
- /**
269
- * Associate memory with agent
270
- */
271
- async associateWithAgent(agentId, memoryKey, accessType) {
272
- await this.execute(`
273
- INSERT OR REPLACE INTO agent_memory (agent_id, memory_key, access_type)
274
- VALUES (?, ?, ?)
275
- `, [agentId, memoryKey, accessType]);
276
- }
277
- /**
278
- * Get agent's memory entries
279
- */
280
- async getAgentMemory(agentId, accessType) {
281
- let sql = `
282
- SELECT h.* FROM hierarchical_memory h
283
- INNER JOIN agent_memory a ON h.key = a.memory_key
284
- WHERE a.agent_id = ?
285
- `;
286
- const params = [agentId];
287
- if (accessType) {
288
- sql += ' AND a.access_type = ?';
289
- params.push(accessType);
290
- }
291
- const results = await this.query(sql, params);
292
- const entries = [];
293
- for (const row of results) {
294
- const entry = await this.getHierarchical(row.key);
295
- if (entry)
296
- entries.push(entry);
297
- }
298
- return entries;
299
- }
300
- /**
301
- * Track access pattern for learning
302
- */
303
- async trackAccessPattern(patternType, metadata) {
304
- const patternId = `${patternType}_${Date.now()}`;
305
- await this.execute(`
306
- INSERT INTO memory_access_patterns (pattern_id, pattern_type, metadata)
307
- VALUES (?, ?, ?)
308
- ON CONFLICT(pattern_id) DO UPDATE SET
309
- frequency = frequency + 1,
310
- last_accessed = strftime('%s', 'now') * 1000
311
- `, [patternId, patternType, JSON.stringify(metadata || {})]);
312
- }
313
- /**
314
- * Get namespace statistics
315
- */
316
- async getNamespaceStats() {
317
- const results = await this.query(`
318
- SELECT namespace, COUNT(*) as count
319
- FROM hierarchical_memory
320
- WHERE expires_at > ?
321
- GROUP BY namespace
322
- `, [Date.now()]);
323
- const stats = {};
324
- for (const row of results) {
325
- stats[row.namespace] = row.count;
326
- }
327
- return stats;
328
- }
329
- /**
330
- * Helper methods
331
- */
332
- async updateTags(key, tags) {
333
- // Remove existing tags
334
- await this.execute('DELETE FROM memory_tags WHERE key = ?', [key]);
335
- // Insert new tags
336
- for (const tag of tags) {
337
- await this.execute('INSERT INTO memory_tags (key, tag) VALUES (?, ?)', [key, tag]);
338
- }
339
- }
340
- async getTags(key) {
341
- const results = await this.query('SELECT tag FROM memory_tags WHERE key = ?', [key]);
342
- return results.map(r => r.tag);
343
- }
344
- updateLocalIndexes(key, namespace, type, tags) {
345
- // Update namespace index
346
- if (!this.namespaceIndex.has(namespace)) {
347
- this.namespaceIndex.set(namespace, new Set());
348
- }
349
- this.namespaceIndex.get(namespace).add(key);
350
- // Update type index
351
- if (!this.typeIndex.has(type)) {
352
- this.typeIndex.set(type, new Set());
353
- }
354
- this.typeIndex.get(type).add(key);
355
- // Update tag index
356
- for (const tag of tags) {
357
- if (!this.tagIndex.has(tag)) {
358
- this.tagIndex.set(tag, new Set());
359
- }
360
- this.tagIndex.get(tag).add(key);
361
- }
362
- }
363
- async buildIndexes() {
364
- // Build indexes from existing data
365
- const results = await this.query(`
366
- SELECT key, namespace, type FROM hierarchical_memory
367
- WHERE expires_at > ?
368
- `, [Date.now()]);
369
- for (const row of results) {
370
- const tags = await this.getTags(row.key);
371
- this.updateLocalIndexes(row.key, row.namespace, row.type, tags);
372
- }
373
- }
374
- /**
375
- * Cleanup expired entries
376
- */
377
- async cleanupExpired() {
378
- const result = await this.query(`
379
- DELETE FROM hierarchical_memory
380
- WHERE expires_at <= ?
381
- RETURNING key
382
- `, [Date.now()]);
383
- // Update local indexes
384
- for (const row of result) {
385
- // Remove from indexes
386
- for (const [namespace, keys] of this.namespaceIndex) {
387
- keys.delete(row.key);
388
- }
389
- for (const [type, keys] of this.typeIndex) {
390
- keys.delete(row.key);
391
- }
392
- for (const [tag, keys] of this.tagIndex) {
393
- keys.delete(row.key);
394
- }
395
- }
396
- return result.length;
397
- }
398
- }
399
- exports.HierarchicalMemorySystem = HierarchicalMemorySystem;
400
- //# sourceMappingURL=hierarchical-memory-system.js.map
@@ -1,9 +0,0 @@
1
- /**
2
- * Snow-Flow Memory System Exports
3
- * Centralized exports for the SQLite memory system
4
- */
5
- export { SwarmMemory, SwarmMemoryConfig, AgentCoordination, ServiceNowArtifactRecord, AgentMessage, SharedContext, DeploymentHistory, AgentDependency, PerformanceMetric } from './swarm-memory.js';
6
- export { MemoryOperations, AgentCoordinationUpdate, ArtifactSearchOptions, MessageSearchOptions, PerformanceQuery } from './memory-operations.js';
7
- export { MemoryClient, MemoryClientConfig, MemoryStoreOptions, MemoryRetrieveOptions, ArtifactInfo, AgentHandoff, PerformanceTracker } from './memory-client.js';
8
- export { ServiceNowArtifactIndexer, ServiceNowArtifact, FlowArtifact, WidgetArtifact, IndexedArtifact, ArtifactStructure, ArtifactContext, ArtifactRelationships, ModificationPoint, EditHistory } from './servicenow-artifact-indexer.js';
9
- //# sourceMappingURL=index.d.ts.map
@@ -1,20 +0,0 @@
1
- "use strict";
2
- /**
3
- * Snow-Flow Memory System Exports
4
- * Centralized exports for the SQLite memory system
5
- */
6
- Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.ServiceNowArtifactIndexer = exports.MemoryClient = exports.MemoryOperations = exports.SwarmMemory = void 0;
8
- // Core memory system
9
- var swarm_memory_js_1 = require("./swarm-memory.js");
10
- Object.defineProperty(exports, "SwarmMemory", { enumerable: true, get: function () { return swarm_memory_js_1.SwarmMemory; } });
11
- // Memory operations
12
- var memory_operations_js_1 = require("./memory-operations.js");
13
- Object.defineProperty(exports, "MemoryOperations", { enumerable: true, get: function () { return memory_operations_js_1.MemoryOperations; } });
14
- // Memory client API
15
- var memory_client_js_1 = require("./memory-client.js");
16
- Object.defineProperty(exports, "MemoryClient", { enumerable: true, get: function () { return memory_client_js_1.MemoryClient; } });
17
- // Existing artifact indexer (for compatibility)
18
- var servicenow_artifact_indexer_js_1 = require("./servicenow-artifact-indexer.js");
19
- Object.defineProperty(exports, "ServiceNowArtifactIndexer", { enumerable: true, get: function () { return servicenow_artifact_indexer_js_1.ServiceNowArtifactIndexer; } });
20
- //# sourceMappingURL=index.js.map
@@ -1,6 +0,0 @@
1
- /**
2
- * Snow-Flow Memory System MCP Integration Example
3
- * Shows how MCP tools integrate with the memory system
4
- */
5
- export {};
6
- //# sourceMappingURL=mcp-integration-example.d.ts.map