snow-flow 3.3.2 → 3.3.4
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 +84 -7
- package/dist/cli-new-prompt.d.ts +2 -0
- package/dist/cli-new-prompt.js +420 -0
- package/dist/cli.js +119 -887
- package/dist/dynamic-version.js +1 -1
- package/dist/mcp/servicenow-deployment-mcp.js +756 -2
- package/dist/queen/servicenow-queen.d.ts +1 -45
- package/dist/queen/servicenow-queen.js +615 -566
- package/package.json +2 -2
- package/src/cli.ts.backup-20250809-125529 +4773 -0
package/README.md
CHANGED
|
@@ -97,7 +97,7 @@ Snow-Flow provides 180+ tools across 17 specialized MCP servers:
|
|
|
97
97
|
| Server | Tools | Primary Focus |
|
|
98
98
|
|--------|-------|---------------|
|
|
99
99
|
| servicenow-operations | 15 | CRUD operations, data management |
|
|
100
|
-
| servicenow-deployment |
|
|
100
|
+
| servicenow-deployment | 21 | Widget, portal, and application deployment (create & update) |
|
|
101
101
|
| servicenow-platform-development | 12 | Table creation, field management |
|
|
102
102
|
| servicenow-machine-learning | 15 | Neural networks, predictions, anomaly detection |
|
|
103
103
|
| servicenow-reporting-analytics | 18 | Dashboards, reports, KPIs |
|
|
@@ -288,12 +288,89 @@ snow_query_table({
|
|
|
288
288
|
```
|
|
289
289
|
|
|
290
290
|
### Development Tools
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
-
|
|
295
|
-
|
|
296
|
-
|
|
291
|
+
|
|
292
|
+
#### Supported Artifact Types (snow_deploy & snow_update)
|
|
293
|
+
|
|
294
|
+
Snow-Flow supports deployment and updating of 16+ different ServiceNow artifact types:
|
|
295
|
+
|
|
296
|
+
| Artifact Type | ServiceNow Table | Deploy | Update | Description |
|
|
297
|
+
|---------------|------------------|--------|---------|-------------|
|
|
298
|
+
| **widget** | sp_widget | ✅ | ✅ | Service Portal widgets with HTML/CSS/JS |
|
|
299
|
+
| **application** | sys_app | ✅ | ✅ | Scoped applications and app stores |
|
|
300
|
+
| **business_rule** | sys_script | ✅ | ✅ | Server-side business logic automation |
|
|
301
|
+
| **script_include** | sys_script_include | ✅ | ✅ | Reusable server-side code libraries |
|
|
302
|
+
| **ui_page** | sys_ui_page | ✅ | ✅ | Custom UI pages and interfaces |
|
|
303
|
+
| **client_script** | sys_script_client | ✅ | ✅ | Client-side form and field scripts |
|
|
304
|
+
| **ui_action** | sys_ui_action | ✅ | ✅ | Buttons, links, and form actions |
|
|
305
|
+
| **ui_policy** | sys_ui_policy | ✅ | ✅ | Dynamic form behavior and validation |
|
|
306
|
+
| **acl** | sys_security_acl | ✅ | ✅ | Access control and security rules |
|
|
307
|
+
| **table** | sys_db_object | ✅ | ✅ | Custom database tables and structures |
|
|
308
|
+
| **field** | sys_dictionary | ✅ | ✅ | Table fields and column definitions |
|
|
309
|
+
| **workflow** | wf_workflow | ✅ | ✅ | Classic workflow processes |
|
|
310
|
+
| **flow** | sys_hub_flow | ✅ | ✅ | Flow Designer automation flows |
|
|
311
|
+
| **notification** | sysevent_email_action | ✅ | ✅ | Email notifications and alerts |
|
|
312
|
+
| **scheduled_job** | sysauto_script | ✅ | ✅ | Scheduled background scripts |
|
|
313
|
+
|
|
314
|
+
#### Usage Examples
|
|
315
|
+
|
|
316
|
+
```javascript
|
|
317
|
+
// Deploy NEW artifacts
|
|
318
|
+
await snow_deploy({
|
|
319
|
+
type: 'widget',
|
|
320
|
+
name: 'My Dashboard Widget',
|
|
321
|
+
template: '<div>My HTML</div>',
|
|
322
|
+
css: '.my-class { color: blue; }',
|
|
323
|
+
client_script: 'function() { console.log("Hello"); }'
|
|
324
|
+
});
|
|
325
|
+
|
|
326
|
+
await snow_deploy({
|
|
327
|
+
type: 'business_rule',
|
|
328
|
+
name: 'Auto Assignment Rule',
|
|
329
|
+
table: 'incident',
|
|
330
|
+
when: 'before',
|
|
331
|
+
insert: true,
|
|
332
|
+
script: 'if (current.priority == "1") current.assigned_to = "admin";'
|
|
333
|
+
});
|
|
334
|
+
|
|
335
|
+
// Update EXISTING artifacts
|
|
336
|
+
await snow_update({
|
|
337
|
+
type: 'widget',
|
|
338
|
+
identifier: 'My Dashboard Widget', // name or sys_id
|
|
339
|
+
instruction: 'Add a new chart showing priority distribution'
|
|
340
|
+
});
|
|
341
|
+
|
|
342
|
+
await snow_update({
|
|
343
|
+
type: 'ui_action',
|
|
344
|
+
identifier: 'close_incident',
|
|
345
|
+
config: {
|
|
346
|
+
action_name: 'Close with Resolution',
|
|
347
|
+
condition: 'current.state != 7'
|
|
348
|
+
}
|
|
349
|
+
});
|
|
350
|
+
```
|
|
351
|
+
|
|
352
|
+
#### Natural Language Updates
|
|
353
|
+
|
|
354
|
+
```javascript
|
|
355
|
+
// All artifact types support natural language instructions
|
|
356
|
+
await snow_update({
|
|
357
|
+
type: 'notification',
|
|
358
|
+
identifier: 'incident_created',
|
|
359
|
+
instruction: 'Change subject to "High Priority Incident Created" and add escalation details'
|
|
360
|
+
});
|
|
361
|
+
|
|
362
|
+
await snow_update({
|
|
363
|
+
type: 'scheduled_job',
|
|
364
|
+
identifier: 'daily_cleanup',
|
|
365
|
+
instruction: 'Change schedule to run every 2 hours and add error logging'
|
|
366
|
+
});
|
|
367
|
+
|
|
368
|
+
await snow_update({
|
|
369
|
+
type: 'acl',
|
|
370
|
+
identifier: 'incident_read',
|
|
371
|
+
instruction: 'Add condition script to check user department'
|
|
372
|
+
});
|
|
373
|
+
```
|
|
297
374
|
|
|
298
375
|
### Service Management
|
|
299
376
|
- Incident management
|
|
@@ -0,0 +1,420 @@
|
|
|
1
|
+
// Helper function to build Queen Agent orchestration prompt - CLEANED UP VERSION
|
|
2
|
+
function buildQueenAgentPrompt(objective, taskAnalysis, options, isAuthenticated = false, sessionId, isFlowDesignerTask = false) {
|
|
3
|
+
// Check if intelligent features are enabled
|
|
4
|
+
const hasIntelligentFeatures = options.autoPermissions || options.smartDiscovery ||
|
|
5
|
+
options.liveTesting || options.autoDeploy || options.autoRollback ||
|
|
6
|
+
options.sharedMemory || options.progressMonitoring;
|
|
7
|
+
const prompt = `# 👑 Snow-Flow Queen Agent Orchestration
|
|
8
|
+
|
|
9
|
+
## 🎯 Mission Brief
|
|
10
|
+
You are the Queen Agent, master coordinator of the Snow-Flow hive-mind. Your mission is to orchestrate a swarm of specialized agents to complete the following ServiceNow development objective:
|
|
11
|
+
|
|
12
|
+
**Objective**: ${objective}
|
|
13
|
+
**Session ID**: ${sessionId}
|
|
14
|
+
|
|
15
|
+
## 🧠 Task Analysis Summary
|
|
16
|
+
- **Task Type**: ${taskAnalysis.taskType}
|
|
17
|
+
- **Complexity**: ${taskAnalysis.complexity}
|
|
18
|
+
- **Primary Agent Required**: ${taskAnalysis.primaryAgent}
|
|
19
|
+
- **Supporting Agents**: ${taskAnalysis.supportingAgents.join(', ')}
|
|
20
|
+
- **Estimated Total Agents**: ${taskAnalysis.estimatedAgentCount}
|
|
21
|
+
- **ServiceNow Artifacts**: ${taskAnalysis.serviceNowArtifacts.join(', ')}
|
|
22
|
+
|
|
23
|
+
## ⚡ CRITICAL: Task Intent Analysis
|
|
24
|
+
**BEFORE PROCEEDING**, analyze the user's ACTUAL intent:
|
|
25
|
+
|
|
26
|
+
1. **Data Generation Request?** (e.g., "create 5000 incidents", "generate test data")
|
|
27
|
+
→ Focus on CREATING DATA, not building systems
|
|
28
|
+
→ Use simple scripts or bulk operations to generate the data
|
|
29
|
+
→ Skip complex architectures unless explicitly asked
|
|
30
|
+
|
|
31
|
+
2. **System Building Request?** (e.g., "build a widget", "create an ML system")
|
|
32
|
+
→ Follow full development workflow
|
|
33
|
+
→ Build proper architecture and components
|
|
34
|
+
|
|
35
|
+
3. **Simple Operation Request?** (e.g., "update field X", "delete records")
|
|
36
|
+
→ Execute the operation directly
|
|
37
|
+
→ Skip unnecessary complexity
|
|
38
|
+
|
|
39
|
+
**For this objective**: Analyze if the user wants data generation, system building, or a simple operation.
|
|
40
|
+
|
|
41
|
+
${isFlowDesignerTask ? `## 🔧 Flow Designer Task Detected - Using Enhanced Flow Creation!
|
|
42
|
+
|
|
43
|
+
**MANDATORY: Use this exact approach for Flow Designer tasks:**
|
|
44
|
+
|
|
45
|
+
\`\`\`javascript
|
|
46
|
+
// ✅ Complete flow generation with ALL features
|
|
47
|
+
await snow_create_flow({
|
|
48
|
+
instruction: "your natural language flow description",
|
|
49
|
+
deploy_immediately: true, // 🔥 Automatically deploys to ServiceNow!
|
|
50
|
+
return_metadata: true // 📊 Returns complete deployment metadata
|
|
51
|
+
});
|
|
52
|
+
\`\`\`
|
|
53
|
+
|
|
54
|
+
🎯 **What this does automatically:**
|
|
55
|
+
- ✅ Generates proper flow structure with all components
|
|
56
|
+
- ✅ Uses correct ServiceNow tables and relationships
|
|
57
|
+
- ✅ Deploys directly to your ServiceNow instance
|
|
58
|
+
- ✅ Returns complete metadata (sys_id, URLs, endpoints)
|
|
59
|
+
- ✅ Includes all requested features and logic
|
|
60
|
+
|
|
61
|
+
` : ''}
|
|
62
|
+
|
|
63
|
+
## 📊 Table Discovery Intelligence
|
|
64
|
+
|
|
65
|
+
The Queen Agent will automatically discover and validate table schemas based on the objective. This ensures agents use correct field names and table structures.
|
|
66
|
+
|
|
67
|
+
**Table Detection Examples:**
|
|
68
|
+
- "create widget for incident records" → Discovers: incident, sys_user, sys_user_group
|
|
69
|
+
- "build approval flow for u_equipment_request" → Discovers: u_equipment_request, sys_user, sysapproval_approver
|
|
70
|
+
- "portal showing catalog items" → Discovers: sc_cat_item, sc_category, sc_request
|
|
71
|
+
- "dashboard with CMDB assets" → Discovers: cmdb_ci, cmdb_rel_ci, sys_user
|
|
72
|
+
- "report on problem tickets" → Discovers: problem, incident, sys_user
|
|
73
|
+
|
|
74
|
+
**Discovery Process:**
|
|
75
|
+
1. Extracts table names from objective (standard tables, u_ custom tables, explicit mentions)
|
|
76
|
+
2. Discovers actual table schemas with field names, types, and relationships
|
|
77
|
+
3. Stores schemas in memory for all agents to use
|
|
78
|
+
4. Agents MUST use exact field names from schemas (e.g., 'short_description' not 'desc')
|
|
79
|
+
|
|
80
|
+
## 👑 Your Queen Agent Responsibilities
|
|
81
|
+
|
|
82
|
+
## 📊 Data Generation Specific Instructions
|
|
83
|
+
If the task is identified as DATA GENERATION (e.g., "create 5000 incidents"):
|
|
84
|
+
|
|
85
|
+
1. **DO NOT** build complex export/import systems
|
|
86
|
+
2. **DO NOT** create APIs, UI Actions, or workflows
|
|
87
|
+
3. **DO** focus on:
|
|
88
|
+
- Creating a simple script to generate the data
|
|
89
|
+
- Using ServiceNow's REST API or direct table operations
|
|
90
|
+
- Ensuring realistic data distribution for ML training
|
|
91
|
+
- Adding variety in categories, priorities, descriptions, etc.
|
|
92
|
+
|
|
93
|
+
**Example approach for "create 5000 incidents":**
|
|
94
|
+
\`\`\`javascript
|
|
95
|
+
// Simple batch creation script
|
|
96
|
+
for (let i = 0; i < 5000; i += 100) {
|
|
97
|
+
// Create 100 incidents at a time to avoid timeouts
|
|
98
|
+
const batch = generateRealisticIncidentBatch(100);
|
|
99
|
+
await createIncidentsBatch(batch);
|
|
100
|
+
}
|
|
101
|
+
\`\`\`
|
|
102
|
+
|
|
103
|
+
### 1. Initialize Memory & Session (Required First Step)
|
|
104
|
+
**THIS MUST BE YOUR VERY FIRST ACTION:**
|
|
105
|
+
\`\`\`javascript
|
|
106
|
+
// Initialize swarm memory session
|
|
107
|
+
Memory.store("swarm_session_${sessionId}", JSON.stringify({
|
|
108
|
+
objective: "${objective}",
|
|
109
|
+
status: "initializing",
|
|
110
|
+
started_at: new Date().toISOString(),
|
|
111
|
+
task_analysis: ${JSON.stringify(taskAnalysis, null, 2)},
|
|
112
|
+
configuration: {
|
|
113
|
+
strategy: "${options.strategy}",
|
|
114
|
+
mode: "${options.mode}",
|
|
115
|
+
max_agents: ${parseInt(options.maxAgents)},
|
|
116
|
+
authenticated: ${isAuthenticated}
|
|
117
|
+
}
|
|
118
|
+
}));
|
|
119
|
+
\`\`\`
|
|
120
|
+
|
|
121
|
+
### 2. Validate ServiceNow Connection
|
|
122
|
+
**Execute these steps IN ORDER:**
|
|
123
|
+
|
|
124
|
+
\`\`\`javascript
|
|
125
|
+
// Step 2.1: Test ServiceNow authentication
|
|
126
|
+
const authCheck = await snow_auth_diagnostics();
|
|
127
|
+
if (!authCheck.success) {
|
|
128
|
+
throw new Error("Authentication failed! Run: snow-flow auth login");
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
// Step 2.2: Create Update Set for tracking changes
|
|
132
|
+
const updateSetName = "Snow-Flow: ${objective.substring(0, 50)}... - ${new Date().toISOString().split('T')[0]}";
|
|
133
|
+
const updateSet = await snow_update_set_create({
|
|
134
|
+
name: updateSetName,
|
|
135
|
+
description: "Automated creation for: ${objective}\\n\\nSession: ${sessionId}",
|
|
136
|
+
auto_switch: true
|
|
137
|
+
});
|
|
138
|
+
|
|
139
|
+
// Store Update Set info in memory
|
|
140
|
+
Memory.store("update_set_${sessionId}", JSON.stringify(updateSet));
|
|
141
|
+
\`\`\`
|
|
142
|
+
|
|
143
|
+
### 3. Create Master Task List
|
|
144
|
+
After completing setup steps, create task breakdown:
|
|
145
|
+
\`\`\`javascript
|
|
146
|
+
TodoWrite([
|
|
147
|
+
{
|
|
148
|
+
id: "setup_complete",
|
|
149
|
+
content: "✅ Setup: Auth, Update Set, Memory initialized",
|
|
150
|
+
status: "completed",
|
|
151
|
+
priority: "high"
|
|
152
|
+
},
|
|
153
|
+
{
|
|
154
|
+
id: "analyze_requirements",
|
|
155
|
+
content: "Analyze user requirements: ${objective}",
|
|
156
|
+
status: "in_progress",
|
|
157
|
+
priority: "high"
|
|
158
|
+
},
|
|
159
|
+
{
|
|
160
|
+
id: "spawn_agents",
|
|
161
|
+
content: "Spawn ${taskAnalysis.estimatedAgentCount} specialized agents",
|
|
162
|
+
status: "pending",
|
|
163
|
+
priority: "high"
|
|
164
|
+
},
|
|
165
|
+
{
|
|
166
|
+
id: "coordinate_development",
|
|
167
|
+
content: "Coordinate agent activities for ${taskAnalysis.taskType}",
|
|
168
|
+
status: "pending",
|
|
169
|
+
priority: "high"
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
id: "validate_solution",
|
|
173
|
+
content: "Validate and test the complete solution",
|
|
174
|
+
status: "pending",
|
|
175
|
+
priority: "medium"
|
|
176
|
+
}
|
|
177
|
+
]);
|
|
178
|
+
\`\`\`
|
|
179
|
+
|
|
180
|
+
### 4. Agent Spawning Strategy
|
|
181
|
+
Based on the task analysis, spawn ${taskAnalysis.estimatedAgentCount} agents in smart batches:
|
|
182
|
+
|
|
183
|
+
**Agent Spawn Order:**
|
|
184
|
+
1. **Primary Agent**: Spawn ${taskAnalysis.primaryAgent} first
|
|
185
|
+
2. **Supporting Agents**: Spawn ${taskAnalysis.supportingAgents.join(', ')} after primary is established
|
|
186
|
+
3. **Use Task tool**: \`Task("agent description", "agent prompt")\` for each agent
|
|
187
|
+
|
|
188
|
+
### 5. Memory Coordination Pattern
|
|
189
|
+
All agents MUST use this simple memory coordination:
|
|
190
|
+
|
|
191
|
+
\`\`\`javascript
|
|
192
|
+
// Agent initialization
|
|
193
|
+
const agentId = \`agent_\${agentType}_${sessionId}\`;
|
|
194
|
+
|
|
195
|
+
// Agent stores progress
|
|
196
|
+
Memory.store(\`\${agentId}_progress\`, JSON.stringify({
|
|
197
|
+
status: "working",
|
|
198
|
+
current_task: "description of current work",
|
|
199
|
+
completion_percentage: 45,
|
|
200
|
+
last_update: new Date().toISOString()
|
|
201
|
+
}));
|
|
202
|
+
|
|
203
|
+
// Agent reads other agent's work when needed
|
|
204
|
+
const primaryWork = Memory.get("agent_${taskAnalysis.primaryAgent}_output");
|
|
205
|
+
|
|
206
|
+
// Agent signals completion
|
|
207
|
+
Memory.store(\`\${agentId}_complete\`, JSON.stringify({
|
|
208
|
+
completed_at: new Date().toISOString(),
|
|
209
|
+
outputs: { /* agent deliverables */ },
|
|
210
|
+
artifacts_created: [ /* list of created artifacts */ ]
|
|
211
|
+
}));
|
|
212
|
+
\`\`\`
|
|
213
|
+
|
|
214
|
+
## 🧠 Intelligent Features Configuration
|
|
215
|
+
${hasIntelligentFeatures ? `✅ **INTELLIGENT MODE ACTIVE** - The following features are enabled:
|
|
216
|
+
|
|
217
|
+
- **🔐 Auto Permissions**: ${options.autoPermissions ? '✅ Will escalate permissions automatically' : '❌ Manual permission handling'}
|
|
218
|
+
- **🔍 Smart Discovery**: ${options.smartDiscovery ? '✅ Will discover and reuse existing artifacts' : '❌ Create all new artifacts'}
|
|
219
|
+
- **🧪 Live Testing**: ${options.liveTesting ? '✅ Will test in real ServiceNow instance' : '❌ Local testing only'}
|
|
220
|
+
- **🚀 Auto Deploy**: ${options.autoDeploy ? '⚠️ WILL DEPLOY TO SERVICENOW AUTOMATICALLY' : '✅ Planning mode - no deployment'}
|
|
221
|
+
- **🔄 Auto Rollback**: ${options.autoRollback ? '✅ Will rollback on any failures' : '❌ No automatic rollback'}
|
|
222
|
+
- **💾 Shared Memory**: ${options.sharedMemory ? '✅ Agents share context via Memory' : '❌ Isolated agent execution'}
|
|
223
|
+
- **📊 Progress Monitoring**: ${options.progressMonitoring ? '✅ Real-time progress tracking' : '❌ No progress monitoring'}` : '❌ **STANDARD MODE** - Use manual coordination patterns'}
|
|
224
|
+
|
|
225
|
+
## 🎯 ServiceNow Execution Strategy
|
|
226
|
+
|
|
227
|
+
### 🚀 MANDATORY: Live ServiceNow Development First!
|
|
228
|
+
|
|
229
|
+
**CRITICAL RULE**: All agents MUST attempt to use ServiceNow MCP tools first, regardless of authentication status.
|
|
230
|
+
|
|
231
|
+
#### Current MCP Tools Available (Snow-Flow v3.3.4)
|
|
232
|
+
${isAuthenticated ? '✅ Authentication detected - full deployment capabilities' : '⚠️ No authentication detected - MCP tools will provide specific instructions if auth needed'}
|
|
233
|
+
|
|
234
|
+
Your agents MUST use these MCP tools IN THIS ORDER:
|
|
235
|
+
|
|
236
|
+
🔍 **PRE-FLIGHT CHECKS** (Always do first!):
|
|
237
|
+
1. \`snow_auth_diagnostics\` - Test authentication and permissions
|
|
238
|
+
2. If auth fails, the tool provides specific instructions
|
|
239
|
+
3. Continue with appropriate strategy based on auth status
|
|
240
|
+
|
|
241
|
+
🎯 **Core Development Tools**:
|
|
242
|
+
1. **Universal Query Tool**: \`snow_query_table\` - Works with ALL ServiceNow tables
|
|
243
|
+
- Count-only: \`{table: "incident", query: "state!=7"}\` → Memory efficient
|
|
244
|
+
- Specific fields: \`{table: "sc_request", fields: ["number", "state"]}\` → Only needed data
|
|
245
|
+
- Full content: \`{table: "change_request", include_content: true}\` → When all data needed
|
|
246
|
+
|
|
247
|
+
2. **Deployment Tools**:
|
|
248
|
+
- \`snow_deploy\` - Universal deployment for NEW artifacts (16+ types supported!)
|
|
249
|
+
- \`snow_update\` - Update EXISTING artifacts by name or sys_id
|
|
250
|
+
|
|
251
|
+
3. **Discovery Tools**:
|
|
252
|
+
- \`snow_discover_table_fields\` - Get exact field names and types
|
|
253
|
+
- \`snow_table_schema_discovery\` - Complete table structure
|
|
254
|
+
|
|
255
|
+
4. **Update Set Management**:
|
|
256
|
+
- \`snow_update_set_create\` - Create new update sets
|
|
257
|
+
- \`snow_update_set_add_comment\` - Track progress
|
|
258
|
+
- \`snow_update_set_retrieve\` - Get update set XML
|
|
259
|
+
|
|
260
|
+
## 🔧 NEW: Expanded Artifact Support (v3.3.4)
|
|
261
|
+
|
|
262
|
+
Snow-Flow now supports **16+ different ServiceNow artifact types**:
|
|
263
|
+
|
|
264
|
+
| Type | Table | Deploy | Update | Natural Language |
|
|
265
|
+
|------|-------|--------|---------|------------------|
|
|
266
|
+
| widget | sp_widget | ✅ | ✅ | ✅ |
|
|
267
|
+
| business_rule | sys_script | ✅ | ✅ | ✅ |
|
|
268
|
+
| script_include | sys_script_include | ✅ | ✅ | ✅ |
|
|
269
|
+
| ui_page | sys_ui_page | ✅ | ✅ | ✅ |
|
|
270
|
+
| client_script | sys_script_client | ✅ | ✅ | ✅ |
|
|
271
|
+
| ui_action | sys_ui_action | ✅ | ✅ | ✅ |
|
|
272
|
+
| ui_policy | sys_ui_policy | ✅ | ✅ | ✅ |
|
|
273
|
+
| acl | sys_security_acl | ✅ | ✅ | ✅ |
|
|
274
|
+
| table | sys_db_object | ✅ | ✅ | ✅ |
|
|
275
|
+
| field | sys_dictionary | ✅ | ✅ | ✅ |
|
|
276
|
+
| workflow | wf_workflow | ✅ | ✅ | ✅ |
|
|
277
|
+
| flow | sys_hub_flow | ✅ | ✅ | ✅ |
|
|
278
|
+
| notification | sysevent_email_action | ✅ | ✅ | ✅ |
|
|
279
|
+
| scheduled_job | sysauto_script | ✅ | ✅ | ✅ |
|
|
280
|
+
|
|
281
|
+
**Usage Examples:**
|
|
282
|
+
\`\`\`javascript
|
|
283
|
+
// Deploy NEW artifacts
|
|
284
|
+
await snow_deploy({
|
|
285
|
+
type: 'business_rule',
|
|
286
|
+
name: 'Auto Assignment Rule',
|
|
287
|
+
table: 'incident',
|
|
288
|
+
when: 'before',
|
|
289
|
+
script: 'if (current.priority == "1") current.assigned_to = "admin";'
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// Update EXISTING artifacts (natural language supported!)
|
|
293
|
+
await snow_update({
|
|
294
|
+
type: 'ui_action',
|
|
295
|
+
identifier: 'close_incident',
|
|
296
|
+
instruction: 'Change label to "Close with Resolution" and add validation'
|
|
297
|
+
});
|
|
298
|
+
\`\`\`
|
|
299
|
+
|
|
300
|
+
${options.autoDeploy ? `
|
|
301
|
+
#### ⚠️ AUTO-DEPLOYMENT ACTIVE ⚠️
|
|
302
|
+
- Real artifacts will be created in ServiceNow
|
|
303
|
+
- All changes tracked in Update Sets
|
|
304
|
+
- Rollback available if needed
|
|
305
|
+
` : `
|
|
306
|
+
#### 📋 Planning Mode Active
|
|
307
|
+
- No real artifacts will be created
|
|
308
|
+
- Analysis and recommendations only
|
|
309
|
+
- Use --auto-deploy to enable deployment
|
|
310
|
+
`}
|
|
311
|
+
|
|
312
|
+
${!isAuthenticated ? `### ❌ ServiceNow Integration Disabled
|
|
313
|
+
|
|
314
|
+
#### Planning Mode (Auth Required)
|
|
315
|
+
When authentication is not available, agents will:
|
|
316
|
+
1. Document the COMPLETE solution architecture
|
|
317
|
+
2. Create detailed implementation guides
|
|
318
|
+
3. Store all plans in Memory for future deployment
|
|
319
|
+
4. Provide SPECIFIC instructions: "Run snow-flow auth login"
|
|
320
|
+
|
|
321
|
+
⚠️ IMPORTANT: This is a FALLBACK mode only!
|
|
322
|
+
Agents must ALWAYS try MCP tools first!` : ''}
|
|
323
|
+
|
|
324
|
+
## 👑 Queen Agent Coordination Instructions
|
|
325
|
+
|
|
326
|
+
### 6. Agent Coordination & Handoffs
|
|
327
|
+
Ensure smooth transitions between agents:
|
|
328
|
+
|
|
329
|
+
\`\`\`javascript
|
|
330
|
+
// Primary agent signals readiness for support
|
|
331
|
+
Memory.store("agent_${taskAnalysis.primaryAgent}_ready_for_support", JSON.stringify({
|
|
332
|
+
base_structure_complete: true,
|
|
333
|
+
ready_for: [${taskAnalysis.supportingAgents.map(a => `"${a}"`).join(', ')}],
|
|
334
|
+
timestamp: new Date().toISOString()
|
|
335
|
+
}));
|
|
336
|
+
|
|
337
|
+
// Supporting agents check readiness
|
|
338
|
+
const canProceed = JSON.parse(Memory.get("agent_${taskAnalysis.primaryAgent}_ready_for_support") || "{}");
|
|
339
|
+
if (canProceed?.base_structure_complete) {
|
|
340
|
+
// Begin supporting work
|
|
341
|
+
}
|
|
342
|
+
\`\`\`
|
|
343
|
+
|
|
344
|
+
### 7. Final Validation and Completion
|
|
345
|
+
Once all agents complete their work:
|
|
346
|
+
|
|
347
|
+
\`\`\`javascript
|
|
348
|
+
// Collect all agent outputs
|
|
349
|
+
const agentOutputs = {};
|
|
350
|
+
[${[taskAnalysis.primaryAgent, ...taskAnalysis.supportingAgents].map(a => `"${a}"`).join(', ')}].forEach(agent => {
|
|
351
|
+
const output = Memory.get(\`agent_\${agent}_complete\`);
|
|
352
|
+
if (output) {
|
|
353
|
+
agentOutputs[agent] = JSON.parse(output);
|
|
354
|
+
}
|
|
355
|
+
});
|
|
356
|
+
|
|
357
|
+
// Store final swarm results
|
|
358
|
+
Memory.store("swarm_session_${sessionId}_results", JSON.stringify({
|
|
359
|
+
objective: "${objective}",
|
|
360
|
+
completed_at: new Date().toISOString(),
|
|
361
|
+
agent_outputs: agentOutputs,
|
|
362
|
+
artifacts_created: Object.values(agentOutputs)
|
|
363
|
+
.flatMap(output => output.artifacts_created || []),
|
|
364
|
+
success: true
|
|
365
|
+
}));
|
|
366
|
+
|
|
367
|
+
// Update final TodoWrite status
|
|
368
|
+
TodoWrite([
|
|
369
|
+
{
|
|
370
|
+
id: "swarm_completion",
|
|
371
|
+
content: "Swarm successfully completed: ${objective}",
|
|
372
|
+
status: "completed",
|
|
373
|
+
priority: "high"
|
|
374
|
+
}
|
|
375
|
+
]);
|
|
376
|
+
\`\`\`
|
|
377
|
+
|
|
378
|
+
## 🎯 Success Criteria
|
|
379
|
+
|
|
380
|
+
Your Queen Agent orchestration is successful when:
|
|
381
|
+
1. ✅ All agents have been spawned and initialized
|
|
382
|
+
2. ✅ Swarm session is tracked in Memory
|
|
383
|
+
3. ✅ Agents are coordinating through shared Memory
|
|
384
|
+
4. ✅ TodoWrite is being used for task tracking
|
|
385
|
+
5. ✅ ${taskAnalysis.taskType} requirements are met
|
|
386
|
+
6. ✅ All artifacts are created/deployed successfully
|
|
387
|
+
|
|
388
|
+
## 💡 Queen Agent Best Practices
|
|
389
|
+
|
|
390
|
+
1. **Spawn agents concurrently** when tasks are independent
|
|
391
|
+
2. **Use Memory with JSON.stringify/parse** to avoid key collisions
|
|
392
|
+
3. **Update TodoWrite** frequently for visibility
|
|
393
|
+
4. **Monitor agent health** and restart if needed
|
|
394
|
+
5. **Validate outputs** before marking complete
|
|
395
|
+
6. **Store all decisions** in Memory for audit trail
|
|
396
|
+
|
|
397
|
+
## 🚀 Begin Orchestration
|
|
398
|
+
|
|
399
|
+
Now execute this Queen Agent orchestration plan:
|
|
400
|
+
1. Initialize the swarm session in Memory
|
|
401
|
+
2. Create the master task list with TodoWrite
|
|
402
|
+
3. Spawn all required agents using Task
|
|
403
|
+
4. Monitor progress and coordinate
|
|
404
|
+
5. Validate and complete the objective
|
|
405
|
+
|
|
406
|
+
Remember: You are the Queen Agent - the master coordinator. Your role is to ensure all agents work harmoniously to achieve the objective: "${objective}"
|
|
407
|
+
|
|
408
|
+
## 📊 Session Information
|
|
409
|
+
- **Session ID**: ${sessionId}
|
|
410
|
+
- **Snow-Flow Version**: v3.3.4
|
|
411
|
+
- **Authentication**: ${isAuthenticated ? 'Active' : 'Required'}
|
|
412
|
+
- **Deployment Mode**: ${options.autoDeploy ? 'Live deployment enabled' : 'Planning mode'}
|
|
413
|
+
- **Estimated Agents**: ${taskAnalysis.estimatedAgentCount}
|
|
414
|
+
- **Primary Agent**: ${taskAnalysis.primaryAgent}
|
|
415
|
+
|
|
416
|
+
🎯 **Ready to begin orchestration!**
|
|
417
|
+
`;
|
|
418
|
+
return prompt;
|
|
419
|
+
}
|
|
420
|
+
//# sourceMappingURL=cli-new-prompt.js.map
|