Skip to content
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
# Cargo workspace configuration
# Reference: https://doc.rust-lang.org/cargo/reference/config.html

[alias]
# Run the full check suite that CI runs locally
check-all = "clippy --all-targets --all-features -- -D warnings"

# Build a release binary
build-release = "build --release --locked"

# Run with debug logging
run-dev = "run -- "


[profile.dev]
# Faster incremental builds during development.
incremental = true

[profile.test]
# Slightly faster test compilation.
incremental = true
37 changes: 37 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# Build artifacts
target/

# Environment files — never include secrets in the image
.env
.env.*
!.env.example

# Version control
.git/
.github/

# Editor and IDE metadata
.vscode/
.idea/
*.iml
.DS_Store

# Rust toolchain overrides (resolved at build time in CI)
rust-toolchain
rust-toolchain.toml

# Documentation source (not needed in the runtime image)
docs/
*.md
!README.md

# Claude / AI tooling
.claude/
.agents/
skills/
skills-lock.json
CLAUDE.md

# Misc
Dockerfile
.dockerignore
77 changes: 77 additions & 0 deletions .env.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
# -----------------------------------------------------------------------------
# Server
# -----------------------------------------------------------------------------

# Host address the server binds to.
# Use 0.0.0.0 to accept connections on all interfaces, 127.0.0.1 for localhost only.
# Default: 0.0.0.0
SERVER_HOST=0.0.0.0

# Port the server listens on.
# Default: 3000
SERVER_PORT=3000


# -----------------------------------------------------------------------------
# HTTP Client (outbound to LLM providers)
# -----------------------------------------------------------------------------

# Maximum idle time before closing a pooled connection, in seconds.
# Default: 90
HTTP_POOL_IDLE_TIMEOUT_SECS=90

# Maximum number of idle connections kept per host.
# Default: 32
HTTP_POOL_MAX_IDLE_PER_HOST=32

# Timeout for establishing a TCP connection, in seconds.
# Default: 10
HTTP_CONNECT_TIMEOUT_SECS=10

# Timeout for the entire request (including streaming body), in seconds.
# Increase this for providers with slow first-token latency.
# Default: 300
HTTP_TIMEOUT_SECS=300


# -----------------------------------------------------------------------------
# Logging
# -----------------------------------------------------------------------------

# Log output format.
# Options: json | compact | pretty
# json - Structured JSON; best for production and log aggregators.
# compact - Single-line; best for development terminals.
# pretty - Multi-line with full context; best for debugging.
# Default: compact (debug builds) | json (release builds)
LOG_FORMAT=pretty

# Tracing filter directive (tracing-subscriber EnvFilter syntax).
# Format: <target>=<level>,...
# Levels: error | warn | info | debug | trace
# Default: valymux=debug,tower_http=debug,info (debug) | valymux=info,warn (release)
RUST_LOG=valymux=debug,tower_http=debug,info


# -----------------------------------------------------------------------------
# SurrealDB
# -----------------------------------------------------------------------------

# WebSocket or HTTP endpoint for your SurrealDB instance.
# Examples:
# ws://localhost:8000 (local, unencrypted)
# wss://your-instance.surreal.cloud (Surreal Cloud, TLS)
SURREAL_URL=ws://localhost:8000

# Namespace and database within the SurrealDB instance.
SURREAL_NAMESPACE=main
SURREAL_DATABASE=main

# Credentials for the SurrealDB root user or a scoped user with write access.
SURREAL_USERNAME=your_username
SURREAL_PASSWORD=your_password

# 32-byte (256-bit) encryption key, hex-encoded, for encrypting provider secrets
# at rest. Generate with:
# openssl rand -hex 32
SURREAL_ENCRYPTION_KEY=replace_with_64_hex_characters_generated_via_openssl_rand_hex_32
18 changes: 18 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# CODEOWNERS
#
# Each line is a file pattern followed by one or more owners.
# Owners are automatically requested for review when a PR touches matching paths.
# The last matching pattern takes precedence.
#
# See: https://docs.github.com/en/repositories/managing-your-repositorys-settings-and-features/customizing-your-repository/about-code-owners

# Current maintainer: @CLoaKY233
# As the project grows and you accept contributors, add their handles here.
# Example: * @CLoaKY233 @NewContributor @AnotherMaintainer

