snow-flow 8.4.42 → 8.4.44

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 (35) hide show
  1. package/dist/cli/auth.d.ts.map +1 -1
  2. package/dist/cli/auth.js +56 -60
  3. package/dist/cli/auth.js.map +1 -1
  4. package/dist/utils/snow-oauth.d.ts +10 -5
  5. package/dist/utils/snow-oauth.d.ts.map +1 -1
  6. package/dist/utils/snow-oauth.js +223 -86
  7. package/dist/utils/snow-oauth.js.map +1 -1
  8. package/package.json +1 -1
  9. package/THEMES.md +0 -223
  10. package/dist/mcp/servicenow-mcp-unified/config/tool-definitions.json +0 -3935
  11. package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_automation_discover.js +0 -164
  12. package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_artifact_transfer.js +0 -282
  13. package/dist/mcp/servicenow-mcp-unified/tools/filters/snow_build_filter.js +0 -171
  14. package/dist/mcp/servicenow-mcp-unified/tools/formatters/snow_format_value.js +0 -164
  15. package/dist/mcp/servicenow-mcp-unified/tools/knowledge/index.js.bak +0 -45
  16. package/dist/mcp/servicenow-mcp-unified/tools/local-sync/snow_artifact_sync.js +0 -172
  17. package/dist/mcp/servicenow-mcp-unified/tools/system-properties/index.js +0 -36
  18. package/dist/mcp/servicenow-mcp-unified/tools/ui-builder/snow_discover_uib.js +0 -296
  19. package/dist/mcp/servicenow-mcp-unified/tools/workspace/snow_create_ux_component.js +0 -292
  20. package/dist/memory/session-memory.d.ts +0 -80
  21. package/dist/memory/session-memory.d.ts.map +0 -1
  22. package/dist/memory/session-memory.js +0 -468
  23. package/dist/memory/session-memory.js.map +0 -1
  24. package/dist/templates/opencode-agents-template.d.ts +0 -2
  25. package/dist/templates/opencode-agents-template.d.ts.map +0 -1
  26. package/dist/templates/opencode-agents-template.js +0 -469
  27. package/dist/templates/opencode-agents-template.js.map +0 -1
  28. package/dist/utils/opencode-output-interceptor.d.ts +0 -40
  29. package/dist/utils/opencode-output-interceptor.d.ts.map +0 -1
  30. package/dist/utils/opencode-output-interceptor.js +0 -258
  31. package/dist/utils/opencode-output-interceptor.js.map +0 -1
  32. package/scripts/bulk-optimize-tools.js +0 -486
  33. package/scripts/optimize-mcp-tools.ts +0 -410
  34. package/themes/README.md +0 -83
  35. package/themes/servicenow.json +0 -117
