@ganglion/xacpx-relay 0.9.0 → 0.9.2

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/cli.js CHANGED
@@ -1073,10 +1073,13 @@ async function createRelayRuntime(dbPath, options = {}) {
1073
1073
  };
1074
1074
  const pushReasoningPart = (a, chunk) => {
1075
1075
  const last = a.parts[a.parts.length - 1];
1076
- if (last?.type === "reasoning")
1076
+ if (last?.type === "reasoning") {
1077
1077
  last.text = (last.text + chunk).slice(0, REASONING_CAP);
1078
- else
1079
- a.parts.push({ type: "reasoning", text: chunk.slice(0, REASONING_CAP) });
1078
+ return;
1079
+ }
1080
+ if (!chunk.trim())
1081
+ return;
1082
+ a.parts.push({ type: "reasoning", text: chunk.slice(0, REASONING_CAP) });
1080
1083
  };
1081
1084
  const pushToolPart = (a, step) => {
1082
1085
  const i = a.parts.findIndex((p) => p.type === "tool" && p.step.toolCallId === step.toolCallId);
@@ -1131,9 +1134,10 @@ async function createRelayRuntime(dbPath, options = {}) {
1131
1134
  if (!a)
1132
1135
  return;
1133
1136
  const steps = [...a.steps.values()];
1134
- const hasStructured = steps.length > 0 || a.reasoning.length > 0;
1137
+ const hasReasoning = a.reasoning.trim().length > 0;
1138
+ const hasStructured = steps.length > 0 || hasReasoning;
1135
1139
  if (a.text || hasStructured) {
1136
- const structured = hasStructured ? { toolSteps: steps, ...a.reasoning ? { reasoning: a.reasoning } : {}, ...a.parts.length ? { parts: a.parts } : {} } : undefined;
1140
+ const structured = hasStructured ? { toolSteps: steps, ...hasReasoning ? { reasoning: a.reasoning } : {}, ...a.parts.length ? { parts: a.parts } : {} } : undefined;
1137
1141
  messages.append(instanceId, event.sessionAlias, "out", a.text, structured);
1138
1142
  }
1139
1143
  } else if (event.type === "session-history") {