agentic-flow 3.4.4 → 3.5.1

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 (48) hide show
  1. package/.agents/skills/agentic-flow-ecosystem/SKILL.md +6 -1
  2. package/.claude/skills/agentic-flow-ecosystem/skill.md +7 -1
  3. package/CHANGELOG.md +19 -0
  4. package/README.md +36 -1
  5. package/dist/.tsbuildinfo +1 -1
  6. package/dist/config/claudeFlow.d.ts +1 -1
  7. package/dist/core/attention-native.d.ts +45 -28
  8. package/dist/core/attention-native.d.ts.map +1 -1
  9. package/dist/core/attention-native.js +131 -84
  10. package/dist/core/attention-native.js.map +1 -1
  11. package/dist/integrations/index.d.ts +2 -0
  12. package/dist/integrations/index.d.ts.map +1 -1
  13. package/dist/integrations/index.js +1 -0
  14. package/dist/integrations/index.js.map +1 -1
  15. package/dist/integrations/task-schedule.d.ts +51 -0
  16. package/dist/integrations/task-schedule.d.ts.map +1 -0
  17. package/dist/integrations/task-schedule.js +222 -0
  18. package/dist/integrations/task-schedule.js.map +1 -0
  19. package/dist/mcp/claudeFlowSdkServer.d.ts.map +1 -1
  20. package/dist/mcp/claudeFlowSdkServer.js +2 -1
  21. package/dist/mcp/claudeFlowSdkServer.js.map +1 -1
  22. package/dist/mcp/fastmcp/servers/claude-flow-sdk.js +2 -1
  23. package/dist/mcp/fastmcp/servers/claude-flow-sdk.js.map +1 -1
  24. package/dist/mcp/fastmcp/servers/http-sse.d.ts.map +1 -1
  25. package/dist/mcp/fastmcp/servers/http-sse.js +2 -1
  26. package/dist/mcp/fastmcp/servers/http-sse.js.map +1 -1
  27. package/dist/mcp/fastmcp/servers/http-streaming-updated.js +2 -1
  28. package/dist/mcp/fastmcp/servers/http-streaming-updated.js.map +1 -1
  29. package/dist/mcp/fastmcp/servers/stdio-full.js +2 -1
  30. package/dist/mcp/fastmcp/servers/stdio-full.js.map +1 -1
  31. package/dist/mcp/mcp-policy.js +1 -1
  32. package/dist/mcp/mcp-policy.js.map +1 -1
  33. package/dist/mcp/standalone-stdio.js +2 -1
  34. package/dist/mcp/standalone-stdio.js.map +1 -1
  35. package/dist/mcp/tools/ecosystem-tools.d.ts +5 -1
  36. package/dist/mcp/tools/ecosystem-tools.d.ts.map +1 -1
  37. package/dist/mcp/tools/ecosystem-tools.js +30 -1
  38. package/dist/mcp/tools/ecosystem-tools.js.map +1 -1
  39. package/dist/optimizations/configuration-tuning.d.ts +1 -1
  40. package/dist/utils/package-version.d.ts +2 -0
  41. package/dist/utils/package-version.d.ts.map +1 -1
  42. package/dist/utils/package-version.js +4 -0
  43. package/dist/utils/package-version.js.map +1 -1
  44. package/package.json +17 -66
  45. package/dist/core/agentdb-wrapper.d.ts +0 -149
  46. package/dist/core/agentdb-wrapper.d.ts.map +0 -1
  47. package/dist/core/agentdb-wrapper.js +0 -394
  48. package/dist/core/agentdb-wrapper.js.map +0 -1
