agentic-flow 2.0.1-alpha.23 β†’ 2.0.1-alpha.32

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 (167) hide show
  1. package/CHANGELOG.md +189 -0
  2. package/dist/.tsbuildinfo +1 -1
  3. package/dist/agents/claudeAgent.d.ts +3 -0
  4. package/dist/agents/claudeAgent.d.ts.map +1 -1
  5. package/dist/agents/claudeAgent.js +148 -20
  6. package/dist/agents/claudeAgent.js.map +1 -1
  7. package/dist/agents/directApiAgent.d.ts.map +1 -1
  8. package/dist/agents/directApiAgent.js +6 -5
  9. package/dist/agents/directApiAgent.js.map +1 -1
  10. package/dist/cli/commands/hooks.d.ts.map +1 -1
  11. package/dist/cli/commands/hooks.js +176 -8
  12. package/dist/cli/commands/hooks.js.map +1 -1
  13. package/dist/cli/commands/swarm.d.ts +17 -0
  14. package/dist/cli/commands/swarm.d.ts.map +1 -0
  15. package/dist/cli/commands/swarm.js +325 -0
  16. package/dist/cli/commands/swarm.js.map +1 -0
  17. package/dist/cli-proxy.js +32 -1
  18. package/dist/cli-proxy.js.map +1 -1
  19. package/dist/config/claudeFlow.d.ts +1 -1
  20. package/dist/hooks/p2p-swarm-hooks.d.ts +105 -0
  21. package/dist/hooks/p2p-swarm-hooks.d.ts.map +1 -0
  22. package/dist/hooks/p2p-swarm-hooks.js +260 -0
  23. package/dist/hooks/p2p-swarm-hooks.js.map +1 -0
  24. package/dist/intelligence/agent-booster-enhanced.d.ts +42 -1
  25. package/dist/intelligence/agent-booster-enhanced.d.ts.map +1 -1
  26. package/dist/intelligence/agent-booster-enhanced.js +199 -20
  27. package/dist/intelligence/agent-booster-enhanced.js.map +1 -1
  28. package/dist/intelligence/index.d.ts +6 -0
  29. package/dist/intelligence/index.d.ts.map +1 -1
  30. package/dist/intelligence/index.js +12 -0
  31. package/dist/intelligence/index.js.map +1 -1
  32. package/dist/intelligence/wasm-acceleration.d.ts +168 -0
  33. package/dist/intelligence/wasm-acceleration.d.ts.map +1 -0
  34. package/dist/intelligence/wasm-acceleration.js +303 -0
  35. package/dist/intelligence/wasm-acceleration.js.map +1 -0
  36. package/dist/mcp/claudeFlowSdkServer.d.ts.map +1 -1
  37. package/dist/mcp/claudeFlowSdkServer.js +134 -0
  38. package/dist/mcp/claudeFlowSdkServer.js.map +1 -1
  39. package/dist/mcp/fastmcp/servers/stdio-full.js +147 -79
  40. package/dist/mcp/fastmcp/servers/stdio-full.js.map +1 -1
  41. package/dist/mcp/fastmcp/tools/hooks/intelligence-bridge.d.ts +55 -0
  42. package/dist/mcp/fastmcp/tools/hooks/intelligence-bridge.d.ts.map +1 -1
  43. package/dist/mcp/fastmcp/tools/hooks/intelligence-bridge.js +332 -8
  44. package/dist/mcp/fastmcp/tools/hooks/intelligence-bridge.js.map +1 -1
  45. package/dist/mcp/fastmcp/tools/swarm/p2p-swarm-tools.d.ts +650 -0
  46. package/dist/mcp/fastmcp/tools/swarm/p2p-swarm-tools.d.ts.map +1 -0
  47. package/dist/mcp/fastmcp/tools/swarm/p2p-swarm-tools.js +405 -0
  48. package/dist/mcp/fastmcp/tools/swarm/p2p-swarm-tools.js.map +1 -0
  49. package/dist/mcp/tools/enhanced-booster-tools.d.ts.map +1 -1
  50. package/dist/mcp/tools/enhanced-booster-tools.js +16 -0
  51. package/dist/mcp/tools/enhanced-booster-tools.js.map +1 -1
  52. package/dist/middleware/auth.middleware.d.ts +11 -3
  53. package/dist/middleware/auth.middleware.d.ts.map +1 -1
  54. package/dist/middleware/auth.middleware.js +47 -9
  55. package/dist/middleware/auth.middleware.js.map +1 -1
  56. package/dist/optimizations/configuration-tuning.d.ts +1 -1
  57. package/dist/proxy/websocket-proxy.d.ts.map +1 -1
  58. package/dist/proxy/websocket-proxy.js +1 -0
  59. package/dist/proxy/websocket-proxy.js.map +1 -1
  60. package/dist/reasoningbank/backend-selector.d.ts +1 -1
  61. package/dist/routing/TinyDancerRouter.d.ts +161 -0
  62. package/dist/routing/TinyDancerRouter.d.ts.map +1 -0
  63. package/dist/routing/TinyDancerRouter.js +408 -0
  64. package/dist/routing/TinyDancerRouter.js.map +1 -0
  65. package/dist/sdk/agent-converter.d.ts +41 -0
  66. package/dist/sdk/agent-converter.d.ts.map +1 -0
  67. package/dist/sdk/agent-converter.js +188 -0
  68. package/dist/sdk/agent-converter.js.map +1 -0
  69. package/dist/sdk/e2b-sandbox.d.ts +105 -0
  70. package/dist/sdk/e2b-sandbox.d.ts.map +1 -0
  71. package/dist/sdk/e2b-sandbox.js +419 -0
  72. package/dist/sdk/e2b-sandbox.js.map +1 -0
  73. package/dist/sdk/e2b-swarm-optimizer.d.ts +116 -0
  74. package/dist/sdk/e2b-swarm-optimizer.d.ts.map +1 -0
  75. package/dist/sdk/e2b-swarm-optimizer.js +253 -0
  76. package/dist/sdk/e2b-swarm-optimizer.js.map +1 -0
  77. package/dist/sdk/e2b-swarm.d.ts +160 -0
  78. package/dist/sdk/e2b-swarm.d.ts.map +1 -0
  79. package/dist/sdk/e2b-swarm.js +366 -0
  80. package/dist/sdk/e2b-swarm.js.map +1 -0
  81. package/dist/sdk/hooks-bridge.d.ts +109 -0
  82. package/dist/sdk/hooks-bridge.d.ts.map +1 -0
  83. package/dist/sdk/hooks-bridge.js +235 -0
  84. package/dist/sdk/hooks-bridge.js.map +1 -0
  85. package/dist/sdk/index.d.ts +17 -0
  86. package/dist/sdk/index.d.ts.map +1 -0
  87. package/dist/sdk/index.js +28 -0
  88. package/dist/sdk/index.js.map +1 -0
  89. package/dist/sdk/permission-handler.d.ts +53 -0
  90. package/dist/sdk/permission-handler.d.ts.map +1 -0
  91. package/dist/sdk/permission-handler.js +229 -0
  92. package/dist/sdk/permission-handler.js.map +1 -0
  93. package/dist/sdk/plugins.d.ts +102 -0
  94. package/dist/sdk/plugins.d.ts.map +1 -0
  95. package/dist/sdk/plugins.js +279 -0
  96. package/dist/sdk/plugins.js.map +1 -0
  97. package/dist/sdk/query-control.d.ts +158 -0
  98. package/dist/sdk/query-control.d.ts.map +1 -0
  99. package/dist/sdk/query-control.js +273 -0
  100. package/dist/sdk/query-control.js.map +1 -0
  101. package/dist/sdk/security.d.ts +120 -0
  102. package/dist/sdk/security.d.ts.map +1 -0
  103. package/dist/sdk/security.js +329 -0
  104. package/dist/sdk/security.js.map +1 -0
  105. package/dist/sdk/session-manager.d.ts +112 -0
  106. package/dist/sdk/session-manager.d.ts.map +1 -0
  107. package/dist/sdk/session-manager.js +181 -0
  108. package/dist/sdk/session-manager.js.map +1 -0
  109. package/dist/sdk/streaming-input.d.ts +153 -0
  110. package/dist/sdk/streaming-input.d.ts.map +1 -0
  111. package/dist/sdk/streaming-input.js +336 -0
  112. package/dist/sdk/streaming-input.js.map +1 -0
  113. package/dist/swarm/index.d.ts +4 -0
  114. package/dist/swarm/index.d.ts.map +1 -1
  115. package/dist/swarm/index.js +12 -1
  116. package/dist/swarm/index.js.map +1 -1
  117. package/dist/swarm/ipfs-swarm.d.ts +265 -0
  118. package/dist/swarm/ipfs-swarm.d.ts.map +1 -0
  119. package/dist/swarm/ipfs-swarm.js +508 -0
  120. package/dist/swarm/ipfs-swarm.js.map +1 -0
  121. package/dist/swarm/p2p-free-swarm.d.ts +344 -0
  122. package/dist/swarm/p2p-free-swarm.d.ts.map +1 -0
  123. package/dist/swarm/p2p-free-swarm.js +603 -0
  124. package/dist/swarm/p2p-free-swarm.js.map +1 -0
  125. package/dist/swarm/p2p-swarm-v2.d.ts +634 -0
  126. package/dist/swarm/p2p-swarm-v2.d.ts.map +1 -0
  127. package/dist/swarm/p2p-swarm-v2.js +1787 -0
  128. package/dist/swarm/p2p-swarm-v2.js.map +1 -0
  129. package/dist/swarm/p2p-swarm-wasm.d.ts +162 -0
  130. package/dist/swarm/p2p-swarm-wasm.d.ts.map +1 -0
  131. package/dist/swarm/p2p-swarm-wasm.js +315 -0
  132. package/dist/swarm/p2p-swarm-wasm.js.map +1 -0
  133. package/dist/swarm/real-p2p-swarm.d.ts +183 -0
  134. package/dist/swarm/real-p2p-swarm.d.ts.map +1 -0
  135. package/dist/swarm/real-p2p-swarm.js +469 -0
  136. package/dist/swarm/real-p2p-swarm.js.map +1 -0
  137. package/dist/utils/cli.d.ts +13 -1
  138. package/dist/utils/cli.d.ts.map +1 -1
  139. package/dist/utils/cli.js +160 -0
  140. package/dist/utils/cli.js.map +1 -1
  141. package/dist/utils/logger.d.ts +15 -0
  142. package/dist/utils/logger.d.ts.map +1 -1
  143. package/dist/utils/logger.js +111 -4
  144. package/dist/utils/logger.js.map +1 -1
  145. package/dist/utils/rate-limiter.d.ts +53 -1
  146. package/dist/utils/rate-limiter.d.ts.map +1 -1
  147. package/dist/utils/rate-limiter.js +134 -11
  148. package/dist/utils/rate-limiter.js.map +1 -1
  149. package/dist/utils/safe-exec.d.ts +103 -0
  150. package/dist/utils/safe-exec.d.ts.map +1 -0
  151. package/dist/utils/safe-exec.js +205 -0
  152. package/dist/utils/safe-exec.js.map +1 -0
  153. package/dist/wasm/edge-full.d.ts +366 -0
  154. package/dist/wasm/edge-full.d.ts.map +1 -0
  155. package/dist/wasm/edge-full.js +637 -0
  156. package/dist/wasm/edge-full.js.map +1 -0
  157. package/dist/wasm/onnx-embeddings-wasm.d.ts +123 -0
  158. package/dist/wasm/onnx-embeddings-wasm.d.ts.map +1 -0
  159. package/dist/wasm/onnx-embeddings-wasm.js +310 -0
  160. package/dist/wasm/onnx-embeddings-wasm.js.map +1 -0
  161. package/dist/wasm/ruvector-edge.d.ts +109 -0
  162. package/dist/wasm/ruvector-edge.d.ts.map +1 -0
  163. package/dist/wasm/ruvector-edge.js +353 -0
  164. package/dist/wasm/ruvector-edge.js.map +1 -0
  165. package/docs/IMPROVEMENT_ROADMAP.md +184 -0
  166. package/package.json +10 -8
  167. package/validation/sdk-integration-test.ts +208 -0
