snow-flow 3.0.1 → 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.
package/README.md CHANGED
@@ -21,11 +21,12 @@ Every interaction with Snow-Flow provides insights into ServiceNow best practice
21
21
  ### **Real Integration, Real Results**
22
22
  Unlike mock tools or simulations, Snow-Flow connects directly to your ServiceNow instance through secure OAuth authentication. Every operation is real, every deployment is functional, and every result is production-ready.
23
23
 
24
- ## šŸŽ‰ Version 3.0.1 - Critical Timeout Fix
24
+ ## šŸŽ‰ Version 3.0.2 - Init Command Fixed
25
25
 
26
- ### **Latest Fix (v3.0.1)**
26
+ ### **Latest Fix (v3.0.2)**
27
+ - šŸ”§ **Init Command Fixed** - Now correctly uses .env.template with v3.0.1 timeout configuration
27
28
  - šŸŽÆ **No Timeouts by Default** - Operations run until completion for maximum reliability
28
- - šŸŽ›ļø **Optional Timeout Configuration** - Set `MCP_MEMORY_TIMEOUT` only if needed
29
+ - šŸŽ›ļø **Optional Timeout Configuration** - All timeouts commented out in generated .env file
29
30
  - šŸš€ **100% Completion Rate** - No artificial timeout limitations
30
31
 
31
32
  ### **What's New in v3.0.0**
package/dist/cli.js CHANGED
@@ -3689,44 +3689,37 @@ For full documentation, visit: https://github.com/groeimetai/snow-flow
3689
3689
  }
3690
3690
  }
