@litmusio/miravo 0.0.0-stage → 0.15.9

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 (81) hide show
  1. package/LICENSE +199 -0
  2. package/NOTICE +9 -0
  3. package/README.md +143 -2
  4. package/THIRD_PARTY_LICENSES.txt +15289 -0
  5. package/THIRD_PARTY_NOTICES.md +995 -0
  6. package/bin/miravo.js +85 -0
  7. package/install.ps1 +230 -0
  8. package/install.sh +758 -0
  9. package/licenses/EPL-2.0.txt +80 -0
  10. package/licenses/GCC-exception-3.1.txt +33 -0
  11. package/licenses/GPL-2.0-only.txt +117 -0
  12. package/licenses/GPL-3.0-only.txt +232 -0
  13. package/licenses/LGPL-2.1-only.txt +176 -0
  14. package/licenses/MPL-2.0.txt +373 -0
  15. package/licenses/OFL-1.1.txt +93 -0
  16. package/licenses/overrides/@headlessui+vue@1.7.23.txt +24 -0
  17. package/licenses/overrides/@next+env@16.4.6.txt +24 -0
  18. package/licenses/overrides/@radix-ui+react-compose-refs@1.1.2.txt +24 -0
  19. package/licenses/overrides/@radix-ui+react-context@1.1.2.txt +24 -0
  20. package/licenses/overrides/@radix-ui+react-direction@1.1.1.txt +24 -0
  21. package/licenses/overrides/@radix-ui+react-id@1.1.1.txt +24 -0
  22. package/licenses/overrides/@radix-ui+react-use-callback-ref@1.1.1.txt +24 -0
  23. package/licenses/overrides/@radix-ui+react-use-escape-keydown@1.1.1.txt +24 -0
  24. package/licenses/overrides/@radix-ui+react-use-layout-effect@1.1.1.txt +24 -0
  25. package/licenses/overrides/@radix-ui+react-use-rect@1.1.1.txt +24 -0
  26. package/licenses/overrides/@radix-ui+react-use-size@1.1.1.txt +24 -0
  27. package/licenses/overrides/@radix-ui+rect@1.1.1.txt +24 -0
  28. package/licenses/overrides/@replit+codemirror-css-color-picker@6.3.0.txt +6 -0
  29. package/licenses/overrides/@scalar+openapi-types@0.8.0.txt +24 -0
  30. package/licenses/overrides/@scalar+openapi-types@0.9.10.txt +24 -0
  31. package/licenses/overrides/@scalar+openapi-types@0.9.7.txt +24 -0
  32. package/licenses/overrides/@scalar+openapi-types@0.9.9.txt +24 -0
  33. package/licenses/overrides/@scalar+postman-to-openapi@0.7.1.txt +24 -0
  34. package/licenses/overrides/@scalar+schemas@0.19.0.txt +24 -0
  35. package/licenses/overrides/@scalar+workspace-store@0.46.3.txt +24 -0
  36. package/licenses/overrides/@scalar+workspace-store@0.75.0.txt +24 -0
  37. package/licenses/overrides/assert-plus@1.0.0.txt +24 -0
  38. package/licenses/overrides/client-only@0.0.1.txt +24 -0
  39. package/licenses/overrides/embla-carousel-react@8.6.0.txt +24 -0
  40. package/licenses/overrides/embla-carousel-reactive-utils@8.6.0.txt +24 -0
  41. package/licenses/overrides/embla-carousel@8.6.0.txt +24 -0
  42. package/licenses/overrides/fastdom@1.0.12.txt +12 -0
  43. package/licenses/overrides/precond@0.2.3.txt +22 -0
  44. package/licenses/overrides/react-remove-scroll-bar@2.3.8.txt +24 -0
  45. package/licenses/overrides/strictdom@1.0.1.txt +12 -0
  46. package/licenses/overrides/victory-vendor@36.9.2.txt +33 -0
  47. package/licenses/runtime/Bun-1.4.3-LICENSE.md +85 -0
  48. package/licenses/runtime/ICU-78.1-LICENSE.txt +568 -0
  49. package/licenses/runtime/bun-components/boringssl.txt +238 -0
  50. package/licenses/runtime/bun-components/brotli.txt +19 -0
  51. package/licenses/runtime/bun-components/c-ares.txt +24 -0
  52. package/licenses/runtime/bun-components/highway.txt +371 -0
  53. package/licenses/runtime/bun-components/libarchive.txt +65 -0
  54. package/licenses/runtime/bun-components/libbase64.txt +28 -0
  55. package/licenses/runtime/bun-components/libdeflate.txt +22 -0
  56. package/licenses/runtime/bun-components/libjpeg-turbo.txt +147 -0
  57. package/licenses/runtime/bun-components/libspng.txt +25 -0
  58. package/licenses/runtime/bun-components/libuv.txt +19 -0
  59. package/licenses/runtime/bun-components/libwebp.txt +30 -0
  60. package/licenses/runtime/bun-components/llvm.txt +311 -0
  61. package/licenses/runtime/bun-components/lol-html.txt +27 -0
  62. package/licenses/runtime/bun-components/ls-hpack.txt +21 -0
  63. package/licenses/runtime/bun-components/ls-qpack.txt +21 -0
  64. package/licenses/runtime/bun-components/lsquic-chrome.txt +32 -0
  65. package/licenses/runtime/bun-components/lsquic.txt +21 -0
  66. package/licenses/runtime/bun-components/mimalloc.txt +21 -0
  67. package/licenses/runtime/bun-components/picohttpparser.txt +24 -0
  68. package/licenses/runtime/bun-components/simdutf-apache.txt +201 -0
  69. package/licenses/runtime/bun-components/simdutf-mit.txt +18 -0
  70. package/licenses/runtime/bun-components/tigerbeetle.txt +177 -0
  71. package/licenses/runtime/bun-components/tinycc.txt +504 -0
  72. package/licenses/runtime/bun-components/typescript-go.txt +55 -0
  73. package/licenses/runtime/bun-components/usockets.txt +201 -0
  74. package/licenses/runtime/bun-components/uucode.txt +30 -0
  75. package/licenses/runtime/bun-components/uwebsockets.txt +201 -0
  76. package/licenses/runtime/bun-components/xxhash.txt +31 -0
  77. package/licenses/runtime/bun-components/zlib-ng.txt +19 -0
  78. package/licenses/runtime/bun-components/zstd-copying.txt +339 -0
  79. package/licenses/runtime/bun-components/zstd.txt +30 -0
  80. package/licenses/runtime/musl-1.2.6-COPYRIGHT.txt +193 -0
  81. package/package.json +64 -4
