rterm-backend 3.2.4 → 3.2.5

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.
Files changed (2) hide show
  1. package/bin/gybackend.cjs +51 -3
  2. package/package.json +2 -2
package/bin/gybackend.cjs CHANGED
@@ -296885,6 +296885,13 @@ ${res.stderr}` : "")
296885
296885
  task2.endTime = Date.now();
296886
296886
  task2.exitCode = options?.exitCode;
296887
296887
  task2.endOffset = task2.startOffset + task2.output.length;
296888
+ if (task2.capturedOutput !== void 0 && task2.capturedOutput.length < (task2.output || "").length) {
296889
+ task2.captureStatus = "partial";
296890
+ } else if ((task2.output || "").length > MAX_BUFFER_SIZE) {
296891
+ task2.captureStatus = "display-truncated";
296892
+ } else {
296893
+ task2.captureStatus = "complete";
296894
+ }
296888
296895
  this.stopCommandTrackingWatcher(taskId);
296889
296896
  this.activeTaskByTerminal.delete(terminalId);
296890
296897
  this.pendingTaskFinishByTerminal.delete(terminalId);
@@ -296899,7 +296906,8 @@ ${res.stderr}` : "")
296899
296906
  callback({
296900
296907
  stdoutDelta: task2.output,
296901
296908
  exitCode: options?.exitCode,
296902
- history_command_match_id: taskId
296909
+ history_command_match_id: taskId,
296910
+ captureStatus: task2.captureStatus
296903
296911
  });
296904
296912
  }
296905
296913
  }
@@ -349593,10 +349601,11 @@ async function runCommand(args, context2, options) {
349593
349601
  });
349594
349602
  finalResult = `The command has been running for over 120s and has been switched to nowait mode (running in the background). You can use read_command_output to check its progress. history_command_match_id=${historyCommandMatchId}, terminalId=${bestMatch.id}`;
349595
349603
  } else {
349604
+ const captureNote = result.captureStatus === "partial" ? "\n[Note: Some output may have been lost during capture. Use read_command_output to retrieve the full output if needed.]" : result.captureStatus === "display-truncated" ? "\n[Note: Output was truncated for display. Use read_command_output to retrieve the full output if needed.]" : "";
349596
349605
  finalResult = `The command has finished executing. The following is the output (history_command_match_id=${historyCommandMatchId}):
349597
349606
  <terminal_content>
349598
349607
  ${truncatedOutput}
349599
- </terminal_content>`;
349608
+ </terminal_content>${captureNote}`;
349600
349609
  }
349601
349610
  context2.sendEvent(sessionId, {
349602
349611
  messageId,
@@ -367471,6 +367480,35 @@ function canRunInParallel(toolCalls) {
367471
367480
  }
367472
367481
  return true;
367473
367482
  }
367483
+ function reconcileToolCalls(toolCalls) {
367484
+ if (!Array.isArray(toolCalls) || toolCalls.length === 0) return [];
367485
+ const seen = /* @__PURE__ */ new Set();
367486
+ const result = [];
367487
+ for (const tc of toolCalls) {
367488
+ if (!tc || typeof tc !== "object") continue;
367489
+ if (!tc.name || typeof tc.name !== "string") continue;
367490
+ let args = tc.args;
367491
+ if (args == null) {
367492
+ args = {};
367493
+ } else if (typeof args === "string") {
367494
+ try {
367495
+ args = JSON.parse(args);
367496
+ } catch {
367497
+ args = {};
367498
+ }
367499
+ }
367500
+ const id = tc.id || "";
367501
+ if (id) {
367502
+ if (seen.has(id)) continue;
367503
+ seen.add(id);
367504
+ }
367505
+ const dedupKey = `${tc.name}::${JSON.stringify(args)}`;
367506
+ if (seen.has(dedupKey)) continue;
367507
+ seen.add(dedupKey);
367508
+ result.push({ ...tc, args });
367509
+ }
367510
+ return result;
367511
+ }
367474
367512
  function clipTextMiddle(input, maxChars) {
367475
367513
  if (maxChars <= 0) return "";
367476
367514
  if (input.length <= maxChars) return input;
@@ -368437,7 +368475,9 @@ var AgentService_v2 = class {
368437
368475
  if (!AIMessage.isInstance(lastMessage)) {
368438
368476
  return { messages, sessionId, pendingToolCalls };
368439
368477
  }
368440
- const toolCalls = Array.isArray(lastMessage.tool_calls) ? lastMessage.tool_calls : [];
368478
+ const toolCalls = reconcileToolCalls(
368479
+ Array.isArray(lastMessage.tool_calls) ? lastMessage.tool_calls : []
368480
+ );
368441
368481
  if (!toolCalls || toolCalls.length === 0) {
368442
368482
  this.cleanupModelToolCallMetadata(lastMessage, []);
368443
368483
  return { messages, sessionId, pendingToolCalls };
@@ -370762,12 +370802,20 @@ ${reminder}`;
370762
370802
  lastCheckpointOffset: 0,
370763
370803
  lastProfileMaxTokens: this.getEffectiveMaxTokensForSession(sessionId)
370764
370804
  };
370805
+ const previousFrontier = session.lastCheckpointOffset || 0;
370806
+ const newFrontier = messages.length;
370765
370807
  this.updateSessionFromMessages(
370766
370808
  session,
370767
370809
  messages,
370768
370810
  this.getEffectiveMaxTokensForSession(sessionId)
370769
370811
  );
370812
+ session.lastCheckpointOffset = newFrontier;
370770
370813
  this.chatHistoryService.saveSession(session);
370814
+ if (newFrontier !== previousFrontier) {
370815
+ console.log(
370816
+ `[AgentService_v2] Reading frontier updated: ${previousFrontier} -> ${newFrontier} messages (session ${sessionId}).`
370817
+ );
370818
+ }
370771
370819
  } catch (error40) {
370772
370820
  console.warn(
370773
370821
  "[AgentService_v2] Failed to save session from checkpoint:",
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "rterm-backend",
3
- "version": "3.2.4",
4
- "description": "Headless AI-native backend for RTerm / neuralOS — v3.2.4: parallel tool execution for compatible tools + per-model requestParams. 11 plugins, 55 plugin tools wired. Transports (SSH/serial/local), SQLite, and NATS libs install automatically.",
3
+ "version": "3.2.5",
4
+ "description": "Headless AI-native backend for RTerm / neuralOS — v3.2.5: captureStatus (complete/partial/truncated), reconcileToolCalls (streamed multi-tool validation), reading frontier for emergency recovery. 11 plugins, 55 plugin tools wired. Transports (SSH/serial/local), SQLite, and NATS libs install automatically.",
5
5
  "main": "bin/gybackend.cjs",
6
6
  "bin": { "gybackend": "bin/gybackend.cjs" },
7
7
  "license": "MIT",