@positronic/cli 0.0.32 → 0.0.34
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 +9 -9
- package/dist/src/commands/brain.js +53 -19
- package/dist/src/commands/helpers.js +11 -0
- package/dist/src/components/brain-history.js +7 -6
- package/dist/src/components/run-show.js +205 -0
- package/dist/src/components/watch.js +7 -6
- package/dist/types/cli.d.ts.map +1 -1
- package/dist/types/commands/brain.d.ts +2 -2
- package/dist/types/commands/brain.d.ts.map +1 -1
- package/dist/types/commands/helpers.d.ts +5 -0
- package/dist/types/commands/helpers.d.ts.map +1 -1
- package/dist/types/components/brain-history.d.ts.map +1 -1
- package/dist/types/components/run-show.d.ts +6 -0
- package/dist/types/components/run-show.d.ts.map +1 -0
- package/dist/types/components/watch.d.ts +1 -2
- package/dist/types/components/watch.d.ts.map +1 -1
- package/package.json +4 -4
- package/dist/src/components/brain-show.js +0 -65
- package/dist/types/components/brain-show.d.ts +0 -6
- package/dist/types/components/brain-show.d.ts.map +0 -1
package/dist/src/cli.js
CHANGED
|
@@ -377,13 +377,13 @@ export function buildCli(options) {
|
|
|
377
377
|
var element = brainCommand.history(argv);
|
|
378
378
|
render(element);
|
|
379
379
|
});
|
|
380
|
-
// --- Show
|
|
381
|
-
cli = cli.command('show <
|
|
382
|
-
return yargsShow.positional('
|
|
383
|
-
describe: '
|
|
380
|
+
// --- Show Run Command ---
|
|
381
|
+
cli = cli.command('show <run-id>', 'Show detailed information about a brain run, including any errors\n', function(yargsShow) {
|
|
382
|
+
return yargsShow.positional('run-id', {
|
|
383
|
+
describe: 'ID of the brain run to show',
|
|
384
384
|
type: 'string',
|
|
385
385
|
demandOption: true
|
|
386
|
-
});
|
|
386
|
+
}).example('$0 show abc123', 'Show details for brain run abc123');
|
|
387
387
|
}, function(argv) {
|
|
388
388
|
var element = brainCommand.show(argv);
|
|
389
389
|
render(element);
|
|
@@ -503,12 +503,12 @@ export function buildCli(options) {
|
|
|
503
503
|
}, function(argv) {
|
|
504
504
|
var element = brainCommand.history(argv);
|
|
505
505
|
render(element);
|
|
506
|
-
}).command('show <
|
|
507
|
-
return yargsShow.positional('
|
|
508
|
-
describe: '
|
|
506
|
+
}).command('show <run-id>', 'Show detailed information about a brain run, including any errors\n', function(yargsShow) {
|
|
507
|
+
return yargsShow.positional('run-id', {
|
|
508
|
+
describe: 'ID of the brain run to show',
|
|
509
509
|
type: 'string',
|
|
510
510
|
demandOption: true
|
|
511
|
-
});
|
|
511
|
+
}).example('$0 brain show abc123', 'Show details for brain run abc123');
|
|
512
512
|
}, function(argv) {
|
|
513
513
|
var element = brainCommand.show(argv);
|
|
514
514
|
render(element);
|
|
@@ -46,6 +46,34 @@ function _create_class(Constructor, protoProps, staticProps) {
|
|
|
46
46
|
if (staticProps) _defineProperties(Constructor, staticProps);
|
|
47
47
|
return Constructor;
|
|
48
48
|
}
|
|
49
|
+
function _define_property(obj, key, value) {
|
|
50
|
+
if (key in obj) {
|
|
51
|
+
Object.defineProperty(obj, key, {
|
|
52
|
+
value: value,
|
|
53
|
+
enumerable: true,
|
|
54
|
+
configurable: true,
|
|
55
|
+
writable: true
|
|
56
|
+
});
|
|
57
|
+
} else {
|
|
58
|
+
obj[key] = value;
|
|
59
|
+
}
|
|
60
|
+
return obj;
|
|
61
|
+
}
|
|
62
|
+
function _object_spread(target) {
|
|
63
|
+
for(var i = 1; i < arguments.length; i++){
|
|
64
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
|
65
|
+
var ownKeys = Object.keys(source);
|
|
66
|
+
if (typeof Object.getOwnPropertySymbols === "function") {
|
|
67
|
+
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
|
68
|
+
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
|
69
|
+
}));
|
|
70
|
+
}
|
|
71
|
+
ownKeys.forEach(function(key) {
|
|
72
|
+
_define_property(target, key, source[key]);
|
|
73
|
+
});
|
|
74
|
+
}
|
|
75
|
+
return target;
|
|
76
|
+
}
|
|
49
77
|
function _ts_generator(thisArg, body) {
|
|
50
78
|
var f, y, t, _ = {
|
|
51
79
|
label: 0,
|
|
@@ -137,13 +165,13 @@ function _ts_generator(thisArg, body) {
|
|
|
137
165
|
};
|
|
138
166
|
}
|
|
139
167
|
}
|
|
140
|
-
import { apiClient } from './helpers.js';
|
|
168
|
+
import { apiClient, isApiLocalDevMode } from './helpers.js';
|
|
141
169
|
import React from 'react';
|
|
142
170
|
import { Text } from 'ink';
|
|
143
171
|
import { Watch } from '../components/watch.js';
|
|
144
172
|
import { BrainList } from '../components/brain-list.js';
|
|
145
173
|
import { BrainHistory } from '../components/brain-history.js';
|
|
146
|
-
import {
|
|
174
|
+
import { RunShow } from '../components/run-show.js';
|
|
147
175
|
import { BrainRerun } from '../components/brain-rerun.js';
|
|
148
176
|
import { BrainKill } from '../components/brain-kill.js';
|
|
149
177
|
import { ErrorComponent } from '../components/error.js';
|
|
@@ -172,9 +200,9 @@ export var BrainCommand = /*#__PURE__*/ function() {
|
|
|
172
200
|
{
|
|
173
201
|
key: "show",
|
|
174
202
|
value: function show(param) {
|
|
175
|
-
var
|
|
176
|
-
return React.createElement(
|
|
177
|
-
|
|
203
|
+
var runId = param.runId;
|
|
204
|
+
return React.createElement(RunShow, {
|
|
205
|
+
runId: runId
|
|
178
206
|
});
|
|
179
207
|
}
|
|
180
208
|
},
|
|
@@ -288,8 +316,13 @@ export var BrainCommand = /*#__PURE__*/ function() {
|
|
|
288
316
|
];
|
|
289
317
|
case 8:
|
|
290
318
|
error = _state.sent();
|
|
291
|
-
|
|
292
|
-
|
|
319
|
+
if (isApiLocalDevMode()) {
|
|
320
|
+
console.error("Error connecting to the local development server.");
|
|
321
|
+
console.error("Please ensure the server is running ('positronic server' or 'px s').");
|
|
322
|
+
} else {
|
|
323
|
+
console.error("Error connecting to the remote project server.");
|
|
324
|
+
console.error('Please check your network connection and verify the project URL is correct.');
|
|
325
|
+
}
|
|
293
326
|
if (error.code === 'ECONNREFUSED') {
|
|
294
327
|
console.error('Reason: Connection refused. The server might not be running or is listening on a different port.');
|
|
295
328
|
} else {
|
|
@@ -313,19 +346,17 @@ export var BrainCommand = /*#__PURE__*/ function() {
|
|
|
313
346
|
key: "watch",
|
|
314
347
|
value: function watch(_0) {
|
|
315
348
|
return _async_to_generator(function(param) {
|
|
316
|
-
var runId, filename,
|
|
349
|
+
var runId, filename, apiPath, response, result, activeRun, errorText, error, connectionError;
|
|
317
350
|
return _ts_generator(this, function(_state) {
|
|
318
351
|
switch(_state.label){
|
|
319
352
|
case 0:
|
|
320
353
|
runId = param.runId, filename = param.filename;
|
|
321
354
|
// If a specific run ID is provided, return the Watch component
|
|
322
355
|
if (runId) {
|
|
323
|
-
port = process.env.POSITRONIC_PORT || '8787';
|
|
324
356
|
return [
|
|
325
357
|
2,
|
|
326
358
|
React.createElement(Watch, {
|
|
327
|
-
runId: runId
|
|
328
|
-
port: port
|
|
359
|
+
runId: runId
|
|
329
360
|
})
|
|
330
361
|
];
|
|
331
362
|
}
|
|
@@ -388,12 +419,10 @@ export var BrainCommand = /*#__PURE__*/ function() {
|
|
|
388
419
|
}
|
|
389
420
|
// Exactly one active run found - watch it
|
|
390
421
|
activeRun = result.runs[0];
|
|
391
|
-
port1 = process.env.POSITRONIC_PORT || '8787';
|
|
392
422
|
return [
|
|
393
423
|
2,
|
|
394
424
|
React.createElement(Watch, {
|
|
395
|
-
runId: activeRun.brainRunId
|
|
396
|
-
port: port1
|
|
425
|
+
runId: activeRun.brainRunId
|
|
397
426
|
})
|
|
398
427
|
];
|
|
399
428
|
case 4:
|
|
@@ -420,14 +449,19 @@ export var BrainCommand = /*#__PURE__*/ function() {
|
|
|
420
449
|
];
|
|
421
450
|
case 7:
|
|
422
451
|
error = _state.sent();
|
|
452
|
+
connectionError = isApiLocalDevMode() ? {
|
|
453
|
+
message: 'Error connecting to the local development server.',
|
|
454
|
+
details: "Please ensure the server is running ('positronic server' or 'px s').\n\nError details: ".concat(error.message)
|
|
455
|
+
} : {
|
|
456
|
+
message: 'Error connecting to the remote project server.',
|
|
457
|
+
details: "Please check your network connection and verify the project URL is correct.\n\nError details: ".concat(error.message)
|
|
458
|
+
};
|
|
423
459
|
return [
|
|
424
460
|
2,
|
|
425
461
|
React.createElement(ErrorComponent, {
|
|
426
|
-
error: {
|
|
427
|
-
title: 'Connection Error'
|
|
428
|
-
|
|
429
|
-
details: "Please ensure the server is running ('positronic server' or 'px s').\n\nError details: ".concat(error.message)
|
|
430
|
-
}
|
|
462
|
+
error: _object_spread({
|
|
463
|
+
title: 'Connection Error'
|
|
464
|
+
}, connectionError)
|
|
431
465
|
})
|
|
432
466
|
];
|
|
433
467
|
case 8:
|
|
@@ -244,6 +244,17 @@ var isLocalDevMode = true;
|
|
|
244
244
|
*/ export function isApiLocalDevMode() {
|
|
245
245
|
return isLocalDevMode;
|
|
246
246
|
}
|
|
247
|
+
/**
|
|
248
|
+
* Get the configured API base URL.
|
|
249
|
+
* Returns the configured URL if set, otherwise falls back to localhost.
|
|
250
|
+
*/ export function getApiBaseUrl() {
|
|
251
|
+
if (apiBaseUrl) {
|
|
252
|
+
return apiBaseUrl;
|
|
253
|
+
}
|
|
254
|
+
// Fallback to localhost (for backwards compatibility and testing)
|
|
255
|
+
var port = process.env.POSITRONIC_PORT || '8787';
|
|
256
|
+
return "http://localhost:".concat(port);
|
|
257
|
+
}
|
|
247
258
|
// Singleton API client instance
|
|
248
259
|
export var apiClient = {
|
|
249
260
|
fetch: function(apiPath, options) {
|
|
@@ -2,6 +2,7 @@ import React from 'react';
|
|
|
2
2
|
import { Text, Box } from 'ink';
|
|
3
3
|
import { useApiGet } from '../hooks/useApi.js';
|
|
4
4
|
import { ErrorComponent } from './error.js';
|
|
5
|
+
import { STATUS } from '@positronic/core';
|
|
5
6
|
// Helper to format dates
|
|
6
7
|
var formatDate = function(timestamp) {
|
|
7
8
|
var date = new Date(timestamp);
|
|
@@ -39,11 +40,11 @@ var formatDuration = function(startMs, endMs) {
|
|
|
39
40
|
// Helper to get status color
|
|
40
41
|
var getStatusColor = function(status) {
|
|
41
42
|
switch(status){
|
|
42
|
-
case
|
|
43
|
+
case STATUS.COMPLETE:
|
|
43
44
|
return 'green';
|
|
44
|
-
case
|
|
45
|
+
case STATUS.ERROR:
|
|
45
46
|
return 'red';
|
|
46
|
-
case
|
|
47
|
+
case STATUS.RUNNING:
|
|
47
48
|
return 'yellow';
|
|
48
49
|
default:
|
|
49
50
|
return 'gray';
|
|
@@ -136,7 +137,7 @@ export var BrainHistory = function(param) {
|
|
|
136
137
|
}, padRight(columns.startedAt.header, columns.startedAt.width))), /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Text, {
|
|
137
138
|
dimColor: true
|
|
138
139
|
}, '─'.repeat(112))), data.runs.map(function(run) {
|
|
139
|
-
var duration = run.startedAt && run.completedAt ? formatDuration(run.startedAt, run.completedAt) : run.status ===
|
|
140
|
+
var duration = run.startedAt && run.completedAt ? formatDuration(run.startedAt, run.completedAt) : run.status === STATUS.RUNNING ? 'Running...' : 'N/A';
|
|
140
141
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
141
142
|
key: run.brainRunId
|
|
142
143
|
}, /*#__PURE__*/ React.createElement(Text, null, padRight(truncate(run.brainRunId, columns.runId.width), columns.runId.width)), /*#__PURE__*/ React.createElement(Text, null, " "), /*#__PURE__*/ React.createElement(Text, {
|
|
@@ -147,7 +148,7 @@ export var BrainHistory = function(param) {
|
|
|
147
148
|
dimColor: true
|
|
148
149
|
}, padRight(run.startedAt ? formatDate(run.startedAt) : 'N/A', columns.startedAt.width)));
|
|
149
150
|
}), data.runs.filter(function(r) {
|
|
150
|
-
return r.status ===
|
|
151
|
+
return r.status === STATUS.ERROR && r.error;
|
|
151
152
|
}).length > 0 && /*#__PURE__*/ React.createElement(Box, {
|
|
152
153
|
flexDirection: "column",
|
|
153
154
|
marginTop: 1
|
|
@@ -155,7 +156,7 @@ export var BrainHistory = function(param) {
|
|
|
155
156
|
bold: true,
|
|
156
157
|
color: "red"
|
|
157
158
|
}, "Errors:"), data.runs.filter(function(r) {
|
|
158
|
-
return r.status ===
|
|
159
|
+
return r.status === STATUS.ERROR && r.error;
|
|
159
160
|
}).map(function(run) {
|
|
160
161
|
return /*#__PURE__*/ React.createElement(Box, {
|
|
161
162
|
key: run.brainRunId,
|
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
function _array_like_to_array(arr, len) {
|
|
2
|
+
if (len == null || len > arr.length) len = arr.length;
|
|
3
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
|
4
|
+
return arr2;
|
|
5
|
+
}
|
|
6
|
+
function _array_with_holes(arr) {
|
|
7
|
+
if (Array.isArray(arr)) return arr;
|
|
8
|
+
}
|
|
9
|
+
function _iterable_to_array_limit(arr, i) {
|
|
10
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
|
11
|
+
if (_i == null) return;
|
|
12
|
+
var _arr = [];
|
|
13
|
+
var _n = true;
|
|
14
|
+
var _d = false;
|
|
15
|
+
var _s, _e;
|
|
16
|
+
try {
|
|
17
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
|
18
|
+
_arr.push(_s.value);
|
|
19
|
+
if (i && _arr.length === i) break;
|
|
20
|
+
}
|
|
21
|
+
} catch (err) {
|
|
22
|
+
_d = true;
|
|
23
|
+
_e = err;
|
|
24
|
+
} finally{
|
|
25
|
+
try {
|
|
26
|
+
if (!_n && _i["return"] != null) _i["return"]();
|
|
27
|
+
} finally{
|
|
28
|
+
if (_d) throw _e;
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
return _arr;
|
|
32
|
+
}
|
|
33
|
+
function _non_iterable_rest() {
|
|
34
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
|
35
|
+
}
|
|
36
|
+
function _sliced_to_array(arr, i) {
|
|
37
|
+
return _array_with_holes(arr) || _iterable_to_array_limit(arr, i) || _unsupported_iterable_to_array(arr, i) || _non_iterable_rest();
|
|
38
|
+
}
|
|
39
|
+
function _unsupported_iterable_to_array(o, minLen) {
|
|
40
|
+
if (!o) return;
|
|
41
|
+
if (typeof o === "string") return _array_like_to_array(o, minLen);
|
|
42
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
|
43
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
|
44
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
|
45
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _array_like_to_array(o, minLen);
|
|
46
|
+
}
|
|
47
|
+
import React from 'react';
|
|
48
|
+
import { Text, Box } from 'ink';
|
|
49
|
+
import { useApiGet } from '../hooks/useApi.js';
|
|
50
|
+
import { ErrorComponent } from './error.js';
|
|
51
|
+
import { STATUS } from '@positronic/core';
|
|
52
|
+
// Helper to format dates
|
|
53
|
+
var formatDate = function(timestamp) {
|
|
54
|
+
var date = new Date(timestamp);
|
|
55
|
+
return date.toLocaleDateString() + ' ' + date.toLocaleTimeString();
|
|
56
|
+
};
|
|
57
|
+
// Helper to format duration
|
|
58
|
+
var formatDuration = function(startMs, endMs) {
|
|
59
|
+
var durationMs = endMs - startMs;
|
|
60
|
+
var seconds = Math.floor(durationMs / 1000);
|
|
61
|
+
var minutes = Math.floor(seconds / 60);
|
|
62
|
+
var hours = Math.floor(minutes / 60);
|
|
63
|
+
if (hours > 0) {
|
|
64
|
+
var remainingMinutes = minutes % 60;
|
|
65
|
+
return "".concat(hours, "h ").concat(remainingMinutes, "m");
|
|
66
|
+
} else if (minutes > 0) {
|
|
67
|
+
var remainingSeconds = seconds % 60;
|
|
68
|
+
return "".concat(minutes, "m ").concat(remainingSeconds, "s");
|
|
69
|
+
} else {
|
|
70
|
+
return "".concat(seconds, "s");
|
|
71
|
+
}
|
|
72
|
+
};
|
|
73
|
+
// Helper to get status color
|
|
74
|
+
var getStatusColor = function(status) {
|
|
75
|
+
switch(status){
|
|
76
|
+
case STATUS.COMPLETE:
|
|
77
|
+
return 'green';
|
|
78
|
+
case STATUS.ERROR:
|
|
79
|
+
return 'red';
|
|
80
|
+
case STATUS.RUNNING:
|
|
81
|
+
return 'yellow';
|
|
82
|
+
case STATUS.CANCELLED:
|
|
83
|
+
return 'gray';
|
|
84
|
+
default:
|
|
85
|
+
return 'white';
|
|
86
|
+
}
|
|
87
|
+
};
|
|
88
|
+
// Component to display a labeled field
|
|
89
|
+
var Field = function(param) {
|
|
90
|
+
var label = param.label, children = param.children;
|
|
91
|
+
return /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Box, {
|
|
92
|
+
width: 14
|
|
93
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
94
|
+
dimColor: true
|
|
95
|
+
}, label, ":")), /*#__PURE__*/ React.createElement(Box, {
|
|
96
|
+
flexGrow: 1
|
|
97
|
+
}, children));
|
|
98
|
+
};
|
|
99
|
+
export var RunShow = function(param) {
|
|
100
|
+
var runId = param.runId;
|
|
101
|
+
var _useApiGet = useApiGet("/brains/runs/".concat(encodeURIComponent(runId))), data = _useApiGet.data, loading = _useApiGet.loading, error = _useApiGet.error;
|
|
102
|
+
if (loading) {
|
|
103
|
+
return /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Text, null, "Loading run details..."));
|
|
104
|
+
}
|
|
105
|
+
if (error) {
|
|
106
|
+
return /*#__PURE__*/ React.createElement(ErrorComponent, {
|
|
107
|
+
error: error
|
|
108
|
+
});
|
|
109
|
+
}
|
|
110
|
+
if (!data) {
|
|
111
|
+
return /*#__PURE__*/ React.createElement(Box, {
|
|
112
|
+
flexDirection: "column"
|
|
113
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
114
|
+
color: "red"
|
|
115
|
+
}, "Run '", runId, "' not found"));
|
|
116
|
+
}
|
|
117
|
+
var duration = data.startedAt && data.completedAt ? formatDuration(data.startedAt, data.completedAt) : data.status === STATUS.RUNNING ? 'Running...' : 'N/A';
|
|
118
|
+
return /*#__PURE__*/ React.createElement(Box, {
|
|
119
|
+
flexDirection: "column",
|
|
120
|
+
gap: 1
|
|
121
|
+
}, /*#__PURE__*/ React.createElement(Box, {
|
|
122
|
+
flexDirection: "column"
|
|
123
|
+
}, /*#__PURE__*/ React.createElement(Field, {
|
|
124
|
+
label: "Run ID"
|
|
125
|
+
}, /*#__PURE__*/ React.createElement(Text, null, data.brainRunId)), /*#__PURE__*/ React.createElement(Field, {
|
|
126
|
+
label: "Brain"
|
|
127
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
128
|
+
bold: true
|
|
129
|
+
}, data.brainTitle)), data.brainDescription && /*#__PURE__*/ React.createElement(Field, {
|
|
130
|
+
label: "Description"
|
|
131
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
132
|
+
dimColor: true
|
|
133
|
+
}, data.brainDescription)), /*#__PURE__*/ React.createElement(Field, {
|
|
134
|
+
label: "Status"
|
|
135
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
136
|
+
color: getStatusColor(data.status),
|
|
137
|
+
bold: true
|
|
138
|
+
}, data.status)), /*#__PURE__*/ React.createElement(Field, {
|
|
139
|
+
label: "Type"
|
|
140
|
+
}, /*#__PURE__*/ React.createElement(Text, null, data.type))), /*#__PURE__*/ React.createElement(Box, {
|
|
141
|
+
flexDirection: "column"
|
|
142
|
+
}, /*#__PURE__*/ React.createElement(Field, {
|
|
143
|
+
label: "Created"
|
|
144
|
+
}, /*#__PURE__*/ React.createElement(Text, null, formatDate(data.createdAt))), data.startedAt && /*#__PURE__*/ React.createElement(Field, {
|
|
145
|
+
label: "Started"
|
|
146
|
+
}, /*#__PURE__*/ React.createElement(Text, null, formatDate(data.startedAt))), data.completedAt && /*#__PURE__*/ React.createElement(Field, {
|
|
147
|
+
label: "Completed"
|
|
148
|
+
}, /*#__PURE__*/ React.createElement(Text, null, formatDate(data.completedAt))), /*#__PURE__*/ React.createElement(Field, {
|
|
149
|
+
label: "Duration"
|
|
150
|
+
}, /*#__PURE__*/ React.createElement(Text, null, duration))), data.options && Object.keys(data.options).length > 0 && /*#__PURE__*/ React.createElement(Box, {
|
|
151
|
+
flexDirection: "column"
|
|
152
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
153
|
+
bold: true
|
|
154
|
+
}, "Options:"), /*#__PURE__*/ React.createElement(Box, {
|
|
155
|
+
marginLeft: 2,
|
|
156
|
+
flexDirection: "column"
|
|
157
|
+
}, Object.entries(data.options).map(function(param) {
|
|
158
|
+
var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
|
|
159
|
+
return /*#__PURE__*/ React.createElement(Text, {
|
|
160
|
+
key: key
|
|
161
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
162
|
+
dimColor: true
|
|
163
|
+
}, key, ":"), " ", String(value));
|
|
164
|
+
}))), data.status === STATUS.ERROR && data.error && /*#__PURE__*/ React.createElement(Box, {
|
|
165
|
+
flexDirection: "column",
|
|
166
|
+
marginTop: 1
|
|
167
|
+
}, /*#__PURE__*/ React.createElement(Box, {
|
|
168
|
+
borderStyle: "round",
|
|
169
|
+
borderColor: "red",
|
|
170
|
+
flexDirection: "column",
|
|
171
|
+
paddingX: 1
|
|
172
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
173
|
+
bold: true,
|
|
174
|
+
color: "red"
|
|
175
|
+
}, "Error Details"), /*#__PURE__*/ React.createElement(Box, {
|
|
176
|
+
marginTop: 1,
|
|
177
|
+
flexDirection: "column"
|
|
178
|
+
}, /*#__PURE__*/ React.createElement(Field, {
|
|
179
|
+
label: "Type"
|
|
180
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
181
|
+
color: "red"
|
|
182
|
+
}, data.error.name)), /*#__PURE__*/ React.createElement(Field, {
|
|
183
|
+
label: "Message"
|
|
184
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
185
|
+
color: "red"
|
|
186
|
+
}, data.error.message))), data.error.stack && /*#__PURE__*/ React.createElement(Box, {
|
|
187
|
+
marginTop: 1,
|
|
188
|
+
flexDirection: "column"
|
|
189
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
190
|
+
bold: true,
|
|
191
|
+
dimColor: true
|
|
192
|
+
}, "Stack Trace:"), /*#__PURE__*/ React.createElement(Box, {
|
|
193
|
+
marginLeft: 2
|
|
194
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
195
|
+
dimColor: true
|
|
196
|
+
}, data.error.stack))))), data.status === STATUS.COMPLETE && /*#__PURE__*/ React.createElement(Box, {
|
|
197
|
+
marginTop: 1
|
|
198
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
199
|
+
color: "green"
|
|
200
|
+
}, "Run completed successfully.")), data.status === STATUS.CANCELLED && /*#__PURE__*/ React.createElement(Box, {
|
|
201
|
+
marginTop: 1
|
|
202
|
+
}, /*#__PURE__*/ React.createElement(Text, {
|
|
203
|
+
color: "gray"
|
|
204
|
+
}, "Run was cancelled.")));
|
|
205
|
+
};
|
|
@@ -49,6 +49,7 @@ import { Text, Box } from 'ink';
|
|
|
49
49
|
import { EventSource } from 'eventsource';
|
|
50
50
|
import { BRAIN_EVENTS } from '@positronic/core';
|
|
51
51
|
import { STATUS } from '@positronic/core';
|
|
52
|
+
import { getApiBaseUrl, isApiLocalDevMode } from '../commands/helpers.js';
|
|
52
53
|
var getStatusIndicator = function(status) {
|
|
53
54
|
switch(status){
|
|
54
55
|
case STATUS.COMPLETE:
|
|
@@ -95,7 +96,7 @@ var WatchStatus = function(param) {
|
|
|
95
96
|
}));
|
|
96
97
|
};
|
|
97
98
|
export var Watch = function(param) {
|
|
98
|
-
var runId = param.runId
|
|
99
|
+
var runId = param.runId;
|
|
99
100
|
var _useState = _sliced_to_array(useState([]), 2), steps = _useState[0], setSteps = _useState[1];
|
|
100
101
|
var _useState1 = _sliced_to_array(useState(undefined), 2), brainTitle = _useState1[0], setBrainTitle = _useState1[1];
|
|
101
102
|
var _useState2 = _sliced_to_array(useState(undefined), 2), brainError = _useState2[0], setBrainError = _useState2[1];
|
|
@@ -103,7 +104,7 @@ export var Watch = function(param) {
|
|
|
103
104
|
var _useState4 = _sliced_to_array(useState(false), 2), isConnected = _useState4[0], setIsConnected = _useState4[1];
|
|
104
105
|
var _useState5 = _sliced_to_array(useState(false), 2), isCompleted = _useState5[0], setIsCompleted = _useState5[1];
|
|
105
106
|
useEffect(function() {
|
|
106
|
-
var baseUrl =
|
|
107
|
+
var baseUrl = getApiBaseUrl();
|
|
107
108
|
var url = "".concat(baseUrl, "/brains/runs/").concat(runId, "/watch");
|
|
108
109
|
var es = new EventSource(url);
|
|
109
110
|
setIsConnected(false);
|
|
@@ -134,17 +135,17 @@ export var Watch = function(param) {
|
|
|
134
135
|
};
|
|
135
136
|
es.onerror = function(err) {
|
|
136
137
|
// EventSource does not provide detailed error objects here, often just a generic Event
|
|
137
|
-
|
|
138
|
+
var errorMessage = isApiLocalDevMode() ? "Connection to ".concat(url, " failed. Ensure the local development server is running ('positronic server' or 'px s').") : "Connection to ".concat(url, " failed. Please check your network connection and verify the project URL is correct.");
|
|
139
|
+
setError(new Error(errorMessage));
|
|
138
140
|
setIsConnected(false);
|
|
139
141
|
es.close();
|
|
140
142
|
};
|
|
141
|
-
// Cleanup function to close EventSource when component unmounts or runId
|
|
143
|
+
// Cleanup function to close EventSource when component unmounts or runId changes
|
|
142
144
|
return function() {
|
|
143
145
|
es.close();
|
|
144
146
|
};
|
|
145
147
|
}, [
|
|
146
|
-
runId
|
|
147
|
-
port
|
|
148
|
+
runId
|
|
148
149
|
]);
|
|
149
150
|
if (!isConnected && steps.length === 0) {
|
|
150
151
|
return /*#__PURE__*/ React.createElement(Text, null, "Connecting to watch service...");
|
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,4BAyjC3C"}
|
|
@@ -7,7 +7,7 @@ interface BrainHistoryArgs {
|
|
|
7
7
|
limit: number;
|
|
8
8
|
}
|
|
9
9
|
interface BrainShowArgs {
|
|
10
|
-
|
|
10
|
+
runId: string;
|
|
11
11
|
}
|
|
12
12
|
interface BrainRerunArgs {
|
|
13
13
|
filename: string;
|
|
@@ -31,7 +31,7 @@ interface BrainKillArgs {
|
|
|
31
31
|
export declare class BrainCommand {
|
|
32
32
|
list(argv: ArgumentsCamelCase<BrainListArgs>): React.ReactElement;
|
|
33
33
|
history({ filename, limit, }: ArgumentsCamelCase<BrainHistoryArgs>): React.ReactElement;
|
|
34
|
-
show({
|
|
34
|
+
show({ runId, }: ArgumentsCamelCase<BrainShowArgs>): React.ReactElement;
|
|
35
35
|
rerun({ filename, runId, startsAt, stopsAfter, }: ArgumentsCamelCase<BrainRerunArgs>): React.ReactElement;
|
|
36
36
|
run({ filename, watch, options }: ArgumentsCamelCase<BrainRunArgs>): Promise<React.ReactElement>;
|
|
37
37
|
watch({ runId, filename, }: ArgumentsCamelCase<BrainWatchArgs>): Promise<React.ReactElement>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain.d.ts","sourceRoot":"","sources":["../../../src/commands/brain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,UAAU,aAAa;CAAG;AAC1B,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AACD,UAAU,aAAa;IACrB,
|
|
1
|
+
{"version":3,"file":"brain.d.ts","sourceRoot":"","sources":["../../../src/commands/brain.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,OAAO,CAAC;AAEhD,OAAO,KAAK,MAAM,OAAO,CAAC;AAU1B,UAAU,aAAa;CAAG;AAC1B,UAAU,gBAAgB;IACxB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,EAAE,MAAM,CAAC;CACf;AACD,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;CACf;AACD,UAAU,cAAc;IACtB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AACD,UAAU,YAAY;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,OAAO,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAClC;AACD,UAAU,cAAc;IACtB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AACD,UAAU,aAAa;IACrB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,OAAO,CAAC;CAChB;AAED,qBAAa,YAAY;IACvB,IAAI,CAAC,IAAI,EAAE,kBAAkB,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,YAAY;IAIjE,OAAO,CAAC,EACN,QAAQ,EACR,KAAK,GACN,EAAE,kBAAkB,CAAC,gBAAgB,CAAC,GAAG,KAAK,CAAC,YAAY;IAI5D,IAAI,CAAC,EACH,KAAK,GACN,EAAE,kBAAkB,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,YAAY;IAIzD,KAAK,CAAC,EACJ,QAAQ,EACR,KAAK,EACL,QAAQ,EACR,UAAU,GACX,EAAE,kBAAkB,CAAC,cAAc,CAAC,GAAG,KAAK,CAAC,YAAY;IASpD,GAAG,CAAC,EAAE,QAAQ,EAAE,KAAK,EAAE,OAAO,EAAE,EAAE,kBAAkB,CAAC,YAAY,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC;IAyEhG,KAAK,CAAC,EACV,KAAK,EACL,QAAQ,GACT,EAAE,kBAAkB,CAAC,cAAc,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,YAAY,CAAC;IAyFnE,IAAI,CAAC,EACH,KAAK,EACL,KAAK,GACN,EAAE,kBAAkB,CAAC,aAAa,CAAC,GAAG,KAAK,CAAC,YAAY;CAI1D"}
|
|
@@ -17,6 +17,11 @@ export declare function configureApiClient(baseUrl: string, localDevMode?: boole
|
|
|
17
17
|
* Get whether the API client is in local dev mode (for error message context)
|
|
18
18
|
*/
|
|
19
19
|
export declare function isApiLocalDevMode(): boolean;
|
|
20
|
+
/**
|
|
21
|
+
* Get the configured API base URL.
|
|
22
|
+
* Returns the configured URL if set, otherwise falls back to localhost.
|
|
23
|
+
*/
|
|
24
|
+
export declare function getApiBaseUrl(): string;
|
|
20
25
|
export declare const apiClient: {
|
|
21
26
|
fetch: (apiPath: string, options?: RequestInit) => Promise<Response>;
|
|
22
27
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/commands/helpers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQtD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;AAGhE,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC;AAMzC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,OAAc,GAAG,IAAI,CAGtF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAGD,eAAO,MAAM,SAAS;qBACG,MAAM,YAAY,WAAW,KAAG,OAAO,CAAC,QAAQ,CAAC;CAiBzE,CAAC;AAEF,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAiF5E;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,EAAE,CAsCxE;AAeD,UAAU,UAAU;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;IAC9C,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;CAC5B,KAAK,IAAI,CAAC;AAEX;;GAEG;AACH,wBAAsB,aAAa,CACjC,eAAe,EAAE,MAAM,EACvB,MAAM,GAAE,SAAqB,EAC7B,UAAU,CAAC,EAAE,oBAAoB,GAChC,OAAO,CAAC,UAAU,CAAC,CA+KrB;AAqKD;;GAEG;AACH,wBAAsB,aAAa,CACjC,eAAe,EAAE,MAAM,EACvB,MAAM,GAAE,SAAqB,mBAoB9B;AAsCD;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,CAAC,EAAE,MAAM,EACb,SAAS,SAAO,GACf,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,SAAqB,EAC7B,UAAU,CAAC,EAAE,gBAAgB,EAC7B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA2If"}
|
|
1
|
+
{"version":3,"file":"helpers.d.ts","sourceRoot":"","sources":["../../../src/commands/helpers.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,KAAK,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAQtD,MAAM,WAAW,YAAY;IAC3B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,MAAM,CAAC;IACd,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,MAAM,gBAAgB,GAAG,CAAC,QAAQ,EAAE,YAAY,KAAK,IAAI,CAAC;AAGhE,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC;AAMzC;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,YAAY,GAAE,OAAc,GAAG,IAAI,CAGtF;AAED;;GAEG;AACH,wBAAgB,iBAAiB,IAAI,OAAO,CAE3C;AAED;;;GAGG;AACH,wBAAgB,aAAa,IAAI,MAAM,CAOtC;AAGD,eAAO,MAAM,SAAS;qBACG,MAAM,YAAY,WAAW,KAAG,OAAO,CAAC,QAAQ,CAAC;CAiBzE,CAAC;AAEF,wBAAsB,eAAe,CAAC,WAAW,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,iBAiF5E;AAED,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,MAAM,GAAG,aAAa,EAAE,CAsCxE;AAeD,UAAU,UAAU;IAClB,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IACnB,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,KAAK,CAAC;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,OAAO,EAAE,MAAM,CAAA;KAAE,CAAC,CAAC;CAClD;AAED,MAAM,MAAM,oBAAoB,GAAG,CAAC,QAAQ,EAAE;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,UAAU,GAAG,WAAW,GAAG,UAAU,CAAC;IAC9C,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;CAC5B,KAAK,IAAI,CAAC;AAEX;;GAEG;AACH,wBAAsB,aAAa,CACjC,eAAe,EAAE,MAAM,EACvB,MAAM,GAAE,SAAqB,EAC7B,UAAU,CAAC,EAAE,oBAAoB,GAChC,OAAO,CAAC,UAAU,CAAC,CA+KrB;AAqKD;;GAEG;AACH,wBAAsB,aAAa,CACjC,eAAe,EAAE,MAAM,EACvB,MAAM,GAAE,SAAqB,mBAoB9B;AAsCD;;GAEG;AACH,wBAAsB,cAAc,CAClC,IAAI,CAAC,EAAE,MAAM,EACb,SAAS,SAAO,GACf,OAAO,CAAC,OAAO,CAAC,CAsBlB;AAED;;;;;;;;;;GAUG;AACH,wBAAsB,0BAA0B,CAC9C,QAAQ,EAAE,MAAM,EAChB,SAAS,EAAE,MAAM,EACjB,MAAM,GAAE,SAAqB,EAC7B,UAAU,CAAC,EAAE,gBAAgB,EAC7B,MAAM,CAAC,EAAE,WAAW,GACnB,OAAO,CAAC,IAAI,CAAC,CA2If"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"brain-history.d.ts","sourceRoot":"","sources":["../../../src/components/brain-history.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"brain-history.d.ts","sourceRoot":"","sources":["../../../src/components/brain-history.tsx"],"names":[],"mappings":"AAMA,UAAU,iBAAiB;IACzB,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAmFD,eAAO,MAAM,YAAY,GAAI,sBAAsB,iBAAiB,4CA0GnE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-show.d.ts","sourceRoot":"","sources":["../../../src/components/run-show.tsx"],"names":[],"mappings":"AAyBA,UAAU,YAAY;IACpB,KAAK,EAAE,MAAM,CAAC;CACf;AAsDD,eAAO,MAAM,OAAO,GAAI,WAAW,YAAY,4CAgI9C,CAAC"}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
interface WatchProps {
|
|
2
2
|
runId: string;
|
|
3
|
-
port: string;
|
|
4
3
|
}
|
|
5
|
-
export declare const Watch: ({ runId
|
|
4
|
+
export declare const Watch: ({ runId }: WatchProps) => import("react/jsx-runtime").JSX.Element;
|
|
6
5
|
export {};
|
|
7
6
|
//# sourceMappingURL=watch.d.ts.map
|
|
@@ -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":"AA8DA,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;CACf;AAED,eAAO,MAAM,KAAK,GAAI,WAAW,UAAU,4CA2F1C,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@positronic/cli",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.34",
|
|
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.34",
|
|
27
|
+
"@positronic/spec": "^0.0.34",
|
|
28
|
+
"@positronic/template-new-project": "^0.0.34",
|
|
29
29
|
"caz": "^2.0.0",
|
|
30
30
|
"chokidar": "^3.6.0",
|
|
31
31
|
"dotenv": "^16.4.7",
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import React from 'react';
|
|
2
|
-
import { Text, Box } from 'ink';
|
|
3
|
-
import { useApiGet } from '../hooks/useApi.js';
|
|
4
|
-
import { ErrorComponent } from './error.js';
|
|
5
|
-
var StepDisplay = function(param) {
|
|
6
|
-
var step = param.step, _param_indent = param.indent, indent = _param_indent === void 0 ? 0 : _param_indent;
|
|
7
|
-
var indentStr = ' '.repeat(indent);
|
|
8
|
-
if (step.type === 'step') {
|
|
9
|
-
return /*#__PURE__*/ React.createElement(Text, null, indentStr, "• ", step.title);
|
|
10
|
-
} else {
|
|
11
|
-
var _step_innerBrain;
|
|
12
|
-
// Nested brain
|
|
13
|
-
return /*#__PURE__*/ React.createElement(Box, {
|
|
14
|
-
flexDirection: "column"
|
|
15
|
-
}, /*#__PURE__*/ React.createElement(Text, null, indentStr, "▸ ", step.title, " ", /*#__PURE__*/ React.createElement(Text, {
|
|
16
|
-
dimColor: true
|
|
17
|
-
}, "(nested brain)")), (_step_innerBrain = step.innerBrain) === null || _step_innerBrain === void 0 ? void 0 : _step_innerBrain.steps.map(function(innerStep, idx) {
|
|
18
|
-
return /*#__PURE__*/ React.createElement(StepDisplay, {
|
|
19
|
-
key: idx,
|
|
20
|
-
step: innerStep,
|
|
21
|
-
indent: indent + 1
|
|
22
|
-
});
|
|
23
|
-
}));
|
|
24
|
-
}
|
|
25
|
-
};
|
|
26
|
-
export var BrainShow = function(param) {
|
|
27
|
-
var brainName = param.brainName;
|
|
28
|
-
var _useApiGet = useApiGet("/brains/".concat(encodeURIComponent(brainName))), data = _useApiGet.data, loading = _useApiGet.loading, error = _useApiGet.error;
|
|
29
|
-
if (loading) {
|
|
30
|
-
return /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Text, null, "\uD83E\uDDE0 Loading brain details..."));
|
|
31
|
-
}
|
|
32
|
-
if (error) {
|
|
33
|
-
return /*#__PURE__*/ React.createElement(ErrorComponent, {
|
|
34
|
-
error: error
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
if (!data) {
|
|
38
|
-
return /*#__PURE__*/ React.createElement(Box, {
|
|
39
|
-
flexDirection: "column"
|
|
40
|
-
}, /*#__PURE__*/ React.createElement(Text, {
|
|
41
|
-
color: "red"
|
|
42
|
-
}, "Brain '", brainName, "' not found"));
|
|
43
|
-
}
|
|
44
|
-
return /*#__PURE__*/ React.createElement(Box, {
|
|
45
|
-
flexDirection: "column",
|
|
46
|
-
gap: 1
|
|
47
|
-
}, /*#__PURE__*/ React.createElement(Text, {
|
|
48
|
-
bold: true,
|
|
49
|
-
underline: true
|
|
50
|
-
}, data.title), data.description && /*#__PURE__*/ React.createElement(Text, {
|
|
51
|
-
dimColor: true
|
|
52
|
-
}, data.description), /*#__PURE__*/ React.createElement(Box, {
|
|
53
|
-
flexDirection: "column"
|
|
54
|
-
}, /*#__PURE__*/ React.createElement(Text, {
|
|
55
|
-
bold: true
|
|
56
|
-
}, "Steps:"), /*#__PURE__*/ React.createElement(Box, {
|
|
57
|
-
flexDirection: "column",
|
|
58
|
-
marginLeft: 1
|
|
59
|
-
}, data.steps.map(function(step, idx) {
|
|
60
|
-
return /*#__PURE__*/ React.createElement(StepDisplay, {
|
|
61
|
-
key: idx,
|
|
62
|
-
step: step
|
|
63
|
-
});
|
|
64
|
-
}))));
|
|
65
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"brain-show.d.ts","sourceRoot":"","sources":["../../../src/components/brain-show.tsx"],"names":[],"mappings":"AAqBA,UAAU,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC;CACnB;AA0BD,eAAO,MAAM,SAAS,GAAI,eAAe,cAAc,4CAyCtD,CAAC"}
|