ultravisor 1.0.3 → 1.0.8

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 (248) hide show
  1. package/.claude/launch.json +11 -0
  2. package/.claude/ultravisor-dev-config.json +3 -0
  3. package/card-audit.json +1545 -0
  4. package/docs/_sidebar.md +17 -0
  5. package/docs/css/docuserve.css +73 -0
  6. package/docs/features/beacon-authentication.md +209 -0
  7. package/docs/features/beacon-providers.md +1299 -0
  8. package/docs/features/beacons.md +530 -0
  9. package/docs/features/capabilities.md +193 -0
  10. package/docs/features/llm-model-setup.md +505 -0
  11. package/docs/features/llm.md +262 -0
  12. package/docs/features/tasks-content-system.md +110 -0
  13. package/docs/features/tasks-data-transform.md +233 -0
  14. package/docs/features/tasks-extension.md +36 -0
  15. package/docs/features/tasks-file-system.md +203 -0
  16. package/docs/features/tasks-flow-control.md +125 -0
  17. package/docs/features/tasks-http-client.md +119 -0
  18. package/docs/features/tasks-llm.md +118 -0
  19. package/docs/features/tasks-meadow-api.md +163 -0
  20. package/docs/features/tasks-user-interaction.md +49 -0
  21. package/docs/features/tasks.md +14 -0
  22. package/docs/index.html +1 -1
  23. package/docs/retold-catalog.json +1 -1
  24. package/docs/retold-keyword-index.json +17374 -5
  25. package/operation-library/api-data-pipeline.json +143 -0
  26. package/operation-library/beacon-remote-command.json +72 -0
  27. package/operation-library/conditional-file-backup.json +143 -0
  28. package/operation-library/config-processor.json +136 -0
  29. package/operation-library/csv-data-analysis.json +228 -0
  30. package/operation-library/csv-to-json.json +160 -0
  31. package/operation-library/directory-inventory.json +128 -0
  32. package/operation-library/expression-calculator.json +114 -0
  33. package/operation-library/file-search-replace.json +175 -0
  34. package/operation-library/git-status-report.json +368 -0
  35. package/operation-library/health-check-ping.json +329 -0
  36. package/operation-library/json-config-merge.json +313 -0
  37. package/operation-library/llm-embedding-tool-use.json +314 -0
  38. package/operation-library/llm-multi-turn-analysis.json +322 -0
  39. package/operation-library/llm-summarize.json +264 -0
  40. package/operation-library/log-line-counter.json +185 -0
  41. package/operation-library/meadow-crud-lifecycle.json +264 -0
  42. package/operation-library/npm-project-validator.json +193 -0
  43. package/operation-library/rest-api-orchestrator.json +218 -0
  44. package/operation-library/shell-system-info.json +137 -0
  45. package/operation-library/simple-echo.json +95 -0
  46. package/operation-library/template-processor.json +299 -0
  47. package/operation-library/text-sanitizer.json +176 -0
  48. package/package.json +12 -8
  49. package/source/Ultravisor.cjs +30 -3
  50. package/source/beacon/Ultravisor-Beacon-CLI.cjs +143 -0
  51. package/source/beacon/Ultravisor-Beacon-CapabilityProvider.cjs +129 -0
  52. package/source/beacon/Ultravisor-Beacon-Client.cjs +568 -0
  53. package/source/beacon/Ultravisor-Beacon-Executor.cjs +500 -0
  54. package/source/beacon/Ultravisor-Beacon-ProviderRegistry.cjs +330 -0
  55. package/source/beacon/providers/Ultravisor-Beacon-Provider-FileSystem.cjs +331 -0
  56. package/source/beacon/providers/Ultravisor-Beacon-Provider-LLM.cjs +966 -0
  57. package/source/beacon/providers/Ultravisor-Beacon-Provider-Shell.cjs +95 -0
  58. package/source/cli/Ultravisor-CLIProgram.cjs +44 -22
  59. package/source/cli/commands/Ultravisor-Command-SingleOperation.cjs +29 -18
  60. package/source/cli/commands/Ultravisor-Command-SingleTask.cjs +62 -19
  61. package/source/cli/commands/Ultravisor-Command-UpdateTask.cjs +27 -15
  62. package/source/config/Ultravisor-Default-Command-Configuration.cjs +12 -3
  63. package/source/services/Ultravisor-Beacon-Coordinator.cjs +966 -0
  64. package/source/services/Ultravisor-ExecutionEngine.cjs +1093 -0
  65. package/source/services/Ultravisor-ExecutionManifest.cjs +629 -0
  66. package/source/services/Ultravisor-Hypervisor-State.cjs +270 -97
  67. package/source/services/Ultravisor-Hypervisor.cjs +185 -75
  68. package/source/services/Ultravisor-Schedule-Persistence-Base.cjs +45 -0
  69. package/source/services/Ultravisor-StateManager.cjs +253 -0
  70. package/source/services/Ultravisor-TaskTypeRegistry.cjs +213 -0
  71. package/source/services/persistence/Ultravisor-Schedule-Persistence-JSONFile.cjs +140 -0
  72. package/source/services/tasks/Ultravisor-BuiltIn-TaskConfigs.cjs +19 -0
  73. package/source/services/tasks/Ultravisor-TaskHelper-BeaconDispatch.cjs +107 -0
  74. package/source/services/tasks/Ultravisor-TaskType-Base.cjs +125 -0
  75. package/source/services/tasks/content-system/Ultravisor-TaskConfigs-ContentSystem.cjs +90 -0
  76. package/source/services/tasks/content-system/definitions/content-create-folder.json +24 -0
  77. package/source/services/tasks/content-system/definitions/content-list-files.json +27 -0
  78. package/source/services/tasks/content-system/definitions/content-read-file.json +26 -0
  79. package/source/services/tasks/content-system/definitions/content-save-file.json +26 -0
  80. package/source/services/tasks/data-transform/Ultravisor-TaskConfigs-DataTransform.cjs +577 -0
  81. package/source/services/tasks/data-transform/Ultravisor-TaskType-ReplaceString.cjs +80 -0
  82. package/source/services/tasks/data-transform/Ultravisor-TaskType-SetValues.cjs +74 -0
  83. package/source/services/tasks/data-transform/Ultravisor-TaskType-StringAppender.cjs +90 -0
  84. package/source/services/tasks/data-transform/definitions/comprehension-intersect.json +24 -0
  85. package/source/services/tasks/data-transform/definitions/csv-transform.json +24 -0
  86. package/source/services/tasks/data-transform/definitions/expression-solver.json +20 -0
  87. package/source/services/tasks/data-transform/definitions/histogram.json +23 -0
  88. package/source/services/tasks/data-transform/definitions/parse-csv.json +27 -0
  89. package/source/services/tasks/data-transform/definitions/replace-string.json +27 -0
  90. package/source/services/tasks/data-transform/definitions/set-values.json +17 -0
  91. package/source/services/tasks/data-transform/definitions/string-appender.json +22 -0
  92. package/source/services/tasks/data-transform/definitions/template-string.json +20 -0
  93. package/source/services/tasks/extension/Ultravisor-TaskConfigs-Extension.cjs +87 -0
  94. package/source/services/tasks/extension/definitions/beacon-dispatch.json +32 -0
  95. package/source/services/tasks/file-system/Ultravisor-TaskConfigs-FileSystem.cjs +509 -0
  96. package/source/services/tasks/file-system/Ultravisor-TaskType-ReadFile.cjs +96 -0
  97. package/source/services/tasks/file-system/Ultravisor-TaskType-ReadFileBuffered.cjs +123 -0
  98. package/source/services/tasks/file-system/Ultravisor-TaskType-WriteFile.cjs +106 -0
  99. package/source/services/tasks/file-system/definitions/copy-file.json +27 -0
  100. package/source/services/tasks/file-system/definitions/list-files.json +27 -0
  101. package/source/services/tasks/file-system/definitions/read-file-buffered.json +31 -0
  102. package/source/services/tasks/file-system/definitions/read-file.json +26 -0
  103. package/source/services/tasks/file-system/definitions/read-json.json +23 -0
  104. package/source/services/tasks/file-system/definitions/write-file.json +29 -0
  105. package/source/services/tasks/file-system/definitions/write-json.json +30 -0
  106. package/source/services/tasks/flow-control/Ultravisor-TaskConfigs-FlowControl.cjs +353 -0
  107. package/source/services/tasks/flow-control/Ultravisor-TaskType-IfConditional.cjs +125 -0
  108. package/source/services/tasks/flow-control/Ultravisor-TaskType-LaunchOperation.cjs +186 -0
  109. package/source/services/tasks/flow-control/Ultravisor-TaskType-SplitExecute.cjs +164 -0
  110. package/source/services/tasks/flow-control/definitions/if-conditional.json +25 -0
  111. package/source/services/tasks/flow-control/definitions/launch-operation.json +27 -0
  112. package/source/services/tasks/flow-control/definitions/split-execute.json +32 -0
  113. package/source/services/tasks/http-client/Ultravisor-TaskConfigs-HttpClient.cjs +281 -0
  114. package/source/services/tasks/http-client/definitions/get-json.json +26 -0
  115. package/source/services/tasks/http-client/definitions/get-text.json +26 -0
  116. package/source/services/tasks/http-client/definitions/rest-request.json +32 -0
  117. package/source/services/tasks/http-client/definitions/send-json.json +28 -0
  118. package/source/services/tasks/llm/Ultravisor-TaskConfigs-LLM.cjs +605 -0
  119. package/source/services/tasks/llm/definitions/llm-chat-completion.json +46 -0
  120. package/source/services/tasks/llm/definitions/llm-embedding.json +31 -0
  121. package/source/services/tasks/llm/definitions/llm-tool-use.json +42 -0
  122. package/source/services/tasks/meadow-api/Ultravisor-TaskConfigs-MeadowApi.cjs +341 -0
  123. package/source/services/tasks/meadow-api/definitions/meadow-count.json +26 -0
  124. package/source/services/tasks/meadow-api/definitions/meadow-create.json +26 -0
  125. package/source/services/tasks/meadow-api/definitions/meadow-delete.json +23 -0
  126. package/source/services/tasks/meadow-api/definitions/meadow-read.json +26 -0
  127. package/source/services/tasks/meadow-api/definitions/meadow-reads.json +29 -0
  128. package/source/services/tasks/meadow-api/definitions/meadow-update.json +26 -0
  129. package/source/services/tasks/shell/Ultravisor-TaskConfigs-Shell.cjs +63 -0
  130. package/source/services/tasks/shell/definitions/command.json +29 -0
  131. package/source/services/tasks/user-interaction/Ultravisor-TaskConfigs-UserInteraction.cjs +64 -0
  132. package/source/services/tasks/user-interaction/Ultravisor-TaskType-ErrorMessage.cjs +55 -0
  133. package/source/services/tasks/user-interaction/Ultravisor-TaskType-ValueInput.cjs +47 -0
  134. package/source/services/tasks/user-interaction/definitions/error-message.json +18 -0
  135. package/source/services/tasks/user-interaction/definitions/value-input.json +23 -0
  136. package/source/web_server/Ultravisor-API-Server.cjs +849 -124
  137. package/test/Ultravisor_browser_tests.js +2226 -0
  138. package/test/Ultravisor_operation_library_tests.js +894 -0
  139. package/test/Ultravisor_tests.js +4946 -5044
  140. package/test/workflows/test-content-concatenate-all.json +339 -0
  141. package/test/workflows/test-content-full-pipeline.json +159 -0
  142. package/test/workflows/test-content-list-files.json +76 -0
  143. package/test/workflows/test-content-save-and-read.json +106 -0
  144. package/webinterface/css/ultravisor-themes.css +668 -0
  145. package/webinterface/css/ultravisor.css +37 -14
  146. package/webinterface/docs/card-help/beacon-dispatch.md +30 -0
  147. package/webinterface/docs/card-help/command.md +27 -0
  148. package/webinterface/docs/card-help/comprehension-intersect.md +24 -0
  149. package/webinterface/docs/card-help/content-create-folder.md +22 -0
  150. package/webinterface/docs/card-help/content-list-files.md +25 -0
  151. package/webinterface/docs/card-help/content-read-file.md +24 -0
  152. package/webinterface/docs/card-help/content-save-file.md +24 -0
  153. package/webinterface/docs/card-help/copy-file.md +25 -0
  154. package/webinterface/docs/card-help/csv-transform.md +24 -0
  155. package/webinterface/docs/card-help/end.md +11 -0
  156. package/webinterface/docs/card-help/error-message.md +16 -0
  157. package/webinterface/docs/card-help/expression-solver.md +21 -0
  158. package/webinterface/docs/card-help/get-json.md +24 -0
  159. package/webinterface/docs/card-help/get-text.md +24 -0
  160. package/webinterface/docs/card-help/histogram.md +23 -0
  161. package/webinterface/docs/card-help/if-conditional.md +23 -0
  162. package/webinterface/docs/card-help/launch-operation.md +25 -0
  163. package/webinterface/docs/card-help/list-files.md +25 -0
  164. package/webinterface/docs/card-help/llm-chat-completion.md +43 -0
  165. package/webinterface/docs/card-help/llm-embedding.md +24 -0
  166. package/webinterface/docs/card-help/llm-tool-use.md +39 -0
  167. package/webinterface/docs/card-help/meadow-count.md +24 -0
  168. package/webinterface/docs/card-help/meadow-create.md +24 -0
  169. package/webinterface/docs/card-help/meadow-delete.md +19 -0
  170. package/webinterface/docs/card-help/meadow-read.md +24 -0
  171. package/webinterface/docs/card-help/meadow-reads.md +27 -0
  172. package/webinterface/docs/card-help/meadow-update.md +24 -0
  173. package/webinterface/docs/card-help/parse-csv.md +27 -0
  174. package/webinterface/docs/card-help/read-file-buffered.md +29 -0
  175. package/webinterface/docs/card-help/read-file.md +24 -0
  176. package/webinterface/docs/card-help/read-json.md +21 -0
  177. package/webinterface/docs/card-help/replace-string.md +25 -0
  178. package/webinterface/docs/card-help/rest-request.md +30 -0
  179. package/webinterface/docs/card-help/send-json.md +26 -0
  180. package/webinterface/docs/card-help/set-values.md +16 -0
  181. package/webinterface/docs/card-help/split-execute.md +35 -0
  182. package/webinterface/docs/card-help/start.md +11 -0
  183. package/webinterface/docs/card-help/string-appender.md +22 -0
  184. package/webinterface/docs/card-help/template-string.md +21 -0
  185. package/webinterface/docs/card-help/value-input.md +24 -0
  186. package/webinterface/docs/card-help/write-file.md +27 -0
  187. package/webinterface/docs/card-help/write-json.md +28 -0
  188. package/webinterface/html/index.html +5 -0
  189. package/webinterface/package.json +13 -4
  190. package/webinterface/source/Pict-Application-Ultravisor.js +564 -70
  191. package/webinterface/source/Ultravisor-TimingUtils.js +99 -0
  192. package/webinterface/source/card-help-content.js +46 -0
  193. package/webinterface/source/cards/Ultravisor-BuiltIn-CardConfigs.js +174 -0
  194. package/webinterface/source/cards/Ultravisor-CardConfigGenerator.js +431 -0
  195. package/webinterface/source/data/ExampleFlow-CSVPipeline.js +231 -0
  196. package/webinterface/source/data/ExampleFlow-FileProcessor.js +315 -0
  197. package/webinterface/source/data/ExampleFlow-MeadowPipeline.js +328 -0
  198. package/webinterface/source/panels/Ultravisor-CardSettingsPanel.js +902 -0
  199. package/webinterface/source/providers/PictRouter-Ultravisor-Configuration.json +20 -8
  200. package/webinterface/source/views/PictView-Ultravisor-BeaconList.js +817 -0
  201. package/webinterface/source/views/PictView-Ultravisor-BottomBar.js +5 -5
  202. package/webinterface/source/views/PictView-Ultravisor-Dashboard.js +25 -25
  203. package/webinterface/source/views/PictView-Ultravisor-Documentation.js +856 -0
  204. package/webinterface/source/views/PictView-Ultravisor-FlowEditor.js +777 -0
  205. package/webinterface/source/views/PictView-Ultravisor-ManifestList.js +321 -58
  206. package/webinterface/source/views/PictView-Ultravisor-OperationEdit.js +36 -91
  207. package/webinterface/source/views/PictView-Ultravisor-OperationList.js +388 -16
  208. package/webinterface/source/views/PictView-Ultravisor-PendingInput.js +314 -0
  209. package/webinterface/source/views/PictView-Ultravisor-Schedule.js +521 -65
  210. package/webinterface/source/views/PictView-Ultravisor-TimingView.js +333 -71
  211. package/webinterface/source/views/PictView-Ultravisor-TopBar.js +257 -21
  212. package/webinterface/theme-sampler.html +645 -0
  213. package/debug/Harness.js +0 -6
  214. package/source/services/Ultravisor-Operation-Manifest.cjs +0 -160
  215. package/source/services/Ultravisor-Operation.cjs +0 -200
  216. package/source/services/Ultravisor-Task.cjs +0 -349
  217. package/source/services/events/Ultravisor-Hypervisor-Event-Solver.cjs +0 -11
  218. package/source/services/tasks/Ultravisor-Task-Base.cjs +0 -264
  219. package/source/services/tasks/Ultravisor-Task-CollectValues.cjs +0 -188
  220. package/source/services/tasks/Ultravisor-Task-Command.cjs +0 -65
  221. package/source/services/tasks/Ultravisor-Task-CommandEach.cjs +0 -190
  222. package/source/services/tasks/Ultravisor-Task-Conditional.cjs +0 -104
  223. package/source/services/tasks/Ultravisor-Task-DateWindow.cjs +0 -72
  224. package/source/services/tasks/Ultravisor-Task-GeneratePagedOperation.cjs +0 -336
  225. package/source/services/tasks/Ultravisor-Task-LaunchOperation.cjs +0 -143
  226. package/source/services/tasks/Ultravisor-Task-LaunchTask.cjs +0 -146
  227. package/source/services/tasks/Ultravisor-Task-LineMatch.cjs +0 -158
  228. package/source/services/tasks/Ultravisor-Task-Request.cjs +0 -56
  229. package/source/services/tasks/Ultravisor-Task-Solver.cjs +0 -89
  230. package/source/services/tasks/Ultravisor-Task-TemplateString.cjs +0 -93
  231. package/source/services/tasks/rest/Ultravisor-Task-GetBinary.cjs +0 -127
  232. package/source/services/tasks/rest/Ultravisor-Task-GetJSON.cjs +0 -119
  233. package/source/services/tasks/rest/Ultravisor-Task-GetText.cjs +0 -109
  234. package/source/services/tasks/rest/Ultravisor-Task-GetXML.cjs +0 -112
  235. package/source/services/tasks/rest/Ultravisor-Task-RestRequest.cjs +0 -499
  236. package/source/services/tasks/rest/Ultravisor-Task-SendJSON.cjs +0 -150
  237. package/source/services/tasks/stagingfiles/Ultravisor-Task-CopyFile.cjs +0 -110
  238. package/source/services/tasks/stagingfiles/Ultravisor-Task-ListFiles.cjs +0 -89
  239. package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadBinary.cjs +0 -87
  240. package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadJSON.cjs +0 -67
  241. package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadText.cjs +0 -66
  242. package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadXML.cjs +0 -69
  243. package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteBinary.cjs +0 -95
  244. package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteJSON.cjs +0 -96
  245. package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteText.cjs +0 -99
  246. package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteXML.cjs +0 -102
  247. package/webinterface/source/views/PictView-Ultravisor-TaskEdit.js +0 -220
  248. package/webinterface/source/views/PictView-Ultravisor-TaskList.js +0 -248
