snipara-sandbox 2.2.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- snipara_sandbox-2.2.0/.env.example +134 -0
- snipara_sandbox-2.2.0/.gitignore +90 -0
- snipara_sandbox-2.2.0/.pre-commit-config.yaml +32 -0
- snipara_sandbox-2.2.0/CHANGELOG.md +48 -0
- snipara_sandbox-2.2.0/CONTRIBUTING.md +310 -0
- snipara_sandbox-2.2.0/DEPLOYMENT.md +582 -0
- snipara_sandbox-2.2.0/LICENSE +190 -0
- snipara_sandbox-2.2.0/Makefile +89 -0
- snipara_sandbox-2.2.0/PKG-INFO +430 -0
- snipara_sandbox-2.2.0/README.md +366 -0
- snipara_sandbox-2.2.0/ROADMAP.md +197 -0
- snipara_sandbox-2.2.0/SECURITY.md +443 -0
- snipara_sandbox-2.2.0/docker/Dockerfile +30 -0
- snipara_sandbox-2.2.0/docker/docker-compose.yml +38 -0
- snipara_sandbox-2.2.0/docs/API.md +562 -0
- snipara_sandbox-2.2.0/docs/CORE_CONCEPTS.md +299 -0
- snipara_sandbox-2.2.0/docs/RECIPES.md +721 -0
- snipara_sandbox-2.2.0/docs/SNIPARA_READY_CHECKLIST.md +431 -0
- snipara_sandbox-2.2.0/docs/TESTING.md +500 -0
- snipara_sandbox-2.2.0/docs/architecture.md +383 -0
- snipara_sandbox-2.2.0/docs/autonomous-agent.md +533 -0
- snipara_sandbox-2.2.0/docs/configuration.md +269 -0
- snipara_sandbox-2.2.0/docs/mcp-integration.md +315 -0
- snipara_sandbox-2.2.0/docs/quickstart.md +251 -0
- snipara_sandbox-2.2.0/docs/snipara-sandbox-audit-2026-04-29.md +66 -0
- snipara_sandbox-2.2.0/docs/snipara.md +584 -0
- snipara_sandbox-2.2.0/docs/sub-llm-orchestration.md +299 -0
- snipara_sandbox-2.2.0/docs/tools.md +513 -0
- snipara_sandbox-2.2.0/examples/basic_completion.py +50 -0
- snipara_sandbox-2.2.0/examples/data_analysis.py +71 -0
- snipara_sandbox-2.2.0/examples/snipara_integration.py +104 -0
- snipara_sandbox-2.2.0/npm-package/README.md +90 -0
- snipara_sandbox-2.2.0/npm-package/package.json +49 -0
- snipara_sandbox-2.2.0/npm-package/src/index.ts +387 -0
- snipara_sandbox-2.2.0/npm-package/tsconfig.json +18 -0
- snipara_sandbox-2.2.0/pyproject.toml +134 -0
- snipara_sandbox-2.2.0/scripts/docker-start.sh +61 -0
- snipara_sandbox-2.2.0/scripts/docker-stop.sh +13 -0
- snipara_sandbox-2.2.0/scripts/install.sh +62 -0
- snipara_sandbox-2.2.0/src/rlm/__init__.py +42 -0
- snipara_sandbox-2.2.0/src/rlm/agent/__init__.py +10 -0
- snipara_sandbox-2.2.0/src/rlm/agent/config.py +36 -0
- snipara_sandbox-2.2.0/src/rlm/agent/guardrails.py +34 -0
- snipara_sandbox-2.2.0/src/rlm/agent/prompts.py +77 -0
- snipara_sandbox-2.2.0/src/rlm/agent/result.py +44 -0
- snipara_sandbox-2.2.0/src/rlm/agent/runner.py +257 -0
- snipara_sandbox-2.2.0/src/rlm/agent/terminal.py +90 -0
- snipara_sandbox-2.2.0/src/rlm/backends/__init__.py +11 -0
- snipara_sandbox-2.2.0/src/rlm/backends/base.py +137 -0
- snipara_sandbox-2.2.0/src/rlm/backends/litellm.py +292 -0
- snipara_sandbox-2.2.0/src/rlm/cli/__init__.py +5 -0
- snipara_sandbox-2.2.0/src/rlm/cli/main.py +1140 -0
- snipara_sandbox-2.2.0/src/rlm/core/__init__.py +77 -0
- snipara_sandbox-2.2.0/src/rlm/core/config.py +348 -0
- snipara_sandbox-2.2.0/src/rlm/core/exceptions.py +603 -0
- snipara_sandbox-2.2.0/src/rlm/core/orchestrator.py +735 -0
- snipara_sandbox-2.2.0/src/rlm/core/pricing.py +123 -0
- snipara_sandbox-2.2.0/src/rlm/core/types.py +274 -0
- snipara_sandbox-2.2.0/src/rlm/logging/__init__.py +5 -0
- snipara_sandbox-2.2.0/src/rlm/logging/trajectory.py +268 -0
- snipara_sandbox-2.2.0/src/rlm/mcp/__init__.py +5 -0
- snipara_sandbox-2.2.0/src/rlm/mcp/auth.py +240 -0
- snipara_sandbox-2.2.0/src/rlm/mcp/server.py +831 -0
- snipara_sandbox-2.2.0/src/rlm/repl/__init__.py +27 -0
- snipara_sandbox-2.2.0/src/rlm/repl/base.py +63 -0
- snipara_sandbox-2.2.0/src/rlm/repl/docker.py +331 -0
- snipara_sandbox-2.2.0/src/rlm/repl/local.py +402 -0
- snipara_sandbox-2.2.0/src/rlm/repl/localdev.py +434 -0
- snipara_sandbox-2.2.0/src/rlm/repl/safety.py +174 -0
- snipara_sandbox-2.2.0/src/rlm/repl/wasm.py +340 -0
- snipara_sandbox-2.2.0/src/rlm/tools/__init__.py +9 -0
- snipara_sandbox-2.2.0/src/rlm/tools/base.py +5 -0
- snipara_sandbox-2.2.0/src/rlm/tools/builtin/__init__.py +318 -0
- snipara_sandbox-2.2.0/src/rlm/tools/registry.py +120 -0
- snipara_sandbox-2.2.0/src/rlm/tools/snipara.py +1033 -0
- snipara_sandbox-2.2.0/src/rlm/tools/sub_llm.py +329 -0
- snipara_sandbox-2.2.0/src/rlm/visualizer/__init__.py +14 -0
- snipara_sandbox-2.2.0/src/rlm/visualizer/app.py +412 -0
- snipara_sandbox-2.2.0/src/snipara_sandbox/__init__.py +35 -0
- snipara_sandbox-2.2.0/src/snipara_sandbox/mcp/__init__.py +3 -0
- snipara_sandbox-2.2.0/src/snipara_sandbox/mcp/server.py +3 -0
- snipara_sandbox-2.2.0/src/snipara_sandbox/visualizer/__init__.py +3 -0
- snipara_sandbox-2.2.0/src/snipara_sandbox/visualizer/app.py +3 -0
- snipara_sandbox-2.2.0/uv.lock +3532 -0
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
# Environment Variables Template
|
|
2
|
+
|
|
3
|
+
# Copy this file to .env and fill in your values
|
|
4
|
+
|
|
5
|
+
# ==============================================================================
|
|
6
|
+
# Core Configuration
|
|
7
|
+
# ==============================================================================
|
|
8
|
+
|
|
9
|
+
# LLM Backend: litellm, openai, anthropic
|
|
10
|
+
# RLM_BACKEND=litellm
|
|
11
|
+
|
|
12
|
+
# Model identifier (e.g., gpt-4o-mini, claude-3-sonnet-20240229)
|
|
13
|
+
# RLM_MODEL=gpt-4o-mini
|
|
14
|
+
|
|
15
|
+
# Temperature: 0.0-2.0 (lower = more deterministic)
|
|
16
|
+
# RLM_TEMPERATURE=0.0
|
|
17
|
+
|
|
18
|
+
# API Key (or use provider-specific env vars like OPENAI_API_KEY)
|
|
19
|
+
# RLM_API_KEY=
|
|
20
|
+
|
|
21
|
+
# ==============================================================================
|
|
22
|
+
# Execution Environment
|
|
23
|
+
# ==============================================================================
|
|
24
|
+
|
|
25
|
+
# Environment: local, docker, wasm
|
|
26
|
+
# RLM_ENVIRONMENT=local
|
|
27
|
+
|
|
28
|
+
# ==============================================================================
|
|
29
|
+
# Resource Limits
|
|
30
|
+
# ==============================================================================
|
|
31
|
+
|
|
32
|
+
# Maximum recursion depth
|
|
33
|
+
# RLM_MAX_DEPTH=4
|
|
34
|
+
|
|
35
|
+
# Maximum tool calls per completion
|
|
36
|
+
# RLM_MAX_SUBCALLS=12
|
|
37
|
+
|
|
38
|
+
# Token budget per completion
|
|
39
|
+
# RLM_TOKEN_BUDGET=8000
|
|
40
|
+
|
|
41
|
+
# Maximum tool calls budget
|
|
42
|
+
# RLM_TOOL_BUDGET=20
|
|
43
|
+
|
|
44
|
+
# Timeout in seconds
|
|
45
|
+
# RLM_TIMEOUT_SECONDS=120
|
|
46
|
+
|
|
47
|
+
# ==============================================================================
|
|
48
|
+
# Parallel Execution
|
|
49
|
+
# ==============================================================================
|
|
50
|
+
|
|
51
|
+
# Enable parallel tool execution
|
|
52
|
+
# RLM_PARALLEL_TOOLS=false
|
|
53
|
+
|
|
54
|
+
# Maximum concurrent tool executions
|
|
55
|
+
# RLM_MAX_PARALLEL=5
|
|
56
|
+
|
|
57
|
+
# ==============================================================================
|
|
58
|
+
# Docker Configuration (when RLM_ENVIRONMENT=docker)
|
|
59
|
+
# ==============================================================================
|
|
60
|
+
|
|
61
|
+
# Docker image to use
|
|
62
|
+
# RLM_DOCKER_IMAGE=python:3.11-slim
|
|
63
|
+
|
|
64
|
+
# CPU limit (e.g., 1.0, 2.0)
|
|
65
|
+
# RLM_DOCKER_CPUS=1.0
|
|
66
|
+
|
|
67
|
+
# Memory limit (e.g., 512m, 1g, 2g)
|
|
68
|
+
# RLM_DOCKER_MEMORY=512m
|
|
69
|
+
|
|
70
|
+
# Disable network access (recommended: true)
|
|
71
|
+
# RLM_DOCKER_NETWORK_DISABLED=true
|
|
72
|
+
|
|
73
|
+
# Docker exec timeout
|
|
74
|
+
# RLM_DOCKER_TIMEOUT=30
|
|
75
|
+
|
|
76
|
+
# ==============================================================================
|
|
77
|
+
# Logging Configuration
|
|
78
|
+
# ==============================================================================
|
|
79
|
+
|
|
80
|
+
# Log directory
|
|
81
|
+
# RLM_LOG_DIR=./logs
|
|
82
|
+
|
|
83
|
+
# Verbose output
|
|
84
|
+
# RLM_VERBOSE=false
|
|
85
|
+
|
|
86
|
+
# Log level: DEBUG, INFO, WARNING, ERROR
|
|
87
|
+
# RLM_LOG_LEVEL=INFO
|
|
88
|
+
|
|
89
|
+
# ==============================================================================
|
|
90
|
+
# Security Configuration
|
|
91
|
+
# ==============================================================================
|
|
92
|
+
|
|
93
|
+
# Allowed file paths (comma-separated, empty = current directory only)
|
|
94
|
+
# RLM_ALLOWED_PATHS=
|
|
95
|
+
|
|
96
|
+
# ==============================================================================
|
|
97
|
+
# Snipara Configuration (Optional but Recommended)
|
|
98
|
+
# ==============================================================================
|
|
99
|
+
|
|
100
|
+
# Snipara API key (get from https://snipara.com/dashboard)
|
|
101
|
+
# SNIPARA_API_KEY=
|
|
102
|
+
|
|
103
|
+
# Snipara project slug
|
|
104
|
+
# SNIPARA_PROJECT_SLUG=
|
|
105
|
+
|
|
106
|
+
# Snipara base URL (default: https://api.snipara.com/mcp)
|
|
107
|
+
# SNIPARA_BASE_URL=https://api.snipara.com/mcp
|
|
108
|
+
|
|
109
|
+
# Enable memory tools (Tier 2: rlm_remember, rlm_recall, etc.)
|
|
110
|
+
# RLM_MEMORY_ENABLED=false
|
|
111
|
+
|
|
112
|
+
# ==============================================================================
|
|
113
|
+
# Provider-Specific API Keys (Optional)
|
|
114
|
+
# ==============================================================================
|
|
115
|
+
|
|
116
|
+
# OpenAI
|
|
117
|
+
# OPENAI_API_KEY=
|
|
118
|
+
|
|
119
|
+
# Anthropic
|
|
120
|
+
# ANTHROPIC_API_KEY=
|
|
121
|
+
|
|
122
|
+
# Google Vertex AI
|
|
123
|
+
# GOOGLE_API_KEY=
|
|
124
|
+
# GOOGLE_APPLICATION_CREDENTIALS=
|
|
125
|
+
|
|
126
|
+
# AWS Bedrock
|
|
127
|
+
# AWS_ACCESS_KEY_ID=
|
|
128
|
+
# AWS_SECRET_ACCESS_KEY=
|
|
129
|
+
# AWS_REGION_NAME=us-east-1
|
|
130
|
+
|
|
131
|
+
# Azure OpenAI
|
|
132
|
+
# AZURE_API_KEY=
|
|
133
|
+
# AZURE_API_BASE=
|
|
134
|
+
# AZURE_API_VERSION=2023-05-15
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
# Byte-compiled / optimized / DLL files
|
|
2
|
+
__pycache__/
|
|
3
|
+
*.py[cod]
|
|
4
|
+
*$py.class
|
|
5
|
+
|
|
6
|
+
# C extensions
|
|
7
|
+
*.so
|
|
8
|
+
|
|
9
|
+
# Distribution / packaging
|
|
10
|
+
.Python
|
|
11
|
+
build/
|
|
12
|
+
develop-eggs/
|
|
13
|
+
dist/
|
|
14
|
+
downloads/
|
|
15
|
+
eggs/
|
|
16
|
+
.eggs/
|
|
17
|
+
lib/
|
|
18
|
+
lib64/
|
|
19
|
+
parts/
|
|
20
|
+
sdist/
|
|
21
|
+
var/
|
|
22
|
+
wheels/
|
|
23
|
+
*.egg-info/
|
|
24
|
+
.installed.cfg
|
|
25
|
+
*.egg
|
|
26
|
+
|
|
27
|
+
# PyInstaller
|
|
28
|
+
*.manifest
|
|
29
|
+
*.spec
|
|
30
|
+
|
|
31
|
+
# Installer logs
|
|
32
|
+
pip-log.txt
|
|
33
|
+
pip-delete-this-directory.txt
|
|
34
|
+
|
|
35
|
+
# Unit test / coverage reports
|
|
36
|
+
htmlcov/
|
|
37
|
+
.tox/
|
|
38
|
+
.nox/
|
|
39
|
+
.coverage
|
|
40
|
+
.coverage.*
|
|
41
|
+
.cache
|
|
42
|
+
nosetests.xml
|
|
43
|
+
coverage.xml
|
|
44
|
+
*.cover
|
|
45
|
+
*.py,cover
|
|
46
|
+
.hypothesis/
|
|
47
|
+
.pytest_cache/
|
|
48
|
+
|
|
49
|
+
# Translations
|
|
50
|
+
*.mo
|
|
51
|
+
*.pot
|
|
52
|
+
|
|
53
|
+
# Environments
|
|
54
|
+
.env
|
|
55
|
+
.env.local
|
|
56
|
+
.venv
|
|
57
|
+
env/
|
|
58
|
+
venv/
|
|
59
|
+
ENV/
|
|
60
|
+
|
|
61
|
+
# IDE
|
|
62
|
+
.idea/
|
|
63
|
+
.vscode/
|
|
64
|
+
*.swp
|
|
65
|
+
*.swo
|
|
66
|
+
*~
|
|
67
|
+
|
|
68
|
+
# mypy
|
|
69
|
+
.mypy_cache/
|
|
70
|
+
.dmypy.json
|
|
71
|
+
dmypy.json
|
|
72
|
+
|
|
73
|
+
# ruff
|
|
74
|
+
.ruff_cache/
|
|
75
|
+
|
|
76
|
+
# Logs
|
|
77
|
+
logs/
|
|
78
|
+
*.log
|
|
79
|
+
|
|
80
|
+
# Local config
|
|
81
|
+
rlm.toml
|
|
82
|
+
.rlm/
|
|
83
|
+
.mcp.json
|
|
84
|
+
|
|
85
|
+
# Docker
|
|
86
|
+
.docker/
|
|
87
|
+
|
|
88
|
+
# OS
|
|
89
|
+
.DS_Store
|
|
90
|
+
Thumbs.db
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# Pre-commit hooks for rlm-runtime
|
|
2
|
+
# Install: pip install pre-commit && pre-commit install
|
|
3
|
+
# Manual run: pre-commit run --all-files
|
|
4
|
+
|
|
5
|
+
repos:
|
|
6
|
+
- repo: https://github.com/astral-sh/ruff-pre-commit
|
|
7
|
+
rev: v0.9.2
|
|
8
|
+
hooks:
|
|
9
|
+
# Run the linter
|
|
10
|
+
- id: ruff
|
|
11
|
+
args: [--fix]
|
|
12
|
+
# Run the formatter
|
|
13
|
+
- id: ruff-format
|
|
14
|
+
|
|
15
|
+
- repo: https://github.com/pre-commit/pre-commit-hooks
|
|
16
|
+
rev: v5.0.0
|
|
17
|
+
hooks:
|
|
18
|
+
- id: trailing-whitespace
|
|
19
|
+
- id: end-of-file-fixer
|
|
20
|
+
- id: check-yaml
|
|
21
|
+
- id: check-added-large-files
|
|
22
|
+
- id: check-merge-conflict
|
|
23
|
+
|
|
24
|
+
- repo: local
|
|
25
|
+
hooks:
|
|
26
|
+
- id: pytest-quick
|
|
27
|
+
name: pytest (quick smoke test)
|
|
28
|
+
entry: pytest tests/unit/ -x -q --no-cov
|
|
29
|
+
language: system
|
|
30
|
+
pass_filenames: false
|
|
31
|
+
always_run: true
|
|
32
|
+
stages: [pre-push] # Only run on push, not every commit
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
## [2.2.0] - 2026-05-11
|
|
6
|
+
|
|
7
|
+
### Changed
|
|
8
|
+
|
|
9
|
+
- Renamed the published Python distribution to `snipara-sandbox`.
|
|
10
|
+
- Added the `snipara-sandbox` CLI while keeping `rlm` as a legacy command alias.
|
|
11
|
+
- Added the `snipara_sandbox` Python import surface while keeping `rlm` imports compatible.
|
|
12
|
+
- Renamed public MCP server identity and agent tools to Snipara-first names, with legacy `rlm_*` aliases retained.
|
|
13
|
+
- Switched generated API key examples to the `snp-` prefix.
|
|
14
|
+
- Updated documentation, install scripts, and package metadata for the `Snipara/snipara-sandbox` repository.
|
|
15
|
+
|
|
16
|
+
## [2.1.3] - 2026-04-29
|
|
17
|
+
|
|
18
|
+
### Added
|
|
19
|
+
|
|
20
|
+
- `snipara-sandbox config show` for inspecting the effective runtime configuration.
|
|
21
|
+
- `--json` output for `snipara-sandbox config show`.
|
|
22
|
+
|
|
23
|
+
### Changed
|
|
24
|
+
|
|
25
|
+
- Added documentation links for the config inspection command in the README and configuration guide.
|
|
26
|
+
- Bumped the package version to `2.1.3` for release.
|
|
27
|
+
|
|
28
|
+
## [2.1.2] - 2026-04-29
|
|
29
|
+
|
|
30
|
+
### Fixed
|
|
31
|
+
|
|
32
|
+
- `rlm --version` now works from the root CLI entrypoint.
|
|
33
|
+
- CLI version output now reflects the source version and the installed package version when they differ.
|
|
34
|
+
- Project `.env` files are loaded automatically by the CLI and config loader, so `snipara-sandbox doctor` and `snipara-sandbox run` no longer depend on manual `source .env`.
|
|
35
|
+
- Failed runs now return non-zero exit codes instead of reporting `success: true`.
|
|
36
|
+
- CLI JSON mode now emits clean JSON without debug logs mixed into stdout.
|
|
37
|
+
- `--max-depth 0` is rejected immediately with a clear error.
|
|
38
|
+
|
|
39
|
+
### Changed
|
|
40
|
+
|
|
41
|
+
- Added explicit failure propagation to `RLMResult`.
|
|
42
|
+
- Added tests covering CLI version handling, `.env` loading, JSON output, and max-depth validation.
|
|
43
|
+
- Documented the confirmed bugs, fixes, and remaining notes in `docs/snipara-sandbox-audit-2026-04-29.md`.
|
|
44
|
+
|
|
45
|
+
### Notes
|
|
46
|
+
|
|
47
|
+
- `--max-depth 1` is still a tight setting and may fail on prompts that need at least one extra recursive or tool step.
|
|
48
|
+
- The repository's GitHub release workflow attempted trusted publishing, but PyPI rejected the repo as an invalid trusted publisher. The `2.1.2` package was published successfully with the existing local PyPI token fallback.
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
# Contributing to Snipara Sandbox
|
|
2
|
+
|
|
3
|
+
Thank you for your interest in contributing to Snipara Sandbox! This document provides guidelines and information for contributors.
|
|
4
|
+
|
|
5
|
+
## Code of Conduct
|
|
6
|
+
|
|
7
|
+
By participating in this project, you agree to maintain a respectful and inclusive environment for everyone.
|
|
8
|
+
|
|
9
|
+
## Getting Started
|
|
10
|
+
|
|
11
|
+
### Development Setup
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
# Clone the repository
|
|
15
|
+
git clone https://github.com/Snipara/snipara-sandbox
|
|
16
|
+
cd snipara-sandbox
|
|
17
|
+
|
|
18
|
+
# Create a virtual environment
|
|
19
|
+
python -m venv venv
|
|
20
|
+
source venv/bin/activate # On Windows: venv\Scripts\activate
|
|
21
|
+
|
|
22
|
+
# Install development dependencies
|
|
23
|
+
pip install -e ".[dev]"
|
|
24
|
+
|
|
25
|
+
# Verify setup
|
|
26
|
+
snipara-sandbox doctor
|
|
27
|
+
pytest
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
### Project Structure
|
|
31
|
+
|
|
32
|
+
```
|
|
33
|
+
snipara-sandbox/
|
|
34
|
+
├── src/rlm/
|
|
35
|
+
│ ├── backends/ # LLM backend adapters
|
|
36
|
+
│ ├── cli/ # Command-line interface
|
|
37
|
+
│ ├── core/ # Core orchestrator and types
|
|
38
|
+
│ ├── logging/ # Trajectory logging
|
|
39
|
+
│ ├── mcp/ # MCP server for Claude
|
|
40
|
+
│ ├── repl/ # REPL environments (local, docker, wasm)
|
|
41
|
+
│ ├── tools/ # Builtin tools and registry
|
|
42
|
+
│ └── visualizer/ # Trajectory visualizer
|
|
43
|
+
├── tests/ # Test suite
|
|
44
|
+
├── docs/ # Documentation
|
|
45
|
+
└── examples/ # Example scripts
|
|
46
|
+
```
|
|
47
|
+
|
|
48
|
+
## Development Workflow
|
|
49
|
+
|
|
50
|
+
### 1. Create a Branch
|
|
51
|
+
|
|
52
|
+
```bash
|
|
53
|
+
git checkout -b feature/your-feature-name
|
|
54
|
+
# or
|
|
55
|
+
git checkout -b fix/your-bug-fix
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
### 2. Make Changes
|
|
59
|
+
|
|
60
|
+
Follow these guidelines:
|
|
61
|
+
|
|
62
|
+
- Write clear, readable code
|
|
63
|
+
- Add type hints to all functions
|
|
64
|
+
- Include docstrings for public APIs
|
|
65
|
+
- Update tests for new functionality
|
|
66
|
+
- Update documentation as needed
|
|
67
|
+
|
|
68
|
+
### 3. Run Tests
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
# Run all tests
|
|
72
|
+
pytest
|
|
73
|
+
|
|
74
|
+
# Run with coverage
|
|
75
|
+
pytest --cov=rlm --cov-report=html
|
|
76
|
+
|
|
77
|
+
# Run specific tests
|
|
78
|
+
pytest tests/unit/test_repl_local.py
|
|
79
|
+
|
|
80
|
+
# Run tests matching a pattern
|
|
81
|
+
pytest -k "test_execute"
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
### 4. Lint and Format
|
|
85
|
+
|
|
86
|
+
```bash
|
|
87
|
+
# Check linting
|
|
88
|
+
ruff check src/
|
|
89
|
+
|
|
90
|
+
# Auto-fix issues
|
|
91
|
+
ruff check --fix src/
|
|
92
|
+
|
|
93
|
+
# Check formatting
|
|
94
|
+
ruff format --check src/
|
|
95
|
+
|
|
96
|
+
# Auto-format
|
|
97
|
+
ruff format src/
|
|
98
|
+
|
|
99
|
+
# Type checking
|
|
100
|
+
mypy src/
|
|
101
|
+
```
|
|
102
|
+
|
|
103
|
+
### 5. Commit Changes
|
|
104
|
+
|
|
105
|
+
Write clear commit messages:
|
|
106
|
+
|
|
107
|
+
```bash
|
|
108
|
+
# Good commit messages
|
|
109
|
+
git commit -m "Add WebAssembly REPL using Pyodide"
|
|
110
|
+
git commit -m "Fix token counting in recursive completion"
|
|
111
|
+
git commit -m "Update configuration documentation"
|
|
112
|
+
|
|
113
|
+
# Bad commit messages
|
|
114
|
+
git commit -m "Fix stuff"
|
|
115
|
+
git commit -m "WIP"
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
### 6. Submit Pull Request
|
|
119
|
+
|
|
120
|
+
1. Push your branch to GitHub
|
|
121
|
+
2. Open a Pull Request against `master`
|
|
122
|
+
3. Fill out the PR template
|
|
123
|
+
4. Wait for CI checks to pass
|
|
124
|
+
5. Request review
|
|
125
|
+
|
|
126
|
+
## Coding Standards
|
|
127
|
+
|
|
128
|
+
### Python Style
|
|
129
|
+
|
|
130
|
+
We follow PEP 8 with these additions:
|
|
131
|
+
|
|
132
|
+
- Line length: 100 characters
|
|
133
|
+
- Use type hints everywhere
|
|
134
|
+
- Use `from __future__ import annotations` for forward references
|
|
135
|
+
|
|
136
|
+
```python
|
|
137
|
+
from __future__ import annotations
|
|
138
|
+
|
|
139
|
+
def process_data(
|
|
140
|
+
items: list[str],
|
|
141
|
+
options: dict[str, Any] | None = None,
|
|
142
|
+
) -> ProcessResult:
|
|
143
|
+
"""Process a list of items.
|
|
144
|
+
|
|
145
|
+
Args:
|
|
146
|
+
items: List of items to process
|
|
147
|
+
options: Optional processing options
|
|
148
|
+
|
|
149
|
+
Returns:
|
|
150
|
+
ProcessResult with the processed data
|
|
151
|
+
|
|
152
|
+
Raises:
|
|
153
|
+
ValueError: If items is empty
|
|
154
|
+
"""
|
|
155
|
+
if not items:
|
|
156
|
+
raise ValueError("Items cannot be empty")
|
|
157
|
+
...
|
|
158
|
+
```
|
|
159
|
+
|
|
160
|
+
### Documentation Style
|
|
161
|
+
|
|
162
|
+
Use Google-style docstrings:
|
|
163
|
+
|
|
164
|
+
```python
|
|
165
|
+
def example_function(param1: str, param2: int = 10) -> dict[str, Any]:
|
|
166
|
+
"""Short description of the function.
|
|
167
|
+
|
|
168
|
+
Longer description if needed. Can span multiple lines
|
|
169
|
+
and include examples.
|
|
170
|
+
|
|
171
|
+
Args:
|
|
172
|
+
param1: Description of param1
|
|
173
|
+
param2: Description of param2
|
|
174
|
+
|
|
175
|
+
Returns:
|
|
176
|
+
Description of return value
|
|
177
|
+
|
|
178
|
+
Raises:
|
|
179
|
+
ValueError: When param1 is invalid
|
|
180
|
+
|
|
181
|
+
Example:
|
|
182
|
+
```python
|
|
183
|
+
result = example_function("test", 20)
|
|
184
|
+
print(result)
|
|
185
|
+
```
|
|
186
|
+
"""
|
|
187
|
+
```
|
|
188
|
+
|
|
189
|
+
### Testing Standards
|
|
190
|
+
|
|
191
|
+
- Write tests for all new functionality
|
|
192
|
+
- Use descriptive test names
|
|
193
|
+
- Use fixtures for common setup
|
|
194
|
+
- Test both success and error cases
|
|
195
|
+
|
|
196
|
+
```python
|
|
197
|
+
import pytest
|
|
198
|
+
from snipara_sandbox.repl.local import LocalREPL
|
|
199
|
+
|
|
200
|
+
@pytest.fixture
|
|
201
|
+
def repl():
|
|
202
|
+
return LocalREPL(timeout=30)
|
|
203
|
+
|
|
204
|
+
@pytest.mark.asyncio
|
|
205
|
+
async def test_execute_simple_code(repl):
|
|
206
|
+
"""Test executing simple Python code."""
|
|
207
|
+
result = await repl.execute("print(2 + 2)")
|
|
208
|
+
assert result.output.strip() == "4"
|
|
209
|
+
assert result.error is None
|
|
210
|
+
|
|
211
|
+
@pytest.mark.asyncio
|
|
212
|
+
async def test_execute_with_syntax_error(repl):
|
|
213
|
+
"""Test that syntax errors are handled properly."""
|
|
214
|
+
result = await repl.execute("print(")
|
|
215
|
+
assert result.error is not None
|
|
216
|
+
assert "SyntaxError" in result.error
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Priority Areas
|
|
220
|
+
|
|
221
|
+
We welcome contributions in these areas:
|
|
222
|
+
|
|
223
|
+
### High Priority
|
|
224
|
+
|
|
225
|
+
1. **Test Coverage** - Help us reach 90%+ coverage
|
|
226
|
+
2. **Documentation** - Improve guides and examples
|
|
227
|
+
3. **Bug Fixes** - Fix reported issues
|
|
228
|
+
|
|
229
|
+
### Medium Priority
|
|
230
|
+
|
|
231
|
+
4. **WebAssembly REPL** - Improve Pyodide integration
|
|
232
|
+
5. **New Tools** - Create useful community tools
|
|
233
|
+
6. **Performance** - Optimize token usage and latency
|
|
234
|
+
|
|
235
|
+
### Low Priority
|
|
236
|
+
|
|
237
|
+
7. **New Backends** - Add support for more LLM providers
|
|
238
|
+
8. **Observability** - Add metrics and tracing
|
|
239
|
+
|
|
240
|
+
## Reporting Issues
|
|
241
|
+
|
|
242
|
+
### Bug Reports
|
|
243
|
+
|
|
244
|
+
Include:
|
|
245
|
+
- Python version
|
|
246
|
+
- Snipara Sandbox version (`snipara-sandbox version`)
|
|
247
|
+
- Steps to reproduce
|
|
248
|
+
- Expected vs actual behavior
|
|
249
|
+
- Error messages/logs
|
|
250
|
+
|
|
251
|
+
### Feature Requests
|
|
252
|
+
|
|
253
|
+
Include:
|
|
254
|
+
- Use case description
|
|
255
|
+
- Proposed solution
|
|
256
|
+
- Alternatives considered
|
|
257
|
+
|
|
258
|
+
## Pull Request Guidelines
|
|
259
|
+
|
|
260
|
+
### PR Title Format
|
|
261
|
+
|
|
262
|
+
```
|
|
263
|
+
type: short description
|
|
264
|
+
|
|
265
|
+
Examples:
|
|
266
|
+
feat: add streaming support for completions
|
|
267
|
+
fix: handle empty response from LLM
|
|
268
|
+
docs: update configuration guide
|
|
269
|
+
test: add tests for Docker REPL
|
|
270
|
+
refactor: simplify tool registry
|
|
271
|
+
```
|
|
272
|
+
|
|
273
|
+
### PR Description Template
|
|
274
|
+
|
|
275
|
+
```markdown
|
|
276
|
+
## Summary
|
|
277
|
+
Brief description of changes
|
|
278
|
+
|
|
279
|
+
## Changes
|
|
280
|
+
- List of specific changes
|
|
281
|
+
- Another change
|
|
282
|
+
|
|
283
|
+
## Testing
|
|
284
|
+
How was this tested?
|
|
285
|
+
|
|
286
|
+
## Checklist
|
|
287
|
+
- [ ] Tests pass locally
|
|
288
|
+
- [ ] Linting passes
|
|
289
|
+
- [ ] Documentation updated
|
|
290
|
+
- [ ] Type hints added
|
|
291
|
+
```
|
|
292
|
+
|
|
293
|
+
## Release Process
|
|
294
|
+
|
|
295
|
+
Releases are managed by maintainers:
|
|
296
|
+
|
|
297
|
+
1. Update version in `pyproject.toml`
|
|
298
|
+
2. Update CHANGELOG.md
|
|
299
|
+
3. Create GitHub release
|
|
300
|
+
4. CI automatically publishes to PyPI
|
|
301
|
+
|
|
302
|
+
## Getting Help
|
|
303
|
+
|
|
304
|
+
- **Questions**: Open a GitHub Discussion
|
|
305
|
+
- **Bugs**: Open a GitHub Issue
|
|
306
|
+
- **Security**: Email security@snipara.com
|
|
307
|
+
|
|
308
|
+
## License
|
|
309
|
+
|
|
310
|
+
By contributing, you agree that your contributions will be licensed under the Apache 2.0 License.
|