aegisai-harness 0.79.0 → 0.80.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,7 +2,7 @@
2
2
 
3
3
  All notable changes to AegisAi Harness are documented here.
4
4
 
5
- ## [0.79.0] - 2026-11-25
5
+ ## [0.80.0] - 2026-11-25
6
6
 
7
7
  ### Fixed
8
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.
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.79.0 (see [ROADMAP.md](./ROADMAP.md)).
13
+ > Status: v0.80.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
 
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.79.0.
3
+ A feature-rich, local-only AI agent harness. CLI-first, offline-first. v0.80.0.
4
4
 
5
5
  ## Capabilities
6
6
  - Multi-backend LLM adapter (Ollama + OpenAI-compatible + 18 providers)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "aegisai-harness",
3
- "version": "0.79.0",
3
+ "version": "0.80.0",
4
4
  "description": "AegisAi Harness — feature-rich, local-only AI agent harness",
5
5
  "type": "commonjs",
6
6
  "main": "src/index.js",
@@ -4,13 +4,13 @@
4
4
  [Setup]
5
5
  AppId={{8F3D1B2A-6C4E-4B9A-9D21-AE615A010001}}
6
6
  AppName=AegisAi Harness
7
- AppVersion=0.79.0
7
+ AppVersion=0.80.0
8
8
  AppPublisher=AegisAi
9
9
  AppPublisherURL=https://github.com/user6811992/aegisai-harness
10
10
  DefaultDirName={autopf}\AegisAiHarness
11
11
  DefaultGroupName=AegisAi Harness
12
12
  OutputDir=..\..\dist
13
- OutputBaseFilename=AegisAi-Harness-0.79.0-Setup
13
+ OutputBaseFilename=AegisAi-Harness-0.80.0-Setup
14
14
  Compression=lzma2
15
15
  SolidCompression=yes
16
16
  PrivilegesRequired=lowest
@@ -0,0 +1,42 @@
1
+ // /authtoken.js — shared auth shim for secondary pages (plugins, dag, trajectory).
2
+ // Reads the token from sessionStorage (set by the main UI) or ?token= in the URL,
3
+ // then attaches it to fetch() and EventSource() calls.
4
+ (function () {
5
+ function readToken() {
6
+ try {
7
+ const q = new URL(location.href).searchParams.get('token');
8
+ if (q) { try { sessionStorage.setItem('aegisai_token', q); } catch (e) {} return q; }
9
+ return sessionStorage.getItem('aegisai_token') || localStorage.getItem('aegisai_token') || '';
10
+ } catch (e) { return ''; }
11
+ }
12
+ const token = readToken();
13
+
14
+ function withToken(url) {
15
+ if (!token) return url;
16
+ try {
17
+ const u = new URL(url, location.origin);
18
+ if (!u.searchParams.has('token')) u.searchParams.set('token', token);
19
+ return u.pathname + u.search + u.hash;
20
+ } catch (e) { return url; }
21
+ }
22
+
23
+ if (token) {
24
+ const origFetch = window.fetch.bind(window);
25
+ window.fetch = function (input, init) {
26
+ const opts = Object.assign({}, init || {});
27
+ const headers = new Headers(opts.headers || {});
28
+ if (!headers.has('Authorization')) headers.set('Authorization', 'Bearer ' + token);
29
+ opts.headers = headers;
30
+ const url = typeof input === 'string' ? withToken(input) : input;
31
+ return origFetch(url, opts);
32
+ };
33
+
34
+ const OrigEventSource = window.EventSource;
35
+ if (OrigEventSource) {
36
+ window.EventSource = function (url, cfg) { return new OrigEventSource(withToken(url), cfg); };
37
+ window.EventSource.prototype = OrigEventSource.prototype;
38
+ }
39
+ }
40
+
41
+ window.AEGISAI_AUTH = { token, withToken, hasToken: Boolean(token) };
42
+ })();
package/public/dag.html CHANGED
@@ -15,6 +15,7 @@
15
15
  <h3>Recent runs</h3>
16
16
  <div id="runs" class="graph"></div>
17
17
  </div>
18
+ <script src="/authtoken.js"></script>
18
19
  <script>
