@robosystems/core 0.13.2 → 0.13.4

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.
@@ -388,9 +388,12 @@ export function ConsoleContent({ config, variant = 'page', }) {
388
388
  : await clients.operator.executeQuery(graphId, request, options);
389
389
  // The user switched graphs while the operator ran: the reset already
390
390
  // cleared the console, so drop the answer rather than print it (and
391
- // record it as history) under the new graph.
392
- if (isStale())
391
+ // record it as history) under the new graph. Its writes still landed
392
+ // on the first graph, so say so.
393
+ if (isStale()) {
394
+ reportStaleWrites(requestGraphId, readGraphWrites((result.metadata || {})));
393
395
  return;
396
+ }
394
397
  setOperatorProgress({ isRunning: false, message: '' });
395
398
  // The API reports operator failures (credit pre-flight, timeouts,
396
399
  // unbilled calls) as HTTP 200 with `error_details` set and an
@@ -403,6 +406,7 @@ export function ConsoleContent({ config, variant = 'page', }) {
403
406
  errorDetails.detail,
404
407
  ].find((v) => typeof v === 'string' && v.length > 0);
405
408
  addErrorMessage(`Operator error: ${detail || result.content || 'The operator could not complete this request.'}`);
409
+ reportStoppedWrites(requestGraphId, readGraphWrites((result.metadata || {})));
406
410
  return;
407
411
  }
408
412
  const duration = Date.now() - startTime;
@@ -479,8 +483,13 @@ export function ConsoleContent({ config, variant = 'page', }) {
479
483
  }
480
484
  }
481
485
  catch (error) {
482
- if (isStale())
486
+ // A run that stopped after writing reports what it changed, so a
487
+ // retry doesn't repeat it.
488
+ const landed = readGraphWrites(error);
489
+ if (isStale()) {
490
+ reportStaleWrites(requestGraphId, landed);
483
491
  return;
492
+ }
484
493
  setOperatorProgress({ isRunning: false, message: '' });
485
494
  const errorMessage = error.message ||
486
495
  ((_a = error.data) === null || _a === void 0 ? void 0 : _a.detail) ||
@@ -494,8 +503,21 @@ export function ConsoleContent({ config, variant = 'page', }) {
494
503
  else {
495
504
  addErrorMessage(`Operator error: ${errorMessage}`);
496
505
  }
506
+ reportStoppedWrites(requestGraphId, landed);
497
507
  }
498
508
  };
509
+ const reportStoppedWrites = (writtenGraphId, writes) => {
510
+ if (writes.length === 0)
511
+ return;
512
+ emitGraphWrites(writtenGraphId, writes);
513
+ addResultMessage('The run stopped after making these changes. Check them before asking again.', undefined, undefined, { writes });
514
+ };
515
+ const reportStaleWrites = (writtenGraphId, writes) => {
516
+ if (writes.length === 0)
517
+ return;
518
+ emitGraphWrites(writtenGraphId, writes);
519
+ addResultMessage(`A request you started on ${writtenGraphId} finished after you switched graphs, and changed that graph:`, undefined, undefined, { writes });
520
+ };
499
521
  const showMcpSetup = async (mode) => {
500
522
  const apiUrl = process.env.NEXT_PUBLIC_ROBOSYSTEMS_API_URL ||
501
523
  'https://api.robosystems.ai';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robosystems/core",
3
- "version": "0.13.2",
3
+ "version": "0.13.4",
4
4
  "description": "Shared RoboSystems frontend core library (auth, contexts, task monitoring, UI components) for the RoboSystems Next.js apps",
5
5
  "license": "MIT",
6
6
  "private": false,