# Default owner
* @CLoaKY233

# As you add maintainers, uncomment and update these high-sensitivity areas:
# crates/surrealdb/src/crypto.rs @CLoaKY233 @TrustedMaintainer
# src/rts/extractors.rs @CLoaKY233 @TrustedMaintainer
Comment on lines +16 to +18
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Correct the crate path in the commented example.

The commented example on line 17 references crates/surrealdb/src/crypto.rs, but according to the PR summary, the new crate is named valygate-surrealdb. This path mismatch will cause the rule to fail when uncommented in the future.

📝 Proposed fix for the crate path
 # As you add maintainers, uncomment and update these high-sensitivity areas:
-# crates/surrealdb/src/crypto.rs  `@CLoaKY233` `@TrustedMaintainer`
+# crates/valygate-surrealdb/src/crypto.rs  `@CLoaKY233` `@TrustedMaintainer`
 # src/rts/extractors.rs           `@CLoaKY233` `@TrustedMaintainer`
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# As you add maintainers, uncomment and update these high-sensitivity areas:
# crates/surrealdb/src/crypto.rs @CLoaKY233 @TrustedMaintainer
# src/rts/extractors.rs @CLoaKY233 @TrustedMaintainer
# As you add maintainers, uncomment and update these high-sensitivity areas:
# crates/valygate-surrealdb/src/crypto.rs `@CLoaKY233` `@TrustedMaintainer`
# src/rts/extractors.rs `@CLoaKY233` `@TrustedMaintainer`
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/CODEOWNERS around lines 16 - 18, Update the commented crate path
example so it matches the new crate name: replace the string
"crates/surrealdb/src/crypto.rs" with "crates/valygate-surrealdb/src/crypto.rs"
in the CODEOWNERS comment (the commented example containing that path), ensuring
future uncommenting will reference the correct crate; leave the maintainer
handles (e.g., `@CLoaKY233` `@TrustedMaintainer`) unchanged.

89 changes: 89 additions & 0 deletions .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
name: Bug Report
description: Report a reproducible bug in ValyMux.
labels: ["bug", "needs-triage"]
body:
- type: markdown
attributes:
value: |
Before filing a report, please search existing issues to avoid duplicates.
Redact any API keys, passwords, or other credentials from logs and config snippets.

- type: input
id: version
attributes:
label: Version or Commit
description: The ValyMux version or full commit SHA you are running.
placeholder: "0.0.1 or git rev e.g. acdd483"
validations:
required: true

- type: input
id: rust_version
attributes:
label: Rust Toolchain
description: Output of `rustc --version`.
placeholder: "rustc 1.85.0 (4d91de4e4 2025-02-17)"
validations:
required: true

- type: input
id: os
attributes:
label: Operating System
description: OS and architecture.
placeholder: "Ubuntu 24.04 x86_64 / macOS 14.5 arm64"
validations:
required: true

- type: textarea
id: description
attributes:
label: Description
description: A clear and concise description of the bug.
validations:
required: true

- type: textarea
id: reproduce
attributes:
label: Steps to Reproduce
description: Minimal steps that reliably reproduce the issue.
placeholder: |
1. Set LOG_FORMAT=json and start the server.
2. Send a POST to /v1/chat/completions with body ...
3. Observe ...
validations:
required: true

- type: textarea
id: expected
attributes:
label: Expected Behaviour
validations:
required: true

- type: textarea
id: actual
attributes:
label: Actual Behaviour
validations:
required: true

- type: textarea
id: logs
attributes:
label: Relevant Log Output
description: Paste log output here. Use RUST_LOG=debug for verbose output. Redact credentials.
render: text

- type: textarea
id: config
attributes:
label: Relevant Configuration
description: Relevant environment variable values (redact secrets).
render: shell