@@ -0,0 +1,95 @@
1
+ /**
2
+ * Ultravisor Beacon Provider — Shell
3
+ *
4
+ * Built-in provider that executes shell commands via child_process.exec().
5
+ *
6
+ * Capability: 'Shell'
7
+ * Actions: 'Execute' — run a shell command with optional parameters.
8
+ *
9
+ * Provider config:
10
+ * MaxBufferBytes {number} — max stdout/stderr buffer (default: 10MB)
11
+ */
12
+
13
+ const libChildProcess = require('child_process');
14
+
15
+ const libBeaconCapabilityProvider = require('../Ultravisor-Beacon-CapabilityProvider.cjs');
16
+
17
+ class UltravisorBeaconProviderShell extends libBeaconCapabilityProvider
18
+ {
19
+ constructor(pProviderConfig)
20
+ {
21
+ super(pProviderConfig);
22
+
23
+ this.Name = 'Shell';
24
+ this.Capability = 'Shell';
25
+
26
+ this._MaxBufferBytes = this._ProviderConfig.MaxBufferBytes || 10485760;
27
+ }
28
+
29
+ get actions()
30
+ {
31
+ return {
32
+ 'Execute':
33
+ {
34
+ Description: 'Execute a shell command.',
35
+ SettingsSchema:
36
+ [
37
+ { Name: 'Command', DataType: 'String', Required: true, Description: 'The command to run' },
38
+ { Name: 'Parameters', DataType: 'String', Required: false, Description: 'Command-line arguments' }
39
+ ]
40
+ }
41
+ };
42
+ }
43
+
44
+ execute(pAction, pWorkItem, pContext, fCallback, fReportProgress)
45
+ {
46
+ let tmpSettings = pWorkItem.Settings || {};
47
+ let tmpCommand = tmpSettings.Command || '';
48
+ let tmpParameters = tmpSettings.Parameters || '';
49
+
50
+ if (!tmpCommand)
51
+ {
52
+ return fCallback(null, {
53
+ Outputs: { StdOut: 'No command specified.', ExitCode: -1, Result: '' },
54
+ Log: ['Shell Provider: no command specified.']
55
+ });
56
+ }
57
+
58
+ let tmpFullCommand = tmpParameters ? (tmpCommand + ' ' + tmpParameters) : tmpCommand;
59
+ let tmpTimeout = pWorkItem.TimeoutMs || 300000;
60
+
61
+ console.log(` [Shell] Running: ${tmpFullCommand}`);
62
+
63
+ libChildProcess.exec(tmpFullCommand,
64
+ {
65
+ cwd: pContext.StagingPath || process.cwd(),
66
+ timeout: tmpTimeout,
67
+ maxBuffer: this._MaxBufferBytes
68
+ },
69
+ function (pError, pStdOut, pStdErr)
70
+ {
71
+ if (pError)
72
+ {
73
+ return fCallback(null, {
74
+ Outputs: {
75
+ StdOut: (pStdOut || '') + (pStdErr || ''),
76
+ ExitCode: pError.code || 1,
77
+ Result: ''
78
+ },
79
+ Log: [`Command failed: ${pError.message}`, pStdErr || ''].filter(Boolean)
80
+ });
81
+ }
82
+
83
+ return fCallback(null, {
84
+ Outputs: {
85
+ StdOut: pStdOut || '',
86
+ ExitCode: 0,
87
+ Result: pStdOut || ''
88
+ },
89
+ Log: [`Command executed: ${tmpFullCommand}`]
90
+ });
91
+ });
92
+ }
93
+ }
94
+
95
+ module.exports = UltravisorBeaconProviderShell;
@@ -2,24 +2,26 @@ const libCLIProgram = require('pict-service-commandlineutility');
2
2
  const libFS = require('fs');
