@ganglion/xacpx-relay 0.8.0 → 0.9.1

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
@@ -994,6 +994,16 @@ function createApp(deps) {
994
994
  });
995
995
  if (deps.webRoot) {
996
996
  const root = deps.webRoot;
997
+ app.use("/*", async (c, next) => {
998
+ await next();
999
+ const path = c.req.path;
1000
+ if (path.startsWith("/api") || path.startsWith("/ws"))
1001
+ return;
1002
+ if (!c.res.ok)
1003
+ return;
1004
+ const isHtml = (c.res.headers.get("content-type") ?? "").includes("text/html");
1005
+ c.header("Cache-Control", !isHtml && path.startsWith("/assets/") ? "public, max-age=31536000, immutable" : "no-cache");
1006
+ });
997
1007
  app.use("/*", serveStatic({ root }));
998
1008
  app.get("/*", serveStatic({ path: "index.html", root }));
999
1009
  }
@@ -1063,10 +1073,13 @@ async function createRelayRuntime(dbPath, options = {}) {
1063
1073
  };
1064
1074
  const pushReasoningPart = (a, chunk) => {
1065
1075
  const last = a.parts[a.parts.length - 1];
1066
- if (last?.type === "reasoning")
1076
+ if (last?.type === "reasoning") {
1067
1077
  last.text = (last.text + chunk).slice(0, REASONING_CAP);
1068
- else
1069
- 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) });
1070
1083
  };
