aegisai-harness 0.77.0 → 0.78.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 +1 -1
- package/README.md +1 -1
- package/ROADMAP.md +82 -0
- package/llms.txt +1 -1
- package/package.json +1 -1
- package/packaging/windows/installer.iss +2 -2
- package/src/index.js +75 -23
- package/src/mcp_server.js +32 -4
- package/src/tui.js +4 -17
- package/src/version.js +1 -1
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.
|
|
5
|
+
## [0.78.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.
|
|
13
|
+
> Status: v0.78.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/ROADMAP.md
CHANGED
|
@@ -457,6 +457,88 @@ Feasibility: **H** = fits current JS architecture, **M** = needs external servic
|
|
|
457
457
|
- [x] Codex-style approval modes: suggest / auto-edit / full-auto — **H**
|
|
458
458
|
- [ ] Codex-style MCP server configuration patterns — **H** (covered)
|
|
459
459
|
|
|
460
|
+
## v0.78 — From nvidia, cloudflare, trufflesecurity, semgrep, cisco-talos, haydenschmitty, sandbox-quantum, plus re-scan of bytedance/openai/modelcontextprotocol
|
|
461
|
+
Feasibility: **H** = fits current JS architecture, **M** = needs external service/tool, **L** = native/platform-scale.
|
|
462
|
+
|
|
463
|
+
### LLM red-teaming (nvidia/garak)
|
|
464
|
+
- [ ] Model behaviour probe suite — hallucination, jailbreak, prompt-injection, data-leakage, toxicity probes run against the configured backend with scored pass/fail and a JSON report. Sits beside the existing code-pattern scanner (`vuln_scan`) and harness `adversarial` suite. — **H**
|
|
465
|
+
|
|
466
|
+
### Skill & plugin security (nvidia/SkillSpector)
|
|
467
|
+
- [ ] Dedicated skill scanner — extend `skill_eval` with SkillSpector-style rule classes: malicious patterns, prompt injection, data exfiltration intent, credential access, unsafe tool grants, obfuscation. Emit SARIF. — **H**
|
|
468
|
+
|
|
469
|
+
### Verified secret scanning (trufflesecurity/trufflehog)
|
|
470
|
+
- [ ] Detect **and verify** credentials — current tooling does regex/PII only. Add provider-aware verifiers (GitHub, Slack, AWS, Stripe, SendGrid, npm, OpenAI-style keys) that confirm liveness, with an explicit offline mode that reports `unverified`. — **H**
|
|
471
|
+
|
|
472
|
+
### Multi-phase security audit with independent verification (cloudflare/security-audit-skill)
|
|
473
|
+
- [ ] Audit pipeline upgrade — recon → candidate findings → **independent re-verification pass that drops false positives** → machine-readable SARIF/JSON with evidence per finding. Replaces the current single-pass `pentest_pipeline`. — **H**
|
|
474
|
+
|
|
475
|
+
### MCP testing & registry alignment (modelcontextprotocol/inspector, /registry)
|
|
476
|
+
- [ ] `mcp-inspect` command — deterministic MCP server tests: tool schema validity, error-path behaviour, resource/prompt round-trips, timeouts; machine-readable results. — **H**
|
|
477
|
+
- [ ] Align registry client with the official MCP registry API (`modelcontextprotocol/registry`) instead of the hand-rolled catalog. — **M**
|
|
478
|
+
|
|
479
|
+
### Cross-agent delegation (openai/codex-plugin-cc, openai/skills)
|
|
480
|
+
- [ ] External agent adapters — delegate a task to a locally installed `codex` / `claude` / `aider` CLI and capture the result as an evidence record. Complements `agents_as_tools` and `peer_review`. — **M**
|
|
481
|
+
- [ ] Codex skills catalog import — map the public skills catalog onto `skill_pkg`/`default_skills`. — **M**
|
|
482
|
+
|
|
483
|
+
### Visual grounding for computer use (bytedance/UI-TARS-desktop)
|
|
484
|
+
- [ ] Screenshot → vision → coordinate click — extend the CDP browser tools with `browser_screenshot`, `browser_click_at(x,y)` and a vision-model locator ("click the Submit button") using the existing `vision.js`. — **H**
|
|
485
|
+
|
|
486
|
+
### Plain-English architecture map (haydenschmitty/floorplan)
|
|
487
|
+
- [ ] Interactive architecture map page — render `code_map` as a navigable module/edge diagram in the web UI with plain-English summaries per module. — **H**
|
|
488
|
+
|
|
489
|
+
### Channels & trust (sandbox-quantum/switch, switch-trust-*)
|
|
490
|
+
- [ ] Microsoft Teams + Mattermost channel adapters — completes the IM set alongside Slack/Telegram/Discord/DingTalk/Feishu. — **M**
|
|
491
|
+
- [ ] Guardrail routing SDK surface — expose the guardrails/policy engine as a small documented JS API (`evaluate(tool, args)`) so external tools can reuse it. — **H**
|
|
492
|
+
- [ ] Project-wide symbol rename — LSP `rename` + apply-edits across the workspace. — **M**
|
|
493
|
+
|
|
494
|
+
### Malware & artifact hygiene (cisco-talos)
|
|
495
|
+
- [ ] Attachment malware scan — if `clamscan` is present, scan dropped/ingested files before the agent reads them; quarantine and report. — **M**
|
|
496
|
+
- [ ] Binary function similarity for RE — near-duplicate function detection across builds to support diffing patched binaries (feeds `re_index` / Ghidra workflow). — **M**
|
|
497
|
+
- [ ] Synthetic security log corpus (talos/EvidenceForge) — generated hunt datasets for testing `security_kb` and detection rules. — **H**
|
|
498
|
+
- [ ] IoC feed import (talos/IOCs) — load indicators into `security_kb` with hashes/domains/IPs for offline matching. — **H**
|
|
499
|
+
|
|
500
|
+
## Batch plan (updated)
|
|
501
|
+
|
|
502
|
+
### Batch 3 — next
|
|
503
|
+
| Item | Source | Feasibility |
|
|
504
|
+
|---|---|---|
|
|
505
|
+
| Model behaviour probe suite | nvidia/garak | H |
|
|
506
|
+
| Skill scanner rule classes + SARIF | nvidia/SkillSpector | H |
|
|
507
|
+
| Verified secret scanning | trufflesecurity/trufflehog | H |
|
|
508
|
+
| Multi-phase audit with independent verification | cloudflare/security-audit-skill | H |
|
|
509
|
+
| `mcp-inspect` deterministic MCP tests | modelcontextprotocol/inspector | H |
|
|
510
|
+
| Screenshot → vision → click | bytedance/UI-TARS-desktop | H |
|
|
511
|
+
| Conversation templates | prior backlog | H |
|
|
512
|
+
| Multi-model A/B testing across runs | prior backlog | H |
|
|
513
|
+
|
|
514
|
+
### Batch 4 — after
|
|
515
|
+
| Item | Source | Feasibility |
|
|
516
|
+
|---|---|---|
|
|
517
|
+
| Interactive architecture map page | haydenschmitty/floorplan | H |
|
|
518
|
+
| Guardrail routing API surface | sandbox-quantum/switch-trust | H |
|
|
519
|
+
| IoC feed import | cisco-talos/IOCs | H |
|
|
520
|
+
| Synthetic security log corpus | cisco-talos/EvidenceForge | H |
|
|
521
|
+
| Teams + Mattermost channels | sandbox-quantum/switch | M |
|
|
522
|
+
| External agent CLI adapters | openai/codex-plugin-cc | M |
|
|
523
|
+
| Official MCP registry alignment | modelcontextprotocol/registry | M |
|
|
524
|
+
| Codex skills catalog import | openai/skills | M |
|
|
525
|
+
| Attachment malware scan (`clamscan`) | cisco-talos/clamav | M |
|
|
526
|
+
| Project-wide symbol rename (LSP) | sandbox-quantum/bartleby | M |
|
|
527
|
+
| Binary function similarity | cisco-talos/binary_function_similarity | M |
|
|
528
|
+
| RAGFlow-style private retrieval | bytedance/deer-flow | M |
|
|
529
|
+
| Codex-style MCP config presets | openai/codex | H |
|
|
530
|
+
| Plugin marketplace maturity | prior backlog | M |
|
|
531
|
+
| Mobile PWA polish | prior backlog | H |
|
|
532
|
+
|
|
533
|
+
### Batch 5 — polish / ecosystem
|
|
534
|
+
| Item | Source | Feasibility |
|
|
535
|
+
|---|---|---|
|
|
536
|
+
| Community plugin ecosystem | prior backlog | ecosystem |
|
|
537
|
+
| Docs & tutorials | prior backlog | H |
|
|
538
|
+
| Performance optimization (large context) | prior backlog | H |
|
|
539
|
+
| Accessibility (ARIA, screen readers) | prior backlog | H |
|
|
540
|
+
| i18n | prior backlog | H |
|
|
541
|
+
|
|
460
542
|
## Non-goals
|
|
461
543
|
- Cloud-hosted backends as a requirement (local-first always).
|
|
462
544
|
- Telemetry or phone-home.
|
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.
|
|
3
|
+
A feature-rich, local-only AI agent harness. CLI-first, offline-first. v0.78.0.
|
|
4
4
|
|
|
5
5
|
## Capabilities
|
|
6
6
|
- Multi-backend LLM adapter (Ollama + OpenAI-compatible + 18 providers)
|
package/package.json
CHANGED
|
@@ -4,13 +4,13 @@
|
|
|
4
4
|
[Setup]
|
|
5
5
|
AppId={{8F3D1B2A-6C4E-4B9A-9D21-AE615A010001}}
|
|
6
6
|
AppName=AegisAi Harness
|
|
7
|
-
AppVersion=0.
|
|
7
|
+
AppVersion=0.78.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.
|
|
13
|
+
OutputBaseFilename=AegisAi-Harness-0.78.0-Setup
|
|
14
14
|
Compression=lzma2
|
|
15
15
|
SolidCompression=yes
|
|
16
16
|
PrivilegesRequired=lowest
|
package/src/index.js
CHANGED
|
@@ -201,6 +201,33 @@ async function main() {
|
|
|
201
201
|
res.end(JSON.stringify(obj));
|
|
202
202
|
}
|
|
203
203
|
|
|
204
|
+
// Scope required by a route. Read-only GETs need `read`; anything that
|
|
205
|
+
// executes the agent or mutates state needs `execute`.
|
|
206
|
+
function requiredScope(method, urlPath) {
|
|
207
|
+
if (method !== 'GET') return 'execute';
|
|
208
|
+
const readOnly = ['/api/version', '/api/config', '/api/models', '/api/models/scan', '/api/models/hf-search',
|
|
209
|
+
'/api/context', '/api/sessions', '/api/sessions/search', '/api/search-sessions', '/api/files', '/api/file',
|
|
210
|
+
'/api/projects', '/api/skills', '/api/memories', '/api/errors', '/api/integrations', '/api/dag-runs',
|
|
211
|
+
'/api/stream', '/api/events'];
|
|
212
|
+
return readOnly.includes(urlPath) ? 'read' : 'read';
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
// Filesystem roots the file browser/editor may touch.
|
|
216
|
+
function allowedRoots() {
|
|
217
|
+
const configured = (process.env.AEGISAI_PROJECT_ROOT_ALLOWLIST || '').split(',').map((s) => s.trim()).filter(Boolean);
|
|
218
|
+
if (configured.length) return configured.map((r) => path.resolve(r));
|
|
219
|
+
return [path.resolve(process.cwd())];
|
|
220
|
+
}
|
|
221
|
+
function assertAllowedPath(target) {
|
|
222
|
+
const resolved = path.resolve(String(target || ''));
|
|
223
|
+
const roots = allowedRoots();
|
|
224
|
+
for (const root of roots) {
|
|
225
|
+
const rel = path.relative(root, resolved);
|
|
226
|
+
if (!rel.startsWith('..') && !path.isAbsolute(rel)) return resolved;
|
|
227
|
+
}
|
|
228
|
+
throw Object.assign(new Error('path outside allowed roots'), { status: 403 });
|
|
229
|
+
}
|
|
230
|
+
|
|
204
231
|
const handleRequest = async (req, res) => {
|
|
205
232
|
// CORS: never wildcard. Reflect only same-host origins; reject cross-site.
|
|
206
233
|
const origin = req.headers.origin;
|
|
@@ -215,19 +242,29 @@ async function main() {
|
|
|
215
242
|
res.setHeader('Access-Control-Allow-Methods', 'GET, POST, OPTIONS');
|
|
216
243
|
res.setHeader('Access-Control-Allow-Headers', 'Content-Type, Authorization');
|
|
217
244
|
if (req.method === 'OPTIONS') { res.writeHead(204); res.end(); return; }
|
|
218
|
-
// auth
|
|
245
|
+
// ---- auth ----
|
|
246
|
+
// Static assets stay public so a fresh browser can load the UI shell and
|
|
247
|
+
// prompt for a token. Only /api/* and /mcp are gated.
|
|
248
|
+
const urlPathOnly = req.url.split('?')[0];
|
|
249
|
+
const needsAuth = urlPathOnly.startsWith('/api/') || urlPathOnly === '/mcp';
|
|
219
250
|
const expectedToken = currentToken();
|
|
220
|
-
if (expectedToken) {
|
|
251
|
+
if (expectedToken && needsAuth) {
|
|
221
252
|
const supplied = (req.headers['authorization'] || '').replace(/^Bearer\s+/i, '') || new URL(req.url, 'http://x').searchParams.get('token') || '';
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
253
|
+
let authorized = tokenMatches(supplied, expectedToken);
|
|
254
|
+
let patScopes = null;
|
|
255
|
+
if (!authorized) {
|
|
256
|
+
// A personal access token may stand in, but only within its scopes.
|
|
225
257
|
try {
|
|
226
258
|
const pats = require('./access_tokens');
|
|
227
259
|
const v = pats.verify ? pats.verify(supplied) : null;
|
|
228
|
-
|
|
229
|
-
} catch (e) {
|
|
230
|
-
|
|
260
|
+
if (v && v.ok !== false) { authorized = true; patScopes = Array.isArray(v.scopes) ? v.scopes : []; }
|
|
261
|
+
} catch (e) { authorized = false; }
|
|
262
|
+
}
|
|
263
|
+
if (!authorized) { sendJson(res, 401, { error: 'unauthorized' }); return; }
|
|
264
|
+
if (patScopes) {
|
|
265
|
+
const required = requiredScope(req.method, urlPathOnly);
|
|
266
|
+
const allowed = patScopes.includes('*') || patScopes.includes(required) || (required === 'read' && patScopes.includes('execute'));
|
|
267
|
+
if (!allowed) { sendJson(res, 403, { error: 'insufficient_scope', required, granted: patScopes }); return; }
|
|
231
268
|
}
|
|
232
269
|
}
|
|
233
270
|
// rate limit — API only; static assets must not consume the API budget
|
|
@@ -364,14 +401,10 @@ async function main() {
|
|
|
364
401
|
}
|
|
365
402
|
if (req.method === 'POST' && req.url.split('?')[0] === '/api/file') {
|
|
366
403
|
const parsed = await readJson(req);
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
const resolved = path.resolve(target);
|
|
372
|
-
if (allowed.length && !allowed.some((root) => { const rel = path.relative(path.resolve(root), resolved); return !rel.startsWith('..') && !path.isAbsolute(rel); })) {
|
|
373
|
-
sendJson(res, 403, { error: 'path outside allowed roots' }); return;
|
|
374
|
-
}
|
|
404
|
+
if (!parsed.path) { sendJson(res, 400, { error: 'path required' }); return; }
|
|
405
|
+
let resolved;
|
|
406
|
+
try { resolved = assertAllowedPath(parsed.path); }
|
|
407
|
+
catch (e) { sendJson(res, e.status || 403, { error: String(e.message || e) }); return; }
|
|
375
408
|
try {
|
|
376
409
|
require('fs').writeFileSync(resolved, String(parsed.content == null ? '' : parsed.content), 'utf8');
|
|
377
410
|
sendJson(res, 200, { ok: true, path: resolved, bytes: Buffer.byteLength(String(parsed.content || '')) });
|
|
@@ -443,19 +476,35 @@ async function main() {
|
|
|
443
476
|
if (req.method === 'GET' && req.url.split('?')[0] === '/api/search-sessions') {
|
|
444
477
|
const q = (new URL(req.url, 'http://x').searchParams.get('q') || '').toLowerCase();
|
|
445
478
|
const results = [];
|
|
446
|
-
|
|
447
|
-
|
|
479
|
+
const seen = new Set();
|
|
480
|
+
const scan = (sid, msgs) => {
|
|
481
|
+
for (const m of msgs || []) {
|
|
448
482
|
if ((m.content || '').toLowerCase().includes(q)) {
|
|
449
|
-
results.push({ sessionId: sid, role: m.role, snippet: (m.content || '').slice(0,
|
|
450
|
-
|
|
483
|
+
results.push({ sessionId: sid, role: m.role, snippet: (m.content || '').slice(0, 140), match: true });
|
|
484
|
+
return;
|
|
451
485
|
}
|
|
452
486
|
}
|
|
487
|
+
};
|
|
488
|
+
// Persisted sessions first so search survives restarts.
|
|
489
|
+
try {
|
|
490
|
+
const d = dbSafe();
|
|
491
|
+
for (const s of (d ? d.listSessions() : [])) {
|
|
492
|
+
if (seen.has(s.id)) continue;
|
|
493
|
+
seen.add(s.id);
|
|
494
|
+
scan(s.id, s.messages);
|
|
495
|
+
}
|
|
496
|
+
} catch (e) {}
|
|
497
|
+
for (const [sid, msgs] of sessions.entries()) {
|
|
498
|
+
if (seen.has(sid)) continue;
|
|
499
|
+
scan(sid, msgs);
|
|
453
500
|
}
|
|
454
501
|
sendJson(res, 200, { results, query: q });
|
|
455
502
|
return;
|
|
456
503
|
}
|
|
457
504
|
if (req.method === 'GET' && req.url.split('?')[0] === '/api/files') {
|
|
458
|
-
|
|
505
|
+
let dir;
|
|
506
|
+
try { dir = assertAllowedPath(new URL(req.url, 'http://x').searchParams.get('dir') || process.cwd()); }
|
|
507
|
+
catch (e) { sendJson(res, e.status || 403, { error: String(e.message || e) }); return; }
|
|
459
508
|
let entries = [];
|
|
460
509
|
try {
|
|
461
510
|
const fs = require('fs');
|
|
@@ -472,8 +521,11 @@ async function main() {
|
|
|
472
521
|
return;
|
|
473
522
|
}
|
|
474
523
|
if (req.method === 'GET' && req.url.split('?')[0] === '/api/file') {
|
|
475
|
-
const
|
|
476
|
-
if (!
|
|
524
|
+
const requested = new URL(req.url, 'http://x').searchParams.get('path');
|
|
525
|
+
if (!requested) { sendJson(res, 400, { error: 'path required' }); return; }
|
|
526
|
+
let filePath;
|
|
527
|
+
try { filePath = assertAllowedPath(requested); }
|
|
528
|
+
catch (e) { sendJson(res, e.status || 403, { error: String(e.message || e) }); return; }
|
|
477
529
|
try {
|
|
478
530
|
const fs = require('fs');
|
|
479
531
|
const content = fs.readFileSync(filePath, 'utf8');
|
package/src/mcp_server.js
CHANGED
|
@@ -99,19 +99,47 @@ async function dispatch(msg) {
|
|
|
99
99
|
function createHandler() {
|
|
100
100
|
return async (req, res) => {
|
|
101
101
|
if (req.method === 'POST') {
|
|
102
|
+
const MAX = parseInt(process.env.AEGISAI_MCP_MAX_BODY || String(2 * 1024 * 1024), 10);
|
|
102
103
|
let body = '';
|
|
103
|
-
|
|
104
|
+
let bytes = 0;
|
|
105
|
+
let done = false;
|
|
106
|
+
req.on('data', (c) => {
|
|
107
|
+
if (done) return;
|
|
108
|
+
bytes += c.length;
|
|
109
|
+
if (bytes > MAX) {
|
|
110
|
+
done = true;
|
|
111
|
+
res.writeHead(413, { 'Content-Type': 'application/json' });
|
|
112
|
+
res.end(JSON.stringify({ jsonrpc: '2.0', error: { code: -32600, message: 'request body too large' } }));
|
|
113
|
+
req.resume();
|
|
114
|
+
return;
|
|
115
|
+
}
|
|
116
|
+
body += c;
|
|
117
|
+
});
|
|
118
|
+
req.on('error', () => {
|
|
119
|
+
if (done) return;
|
|
120
|
+
done = true;
|
|
121
|
+
try { res.writeHead(400, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ jsonrpc: '2.0', error: { code: -32600, message: 'request stream error' } })); } catch (e) {}
|
|
122
|
+
});
|
|
104
123
|
req.on('end', async () => {
|
|
124
|
+
if (done) return;
|
|
125
|
+
done = true;
|
|
105
126
|
let msg;
|
|
106
127
|
try { msg = JSON.parse(body); } catch (e) { res.writeHead(400, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ jsonrpc: '2.0', error: { code: -32700, message: 'parse error' } })); return; }
|
|
107
|
-
|
|
128
|
+
// Dispatch error boundary: a throwing tool must not kill the transport.
|
|
129
|
+
let result;
|
|
130
|
+
try {
|
|
131
|
+
result = await dispatch(msg);
|
|
132
|
+
} catch (e) {
|
|
133
|
+
const id = msg && msg.id !== undefined ? msg.id : null;
|
|
134
|
+
try { res.writeHead(200, { 'Content-Type': 'application/json' }); res.end(JSON.stringify({ jsonrpc: '2.0', id, error: { code: -32603, message: String((e && e.message) || e) } })); } catch (_) {}
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
108
137
|
if (result === null) { res.writeHead(202, { 'Content-Type': 'application/json' }); res.end(); return; }
|
|
109
138
|
const headers = { 'Content-Type': 'application/json' };
|
|
110
139
|
if (result._sessionId) { headers['Mcp-Session-Id'] = result._sessionId; delete result._sessionId; }
|
|
111
140
|
const sid = req.headers['mcp-session-id'];
|
|
112
141
|
if (sid && sessions.has(sid)) headers['Mcp-Session-Id'] = sid;
|
|
113
|
-
res.writeHead(200, headers);
|
|
114
|
-
res.end(JSON.stringify(result));
|
|
142
|
+
try { res.writeHead(200, headers); res.end(JSON.stringify(result)); } catch (e) {}
|
|
115
143
|
});
|
|
116
144
|
return;
|
|
117
145
|
}
|
package/src/tui.js
CHANGED
|
@@ -73,23 +73,10 @@ class Tui extends EventEmitter {
|
|
|
73
73
|
return;
|
|
74
74
|
}
|
|
75
75
|
if (s.startsWith('\x1b[') || s.startsWith('\x1bO')) return; // ignore escape sequences
|
|
76
|
-
//
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
if (parts[i]) this.input += parts[i].replace(/[^\x20-\x7e\t]/g, '');
|
|
81
|
-
if (i < parts.length - 1) {
|
|
82
|
-
const cmd = this.input.trim();
|
|
83
|
-
this.input = '';
|
|
84
|
-
this.emit('command', cmd);
|
|
85
|
-
if (cmd) this.addMessage('user', cmd);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
this.render();
|
|
89
|
-
return;
|
|
90
|
-
}
|
|
91
|
-
// Accept the whole printable run (paste support), dropping control chars.
|
|
92
|
-
const printable = s.replace(/[^\x20-\x7e\t]/g, '');
|
|
76
|
+
// A pasted block (multi-char, may contain newlines) is inserted verbatim so the
|
|
77
|
+
// user can review/edit it; only a bare Enter submits. Newlines become spaces
|
|
78
|
+
// because the input is single-line.
|
|
79
|
+
const printable = s.replace(/[\r\n]+/g, ' ').replace(/[^\x20-\x7e\t]/g, '');
|
|
93
80
|
if (printable) {
|
|
94
81
|
this.input += printable;
|
|
95
82
|
this.render();
|
package/src/version.js
CHANGED