3
3
  const libPath = require('path');
4
4
 
5
- const libServiceHypervisor = require(`../services/Ultravisor-Hypervisor.cjs`);
6
- const libServiceHypervisorState = require(`../services/Ultravisor-Hypervisor-State.cjs`);
5
+ const libServiceHypervisor = require('../services/Ultravisor-Hypervisor.cjs');
6
+ const libServiceHypervisorState = require('../services/Ultravisor-Hypervisor-State.cjs');
7
7
 
8
- const libServiceHypervisorEventBase = require(`../services/Ultravisor-Hypervisor-Event-Base.cjs`);
9
- const libServiceHypervisorEventCron = require(`../services/events/Ultravisor-Hypervisor-Event-Cron.cjs`);
10
- const libServiceHypervisorEventSolver = require(`../services/events/Ultravisor-Hypervisor-Event-Solver.cjs`);
8
+ const libServiceHypervisorEventBase = require('../services/Ultravisor-Hypervisor-Event-Base.cjs');
9
+ const libServiceHypervisorEventCron = require('../services/events/Ultravisor-Hypervisor-Event-Cron.cjs');
11
10
 
12
- const libServiceOperation = require(`../services/Ultravisor-Operation.cjs`);
13
- const libServiceOperationManifest = require(`../services/Ultravisor-Operation-Manifest.cjs`);
11
+ const libServiceSchedulePersistenceBase = require('../services/Ultravisor-Schedule-Persistence-Base.cjs');
12
+ const libServiceSchedulePersistenceJSONFile = require('../services/persistence/Ultravisor-Schedule-Persistence-JSONFile.cjs');
14
13
 
