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.
- package/dist/cli/auth.d.ts.map +1 -1
- package/dist/cli/auth.js +56 -60
- package/dist/cli/auth.js.map +1 -1
- package/dist/utils/snow-oauth.d.ts +10 -5
- package/dist/utils/snow-oauth.d.ts.map +1 -1
- package/dist/utils/snow-oauth.js +223 -86
- package/dist/utils/snow-oauth.js.map +1 -1
- package/package.json +1 -1
- package/THEMES.md +0 -223
- package/dist/mcp/servicenow-mcp-unified/config/tool-definitions.json +0 -3935
- package/dist/mcp/servicenow-mcp-unified/tools/automation/snow_automation_discover.js +0 -164
- package/dist/mcp/servicenow-mcp-unified/tools/deployment/snow_artifact_transfer.js +0 -282
- package/dist/mcp/servicenow-mcp-unified/tools/filters/snow_build_filter.js +0 -171
- package/dist/mcp/servicenow-mcp-unified/tools/formatters/snow_format_value.js +0 -164
- package/dist/mcp/servicenow-mcp-unified/tools/knowledge/index.js.bak +0 -45
- package/dist/mcp/servicenow-mcp-unified/tools/local-sync/snow_artifact_sync.js +0 -172
- package/dist/mcp/servicenow-mcp-unified/tools/system-properties/index.js +0 -36
- package/dist/mcp/servicenow-mcp-unified/tools/ui-builder/snow_discover_uib.js +0 -296
- package/dist/mcp/servicenow-mcp-unified/tools/workspace/snow_create_ux_component.js +0 -292
- package/dist/memory/session-memory.d.ts +0 -80
- package/dist/memory/session-memory.d.ts.map +0 -1
- package/dist/memory/session-memory.js +0 -468
- package/dist/memory/session-memory.js.map +0 -1
- package/dist/templates/opencode-agents-template.d.ts +0 -2
- package/dist/templates/opencode-agents-template.d.ts.map +0 -1
- package/dist/templates/opencode-agents-template.js +0 -469
- package/dist/templates/opencode-agents-template.js.map +0 -1
- package/dist/utils/opencode-output-interceptor.d.ts +0 -40
- package/dist/utils/opencode-output-interceptor.d.ts.map +0 -1
- package/dist/utils/opencode-output-interceptor.js +0 -258
- package/dist/utils/opencode-output-interceptor.js.map +0 -1
- package/scripts/bulk-optimize-tools.js +0 -486
- package/scripts/optimize-mcp-tools.ts +0 -410
- package/themes/README.md +0 -83
- package/themes/servicenow.json +0 -117
|
@@ -1,469 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.AGENTS_MD_TEMPLATE = void 0;
|
|
4
|
-
exports.AGENTS_MD_TEMPLATE = `# Snow-Flow: ServiceNow Development with OpenCode
|
|
5
|
-
|
|
6
|
-
**Multi-LLM ServiceNow Development Platform** • 411 Tools • 2 MCP Servers • Any LLM Provider
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## 🚀 Quick Start
|
|
11
|
-
|
|
12
|
-
You're using **OpenCode** with Snow-Flow's ServiceNow tools. This gives you access to:
|
|
13
|
-
- **235+ ServiceNow tools** via \`servicenow-unified\` MCP server
|
|
14
|
-
- **176+ orchestration tools** via \`snow-flow\` MCP server
|
|
15
|
-
- **Multi-agent coordination** with OpenCode's Task system
|
|
16
|
-
- **Any LLM provider**: Claude, GPT, Gemini, Ollama, etc.
|
|
17
|
-
|
|
18
|
-
### Available Tools
|
|
19
|
-
|
|
20
|
-
Use OpenCode's native commands to explore:
|
|
21
|
-
\`\`\`
|
|
22
|
-
# List all available MCP tools
|
|
23
|
-
> What ServiceNow tools are available?
|
|
24
|
-
|
|
25
|
-
# Get tool details
|
|
26
|
-
> Describe the snow_deploy tool
|
|
27
|
-
|
|
28
|
-
# Use tools directly
|
|
29
|
-
> Use snow_query_table to get open incidents
|
|
30
|
-
\`\`\`
|
|
31
|
-
|
|
32
|
-
---
|
|
33
|
-
|
|
34
|
-
## 🔴 CRITICAL RULES - NO EXCEPTIONS
|
|
35
|
-
|
|
36
|
-
### Rule #1: ES5 ONLY - ServiceNow Rhino Engine
|
|
37
|
-
ServiceNow runs on Mozilla Rhino (ES5 from 2009). Modern JavaScript WILL FAIL!
|
|
38
|
-
|
|
39
|
-
**❌ NEVER USE (WILL CRASH):**
|
|
40
|
-
\`\`\`javascript
|
|
41
|
-
const data = []; // SyntaxError!
|
|
42
|
-
let items = []; // SyntaxError!
|
|
43
|
-
const fn = () => {}; // SyntaxError!
|
|
44
|
-
var msg = \\\`Hello \${name}\\\`; // SyntaxError!
|
|
45
|
-
for (let item of items) {} // SyntaxError!
|
|
46
|
-
var {name, id} = user; // SyntaxError!
|
|
47
|
-
array.map(x => x.id); // SyntaxError!
|
|
48
|
-
\`\`\`
|
|
49
|
-
|
|
50
|
-
**✅ ONLY USE ES5:**
|
|
51
|
-
\`\`\`javascript
|
|
52
|
-
var data = [];
|
|
53
|
-
var items = [];
|
|
54
|
-
function fn() { return 'result'; }
|
|
55
|
-
var msg = 'Hello ' + name;
|
|
56
|
-
for (var i = 0; i < items.length; i++) {
|
|
57
|
-
var item = items[i];
|
|
58
|
-
}
|
|
59
|
-
var name = user.name;
|
|
60
|
-
var id = user.id;
|
|
61
|
-
for (var j = 0; j < array.length; j++) {
|
|
62
|
-
// Process array[j]
|
|
63
|
-
}
|
|
64
|
-
\`\`\`
|
|
65
|
-
|
|
66
|
-
### Rule #2: NO MOCK DATA - EVERYTHING REAL
|
|
67
|
-
**FORBIDDEN:** Mock data, placeholders, TODOs, stub implementations, test values
|
|
68
|
-
**REQUIRED:** Complete, production-ready, fully functional code
|
|
69
|
-
|
|
70
|
-
### Rule #3: Widget Debugging = Local Sync
|
|
71
|
-
**For ANY widget issue, ALWAYS use:**
|
|
72
|
-
\`\`\`
|
|
73
|
-
snow_pull_artifact({ sys_id: 'widget_sys_id' })
|
|
74
|
-
\`\`\`
|
|
75
|
-
Then edit locally with OpenCode's native tools, then push back with \`snow_push_artifact\`.
|
|
76
|
-
|
|
77
|
-
**NEVER use \`snow_query_table\` for widgets!** It hits token limits.
|
|
78
|
-
|
|
79
|
-
---
|
|
80
|
-
|
|
81
|
-
## 📋 MCP Servers (411 Tools Total)
|
|
82
|
-
|
|
83
|
-
### 1. servicenow-unified (235+ tools)
|
|
84
|
-
|
|
85
|
-
**Deployment & Updates:**
|
|
86
|
-
\`\`\`
|
|
87
|
-
snow_deploy - Create NEW artifacts (widgets, flows, scripts)
|
|
88
|
-
snow_update - UPDATE existing artifacts
|
|
89
|
-
snow_validate_deployment - Validate before deploying
|
|
90
|
-
snow_preview_widget - Preview widgets
|
|
91
|
-
\`\`\`
|
|
92
|
-
|
|
93
|
-
**Local Development:**
|
|
94
|
-
\`\`\`
|
|
95
|
-
snow_pull_artifact - Pull ANY artifact to local files
|
|
96
|
-
snow_push_artifact - Push local changes back
|
|
97
|
-
snow_list_local_artifacts - List pulled artifacts
|
|
98
|
-
\`\`\`
|
|
99
|
-
|
|
100
|
-
**CRUD Operations:**
|
|
101
|
-
\`\`\`
|
|
102
|
-
snow_query_table - Query any ServiceNow table
|
|
103
|
-
snow_create_record - Create records
|
|
104
|
-
snow_update_record - Update records
|
|
105
|
-
snow_delete_record - Delete records
|
|
106
|
-
\`\`\`
|
|
107
|
-
|
|
108
|
-
**Automation:**
|
|
109
|
-
\`\`\`
|
|
110
|
-
snow_execute_script_with_output - Run background scripts (ES5 only!)
|
|
111
|
-
snow_create_business_rule - Create business rules
|
|
112
|
-
snow_create_scheduled_job - Schedule jobs
|
|
113
|
-
\`\`\`
|
|
114
|
-
|
|
115
|
-
**UI Builder & Workspaces:**
|
|
116
|
-
\`\`\`
|
|
117
|
-
snow_create_uib_page - Create UI Builder pages
|
|
118
|
-
snow_create_workspace - Create agent workspaces
|
|
119
|
-
snow_create_complete_workspace - Full workspace with landing page
|
|
120
|
-
\`\`\`
|
|
121
|
-
|
|
122
|
-
[... and 200+ more tools]
|
|
123
|
-
|
|
124
|
-
### 2. snow-flow (176+ tools)
|
|
125
|
-
|
|
126
|
-
**Multi-Agent Coordination (Use OpenCode's Task system!):**
|
|
127
|
-
\`\`\`
|
|
128
|
-
swarm_init({ topology: 'hierarchical', maxAgents: 8 })
|
|
129
|
-
agent_spawn({ type: 'widget-creator', objective: '...' })
|
|
130
|
-
\`\`\`
|
|
131
|
-
|
|
132
|
-
**Memory & Context:**
|
|
133
|
-
\`\`\`
|
|
134
|
-
memory_search({ query: 'workspace sys_ids' })
|
|
135
|
-
memory_usage() - Check memory usage
|
|
136
|
-
\`\`\`
|
|
137
|
-
|
|
138
|
-
**🧠 Machine Learning & Predictive Intelligence:**
|
|
139
|
-
|
|
140
|
-
**🚨 TWO COMPLETELY DIFFERENT ML APPROACHES - ASK USER FIRST!**
|
|
141
|
-
|
|
142
|
-
**🏢 Native ServiceNow Predictive Intelligence (NEW! v7.4.0):**
|
|
143
|
-
- Runs INSIDE ServiceNow instance (requires PI license)
|
|
144
|
-
- Production-ready, auto-retrain, enterprise ML
|
|
145
|
-
- **ALWAYS ASK:** "Do you have a ServiceNow Predictive Intelligence license?"
|
|
146
|
-
|
|
147
|
-
\`\`\`
|
|
148
|
-
# Native PI Tools (Production):
|
|
149
|
-
snow_create_pi_solution({ name, table, output_field, solution_type })
|
|
150
|
-
snow_train_pi_solution({ solution_id }) - Trains in ServiceNow (10-30 min)
|
|
151
|
-
snow_monitor_pi_training({ solution_id }) - Monitor progress/accuracy
|
|
152
|
-
snow_activate_pi_solution({ solution_id }) - Activate for production
|
|
153
|
-
snow_list_pi_solutions() - List all PI solutions
|
|
154
|
-
ml_predictive_intelligence({ solution_id, record_id }) - Make predictions
|
|
155
|
-
\`\`\`
|
|
156
|
-
|
|
157
|
-
**💻 Local TensorFlow.js ML (Experimental, FREE):**
|
|
158
|
-
- Runs locally on dev machine (no ServiceNow license required)
|
|
159
|
-
- Development/testing only, NOT for production
|
|
160
|
-
|
|
161
|
-
\`\`\`
|
|
162
|
-
# Local ML Tools (Dev/Testing Only):
|
|
163
|
-
neural_train({ type: 'incident_classifier', dataset: [...] })
|
|
164
|
-
neural_patterns() - Get learned patterns
|
|
165
|
-
ml_train_incident_classifier() - Train LSTM locally
|
|
166
|
-
ml_predict_change_risk() - Local risk prediction
|
|
167
|
-
ml_detect_anomalies() - Local anomaly detection
|
|
168
|
-
\`\`\`
|
|
169
|
-
|
|
170
|
-
**📋 ML Decision Matrix for Agents:**
|
|
171
|
-
| User Request | Has PI License? | Recommend |
|
|
172
|
-
|--------------|----------------|-----------|
|
|
173
|
-
| "Create incident predictor" | ✅ Yes | snow_create_pi_solution + snow_train_pi_solution |
|
|
174
|
-
| "Create incident predictor" | ❌ No | neural_train or ml_train_incident_classifier |
|
|
175
|
-
| "Production ML solution" | ✅ Yes | Native PI (always) |
|
|
176
|
-
| "Production ML solution" | ❌ No | STOP: Explain PI license required for production |
|
|
177
|
-
| "Test/experiment with ML" | Either | Can use local TensorFlow.js tools |
|
|
178
|
-
|
|
179
|
-
**🚨 CRITICAL: ALWAYS ask "Do you have a ServiceNow Predictive Intelligence license?" before recommending ML tools!**
|
|
180
|
-
|
|
181
|
-
**Performance Tracking:**
|
|
182
|
-
\`\`\`
|
|
183
|
-
performance_report({ timeframe: '24h' })
|
|
184
|
-
token_usage() - Track LLM token usage
|
|
185
|
-
\`\`\`
|
|
186
|
-
|
|
187
|
-
---
|
|
188
|
-
|
|
189
|
-
## 🤖 Multi-Agent Coordination with OpenCode
|
|
190
|
-
|
|
191
|
-
### Using OpenCode's Native Task System
|
|
192
|
-
|
|
193
|
-
OpenCode has **built-in multi-agent support** via the \`Task()\` function:
|
|
194
|
-
|
|
195
|
-
\`\`\`
|
|
196
|
-
// Spawn specialized agents for different tasks
|
|
197
|
-
Task("widget-creator", "Create incident dashboard widget with snow_deploy");
|
|
198
|
-
Task("tester", "Test the widget after widget-creator completes");
|
|
199
|
-
Task("documenter", "Document the widget after testing passes");
|
|
200
|
-
\`\`\`
|
|
201
|
-
|
|
202
|
-
### Anti-Loop Rules (CRITICAL!)
|
|
203
|
-
**NEVER spawn duplicate agents!** This causes infinite loops:
|
|
204
|
-
|
|
205
|
-
**❌ WRONG (Causes infinite loop):**
|
|
206
|
-
\`\`\`
|
|
207
|
-
Task("UI Builder Tools Tester", "Test UI Builder");
|
|
208
|
-
Task("UI Builder Tools Tester", "Test UI Builder"); // DUPLICATE!
|
|
209
|
-
\`\`\`
|
|
210
|
-
|
|
211
|
-
**✅ CORRECT (Unique agents):**
|
|
212
|
-
\`\`\`
|
|
213
|
-
Task("workspace-architect", "Create workspace with snow_create_workspace");
|
|
214
|
-
Task("ui-designer", "Design UI after workspace-architect completes");
|
|
215
|
-
Task("validator", "Validate after ui-designer completes");
|
|
216
|
-
\`\`\`
|
|
217
|
-
|
|
218
|
-
**Rules:**
|
|
219
|
-
1. ONE agent per task type maximum
|
|
220
|
-
2. Use specific, unique agent names
|
|
221
|
-
3. Wait for completion before spawning next
|
|
222
|
-
4. Check Memory for existing work
|
|
223
|
-
|
|
224
|
-
### Alternative: Use snow-flow MCP Tools
|
|
225
|
-
|
|
226
|
-
If you need advanced orchestration, use the \`snow-flow\` MCP server:
|
|
227
|
-
|
|
228
|
-
\`\`\`
|
|
229
|
-
// Initialize swarm
|
|
230
|
-
swarm_init({
|
|
231
|
-
topology: 'hierarchical',
|
|
232
|
-
maxAgents: 8,
|
|
233
|
-
strategy: 'auto'
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
// Spawn specialized agents
|
|
237
|
-
agent_spawn({
|
|
238
|
-
type: 'widget-creator',
|
|
239
|
-
objective: 'Create incident dashboard',
|
|
240
|
-
capabilities: ['snow_deploy', 'snow_update']
|
|
241
|
-
});
|
|
242
|
-
\`\`\`
|
|
243
|
-
|
|
244
|
-
---
|
|
245
|
-
|
|
246
|
-
## 🛠 Common Workflows
|
|
247
|
-
|
|
248
|
-
### Create a Service Portal Widget
|
|
249
|
-
|
|
250
|
-
\`\`\`
|
|
251
|
-
1. Use snow_deploy to create widget:
|
|
252
|
-
snow_deploy({
|
|
253
|
-
type: 'widget',
|
|
254
|
-
config: {
|
|
255
|
-
name: 'my_widget',
|
|
256
|
-
title: 'My Widget',
|
|
257
|
-
template: '<div>{{data.message}}</div>',
|
|
258
|
-
server_script: 'data.message = "Hello";',
|
|
259
|
-
client_script: 'function($scope) { var c = this; }'
|
|
260
|
-
}
|
|
261
|
-
})
|
|
262
|
-
|
|
263
|
-
2. Test with snow_preview_widget
|
|
264
|
-
|
|
265
|
-
3. Update if needed with snow_update
|
|
266
|
-
\`\`\`
|
|
267
|
-
|
|
268
|
-
### Debug an Existing Widget
|
|
269
|
-
|
|
270
|
-
\`\`\`
|
|
271
|
-
1. Pull to local files:
|
|
272
|
-
snow_pull_artifact({
|
|
273
|
-
sys_id: 'widget_sys_id',
|
|
274
|
-
table: 'sp_widget'
|
|
275
|
-
})
|
|
276
|
-
|
|
277
|
-
2. Edit locally with OpenCode's native tools
|
|
278
|
-
|
|
279
|
-
3. Push back:
|
|
280
|
-
snow_push_artifact({ sys_id: 'widget_sys_id' })
|
|
281
|
-
\`\`\`
|
|
282
|
-
|
|
283
|
-
### Create Complete Agent Workspace
|
|
284
|
-
|
|
285
|
-
\`\`\`
|
|
286
|
-
snow_create_complete_workspace({
|
|
287
|
-
name: 'IT Support Workspace',
|
|
288
|
-
tables: ['incident', 'task', 'problem'],
|
|
289
|
-
roles: ['itil', 'admin'],
|
|
290
|
-
landing_page: {
|
|
291
|
-
title: 'IT Support Dashboard',
|
|
292
|
-
charts: true,
|
|
293
|
-
list_filters: true
|
|
294
|
-
}
|
|
295
|
-
})
|
|
296
|
-
\`\`\`
|
|
297
|
-
|
|
298
|
-
---
|
|
299
|
-
|
|
300
|
-
## 🔍 Debugging Best Practices
|
|
301
|
-
|
|
302
|
-
### 1. Verify First, Fix Second
|
|
303
|
-
**ALWAYS test before claiming something is broken:**
|
|
304
|
-
\`\`\`
|
|
305
|
-
// Test if table exists
|
|
306
|
-
var gr = new GlideRecord('my_table');
|
|
307
|
-
gs.info('Table valid: ' + gr.isValid());
|
|
308
|
-
|
|
309
|
-
// Test if property exists
|
|
310
|
-
var prop = gs.getProperty('my.property');
|
|
311
|
-
gs.info('Property: ' + (prop || 'NOT SET'));
|
|
312
|
-
\`\`\`
|
|
313
|
-
|
|
314
|
-
### 2. Use Background Scripts for Verification
|
|
315
|
-
\`\`\`
|
|
316
|
-
snow_execute_script_with_output({
|
|
317
|
-
script: "var gr = new GlideRecord('incident'); gr.query(); gs.info('Count: ' + gr.getRowCount());",
|
|
318
|
-
description: "Count incidents"
|
|
319
|
-
})
|
|
320
|
-
\`\`\`
|
|
321
|
-
|
|
322
|
-
**Remember:** All scripts must be **ES5 only**!
|
|
323
|
-
|
|
324
|
-
### 3. Widget Coherence
|
|
325
|
-
Widgets need perfect communication between:
|
|
326
|
-
- **Server script** → Sets \`data\` properties
|
|
327
|
-
- **Client script** → Implements methods HTML calls
|
|
328
|
-
- **HTML template** → Uses \`data\` properties and calls methods
|
|
329
|
-
|
|
330
|
-
**Check:**
|
|
331
|
-
- [ ] Every \`data.property\` in server is used in HTML
|
|
332
|
-
- [ ] Every \`ng-click\` in HTML has matching \`$scope.method\`
|
|
333
|
-
- [ ] Every \`c.server.get({action})\` has matching \`if(input.action)\`
|
|
334
|
-
|
|
335
|
-
---
|
|
336
|
-
|
|
337
|
-
## 💡 OpenCode-Specific Tips
|
|
338
|
-
|
|
339
|
-
### LLM Provider Selection
|
|
340
|
-
|
|
341
|
-
**🎯 You have FIVE main options:**
|
|
342
|
-
|
|
343
|
-
#### Option 1: Claude Pro/Max Subscription (RECOMMENDED if you have it)
|
|
344
|
-
\`\`\`bash
|
|
345
|
-
# ⭐ Use your EXISTING Claude Pro ($20/month) or Max ($40/month)
|
|
346
|
-
# ✅ No API key needed - OpenCode logs in with your Anthropic account
|
|
347
|
-
# ✅ No additional costs beyond your existing subscription
|
|
348
|
-
# ✅ Same Claude models, same quality, just via OpenCode
|
|
349
|
-
|
|
350
|
-
# Setup:
|
|
351
|
-
DEFAULT_LLM_PROVIDER=anthropic
|
|
352
|
-
DEFAULT_ANTHROPIC_MODEL=claude-sonnet-4
|
|
353
|
-
ANTHROPIC_API_KEY= # Leave empty - OpenCode will prompt login
|
|
354
|
-
\`\`\`
|
|
355
|
-
|
|
356
|
-
#### Option 2: Pay-Per-Use API (No subscription)
|
|
357
|
-
\`\`\`bash
|
|
358
|
-
# Use Anthropic API directly (if no Claude Pro/Max)
|
|
359
|
-
DEFAULT_LLM_PROVIDER=anthropic
|
|
360
|
-
DEFAULT_ANTHROPIC_MODEL=claude-sonnet-4
|
|
361
|
-
ANTHROPIC_API_KEY=sk-ant-your-api-key # Get from console.anthropic.com
|
|
362
|
-
|
|
363
|
-
# Or OpenAI
|
|
364
|
-
DEFAULT_LLM_PROVIDER=openai
|
|
365
|
-
DEFAULT_OPENAI_MODEL=gpt-4o
|
|
366
|
-
OPENAI_API_KEY=sk-your-api-key
|
|
367
|
-
\`\`\`
|
|
368
|
-
|
|
369
|
-
#### Option 3: 100% Free with Ollama (Offline, Private)
|
|
370
|
-
\`\`\`bash
|
|
371
|
-
# Install: https://ollama.com
|
|
372
|
-
# Setup: ollama pull llama3.1 && ollama serve
|
|
373
|
-
|
|
374
|
-
DEFAULT_LLM_PROVIDER=ollama
|
|
375
|
-
DEFAULT_OLLAMA_MODEL=llama3.1
|
|
376
|
-
OLLAMA_BASE_URL=http://localhost:11434
|
|
377
|
-
# ✅ FREE • ✅ OFFLINE • ✅ PRIVATE • ✅ No API keys needed
|
|
378
|
-
\`\`\`
|
|
379
|
-
|
|
380
|
-
#### Option 4: LM Studio (GUI + Local)
|
|
381
|
-
\`\`\`bash
|
|
382
|
-
# Download: https://lmstudio.ai
|
|
383
|
-
# Easiest local option with beautiful GUI
|
|
384
|
-
# Supports: Llama 3.2, Mistral, Phi, Gemma, DeepSeek, Qwen 2.5
|
|
385
|
-
|
|
386
|
-
DEFAULT_LLM_PROVIDER=openai # LM Studio mimics OpenAI API
|
|
387
|
-
OPENAI_BASE_URL=http://localhost:1234/v1
|
|
388
|
-
DEFAULT_OPENAI_MODEL=llama-3.1-8b
|
|
389
|
-
# ✅ FREE • ✅ GUI • ✅ No coding needed
|
|
390
|
-
\`\`\`
|
|
391
|
-
|
|
392
|
-
#### Option 5: High-Performance Local (vLLM, LocalAI)
|
|
393
|
-
\`\`\`bash
|
|
394
|
-
# vLLM - 2-4x faster inference
|
|
395
|
-
# Install: pip install vllm
|
|
396
|
-
# Start: python -m vllm.entrypoints.openai.api_server --model llama3.1
|
|
397
|
-
|
|
398
|
-
DEFAULT_LLM_PROVIDER=openai
|
|
399
|
-
OPENAI_BASE_URL=http://localhost:8000/v1
|
|
400
|
-
DEFAULT_OPENAI_MODEL=llama3.1
|
|
401
|
-
|
|
402
|
-
# OR LocalAI - Most versatile, supports images + audio
|
|
403
|
-
# Docker: docker run -p 8080:8080 localai/localai
|
|
404
|
-
LOCALAI_BASE_URL=http://localhost:8080/v1
|
|
405
|
-
\`\`\`
|
|
406
|
-
|
|
407
|
-
### Quick Decision Guide
|
|
408
|
-
|
|
409
|
-
**Have Claude Pro/Max?** → Use Option 1 (no extra cost!)
|
|
410
|
-
**Want best quality?** → Use Option 2 (Claude Sonnet 4 or GPT-4o API)
|
|
411
|
-
**Want 100% free?** → Use Option 3 (Ollama) or Option 4 (LM Studio)
|
|
412
|
-
**Want performance?** → Use Option 5 (vLLM)
|
|
413
|
-
**Want offline/private?** → Use Option 3, 4, or 5 (all local)
|
|
414
|
-
|
|
415
|
-
### Instructions Priority
|
|
416
|
-
|
|
417
|
-
OpenCode loads instructions in this order:
|
|
418
|
-
1. \`.opencode/AGENTS.md\` (this file)
|
|
419
|
-
2. \`AGENTS.md\` (root)
|
|
420
|
-
3. \`CLAUDE.md\` (backward compatibility)
|
|
421
|
-
4. Custom instruction files in \`opencode.json\`
|
|
422
|
-
|
|
423
|
-
### Custom Modes
|
|
424
|
-
|
|
425
|
-
Create task-specific modes in \`.opencode/modes/\`:
|
|
426
|
-
- \`servicenow-widget.md\` - Widget development mode
|
|
427
|
-
- \`servicenow-debug.md\` - Debugging mode
|
|
428
|
-
- \`servicenow-deploy.md\` - Deployment mode
|
|
429
|
-
|
|
430
|
-
---
|
|
431
|
-
|
|
432
|
-
## 🚨 Common Mistakes to Avoid
|
|
433
|
-
|
|
434
|
-
### ❌ Using Modern JavaScript
|
|
435
|
-
\`\`\`javascript
|
|
436
|
-
// DON'T DO THIS - Will crash ServiceNow!
|
|
437
|
-
const incidents = await getIncidents();
|
|
438
|
-
const open = incidents.filter(i => i.state === 'open');
|
|
439
|
-
\`\`\`
|
|
440
|
-
|
|
441
|
-
### ❌ Using snow_query_table for Widgets
|
|
442
|
-
\`\`\`javascript
|
|
443
|
-
// DON'T DO THIS - Hits token limits!
|
|
444
|
-
snow_query_table({ table: 'sp_widget', sys_id: '...' })
|
|
445
|
-
|
|
446
|
-
// DO THIS INSTEAD:
|
|
447
|
-
snow_pull_artifact({ sys_id: '...', table: 'sp_widget' })
|
|
448
|
-
\`\`\`
|
|
449
|
-
|
|
450
|
-
### ❌ Spawning Duplicate Agents
|
|
451
|
-
\`\`\`javascript
|
|
452
|
-
// DON'T DO THIS - Infinite loop!
|
|
453
|
-
Task("Tester", "Test workspace");
|
|
454
|
-
Task("Tester", "Test workspace"); // DUPLICATE!
|
|
455
|
-
\`\`\`
|
|
456
|
-
|
|
457
|
-
---
|
|
458
|
-
|
|
459
|
-
## 📚 Resources
|
|
460
|
-
|
|
461
|
-
- **OpenCode Docs**: https://opencode.ai/docs
|
|
462
|
-
- **Snow-Flow GitHub**: https://github.com/groeimetai/snow-flow
|
|
463
|
-
- **ServiceNow Docs**: https://docs.servicenow.com
|
|
464
|
-
|
|
465
|
-
---
|
|
466
|
-
|
|
467
|
-
**Built with OpenCode • Powered by Multi-LLM • 411 ServiceNow Tools**
|
|
468
|
-
`;
|
|
469
|
-
//# sourceMappingURL=opencode-agents-template.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opencode-agents-template.js","sourceRoot":"","sources":["../../src/templates/opencode-agents-template.ts"],"names":[],"mappings":";;;AAAa,QAAA,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAgdjC,CAAC"}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* OpenCode Output Interceptor
|
|
3
|
-
* Captures and reformats OpenCode's output to show beautiful MCP tool execution
|
|
4
|
-
*
|
|
5
|
-
* Detects patterns like:
|
|
6
|
-
* - Shell Create incident dashboard via MCP server
|
|
7
|
-
* - MCP tool execution scripts
|
|
8
|
-
* - JSON-RPC messages
|
|
9
|
-
*
|
|
10
|
-
* And reformats them using MCPOutputFormatter for clean, structured display
|
|
11
|
-
*/
|
|
12
|
-
import { Transform } from 'stream';
|
|
13
|
-
export declare class OpenCodeOutputInterceptor extends Transform {
|
|
14
|
-
private formatter;
|
|
15
|
-
private buffer;
|
|
16
|
-
private inShellBlock;
|
|
17
|
-
private inMCPExecution;
|
|
18
|
-
private currentExecution?;
|
|
19
|
-
private shellBlockLines;
|
|
20
|
-
private quiet;
|
|
21
|
-
constructor(options?: {
|
|
22
|
-
quiet?: boolean;
|
|
23
|
-
});
|
|
24
|
-
_transform(chunk: Buffer, encoding: string, callback: Function): void;
|
|
25
|
-
_flush(callback: Function): void;
|
|
26
|
-
private processLine;
|
|
27
|
-
private startMCPExecution;
|
|
28
|
-
private handleShellBlock;
|
|
29
|
-
private extractMCPToolCall;
|
|
30
|
-
private tryParseJSONRPC;
|
|
31
|
-
private handleMCPSuccess;
|
|
32
|
-
private handleMCPError;
|
|
33
|
-
}
|
|
34
|
-
/**
|
|
35
|
-
* Convenience function to pipe OpenCode output through the interceptor
|
|
36
|
-
*/
|
|
37
|
-
export declare function interceptOpenCodeOutput(options?: {
|
|
38
|
-
quiet?: boolean;
|
|
39
|
-
}): OpenCodeOutputInterceptor;
|
|
40
|
-
//# sourceMappingURL=opencode-output-interceptor.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"opencode-output-interceptor.d.ts","sourceRoot":"","sources":["../../src/utils/opencode-output-interceptor.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AAYnC,qBAAa,yBAA0B,SAAQ,SAAS;IACtD,OAAO,CAAC,SAAS,CAAqB;IACtC,OAAO,CAAC,MAAM,CAAc;IAC5B,OAAO,CAAC,YAAY,CAAkB;IACtC,OAAO,CAAC,cAAc,CAAkB;IACxC,OAAO,CAAC,gBAAgB,CAAC,CAAmB;IAC5C,OAAO,CAAC,eAAe,CAAgB;IACvC,OAAO,CAAC,KAAK,CAAU;gBAEX,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;IAMzC,UAAU,CAAC,KAAK,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ;IAe9D,MAAM,CAAC,QAAQ,EAAE,QAAQ;IAQzB,OAAO,CAAC,WAAW;IA8DnB,OAAO,CAAC,iBAAiB;IAiBzB,OAAO,CAAC,gBAAgB;IAmDxB,OAAO,CAAC,kBAAkB;IAkB1B,OAAO,CAAC,eAAe;IAwBvB,OAAO,CAAC,gBAAgB;IAsCxB,OAAO,CAAC,cAAc;CA0BvB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CAAC,OAAO,CAAC,EAAE;IAAE,KAAK,CAAC,EAAE,OAAO,CAAA;CAAE,GAAG,yBAAyB,CAEhG"}
|