aegisai-harness 0.67.9 → 0.68.0

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/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  All notable changes to AegisAi Harness are documented here.
4
4
 
5
+ ## [0.68.0] - 2026-11-23
6
+
7
+ ### Fixed
8
+ - Installation: Windows installer now preflights Node.js 22.13+ with actionable messages; launcher no longer hides npm failures, uses `--omit=dev`, and records a dependency marker. Inno uninstall removes stale `node_modules`/lockfiles; `install.ps1` preserves `data/` and handles GitHub source zips.
9
+ - Packaging: `package.json` is the single version source; CI checks version strings across installer/docs/changelog. Release workflow honors its `tag` input, derives versions from the tag, refuses mismatches, and publishes SHA-256 checksums. Standalone binary builds use pkg 6 + Node 24 targets and `--out-path` (pkg 5/node22 produced broken binaries).
10
+ - Web UI: chat now posts `message` (server API field), onboarding actually applies the chosen model and auth token, token auth is read per request with a constant-time comparison, and tool auto-approval from the browser is opt-in (`AEGISAI_WEB_AUTO_APPROVE`).
11
+ - TUI: fixed a temporal-dead-zone `root` reference that made `node src/index.js --tui` crash immediately.
12
+ - Offline: Preact/htm/Tailwind are vendored under `public/vendor/`; service worker is registered, versioned, and caches all UI assets.
13
+ - Security: static file serving rejects `../` and encoded traversal paths; new `src/http_utils.js` helper with tests.
14
+ - npm global installs: added a shebang and a `preinstall` Node version guard so `npm i -g` fails clearly on unsupported runtimes instead of leaving a broken CLI.
15
+
16
+ ### Added
17
+ - `scripts/check-version-consistency.js`, `scripts/check-node.js`, `docs/TROUBLESHOOTING.md`, and regression tests for entry points, web auth, path traversal, and UI wiring.
18
+
5
19
  ## [0.63.0] - 2026-11-22
6
20
 
7
21
  ### Added
package/HARNESS_DOCS.md CHANGED
@@ -11,7 +11,7 @@ Layers:
11
11
  4. **Integrations** (`src/integrations`) — MCP client + security scanner, CDP browser (AX-first), REA/Ghidra/Craft.
12
12
  5. **Memory & context** — SQLite persistence, compaction + archive, source-bound/bi-temporal memory, context files, context filesystem, capsules.
13
13
  6. **Quality** — evals, benchmarks, harness score, reliability attribution, counterfactual optimizer, adversarial tests, CI template.
14
- 7. **Interfaces** — CLI/REPL, `--web` UI, `--rpc`, OpenAI-compatible `--proxy`, JSON `--json`.
14
+ 7. **Interfaces** — CLI/REPL, `--web` UI, `--rpc`, OpenAI-compatible `--proxy`, JSON `--json`. The web UI's Preact/Tailwind assets are vendored in `public/vendor/` (no CDN), and the service worker caches them for offline restarts. Web chat does not auto-approve tool calls unless `AEGISAI_WEB_AUTO_APPROVE=true`.
15
15
 
16
16
  ## Guides
17
17
 
package/README.md CHANGED
@@ -10,7 +10,7 @@ A **feature-rich, local-only AI agent harness** — OpenCode-class runtime, but
10
10
  offline-first: no cloud dependencies, no telemetry. 66 milestones, ~200 modules,
11
11
  257 tests, CI green.
12
12
 