package/bin/miravo.js ADDED
@@ -0,0 +1,85 @@
1
+ #!/usr/bin/env node
2
+
3
+ const fs = require("node:fs");
4
+ const path = require("node:path");
5
+ const { spawnSync } = require("node:child_process");
6
+
7
+ const PLATFORM_PACKAGES = new Map([
8
+ ["linux/x64", "@litmusio/miravo-cli-linux-x64"],
9
+ ["linux/arm64", "@litmusio/miravo-cli-linux-arm64"],
10
+ ["linux/x64/musl", "@litmusio/miravo-cli-linux-x64-musl"],
11
+ ["linux/arm64/musl", "@litmusio/miravo-cli-linux-arm64-musl"],
12
+ ["darwin/x64", "@litmusio/miravo-cli-darwin-x64"],
13
+ ["darwin/arm64", "@litmusio/miravo-cli-darwin-arm64"],
14
+ ["win32/x64", "@litmusio/miravo-cli-windows-x64"],
15
+ ]);
16
+
17
+ function resolveBinaryName(platform) {
18
+ return platform === "win32" ? "miravo.exe" : "miravo";
19
+ }
20
+
21
+ function detectMuslLibc(options = {}) {
22
+ const fsModule = options.fsModule || fs;
23
+ const spawnSyncFn = options.spawnSyncFn || spawnSync;
24
+ try {
25
+ if (fsModule.existsSync("/etc/alpine-release")) return true;
26
+ } catch {}
27
+ try {
28
+ // Avoid /lib scanning: glibc hosts can also have musl loaders installed.
29
+ const result = spawnSyncFn("ldd", ["--version"], { encoding: "utf8" });
30
+ const combinedOutput = `${result?.stdout || ""}\n${result?.stderr || ""}`;
31
+ if (/\bmusl\b/i.test(combinedOutput)) return true;
32
+ } catch {}
33
+ return false;
34
+ }
35
+
36
+ function resolvePackageName(platform, arch, options = {}) {
37
+ const libc = platform === "linux" && detectMuslLibc(options) ? "/musl" : "";
38
+ return PLATFORM_PACKAGES.get(`${platform}/${arch}${libc}`);
39
+ }
40
+
41
+ function fail(message) {
42
+ process.stderr.write(`miravo: ${message}\n`);
43
+ process.exit(1);
44
+ }
45
+
46
+ function main() {
47
+ const platform = process.platform;
48
+ const arch = process.arch;
49
+ const packageName = resolvePackageName(platform, arch);
50
+
51
+ if (!packageName) {
52
+ fail(
53
+ `unsupported platform ${platform}/${arch}. Supported: linux/x64, linux/arm64, darwin/x64, darwin/arm64, win32/x64. Use the install script, Docker, or a standalone archive.`,
54
+ );
55
+ }
56
+
57
+ let pkgJsonPath;
58
+ try {
59
+ pkgJsonPath = require.resolve(`${packageName}/package.json`, { paths: [__dirname] });
60
+ } catch {
61
+ fail(
62
+ `${packageName} is not installed. Reinstall with optional dependencies enabled (example: npm install @litmusio/miravo --include=optional). If you use a corporate proxy, allow @litmusio/miravo and @litmusio/miravo-cli-* packages.`,
63
+ );
64
+ }
65
+
66
+ const bin = path.join(path.dirname(pkgJsonPath), resolveBinaryName(platform));
67
+ if (!fs.existsSync(bin)) {
68
+ fail(`${packageName} is incomplete: missing binary at ${bin}. Reinstall @litmusio/miravo.`);
69
+ }
70
+
71
+ const result = spawnSync(bin, process.argv.slice(2), {
72
+ stdio: "inherit",
73
+ windowsHide: false,
74
+ });
75
+ if (result.error) {
76
+ fail(`failed to spawn ${bin}: ${result.error.message}`);
77
+ }
78
+ process.exit(typeof result.status === "number" ? result.status : 1);
79
+ }
80
+
81
+ if (require.main === module) {
82
+ main();
83
+ }
84
+
85
+ module.exports = { main, resolveBinaryName, resolvePackageName };
package/install.ps1 ADDED
@@ -0,0 +1,230 @@
1
+ # Installs Miravo on Windows x64. Needs PowerShell 5.1 or later.
2
+ #
3
+ # irm https://cdn.jsdelivr.net/npm/@litmusio/miravo/install.ps1 | iex
4
+ # $env:MIRAVO_VERSION = "0.15.0"; irm https://cdn.jsdelivr.net/npm/@litmusio/miravo/install.ps1 | iex
5
+ #
6
+ # MIRAVO_INSTALL_DIR: install directory (default %LOCALAPPDATA%\Programs\miravo).
7
+ # MIRAVO_INSTALL_REGISTRY: npm registry to download from (default https://registry.npmjs.org).
8
+ # MIRAVO_INSTALL_SKILL: 1 installs the Miravo agent skill without asking, 0 skips it.
9
+ # MIRAVO_NO_MODIFY_PATH: 1 leaves the user PATH unchanged.
10
+
11
+ # Runs in a script block, so that under `irm | iex` its variables and
12
+ # preferences stay out of the user's session and a failure ends the install
13
+ # without closing the PowerShell window.
14
+ & {
15
+ $ErrorActionPreference = "Stop"
16
+ $ProgressPreference = "SilentlyContinue"
17
+ $Version = $env:MIRAVO_VERSION
18
+ $Package = "@litmusio/miravo"
19
+ $PlatformPackage = "@litmusio/miravo-cli-windows-x64"
20
+ $VersionsUrl = "https://www.npmjs.com/package/${Package}?activeTab=versions"
21
+ $Registry = if ($env:MIRAVO_INSTALL_REGISTRY) { $env:MIRAVO_INSTALL_REGISTRY.TrimEnd("/") } else { "https://registry.npmjs.org" }
22
+ $InstallDir = if ($env:MIRAVO_INSTALL_DIR) { $env:MIRAVO_INSTALL_DIR } else { Join-Path $env:LOCALAPPDATA "Programs\miravo" }
23
+
24
+ $Retry = "Retry; if it persists, report it at https://github.com/litmusautomation/miravo/issues."
25
+
26
+ function Fail([string]$Message, [string]$Fix) {
27
+ throw "miravo install: $Message`n$Fix"
28
+ }
29
+
30
+ # Windows PowerShell 5.1 does not offer TLS 1.2 by default.
31
+ [Net.ServicePointManager]::SecurityProtocol = [Net.ServicePointManager]::SecurityProtocol -bor [Net.SecurityProtocolType]::Tls12
32
+
33
+ # A 32-bit PowerShell on 64-bit Windows reports x86 here and the real
34
+ # architecture in PROCESSOR_ARCHITEW6432.
35
+ $arch = if ($env:PROCESSOR_ARCHITEW6432) { $env:PROCESSOR_ARCHITEW6432 } else { $env:PROCESSOR_ARCHITECTURE }
36
+ if ($arch -ne "AMD64") {
37
+ Fail "Windows $arch is not supported." "Use the Docker image ghcr.io/litmusautomation/miravo."
38
+ }
39
+ # Windows' own tar: a tar from Git for Windows earlier on PATH reads C: as
40
+ # a remote host.
41
+ $tar = Join-Path $env:SystemRoot "System32\tar.exe"
42
+ if (-not (Test-Path $tar)) {
43
+ Fail "needs tar.exe, which ships with Windows 10 1803 and later." "Update Windows, or install with npm (npm install -g $Package)."
44
+ }
45
+
46
+ if (-not $Version) {
47
+ try {
48
+ $Version = (Invoke-RestMethod "$Registry/-/package/$($Package.Replace('/', '%2f'))/dist-tags").latest
49
+ } catch {
50
+ Fail "could not get the latest version from ${Registry}: $($_.Exception.Message)" "Check your network, or pin a version with `$env:MIRAVO_VERSION (see $VersionsUrl)."
51
+ }
52
+ }
53
+ $Version = $Version.TrimStart("v")
54
+
55
+ $dest = Join-Path $InstallDir "miravo.exe"
56
+ $installedVersion = ""
57
+ $payload = @("miravo.exe", "console-dist\index.html", "nodesets\Opc.Ua.NodeSet2.xml", "native\miravo-s7.node")
58
+ $missing = @($payload | Where-Object { -not (Test-Path -LiteralPath (Join-Path $InstallDir $_) -PathType Leaf) })
59
+ if ($missing.Count -eq 0) {
60
+ $ErrorActionPreference = "Continue"
61
+ try {
62
+ $probe = @(& $dest --version 2>$null)
63
+ if ($LASTEXITCODE -eq 0 -and $probe.Count -gt 0) { $installedVersion = "$($probe[0])".Trim() }
64
+ } catch { $installedVersion = "" }
65
+ $ErrorActionPreference = "Stop"
66
+ }
67
+ if ($installedVersion -eq $Version) {
68
+ Write-Host "Miravo $Version already installed at $dest"
69
+ } else {
70
+
71
+ try {
72
+ $manifest = Invoke-RestMethod "$Registry/$PlatformPackage/$Version"
73
+ } catch {
74
+ Fail "Miravo $Version is not published for windows-x64." "Pick a published version from $VersionsUrl."
75
+ }
76
+ $integrity = [string]$manifest.dist.integrity
77
+ if (-not $integrity.StartsWith("sha512-")) {
78
+ Fail "the registry gave no sha512 checksum for $PlatformPackage@$Version." $Retry
79
+ }
80
+
81
+ $work = Join-Path ([IO.Path]::GetTempPath()) ([IO.Path]::GetRandomFileName())
82
+ New-Item -ItemType Directory -Path $work | Out-Null
83
+ $staged = $null
84
+ try {
85
+ Write-Host "Downloading Miravo $Version for windows-x64..."
86
+ $tgz = Join-Path $work "package.tgz"
87
+ try {
88
+ Invoke-WebRequest -UseBasicParsing -Uri $manifest.dist.tarball -OutFile $tgz
89
+ } catch {
90
+ Fail "could not download $($manifest.dist.tarball): $($_.Exception.Message)" "Check your network and retry."
91
+ }
92
+
93
+ try {
94
+ $bytes = [Convert]::FromBase64String($integrity.Substring(7))
95
+ } catch {
96
+ Fail "the registry gave an unreadable checksum for $PlatformPackage@$Version." $Retry
97
+ }
98
+ $expected = ([BitConverter]::ToString($bytes) -replace "-", "").ToLowerInvariant()
99
+ $actual = (Get-FileHash -Algorithm SHA512 -Path $tgz).Hash.ToLowerInvariant()
100
+ if ($expected -ne $actual) {
101
+ Fail "checksum mismatch for $PlatformPackage@$Version. Nothing was installed." "The download is corrupt or was tampered with. $Retry"
102
+ }
103
+
104
+ $payloadDirs = @("console-dist", "nodesets")
105
+ $entries = & $tar -tzf $tgz
106
+ if ($LASTEXITCODE -ne 0) { Fail "could not inspect the download." $Retry }
107
+ if ($entries | Where-Object { $_ -like "package/native/*" }) { $payloadDirs += "native" }
108
+ $extractPaths = @("package/miravo.exe") + @($payloadDirs | ForEach-Object { "package/$_" })
109
+ & $tar -xzf $tgz -C $work @extractPaths
110
+ if ($LASTEXITCODE -ne 0) { Fail "could not extract the download." "Retry; the download may be incomplete." }
111
+ $source = Join-Path $work "package"
112
+ foreach ($required in @("miravo.exe", "console-dist\index.html", "nodesets\Opc.Ua.NodeSet2.xml")) {
113
+ if (-not (Test-Path (Join-Path $source $required))) {
114
+ Fail "the download is missing $required. Nothing was installed." $Retry
115
+ }
116
+ }
117
+
118
+ New-Item -ItemType Directory -Force -Path $InstallDir | Out-Null
119
+ $dest = Join-Path $InstallDir "miravo.exe"
120
+ # Staged next to the old binary, so the final move is a same-volume rename.
121
+ $staged = Join-Path $InstallDir ".miravo-$([IO.Path]::GetRandomFileName()).exe"
122
+ Copy-Item -Path (Join-Path $source "miravo.exe") -Destination $staged
123
+ # Windows PowerShell 5.1 turns redirected native stderr into errors, which
124
+ # "Stop" would make fatal; only the exit code decides here.
125
+ $ErrorActionPreference = "Continue"
126
+ try {
127
+ & $staged --version *> $null
128
+ $runs = $LASTEXITCODE -eq 0
129
+ } catch {
130
+ $runs = $false
131
+ }
132
+ $ErrorActionPreference = "Stop"
133
+ if (-not $runs) {
134
+ Fail "the downloaded miravo does not run on this machine. Nothing was installed." "Install with npm (npm install -g $Package) or use the Docker image ghcr.io/litmusautomation/miravo."
135
+ }
136
+
137
+ # Swap console-dist and nodesets, keeping the old copies until the binary
138
+ # is in place so a failure leaves the previous install working.
139
+ $suffix = [IO.Path]::GetRandomFileName()
140
+ $moved = @()
141
+ try {
142
+ foreach ($dir in $payloadDirs) {
143
+ $current = Join-Path $InstallDir $dir
144
+ if (Test-Path $current) {
145
+ Move-Item -Path $current -Destination "$current.old-$suffix"
146
+ $moved += $dir
147
+ }
148
+ Move-Item -Path (Join-Path $source $dir) -Destination $current
149
+ }
150
+ Move-Item -Force -Path $staged -Destination $dest
151
+ } catch {
152
+ foreach ($dir in $payloadDirs) {
153
+ $current = Join-Path $InstallDir $dir
154
+ if ($moved -contains $dir) {
155
+ Remove-Item -Recurse -Force -Path $current -ErrorAction SilentlyContinue
156
+ Move-Item -Path "$current.old-$suffix" -Destination $current -ErrorAction SilentlyContinue
157
+ }
158
+ }
159
+ Fail "could not replace the install in $InstallDir." "Stop any running miravo (miravo stop) and retry."
160
+ }
161
+ foreach ($dir in $moved) {
162
+ Remove-Item -Recurse -Force -Path (Join-Path $InstallDir "$dir.old-$suffix") -ErrorAction SilentlyContinue
163
+ }
164
+ } finally {
165
+ Remove-Item -Recurse -Force -Path $work -ErrorAction SilentlyContinue
166
+ if ($staged) { Remove-Item -Force -Path $staged -ErrorAction SilentlyContinue }
167
+ }
168
+
169
+ Write-Host "Installed Miravo $Version to $dest"
170
+ }
171
+
172
+ $added = $false
173
+ if ($env:MIRAVO_NO_MODIFY_PATH -eq "1") {
174
+ Write-Host "User PATH left unchanged (MIRAVO_NO_MODIFY_PATH=1). Run miravo by its full path: $dest"
175
+ } else {
176
+ # The raw registry value: the Environment API would expand %VAR% entries
177
+ # and save the user PATH as a plain string.
178
+ $key = [Microsoft.Win32.Registry]::CurrentUser.OpenSubKey("Environment", $true)
179
+ try {
180
+ $userPath = [string]$key.GetValue("Path", "", [Microsoft.Win32.RegistryValueOptions]::DoNotExpandEnvironmentNames)
181
+ $entries = @($userPath -split ";" | Where-Object { $_ })
182
+ # Entries may hold %VARS% or a trailing backslash; compare them expanded.
183
+ $normalized = @($entries | ForEach-Object { [Environment]::ExpandEnvironmentVariables($_).TrimEnd("\") })
184
+ $added = $normalized -notcontains $InstallDir.TrimEnd("\")
185
+ if ($added) {
186
+ $kind = if ($userPath) { $key.GetValueKind("Path") } else { [Microsoft.Win32.RegistryValueKind]::ExpandString }
187
+ $key.SetValue("Path", (($entries + $InstallDir) -join ";"), $kind)
188
+ }
189
+ } finally {
190
+ $key.Close()
191
+ }
192
+ }
193
+ if ($added) {
194
+ # Setting a user variable through the Environment API announces the
195
+ # change, so terminals opened from now on see the new PATH.
196
+ $marker = "MIRAVO_INSTALL_$([IO.Path]::GetRandomFileName().Replace('.', ''))"
197
+ [Environment]::SetEnvironmentVariable($marker, "1", "User")
198
+ [Environment]::SetEnvironmentVariable($marker, $null, "User")
199
+ Write-Host "Added $InstallDir to your user PATH. Open a new terminal to use miravo."
200
+ }
201
+ if ($env:MIRAVO_NO_MODIFY_PATH -ne "1" -and ($env:Path -split ";") -notcontains $InstallDir) {
202
+ $env:Path = "$env:Path;$InstallDir"
203
+ }
204
+
205
+ $found = Get-Command miravo -CommandType Application -ErrorAction SilentlyContinue | Select-Object -First 1
206
+ if ($found -and $found.Source -ne $dest) {
207
+ Write-Host ""
208
+ Write-Host "Another miravo at $($found.Source) comes first on your PATH."
209
+ Write-Host "If npm installed it, remove it with: npm rm -g $Package"
210
+ }
211
+
212
+ $skill = $env:MIRAVO_INSTALL_SKILL
213
+ if (-not $skill -and [Environment]::UserInteractive -and -not [Console]::IsInputRedirected) {
214
+ $answer = Read-Host "Install the Miravo skill for Claude Code / Codex? [Y/n]"
215
+ $skill = if ($answer -eq "" -or $answer -match "^(y|yes)$") { "1" } else { "0" }
216
+ }
217
+ if ($skill -eq "1") {
218
+ # Never --force here: a folder or link the user put at the Claude Code
219
+ # path must surface instead of being replaced.
220
+ & $dest skill install
221
+ if ($LASTEXITCODE -ne 0) { Write-Host "Skill not installed: a folder or link is in the way at ~/.claude/skills/miravo, or the install failed. Run miravo skill install to see why; back up that folder before adding --force." }
222
+ }
223
+
224
+ Write-Host ""
225
+ if ($env:MIRAVO_NO_MODIFY_PATH -eq "1") {
226
+ Write-Host "Run: & `"$dest`" start -t smart-factory"
227
+ } else {
228
+ Write-Host "Run: miravo start -t smart-factory"
229
+ }
230
+ }