magi-ai 0.1.1 → 0.1.2
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/dist/bin/magi.js +7 -0
- package/dist/src/tui/magi-tui.js +16 -0
- package/dist/src/tui/panel.d.ts +1 -0
- package/dist/src/tui/panel.js +4 -0
- package/package.json +3 -1
package/dist/bin/magi.js
CHANGED
|
@@ -4,6 +4,9 @@ import chalk from 'chalk';
|
|
|
4
4
|
import { randomBytes } from 'node:crypto';
|
|
5
5
|
import { createInterface } from 'node:readline/promises';
|
|
6
6
|
import { readFile } from 'node:fs/promises';
|
|
7
|
+
import { fileURLToPath } from 'node:url';
|
|
8
|
+
import { dirname, join } from 'node:path';
|
|
9
|
+
import updateNotifier from 'update-notifier';
|
|
7
10
|
import { Magi } from '../src/index.js';
|
|
8
11
|
import { printDeliberation, printHeader } from '../src/reporters/console.js';
|
|
9
12
|
import { initializeTui } from '../src/cli/tui-setup.js';
|
|
@@ -16,6 +19,10 @@ import { validateFile } from '../src/utils/file-validator.js';
|
|
|
16
19
|
import { detectLanguage } from '../src/utils/language-detector.js';
|
|
17
20
|
import { collectProjectContext, collectRelatedFiles } from '../src/context/auto-collector.js';
|
|
18
21
|
setupGracefulShutdown();
|
|
22
|
+
// ── Update notification ──────────────────────────────────────────
|
|
23
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
24
|
+
const pkg = JSON.parse(await readFile(join(__dirname, '..', 'package.json'), 'utf-8'));
|
|
25
|
+
updateNotifier({ pkg }).notify();
|
|
19
26
|
// ── CLI confirmation helper ──────────────────────────────────────
|
|
20
27
|
async function confirmDestructiveAction(description) {
|
|
21
28
|
if (!process.stdin.isTTY) {
|
package/dist/src/tui/magi-tui.js
CHANGED
|
@@ -308,6 +308,7 @@ export class MagiTui {
|
|
|
308
308
|
this.animations.stopBreathing(e.unit);
|
|
309
309
|
const us = this.getOrCreateUnit(e.unit);
|
|
310
310
|
us.state = 'error';
|
|
311
|
+
us.errorMessage = summarizeError(e.error);
|
|
311
312
|
us.startedAtMs = undefined;
|
|
312
313
|
us.breathPhase = 0;
|
|
313
314
|
this.activityLog.push(`${e.unit} FAILED: ${e.error.slice(0, 50)}`, EVA_PALETTE.warning);
|
|
@@ -562,6 +563,7 @@ export class MagiTui {
|
|
|
562
563
|
? Math.max(0, Date.now() - us.startedAtMs)
|
|
563
564
|
: undefined,
|
|
564
565
|
reasoning: us.reasoning,
|
|
566
|
+
errorMessage: us.errorMessage,
|
|
565
567
|
breathPhase: us.breathPhase,
|
|
566
568
|
};
|
|
567
569
|
}
|
|
@@ -752,3 +754,17 @@ function decisionTone(decision) {
|
|
|
752
754
|
return 'reject';
|
|
753
755
|
return 'deadlock';
|
|
754
756
|
}
|
|
757
|
+
/** Shorten raw AdapterError string into a concise panel-friendly message. */
|
|
758
|
+
function summarizeError(raw) {
|
|
759
|
+
if (raw.includes('timed out'))
|
|
760
|
+
return 'TIMEOUT';
|
|
761
|
+
if (raw.includes('PARSE_ERROR') || raw.includes('Failed to parse'))
|
|
762
|
+
return 'PARSE ERROR';
|
|
763
|
+
// "... exited with code N" → "EXIT CODE N"
|
|
764
|
+
const exitMatch = raw.match(/exited with code (\d+)/);
|
|
765
|
+
if (exitMatch)
|
|
766
|
+
return `EXIT CODE ${exitMatch[1]}`;
|
|
767
|
+
// Generic fallback: strip class prefix, keep first 40 chars
|
|
768
|
+
const stripped = raw.replace(/^(AdapterError|Error):\s*/i, '');
|
|
769
|
+
return stripped.length > 40 ? stripped.slice(0, 37) + '...' : stripped;
|
|
770
|
+
}
|
package/dist/src/tui/panel.d.ts
CHANGED
package/dist/src/tui/panel.js
CHANGED
|
@@ -114,6 +114,10 @@ export class PanelRenderer {
|
|
|
114
114
|
const wc = EVA_PALETTE.warning;
|
|
115
115
|
this.writeCentered(buf, innerRow + 1, rect, '侵 食', wc, ATTR_BOLD);
|
|
116
116
|
this.writeCentered(buf, innerRow + 2, rect, 'INTRUSION', wc, ATTR_DIM);
|
|
117
|
+
if (content.errorMessage) {
|
|
118
|
+
const hint = truncateToDisplayWidth(content.errorMessage, innerWidth);
|
|
119
|
+
this.writeCentered(buf, innerRow + 4, rect, hint, tw, ATTR_DIM);
|
|
120
|
+
}
|
|
117
121
|
break;
|
|
118
122
|
}
|
|
119
123
|
case 'berserk': {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "magi-ai",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "MAGI System - Multi-AI CLI Deliberation Framework (Evangelion-inspired, unofficial fan-made)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/src/index.js",
|
|
@@ -64,11 +64,13 @@
|
|
|
64
64
|
"@modelcontextprotocol/sdk": "^1.27.1",
|
|
65
65
|
"chalk": "^5.4.0",
|
|
66
66
|
"commander": "^13.0.0",
|
|
67
|
+
"update-notifier": "^7.3.1",
|
|
67
68
|
"zod": "^3.24.0"
|
|
68
69
|
},
|
|
69
70
|
"devDependencies": {
|
|
70
71
|
"@eslint/js": "^10.0.1",
|
|
71
72
|
"@types/node": "^22.0.0",
|
|
73
|
+
"@types/update-notifier": "^6.0.8",
|
|
72
74
|
"@vitest/coverage-v8": "^3.2.4",
|
|
73
75
|
"eslint": "^10.0.2",
|
|
74
76
|
"tsx": "^4.19.0",
|