nowaikit 2.5.3 → 3.0.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.
Files changed (151) hide show
  1. package/dist/cli/index.js +89 -1
  2. package/dist/cli/index.js.map +1 -1
  3. package/dist/direct/executor.d.ts +28 -0
  4. package/dist/direct/executor.d.ts.map +1 -0
  5. package/dist/direct/executor.js +228 -0
  6. package/dist/direct/executor.js.map +1 -0
  7. package/dist/direct/llm-client.d.ts +32 -0
  8. package/dist/direct/llm-client.d.ts.map +1 -0
  9. package/dist/direct/llm-client.js +122 -0
  10. package/dist/direct/llm-client.js.map +1 -0
  11. package/dist/prompts/capabilities/build-app.d.ts +4 -0
  12. package/dist/prompts/capabilities/build-app.d.ts.map +1 -0
  13. package/dist/prompts/capabilities/build-app.js +238 -0
  14. package/dist/prompts/capabilities/build-app.js.map +1 -0
  15. package/dist/prompts/capabilities/build-business-rule.d.ts +4 -0
  16. package/dist/prompts/capabilities/build-business-rule.d.ts.map +1 -0
  17. package/dist/prompts/capabilities/build-business-rule.js +93 -0
  18. package/dist/prompts/capabilities/build-business-rule.js.map +1 -0
  19. package/dist/prompts/capabilities/build-catalog.d.ts +4 -0
  20. package/dist/prompts/capabilities/build-catalog.d.ts.map +1 -0
  21. package/dist/prompts/capabilities/build-catalog.js +350 -0
  22. package/dist/prompts/capabilities/build-catalog.js.map +1 -0
  23. package/dist/prompts/capabilities/build-client-script.d.ts +4 -0
  24. package/dist/prompts/capabilities/build-client-script.d.ts.map +1 -0
  25. package/dist/prompts/capabilities/build-client-script.js +157 -0
  26. package/dist/prompts/capabilities/build-client-script.js.map +1 -0
  27. package/dist/prompts/capabilities/build-flow.d.ts +4 -0
  28. package/dist/prompts/capabilities/build-flow.d.ts.map +1 -0
  29. package/dist/prompts/capabilities/build-flow.js +243 -0
  30. package/dist/prompts/capabilities/build-flow.js.map +1 -0
  31. package/dist/prompts/capabilities/build-portal.d.ts +4 -0
  32. package/dist/prompts/capabilities/build-portal.d.ts.map +1 -0
  33. package/dist/prompts/capabilities/build-portal.js +250 -0
  34. package/dist/prompts/capabilities/build-portal.js.map +1 -0
  35. package/dist/prompts/capabilities/build-rest-api.d.ts +4 -0
  36. package/dist/prompts/capabilities/build-rest-api.d.ts.map +1 -0
  37. package/dist/prompts/capabilities/build-rest-api.js +293 -0
  38. package/dist/prompts/capabilities/build-rest-api.js.map +1 -0
  39. package/dist/prompts/capabilities/build-test-plan.d.ts +4 -0
  40. package/dist/prompts/capabilities/build-test-plan.d.ts.map +1 -0
  41. package/dist/prompts/capabilities/build-test-plan.js +162 -0
  42. package/dist/prompts/capabilities/build-test-plan.js.map +1 -0
  43. package/dist/prompts/capabilities/build-uib.d.ts +4 -0
  44. package/dist/prompts/capabilities/build-uib.d.ts.map +1 -0
  45. package/dist/prompts/capabilities/build-uib.js +309 -0
  46. package/dist/prompts/capabilities/build-uib.js.map +1 -0
  47. package/dist/prompts/capabilities/docs-app.d.ts +4 -0
  48. package/dist/prompts/capabilities/docs-app.d.ts.map +1 -0
  49. package/dist/prompts/capabilities/docs-app.js +234 -0
  50. package/dist/prompts/capabilities/docs-app.js.map +1 -0
  51. package/dist/prompts/capabilities/docs-release.d.ts +4 -0
  52. package/dist/prompts/capabilities/docs-release.d.ts.map +1 -0
  53. package/dist/prompts/capabilities/docs-release.js +197 -0
  54. package/dist/prompts/capabilities/docs-release.js.map +1 -0
  55. package/dist/prompts/capabilities/docs-runbook.d.ts +4 -0
  56. package/dist/prompts/capabilities/docs-runbook.d.ts.map +1 -0
  57. package/dist/prompts/capabilities/docs-runbook.js +223 -0
  58. package/dist/prompts/capabilities/docs-runbook.js.map +1 -0
  59. package/dist/prompts/capabilities/docs-script.d.ts +4 -0
  60. package/dist/prompts/capabilities/docs-script.d.ts.map +1 -0
  61. package/dist/prompts/capabilities/docs-script.js +242 -0
  62. package/dist/prompts/capabilities/docs-script.js.map +1 -0
  63. package/dist/prompts/capabilities/ops-deploy.d.ts +4 -0
  64. package/dist/prompts/capabilities/ops-deploy.d.ts.map +1 -0
  65. package/dist/prompts/capabilities/ops-deploy.js +193 -0
  66. package/dist/prompts/capabilities/ops-deploy.js.map +1 -0
  67. package/dist/prompts/capabilities/ops-risk.d.ts +4 -0
  68. package/dist/prompts/capabilities/ops-risk.d.ts.map +1 -0
  69. package/dist/prompts/capabilities/ops-risk.js +227 -0
  70. package/dist/prompts/capabilities/ops-risk.js.map +1 -0
  71. package/dist/prompts/capabilities/ops-triage.d.ts +4 -0
  72. package/dist/prompts/capabilities/ops-triage.d.ts.map +1 -0
  73. package/dist/prompts/capabilities/ops-triage.js +183 -0
  74. package/dist/prompts/capabilities/ops-triage.js.map +1 -0
  75. package/dist/prompts/capabilities/review-acls.d.ts +4 -0
  76. package/dist/prompts/capabilities/review-acls.d.ts.map +1 -0
  77. package/dist/prompts/capabilities/review-acls.js +142 -0
  78. package/dist/prompts/capabilities/review-acls.js.map +1 -0
  79. package/dist/prompts/capabilities/review-code.d.ts +4 -0
  80. package/dist/prompts/capabilities/review-code.d.ts.map +1 -0
  81. package/dist/prompts/capabilities/review-code.js +155 -0
  82. package/dist/prompts/capabilities/review-code.js.map +1 -0
  83. package/dist/prompts/capabilities/review-flows.d.ts +4 -0
  84. package/dist/prompts/capabilities/review-flows.d.ts.map +1 -0
  85. package/dist/prompts/capabilities/review-flows.js +413 -0
  86. package/dist/prompts/capabilities/review-flows.js.map +1 -0
  87. package/dist/prompts/capabilities/review-scripts.d.ts +4 -0
  88. package/dist/prompts/capabilities/review-scripts.d.ts.map +1 -0
  89. package/dist/prompts/capabilities/review-scripts.js +160 -0
  90. package/dist/prompts/capabilities/review-scripts.js.map +1 -0
  91. package/dist/prompts/capabilities/scan-automation.d.ts +4 -0
  92. package/dist/prompts/capabilities/scan-automation.d.ts.map +1 -0
  93. package/dist/prompts/capabilities/scan-automation.js +449 -0
  94. package/dist/prompts/capabilities/scan-automation.js.map +1 -0
  95. package/dist/prompts/capabilities/scan-cmdb.d.ts +4 -0
  96. package/dist/prompts/capabilities/scan-cmdb.d.ts.map +1 -0
  97. package/dist/prompts/capabilities/scan-cmdb.js +450 -0
  98. package/dist/prompts/capabilities/scan-cmdb.js.map +1 -0
  99. package/dist/prompts/capabilities/scan-debt.d.ts +4 -0
  100. package/dist/prompts/capabilities/scan-debt.d.ts.map +1 -0
  101. package/dist/prompts/capabilities/scan-debt.js +287 -0
  102. package/dist/prompts/capabilities/scan-debt.js.map +1 -0
  103. package/dist/prompts/capabilities/scan-health.d.ts +4 -0
  104. package/dist/prompts/capabilities/scan-health.d.ts.map +1 -0
  105. package/dist/prompts/capabilities/scan-health.js +235 -0
  106. package/dist/prompts/capabilities/scan-health.js.map +1 -0
  107. package/dist/prompts/capabilities/scan-security.d.ts +4 -0
  108. package/dist/prompts/capabilities/scan-security.d.ts.map +1 -0
  109. package/dist/prompts/capabilities/scan-security.js +370 -0
  110. package/dist/prompts/capabilities/scan-security.js.map +1 -0
  111. package/dist/prompts/capabilities/scan-upgrade.d.ts +4 -0
  112. package/dist/prompts/capabilities/scan-upgrade.d.ts.map +1 -0
  113. package/dist/prompts/capabilities/scan-upgrade.js +327 -0
  114. package/dist/prompts/capabilities/scan-upgrade.js.map +1 -0
  115. package/dist/prompts/index.d.ts +24 -2
  116. package/dist/prompts/index.d.ts.map +1 -1
  117. package/dist/prompts/index.js +160 -14
  118. package/dist/prompts/index.js.map +1 -1
  119. package/dist/prompts/knowledge.d.ts +10 -0
  120. package/dist/prompts/knowledge.d.ts.map +1 -0
  121. package/dist/prompts/knowledge.js +604 -0
  122. package/dist/prompts/knowledge.js.map +1 -0
  123. package/dist/prompts/types.d.ts +38 -0
  124. package/dist/prompts/types.d.ts.map +1 -0
  125. package/dist/prompts/types.js +8 -0
  126. package/dist/prompts/types.js.map +1 -0
  127. package/dist/server.js +3 -3
  128. package/dist/server.js.map +1 -1
  129. package/dist/servicenow/client.d.ts +15 -0
  130. package/dist/servicenow/client.d.ts.map +1 -1
  131. package/dist/servicenow/client.js +107 -0
  132. package/dist/servicenow/client.js.map +1 -1
  133. package/dist/tools/core.d.ts +68 -0
  134. package/dist/tools/core.d.ts.map +1 -1
  135. package/dist/tools/core.js +58 -0
  136. package/dist/tools/core.js.map +1 -1
  137. package/dist/tools/fluent.d.ts +161 -0
  138. package/dist/tools/fluent.d.ts.map +1 -0
  139. package/dist/tools/fluent.js +277 -0
  140. package/dist/tools/fluent.js.map +1 -0
  141. package/dist/tools/index.d.ts +214 -0
  142. package/dist/tools/index.d.ts.map +1 -1
  143. package/dist/tools/index.js +12 -6
  144. package/dist/tools/index.js.map +1 -1
  145. package/dist/tools/now-assist.d.ts.map +1 -1
  146. package/dist/tools/now-assist.js +8 -0
  147. package/dist/tools/now-assist.js.map +1 -1
  148. package/dist/tools/script.d.ts.map +1 -1
  149. package/dist/tools/script.js +12 -0
  150. package/dist/tools/script.js.map +1 -1
  151. package/package.json +11 -3
