veris-ai 1.17.1__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.
Files changed (49) hide show
  1. veris_ai-1.17.1/.cursor/rules/documentation-management.mdc +82 -0
  2. veris_ai-1.17.1/.github/workflows/release.yml +45 -0
  3. veris_ai-1.17.1/.github/workflows/test.yml +44 -0
  4. veris_ai-1.17.1/.gitignore +132 -0
  5. veris_ai-1.17.1/.pre-commit-config.yaml +24 -0
  6. veris_ai-1.17.1/CHANGELOG.md +13 -0
  7. veris_ai-1.17.1/CLAUDE.md +285 -0
  8. veris_ai-1.17.1/LICENSE +21 -0
  9. veris_ai-1.17.1/PKG-INFO +466 -0
  10. veris_ai-1.17.1/README.md +425 -0
  11. veris_ai-1.17.1/examples/README.md +124 -0
  12. veris_ai-1.17.1/examples/__init__.py +1 -0
  13. veris_ai-1.17.1/examples/import_options.py +69 -0
  14. veris_ai-1.17.1/examples/openai_agents_example.py +183 -0
  15. veris_ai-1.17.1/pyproject.toml +179 -0
  16. veris_ai-1.17.1/src/veris_ai/README.md +94 -0
  17. veris_ai-1.17.1/src/veris_ai/__init__.py +61 -0
  18. veris_ai-1.17.1/src/veris_ai/agents_wrapper.py +322 -0
  19. veris_ai-1.17.1/src/veris_ai/api_client.py +158 -0
  20. veris_ai-1.17.1/src/veris_ai/context_vars.py +23 -0
  21. veris_ai-1.17.1/src/veris_ai/jaeger_interface/README.md +101 -0
  22. veris_ai-1.17.1/src/veris_ai/jaeger_interface/__init__.py +39 -0
  23. veris_ai-1.17.1/src/veris_ai/jaeger_interface/client.py +236 -0
  24. veris_ai-1.17.1/src/veris_ai/jaeger_interface/models.py +78 -0
  25. veris_ai-1.17.1/src/veris_ai/logfire_config.py +164 -0
  26. veris_ai-1.17.1/src/veris_ai/models.py +28 -0
  27. veris_ai-1.17.1/src/veris_ai/observability.py +114 -0
  28. veris_ai-1.17.1/src/veris_ai/tool_mock.py +746 -0
  29. veris_ai-1.17.1/src/veris_ai/utils.py +664 -0
  30. veris_ai-1.17.1/tests/README.md +108 -0
  31. veris_ai-1.17.1/tests/__init__.py +1 -0
  32. veris_ai-1.17.1/tests/conftest.py +63 -0
  33. veris_ai-1.17.1/tests/fixtures/__init__.py +1 -0
  34. veris_ai-1.17.1/tests/fixtures/http_server.py +116 -0
  35. veris_ai-1.17.1/tests/fixtures/simple_app.py +66 -0
  36. veris_ai-1.17.1/tests/test_agents_wrapper_extract.py +163 -0
  37. veris_ai-1.17.1/tests/test_agents_wrapper_simple.py +293 -0
  38. veris_ai-1.17.1/tests/test_api_client.py +78 -0
  39. veris_ai-1.17.1/tests/test_class_callbacks.py +182 -0
  40. veris_ai-1.17.1/tests/test_external_callbacks.py +377 -0
  41. veris_ai-1.17.1/tests/test_helpers.py +23 -0
  42. veris_ai-1.17.1/tests/test_logfire_config.py +234 -0
  43. veris_ai-1.17.1/tests/test_mcp_protocol_server_mocked.py +200 -0
  44. veris_ai-1.17.1/tests/test_side_effects.py +1304 -0
  45. veris_ai-1.17.1/tests/test_token_decoding.py +132 -0
  46. veris_ai-1.17.1/tests/test_tool_mock.py +653 -0
  47. veris_ai-1.17.1/tests/test_utils.py +467 -0
  48. veris_ai-1.17.1/tests/test_veris_runner_tool_options.py +318 -0
  49. veris_ai-1.17.1/uv.lock +1724 -0