1071
1084
  const pushToolPart = (a, step) => {
1072
1085
  const i = a.parts.findIndex((p) => p.type === "tool" && p.step.toolCallId === step.toolCallId);
@@ -1121,9 +1134,10 @@ async function createRelayRuntime(dbPath, options = {}) {
1121
1134
  if (!a)
1122
1135
  return;
1123
1136
  const steps = [...a.steps.values()];
1124
- const hasStructured = steps.length > 0 || a.reasoning.length > 0;
1137
+ const hasReasoning = a.reasoning.trim().length > 0;
1138
+ const hasStructured = steps.length > 0 || hasReasoning;
1125
1139
  if (a.text || hasStructured) {
1126
- 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;
1127
1141
  messages.append(instanceId, event.sessionAlias, "out", a.text, structured);
1128
1142
  }
1129
1143
  } else if (event.type === "session-history") {
@@ -1 +1 @@
1
- .stream-md>:first-child{margin-top:0}.stream-md>:last-child{margin-bottom:0}.stream-md p{margin:.5em 0;line-height:1.5}.stream-md h1,.stream-md h2,.stream-md h3,.stream-md h4{margin:.8em 0 .4em;font-weight:600;line-height:1.3}.stream-md h1{font-size:1.3em}.stream-md h2{font-size:1.2em}.stream-md h3{font-size:1.1em}.stream-md ul,.stream-md ol{margin:.5em 0;padding-left:1.4em}.stream-md ul{list-style:disc}.stream-md ol{list-style:decimal}.stream-md li{margin:.2em 0}.stream-md a{color:rgb(var(--c-accent));text-decoration:underline}.stream-md code{background:rgb(var(--c-surface));color:rgb(var(--c-fg));border-radius:4px;padding:.1em .3em;font-family:JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px}.stream-md pre{background:rgb(var(--c-bg));color:rgb(var(--c-fg));border:1px solid rgb(var(--c-border));border-radius:8px;padding:.65em .85em;overflow-x:auto;margin:.6em 0;box-shadow:var(--shadow-e1)}.stream-md pre::-webkit-scrollbar{height:8px}.stream-md pre::-webkit-scrollbar-thumb{background:rgb(var(--c-fg-muted) / .28);border-radius:8px}.stream-md pre::-webkit-scrollbar-track{background:transparent}.stream-md pre code{background:transparent;padding:0;color:inherit;font-size:13px;line-height:1.6}.stream-md .hljs-keyword,.stream-md .hljs-built_in,.stream-md .hljs-name,.stream-md .hljs-tag{color:rgb(var(--c-accent))}.stream-md .hljs-string,.stream-md .hljs-attr,.stream-md .hljs-symbol{color:rgb(var(--c-run))}.stream-md .hljs-comment,.stream-md .hljs-quote{color:rgb(var(--c-fg-muted))}.stream-md .hljs-number,.stream-md .hljs-literal{color:rgb(var(--c-info))}.stream-md blockquote{border-left:3px solid rgb(var(--c-border));margin:.6em 0;padding-left:.8em;color:rgb(var(--c-fg-muted))}.stream-md .md-table-wrap{max-width:100%;overflow-x:auto;margin:.6em 0}.stream-md .md-table-wrap::-webkit-scrollbar{height:8px}.stream-md .md-table-wrap::-webkit-scrollbar-thumb{background:rgb(var(--c-fg-muted) / .28);border-radius:8px}.stream-md .md-table-wrap::-webkit-scrollbar-track{background:transparent}.stream-md table{border-collapse:collapse}.stream-md img{max-width:100%;height:auto}.stream-md th,.stream-md td{border:1px solid rgb(var(--c-border));padding:.3em .6em}.stream-md hr{border:none;border-top:1px solid rgb(var(--c-border));margin:.8em 0}.cv-row[data-v-c68894eb]{content-visibility:auto;contain-intrinsic-size:auto 88px}
1
+ .stream-md>:first-child{margin-top:0}.stream-md>:last-child{margin-bottom:0}.stream-md p{margin:.5em 0;line-height:1.5}.stream-md h1,.stream-md h2,.stream-md h3,.stream-md h4{margin:.8em 0 .4em;font-weight:600;line-height:1.3}.stream-md h1{font-size:1.3em}.stream-md h2{font-size:1.2em}.stream-md h3{font-size:1.1em}.stream-md ul,.stream-md ol{margin:.5em 0;padding-left:1.4em}.stream-md ul{list-style:disc}.stream-md ol{list-style:decimal}.stream-md li{margin:.2em 0}.stream-md a{color:rgb(var(--c-accent));text-decoration:underline}.stream-md code{background:rgb(var(--c-surface));color:rgb(var(--c-fg));border-radius:4px;padding:.1em .3em;font-family:JetBrains Mono,ui-monospace,SFMono-Regular,Menlo,monospace;font-size:12.5px}.stream-md pre{background:rgb(var(--c-bg));color:rgb(var(--c-fg));border:1px solid rgb(var(--c-border));border-radius:8px;padding:.65em .85em;overflow-x:auto;margin:.6em 0;box-shadow:var(--shadow-e1)}.stream-md pre::-webkit-scrollbar{height:8px}.stream-md pre::-webkit-scrollbar-thumb{background:rgb(var(--c-fg-muted) / .28);border-radius:8px}.stream-md pre::-webkit-scrollbar-track{background:transparent}.stream-md pre code{background:transparent;padding:0;color:inherit;font-size:13px;line-height:1.6}.stream-md .hljs-keyword,.stream-md .hljs-built_in,.stream-md .hljs-name,.stream-md .hljs-tag{color:rgb(var(--c-accent))}.stream-md .hljs-string,.stream-md .hljs-attr,.stream-md .hljs-symbol{color:rgb(var(--c-run))}.stream-md .hljs-comment,.stream-md .hljs-quote{color:rgb(var(--c-fg-muted))}.stream-md .hljs-number,.stream-md .hljs-literal{color:rgb(var(--c-info))}.stream-md blockquote{border-left:3px solid rgb(var(--c-border));margin:.6em 0;padding-left:.8em;color:rgb(var(--c-fg-muted))}.stream-md .md-table-wrap{max-width:100%;overflow-x:auto;margin:.6em 0}.stream-md .md-table-wrap::-webkit-scrollbar{height:8px}.stream-md .md-table-wrap::-webkit-scrollbar-thumb{background:rgb(var(--c-fg-muted) / .28);border-radius:8px}.stream-md .md-table-wrap::-webkit-scrollbar-track{background:transparent}.stream-md table{border-collapse:collapse}.stream-md img{max-width:100%;height:auto}.stream-md th,.stream-md td{border:1px solid rgb(var(--c-border));padding:.3em .6em}.stream-md hr{border:none;border-top:1px solid rgb(var(--c-border));margin:.8em 0}.cv-row[data-v-a7278286]{content-visibility:auto;contain-intrinsic-size:auto 88px}