- type: textarea
id: additional
attributes:
label: Additional Context
8 changes: 8 additions & 0 deletions .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
blank_issues_enabled: false
contact_links:
- name: Security Vulnerability
url: https://github.com/CLoaKY233/Valymux/security/advisories/new
about: Report a security vulnerability privately via GitHub Security Advisories.
- name: General Discussion
url: https://github.com/CLoaKY233/Valymux/discussions
about: Ask questions or discuss ideas before opening a formal issue.
63 changes: 63 additions & 0 deletions .github/ISSUE_TEMPLATE/feature_request.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
name: Feature Request
description: Propose a new feature or improvement for ValyMux.
labels: ["enhancement", "needs-triage"]
body:
- type: markdown
attributes:
value: |
Please search existing issues before submitting to avoid duplicates.
Feature requests that include a clear problem statement and use case are
more likely to be considered and prioritised.

- type: textarea
id: problem
attributes:
label: Problem Statement
description: |
Describe the problem or limitation you are experiencing.
Focus on the problem, not the solution.
placeholder: "When I want to route requests to different providers based on model name, I currently have to..."
validations:
required: true

- type: textarea
id: solution
attributes:
label: Proposed Solution
description: |
Describe the solution you have in mind.
If you are unsure about implementation details, a high-level description is fine.
validations:
required: true

- type: textarea
id: alternatives
attributes:
label: Alternatives Considered
description: Other approaches you have considered and why they are insufficient.

- type: dropdown
id: area
attributes:
label: Area
description: Which part of the codebase does this relate to?
options:
- Proxy / Request Forwarding
- Model Routing
- Observability / Metrics / Tracing
- Rate Limiting
- Prompt Management
- Authentication / API Keys
- SurrealDB / Persistence
- Configuration
- Documentation
- CI / Developer Experience
- Other
validations:
required: true

- type: textarea
id: additional
attributes:
label: Additional Context
description: Links to related issues, external specifications, or prior art.
43 changes: 43 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
## Summary

<!-- What does this PR do? One or two sentences. Link the relevant issue if one exists. -->

Closes #

## Type of Change

<!-- Mark the one that applies. -->

- [ ] Bug fix (non-breaking change that fixes an issue)
- [ ] New feature (non-breaking change that adds functionality)
- [ ] Breaking change (fix or feature that would cause existing behaviour to change)
- [ ] Refactor (no behaviour change)
- [ ] Documentation update
- [ ] CI / tooling change

## Changes

<!-- Bullet-point list of what changed and why. -->

-

## Testing

<!-- Describe how you tested this. Include commands if relevant. -->

- [ ] `cargo test` passes
- [ ] `cargo clippy --all-targets --all-features -- -D warnings` passes
- [ ] `cargo fmt --all -- --check` passes
- [ ] Manual testing performed (describe below)

## Checklist

- [ ] I have read the [CONTRIBUTING](../CONTRIBUTING.md) guide.
- [ ] The change is covered by tests or an explanation is provided for why tests are not applicable.
- [ ] Documentation has been updated where necessary (README, CHANGELOG, inline docs).
- [ ] No credentials, keys, or sensitive values are present in the diff.
- [ ] CHANGELOG.md has been updated under `[Unreleased]`.

## Notes for Reviewers

<!-- Anything the reviewer should pay particular attention to. -->
25 changes: 25 additions & 0 deletions .github/workflows/audit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Security Audit

on:
push:
paths:
- Cargo.lock
schedule:
# Run every Monday at 07:00 UTC
- cron: "0 7 * * 1"
workflow_dispatch:

env:
CARGO_TERM_COLOR: always

jobs:
audit:
name: cargo-audit
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- run: cargo install cargo-audit --locked
- run: cargo audit
Comment on lines +22 to +25
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟠 Major

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail
rg -n 'cargo[- ]deny|deny\.toml' .github/workflows

Repository: CLoaKY233/Valymux

Length of output: 43


Add cargo deny check to enforce the new deny.toml policy in CI.

The audit workflow only runs cargo audit. You've added deny.toml for bans, licenses, and source-provenance checks, but nothing in your workflows executes cargo deny check. Add a step to enforce it, otherwise the policy can drift without CI catching it.

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.github/workflows/audit.yml around lines 22 - 25, Add a CI step that
installs and runs cargo-deny to enforce deny.toml: install cargo-deny (e.g., via
cargo install cargo-deny) and run cargo deny check --config deny.toml (or just
cargo deny check if config auto-detected) as a new step in the audit workflow
after the cargo audit step so the deny.toml policy (bans, licenses, provenance)
is validated in CI.

Loading
Loading