@@ -0,0 +1,82 @@
1
+ ---
2
+ description: Ensure READMEs function as both a human-friendly guide and an LLM semantic router, while designating source code as the sole source of truth. This document also defines LLM workflows that continuously evolve documentation in response to actual usage patterns.
3
+ alwaysApply: false
4
+ ---
5
+
6
+ # Documentation Handling Guidelines
7
+ Ensure READMEs function as both a human-friendly guide and an LLM semantic router, while designating source code as the sole source of truth. This document also defines LLM workflows that continuously evolve documentation in response to actual usage patterns.
8
+
9
+ ### Dual‑Use Overview
10
+
11
+ * **Humans**: READMEs must be narrative‑driven, intuitive, and structured for readability, with inline cross‑links to related READMEs or code modules for deeper context.
12
+ * **LLM Agents**: Treat these same READMEs as semantic routers and exploration waypoints. Use linked references and tags to dynamically navigate through the documentation web, following trails of dependency and discovering emergent patterns — never treat the README as the ultimate logic source.
13
+ * **Shared Goal**: Documentation must actively fight codebase complexity. Instead of growing endlessly, it should simplify, subtract redundancy, and delegate details to lower‑level READMEs in the hierarchy.
14
+
15
+ ---
16
+
17
+ ### When to Update Documentation
18
+
19
+ Trigger updates upon significant changes including:
20
+
21
+ * Major features, refactors, or architectural/schematic changes
22
+ * Workflow updates or dependencies added/removed
23
+ * Changes affecting user interactions or onboarding
24
+
25
+ **Heuristic**: If the change alters how a human would interact or mentally model the system — or how the LLM navigates it — it calls for a README update.
26
+
27
+ Updates should simplify where possible: remove outdated or redundant content, and delegate specifics via cross‑links (e.g., *See [Auth Module README](./auth/README.md) for details on authentication flows*).
28
+
29
+ ---
30
+
31
+ ### LLM‑Driven Continuous Documentation
32
+
33
+ 1. **End‑of‑session reflection**: At task completion, the LLM should summarize the work and, if needed, update the README with clarifications or new links to relevant modules.
34
+ 2. **Parallel instance memory**: Maintain awareness of session context across LLM instances to keep documentation aligned with ongoing workflows.
35
+ 3. **LLM as thought partner**: Propose not only wording edits but also simplifications and delegation opportunities — e.g., linking to an existing module README rather than duplicating logic.
36
+ 4. **Complexity management**: Treat every update as a chance to prune. The README should remain a high‑level, navigable entry point, not a catch‑all.
37
+ 5. **Recursive documentation weaving**: When creating or updating a README, treat it as the entry point to a documentation web. Draft the initial README, then follow every dependency thread—navigating to parent and child READMEs, creating missing pieces, and refining connections. Continue this cyclical exploration until the entire documentation network achieves seamless consistency, with each iteration strengthening the coherence of the whole system.
38
+
39
+ ---
40
+
41
+ ### Structure & Format
42
+
43
+ Each meaningful workspace or module must include a `README.md` designed to operate like a **hub page** in an IDE‑backed website:
44
+
45
+ * **Quick Reference**: Purpose, setup, usage, and high‑level architecture.
46
+ * **Linked Context**: Cross‑links to deeper child READMEs and parent READMEs, design docs, or code directories.
47
+ * **Visual Aids**: Use visual aids (e.g. mermaid diagrams) to as needed to help explain the codebase to humans.
48
+
49
+
50
+ > Example:
51
+ > *“For transaction processing, see [Transactions README](./transactions/README.md). For error handling logic, see [Error Handling README](./errors/README.md).”*
52
+
53
+ The human and LLM share the same document: humans follow the narrative, while the LLM uses references in the LLM to navigate the codebase semantically.
54
+
55
+ ---
56
+
57
+ ### Workflow Roles
58
+
59
+ #### LLM Responsibilities
60
+
61
+ * Detect README drift by comparing live code to described behavior.
62
+ * Perform updates with an emphasis on pruning duplication and linking to existing READMEs.
63
+ * Ensure docs remain aligned with code without ballooning in size.
64
+
65
+ #### Human Responsibilities
66
+
67
+ * Diligently read through *ALL* LLM‑driven documentation updates for clarity, accuracy, and usability.
68
+ * Refactor prose when needed to keep explanations intuitive.
69
+ * Validate that cross‑links resolve correctly and are helpful for navigation.
70
+
71
+ ---
72
+
73
+ ### Key Principles
74
+
75
+ | Principle | Description |
76
+ | -------------------------- | ------------------------------------------------------------------------- |
77
+ | **Code is truth** | Source code is definitive; README is a semantic guide, not the authority. |
78
+ | **Documentation evolves** | Updates happen with real usage, not on a fixed schedule. |
79
+ | **Simplicity over sprawl** | Fight complexity by pruning, delegating, and cross‑linking. |
80
+ | **One README, two roles** | The same README serves both humans and LLMs through cross‑referencing. |
81
+ | **Real‑world grounding** | Updates reflect actual changes in workflows and architecture. |
82
+ | **Human validation** | LLM documentation edits require thorough human driver review to ensure usability and accuracy. |
@@ -0,0 +1,45 @@
1
+ name: Release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+
6
+ jobs:
7
+ release:
8
+ runs-on: ubuntu-latest
9
+ permissions:
10
+ contents: write
11
+ steps:
12
+ - uses: actions/checkout@v4
13
+ with:
14
+ fetch-depth: 0
15
+
16
+ - name: Set up Python
17
+ uses: actions/setup-python@v4
18
+ with:
19
+ python-version: '3.13'
20
+
21
+ - name: Install dependencies
22
+ run: |
23
+ curl -LsSf https://astral.sh/uv/install.sh | sh
24
+ uv sync --all-extras
25
+ uv pip install python-semantic-release
26
+
27
+ - name: Configure Git
28
+ run: |
29
+ git config --global user.name "GitHub Actions"
30
+ git config --global user.email "actions@github.com"
31
+
32
+ - name: Version and Upload Artifacts
33
+ env:
34
+ GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35
+ run: |
36
+ uv run semantic-release version
37
+ uv run semantic-release publish
38
+
39
+ - name: Publish to PyPI if distribution is created
40
+ run: |
41
+ if [ -d "dist" ] && [ "$(ls -A dist)" ]; then
42
+ uv publish --token ${{ secrets.PYPI_API_TOKEN }}
43
+ else
44
+ echo "No distribution files found in dist directory. Skipping PyPI publish."
45
+ fi
@@ -0,0 +1,44 @@
1
+ name: Tests
2
+
3
+ on:
4
+ push:
5
+ branches: [ main ]
6
+ pull_request:
7
+ branches: [ main ]
8
+ workflow_dispatch:
9
+
10
+ jobs:
11
+ test:
12
+ runs-on: ubuntu-latest
13
+ strategy:
14
+ matrix:
15
+ python-version: ["3.11", "3.12", "3.13"]
16
+
17
+ steps:
18
+ - uses: actions/checkout@v4
19
+
20
+ - name: Set up Python ${{ matrix.python-version }}
21
+ uses: actions/setup-python@v5
22
+ with:
23
+ python-version: ${{ matrix.python-version }}
24
+
25
+ - name: Install uv
26
+ run: |
27
+ curl -LsSf https://astral.sh/uv/install.sh | sh
28
+
29
+ - name: Install dependencies
30
+ run: |
31
+ uv sync --all-extras
32
+
33
+ - name: Run code quality checks with Ruff
34
+ run: |
35
+ uv run ruff check .
36
+ uv run ruff format --check .
37
+
38
+ - name: Run type checks with mypy
39
+ run: |
40
+ uv run mypy src/veris_ai
41
+
42
+ - name: Run tests with pytest
43
+ run: |
44
+ uv run pytest tests/ --cov=veris_ai --cov-report=xml --cov-report=term-missing
@@ -0,0 +1,132 @@
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
+ MANIFEST
27
+
28
+ # PyInstaller
29
+ *.manifest
30
+ *.spec
31
+
32
+ # Installer logs
33
+ pip-log.txt
34
+ pip-delete-this-directory.txt
35
+
36
+ # Unit test / coverage reports
37
+ htmlcov/
38
+ .tox/
39
+ .nox/
40
+ .coverage
41
+ .coverage.*
42
+ .cache
43
+ nosetests.xml
44
+ coverage.xml
45
+ *.cover
46
+ .hypothesis/
47
+ .pytest_cache/
48
+
49
+ # Translations
50
+ *.mo
51
+ *.pot
52
+
53
+ # Django stuff:
54
+ *.log
55
+ local_settings.py
56
+ db.sqlite3
57
+
58
+ # Flask stuff:
59
+ instance/
60
+ .webassets-cache
61
+
62
+ # Scrapy stuff:
63
+ .scrapy
64
+
65
+ # Sphinx documentation
66
+ docs/_build/
67
+
68
+ # PyBuilder
69
+ target/
70
+
71
+ # Jupyter Notebook
72
+ .ipynb_checkpoints
73
+
74
+ # IPython
75
+ profile_default/
76
+ ipython_config.py
77
+
78
+ # pyenv
79
+ .python-version
80
+
81
+ # celery beat schedule file
82
+ celerybeat-schedule
83
+
84
+ # SageMath parsed files
85
+ *.sage.py
86
+
87
+ # Environments
88
+ .env
89
+ .venv
90
+ env/
91
+ venv/
92
+ ENV/
93
+ env.bak/
94
+ venv.bak/
95
+
96
+ # Spyder project settings
97
+ .spyderproject
98
+ .spyproject
99
+
100
+ # Rope project settings
101
+ .ropeproject
102
+
103
+ # mkdocs documentation
104
+ /site
105
+
106
+ # mypy
107
+ .mypy_cache/
108
+ .dmypy.json
109
+ dmypy.json
110
+
111
+ # Pyre type checker
112
+ .pyre/
113
+
114
+ # pytype static type analyzer
115
+ .pytype/
116
+
117
+ # Cython debug symbols
118
+ cython_debug/
119
+
120
+ # VS Code
121
+ .vscode/
122
+
123
+ # PyCharm
124
+ .idea/
125
+
126
+ # macOS
127
+ .DS_Store
128
+
129
+ # Windows
130
+ Thumbs.db
131
+
132
+ .scratch/
@@ -0,0 +1,24 @@
1
+ repos:
2
+ - repo: local
3
+ hooks:
4
+ - id: ruff-check
5
+ name: Ruff lint
6
+ entry: uv run ruff check --fix .
7
+ language: system
8
+ pass_filenames: false
9
+ types: [python]
10
+
11
+ - id: ruff-format-check
12
+ name: Ruff format (check)
13
+ entry: uv run ruff format
14
+ language: system
15
+ pass_filenames: false
16
+ types: [python]
17
+
18
+ - id: mypy
19
+ name: Mypy type check
20
+ entry: uv run mypy src/veris_ai
21
+ language: system
22
+ pass_filenames: false
23
+ types: [python]
24
+
@@ -0,0 +1,13 @@
1
+ # CHANGELOG
2
+
3
+ All notable changes to this project will be documented in this file.
4
+
5
+ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6
+ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
+
8
+ ## v0.1.1 (2025-04-17)
9
+
10
+ ### Features
11
+
12
+ - Updates to package for publishing ([#1](https://github.com/veris-ai/veris-python-sdk/pull/1),
13
+ [`c6f460e`](https://github.com/veris-ai/veris-python-sdk/commit/c6f460ea6e2f8472c120370a14f67f1d8c28626c))
@@ -0,0 +1,285 @@
1
+ # CLAUDE.md
2
+
3
+ This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
4
+
5
+ ## Project Overview
6
+
7
+ This is the Veris AI Python SDK - a package that provides simulation capabilities through decorator-based function mocking and FastAPI MCP (Model Context Protocol) integration. The core functionality revolves around:
8
+ - `VerisSDK` class in `src/veris_ai/tool_mock.py:27` - enables environment-aware execution where functions can be mocked in simulation mode, spied on, or executed normally in production
9
+ - `@veris.spy()` decorator - executes original functions while logging calls and responses via logging endpoints
10
+ - `convert_to_type()` function in `src/veris_ai/utils.py:5` - handles sophisticated type conversion from mock responses
11
+ - `FastApiMCPParams` model in `src/veris_ai/models.py:1` - provides configuration for integrating FastAPI applications with the Model Context Protocol
12
+ - `set_fastapi_mcp()` method in `src/veris_ai/tool_mock.py:54` - configures FastAPI MCP server with automatic OAuth2-based session management
13
+ - Logging utilities in `src/veris_ai/logging.py` - provide async and sync functions for logging tool calls and responses to VERIS endpoints
14
+ - `SimulatorAPIClient` class in `src/veris_ai/api_client.py` - centralized client for making requests to VERIS simulation endpoints with automatic authentication
15
+
16
+ ## Development Commands
17
+
18
+ This project uses `uv` as the package manager and follows modern Python tooling practices.
19
+
20
+ ### Setup
21
+ ```bash
22
+ # Install base package
23
+ uv add veris-ai
24
+
25
+ # Install with development dependencies
26
+ uv add "veris-ai[dev]"
27
+
28
+ # Install with FastAPI MCP integration
29
+ uv add "veris-ai[fastapi]"
30
+
31
+ # Install with all extras
32
+ uv add "veris-ai[dev,fastapi,observability,agents]"
33
+
34
+ # Set Python version (requires 3.11+)
35
+ pyenv local 3.11.0
36
+ ```
37
+
38
+ ### Code Quality (Primary: Ruff)
39
+ ```bash
40
+ # Lint code
41
+ ruff check .
42
+
43
+ # Auto-fix linting issues
44
+ ruff check --fix .
45
+
46
+ # Format code
47
+ ruff format .
48
+
49
+ # Check formatting only
50
+ ruff format --check .
51
+ ```
52
+
53
+ ### Type Checking
54
+ ```bash
55
+ # Run static type checking
56
+ mypy src/veris_ai tests
57
+ ```
58
+
59
+ ### Testing
60
+ ```bash
61
+ # Run all tests with coverage
62
+ pytest tests/ --cov=veris_ai --cov-report=xml --cov-report=term-missing
63
+
64
+ # Run specific test file
65
+ pytest tests/test_tool_mock.py
66
+
67
+ # Run tests with verbose output
68
+ pytest -v tests/
69
+ ```
70
+
71
+ ### Building
72
+ ```bash
73
+ # Build package distributions
74
+ uv build
75
+ ```
76
+
77
+ ## Code Architecture
78
+
79
+ ### Core Components
80
+
81
+ **VerisSDK Class** (`src/veris_ai/tool_mock.py:27`)
82
+ - Main SDK class that provides decorator functionality:
83
+ - `@veris.mock()`: Dynamic mocking that calls external endpoints for responses
84
+ - `@veris.stub()`: Simple stubbing with fixed return values
85
+ - `@veris.spy()`: Logging decorator that executes original function and logs the call/response
86
+ - Session-based activation: Uses session ID presence to determine mocking behavior
87
+ - HTTP communication with mock endpoints via `httpx` (for mock decorator)
88
+ - Context extraction for session management via context variables
89
+ - Delegates type conversion to the utils module
90
+ - Automatic API endpoint configuration with production defaults
91
+
92
+ **API Surface** (`src/veris_ai/__init__.py:5`)
93
+ - Exports single `veris` instance for public use
94
+ - Clean, minimal API design
95
+
96
+ **Type Conversion Utilities** (`src/veris_ai/utils.py:1`)
97
+ - `convert_to_type()` function handles sophisticated type conversion from mock responses
98
+ - Supports primitives, lists, dictionaries, unions, and custom types
99
+ - Modular design with separate conversion functions for each type category
100
+ - Uses Python's typing system for runtime type checking
101
+
102
+ **FastAPI MCP Integration** (`src/veris_ai/models.py:1`)
103
+ - `FastApiMCPParams` Pydantic model for configuring FastAPI MCP server integration
104
+ - Comprehensive configuration options including:
105
+ - Custom server naming and descriptions
106
+ - HTTP client configuration (base URL, headers, timeout)
107
+ - Operation filtering (include/exclude by operation ID or tag)
108
+ - Response schema documentation controls
109
+ - Authentication configuration
110
+
111
+ ### Environment Configuration
112
+
113
+ Environment variables:
114
+ - `VERIS_API_KEY`: API authentication key for VERIS services (optional, but recommended for production)
115
+ - `VERIS_MOCK_TIMEOUT`: Request timeout in seconds (optional, default: 90.0)
116
+
117
+ **Note**: The SDK automatically connects to the production VERIS API endpoint (`https://simulation.api.veris.ai/`). Only override `VERIS_API_URL` if you need to use a custom endpoint (rarely needed).
118
+
119
+ ### Session-Based Activation
120
+
121
+ The SDK activates mocking based on session ID presence:
122
+ - **With session ID**: Routes calls to mock/simulator endpoint
123
+ - **Without session ID**: Executes original function
124
+ - Session IDs can be set manually via `veris.set_session_id()` or extracted automatically from OAuth2 tokens in FastAPI MCP integration
125
+
126
+ ### Type System
127
+
128
+ The SDK handles sophisticated type conversion from mock responses:
129
+ - Type conversion is handled by the `convert_to_type()` function in `src/veris_ai/utils.py`
130
+ - Supports primitives, lists, dictionaries, unions, and custom types
131
+ - Modular design with separate handlers for different type categories
132
+ - Uses Python's typing system for runtime type checking
133
+
134
+ ## Testing Strategy
135
+
136
+ **Test Structure**:
137
+ - `tests/conftest.py:1`: Pytest fixtures for environment mocking and context objects
138
+ - `tests/test_tool_mock.py:1`: Unit tests for the VerisSDK class and mock decorator functionality
139
+ - `tests/test_utils.py:1`: Comprehensive tests for type conversion utilities
140
+
141
+ **Key Test Fixtures**:
142
+ - `mock_context`: Provides mock context with session ID
143
+ - `simulation_env`: Sets up simulation mode with session ID
144
+ - `production_env`: Sets up production mode without session ID
145
+
146
+ **Test Coverage Areas**:
147
+ - Environment-based behavior switching
148
+ - HTTP client interactions and error handling
149
+ - Type conversion scenarios (parametrized tests)
150
+ - Configuration validation
151
+
152
+ ## Code Quality Standards
153
+
154
+ **Ruff Configuration** (80+ rules enabled):
155
+ - Line length: 100 characters
156
+ - Target: Python 3.11+
157
+ - Google-style docstring convention
158
+ - Comprehensive rule set covering style, bugs, security, and complexity
159
+ - Relaxed rules for test files (allows more flexibility in tests)
160
+
161
+ **Development Tools**:
162
+ - **Ruff**: Primary linter and formatter (replaces flake8, black, isort)
163
+ - **MyPy**: Static type checking
164
+ - **Pytest**: Testing with async support and coverage
165
+ - **Pre-commit**: Git hooks for code quality
166
+
167
+ ## CI/CD Pipeline
168
+
169
+ **Testing Workflow** (`.github/workflows/test.yml`):
170
+ - Runs on Python 3.11, 3.12, 3.13
171
+ - Code quality checks (Ruff lint/format)
172
+ - Type checking (MyPy)
173
+ - Unit tests with coverage
174
+
175
+ **Release Workflow** (`.github/workflows/release.yml`):
176
+ - Manual trigger for releases
177
+ - Semantic versioning with conventional commits
178
+ - Automated PyPI publishing
179
+ - Uses `uv build` for package building
180
+
181
+ ## Key Implementation Details
182
+
183
+ - **Decorator Pattern**: Functions are wrapped to intercept calls in simulation mode
184
+ - `@veris.mock()`: Sends function metadata to external endpoint for dynamic responses
185
+ - `@veris.stub()`: Returns predetermined values without external calls
186
+ - `@veris.spy()`: Executes original function while logging calls and responses
187
+ - **Session Management**: Extracts session ID from context for request correlation
188
+ - **API Client**: Centralized `SimulatorAPIClient` handles all API communication
189
+ - Automatic endpoint configuration with production defaults
190
+ - Built-in authentication via `VERIS_API_KEY` header
191
+ - Configurable timeout with `VERIS_MOCK_TIMEOUT`
192
+ - **Error Handling**: Comprehensive HTTP and type conversion error handling
193
+ - **Async Support**: Built with async/await pattern throughout
194
+ - **Type Safety**: Full type hints and runtime type conversion validation
195
+ - **Modular Architecture**: Type conversion logic separated into utils module for better maintainability
196
+
197
+ ### FastAPI MCP Integration
198
+
199
+ The `set_fastapi_mcp()` method provides:
200
+ - **Automatic Session Handling**: OAuth2-based session ID extraction from bearer tokens
201
+ - **Context Management**: Session IDs are stored in context variables for cross-request correlation
202
+ - **Auth Config Merging**: User-provided auth configs are merged with internal session handling
203
+ - **MCP Server Access**: Configured server available via `veris.fastapi_mcp` property
204
+
205
+ Key implementation aspects:
206
+ - Creates internal OAuth2PasswordBearer scheme for token extraction
207
+ - Dependency injection for automatic session context setting
208
+ - Preserves user auth configurations while adding session management
209
+ - SSE (Server-Sent Events) support for streaming responses
210
+
211
+ ## Documentation Handling Guidelines
212
+
213
+ ### Dual‑Use Overview
214
+
215
+ * **Humans**: READMEs must be narrative‑driven, intuitive, and structured for readability, with inline cross‑links to related READMEs or code modules for deeper context.
216
+ * **LLM Agents**: Treat these same READMEs as semantic routers. Use linked references and tags within the document to locate the most relevant code, tests, and workflows — never treat the README as the ultimate logic source.
217
+ * **Shared Goal**: Documentation must actively fight codebase complexity. Instead of growing endlessly, it should simplify, subtract redundancy, and delegate details to lower‑level READMEs in the hierarchy.
218
+
219
+ ---
220
+
221
+ ### When to Update Documentation
222
+
223
+ Trigger updates upon significant changes including:
224
+
225
+ * Major features, refactors, or architectural/schematic changes
226
+ * Workflow updates or dependencies added/removed
227
+ * Changes affecting user interactions or onboarding
228
+
229
+ **Heuristic**: If the change alters how a human would interact or mentally model the system — or how the LLM navigates it — it calls for a README update.
230
+
231
+ Updates should simplify where possible: remove outdated or redundant content, and delegate specifics via cross‑links (e.g., *See [Auth Module README](./auth/README.md) for details on authentication flows*).
232
+
233
+ ---
234
+
235
+ ### LLM‑Driven Continuous Documentation
236
+
237
+ 1. **End‑of‑session reflection**: At task completion, the LLM should summarize the work and, if needed, update the README with clarifications or new links to relevant modules.
238
+ 2. **Parallel instance memory**: Maintain awareness of session context across LLM instances to keep documentation aligned with ongoing workflows.
239
+ 3. **LLM as thought partner**: Propose not only wording edits but also simplifications and delegation opportunities — e.g., linking to an existing module README rather than duplicating logic.
240
+ 4. **Complexity management**: Treat every update as a chance to prune. The README should remain a high‑level, navigable entry point, not a catch‑all.
241
+
242
+ ---
243
+
244
+ ### Structure & Format
245
+
246
+ Each meaningful workspace or module must include a `README.md` designed to operate like a **hub page** in an IDE‑backed website:
247
+
248
+ * **Quick Reference**: Purpose, setup, usage, and high‑level architecture.
249
+ * **Linked Context**: Cross‑links to deeper READMEs, design docs, or code directories.
250
+ * **Semantic Anchors**: Inline cues (e.g., tags, headings, links) that help the LLM map concepts to code without requiring redundant prose.
251
+
252
+ > Example:
253
+ > *“For transaction processing, see [Transactions README](./transactions/README.md). For error handling logic, see [Error Handling README](./errors/README.md).”*
254
+
255
+ The human and LLM share the same document: humans follow the narrative, while the LLM uses references and anchors to navigate the codebase semantically.
256
+
257
+ ---
258
+
259
+ ### Workflow Roles
260
+
261
+ #### LLM Responsibilities
262
+
263
+ * Detect README drift by comparing live code to described behavior.
264
+ * Perform updates with an emphasis on pruning duplication and linking to existing READMEs.
265
+ * Use end‑of‑session summaries to suggest or implement simplifications.
266
+ * Ensure docs remain aligned with code without ballooning in size.
267
+
268
+ #### Human Responsibilities
269
+
270
+ * Review LLM‑driven updates for clarity, accuracy, and usability.
271
+ * Refactor prose when needed to keep explanations intuitive.
272
+ * Validate that cross‑links resolve correctly and are helpful for navigation.
273
+
274
+ ---
275
+
276
+ ### Key Principles
277
+
278
+ | Principle | Description |
279
+ | -------------------------- | ------------------------------------------------------------------------- |
280
+ | **Code is truth** | Source code is definitive; README is a semantic guide, not the authority. |
281
+ | **Documentation evolves** | Updates happen with real usage, not on a fixed schedule. |
282
+ | **Simplicity over sprawl** | Fight complexity by pruning, delegating, and cross‑linking. |
283
+ | **One README, two roles** | The same README serves both humans and LLMs through cross‑referencing. |
284
+ | **Real‑world grounding** | Updates reflect actual changes in workflows and architecture. |
285
+ | **Human validation** | LLM edits require human review to ensure usability and accuracy. |
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2024 Veris AI
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.