19
20
  async function load() {
20
21
  const r = await fetch('/api/dag-runs'); const data = await r.json();
@@ -9,6 +9,7 @@
9
9
  <h3>Live events</h3>
10
10
  <pre id="events" style="max-height:400px;overflow:auto"></pre>
11
11
  </div>
12
+ <script src="/authtoken.js"></script>
12
13
  <script>
13
14
  async function load() {
14
15
  const r = await fetch('/api/plugins'); const data = await r.json();
package/public/sw.js CHANGED
@@ -1,4 +1,4 @@
1
- const CACHE = 'aegisai-harness-v2';
1
+ const CACHE = 'aegisai-harness-v3';
2
2
  const PRECACHE = ['/', '/style.css', '/app.js', '/manifest.json', '/vendor/preact.mjs', '/vendor/hooks.mjs', '/vendor/htm.mjs', '/vendor/tailwind.js'];
3
3
 
4
4
  self.addEventListener('install', (e) => {
@@ -21,6 +21,24 @@ self.addEventListener('fetch', (e) => {
21
21
  if (url.origin !== self.location.origin) return;
22
22
  // Never intercept API / protocol calls: always network, never cached.
23
23
  if (url.pathname.startsWith('/api/') || url.pathname === '/mcp' || url.pathname.startsWith('/mcp/')) return;
24
+
25
+ const isNavigation = req.mode === 'navigate' || (req.headers.get('accept') || '').includes('text/html');
26
+ if (isNavigation) {
27
+ // Network-first for pages so a new build is picked up immediately; fall back
28
+ // to cache only when offline.
29
+ e.respondWith(
30
+ fetch(req).then((res) => {
31
+ if (res && res.ok && res.type === 'basic') {
32
+ const copy = res.clone();
33
+ caches.open(CACHE).then((c) => c.put(req, copy)).catch(() => {});
34
+ }
35
+ return res;
36
+ }).catch(() => caches.match(req).then((hit) => hit || caches.match('/')))
37
+ );
38
+ return;
39
+ }
40
+
41
+ // Static assets: cache-first is fine (they are versioned by CACHE).
24
42
  e.respondWith(
25
43
  caches.match(req).then((hit) => hit || fetch(req).then((res) => {
26
44
  if (res && res.ok && res.type === 'basic') {
@@ -28,6 +46,6 @@ self.addEventListener('fetch', (e) => {
28
46
  caches.open(CACHE).then((c) => c.put(req, copy)).catch(() => {});
29
47
  }
30
48
  return res;
31
- }).catch(() => hit))
49
+ }))
32
50
  );
33
51
  });
@@ -6,6 +6,7 @@
6
6
  <header><h2>Live Trajectory</h2><button onclick="location.href='/'">Back</button></header>
7
7
  <pre id="feed" style="max-height:70vh;overflow:auto"></pre>
8
8
  </div>
9
+ <script src="/authtoken.js"></script>
9
10
  <script>
10
11
  const es = new EventSource('/api/events');
11
12
  es.onmessage = (e) => {
package/src/index.js CHANGED
@@ -119,7 +119,9 @@ async function main() {
119
119
  }
120
120
 
121
121
  if (mcpServerFlag) {
122
- const port = parseInt(process.env.AEGISAI_MCP_PORT || '3001', 10);
122
+ const portIdx = args.indexOf('--port');
123
+ const cliPort = portIdx >= 0 ? parseInt(args[portIdx + 1], 10) : 0;
124
+ const port = cliPort || parseInt(process.env.AEGISAI_MCP_PORT || '3001', 10);
123
125
  require('./mcp_server').start(port, process.env.HOST || '127.0.0.1');
124
126
  return;
125
127
  }
package/src/mcp_server.js CHANGED
@@ -164,8 +164,22 @@ function createHandler() {
164
164
 
165
165
  function start(port, host) {
166
166
  const http = require('http');
167
- const server = http.createServer(createHandler());
168
- server.listen(port || 3001, host || '127.0.0.1', () => console.log('MCP server at http://' + (host || '127.0.0.1') + ':' + (port || 3001) + '/mcp'));
167
+ const handler = createHandler();
168
+ const expected = () => process.env.AEGISAI_TOKEN || process.env.LOCALAI_TOKEN || '';
169
+ const server = http.createServer((req, res) => {
170
+ const want = expected();
171
+ if (want) {
172
+ const supplied = (req.headers['authorization'] || '').replace(/^Bearer\s+/i, '') || (() => { try { return new URL(req.url, 'http://x').searchParams.get('token') || ''; } catch (e) { return ''; } })();
173
+ // Constant-time-ish comparison to avoid length leaks.
174
+ let ok = supplied.length === want.length;
175
+ if (ok) { let diff = 0; for (let i = 0; i < want.length; i++) diff |= supplied.charCodeAt(i) ^ want.charCodeAt(i); ok = diff === 0; }
176
+ if (!ok) { res.writeHead(401, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ jsonrpc: '2.0', error: { code: -32001, message: 'unauthorized' } })); return; }
177
+ }
178
+ handler(req, res).catch((e) => {
179
+ try { if (!res.headersSent) { res.writeHead(500, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ jsonrpc: '2.0', error: { code: -32603, message: String((e && e.message) || e) } })); } else res.end(); } catch (_) {}
180
+ });
181
+ });
182
+ server.listen(port || 3001, host || '127.0.0.1', () => console.log('MCP server at http://' + (host || '127.0.0.1') + ':' + (port || 3001) + '/mcp' + (expected() ? ' (auth required)' : '')));
169
183
  return server;
170
184
  }
171
185
 
package/src/tui.js CHANGED
@@ -111,7 +111,7 @@ class Tui extends EventEmitter {
111
111
  if (msgIdx >= 0 && msgIdx < this.messages.length) {
112
112
  const m = this.messages[msgIdx];
113
113
  const prefix = m.role === 'user' ? ANSI.fg.green + '> ' : ANSI.fg.blue + ' ';
114
- chatCell = prefix + m.content.slice(0, chatWidth - 3) + ANSI.reset;
114
+ chatCell = prefix + sanitizeLine(m.content).slice(0, chatWidth - 3) + ANSI.reset;
115
115
  }
116
116
  // pad chat
117
117
  const pad = Math.max(0, chatWidth - stripAnsi(chatCell).length);
@@ -119,24 +119,35 @@ class Tui extends EventEmitter {
119
119
  // sidebar
120
120
  out += ANSI.dim + '│' + ANSI.reset;
121
121
  const sl = sidebarLines[r] || '';
122
- out += ANSI.dim + sl.slice(0, sidebarWidth - 1) + ANSI.reset;
122
+ out += ANSI.dim + sanitizeLine(sl).slice(0, sidebarWidth - 1) + ANSI.reset;
123
123
  }
124
124
  // Input line
125
125
  out += ANSI.move(inputRow, 1) + ANSI.clearLine;
126
- out += ANSI.fg.green + '> ' + ANSI.reset + this.input + ANSI.showCursor;
126
+ out += ANSI.fg.green + '> ' + ANSI.reset + sanitizeLine(this.input) + ANSI.showCursor;
127
127
  // Status bar
128
128
  out += ANSI.move(statusRow, 1) + ANSI.clearLine;
129
- out += ANSI.bg.blue + ANSI.fg.white + ANSI.bold + ' ' + this.status + ' '.repeat(Math.max(0, cols - this.status.length - 1)) + ANSI.reset;
129
+ const statusSafe = sanitizeLine(this.status);
130
+ out += ANSI.bg.blue + ANSI.fg.white + ANSI.bold + ' ' + statusSafe + ' '.repeat(Math.max(0, cols - statusSafe.length - 1)) + ANSI.reset;
130
131
  process.stdout.write(out);
131
132
  }
132
133
  }
