@positronic/cli 0.0.31 → 0.0.33

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 CHANGED
@@ -377,13 +377,13 @@ export function buildCli(options) {
377
377
  var element = brainCommand.history(argv);
378
378
  render(element);
379
379
  });
380
- // --- Show Brain Command ---
381
- cli = cli.command('show <filename>', 'List all steps and other details for the brain\n', function(yargsShow) {
382
- return yargsShow.positional('filename', {
383
- describe: 'Filename of the brain',
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 <filename>', 'List all steps and other details for the brain\n', function(yargsShow) {
507
- return yargsShow.positional('filename', {
508
- describe: 'Filename of the brain',
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 { BrainShow } from '../components/brain-show.js';
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 filename = param.filename;
176
- return React.createElement(BrainShow, {
177
- brainName: filename
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
- console.error("Error connecting to the local development server.");
292
- console.error("Please ensure the server is running ('positronic server' or 'px s').");
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, port, apiPath, response, result, activeRun, port1, errorText, error;
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
- message: 'Error connecting to the local development server.',
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) {
@@ -0,0 +1,204 @@
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
+ // Helper to format dates
52
+ var formatDate = function(timestamp) {
53
+ var date = new Date(timestamp);
54
+ return date.toLocaleDateString() + ' ' + date.toLocaleTimeString();
55
+ };
56
+ // Helper to format duration
57
+ var formatDuration = function(startMs, endMs) {
58
+ var durationMs = endMs - startMs;
59
+ var seconds = Math.floor(durationMs / 1000);
60
+ var minutes = Math.floor(seconds / 60);
61
+ var hours = Math.floor(minutes / 60);
62
+ if (hours > 0) {
63
+ var remainingMinutes = minutes % 60;
64
+ return "".concat(hours, "h ").concat(remainingMinutes, "m");
65
+ } else if (minutes > 0) {
66
+ var remainingSeconds = seconds % 60;
67
+ return "".concat(minutes, "m ").concat(remainingSeconds, "s");
68
+ } else {
69
+ return "".concat(seconds, "s");
70
+ }
71
+ };
72
+ // Helper to get status color
73
+ var getStatusColor = function(status) {
74
+ switch(status){
75
+ case 'COMPLETE':
76
+ return 'green';
77
+ case 'ERROR':
78
+ return 'red';
79
+ case 'RUNNING':
80
+ return 'yellow';
81
+ case 'CANCELLED':
82
+ return 'gray';
83
+ default:
84
+ return 'white';
85
+ }
86
+ };
87
+ // Component to display a labeled field
88
+ var Field = function(param) {
89
+ var label = param.label, children = param.children;
90
+ return /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Box, {
91
+ width: 14
92
+ }, /*#__PURE__*/ React.createElement(Text, {
93
+ dimColor: true
94
+ }, label, ":")), /*#__PURE__*/ React.createElement(Box, {
95
+ flexGrow: 1
96
+ }, children));
97
+ };
98
+ export var RunShow = function(param) {
99
+ var runId = param.runId;
100
+ var _useApiGet = useApiGet("/brains/runs/".concat(encodeURIComponent(runId))), data = _useApiGet.data, loading = _useApiGet.loading, error = _useApiGet.error;
101
+ if (loading) {
102
+ return /*#__PURE__*/ React.createElement(Box, null, /*#__PURE__*/ React.createElement(Text, null, "Loading run details..."));
103
+ }
104
+ if (error) {
105
+ return /*#__PURE__*/ React.createElement(ErrorComponent, {
106
+ error: error
107
+ });
108
+ }
109
+ if (!data) {
110
+ return /*#__PURE__*/ React.createElement(Box, {
111
+ flexDirection: "column"
112
+ }, /*#__PURE__*/ React.createElement(Text, {
113
+ color: "red"
114
+ }, "Run '", runId, "' not found"));
115
+ }
116
+ var duration = data.startedAt && data.completedAt ? formatDuration(data.startedAt, data.completedAt) : data.status === 'RUNNING' ? 'Running...' : 'N/A';
117
+ return /*#__PURE__*/ React.createElement(Box, {
118
+ flexDirection: "column",
119
+ gap: 1
120
+ }, /*#__PURE__*/ React.createElement(Box, {
121
+ flexDirection: "column"
122
+ }, /*#__PURE__*/ React.createElement(Field, {
123
+ label: "Run ID"
124
+ }, /*#__PURE__*/ React.createElement(Text, null, data.brainRunId)), /*#__PURE__*/ React.createElement(Field, {
125
+ label: "Brain"
126
+ }, /*#__PURE__*/ React.createElement(Text, {
127
+ bold: true
128
+ }, data.brainTitle)), data.brainDescription && /*#__PURE__*/ React.createElement(Field, {
129
+ label: "Description"
130
+ }, /*#__PURE__*/ React.createElement(Text, {
131
+ dimColor: true
132
+ }, data.brainDescription)), /*#__PURE__*/ React.createElement(Field, {
133
+ label: "Status"
134
+ }, /*#__PURE__*/ React.createElement(Text, {
135
+ color: getStatusColor(data.status),
136
+ bold: true
137
+ }, data.status)), /*#__PURE__*/ React.createElement(Field, {
138
+ label: "Type"
139
+ }, /*#__PURE__*/ React.createElement(Text, null, data.type))), /*#__PURE__*/ React.createElement(Box, {
140
+ flexDirection: "column"
141
+ }, /*#__PURE__*/ React.createElement(Field, {
142
+ label: "Created"
143
+ }, /*#__PURE__*/ React.createElement(Text, null, formatDate(data.createdAt))), data.startedAt && /*#__PURE__*/ React.createElement(Field, {
144
+ label: "Started"
145
+ }, /*#__PURE__*/ React.createElement(Text, null, formatDate(data.startedAt))), data.completedAt && /*#__PURE__*/ React.createElement(Field, {
146
+ label: "Completed"
147
+ }, /*#__PURE__*/ React.createElement(Text, null, formatDate(data.completedAt))), /*#__PURE__*/ React.createElement(Field, {
148
+ label: "Duration"
149
+ }, /*#__PURE__*/ React.createElement(Text, null, duration))), data.options && Object.keys(data.options).length > 0 && /*#__PURE__*/ React.createElement(Box, {
150
+ flexDirection: "column"
151
+ }, /*#__PURE__*/ React.createElement(Text, {
152
+ bold: true
153
+ }, "Options:"), /*#__PURE__*/ React.createElement(Box, {
154
+ marginLeft: 2,
155
+ flexDirection: "column"
156
+ }, Object.entries(data.options).map(function(param) {
157
+ var _param = _sliced_to_array(param, 2), key = _param[0], value = _param[1];
158
+ return /*#__PURE__*/ React.createElement(Text, {
159
+ key: key
160
+ }, /*#__PURE__*/ React.createElement(Text, {
161
+ dimColor: true
162
+ }, key, ":"), " ", String(value));
163
+ }))), data.status === 'ERROR' && data.error && /*#__PURE__*/ React.createElement(Box, {
164
+ flexDirection: "column",
165
+ marginTop: 1
166
+ }, /*#__PURE__*/ React.createElement(Box, {
167
+ borderStyle: "round",
168
+ borderColor: "red",
169
+ flexDirection: "column",
170
+ paddingX: 1
171
+ }, /*#__PURE__*/ React.createElement(Text, {
172
+ bold: true,
173
+ color: "red"
174
+ }, "Error Details"), /*#__PURE__*/ React.createElement(Box, {
175
+ marginTop: 1,
176
+ flexDirection: "column"
177
+ }, /*#__PURE__*/ React.createElement(Field, {
178
+ label: "Type"
179
+ }, /*#__PURE__*/ React.createElement(Text, {
180
+ color: "red"
181
+ }, data.error.name)), /*#__PURE__*/ React.createElement(Field, {
182
+ label: "Message"
183
+ }, /*#__PURE__*/ React.createElement(Text, {
184
+ color: "red"
185
+ }, data.error.message))), data.error.stack && /*#__PURE__*/ React.createElement(Box, {
186
+ marginTop: 1,
187
+ flexDirection: "column"
188
+ }, /*#__PURE__*/ React.createElement(Text, {
189
+ bold: true,
190
+ dimColor: true
191
+ }, "Stack Trace:"), /*#__PURE__*/ React.createElement(Box, {
192
+ marginLeft: 2
193
+ }, /*#__PURE__*/ React.createElement(Text, {
194
+ dimColor: true
195
+ }, data.error.stack))))), data.status === 'COMPLETE' && /*#__PURE__*/ React.createElement(Box, {
196
+ marginTop: 1
197
+ }, /*#__PURE__*/ React.createElement(Text, {
198
+ color: "green"
199
+ }, "Run completed successfully.")), data.status === 'CANCELLED' && /*#__PURE__*/ React.createElement(Box, {
200
+ marginTop: 1
201
+ }, /*#__PURE__*/ React.createElement(Text, {
202
+ color: "gray"
203
+ }, "Run was cancelled.")));
204
+ };
@@ -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, port = param.port;
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 = "http://localhost:".concat(port);
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
- setError(new Error("Connection to ".concat(url, " failed. Ensure the server is running and accessible.")));
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/port changes
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...");
@@ -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,4BAqjC3C"}
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
- filename: string;
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({ filename, }: ArgumentsCamelCase<BrainShowArgs>): React.ReactElement;
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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;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,kBAA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string;
3
+ }
4
+ export declare const RunShow: ({ runId }: RunShowProps) => import("react/jsx-runtime").JSX.Element;
5
+ export {};
6
+ //# sourceMappingURL=run-show.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-show.d.ts","sourceRoot":"","sources":["../../../src/components/run-show.tsx"],"names":[],"mappings":"AAwBA,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, port }: WatchProps) => import("react/jsx-runtime").JSX.Element;
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":"AA6DA,UAAU,UAAU;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,IAAI,EAAE,MAAM,CAAC;CACd;AAED,eAAO,MAAM,KAAK,GAAI,iBAAiB,UAAU,4CAwFhD,CAAC"}
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.31",
3
+ "version": "0.0.33",
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.31",
27
- "@positronic/spec": "^0.0.31",
28
- "@positronic/template-new-project": "^0.0.31",
26
+ "@positronic/core": "^0.0.33",
27
+ "@positronic/spec": "^0.0.33",
28
+ "@positronic/template-new-project": "^0.0.33",
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,6 +0,0 @@
1
- interface BrainShowProps {
2
- brainName: string;
3
- }
4
- export declare const BrainShow: ({ brainName }: BrainShowProps) => import("react/jsx-runtime").JSX.Element;
5
- export {};
6
- //# sourceMappingURL=brain-show.d.ts.map
@@ -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"}