victor-contracts 0.7.2__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.
- victor_contracts-0.7.2/PKG-INFO +264 -0
- victor_contracts-0.7.2/README.md +229 -0
- victor_contracts-0.7.2/pyproject.toml +98 -0
- victor_contracts-0.7.2/setup.cfg +4 -0
- victor_contracts-0.7.2/victor_contracts/__init__.py +497 -0
- victor_contracts-0.7.2/victor_contracts/agent_spec_runtime.py +46 -0
- victor_contracts-0.7.2/victor_contracts/capabilities/__init__.py +183 -0
- victor_contracts-0.7.2/victor_contracts/capabilities/runtime.py +588 -0
- victor_contracts-0.7.2/victor_contracts/capability_runtime.py +113 -0
- victor_contracts-0.7.2/victor_contracts/chain_runtime.py +29 -0
- victor_contracts-0.7.2/victor_contracts/cli.py +46 -0
- victor_contracts-0.7.2/victor_contracts/constants/__init__.py +34 -0
- victor_contracts-0.7.2/victor_contracts/constants/capability_ids.py +53 -0
- victor_contracts-0.7.2/victor_contracts/constants/tool_names.py +226 -0
- victor_contracts-0.7.2/victor_contracts/conversation.py +400 -0
- victor_contracts-0.7.2/victor_contracts/core/__init__.py +80 -0
- victor_contracts-0.7.2/victor_contracts/core/api_version.py +14 -0
- victor_contracts-0.7.2/victor_contracts/core/capability_contract.py +87 -0
- victor_contracts-0.7.2/victor_contracts/core/exceptions.py +72 -0
- victor_contracts-0.7.2/victor_contracts/core/plugins.py +355 -0
- victor_contracts-0.7.2/victor_contracts/core/types.py +1412 -0
- victor_contracts-0.7.2/victor_contracts/database_runtime.py +24 -0
- victor_contracts-0.7.2/victor_contracts/discovery.py +769 -0
- victor_contracts-0.7.2/victor_contracts/enrichment_runtime.py +61 -0
- victor_contracts-0.7.2/victor_contracts/feature_flag_runtime.py +25 -0
- victor_contracts-0.7.2/victor_contracts/framework/__init__.py +14 -0
- victor_contracts-0.7.2/victor_contracts/framework/protocols/__init__.py +11 -0
- victor_contracts-0.7.2/victor_contracts/framework/protocols/orchestrator.py +86 -0
- victor_contracts-0.7.2/victor_contracts/framework/protocols/teams.py +58 -0
- victor_contracts-0.7.2/victor_contracts/framework/protocols/workflows.py +63 -0
- victor_contracts-0.7.2/victor_contracts/graph_rag_runtime.py +24 -0
- victor_contracts-0.7.2/victor_contracts/graph_runtime.py +29 -0
- victor_contracts-0.7.2/victor_contracts/handler_runtime.py +153 -0
- victor_contracts-0.7.2/victor_contracts/indexing_runtime.py +37 -0
- victor_contracts-0.7.2/victor_contracts/init_runtime.py +25 -0
- victor_contracts-0.7.2/victor_contracts/lsp_runtime.py +85 -0
- victor_contracts-0.7.2/victor_contracts/middleware_runtime.py +47 -0
- victor_contracts-0.7.2/victor_contracts/multi_agent.py +310 -0
- victor_contracts-0.7.2/victor_contracts/processing_runtime.py +98 -0
- victor_contracts-0.7.2/victor_contracts/protocols.py +92 -0
- victor_contracts-0.7.2/victor_contracts/provider_runtime.py +32 -0
- victor_contracts-0.7.2/victor_contracts/providers/__init__.py +10 -0
- victor_contracts-0.7.2/victor_contracts/providers/protocols/__init__.py +7 -0
- victor_contracts-0.7.2/victor_contracts/providers/protocols/llm.py +109 -0
- victor_contracts-0.7.2/victor_contracts/registries.py +70 -0
- victor_contracts-0.7.2/victor_contracts/rl.py +129 -0
- victor_contracts-0.7.2/victor_contracts/rl_runtime.py +65 -0
- victor_contracts-0.7.2/victor_contracts/safety/__init__.py +75 -0
- victor_contracts-0.7.2/victor_contracts/safety/framework.py +162 -0
- victor_contracts-0.7.2/victor_contracts/safety/patterns.py +64 -0
- victor_contracts-0.7.2/victor_contracts/safety/pii.py +275 -0
- victor_contracts-0.7.2/victor_contracts/safety/runtime.py +402 -0
- victor_contracts-0.7.2/victor_contracts/safety_patterns.py +100 -0
- victor_contracts-0.7.2/victor_contracts/safety_policy.py +46 -0
- victor_contracts-0.7.2/victor_contracts/search_runtime.py +57 -0
- victor_contracts-0.7.2/victor_contracts/skills/__init__.py +10 -0
- victor_contracts-0.7.2/victor_contracts/skills/definition.py +84 -0
- victor_contracts-0.7.2/victor_contracts/skills/provider.py +24 -0
- victor_contracts-0.7.2/victor_contracts/subagent_runtime.py +40 -0
- victor_contracts-0.7.2/victor_contracts/team_schema.py +351 -0
- victor_contracts-0.7.2/victor_contracts/testing/__init__.py +197 -0
- victor_contracts-0.7.2/victor_contracts/testing/fixtures.py +179 -0
- victor_contracts-0.7.2/victor_contracts/tool_runtime.py +29 -0
- victor_contracts-0.7.2/victor_contracts/tools.py +153 -0
- victor_contracts-0.7.2/victor_contracts/utils/__init__.py +0 -0
- victor_contracts-0.7.2/victor_contracts/utils/ast_helpers.py +246 -0
- victor_contracts-0.7.2/victor_contracts/validation.py +189 -0
- victor_contracts-0.7.2/victor_contracts/verticals/__init__.py +126 -0
- victor_contracts-0.7.2/victor_contracts/verticals/extensions.py +241 -0
- victor_contracts-0.7.2/victor_contracts/verticals/manifest.py +154 -0
- victor_contracts-0.7.2/victor_contracts/verticals/metadata.py +183 -0
- victor_contracts-0.7.2/victor_contracts/verticals/mixins/__init__.py +24 -0
- victor_contracts-0.7.2/victor_contracts/verticals/mixins/extension_provider_mixin.py +107 -0
- victor_contracts-0.7.2/victor_contracts/verticals/mixins/prompt_metadata_mixin.py +39 -0
- victor_contracts-0.7.2/victor_contracts/verticals/mixins/rl_mixin.py +24 -0
- victor_contracts-0.7.2/victor_contracts/verticals/mixins/team_mixin.py +54 -0
- victor_contracts-0.7.2/victor_contracts/verticals/mixins/workflow_metadata_mixin.py +53 -0
- victor_contracts-0.7.2/victor_contracts/verticals/mode_config.py +266 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/__init__.py +250 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/base.py +503 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/capabilities.py +108 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/compaction.py +42 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/config.py +133 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/conversation.py +91 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/enrichment.py +69 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/handlers.py +75 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/hooks.py +66 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/mcp.py +59 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/memory.py +73 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/middleware.py +54 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/modes.py +57 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/permissions.py +48 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/plugins.py +47 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/promoted.py +756 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/promoted_types.py +288 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/prompts.py +104 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/rl.py +49 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/safety.py +116 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/sandbox.py +42 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/services.py +72 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/storage.py +187 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/teams.py +51 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/tool_plugins.py +159 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/tools.py +185 -0
- victor_contracts-0.7.2/victor_contracts/verticals/protocols/workflows.py +87 -0
- victor_contracts-0.7.2/victor_contracts/verticals/registration.py +88 -0
- victor_contracts-0.7.2/victor_contracts/verticals/tool_dependencies.py +655 -0
- victor_contracts-0.7.2/victor_contracts/verticals/validation.py +230 -0
- victor_contracts-0.7.2/victor_contracts/workflow_executor_runtime.py +49 -0
- victor_contracts-0.7.2/victor_contracts/workflow_runtime.py +70 -0
- victor_contracts-0.7.2/victor_contracts/workflows.py +99 -0
- victor_contracts-0.7.2/victor_contracts.egg-info/PKG-INFO +264 -0
- victor_contracts-0.7.2/victor_contracts.egg-info/SOURCES.txt +224 -0
- victor_contracts-0.7.2/victor_contracts.egg-info/dependency_links.txt +1 -0
- victor_contracts-0.7.2/victor_contracts.egg-info/entry_points.txt +2 -0
- victor_contracts-0.7.2/victor_contracts.egg-info/requires.txt +13 -0
- victor_contracts-0.7.2/victor_contracts.egg-info/top_level.txt +2 -0
- victor_contracts-0.7.2/victor_sdk/__init__.py +82 -0
|
@@ -0,0 +1,264 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: victor-contracts
|
|
3
|
+
Version: 0.7.2
|
|
4
|
+
Summary: Victor Contracts - Protocol definitions for vertical development
|
|
5
|
+
Author-email: Vijaykumar Singh <singhvjd@gmail.com>
|
|
6
|
+
Maintainer-email: Vijaykumar Singh <singhvjd@gmail.com>
|
|
7
|
+
License: Apache-2.0
|
|
8
|
+
Project-URL: Homepage, https://github.com/vjsingh1984/victor
|
|
9
|
+
Project-URL: Repository, https://github.com/vjsingh1984/victor
|
|
10
|
+
Project-URL: Documentation, https://docs.victor.dev/contracts
|
|
11
|
+
Project-URL: Issues, https://github.com/vjsingh1984/victor/issues
|
|
12
|
+
Keywords: ai,agents,llm,framework,contracts,protocols,verticals
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Intended Audience :: Developers
|
|
15
|
+
Classifier: License :: OSI Approved :: Apache Software License
|
|
16
|
+
Classifier: Programming Language :: Python :: 3
|
|
17
|
+
Classifier: Programming Language :: Python :: 3.10
|
|
18
|
+
Classifier: Programming Language :: Python :: 3.11
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Topic :: Software Development :: Libraries :: Application Frameworks
|
|
22
|
+
Requires-Python: >=3.10
|
|
23
|
+
Description-Content-Type: text/markdown
|
|
24
|
+
Requires-Dist: typing-extensions>=4.9
|
|
25
|
+
Provides-Extra: yaml
|
|
26
|
+
Requires-Dist: PyYAML>=6.0; extra == "yaml"
|
|
27
|
+
Provides-Extra: dev
|
|
28
|
+
Requires-Dist: PyYAML>=6.0; extra == "dev"
|
|
29
|
+
Requires-Dist: pytest>=8.0; extra == "dev"
|
|
30
|
+
Requires-Dist: pytest-asyncio>=0.23; extra == "dev"
|
|
31
|
+
Requires-Dist: pytest-cov>=4.1; extra == "dev"
|
|
32
|
+
Requires-Dist: mypy>=1.10; extra == "dev"
|
|
33
|
+
Requires-Dist: black==26.3.1; extra == "dev"
|
|
34
|
+
Requires-Dist: ruff>=0.5; extra == "dev"
|
|
35
|
+
|
|
36
|
+
# Victor Contracts
|
|
37
|
+
|
|
38
|
+
Protocol and type definitions for building Victor verticals without pulling in
|
|
39
|
+
the Victor runtime.
|
|
40
|
+
|
|
41
|
+
## Overview
|
|
42
|
+
|
|
43
|
+
Use the contracts package when you want to author or publish a vertical package.
|
|
44
|
+
Use `victor-ai` when you want to run a vertical inside the Victor host runtime.
|
|
45
|
+
|
|
46
|
+
The supported external authoring model is contract-first:
|
|
47
|
+
|
|
48
|
+
- vertical packages depend on `victor-contracts`
|
|
49
|
+
- verticals declare tools, capabilities, prompts, teams, and workflow metadata through
|
|
50
|
+
the contracts package
|
|
51
|
+
- `victor-ai` remains responsible for runtime concerns such as agent creation,
|
|
52
|
+
capability injection, and tool execution
|
|
53
|
+
|
|
54
|
+
## Installation
|
|
55
|
+
|
|
56
|
+
### Contract-only authoring
|
|
57
|
+
|
|
58
|
+
```bash
|
|
59
|
+
pip install victor-contracts
|
|
60
|
+
```
|
|
61
|
+
|
|
62
|
+
### Runtime usage
|
|
63
|
+
|
|
64
|
+
```bash
|
|
65
|
+
pip install victor-ai
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Stable Contract Surface
|
|
69
|
+
|
|
70
|
+
The core authoring surface is available from the top-level package:
|
|
71
|
+
|
|
72
|
+
```python
|
|
73
|
+
from victor_contracts import (
|
|
74
|
+
CURRENT_DEFINITION_VERSION,
|
|
75
|
+
CapabilityIds,
|
|
76
|
+
CapabilityRequirement,
|
|
77
|
+
ToolNames,
|
|
78
|
+
ToolRequirement,
|
|
79
|
+
VerticalBase,
|
|
80
|
+
VerticalDefinition,
|
|
81
|
+
)
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
Key pieces:
|
|
85
|
+
|
|
86
|
+
- `VerticalBase`: contract base class for external verticals
|
|
87
|
+
- `ToolNames`: canonical contract-owned tool identifiers
|
|
88
|
+
- `CapabilityIds`: canonical contract-owned runtime capability identifiers
|
|
89
|
+
- `ToolRequirement` / `CapabilityRequirement`: typed requirement declarations
|
|
90
|
+
- `VerticalDefinition`: validated serializable manifest returned by
|
|
91
|
+
`get_definition()`
|
|
92
|
+
|
|
93
|
+
## Quick Start
|
|
94
|
+
|
|
95
|
+
```python
|
|
96
|
+
from victor_contracts import (
|
|
97
|
+
CapabilityIds,
|
|
98
|
+
CapabilityRequirement,
|
|
99
|
+
ToolNames,
|
|
100
|
+
ToolRequirement,
|
|
101
|
+
VerticalBase,
|
|
102
|
+
)
|
|
103
|
+
|
|
104
|
+
|
|
105
|
+
class SecurityVertical(VerticalBase):
|
|
106
|
+
name = "security"
|
|
107
|
+
description = "Security analysis and audit workflows"
|
|
108
|
+
version = "1.0.0"
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def get_name(cls) -> str:
|
|
112
|
+
return cls.name
|
|
113
|
+
|
|
114
|
+
@classmethod
|
|
115
|
+
def get_description(cls) -> str:
|
|
116
|
+
return cls.description
|
|
117
|
+
|
|
118
|
+
@classmethod
|
|
119
|
+
def get_tool_requirements(cls) -> list[ToolRequirement]:
|
|
120
|
+
return [
|
|
121
|
+
ToolRequirement(ToolNames.READ, purpose="inspect code and configs"),
|
|
122
|
+
ToolRequirement(ToolNames.GREP, purpose="search for vulnerable patterns"),
|
|
123
|
+
ToolRequirement(ToolNames.SHELL, required=False, purpose="run scanners"),
|
|
124
|
+
ToolRequirement(ToolNames.WEB_SEARCH, required=False, purpose="look up CVEs"),
|
|
125
|
+
]
|
|
126
|
+
|
|
127
|
+
@classmethod
|
|
128
|
+
def get_capability_requirements(cls) -> list[CapabilityRequirement]:
|
|
129
|
+
return [
|
|
130
|
+
CapabilityRequirement(
|
|
131
|
+
capability_id=CapabilityIds.FILE_OPS,
|
|
132
|
+
purpose="read repository contents",
|
|
133
|
+
),
|
|
134
|
+
CapabilityRequirement(
|
|
135
|
+
capability_id=CapabilityIds.WEB_ACCESS,
|
|
136
|
+
optional=True,
|
|
137
|
+
purpose="fetch external security references",
|
|
138
|
+
),
|
|
139
|
+
]
|
|
140
|
+
|
|
141
|
+
@classmethod
|
|
142
|
+
def get_system_prompt(cls) -> str:
|
|
143
|
+
return "You are a security-focused assistant."
|
|
144
|
+
|
|
145
|
+
@classmethod
|
|
146
|
+
def get_prompt_templates(cls) -> dict[str, str]:
|
|
147
|
+
return {
|
|
148
|
+
"audit": "Audit the target for security issues and explain severity."
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
@classmethod
|
|
152
|
+
def get_task_type_hints(cls) -> dict[str, dict[str, object]]:
|
|
153
|
+
return {
|
|
154
|
+
"audit": {
|
|
155
|
+
"hint": "Start with read-first reconnaissance, then validate findings.",
|
|
156
|
+
"tool_budget": 12,
|
|
157
|
+
"priority_tools": [ToolNames.READ, ToolNames.GREP, ToolNames.SHELL],
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
|
|
161
|
+
@classmethod
|
|
162
|
+
def get_team_declarations(cls) -> dict[str, dict[str, object]]:
|
|
163
|
+
return {
|
|
164
|
+
"security_review_team": {
|
|
165
|
+
"name": "Security Review Team",
|
|
166
|
+
"formation": "pipeline",
|
|
167
|
+
"members": [
|
|
168
|
+
{
|
|
169
|
+
"role": "researcher",
|
|
170
|
+
"goal": "Inspect the target and identify likely risks.",
|
|
171
|
+
},
|
|
172
|
+
{
|
|
173
|
+
"role": "reviewer",
|
|
174
|
+
"goal": "Validate findings before escalation.",
|
|
175
|
+
},
|
|
176
|
+
],
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
|
|
180
|
+
|
|
181
|
+
definition = SecurityVertical.get_definition()
|
|
182
|
+
assert definition.definition_version == "1.0"
|
|
183
|
+
assert definition.tools == [ToolNames.READ, ToolNames.GREP, ToolNames.SHELL, ToolNames.WEB_SEARCH]
|
|
184
|
+
assert definition.team_metadata.teams[0].team_id == "security_review_team"
|
|
185
|
+
```
|
|
186
|
+
|
|
187
|
+
## Definition Contract
|
|
188
|
+
|
|
189
|
+
`VerticalBase.get_definition()` is the preferred contract API. It returns a
|
|
190
|
+
validated `VerticalDefinition` manifest that contains:
|
|
191
|
+
|
|
192
|
+
- `definition_version`
|
|
193
|
+
- canonical tool identifiers
|
|
194
|
+
- typed tool and capability requirements
|
|
195
|
+
- system prompt text
|
|
196
|
+
- prompt metadata and task-type hints
|
|
197
|
+
- team metadata such as declarative team layouts and the default team identifier
|
|
198
|
+
- declarative stage definitions
|
|
199
|
+
- workflow metadata such as initial stage, provider hints, and evaluation criteria
|
|
200
|
+
|
|
201
|
+
Compatibility note:
|
|
202
|
+
|
|
203
|
+
- `get_config()` still exists as a bridge for current victor-ai integrations
|
|
204
|
+
- `VerticalDefinition.to_config()` / `from_config()` bridge the legacy config shape
|
|
205
|
+
- `VerticalDefinition.from_dict()` supports serialized manifest round-tripping
|
|
206
|
+
|
|
207
|
+
## Packaging
|
|
208
|
+
|
|
209
|
+
Register the vertical via the standard Victor entry point:
|
|
210
|
+
|
|
211
|
+
```toml
|
|
212
|
+
[project]
|
|
213
|
+
name = "victor-security"
|
|
214
|
+
version = "1.0.0"
|
|
215
|
+
dependencies = ["victor-contracts>=1.0.0"]
|
|
216
|
+
|
|
217
|
+
[project.entry-points."victor.plugins"]
|
|
218
|
+
security = "victor_security:plugin"
|
|
219
|
+
```
|
|
220
|
+
|
|
221
|
+
## Discovery
|
|
222
|
+
|
|
223
|
+
Victor discovers external vertical packages through `victor.plugins` entry
|
|
224
|
+
points, then each plugin registers one or more contract vertical definitions:
|
|
225
|
+
|
|
226
|
+
```python
|
|
227
|
+
from victor_contracts.discovery import get_global_registry
|
|
228
|
+
|
|
229
|
+
registry = get_global_registry()
|
|
230
|
+
verticals = registry.get_verticals()
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
## Guides And Examples
|
|
234
|
+
|
|
235
|
+
- [Vertical Development Guide](VERTICAL_DEVELOPMENT.md)
|
|
236
|
+
- [Migration Guide](MIGRATION_GUIDE.md)
|
|
237
|
+
- [Minimal contract-only example](examples/minimal_vertical/README.md)
|
|
238
|
+
- [Repository external package example](../examples/external_vertical/README.md)
|
|
239
|
+
|
|
240
|
+
## Testing
|
|
241
|
+
|
|
242
|
+
```bash
|
|
243
|
+
pip install -e ".[dev]"
|
|
244
|
+
pytest victor-contracts/tests -q
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
To verify compatibility with the runtime as well:
|
|
248
|
+
|
|
249
|
+
```bash
|
|
250
|
+
pip install -e ".[dev]" victor-ai
|
|
251
|
+
pytest victor-contracts/tests/unit tests/integration/test_contracts_integration.py -q
|
|
252
|
+
```
|
|
253
|
+
|
|
254
|
+
## Versioning
|
|
255
|
+
|
|
256
|
+
The package follows semantic versioning, and the manifest contract is versioned
|
|
257
|
+
separately via `VerticalDefinition.definition_version`. External verticals
|
|
258
|
+
should treat the contracts package as the source of truth for supported identifiers
|
|
259
|
+
and manifest fields.
|
|
260
|
+
|
|
261
|
+
## Links
|
|
262
|
+
|
|
263
|
+
- Repository: https://github.com/vjsingh1984/victor
|
|
264
|
+
- Issues: https://github.com/vjsingh1984/victor/issues
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
# Victor Contracts
|
|
2
|
+
|
|
3
|
+
Protocol and type definitions for building Victor verticals without pulling in
|
|
4
|
+
the Victor runtime.
|
|
5
|
+
|
|
6
|
+
## Overview
|
|
7
|
+
|
|
8
|
+
Use the contracts package when you want to author or publish a vertical package.
|
|
9
|
+
Use `victor-ai` when you want to run a vertical inside the Victor host runtime.
|
|
10
|
+
|
|
11
|
+
The supported external authoring model is contract-first:
|
|
12
|
+
|
|
13
|
+
- vertical packages depend on `victor-contracts`
|
|
14
|
+
- verticals declare tools, capabilities, prompts, teams, and workflow metadata through
|
|
15
|
+
the contracts package
|
|
16
|
+
- `victor-ai` remains responsible for runtime concerns such as agent creation,
|
|
17
|
+
capability injection, and tool execution
|
|
18
|
+
|
|
19
|
+
## Installation
|
|
20
|
+
|
|
21
|
+
### Contract-only authoring
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
pip install victor-contracts
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Runtime usage
|
|
28
|
+
|
|
29
|
+
```bash
|
|
30
|
+
pip install victor-ai
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## Stable Contract Surface
|
|
34
|
+
|
|
35
|
+
The core authoring surface is available from the top-level package:
|
|
36
|
+
|
|
37
|
+
```python
|
|
38
|
+
from victor_contracts import (
|
|
39
|
+
CURRENT_DEFINITION_VERSION,
|
|
40
|
+
CapabilityIds,
|
|
41
|
+
CapabilityRequirement,
|
|
42
|
+
ToolNames,
|
|
43
|
+
ToolRequirement,
|
|
44
|
+
VerticalBase,
|
|
45
|
+
VerticalDefinition,
|
|
46
|
+
)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
Key pieces:
|
|
50
|
+
|
|
51
|
+
- `VerticalBase`: contract base class for external verticals
|
|
52
|
+
- `ToolNames`: canonical contract-owned tool identifiers
|
|
53
|
+
- `CapabilityIds`: canonical contract-owned runtime capability identifiers
|
|
54
|
+
- `ToolRequirement` / `CapabilityRequirement`: typed requirement declarations
|
|
55
|
+
- `VerticalDefinition`: validated serializable manifest returned by
|
|
56
|
+
`get_definition()`
|
|
57
|
+
|
|
58
|
+
## Quick Start
|
|
59
|
+
|
|
60
|
+
```python
|
|
61
|
+
from victor_contracts import (
|
|
62
|
+
CapabilityIds,
|
|
63
|
+
CapabilityRequirement,
|
|
64
|
+
ToolNames,
|
|
65
|
+
ToolRequirement,
|
|
66
|
+
VerticalBase,
|
|
67
|
+
)
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class SecurityVertical(VerticalBase):
|
|
71
|
+
name = "security"
|
|
72
|
+
description = "Security analysis and audit workflows"
|
|
73
|
+
version = "1.0.0"
|
|
74
|
+
|
|
75
|
+
@classmethod
|
|
76
|
+
def get_name(cls) -> str:
|
|
77
|
+
return cls.name
|
|
78
|
+
|
|
79
|
+
@classmethod
|
|
80
|
+
def get_description(cls) -> str:
|
|
81
|
+
return cls.description
|
|
82
|
+
|
|
83
|
+
@classmethod
|
|
84
|
+
def get_tool_requirements(cls) -> list[ToolRequirement]:
|
|
85
|
+
return [
|
|
86
|
+
ToolRequirement(ToolNames.READ, purpose="inspect code and configs"),
|
|
87
|
+
ToolRequirement(ToolNames.GREP, purpose="search for vulnerable patterns"),
|
|
88
|
+
ToolRequirement(ToolNames.SHELL, required=False, purpose="run scanners"),
|
|
89
|
+
ToolRequirement(ToolNames.WEB_SEARCH, required=False, purpose="look up CVEs"),
|
|
90
|
+
]
|
|
91
|
+
|
|
92
|
+
@classmethod
|
|
93
|
+
def get_capability_requirements(cls) -> list[CapabilityRequirement]:
|
|
94
|
+
return [
|
|
95
|
+
CapabilityRequirement(
|
|
96
|
+
capability_id=CapabilityIds.FILE_OPS,
|
|
97
|
+
purpose="read repository contents",
|
|
98
|
+
),
|
|
99
|
+
CapabilityRequirement(
|
|
100
|
+
capability_id=CapabilityIds.WEB_ACCESS,
|
|
101
|
+
optional=True,
|
|
102
|
+
purpose="fetch external security references",
|
|
103
|
+
),
|
|
104
|
+
]
|
|
105
|
+
|
|
106
|
+
@classmethod
|
|
107
|
+
def get_system_prompt(cls) -> str:
|
|
108
|
+
return "You are a security-focused assistant."
|
|
109
|
+
|
|
110
|
+
@classmethod
|
|
111
|
+
def get_prompt_templates(cls) -> dict[str, str]:
|
|
112
|
+
return {
|
|
113
|
+
"audit": "Audit the target for security issues and explain severity."
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
@classmethod
|
|
117
|
+
def get_task_type_hints(cls) -> dict[str, dict[str, object]]:
|
|
118
|
+
return {
|
|
119
|
+
"audit": {
|
|
120
|
+
"hint": "Start with read-first reconnaissance, then validate findings.",
|
|
121
|
+
"tool_budget": 12,
|
|
122
|
+
"priority_tools": [ToolNames.READ, ToolNames.GREP, ToolNames.SHELL],
|
|
123
|
+
}
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
@classmethod
|
|
127
|
+
def get_team_declarations(cls) -> dict[str, dict[str, object]]:
|
|
128
|
+
return {
|
|
129
|
+
"security_review_team": {
|
|
130
|
+
"name": "Security Review Team",
|
|
131
|
+
"formation": "pipeline",
|
|
132
|
+
"members": [
|
|
133
|
+
{
|
|
134
|
+
"role": "researcher",
|
|
135
|
+
"goal": "Inspect the target and identify likely risks.",
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
"role": "reviewer",
|
|
139
|
+
"goal": "Validate findings before escalation.",
|
|
140
|
+
},
|
|
141
|
+
],
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
definition = SecurityVertical.get_definition()
|
|
147
|
+
assert definition.definition_version == "1.0"
|
|
148
|
+
assert definition.tools == [ToolNames.READ, ToolNames.GREP, ToolNames.SHELL, ToolNames.WEB_SEARCH]
|
|
149
|
+
assert definition.team_metadata.teams[0].team_id == "security_review_team"
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
## Definition Contract
|
|
153
|
+
|
|
154
|
+
`VerticalBase.get_definition()` is the preferred contract API. It returns a
|
|
155
|
+
validated `VerticalDefinition` manifest that contains:
|
|
156
|
+
|
|
157
|
+
- `definition_version`
|
|
158
|
+
- canonical tool identifiers
|
|
159
|
+
- typed tool and capability requirements
|
|
160
|
+
- system prompt text
|
|
161
|
+
- prompt metadata and task-type hints
|
|
162
|
+
- team metadata such as declarative team layouts and the default team identifier
|
|
163
|
+
- declarative stage definitions
|
|
164
|
+
- workflow metadata such as initial stage, provider hints, and evaluation criteria
|
|
165
|
+
|
|
166
|
+
Compatibility note:
|
|
167
|
+
|
|
168
|
+
- `get_config()` still exists as a bridge for current victor-ai integrations
|
|
169
|
+
- `VerticalDefinition.to_config()` / `from_config()` bridge the legacy config shape
|
|
170
|
+
- `VerticalDefinition.from_dict()` supports serialized manifest round-tripping
|
|
171
|
+
|
|
172
|
+
## Packaging
|
|
173
|
+
|
|
174
|
+
Register the vertical via the standard Victor entry point:
|
|
175
|
+
|
|
176
|
+
```toml
|
|
177
|
+
[project]
|
|
178
|
+
name = "victor-security"
|
|
179
|
+
version = "1.0.0"
|
|
180
|
+
dependencies = ["victor-contracts>=1.0.0"]
|
|
181
|
+
|
|
182
|
+
[project.entry-points."victor.plugins"]
|
|
183
|
+
security = "victor_security:plugin"
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
## Discovery
|
|
187
|
+
|
|
188
|
+
Victor discovers external vertical packages through `victor.plugins` entry
|
|
189
|
+
points, then each plugin registers one or more contract vertical definitions:
|
|
190
|
+
|
|
191
|
+
```python
|
|
192
|
+
from victor_contracts.discovery import get_global_registry
|
|
193
|
+
|
|
194
|
+
registry = get_global_registry()
|
|
195
|
+
verticals = registry.get_verticals()
|
|
196
|
+
```
|
|
197
|
+
|
|
198
|
+
## Guides And Examples
|
|
199
|
+
|
|
200
|
+
- [Vertical Development Guide](VERTICAL_DEVELOPMENT.md)
|
|
201
|
+
- [Migration Guide](MIGRATION_GUIDE.md)
|
|
202
|
+
- [Minimal contract-only example](examples/minimal_vertical/README.md)
|
|
203
|
+
- [Repository external package example](../examples/external_vertical/README.md)
|
|
204
|
+
|
|
205
|
+
## Testing
|
|
206
|
+
|
|
207
|
+
```bash
|
|
208
|
+
pip install -e ".[dev]"
|
|
209
|
+
pytest victor-contracts/tests -q
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
To verify compatibility with the runtime as well:
|
|
213
|
+
|
|
214
|
+
```bash
|
|
215
|
+
pip install -e ".[dev]" victor-ai
|
|
216
|
+
pytest victor-contracts/tests/unit tests/integration/test_contracts_integration.py -q
|
|
217
|
+
```
|
|
218
|
+
|
|
219
|
+
## Versioning
|
|
220
|
+
|
|
221
|
+
The package follows semantic versioning, and the manifest contract is versioned
|
|
222
|
+
separately via `VerticalDefinition.definition_version`. External verticals
|
|
223
|
+
should treat the contracts package as the source of truth for supported identifiers
|
|
224
|
+
and manifest fields.
|
|
225
|
+
|
|
226
|
+
## Links
|
|
227
|
+
|
|
228
|
+
- Repository: https://github.com/vjsingh1984/victor
|
|
229
|
+
- Issues: https://github.com/vjsingh1984/victor/issues
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "victor-contracts"
|
|
7
|
+
version = "0.7.2"
|
|
8
|
+
description = "Victor Contracts - Protocol definitions for vertical development"
|
|
9
|
+
readme = "README.md"
|
|
10
|
+
requires-python = ">=3.10"
|
|
11
|
+
license = { text = "Apache-2.0" }
|
|
12
|
+
authors = [
|
|
13
|
+
{ name = "Vijaykumar Singh", email = "singhvjd@gmail.com" },
|
|
14
|
+
]
|
|
15
|
+
maintainers = [
|
|
16
|
+
{ name = "Vijaykumar Singh", email = "singhvjd@gmail.com" },
|
|
17
|
+
]
|
|
18
|
+
keywords = [
|
|
19
|
+
"ai",
|
|
20
|
+
"agents",
|
|
21
|
+
"llm",
|
|
22
|
+
"framework",
|
|
23
|
+
"contracts",
|
|
24
|
+
"protocols",
|
|
25
|
+
"verticals",
|
|
26
|
+
]
|
|
27
|
+
classifiers = [
|
|
28
|
+
"Development Status :: 3 - Alpha",
|
|
29
|
+
"Intended Audience :: Developers",
|
|
30
|
+
"License :: OSI Approved :: Apache Software License",
|
|
31
|
+
"Programming Language :: Python :: 3",
|
|
32
|
+
"Programming Language :: Python :: 3.10",
|
|
33
|
+
"Programming Language :: Python :: 3.11",
|
|
34
|
+
"Programming Language :: Python :: 3.12",
|
|
35
|
+
"Programming Language :: Python :: 3.13",
|
|
36
|
+
"Topic :: Software Development :: Libraries :: Application Frameworks",
|
|
37
|
+
]
|
|
38
|
+
|
|
39
|
+
# ZERO runtime dependencies except typing-extensions
|
|
40
|
+
dependencies = [
|
|
41
|
+
"typing-extensions>=4.9", # For Protocol support
|
|
42
|
+
]
|
|
43
|
+
|
|
44
|
+
[project.optional-dependencies]
|
|
45
|
+
yaml = [
|
|
46
|
+
"PyYAML>=6.0",
|
|
47
|
+
]
|
|
48
|
+
dev = [
|
|
49
|
+
"PyYAML>=6.0", # the tool-dependency loader tests exercise the yaml extra
|
|
50
|
+
"pytest>=8.0",
|
|
51
|
+
"pytest-asyncio>=0.23",
|
|
52
|
+
"pytest-cov>=4.1",
|
|
53
|
+
"mypy>=1.10",
|
|
54
|
+
"black==26.3.1",
|
|
55
|
+
"ruff>=0.5",
|
|
56
|
+
]
|
|
57
|
+
|
|
58
|
+
[project.urls]
|
|
59
|
+
Homepage = "https://github.com/vjsingh1984/victor"
|
|
60
|
+
Repository = "https://github.com/vjsingh1984/victor"
|
|
61
|
+
Documentation = "https://docs.victor.dev/contracts"
|
|
62
|
+
Issues = "https://github.com/vjsingh1984/victor/issues"
|
|
63
|
+
|
|
64
|
+
[project.scripts]
|
|
65
|
+
victor-contracts = "victor_contracts.cli:main"
|
|
66
|
+
|
|
67
|
+
[tool.setuptools]
|
|
68
|
+
package-dir = { "" = "." }
|
|
69
|
+
|
|
70
|
+
[tool.setuptools.packages.find]
|
|
71
|
+
where = ["."]
|
|
72
|
+
# victor_sdk* is a deprecation shim re-exporting victor_contracts (old package name).
|
|
73
|
+
include = ["victor_contracts*", "victor_sdk*"]
|
|
74
|
+
exclude = ["tests*"]
|
|
75
|
+
|
|
76
|
+
[tool.black]
|
|
77
|
+
line-length = 100
|
|
78
|
+
target-version = ["py310", "py311", "py312", "py313"]
|
|
79
|
+
|
|
80
|
+
[tool.ruff]
|
|
81
|
+
line-length = 100
|
|
82
|
+
target-version = "py310"
|
|
83
|
+
|
|
84
|
+
[tool.ruff.lint]
|
|
85
|
+
select = ["E", "W", "F", "B", "C4"]
|
|
86
|
+
ignore = []
|
|
87
|
+
|
|
88
|
+
[tool.mypy]
|
|
89
|
+
python_version = "3.10"
|
|
90
|
+
strict = false
|
|
91
|
+
warn_return_any = true
|
|
92
|
+
warn_unused_configs = true
|
|
93
|
+
disallow_untyped_defs = true
|
|
94
|
+
|
|
95
|
+
[tool.pytest.ini_options]
|
|
96
|
+
asyncio_mode = "auto"
|
|
97
|
+
testpaths = ["tests"]
|
|
98
|
+
pythonpath = ["."]
|