15
- const libServiceTask = require(`../services/Ultravisor-Task.cjs`);
14
+ const libServiceTaskTypeRegistry = require('../services/Ultravisor-TaskTypeRegistry.cjs');
15
+ const libServiceStateManager = require('../services/Ultravisor-StateManager.cjs');
16
+ const libServiceExecutionEngine = require('../services/Ultravisor-ExecutionEngine.cjs');
17
+ const libServiceExecutionManifest = require('../services/Ultravisor-ExecutionManifest.cjs');
18
+ const libServiceBeaconCoordinator = require('../services/Ultravisor-Beacon-Coordinator.cjs');
16
19
 
17
20
  // TODO: Remove this when Restify is fixed.
18
21
  process.removeAllListeners('warning')
19
22
 
20
- const libWebServerAPIServer = require(`../web_server/Ultravisor-API-Server.cjs`);
23
+ const libWebServerAPIServer = require('../web_server/Ultravisor-API-Server.cjs');
21
24
 
22
- // TODO: Add a way to do this cleanly from the pict-service-commandlineutility package itself, maybe via a "pre-initialization" function or something like that?
23
25
  // Check for an optional --config / -c command line parameter to load a config file
24
26
  let _ConfigFileOverride = false;
25
27
  for (let i = 0; i < process.argv.length; i++)