13
- > Status: v0.66.0 (see [ROADMAP.md](./ROADMAP.md)).
13
+ > Status: v0.68.0 (see [ROADMAP.md](./ROADMAP.md)).
14
14
  > **Successor to [aegisai-next](https://github.com/user6811992/aegisai-next)** — that project is deprecated; all features have been ported here.
15
15
  > **Live docs:** https://user6811992.github.io/aegisai-harness/
16
16
 
@@ -47,7 +47,7 @@ npm install
47
47
  npm start
48
48
  ```
49
49
 
50
- Requires Node 22.5+ and a local backend (Ollama recommended).
50
+ Requires **Node.js 22.13+** (`node -v` to check) and a local backend (Ollama recommended). The Windows installer does **not** bundle Node.js — install the LTS from [nodejs.org](https://nodejs.org) first and reopen your terminal so `node` is on PATH.
51
51
 
52
52
  ### Web UI
53
53
 
@@ -88,6 +88,13 @@ node src/index.js --json "your prompt here"
88
88
  bash packaging/build-binary.sh
89
89
  ```
90
90
 
91
+ CI enforces `npm run check:version` so `package.json`, the installer filename, docs, and release tag always agree. Release assets include a `.sha256` checksum file — verify it before running an installer:
92
+
93
+ ```bash
94
+ # PowerShell (in the download folder)
95
+ Get-FileHash .\AegisAi-Harness-0.68.0-Setup.exe -Algorithm SHA256
96
+ ```
97
+
91
98
  ## Environment variables
92
99
 
93
100
  See [ROADMAP.md](./ROADMAP.md) for the full list. Key ones:
@@ -101,12 +108,22 @@ See [ROADMAP.md](./ROADMAP.md) for the full list. Key ones:
101
108
  | `BACKEND_URL` | Backend URL | auto-detect |
102
109
  | `AEGISAI_DATA_DIR` | Data directory | ./data |
103
110
  | `AEGISAI_PROJECT_ROOT_ALLOWLIST` | Allow-list for agent project roots | (none) |
111
+ | `AEGISAI_WEB_AUTO_APPROVE` | Allow the web UI to auto-approve tool calls (off by default) | false |
112
+
113
+ ## Troubleshooting
114
+
115
+ See [docs/TROUBLESHOOTING.md](./docs/TROUBLESHOOTING.md) for full details. Quick fixes:
116
+
117
+ - **`.js` files open in Notepad / `node` is not recognized** — Node.js isn't installed or isn't on PATH. Install Node 22.13+ LTS from https://nodejs.org, reopen the terminal, verify `node -v`, then reinstall/retry. Double-clicking a `.js` file is not how the harness starts.
118
+ - **Stale version after uninstalling** — the old runtime `node_modules` survives an Inno uninstall in older builds. Delete `%LOCALAPPDATA%\Programs\AegisAiHarness` (or `%LOCALAPPDATA%\AegisAiHarness`) before reinstalling. For npm: `npm uninstall -g aegisai-harness && npm cache clean --force`.
119
+ - **Web UI is blank offline** — v0.68.0 vendors Preact/Tailwind locally; clear the browser cache if an older service worker is still serving stale assets.
120
+ - **Web chat sends empty prompts** — fixed in v0.68.0; the browser now posts `message`, matching the server API.
104
121
 
105
122
  ## Layout
106
123
 
107
124
  ```
108
125
  src/ 150+ modules (agent, tools, backends, storage, integrations, ...)
109
- public/ web UI (Preact via CDN, no build step)
126
+ public/ web UI (Preact + Tailwind vendored locally, no build step)
110
127
  tests/ 257 tests (node:test)
111
128
  packaging/ Windows/macOS/Linux installers + binary build
112
129
  docs/ landing page (GitHub Pages)
package/llms.txt CHANGED
@@ -1,6 +1,6 @@
1
1
  # AegisAi Harness — agent-readable catalog
2
2
 
3
- A feature-rich, local-only AI agent harness. CLI-first, offline-first. v0.63.0.
3
+ A feature-rich, local-only AI agent harness. CLI-first, offline-first. v0.68.0.
4
4
 
5
5
  ## Capabilities
6
6
  - Multi-backend LLM adapter (Ollama + OpenAI-compatible + 18 providers)
@@ -33,6 +33,7 @@ A feature-rich, local-only AI agent harness. CLI-first, offline-first. v0.63.0.
33
33
  - `node src/index.js --mcp-server` — MCP server
34
34
  - `node src/index.js --json "<prompt>"` — headless JSON output
35
35
  - `node src/index.js --update` — version check
36
+ - `node src/index.js --help` — list all flags
36
37
 
37
38
  ## Docs
38
39
  - README.md, ROADMAP.md, HARNESS_DOCS.md, CONTRIBUTING.md, CHANGELOG.md, LICENSE
package/package.json CHANGED
@@ -1,18 +1,25 @@
1
1
  {
2
2
  "name": "aegisai-harness",
3
- "version": "0.67.9",
3
+ "version": "0.68.0",
4
4
  "description": "AegisAi Harness — feature-rich, local-only AI agent harness",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
7
7
  "bin": { "aegisai-harness": "src/index.js", "aegisai": "src/index.js" },
8
- "files": ["src/", "public/", "packaging/", "README.md", "LICENSE", "ROADMAP.md", "CHANGELOG.md", "HARNESS_DOCS.md", "CONTRIBUTING.md", "llms.txt"],
8
+ "files": ["src/", "public/", "packaging/", "scripts/", "README.md", "LICENSE", "ROADMAP.md", "CHANGELOG.md", "HARNESS_DOCS.md", "CONTRIBUTING.md", "llms.txt"],
9
9
  "scripts": {
10
+ "preinstall": "node scripts/check-node.js",
10
11
  "start": "node src/index.js",
11
12
  "dev": "node --watch src/index.js",
12
- "test": "node --test tests/**/*.test.js"
13
+ "test": "node --test tests/**/*.test.js",
14
+ "lint": "node scripts/run-lint.js",
15
+ "check:version": "node scripts/check-version-consistency.js"
16
+ },
17
+ "pkg": {
18
+ "assets": ["public/**/*", "README.md", "LICENSE", "CHANGELOG.md", "llms.txt"],
19
+ "targets": ["node24-win-x64", "node24-linux-x64", "node24-macos-x64"]
13
20
  },
14
21
  "engines": {
15
- "node": ">=22.5"
22
+ "node": ">=22.13"
16
23
  },
17
24
  "dependencies": {},
18
25
  "optionalDependencies": {
@@ -1,10 +1,17 @@
1
1
  #!/usr/bin/env bash
2
- # Build a single standalone binary using @yao-pkg/pkg.
2
+ # Build standalone binaries using @yao-pkg/pkg.
3
3
  # Requires network access on first run (npx downloads the packager).
4
4
  set -euo pipefail
5
5
  ROOT="$(cd "$(dirname "$0")/.." && pwd)"
6
6
  cd "$ROOT"
7
7
  VERSION=$(node -p "require('./package.json').version")
8
- mkdir -p dist
9
- npx --yes @yao-pkg/pkg@5 src/index.js --targets node22-win-x64,node22-linux-x64,node22-macos-x64 --output dist/aegisai-harness-$VERSION
10
- echo "Built dist/aegisai-harness-$VERSION"
8
+ OUT="dist/aegisai-harness-$VERSION"
9
+ mkdir -p "$OUT"
10
+
11
+ # pkg 5 + node22 targets are known to emit broken binaries; pkg 6 + node24 is stable.
12
+ # --output is for a single target; multi-target builds must use --out-path.
13
+ npx --yes @yao-pkg/pkg@6 src/index.js \
14
+ --targets node24-win-x64,node24-linux-x64,node24-macos-x64 \
15
+ --out-path "$OUT"
16
+
17
+ echo "Built binaries in $OUT"
@@ -1,6 +1,6 @@
1
1
  # Build AegisAi Harness for Windows.
2
2
  # Usage: .\packaging\build.ps1 [-Binary] [-Installer]
3
- # -Binary: build standalone exe via pkg (requires network on first run)
3
+ # -Binary: build standalone exe via @yao-pkg/pkg (requires network on first run)
4
4
  # -Installer: build Inno Setup installer (requires ISCC on PATH)
5
5
  param([switch]$Binary, [switch]$Installer)
6
6
 
@@ -13,16 +13,25 @@ Write-Host "Building AegisAi Harness v$Version" -ForegroundColor Cyan
13
13
 
14
14
  New-Item -ItemType Directory -Force -Path dist | Out-Null
15
15
 
16
- # Update version in installer.iss
16
+ # package.json is the single source of truth; mirror the version into the .iss.
17
17
  $issPath = "packaging\windows\installer.iss"
18
18
  $iss = Get-Content $issPath -Raw
19
- $iss = $iss -replace 'AppVersion=\d+\.\d+\.\d+', "AppVersion=$Version"
20
- $iss = $iss -replace 'OutputBaseFilename=AegisAi-Harness-[\d.]+-Setup', "OutputBaseFilename=AegisAi-Harness-$Version-Setup"
21
- Set-Content $issPath $iss
19
+ $updated = $iss -replace 'AppVersion=\d+\.\d+\.\d+', "AppVersion=$Version"
20
+ $updated = $updated -replace 'OutputBaseFilename=AegisAi-Harness-[\d.]+-Setup', "OutputBaseFilename=AegisAi-Harness-$Version-Setup"
21
+ if ($updated -notmatch "AppVersion=$Version" -or $updated -notmatch "OutputBaseFilename=AegisAi-Harness-$Version-Setup") {
22
+ Write-Error "Failed to update version strings in $issPath"
23
+ exit 1
24
+ }
25
+ Set-Content $issPath $updated
26
+
27
+ node scripts/check-version-consistency.js
28
+ if ($LASTEXITCODE -ne 0) { Write-Error "Version consistency check failed"; exit 1 }
22
29
 
23
30
  if ($Binary -or (-not $Installer)) {
24
31
  Write-Host "Building standalone binary..." -ForegroundColor Yellow
25
- npx --yes @yao-pkg/pkg@5 src/index.js --targets node22-win-x64 --output "dist\aegisai-harness-$Version.exe"
32
+ # pkg 5 + node22 targets are known to produce broken binaries; use pkg 6 + node24.
33
+ npx --yes @yao-pkg/pkg@6 src/index.js --targets node24-win-x64 --output "dist\aegisai-harness-$Version.exe"
34
+ if ($LASTEXITCODE -ne 0) { Write-Error "pkg build failed"; exit 1 }
26
35
  Write-Host "Binary: dist\aegisai-harness-$Version.exe" -ForegroundColor Green
27
36
  }
28
37
 
@@ -31,7 +40,14 @@ if ($Installer) {
31
40
  if (-not $Iscc) { Write-Error "ISCC (Inno Setup) not found on PATH. Install from https://jrsoftware.org/isdl.php"; exit 1 }
32
41
  Write-Host "Building Inno Setup installer..." -ForegroundColor Yellow
33
42
  & iscc "packaging\windows\installer.iss"
34
- Write-Host "Installer: dist\AegisAi-Harness-$Version-Setup.exe" -ForegroundColor Green
43
+ if ($LASTEXITCODE -ne 0) { Write-Error "Inno Setup build failed"; exit 1 }
44
+
45
+ $exe = "dist\AegisAi-Harness-$Version-Setup.exe"
46
+ if (-not (Test-Path $exe)) { Write-Error "Expected installer not found: $exe"; exit 1 }
47
+ $hash = (Get-FileHash $exe -Algorithm SHA256).Hash.ToLowerInvariant()
48
+ "$hash AegisAi-Harness-$Version-Setup.exe" | Set-Content "dist\AegisAi-Harness-$Version-Setup.exe.sha256"
49
+ Write-Host "Installer: $exe" -ForegroundColor Green
50
+ Write-Host "SHA256: $hash" -ForegroundColor Green
35
51
  }
36
52
 
37
53
  Write-Host "Done." -ForegroundColor Green
@@ -1,20 +1,63 @@
1
1
  # packaging/install.ps1
2
- # Install the harness to %LOCALAPPDATA%\AegisAiHarness
2
+ # Install the harness to %LOCALAPPDATA%\AegisAiHarness without losing user data.
3
3
  param([string]$SourceZip)
4
4
  $ErrorActionPreference = "Stop"
5
+
5
6
  $dest = Join-Path $env:LOCALAPPDATA "AegisAiHarness"
7
+ $dataPath = Join-Path $dest "data"
8
+
9
+ # Preserve sessions/memories across reinstalls (the old script deleted them).
10
+ $hadData = Test-Path $dataPath
11
+ $backup = $null
12
+ if ($hadData) {
13
+ $backup = Join-Path $env:TEMP ("aegisai-harness-data-" + (Get-Date -Format yyyyMMddHHmmss))
14
+ New-Item -ItemType Directory -Path $backup | Out-Null
15
+ Copy-Item -Path $dataPath -Destination (Join-Path $backup "data") -Recurse -Force
16
+ }
17
+
6
18
  if (Test-Path $dest) { Remove-Item $dest -Recurse -Force }
7
19
  New-Item -ItemType Directory -Path $dest | Out-Null
20
+
8
21
  if ($SourceZip) {
9
- Expand-Archive -Path $SourceZip -DestinationPath $dest
22
+ $stage = Join-Path $env:TEMP ("aegisai-harness-zip-" + (Get-Date -Format yyyyMMddHHmmss))
23
+ Expand-Archive -Force -Path $SourceZip -DestinationPath $stage
24
+ # GitHub source zips contain a single top-level folder; find the actual repo root.
25
+ $candidate = Get-ChildItem -Path $stage -Directory -Recurse |
26
+ Where-Object { (Test-Path (Join-Path $_.FullName "src")) -and (Test-Path (Join-Path $_.FullName "package.json")) } |
27
+ Select-Object -First 1
28
+ if (-not $candidate) { throw "SourceZip does not contain a folder with src/ and package.json" }
29
+ $root = $candidate.FullName
10
30
  } else {
11
- # assume running from repo
12
31
  $root = Split-Path -Parent $PSScriptRoot
13
- Copy-Item -Path (Join-Path $root "src") -Destination $dest -Recurse
14
- Copy-Item -Path (Join-Path $root "package.json") -Destination $dest
15
32
  }
16
- # create launcher
33
+
34
+ Copy-Item -Path (Join-Path $root "src") -Destination $dest -Recurse
35
+ Copy-Item -Path (Join-Path $root "public") -Destination $dest -Recurse
36
+ Copy-Item -Path (Join-Path $root "package.json") -Destination $dest
37
+ foreach ($doc in @("README.md", "LICENSE", "CHANGELOG.md", "llms.txt")) {
38
+ $f = Join-Path $root $doc
39
+ if (Test-Path $f) { Copy-Item -Path $f -Destination $dest }
40
+ }
41
+
42
+ if ($hadData -and (Test-Path (Join-Path $backup "data"))) {
43
+ Copy-Item -Path (Join-Path $backup "data") -Destination $dest -Recurse -Force
44
+ }
45
+
17
46
  $launcher = Join-Path $dest "aegisai-harness.cmd"
18
- Set-Content -Path $launcher -Value "@echo off`nnode `"%~dp0src\index.js`" %*"
47
+ $launcherText = @'
48
+ @echo off
49
+ setlocal
50
+ cd /d "%~dp0"
51
+ where node >nul 2>&1
52
+ if errorlevel 1 (
53
+ echo [AegisAi] Node.js 22.13+ is required but was not found on PATH.
54
+ echo [AegisAi] Install Node.js from https://nodejs.org and reopen this shortcut.
55
+ pause
56
+ exit /b 1
57
+ )
58
+ node src\index.js %*
59
+ '@
60
+ Set-Content -Path $launcher -Value $launcherText
61
+
19
62
  Write-Host "Installed to $dest"
20
63
  Write-Host "Run: $launcher"
@@ -1,8 +1,34 @@
1
1
  @echo off
2
2
  setlocal
3
3
  cd /d "%~dp0"
4
- if not exist "node_modules" (
5
- echo Installing dependencies...
6
- call npm install --production --silent 2>nul
4
+
5
+ where node >nul 2>&1
6
+ if errorlevel 1 (
7
+ echo [AegisAi] Node.js was not found on PATH.
8
+ echo [AegisAi] Install Node.js 22.13+ (LTS) from https://nodejs.org,
9
+ echo [AegisAi] then reopen this shortcut in a new terminal.
10
+ pause
11
+ exit /b 1
7
12
  )
13
+
14
+ node -e "const v=process.versions.node.split('.').map(Number);process.exit(v[0]>22||(v[0]===22&&v[1]>=13)?0:1)" >nul 2>&1
15
+ if errorlevel 1 (
16
+ echo [AegisAi] Node.js 22.13+ is required. Found:
17
+ node --version
18
+ echo [AegisAi] Upgrade from https://nodejs.org and rerun the installer.
19
+ pause
20
+ exit /b 1
21
+ )
22
+
23
+ if not exist ".deps-ok" (
24
+ echo [AegisAi] First run: installing optional dependencies (needs internet once).
25
+ echo [AegisAi] The built-in SQLite backend works even if this step fails.
26
+ call npm install --omit=dev --no-audit --no-fund
27
+ if errorlevel 1 (
28
+ echo [AegisAi] WARNING: dependency install failed; continuing without optional packages.
29
+ ) else (
30
+ echo ok> ".deps-ok"
31
+ )
32
+ )
33
+
8
34
  node src\index.js %*
@@ -1,14 +1,16 @@
1
1
  ; Inno Setup script for AegisAi Harness
2
- ; Build with: iscc packaging\windows\installer.iss
2
+ ; Build with: .\packaging\build.ps1 -Installer
3
+ ; Version strings are checked by scripts/check-version-consistency.js (CI).
3
4
  [Setup]
5
+ AppId={{8F3D1B2A-6C4E-4B9A-9D21-AE615A010001}}
4
6
  AppName=AegisAi Harness
5
- AppVersion=0.67.3
7
+ AppVersion=0.68.0
6
8
  AppPublisher=AegisAi
7
9
  AppPublisherURL=https://github.com/user6811992/aegisai-harness
8
10
  DefaultDirName={autopf}\AegisAiHarness
9
11
  DefaultGroupName=AegisAi Harness
10
12
  OutputDir=..\..\dist
11
- OutputBaseFilename=AegisAi-Harness-0.67.3-Setup
13
+ OutputBaseFilename=AegisAi-Harness-0.68.0-Setup
12
14
  Compression=lzma2
13
15
  SolidCompression=yes
14
16
  PrivilegesRequired=lowest
@@ -27,6 +29,7 @@ Source: "..\..\package.json"; DestDir: "{app}"; Flags: ignoreversion
27
29
  Source: "..\..\README.md"; DestDir: "{app}"; Flags: ignoreversion
28
30
  Source: "..\..\ROADMAP.md"; DestDir: "{app}"; Flags: ignoreversion
29
31
  Source: "..\..\HARNESS_DOCS.md"; DestDir: "{app}"; Flags: ignoreversion
32
+ Source: "..\..\CHANGELOG.md"; DestDir: "{app}"; Flags: ignoreversion
30
33
  Source: "..\..\llms.txt"; DestDir: "{app}"; Flags: ignoreversion skipifsourcedoesntexist
31
34
  Source: "aegisai-harness.cmd"; DestDir: "{app}"; Flags: ignoreversion
32
35
 
@@ -38,8 +41,42 @@ Name: "{autodesktop}\AegisAi Harness"; Filename: "{app}\aegisai-harness.cmd"; Wo
38
41
  [Run]
39
42
  Filename: "{app}\aegisai-harness.cmd"; Description: "Launch AegisAi Harness"; Flags: nowait postinstall skipifsilent
40
43
 
44
+ [UninstallDelete]
45
+ ; Generated at first launch by the launcher, not installed by Setup.
46
+ ; Removing them prevents an old dependency tree being reused after an upgrade.
47
+ Type: filesandordirs; Name: "{app}\node_modules"
48
+ Type: files; Name: "{app}\package-lock.json"
49
+ Type: files; Name: "{app}\.deps-ok"
50
+ ; {app}\data is intentionally preserved so user sessions/memories survive uninstall.
51
+
41
52
  [Code]
42
53
  function InitializeSetup(): Boolean;
54
+ var
55
+ ResultCode: Integer;
43
56
  begin
44
57
  Result := True;
58
+
59
+ if not Exec(ExpandConstant('{cmd}'), '/c where node >nul 2>&1', '', SW_HIDE, ewWaitUntilTerminated, ResultCode) or (ResultCode <> 0) then
60
+ begin
61
+ MsgBox(
62
+ 'AegisAi Harness needs Node.js 22.13 or newer, but ''node'' was not found on PATH.' + #13#10 +
63
+ '1. Download the LTS installer from https://nodejs.org' + #13#10 +
64
+ '2. Install it and reopen this installer (a terminal restart is required).' + #13#10 +
65
+ '3. Verify with: node -v',
66
+ mbError, MB_OK);
67
+ Result := False;
68
+ Exit;
69
+ end;
70
+
71
+ if not Exec(ExpandConstant('{cmd}'),
72
+ '/c node -e "const v=process.versions.node.split(''.'').map(Number);process.exit(v[0]>22||(v[0]===22&&v[1]>=13)?0:1)"',
73
+ '', SW_HIDE, ewWaitUntilTerminated, ResultCode) or (ResultCode <> 0) then
74
+ begin
75
+ MsgBox(
76
+ 'AegisAi Harness needs Node.js 22.13 or newer.' + #13#10 +
77
+ 'The installed version is too old (or not runnable).' + #13#10 +
78
+ 'Upgrade from https://nodejs.org and rerun this installer.',
79
+ mbError, MB_OK);
80
+ Result := False;
81
+ end;
45
82
  end;
package/public/app.js CHANGED
@@ -1,6 +1,7 @@
1
- import { h, render } from 'https://esm.sh/preact@10.25.4';
2
- import { useState, useEffect, useRef, useCallback } from 'https://esm.sh/preact@10.25.4/hooks';
3
- import htm from 'https://esm.sh/htm@3.1.1';
1
+ // Vendored locally so the web UI works with no internet connection.
2
+ import { h, render } from '/vendor/preact.mjs';
3
+ import { useState, useEffect, useRef, useCallback } from '/vendor/hooks.mjs';
4
+ import htm from '/vendor/htm.mjs';
4
5
  const html = htm.bind(h);
5
6
 
6
7
  const API = (p) => fetch(p).then((r) => r.json());
@@ -65,6 +66,7 @@ function OnboardingWizard({ onComplete }) {
65
66
  async function finish() {
66
67
  try {
67
68
  const body = { BACKEND_TYPE: backend };
69
+ if (model) body.AEGISAI_MODEL = model;
68
70
  if (token) body.AEGISAI_TOKEN = token;
69
71
  await fetch('/api/config', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify(body) });
70
72
  } catch (e) {
@@ -313,7 +315,7 @@ function App() {
313
315
  setLoading(true);
314
316
  setToolLog([]);
315
317
  try {
316
- const r = await fetch('/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ prompt: text }) });
318
+ const r = await fetch('/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: text }) });
317
319
  const d = await r.json();
318
320
  setMessages((m) => [...m, { role: 'assistant', content: d.reply || '(no reply)' }]);
319
321
  if (d.toolLog) setToolLog(d.toolLog);
@@ -388,3 +390,9 @@ function App() {
388
390
  }
389
391
 
390
392
  render(html`<${App} />`, document.getElementById('app'));
393
+
394
+ if ('serviceWorker' in navigator) {
395
+ window.addEventListener('load', () => {
396
+ navigator.serviceWorker.register('/sw.js').then((reg) => reg.update()).catch(() => {});
397
+ });
398
+ }
package/public/index.html CHANGED
@@ -6,7 +6,7 @@
6
6
  <title>AegisAi Harness</title>
7
7
  <link rel="manifest" href="/manifest.json" />
8
8
  <link rel="stylesheet" href="/style.css" />
9
- <script src="https://cdn.tailwindcss.com"></script>
9
+ <script src="/vendor/tailwind.js"></script>
10
10
  </head>
11
11
  <body>
12
12
  <div id="app"></div>
package/public/sw.js CHANGED
@@ -1,8 +1,44 @@
1
- const CACHE = 'aegisai-harness-v1';
2
- self.addEventListener('install', (e) => {
3
- e.waitUntil(caches.open(CACHE).then((c) => c.addAll(['/', '/style.css', '/app.js', '/manifest.json'])));
1
+ // Offline cache for the local web UI. Bump CACHE when bundled assets change.
2
+ const CACHE = 'aegisai-harness-v2';
3
+ const CORE = [
4
+ '/', '/index.html', '/style.css', '/app.js', '/markdown.js', '/manifest.json',
5
+ '/vendor/preact.mjs', '/vendor/hooks.mjs', '/vendor/htm.mjs', '/vendor/tailwind.js'
6
+ ];
7
+
8
+ self.addEventListener('install', (event) => {
9
+ event.waitUntil(caches.open(CACHE).then((cache) => cache.addAll(CORE)).then(() => self.skipWaiting()));
4
10
  });
5
- self.addEventListener('fetch', (e) => {
6
- if (e.request.method !== 'GET') return;
7
- e.respondWith(caches.match(e.request).then((r) => r || fetch(e.request)));
11
+
12
+ self.addEventListener('activate', (event) => {
13
+ event.waitUntil(
14
+ caches.keys()
15
+ .then((keys) => Promise.all(keys.filter((k) => k !== CACHE).map((k) => caches.delete(k))))
16
+ .then(() => self.clients.claim())
17
+ );
18
+ });
19
+
20
+ self.addEventListener('fetch', (event) => {
21
+ const req = event.request;
22
+ if (req.method !== 'GET') return;
23
+ const url = new URL(req.url);
24
+ if (url.origin !== self.location.origin) return; // never intercept backend/LLM calls
25
+
26
+ if (req.mode === 'navigate') {
27
+ event.respondWith(fetch(req).then((res) => {
28
+ const copy = res.clone();
29
+ caches.open(CACHE).then((c) => c.put('/index.html', copy));
30
+ return res;
31
+ }).catch(() => caches.match('/index.html')));
32
+ return;
33
+ }
34
+
35
+ event.respondWith(
36
+ caches.match(req).then((hit) => hit || fetch(req).then((res) => {
37
+ if (res.ok) {
38
+ const copy = res.clone();
39
+ caches.open(CACHE).then((c) => c.put(req, copy));
40
+ }
41
+ return res;
42
+ }))
43
+ );
8
44
  });
@@ -0,0 +1,3 @@
1
+ /* esm.sh - preact@10.25.4/hooks */
2
+ import{options as V}from"./preact.mjs";var c,r,d,b,v=0,x=[],o=V,g=o.__b,C=o.__r,A=o.diffed,D=o.__c,F=o.unmount,k=o.__;function l(t,_){o.__h&&o.__h(r,t,v||_),v=0;var u=r.__H||(r.__H={__:[],__h:[]});return t>=u.__.length&&u.__.push({}),u.__[t]}function B(t){return v=1,I(U,t)}function I(t,_,u){var n=l(c++,2);if(n.t=t,!n.__c&&(n.__=[u?u(_):U(void 0,_),function(a){var f=n.__N?n.__N[0]:n.__[0],s=n.t(f,a);f!==s&&(n.__N=[s,n.__[1]],n.__c.setState({}))}],n.__c=r,!r.u)){var i=function(a,f,s){if(!n.__c.__H)return!0;var m=n.__c.__H.__.filter(function(e){return!!e.__c});if(m.every(function(e){return!e.__N}))return!h||h.call(this,a,f,s);var N=n.__c.props!==a;return m.forEach(function(e){if(e.__N){var P=e.__[0];e.__=e.__N,e.__N=void 0,P!==e.__[0]&&(N=!0)}}),h&&h.call(this,a,f,s)||N};r.u=!0;var h=r.shouldComponentUpdate,y=r.componentWillUpdate;r.componentWillUpdate=function(a,f,s){if(this.__e){var m=h;h=void 0,i(a,f,s),h=m}y&&y.call(this,a,f,s)},r.shouldComponentUpdate=i}return n.__N||n.__}function w(t,_){var u=l(c++,3);!o.__s&&E(u.__H,_)&&(u.__=t,u.i=_,r.__H.__h.push(u))}function R(t,_){var u=l(c++,4);!o.__s&&E(u.__H,_)&&(u.__=t,u.i=_,r.__h.push(u))}function z(t){return v=5,T(function(){return{current:t}},[])}function L(t,_,u){v=6,R(function(){return typeof t=="function"?(t(_()),function(){return t(null)}):t?(t.current=_(),function(){return t.current=null}):void 0},u==null?u:u.concat(t))}function T(t,_){var u=l(c++,7);return E(u.__H,_)&&(u.__=t(),u.__H=_,u.__h=t),u.__}function M(t,_){return v=8,T(function(){return t},_)}function G(t){var _=r.context[t.__c],u=l(c++,9);return u.c=t,_?(u.__==null&&(u.__=!0,_.sub(r)),_.props.value):t.__}function J(t,_){o.useDebugValue&&o.useDebugValue(_?_(t):t)}function K(t){var _=l(c++,10),u=B();return _.__=t,r.componentDidCatch||(r.componentDidCatch=function(n,i){_.__&&_.__(n,i),u[1](n)}),[u[0],function(){u[1](void 0)}]}function O(){var t=l(c++,11);if(!t.__){for(var _=r.__v;_!==null&&!_.__m&&_.__!==null;)_=_.__;var u=_.__m||(_.__m=[0,0]);t.__="P"+u[0]+"-"+u[1]++}return t.__}function S(){for(var t;t=x.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(p),t.__H.__h.forEach(H),t.__H.__h=[]}catch(_){t.__H.__h=[],o.__e(_,t.__v)}}o.__b=function(t){r=null,g&&g(t)},o.__=function(t,_){t&&_.__k&&_.__k.__m&&(t.__m=_.__k.__m),k&&k(t,_)},o.__r=function(t){C&&C(t),c=0;var _=(r=t.__c).__H;_&&(d===r?(_.__h=[],r.__h=[],_.__.forEach(function(u){u.__N&&(u.__=u.__N),u.i=u.__N=void 0})):(_.__h.forEach(p),_.__h.forEach(H),_.__h=[],c=0)),d=r},o.diffed=function(t){A&&A(t);var _=t.__c;_&&_.__H&&(_.__H.__h.length&&(x.push(_)!==1&&b===o.requestAnimationFrame||((b=o.requestAnimationFrame)||W)(S)),_.__H.__.forEach(function(u){u.i&&(u.__H=u.i),u.i=void 0})),d=r=null},o.__c=function(t,_){_.some(function(u){try{u.__h.forEach(p),u.__h=u.__h.filter(function(n){return!n.__||H(n)})}catch(n){_.some(function(i){i.__h&&(i.__h=[])}),_=[],o.__e(n,u.__v)}}),D&&D(t,_)},o.unmount=function(t){F&&F(t);var _,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{p(n)}catch(i){_=i}}),u.__H=void 0,_&&o.__e(_,u.__v))};var q=typeof requestAnimationFrame=="function";function W(t){var _,u=function(){clearTimeout(n),q&&cancelAnimationFrame(_),setTimeout(t)},n=setTimeout(u,100);q&&(_=requestAnimationFrame(u))}function p(t){var _=r,u=t.__c;typeof u=="function"&&(t.__c=void 0,u()),r=_}function H(t){var _=r;t.__c=t.__(),r=_}function E(t,_){return!t||t.length!==_.length||_.some(function(u,n){return u!==t[n]})}function U(t,_){return typeof _=="function"?_(t):_}export{M as useCallback,G as useContext,J as useDebugValue,w as useEffect,K as useErrorBoundary,O as useId,L as useImperativeHandle,R as useLayoutEffect,T as useMemo,I as useReducer,z as useRef,B as useState};
3
+ //# sourceMappingURL=hooks.mjs.map
@@ -0,0 +1,4 @@
1
+ /* esm.sh - htm@3.1.1 */
2
+ var a=function(p,f,c,n){var l;f[0]=0;for(var u=1;u<f.length;u++){var g=f[u++],o=f[u]?(f[0]|=g?1:2,c[f[u++]]):f[++u];g===3?n[0]=o:g===4?n[1]=Object.assign(n[1]||{},o):g===5?(n[1]=n[1]||{})[f[++u]]=o:g===6?n[1][f[++u]]+=o+"":g?(l=p.apply(o,a(p,o,c,["",null])),n.push(l),o[0]?f[0]|=2:(f[u-2]=0,f[u]=l)):n.push(o)}return n},M=new Map;function b(p){var f=M.get(this);return f||(f=new Map,M.set(this,f)),(f=a(this,f.get(p)||(f.set(p,f=function(c){for(var n,l,u=1,g="",o="",i=[0],s=function(v){u===1&&(v||(g=g.replace(/^\s*\n\s*|\s*\n\s*$/g,"")))?i.push(0,v,g):u===3&&(v||g)?(i.push(3,v,g),u=2):u===2&&g==="..."&&v?i.push(4,v,0):u===2&&g&&!v?i.push(5,0,!0,g):u>=5&&((g||!v&&u===5)&&(i.push(u,0,g,l),u=6),v&&(i.push(u,v,0,l),u=6)),g=""},t=0;t<c.length;t++){t&&(u===1&&s(),s(t));for(var w=0;w<c[t].length;w++)n=c[t][w],u===1?n==="<"?(s(),i=[i],u=3):g+=n:u===4?g==="--"&&n===">"?(u=1,g=""):g=n+g[0]:o?n===o?o="":g+=n:n==='"'||n==="'"?o=n:n===">"?(s(),u=1):u&&(n==="="?(u=5,l=g,g=""):n==="/"&&(u<5||c[t][w+1]===">")?(s(),u===3&&(i=i[0]),u=i,(i=i[0]).push(2,0,u),u=0):n===" "||n===" "||n===`
3
+ `||n==="\r"?(s(),u=2):g+=n),u===3&&g==="!--"&&(u=4,i=i[0])}return s(),i}(p)),f),arguments,[])).length>1?f:f[0]}export{b as default};
4
+ //# sourceMappingURL=htm.mjs.map
@@ -0,0 +1,3 @@
1
+ /* esm.sh - preact@10.25.4 */
2
+ var M,d,Y,se,x,K,Z,$,ee,j,B,O,te,E={},_e=[],ue=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,N=Array.isArray;function k(t,e){for(var _ in e)t[_]=e[_];return t}function z(t){t&&t.parentNode&&t.parentNode.removeChild(t)}function ce(t,e,_){var l,o,r,i={};for(r in e)r=="key"?l=e[r]:r=="ref"?o=e[r]:i[r]=e[r];if(arguments.length>2&&(i.children=arguments.length>3?M.call(arguments,2):_),typeof t=="function"&&t.defaultProps!=null)for(r in t.defaultProps)i[r]===void 0&&(i[r]=t.defaultProps[r]);return T(t,i,l,o,null)}function T(t,e,_,l,o){var r={type:t,props:e,key:_,ref:l,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:o??++Y,__i:-1,__u:0};return o==null&&d.vnode!=null&&d.vnode(r),r}function ye(){return{current:null}}function H(t){return t.children}function W(t,e){this.props=t,this.context=e}function C(t,e){if(e==null)return t.__?C(t.__,t.__i+1):null;for(var _;e<t.__k.length;e++)if((_=t.__k[e])!=null&&_.__e!=null)return _.__e;return typeof t.type=="function"?C(t):null}function ne(t){var e,_;if((t=t.__)!=null&&t.__c!=null){for(t.__e=t.__c.base=null,e=0;e<t.__k.length;e++)if((_=t.__k[e])!=null&&_.__e!=null){t.__e=t.__c.base=_.__e;break}return ne(t)}}function V(t){(!t.__d&&(t.__d=!0)&&x.push(t)&&!A.__r++||K!==d.debounceRendering)&&((K=d.debounceRendering)||Z)(A)}function A(){var t,e,_,l,o,r,i,s;for(x.sort($);t=x.shift();)t.__d&&(e=x.length,l=void 0,r=(o=(_=t).__v).__e,i=[],s=[],_.__P&&((l=k({},o)).__v=o.__v+1,d.vnode&&d.vnode(l),q(_.__P,l,o,_.__n,_.__P.namespaceURI,32&o.__u?[r]:null,i,r??C(o),!!(32&o.__u),s),l.__v=o.__v,l.__.__k[l.__i]=l,le(i,l,s),l.__e!=r&&ne(l)),x.length>e&&x.sort($));A.__r=0}function re(t,e,_,l,o,r,i,s,f,u,p){var n,v,c,m,g,y,a=l&&l.__k||_e,h=e.length;for(f=fe(_,e,a,f,h),n=0;n<h;n++)(c=_.__k[n])!=null&&(v=c.__i===-1?E:a[c.__i]||E,c.__i=n,y=q(t,c,v,o,r,i,s,f,u,p),m=c.__e,c.ref&&v.ref!=c.ref&&(v.ref&&G(v.ref,null,c),p.push(c.ref,c.__c||m,c)),g==null&&m!=null&&(g=m),4&c.__u||v.__k===c.__k?f=oe(c,f,t):typeof c.type=="function"&&y!==void 0?f=y:m&&(f=m.nextSibling),c.__u&=-7);return _.__e=g,f}function fe(t,e,_,l,o){var r,i,s,f,u,p=_.length,n=p,v=0;for(t.__k=new Array(o),r=0;r<o;r++)(i=e[r])!=null&&typeof i!="boolean"&&typeof i!="function"?(f=r+v,(i=t.__k[r]=typeof i=="string"||typeof i=="number"||typeof i=="bigint"||i.constructor==String?T(null,i,null,null,null):N(i)?T(H,{children:i},null,null,null):i.constructor===void 0&&i.__b>0?T(i.type,i.props,i.key,i.ref?i.ref:null,i.__v):i).__=t,i.__b=t.__b+1,s=null,(u=i.__i=ae(i,_,f,n))!==-1&&(n--,(s=_[u])&&(s.__u|=2)),s==null||s.__v===null?(u==-1&&v--,typeof i.type!="function"&&(i.__u|=4)):u!=f&&(u==f-1?v--:u==f+1?v++:(u>f?v--:v++,i.__u|=4))):t.__k[r]=null;if(n)for(r=0;r<p;r++)(s=_[r])!=null&&!(2&s.__u)&&(s.__e==l&&(l=C(s)),ie(s,s));return l}function oe(t,e,_){var l,o;if(typeof t.type=="function"){for(l=t.__k,o=0;l&&o<l.length;o++)l[o]&&(l[o].__=t,e=oe(l[o],e,_));return e}t.__e!=e&&(e&&t.type&&!_.contains(e)&&(e=C(t)),_.insertBefore(t.__e,e||null),e=t.__e);do e=e&&e.nextSibling;while(e!=null&&e.nodeType==8);return e}function pe(t,e){return e=e||[],t==null||typeof t=="boolean"||(N(t)?t.some(function(_){pe(_,e)}):e.push(t)),e}function ae(t,e,_,l){var o,r,i=t.key,s=t.type,f=e[_];if(f===null||f&&i==f.key&&s===f.type&&!(2&f.__u))return _;if(l>(f!=null&&!(2&f.__u)?1:0))for(o=_-1,r=_+1;o>=0||r<e.length;){if(o>=0){if((f=e[o])&&!(2&f.__u)&&i==f.key&&s===f.type)return o;o--}if(r<e.length){if((f=e[r])&&!(2&f.__u)&&i==f.key&&s===f.type)return r;r++}}return-1}function Q(t,e,_){e[0]=="-"?t.setProperty(e,_??""):t[e]=_==null?"":typeof _!="number"||ue.test(e)?_:_+"px"}function F(t,e,_,l,o){var r;e:if(e=="style")if(typeof _=="string")t.style.cssText=_;else{if(typeof l=="string"&&(t.style.cssText=l=""),l)for(e in l)_&&e in _||Q(t.style,e,"");if(_)for(e in _)l&&_[e]===l[e]||Q(t.style,e,_[e])}else if(e[0]=="o"&&e[1]=="n")r=e!=(e=e.replace(ee,"$1")),e=e.toLowerCase()in t||e=="onFocusOut"||e=="onFocusIn"?e.toLowerCase().slice(2):e.slice(2),t.l||(t.l={}),t.l[e+r]=_,_?l?_.u=l.u:(_.u=j,t.addEventListener(e,r?O:B,r)):t.removeEventListener(e,r?O:B,r);else{if(o=="http://www.w3.org/2000/svg")e=e.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if(e!="width"&&e!="height"&&e!="href"&&e!="list"&&e!="form"&&e!="tabIndex"&&e!="download"&&e!="rowSpan"&&e!="colSpan"&&e!="role"&&e!="popover"&&e in t)try{t[e]=_??"";break e}catch{}typeof _=="function"||(_==null||_===!1&&e[4]!="-"?t.removeAttribute(e):t.setAttribute(e,e=="popover"&&_==1?"":_))}}function X(t){return function(e){if(this.l){var _=this.l[e.type+t];if(e.t==null)e.t=j++;else if(e.t<_.u)return;return _(d.event?d.event(e):e)}}}function q(t,e,_,l,o,r,i,s,f,u){var p,n,v,c,m,g,y,a,h,P,w,D,S,J,L,I,R,b=e.type;if(e.constructor!==void 0)return null;128&_.__u&&(f=!!(32&_.__u),r=[s=e.__e=_.__e]),(p=d.__b)&&p(e);e:if(typeof b=="function")try{if(a=e.props,h="prototype"in b&&b.prototype.render,P=(p=b.contextType)&&l[p.__c],w=p?P?P.props.value:p.__:l,_.__c?y=(n=e.__c=_.__c).__=n.__E:(h?e.__c=n=new b(a,w):(e.__c=n=new W(a,w),n.constructor=b,n.render=de),P&&P.sub(n),n.props=a,n.state||(n.state={}),n.context=w,n.__n=l,v=n.__d=!0,n.__h=[],n._sb=[]),h&&n.__s==null&&(n.__s=n.state),h&&b.getDerivedStateFromProps!=null&&(n.__s==n.state&&(n.__s=k({},n.__s)),k(n.__s,b.getDerivedStateFromProps(a,n.__s))),c=n.props,m=n.state,n.__v=e,v)h&&b.getDerivedStateFromProps==null&&n.componentWillMount!=null&&n.componentWillMount(),h&&n.componentDidMount!=null&&n.__h.push(n.componentDidMount);else{if(h&&b.getDerivedStateFromProps==null&&a!==c&&n.componentWillReceiveProps!=null&&n.componentWillReceiveProps(a,w),!n.__e&&(n.shouldComponentUpdate!=null&&n.shouldComponentUpdate(a,n.__s,w)===!1||e.__v==_.__v)){for(e.__v!=_.__v&&(n.props=a,n.state=n.__s,n.__d=!1),e.__e=_.__e,e.__k=_.__k,e.__k.some(function(U){U&&(U.__=e)}),D=0;D<n._sb.length;D++)n.__h.push(n._sb[D]);n._sb=[],n.__h.length&&i.push(n);break e}n.componentWillUpdate!=null&&n.componentWillUpdate(a,n.__s,w),h&&n.componentDidUpdate!=null&&n.__h.push(function(){n.componentDidUpdate(c,m,g)})}if(n.context=w,n.props=a,n.__P=t,n.__e=!1,S=d.__r,J=0,h){for(n.state=n.__s,n.__d=!1,S&&S(e),p=n.render(n.props,n.state,n.context),L=0;L<n._sb.length;L++)n.__h.push(n._sb[L]);n._sb=[]}else do n.__d=!1,S&&S(e),p=n.render(n.props,n.state,n.context),n.state=n.__s;while(n.__d&&++J<25);n.state=n.__s,n.getChildContext!=null&&(l=k(k({},l),n.getChildContext())),h&&!v&&n.getSnapshotBeforeUpdate!=null&&(g=n.getSnapshotBeforeUpdate(c,m)),s=re(t,N(I=p!=null&&p.type===H&&p.key==null?p.props.children:p)?I:[I],e,_,l,o,r,i,s,f,u),n.base=e.__e,e.__u&=-161,n.__h.length&&i.push(n),y&&(n.__E=n.__=null)}catch(U){if(e.__v=null,f||r!=null)if(U.then){for(e.__u|=f?160:128;s&&s.nodeType==8&&s.nextSibling;)s=s.nextSibling;r[r.indexOf(s)]=null,e.__e=s}else for(R=r.length;R--;)z(r[R]);else e.__e=_.__e,e.__k=_.__k;d.__e(U,e,_)}else r==null&&e.__v==_.__v?(e.__k=_.__k,e.__e=_.__e):s=e.__e=he(_.__e,e,_,l,o,r,i,f,u);return(p=d.diffed)&&p(e),128&e.__u?void 0:s}function le(t,e,_){for(var l=0;l<_.length;l++)G(_[l],_[++l],_[++l]);d.__c&&d.__c(e,t),t.some(function(o){try{t=o.__h,o.__h=[],t.some(function(r){r.call(o)})}catch(r){d.__e(r,o.__v)}})}function he(t,e,_,l,o,r,i,s,f){var u,p,n,v,c,m,g,y=_.props,a=e.props,h=e.type;if(h=="svg"?o="http://www.w3.org/2000/svg":h=="math"?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),r!=null){for(u=0;u<r.length;u++)if((c=r[u])&&"setAttribute"in c==!!h&&(h?c.localName==h:c.nodeType==3)){t=c,r[u]=null;break}}if(t==null){if(h==null)return document.createTextNode(a);t=document.createElementNS(o,h,a.is&&a),s&&(d.__m&&d.__m(e,r),s=!1),r=null}if(h===null)y===a||s&&t.data===a||(t.data=a);else{if(r=r&&M.call(t.childNodes),y=_.props||E,!s&&r!=null)for(y={},u=0;u<t.attributes.length;u++)y[(c=t.attributes[u]).name]=c.value;for(u in y)if(c=y[u],u!="children"){if(u=="dangerouslySetInnerHTML")n=c;else if(!(u in a)){if(u=="value"&&"defaultValue"in a||u=="checked"&&"defaultChecked"in a)continue;F(t,u,null,c,o)}}for(u in a)c=a[u],u=="children"?v=c:u=="dangerouslySetInnerHTML"?p=c:u=="value"?m=c:u=="checked"?g=c:s&&typeof c!="function"||y[u]===c||F(t,u,c,y[u],o);if(p)s||n&&(p.__html===n.__html||p.__html===t.innerHTML)||(t.innerHTML=p.__html),e.__k=[];else if(n&&(t.innerHTML=""),re(t,N(v)?v:[v],e,_,l,h=="foreignObject"?"http://www.w3.org/1999/xhtml":o,r,i,r?r[0]:_.__k&&C(_,0),s,f),r!=null)for(u=r.length;u--;)z(r[u]);s||(u="value",h=="progress"&&m==null?t.removeAttribute("value"):m!==void 0&&(m!==t[u]||h=="progress"&&!m||h=="option"&&m!==y[u])&&F(t,u,m,y[u],o),u="checked",g!==void 0&&g!==t[u]&&F(t,u,g,y[u],o))}return t}function G(t,e,_){try{if(typeof t=="function"){var l=typeof t.__u=="function";l&&t.__u(),l&&e==null||(t.__u=t(e))}else t.current=e}catch(o){d.__e(o,_)}}function ie(t,e,_){var l,o;if(d.unmount&&d.unmount(t),(l=t.ref)&&(l.current&&l.current!==t.__e||G(l,null,e)),(l=t.__c)!=null){if(l.componentWillUnmount)try{l.componentWillUnmount()}catch(r){d.__e(r,e)}l.base=l.__P=null}if(l=t.__k)for(o=0;o<l.length;o++)l[o]&&ie(l[o],e,_||typeof t.type!="function");_||z(t.__e),t.__c=t.__=t.__e=void 0}function de(t,e,_){return this.constructor(t,_)}function ve(t,e,_){var l,o,r,i;e==document&&(e=document.documentElement),d.__&&d.__(t,e),o=(l=typeof _=="function")?null:_&&_.__k||e.__k,r=[],i=[],q(e,t=(!l&&_||e).__k=ce(H,null,[t]),o||E,E,e.namespaceURI,!l&&_?[_]:o?null:e.firstChild?M.call(e.childNodes):null,r,!l&&_?_:o?o.__e:e.firstChild,l,i),le(r,t,i)}function me(t,e){ve(t,e,me)}function ge(t,e,_){var l,o,r,i,s=k({},t.props);for(r in t.type&&t.type.defaultProps&&(i=t.type.defaultProps),e)r=="key"?l=e[r]:r=="ref"?o=e[r]:s[r]=e[r]===void 0&&i!==void 0?i[r]:e[r];return arguments.length>2&&(s.children=arguments.length>3?M.call(arguments,2):_),T(t.type,s,l||t.key,o||t.ref,null)}function be(t,e){var _={__c:e="__cC"+te++,__:t,Consumer:function(l,o){return l.children(o)},Provider:function(l){var o,r;return this.getChildContext||(o=new Set,(r={})[e]=this,this.getChildContext=function(){return r},this.componentWillUnmount=function(){o=null},this.shouldComponentUpdate=function(i){this.props.value!==i.value&&o.forEach(function(s){s.__e=!0,V(s)})},this.sub=function(i){o.add(i);var s=i.componentWillUnmount;i.componentWillUnmount=function(){o&&o.delete(i),s&&s.call(i)}}),l.children}};return _.Provider.__=_.Consumer.contextType=_}M=_e.slice,d={__e:function(t,e,_,l){for(var o,r,i;e=e.__;)if((o=e.__c)&&!o.__)try{if((r=o.constructor)&&r.getDerivedStateFromError!=null&&(o.setState(r.getDerivedStateFromError(t)),i=o.__d),o.componentDidCatch!=null&&(o.componentDidCatch(t,l||{}),i=o.__d),i)return o.__E=o}catch(s){t=s}throw t}},Y=0,se=function(t){return t!=null&&t.constructor==null},W.prototype.setState=function(t,e){var _;_=this.__s!=null&&this.__s!==this.state?this.__s:this.__s=k({},this.state),typeof t=="function"&&(t=t(k({},_),this.props)),t&&k(_,t),t!=null&&this.__v&&(e&&this._sb.push(e),V(this))},W.prototype.forceUpdate=function(t){this.__v&&(this.__e=!0,t&&this.__h.push(t),V(this))},W.prototype.render=H,x=[],Z=typeof Promise=="function"?Promise.prototype.then.bind(Promise.resolve()):setTimeout,$=function(t,e){return t.__v.__b-e.__v.__b},A.__r=0,ee=/(PointerCapture)$|Capture$/i,j=0,B=X(!1),O=X(!0),te=0;export{W as Component,H as Fragment,ge as cloneElement,be as createContext,ce as createElement,ye as createRef,ce as h,me as hydrate,se as isValidElement,d as options,ve as render,pe as toChildArray};
3
+ //# sourceMappingURL=preact.mjs.map