@@ -1,468 +0,0 @@
1
- "use strict";
2
- /**
3
- * Session Memory System - JSON-based implementation
4
- * Simple JSON file storage for swarm orchestration sessions
5
- */
6
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
7
- if (k2 === undefined) k2 = k;
8
- var desc = Object.getOwnPropertyDescriptor(m, k);
9
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
10
- desc = { enumerable: true, get: function() { return m[k]; } };
11
- }
12
- Object.defineProperty(o, k2, desc);
13
- }) : (function(o, m, k, k2) {
14
- if (k2 === undefined) k2 = k;
15
- o[k2] = m[k];
16
- }));
17
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
18
- Object.defineProperty(o, "default", { enumerable: true, value: v });
19
- }) : function(o, v) {
20
- o["default"] = v;
21
- });
22
- var __importStar = (this && this.__importStar) || (function () {
23
- var ownKeys = function(o) {
24
- ownKeys = Object.getOwnPropertyNames || function (o) {
25
- var ar = [];
26
- for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
27
- return ar;
28
- };
29
- return ownKeys(o);
30
- };
31
- return function (mod) {
32
- if (mod && mod.__esModule) return mod;
33
- var result = {};
34
- if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
35
- __setModuleDefault(result, mod);
36
- return result;
37
- };
38
- })();
39
- Object.defineProperty(exports, "__esModule", { value: true });
40
- exports.QueenMemorySystem = exports.SessionMemorySystem = void 0;
41
- const path = __importStar(require("path"));
42
- const fs = __importStar(require("fs"));
43
- class SessionMemorySystem {
44
- constructor(dbPath) {
45
- this.SAVE_DELAY = 1000; // Debounce saves by 1 second
46
- // Use .snow-flow/sessions directory instead of queen
47
- this.memoryDir = path.dirname(dbPath || path.join(process.cwd(), '.snow-flow', 'sessions', 'memory'));
48
- // Ensure directory exists
49
- if (!fs.existsSync(this.memoryDir)) {
50
- fs.mkdirSync(this.memoryDir, { recursive: true });
51
- }
52
- // Load or initialize storage
53
- this.storage = this.loadStorage();
54
- // Convert storage to memory format
55
- this.memory = this.convertStorageToMemory();
56
- }
57
- getFilePath(filename) {
58
- return path.join(this.memoryDir, filename);
59
- }
60
- loadStorage() {
61
- const files = {
62
- patterns: this.getFilePath('patterns.json'),
63
- artifacts: this.getFilePath('artifacts.json'),
64
- learnings: this.getFilePath('learnings.json'),
65
- context: this.getFilePath('context.json'),
66
- taskHistory: this.getFilePath('task-history.json')
67
- };
68
- const storage = {
69
- patterns: [],
70
- artifacts: {},
71
- learnings: {},
72
- context: {},
73
- taskHistory: []
74
- };
75
- // Load patterns
76
- if (fs.existsSync(files.patterns)) {
77
- try {
78
- const data = fs.readFileSync(files.patterns, 'utf-8');
79
- storage.patterns = JSON.parse(data);
80
- // Convert date strings back to Date objects
81
- storage.patterns.forEach(p => {
82
- p.lastUsed = new Date(p.lastUsed);
83
- });
84
- }
85
- catch (error) {
86
- console.warn('⚠️ Could not load patterns.json:', error);
87
- }
88
- }
89
- // Load artifacts
90
- if (fs.existsSync(files.artifacts)) {
91
- try {
92
- const data = fs.readFileSync(files.artifacts, 'utf-8');
93
- storage.artifacts = JSON.parse(data);
94
- }
95
- catch (error) {
96
- console.warn('⚠️ Could not load artifacts.json:', error);
97
- }
98
- }
99
- // Load learnings
100
- if (fs.existsSync(files.learnings)) {
101
- try {
102
- const data = fs.readFileSync(files.learnings, 'utf-8');
103
- storage.learnings = JSON.parse(data);
104
- }
105
- catch (error) {
106
- console.warn('⚠️ Could not load learnings.json:', error);
107
- }
108
- }
109
- // Load context
110
- if (fs.existsSync(files.context)) {
111
- try {
112
- const data = fs.readFileSync(files.context, 'utf-8');
113
- storage.context = JSON.parse(data);
114
- }
115
- catch (error) {
116
- console.warn('⚠️ Could not load context.json:', error);
117
- }
118
- }
119
- // Load task history
120
- if (fs.existsSync(files.taskHistory)) {
121
- try {
122
- const data = fs.readFileSync(files.taskHistory, 'utf-8');
123
- storage.taskHistory = JSON.parse(data);
124
- }
125
- catch (error) {
126
- console.warn('⚠️ Could not load task-history.json:', error);
127
- }
128
- }
129
- return storage;
130
- }
131
- convertStorageToMemory() {
132
- const artifacts = new Map();
133
- Object.entries(this.storage.artifacts).forEach(([key, value]) => {
134
- artifacts.set(key, value);
135
- });
136
- const learnings = new Map();
137
- Object.entries(this.storage.learnings).forEach(([key, value]) => {
138
- learnings.set(key, typeof value === 'string' ? value : JSON.stringify(value));
139
- });
140
- return {
141
- patterns: this.storage.patterns,
142
- artifacts,
143
- agentHistory: new Map(),
144
- learnings
145
- };
146
- }
147
- scheduleSave() {
148
- // Debounce saves to avoid excessive file writes
149
- if (this.saveDebounceTimer) {
150
- clearTimeout(this.saveDebounceTimer);
151
- }
152
- this.saveDebounceTimer = setTimeout(() => {
153
- this.saveAll();
154
- }, this.SAVE_DELAY);
155
- }
156
- saveAll() {
157
- // Save patterns
158
- this.saveJSON('patterns.json', this.storage.patterns);
159
- // Save artifacts
160
- this.saveJSON('artifacts.json', this.storage.artifacts);
161
- // Save learnings
162
- this.saveJSON('learnings.json', this.storage.learnings);
163
- // Save context
164
- this.saveJSON('context.json', this.storage.context);
165
- // Save task history
166
- this.saveJSON('task-history.json', this.storage.taskHistory);
167
- }
168
- saveJSON(filename, data) {
169
- const filepath = this.getFilePath(filename);
170
- try {
171
- // Write to temp file first for atomicity
172
- const tempPath = filepath + '.tmp';
173
- fs.writeFileSync(tempPath, JSON.stringify(data, null, 2));
174
- // Atomic rename
175
- fs.renameSync(tempPath, filepath);
176
- }
177
- catch (error) {
178
- console.error(`❌ Failed to save ${filename}:`, error);
179
- }
180
- }
181
- // Store successful deployment pattern
182
- storePattern(pattern) {
183
- // Update or add pattern
184
- const existingIndex = this.storage.patterns.findIndex(p => p.taskType === pattern.taskType);
185
- if (existingIndex >= 0) {
186
- // Update existing pattern
187
- const existing = this.storage.patterns[existingIndex];
188
- existing.successRate = pattern.successRate;
189
- existing.agentSequence = pattern.agentSequence;
190
- existing.mcpSequence = pattern.mcpSequence;
191
- existing.avgDuration = pattern.avgDuration;
192
- existing.lastUsed = pattern.lastUsed;
193
- existing.useCount = (existing.useCount || 0) + 1;
194
- }
195
- else {
196
- // Add new pattern
197
- this.storage.patterns.push({
198
- ...pattern,
199
- useCount: 1
200
- });
201
- }
202
- // Update memory
203
- this.memory.patterns = this.storage.patterns;
204
- // Schedule save
205
- this.scheduleSave();
206
- }
207
- // Get best pattern for task type
208
- getBestPattern(taskType) {
209
- return this.memory.patterns.find(p => p.taskType === taskType) || null;
210
- }
211
- // Store artifact information
212
- storeArtifact(artifact) {
213
- const id = `${artifact.type}_${artifact.name}`;
214
- // Store in both storage and memory
215
- this.storage.artifacts[id] = artifact;
216
- this.memory.artifacts.set(id, artifact);
217
- // Schedule save
218
- this.scheduleSave();
219
- }
220
- // Find similar artifacts
221
- findSimilarArtifacts(type, namePattern) {
222
- const results = [];
223
- for (const [id, artifact] of Array.from(this.memory.artifacts.entries())) {
224
- if (artifact.type === type && artifact.name.toLowerCase().includes(namePattern.toLowerCase())) {
225
- results.push(artifact);
226
- }
227
- }
228
- return results;
229
- }
230
- // Store learning from task execution
231
- storeLearning(key, value, confidence = 1.0) {
232
- const valueStr = typeof value === 'string' ? value : JSON.stringify(value);
233
- // Store with metadata
234
- this.storage.learnings[key] = {
235
- value: valueStr,
236
- confidence,
237
- updatedAt: new Date().toISOString()
238
- };
239
- // Update memory
240
- this.memory.learnings.set(key, valueStr);
241
- // Schedule save
242
- this.scheduleSave();
243
- }
244
- // Get learning
245
- getLearning(key) {
246
- const value = this.memory.learnings.get(key);
247
- if (!value)
248
- return null;
249
- // Try to parse JSON if it looks like JSON
250
- try {
251
- if (value.startsWith('{') || value.startsWith('[')) {
252
- return JSON.parse(value);
253
- }
254
- }
255
- catch {
256
- // If parsing fails, return as string
257
- }
258
- return value;
259
- }
260
- // Record task completion for learning
261
- recordTaskCompletion(taskId, objective, type, agentsUsed, success, duration) {
262
- const entry = {
263
- id: taskId,
264
- objective,
265
- type,
266
- agentsUsed,
267
- success,
268
- duration,
269
- completedAt: new Date().toISOString()
270
- };
271
- // Add to history
272
- this.storage.taskHistory.push(entry);
273
- // Keep only last 1000 entries to prevent unbounded growth
274
- if (this.storage.taskHistory.length > 1000) {
275
- this.storage.taskHistory = this.storage.taskHistory.slice(-1000);
276
- }
277
- // Schedule save
278
- this.scheduleSave();
279
- }
280
- // Get success rate for task type
281
- getSuccessRate(taskType) {
282
- const relevantTasks = this.storage.taskHistory.filter(t => t.type === taskType);
283
- if (relevantTasks.length === 0) {
284
- return 0.5; // Default success rate
285
- }
286
- const successes = relevantTasks.filter(t => t.success).length;
287
- return successes / relevantTasks.length;
288
- }
289
- // Export memory for backup
290
- exportMemory() {
291
- return JSON.stringify({
292
- patterns: this.storage.patterns,
293
- artifacts: Object.entries(this.storage.artifacts),
294
- learnings: Object.entries(this.storage.learnings),
295
- context: Object.entries(this.storage.context),
296
- taskHistory: this.storage.taskHistory
297
- }, null, 2);
298
- }
299
- // Import memory from backup
300
- importMemory(memoryData) {
301
- try {
302
- const data = JSON.parse(memoryData);
303
- // Import patterns
304
- if (data.patterns) {
305
- this.storage.patterns = data.patterns.map((p) => ({
306
- ...p,
307
- lastUsed: new Date(p.lastUsed)
308
- }));
309
- }
310
- // Import artifacts
311
- if (data.artifacts) {
312
- this.storage.artifacts = {};
313
- data.artifacts.forEach(([key, value]) => {
314
- this.storage.artifacts[key] = value;
315
- });
316
- }
317
- // Import learnings
318
- if (data.learnings) {
319
- this.storage.learnings = {};
320
- data.learnings.forEach(([key, value]) => {
321
- this.storage.learnings[key] = value;
322
- });
323
- }
324
- // Import context
325
- if (data.context) {
326
- this.storage.context = {};
327
- data.context.forEach(([key, value]) => {
328
- this.storage.context[key] = value;
329
- });
330
- }
331
- // Import task history
332
- if (data.taskHistory) {
333
- this.storage.taskHistory = data.taskHistory;
334
- }
335
- // Update memory from storage
336
- this.memory = this.convertStorageToMemory();
337
- // Save all
338
- this.saveAll();
339
- }
340
- catch (error) {
341
- throw new Error(`Failed to import memory: ${error.message}`);
342
- }
343
- }
344
- // Clear all memory (reset learning)
345
- clearMemory() {
346
- // Reset storage
347
- this.storage = {
348
- patterns: [],
349
- artifacts: {},
350
- learnings: {},
351
- context: {},
352
- taskHistory: []
353
- };
354
- // Reset memory
355
- this.memory = {
356
- patterns: [],
357
- artifacts: new Map(),
358
- agentHistory: new Map(),
359
- learnings: new Map()
360
- };
361
- // Save empty state
362
- this.saveAll();
363
- }
364
- // Store data in context (key-value store)
365
- storeInContext(key, value) {
366
- this.storage.context[key] = value;
367
- this.scheduleSave();
368
- }
369
- // Get data from context
370
- getFromContext(key) {
371
- return this.storage.context[key] || null;
372
- }
373
- // Store generic data (alias for storeInContext for compatibility)
374
- store(key, value) {
375
- this.storeInContext(key, value);
376
- }
377
- // Get generic data (alias for getFromContext for compatibility)
378
- get(key) {
379
- return this.getFromContext(key);
380
- }
381
- // Get database path (for compatibility)
382
- getDbPath() {
383
- return this.memoryDir;
384
- }
385
- // Close database connection (no-op for JSON, but kept for compatibility)
386
- close() {
387
- // Save any pending changes
388
- if (this.saveDebounceTimer) {
389
- clearTimeout(this.saveDebounceTimer);
390
- this.saveAll();
391
- }
392
- }
393
- // Additional methods needed by other components
394
- /**
395
- * Find similar patterns for a given task type
396
- */
397
- findSimilarPatterns(taskType) {
398
- return this.storage.patterns
399
- .filter(p => p.taskType.toLowerCase().includes(taskType.toLowerCase()))
400
- .sort((a, b) => {
401
- // Sort by success rate first, then by use count
402
- if (b.successRate !== a.successRate) {
403
- return b.successRate - a.successRate;
404
- }
405
- return (b.useCount || 0) - (a.useCount || 0);
406
- })
407
- .slice(0, 5);
408
- }
409
- /**
410
- * Store a decision made by the orchestrator
411
- */
412
- storeDecision(taskId, decision) {
413
- this.storeInContext(`decision_${taskId}`, {
414
- ...decision,
415
- timestamp: new Date().toISOString()
416
- });
417
- }
418
- /**
419
- * Find the best pattern for a task type
420
- */
421
- findBestPattern(taskType) {
422
- const patterns = this.findSimilarPatterns(taskType);
423
- return patterns.length > 0 ? patterns[0] : null;
424
- }
425
- /**
426
- * Get memory statistics
427
- */
428
- getStats() {
429
- const stats = {
430
- patterns: this.storage.patterns.length,
431
- artifacts: Object.keys(this.storage.artifacts).length,
432
- tasks: this.storage.taskHistory.length,
433
- learnings: Object.keys(this.storage.learnings).length,
434
- databaseSize: 0
435
- };
436
- // Calculate total file sizes
437
- const files = ['patterns.json', 'artifacts.json', 'learnings.json', 'context.json', 'task-history.json'];
438
- for (const file of files) {
439
- const filepath = this.getFilePath(file);
440
- if (fs.existsSync(filepath)) {
441
- stats.databaseSize += fs.statSync(filepath).size;
442
- }
443
- }
444
- return stats;
445
- }
446
- /**
447
- * Store progress information
448
- */
449
- storeProgress(agentId, progress) {
450
- this.storeInContext(`progress_${agentId}`, progress);
451
- }
452
- /**
453
- * Get progress information
454
- */
455
- getProgress(agentId) {
456
- return this.getFromContext(`progress_${agentId}`);
457
- }
458
- /**
459
- * Store failure pattern for learning
460
- */
461
- storeFailurePattern(pattern) {
462
- const key = `failure_${Date.now()}`;
463
- this.storeLearning(key, pattern, 0.8);
464
- }
465
- }
466
- exports.SessionMemorySystem = SessionMemorySystem;
467
- exports.QueenMemorySystem = SessionMemorySystem;
468
- //# sourceMappingURL=session-memory.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"session-memory.js","sourceRoot":"","sources":["../../src/memory/session-memory.ts"],"names":[],"mappings":";AAAA;;;GAGG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2CAA6B;AAC7B,uCAAyB;AA6CzB,MAAa,mBAAmB;IAO9B,YAAY,MAAe;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ACzG,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,MAAM,QAAQ,GAAG,IAAI,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YACxC,IAAI,EAAE,CAAC,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;gBAC5B,KAAK,CAAC,YAAY,IAAI,EAAE,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC,IAAI,CAAC;YACnD,CAAC;QACH,CAAC;QAED,OAAO,KAAK,CAAC;IACf,CAAC;IAED;;OAEG;IACH,aAAa,CAAC,OAAe,EAAE,QAAa;QAC1C,IAAI,CAAC,cAAc,CAAC,YAAY,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;IACvD,CAAC;IAED;;OAEG;IACH,WAAW,CAAC,OAAe;QACzB,OAAO,IAAI,CAAC,cAAc,CAAC,YAAY,OAAO,EAAE,CAAC,CAAC;IACpD,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,OAAY;QAC9B,MAAM,GAAG,GAAG,WAAW,IAAI,CAAC,GAAG,EAAE,EAAE,CAAC;QACpC,IAAI,CAAC,aAAa,CAAC,GAAG,EAAE,OAAO,EAAE,GAAG,CAAC,CAAC;IACxC,CAAC;CACF;AA7eD,kDA6eC;AAG+B,gDAAiB"}
@@ -1,2 +0,0 @@
1
- export declare const AGENTS_MD_TEMPLATE = "# Snow-Flow: ServiceNow Development with OpenCode\n\n**Multi-LLM ServiceNow Development Platform** \u2022 411 Tools \u2022 2 MCP Servers \u2022 Any LLM Provider\n\n---\n\n## \uD83D\uDE80 Quick Start\n\nYou're using **OpenCode** with Snow-Flow's ServiceNow tools. This gives you access to:\n- **235+ ServiceNow tools** via `servicenow-unified` MCP server\n- **176+ orchestration tools** via `snow-flow` MCP server\n- **Multi-agent coordination** with OpenCode's Task system\n- **Any LLM provider**: Claude, GPT, Gemini, Ollama, etc.\n\n### Available Tools\n\nUse OpenCode's native commands to explore:\n```\n# List all available MCP tools\n> What ServiceNow tools are available?\n\n# Get tool details\n> Describe the snow_deploy tool\n\n# Use tools directly\n> Use snow_query_table to get open incidents\n```\n\n---\n\n## \uD83D\uDD34 CRITICAL RULES - NO EXCEPTIONS\n\n### Rule #1: ES5 ONLY - ServiceNow Rhino Engine\nServiceNow runs on Mozilla Rhino (ES5 from 2009). Modern JavaScript WILL FAIL!\n\n**\u274C NEVER USE (WILL CRASH):**\n```javascript\nconst data = []; // SyntaxError!\nlet items = []; // SyntaxError!\nconst fn = () => {}; // SyntaxError!\nvar msg = \\`Hello ${name}\\`; // SyntaxError!\nfor (let item of items) {} // SyntaxError!\nvar {name, id} = user; // SyntaxError!\narray.map(x => x.id); // SyntaxError!\n```\n\n**\u2705 ONLY USE ES5:**\n```javascript\nvar data = [];\nvar items = [];\nfunction fn() { return 'result'; }\nvar msg = 'Hello ' + name;\nfor (var i = 0; i < items.length; i++) {\n var item = items[i];\n}\nvar name = user.name;\nvar id = user.id;\nfor (var j = 0; j < array.length; j++) {\n // Process array[j]\n}\n```\n\n### Rule #2: NO MOCK DATA - EVERYTHING REAL\n**FORBIDDEN:** Mock data, placeholders, TODOs, stub implementations, test values\n**REQUIRED:** Complete, production-ready, fully functional code\n\n### Rule #3: Widget Debugging = Local Sync\n**For ANY widget issue, ALWAYS use:**\n```\nsnow_pull_artifact({ sys_id: 'widget_sys_id' })\n```\nThen edit locally with OpenCode's native tools, then push back with `snow_push_artifact`.\n\n**NEVER use `snow_query_table` for widgets!** It hits token limits.\n\n---\n\n## \uD83D\uDCCB MCP Servers (411 Tools Total)\n\n### 1. servicenow-unified (235+ tools)\n\n**Deployment & Updates:**\n```\nsnow_deploy - Create NEW artifacts (widgets, flows, scripts)\nsnow_update - UPDATE existing artifacts\nsnow_validate_deployment - Validate before deploying\nsnow_preview_widget - Preview widgets\n```\n\n**Local Development:**\n```\nsnow_pull_artifact - Pull ANY artifact to local files\nsnow_push_artifact - Push local changes back\nsnow_list_local_artifacts - List pulled artifacts\n```\n\n**CRUD Operations:**\n```\nsnow_query_table - Query any ServiceNow table\nsnow_create_record - Create records\nsnow_update_record - Update records\nsnow_delete_record - Delete records\n```\n\n**Automation:**\n```\nsnow_execute_script_with_output - Run background scripts (ES5 only!)\nsnow_create_business_rule - Create business rules\nsnow_create_scheduled_job - Schedule jobs\n```\n\n**UI Builder & Workspaces:**\n```\nsnow_create_uib_page - Create UI Builder pages\nsnow_create_workspace - Create agent workspaces\nsnow_create_complete_workspace - Full workspace with landing page\n```\n\n[... and 200+ more tools]\n\n### 2. snow-flow (176+ tools)\n\n**Multi-Agent Coordination (Use OpenCode's Task system!):**\n```\nswarm_init({ topology: 'hierarchical', maxAgents: 8 })\nagent_spawn({ type: 'widget-creator', objective: '...' })\n```\n\n**Memory & Context:**\n```\nmemory_search({ query: 'workspace sys_ids' })\nmemory_usage() - Check memory usage\n```\n\n**\uD83E\uDDE0 Machine Learning & Predictive Intelligence:**\n\n**\uD83D\uDEA8 TWO COMPLETELY DIFFERENT ML APPROACHES - ASK USER FIRST!**\n\n**\uD83C\uDFE2 Native ServiceNow Predictive Intelligence (NEW! v7.4.0):**\n- Runs INSIDE ServiceNow instance (requires PI license)\n- Production-ready, auto-retrain, enterprise ML\n- **ALWAYS ASK:** \"Do you have a ServiceNow Predictive Intelligence license?\"\n\n```\n# Native PI Tools (Production):\nsnow_create_pi_solution({ name, table, output_field, solution_type })\nsnow_train_pi_solution({ solution_id }) - Trains in ServiceNow (10-30 min)\nsnow_monitor_pi_training({ solution_id }) - Monitor progress/accuracy\nsnow_activate_pi_solution({ solution_id }) - Activate for production\nsnow_list_pi_solutions() - List all PI solutions\nml_predictive_intelligence({ solution_id, record_id }) - Make predictions\n```\n\n**\uD83D\uDCBB Local TensorFlow.js ML (Experimental, FREE):**\n- Runs locally on dev machine (no ServiceNow license required)\n- Development/testing only, NOT for production\n\n```\n# Local ML Tools (Dev/Testing Only):\nneural_train({ type: 'incident_classifier', dataset: [...] })\nneural_patterns() - Get learned patterns\nml_train_incident_classifier() - Train LSTM locally\nml_predict_change_risk() - Local risk prediction\nml_detect_anomalies() - Local anomaly detection\n```\n\n**\uD83D\uDCCB ML Decision Matrix for Agents:**\n| User Request | Has PI License? | Recommend |\n|--------------|----------------|-----------|\n| \"Create incident predictor\" | \u2705 Yes | snow_create_pi_solution + snow_train_pi_solution |\n| \"Create incident predictor\" | \u274C No | neural_train or ml_train_incident_classifier |\n| \"Production ML solution\" | \u2705 Yes | Native PI (always) |\n| \"Production ML solution\" | \u274C No | STOP: Explain PI license required for production |\n| \"Test/experiment with ML\" | Either | Can use local TensorFlow.js tools |\n\n**\uD83D\uDEA8 CRITICAL: ALWAYS ask \"Do you have a ServiceNow Predictive Intelligence license?\" before recommending ML tools!**\n\n**Performance Tracking:**\n```\nperformance_report({ timeframe: '24h' })\ntoken_usage() - Track LLM token usage\n```\n\n---\n\n## \uD83E\uDD16 Multi-Agent Coordination with OpenCode\n\n### Using OpenCode's Native Task System\n\nOpenCode has **built-in multi-agent support** via the `Task()` function:\n\n```\n// Spawn specialized agents for different tasks\nTask(\"widget-creator\", \"Create incident dashboard widget with snow_deploy\");\nTask(\"tester\", \"Test the widget after widget-creator completes\");\nTask(\"documenter\", \"Document the widget after testing passes\");\n```\n\n### Anti-Loop Rules (CRITICAL!)\n**NEVER spawn duplicate agents!** This causes infinite loops:\n\n**\u274C WRONG (Causes infinite loop):**\n```\nTask(\"UI Builder Tools Tester\", \"Test UI Builder\");\nTask(\"UI Builder Tools Tester\", \"Test UI Builder\"); // DUPLICATE!\n```\n\n**\u2705 CORRECT (Unique agents):**\n```\nTask(\"workspace-architect\", \"Create workspace with snow_create_workspace\");\nTask(\"ui-designer\", \"Design UI after workspace-architect completes\");\nTask(\"validator\", \"Validate after ui-designer completes\");\n```\n\n**Rules:**\n1. ONE agent per task type maximum\n2. Use specific, unique agent names\n3. Wait for completion before spawning next\n4. Check Memory for existing work\n\n### Alternative: Use snow-flow MCP Tools\n\nIf you need advanced orchestration, use the `snow-flow` MCP server:\n\n```\n// Initialize swarm\nswarm_init({\n topology: 'hierarchical',\n maxAgents: 8,\n strategy: 'auto'\n});\n\n// Spawn specialized agents\nagent_spawn({\n type: 'widget-creator',\n objective: 'Create incident dashboard',\n capabilities: ['snow_deploy', 'snow_update']\n});\n```\n\n---\n\n## \uD83D\uDEE0 Common Workflows\n\n### Create a Service Portal Widget\n\n```\n1. Use snow_deploy to create widget:\n snow_deploy({\n type: 'widget',\n config: {\n name: 'my_widget',\n title: 'My Widget',\n template: '<div>{{data.message}}</div>',\n server_script: 'data.message = \"Hello\";',\n client_script: 'function($scope) { var c = this; }'\n }\n })\n\n2. Test with snow_preview_widget\n\n3. Update if needed with snow_update\n```\n\n### Debug an Existing Widget\n\n```\n1. Pull to local files:\n snow_pull_artifact({\n sys_id: 'widget_sys_id',\n table: 'sp_widget'\n })\n\n2. Edit locally with OpenCode's native tools\n\n3. Push back:\n snow_push_artifact({ sys_id: 'widget_sys_id' })\n```\n\n### Create Complete Agent Workspace\n\n```\nsnow_create_complete_workspace({\n name: 'IT Support Workspace',\n tables: ['incident', 'task', 'problem'],\n roles: ['itil', 'admin'],\n landing_page: {\n title: 'IT Support Dashboard',\n charts: true,\n list_filters: true\n }\n})\n```\n\n---\n\n## \uD83D\uDD0D Debugging Best Practices\n\n### 1. Verify First, Fix Second\n**ALWAYS test before claiming something is broken:**\n```\n// Test if table exists\nvar gr = new GlideRecord('my_table');\ngs.info('Table valid: ' + gr.isValid());\n\n// Test if property exists\nvar prop = gs.getProperty('my.property');\ngs.info('Property: ' + (prop || 'NOT SET'));\n```\n\n### 2. Use Background Scripts for Verification\n```\nsnow_execute_script_with_output({\n script: \"var gr = new GlideRecord('incident'); gr.query(); gs.info('Count: ' + gr.getRowCount());\",\n description: \"Count incidents\"\n})\n```\n\n**Remember:** All scripts must be **ES5 only**!\n\n### 3. Widget Coherence\nWidgets need perfect communication between:\n- **Server script** \u2192 Sets `data` properties\n- **Client script** \u2192 Implements methods HTML calls\n- **HTML template** \u2192 Uses `data` properties and calls methods\n\n**Check:**\n- [ ] Every `data.property` in server is used in HTML\n- [ ] Every `ng-click` in HTML has matching `$scope.method`\n- [ ] Every `c.server.get({action})` has matching `if(input.action)`\n\n---\n\n## \uD83D\uDCA1 OpenCode-Specific Tips\n\n### LLM Provider Selection\n\n**\uD83C\uDFAF You have FIVE main options:**\n\n#### Option 1: Claude Pro/Max Subscription (RECOMMENDED if you have it)\n```bash\n# \u2B50 Use your EXISTING Claude Pro ($20/month) or Max ($40/month)\n# \u2705 No API key needed - OpenCode logs in with your Anthropic account\n# \u2705 No additional costs beyond your existing subscription\n# \u2705 Same Claude models, same quality, just via OpenCode\n\n# Setup:\nDEFAULT_LLM_PROVIDER=anthropic\nDEFAULT_ANTHROPIC_MODEL=claude-sonnet-4\nANTHROPIC_API_KEY= # Leave empty - OpenCode will prompt login\n```\n\n#### Option 2: Pay-Per-Use API (No subscription)\n```bash\n# Use Anthropic API directly (if no Claude Pro/Max)\nDEFAULT_LLM_PROVIDER=anthropic\nDEFAULT_ANTHROPIC_MODEL=claude-sonnet-4\nANTHROPIC_API_KEY=sk-ant-your-api-key # Get from console.anthropic.com\n\n# Or OpenAI\nDEFAULT_LLM_PROVIDER=openai\nDEFAULT_OPENAI_MODEL=gpt-4o\nOPENAI_API_KEY=sk-your-api-key\n```\n\n#### Option 3: 100% Free with Ollama (Offline, Private)\n```bash\n# Install: https://ollama.com\n# Setup: ollama pull llama3.1 && ollama serve\n\nDEFAULT_LLM_PROVIDER=ollama\nDEFAULT_OLLAMA_MODEL=llama3.1\nOLLAMA_BASE_URL=http://localhost:11434\n# \u2705 FREE \u2022 \u2705 OFFLINE \u2022 \u2705 PRIVATE \u2022 \u2705 No API keys needed\n```\n\n#### Option 4: LM Studio (GUI + Local)\n```bash\n# Download: https://lmstudio.ai\n# Easiest local option with beautiful GUI\n# Supports: Llama 3.2, Mistral, Phi, Gemma, DeepSeek, Qwen 2.5\n\nDEFAULT_LLM_PROVIDER=openai # LM Studio mimics OpenAI API\nOPENAI_BASE_URL=http://localhost:1234/v1\nDEFAULT_OPENAI_MODEL=llama-3.1-8b\n# \u2705 FREE \u2022 \u2705 GUI \u2022 \u2705 No coding needed\n```\n\n#### Option 5: High-Performance Local (vLLM, LocalAI)\n```bash\n# vLLM - 2-4x faster inference\n# Install: pip install vllm\n# Start: python -m vllm.entrypoints.openai.api_server --model llama3.1\n\nDEFAULT_LLM_PROVIDER=openai\nOPENAI_BASE_URL=http://localhost:8000/v1\nDEFAULT_OPENAI_MODEL=llama3.1\n\n# OR LocalAI - Most versatile, supports images + audio\n# Docker: docker run -p 8080:8080 localai/localai\nLOCALAI_BASE_URL=http://localhost:8080/v1\n```\n\n### Quick Decision Guide\n\n**Have Claude Pro/Max?** \u2192 Use Option 1 (no extra cost!)\n**Want best quality?** \u2192 Use Option 2 (Claude Sonnet 4 or GPT-4o API)\n**Want 100% free?** \u2192 Use Option 3 (Ollama) or Option 4 (LM Studio)\n**Want performance?** \u2192 Use Option 5 (vLLM)\n**Want offline/private?** \u2192 Use Option 3, 4, or 5 (all local)\n\n### Instructions Priority\n\nOpenCode loads instructions in this order:\n1. `.opencode/AGENTS.md` (this file)\n2. `AGENTS.md` (root)\n3. `CLAUDE.md` (backward compatibility)\n4. Custom instruction files in `opencode.json`\n\n### Custom Modes\n\nCreate task-specific modes in `.opencode/modes/`:\n- `servicenow-widget.md` - Widget development mode\n- `servicenow-debug.md` - Debugging mode\n- `servicenow-deploy.md` - Deployment mode\n\n---\n\n## \uD83D\uDEA8 Common Mistakes to Avoid\n\n### \u274C Using Modern JavaScript\n```javascript\n// DON'T DO THIS - Will crash ServiceNow!\nconst incidents = await getIncidents();\nconst open = incidents.filter(i => i.state === 'open');\n```\n\n### \u274C Using snow_query_table for Widgets\n```javascript\n// DON'T DO THIS - Hits token limits!\nsnow_query_table({ table: 'sp_widget', sys_id: '...' })\n\n// DO THIS INSTEAD:\nsnow_pull_artifact({ sys_id: '...', table: 'sp_widget' })\n```\n\n### \u274C Spawning Duplicate Agents\n```javascript\n// DON'T DO THIS - Infinite loop!\nTask(\"Tester\", \"Test workspace\");\nTask(\"Tester\", \"Test workspace\"); // DUPLICATE!\n```\n\n---\n\n## \uD83D\uDCDA Resources\n\n- **OpenCode Docs**: https://opencode.ai/docs\n- **Snow-Flow GitHub**: https://github.com/groeimetai/snow-flow\n- **ServiceNow Docs**: https://docs.servicenow.com\n\n---\n\n**Built with OpenCode \u2022 Powered by Multi-LLM \u2022 411 ServiceNow Tools**\n";
2
- //# sourceMappingURL=opencode-agents-template.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"opencode-agents-template.d.ts","sourceRoot":"","sources":["../../src/templates/opencode-agents-template.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,kBAAkB,41aAgd9B,CAAC"}