@@ -1 +0,0 @@
1
- {"version":3,"file":"agentdb-wrapper.js","sourceRoot":"","sources":["../../src/core/agentdb-wrapper.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;GAYG;AAEH,IAAI,OAAO,GAAQ,IAAI,CAAC;AACxB,IAAI,gBAAgB,GAAG,KAAK,CAAC;AAE7B,IAAI,CAAC;IACH,MAAM,GAAG,GAAG,MAAM,MAAM,CAAC,SAAS,CAAC,CAAC;IACpC,OAAO,GAAG,GAAG,CAAC,OAAO,CAAC;IACtB,gBAAgB,GAAG,IAAI,CAAC;AAC1B,CAAC;AAAC,MAAM,CAAC;IACP,OAAO,CAAC,IAAI,CAAC,kDAAkD,CAAC,CAAC;AACnE,CAAC;AAmBD;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,OAAO,cAAc;IACjB,OAAO,CAAO;IACd,MAAM,CAAgB;IACtB,WAAW,GAAG,KAAK,CAAC;IACpB,SAAS,CAAS;IAClB,SAAS,CAAS;IAClB,mBAAmB,CAAM;IACzB,QAAQ,CAAM;IACd,aAAa,CAAM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EAAE,CAAC;YACf,MAAM,IAAI,KAAK,CACb,6BAA6B,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAAE,CACtF,CAAC;QACJ,CAAC;IACH,CAAC;IAED;;;;OAIG;IACH,cAAc;QACZ,IAAI,CAAC,iBAAiB,EAAE,CAAC;QACzB,OAAO,IAAI,CAAC,OAAO,CAAC;IACtB,CAAC;CACF","sourcesContent":["/**\n * AgentDBWrapper - Clean API over raw AgentDB v2.0.0-alpha.2.11\n *\n * Provides a unified interface for:\n * - Vector search with HNSW indexing\n * - Memory operations (insert, search, update, delete)\n * - TypeScript-first type safety\n * - Error handling and validation\n *\n * Note: AgentDB is optional - falls back gracefully on Windows\n *\n * @module agentdb-wrapper\n */\n\nlet AgentDB: any = null;\nlet agentdbAvailable = false;\n\ntry {\n const mod = await import('agentdb');\n AgentDB = mod.AgentDB;\n agentdbAvailable = true;\n} catch {\n console.warn('[AgentDB] Not available - some features disabled');\n}\n\nimport type {\n AgentDBConfig,\n VectorEntry,\n VectorSearchOptions,\n VectorSearchResult,\n MemoryInsertOptions,\n MemoryUpdateOptions,\n MemoryDeleteOptions,\n MemoryGetOptions,\n AgentDBStats,\n BatchInsertResult,\n ValidationError,\n DatabaseError,\n IndexError,\n HNSWConfig,\n} from '../types/agentdb.js';\n\n/**\n * Main wrapper class for AgentDB operations\n *\n * @example\n * ```typescript\n * const wrapper = new AgentDBWrapper({\n * dbPath: ':memory:',\n * dimension: 384,\n * hnswConfig: { M: 16, efConstruction: 200 }\n * });\n *\n * await wrapper.initialize();\n *\n * // Insert a vector\n * const vector = new Float32Array(384);\n * await wrapper.insert({ vector, metadata: { type: 'test' } });\n *\n * // Search\n * const results = await wrapper.vectorSearch(queryVector, { k: 10 });\n *\n * await wrapper.close();\n * ```\n */\nexport class AgentDBWrapper {\n private agentDB!: any;\n private config: AgentDBConfig;\n private initialized = false;\n private dimension: number;\n private namespace: string;\n private reflexionController: any;\n private embedder: any;\n private vectorBackend: any;\n\n // For testing - allow dependency injection\n public _agentDB?: any;\n public _embedder?: any;\n public _vectorBackend?: any;\n\n /**\n * Create a new AgentDBWrapper instance\n *\n * @param config - Configuration options\n */\n constructor(config: AgentDBConfig = {}) {\n this.config = {\n dbPath: config.dbPath || ':memory:',\n namespace: config.namespace || 'default',\n dimension: config.dimension || 384,\n hnswConfig: {\n M: config.hnswConfig?.M || 16,\n efConstruction: config.hnswConfig?.efConstruction || 200,\n efSearch: config.hnswConfig?.efSearch || 100,\n },\n enableAttention: config.enableAttention || false,\n attentionConfig: config.attentionConfig,\n autoInit: config.autoInit !== false, // Default true\n };\n\n this.dimension = this.config.dimension!;\n this.namespace = this.config.namespace!;\n\n // Auto-initialize if configured\n if (this.config.autoInit) {\n this.initialize().catch((err) => {\n console.error('Auto-initialization failed:', err);\n });\n }\n }\n\n /**\n * Initialize the AgentDB instance and dependencies\n *\n * @throws {DatabaseError} If initialization fails\n */\n async initialize(): Promise<void> {\n if (this.initialized) {\n return;\n }\n\n if (!agentdbAvailable || !AgentDB) {\n throw new Error('AgentDB not available - install with: npm install agentdb (requires native build tools)');\n }\n\n try {\n // Use injected dependencies for testing, otherwise create real instances\n if (this._agentDB) {\n this.agentDB = this._agentDB;\n this.embedder = this._embedder;\n this.vectorBackend = this._vectorBackend;\n } else {\n // Create real AgentDB instance\n this.agentDB = new AgentDB({\n dbPath: this.config.dbPath,\n namespace: this.namespace,\n enableAttention: this.config.enableAttention,\n attentionConfig: this.config.attentionConfig,\n });\n\n await this.agentDB.initialize();\n\n // Get controllers\n this.reflexionController = this.agentDB.getController('reflexion');\n this.embedder = this.reflexionController?.embedder;\n this.vectorBackend = this.reflexionController?.vectorBackend;\n }\n\n // Initialize embedder if available\n if (this.embedder && this.embedder.initialize) {\n await this.embedder.initialize();\n }\n\n this.initialized = true;\n } catch (error) {\n throw new Error(\n `Failed to initialize AgentDB: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n\n /**\n * Ensure wrapper is initialized before operations\n *\n * @throws {Error} If not initialized\n */\n private ensureInitialized(): void {\n if (!this.initialized) {\n throw new Error(\n 'AgentDBWrapper not initialized. Call initialize() first.'\n );\n }\n }\n\n /**\n * Validate vector dimension\n *\n * @param vector - Vector to validate\n * @throws {ValidationError} If dimension is invalid\n */\n private validateVectorDimension(vector: Float32Array): void {\n if (vector.length !== this.dimension) {\n throw new Error(\n `Invalid vector dimension: expected ${this.dimension}, got ${vector.length}`\n );\n }\n }\n\n /**\n * Generate a unique ID\n *\n * @returns A unique identifier\n */\n private generateId(): string {\n return `${Date.now()}-${Math.random().toString(36).substring(2, 11)}`;\n }\n\n /**\n * Insert a vector with metadata into the database\n *\n * @param options - Insert options\n * @returns The inserted entry with ID\n * @throws {ValidationError} If vector dimension is invalid\n * @throws {DatabaseError} If insertion fails\n */\n async insert(\n options: MemoryInsertOptions\n ): Promise<{ id: string; timestamp: number }> {\n this.ensureInitialized();\n this.validateVectorDimension(options.vector);\n\n const id = options.id || this.generateId();\n const timestamp = Date.now();\n\n const metadata = {\n ...options.metadata,\n timestamp,\n namespace: options.namespace || this.namespace,\n };\n\n try {\n const controller = this._agentDB\n ? this._agentDB.getController('reflexion')\n : this.reflexionController;\n\n await controller.store({\n id,\n vector: options.vector,\n metadata,\n });\n\n return { id, timestamp };\n } catch (error) {\n throw new Error(\n `Failed to insert vector: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n\n /**\n * Search for similar vectors using HNSW indexing\n *\n * @param query - Query vector\n * @param options - Search options\n * @returns Array of search results sorted by similarity (descending)\n * @throws {ValidationError} If query dimension is invalid\n */\n async vectorSearch(\n query: Float32Array,\n options: VectorSearchOptions = {}\n ): Promise<VectorSearchResult[]> {\n this.ensureInitialized();\n this.validateVectorDimension(query);\n\n const {\n k = 10,\n metric = 'cosine',\n filter,\n includeVectors = false,\n hnswParams,\n } = options;\n\n try {\n const controller = this._agentDB\n ? this._agentDB.getController('reflexion')\n : this.reflexionController;\n\n const results = await controller.retrieve(query, {\n k,\n metric,\n filter,\n includeVectors,\n hnswParams,\n });\n\n return results.map((result: any) => ({\n id: result.id,\n score: result.score,\n metadata: result.metadata,\n ...(includeVectors && { vector: result.vector }),\n }));\n } catch (error) {\n throw new Error(\n `Vector search failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n\n /**\n * Update a vector and/or its metadata\n *\n * @param options - Update options\n * @returns True if update succeeded\n * @throws {ValidationError} If vector dimension is invalid\n * @throws {DatabaseError} If vector not found\n */\n async update(options: MemoryUpdateOptions): Promise<boolean> {\n this.ensureInitialized();\n\n if (options.vector) {\n this.validateVectorDimension(options.vector);\n }\n\n try {\n const controller = this._agentDB\n ? this._agentDB.getController('reflexion')\n : this.reflexionController;\n\n const updateData: any = {};\n\n if (options.vector) {\n updateData.vector = options.vector;\n }\n\n if (options.metadata) {\n updateData.metadata = options.metadata;\n }\n\n const result = await controller.update(options.id, updateData);\n\n if (!result) {\n throw new Error(`Vector not found: ${options.id}`);\n }\n\n return result;\n } catch (error) {\n throw error;\n }\n }\n\n /**\n * Delete a vector by ID\n *\n * @param options - Delete options\n * @returns True if deletion succeeded, false if not found\n */\n async delete(options: MemoryDeleteOptions): Promise<boolean> {\n this.ensureInitialized();\n\n try {\n const controller = this._agentDB\n ? this._agentDB.getController('reflexion')\n : this.reflexionController;\n\n const result = await controller.delete(options.id);\n return result;\n } catch (error) {\n throw new Error(\n `Delete failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n\n /**\n * Get a vector by ID\n *\n * @param options - Get options\n * @returns Vector entry or null if not found\n */\n async get(options: MemoryGetOptions): Promise<VectorEntry | null> {\n this.ensureInitialized();\n\n try {\n const controller = this._agentDB\n ? this._agentDB.getController('reflexion')\n : this.reflexionController;\n\n const result = await controller.get(options.id);\n\n if (!result) {\n return null;\n }\n\n const entry: VectorEntry = {\n id: result.id,\n vector: result.vector,\n metadata: result.metadata,\n };\n\n // Exclude vector if not requested\n if (options.includeVector === false) {\n delete entry.vector;\n }\n\n return entry;\n } catch (error) {\n throw new Error(\n `Get failed: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n\n /**\n * Insert multiple vectors in a batch\n *\n * @param entries - Array of entries to insert\n * @returns Batch insert result with success/failure counts\n */\n async batchInsert(\n entries: MemoryInsertOptions[]\n ): Promise<BatchInsertResult> {\n this.ensureInitialized();\n\n const startTime = Date.now();\n const result: BatchInsertResult = {\n inserted: 0,\n failed: [],\n duration: 0,\n };\n\n const controller = this._agentDB\n ? this._agentDB.getController('reflexion')\n : this.reflexionController;\n\n for (let i = 0; i < entries.length; i++) {\n const entry = entries[i];\n\n try {\n await this.insert(entry);\n result.inserted++;\n } catch (error) {\n result.failed.push({\n index: i,\n id: entry.id,\n error: error instanceof Error ? error.message : String(error),\n });\n }\n }\n\n result.duration = Date.now() - startTime;\n return result;\n }\n\n /**\n * Get database statistics\n *\n * @returns Database statistics including vector count and index info\n */\n async getStats(): Promise<AgentDBStats> {\n this.ensureInitialized();\n\n try {\n const backend = this._vectorBackend || this.vectorBackend;\n\n const stats = await backend.getStats();\n\n return {\n vectorCount: stats.vectorCount || 0,\n dimension: this.dimension,\n databaseSize: stats.databaseSize || 0,\n hnswStats: stats.hnswStats,\n memoryUsage: stats.memoryUsage,\n indexBuildTime: stats.indexBuildTime,\n };\n } catch (error) {\n throw new Error(\n `Failed to get stats: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n\n /**\n * Close the database connection\n */\n async close(): Promise<void> {\n if (!this.initialized) {\n return;\n }\n\n try {\n const db = this._agentDB || this.agentDB;\n await db.close();\n this.initialized = false;\n } catch (error) {\n throw new Error(\n `Failed to close database: ${error instanceof Error ? error.message : String(error)}`\n );\n }\n }\n\n /**\n * Get the underlying AgentDB instance (for advanced usage)\n *\n * @returns The raw AgentDB instance\n */\n getRawInstance(): any {\n this.ensureInitialized();\n return this.agentDB;\n }\n}\n"]}