@positronic/cli 0.0.40 → 0.0.42
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/src/cli.js +59 -18
- package/dist/src/commands/server.js +4 -0
- package/dist/src/components/brain-rerun.js +25 -32
- package/dist/src/components/brain-run.js +27 -44
- package/dist/src/components/brain-watch.js +23 -34
- package/dist/src/components/resource-sync.js +8 -12
- package/dist/src/components/schedule-create.js +1 -1
- package/dist/src/components/watch.js +27 -14
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/commands/server.d.ts.map +1 -1
- package/dist/types/components/brain-rerun.d.ts.map +1 -1
- package/dist/types/components/brain-run.d.ts +1 -1
- package/dist/types/components/brain-run.d.ts.map +1 -1
- package/dist/types/components/brain-watch.d.ts.map +1 -1
- package/dist/types/components/resource-sync.d.ts.map +1 -1
- package/dist/types/components/watch.d.ts.map +1 -1
- package/package.json +4 -4
package/dist/src/cli.js
CHANGED
|
@@ -700,25 +700,66 @@ export function buildCli(options) {
|
|
|
700
700
|
});
|
|
701
701
|
// Handle top-level list/delete options
|
|
702
702
|
yargsSchedule.middleware(function(argv) {
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
703
|
+
return _async_to_generator(function() {
|
|
704
|
+
var element, result, element1, result1;
|
|
705
|
+
return _ts_generator(this, function(_state) {
|
|
706
|
+
switch(_state.label){
|
|
707
|
+
case 0:
|
|
708
|
+
if (!argv.list) return [
|
|
709
|
+
3,
|
|
710
|
+
3
|
|
711
|
+
];
|
|
712
|
+
element = scheduleCommand.list({
|
|
713
|
+
brain: argv.brain
|
|
714
|
+
});
|
|
715
|
+
result = render(element);
|
|
716
|
+
if (!(result && typeof result.waitUntilExit === 'function')) return [
|
|
717
|
+
3,
|
|
718
|
+
2
|
|
719
|
+
];
|
|
720
|
+
return [
|
|
721
|
+
4,
|
|
722
|
+
result.waitUntilExit()
|
|
723
|
+
];
|
|
724
|
+
case 1:
|
|
725
|
+
_state.sent();
|
|
726
|
+
_state.label = 2;
|
|
727
|
+
case 2:
|
|
728
|
+
// Exit after completion to prevent further command processing
|
|
729
|
+
process.exit(0);
|
|
730
|
+
_state.label = 3;
|
|
731
|
+
case 3:
|
|
732
|
+
if (!argv.delete) return [
|
|
733
|
+
3,
|
|
734
|
+
6
|
|
735
|
+
];
|
|
736
|
+
element1 = scheduleCommand.delete({
|
|
737
|
+
scheduleId: argv.delete,
|
|
738
|
+
force: argv.force
|
|
739
|
+
});
|
|
740
|
+
result1 = render(element1);
|
|
741
|
+
if (!(result1 && typeof result1.waitUntilExit === 'function')) return [
|
|
742
|
+
3,
|
|
743
|
+
5
|
|
744
|
+
];
|
|
745
|
+
return [
|
|
746
|
+
4,
|
|
747
|
+
result1.waitUntilExit()
|
|
748
|
+
];
|
|
749
|
+
case 4:
|
|
750
|
+
_state.sent();
|
|
751
|
+
_state.label = 5;
|
|
752
|
+
case 5:
|
|
753
|
+
// Exit after completion to prevent further command processing
|
|
754
|
+
process.exit(0);
|
|
755
|
+
_state.label = 6;
|
|
756
|
+
case 6:
|
|
757
|
+
return [
|
|
758
|
+
2
|
|
759
|
+
];
|
|
760
|
+
}
|
|
717
761
|
});
|
|
718
|
-
|
|
719
|
-
// Exit after completion to prevent further command processing
|
|
720
|
-
process.exit(0);
|
|
721
|
-
}
|
|
762
|
+
})();
|
|
722
763
|
}, true);
|
|
723
764
|
yargsSchedule.command([
|
|
724
765
|
'create <brain> <cron-expression>',
|
|
@@ -344,6 +344,10 @@ export var ServerCommand = /*#__PURE__*/ function() {
|
|
|
344
344
|
if (fs.existsSync(pidFile)) {
|
|
345
345
|
fs.unlinkSync(pidFile);
|
|
346
346
|
}
|
|
347
|
+
// Restore terminal from raw mode (dev server may have set it)
|
|
348
|
+
if (process.stdin.isTTY && process.stdin.setRawMode) {
|
|
349
|
+
process.stdin.setRawMode(false);
|
|
350
|
+
}
|
|
347
351
|
process.exit(0);
|
|
348
352
|
return [
|
|
349
353
|
2
|
|
@@ -276,38 +276,31 @@ export var BrainRerun = function(param) {
|
|
|
276
276
|
startsAt,
|
|
277
277
|
stopsAfter
|
|
278
278
|
]);
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
}, 'Rerunning brain "', identifier, '"', runDetails, rangeDetails), /*#__PURE__*/ React.createElement(Box, {
|
|
305
|
-
marginTop: 1
|
|
306
|
-
}, /*#__PURE__*/ React.createElement(Text, {
|
|
307
|
-
dimColor: true
|
|
308
|
-
}, "Watch the run with: positronic watch --run-id ", newRunId)));
|
|
309
|
-
}
|
|
310
|
-
return /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Text, {
|
|
279
|
+
var errorDetails = runId ? 'Make sure the brain "'.concat(identifier, '" and run ID "').concat(runId, '" exist.\nYou can list brain history with: positronic brain history ').concat(identifier) : 'Make sure the brain "'.concat(identifier, '" exists.\nYou can list available brains with: positronic brain list');
|
|
280
|
+
var runDetails = runId ? " from run ".concat(runId) : '';
|
|
281
|
+
var rangeDetails = startsAt || stopsAfter ? " (".concat(startsAt ? "starting at step ".concat(startsAt) : '').concat(startsAt && stopsAfter ? ', ' : '').concat(stopsAfter ? "stopping after step ".concat(stopsAfter) : '', ")") : '';
|
|
282
|
+
// Maintain consistent Box wrapper to help Ink properly calculate
|
|
283
|
+
// terminal clearing between renders (prevents appending instead of overwriting)
|
|
284
|
+
return /*#__PURE__*/ React.createElement(Box, {
|
|
285
|
+
flexDirection: "column"
|
|
286
|
+
}, isLoading ? /*#__PURE__*/ React.createElement(Text, null, "\uD83D\uDD04 Starting brain rerun...") : error ? /*#__PURE__*/ React.createElement(ErrorComponent, {
|
|
287
|
+
error: {
|
|
288
|
+
title: 'Brain Rerun Failed',
|
|
289
|
+
message: error,
|
|
290
|
+
details: errorDetails
|
|
291
|
+
}
|
|
292
|
+
}) : newRunId ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Text, {
|
|
293
|
+
bold: true,
|
|
294
|
+
color: "green"
|
|
295
|
+
}, "✅ Brain rerun started successfully!"), /*#__PURE__*/ React.createElement(Text, null, "New run ID: ", /*#__PURE__*/ React.createElement(Text, {
|
|
296
|
+
bold: true
|
|
297
|
+
}, newRunId)), /*#__PURE__*/ React.createElement(Text, {
|
|
298
|
+
dimColor: true
|
|
299
|
+
}, 'Rerunning brain "', identifier, '"', runDetails, rangeDetails), /*#__PURE__*/ React.createElement(Box, {
|
|
300
|
+
marginTop: 1
|
|
301
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
302
|
+
dimColor: true
|
|
303
|
+
}, "Watch the run with: positronic watch --run-id ", newRunId))) : /*#__PURE__*/ React.createElement(Text, {
|
|
311
304
|
color: "red"
|
|
312
305
|
}, "❌ Unexpected error occurred"));
|
|
313
306
|
};
|
|
@@ -478,52 +478,35 @@ export var BrainRun = function(param) {
|
|
|
478
478
|
exit();
|
|
479
479
|
}
|
|
480
480
|
});
|
|
481
|
-
//
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
}
|
|
490
|
-
|
|
481
|
+
// Maintain consistent Box wrapper to help Ink properly calculate
|
|
482
|
+
// terminal clearing between renders (prevents appending instead of overwriting)
|
|
483
|
+
return /*#__PURE__*/ React.createElement(Box, {
|
|
484
|
+
flexDirection: "column"
|
|
485
|
+
}, phase === 'searching' ? /*#__PURE__*/ React.createElement(Text, null, "Searching for brain '", identifier, "'...") : phase === 'error' && error ? /*#__PURE__*/ React.createElement(ErrorComponent, {
|
|
486
|
+
error: error
|
|
487
|
+
}) : phase === 'disambiguating' ? /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(Text, {
|
|
488
|
+
bold: true
|
|
489
|
+
}, "Multiple brains match '", identifier, "':"), /*#__PURE__*/ React.createElement(Box, {
|
|
490
|
+
marginTop: 1,
|
|
491
|
+
flexDirection: "column"
|
|
492
|
+
}, brains.map(function(brain, index) {
|
|
493
|
+
var isSelected = index === selectedIndex;
|
|
491
494
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
492
|
-
|
|
495
|
+
key: brain.title,
|
|
496
|
+
flexDirection: "column",
|
|
497
|
+
marginBottom: 1
|
|
493
498
|
}, /*#__PURE__*/ React.createElement(Text, {
|
|
499
|
+
color: isSelected ? 'cyan' : undefined
|
|
500
|
+
}, isSelected ? '▶ ' : ' ', /*#__PURE__*/ React.createElement(Text, {
|
|
494
501
|
bold: true
|
|
495
|
-
},
|
|
496
|
-
marginTop: 1,
|
|
497
|
-
flexDirection: "column"
|
|
498
|
-
}, brains.map(function(brain, index) {
|
|
499
|
-
var isSelected = index === selectedIndex;
|
|
500
|
-
return /*#__PURE__*/ React.createElement(Box, {
|
|
501
|
-
key: brain.title,
|
|
502
|
-
flexDirection: "column",
|
|
503
|
-
marginBottom: 1
|
|
504
|
-
}, /*#__PURE__*/ React.createElement(Text, {
|
|
505
|
-
color: isSelected ? 'cyan' : undefined
|
|
506
|
-
}, isSelected ? '▶ ' : ' ', /*#__PURE__*/ React.createElement(Text, {
|
|
507
|
-
bold: true
|
|
508
|
-
}, brain.title)), /*#__PURE__*/ React.createElement(Text, {
|
|
509
|
-
dimColor: true
|
|
510
|
-
}, ' ', brain.description));
|
|
511
|
-
})), /*#__PURE__*/ React.createElement(Box, {
|
|
512
|
-
marginTop: 1
|
|
513
|
-
}, /*#__PURE__*/ React.createElement(Text, {
|
|
502
|
+
}, brain.title)), /*#__PURE__*/ React.createElement(Text, {
|
|
514
503
|
dimColor: true
|
|
515
|
-
},
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
|
|
523
|
-
runId: runId
|
|
524
|
-
});
|
|
525
|
-
}
|
|
526
|
-
return /*#__PURE__*/ React.createElement(Text, null, "Run ID: ", runId);
|
|
527
|
-
}
|
|
528
|
-
return null;
|
|
504
|
+
}, ' ', brain.description));
|
|
505
|
+
})), /*#__PURE__*/ React.createElement(Box, {
|
|
506
|
+
marginTop: 1
|
|
507
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
508
|
+
dimColor: true
|
|
509
|
+
}, "Use arrow keys to navigate, Enter to select, q to quit"))) : phase === 'running' ? /*#__PURE__*/ React.createElement(Text, null, "Starting brain run...") : phase === 'complete' && runId ? watch ? /*#__PURE__*/ React.createElement(Watch, {
|
|
510
|
+
runId: runId
|
|
511
|
+
}) : /*#__PURE__*/ React.createElement(Text, null, "Run ID: ", runId) : null);
|
|
529
512
|
};
|
|
@@ -304,40 +304,29 @@ import { apiClient, isApiLocalDevMode } from '../commands/helpers.js';
|
|
|
304
304
|
}, [
|
|
305
305
|
brainTitle
|
|
306
306
|
]);
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
return " positronic watch --run-id ".concat(run.brainRunId);
|
|
331
|
-
}).join('\n'))
|
|
332
|
-
}
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
if (phase === 'watching' && runId) {
|
|
336
|
-
return /*#__PURE__*/ React.createElement(Watch, {
|
|
337
|
-
runId: runId
|
|
338
|
-
});
|
|
339
|
-
}
|
|
340
|
-
return null;
|
|
307
|
+
// Maintain consistent Box wrapper to help Ink properly calculate
|
|
308
|
+
// terminal clearing between renders (prevents appending instead of overwriting)
|
|
309
|
+
return /*#__PURE__*/ React.createElement(Box, {
|
|
310
|
+
flexDirection: "column"
|
|
311
|
+
}, phase === 'loading' ? /*#__PURE__*/ React.createElement(Text, null, 'Looking for active runs for "', brainTitle, '"...') : phase === 'error' && error ? /*#__PURE__*/ React.createElement(ErrorComponent, {
|
|
312
|
+
error: error
|
|
313
|
+
}) : phase === 'no-runs' ? /*#__PURE__*/ React.createElement(ErrorComponent, {
|
|
314
|
+
error: {
|
|
315
|
+
title: 'No Active Runs',
|
|
316
|
+
message: 'No currently running brain runs found for brain "'.concat(brainTitle, '".'),
|
|
317
|
+
details: "To start a new run, use: positronic run ".concat(brainTitle)
|
|
318
|
+
}
|
|
319
|
+
}) : phase === 'multiple-runs' ? /*#__PURE__*/ React.createElement(ErrorComponent, {
|
|
320
|
+
error: {
|
|
321
|
+
title: 'Multiple Active Runs',
|
|
322
|
+
message: "Found ".concat(runs.length, ' active runs for brain "').concat(brainTitle, '".'),
|
|
323
|
+
details: "Please specify a specific run ID with --run-id:\n".concat(runs.map(function(run) {
|
|
324
|
+
return " positronic watch --run-id ".concat(run.brainRunId);
|
|
325
|
+
}).join('\n'))
|
|
326
|
+
}
|
|
327
|
+
}) : phase === 'watching' && runId ? /*#__PURE__*/ React.createElement(Watch, {
|
|
328
|
+
runId: runId
|
|
329
|
+
}) : null);
|
|
341
330
|
};
|
|
342
331
|
/**
|
|
343
332
|
* BrainWatchWithResolver - Resolves a brain identifier and watches its active run.
|
|
@@ -335,17 +335,13 @@ export var ResourceSync = function(param) {
|
|
|
335
335
|
]);
|
|
336
336
|
var uploadCount = stats.uploadCount, skipCount = stats.skipCount, errorCount = stats.errorCount, totalCount = stats.totalCount, deleteCount = stats.deleteCount, currentFile = stats.currentFile, currentAction = stats.currentAction, errors = stats.errors;
|
|
337
337
|
var processedCount = uploadCount + skipCount + errorCount;
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
error: error
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
if (currentAction === 'connecting') {
|
|
344
|
-
return /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Text, null, "\uD83D\uDD0C Connecting to server..."));
|
|
345
|
-
}
|
|
338
|
+
// Maintain consistent Box wrapper to help Ink properly calculate
|
|
339
|
+
// terminal clearing between renders (prevents appending instead of overwriting)
|
|
346
340
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
347
341
|
flexDirection: "column"
|
|
348
|
-
},
|
|
342
|
+
}, error ? /*#__PURE__*/ React.createElement(ErrorComponent, {
|
|
343
|
+
error: error
|
|
344
|
+
}) : currentAction === 'connecting' ? /*#__PURE__*/ React.createElement(Text, null, "\uD83D\uDD0C Connecting to server...") : /*#__PURE__*/ React.createElement(React.Fragment, null, currentAction !== 'done' && currentFile && /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Text, null, currentAction === 'uploading' ? '⬆️ Uploading' : currentAction === 'deleting' ? '🗑️ Deleting' : '🔍 Checking', " ", currentFile, "...")), totalCount > 0 && currentAction !== 'done' && /*#__PURE__*/ React.createElement(Box, {
|
|
349
345
|
marginTop: 1
|
|
350
346
|
}, /*#__PURE__*/ React.createElement(Text, {
|
|
351
347
|
dimColor: true
|
|
@@ -359,13 +355,13 @@ export var ResourceSync = function(param) {
|
|
|
359
355
|
}, /*#__PURE__*/ React.createElement(Text, {
|
|
360
356
|
color: "red",
|
|
361
357
|
bold: true
|
|
362
|
-
}, "Errors:"), errors.map(function(
|
|
358
|
+
}, "Errors:"), errors.map(function(err, i) {
|
|
363
359
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
364
360
|
key: i,
|
|
365
361
|
paddingLeft: 2
|
|
366
362
|
}, /*#__PURE__*/ React.createElement(Text, {
|
|
367
363
|
color: "red"
|
|
368
|
-
}, "❌ ",
|
|
364
|
+
}, "❌ ", err.file, ": ", err.message));
|
|
369
365
|
})), currentAction === 'done' && totalCount > 0 && /*#__PURE__*/ React.createElement(Box, {
|
|
370
366
|
flexDirection: "column",
|
|
371
367
|
marginTop: 1
|
|
@@ -382,5 +378,5 @@ export var ResourceSync = function(param) {
|
|
|
382
378
|
color: "yellow"
|
|
383
379
|
}, " • Deleted: ", deleteCount), errorCount > 0 && /*#__PURE__*/ React.createElement(Text, {
|
|
384
380
|
color: "red"
|
|
385
|
-
}, " • Errors: ", errorCount))));
|
|
381
|
+
}, " • Errors: ", errorCount)))));
|
|
386
382
|
};
|
|
@@ -253,7 +253,7 @@ export var ScheduleCreate = function(param) {
|
|
|
253
253
|
marginTop: 1
|
|
254
254
|
}, /*#__PURE__*/ React.createElement(Text, {
|
|
255
255
|
dimColor: true
|
|
256
|
-
}, 'Tip: Use "px schedule
|
|
256
|
+
}, 'Tip: Use "px schedule -l" to view all schedules')));
|
|
257
257
|
}
|
|
258
258
|
return null;
|
|
259
259
|
};
|
|
@@ -44,7 +44,7 @@ function _unsupported_iterable_to_array(o, minLen) {
|
|
|
44
44
|
if (n === "Map" || n === "Set") return Array.from(n);
|
|
45
45
|
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
46
46
|
}
|
|
47
|
-
import React, { useState, useEffect } from 'react';
|
|
47
|
+
import React, { useState, useEffect, useRef } from 'react';
|
|
48
48
|
import { Text, Box } from 'ink';
|
|
49
49
|
import { EventSource } from 'eventsource';
|
|
50
50
|
import { BRAIN_EVENTS } from '@positronic/core';
|
|
@@ -72,12 +72,10 @@ var getStatusIndicator = function(status) {
|
|
|
72
72
|
};
|
|
73
73
|
var WatchStatus = function(param) {
|
|
74
74
|
var steps = param.steps, brainTitle = param.brainTitle, runId = param.runId;
|
|
75
|
-
|
|
76
|
-
return /*#__PURE__*/ React.createElement(Text, null, "Waiting for brain steps...");
|
|
77
|
-
}
|
|
75
|
+
// Maintain consistent Box wrapper for proper Ink terminal clearing
|
|
78
76
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
79
77
|
flexDirection: "column"
|
|
80
|
-
}, brainTitle && /*#__PURE__*/ React.createElement(Text, {
|
|
78
|
+
}, !steps || steps.length === 0 ? /*#__PURE__*/ React.createElement(Text, null, "Waiting for brain steps...") : /*#__PURE__*/ React.createElement(React.Fragment, null, brainTitle && /*#__PURE__*/ React.createElement(Text, {
|
|
81
79
|
bold: true
|
|
82
80
|
}, "Brain: ", brainTitle, " Run ID: ", runId), /*#__PURE__*/ React.createElement(Box, {
|
|
83
81
|
marginTop: 1,
|
|
@@ -93,7 +91,7 @@ var WatchStatus = function(param) {
|
|
|
93
91
|
}, /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Text, {
|
|
94
92
|
color: step.status === STATUS.COMPLETE ? 'green' : step.status === STATUS.ERROR ? 'red' : step.status === STATUS.RUNNING ? 'white' : step.status === STATUS.PENDING ? 'gray' : 'yellow'
|
|
95
93
|
}, getStatusIndicator(step.status), " ", step.title)));
|
|
96
|
-
}));
|
|
94
|
+
})));
|
|
97
95
|
};
|
|
98
96
|
export var Watch = function(param) {
|
|
99
97
|
var runId = param.runId;
|
|
@@ -103,12 +101,15 @@ export var Watch = function(param) {
|
|
|
103
101
|
var _useState3 = _sliced_to_array(useState(null), 2), error = _useState3[0], setError = _useState3[1];
|
|
104
102
|
var _useState4 = _sliced_to_array(useState(false), 2), isConnected = _useState4[0], setIsConnected = _useState4[1];
|
|
105
103
|
var _useState5 = _sliced_to_array(useState(false), 2), isCompleted = _useState5[0], setIsCompleted = _useState5[1];
|
|
104
|
+
// Track the main brain's brainRunId to distinguish from inner brain events
|
|
105
|
+
var mainBrainRunIdRef = useRef(null);
|
|
106
106
|
useEffect(function() {
|
|
107
107
|
var baseUrl = getApiBaseUrl();
|
|
108
108
|
var url = "".concat(baseUrl, "/brains/runs/").concat(runId, "/watch");
|
|
109
109
|
var es = new EventSource(url);
|
|
110
110
|
setIsConnected(false);
|
|
111
111
|
setError(null);
|
|
112
|
+
mainBrainRunIdRef.current = null;
|
|
112
113
|
es.onopen = function() {
|
|
113
114
|
setIsConnected(true);
|
|
114
115
|
setError(null);
|
|
@@ -120,14 +121,27 @@ export var Watch = function(param) {
|
|
|
120
121
|
setSteps(eventData.steps);
|
|
121
122
|
}
|
|
122
123
|
if (eventData.type === BRAIN_EVENTS.START || eventData.type === BRAIN_EVENTS.RESTART) {
|
|
123
|
-
|
|
124
|
+
var startEvent = eventData;
|
|
125
|
+
// Only set the main brain info on the first START event
|
|
126
|
+
if (mainBrainRunIdRef.current === null) {
|
|
127
|
+
mainBrainRunIdRef.current = startEvent.brainRunId;
|
|
128
|
+
setBrainTitle(startEvent.brainTitle);
|
|
129
|
+
}
|
|
124
130
|
setIsCompleted(false);
|
|
125
131
|
}
|
|
132
|
+
// Only mark complete when the main brain completes, not inner brains
|
|
126
133
|
if (eventData.type === BRAIN_EVENTS.COMPLETE || eventData.type === BRAIN_EVENTS.ERROR) {
|
|
127
|
-
|
|
134
|
+
var completeEvent = eventData;
|
|
135
|
+
if (completeEvent.brainRunId === mainBrainRunIdRef.current) {
|
|
136
|
+
setIsCompleted(true);
|
|
137
|
+
}
|
|
128
138
|
}
|
|
129
139
|
if (eventData.type === BRAIN_EVENTS.ERROR) {
|
|
130
|
-
|
|
140
|
+
var errorEvent = eventData;
|
|
141
|
+
// Only show error for the main brain
|
|
142
|
+
if (errorEvent.brainRunId === mainBrainRunIdRef.current) {
|
|
143
|
+
setBrainError(errorEvent);
|
|
144
|
+
}
|
|
131
145
|
}
|
|
132
146
|
} catch (e) {
|
|
133
147
|
setError(new Error("Error parsing event data: ".concat(e.message)));
|
|
@@ -147,12 +161,11 @@ export var Watch = function(param) {
|
|
|
147
161
|
}, [
|
|
148
162
|
runId
|
|
149
163
|
]);
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
}
|
|
164
|
+
// Maintain consistent Box wrapper to help Ink properly calculate
|
|
165
|
+
// terminal clearing between renders (prevents appending instead of overwriting)
|
|
153
166
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
154
167
|
flexDirection: "column"
|
|
155
|
-
}, /*#__PURE__*/ React.createElement(WatchStatus, {
|
|
168
|
+
}, !isConnected && steps.length === 0 ? /*#__PURE__*/ React.createElement(Text, null, "Connecting to watch service...") : /*#__PURE__*/ React.createElement(React.Fragment, null, /*#__PURE__*/ React.createElement(WatchStatus, {
|
|
156
169
|
steps: steps,
|
|
157
170
|
brainTitle: brainTitle,
|
|
158
171
|
runId: runId
|
|
@@ -181,5 +194,5 @@ export var Watch = function(param) {
|
|
|
181
194
|
color: "red"
|
|
182
195
|
}, brainError.error.message), /*#__PURE__*/ React.createElement(Text, {
|
|
183
196
|
color: "red"
|
|
184
|
-
}, brainError.error.stack)));
|
|
197
|
+
}, brainError.error.stack))));
|
|
185
198
|
};
|
package/dist/types/cli.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAK5D,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,KAAK,GAAG,CAAC;CAC9C;AAoBD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,UAAU,
|
|
1
|
+
{"version":3,"file":"cli.d.ts","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAQ1B,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AAK5D,MAAM,WAAW,UAAU;IACzB,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,MAAM,CAAC,EAAE,mBAAmB,CAAC;IAC7B,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,MAAM,EAAE,CAAC,OAAO,EAAE,KAAK,CAAC,YAAY,KAAK,GAAG,CAAC;CAC9C;AAoBD,wBAAgB,QAAQ,CAAC,OAAO,EAAE,UAAU,4BAkkC3C"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/commands/server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,EAAE,mBAAmB,EAAgB,MAAM,kBAAkB,CAAC;AAE1E,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,mBAAmB;IAEzC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC;
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../../../src/commands/server.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,EAAE,mBAAmB,EAAgB,MAAM,kBAAkB,CAAC;AAE1E,qBAAa,aAAa;IACZ,OAAO,CAAC,MAAM;gBAAN,MAAM,EAAE,mBAAmB;IAEzC,MAAM,CAAC,IAAI,EAAE,kBAAkB,CAAC,GAAG,CAAC;YAwP5B,cAAc;IA4C5B,OAAO,CAAC,cAAc;IAUtB,OAAO,CAAC,gBAAgB;YAUV,UAAU;CAiDzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain-rerun.d.ts","sourceRoot":"","sources":["../../../src/components/brain-rerun.tsx"],"names":[],"mappings":"AAKA,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD,eAAO,MAAM,UAAU,GAAI,6CAA6C,eAAe,
|
|
1
|
+
{"version":3,"file":"brain-rerun.d.ts","sourceRoot":"","sources":["../../../src/components/brain-rerun.tsx"],"names":[],"mappings":"AAKA,UAAU,eAAe;IACvB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAMD,eAAO,MAAM,UAAU,GAAI,6CAA6C,eAAe,4CAoFtF,CAAC"}
|
|
@@ -3,6 +3,6 @@ interface BrainRunProps {
|
|
|
3
3
|
watch?: boolean;
|
|
4
4
|
options?: Record<string, string>;
|
|
5
5
|
}
|
|
6
|
-
export declare const BrainRun: ({ identifier, watch, options }: BrainRunProps) => import("react/jsx-runtime").JSX.Element
|
|
6
|
+
export declare const BrainRun: ({ identifier, watch, options }: BrainRunProps) => import("react/jsx-runtime").JSX.Element;
|
|
7
7
|
export {};
|
|
8
8
|
//# sourceMappingURL=brain-run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain-run.d.ts","sourceRoot":"","sources":["../../../src/components/brain-run.tsx"],"names":[],"mappings":"AAgBA,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAID,eAAO,MAAM,QAAQ,GAAI,gCAAgC,aAAa,
|
|
1
|
+
{"version":3,"file":"brain-run.d.ts","sourceRoot":"","sources":["../../../src/components/brain-run.tsx"],"names":[],"mappings":"AAgBA,UAAU,aAAa;IACrB,UAAU,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AAID,eAAO,MAAM,QAAQ,GAAI,gCAAgC,aAAa,4CAgLrE,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain-watch.d.ts","sourceRoot":"","sources":["../../../src/components/brain-watch.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"brain-watch.d.ts","sourceRoot":"","sources":["../../../src/components/brain-watch.tsx"],"names":[],"mappings":"AAuHA,UAAU,2BAA2B;IACnC,UAAU,EAAE,MAAM,CAAC;CACpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,sBAAsB,GAAI,gBAAgB,2BAA2B,4CAMjF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"resource-sync.d.ts","sourceRoot":"","sources":["../../../src/components/resource-sync.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,UAAU,iBAAiB;IACzB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,GAAI,kCAG1B,iBAAiB,
|
|
1
|
+
{"version":3,"file":"resource-sync.d.ts","sourceRoot":"","sources":["../../../src/components/resource-sync.tsx"],"names":[],"mappings":"AAKA,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAajD,UAAU,iBAAiB;IACzB,cAAc,EAAE,aAAa,EAAE,CAAC;IAChC,YAAY,EAAE,MAAM,GAAG,IAAI,CAAC;CAC7B;AAED,eAAO,MAAM,YAAY,GAAI,kCAG1B,iBAAiB,4CA6InB,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/components/watch.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"watch.d.ts","sourceRoot":"","sources":["../../../src/components/watch.tsx"],"names":[],"mappings":"AAiEA,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,KAAK,GAAI,WAAW,UAAU,4CA+G1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positronic/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.42",
|
|
4
4
|
"publishConfig": {
|
|
5
5
|
"access": "public"
|
|
6
6
|
},
|
|
@@ -23,9 +23,9 @@
|
|
|
23
23
|
"clean": "rm -rf tsconfig.tsbuildinfo dist node_modules"
|
|
24
24
|
},
|
|
25
25
|
"dependencies": {
|
|
26
|
-
"@positronic/core": "^0.0.
|
|
27
|
-
"@positronic/spec": "^0.0.
|
|
28
|
-
"@positronic/template-new-project": "^0.0.
|
|
26
|
+
"@positronic/core": "^0.0.42",
|
|
27
|
+
"@positronic/spec": "^0.0.42",
|
|
28
|
+
"@positronic/template-new-project": "^0.0.42",
|
|
29
29
|
"caz": "^2.0.0",
|
|
30
30
|
"chokidar": "^3.6.0",
|
|
31
31
|
"dotenv": "^16.4.7",
|