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.
- package/.claude/launch.json +11 -0
- package/.claude/ultravisor-dev-config.json +3 -0
- package/card-audit.json +1545 -0
- package/docs/_sidebar.md +17 -0
- package/docs/css/docuserve.css +73 -0
- package/docs/features/beacon-authentication.md +209 -0
- package/docs/features/beacon-providers.md +1299 -0
- package/docs/features/beacons.md +530 -0
- package/docs/features/capabilities.md +193 -0
- package/docs/features/llm-model-setup.md +505 -0
- package/docs/features/llm.md +262 -0
- package/docs/features/tasks-content-system.md +110 -0
- package/docs/features/tasks-data-transform.md +233 -0
- package/docs/features/tasks-extension.md +36 -0
- package/docs/features/tasks-file-system.md +203 -0
- package/docs/features/tasks-flow-control.md +125 -0
- package/docs/features/tasks-http-client.md +119 -0
- package/docs/features/tasks-llm.md +118 -0
- package/docs/features/tasks-meadow-api.md +163 -0
- package/docs/features/tasks-user-interaction.md +49 -0
- package/docs/features/tasks.md +14 -0
- package/docs/index.html +1 -1
- package/docs/retold-catalog.json +1 -1
- package/docs/retold-keyword-index.json +17374 -5
- package/operation-library/api-data-pipeline.json +143 -0
- package/operation-library/beacon-remote-command.json +72 -0
- package/operation-library/conditional-file-backup.json +143 -0
- package/operation-library/config-processor.json +136 -0
- package/operation-library/csv-data-analysis.json +228 -0
- package/operation-library/csv-to-json.json +160 -0
- package/operation-library/directory-inventory.json +128 -0
- package/operation-library/expression-calculator.json +114 -0
- package/operation-library/file-search-replace.json +175 -0
- package/operation-library/git-status-report.json +368 -0
- package/operation-library/health-check-ping.json +329 -0
- package/operation-library/json-config-merge.json +313 -0
- package/operation-library/llm-embedding-tool-use.json +314 -0
- package/operation-library/llm-multi-turn-analysis.json +322 -0
- package/operation-library/llm-summarize.json +264 -0
- package/operation-library/log-line-counter.json +185 -0
- package/operation-library/meadow-crud-lifecycle.json +264 -0
- package/operation-library/npm-project-validator.json +193 -0
- package/operation-library/rest-api-orchestrator.json +218 -0
- package/operation-library/shell-system-info.json +137 -0
- package/operation-library/simple-echo.json +95 -0
- package/operation-library/template-processor.json +299 -0
- package/operation-library/text-sanitizer.json +176 -0
- package/package.json +12 -8
- package/source/Ultravisor.cjs +30 -3
- package/source/beacon/Ultravisor-Beacon-CLI.cjs +143 -0
- package/source/beacon/Ultravisor-Beacon-CapabilityProvider.cjs +129 -0
- package/source/beacon/Ultravisor-Beacon-Client.cjs +568 -0
- package/source/beacon/Ultravisor-Beacon-Executor.cjs +500 -0
- package/source/beacon/Ultravisor-Beacon-ProviderRegistry.cjs +330 -0
- package/source/beacon/providers/Ultravisor-Beacon-Provider-FileSystem.cjs +331 -0
- package/source/beacon/providers/Ultravisor-Beacon-Provider-LLM.cjs +966 -0
- package/source/beacon/providers/Ultravisor-Beacon-Provider-Shell.cjs +95 -0
- package/source/cli/Ultravisor-CLIProgram.cjs +44 -22
- package/source/cli/commands/Ultravisor-Command-SingleOperation.cjs +29 -18
- package/source/cli/commands/Ultravisor-Command-SingleTask.cjs +62 -19
- package/source/cli/commands/Ultravisor-Command-UpdateTask.cjs +27 -15
- package/source/config/Ultravisor-Default-Command-Configuration.cjs +12 -3
- package/source/services/Ultravisor-Beacon-Coordinator.cjs +966 -0
- package/source/services/Ultravisor-ExecutionEngine.cjs +1093 -0
- package/source/services/Ultravisor-ExecutionManifest.cjs +629 -0
- package/source/services/Ultravisor-Hypervisor-State.cjs +270 -97
- package/source/services/Ultravisor-Hypervisor.cjs +185 -75
- package/source/services/Ultravisor-Schedule-Persistence-Base.cjs +45 -0
- package/source/services/Ultravisor-StateManager.cjs +253 -0
- package/source/services/Ultravisor-TaskTypeRegistry.cjs +213 -0
- package/source/services/persistence/Ultravisor-Schedule-Persistence-JSONFile.cjs +140 -0
- package/source/services/tasks/Ultravisor-BuiltIn-TaskConfigs.cjs +19 -0
- package/source/services/tasks/Ultravisor-TaskHelper-BeaconDispatch.cjs +107 -0
- package/source/services/tasks/Ultravisor-TaskType-Base.cjs +125 -0
- package/source/services/tasks/content-system/Ultravisor-TaskConfigs-ContentSystem.cjs +90 -0
- package/source/services/tasks/content-system/definitions/content-create-folder.json +24 -0
- package/source/services/tasks/content-system/definitions/content-list-files.json +27 -0
- package/source/services/tasks/content-system/definitions/content-read-file.json +26 -0
- package/source/services/tasks/content-system/definitions/content-save-file.json +26 -0
- package/source/services/tasks/data-transform/Ultravisor-TaskConfigs-DataTransform.cjs +577 -0
- package/source/services/tasks/data-transform/Ultravisor-TaskType-ReplaceString.cjs +80 -0
- package/source/services/tasks/data-transform/Ultravisor-TaskType-SetValues.cjs +74 -0
- package/source/services/tasks/data-transform/Ultravisor-TaskType-StringAppender.cjs +90 -0
- package/source/services/tasks/data-transform/definitions/comprehension-intersect.json +24 -0
- package/source/services/tasks/data-transform/definitions/csv-transform.json +24 -0
- package/source/services/tasks/data-transform/definitions/expression-solver.json +20 -0
- package/source/services/tasks/data-transform/definitions/histogram.json +23 -0
- package/source/services/tasks/data-transform/definitions/parse-csv.json +27 -0
- package/source/services/tasks/data-transform/definitions/replace-string.json +27 -0
- package/source/services/tasks/data-transform/definitions/set-values.json +17 -0
- package/source/services/tasks/data-transform/definitions/string-appender.json +22 -0
- package/source/services/tasks/data-transform/definitions/template-string.json +20 -0
- package/source/services/tasks/extension/Ultravisor-TaskConfigs-Extension.cjs +87 -0
- package/source/services/tasks/extension/definitions/beacon-dispatch.json +32 -0
- package/source/services/tasks/file-system/Ultravisor-TaskConfigs-FileSystem.cjs +509 -0
- package/source/services/tasks/file-system/Ultravisor-TaskType-ReadFile.cjs +96 -0
- package/source/services/tasks/file-system/Ultravisor-TaskType-ReadFileBuffered.cjs +123 -0
- package/source/services/tasks/file-system/Ultravisor-TaskType-WriteFile.cjs +106 -0
- package/source/services/tasks/file-system/definitions/copy-file.json +27 -0
- package/source/services/tasks/file-system/definitions/list-files.json +27 -0
- package/source/services/tasks/file-system/definitions/read-file-buffered.json +31 -0
- package/source/services/tasks/file-system/definitions/read-file.json +26 -0
- package/source/services/tasks/file-system/definitions/read-json.json +23 -0
- package/source/services/tasks/file-system/definitions/write-file.json +29 -0
- package/source/services/tasks/file-system/definitions/write-json.json +30 -0
- package/source/services/tasks/flow-control/Ultravisor-TaskConfigs-FlowControl.cjs +353 -0
- package/source/services/tasks/flow-control/Ultravisor-TaskType-IfConditional.cjs +125 -0
- package/source/services/tasks/flow-control/Ultravisor-TaskType-LaunchOperation.cjs +186 -0
- package/source/services/tasks/flow-control/Ultravisor-TaskType-SplitExecute.cjs +164 -0
- package/source/services/tasks/flow-control/definitions/if-conditional.json +25 -0
- package/source/services/tasks/flow-control/definitions/launch-operation.json +27 -0
- package/source/services/tasks/flow-control/definitions/split-execute.json +32 -0
- package/source/services/tasks/http-client/Ultravisor-TaskConfigs-HttpClient.cjs +281 -0
- package/source/services/tasks/http-client/definitions/get-json.json +26 -0
- package/source/services/tasks/http-client/definitions/get-text.json +26 -0
- package/source/services/tasks/http-client/definitions/rest-request.json +32 -0
- package/source/services/tasks/http-client/definitions/send-json.json +28 -0
- package/source/services/tasks/llm/Ultravisor-TaskConfigs-LLM.cjs +605 -0
- package/source/services/tasks/llm/definitions/llm-chat-completion.json +46 -0
- package/source/services/tasks/llm/definitions/llm-embedding.json +31 -0
- package/source/services/tasks/llm/definitions/llm-tool-use.json +42 -0
- package/source/services/tasks/meadow-api/Ultravisor-TaskConfigs-MeadowApi.cjs +341 -0
- package/source/services/tasks/meadow-api/definitions/meadow-count.json +26 -0
- package/source/services/tasks/meadow-api/definitions/meadow-create.json +26 -0
- package/source/services/tasks/meadow-api/definitions/meadow-delete.json +23 -0
- package/source/services/tasks/meadow-api/definitions/meadow-read.json +26 -0
- package/source/services/tasks/meadow-api/definitions/meadow-reads.json +29 -0
- package/source/services/tasks/meadow-api/definitions/meadow-update.json +26 -0
- package/source/services/tasks/shell/Ultravisor-TaskConfigs-Shell.cjs +63 -0
- package/source/services/tasks/shell/definitions/command.json +29 -0
- package/source/services/tasks/user-interaction/Ultravisor-TaskConfigs-UserInteraction.cjs +64 -0
- package/source/services/tasks/user-interaction/Ultravisor-TaskType-ErrorMessage.cjs +55 -0
- package/source/services/tasks/user-interaction/Ultravisor-TaskType-ValueInput.cjs +47 -0
- package/source/services/tasks/user-interaction/definitions/error-message.json +18 -0
- package/source/services/tasks/user-interaction/definitions/value-input.json +23 -0
- package/source/web_server/Ultravisor-API-Server.cjs +849 -124
- package/test/Ultravisor_browser_tests.js +2226 -0
- package/test/Ultravisor_operation_library_tests.js +894 -0
- package/test/Ultravisor_tests.js +4946 -5044
- package/test/workflows/test-content-concatenate-all.json +339 -0
- package/test/workflows/test-content-full-pipeline.json +159 -0
- package/test/workflows/test-content-list-files.json +76 -0
- package/test/workflows/test-content-save-and-read.json +106 -0
- package/webinterface/css/ultravisor-themes.css +668 -0
- package/webinterface/css/ultravisor.css +37 -14
- package/webinterface/docs/card-help/beacon-dispatch.md +30 -0
- package/webinterface/docs/card-help/command.md +27 -0
- package/webinterface/docs/card-help/comprehension-intersect.md +24 -0
- package/webinterface/docs/card-help/content-create-folder.md +22 -0
- package/webinterface/docs/card-help/content-list-files.md +25 -0
- package/webinterface/docs/card-help/content-read-file.md +24 -0
- package/webinterface/docs/card-help/content-save-file.md +24 -0
- package/webinterface/docs/card-help/copy-file.md +25 -0
- package/webinterface/docs/card-help/csv-transform.md +24 -0
- package/webinterface/docs/card-help/end.md +11 -0
- package/webinterface/docs/card-help/error-message.md +16 -0
- package/webinterface/docs/card-help/expression-solver.md +21 -0
- package/webinterface/docs/card-help/get-json.md +24 -0
- package/webinterface/docs/card-help/get-text.md +24 -0
- package/webinterface/docs/card-help/histogram.md +23 -0
- package/webinterface/docs/card-help/if-conditional.md +23 -0
- package/webinterface/docs/card-help/launch-operation.md +25 -0
- package/webinterface/docs/card-help/list-files.md +25 -0
- package/webinterface/docs/card-help/llm-chat-completion.md +43 -0
- package/webinterface/docs/card-help/llm-embedding.md +24 -0
- package/webinterface/docs/card-help/llm-tool-use.md +39 -0
- package/webinterface/docs/card-help/meadow-count.md +24 -0
- package/webinterface/docs/card-help/meadow-create.md +24 -0
- package/webinterface/docs/card-help/meadow-delete.md +19 -0
- package/webinterface/docs/card-help/meadow-read.md +24 -0
- package/webinterface/docs/card-help/meadow-reads.md +27 -0
- package/webinterface/docs/card-help/meadow-update.md +24 -0
- package/webinterface/docs/card-help/parse-csv.md +27 -0
- package/webinterface/docs/card-help/read-file-buffered.md +29 -0
- package/webinterface/docs/card-help/read-file.md +24 -0
- package/webinterface/docs/card-help/read-json.md +21 -0
- package/webinterface/docs/card-help/replace-string.md +25 -0
- package/webinterface/docs/card-help/rest-request.md +30 -0
- package/webinterface/docs/card-help/send-json.md +26 -0
- package/webinterface/docs/card-help/set-values.md +16 -0
- package/webinterface/docs/card-help/split-execute.md +35 -0
- package/webinterface/docs/card-help/start.md +11 -0
- package/webinterface/docs/card-help/string-appender.md +22 -0
- package/webinterface/docs/card-help/template-string.md +21 -0
- package/webinterface/docs/card-help/value-input.md +24 -0
- package/webinterface/docs/card-help/write-file.md +27 -0
- package/webinterface/docs/card-help/write-json.md +28 -0
- package/webinterface/html/index.html +5 -0
- package/webinterface/package.json +13 -4
- package/webinterface/source/Pict-Application-Ultravisor.js +564 -70
- package/webinterface/source/Ultravisor-TimingUtils.js +99 -0
- package/webinterface/source/card-help-content.js +46 -0
- package/webinterface/source/cards/Ultravisor-BuiltIn-CardConfigs.js +174 -0
- package/webinterface/source/cards/Ultravisor-CardConfigGenerator.js +431 -0
- package/webinterface/source/data/ExampleFlow-CSVPipeline.js +231 -0
- package/webinterface/source/data/ExampleFlow-FileProcessor.js +315 -0
- package/webinterface/source/data/ExampleFlow-MeadowPipeline.js +328 -0
- package/webinterface/source/panels/Ultravisor-CardSettingsPanel.js +902 -0
- package/webinterface/source/providers/PictRouter-Ultravisor-Configuration.json +20 -8
- package/webinterface/source/views/PictView-Ultravisor-BeaconList.js +817 -0
- package/webinterface/source/views/PictView-Ultravisor-BottomBar.js +5 -5
- package/webinterface/source/views/PictView-Ultravisor-Dashboard.js +25 -25
- package/webinterface/source/views/PictView-Ultravisor-Documentation.js +856 -0
- package/webinterface/source/views/PictView-Ultravisor-FlowEditor.js +777 -0
- package/webinterface/source/views/PictView-Ultravisor-ManifestList.js +321 -58
- package/webinterface/source/views/PictView-Ultravisor-OperationEdit.js +36 -91
- package/webinterface/source/views/PictView-Ultravisor-OperationList.js +388 -16
- package/webinterface/source/views/PictView-Ultravisor-PendingInput.js +314 -0
- package/webinterface/source/views/PictView-Ultravisor-Schedule.js +521 -65
- package/webinterface/source/views/PictView-Ultravisor-TimingView.js +333 -71
- package/webinterface/source/views/PictView-Ultravisor-TopBar.js +257 -21
- package/webinterface/theme-sampler.html +645 -0
- package/debug/Harness.js +0 -6
- package/source/services/Ultravisor-Operation-Manifest.cjs +0 -160
- package/source/services/Ultravisor-Operation.cjs +0 -200
- package/source/services/Ultravisor-Task.cjs +0 -349
- package/source/services/events/Ultravisor-Hypervisor-Event-Solver.cjs +0 -11
- package/source/services/tasks/Ultravisor-Task-Base.cjs +0 -264
- package/source/services/tasks/Ultravisor-Task-CollectValues.cjs +0 -188
- package/source/services/tasks/Ultravisor-Task-Command.cjs +0 -65
- package/source/services/tasks/Ultravisor-Task-CommandEach.cjs +0 -190
- package/source/services/tasks/Ultravisor-Task-Conditional.cjs +0 -104
- package/source/services/tasks/Ultravisor-Task-DateWindow.cjs +0 -72
- package/source/services/tasks/Ultravisor-Task-GeneratePagedOperation.cjs +0 -336
- package/source/services/tasks/Ultravisor-Task-LaunchOperation.cjs +0 -143
- package/source/services/tasks/Ultravisor-Task-LaunchTask.cjs +0 -146
- package/source/services/tasks/Ultravisor-Task-LineMatch.cjs +0 -158
- package/source/services/tasks/Ultravisor-Task-Request.cjs +0 -56
- package/source/services/tasks/Ultravisor-Task-Solver.cjs +0 -89
- package/source/services/tasks/Ultravisor-Task-TemplateString.cjs +0 -93
- package/source/services/tasks/rest/Ultravisor-Task-GetBinary.cjs +0 -127
- package/source/services/tasks/rest/Ultravisor-Task-GetJSON.cjs +0 -119
- package/source/services/tasks/rest/Ultravisor-Task-GetText.cjs +0 -109
- package/source/services/tasks/rest/Ultravisor-Task-GetXML.cjs +0 -112
- package/source/services/tasks/rest/Ultravisor-Task-RestRequest.cjs +0 -499
- package/source/services/tasks/rest/Ultravisor-Task-SendJSON.cjs +0 -150
- package/source/services/tasks/stagingfiles/Ultravisor-Task-CopyFile.cjs +0 -110
- package/source/services/tasks/stagingfiles/Ultravisor-Task-ListFiles.cjs +0 -89
- package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadBinary.cjs +0 -87
- package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadJSON.cjs +0 -67
- package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadText.cjs +0 -66
- package/source/services/tasks/stagingfiles/Ultravisor-Task-ReadXML.cjs +0 -69
- package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteBinary.cjs +0 -95
- package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteJSON.cjs +0 -96
- package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteText.cjs +0 -99
- package/source/services/tasks/stagingfiles/Ultravisor-Task-WriteXML.cjs +0 -102
- package/webinterface/source/views/PictView-Ultravisor-TaskEdit.js +0 -220
- package/webinterface/source/views/PictView-Ultravisor-TaskList.js +0 -248
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
const libTaskTypeBase = require('../Ultravisor-TaskType-Base.cjs');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* ReplaceString Task Type
|
|
5
|
+
*
|
|
6
|
+
* Performs string find-and-replace on InputString.
|
|
7
|
+
* Replaces all occurrences of SearchString with ReplaceString.
|
|
8
|
+
*/
|
|
9
|
+
class UltravisorTaskTypeReplaceString extends libTaskTypeBase
|
|
10
|
+
{
|
|
11
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
12
|
+
{
|
|
13
|
+
super(pFable, pOptions, pServiceHash);
|
|
14
|
+
|
|
15
|
+
this.serviceType = 'UltravisorTaskTypeReplaceString';
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
get definition()
|
|
19
|
+
{
|
|
20
|
+
return require('./definitions/replace-string.json');
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
execute(pResolvedSettings, pExecutionContext, fCallback, fFireIntermediateEvent)
|
|
24
|
+
{
|
|
25
|
+
let tmpInputString = pResolvedSettings.InputString;
|
|
26
|
+
let tmpSearchString = pResolvedSettings.SearchString;
|
|
27
|
+
let tmpReplaceString = pResolvedSettings.ReplaceString || '';
|
|
28
|
+
|
|
29
|
+
if (typeof(tmpInputString) !== 'string')
|
|
30
|
+
{
|
|
31
|
+
return fCallback(null, {
|
|
32
|
+
EventToFire: 'Error',
|
|
33
|
+
Outputs: {},
|
|
34
|
+
Log: ['InputString is not a string.']
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
if (!tmpSearchString || typeof(tmpSearchString) !== 'string')
|
|
39
|
+
{
|
|
40
|
+
return fCallback(null, {
|
|
41
|
+
EventToFire: 'Error',
|
|
42
|
+
Outputs: {},
|
|
43
|
+
Log: ['SearchString is empty or not a string.']
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
let tmpUseRegex = pResolvedSettings.UseRegex;
|
|
48
|
+
let tmpCaseSensitive = pResolvedSettings.CaseSensitive !== false;
|
|
49
|
+
let tmpResult;
|
|
50
|
+
let tmpReplacementCount = 0;
|
|
51
|
+
|
|
52
|
+
if (tmpUseRegex)
|
|
53
|
+
{
|
|
54
|
+
let tmpFlags = 'g' + (tmpCaseSensitive ? '' : 'i');
|
|
55
|
+
let tmpRegex = new RegExp(tmpSearchString, tmpFlags);
|
|
56
|
+
tmpReplacementCount = (tmpInputString.match(tmpRegex) || []).length;
|
|
57
|
+
tmpResult = tmpInputString.replace(tmpRegex, tmpReplaceString);
|
|
58
|
+
}
|
|
59
|
+
else if (!tmpCaseSensitive)
|
|
60
|
+
{
|
|
61
|
+
let tmpEscaped = tmpSearchString.replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
|
62
|
+
let tmpRegex = new RegExp(tmpEscaped, 'gi');
|
|
63
|
+
tmpReplacementCount = (tmpInputString.match(tmpRegex) || []).length;
|
|
64
|
+
tmpResult = tmpInputString.replace(tmpRegex, tmpReplaceString);
|
|
65
|
+
}
|
|
66
|
+
else
|
|
67
|
+
{
|
|
68
|
+
tmpReplacementCount = tmpInputString.split(tmpSearchString).length - 1;
|
|
69
|
+
tmpResult = tmpInputString.split(tmpSearchString).join(tmpReplaceString);
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
return fCallback(null, {
|
|
73
|
+
EventToFire: 'ReplaceComplete',
|
|
74
|
+
Outputs: { ReplacedString: tmpResult, ReplacementCount: tmpReplacementCount },
|
|
75
|
+
Log: [`Replaced "${tmpSearchString}" with "${tmpReplaceString}" (${tmpReplacementCount} occurrences).`]
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
module.exports = UltravisorTaskTypeReplaceString;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
const libTaskTypeBase = require('../Ultravisor-TaskType-Base.cjs');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* SetValues Task Type
|
|
5
|
+
*
|
|
6
|
+
* Sets one or more values in state at specified addresses.
|
|
7
|
+
* Used for initializing state, transforming data between levels, or
|
|
8
|
+
* setting computed values.
|
|
9
|
+
*
|
|
10
|
+
* Settings.Mappings is an array of { Address, Value } objects.
|
|
11
|
+
* Each mapping sets the value at the given state address.
|
|
12
|
+
*/
|
|
13
|
+
class UltravisorTaskTypeSetValues extends libTaskTypeBase
|
|
14
|
+
{
|
|
15
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
16
|
+
{
|
|
17
|
+
super(pFable, pOptions, pServiceHash);
|
|
18
|
+
|
|
19
|
+
this.serviceType = 'UltravisorTaskTypeSetValues';
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
get definition()
|
|
23
|
+
{
|
|
24
|
+
return require('./definitions/set-values.json');
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
execute(pResolvedSettings, pExecutionContext, fCallback, fFireIntermediateEvent)
|
|
28
|
+
{
|
|
29
|
+
let tmpMappings = pResolvedSettings.Mappings;
|
|
30
|
+
|
|
31
|
+
if (!Array.isArray(tmpMappings))
|
|
32
|
+
{
|
|
33
|
+
if (tmpMappings !== undefined && tmpMappings !== null)
|
|
34
|
+
{
|
|
35
|
+
return fCallback(null, {
|
|
36
|
+
EventToFire: 'Error',
|
|
37
|
+
Outputs: {},
|
|
38
|
+
Log: ['Mappings is not an array.']
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
return fCallback(null, {
|
|
42
|
+
EventToFire: 'Complete',
|
|
43
|
+
Outputs: {},
|
|
44
|
+
Log: ['No mappings provided.']
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
|
|
48
|
+
let tmpStateWrites = {};
|
|
49
|
+
let tmpLog = [];
|
|
50
|
+
|
|
51
|
+
for (let i = 0; i < tmpMappings.length; i++)
|
|
52
|
+
{
|
|
53
|
+
let tmpMapping = tmpMappings[i];
|
|
54
|
+
|
|
55
|
+
if (!tmpMapping || !tmpMapping.Address)
|
|
56
|
+
{
|
|
57
|
+
tmpLog.push(`Mapping ${i}: skipped (no Address).`);
|
|
58
|
+
continue;
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
tmpStateWrites[tmpMapping.Address] = tmpMapping.Value;
|
|
62
|
+
tmpLog.push(`Set [${tmpMapping.Address}] = ${JSON.stringify(tmpMapping.Value)}`);
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
return fCallback(null, {
|
|
66
|
+
EventToFire: 'Complete',
|
|
67
|
+
Outputs: {},
|
|
68
|
+
StateWrites: tmpStateWrites,
|
|
69
|
+
Log: tmpLog
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
module.exports = UltravisorTaskTypeSetValues;
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
const libTaskTypeBase = require('../Ultravisor-TaskType-Base.cjs');
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* StringAppender Task Type
|
|
5
|
+
*
|
|
6
|
+
* Appends InputString to the value at OutputAddress.
|
|
7
|
+
* If the target address is empty/undefined, sets it to InputString.
|
|
8
|
+
* Useful for accumulating results across loop iterations (e.g., split-execute).
|
|
9
|
+
*/
|
|
10
|
+
class UltravisorTaskTypeStringAppender extends libTaskTypeBase
|
|
11
|
+
{
|
|
12
|
+
constructor(pFable, pOptions, pServiceHash)
|
|
13
|
+
{
|
|
14
|
+
super(pFable, pOptions, pServiceHash);
|
|
15
|
+
|
|
16
|
+
this.serviceType = 'UltravisorTaskTypeStringAppender';
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
get definition()
|
|
20
|
+
{
|
|
21
|
+
return require('./definitions/string-appender.json');
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
execute(pResolvedSettings, pExecutionContext, fCallback, fFireIntermediateEvent)
|
|
25
|
+
{
|
|
26
|
+
let tmpInputString = pResolvedSettings.InputString;
|
|
27
|
+
let tmpOutputAddress = pResolvedSettings.OutputAddress;
|
|
28
|
+
|
|
29
|
+
if (typeof(tmpInputString) !== 'string')
|
|
30
|
+
{
|
|
31
|
+
tmpInputString = String(tmpInputString !== undefined ? tmpInputString : '');
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (!tmpOutputAddress || typeof(tmpOutputAddress) !== 'string')
|
|
35
|
+
{
|
|
36
|
+
// No output address — just pass through as output
|
|
37
|
+
return fCallback(null, {
|
|
38
|
+
EventToFire: 'Completed',
|
|
39
|
+
Outputs: {
|
|
40
|
+
AppendedString: tmpInputString
|
|
41
|
+
},
|
|
42
|
+
Log: ['No OutputAddress specified, returning InputString as AppendedString.']
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
// Read the existing value at the output address
|
|
47
|
+
let tmpStateManager = pExecutionContext.StateManager;
|
|
48
|
+
let tmpExistingValue = '';
|
|
49
|
+
|
|
50
|
+
if (tmpStateManager)
|
|
51
|
+
{
|
|
52
|
+
let tmpResolved = tmpStateManager.resolveAddress(tmpOutputAddress, pExecutionContext, pExecutionContext.NodeHash);
|
|
53
|
+
|
|
54
|
+
if (tmpResolved !== undefined && tmpResolved !== null)
|
|
55
|
+
{
|
|
56
|
+
tmpExistingValue = String(tmpResolved);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
let tmpAppendedValue;
|
|
61
|
+
|
|
62
|
+
if (pResolvedSettings.Separator)
|
|
63
|
+
{
|
|
64
|
+
tmpAppendedValue = tmpExistingValue + (tmpExistingValue.length > 0 ? pResolvedSettings.Separator : '') + tmpInputString;
|
|
65
|
+
}
|
|
66
|
+
else
|
|
67
|
+
{
|
|
68
|
+
if (pResolvedSettings.AppendNewline)
|
|
69
|
+
{
|
|
70
|
+
tmpInputString = tmpInputString + '\n';
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
tmpAppendedValue = tmpExistingValue + tmpInputString;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
let tmpStateWrites = {};
|
|
77
|
+
tmpStateWrites[tmpOutputAddress] = tmpAppendedValue;
|
|
78
|
+
|
|
79
|
+
return fCallback(null, {
|
|
80
|
+
EventToFire: 'Completed',
|
|
81
|
+
Outputs: {
|
|
82
|
+
AppendedString: tmpAppendedValue
|
|
83
|
+
},
|
|
84
|
+
StateWrites: tmpStateWrites,
|
|
85
|
+
Log: [`Appended ${tmpInputString.length} chars to [${tmpOutputAddress}] (total: ${tmpAppendedValue.length}).`]
|
|
86
|
+
});
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
module.exports = UltravisorTaskTypeStringAppender;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "comprehension-intersect",
|
|
3
|
+
"Type": "comprehension-intersect",
|
|
4
|
+
"Name": "Comprehension Intersect",
|
|
5
|
+
"Description": "Intersects two arrays by matching a common field.",
|
|
6
|
+
"Category": "pipeline",
|
|
7
|
+
"Capability": "Data Transform",
|
|
8
|
+
"Action": "Intersect",
|
|
9
|
+
"Tier": "Engine",
|
|
10
|
+
"EventInputs": [{ "Name": "Execute" }],
|
|
11
|
+
"EventOutputs": [{ "Name": "Complete" }],
|
|
12
|
+
"SettingsInputs": [
|
|
13
|
+
{ "Name": "SourceAddressA", "DataType": "String", "Required": true, "Description": "State address of the first array" },
|
|
14
|
+
{ "Name": "SourceAddressB", "DataType": "String", "Required": true, "Description": "State address of the second array" },
|
|
15
|
+
{ "Name": "MatchField", "DataType": "String", "Required": false, "Description": "Field name to match records on" },
|
|
16
|
+
{ "Name": "Destination", "DataType": "String", "Required": false, "Description": "State address to store the result" },
|
|
17
|
+
{ "Name": "JoinType", "DataType": "String", "Required": false, "Description": "Join type: inner (default)" }
|
|
18
|
+
],
|
|
19
|
+
"StateOutputs": [
|
|
20
|
+
{ "Name": "Result", "DataType": "Array", "Description": "Intersected records" },
|
|
21
|
+
{ "Name": "MatchCount", "DataType": "Number", "Description": "Number of matched records" }
|
|
22
|
+
],
|
|
23
|
+
"DefaultSettings": { "SourceAddressA": "", "SourceAddressB": "", "MatchField": "", "Destination": "", "JoinType": "inner" }
|
|
24
|
+
}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "csv-transform",
|
|
3
|
+
"Type": "csv-transform",
|
|
4
|
+
"Name": "CSV Transform",
|
|
5
|
+
"Description": "Transforms parsed CSV records using a template per row.",
|
|
6
|
+
"Category": "pipeline",
|
|
7
|
+
"Capability": "Data Transform",
|
|
8
|
+
"Action": "TransformCSV",
|
|
9
|
+
"Tier": "Engine",
|
|
10
|
+
"EventInputs": [{ "Name": "Execute" }],
|
|
11
|
+
"EventOutputs": [{ "Name": "Complete" }],
|
|
12
|
+
"SettingsInputs": [
|
|
13
|
+
{ "Name": "SourceAddress", "DataType": "String", "Required": false, "Description": "State address of the records array" },
|
|
14
|
+
{ "Name": "Destination", "DataType": "String", "Required": false, "Description": "State address to store transformed records" },
|
|
15
|
+
{ "Name": "Delimiter", "DataType": "String", "Required": false, "Description": "Delimiter for re-serialization" },
|
|
16
|
+
{ "Name": "FieldMapping", "DataType": "String", "Required": false, "Description": "JSON array of field mappings [{From, To, Template}]" },
|
|
17
|
+
{ "Name": "FilterExpression", "DataType": "String", "Required": false, "Description": "Expression to filter rows" },
|
|
18
|
+
{ "Name": "OutputFields", "DataType": "String", "Required": false, "Description": "JSON array of field names to include in output" }
|
|
19
|
+
],
|
|
20
|
+
"StateOutputs": [
|
|
21
|
+
{ "Name": "Records", "DataType": "Array", "Description": "Transformed records" }
|
|
22
|
+
],
|
|
23
|
+
"DefaultSettings": { "SourceAddress": "", "Destination": "", "Delimiter": ",", "FieldMapping": "", "FilterExpression": "", "OutputFields": "" }
|
|
24
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "expression-solver",
|
|
3
|
+
"Type": "expression-solver",
|
|
4
|
+
"Name": "Expression Solver",
|
|
5
|
+
"Description": "Evaluates an expression using Fable ExpressionParser.",
|
|
6
|
+
"Category": "core",
|
|
7
|
+
"Capability": "Data Transform",
|
|
8
|
+
"Action": "EvaluateExpression",
|
|
9
|
+
"Tier": "Engine",
|
|
10
|
+
"EventInputs": [{ "Name": "In" }],
|
|
11
|
+
"EventOutputs": [{ "Name": "Complete" }, { "Name": "Error", "IsError": true }],
|
|
12
|
+
"SettingsInputs": [
|
|
13
|
+
{ "Name": "Expression", "DataType": "String", "Required": true, "Description": "Expression to evaluate" },
|
|
14
|
+
{ "Name": "Destination", "DataType": "String", "Required": false, "Description": "State address to store the result" }
|
|
15
|
+
],
|
|
16
|
+
"StateOutputs": [
|
|
17
|
+
{ "Name": "Result", "DataType": "String", "Description": "Evaluation result" }
|
|
18
|
+
],
|
|
19
|
+
"DefaultSettings": { "Expression": "", "Destination": "" }
|
|
20
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "histogram",
|
|
3
|
+
"Type": "histogram",
|
|
4
|
+
"Name": "Histogram",
|
|
5
|
+
"Description": "Computes a frequency distribution over a field in a dataset.",
|
|
6
|
+
"Category": "pipeline",
|
|
7
|
+
"Capability": "Data Transform",
|
|
8
|
+
"Action": "Histogram",
|
|
9
|
+
"Tier": "Engine",
|
|
10
|
+
"EventInputs": [{ "Name": "Execute" }],
|
|
11
|
+
"EventOutputs": [{ "Name": "Complete" }],
|
|
12
|
+
"SettingsInputs": [
|
|
13
|
+
{ "Name": "SourceAddress", "DataType": "String", "Required": false, "Description": "State address of the data array" },
|
|
14
|
+
{ "Name": "Field", "DataType": "String", "Required": false, "Description": "Field name to analyze" },
|
|
15
|
+
{ "Name": "Bins", "DataType": "Number", "Required": false, "Description": "Number of bins for numeric data" },
|
|
16
|
+
{ "Name": "Destination", "DataType": "String", "Required": false, "Description": "State address to store stats" },
|
|
17
|
+
{ "Name": "SortBy", "DataType": "String", "Required": false, "Description": "Sort frequency results by \"count\" or \"key\"" }
|
|
18
|
+
],
|
|
19
|
+
"StateOutputs": [
|
|
20
|
+
{ "Name": "Stats", "DataType": "Object", "Description": "Histogram / frequency distribution" }
|
|
21
|
+
],
|
|
22
|
+
"DefaultSettings": { "SourceAddress": "", "Field": "score", "Bins": 5, "Destination": "", "SortBy": "" }
|
|
23
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "parse-csv",
|
|
3
|
+
"Type": "parse-csv",
|
|
4
|
+
"Name": "Parse CSV",
|
|
5
|
+
"Description": "Parses CSV text into an array of records.",
|
|
6
|
+
"Category": "pipeline",
|
|
7
|
+
"Capability": "Data Transform",
|
|
8
|
+
"Action": "ParseCSV",
|
|
9
|
+
"Tier": "Engine",
|
|
10
|
+
"EventInputs": [{ "Name": "Execute" }],
|
|
11
|
+
"EventOutputs": [{ "Name": "Complete" }],
|
|
12
|
+
"SettingsInputs": [
|
|
13
|
+
{ "Name": "SourceAddress", "DataType": "String", "Required": false, "Description": "State address of the CSV text to parse" },
|
|
14
|
+
{ "Name": "Delimiter", "DataType": "String", "Required": false, "Description": "Column delimiter" },
|
|
15
|
+
{ "Name": "HasHeaders", "DataType": "Boolean", "Required": false, "Description": "When true, first row is used as field names" },
|
|
16
|
+
{ "Name": "Destination", "DataType": "String", "Required": false, "Description": "State address to store parsed records" },
|
|
17
|
+
{ "Name": "QuoteCharacter", "DataType": "String", "Required": false, "Description": "Character used to quote fields containing the delimiter" },
|
|
18
|
+
{ "Name": "TrimFields", "DataType": "Boolean", "Required": false, "Description": "Trim whitespace from field values" },
|
|
19
|
+
{ "Name": "SkipEmptyLines", "DataType": "Boolean", "Required": false, "Description": "Skip empty lines in the input" }
|
|
20
|
+
],
|
|
21
|
+
"StateOutputs": [
|
|
22
|
+
{ "Name": "Records", "DataType": "Array", "Description": "Parsed rows" },
|
|
23
|
+
{ "Name": "ColumnCount", "DataType": "Number", "Description": "Number of columns found" },
|
|
24
|
+
{ "Name": "Headers", "DataType": "Array", "Description": "Parsed header names" }
|
|
25
|
+
],
|
|
26
|
+
"DefaultSettings": { "SourceAddress": "", "Delimiter": ",", "HasHeaders": true, "Destination": "", "QuoteCharacter": "\"", "TrimFields": true, "SkipEmptyLines": true }
|
|
27
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "replace-string",
|
|
3
|
+
"Type": "replace-string",
|
|
4
|
+
"Name": "Replace String",
|
|
5
|
+
"Description": "Replaces all occurrences of a search string within the input.",
|
|
6
|
+
"Category": "data",
|
|
7
|
+
"Capability": "Data Transform",
|
|
8
|
+
"Action": "ReplaceString",
|
|
9
|
+
"Tier": "Engine",
|
|
10
|
+
"EventInputs": [{ "Name": "Replace" }],
|
|
11
|
+
"EventOutputs": [
|
|
12
|
+
{ "Name": "ReplaceComplete" },
|
|
13
|
+
{ "Name": "Error", "IsError": true }
|
|
14
|
+
],
|
|
15
|
+
"SettingsInputs": [
|
|
16
|
+
{ "Name": "InputString", "DataType": "String", "Required": true },
|
|
17
|
+
{ "Name": "SearchString", "DataType": "String", "Required": true },
|
|
18
|
+
{ "Name": "ReplaceString", "DataType": "String", "Required": false },
|
|
19
|
+
{ "Name": "UseRegex", "DataType": "Boolean", "Required": false, "Description": "Treat SearchString as a regular expression" },
|
|
20
|
+
{ "Name": "CaseSensitive", "DataType": "Boolean", "Required": false, "Description": "Case-sensitive matching (default true)" }
|
|
21
|
+
],
|
|
22
|
+
"StateOutputs": [
|
|
23
|
+
{ "Name": "ReplacedString", "DataType": "String" },
|
|
24
|
+
{ "Name": "ReplacementCount", "DataType": "Number", "Description": "Number of replacements made" }
|
|
25
|
+
],
|
|
26
|
+
"DefaultSettings": { "InputString": "", "SearchString": "", "ReplaceString": "", "UseRegex": false, "CaseSensitive": true }
|
|
27
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "set-values",
|
|
3
|
+
"Type": "set-values",
|
|
4
|
+
"Name": "Set Values",
|
|
5
|
+
"Description": "Sets one or more values in state at specified addresses.",
|
|
6
|
+
"Category": "data",
|
|
7
|
+
"Capability": "Data Transform",
|
|
8
|
+
"Action": "SetValues",
|
|
9
|
+
"Tier": "Engine",
|
|
10
|
+
"EventInputs": [{ "Name": "Execute" }],
|
|
11
|
+
"EventOutputs": [{ "Name": "Complete" }, { "Name": "Error", "IsError": true }],
|
|
12
|
+
"SettingsInputs": [
|
|
13
|
+
{ "Name": "Mappings", "DataType": "Array", "Required": true }
|
|
14
|
+
],
|
|
15
|
+
"StateOutputs": [],
|
|
16
|
+
"DefaultSettings": { "Mappings": [] }
|
|
17
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "string-appender",
|
|
3
|
+
"Type": "string-appender",
|
|
4
|
+
"Name": "String Appender",
|
|
5
|
+
"Description": "Appends a string to a value at a specified state address.",
|
|
6
|
+
"Category": "data",
|
|
7
|
+
"Capability": "Data Transform",
|
|
8
|
+
"Action": "AppendString",
|
|
9
|
+
"Tier": "Engine",
|
|
10
|
+
"EventInputs": [{ "Name": "Append" }],
|
|
11
|
+
"EventOutputs": [{ "Name": "Completed" }],
|
|
12
|
+
"SettingsInputs": [
|
|
13
|
+
{ "Name": "InputString", "DataType": "String", "Required": true },
|
|
14
|
+
{ "Name": "OutputAddress", "DataType": "String", "Required": true },
|
|
15
|
+
{ "Name": "AppendNewline", "DataType": "Boolean", "Required": false, "Description": "When true, append a newline after each InputString." },
|
|
16
|
+
{ "Name": "Separator", "DataType": "String", "Required": false, "Description": "String to insert between existing and new content. Overrides AppendNewline when set." }
|
|
17
|
+
],
|
|
18
|
+
"StateOutputs": [
|
|
19
|
+
{ "Name": "AppendedString", "DataType": "String" }
|
|
20
|
+
],
|
|
21
|
+
"DefaultSettings": { "InputString": "", "OutputAddress": "", "AppendNewline": false, "Separator": "" }
|
|
22
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "template-string",
|
|
3
|
+
"Type": "template-string",
|
|
4
|
+
"Name": "Template String",
|
|
5
|
+
"Description": "Processes a Pict template string against the current state.",
|
|
6
|
+
"Category": "core",
|
|
7
|
+
"Capability": "Data Transform",
|
|
8
|
+
"Action": "Template",
|
|
9
|
+
"Tier": "Engine",
|
|
10
|
+
"EventInputs": [{ "Name": "In" }],
|
|
11
|
+
"EventOutputs": [{ "Name": "Complete" }, { "Name": "Error", "IsError": true }],
|
|
12
|
+
"SettingsInputs": [
|
|
13
|
+
{ "Name": "Template", "DataType": "String", "Required": true, "Description": "Pict template string with {~D:...~} expressions" },
|
|
14
|
+
{ "Name": "Destination", "DataType": "String", "Required": false, "Description": "State address to store the result" }
|
|
15
|
+
],
|
|
16
|
+
"StateOutputs": [
|
|
17
|
+
{ "Name": "Result", "DataType": "String", "Description": "Rendered template output" }
|
|
18
|
+
],
|
|
19
|
+
"DefaultSettings": { "Template": "", "Destination": "" }
|
|
20
|
+
}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Task configurations for the "Extension" capability.
|
|
3
|
+
*
|
|
4
|
+
* Contains:
|
|
5
|
+
* - beacon-dispatch — Dispatches work to a remote Beacon worker node.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Get a named service from the Fable services map.
|
|
11
|
+
*/
|
|
12
|
+
function _getService(pTask, pTypeName)
|
|
13
|
+
{
|
|
14
|
+
return pTask.fable.servicesMap[pTypeName]
|
|
15
|
+
? Object.values(pTask.fable.servicesMap[pTypeName])[0]
|
|
16
|
+
: null;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
|
|
20
|
+
module.exports =
|
|
21
|
+
[
|
|
22
|
+
// ── beacon-dispatch ────────────────────────────────────────
|
|
23
|
+
{
|
|
24
|
+
Definition: require('./definitions/beacon-dispatch.json'),
|
|
25
|
+
Execute: function (pTask, pResolvedSettings, pExecutionContext, fCallback)
|
|
26
|
+
{
|
|
27
|
+
let tmpCoordinator = _getService(pTask, 'UltravisorBeaconCoordinator');
|
|
28
|
+
|
|
29
|
+
if (!tmpCoordinator)
|
|
30
|
+
{
|
|
31
|
+
return fCallback(null, {
|
|
32
|
+
EventToFire: 'Error',
|
|
33
|
+
Outputs: { StdOut: 'BeaconCoordinator service not available.', ExitCode: -1, Result: '', BeaconID: '' },
|
|
34
|
+
Log: ['Beacon Dispatch: BeaconCoordinator service not found.']
|
|
35
|
+
});
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
// Check if any Beacons are registered
|
|
39
|
+
let tmpBeacons = tmpCoordinator.listBeacons();
|
|
40
|
+
if (tmpBeacons.length === 0)
|
|
41
|
+
{
|
|
42
|
+
return fCallback(null, {
|
|
43
|
+
EventToFire: 'Error',
|
|
44
|
+
Outputs: { StdOut: 'No Beacon workers are registered.', ExitCode: -1, Result: '', BeaconID: '' },
|
|
45
|
+
Log: ['Beacon Dispatch: no Beacon workers registered. Cannot dispatch work.']
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// Build work item from resolved settings
|
|
50
|
+
let tmpWorkItemInfo = {
|
|
51
|
+
RunHash: pExecutionContext.RunHash,
|
|
52
|
+
NodeHash: pExecutionContext.NodeHash,
|
|
53
|
+
OperationHash: pExecutionContext.OperationHash,
|
|
54
|
+
Capability: pResolvedSettings.RemoteCapability || 'Shell',
|
|
55
|
+
Action: pResolvedSettings.RemoteAction || 'Execute',
|
|
56
|
+
Settings: {
|
|
57
|
+
Command: pResolvedSettings.Command || '',
|
|
58
|
+
Parameters: pResolvedSettings.Parameters || '',
|
|
59
|
+
InputData: pResolvedSettings.InputData || ''
|
|
60
|
+
},
|
|
61
|
+
AffinityKey: pResolvedSettings.AffinityKey || '',
|
|
62
|
+
TimeoutMs: pResolvedSettings.TimeoutMs || 300000
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
// Enqueue the work item
|
|
66
|
+
let tmpWorkItem = tmpCoordinator.enqueueWorkItem(tmpWorkItemInfo);
|
|
67
|
+
|
|
68
|
+
pTask.log.info(`Beacon Dispatch: enqueued work item [${tmpWorkItem.WorkItemHash}] for capability [${tmpWorkItemInfo.Capability}/${tmpWorkItemInfo.Action}]` +
|
|
69
|
+
(tmpWorkItemInfo.AffinityKey ? ` with affinity [${tmpWorkItemInfo.AffinityKey}]` : ''));
|
|
70
|
+
|
|
71
|
+
// Pause execution — the BeaconCoordinator will call resumeOperation when the Beacon reports back
|
|
72
|
+
return fCallback(null, {
|
|
73
|
+
WaitingForInput: true,
|
|
74
|
+
ResumeEventName: 'Complete',
|
|
75
|
+
PromptMessage: `Waiting for Beacon worker (${tmpWorkItemInfo.Capability}/${tmpWorkItemInfo.Action})`,
|
|
76
|
+
OutputAddress: '',
|
|
77
|
+
Outputs: {},
|
|
78
|
+
Log: [
|
|
79
|
+
`Beacon Dispatch: dispatched to work queue as [${tmpWorkItem.WorkItemHash}].`,
|
|
80
|
+
`Capability: ${tmpWorkItemInfo.Capability}, Action: ${tmpWorkItemInfo.Action}`,
|
|
81
|
+
tmpWorkItemInfo.AffinityKey ? `Affinity: ${tmpWorkItemInfo.AffinityKey}` : 'No affinity key',
|
|
82
|
+
tmpWorkItemInfo.Settings.Command ? `Command: ${tmpWorkItemInfo.Settings.Command} ${tmpWorkItemInfo.Settings.Parameters}` : ''
|
|
83
|
+
].filter(Boolean)
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
];
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
{
|
|
2
|
+
"Hash": "beacon-dispatch",
|
|
3
|
+
"Type": "beacon-dispatch",
|
|
4
|
+
"Name": "Beacon Dispatch",
|
|
5
|
+
"Description": "Dispatches work to a remote Beacon worker node. The task pauses until the Beacon completes execution and reports results.",
|
|
6
|
+
"Category": "extension",
|
|
7
|
+
"Capability": "Extension",
|
|
8
|
+
"Action": "Dispatch",
|
|
9
|
+
"Tier": "Extension",
|
|
10
|
+
"EventInputs": [{ "Name": "Trigger" }],
|
|
11
|
+
"EventOutputs": [
|
|
12
|
+
{ "Name": "Complete" },
|
|
13
|
+
{ "Name": "Error", "IsError": true }
|
|
14
|
+
],
|
|
15
|
+
"SettingsInputs": [
|
|
16
|
+
{ "Name": "RemoteCapability", "DataType": "String", "Required": true, "Description": "Required capability on the Beacon (e.g. Shell, FileSystem)" },
|
|
17
|
+
{ "Name": "RemoteAction", "DataType": "String", "Required": false, "Description": "Specific action within the capability (e.g. Execute, Read)" },
|
|
18
|
+
{ "Name": "Command", "DataType": "String", "Required": false, "Description": "Shell command to execute on the Beacon" },
|
|
19
|
+
{ "Name": "Parameters", "DataType": "String", "Required": false, "Description": "Command-line parameters" },
|
|
20
|
+
{ "Name": "AffinityKey", "DataType": "String", "Required": false, "Description": "Key for worker affinity routing (same key → same Beacon)" },
|
|
21
|
+
{ "Name": "TimeoutMs", "DataType": "Number", "Required": false, "Description": "Work item timeout in milliseconds (default: 300000)" },
|
|
22
|
+
{ "Name": "InputData", "DataType": "String", "Required": false, "Description": "JSON data to pass to the Beacon worker" },
|
|
23
|
+
{ "Name": "Destination", "DataType": "String", "Required": false, "Description": "State address to write results on completion" }
|
|
24
|
+
],
|
|
25
|
+
"StateOutputs": [
|
|
26
|
+
{ "Name": "StdOut", "DataType": "String", "Description": "Standard output from the Beacon execution" },
|
|
27
|
+
{ "Name": "Result", "DataType": "String", "Description": "Result data from the Beacon" },
|
|
28
|
+
{ "Name": "ExitCode", "DataType": "Number", "Description": "Exit code of the remote command" },
|
|
29
|
+
{ "Name": "BeaconID", "DataType": "String", "Description": "ID of the Beacon that executed the work" }
|
|
30
|
+
],
|
|
31
|
+
"DefaultSettings": { "RemoteCapability": "Shell", "RemoteAction": "Execute", "TimeoutMs": 300000, "Destination": "" }
|
|
32
|
+
}
|