@@ -0,0 +1,604 @@
1
+ // =============================================================================
2
+ // ServiceNow Platform Knowledge — Embedded Reference for Capabilities
3
+ // =============================================================================
4
+ // Each export is a structured string constant that capabilities can import
5
+ // and inject into their prompts to give the AI model deep platform context.
6
+ // =============================================================================
7
+ export const FLOW_DESIGNER_KNOWLEDGE = `
8
+ ## Flow Designer — Platform Reference
9
+
10
+ ### Trigger Types
11
+ - **Record Triggers**: Before Insert, After Insert, Before Update, After Update, Before Delete, After Delete
12
+ - Conditions: field-level conditions, advanced scripting conditions
13
+ - Run-as: System or triggering user (security context matters)
14
+ - **Scheduled Triggers**: Run once, daily, weekly, monthly, or cron expression
15
+ - Time zone aware, supports repeat-until and count-based limits
16
+ - **Application Triggers**: REST trigger (inbound webhook), Email trigger (inbound email parse),
17
+ Custom trigger (raised by script via sn_fd.FlowAPI.startFlow)
18
+ - **Inbound Email Trigger**: Matches on subject, sender, body regex; parses attachments
19
+
20
+ ### Action Types
21
+ - **Core Actions**: Create Record, Update Record, Delete Record, Log, Assign Record, Request Approval,
22
+ Wait for Approval, Send Notification, Set Value, Ask for Input
23
+ - **Flow Logic**: If / Else If / Else, For Each (loop), Wait For (duration/condition),
24
+ Do Until (loop with condition), Parallel (fan-out), Collect (fan-in)
25
+ - **Advanced Actions**: Run Script (GlideRecord, GlideQuery, scoped APIs), Call REST (outbound HTTP),
26
+ Call Subflow (reusable logic), Publish Event (event queue), Transform (data mapping),
27
+ Call Action (custom spoke actions), Raise Error (halt execution)
28
+
29
+ ### Error Handling
30
+ - **Try / Catch / Finally**: Wrap actions in try-catch; catch outputs error.message, error.detail
31
+ - **Rollback Actions**: Delete or revert records created before error
32
+ - **Error Outputs**: Every action exposes .error_message and .is_error output variables
33
+ - **Compensation**: Use catch block to trigger compensating subflows
34
+
35
+ ### Variables & Data
36
+ - **Input/Output Variables**: Defined on flow/subflow signature; typed (string, reference, integer, etc.)
37
+ - **Scratch Variables**: Temporary flow-scoped storage, not exposed externally
38
+ - **Dot-Walking**: Access related record fields via dot notation (e.g., trigger.current.caller_id.email)
39
+ - **Data Pills**: Visual references to any upstream action output or trigger field
40
+
41
+ ### Limits & Performance
42
+ - Maximum 100 actions per flow; 200 actions per subflow
43
+ - Execution depth limit: 500 (nested subflow calls)
44
+ - Synchronous flow timeout: 60 seconds
45
+ - Asynchronous flow timeout: 24 hours (configurable)
46
+ - Batch operations: use For Each with limit, or GlideQuery bulk operations in Run Script
47
+ - Avoid GlideRecord loops in Run Script; prefer GlideQuery with .toArray()
48
+ `;
49
+ export const PORTAL_WIDGET_KNOWLEDGE = `
50
+ ## Service Portal Widget — Platform Reference
51
+
52
+ ### Lifecycle
53
+ 1. **Server Script** executes first (server-side, GlideRecord access, secure)
54
+ 2. **Client Controller** initializes with data from server (\`c.data\` binding)
55
+ 3. **HTML Template** renders using AngularJS directives and \`c.data\`
56
+ 4. Interactions trigger \`c.server.update()\` for round-trip back to server
57
+
58
+ ### Server Script
59
+ - **data object**: Populate \`data.fieldName = value\` to pass to client
60
+ - **input object**: Receive client-sent data via \`input.fieldName\`
61
+ - **$sp API**: getParameter(name), getPortalRecord(), getUser(), getWidget(widgetId, options),
62
+ getStream(table, sys_id), getValues(gr, fieldList), setRedirectURL(url),
63
+ getDisplayValue(fieldName), getInstanceRecord(), getKBCategoryArticles(kbId, categoryId)
64
+ - **GlideRecord**: Full server-side access; always enforce ACLs with gr.canRead()
65
+ - **Options**: Widget instance options accessible via \`options.optionName\`
66
+
67
+ ### Client Controller
68
+ - **\`c.data\`**: Two-way bound to server data object
69
+ - **\`c.options\`**: Read-only widget instance options
70
+ - **\`c.server.update()\`**: Send c.data back to server; returns promise
71
+ - **\`c.server.get({action: 'name'})\`**: Call server with specific action; returns promise
72
+ - **spUtil API**: update(widget), addInfoMessage(msg), addErrorMessage(msg),
73
+ addTrivialMessage(msg), createChangeHandler(scope, data, callback),
74
+ recordWatch(scope, table, filter, callback), format(template, data), get(widgetId, options)
75
+ - **$scope**: AngularJS scope; use \`\$scope.\$on('event', handler)\` for cross-widget communication
76
+ - **\$rootScope.\$broadcast('event', data)**: Emit events to all widgets on page
77
+
78
+ ### HTML Template
79
+ - **Directives**: ng-repeat, ng-if, ng-show/ng-hide, ng-click, ng-model, ng-class, ng-style,
80
+ ng-change, ng-submit, ng-disabled, ng-href, ng-src
81
+ - **Widget Embedding**: \`<sp-widget widget="c.data.myWidget"></sp-widget>\`
82
+ - **Filters**: {{ value | limitTo:50 }}, {{ date | date:'yyyy-MM-dd' }}, {{ text | uppercase }}
83
+ - **Translation**: \`\${Message text}\` syntax for internationalization
84
+
85
+ ### CSS / SCSS
86
+ - Scoped to widget automatically (no bleed to other widgets)
87
+ - SCSS variables: \$sp-primary, \$sp-secondary, \$sp-navbar-bg, \$sp-tagline-color
88
+ - BEM convention recommended: .widget-name__element--modifier
89
+ - Bootstrap 3 grid system available (col-xs, col-sm, col-md, col-lg)
90
+
91
+ ### Security
92
+ - **XSS Prevention**: Use ng-bind (not ng-bind-html) for untrusted data; use $sanitize service
93
+ - **Server-Side Validation**: Always validate input on server; client validation is bypassable
94
+ - **ACL Enforcement**: Use gr.canRead()/canWrite() before returning data
95
+ - **Sensitive Data**: Never send sys_ids of admin records; filter server-side
96
+ `;
97
+ export const UIB_COMPONENT_KNOWLEDGE = `
98
+ ## UI Builder (UIB) / Now Experience — Platform Reference
99
+
100
+ ### Architecture
101
+ - **Macroponent**: Top-level container component; composes child components
102
+ - **Child Components**: Reusable elements within a macroponent
103
+ - **Data Resources**: Feed data into components (GraphQL, REST, Script, Record Watcher, Transform)
104
+ - **Variants**: Different configurations of a macroponent for different use cases
105
+ - **Page**: Collection of macroponents arranged in layout regions
106
+
107
+ ### @seismic/core (Now Experience Framework)
108
+ - \`createCustomElement(tag, { ...config })\`: Register a custom web component
109
+ - \`actionTypes.COMPONENT_PROPERTY_CHANGED\`: Dispatched when a property value changes
110
+ - \`actionTypes.COMPONENT_CONNECTED\`: Component attached to DOM
111
+ - \`actionTypes.COMPONENT_DISCONNECTED\`: Component removed from DOM
112
+ - \`actionTypes.COMPONENT_BOOTSTRAPPED\`: Component first initialized
113
+ - Action handlers: \`actionHandlers: { [actionType]: (coeffects) => newState }\`
114
+ - Coeffects: \`{ action, state, dispatch, updateState, properties }\`
115
+
116
+ ### Data Resources
117
+ - **GraphQL**: Query Now Platform GraphQL APIs; supports variables and fragments
118
+ - **REST**: Call REST APIs (internal or external); configure auth and headers
119
+ - **Script**: Server-side Script Include execution; returns JSON
120
+ - **Record Watcher**: Real-time updates via AMB (Ambient Messaging Bus) channel
121
+ - **Transform**: Map and reshape data from other resources
122
+
123
+ ### Now Experience Design System (NEDS)
124
+ - Core components: now-button, now-heading, now-card, now-card-hero, now-dropdown,
125
+ now-modal, now-icon, now-avatar, now-badge, now-toggle, now-input, now-textarea,
126
+ now-select, now-radio-buttons, now-checkbox, now-tabs, now-alert, now-loading,
127
+ now-rich-text, now-label-value, now-template-card
128
+ - Layout: now-grid, now-split, now-stack (flexbox-based)
129
+ - Theming: CSS custom properties (--now-color-*, --now-font-*, --now-spacing-*)
130
+
131
+ ### Properties & Events
132
+ - \`@property({ type: String }) label\`: Declare configurable properties
133
+ - Properties configurable via Variant Editor in UI Builder
134
+ - \`dispatch('EVENT_NAME', { detail: payload })\`: Emit custom events
135
+ - \`update({ propName: newValue })\`: Update component state
136
+ - Lifecycle: connected -> bootstrapped -> property changes -> disconnected
137
+
138
+ ### Responsive Design
139
+ - Breakpoints: mobile (<768px), tablet (768-1024px), desktop (>1024px)
140
+ - CSS grid and flexbox for layout; container queries for component-level responsiveness
141
+ - Use now-grid regions for adaptive layouts
142
+ `;
143
+ export const CMDB_KNOWLEDGE = `
144
+ ## CMDB (Configuration Management Database) — Platform Reference
145
+
146
+ ### Class Hierarchy (Inheritance)
147
+ - \`cmdb\` (base) -> \`cmdb_ci\` (Configuration Item base)
148
+ - \`cmdb_ci_hardware\` -> \`cmdb_ci_computer\` -> \`cmdb_ci_server\` / \`cmdb_ci_vm_instance\`
149
+ - \`cmdb_ci_hardware\` -> \`cmdb_ci_computer\` -> \`cmdb_ci_pc_hardware\`
150
+ - \`cmdb_ci_hardware\` -> \`cmdb_ci_netgear\` -> \`cmdb_ci_ip_router\` / \`cmdb_ci_ip_switch\` / \`cmdb_ci_ip_firewall\`
151
+ - \`cmdb_ci_service\` -> \`cmdb_ci_service_auto\` / \`cmdb_ci_service_technical\` / \`cmdb_ci_service_business\`
152
+ - \`cmdb_ci_appl\` -> \`cmdb_ci_app_server\` (Tomcat, WebSphere, etc.)
153
+ - \`cmdb_ci_db_instance\` (MySQL, Oracle, SQL Server, PostgreSQL)
154
+ - \`cmdb_ci_cloud_service_account\` (AWS, Azure, GCP)
155
+ - \`cmdb_ci_kubernetes_cluster\`, \`cmdb_ci_kubernetes_node\`, \`cmdb_ci_kubernetes_pod\`
156
+ - \`cmdb_ci_storage_device\`, \`cmdb_ci_network_adapter\`, \`cmdb_ci_disk\`
157
+
158
+ ### Relationship Types (cmdb_rel_type)
159
+ - **Depends on::Used by** — Service A depends on Server B
160
+ - **Runs on::Runs** — Application runs on Server
161
+ - **Housed in::Houses** — Server housed in Rack
162
+ - **Connected to::Connected by** — Network adjacency
163
+ - **Cluster of::Cluster is** — Cluster membership
164
+ - **Provided by::Provides** — Cloud service provider relationship
165
+ - **Members::Member of** — Group membership
166
+ - **Hosted on::Hosts** — VM hosted on Hypervisor
167
+
168
+ ### IRE (Identification & Reconciliation Engine)
169
+ - **Identification Rules**: Match incoming CI data to existing CIs using identifier fields (e.g., serial_number + name)
170
+ - **Reconciliation Rules**: Determine which data source wins conflicts (priority-based)
171
+ - **Data Source Priority**: Discovery > SCCM > Manual > Import Set (configurable)
172
+ - **Duplicate Detection**: IRE flags potential duplicates via identification mismatches
173
+ - **Reclassification**: Automatically moves CIs to correct class based on discovered attributes
174
+
175
+ ### Discovery
176
+ - **Schedule Types**: Full, Incremental, Quick (IP range limited)
177
+ - **MID Server Roles**: Discovery, ITOM, Event Management, Orchestration
178
+ - **Horizontal Discovery**: IP-based; finds devices on network (ping, SNMP, WMI, SSH)
179
+ - **Vertical Discovery** (Pattern-based): Deep application topology; uses Service Mapping patterns
180
+ - **Cloud Discovery**: AWS, Azure, GCP via service account credentials
181
+ - **Credential-less Discovery**: Agent-based (ACC-M) for environments without shared credentials
182
+
183
+ ### CMDB Health
184
+ - **Data Completeness**: Percentage of required fields populated per CI class
185
+ - **Staleness**: CIs not updated within defined threshold (e.g., 30 days)
186
+ - **Orphan CIs**: CIs with no relationships (isolated in the graph)
187
+ - **Relationship Density**: Average relationships per CI; low density indicates poor mapping
188
+ - **Compliance Score**: Combined metric of completeness + freshness + relationship health
189
+ - **Duplicate Rate**: Percentage of CIs flagged as potential duplicates
190
+ `;
191
+ export const GLIDE_QUERY_PATTERNS = `
192
+ ## Glide Query Patterns — Platform Reference
193
+
194
+ ### GlideQuery (Modern — Preferred for new development, scoped apps)
195
+ \`\`\`javascript
196
+ // Basic select
197
+ var results = new GlideQuery('incident')
198
+ .where('priority', 1)
199
+ .where('state', '!=', 6)
200
+ .orderByDesc('sys_created_on')
201
+ .select('number', 'short_description', 'caller_id$DISPLAY')
202
+ .toArray(100);
203
+
204
+ // Select one record
205
+ var record = new GlideQuery('sys_user')
206
+ .where('user_name', 'admin')
207
+ .selectOne('sys_id', 'name', 'email')
208
+ .orElse({ name: 'Not found' });
209
+
210
+ // Aggregates
211
+ var counts = new GlideQuery('incident')
212
+ .where('state', '!=', 7)
213
+ .aggregate('COUNT')
214
+ .groupBy('priority')
215
+ .select();
216
+
217
+ // Insert
218
+ var sysId = new GlideQuery('incident')
219
+ .insert({
220
+ short_description: 'New incident',
221
+ caller_id: callerSysId,
222
+ priority: 3
223
+ })
224
+ .get('sys_id');
225
+
226
+ // Update (returns count of updated records)
227
+ new GlideQuery('incident')
228
+ .where('sys_id', incidentId)
229
+ .update({ state: 2, assigned_to: userSysId });
230
+
231
+ // Null checks
232
+ new GlideQuery('cmdb_ci')
233
+ .whereNull('assigned_to')
234
+ .whereNotNull('name')
235
+ .select('name')
236
+ .toArray(50);
237
+
238
+ // Disable business rules for bulk operations
239
+ new GlideQuery('table').disableWorkflow().where(...).update({...});
240
+ \`\`\`
241
+
242
+ ### GlideRecord (Legacy — still dominant in global scope and existing code)
243
+ \`\`\`javascript
244
+ // Basic query
245
+ var gr = new GlideRecord('incident');
246
+ gr.addQuery('priority', 1);
247
+ gr.addQuery('state', '!=', 6);
248
+ gr.orderByDesc('sys_created_on');
249
+ gr.setLimit(100);
250
+ gr.query();
251
+ while (gr.next()) {
252
+ var number = gr.getValue('number');
253
+ var desc = gr.getDisplayValue('short_description');
254
+ }
255
+
256
+ // Encoded query (complex conditions)
257
+ var gr = new GlideRecord('incident');
258
+ gr.addEncodedQuery('priority=1^stateNOT IN6,7^sys_created_on>=javascript:gs.daysAgo(30)');
259
+ gr.query();
260
+
261
+ // Get single record
262
+ var gr = new GlideRecord('incident');
263
+ if (gr.get('number', 'INC0010001')) {
264
+ // record found
265
+ }
266
+ \`\`\`
267
+
268
+ ### Best Practices
269
+ - **Use getDisplayValue()** for reference fields, choice fields (returns label not sys_id)
270
+ - **Use getValue()** when you need the raw stored value (sys_id, integer, etc.)
271
+ - **Always setLimit()** before query() to prevent unbounded result sets
272
+ - **getRowCount() is expensive** — it queries all rows; use GlideAggregate COUNT instead
273
+ - **addEncodedQuery** for complex OR conditions, date math, CONTAINS, STARTSWITH
274
+ - **toString() caution**: gr.field returns GlideElement, not string; use getValue() or toString()
275
+
276
+ ### GlideAggregate
277
+ \`\`\`javascript
278
+ var ga = new GlideAggregate('incident');
279
+ ga.addQuery('active', true);
280
+ ga.addAggregate('COUNT');
281
+ ga.addAggregate('AVG', 'reassignment_count');
282
+ ga.groupBy('priority');
283
+ ga.query();
284
+ while (ga.next()) {
285
+ var priority = ga.getValue('priority');
286
+ var count = ga.getAggregate('COUNT');
287
+ var avgReassign = ga.getAggregate('AVG', 'reassignment_count');
288
+ }
289
+ \`\`\`
290
+
291
+ ### GlideAjax (Client-to-Server round-trip)
292
+ \`\`\`javascript
293
+ // Client-side call
294
+ var ga = new GlideAjax('MyScriptInclude');
295
+ ga.addParam('sysparm_name', 'myMethod');
296
+ ga.addParam('sysparm_my_param', 'value');
297
+ ga.getXMLAnswer(function(answer) {
298
+ // answer is the string returned by the script include
299
+ var result = JSON.parse(answer);
300
+ });
301
+
302
+ // Server-side Script Include (must extend AbstractAjaxProcessor)
303
+ var MyScriptInclude = Class.create();
304
+ MyScriptInclude.prototype = Object.extendsObject(AbstractAjaxProcessor, {
305
+ myMethod: function() {
306
+ var param = this.getParameter('sysparm_my_param');
307
+ return JSON.stringify({ success: true, data: param });
308
+ },
309
+ type: 'MyScriptInclude'
310
+ });
311
+ \`\`\`
312
+ `;
313
+ export const COMMON_ANTI_PATTERNS = `
314
+ ## Common ServiceNow Anti-Patterns — Reference
315
+
316
+ ### Query Anti-Patterns
317
+ - **GlideRecord in a loop (N+1 problem)**: Each iteration fires a separate SQL query.
318
+ Fix: Use addEncodedQuery with IN operator, or GlideQuery with a single query returning all needed records.
319
+ - **No query limit**: Unbounded queries can return millions of rows, causing performance degradation and timeouts.
320
+ Fix: Always call setLimit() or use .toArray(maxCount) with GlideQuery.
321
+ - **getRowCount() for existence check**: Queries ALL matching rows just to check if any exist.
322
+ Fix: Use setLimit(1) + query() + hasNext(), or GlideQuery .selectOne().isPresent().
323
+ - **String concatenation for queries**: Building query strings manually is error-prone and vulnerable to injection.
324
+ Fix: Use addQuery(), addOrCondition(), or addEncodedQuery() with proper escaping.
325
+ - **SELECT * pattern**: Retrieving all fields when only a few are needed wastes memory and bandwidth.
326
+ Fix: Use GlideQuery .select('field1', 'field2') or setDisplayValue(false) with specific getValue() calls.
327
+
328
+ ### Scripting Anti-Patterns
329
+ - **Hardcoded sys_ids**: Break across instances (dev/test/prod) and upgrades.
330
+ Fix: Use system properties (gs.getProperty), GlideRecord lookups by name, or sys_properties.
331
+ - **eval() usage**: Severe security risk; allows arbitrary code execution.
332
+ Fix: Never use eval(). Use JSON.parse() for data, function references for dynamic dispatch.
333
+ - **gs.print() in production**: Writes to system log inefficiently, not filterable.
334
+ Fix: Use gs.log(), gs.debug(), gs.info(), gs.warn(), gs.error() with source parameter.
335
+ - **current.update() in Before business rules**: Triggers another update, causing infinite recursion.
336
+ Fix: Set field values directly on current (current.field = value); the platform saves automatically in Before rules.
337
+ - **Synchronous GlideAjax**: Blocks the browser UI thread, causes freezing.
338
+ Fix: Always use getXMLAnswer(callback) or getXMLWait() with async patterns.
339
+ - **Direct DOM manipulation in client scripts**: Breaks on form redesign, not upgrade-safe.
340
+ Fix: Use g_form API exclusively (setValue, setDisplay, setVisible, setMandatory, etc.).
341
+
342
+ ### Business Rule Anti-Patterns
343
+ - **No condition on business rule**: Fires on EVERY insert/update/delete regardless of relevance.
344
+ Fix: Always set a condition (filter or script condition) to narrow execution scope.
345
+ - **Heavy computation in synchronous rules**: Blocks the user transaction, causes slow form saves.
346
+ Fix: Move heavy logic to async business rules or Flow Designer scheduled flows.
347
+ - **Not using setWorkflow(false)**: Bulk operations without disabling business rules cause cascading performance issues.
348
+ Fix: Call gr.setWorkflow(false) for bulk data loads; re-enable after.
349
+
350
+ ### Architecture Anti-Patterns
351
+ - **Business logic in UI policies**: UI policies are client-only; logic can be bypassed via API, imports, or scripting.
352
+ Fix: Enforce logic in business rules (server-side) and use UI policies only for form UX.
353
+ - **Excessive client scripts**: Too many onChange/onLoad scripts slow form rendering.
354
+ Fix: Consolidate into fewer scripts; use UI policies for simple show/hide/mandatory.
355
+ - **Not using update sets**: Making changes directly in production without tracking.
356
+ Fix: Always use update sets; move changes through dev -> test -> prod pipeline.
357
+ - **Circular references in script includes**: Script Include A calls B which calls A.
358
+ Fix: Refactor to remove circular dependency; use a shared utility Script Include.
359
+ `;
360
+ export const API_REFERENCE = `
361
+ ## ServiceNow API Quick Reference
362
+
363
+ ### g_form (Client-Side Form API)
364
+ - **Get/Set Values**: getValue(field), setValue(field, value), clearValue(field)
365
+ - **Display Control**: setDisplay(field, bool), setVisible(field, bool), setReadOnly(field, bool),
366
+ setMandatory(field, bool), setDisabled(field, bool)
367
+ - **Labels/Options**: setLabel(field, label), getLabelOf(field), addOption(field, value, label),
368
+ removeOption(field, value), clearOptions(field), getOption(field, value)
369
+ - **Messages**: showFieldMsg(field, msg, type), hideFieldMsg(field), hideAllFieldMsgs(),
370
+ addInfoMessage(msg), addErrorMessage(msg), clearMessages()
371
+ - **References**: getReference(field, callback) — async; returns GlideRecord of referenced record
372
+ - **Visual**: flash(field, color, count), setSectionDisplay(section, bool)
373
+ - **State**: isNewRecord(), isDatabaseReady(), isLiveUpdating(), isMandatory(field), isReadOnly(field)
374
+ - **Sections**: getSections(), setSectionDisplay(sectionName, display), isSectionVisible(sectionName)
375
+ - **Save**: save(), submit()
376
+
377
+ ### g_list (Client-Side List API)
378
+ - **Get Info**: getQuery(), getTableName(), getTitle(), getOrderBy(), getGroupBy()
379
+ - **Set Info**: setQuery(encodedQuery), setOrderBy(orderBy), setGroupBy(groupBy)
380
+ - **Refresh**: refresh(), refreshWithOrderBy(orderBy)
381
+ - **Row Count**: getRowCount(), getTotalRows()
382
+
383
+ ### GlideRecord (Server-Side Record API)
384
+ - **Query Building**: addQuery(field, operator, value), addOrCondition(field, operator, value),
385
+ addEncodedQuery(query), addNullQuery(field), addNotNullQuery(field), orderBy(field),
386
+ orderByDesc(field), setLimit(max), chooseWindow(start, end)
387
+ - **Execution**: query(), next(), hasNext(), get(sysId), get(field, value)
388
+ - **CRUD**: insert(), update(), deleteRecord(), deleteMultiple(), initialize(), newRecord()
389
+ - **Field Access**: getValue(field), setValue(field, value), getDisplayValue(field),
390
+ getElement(field), getUniqueValue(), getRecordClassName(), getTableName()
391
+ - **Security**: canRead(), canWrite(), canCreate(), canDelete(), setAbortAction(bool)
392
+ - **Workflow**: setWorkflow(bool), autoSysFields(bool), setForceUpdate(bool)
393
+ - **Utility**: getEncodedQuery(), getRowCount(), getLink(noStack), getClassDisplayValue(),
394
+ isValid(), isValidField(field), isNewRecord(), isActionAborted(), hasAttachments()
395
+
396
+ ### GlideSystem — gs (Server-Side System API)
397
+ - **User Context**: getUserID(), getUserName(), getUser().getFullName(), hasRole(role),
398
+ hasRoleInGroup(role, groupSysId), isLoggedIn(), isInteractive(), getSession()
399
+ - **Date/Time**: beginningOfToday(), endOfToday(), beginningOfYesterday(), endOfYesterday(),
400
+ daysAgo(days), daysAgoStart(days), daysAgoEnd(days), hoursAgo(hours), minutesAgo(minutes),
401
+ monthsAgo(months), quartersAgo(quarters), yearsAgo(years), now(), nowDateTime(),
402
+ dateGenerate(date, range)
403
+ - **Logging**: log(msg, source), debug(msg, source), info(msg, source), warn(msg, source),
404
+ error(msg, source)
405
+ - **Messages**: addInfoMessage(msg), addErrorMessage(msg)
406
+ - **Properties**: getProperty(name, defaultValue), setProperty(name, value, description)
407
+ - **Utility**: nil(obj), include(scriptIncludeName), tableExists(tableName),
408
+ generateGUID(), getDisplayColumn(table), eventQueue(eventName, gr, parm1, parm2),
409
+ sleep(ms), urlEncode(url), urlDecode(url), xmlToJSON(xml), base64Encode(str), base64Decode(str)
410
+ - **Scoped**: getCallerScopeName(), getCurrentScopeName()
411
+
412
+ ### GlideQuery (Server-Side Modern Query API)
413
+ - **Build**: new GlideQuery(table), where(field, operator, value), whereNull(field),
414
+ whereNotNull(field), orWhere(field, operator, value)
415
+ - **Order**: orderBy(field), orderByDesc(field), limit(count)
416
+ - **Execute**: select(field1, field2, ...), selectOne(field1, ...), toArray(maxCount)
417
+ - **Aggregate**: aggregate(operation, field), groupBy(field), having(operation, field, operator, value)
418
+ - **Mutate**: insert(record), update(record), updateMultiple(record), deleteMultiple()
419
+ - **Control**: disableWorkflow(), withAcls(), forceUpdate()
420
+ - **Optional (selectOne result)**: get(field), isPresent(), isEmpty(), orElse(default),
421
+ ifPresent(callback), map(callback), flatMap(callback)
422
+
423
+ ### $sp (Portal Server-Side API)
424
+ - getParameter(name), getPortalRecord(), getUser(), getUserInitials()
425
+ - getWidget(widgetSysId, options), getWidgetFromInstance(instanceSysId)
426
+ - getStream(table, sysId), getValues(gr, fieldString)
427
+ - setRedirectURL(url), getDisplayValue(field)
428
+ - getInstanceRecord(), getRecordElements(gr, fieldNames)
429
+ - getKBCategoryArticles(kbSysId, categorySysId), getKBCount(kbSysId)
430
+
431
+ ### spUtil (Portal Client-Side Utility)
432
+ - update(widget) — send c.data to server and refresh
433
+ - get(widgetSysId, options) — fetch widget model from server
434
+ - addInfoMessage(msg), addErrorMessage(msg), addTrivialMessage(msg)
435
+ - createChangeHandler(scope, dataObject, callback)
436
+ - recordWatch(scope, table, filter, callback) — real-time record updates
437
+ - format(templateString, dataObject) — string interpolation
438
+ `;
439
+ export const CATALOG_KNOWLEDGE = `
440
+ ## Service Catalog — Platform Reference
441
+
442
+ ### Catalog Structure
443
+ - **Catalog** (sc_catalog): Top-level container; an instance can have multiple catalogs
444
+ - **Category** (sc_category): Organizational grouping within a catalog; supports nesting (parent/child)
445
+ - **Item** (sc_cat_item): Orderable service; can be Record Producer, Order Guide, or standard item
446
+ - **Variable Set** (item_option_new_set): Reusable group of variables shared across items
447
+ - **Variable** (item_option_new): Individual form field on a catalog item
448
+
449
+ ### Variable Types
450
+ - **Text**: Single Line Text (string), Multi-Line Text (textarea), Email, URL, IP Address
451
+ - **Numeric**: Integer, Decimal, Currency, Duration, Percent
452
+ - **Selection**: Select Box (dropdown), Radio Button, Checkbox, Lookup Select Box (query-driven dropdown)
453
+ - **Reference Types**: Reference (single record), List Collector (multi-select reference)
454
+ - **Date Types**: Date, Date/Time, Time
455
+ - **Rich Content**: HTML, Label (read-only text), Macro, Macro with Label
456
+ - **Layout**: Container Start, Container End, Container Split (visual grouping)
457
+ - **Advanced**: Multi-Row Variable Set (MRVS — repeatable row groups), Requested For,
458
+ Masked (password-type), Custom (UI Macro based)
459
+
460
+ ### Variable Attributes (Semicolon-delimited on variable record)
461
+ - ref_qual_elements=field: Dynamic reference qualifier based on another variable
462
+ - ref_auto_completer=AJAXTableCompleter: Auto-complete for reference fields
463
+ - max_length=100: Character limit for text fields
464
+ - default_value=value: Pre-populated value
465
+ - hidden=true: Hide from form (still submitted)
466
+ - read_only=true: Display but not editable
467
+ - mandatory=true: Require before submission
468
+ - include_none=true: Add "-- None --" option to select boxes
469
+ - glide_list=true: Enable comma-separated multi-value entry
470
+ - no_filter=true: Disable list filter on reference fields
471
+
472
+ ### Request Model (Fulfillment Chain)
473
+ - **sc_request**: Parent request record (one per cart checkout)
474
+ - **sc_req_item** (RITM): One per catalog item ordered; contains variable values
475
+ - **sc_task**: Fulfillment tasks generated from the RITM; assigned to groups
476
+ - **Flow**: sc_req_item triggers fulfillment flow (preferred) or legacy workflow
477
+
478
+ ### Approval Engine
479
+ - **Approval Rules** (sysapproval_approver): Define who approves and under what conditions
480
+ - **States**: Not Yet Requested -> Requested -> Approved / Rejected / Cancelled
481
+ - **Types**: User approval, Group approval (any member can act), Scripted approval
482
+ - **Generated vs Required**: Generated = system-created; Required = manually added
483
+ - **Approval Policies**: Anyone (first responder), Everyone (unanimous), Majority (>50%)
484
+
485
+ ### Fulfillment
486
+ - **Flow Designer** (preferred): Trigger on sc_req_item insert; automate task creation, notifications
487
+ - **Workflow** (legacy): Visual workflow editor; being replaced by Flow Designer
488
+ - **Direct Task Creation**: Execution plan creates sc_task records automatically
489
+
490
+ ### Catalog Client Scripts
491
+ - **onChange**: Fires when a variable value changes; receives variableName, oldValue, newValue
492
+ Use: Cascade variable values, dynamic filtering, show/hide variables
493
+ - **onLoad**: Fires when the catalog item form loads
494
+ Use: Set default values, initialize variable states, hide sections
495
+ - **onSubmit**: Fires on form submission; return false to prevent submit
496
+ Use: Validation, confirmation dialogs, data formatting
497
+
498
+ ### Catalog UI Policies
499
+ - Conditions based on variable values (no scripting needed for simple cases)
500
+ - Actions: Set mandatory, set visible, set read-only on target variables
501
+ - Reverse if false: Automatically undo actions when condition no longer met
502
+ - Script-based: Advanced conditions via script expression for complex logic
503
+ - Run on load: Execute policy when form first opens (not just on change)
504
+ `;
505
+ export const REST_API_KNOWLEDGE = `
506
+ ## REST API — Platform Reference
507
+
508
+ ### Scripted REST API Structure
509
+ - **API Definition** (sys_ws_definition): Top-level API with base path, namespace, version
510
+ - Path: /api/{namespace}/{api_id}/v{version}
511
+ - Namespace: Scoped app namespace (e.g., x_myapp) or global (now)
512
+ - **Resource** (sys_ws_operation): Individual endpoint within an API
513
+ - Path: Relative to API base; supports path parameters with {param_name}
514
+ - HTTP Method: GET, POST, PUT, PATCH, DELETE (one method per resource)
515
+
516
+ ### Request Object (Scripted REST)
517
+ \`\`\`javascript
518
+ // Path parameters: /api/x_app/users/{user_id}
519
+ var userId = request.pathParams.user_id;
520
+
521
+ // Query parameters: ?active=true&limit=10
522
+ var active = request.queryParams.active;
523
+ var limit = request.queryParams.limit;
524
+
525
+ // Request body (POST/PUT/PATCH)
526
+ var body = request.body.data; // Parsed JSON object
527
+ var rawBody = request.body.dataString; // Raw string
528
+
529
+ // Headers
530
+ var authHeader = request.getHeader('Authorization');
531
+ var contentType = request.getHeader('Content-Type');
532
+
533
+ // Request metadata
534
+ var method = request.getMethod(); // GET, POST, etc.
535
+ var uri = request.uri;
536
+ var queryString = request.queryString;
537
+ \`\`\`
538
+
539
+ ### Response Object (Scripted REST)
540
+ \`\`\`javascript
541
+ // Set status code
542
+ response.setStatus(200); // 200 OK, 201 Created, 204 No Content, etc.
543
+
544
+ // Set response body
545
+ response.setBody({
546
+ result: { id: sysId, name: name },
547
+ status: 'success'
548
+ });
549
+
550
+ // Set headers
551
+ response.setHeader('X-Custom-Header', 'value');
552
+ response.setContentType('application/json');
553
+
554
+ // Streaming (large responses)
555
+ var writer = response.getStreamWriter();
556
+ writer.writeString('data chunk');
557
+ \`\`\`
558
+
559
+ ### Error Handling
560
+ \`\`\`javascript
561
+ // Built-in error classes (sn_ws_err namespace)
562
+ throw new sn_ws_err.NotFoundError('Record not found'); // 404
563
+ throw new sn_ws_err.BadRequestError('Invalid input'); // 400
564
+ throw new sn_ws_err.ServiceError('Internal error'); // 500
565
+ throw new sn_ws_err.UnsupportedMediaTypeError('Use JSON'); // 415
566
+ throw new sn_ws_err.ConflictError('Record already exists'); // 409
567
+
568
+ // Custom error with details
569
+ var error = new sn_ws_err.ServiceError();
570
+ error.setStatus(422);
571
+ error.setMessage('Validation failed');
572
+ error.setDetail('Field "name" is required');
573
+ throw error;
574
+ \`\`\`
575
+
576
+ ### Authentication Methods
577
+ - **Basic Authentication**: Username/password in Authorization header (Base64)
578
+ - **OAuth 2.0**: Client credentials, authorization code, or refresh token grant
579
+ - Token endpoint: /oauth_token.do
580
+ - Authorize endpoint: /oauth_auth.do
581
+ - **API Key**: Custom header (x-api-key) validated in Scripted REST preprocessing
582
+ - **Mutual TLS**: Client certificate authentication for high-security integrations
583
+ - **Session-based**: Cookie-based (jsessionid) for browser clients after login
584
+
585
+ ### Versioning
586
+ - Path-based: /api/x_scope/v1/resource vs /api/x_scope/v2/resource
587
+ - Each version is a separate API definition or resource set
588
+ - Maintain backward compatibility; deprecate old versions with sunset headers
589
+
590
+ ### Best Practices
591
+ - **Input Validation**: Always validate request body fields, types, and ranges before processing
592
+ - **Try-Catch**: Wrap all logic in try-catch; return consistent error format
593
+ - **Status Codes**: Use correct HTTP status codes (200, 201, 204, 400, 401, 403, 404, 409, 500)
594
+ - **Pagination**: Support limit and offset query params; return total count and next/prev links
595
+ - response.setBody({ result: records, meta: { total: count, limit: limit, offset: offset } })
596
+ - **ETags**: Return ETag header for cacheable responses; support If-None-Match for conditional requests
597
+ - **Rate Limiting**: Configure via system property glide.rest.rate_limit.* or custom Scripted REST logic
598
+ - **CORS**: Configure via sys_cors_rule; specify allowed origins, methods (GET, POST, etc.), headers
599
+ - Preflight: OPTIONS request auto-handled when CORS rule exists
600
+ - Credentials: Set allow_credentials to true for cookie-based auth from browsers
601
+ - **Security**: Never expose internal sys_ids unnecessarily; use display values or mapped identifiers
602
+ - **Logging**: Log request/response in Scripted REST for debugging; use gs.debug() not gs.log()
603
+ `;
604
+ //# sourceMappingURL=knowledge.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"knowledge.js","sourceRoot":"","sources":["../../src/prompts/knowledge.ts"],"names":[],"mappings":"AAAA,gFAAgF;AAChF,sEAAsE;AACtE,gFAAgF;AAChF,2EAA2E;AAC3E,4EAA4E;AAC5E,gFAAgF;AAEhF,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyCtC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+CtC,CAAC;AAEF,MAAM,CAAC,MAAM,uBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6CtC,CAAC;AAEF,MAAM,CAAC,MAAM,cAAc,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+C7B,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAyHnC,CAAC;AAEF,MAAM,CAAC,MAAM,oBAAoB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8CnC,CAAC;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8E5B,CAAC;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAiEhC,CAAC;AAEF,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAkGjC,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * NowAIKit — Capability type definitions.
3
+ *
4
+ * Capabilities are user-facing commands (/scan-health, /review-code, etc.)
5
+ * backed by domain expertise. Exposed as MCP prompts.
6
+ */
7
+ /** Capability category — determines command grouping. */
8
+ export type CapabilityCategory = 'scan' | 'review' | 'build' | 'ops' | 'docs';
9
+ /** A single message in an MCP prompt conversation. */
10
+ export interface AgentMessage {
11
+ role: 'user' | 'assistant';
12
+ content: {
13
+ type: 'text';
14
+ text: string;
15
+ };
16
+ }
17
+ /** A capability definition. Each file in capabilities/ exports one. */
18
+ export interface CapabilityDefinition {
19
+ /** MCP prompt name (e.g. "scan-health", "review-code", "build-app"). */
20
+ name: string;
21
+ /** Human-readable title. */
22
+ title: string;
23
+ /** One-line description for prompt listings. */
24
+ description: string;
25
+ /** Category for grouping in CLI list. */
26
+ category: CapabilityCategory;
27
+ /** Optional user-supplied arguments. */
28
+ arguments?: Array<{
29
+ name: string;
30
+ description: string;
31
+ required?: boolean;
32
+ }>;
33
+ /** Tool names this capability commonly uses. */
34
+ recommendedTools?: string[];
35
+ /** Build the multi-message prompt. */
36
+ buildPrompt: (args?: Record<string, string>) => AgentMessage[];
37
+ }
38
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/prompts/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,yDAAyD;AACzD,MAAM,MAAM,kBAAkB,GAAG,MAAM,GAAG,QAAQ,GAAG,OAAO,GAAG,KAAK,GAAG,MAAM,CAAC;AAE9E,sDAAsD;AACtD,MAAM,WAAW,YAAY;IAC3B,IAAI,EAAE,MAAM,GAAG,WAAW,CAAC;IAC3B,OAAO,EAAE;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAC;CACzC;AAED,uEAAuE;AACvE,MAAM,WAAW,oBAAoB;IACnC,wEAAwE;IACxE,IAAI,EAAE,MAAM,CAAC;IACb,4BAA4B;IAC5B,KAAK,EAAE,MAAM,CAAC;IACd,gDAAgD;IAChD,WAAW,EAAE,MAAM,CAAC;IACpB,yCAAyC;IACzC,QAAQ,EAAE,kBAAkB,CAAC;IAC7B,wCAAwC;IACxC,SAAS,CAAC,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,WAAW,EAAE,MAAM,CAAC;QAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;KAAE,CAAC,CAAC;IAC7E,gDAAgD;IAChD,gBAAgB,CAAC,EAAE,MAAM,EAAE,CAAC;IAC5B,sCAAsC;IACtC,WAAW,EAAE,CAAC,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,KAAK,YAAY,EAAE,CAAC;CAChE"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * NowAIKit — Capability type definitions.
3
+ *
4
+ * Capabilities are user-facing commands (/scan-health, /review-code, etc.)
5
+ * backed by domain expertise. Exposed as MCP prompts.
6
+ */
7
+ export {};
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/prompts/types.ts"],"names":[],"mappings":"AAAA;;;;;GAKG"}