33 lines
1.1 KiB
Docker
33 lines
1.1 KiB
Docker
# syntax=docker/dockerfile:1
|
|
# dockerfiles/Dockerfile.hermes-agent
|
|
FROM nousresearch/hermes-agent@sha256:9c841866021c54c4596849f6135717e8a4d52ba510b7f52c50aef1de1a283973
|
|
|
|
USER root
|
|
|
|
# Ignore an async WebSocket-ticket result after React has already disposed the
|
|
# connection attempt. Without this guard, a stale socket can supersede the
|
|
# visible chat socket and leave the dashboard in a reconnect loop.
|
|
RUN node <<'NODE'
|
|
const fs = require("node:fs");
|
|
const path = "/opt/hermes/web/src/pages/ChatPage.tsx";
|
|
const source = fs.readFileSync(path, "utf8");
|
|
const before = [
|
|
' const url = await api.buildWsUrl("/api/pty", params);',
|
|
' const ws = new WebSocket(url);',
|
|
].join("\n");
|
|
const after = [
|
|
' const url = await api.buildWsUrl("/api/pty", params);',
|
|
' if (unmounting) return;',
|
|
' const ws = new WebSocket(url);',
|
|
].join("\n");
|
|
|
|
if (!source.includes(before)) {
|
|
throw new Error("Hermes ChatPage WebSocket patch context changed");
|
|
}
|
|
fs.writeFileSync(path, source.replace(before, after));
|
|
NODE
|
|
|
|
RUN cd /opt/hermes/web \
|
|
&& npm run build \
|
|
&& grep -Fq 'if (unmounting) return;' src/pages/ChatPage.tsx
|