package/CHANGELOG.md CHANGED
@@ -2,6 +2,195 @@
2
2
 
3
3
  All notable changes to this project will be documented in this file.
4
4
 
5
+ ## [2.0.1-alpha.29] - 2025-12-31
6
+
7
+ ### Added
8
+ - **E2B Sandbox Integration**: Secure cloud sandboxes for AI code execution
9
+ - Firecracker-based isolation with Code Interpreter support
10
+ - Python, JavaScript, and shell execution
11
+ - File system access and package installation
12
+ - `E2BSandboxManager`, `runInE2BSandbox()`, `isE2BAvailable()`
13
+
14
+ - **Query Control System**: Runtime control of active SDK queries
15
+ - Change model mid-execution (`setModel()`)
16
+ - Switch permission modes (`setPermissionMode()`)
17
+ - Interrupt, resume, and abort queries
18
+ - Query introspection (commands, models, MCP status)
19
+ - `createQueryController()`, `getActiveQueries()`, `abortAllQueries()`
20
+
21
+ - **Plugins System**: Flexible plugin loading and management
22
+ - Load from local filesystem, NPM packages, remote URLs, or inline
23
+ - Plugin tool execution with typed definitions
24
+ - Checksum verification for remote plugins
25
+ - `loadPlugin()`, `getAllPluginTools()`, `executePluginTool()`, `defineTool()`
26
+
27
+ - **Streaming Input Mode**: Async iterable prompts for SDK
28
+ - `StreamingPromptBuilder` with fluent API
29
+ - `InteractivePromptStream` for real-time input
30
+ - Transform, filter, batch, and rate-limit operations
31
+ - `streamingPrompt()`, `createInteractiveStream()`, `fromArray()`
32
+
33
+ - **Security Module**: Comprehensive security hardening
34
+ - Path sanitization with traversal protection
35
+ - Command injection detection (20+ patterns)
36
+ - Secret redaction (API keys, tokens, DB URLs, private keys)
37
+ - Rate limiting with sliding window
38
+ - Audit logging with file persistence
39
+ - `sanitizePath()`, `validateCommand()`, `redactSecrets()`, `checkRateLimit()`, `auditLog()`
40
+
41
+ ### Tests
42
+ - 47 security tests covering all security functions
43
+ - 46 SDK module tests for E2B, query control, plugins, and streaming
44
+ - All 93 tests passing
45
+
46
+ ## [2.0.1-alpha.28] - 2025-12-31
47
+
48
+ ### Added
49
+ - **SDK Structured Outputs**: `outputFormat` with JSON schema support
50
+ - **SDK Sandbox Configuration**: Environment variable control for sandbox mode
51
+ - **Beta Features**: 1M context window support (`SDK_ENABLE_BETAS=true`)
52
+ - **Query Limits**: `maxTurns` and `maxBudgetUsd` controls
53
+ - **File Checkpointing**: Persistent session state (`SDK_FILE_CHECKPOINTING=true`)
54
+
55
+ ### Environment Variables
56
+ - `SDK_OUTPUT_SCHEMA` - JSON schema for structured output
57
+ - `SDK_ENABLE_SANDBOX` - Enable SDK sandbox mode
58
+ - `SDK_ENABLE_BETAS` - Enable beta features (1M context)
59
+ - `SDK_MAX_TURNS` - Maximum conversation turns
60
+ - `SDK_MAX_BUDGET_USD` - Maximum cost limit
61
+ - `SDK_FILE_CHECKPOINTING` - Enable file checkpointing
62
+
63
+ ## [2.0.1-alpha.27] - 2025-12-31
64
+
65
+ ### Fixed
66
+ - **Permission Handler**: Overly broad command substitution blocking
67
+ - Changed `/\$\(.*\)/` to specific dangerous patterns
68
+ - Safe patterns like `$(date)` now allowed
69
+ - **Memory Leaks**: Added TTL-based cleanup for Maps
70
+ - `activeTrajectories`: 5-minute TTL with 2-minute cleanup
71
+ - `activeSessions`: 30-minute TTL with 5-minute cleanup
72
+ - **Agent Converter**: Added 1-minute cache for converted agents
73
+ - `invalidateAgentCache()` function for manual cache clearing
74
+
75
+ ### Added
76
+ - New dangerous patterns: `git push --force`, `npm publish`, `cat .env`
77
+ - TTL cleanup intervals for trajectory and session Maps
78
+ - Agent conversion caching for performance
79
+
80
+ ### Tests
81
+ - 20 permission handler tests (all passing)
82
+ - Includes git force push, npm publish, safe command substitution
83
+
84
+ ## [2.0.1-alpha.26] - 2025-12-31
85
+
86
+ ### Added
87
+ - **SDK Integration Module**: Full Claude Agent SDK v0.1.76 support
88
+ - Hooks bridge with trajectory tracking
89
+ - Session management with resume/fork
90
+ - Custom permission handlers
91
+ - Agent converter for subagent spawning
92
+ - All 17 SDK tools enabled
93
+
94
+ ### Exports (src/sdk/index.ts)
95
+ - Hooks: `preToolUseHook`, `postToolUseHook`, `sessionStartHook`, etc.
96
+ - Sessions: `captureSessionId`, `getResumeOptions`, `getForkOptions`
97
+ - Permissions: `customPermissionHandler`, `strictPermissionHandler`
98
+ - Agents: `convertAgentToSdkFormat`, `getAgentsForUseCase`
99
+
100
+ ## [2.0.1-alpha.25] - 2025-12-31
101
+
102
+ ### Added
103
+ - **Multi-Algorithm Learning Engine**: 9 specialized RL algorithms for different task types
104
+
105
+ | Algorithm | Task Type | Why |
106
+ |----------------------|---------------------|----------------------------------|
107
+ | double-q | agent-routing | Reduces overestimation bias |
108
+ | sarsa | error-avoidance | Conservative, on-policy |
109
+ | actor-critic | confidence-scoring | Continuous 0-1 scores |
110
+ | ppo | context-ranking | Stable preference learning |
111
+ | decision-transformer | trajectory-learning | Sequence patterns |
112
+ | td-lambda | memory-recall | Better credit assignment |
113
+ | q-learning | pattern-matching | Fast value-based matching |
114
+ | reinforce | exploration | Policy gradient for novel tasks |
115
+ | a2c | multi-agent | Advantage estimation |
116
+
117
+ ### New Functions (IntelligenceBridge)
118
+ - `getAlgorithmForTask(taskType)` - Get recommended algorithm and reason
119
+ - `learnFromEpisode(taskType, state, action, reward, nextState, done)` - Learn with appropriate algorithm
120
+ - `getActionValue(taskType, state, action)` - Get Q-value or policy probability
121
+ - `getMultiAlgorithmStats()` - Get per-algorithm episode counts and avg rewards
122
+
123
+ ### Updated
124
+ - `ruvector` upgraded to `^0.1.69` with multi-algorithm learning engine
125
+ - `getIntelligenceStats()` now includes `multiAlgorithmStats`
126
+ - Features list now includes `multi-algorithm-rl`
127
+
128
+ ### Usage
129
+ ```typescript
130
+ import { getAlgorithmForTask, learnFromEpisode } from 'agentic-flow/hooks';
131
+
132
+ // Get recommended algorithm for a task
133
+ const { algorithm, reason } = getAlgorithmForTask('agent-routing');
134
+ // => { algorithm: 'double-q', reason: 'Reduces overestimation bias...' }
135
+
136
+ // Learn from an episode
137
+ const result = await learnFromEpisode(
138
+ 'error-avoidance', // Uses SARSA (conservative)
139
+ 'state',
140
+ 'action',
141
+ 0.9, // reward
142
+ 'nextState',
143
+ true // done
144
+ );
145
+ ```
146
+
147
+ ## [2.0.1-alpha.24] - 2025-12-31
148
+
149
+ ### Added
150
+ - **Tiered TensorCompress**: Dynamic compression based on access frequency
151
+ - **Hot patterns** (>80% freq): No compression (0% savings) - fastest access
152
+ - **Warm patterns** (40-80% freq): Half precision (50% savings)
153
+ - **Cool patterns** (10-40% freq): PQ8 quantization (87.5% savings)
154
+ - **Cold patterns** (1-10% freq): PQ4 quantization (93.75% savings)
155
+ - **Archive patterns** (<1% freq): Binary (96.9% savings)
156
+
157
+ ### Improved
158
+ - **Access Frequency Tracking**: Each pattern tracks total accesses, creation time
159
+ - **Dynamic Tier Migration**: Patterns automatically move between tiers based on usage
160
+ - **Periodic Recompression**: Background process migrates patterns every 5 minutes
161
+ - **Memory Efficiency**: Up to 96.9% memory savings for rarely-used patterns
162
+ - **Stats Display**: New compression tier distribution table in `enhanced_booster_stats`
163
+
164
+ ### IntelligenceBridge Integration
165
+ - **TensorCompress in Hooks**: Tiered compression now integrated into hooks intelligence layer
166
+ - **storePattern**: New patterns start as "hot" (no compression), migrate based on access
167
+ - **findSimilarPatterns**: Tracks accesses for automatic tier migration
168
+ - **routeTaskIntelligent**: Pattern results now tracked for compression decisions
169
+ - **getIntelligenceStats**: Now includes `compressionStats` with tier distribution
170
+ - **Backward Compatible**: Existing patterns continue to work without modification
171
+
172
+ ### Technical Details
173
+ - Access frequency = 50% access ratio + 30% recency (24hr decay) + 20% success rate
174
+ - New patterns start as "hot" (no compression) since they're likely to be reused
175
+ - Recompression runs non-blocking in background during apply()
176
+ - Backward-compatible with older pattern files (auto-migrates fields)
177
+
178
+ ### Stats Output
179
+ ```
180
+ πŸ—œοΈ Tiered Compression:
181
+ β”Œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”
182
+ β”‚ Tier β”‚ Count β”‚ Access Freq β”‚ Memory Save β”‚
183
+ β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€
184
+ β”‚ πŸ”₯ Hot β”‚ 15 β”‚ >80% β”‚ 0% β”‚
185
+ β”‚ 🌑️ Warm β”‚ 8 β”‚ 40-80% β”‚ 50% β”‚
186
+ β”‚ ❄️ Cool β”‚ 12 β”‚ 10-40% β”‚ 87.5% β”‚
187
+ β”‚ 🧊 Cold β”‚ 25 β”‚ 1-10% β”‚ 93.75% β”‚
188
+ β”‚ πŸ“¦ Archiveβ”‚ 40 β”‚ <1% β”‚ 96.9% β”‚
189
+ β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜
190
+ Compression Ratio: 4.2:1
191
+ Memory Savings: 76.2%
192
+ ```
193
+
5
194
  ## [2.0.1-alpha.23] - 2025-12-31
6
195
 
7
196
  ### Added