133
134
 
134
135
  function stripAnsi(s) { return String(s).replace(/\x1b\[[0-9;]*m/g, ''); }
135
136
 
137
+ // Make untrusted text safe for a single TUI row: drop ANSI/control sequences and
138
+ // collapse newlines so a message cannot break the layout.
139
+ function sanitizeLine(s) {
140
+ return String(s == null ? '' : s)
141
+ .replace(/\x1b\[[0-9;?]*[A-Za-z]/g, '')
142
+ .replace(/\x1b\][^\x07]*\x07/g, '')
143
+ .replace(/[\r\n]+/g, ' ')
144
+ .replace(/[\x00-\x08\x0b-\x1f\x7f]/g, '');
145
+ }
146
+
136
147
  function launch(opts) {
137
148
  const tui = new Tui(opts);
138
149
  tui.start();
139
150
  return tui;
140
151
  }
141
152
 
142
- module.exports = { Tui, launch, ANSI, stripAnsi };
153
+ module.exports = { Tui, launch, ANSI, stripAnsi, sanitizeLine };
package/src/version.js CHANGED
@@ -1,4 +1,4 @@
1
1
  // src/version.js — single runtime source for the version string.
2
2
  // Kept separate from package.json so bundled/npm-installed copies behave the same.
3
- const VERSION = '0.79.0';
3
+ const VERSION = '0.80.0';
4
4
  module.exports = { VERSION, version: VERSION };