@@ -59,7 +61,7 @@ let _Ultravisor_Pict = new libCLIProgram(
59
61
 
60
62
  "Command": "ultravisor",
61
63
 
62
- "DefaultProgramConfiguration": require(`../config/Ultravisor-Default-Command-Configuration.cjs`),
64
+ "DefaultProgramConfiguration": require('../config/Ultravisor-Default-Command-Configuration.cjs'),
63
65
 
64
66
  "ProgramConfigurationFileName": ".ultravisor.json",
65
67
 
@@ -85,8 +87,6 @@ let _Ultravisor_Pict = new libCLIProgram(
85
87
  ]);
86
88
 
87
89
  // Register --config / -c as a known global option so Commander doesn't reject it.
88
- // The actual file loading happens in the pre-initialization block above; this just
89
- // prevents Commander from throwing "unknown option '--config'".
90
90
  _Ultravisor_Pict.CommandLineUtility.command.option('-c, --config <path>', 'Load configuration from a JSON file');
91
91
 
92
92
  // If a config file override was passed via --config / -c, apply it on top of the gathered config
@@ -100,18 +100,40 @@ _Ultravisor_Pict.instantiateServiceProvider('FilePersistence');
100
100
  // Instantiate the data generation service
101
101
  _Ultravisor_Pict.instantiateServiceProvider('DataGeneration');
102
102
 
103
- _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('Ultravisor-Hypervisor', libServiceHypervisor);
104
- _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('Ultravisor-Hypervisor-State', libServiceHypervisorState);
103
+ // --- Core services ---
104
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorHypervisor', libServiceHypervisor);
105
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorHypervisorState', libServiceHypervisorState);
105
106
 
106
- _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('Ultravisor-Hypervisor-Event-Base', libServiceHypervisorEventBase);
107
- _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('Ultravisor-Hypervisor-Event-Cron', libServiceHypervisorEventCron);
108
- _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('Ultravisor-Hypervisor-Event-Solver', libServiceHypervisorEventSolver);
107
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorHypervisorEventBase', libServiceHypervisorEventBase);
108
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorHypervisorEventCron', libServiceHypervisorEventCron);
109
109
 
110
- _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('Ultravisor-Operation', libServiceOperation);
111
- _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('Ultravisor-Operation-Manifest', libServiceOperationManifest);
110
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorSchedulePersistenceBase', libServiceSchedulePersistenceBase);
111
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorSchedulePersistence', libServiceSchedulePersistenceJSONFile);
112
112
 
113
- _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('Ultravisor-Task', libServiceTask);
113
+ // --- New engine services ---
114
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorTaskTypeRegistry', libServiceTaskTypeRegistry);
115
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorStateManager', libServiceStateManager);
116
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorExecutionEngine', libServiceExecutionEngine);
117
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorExecutionManifest', libServiceExecutionManifest);
114
118
 
