aegisai-harness 0.70.1 → 0.72.1

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.70.1] - 2026-11-24
5
+ ## [0.72.1] - 2026-11-24
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.70.1 (see [ROADMAP.md](./ROADMAP.md)).
13
+ > Status: v0.72.1 (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.70.1.
3
+ A feature-rich, local-only AI agent harness. CLI-first, offline-first. v0.72.1.
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.70.1",
3
+ "version": "0.72.1",
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.70.1
7
+ AppVersion=0.72.1
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.70.1-Setup
13
+ OutputBaseFilename=AegisAi-Harness-0.72.1-Setup
14
14
  Compression=lzma2
15
15
  SolidCompression=yes
16
16
  PrivilegesRequired=lowest
package/public/app.js CHANGED
@@ -237,7 +237,7 @@ function ConfigModal({ cfg, setCfg, onClose }) {
237
237
  ${tab === 'discover' ? html`
238
238
  <div class="discover-section">
239
239
  <h3>Scan for Local Models</h3>
240
- <p class="hint">Scan drives and directories for GGUF, BIN, and Safetensors model files, plus Ollama models.</p>
240
+ <p class="hint">Active backend: <strong>${cfg.BACKEND_TYPE || 'auto'}</strong>. Scan drives and directories for model files compatible with your backend.</p>
241
241
  <div class="search-bar">
242
242
  <input value=${scanRoot} onInput=${(e) => setScanRoot(e.target.value)} placeholder="Leave empty for default roots, or enter a path (e.g. D:\\models)" style="flex:1" />
243
243
  <button class="btn-primary" onClick=${scanDrives} disabled=${scanning}>${scanning ? 'Scanning...' : 'Scan'}</button>
@@ -248,11 +248,12 @@ function ConfigModal({ cfg, setCfg, onClose }) {
248
248
  ${scanResults.slice(0, 30).map((m) => html`
249
249
  <div class="scan-item">
250
250
  <span class="model-name">${m.name}</span>
251
- <span class="hint">${m.sizeGB > 0 ? m.sizeGB + ' GB' : ''} ${m.type ? '(' + m.type + ')' : ''}</span>
251
+ <span class="hint">${m.sizeGB > 0 ? m.sizeGB + ' GB' : ''} ${m.type ? '[' + m.type + ']' : ''}</span>
252
+ ${m.type !== 'ollama' && m.path && !m.path.startsWith('ollama://') ? html`<button class="btn-sm" onClick=${() => { setLocal({ ...local, AEGISAI_MODEL: m.path }); toast('Selected ' + m.name, 'info'); }}>Use</button>` : null}
252
253
  </div>
253
254
  `)}
254
255
  </div>
255
- ` : html`<p class="hint">No models found. Try scanning a specific directory.</p>`}
256
+ ` : html`<p class="hint">No models found. Try scanning a specific directory or changing the backend.</p>`}
256
257
  <h3 style="margin-top: 16px">Search HuggingFace</h3>
257
258
  <p class="hint">Search HuggingFace for GGUF models. Try terms like "llama", "mistral", "phi", "gemma".</p>
258
259
  <div class="search-bar">
@@ -423,15 +424,52 @@ function App() {
423
424
  setMessages((m) => [...m, { role: 'user', content: text }]);
424
425
  setLoading(true);
425
426
  setToolLog([]);
427
+ // Add empty assistant message for streaming
428
+ setMessages((m) => [...m, { role: 'assistant', content: '' }]);
426
429
  try {
427
- const r = await fetch('/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: text }) });
428
- const d = await r.json();
429
- setMessages((m) => [...m, { role: 'assistant', content: d.reply || '(no reply)' }]);
430
- if (d.toolLog) setToolLog(d.toolLog);
431
- updateCtx();
432
- toast('Response received', 'success');
430
+ const r = await fetch('/api/chat', { method: 'POST', headers: { 'Content-Type': 'application/json' }, body: JSON.stringify({ message: text, stream: true }) });
431
+ if (!r.ok) throw new Error('HTTP ' + r.status);
432
+ const reader = r.body.getReader();
433
+ const decoder = new TextDecoder();
434
+ let buffer = '';
435
+ let fullReply = '';
436
+ while (true) {
437
+ const { done, value } = await reader.read();
438
+ if (done) break;
439
+ buffer += decoder.decode(value, { stream: true });
440
+ const lines = buffer.split('\\n\\n');
441
+ buffer = lines.pop() || '';
442
+ for (const line of lines) {
443
+ if (!line.startsWith('data: ')) continue;
444
+ try {
445
+ const data = JSON.parse(line.slice(6));
446
+ if (data.type === 'token') {
447
+ fullReply += data.content;
448
+ setMessages((m) => {
449
+ const updated = [...m];
450
+ updated[updated.length - 1] = { role: 'assistant', content: fullReply };
451
+ return updated;
452
+ });
453
+ } else if (data.type === 'tool_call') {
454
+ toast('Tool: ' + data.name, 'info');
455
+ } else if (data.type === 'done') {
456
+ if (data.toolLog) setToolLog(data.toolLog);
457
+ updateCtx();
458
+ toast('Response received', 'success');
459
+ }
460
+ } catch (e) {}
461
+ }
462
+ }
433
463
  } catch (e) {
434
- setMessages((m) => [...m, { role: 'assistant', content: 'Error: ' + e.message }]);
464
+ setMessages((m) => {
465
+ const updated = [...m];
466
+ if (updated.length > 0 && updated[updated.length - 1].role === 'assistant' && !updated[updated.length - 1].content) {
467
+ updated[updated.length - 1] = { role: 'assistant', content: 'Error: ' + e.message };
468
+ } else {
469
+ updated.push({ role: 'assistant', content: 'Error: ' + e.message });
470
+ }
471
+ return updated;
472
+ });
435
473
  toast('Error: ' + e.message, 'error');
436
474
  } finally { setLoading(false); }
437
475
  }
package/src/index.js CHANGED
@@ -196,13 +196,38 @@ async function main() {
196
196
  const parsed = await readJson(req);
197
197
  const sid = parsed.sessionId || 'default';
198
198
  const history = Array.isArray(parsed.history) ? parsed.history : (sessions.get(sid) || []);
199
+ const stream = parsed.stream === true;
200
+ const autoApprove = process.env.AEGISAI_WEB_AUTO_APPROVE === 'true';
201
+ if (stream) {
202
+ res.writeHead(200, { 'Content-Type': 'text/event-stream', 'Cache-Control': 'no-cache', 'Connection': 'keep-alive', 'Access-Control-Allow-Origin': '*' });
203
+ let fullReply = '';
204
+ const result = await runAgent({
205
+ model: parsed.model || process.env.AEGISAI_MODEL || 'llama3.2:3b',
206
+ messages: history.concat([{ role: 'user', content: parsed.message || '' }]),
207
+ projectRoot: process.cwd(),
208
+ onEvent: (e) => {
209
+ if (e.type === 'token') { fullReply += (e.content || ''); res.write('data: ' + JSON.stringify({ type: 'token', content: e.content || '' }) + '\\n\\n'); }
210
+ else if (e.type === 'tool_call') { res.write('data: ' + JSON.stringify({ type: 'tool_call', name: e.name, args: e.args }) + '\\n\\n'); }
211
+ else if (e.type === 'tool_result') { res.write('data: ' + JSON.stringify({ type: 'tool_result', preview: (e.preview || '').slice(0, 200) }) + '\\n\\n'); }
212
+ else if (e.type === 'status') { res.write('data: ' + JSON.stringify({ type: 'status', message: e.message }) + '\\n\\n'); }
213
+ },
214
+ autoApprove,
215
+ approvalHandler: async () => false,
216
+ });
217
+ const reply = (result.final && result.final.final) || fullReply;
218
+ const updated = history.concat([{ role: 'user', content: parsed.message || '' }, { role: 'assistant', content: reply }]);
219
+ sessions.set(sid, updated);
220
+ res.write('data: ' + JSON.stringify({ type: 'done', reply, toolLog: result.toolLog || [] }) + '\\n\\n');
221
+ res.end();
222
+ return;
223
+ }
199
224
  const result = await runAgent({
200
225
  model: parsed.model || process.env.AEGISAI_MODEL || 'llama3.2:3b',
201
226
  messages: history.concat([{ role: 'user', content: parsed.message || '' }]),
202
227
  projectRoot: process.cwd(),
203
228
  onEvent: () => {},
204
229
  // Tool execution from the browser is opt-in. Default: no writes.
205
- autoApprove: process.env.AEGISAI_WEB_AUTO_APPROVE === 'true',
230
+ autoApprove,
206
231
  approvalHandler: async () => false,
207
232
  });
208
233
  const reply = (result.final && result.final.final) || '';
@@ -241,14 +266,19 @@ async function main() {
241
266
  if (req.method === 'GET' && req.url.split('?')[0] === '/api/models/scan') {
242
267
  const roots = new URL(req.url, 'http://x').searchParams.get('roots');
243
268
  const rootList = roots ? roots.split(',') : undefined;
244
- const found = require('./model_discovery').scan(rootList);
245
- // Also list Ollama models
269
+ const backend = require('./backends').getType();
270
+ const found = require('./model_discovery').scan(rootList, 500, backend);
271
+ // Also list models from the active backend
246
272
  try {
247
273
  const r = await require('./backends').backendListModels();
248
- const ollamaModels = (r.models || []).map((m) => ({ path: 'ollama://' + (m.name || m), name: m.name || m, sizeGB: m.size ? +(m.size / 1024 ** 3).toFixed(2) : 0, type: 'ollama' }));
249
- found.push(...ollamaModels);
274
+ const backendModels = (r.models || []).map((m) => ({ path: backend + '://' + (m.name || m), name: m.name || m, sizeGB: m.size ? +(m.size / 1024 ** 3).toFixed(2) : 0, type: backend }));
275
+ // Only add if not already in found
276
+ const existingNames = new Set(found.map((f) => f.name));
277
+ for (const bm of backendModels) {
278
+ if (!existingNames.has(bm.name)) found.push(bm);
279
+ }
250
280
  } catch (e) {}
251
- sendJson(res, 200, { models: found });
281
+ sendJson(res, 200, { models: found, backend });
252
282
  return;
253
283
  }
254
284
  if (req.method === 'GET' && req.url.split('?')[0] === '/api/models/hf-search') {
@@ -279,14 +309,19 @@ async function main() {
279
309
  if (req.method === 'GET' && req.url.split('?')[0] === '/api/models/scan') {
280
310
  const roots = new URL(req.url, 'http://x').searchParams.get('roots');
281
311
  const rootList = roots ? roots.split(',') : undefined;
282
- const found = require('./model_discovery').scan(rootList);
283
- // Also list Ollama models
312
+ const backend = require('./backends').getType();
313
+ const found = require('./model_discovery').scan(rootList, 500, backend);
314
+ // Also list models from the active backend
284
315
  try {
285
316
  const r = await require('./backends').backendListModels();
286
- const ollamaModels = (r.models || []).map((m) => ({ path: 'ollama://' + (m.name || m), name: m.name || m, sizeGB: m.size ? +(m.size / 1024 ** 3).toFixed(2) : 0, type: 'ollama' }));
287
- found.push(...ollamaModels);
317
+ const backendModels = (r.models || []).map((m) => ({ path: backend + '://' + (m.name || m), name: m.name || m, sizeGB: m.size ? +(m.size / 1024 ** 3).toFixed(2) : 0, type: backend }));
318
+ // Only add if not already in found
319
+ const existingNames = new Set(found.map((f) => f.name));
320
+ for (const bm of backendModels) {
321
+ if (!existingNames.has(bm.name)) found.push(bm);
322
+ }
288
323
  } catch (e) {}
289
- sendJson(res, 200, { models: found });
324
+ sendJson(res, 200, { models: found, backend });
290
325
  return;
291
326
  }
292
327
  if (req.method === 'GET' && req.url.split('?')[0] === '/api/models/hf-search') {
@@ -4,30 +4,65 @@ const fs = require('fs');
4
4
  const path = require('path');
5
5
  const os = require('os');
6
6
 
7
- const ROOTS = [
8
- path.join(os.homedir(), '.ollama'),
9
- path.join(os.homedir(), '.cache', 'lm-studio'),
10
- path.join(os.homedir(), 'LM Studio'),
11
- path.join(os.homedir(), 'models'),
12
- ];
7
+ const ROOTS_BY_BACKEND = {
8
+ ollama: [
9
+ path.join(os.homedir(), '.ollama'),
10
+ ],
11
+ lmstudio: [
12
+ path.join(os.homedir(), '.cache', 'lm-studio'),
13
+ path.join(os.homedir(), 'LM Studio'),
14
+ path.join(os.homedir(), '.lmstudio'),
15
+ ],
16
+ llamacpp: [
17
+ path.join(os.homedir(), 'models'),
18
+ path.join(os.homedir(), 'llama.cpp', 'models'),
19
+ ],
20
+ vllm: [],
21
+ openai: [],
22
+ generic: [
23
+ path.join(os.homedir(), 'models'),
24
+ path.join(os.homedir(), 'Downloads'),
25
+ ],
26
+ };
13
27
 
14
- // Also scan common drive roots on Windows
15
- function getDefaultRoots() {
16
- const roots = [...ROOTS];
28
+ function getDefaultRoots(backend) {
29
+ const roots = [...(ROOTS_BY_BACKEND[backend] || ROOTS_BY_BACKEND.generic)];
30
+ // Add common roots for all backends
31
+ if (!roots.includes(path.join(os.homedir(), 'models'))) {
32
+ roots.push(path.join(os.homedir(), 'models'));
33
+ }
17
34
  if (process.platform === 'win32') {
18
- // Add common Windows locations
19
- for (const drive of ['C:', 'D:', 'E:']) {
35
+ for (const drive of ['C:', 'D:', 'E:', 'F:']) {
20
36
  const modelsDir = drive + '\\models';
21
37
  try { if (fs.existsSync(modelsDir)) roots.push(modelsDir); } catch (e) {}
22
38
  const ollamaDir = drive + '\\.ollama';
23
39
  try { if (fs.existsSync(ollamaDir)) roots.push(ollamaDir); } catch (e) {}
40
+ // LM Studio on Windows
41
+ const lmStudioDir = drive + '\\LM Studio';
42
+ try { if (fs.existsSync(lmStudioDir)) roots.push(lmStudioDir); } catch (e) {}
24
43
  }
25
44
  }
26
- return roots;
45
+ // Deduplicate
46
+ return [...new Set(roots)];
47
+ }
48
+
49
+ // Detect which backend is active
50
+ function detectBackend() {
51
+ const envType = process.env.BACKEND_TYPE || '';
52
+ if (envType && ROOTS_BY_BACKEND[envType]) return envType;
53
+ // Check if Ollama is running
54
+ try {
55
+ const http = require('http');
56
+ // Synchronous check not possible; return 'generic' as default
57
+ } catch (e) {}
58
+ return 'generic';
27
59
  }
28
60
 
29
- function scan(roots, maxFiles) {
30
- roots = roots || getDefaultRoots();
61
+ function scan(roots, maxFiles, backend) {
62
+ // If no roots provided, use backend-specific defaults
63
+ if (!roots || (Array.isArray(roots) && roots.length === 0)) {
64
+ roots = getDefaultRoots(backend || detectBackend());
65
+ }
31
66
  const found = [];
32
67
  let count = 0;
33
68
  const extensions = /\.(gguf|bin|safetensors)$/i;
@@ -84,10 +119,10 @@ function huggingFacePull(repo, filename) {
84
119
  return { ok: true, url, note: 'streaming download not implemented; open URL or use huggingface-cli' };
85
120
  }
86
121
 
87
- module.exports = { ROOTS, getDefaultRoots, scan, huggingFacePull };
122
+ module.exports = { ROOTS: [], getDefaultRoots, scan, huggingFacePull };
88
123
  function huggingFacePull(repo, filename) {
89
124
  const url = 'https://huggingface.co/' + repo + '/resolve/main/' + (filename || '');
90
125
  return { ok: true, url, note: 'streaming download not implemented; open URL or use huggingface-cli' };
91
126
  }
92
127
 
93
- module.exports = { ROOTS, scan, huggingFacePull };
128
+ // (duplicate removed)
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.70.1';
3
+ const VERSION = '0.72.1';
4
4
  module.exports = { VERSION, version: VERSION };
@@ -1,10 +0,0 @@
1
- const fs = require('fs');
2
- const { execSync } = require('child_process');
3
- const log = execSync('gh run view 45305918897 --log', { encoding: 'utf8', maxBuffer: 10 * 1024 * 1024 });
4
- const lines = log.split(/\r?\n/);
5
- const publishLines = lines.filter((l) => l.includes('+ aegisai-harness@'));
6
- console.log('publish output:', publishLines.length);
7
- publishLines.forEach((l) => console.log(l.slice(0, 100)));
8
- const errors = lines.filter((l) => /npm error/i.test(l));
9
- console.log('npm errors:', errors.length);
10
- errors.forEach((l) => console.log(l.slice(0, 200)));
@@ -1,14 +0,0 @@
1
- const fs = require('fs');
2
- const { execSync } = require('child_process');
3
- const log = execSync('gh run view 45305918897 --log', { encoding: 'utf8', maxBuffer: 10 * 1024 * 1024 });
4
- const lines = log.split(/\r?\n/);
5
- const publishLines = lines.filter((l) => l.includes('+ aegisai-harness@'));
6
- console.log('publish output:', publishLines.length);
7
- publishLines.forEach((l) => console.log(l.slice(0, 100)));
8
- const errors = lines.filter((l) => /npm error/i.test(l));
9
- console.log('npm errors:', errors.length);
10
- errors.forEach((l) => console.log(l.slice(0, 200)));
11
- // Check if version in package.json matches
12
- const pkgLines = lines.filter((l) => l.includes('npm notice version:'));
13
- console.log('version lines:', pkgLines.length);
14
- pkgLines.forEach((l) => console.log(l.slice(0, 100)));