Skip to content

Commit 57f18a0

Browse files
authored
Merge pull request #13 from PredicateSystems/real
readl examples with v1/execute to read files
2 parents 17befc7 + 48bc81e commit 57f18a0

16 files changed

Lines changed: 1972 additions & 0 deletions
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# File Processor Demo - Environment Configuration
2+
# Copy this file to .env and fill in your values
3+
4+
# ==============================================================================
5+
# LLM Provider Configuration (choose ONE)
6+
# ==============================================================================
7+
8+
# Option 1: Anthropic Claude (recommended)
9+
ANTHROPIC_API_KEY=your-anthropic-api-key-here
10+
ANTHROPIC_MODEL=claude-sonnet-4-20250514
11+
12+
# Option 2: OpenAI
13+
# OPENAI_API_KEY=your-openai-api-key-here
14+
# OPENAI_MODEL=gpt-4o
15+
16+
# Option 3: Local LLM (Ollama or LM Studio)
17+
# LOCAL_LLM_BASE_URL=http://host.docker.internal:11434/v1
18+
# LOCAL_LLM_MODEL=llama3.2
19+
20+
# Force specific provider (optional - auto-detects based on keys if not set)
21+
# LLM_PROVIDER=anthropic # or: openai, local, ollama, lmstudio
22+
23+
# ==============================================================================
24+
# Sidecar Configuration
25+
# ==============================================================================
26+
27+
# Sidecar URL (defaults to docker service name)
28+
PREDICATE_SIDECAR_URL=http://predicate-sidecar:8787
29+
30+
# Agent principal identity
31+
SECURECLAW_PRINCIPAL=agent:file-processor
32+
33+
# ==============================================================================
34+
# Optional Settings
35+
# ==============================================================================
36+
37+
# Enable verbose logging
38+
SECURECLAW_VERBOSE=true
39+
40+
# Cloud tracing (optional)
41+
# PREDICATE_API_KEY=your-predicate-api-key-here
Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
# Environment files (contain secrets)
2+
.env
3+
.env.local
4+
.env.*.local
5+
6+
# Dependencies
7+
node_modules/
8+
9+
# Build output
10+
dist/
11+
12+
# TypeScript cache
13+
*.tsbuildinfo
14+
15+
# Logs
16+
*.log
17+
npm-debug.log*
18+
19+
# IDE
20+
.idea/
21+
.vscode/
22+
*.swp
23+
*.swo
24+
25+
# OS files
26+
.DS_Store
27+
Thumbs.db
28+
29+
# Workspace output (generated files)
30+
workspace/output/*
31+
workspace/archive/*
32+
!workspace/output/.gitkeep
33+
!workspace/archive/.gitkeep
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# ============================================================================
2+
# File Processor Agent - Dockerfile
3+
# ============================================================================
4+
#
5+
# Builds the file processor agent with zero filesystem privileges.
6+
# All file operations go through the sidecar's /v1/execute endpoint.
7+
#
8+
# ============================================================================
9+
10+
FROM node:20-slim
11+
12+
WORKDIR /app
13+
14+
# Install dependencies
15+
RUN apt-get update && apt-get install -y \
16+
curl \
17+
&& rm -rf /var/lib/apt/lists/*
18+
19+
# Copy package files
20+
COPY package.json tsconfig.json ./
21+
COPY src ./src
22+
23+
# Install npm dependencies
24+
RUN npm install
25+
26+
# Build TypeScript
27+
RUN npm run build
28+
29+
# Create non-root user (agent runs with minimal privileges)
30+
RUN useradd -m -s /bin/bash agent
31+
USER agent
32+
33+
# Entry point
34+
CMD ["node", "dist/file-processor-agent.js"]
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Predicate Authority Sidecar
2+
#
3+
# Uses Ubuntu 24.04 LTS which has GLIBC 2.39 (required by the sidecar binary).
4+
# Downloads the binary from GitHub releases - cached in Docker layers.
5+
6+
FROM ubuntu:24.04
7+
8+
# Install curl for downloading binary and health checks
9+
RUN apt-get update && apt-get install -y curl ca-certificates && rm -rf /var/lib/apt/lists/*
10+
11+
WORKDIR /app
12+
13+
# Detect architecture and download appropriate binary
14+
# This layer is cached after first build
15+
ARG TARGETARCH
16+
RUN ARCH=$(echo ${TARGETARCH:-$(uname -m)} | sed 's/amd64/x64/' | sed 's/x86_64/x64/' | sed 's/aarch64/arm64/') && \
17+
echo "Detected architecture: $ARCH" && \
18+
curl -fsSL -o /tmp/sidecar.tar.gz \
19+
"https://github.com/PredicateSystems/predicate-authority-sidecar/releases/download/v0.6.7/predicate-authorityd-linux-${ARCH}.tar.gz" && \
20+
tar -xzf /tmp/sidecar.tar.gz -C /usr/local/bin && \
21+
chmod +x /usr/local/bin/predicate-authorityd && \
22+
rm /tmp/sidecar.tar.gz
23+
24+
# Copy policy file (at end for better caching)
25+
COPY policy.yaml /app/policy.yaml
26+
27+
EXPOSE 8787
28+
29+
# Run sidecar with delegation enabled for /v1/execute support
30+
# The --enable-delegation flag enables mandate issuance AND mandate store
31+
CMD ["predicate-authorityd", \
32+
"--host", "0.0.0.0", \
33+
"--port", "8787", \
34+
"--mode", "local_only", \
35+
"--policy-file", "/app/policy.yaml", \
36+
"--log-level", "info", \
37+
"--enable-delegation", \
38+
"run"]

0 commit comments

Comments
 (0)