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,143 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* Ultravisor Beacon CLI
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* node Ultravisor-Beacon-CLI.cjs --server http://localhost:54321 --name GPU-Worker-1 --capabilities Shell,FileSystem
|
|
7
|
+
*
|
|
8
|
+
* Options:
|
|
9
|
+
* --server URL Ultravisor server URL (default: http://localhost:54321)
|
|
10
|
+
* --name NAME Beacon worker name (default: beacon-worker)
|
|
11
|
+
* --capabilities LIST Comma-separated capabilities (default: Shell)
|
|
12
|
+
* --password PASSWORD Authentication password for server connection
|
|
13
|
+
*
|
|
14
|
+
* For advanced provider configuration, use a .ultravisor-beacon.json file
|
|
15
|
+
* with a "Providers" array instead of --capabilities.
|
|
16
|
+
* --max-concurrent N Max concurrent work items (default: 1)
|
|
17
|
+
* --poll-interval MS Poll interval in ms (default: 5000)
|
|
18
|
+
* --staging-path PATH Local staging directory (default: cwd)
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
const libPath = require('path');
|
|
22
|
+
const libFS = require('fs');
|
|
23
|
+
|
|
24
|
+
const libBeaconClient = require('./Ultravisor-Beacon-Client.cjs');
|
|
25
|
+
|
|
26
|
+
// Parse command-line arguments
|
|
27
|
+
let tmpConfig = {
|
|
28
|
+
ServerURL: 'http://localhost:54321',
|
|
29
|
+
Name: 'beacon-worker',
|
|
30
|
+
Capabilities: ['Shell'],
|
|
31
|
+
MaxConcurrent: 1,
|
|
32
|
+
PollIntervalMs: 5000,
|
|
33
|
+
HeartbeatIntervalMs: 30000,
|
|
34
|
+
StagingPath: process.cwd(),
|
|
35
|
+
Password: '',
|
|
36
|
+
Tags: {}
|
|
37
|
+
};
|
|
38
|
+
|
|
39
|
+
// Check for config file
|
|
40
|
+
let tmpConfigFilePath = libPath.resolve(process.cwd(), '.ultravisor-beacon.json');
|
|
41
|
+
if (libFS.existsSync(tmpConfigFilePath))
|
|
42
|
+
{
|
|
43
|
+
try
|
|
44
|
+
{
|
|
45
|
+
let tmpFileConfig = JSON.parse(libFS.readFileSync(tmpConfigFilePath, 'utf8'));
|
|
46
|
+
tmpConfig = Object.assign(tmpConfig, tmpFileConfig);
|
|
47
|
+
console.log(`[Beacon CLI] Loaded config from ${tmpConfigFilePath}`);
|
|
48
|
+
}
|
|
49
|
+
catch (pError)
|
|
50
|
+
{
|
|
51
|
+
console.warn(`[Beacon CLI] Warning: could not parse ${tmpConfigFilePath}: ${pError.message}`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
// Parse CLI arguments (override config file)
|
|
56
|
+
for (let i = 2; i < process.argv.length; i++)
|
|
57
|
+
{
|
|
58
|
+
switch (process.argv[i])
|
|
59
|
+
{
|
|
60
|
+
case '--server':
|
|
61
|
+
tmpConfig.ServerURL = process.argv[++i] || tmpConfig.ServerURL;
|
|
62
|
+
break;
|
|
63
|
+
case '--name':
|
|
64
|
+
tmpConfig.Name = process.argv[++i] || tmpConfig.Name;
|
|
65
|
+
break;
|
|
66
|
+
case '--capabilities':
|
|
67
|
+
tmpConfig.Capabilities = (process.argv[++i] || 'Shell').split(',').map(s => s.trim());
|
|
68
|
+
break;
|
|
69
|
+
case '--max-concurrent':
|
|
70
|
+
tmpConfig.MaxConcurrent = parseInt(process.argv[++i]) || 1;
|
|
71
|
+
break;
|
|
72
|
+
case '--poll-interval':
|
|
73
|
+
tmpConfig.PollIntervalMs = parseInt(process.argv[++i]) || 5000;
|
|
74
|
+
break;
|
|
75
|
+
case '--staging-path':
|
|
76
|
+
tmpConfig.StagingPath = process.argv[++i] || process.cwd();
|
|
77
|
+
break;
|
|
78
|
+
case '--password':
|
|
79
|
+
tmpConfig.Password = process.argv[++i] || '';
|
|
80
|
+
break;
|
|
81
|
+
case '--help':
|
|
82
|
+
case '-h':
|
|
83
|
+
console.log('Ultravisor Beacon Worker');
|
|
84
|
+
console.log('');
|
|
85
|
+
console.log('Usage: node Ultravisor-Beacon-CLI.cjs [options]');
|
|
86
|
+
console.log('');
|
|
87
|
+
console.log('Options:');
|
|
88
|
+
console.log(' --server URL Ultravisor server URL (default: http://localhost:54321)');
|
|
89
|
+
console.log(' --name NAME Beacon worker name (default: beacon-worker)');
|
|
90
|
+
console.log(' --capabilities LIST Comma-separated capabilities (default: Shell)');
|
|
91
|
+
console.log(' --max-concurrent N Max concurrent work items (default: 1)');
|
|
92
|
+
console.log(' --poll-interval MS Poll interval in ms (default: 5000)');
|
|
93
|
+
console.log(' --staging-path PATH Local staging directory (default: cwd)');
|
|
94
|
+
console.log(' --password PASSWORD Authentication password for server connection');
|
|
95
|
+
console.log(' --help, -h Show this help');
|
|
96
|
+
console.log('');
|
|
97
|
+
console.log('Provider Configuration:');
|
|
98
|
+
console.log(' For advanced provider configuration, create a .ultravisor-beacon.json');
|
|
99
|
+
console.log(' file with a "Providers" array:');
|
|
100
|
+
console.log('');
|
|
101
|
+
console.log(' {');
|
|
102
|
+
console.log(' "Providers": [');
|
|
103
|
+
console.log(' { "Source": "Shell" },');
|
|
104
|
+
console.log(' { "Source": "FileSystem", "Config": { "AllowedPaths": ["/data"] } },');
|
|
105
|
+
console.log(' { "Source": "./my-custom-provider.cjs", "Config": {} }');
|
|
106
|
+
console.log(' ]');
|
|
107
|
+
console.log(' }');
|
|
108
|
+
process.exit(0);
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
|
|
112
|
+
// Create and start the Beacon client
|
|
113
|
+
let tmpClient = new libBeaconClient(tmpConfig);
|
|
114
|
+
|
|
115
|
+
tmpClient.start((pError) =>
|
|
116
|
+
{
|
|
117
|
+
if (pError)
|
|
118
|
+
{
|
|
119
|
+
console.error(`[Beacon CLI] Failed to start: ${pError.message}`);
|
|
120
|
+
process.exit(1);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
console.log(`[Beacon CLI] Beacon is running. Polling every ${tmpConfig.PollIntervalMs}ms.`);
|
|
124
|
+
console.log(`[Beacon CLI] Press Ctrl+C to stop.`);
|
|
125
|
+
});
|
|
126
|
+
|
|
127
|
+
// Handle graceful shutdown
|
|
128
|
+
process.on('SIGINT', () =>
|
|
129
|
+
{
|
|
130
|
+
console.log('\n[Beacon CLI] Shutting down...');
|
|
131
|
+
tmpClient.stop(() =>
|
|
132
|
+
{
|
|
133
|
+
process.exit(0);
|
|
134
|
+
});
|
|
135
|
+
});
|
|
136
|
+
|
|
137
|
+
process.on('SIGTERM', () =>
|
|
138
|
+
{
|
|
139
|
+
tmpClient.stop(() =>
|
|
140
|
+
{
|
|
141
|
+
process.exit(0);
|
|
142
|
+
});
|
|
143
|
+
});
|
|
@@ -0,0 +1,129 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Ultravisor Beacon Capability Provider — Base Class
|
|
3
|
+
*
|
|
4
|
+
* Providers extend this class to implement a specific capability
|
|
5
|
+
* (Shell, FileSystem, MediaProcessing, etc.) that the Beacon can
|
|
6
|
+
* advertise and execute work items for.
|
|
7
|
+
*
|
|
8
|
+
* This is a plain JavaScript class — no Fable dependency — keeping
|
|
9
|
+
* the Beacon lightweight and deployable with minimal dependencies.
|
|
10
|
+
*
|
|
11
|
+
* Lifecycle:
|
|
12
|
+
* 1. constructor(pProviderConfig) — receive per-provider config
|
|
13
|
+
* 2. initialize(fCallback) — async init (validate prereqs)
|
|
14
|
+
* 3. execute(...) — called per work item
|
|
15
|
+
* 4. shutdown(fCallback) — cleanup on beacon stop
|
|
16
|
+
*/
|
|
17
|
+
|
|
18
|
+
class UltravisorBeaconCapabilityProvider
|
|
19
|
+
{
|
|
20
|
+
constructor(pProviderConfig)
|
|
21
|
+
{
|
|
22
|
+
this._ProviderConfig = pProviderConfig || {};
|
|
23
|
+
|
|
24
|
+
// Subclasses MUST set these
|
|
25
|
+
this.Name = 'BaseProvider';
|
|
26
|
+
this.Capability = 'Unknown';
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* Return the actions this provider supports.
|
|
31
|
+
*
|
|
32
|
+
* Override in subclasses. Each key is an action name, value is
|
|
33
|
+
* an object with Description and optional SettingsSchema.
|
|
34
|
+
*
|
|
35
|
+
* @returns {object} Map of ActionName → { Description, SettingsSchema? }
|
|
36
|
+
*
|
|
37
|
+
* Example:
|
|
38
|
+
* {
|
|
39
|
+
* 'Execute': { Description: 'Run a shell command.' },
|
|
40
|
+
* 'Script': { Description: 'Run a script file.',
|
|
41
|
+
* SettingsSchema: [{ Name: 'ScriptPath', DataType: 'String', Required: true }] }
|
|
42
|
+
* }
|
|
43
|
+
*/
|
|
44
|
+
get actions()
|
|
45
|
+
{
|
|
46
|
+
return {};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/**
|
|
50
|
+
* Return the list of capability strings this provider advertises.
|
|
51
|
+
*
|
|
52
|
+
* Usually just [this.Capability]. Override for multi-capability
|
|
53
|
+
* providers.
|
|
54
|
+
*
|
|
55
|
+
* @returns {string[]}
|
|
56
|
+
*/
|
|
57
|
+
getCapabilities()
|
|
58
|
+
{
|
|
59
|
+
return [this.Capability];
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
/**
|
|
63
|
+
* Return a structured description of all supported actions.
|
|
64
|
+
* Used for logging and introspection.
|
|
65
|
+
*
|
|
66
|
+
* @returns {Array<{ Capability: string, Action: string, Description: string }>}
|
|
67
|
+
*/
|
|
68
|
+
describeActions()
|
|
69
|
+
{
|
|
70
|
+
let tmpResult = [];
|
|
71
|
+
let tmpActions = this.actions;
|
|
72
|
+
let tmpActionNames = Object.keys(tmpActions);
|
|
73
|
+
|
|
74
|
+
for (let i = 0; i < tmpActionNames.length; i++)
|
|
75
|
+
{
|
|
76
|
+
tmpResult.push({
|
|
77
|
+
Capability: this.Capability,
|
|
78
|
+
Action: tmpActionNames[i],
|
|
79
|
+
Description: tmpActions[tmpActionNames[i]].Description || ''
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
return tmpResult;
|
|
84
|
+
}
|
|
85
|
+
|
|
86
|
+
/**
|
|
87
|
+
* Execute a work item for the given action.
|
|
88
|
+
*
|
|
89
|
+
* @param {string} pAction - The action to perform (e.g. 'Execute', 'Read')
|
|
90
|
+
* @param {object} pWorkItem - The full work item from the server:
|
|
91
|
+
* { WorkItemHash, Capability, Action, Settings, TimeoutMs, OperationHash }
|
|
92
|
+
* @param {object} pContext - Execution context: { StagingPath }
|
|
93
|
+
* @param {function} fCallback - function(pError, pResult)
|
|
94
|
+
* pResult = { Outputs: { ... }, Log: [...] }
|
|
95
|
+
* @param {function} [fReportProgress] - Optional progress callback:
|
|
96
|
+
* function({ Percent, Message, Step, TotalSteps, Log })
|
|
97
|
+
* All fields optional. Call during long-running operations.
|
|
98
|
+
*/
|
|
99
|
+
execute(pAction, pWorkItem, pContext, fCallback, fReportProgress)
|
|
100
|
+
{
|
|
101
|
+
return fCallback(new Error(
|
|
102
|
+
`Provider "${this.Name}" has not implemented execute() for action "${pAction}".`));
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* Optional lifecycle hook: called after provider is loaded,
|
|
107
|
+
* before the beacon starts polling. Use for async initialization
|
|
108
|
+
* (e.g. verifying that ffmpeg exists, connecting to a local API).
|
|
109
|
+
*
|
|
110
|
+
* @param {function} fCallback - function(pError)
|
|
111
|
+
*/
|
|
112
|
+
initialize(fCallback)
|
|
113
|
+
{
|
|
114
|
+
return fCallback(null);
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* Optional lifecycle hook: called when the beacon is shutting down.
|
|
119
|
+
* Use for cleanup (e.g. closing connections, flushing buffers).
|
|
120
|
+
*
|
|
121
|
+
* @param {function} fCallback - function(pError)
|
|
122
|
+
*/
|
|
123
|
+
shutdown(fCallback)
|
|
124
|
+
{
|
|
125
|
+
return fCallback(null);
|
|
126
|
+
}
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
module.exports = UltravisorBeaconCapabilityProvider;
|