@robosystems/core 0.3.1 → 0.4.0

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.
@@ -87,6 +87,9 @@ export function ConsoleContent({ config }) {
87
87
  .join('\n');
88
88
  const builtInCommands = ` /query - Execute a Cypher query\n` +
89
89
  ` /search - Search documents\n` +
90
+ (config.enableRecall
91
+ ? ` /recall - Recall semantic memories\n`
92
+ : '') +
90
93
  ` /mcp - Show MCP connection setup\n` +
91
94
  ` /help - Show this help message\n` +
92
95
  ` /clear - Clear console history\n` +
@@ -451,7 +454,7 @@ export function ConsoleContent({ config }) {
451
454
  }
452
455
  };
453
456
  const handleCommand = async (command) => {
454
- var _a;
457
+ var _a, _b;
455
458
  if (!command.trim())
456
459
  return;
457
460
  addUserMessage(command);
@@ -515,16 +518,70 @@ export function ConsoleContent({ config }) {
515
518
  addErrorMessage('Search failed. Please try again.');
516
519
  }
517
520
  }
518
- catch (_b) {
521
+ catch (_c) {
519
522
  addErrorMessage('An error occurred while searching.');
520
523
  }
521
524
  return;
522
525
  }
526
+ // Handle /recall command — built-in only when the target supports
527
+ // semantic memory (user graphs; shared repositories reject it). When
528
+ // disabled it falls through to the unknown-command branch below.
529
+ if (config.enableRecall && command.toLowerCase().startsWith('/recall')) {
530
+ const recallQuery = command.slice(7).trim();
531
+ if (!recallQuery) {
532
+ addErrorMessage('Usage: /recall <query>\n\nExamples:\n /recall payment terms for Acme\n /recall quarter close checklist');
533
+ return;
534
+ }
535
+ if (!graphId) {
536
+ addErrorMessage(config.noSelectionError);
537
+ return;
538
+ }
539
+ addSystemMessage(`Recalling memories for "${recallQuery}"...`);
540
+ try {
541
+ const res = await SDK.recallMemory({
542
+ path: { graph_id: graphId },
543
+ body: { query: recallQuery, k: 10 },
544
+ });
545
+ if (res.data) {
546
+ const data = res.data;
547
+ if (data.hits.length === 0) {
548
+ addSystemMessage(`No memories found for "${recallQuery}".`);
549
+ }
550
+ else {
551
+ const lines = data.hits.map((hit, idx) => {
552
+ var _a;
553
+ const tags = ((_a = hit.tags) === null || _a === void 0 ? void 0 : _a.length) ? ` [${hit.tags.join(', ')}]` : '';
554
+ const text = hit.snippet
555
+ ? `\n ${hit.snippet.slice(0, 150)}${hit.snippet.length > 150 ? '...' : ''}`
556
+ : '';
557
+ return ` ${idx + 1}. [${hit.score.toFixed(2)}]${tags}${text}`;
558
+ });
559
+ addSystemMessage(`Recalled ${data.total} memor${data.total === 1 ? 'y' : 'ies'} for "${recallQuery}" (showing ${data.hits.length}):\n\n${lines.join('\n\n')}`, true);
560
+ }
561
+ }
562
+ else {
563
+ const status = (_a = res.response) === null || _a === void 0 ? void 0 : _a.status;
564
+ if (status === 403) {
565
+ addErrorMessage('Memory recall is not available for shared repositories.');
566
+ }
567
+ else if (status === 404 || status === 503) {
568
+ addErrorMessage('Semantic memory is not enabled in this environment.');
569
+ }
570
+ else {
571
+ addErrorMessage('Recall failed. Please try again.');
572
+ }
573
+ }
574
+ }
575
+ catch (_d) {
576
+ addErrorMessage('An error occurred while recalling memories.');
577
+ }
578
+ return;
579
+ }
523
580
  // Handle slash commands
524
581
  if (command.startsWith('/')) {
525
582
  const cmd = command.toLowerCase().split(' ')[0];
526
583
  // Check extra commands first
527
- const extra = (_a = config.extraCommands) === null || _a === void 0 ? void 0 : _a.find((ec) => ec.command.toLowerCase() === cmd);
584
+ const extra = (_b = config.extraCommands) === null || _b === void 0 ? void 0 : _b.find((ec) => ec.command.toLowerCase() === cmd);
528
585
  if (extra) {
529
586
  await extra.handler({ addSystemMessage, addErrorMessage, graphId });
530
587
  return;
@@ -390,6 +390,8 @@ export function buildGraphAwareConsoleConfig(graph, branding) {
390
390
  sampleQueries: set.sampleQueries,
391
391
  examplesLabel: (_b = branding.examplesLabel) !== null && _b !== void 0 ? _b : 'Example Cypher Queries:',
392
392
  noSelectionError: (_c = branding.noSelectionError) !== null && _c !== void 0 ? _c : 'No graph selected. Please select a graph first.',
393
+ // Semantic memory is per-user-graph; shared repositories reject it.
394
+ enableRecall: !isRepository,
393
395
  };
394
396
  }
395
397
  /**
@@ -56,6 +56,10 @@ export interface ConsoleConfig {
56
56
  examplesLabel: string;
57
57
  /** Error message when no graph/portfolio is selected */
58
58
  noSelectionError: string;
59
+ /** Enable the built-in /recall semantic-memory command. Off by default —
60
+ * shared repositories don't support memory, so the graph-aware builder
61
+ * enables it only for user graphs. */
62
+ enableRecall?: boolean;
59
63
  /** Extra slash commands beyond the built-in set */
60
64
  extraCommands?: ConsoleExtraCommand[];
61
65
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@robosystems/core",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
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,