snow-flow 3.0.2 → 3.0.3

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.
@@ -0,0 +1,87 @@
1
+ /**
2
+ * MCP-based Todo Manager
3
+ * Alternative to Claude Code's native TodoWrite which has a 30-second timeout
4
+ * This uses our memory tools with NO timeout by default
5
+ */
6
+ export interface Todo {
7
+ id: string;
8
+ content: string;
9
+ status: 'pending' | 'in_progress' | 'completed';
10
+ priority?: 'low' | 'medium' | 'high' | 'critical';
11
+ assignedAgent?: string;
12
+ dependencies?: string[];
13
+ estimatedTime?: string;
14
+ createdAt?: Date;
15
+ updatedAt?: Date;
16
+ }
17
+ export declare class TodoManagerMCP {
18
+ private static instance;
19
+ private logger;
20
+ private readonly TODO_KEY;
21
+ private constructor();
22
+ static getInstance(): TodoManagerMCP;
23
+ /**
24
+ * Get all todos
25
+ */
26
+ getTodos(): Promise<Todo[]>;
27
+ /**
28
+ * Update todos (replaces entire list like TodoWrite)
29
+ */
30
+ updateTodos(todos: Todo[]): Promise<void>;
31
+ /**
32
+ * Add a single todo
33
+ */
34
+ addTodo(todo: Omit<Todo, 'id' | 'createdAt' | 'updatedAt'>): Promise<Todo>;
35
+ /**
36
+ * Update a single todo
37
+ */
38
+ updateTodo(id: string, updates: Partial<Todo>): Promise<Todo | null>;
39
+ /**
40
+ * Mark todo as completed
41
+ */
42
+ completeTodo(id: string): Promise<boolean>;
43
+ /**
44
+ * Mark todo as in progress
45
+ */
46
+ startTodo(id: string): Promise<boolean>;
47
+ /**
48
+ * Delete a todo
49
+ */
50
+ deleteTodo(id: string): Promise<boolean>;
51
+ /**
52
+ * Clear all todos
53
+ */
54
+ clearTodos(): Promise<void>;
55
+ /**
56
+ * Get todos by status
57
+ */
58
+ getTodosByStatus(status: Todo['status']): Promise<Todo[]>;
59
+ /**
60
+ * Get todos by priority
61
+ */
62
+ getTodosByPriority(priority: Todo['priority']): Promise<Todo[]>;
63
+ /**
64
+ * Get todos assigned to specific agent
65
+ */
66
+ getTodosByAgent(agent: string): Promise<Todo[]>;
67
+ /**
68
+ * Generate formatted todo list (similar to TodoWrite output)
69
+ */
70
+ getFormattedTodos(): Promise<string>;
71
+ /**
72
+ * Generate unique ID
73
+ */
74
+ private generateId;
75
+ /**
76
+ * Get statistics
77
+ */
78
+ getStats(): Promise<{
79
+ total: number;
80
+ pending: number;
81
+ inProgress: number;
82
+ completed: number;
83
+ completionRate: number;
84
+ }>;
85
+ }
86
+ export declare const todoManager: TodoManagerMCP;
87
+ //# sourceMappingURL=todo-manager-mcp.d.ts.map
@@ -0,0 +1,211 @@
1
+ "use strict";
2
+ /**
3
+ * MCP-based Todo Manager
4
+ * Alternative to Claude Code's native TodoWrite which has a 30-second timeout
5
+ * This uses our memory tools with NO timeout by default
6
+ */
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.todoManager = exports.TodoManagerMCP = void 0;
9
+ const reliable_memory_manager_js_1 = require("../mcp/shared/reliable-memory-manager.js");
10
+ const logger_js_1 = require("./logger.js");
11
+ class TodoManagerMCP {
12
+ constructor() {
13
+ this.TODO_KEY = 'mcp_todos';
14
+ this.logger = new logger_js_1.Logger('TodoManagerMCP');
15
+ }
16
+ static getInstance() {
17
+ if (!TodoManagerMCP.instance) {
18
+ TodoManagerMCP.instance = new TodoManagerMCP();
19
+ }
20
+ return TodoManagerMCP.instance;
21
+ }
22
+ /**
23
+ * Get all todos
24
+ */
25
+ async getTodos() {
26
+ try {
27
+ const todos = await reliable_memory_manager_js_1.reliableMemory.retrieve(this.TODO_KEY);
28
+ return todos || [];
29
+ }
30
+ catch (error) {
31
+ this.logger.error('Failed to retrieve todos:', error);
32
+ return [];
33
+ }
34
+ }
35
+ /**
36
+ * Update todos (replaces entire list like TodoWrite)
37
+ */
38
+ async updateTodos(todos) {
39
+ try {
40
+ // Add timestamps
41
+ const updatedTodos = todos.map(todo => ({
42
+ ...todo,
43
+ updatedAt: new Date(),
44
+ createdAt: todo.createdAt || new Date()
45
+ }));
46
+ // Store with NO timeout - operations run to completion
47
+ await reliable_memory_manager_js_1.reliableMemory.store(this.TODO_KEY, updatedTodos);
48
+ this.logger.info(`Updated ${todos.length} todos successfully`);
49
+ // Also store a backup with timestamp
50
+ const backupKey = `${this.TODO_KEY}_backup_${Date.now()}`;
51
+ await reliable_memory_manager_js_1.reliableMemory.store(backupKey, updatedTodos, 86400000); // 24 hour expiry for backups
52
+ }
53
+ catch (error) {
54
+ this.logger.error('Failed to update todos:', error);
55
+ throw error;
56
+ }
57
+ }
58
+ /**
59
+ * Add a single todo
60
+ */
61
+ async addTodo(todo) {
62
+ const todos = await this.getTodos();
63
+ const newTodo = {
64
+ ...todo,
65
+ id: this.generateId(),
66
+ createdAt: new Date(),
67
+ updatedAt: new Date()
68
+ };
69
+ todos.push(newTodo);
70
+ await this.updateTodos(todos);
71
+ return newTodo;
72
+ }
73
+ /**
74
+ * Update a single todo
75
+ */
76
+ async updateTodo(id, updates) {
77
+ const todos = await this.getTodos();
78
+ const index = todos.findIndex(t => t.id === id);
79
+ if (index === -1) {
80
+ this.logger.warn(`Todo ${id} not found`);
81
+ return null;
82
+ }
83
+ todos[index] = {
84
+ ...todos[index],
85
+ ...updates,
86
+ id: todos[index].id, // Preserve ID
87
+ createdAt: todos[index].createdAt, // Preserve creation date
88
+ updatedAt: new Date()
89
+ };
90
+ await this.updateTodos(todos);
91
+ return todos[index];
92
+ }
93
+ /**
94
+ * Mark todo as completed
95
+ */
96
+ async completeTodo(id) {
97
+ const result = await this.updateTodo(id, { status: 'completed' });
98
+ return result !== null;
99
+ }
100
+ /**
101
+ * Mark todo as in progress
102
+ */
103
+ async startTodo(id) {
104
+ const result = await this.updateTodo(id, { status: 'in_progress' });
105
+ return result !== null;
106
+ }
107
+ /**
108
+ * Delete a todo
109
+ */
110
+ async deleteTodo(id) {
111
+ const todos = await this.getTodos();
112
+ const filtered = todos.filter(t => t.id !== id);
113
+ if (filtered.length === todos.length) {
114
+ return false; // Nothing was deleted
115
+ }
116
+ await this.updateTodos(filtered);
117
+ return true;
118
+ }
119
+ /**
120
+ * Clear all todos
121
+ */
122
+ async clearTodos() {
123
+ await reliable_memory_manager_js_1.reliableMemory.delete(this.TODO_KEY);
124
+ this.logger.info('All todos cleared');
125
+ }
126
+ /**
127
+ * Get todos by status
128
+ */
129
+ async getTodosByStatus(status) {
130
+ const todos = await this.getTodos();
131
+ return todos.filter(t => t.status === status);
132
+ }
133
+ /**
134
+ * Get todos by priority
135
+ */
136
+ async getTodosByPriority(priority) {
137
+ const todos = await this.getTodos();
138
+ return todos.filter(t => t.priority === priority);
139
+ }
140
+ /**
141
+ * Get todos assigned to specific agent
142
+ */
143
+ async getTodosByAgent(agent) {
144
+ const todos = await this.getTodos();
145
+ return todos.filter(t => t.assignedAgent === agent);
146
+ }
147
+ /**
148
+ * Generate formatted todo list (similar to TodoWrite output)
149
+ */
150
+ async getFormattedTodos() {
151
+ const todos = await this.getTodos();
152
+ if (todos.length === 0) {
153
+ return 'No todos';
154
+ }
155
+ const lines = [];
156
+ // Group by status
157
+ const pending = todos.filter(t => t.status === 'pending');
158
+ const inProgress = todos.filter(t => t.status === 'in_progress');
159
+ const completed = todos.filter(t => t.status === 'completed');
160
+ if (inProgress.length > 0) {
161
+ lines.push('šŸ”„ In Progress:');
162
+ inProgress.forEach(t => {
163
+ const priority = t.priority ? ` [${t.priority}]` : '';
164
+ const agent = t.assignedAgent ? ` (@${t.assignedAgent})` : '';
165
+ lines.push(` ā–¶ ${t.content}${priority}${agent}`);
166
+ });
167
+ }
168
+ if (pending.length > 0) {
169
+ lines.push('\nšŸ“‹ Pending:');
170
+ pending.forEach(t => {
171
+ const priority = t.priority ? ` [${t.priority}]` : '';
172
+ const agent = t.assignedAgent ? ` (@${t.assignedAgent})` : '';
173
+ lines.push(` ā—‹ ${t.content}${priority}${agent}`);
174
+ });
175
+ }
176
+ if (completed.length > 0) {
177
+ lines.push('\nāœ… Completed:');
178
+ completed.forEach(t => {
179
+ lines.push(` āœ“ ${t.content}`);
180
+ });
181
+ }
182
+ return lines.join('\n');
183
+ }
184
+ /**
185
+ * Generate unique ID
186
+ */
187
+ generateId() {
188
+ return `todo_${Date.now()}_${Math.random().toString(36).substr(2, 9)}`;
189
+ }
190
+ /**
191
+ * Get statistics
192
+ */
193
+ async getStats() {
194
+ const todos = await this.getTodos();
195
+ const stats = {
196
+ total: todos.length,
197
+ pending: todos.filter(t => t.status === 'pending').length,
198
+ inProgress: todos.filter(t => t.status === 'in_progress').length,
199
+ completed: todos.filter(t => t.status === 'completed').length,
200
+ completionRate: 0
201
+ };
202
+ if (stats.total > 0) {
203
+ stats.completionRate = (stats.completed / stats.total) * 100;
204
+ }
205
+ return stats;
206
+ }
207
+ }
208
+ exports.TodoManagerMCP = TodoManagerMCP;
209
+ // Export singleton instance
210
+ exports.todoManager = TodoManagerMCP.getInstance();
211
+ //# sourceMappingURL=todo-manager-mcp.js.map
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "snow-flow",
3
- "version": "3.0.2",
4
- "description": "Snow-Flow v3.0.2: Production-Ready ServiceNow Intelligence Platform - NO TIMEOUTS by default for maximum reliability. Init command now uses .env.template correctly. 100% REAL implementation with TensorFlow.js neural networks, direct ServiceNow API integration, and intelligent memory management. Includes 100+ MCP tools for operations, development, ML, analytics, and security. Full AI swarm orchestration with dynamic task categorization. Operations run to completion without artificial time limits.",
3
+ "version": "3.0.3",
4
+ "description": "Snow-Flow v3.0.3: Production-Ready ServiceNow Intelligence Platform - NO TIMEOUTS by default. Includes TodoWrite timeout documentation and MCP-based todo manager alternative. 100% REAL implementation with TensorFlow.js neural networks, direct ServiceNow API integration, and intelligent memory management. Includes 100+ MCP tools for operations, development, ML, analytics, and security. Full AI swarm orchestration with dynamic task categorization.",
5
5
  "main": "dist/index.js",
6
6
  "type": "commonjs",
7
7
  "bin": {