snow-flow 3.4.39 → 3.5.0
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 +11 -9
- package/dist/index.d.ts +4 -0
- package/dist/index.js +10 -2
- package/dist/mcp/enhancements/smart-query-enhancement.d.ts +49 -0
- package/dist/mcp/enhancements/smart-query-enhancement.js +233 -0
- package/dist/mcp/servicenow-local-development-mcp.d.ts +48 -0
- package/dist/mcp/servicenow-local-development-mcp.js +570 -0
- package/dist/queen/queen-knowledge-base.d.ts +151 -0
- package/dist/queen/queen-knowledge-base.js +283 -0
- package/dist/queen/servicenow-queen.d.ts +2 -0
- package/dist/queen/servicenow-queen.js +91 -0
- package/dist/utils/artifact-local-sync.d.ts +115 -0
- package/dist/utils/artifact-local-sync.js +705 -0
- package/dist/utils/artifact-sync/artifact-registry.d.ts +66 -0
- package/dist/utils/artifact-sync/artifact-registry.js +450 -0
- package/dist/utils/artifact-sync/index.d.ts +33 -0
- package/dist/utils/artifact-sync/index.js +52 -0
- package/dist/utils/mcp-tool-registry.js +109 -0
- package/dist/utils/smart-field-fetcher.d.ts +68 -0
- package/dist/utils/smart-field-fetcher.js +395 -0
- package/package.json +2 -2
- package/website/.dockerignore +64 -0
- package/website/Dockerfile +36 -0
- package/website/README.md +40 -1
- package/website/cloudbuild.yaml +69 -0
- package/website/css/style.css +119 -1
- package/website/index.html +385 -39
- package/website/js/main.js +26 -1
- package/website/nginx.conf +116 -0
- package/website/service.yaml +61 -0
|
@@ -0,0 +1,151 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Queen Agent Knowledge Base
|
|
3
|
+
*
|
|
4
|
+
* Central repository of ServiceNow development patterns, tools, and capabilities
|
|
5
|
+
* that the Queen Agent uses for strategic decision making.
|
|
6
|
+
*/
|
|
7
|
+
export declare const QUEEN_KNOWLEDGE_BASE: {
|
|
8
|
+
/**
|
|
9
|
+
* ServiceNow Development Patterns
|
|
10
|
+
*/
|
|
11
|
+
developmentPatterns: {
|
|
12
|
+
widgetDevelopment: {
|
|
13
|
+
description: string;
|
|
14
|
+
approaches: {
|
|
15
|
+
name: string;
|
|
16
|
+
description: string;
|
|
17
|
+
optimal_for: string[];
|
|
18
|
+
workflow: string[];
|
|
19
|
+
advantages: string[];
|
|
20
|
+
}[];
|
|
21
|
+
};
|
|
22
|
+
scriptDevelopment: {
|
|
23
|
+
description: string;
|
|
24
|
+
approaches: {
|
|
25
|
+
name: string;
|
|
26
|
+
description: string;
|
|
27
|
+
optimal_for: string[];
|
|
28
|
+
workflow: string[];
|
|
29
|
+
advantages: string[];
|
|
30
|
+
}[];
|
|
31
|
+
};
|
|
32
|
+
flowDevelopment: {
|
|
33
|
+
description: string;
|
|
34
|
+
approaches: {
|
|
35
|
+
name: string;
|
|
36
|
+
description: string;
|
|
37
|
+
optimal_for: string[];
|
|
38
|
+
workflow: string[];
|
|
39
|
+
limitations: string[];
|
|
40
|
+
}[];
|
|
41
|
+
};
|
|
42
|
+
};
|
|
43
|
+
/**
|
|
44
|
+
* Tool Selection Criteria
|
|
45
|
+
*/
|
|
46
|
+
toolSelectionCriteria: {
|
|
47
|
+
useLocalSync: {
|
|
48
|
+
when: string[];
|
|
49
|
+
artifacts: string[];
|
|
50
|
+
};
|
|
51
|
+
useDirectDeployment: {
|
|
52
|
+
when: string[];
|
|
53
|
+
};
|
|
54
|
+
useDirectUpdate: {
|
|
55
|
+
when: string[];
|
|
56
|
+
};
|
|
57
|
+
};
|
|
58
|
+
/**
|
|
59
|
+
* Artifact Type Capabilities
|
|
60
|
+
*/
|
|
61
|
+
artifactCapabilities: {
|
|
62
|
+
sp_widget: {
|
|
63
|
+
localSync: boolean;
|
|
64
|
+
directDeploy: boolean;
|
|
65
|
+
directUpdate: boolean;
|
|
66
|
+
coherenceValidation: boolean;
|
|
67
|
+
es5Required: string[];
|
|
68
|
+
fields: string[];
|
|
69
|
+
};
|
|
70
|
+
sys_script_include: {
|
|
71
|
+
localSync: boolean;
|
|
72
|
+
directDeploy: boolean;
|
|
73
|
+
directUpdate: boolean;
|
|
74
|
+
es5Required: string[];
|
|
75
|
+
fields: string[];
|
|
76
|
+
};
|
|
77
|
+
sys_script: {
|
|
78
|
+
localSync: boolean;
|
|
79
|
+
directDeploy: boolean;
|
|
80
|
+
directUpdate: boolean;
|
|
81
|
+
es5Required: string[];
|
|
82
|
+
fields: string[];
|
|
83
|
+
};
|
|
84
|
+
sys_hub_flow: {
|
|
85
|
+
localSync: boolean;
|
|
86
|
+
directDeploy: boolean;
|
|
87
|
+
directUpdate: boolean;
|
|
88
|
+
fields: string[];
|
|
89
|
+
};
|
|
90
|
+
sys_ui_page: {
|
|
91
|
+
localSync: boolean;
|
|
92
|
+
directDeploy: boolean;
|
|
93
|
+
directUpdate: boolean;
|
|
94
|
+
es5Required: string[];
|
|
95
|
+
fields: string[];
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* Strategic Recommendations
|
|
100
|
+
*/
|
|
101
|
+
strategicRecommendations: {
|
|
102
|
+
complexWidgetEdit: {
|
|
103
|
+
pattern: string;
|
|
104
|
+
reasoning: string;
|
|
105
|
+
steps: string[];
|
|
106
|
+
};
|
|
107
|
+
bulkRefactoring: {
|
|
108
|
+
pattern: string;
|
|
109
|
+
reasoning: string;
|
|
110
|
+
steps: string[];
|
|
111
|
+
};
|
|
112
|
+
quickPrototype: {
|
|
113
|
+
pattern: string;
|
|
114
|
+
reasoning: string;
|
|
115
|
+
steps: string[];
|
|
116
|
+
};
|
|
117
|
+
};
|
|
118
|
+
/**
|
|
119
|
+
* Common Pitfalls to Avoid
|
|
120
|
+
*/
|
|
121
|
+
pitfallsToAvoid: {
|
|
122
|
+
pitfall: string;
|
|
123
|
+
solution: string;
|
|
124
|
+
}[];
|
|
125
|
+
/**
|
|
126
|
+
* MCP Server Mapping
|
|
127
|
+
*/
|
|
128
|
+
mcpServerMapping: {
|
|
129
|
+
snow_pull_artifact: string;
|
|
130
|
+
snow_push_artifact: string;
|
|
131
|
+
snow_validate_artifact_coherence: string;
|
|
132
|
+
snow_list_supported_artifacts: string;
|
|
133
|
+
snow_sync_status: string;
|
|
134
|
+
snow_sync_cleanup: string;
|
|
135
|
+
snow_convert_to_es5: string;
|
|
136
|
+
snow_deploy: string;
|
|
137
|
+
snow_update: string;
|
|
138
|
+
snow_query_table: string;
|
|
139
|
+
snow_create_script_include: string;
|
|
140
|
+
};
|
|
141
|
+
};
|
|
142
|
+
/**
|
|
143
|
+
* Helper function for Queen to determine optimal approach
|
|
144
|
+
*/
|
|
145
|
+
export declare function determineOptimalApproach(objective: string, artifactType: string, context: {
|
|
146
|
+
hasExistingArtifact: boolean;
|
|
147
|
+
complexity: 'low' | 'medium' | 'high';
|
|
148
|
+
requiresRefactoring: boolean;
|
|
149
|
+
userMentionedModifications: boolean;
|
|
150
|
+
}): string;
|
|
151
|
+
//# sourceMappingURL=queen-knowledge-base.d.ts.map
|
|
@@ -0,0 +1,283 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
/**
|
|
3
|
+
* Queen Agent Knowledge Base
|
|
4
|
+
*
|
|
5
|
+
* Central repository of ServiceNow development patterns, tools, and capabilities
|
|
6
|
+
* that the Queen Agent uses for strategic decision making.
|
|
7
|
+
*/
|
|
8
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
|
+
exports.QUEEN_KNOWLEDGE_BASE = void 0;
|
|
10
|
+
exports.determineOptimalApproach = determineOptimalApproach;
|
|
11
|
+
exports.QUEEN_KNOWLEDGE_BASE = {
|
|
12
|
+
/**
|
|
13
|
+
* ServiceNow Development Patterns
|
|
14
|
+
*/
|
|
15
|
+
developmentPatterns: {
|
|
16
|
+
widgetDevelopment: {
|
|
17
|
+
description: 'Service Portal Widget Development',
|
|
18
|
+
approaches: [
|
|
19
|
+
{
|
|
20
|
+
name: 'Local Sync Development',
|
|
21
|
+
description: 'Pull widget to local files, edit with Claude Code, push back',
|
|
22
|
+
optimal_for: ['complex widgets', 'multi-file editing', 'refactoring', 'bulk changes'],
|
|
23
|
+
workflow: [
|
|
24
|
+
'snow_pull_artifact({ sys_id, table: "sp_widget" })',
|
|
25
|
+
'Edit with Claude Code native tools',
|
|
26
|
+
'snow_validate_artifact_coherence({ sys_id })',
|
|
27
|
+
'snow_push_artifact({ sys_id })'
|
|
28
|
+
],
|
|
29
|
+
advantages: [
|
|
30
|
+
'Full IDE capabilities',
|
|
31
|
+
'Multi-file search and replace',
|
|
32
|
+
'Git integration possible',
|
|
33
|
+
'Offline development',
|
|
34
|
+
'Advanced refactoring'
|
|
35
|
+
]
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
name: 'Direct Deployment',
|
|
39
|
+
description: 'Deploy widget directly to ServiceNow',
|
|
40
|
+
optimal_for: ['new widgets', 'simple widgets', 'quick prototypes'],
|
|
41
|
+
workflow: [
|
|
42
|
+
'snow_deploy({ type: "widget", config: {...} })'
|
|
43
|
+
],
|
|
44
|
+
advantages: [
|
|
45
|
+
'Fast deployment',
|
|
46
|
+
'No local files needed',
|
|
47
|
+
'Immediate availability'
|
|
48
|
+
]
|
|
49
|
+
},
|
|
50
|
+
{
|
|
51
|
+
name: 'Direct Update',
|
|
52
|
+
description: 'Update existing widget fields directly',
|
|
53
|
+
optimal_for: ['small changes', 'field updates', 'quick fixes'],
|
|
54
|
+
workflow: [
|
|
55
|
+
'snow_update({ type: "widget", identifier, config: {...} })'
|
|
56
|
+
],
|
|
57
|
+
advantages: [
|
|
58
|
+
'Minimal overhead',
|
|
59
|
+
'Targeted updates',
|
|
60
|
+
'Fast iteration'
|
|
61
|
+
]
|
|
62
|
+
}
|
|
63
|
+
]
|
|
64
|
+
},
|
|
65
|
+
scriptDevelopment: {
|
|
66
|
+
description: 'Script Include and Business Rule Development',
|
|
67
|
+
approaches: [
|
|
68
|
+
{
|
|
69
|
+
name: 'Local Sync Development',
|
|
70
|
+
description: 'Pull script to local file, edit, validate ES5, push back',
|
|
71
|
+
optimal_for: ['complex scripts', 'refactoring', 'bulk operations'],
|
|
72
|
+
workflow: [
|
|
73
|
+
'snow_pull_artifact({ sys_id, table: "sys_script_include" })',
|
|
74
|
+
'Edit with full IDE support',
|
|
75
|
+
'Validate ES5 compliance',
|
|
76
|
+
'snow_push_artifact({ sys_id })'
|
|
77
|
+
],
|
|
78
|
+
advantages: [
|
|
79
|
+
'ES5 validation',
|
|
80
|
+
'Syntax highlighting',
|
|
81
|
+
'Code completion',
|
|
82
|
+
'Search across scripts'
|
|
83
|
+
]
|
|
84
|
+
}
|
|
85
|
+
]
|
|
86
|
+
},
|
|
87
|
+
flowDevelopment: {
|
|
88
|
+
description: 'Flow Designer Development',
|
|
89
|
+
approaches: [
|
|
90
|
+
{
|
|
91
|
+
name: 'Local Sync for Analysis',
|
|
92
|
+
description: 'Pull flow definition for analysis and documentation',
|
|
93
|
+
optimal_for: ['flow analysis', 'documentation', 'debugging'],
|
|
94
|
+
workflow: [
|
|
95
|
+
'snow_pull_artifact({ sys_id, table: "sys_hub_flow" })',
|
|
96
|
+
'Analyze JSON structure',
|
|
97
|
+
'Document flow logic'
|
|
98
|
+
],
|
|
99
|
+
limitations: [
|
|
100
|
+
'Flow creation must be done in ServiceNow UI',
|
|
101
|
+
'Cannot programmatically create flows'
|
|
102
|
+
]
|
|
103
|
+
}
|
|
104
|
+
]
|
|
105
|
+
}
|
|
106
|
+
},
|
|
107
|
+
/**
|
|
108
|
+
* Tool Selection Criteria
|
|
109
|
+
*/
|
|
110
|
+
toolSelectionCriteria: {
|
|
111
|
+
useLocalSync: {
|
|
112
|
+
when: [
|
|
113
|
+
'User requests editing existing artifact',
|
|
114
|
+
'Complex multi-file changes needed',
|
|
115
|
+
'Refactoring required',
|
|
116
|
+
'Bulk search/replace operations',
|
|
117
|
+
'User wants to use Claude Code native tools',
|
|
118
|
+
'Need offline development capability'
|
|
119
|
+
],
|
|
120
|
+
artifacts: [
|
|
121
|
+
'sp_widget',
|
|
122
|
+
'sys_script_include',
|
|
123
|
+
'sys_script',
|
|
124
|
+
'sys_ui_page',
|
|
125
|
+
'sys_script_client',
|
|
126
|
+
'sys_ui_policy',
|
|
127
|
+
'sysauto_script',
|
|
128
|
+
'sys_script_fix'
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
useDirectDeployment: {
|
|
132
|
+
when: [
|
|
133
|
+
'Creating new artifact from scratch',
|
|
134
|
+
'Simple artifact with minimal complexity',
|
|
135
|
+
'Quick prototype needed',
|
|
136
|
+
'No existing artifact to modify'
|
|
137
|
+
]
|
|
138
|
+
},
|
|
139
|
+
useDirectUpdate: {
|
|
140
|
+
when: [
|
|
141
|
+
'Small targeted changes',
|
|
142
|
+
'Single field update',
|
|
143
|
+
'Quick fix needed',
|
|
144
|
+
'No complex editing required'
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
},
|
|
148
|
+
/**
|
|
149
|
+
* Artifact Type Capabilities
|
|
150
|
+
*/
|
|
151
|
+
artifactCapabilities: {
|
|
152
|
+
sp_widget: {
|
|
153
|
+
localSync: true,
|
|
154
|
+
directDeploy: true,
|
|
155
|
+
directUpdate: true,
|
|
156
|
+
coherenceValidation: true,
|
|
157
|
+
es5Required: ['script'],
|
|
158
|
+
fields: ['template', 'script', 'client_script', 'css', 'option_schema']
|
|
159
|
+
},
|
|
160
|
+
sys_script_include: {
|
|
161
|
+
localSync: true,
|
|
162
|
+
directDeploy: true,
|
|
163
|
+
directUpdate: true,
|
|
164
|
+
es5Required: ['script'],
|
|
165
|
+
fields: ['script', 'api_name', 'description']
|
|
166
|
+
},
|
|
167
|
+
sys_script: {
|
|
168
|
+
localSync: true,
|
|
169
|
+
directDeploy: true,
|
|
170
|
+
directUpdate: true,
|
|
171
|
+
es5Required: ['script'],
|
|
172
|
+
fields: ['script', 'condition', 'collection', 'when']
|
|
173
|
+
},
|
|
174
|
+
sys_hub_flow: {
|
|
175
|
+
localSync: true,
|
|
176
|
+
directDeploy: false, // Cannot create flows programmatically
|
|
177
|
+
directUpdate: false,
|
|
178
|
+
fields: ['definition', 'description']
|
|
179
|
+
},
|
|
180
|
+
sys_ui_page: {
|
|
181
|
+
localSync: true,
|
|
182
|
+
directDeploy: true,
|
|
183
|
+
directUpdate: true,
|
|
184
|
+
es5Required: ['processing_script'],
|
|
185
|
+
fields: ['html', 'client_script', 'processing_script']
|
|
186
|
+
}
|
|
187
|
+
},
|
|
188
|
+
/**
|
|
189
|
+
* Strategic Recommendations
|
|
190
|
+
*/
|
|
191
|
+
strategicRecommendations: {
|
|
192
|
+
complexWidgetEdit: {
|
|
193
|
+
pattern: 'Local Sync Development',
|
|
194
|
+
reasoning: 'Complex widgets benefit from full IDE capabilities and multi-file editing',
|
|
195
|
+
steps: [
|
|
196
|
+
'Pull widget to local files',
|
|
197
|
+
'Use Claude Code search/replace across template, scripts, CSS',
|
|
198
|
+
'Validate coherence between components',
|
|
199
|
+
'Push back when complete'
|
|
200
|
+
]
|
|
201
|
+
},
|
|
202
|
+
bulkRefactoring: {
|
|
203
|
+
pattern: 'Local Sync Development',
|
|
204
|
+
reasoning: 'Refactoring requires searching and replacing across multiple files',
|
|
205
|
+
steps: [
|
|
206
|
+
'Pull all related artifacts',
|
|
207
|
+
'Use regex search/replace',
|
|
208
|
+
'Validate changes',
|
|
209
|
+
'Push all artifacts back'
|
|
210
|
+
]
|
|
211
|
+
},
|
|
212
|
+
quickPrototype: {
|
|
213
|
+
pattern: 'Direct Deployment',
|
|
214
|
+
reasoning: 'Prototypes need speed over complex editing capabilities',
|
|
215
|
+
steps: [
|
|
216
|
+
'Generate basic structure',
|
|
217
|
+
'Deploy directly to ServiceNow',
|
|
218
|
+
'Iterate quickly with direct updates'
|
|
219
|
+
]
|
|
220
|
+
}
|
|
221
|
+
},
|
|
222
|
+
/**
|
|
223
|
+
* Common Pitfalls to Avoid
|
|
224
|
+
*/
|
|
225
|
+
pitfallsToAvoid: [
|
|
226
|
+
{
|
|
227
|
+
pitfall: 'Using modern JavaScript in ServiceNow',
|
|
228
|
+
solution: 'Always validate ES5 compliance for server-side scripts'
|
|
229
|
+
},
|
|
230
|
+
{
|
|
231
|
+
pitfall: 'Breaking widget coherence',
|
|
232
|
+
solution: 'Run coherence validation before pushing widget changes'
|
|
233
|
+
},
|
|
234
|
+
{
|
|
235
|
+
pitfall: 'Not fetching latest version before editing',
|
|
236
|
+
solution: 'Always pull latest artifact if user mentions they modified it'
|
|
237
|
+
},
|
|
238
|
+
{
|
|
239
|
+
pitfall: 'Trying to create flows programmatically',
|
|
240
|
+
solution: 'Direct users to ServiceNow Flow Designer UI for flow creation'
|
|
241
|
+
}
|
|
242
|
+
],
|
|
243
|
+
/**
|
|
244
|
+
* MCP Server Mapping
|
|
245
|
+
*/
|
|
246
|
+
mcpServerMapping: {
|
|
247
|
+
'snow_pull_artifact': 'servicenow-local-development',
|
|
248
|
+
'snow_push_artifact': 'servicenow-local-development',
|
|
249
|
+
'snow_validate_artifact_coherence': 'servicenow-local-development',
|
|
250
|
+
'snow_list_supported_artifacts': 'servicenow-local-development',
|
|
251
|
+
'snow_sync_status': 'servicenow-local-development',
|
|
252
|
+
'snow_sync_cleanup': 'servicenow-local-development',
|
|
253
|
+
'snow_convert_to_es5': 'servicenow-local-development',
|
|
254
|
+
'snow_deploy': 'servicenow-deployment',
|
|
255
|
+
'snow_update': 'servicenow-deployment',
|
|
256
|
+
'snow_query_table': 'servicenow-operations',
|
|
257
|
+
'snow_create_script_include': 'servicenow-platform-development'
|
|
258
|
+
}
|
|
259
|
+
};
|
|
260
|
+
/**
|
|
261
|
+
* Helper function for Queen to determine optimal approach
|
|
262
|
+
*/
|
|
263
|
+
function determineOptimalApproach(objective, artifactType, context) {
|
|
264
|
+
// If user mentioned modifications, always sync first
|
|
265
|
+
if (context.userMentionedModifications && context.hasExistingArtifact) {
|
|
266
|
+
return 'Local Sync Development';
|
|
267
|
+
}
|
|
268
|
+
// For complex operations or refactoring
|
|
269
|
+
if (context.requiresRefactoring || context.complexity === 'high') {
|
|
270
|
+
return 'Local Sync Development';
|
|
271
|
+
}
|
|
272
|
+
// For new artifacts
|
|
273
|
+
if (!context.hasExistingArtifact) {
|
|
274
|
+
return context.complexity === 'low' ? 'Direct Deployment' : 'Local Sync Development';
|
|
275
|
+
}
|
|
276
|
+
// For simple updates
|
|
277
|
+
if (context.complexity === 'low' && context.hasExistingArtifact) {
|
|
278
|
+
return 'Direct Update';
|
|
279
|
+
}
|
|
280
|
+
// Default to local sync for safety
|
|
281
|
+
return 'Local Sync Development';
|
|
282
|
+
}
|
|
283
|
+
//# sourceMappingURL=queen-knowledge-base.js.map
|
|
@@ -42,6 +42,7 @@ const queen_memory_1 = require("./queen-memory");
|
|
|
42
42
|
const neural_learning_1 = require("./neural-learning");
|
|
43
43
|
const agent_factory_1 = require("./agent-factory");
|
|
44
44
|
const mcp_execution_bridge_1 = require("./mcp-execution-bridge");
|
|
45
|
+
const queen_knowledge_base_1 = require("./queen-knowledge-base");
|
|
45
46
|
const theme_manager_1 = require("../utils/theme-manager");
|
|
46
47
|
const dependency_detector_1 = require("../utils/dependency-detector");
|
|
47
48
|
// Gap Analysis Engine removed - using direct MCP approach
|
|
@@ -311,6 +312,46 @@ class ServiceNowQueen {
|
|
|
311
312
|
}
|
|
312
313
|
}
|
|
313
314
|
createDeploymentPlan(task, agentResults, _analysis) {
|
|
315
|
+
// Determine optimal approach based on knowledge base
|
|
316
|
+
const hasExistingArtifact = task.objective.toLowerCase().includes('update') ||
|
|
317
|
+
task.objective.toLowerCase().includes('edit') ||
|
|
318
|
+
task.objective.toLowerCase().includes('modify') ||
|
|
319
|
+
task.objective.toLowerCase().includes('change');
|
|
320
|
+
const requiresRefactoring = task.objective.toLowerCase().includes('refactor') ||
|
|
321
|
+
task.objective.toLowerCase().includes('rename') ||
|
|
322
|
+
task.objective.toLowerCase().includes('reorganize');
|
|
323
|
+
const userMentionedModifications = task.objective.toLowerCase().includes('i modified') ||
|
|
324
|
+
task.objective.toLowerCase().includes('i changed') ||
|
|
325
|
+
task.objective.toLowerCase().includes('i updated') ||
|
|
326
|
+
task.objective.toLowerCase().includes('aangepast') ||
|
|
327
|
+
task.objective.toLowerCase().includes('zelf');
|
|
328
|
+
const approach = (0, queen_knowledge_base_1.determineOptimalApproach)(task.objective, task.type, {
|
|
329
|
+
hasExistingArtifact,
|
|
330
|
+
complexity: _analysis.estimatedComplexity > 7 ? 'high' :
|
|
331
|
+
_analysis.estimatedComplexity > 4 ? 'medium' : 'low',
|
|
332
|
+
requiresRefactoring,
|
|
333
|
+
userMentionedModifications
|
|
334
|
+
});
|
|
335
|
+
if (this.config.debugMode) {
|
|
336
|
+
this.logger.info(`🎨 Optimal approach: ${approach}`);
|
|
337
|
+
this.logger.info(`🔍 Artifact sync available: ${queen_knowledge_base_1.QUEEN_KNOWLEDGE_BASE.artifactCapabilities[this.getTableForType(task.type)]?.localSync}`);
|
|
338
|
+
}
|
|
339
|
+
// If local sync is optimal and available
|
|
340
|
+
if (approach === 'Local Sync Development' && hasExistingArtifact) {
|
|
341
|
+
const table = this.getTableForType(task.type);
|
|
342
|
+
if (queen_knowledge_base_1.QUEEN_KNOWLEDGE_BASE.artifactCapabilities[table]?.localSync) {
|
|
343
|
+
return {
|
|
344
|
+
type: 'local-sync',
|
|
345
|
+
approach: approach,
|
|
346
|
+
mcpTool: 'snow_pull_artifact',
|
|
347
|
+
workflow: queen_knowledge_base_1.QUEEN_KNOWLEDGE_BASE.developmentPatterns.widgetDevelopment.approaches[0].workflow,
|
|
348
|
+
config: {
|
|
349
|
+
table: table,
|
|
350
|
+
sys_id: this.extractSysIdFromObjective(task.objective)
|
|
351
|
+
}
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
}
|
|
314
355
|
// Extract deployment instructions from agent results
|
|
315
356
|
const widgetCreator = agentResults.find(r => r.agentType === 'widget-creator');
|
|
316
357
|
const flowBuilder = agentResults.find(r => r.agentType === 'flow-builder');
|
|
@@ -609,6 +650,36 @@ function($scope) {
|
|
|
609
650
|
})();`;
|
|
610
651
|
}
|
|
611
652
|
async executeDeploymentPlan(plan) {
|
|
653
|
+
// Handle local sync workflow for artifact editing
|
|
654
|
+
if (plan.type === 'local-sync') {
|
|
655
|
+
if (this.config.debugMode) {
|
|
656
|
+
this.logger.info('🔄 Executing Local Sync Development workflow');
|
|
657
|
+
this.logger.info('📁 Artifact will be synced to local files for editing');
|
|
658
|
+
}
|
|
659
|
+
// Create recommendation for local sync
|
|
660
|
+
const recommendation = {
|
|
661
|
+
agentId: 'queen-agent',
|
|
662
|
+
agentType: 'queen',
|
|
663
|
+
action: 'local-sync',
|
|
664
|
+
tool: 'snow_pull_artifact',
|
|
665
|
+
server: 'servicenow-local-development',
|
|
666
|
+
params: plan.config,
|
|
667
|
+
reasoning: 'Syncing artifact to local files for advanced editing with Claude Code',
|
|
668
|
+
confidence: 0.95
|
|
669
|
+
};
|
|
670
|
+
// Execute pull through MCP bridge
|
|
671
|
+
const result = await this.mcpBridge.executeAgentRecommendation({ id: 'queen-agent', type: 'queen' }, recommendation);
|
|
672
|
+
if (result.success) {
|
|
673
|
+
return {
|
|
674
|
+
success: true,
|
|
675
|
+
type: 'local-sync',
|
|
676
|
+
approach: plan.approach,
|
|
677
|
+
message: 'Artifact synced to local files. Edit with Claude Code, then use snow_push_artifact to sync back.',
|
|
678
|
+
localPath: result.toolResult?.localPath,
|
|
679
|
+
files: result.toolResult?.files
|
|
680
|
+
};
|
|
681
|
+
}
|
|
682
|
+
}
|
|
612
683
|
// Execute real MCP tools through the bridge
|
|
613
684
|
if (this.config.debugMode) {
|
|
614
685
|
this.logger.info('🚀 Executing deployment plan with MCP Bridge');
|
|
@@ -942,6 +1013,26 @@ function($scope) {
|
|
|
942
1013
|
/**
|
|
943
1014
|
* Extract the core business problem from user request
|
|
944
1015
|
*/
|
|
1016
|
+
getTableForType(type) {
|
|
1017
|
+
const typeToTable = {
|
|
1018
|
+
'widget': 'sp_widget',
|
|
1019
|
+
'flow': 'sys_hub_flow',
|
|
1020
|
+
'script': 'sys_script_include',
|
|
1021
|
+
'business_rule': 'sys_script',
|
|
1022
|
+
'ui_page': 'sys_ui_page',
|
|
1023
|
+
'client_script': 'sys_script_client',
|
|
1024
|
+
'ui_policy': 'sys_ui_policy',
|
|
1025
|
+
'scheduled_job': 'sysauto_script',
|
|
1026
|
+
'fix_script': 'sys_script_fix'
|
|
1027
|
+
};
|
|
1028
|
+
return typeToTable[type] || 'sys_metadata';
|
|
1029
|
+
}
|
|
1030
|
+
extractSysIdFromObjective(objective) {
|
|
1031
|
+
// Look for sys_id patterns in the objective
|
|
1032
|
+
const sysIdPattern = /[a-f0-9]{32}/i;
|
|
1033
|
+
const match = objective.match(sysIdPattern);
|
|
1034
|
+
return match ? match[0] : undefined;
|
|
1035
|
+
}
|
|
945
1036
|
extractCoreProblem(objective) {
|
|
946
1037
|
const objective_lower = objective.toLowerCase();
|
|
947
1038
|
// Analyze patterns to understand underlying need
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Artifact Local Sync System
|
|
3
|
+
*
|
|
4
|
+
* Creates temporary local files from ServiceNow artifacts so Claude Code
|
|
5
|
+
* can use its native tools (search, edit, multi-file operations, etc.)
|
|
6
|
+
* Then syncs changes back to ServiceNow.
|
|
7
|
+
*
|
|
8
|
+
* THIS IS THE BRIDGE BETWEEN SERVICENOW AND CLAUDE CODE!
|
|
9
|
+
*/
|
|
10
|
+
import { ServiceNowClient } from './servicenow-client';
|
|
11
|
+
import { ArtifactTypeConfig, FieldMapping, ValidationResult } from './artifact-sync/artifact-registry';
|
|
12
|
+
export interface LocalArtifact {
|
|
13
|
+
sys_id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
type: string;
|
|
16
|
+
tableName: string;
|
|
17
|
+
localPath: string;
|
|
18
|
+
files: LocalFile[];
|
|
19
|
+
metadata: any;
|
|
20
|
+
syncStatus: 'synced' | 'modified' | 'pending_upload';
|
|
21
|
+
createdAt: Date;
|
|
22
|
+
lastSyncedAt: Date;
|
|
23
|
+
artifactConfig?: ArtifactTypeConfig;
|
|
24
|
+
}
|
|
25
|
+
export interface LocalFile {
|
|
26
|
+
filename: string;
|
|
27
|
+
path: string;
|
|
28
|
+
field: string;
|
|
29
|
+
type: string;
|
|
30
|
+
originalContent: string;
|
|
31
|
+
currentContent?: string;
|
|
32
|
+
isModified: boolean;
|
|
33
|
+
fieldMapping?: FieldMapping;
|
|
34
|
+
}
|
|
35
|
+
export declare class ArtifactLocalSync {
|
|
36
|
+
private baseDir;
|
|
37
|
+
private artifacts;
|
|
38
|
+
private client;
|
|
39
|
+
private smartFetcher;
|
|
40
|
+
constructor(client: ServiceNowClient);
|
|
41
|
+
/**
|
|
42
|
+
* DYNAMIC pull artifact from ServiceNow using artifact registry
|
|
43
|
+
* Works with ANY artifact type defined in the registry!
|
|
44
|
+
*/
|
|
45
|
+
pullArtifact(tableName: string, sys_id: string): Promise<LocalArtifact>;
|
|
46
|
+
/**
|
|
47
|
+
* Pull a widget from ServiceNow and create local files
|
|
48
|
+
* This is the magic that lets Claude Code use its native tools!
|
|
49
|
+
* (Wrapper for backward compatibility)
|
|
50
|
+
*/
|
|
51
|
+
pullWidget(sys_id: string): Promise<LocalArtifact>;
|
|
52
|
+
/**
|
|
53
|
+
* DYNAMIC push local changes back to ServiceNow using artifact registry
|
|
54
|
+
*/
|
|
55
|
+
pushArtifact(sys_id: string): Promise<boolean>;
|
|
56
|
+
/**
|
|
57
|
+
* Push local changes back to ServiceNow
|
|
58
|
+
* (Wrapper for backward compatibility)
|
|
59
|
+
*/
|
|
60
|
+
pushWidget(sys_id: string): Promise<boolean>;
|
|
61
|
+
/**
|
|
62
|
+
* Clean up local files after successful sync
|
|
63
|
+
*/
|
|
64
|
+
cleanup(sys_id: string, force?: boolean): Promise<void>;
|
|
65
|
+
/**
|
|
66
|
+
* Create a local file with appropriate headers
|
|
67
|
+
*/
|
|
68
|
+
private createLocalFile;
|
|
69
|
+
/**
|
|
70
|
+
* Generate README with artifact-specific context using registry
|
|
71
|
+
*/
|
|
72
|
+
private generateArtifactReadme;
|
|
73
|
+
/**
|
|
74
|
+
* Replace placeholders in wrapper strings
|
|
75
|
+
*/
|
|
76
|
+
private replacePlaceholders;
|
|
77
|
+
/**
|
|
78
|
+
* Generate README with widget context
|
|
79
|
+
* (Wrapper for backward compatibility)
|
|
80
|
+
*/
|
|
81
|
+
private generateWidgetReadme;
|
|
82
|
+
/**
|
|
83
|
+
* Validate ES5 compliance
|
|
84
|
+
*/
|
|
85
|
+
private validateES5;
|
|
86
|
+
/**
|
|
87
|
+
* Strip headers/footers we added - now uses field mapping for accuracy
|
|
88
|
+
*/
|
|
89
|
+
private stripAddedWrappers;
|
|
90
|
+
/**
|
|
91
|
+
* Sanitize filename for filesystem
|
|
92
|
+
*/
|
|
93
|
+
private sanitizeFilename;
|
|
94
|
+
/**
|
|
95
|
+
* List all local artifacts
|
|
96
|
+
*/
|
|
97
|
+
listLocalArtifacts(): LocalArtifact[];
|
|
98
|
+
/**
|
|
99
|
+
* Get sync status for an artifact
|
|
100
|
+
*/
|
|
101
|
+
getSyncStatus(sys_id: string): string;
|
|
102
|
+
/**
|
|
103
|
+
* Pull any supported artifact type by detecting table from sys_id
|
|
104
|
+
*/
|
|
105
|
+
pullArtifactBySysId(sys_id: string): Promise<LocalArtifact>;
|
|
106
|
+
/**
|
|
107
|
+
* Get supported artifact types
|
|
108
|
+
*/
|
|
109
|
+
getSupportedTypes(): string[];
|
|
110
|
+
/**
|
|
111
|
+
* Validate coherence for an artifact
|
|
112
|
+
*/
|
|
113
|
+
validateArtifactCoherence(sys_id: string): Promise<ValidationResult[]>;
|
|
114
|
+
}
|
|
115
|
+
//# sourceMappingURL=artifact-local-sync.d.ts.map
|