fix: skip OpenSSL build on arm64 (uses rustls instead)

This commit is contained in:
Nathan Flurry 2026-01-28 01:51:20 -08:00
parent 9edf07951c
commit e887b48e26
2 changed files with 65 additions and 25 deletions

View file

@ -40,7 +40,7 @@ ENV LIBCLANG_PATH=/usr/lib/llvm-14/lib \
CARGO_INCREMENTAL=0 \ CARGO_INCREMENTAL=0 \
CARGO_NET_GIT_FETCH_WITH_CLI=true CARGO_NET_GIT_FETCH_WITH_CLI=true
# Build OpenSSL for musl target # Build OpenSSL for musl target (amd64 only - arm64 uses rustls)
ENV SSL_VER=1.1.1w ENV SSL_VER=1.1.1w
RUN if [ "$TARGETARCH" = "amd64" ]; then \ RUN if [ "$TARGETARCH" = "amd64" ]; then \
export PATH="/opt/x86_64-unknown-linux-musl/bin:$PATH" && \ export PATH="/opt/x86_64-unknown-linux-musl/bin:$PATH" && \
@ -52,18 +52,9 @@ RUN if [ "$TARGETARCH" = "amd64" ]; then \
make install_sw && \ make install_sw && \
cd .. && \ cd .. && \
rm -rf openssl-$SSL_VER*; \ rm -rf openssl-$SSL_VER*; \
elif [ "$TARGETARCH" = "arm64" ]; then \
wget https://www.openssl.org/source/openssl-$SSL_VER.tar.gz && \
tar -xzf openssl-$SSL_VER.tar.gz && \
cd openssl-$SSL_VER && \
CC="musl-gcc -static" ./Configure no-shared no-async --prefix=/musl --openssldir=/musl/ssl linux-generic64 && \
make -j$(nproc) CC="musl-gcc -static" && \
make install_sw && \
cd .. && \
rm -rf openssl-$SSL_VER*; \
fi fi
# Set OpenSSL environment variables # Set OpenSSL environment variables (only used on amd64)
ENV OPENSSL_DIR=/musl \ ENV OPENSSL_DIR=/musl \
OPENSSL_INCLUDE_DIR=/musl/include \ OPENSSL_INCLUDE_DIR=/musl/include \
OPENSSL_LIB_DIR=/musl/lib \ OPENSSL_LIB_DIR=/musl/lib \

View file

@ -238,11 +238,14 @@ export async function sendMessageStream({
try { try {
const event = JSON.parse(data); const event = JSON.parse(data);
// Handle text deltas // Handle text deltas (delta can be a string or an object with type: "text")
if (event.type === "item.delta" && event.data?.delta?.type === "text") { if (event.type === "item.delta" && event.data?.delta) {
const text = event.data.delta.text || ""; const delta = event.data.delta;
fullText += text; const text = typeof delta === "string" ? delta : delta.type === "text" ? delta.text || "" : "";
onText?.(text); if (text) {
fullText += text;
onText?.(text);
}
} }
// Handle completed assistant message // Handle completed assistant message
@ -276,25 +279,71 @@ export async function runPrompt({
extraHeaders?: Record<string, string>; extraHeaders?: Record<string, string>;
agentId?: string; agentId?: string;
}): Promise<void> { }): Promise<void> {
const normalized = normalizeBaseUrl(baseUrl);
const sessionId = await createSession({ baseUrl, token, extraHeaders, agentId }); const sessionId = await createSession({ baseUrl, token, extraHeaders, agentId });
console.log(`Session ${sessionId} ready. Press Ctrl+C to quit.`); console.log(`Session ${sessionId} ready. Press Ctrl+C to quit.`);
const rl = createInterface({ input: process.stdin, output: process.stdout }); // Connect to SSE event stream
const headers = buildHeaders({ token, extraHeaders });
const sseResponse = await fetch(`${normalized}/v1/sessions/${sessionId}/events/sse`, { headers });
if (!sseResponse.ok || !sseResponse.body) {
throw new Error(`Failed to connect to SSE: ${sseResponse.status}`);
}
const reader = sseResponse.body.getReader();
const decoder = new TextDecoder();
let buffer = "";
let lastSeq = 0;
// Process SSE events in background
const processEvents = async () => {
while (true) {
const { done, value } = await reader.read();
if (done) break;
buffer += decoder.decode(value, { stream: true });
const lines = buffer.split("\n");
buffer = lines.pop() || "";
for (const line of lines) {
if (!line.startsWith("data: ")) continue;
const data = line.slice(6);
if (data === "[DONE]") continue;
try {
const event = JSON.parse(data);
if (event.sequence <= lastSeq) continue;
lastSeq = event.sequence;
// Print text deltas
if (event.type === "item.delta" && event.data?.delta) {
const delta = event.data.delta;
const text = typeof delta === "string" ? delta : delta.type === "text" ? delta.text || "" : "";
if (text) process.stdout.write(text);
}
// Print newline after completed assistant message
if (event.type === "item.completed" && event.data?.item?.role === "assistant") {
process.stdout.write("\n> ");
}
} catch {}
}
}
};
processEvents().catch(() => {});
// Read user input and post messages
const rl = createInterface({ input: process.stdin, output: process.stdout });
while (true) { while (true) {
const line = await rl.question("> "); const line = await rl.question("> ");
if (!line.trim()) continue; if (!line.trim()) continue;
try { try {
await sendMessageStream({ await fetch(`${normalized}/v1/sessions/${sessionId}/messages`, {
baseUrl, method: "POST",
token, headers: buildHeaders({ token, extraHeaders, contentType: true }),
extraHeaders, body: JSON.stringify({ message: line.trim() }),
sessionId,
message: line.trim(),
onText: (text) => process.stdout.write(text),
}); });
process.stdout.write("\n");
} catch (error) { } catch (error) {
console.error(error instanceof Error ? error.message : error); console.error(error instanceof Error ? error.message : error);
} }