Skip to content

Commit 59f82df

Browse files
authored
Merge pull request #106 from AdaWorldAPI/claude/code-review-SMMuY
Claude/code review sm mu y
2 parents f65515b + 90f9db1 commit 59f82df

186 files changed

Lines changed: 18054 additions & 11550 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Cargo.toml

Lines changed: 43 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,15 @@ flight = ["arrow-flight", "tonic", "prost"] # Arrow Flight MCP server
4444
crewai = ["flight"] # crewAI orchestration (A2A, agent cards, thinking templates)
4545
json_fallback = [] # Legacy JSON MCP types (backwards compat)
4646

47+
# Vendor integrations — uncommented by Dockerfile presets at build time.
48+
# Require repos cloned into vendor/ and dependency lines below uncommented.
49+
# See: Dockerfile.n8n, Dockerfile.crewai, Dockerfile.full
50+
# vendor-n8n = ["dep:n8n-core", "dep:n8n-workflow", "dep:n8n-arrow", "dep:n8n-grpc", "dep:n8n-hamming"]
51+
# vendor-crewai = ["dep:crewai-vendor", "crewai"]
52+
4753
# All features
4854
full = [
49-
"simd", "parallel", "python",
55+
"simd", "parallel", "python",
5056
"codebook", "hologram", "spo", "compress", "quantum",
5157
"lancedb", "neo4j", "redis"
5258
]
@@ -159,6 +165,30 @@ reqwest = { version = "0.12", features = ["json", "rustls-tls"], optional = true
159165
# -----------------------------------------------------------------------------
160166
pyo3 = { version = "0.23", optional = true, features = ["extension-module"] }
161167

168+
# -----------------------------------------------------------------------------
169+
# Vendor: n8n-rs (workflow automation engine)
170+
# Source: https://github.com/AdaWorldAPI/n8n-rs
171+
# Uncommented by Dockerfile.n8n / Dockerfile.full at build time.
172+
# Requires: git clone https://github.com/AdaWorldAPI/n8n-rs vendor/n8n-rs
173+
# NOTE: n8n crates pin Arrow 53 / DataFusion 43. The Dockerfiles add
174+
# [patch.crates-io] entries to unify Arrow/DataFusion to ladybug's versions.
175+
# -----------------------------------------------------------------------------
176+
# n8n-core = { path = "vendor/n8n-rs/n8n-rust/crates/n8n-core", optional = true }
177+
# n8n-workflow = { path = "vendor/n8n-rs/n8n-rust/crates/n8n-workflow", optional = true }
178+
# n8n-arrow = { path = "vendor/n8n-rs/n8n-rust/crates/n8n-arrow", optional = true }
179+
# n8n-grpc = { path = "vendor/n8n-rs/n8n-rust/crates/n8n-grpc", optional = true }
180+
# n8n-hamming = { path = "vendor/n8n-rs/n8n-rust/crates/n8n-hamming", optional = true }
181+
182+
# -----------------------------------------------------------------------------
183+
# Vendor: crewai-rust (AI agent orchestration framework)
184+
# Source: https://github.com/AdaWorldAPI/crewai-rust
185+
# Uncommented by Dockerfile.crewai / Dockerfile.full at build time.
186+
# Requires: git clone https://github.com/AdaWorldAPI/crewai-rust vendor/crewai-rust
187+
# No version conflicts — crewai has no Arrow/DataFusion deps.
188+
# Renamed to crewai-vendor to avoid collision with ladybug's built-in crewai feature.
189+
# -----------------------------------------------------------------------------
190+
# crewai-vendor = { package = "crewai", path = "vendor/crewai-rust", optional = true }
191+
162192
# =============================================================================
163193
# DEV DEPENDENCIES
164194
# =============================================================================
@@ -267,3 +297,15 @@ opt-level = 3
267297
# lance-bitpacking = { path = "vendor/lance/rust/compression/bitpacking" }
268298
# fsst = { path = "vendor/lance/rust/compression/fsst" }
269299
# datafusion = { git = "https://github.com/AdaWorldAPI/datafusion", branch = "liblzma-fix" }
300+
#
301+
# n8n-rs vendor overrides — use local clones instead of git fetch:
302+
# git clone https://github.com/AdaWorldAPI/n8n-rs vendor/n8n-rs
303+
# n8n-core = { path = "vendor/n8n-rs/n8n-rust/crates/n8n-core" }
304+
# n8n-workflow = { path = "vendor/n8n-rs/n8n-rust/crates/n8n-workflow" }
305+
# n8n-arrow = { path = "vendor/n8n-rs/n8n-rust/crates/n8n-arrow" }
306+
# n8n-grpc = { path = "vendor/n8n-rs/n8n-rust/crates/n8n-grpc" }
307+
# n8n-hamming = { path = "vendor/n8n-rs/n8n-rust/crates/n8n-hamming" }
308+
#
309+
# crewai-rust vendor override — use local clone instead of git fetch:
310+
# git clone https://github.com/AdaWorldAPI/crewai-rust vendor/crewai-rust
311+
# crewai = { path = "vendor/crewai-rust" }

Dockerfile.crewai

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
# =============================================================================
2+
# LadybugDB + crewAI — Docker Build
3+
# =============================================================================
4+
# Builds ladybug with crewAI agent orchestration framework vendored in.
5+
# crewai-rust provides: Agent, Crew, Flow, Task, LLM integrations,
6+
# memory, RAG, MCP, A2A messaging, and telemetry.
7+
#
8+
# BUILD:
9+
# docker build -f Dockerfile.crewai -t ladybugdb:crewai .
10+
#
11+
# RUN:
12+
# docker run -p 8080:8080 -p 50051:50051 ladybugdb:crewai
13+
# =============================================================================
14+
15+
# =============================================================================
16+
# STAGE 1: Builder
17+
# =============================================================================
18+
FROM rust:1.93-slim-bookworm AS builder
19+
20+
RUN apt-get update && apt-get install -y \
21+
pkg-config libssl-dev cmake protobuf-compiler git \
22+
&& rm -rf /var/lib/apt/lists/*
23+
24+
WORKDIR /build
25+
26+
# --- Clone crewai-rust vendor ---
27+
RUN git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust vendor/crewai-rust
28+
29+
# --- Copy source ---
30+
COPY . .
31+
32+
# --- Activate vendor deps in Cargo.toml ---
33+
RUN sed -i 's/^# crewai-vendor = /crewai-vendor = /' Cargo.toml && \
34+
sed -i 's/^# vendor-crewai = /vendor-crewai = /' Cargo.toml
35+
36+
ARG FEATURES="simd,parallel,flight,crewai,vendor-crewai"
37+
38+
# --- AVX-512 binary ---
39+
RUN RUSTFLAGS="-C target-cpu=x86-64-v4 -C link-arg=-s" \
40+
cargo build --release --bin ladybug-server --features "$FEATURES" && \
41+
cp target/release/ladybug-server /build/ladybug-avx512 && \
42+
cargo clean -p ladybug
43+
44+
# --- AVX-2 binary ---
45+
RUN RUSTFLAGS="-C target-cpu=x86-64-v3 -C link-arg=-s" \
46+
cargo build --release --bin ladybug-server --features "$FEATURES" && \
47+
cp target/release/ladybug-server /build/ladybug-avx2 && \
48+
cargo clean -p ladybug
49+
50+
# --- Generic binary ---
51+
RUN RUSTFLAGS="-C link-arg=-s" \
52+
cargo build --release --bin ladybug-server --features "$FEATURES" && \
53+
cp target/release/ladybug-server /build/ladybug-generic
54+
55+
# --- Flight gRPC binary ---
56+
RUN RUSTFLAGS="-C target-cpu=x86-64-v3 -C link-arg=-s" \
57+
cargo build --release --bin ladybug-flight --features "$FEATURES" && \
58+
cp target/release/ladybug-flight /build/ladybug-flight
59+
60+
# =============================================================================
61+
# STAGE 2: Runtime
62+
# =============================================================================
63+
FROM debian:bookworm-slim AS runtime
64+
65+
RUN apt-get update && apt-get install -y --no-install-recommends \
66+
ca-certificates curl procps \
67+
&& rm -rf /var/lib/apt/lists/* \
68+
&& useradd -m -s /bin/bash ladybug \
69+
&& mkdir -p /data && chown ladybug:ladybug /data
70+
71+
COPY --from=builder /build/ladybug-avx512 /usr/local/bin/
72+
COPY --from=builder /build/ladybug-avx2 /usr/local/bin/
73+
COPY --from=builder /build/ladybug-generic /usr/local/bin/
74+
COPY --from=builder /build/ladybug-flight /usr/local/bin/
75+
76+
COPY <<'ENTRY' /usr/local/bin/ladybug-start
77+
#!/bin/sh
78+
set -e
79+
if grep -q "avx512f" /proc/cpuinfo 2>/dev/null; then
80+
BIN=ladybug-avx512; LVL=AVX-512
81+
elif grep -q "avx2" /proc/cpuinfo 2>/dev/null; then
82+
BIN=ladybug-avx2; LVL=AVX-2
83+
else
84+
BIN=ladybug-generic; LVL=Generic
85+
fi
86+
echo "[ladybugdb+crewai] SIMD: ${LVL} → ${BIN}"
87+
exec "/usr/local/bin/${BIN}" "$@"
88+
ENTRY
89+
RUN chmod +x /usr/local/bin/ladybug-start
90+
91+
USER ladybug
92+
WORKDIR /home/ladybug
93+
94+
ENV LADYBUG_HOST=0.0.0.0
95+
ENV LADYBUG_PORT=8080
96+
ENV LADYBUG_FLIGHT_PORT=50051
97+
ENV LADYBUG_DATA_DIR=/data
98+
ENV LADYBUG_PRESET=crewai
99+
100+
EXPOSE 8080
101+
EXPOSE 50051
102+
103+
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
104+
CMD curl -f http://localhost:${LADYBUG_PORT}/health || exit 1
105+
106+
ENTRYPOINT ["ladybug-start"]

Dockerfile.full

Lines changed: 112 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,112 @@
1+
# =============================================================================
2+
# LadybugDB + n8n + crewAI — Docker Build (Full Vendor)
3+
# =============================================================================
4+
# Builds ladybug with both n8n workflow engine AND crewAI agent orchestration.
5+
# This is the maximum-capability image.
6+
#
7+
# BUILD:
8+
# docker build -f Dockerfile.full -t ladybugdb:full .
9+
#
10+
# RUN:
11+
# docker run -p 8080:8080 -p 50051:50051 ladybugdb:full
12+
# =============================================================================
13+
14+
# =============================================================================
15+
# STAGE 1: Builder
16+
# =============================================================================
17+
FROM rust:1.93-slim-bookworm AS builder
18+
19+
RUN apt-get update && apt-get install -y \
20+
pkg-config libssl-dev cmake protobuf-compiler git \
21+
&& rm -rf /var/lib/apt/lists/*
22+
23+
WORKDIR /build
24+
25+
# --- Clone both vendor repos ---
26+
RUN git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs vendor/n8n-rs && \
27+
git clone --depth 1 https://github.com/AdaWorldAPI/crewai-rust vendor/crewai-rust
28+
29+
# --- Copy source ---
30+
COPY . .
31+
32+
# --- Activate all vendor deps in Cargo.toml ---
33+
RUN sed -i 's/^# n8n-core = /n8n-core = /' Cargo.toml && \
34+
sed -i 's/^# n8n-workflow = /n8n-workflow = /' Cargo.toml && \
35+
sed -i 's/^# n8n-arrow = /n8n-arrow = /' Cargo.toml && \
36+
sed -i 's/^# n8n-grpc = /n8n-grpc = /' Cargo.toml && \
37+
sed -i 's/^# n8n-hamming = /n8n-hamming = /' Cargo.toml && \
38+
sed -i 's/^# vendor-n8n = /vendor-n8n = /' Cargo.toml && \
39+
sed -i 's/^# crewai-vendor = /crewai-vendor = /' Cargo.toml && \
40+
sed -i 's/^# vendor-crewai = /vendor-crewai = /' Cargo.toml
41+
42+
ARG FEATURES="simd,parallel,flight,crewai,vendor-n8n,vendor-crewai"
43+
44+
# --- AVX-512 binary ---
45+
RUN RUSTFLAGS="-C target-cpu=x86-64-v4 -C link-arg=-s" \
46+
cargo build --release --bin ladybug-server --features "$FEATURES" && \
47+
cp target/release/ladybug-server /build/ladybug-avx512 && \
48+
cargo clean -p ladybug
49+
50+
# --- AVX-2 binary ---
51+
RUN RUSTFLAGS="-C target-cpu=x86-64-v3 -C link-arg=-s" \
52+
cargo build --release --bin ladybug-server --features "$FEATURES" && \
53+
cp target/release/ladybug-server /build/ladybug-avx2 && \
54+
cargo clean -p ladybug
55+
56+
# --- Generic binary ---
57+
RUN RUSTFLAGS="-C link-arg=-s" \
58+
cargo build --release --bin ladybug-server --features "$FEATURES" && \
59+
cp target/release/ladybug-server /build/ladybug-generic
60+
61+
# --- Flight gRPC binary ---
62+
RUN RUSTFLAGS="-C target-cpu=x86-64-v3 -C link-arg=-s" \
63+
cargo build --release --bin ladybug-flight --features "$FEATURES" && \
64+
cp target/release/ladybug-flight /build/ladybug-flight
65+
66+
# =============================================================================
67+
# STAGE 2: Runtime
68+
# =============================================================================
69+
FROM debian:bookworm-slim AS runtime
70+
71+
RUN apt-get update && apt-get install -y --no-install-recommends \
72+
ca-certificates curl procps \
73+
&& rm -rf /var/lib/apt/lists/* \
74+
&& useradd -m -s /bin/bash ladybug \
75+
&& mkdir -p /data && chown ladybug:ladybug /data
76+
77+
COPY --from=builder /build/ladybug-avx512 /usr/local/bin/
78+
COPY --from=builder /build/ladybug-avx2 /usr/local/bin/
79+
COPY --from=builder /build/ladybug-generic /usr/local/bin/
80+
COPY --from=builder /build/ladybug-flight /usr/local/bin/
81+
82+
COPY <<'ENTRY' /usr/local/bin/ladybug-start
83+
#!/bin/sh
84+
set -e
85+
if grep -q "avx512f" /proc/cpuinfo 2>/dev/null; then
86+
BIN=ladybug-avx512; LVL=AVX-512
87+
elif grep -q "avx2" /proc/cpuinfo 2>/dev/null; then
88+
BIN=ladybug-avx2; LVL=AVX-2
89+
else
90+
BIN=ladybug-generic; LVL=Generic
91+
fi
92+
echo "[ladybugdb+n8n+crewai] SIMD: ${LVL} → ${BIN}"
93+
exec "/usr/local/bin/${BIN}" "$@"
94+
ENTRY
95+
RUN chmod +x /usr/local/bin/ladybug-start
96+
97+
USER ladybug
98+
WORKDIR /home/ladybug
99+
100+
ENV LADYBUG_HOST=0.0.0.0
101+
ENV LADYBUG_PORT=8080
102+
ENV LADYBUG_FLIGHT_PORT=50051
103+
ENV LADYBUG_DATA_DIR=/data
104+
ENV LADYBUG_PRESET=full
105+
106+
EXPOSE 8080
107+
EXPOSE 50051
108+
109+
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
110+
CMD curl -f http://localhost:${LADYBUG_PORT}/health || exit 1
111+
112+
ENTRYPOINT ["ladybug-start"]

Dockerfile.n8n

Lines changed: 111 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,111 @@
1+
# =============================================================================
2+
# LadybugDB + n8n-rs — Docker Build
3+
# =============================================================================
4+
# Builds ladybug with n8n workflow automation engine vendored in.
5+
# n8n-rs provides: workflow execution, Arrow data transfer, gRPC services,
6+
# 10kbit Hamming vectors, and PostgreSQL persistence.
7+
#
8+
# BUILD:
9+
# docker build -f Dockerfile.n8n -t ladybugdb:n8n .
10+
#
11+
# RUN:
12+
# docker run -p 8080:8080 -p 50051:50051 ladybugdb:n8n
13+
# =============================================================================
14+
15+
# =============================================================================
16+
# STAGE 1: Builder
17+
# =============================================================================
18+
FROM rust:1.93-slim-bookworm AS builder
19+
20+
RUN apt-get update && apt-get install -y \
21+
pkg-config libssl-dev cmake protobuf-compiler git \
22+
&& rm -rf /var/lib/apt/lists/*
23+
24+
WORKDIR /build
25+
26+
# --- Clone n8n-rs vendor ---
27+
RUN git clone --depth 1 https://github.com/AdaWorldAPI/n8n-rs vendor/n8n-rs
28+
29+
# --- Copy source ---
30+
COPY . .
31+
32+
# --- Activate vendor deps in Cargo.toml ---
33+
# Uncomment n8n dependency lines
34+
RUN sed -i 's/^# n8n-core = /n8n-core = /' Cargo.toml && \
35+
sed -i 's/^# n8n-workflow = /n8n-workflow = /' Cargo.toml && \
36+
sed -i 's/^# n8n-arrow = /n8n-arrow = /' Cargo.toml && \
37+
sed -i 's/^# n8n-grpc = /n8n-grpc = /' Cargo.toml && \
38+
sed -i 's/^# n8n-hamming = /n8n-hamming = /' Cargo.toml && \
39+
sed -i 's/^# vendor-n8n = /vendor-n8n = /' Cargo.toml
40+
41+
ARG FEATURES="simd,parallel,flight,vendor-n8n"
42+
43+
# --- AVX-512 binary ---
44+
RUN RUSTFLAGS="-C target-cpu=x86-64-v4 -C link-arg=-s" \
45+
cargo build --release --bin ladybug-server --features "$FEATURES" && \
46+
cp target/release/ladybug-server /build/ladybug-avx512 && \
47+
cargo clean -p ladybug
48+
49+
# --- AVX-2 binary ---
50+
RUN RUSTFLAGS="-C target-cpu=x86-64-v3 -C link-arg=-s" \
51+
cargo build --release --bin ladybug-server --features "$FEATURES" && \
52+
cp target/release/ladybug-server /build/ladybug-avx2 && \
53+
cargo clean -p ladybug
54+
55+
# --- Generic binary ---
56+
RUN RUSTFLAGS="-C link-arg=-s" \
57+
cargo build --release --bin ladybug-server --features "$FEATURES" && \
58+
cp target/release/ladybug-server /build/ladybug-generic
59+
60+
# --- Flight gRPC binary ---
61+
RUN RUSTFLAGS="-C target-cpu=x86-64-v3 -C link-arg=-s" \
62+
cargo build --release --bin ladybug-flight --features "$FEATURES" && \
63+
cp target/release/ladybug-flight /build/ladybug-flight
64+
65+
# =============================================================================
66+
# STAGE 2: Runtime
67+
# =============================================================================
68+
FROM debian:bookworm-slim AS runtime
69+
70+
RUN apt-get update && apt-get install -y --no-install-recommends \
71+
ca-certificates curl procps \
72+
&& rm -rf /var/lib/apt/lists/* \
73+
&& useradd -m -s /bin/bash ladybug \
74+
&& mkdir -p /data && chown ladybug:ladybug /data
75+
76+
COPY --from=builder /build/ladybug-avx512 /usr/local/bin/
77+
COPY --from=builder /build/ladybug-avx2 /usr/local/bin/
78+
COPY --from=builder /build/ladybug-generic /usr/local/bin/
79+
COPY --from=builder /build/ladybug-flight /usr/local/bin/
80+
81+
COPY <<'ENTRY' /usr/local/bin/ladybug-start
82+
#!/bin/sh
83+
set -e
84+
if grep -q "avx512f" /proc/cpuinfo 2>/dev/null; then
85+
BIN=ladybug-avx512; LVL=AVX-512
86+
elif grep -q "avx2" /proc/cpuinfo 2>/dev/null; then
87+
BIN=ladybug-avx2; LVL=AVX-2
88+
else
89+
BIN=ladybug-generic; LVL=Generic
90+
fi
91+
echo "[ladybugdb+n8n] SIMD: ${LVL} → ${BIN}"
92+
exec "/usr/local/bin/${BIN}" "$@"
93+
ENTRY
94+
RUN chmod +x /usr/local/bin/ladybug-start
95+
96+
USER ladybug
97+
WORKDIR /home/ladybug
98+
99+
ENV LADYBUG_HOST=0.0.0.0
100+
ENV LADYBUG_PORT=8080
101+
ENV LADYBUG_FLIGHT_PORT=50051
102+
ENV LADYBUG_DATA_DIR=/data
103+
ENV LADYBUG_PRESET=n8n
104+
105+
EXPOSE 8080
106+
EXPOSE 50051
107+
108+
HEALTHCHECK --interval=10s --timeout=3s --start-period=5s --retries=3 \
109+
CMD curl -f http://localhost:${LADYBUG_PORT}/health || exit 1
110+
111+
ENTRYPOINT ["ladybug-start"]

0 commit comments

Comments
 (0)