flowmind 1.2.2 → 1.2.3
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/bin/flowmind.js +62 -2
- package/package.json +1 -1
package/bin/flowmind.js
CHANGED
|
@@ -1343,17 +1343,45 @@ program
|
|
|
1343
1343
|
.command('tui')
|
|
1344
1344
|
.description('Launch enhanced TUI with split panels, skill browser, and dragon display')
|
|
1345
1345
|
.action(async () => {
|
|
1346
|
+
let stdinWrapper = null;
|
|
1346
1347
|
try {
|
|
1347
1348
|
// Register .jsx extension for CJS
|
|
1348
1349
|
require('module')._extensions['.jsx'] = require('module')._extensions['.js'];
|
|
1349
1350
|
|
|
1350
1351
|
const React = require('react');
|
|
1351
1352
|
const { render } = require('ink');
|
|
1353
|
+
const { PassThrough } = require('stream');
|
|
1352
1354
|
const App = require('../tui/app.jsx');
|
|
1353
1355
|
|
|
1354
1356
|
const fm = await initFlowMind();
|
|
1355
1357
|
|
|
1356
|
-
|
|
1358
|
+
// Create a stdin wrapper to handle non-TTY environments (e.g., piped stdin).
|
|
1359
|
+
// Ink v3's useInput hook calls setRawMode(true) which throws if stdin is not a TTY.
|
|
1360
|
+
const realStdin = process.stdin;
|
|
1361
|
+
stdinWrapper = new PassThrough();
|
|
1362
|
+
stdinWrapper.isTTY = true;
|
|
1363
|
+
stdinWrapper.isRaw = false;
|
|
1364
|
+
stdinWrapper.setRawMode = (mode) => {
|
|
1365
|
+
try {
|
|
1366
|
+
if (realStdin.setRawMode) {
|
|
1367
|
+
realStdin.setRawMode(mode);
|
|
1368
|
+
}
|
|
1369
|
+
} catch (e) {
|
|
1370
|
+
// Suppress raw mode errors in non-TTY environments
|
|
1371
|
+
}
|
|
1372
|
+
return stdinWrapper;
|
|
1373
|
+
};
|
|
1374
|
+
// Forward real stdin data to the wrapper
|
|
1375
|
+
if (realStdin.readable) {
|
|
1376
|
+
realStdin.on('data', (chunk) => {
|
|
1377
|
+
if (!stdinWrapper.destroyed) stdinWrapper.write(chunk);
|
|
1378
|
+
});
|
|
1379
|
+
}
|
|
1380
|
+
|
|
1381
|
+
const { unmount, waitUntilExit } = render(
|
|
1382
|
+
React.createElement(App, { flowmind: fm }),
|
|
1383
|
+
{ stdin: stdinWrapper }
|
|
1384
|
+
);
|
|
1357
1385
|
await waitUntilExit();
|
|
1358
1386
|
unmount();
|
|
1359
1387
|
} catch (error) {
|
|
@@ -1361,6 +1389,10 @@ program
|
|
|
1361
1389
|
if (error.message.includes('Cannot find module')) {
|
|
1362
1390
|
console.log(chalk.yellow('Try running: npm install ink@3 react ink-text-input ink-spinner'));
|
|
1363
1391
|
}
|
|
1392
|
+
} finally {
|
|
1393
|
+
if (stdinWrapper && !stdinWrapper.destroyed) {
|
|
1394
|
+
stdinWrapper.destroy();
|
|
1395
|
+
}
|
|
1364
1396
|
}
|
|
1365
1397
|
});
|
|
1366
1398
|
|
|
@@ -1369,19 +1401,43 @@ program
|
|
|
1369
1401
|
.command('dashboard')
|
|
1370
1402
|
.description('Launch real-time monitoring dashboard for MCP activity and events')
|
|
1371
1403
|
.action(async () => {
|
|
1404
|
+
let stdinWrapper = null;
|
|
1372
1405
|
try {
|
|
1373
1406
|
// Register .jsx extension for CJS
|
|
1374
1407
|
require('module')._extensions['.jsx'] = require('module')._extensions['.js'];
|
|
1375
1408
|
|
|
1376
1409
|
const React = require('react');
|
|
1377
1410
|
const { render } = require('ink');
|
|
1411
|
+
const { PassThrough } = require('stream');
|
|
1378
1412
|
const DashboardApp = require('../dashboard/app.jsx');
|
|
1379
1413
|
const eventBus = require('../core/event-bus');
|
|
1380
1414
|
|
|
1381
1415
|
const fm = await initFlowMind();
|
|
1382
1416
|
|
|
1417
|
+
// Create a stdin wrapper to handle non-TTY environments
|
|
1418
|
+
const realStdin = process.stdin;
|
|
1419
|
+
stdinWrapper = new PassThrough();
|
|
1420
|
+
stdinWrapper.isTTY = true;
|
|
1421
|
+
stdinWrapper.isRaw = false;
|
|
1422
|
+
stdinWrapper.setRawMode = (mode) => {
|
|
1423
|
+
try {
|
|
1424
|
+
if (realStdin.setRawMode) {
|
|
1425
|
+
realStdin.setRawMode(mode);
|
|
1426
|
+
}
|
|
1427
|
+
} catch (e) {
|
|
1428
|
+
// Suppress raw mode errors in non-TTY environments
|
|
1429
|
+
}
|
|
1430
|
+
return stdinWrapper;
|
|
1431
|
+
};
|
|
1432
|
+
if (realStdin.readable) {
|
|
1433
|
+
realStdin.on('data', (chunk) => {
|
|
1434
|
+
if (!stdinWrapper.destroyed) stdinWrapper.write(chunk);
|
|
1435
|
+
});
|
|
1436
|
+
}
|
|
1437
|
+
|
|
1383
1438
|
const { unmount, waitUntilExit } = render(
|
|
1384
|
-
React.createElement(DashboardApp, { flowmind: fm, eventBus })
|
|
1439
|
+
React.createElement(DashboardApp, { flowmind: fm, eventBus }),
|
|
1440
|
+
{ stdin: stdinWrapper }
|
|
1385
1441
|
);
|
|
1386
1442
|
await waitUntilExit();
|
|
1387
1443
|
unmount();
|
|
@@ -1390,6 +1446,10 @@ program
|
|
|
1390
1446
|
if (error.message.includes('Cannot find module')) {
|
|
1391
1447
|
console.log(chalk.yellow('Try running: npm install ink@3 react'));
|
|
1392
1448
|
}
|
|
1449
|
+
} finally {
|
|
1450
|
+
if (stdinWrapper && !stdinWrapper.destroyed) {
|
|
1451
|
+
stdinWrapper.destroy();
|
|
1452
|
+
}
|
|
1393
1453
|
}
|
|
1394
1454
|
});
|
|
1395
1455
|
|
package/package.json
CHANGED