@questionbase/deskfree 0.6.8 → 0.6.9

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/index.js CHANGED
@@ -13631,6 +13631,13 @@ async function routeMessage(message, client, deps, sessionStore, config) {
13631
13631
  const delta = extractTextDelta(message2);
13632
13632
  if (delta) {
13633
13633
  fullText += delta;
13634
+ if (!fullText.trim()) {
13635
+ log.warn(`Skipping whitespace-only delta`, {
13636
+ delta: JSON.stringify(delta),
13637
+ fullText: JSON.stringify(fullText)
13638
+ });
13639
+ continue;
13640
+ }
13634
13641
  if (!streamStarted) {
13635
13642
  await streamingSession.start(fullText, replyTaskId);
13636
13643
  streamStarted = true;
@@ -13666,8 +13673,12 @@ async function routeMessage(message, client, deps, sessionStore, config) {
13666
13673
  }
13667
13674
  if (streamStarted && streamingSession.isActive()) {
13668
13675
  await streamingSession.close(fullText || void 0);
13669
- } else if (!streamStarted && fullText) {
13676
+ } else if (!streamStarted && fullText.trim()) {
13670
13677
  await client.sendMessage({ content: fullText, taskId: replyTaskId });
13678
+ } else if (!streamStarted && fullText && !fullText.trim()) {
13679
+ log.warn(`Skipping sendMessage: fullText is whitespace-only`, {
13680
+ fullText: JSON.stringify(fullText)
13681
+ });
13671
13682
  }
13672
13683
  if (capturedSessionId) {
13673
13684
  sessionStore.setSessionId(sessionKey, capturedSessionId);
@@ -13681,8 +13692,10 @@ async function routeMessage(message, client, deps, sessionStore, config) {
13681
13692
  }
13682
13693
  }
13683
13694
  const errMsg = err instanceof Error ? err.message : String(err);
13695
+ const errStack = err instanceof Error ? err.stack : void 0;
13684
13696
  const errStderr = err?.["stderr"] ?? "";
13685
13697
  log.warn(`Failed to handle message: ${errMsg}`, {
13698
+ stack: errStack,
13686
13699
  stderr: errStderr ? String(errStderr).slice(0, 2e3) : void 0,
13687
13700
  exitCode: err?.["exit_code"]
13688
13701
  });
@@ -14471,7 +14484,7 @@ async function startAgent(opts) {
14471
14484
  log.info("DeskFree Agent Runtime starting...");
14472
14485
  const { getRotationToken: getRotationToken2, setInitialRotationToken: setInitialRotationToken2 } = await Promise.resolve().then(() => (init_ws_gateway(), ws_gateway_exports));
14473
14486
  const { collectFingerprint: collectFingerprint2 } = await Promise.resolve().then(() => (init_fingerprint(), fingerprint_exports));
14474
- const runtimeVersion = "0.6.8";
14487
+ const runtimeVersion = "0.6.9";
14475
14488
  const fingerprint = collectFingerprint2(localConfig.stateDir, runtimeVersion);
14476
14489
  log.info("Connecting to DeskFree...", { wsUrl: localConfig.wsUrl });
14477
14490
  const connectResult = await initialConnect({