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,24 @@
1
+ {
2
+ "Hash": "content-create-folder",
3
+ "Type": "content-create-folder",
4
+ "Name": "Content Create Folder",
5
+ "Description": "Create a folder in the content directory on a Content System beacon.",
6
+ "Category": "content-system",
7
+ "Capability": "ContentSystem",
8
+ "Action": "CreateFolder",
9
+ "Tier": "Service",
10
+ "EventInputs": [{ "Name": "Trigger" }],
11
+ "EventOutputs": [
12
+ { "Name": "Complete" },
13
+ { "Name": "Error", "IsError": true }
14
+ ],
15
+ "SettingsInputs": [
16
+ { "Name": "Path", "DataType": "String", "Required": true, "Description": "Relative folder path to create" },
17
+ { "Name": "AffinityKey", "DataType": "String", "Required": false, "Description": "Worker affinity key" },
18
+ { "Name": "TimeoutMs", "DataType": "Number", "Required": false, "Description": "Timeout in milliseconds (default: 300000)" }
19
+ ],
20
+ "StateOutputs": [
21
+ { "Name": "StdOut", "DataType": "String", "Description": "Status message" }
22
+ ],
23
+ "DefaultSettings": { "Path": "", "AffinityKey": "", "TimeoutMs": 300000 }
24
+ }
@@ -0,0 +1,27 @@
1
+ {
2
+ "Hash": "content-list-files",
3
+ "Type": "content-list-files",
4
+ "Name": "Content List Files",
5
+ "Description": "List files in a directory on a Content System beacon.",
6
+ "Category": "content-system",
7
+ "Capability": "ContentSystem",
8
+ "Action": "ListFiles",
9
+ "Tier": "Service",
10
+ "EventInputs": [{ "Name": "Trigger" }],
11
+ "EventOutputs": [
12
+ { "Name": "Complete" },
13
+ { "Name": "Error", "IsError": true }
14
+ ],
15
+ "SettingsInputs": [
16
+ { "Name": "Path", "DataType": "String", "Required": false, "Description": "Relative directory path (empty for root)" },
17
+ { "Name": "Pattern", "DataType": "String", "Required": false, "Description": "Glob-style pattern filter" },
18
+ { "Name": "Recursive", "DataType": "Boolean", "Required": false, "Description": "Recursively list files in subdirectories" },
19
+ { "Name": "AffinityKey", "DataType": "String", "Required": false, "Description": "Worker affinity key" },
20
+ { "Name": "TimeoutMs", "DataType": "Number", "Required": false, "Description": "Timeout in milliseconds (default: 300000)" }
21
+ ],
22
+ "StateOutputs": [
23
+ { "Name": "Files", "DataType": "String", "Description": "JSON array of file entries" },
24
+ { "Name": "StdOut", "DataType": "String", "Description": "Status message" }
25
+ ],
26
+ "DefaultSettings": { "Path": "", "Pattern": "", "Recursive": false, "AffinityKey": "", "TimeoutMs": 300000 }
27
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "Hash": "content-read-file",
3
+ "Type": "content-read-file",
4
+ "Name": "Content Read File",
5
+ "Description": "Read a markdown or content file from a Content System beacon.",
6
+ "Category": "content-system",
7
+ "Capability": "ContentSystem",
8
+ "Action": "ReadFile",
9
+ "Tier": "Service",
10
+ "EventInputs": [{ "Name": "Trigger" }],
11
+ "EventOutputs": [
12
+ { "Name": "Complete" },
13
+ { "Name": "Error", "IsError": true }
14
+ ],
15
+ "SettingsInputs": [
16
+ { "Name": "FilePath", "DataType": "String", "Required": true, "Description": "Relative path within the content directory" },
17
+ { "Name": "Destination", "DataType": "String", "Required": false, "Description": "State address to store the file content" },
18
+ { "Name": "AffinityKey", "DataType": "String", "Required": false, "Description": "Worker affinity key" },
19
+ { "Name": "TimeoutMs", "DataType": "Number", "Required": false, "Description": "Timeout in milliseconds (default: 300000)" }
20
+ ],
21
+ "StateOutputs": [
22
+ { "Name": "Content", "DataType": "String", "Description": "File content" },
23
+ { "Name": "StdOut", "DataType": "String", "Description": "Status message" }
24
+ ],
25
+ "DefaultSettings": { "FilePath": "", "Destination": "", "AffinityKey": "", "TimeoutMs": 300000 }
26
+ }
@@ -0,0 +1,26 @@
1
+ {
2
+ "Hash": "content-save-file",
3
+ "Type": "content-save-file",
4
+ "Name": "Content Save File",
5
+ "Description": "Save content to a file on a Content System beacon.",
6
+ "Category": "content-system",
7
+ "Capability": "ContentSystem",
8
+ "Action": "SaveFile",
9
+ "Tier": "Service",
10
+ "EventInputs": [{ "Name": "Trigger" }],
11
+ "EventOutputs": [
12
+ { "Name": "Complete" },
13
+ { "Name": "Error", "IsError": true }
14
+ ],
15
+ "SettingsInputs": [
16
+ { "Name": "FilePath", "DataType": "String", "Required": true, "Description": "Relative path within the content directory" },
17
+ { "Name": "Content", "DataType": "String", "Required": true, "Description": "File content to write" },
18
+ { "Name": "AffinityKey", "DataType": "String", "Required": false, "Description": "Worker affinity key" },
19
+ { "Name": "TimeoutMs", "DataType": "Number", "Required": false, "Description": "Timeout in milliseconds (default: 300000)" }
20
+ ],
21
+ "StateOutputs": [
22
+ { "Name": "FilePath", "DataType": "String", "Description": "Path of the saved file" },
23
+ { "Name": "StdOut", "DataType": "String", "Description": "Status message" }
24
+ ],
25
+ "DefaultSettings": { "FilePath": "", "Content": "", "AffinityKey": "", "TimeoutMs": 300000 }
26
+ }
@@ -0,0 +1,577 @@
1
+ /**
2
+ * Data Transform task configurations for Ultravisor.
3
+ *
4
+ * Contains task types for manipulating and transforming data in state:
5
+ * set-values, replace-string, string-appender, template-string,
6
+ * expression-solver, parse-csv, csv-transform, comprehension-intersect,
7
+ * histogram
8
+ *
9
+ * Each entry defines a task type as a config object with:
10
+ * Definition {object} - Port schema, metadata, default settings
11
+ * Execute {function} - Runtime logic: function(pTask, pSettings, pContext, fCb, fFireEvent)
12
+ */
13
+
14
+
15
+ // ── Module-scoped helpers ───────────────────────────────────────────
16
+
17
+ /**
18
+ * Get a service instance from the fable services map.
19
+ */
20
+ function _getService(pTask, pTypeName)
21
+ {
22
+ if (pTask.fable.servicesMap[pTypeName])
23
+ {
24
+ return Object.values(pTask.fable.servicesMap[pTypeName])[0];
25
+ }
26
+ return null;
27
+ }
28
+
29
+
30
+ /**
31
+ * Split a CSV line respecting quoted fields.
32
+ */
33
+ function _splitCSVLine(pLine, pDelimiter, pQuoteChar)
34
+ {
35
+ let tmpFields = [];
36
+ let tmpCurrent = '';
37
+ let tmpInQuotes = false;
38
+
39
+ for (let i = 0; i < pLine.length; i++)
40
+ {
41
+ let tmpChar = pLine[i];
42
+
43
+ if (tmpChar === pQuoteChar)
44
+ {
45
+ if (tmpInQuotes && i + 1 < pLine.length && pLine[i + 1] === pQuoteChar)
46
+ {
47
+ tmpCurrent += pQuoteChar;
48
+ i++;
49
+ }
50
+ else
51
+ {
52
+ tmpInQuotes = !tmpInQuotes;
53
+ }
54
+ }
55
+ else if (tmpChar === pDelimiter && !tmpInQuotes)
56
+ {
57
+ tmpFields.push(tmpCurrent);
58
+ tmpCurrent = '';
59
+ }
60
+ else
61
+ {
62
+ tmpCurrent += tmpChar;
63
+ }
64
+ }
65
+
66
+ tmpFields.push(tmpCurrent);
67
+ return tmpFields;
68
+ }
69
+
70
+
71
+ // ═══════════════════════════════════════════════════════════════════
72
+ // DATA TRANSFORM TASK CONFIGS
73
+ // ═══════════════════════════════════════════════════════════════════
74
+
75
+ module.exports =
76
+ [
77
+ // ── set-values ─────────────────────────────────────────────
78
+ {
79
+ Definition: require('./definitions/set-values.json'),
80
+ Execute: function (pTask, pResolvedSettings, pExecutionContext, fCallback)
81
+ {
82
+ let tmpMappings = pResolvedSettings.Mappings;
83
+
84
+ if (!Array.isArray(tmpMappings))
85
+ {
86
+ if (tmpMappings !== undefined && tmpMappings !== null)
87
+ {
88
+ return fCallback(null, {
89
+ EventToFire: 'Error',
90
+ Outputs: {},
91
+ Log: ['Mappings is not an array.']
92
+ });
93
+ }
94
+ return fCallback(null, {
95
+ EventToFire: 'Complete',
96
+ Outputs: {},
97
+ Log: ['No mappings provided.']
98
+ });
99
+ }
100
+
101
+ let tmpStateWrites = {};
102
+ let tmpLog = [];
103
+
104
+ for (let i = 0; i < tmpMappings.length; i++)
105
+ {
106
+ let tmpMapping = tmpMappings[i];
107
+
108
+ if (!tmpMapping || !tmpMapping.Address)
109
+ {
110
+ tmpLog.push(`Mapping ${i}: skipped (no Address).`);
111
+ continue;
112
+ }
113
+
114
+ tmpStateWrites[tmpMapping.Address] = tmpMapping.Value;
115
+ tmpLog.push(`Set [${tmpMapping.Address}] = ${JSON.stringify(tmpMapping.Value)}`);
116
+ }
117
+
118
+ return fCallback(null, {
119
+ EventToFire: 'Complete',
120
+ Outputs: {},
121
+ StateWrites: tmpStateWrites,
122
+ Log: tmpLog
123
+ });
124
+ }
125
+ },
126
+
127
+ // ── replace-string ─────────────────────────────────────────
128
+ {
129
+ Definition: require('./definitions/replace-string.json'),
130
+ Execute: function (pTask, pResolvedSettings, pExecutionContext, fCallback)
131
+ {
132
+ let tmpInputString = pResolvedSettings.InputString;
133
+ let tmpSearchString = pResolvedSettings.SearchString;
134
+ let tmpReplaceString = pResolvedSettings.ReplaceString || '';
135
+
136
+ if (typeof(tmpInputString) !== 'string')
137
+ {
138
+ return fCallback(null, {
139
+ EventToFire: 'Error',
140
+ Outputs: {},
141
+ Log: ['InputString is not a string.']
142
+ });
143
+ }
144
+
145
+ if (!tmpSearchString || typeof(tmpSearchString) !== 'string')
146
+ {
147
+ return fCallback(null, {
148
+ EventToFire: 'Error',
149
+ Outputs: {},
150
+ Log: ['SearchString is empty or not a string.']
151
+ });
152
+ }
153
+
154
+ let tmpUseRegex = pResolvedSettings.UseRegex;
155
+ let tmpCaseSensitive = pResolvedSettings.CaseSensitive !== false;
156
+ let tmpResult;
157
+ let tmpReplacementCount = 0;
158
+
159
+ if (tmpUseRegex)
160
+ {
161
+ let tmpFlags = 'g' + (tmpCaseSensitive ? '' : 'i');
162
+ let tmpRegex = new RegExp(tmpSearchString, tmpFlags);
163
+ tmpReplacementCount = (tmpInputString.match(tmpRegex) || []).length;
164
+ tmpResult = tmpInputString.replace(tmpRegex, tmpReplaceString);
165
+ }
166
+ else if (!tmpCaseSensitive)
167
+ {
168
+ let tmpEscaped = tmpSearchString.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
169
+ let tmpRegex = new RegExp(tmpEscaped, 'gi');
170
+ tmpReplacementCount = (tmpInputString.match(tmpRegex) || []).length;
171
+ tmpResult = tmpInputString.replace(tmpRegex, tmpReplaceString);
172
+ }
173
+ else
174
+ {
175
+ tmpReplacementCount = tmpInputString.split(tmpSearchString).length - 1;
176
+ tmpResult = tmpInputString.split(tmpSearchString).join(tmpReplaceString);
177
+ }
178
+
179
+ return fCallback(null, {
180
+ EventToFire: 'ReplaceComplete',
181
+ Outputs: { ReplacedString: tmpResult, ReplacementCount: tmpReplacementCount },
182
+ Log: [`Replaced "${tmpSearchString}" with "${tmpReplaceString}" (${tmpReplacementCount} occurrences).`]
183
+ });
184
+ }
185
+ },
186
+
187
+ // ── string-appender ────────────────────────────────────────
188
+ {
189
+ Definition: require('./definitions/string-appender.json'),
190
+ Execute: function (pTask, pResolvedSettings, pExecutionContext, fCallback)
191
+ {
192
+ let tmpInputString = pResolvedSettings.InputString;
193
+ let tmpOutputAddress = pResolvedSettings.OutputAddress;
194
+
195
+ if (typeof(tmpInputString) !== 'string')
196
+ {
197
+ tmpInputString = String(tmpInputString !== undefined ? tmpInputString : '');
198
+ }
199
+
200
+ if (!tmpOutputAddress || typeof(tmpOutputAddress) !== 'string')
201
+ {
202
+ return fCallback(null, {
203
+ EventToFire: 'Completed',
204
+ Outputs: { AppendedString: tmpInputString },
205
+ Log: ['No OutputAddress specified, returning InputString as AppendedString.']
206
+ });
207
+ }
208
+
209
+ let tmpStateManager = pExecutionContext.StateManager;
210
+ let tmpExistingValue = '';
211
+
212
+ if (tmpStateManager)
213
+ {
214
+ let tmpResolved = tmpStateManager.resolveAddress(tmpOutputAddress, pExecutionContext, pExecutionContext.NodeHash);
215
+ if (tmpResolved !== undefined && tmpResolved !== null)
216
+ {
217
+ tmpExistingValue = String(tmpResolved);
218
+ }
219
+ }
220
+
221
+ let tmpAppendedValue;
222
+
223
+ if (pResolvedSettings.Separator)
224
+ {
225
+ tmpAppendedValue = tmpExistingValue + (tmpExistingValue.length > 0 ? pResolvedSettings.Separator : '') + tmpInputString;
226
+ }
227
+ else
228
+ {
229
+ if (pResolvedSettings.AppendNewline)
230
+ {
231
+ tmpInputString = tmpInputString + '\n';
232
+ }
233
+
234
+ tmpAppendedValue = tmpExistingValue + tmpInputString;
235
+ }
236
+
237
+ let tmpStateWrites = {};
238
+ tmpStateWrites[tmpOutputAddress] = tmpAppendedValue;
239
+
240
+ return fCallback(null, {
241
+ EventToFire: 'Completed',
242
+ Outputs: { AppendedString: tmpAppendedValue },
243
+ StateWrites: tmpStateWrites,
244
+ Log: [`Appended ${tmpInputString.length} chars to [${tmpOutputAddress}] (total: ${tmpAppendedValue.length}).`]
245
+ });
246
+ }
247
+ },
248
+
249
+ // ── template-string ────────────────────────────────────────
250
+ {
251
+ Definition: require('./definitions/template-string.json'),
252
+ Execute: function (pTask, pResolvedSettings, pExecutionContext, fCallback)
253
+ {
254
+ let tmpTemplate = pResolvedSettings.Template || '';
255
+ let tmpResult = tmpTemplate;
256
+
257
+ if (tmpTemplate && pTask.fable.parseTemplate)
258
+ {
259
+ try
260
+ {
261
+ tmpResult = pTask.fable.parseTemplate(tmpTemplate, pExecutionContext);
262
+ }
263
+ catch (pError)
264
+ {
265
+ return fCallback(null, {
266
+ EventToFire: 'Error',
267
+ Outputs: { Result: '' },
268
+ Log: [`TemplateString: error parsing template: ${pError.message}`]
269
+ });
270
+ }
271
+ }
272
+
273
+ let tmpStateWrites = {};
274
+ if (pResolvedSettings.Destination)
275
+ {
276
+ tmpStateWrites[pResolvedSettings.Destination] = tmpResult;
277
+ }
278
+
279
+ return fCallback(null, {
280
+ EventToFire: 'Complete',
281
+ Outputs: { Result: tmpResult },
282
+ StateWrites: tmpStateWrites,
283
+ Log: [`TemplateString: rendered ${tmpResult.length} chars`]
284
+ });
285
+ }
286
+ },
287
+
288
+ // ── expression-solver ──────────────────────────────────────
289
+ {
290
+ Definition: require('./definitions/expression-solver.json'),
291
+ Execute: function (pTask, pResolvedSettings, pExecutionContext, fCallback)
292
+ {
293
+ let tmpExpression = pResolvedSettings.Expression || '';
294
+ let tmpResult = '';
295
+
296
+ if (tmpExpression && pTask.fable.ExpressionParser)
297
+ {
298
+ try
299
+ {
300
+ tmpResult = pTask.fable.ExpressionParser.resolve(tmpExpression, pExecutionContext);
301
+ }
302
+ catch (pError)
303
+ {
304
+ tmpResult = '';
305
+ return fCallback(null, {
306
+ EventToFire: 'Error',
307
+ Outputs: { Result: '' },
308
+ Log: [`ExpressionSolver: error evaluating "${tmpExpression}": ${pError.message}`]
309
+ });
310
+ }
311
+ }
312
+
313
+ let tmpStateWrites = {};
314
+ if (pResolvedSettings.Destination)
315
+ {
316
+ tmpStateWrites[pResolvedSettings.Destination] = tmpResult;
317
+ }
318
+
319
+ return fCallback(null, {
320
+ EventToFire: 'Complete',
321
+ Outputs: { Result: tmpResult },
322
+ StateWrites: tmpStateWrites,
323
+ Log: [`ExpressionSolver: result = ${JSON.stringify(tmpResult)}`]
324
+ });
325
+ }
326
+ },
327
+
328
+ // ── parse-csv ──────────────────────────────────────────────
329
+ {
330
+ Definition: require('./definitions/parse-csv.json'),
331
+ Execute: function (pTask, pResolvedSettings, pExecutionContext, fCallback)
332
+ {
333
+ let tmpRawText = '';
334
+ if (pResolvedSettings.SourceAddress && pExecutionContext.StateManager)
335
+ {
336
+ tmpRawText = pExecutionContext.StateManager.resolveAddress(pResolvedSettings.SourceAddress, pExecutionContext, pExecutionContext.NodeHash);
337
+ }
338
+
339
+ if (typeof(tmpRawText) !== 'string' || tmpRawText.length === 0)
340
+ {
341
+ return fCallback(null, { EventToFire: 'Complete', Outputs: { Records: [] }, Log: ['ParseCSV: no input text.'] });
342
+ }
343
+
344
+ let tmpDelimiter = pResolvedSettings.Delimiter || ',';
345
+ let tmpHasHeaders = pResolvedSettings.HasHeaders !== false;
346
+ let tmpQuoteChar = pResolvedSettings.QuoteCharacter || '"';
347
+ let tmpTrimFields = pResolvedSettings.TrimFields !== false;
348
+ let tmpSkipEmptyLines = pResolvedSettings.SkipEmptyLines !== false;
349
+ let tmpLines = tmpRawText.split('\n');
350
+
351
+ if (tmpSkipEmptyLines)
352
+ {
353
+ tmpLines = tmpLines.filter(function (pLine) { return pLine.trim().length > 0; });
354
+ }
355
+
356
+ let tmpRecords = [];
357
+ let tmpHeaders = [];
358
+
359
+ if (tmpHasHeaders && tmpLines.length > 0)
360
+ {
361
+ tmpHeaders = _splitCSVLine(tmpLines[0], tmpDelimiter, tmpQuoteChar);
362
+ if (tmpTrimFields)
363
+ {
364
+ tmpHeaders = tmpHeaders.map(function (pH) { return pH.trim(); });
365
+ }
366
+ tmpLines = tmpLines.slice(1);
367
+ }
368
+
369
+ let tmpColumnCount = tmpHeaders.length;
370
+
371
+ for (let i = 0; i < tmpLines.length; i++)
372
+ {
373
+ let tmpFields = _splitCSVLine(tmpLines[i], tmpDelimiter, tmpQuoteChar);
374
+
375
+ if (tmpTrimFields)
376
+ {
377
+ tmpFields = tmpFields.map(function (pF) { return pF.trim(); });
378
+ }
379
+
380
+ if (tmpFields.length > tmpColumnCount)
381
+ {
382
+ tmpColumnCount = tmpFields.length;
383
+ }
384
+
385
+ if (tmpHeaders.length > 0)
386
+ {
387
+ let tmpRecord = {};
388
+ for (let j = 0; j < tmpHeaders.length; j++)
389
+ {
390
+ tmpRecord[tmpHeaders[j]] = (j < tmpFields.length) ? tmpFields[j] : '';
391
+ }
392
+ tmpRecords.push(tmpRecord);
393
+ }
394
+ else
395
+ {
396
+ tmpRecords.push(tmpFields);
397
+ }
398
+ }
399
+
400
+ let tmpStateWrites = {};
401
+ if (pResolvedSettings.Destination)
402
+ {
403
+ tmpStateWrites[pResolvedSettings.Destination] = tmpRecords;
404
+ }
405
+
406
+ return fCallback(null, {
407
+ EventToFire: 'Complete',
408
+ Outputs: { Records: tmpRecords, ColumnCount: tmpColumnCount, Headers: tmpHeaders },
409
+ StateWrites: tmpStateWrites,
410
+ Log: [`ParseCSV: parsed ${tmpRecords.length} records with ${tmpHeaders.length || 'no'} headers`]
411
+ });
412
+ }
413
+ },
414
+
415
+ // ── csv-transform ──────────────────────────────────────────
416
+ {
417
+ Definition: require('./definitions/csv-transform.json'),
418
+ Execute: function (pTask, pResolvedSettings, pExecutionContext, fCallback)
419
+ {
420
+ let tmpRecords = [];
421
+ if (pResolvedSettings.SourceAddress && pExecutionContext.StateManager)
422
+ {
423
+ tmpRecords = pExecutionContext.StateManager.resolveAddress(pResolvedSettings.SourceAddress, pExecutionContext, pExecutionContext.NodeHash);
424
+ }
425
+
426
+ if (!Array.isArray(tmpRecords))
427
+ {
428
+ return fCallback(null, { EventToFire: 'Complete', Outputs: { Records: [] }, Log: ['CSVTransform: source is not an array.'] });
429
+ }
430
+
431
+ // Pass-through for now — transformation logic is extensible
432
+ let tmpStateWrites = {};
433
+ if (pResolvedSettings.Destination)
434
+ {
435
+ tmpStateWrites[pResolvedSettings.Destination] = tmpRecords;
436
+ }
437
+
438
+ return fCallback(null, {
439
+ EventToFire: 'Complete',
440
+ Outputs: { Records: tmpRecords },
441
+ StateWrites: tmpStateWrites,
442
+ Log: [`CSVTransform: processed ${tmpRecords.length} records`]
443
+ });
444
+ }
445
+ },
446
+
447
+ // ── comprehension-intersect ─────────────────────────────────
448
+ {
449
+ Definition: require('./definitions/comprehension-intersect.json'),
450
+ Execute: function (pTask, pResolvedSettings, pExecutionContext, fCallback)
451
+ {
452
+ let tmpSetA = [];
453
+ let tmpSetB = [];
454
+
455
+ if (pResolvedSettings.SourceAddressA && pExecutionContext.StateManager)
456
+ {
457
+ tmpSetA = pExecutionContext.StateManager.resolveAddress(pResolvedSettings.SourceAddressA, pExecutionContext, pExecutionContext.NodeHash);
458
+ }
459
+ if (pResolvedSettings.SourceAddressB && pExecutionContext.StateManager)
460
+ {
461
+ tmpSetB = pExecutionContext.StateManager.resolveAddress(pResolvedSettings.SourceAddressB, pExecutionContext, pExecutionContext.NodeHash);
462
+ }
463
+
464
+ if (!Array.isArray(tmpSetA)) { tmpSetA = []; }
465
+ if (!Array.isArray(tmpSetB)) { tmpSetB = []; }
466
+
467
+ let tmpMatchField = pResolvedSettings.MatchField || '';
468
+ let tmpResult = [];
469
+
470
+ if (tmpMatchField)
471
+ {
472
+ // Build a set of match values from B
473
+ let tmpBValues = {};
474
+ for (let i = 0; i < tmpSetB.length; i++)
475
+ {
476
+ let tmpKey = String(tmpSetB[i][tmpMatchField]);
477
+ tmpBValues[tmpKey] = tmpSetB[i];
478
+ }
479
+
480
+ // Find matches in A
481
+ for (let i = 0; i < tmpSetA.length; i++)
482
+ {
483
+ let tmpKey = String(tmpSetA[i][tmpMatchField]);
484
+ if (tmpBValues[tmpKey])
485
+ {
486
+ tmpResult.push(Object.assign({}, tmpSetA[i], tmpBValues[tmpKey]));
487
+ }
488
+ }
489
+ }
490
+ else
491
+ {
492
+ // Simple array intersection (by value equality for primitives)
493
+ let tmpBSet = new Set(tmpSetB.map(function (pV) { return JSON.stringify(pV); }));
494
+ for (let i = 0; i < tmpSetA.length; i++)
495
+ {
496
+ if (tmpBSet.has(JSON.stringify(tmpSetA[i])))
497
+ {
498
+ tmpResult.push(tmpSetA[i]);
499
+ }
500
+ }
501
+ }
502
+
503
+ let tmpStateWrites = {};
504
+ if (pResolvedSettings.Destination)
505
+ {
506
+ tmpStateWrites[pResolvedSettings.Destination] = tmpResult;
507
+ }
508
+
509
+ return fCallback(null, {
510
+ EventToFire: 'Complete',
511
+ Outputs: { Result: tmpResult, MatchCount: tmpResult.length },
512
+ StateWrites: tmpStateWrites,
513
+ Log: [`ComprehensionIntersect: ${tmpSetA.length} x ${tmpSetB.length} -> ${tmpResult.length} results`]
514
+ });
515
+ }
516
+ },
517
+
518
+ // ── histogram ──────────────────────────────────────────────
519
+ {
520
+ Definition: require('./definitions/histogram.json'),
521
+ Execute: function (pTask, pResolvedSettings, pExecutionContext, fCallback)
522
+ {
523
+ let tmpData = [];
524
+ if (pResolvedSettings.SourceAddress && pExecutionContext.StateManager)
525
+ {
526
+ tmpData = pExecutionContext.StateManager.resolveAddress(pResolvedSettings.SourceAddress, pExecutionContext, pExecutionContext.NodeHash);
527
+ }
528
+
529
+ if (!Array.isArray(tmpData))
530
+ {
531
+ return fCallback(null, { EventToFire: 'Complete', Outputs: { Stats: {} }, Log: ['Histogram: source is not an array.'] });
532
+ }
533
+
534
+ let tmpField = pResolvedSettings.Field || '';
535
+ let tmpFrequency = {};
536
+
537
+ for (let i = 0; i < tmpData.length; i++)
538
+ {
539
+ let tmpValue = tmpField ? tmpData[i][tmpField] : tmpData[i];
540
+ let tmpKey = String(tmpValue);
541
+ tmpFrequency[tmpKey] = (tmpFrequency[tmpKey] || 0) + 1;
542
+ }
543
+
544
+ let tmpSortBy = pResolvedSettings.SortBy || '';
545
+
546
+ if (tmpSortBy === 'count')
547
+ {
548
+ let tmpEntries = Object.entries(tmpFrequency).sort(function (pA, pB) { return pB[1] - pA[1]; });
549
+ tmpFrequency = Object.fromEntries(tmpEntries);
550
+ }
551
+ else if (tmpSortBy === 'key')
552
+ {
553
+ let tmpEntries = Object.entries(tmpFrequency).sort(function (pA, pB) { return pA[0].localeCompare(pB[0]); });
554
+ tmpFrequency = Object.fromEntries(tmpEntries);
555
+ }
556
+
557
+ let tmpStats = {
558
+ TotalRecords: tmpData.length,
559
+ UniqueValues: Object.keys(tmpFrequency).length,
560
+ Frequency: tmpFrequency
561
+ };
562
+
563
+ let tmpStateWrites = {};
564
+ if (pResolvedSettings.Destination)
565
+ {
566
+ tmpStateWrites[pResolvedSettings.Destination] = tmpStats;
567
+ }
568
+
569
+ return fCallback(null, {
570
+ EventToFire: 'Complete',
571
+ Outputs: { Stats: tmpStats },
572
+ StateWrites: tmpStateWrites,
573
+ Log: [`Histogram: analyzed ${tmpData.length} records, ${Object.keys(tmpFrequency).length} unique values`]
574
+ });
575
+ }
576
+ }
577
+ ];