3691
3691
  async function createEnvFile(targetDir, force = false) {
3692
- const envContent = `# ServiceNow Configuration
3692
+ // Read content from .env.template file
3693
+ let envContent;
3694
+ try {
3695
+ // Try to read from the project's .env.template file
3696
+ const templatePath = (0, path_1.join)(__dirname, '..', '.env.template');
3697
+ envContent = await fs_1.promises.readFile(templatePath, 'utf-8');
3698
+ console.log('šŸ“‹ Using .env.template for configuration');
3699
+ }
3700
+ catch (error) {
3701
+ // If template not found, try alternative locations
3702
+ try {
3703
+ const alternativePath = (0, path_1.join)(process.cwd(), '.env.template');
3704
+ envContent = await fs_1.promises.readFile(alternativePath, 'utf-8');
3705
+ console.log('šŸ“‹ Using .env.template from current directory');
3706
+ }
3707
+ catch (fallbackError) {
3708
+ console.warn('āš ļø Could not find .env.template file, using embedded minimal version');
3709
+ // Last resort: use embedded minimal version with v3.0.1 timeout config
3710
+ envContent = `# ServiceNow Configuration
3693
3711
  # ===========================================
3694
3712
 
3695
3713
  # ServiceNow Instance URL (without https://)
3696
3714
  # Example: dev12345.service-now.com
3697
3715
  SNOW_INSTANCE=your-instance.service-now.com
3698
3716
 
3699
- # ===========================================
3700
- # OAuth Authentication (Required)
3701
- # ===========================================
3702
- # Snow-Flow uses OAuth for secure authentication to ServiceNow
3703
- #
3704
- # How to set up OAuth in ServiceNow:
3705
- # 1. Navigate to: System OAuth > Application Registry
3706
- # 2. Click "New" > "Create an OAuth API endpoint for external clients"
3707
- # 3. Fill in:
3708
- # - Name: Snow-Flow Development
3709
- # - Client ID: (will be auto-generated)
3710
- # - Client Secret: (set your own or auto-generate)
3711
- # 4. Copy the Client ID and Secret below:
3712
-
3713
3717
  # OAuth Client ID from ServiceNow Application Registry
3714
3718
  SNOW_CLIENT_ID=your-oauth-client-id
3715
3719
 
3716
3720
  # OAuth Client Secret from ServiceNow Application Registry
3717
3721
  SNOW_CLIENT_SECRET=your-oauth-client-secret
3718
3722
 
3719
- # ===========================================
3720
- # Legacy Username/Password (Not Recommended)
3721
- # ===========================================
3722
- # These fields are kept for backwards compatibility but are not used
3723
- # Snow-Flow requires OAuth authentication for security
3724
- # SNOW_USERNAME=not-used
3725
- # SNOW_PASSWORD=not-used
3726
-
3727
- # Optional: Additional Configuration
3728
- # SNOW_REDIRECT_URI=http://\${SNOW_REDIRECT_HOST:-localhost}:\${SNOW_REDIRECT_PORT:-3000}/callback
3729
-
3730
3723
  # ===========================================
3731
3724
  # Snow-Flow Configuration
3732
3725
  # ===========================================
@@ -3740,44 +3733,33 @@ SNOW_FLOW_STRATEGY=development
3740
3733
  # Maximum number of agents
3741
3734
  SNOW_FLOW_MAX_AGENTS=5
3742
3735
 
3743
- # Claude Code timeout configuration (in minutes)
3744
- # Set to 0 to disable timeout (infinite execution time)
3745
- # Default: 60 minutes
3746
- SNOW_FLOW_TIMEOUT_MINUTES=0
3747
-
3748
- # ===========================================
3749
- # Deployment Timeout Configuration
3750
- # ===========================================
3751
-
3752
- # ServiceNow API timeout for regular operations (milliseconds)
3753
- # Default: 60000 (60 seconds)
3754
- SNOW_REQUEST_TIMEOUT=60000
3755
-
3756
- # ServiceNow API timeout for DEPLOYMENT operations (milliseconds)
3757
- # Deployments need more time for complex widgets
3758
- # Default: 300000 (5 minutes)
3759
- SNOW_DEPLOYMENT_TIMEOUT=300000
3760
-
3761
- # MCP transport timeout for deployment operations (milliseconds)
3762
- # Should be higher than SNOW_DEPLOYMENT_TIMEOUT
3763
- # Default: 360000 (6 minutes)
3764
- MCP_DEPLOYMENT_TIMEOUT=360000
3765
-
3766
3736
  # ===========================================
3767
- # How to Set Up ServiceNow OAuth
3737
+ # Timeout Configuration (v3.0.1+)
3768
3738
  # ===========================================
3769
- # 1. Log into your ServiceNow instance as admin
3770
- # 2. Navigate to: System OAuth > Application Registry
3771
- # 3. Click "New" > "Create an OAuth application"
3772
- # 4. Fill in:
3773
- # - Name: Snow-Flow Development
3774
- # - Client ID: (will be generated)
3775
- # - Client Secret: (will be generated)
3776
- # - Redirect URL: http://\${SNOW_REDIRECT_HOST:-localhost}:\${SNOW_REDIRECT_PORT:-3000}/callback
3777
- # - Grant Type: Authorization Code
3778
- # 5. Copy the Client ID and Client Secret to this file
3779
- # 6. Run: snow-flow auth login
3739
+ # IMPORTANT: Snow-Flow has NO TIMEOUTS by default for maximum reliability.
3740
+ # Operations run until completion. Only set timeouts if you specifically need them.
3741
+ # All timeout values below are COMMENTED OUT - uncomment only what you need.
3742
+
3743
+ # Memory Operations (TodoWrite, etc.)
3744
+ # MCP_MEMORY_TIMEOUT=30000 # 30 seconds
3745
+ # MCP_MEMORY_TIMEOUT=60000 # 1 minute
3746
+ # MCP_MEMORY_TIMEOUT=120000 # 2 minutes
3747
+
3748
+ # ServiceNow API Operations
3749
+ # SNOW_API_TIMEOUT=60000 # 1 minute - quick operations
3750
+ # SNOW_API_TIMEOUT=180000 # 3 minutes - standard operations
3751
+ # SNOW_API_TIMEOUT=300000 # 5 minutes - complex queries
3752
+
3753
+ # Deployment Operations
3754
+ # SNOW_DEPLOYMENT_TIMEOUT=300000 # 5 minutes - simple deployments
3755
+ # SNOW_DEPLOYMENT_TIMEOUT=600000 # 10 minutes - complex widgets
3756
+
3757
+ # MCP transport timeout (should be higher than SNOW_DEPLOYMENT_TIMEOUT if both set)
3758
+ # MCP_DEPLOYMENT_TIMEOUT=360000 # 6 minutes
3759
+ # MCP_DEPLOYMENT_TIMEOUT=720000 # 12 minutes
3780
3760
  `;
3761
+ }
3762
+ }
3781
3763
  const envFilePath = (0, path_1.join)(targetDir, '.env');
3782
3764
  // Check if .env already exists
3783
3765
  try {
@@ -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.1",
4
- "description": "Snow-Flow v3.0.1: Production-Ready ServiceNow Intelligence Platform - NO TIMEOUTS by default for maximum reliability. 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": {