115
- _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('Ultravisor-API-Server', libWebServerAPIServer);
119
+ // Register built-in task types
120
+ let tmpRegistry = Object.values(_Ultravisor_Pict.fable.servicesMap['UltravisorTaskTypeRegistry'])[0];
121
+ if (tmpRegistry)
122
+ {
123
+ tmpRegistry.registerBuiltInTaskTypes();
124
+ }
125
+
126
+ // --- Beacon coordinator ---
127
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorBeaconCoordinator', libServiceBeaconCoordinator);
128
+
129
+ _Ultravisor_Pict.fable.addAndInstantiateServiceTypeIfNotExists('UltravisorAPIServer', libWebServerAPIServer);
130
+
131
+ // ── Service name aliases ────────────────────────────────
132
+ // Some CLI commands access services by hyphenated names via this.fable['Name'].
133
+ // Bridge the camelCase registration to hyphenated access.
134
+ let _Fable = _Ultravisor_Pict.fable;
135
+
136
+ _Fable['Ultravisor-Hypervisor'] = Object.values(_Fable.servicesMap['UltravisorHypervisor'])[0];
137
+ _Fable['Ultravisor-API-Server'] = Object.values(_Fable.servicesMap['UltravisorAPIServer'])[0];
116
138
 
117
139
  module.exports = _Ultravisor_Pict;
@@ -9,19 +9,26 @@ class UltravisorCommandSingleOperationRun extends libCommandLineCommand
9
9
  this.options.CommandKeyword = 'singleoperation';
10
10
  this.options.Description = 'Execute a single ultravisor operation immediately, no matter what.';
11
11
 
12
- this.options.CommandArguments.push({ Name: '<operation>', Description: 'The operation(s) to run.' });
13
- this.options.CommandOptions.push({ Name: '-d, --dry_run', Description: 'Dry run the task.', Default: false });
12
+ this.options.CommandArguments.push({ Name: '<operation>', Description: 'The operation hash to run.' });
13
+ this.options.CommandOptions.push({ Name: '-d, --dry_run', Description: 'Dry run the operation.', Default: false });
14
14
 
15
15
  this.options.Aliases.push('operation');
16
16
 
17
17
  this.addCommand();
18
18
  }
19
19
 
20
+ _getService(pTypeName)
21
+ {
22
+ return this.fable.servicesMap[pTypeName]
23
+ ? Object.values(this.fable.servicesMap[pTypeName])[0]
24
+ : null;
25
+ }
26
+
20
27
  onRunAsync(fCallback)
21
28
  {
22
- let tmpOperationGUID = this.ArgumentString;
29
+ let tmpOperationHash = this.ArgumentString;
23
30
 
24
- if (!tmpOperationGUID)
31
+ if (!tmpOperationHash)
25
32
  {
26
33
  console.log(`Error: operation argument is required.`);
27
34
  return fCallback();
@@ -31,16 +38,16 @@ class UltravisorCommandSingleOperationRun extends libCommandLineCommand
31
38
 
32
39
  if (tmpDryRun)
33
40
  {
34
- console.log(`[DRY RUN] Would execute operation: ${tmpOperationGUID}`);
41
+ console.log(`[DRY RUN] Would execute operation: ${tmpOperationHash}`);
35
42
  return fCallback();
36
43
  }
37
44
 
38
- console.log(`Executing operation: ${tmpOperationGUID}`);
45
+ console.log(`Executing operation: ${tmpOperationHash}`);
39
46
 
40
- let tmpStateService = this.fable['Ultravisor-Hypervisor-State'];
41
- let tmpOperationService = this.fable['Ultravisor-Operation'];
47
+ let tmpStateService = this._getService('UltravisorHypervisorState');
48
+ let tmpEngine = this._getService('UltravisorExecutionEngine');
42
49
 
43
- tmpStateService.getOperation(tmpOperationGUID,
50
+ tmpStateService.getOperation(tmpOperationHash,
44
51
  function (pError, pOperation)
45
52
  {
46
53
  if (pError)
@@ -49,8 +56,8 @@ class UltravisorCommandSingleOperationRun extends libCommandLineCommand
49
56
  return fCallback();
50
57
  }
51
58
 
52
- tmpOperationService.executeOperation(pOperation,
53
- function (pExecError, pManifest)
59
+ tmpEngine.executeOperation(pOperation,
60
+ function (pExecError, pContext)
54
61
  {
55
62
  if (pExecError)
56
63
  {
@@ -59,16 +66,20 @@ class UltravisorCommandSingleOperationRun extends libCommandLineCommand
59
66
  }
60
67
 
61
68
  console.log(`\nOperation Result:`);
62
- console.log(` Status: ${pManifest.Status}`);
63
- console.log(` Success: ${pManifest.Success}`);
64
- console.log(` Start: ${pManifest.StartTime}`);
65
- console.log(` Stop: ${pManifest.StopTime}`);
66
- console.log(` Tasks Executed: ${pManifest.TaskResults.length}`);
67
- console.log(` Summary: ${pManifest.Summary}`);
69
+ console.log(` Status: ${pContext.Status}`);
70
+ console.log(` Start: ${pContext.StartTime}`);
71
+ console.log(` Stop: ${pContext.StopTime}`);
72
+ console.log(` Elapsed: ${pContext.ElapsedMs}ms`);
73
+ let tmpTaskCount = pContext.TaskManifests ? Object.keys(pContext.TaskManifests).length : 0;
74
+ console.log(` Tasks Executed: ${tmpTaskCount}`);
75
+ if (pContext.Errors && pContext.Errors.length > 0)
76
+ {
77
+ console.log(` Errors: ${pContext.Errors.length}`);
78
+ }
68
79
  return fCallback();
69
80
  });
70
81
  });
71
82
  }
72
83
  }
73
84
 
74
- module.exports = UltravisorCommandSingleOperationRun;
85
+ module.exports = UltravisorCommandSingleOperationRun;
@@ -9,8 +9,7 @@ class UltravisorCommandSingleTaskRun extends libCommandLineCommand
9
9
  this.options.CommandKeyword = 'singletask';
10
10
  this.options.Description = 'Execute a single ultravisor task immediately, no matter what.';
11
11
 
12
- this.options.CommandArguments.push({ Name: '<task>', Description: 'The task(s) to run.' });
13
- this.options.CommandOptions.push({ Name: '-o, --operation [operation]', Description: 'The operation to scope the task(s) to.', Default: 'Default' });
12
+ this.options.CommandArguments.push({ Name: '<task>', Description: 'The task hash to run.' });
14
13
  this.options.CommandOptions.push({ Name: '-d, --dry_run', Description: 'Dry run the task.', Default: false });
15
14
 
16
15
  this.options.Aliases.push('task');
@@ -18,11 +17,18 @@ class UltravisorCommandSingleTaskRun extends libCommandLineCommand
18
17
  this.addCommand();
19
18
  }
