@questionbase/deskfree 0.6.8 → 0.6.10

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/bin.js CHANGED
@@ -14012,6 +14012,13 @@ async function routeMessage(message, client, deps, sessionStore, config) {
14012
14012
  const delta = extractTextDelta(message2);
14013
14013
  if (delta) {
14014
14014
  fullText += delta;
14015
+ if (!fullText.trim()) {
14016
+ log.warn(`Skipping whitespace-only delta`, {
14017
+ delta: JSON.stringify(delta),
14018
+ fullText: JSON.stringify(fullText)
14019
+ });
14020
+ continue;
14021
+ }
14015
14022
  if (!streamStarted) {
14016
14023
  await streamingSession.start(fullText, replyTaskId);
14017
14024
  streamStarted = true;
@@ -14047,8 +14054,12 @@ async function routeMessage(message, client, deps, sessionStore, config) {
14047
14054
  }
14048
14055
  if (streamStarted && streamingSession.isActive()) {
14049
14056
  await streamingSession.close(fullText || void 0);
14050
- } else if (!streamStarted && fullText) {
14057
+ } else if (!streamStarted && fullText.trim()) {
14051
14058
  await client.sendMessage({ content: fullText, taskId: replyTaskId });
14059
+ } else if (!streamStarted && fullText && !fullText.trim()) {
14060
+ log.warn(`Skipping sendMessage: fullText is whitespace-only`, {
14061
+ fullText: JSON.stringify(fullText)
14062
+ });
14052
14063
  }
14053
14064
  if (capturedSessionId) {
14054
14065
  sessionStore.setSessionId(sessionKey, capturedSessionId);
@@ -14062,8 +14073,10 @@ async function routeMessage(message, client, deps, sessionStore, config) {
14062
14073
  }
14063
14074
  }
14064
14075
  const errMsg = err instanceof Error ? err.message : String(err);
14076
+ const errStack = err instanceof Error ? err.stack : void 0;
14065
14077
  const errStderr = err?.["stderr"] ?? "";
14066
14078
  log.warn(`Failed to handle message: ${errMsg}`, {
14079
+ stack: errStack,
14067
14080
  stderr: errStderr ? String(errStderr).slice(0, 2e3) : void 0,
14068
14081
  exitCode: err?.["exit_code"]
14069
14082
  });
@@ -14627,6 +14640,13 @@ ${userMessage}
14627
14640
  const delta = extractTextDelta2(message);
14628
14641
  if (delta) {
14629
14642
  fullText += delta;
14643
+ if (!fullText.trim()) {
14644
+ log.warn(`Skipping whitespace-only delta`, {
14645
+ delta: JSON.stringify(delta),
14646
+ fullText: JSON.stringify(fullText)
14647
+ });
14648
+ continue;
14649
+ }
14630
14650
  if (!streamStarted) {
14631
14651
  setInboundThreadId(taskId);
14632
14652
  await streamingSession.start(fullText, taskId);
@@ -14695,7 +14715,10 @@ ${userMessage}
14695
14715
  }
14696
14716
  }
14697
14717
  const errMsg = err instanceof Error ? err.message : String(err);
14698
- log.warn(`Worker drain loop error for task ${taskId}: ${errMsg}`);
14718
+ const errStack = err instanceof Error ? err.stack : void 0;
14719
+ log.warn(`Worker drain loop error for task ${taskId}: ${errMsg}`, {
14720
+ stack: errStack
14721
+ });
14699
14722
  try {
14700
14723
  await client.sendMessage({
14701
14724
  content: "Sorry, I encountered an error while working on this task. Please try again.",
@@ -14983,7 +15006,7 @@ async function startAgent(opts) {
14983
15006
  log.info("DeskFree Agent Runtime starting...");
14984
15007
  const { getRotationToken: getRotationToken2, setInitialRotationToken: setInitialRotationToken2 } = await Promise.resolve().then(() => (init_ws_gateway(), ws_gateway_exports));
14985
15008
  const { collectFingerprint: collectFingerprint2 } = await Promise.resolve().then(() => (init_fingerprint(), fingerprint_exports));
14986
- const runtimeVersion = "0.6.8";
15009
+ const runtimeVersion = "0.6.10";
14987
15010
  const fingerprint = collectFingerprint2(localConfig.stateDir, runtimeVersion);
14988
15011
  log.info("Connecting to DeskFree...", { wsUrl: localConfig.wsUrl });
14989
15012
  const connectResult = await initialConnect({