20
19
 
20
+ _getService(pTypeName)
21
+ {
22
+ return this.fable.servicesMap[pTypeName]
23
+ ? Object.values(this.fable.servicesMap[pTypeName])[0]
24
+ : null;
25
+ }
26
+
21
27
  onRunAsync(fCallback)
22
28
  {
23
- let tmpTaskGUID = this.ArgumentString;
29
+ let tmpTaskHash = this.ArgumentString;
24
30
 
25
- if (!tmpTaskGUID)
31
+ if (!tmpTaskHash)
26
32
  {
27
33
  console.log(`Error: task argument is required.`);
28
34
  return fCallback();
@@ -32,17 +38,17 @@ class UltravisorCommandSingleTaskRun extends libCommandLineCommand
32
38
 
33
39
  if (tmpDryRun)
34
40
  {
35
- console.log(`[DRY RUN] Would execute task: ${tmpTaskGUID}`);
41
+ console.log(`[DRY RUN] Would execute task: ${tmpTaskHash}`);
36
42
  return fCallback();
37
43
  }
38
44
 
39
- console.log(`Executing task: ${tmpTaskGUID}`);
45
+ console.log(`Executing task: ${tmpTaskHash}`);
40
46
 
41
- let tmpStateService = this.fable['Ultravisor-Hypervisor-State'];
42
- let tmpTaskService = this.fable['Ultravisor-Task'];
47
+ let tmpStateService = this._getService('UltravisorHypervisorState');
48
+ let tmpEngine = this._getService('UltravisorExecutionEngine');
43
49
 
44
- tmpStateService.getTask(tmpTaskGUID,
45
- function (pError, pTask)
50
+ tmpStateService.getTaskDefinition(tmpTaskHash,
51
+ function (pError, pTaskDef)
46
52
  {
47
53
  if (pError)
48
54
  {
@@ -50,8 +56,41 @@ class UltravisorCommandSingleTaskRun extends libCommandLineCommand
50
56
  return fCallback();
51
57
  }
52
58
 
53
- tmpTaskService.executeTask(pTask, {},
54
- function (pExecError, pResult)
59
+ // Wrap single task in a minimal operation graph and execute
60
+ let tmpAdHocOperation = {
61
+ Hash: `ADHOC-${pTaskDef.Hash}`,
62
+ Name: `Ad-hoc: ${pTaskDef.Name || pTaskDef.Hash}`,
63
+ Graph:
64
+ {
65
+ Nodes:
66
+ [
67
+ { Hash: 'start-node', Type: 'start', X: 0, Y: 100 },
68
+ { Hash: pTaskDef.Hash, Type: pTaskDef.Type, DefinitionHash: pTaskDef.Type, Settings: pTaskDef.Settings || {}, X: 200, Y: 100 },
69
+ { Hash: 'end-node', Type: 'end', X: 400, Y: 100 }
70
+ ],
71
+ Connections:
72
+ [
73
+ {
74
+ SourceNodeHash: 'start-node',
75
+ SourcePortHash: 'start-node-eo-Start',
76
+ TargetNodeHash: pTaskDef.Hash,
77
+ TargetPortHash: pTaskDef.Hash + '-ei-Execute',
78
+ ConnectionType: 'Event'
79
+ },
80
+ {
81
+ SourceNodeHash: pTaskDef.Hash,
82
+ SourcePortHash: pTaskDef.Hash + '-eo-Complete',
83
+ TargetNodeHash: 'end-node',
84
+ TargetPortHash: 'end-node-ei-Finish',
85
+ ConnectionType: 'Event'
86
+ }
87
+ ],
88
+ ViewState: {}
89
+ }
90
+ };
91
+
92
+ tmpEngine.executeOperation(tmpAdHocOperation,
93
+ function (pExecError, pContext)
55
94
  {
56
95
  if (pExecError)
57
96
  {
@@ -60,13 +99,17 @@ class UltravisorCommandSingleTaskRun extends libCommandLineCommand
60
99
  }
61
100
 
62
101
  console.log(`\nTask Result:`);
63
- console.log(` Status: ${pResult.Status}`);
64
- console.log(` Success: ${pResult.Success}`);
65
- console.log(` Start: ${pResult.StartTime}`);
66
- console.log(` Stop: ${pResult.StopTime}`);
67
- if (pResult.Output)
102
+ console.log(` Status: ${pContext.Status}`);
103
+ console.log(` Start: ${pContext.StartTime}`);
104
+ console.log(` Stop: ${pContext.StopTime}`);
105
+ console.log(` Elapsed: ${pContext.ElapsedMs}ms`);
106
+ if (pContext.TaskOutputs && pContext.TaskOutputs[pTaskDef.Hash])
107
+ {
108
+ console.log(` Output: ${JSON.stringify(pContext.TaskOutputs[pTaskDef.Hash]).substring(0, 1000)}`);
109
+ }
110
+ if (pContext.Errors && pContext.Errors.length > 0)
68
111
  {
69
- console.log(` Output: ${pResult.Output.substring(0, 1000)}`);
112
+ console.log(` Errors: ${pContext.Errors.length}`);
70
113
  }
71
114
  return fCallback();
72
115
  });
@@ -74,4 +117,4 @@ class UltravisorCommandSingleTaskRun extends libCommandLineCommand
74
117
  }
75
118
  }
76
119
 
77
- module.exports = UltravisorCommandSingleTaskRun;
120
+ module.exports = UltravisorCommandSingleTaskRun;
@@ -10,20 +10,25 @@ class UltravisorCommandAddTask extends libCommandLineCommand
10
10
  super(pFable, pManifest, pServiceHash);
11
11
 
12
12
  this.options.CommandKeyword = 'updatetask';
13
- this.options.Description = 'Update (or add) a task to the available tasks.';
13
+ this.options.Description = 'Update (or add) a task definition.';
14
14
 
15
15
  this.options.CommandOptions.push({ Name:'-f, --file [json_filepath]', Description:'JSON Task definition file path.', Default:false });
16
16
 
17
- this.options.CommandOptions.push({ Name:'-g, --guid [task_guid]', Description:'The guid for the task.', Default:false });
18
- this.options.CommandOptions.push({ Name:'-c, --code [task_code]', Description:'The code for the task.', Default:false });
17
+ this.options.CommandOptions.push({ Name:'-h, --hash [task_hash]', Description:'The hash for the task definition.', Default:false });
19
18
  this.options.CommandOptions.push({ Name:'-n, --name [task_name]', Description:'The name of the task.', Default:false });
20
19
 
21
- this.options.CommandOptions.push({ Name:'-t, --type [task_type]', Description:'The type of task.', Default:'CRON' });
22
- this.options.CommandOptions.push({ Name:'-p, --parameters [task_parameters]', Description:'The parameters of the task.', Default:'0 0 * * * *' });
20
+ this.options.CommandOptions.push({ Name:'-t, --type [task_type]', Description:'The type of task (e.g. read-file, write-file, set-values).', Default:false });
23
21
 
24
22
  this.addCommand();
25
23
  }
26
24
 
25
+ _getService(pTypeName)
26
+ {
27
+ return this.fable.servicesMap[pTypeName]
28
+ ? Object.values(this.fable.servicesMap[pTypeName])[0]
29
+ : null;
30
+ }
31
+
27
32
  onRunAsync(fCallback)
28
33
  {
29
34
  const tmpOperationState = {};
@@ -64,28 +69,35 @@ class UltravisorCommandAddTask extends libCommandLineCommand
64
69
 
65
70
  tmpOperationState.TaskDefinition_Parameterized = {};
66
71
 
67
- tmpOperationState.TaskDefinition_Parameterized.GUIDTask = this.CommandOptions.guid;
68
- tmpOperationState.TaskDefinition_Parameterized.Code = this.CommandOptions.code;
69
- tmpOperationState.TaskDefinition_Parameterized.Name = this.CommandOptions.name;
70
-
71
- tmpOperationState.TaskDefinition_Parameterized.Type = this.CommandOptions.type;
72
- tmpOperationState.TaskDefinition_Parameterized.Parameters = this.CommandOptions.parameters;
72
+ if (this.CommandOptions.hash)
73
+ {
74
+ tmpOperationState.TaskDefinition_Parameterized.Hash = this.CommandOptions.hash;
75
+ }
76
+ if (this.CommandOptions.name)
77
+ {
78
+ tmpOperationState.TaskDefinition_Parameterized.Name = this.CommandOptions.name;
79
+ }
80
+ if (this.CommandOptions.type)
81
+ {
82
+ tmpOperationState.TaskDefinition_Parameterized.Type = this.CommandOptions.type;
83
+ }
73
84
 
74
85
  tmpOperationState.TaskDefinition = Object.assign({}, tmpOperationState.TaskDefinition_Parameterized, tmpOperationState.JSONFile);
75
86
 
76
- this.fable['Ultravisor-Hypervisor-State'].updateTask(tmpOperationState.TaskDefinition,
87
+ let tmpStateService = this._getService('UltravisorHypervisorState');
88
+ tmpStateService.updateTaskDefinition(tmpOperationState.TaskDefinition,
77
89
  function (pError, pUpdatedTask)
78
90
  {
79
91
  if (pError)
80
92
  {
81
- return fCallback(new Error(`Could not update task: ${pError.message}`));
93
+ return fCallback(new Error(`Could not update task definition: ${pError.message}`));
82
94
  }
83
95
 
84
- console.log(`Task with GUID ${pUpdatedTask.GUIDTask} updated successfully.`);
96
+ console.log(`Task definition ${pUpdatedTask.Hash} updated successfully.`);
85
97
 
86
98
  return fCallback();
87
99
  }.bind(this));
88
100
  }
89
101
  }
90
102
 
91
- module.exports = UltravisorCommandAddTask;
103
+ module.exports = UltravisorCommandAddTask;
@@ -1,10 +1,19 @@
1
+ let _ModuleRoot = require('path').resolve(__dirname, '..', '..');
2
+
1
3
  module.exports = (
2
4
  {
3
5
  "UltravisorAPIServerPort": 54321,
4
- "UltravisorFileStorePath": `${process.cwd()}/dist/ultravisor_datastore`,
5
- "UltravisorStagingRoot": `${process.cwd()}/dist/ultravisor_staging`,
6
+ "UltravisorFileStorePath": `${_ModuleRoot}/dist/ultravisor_datastore`,
7
+ "UltravisorStagingRoot": `${_ModuleRoot}/dist/ultravisor_staging`,
6
8
  "UltravisorTickIntervalMilliseconds": 60000,
7
9
  "UltravisorCommandTimeoutMilliseconds": 300000,
8
10
  "UltravisorCommandMaxBufferBytes": 10485760,
9
- "UltravisorWebInterfacePath": false
11
+ "UltravisorWebInterfacePath": `${_ModuleRoot}/webinterface/dist`,
12
+ "UltravisorOperationLibraryPath": `${_ModuleRoot}/operation-library`,
13
+
14
+ // Beacon worker configuration
15
+ "UltravisorBeaconHeartbeatTimeoutMs": 60000,
16
+ "UltravisorBeaconWorkItemTimeoutMs": 300000,
17
+ "UltravisorBeaconAffinityTTLMs": 3600000,
18
+ "UltravisorBeaconPollIntervalMs": 5000
10
19
  });