capdag 0.148.1428__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.
- capdag-0.148.1428/PKG-INFO +12 -0
- capdag-0.148.1428/README.md +174 -0
- capdag-0.148.1428/pyproject.toml +29 -0
- capdag-0.148.1428/setup.cfg +4 -0
- capdag-0.148.1428/src/capdag/__init__.py +495 -0
- capdag-0.148.1428/src/capdag/bifaci/__init__.py +48 -0
- capdag-0.148.1428/src/capdag/bifaci/cartridge_json.py +364 -0
- capdag-0.148.1428/src/capdag/bifaci/cartridge_repo.py +721 -0
- capdag-0.148.1428/src/capdag/bifaci/cartridge_runtime.py +2711 -0
- capdag-0.148.1428/src/capdag/bifaci/cartridge_slug.py +59 -0
- capdag-0.148.1428/src/capdag/bifaci/frame.py +877 -0
- capdag-0.148.1428/src/capdag/bifaci/host_runtime.py +834 -0
- capdag-0.148.1428/src/capdag/bifaci/io.py +880 -0
- capdag-0.148.1428/src/capdag/bifaci/manifest.py +209 -0
- capdag-0.148.1428/src/capdag/bifaci/relay.py +238 -0
- capdag-0.148.1428/src/capdag/bifaci/relay_switch.py +729 -0
- capdag-0.148.1428/src/capdag/bifaci/router.py +65 -0
- capdag-0.148.1428/src/capdag/cap/__init__.py +0 -0
- capdag-0.148.1428/src/capdag/cap/caller.py +162 -0
- capdag-0.148.1428/src/capdag/cap/definition.py +599 -0
- capdag-0.148.1428/src/capdag/cap/registry.py +548 -0
- capdag-0.148.1428/src/capdag/cap/response.py +132 -0
- capdag-0.148.1428/src/capdag/cap/schema_validation.py +140 -0
- capdag-0.148.1428/src/capdag/cap/validation.py +321 -0
- capdag-0.148.1428/src/capdag/input_resolver/__init__.py +66 -0
- capdag-0.148.1428/src/capdag/input_resolver/adapter.py +18 -0
- capdag-0.148.1428/src/capdag/input_resolver/adapters/__init__.py +9 -0
- capdag-0.148.1428/src/capdag/input_resolver/adapters/registry.py +115 -0
- capdag-0.148.1428/src/capdag/input_resolver/os_filter.py +81 -0
- capdag-0.148.1428/src/capdag/input_resolver/path_resolver.py +113 -0
- capdag-0.148.1428/src/capdag/input_resolver/resolver.py +194 -0
- capdag-0.148.1428/src/capdag/input_resolver/types.py +133 -0
- capdag-0.148.1428/src/capdag/input_resolver/value_adapter.py +27 -0
- capdag-0.148.1428/src/capdag/input_resolver/value_adapter_registry.py +31 -0
- capdag-0.148.1428/src/capdag/machine/__init__.py +65 -0
- capdag-0.148.1428/src/capdag/machine/error.py +164 -0
- capdag-0.148.1428/src/capdag/machine/graph.py +357 -0
- capdag-0.148.1428/src/capdag/machine/parser.py +322 -0
- capdag-0.148.1428/src/capdag/machine/resolve.py +446 -0
- capdag-0.148.1428/src/capdag/machine/serializer.py +308 -0
- capdag-0.148.1428/src/capdag/media/__init__.py +0 -0
- capdag-0.148.1428/src/capdag/media/profile.py +229 -0
- capdag-0.148.1428/src/capdag/media/registry.py +640 -0
- capdag-0.148.1428/src/capdag/media/spec.py +639 -0
- capdag-0.148.1428/src/capdag/orchestrator/__init__.py +74 -0
- capdag-0.148.1428/src/capdag/orchestrator/cbor_util.py +186 -0
- capdag-0.148.1428/src/capdag/orchestrator/parser.py +290 -0
- capdag-0.148.1428/src/capdag/orchestrator/plan_converter.py +159 -0
- capdag-0.148.1428/src/capdag/orchestrator/types.py +186 -0
- capdag-0.148.1428/src/capdag/orchestrator/validation.py +58 -0
- capdag-0.148.1428/src/capdag/planner/__init__.py +159 -0
- capdag-0.148.1428/src/capdag/planner/argument_binding.py +641 -0
- capdag-0.148.1428/src/capdag/planner/cardinality.py +479 -0
- capdag-0.148.1428/src/capdag/planner/collection_input.py +139 -0
- capdag-0.148.1428/src/capdag/planner/error.py +41 -0
- capdag-0.148.1428/src/capdag/planner/executor.py +468 -0
- capdag-0.148.1428/src/capdag/planner/live_cap_fab.py +660 -0
- capdag-0.148.1428/src/capdag/planner/plan.py +944 -0
- capdag-0.148.1428/src/capdag/planner/plan_builder.py +587 -0
- capdag-0.148.1428/src/capdag/standard/__init__.py +47 -0
- capdag-0.148.1428/src/capdag/standard/caps.py +615 -0
- capdag-0.148.1428/src/capdag/urn/__init__.py +0 -0
- capdag-0.148.1428/src/capdag/urn/cap_urn.py +716 -0
- capdag-0.148.1428/src/capdag/urn/media_urn.py +515 -0
- capdag-0.148.1428/src/capdag.egg-info/PKG-INFO +12 -0
- capdag-0.148.1428/src/capdag.egg-info/SOURCES.txt +103 -0
- capdag-0.148.1428/src/capdag.egg-info/dependency_links.txt +1 -0
- capdag-0.148.1428/src/capdag.egg-info/requires.txt +6 -0
- capdag-0.148.1428/src/capdag.egg-info/top_level.txt +1 -0
- capdag-0.148.1428/tests/test_caller.py +322 -0
- capdag-0.148.1428/tests/test_cap.py +398 -0
- capdag-0.148.1428/tests/test_cap_urn.py +1354 -0
- capdag-0.148.1428/tests/test_cardinality.py +356 -0
- capdag-0.148.1428/tests/test_cartridge_host.py +982 -0
- capdag-0.148.1428/tests/test_cartridge_host_runtime.py +282 -0
- capdag-0.148.1428/tests/test_cartridge_relay.py +515 -0
- capdag-0.148.1428/tests/test_cartridge_repo.py +751 -0
- capdag-0.148.1428/tests/test_cartridge_runtime.py +2402 -0
- capdag-0.148.1428/tests/test_cbor_frame.py +1579 -0
- capdag-0.148.1428/tests/test_cbor_integration.py +366 -0
- capdag-0.148.1428/tests/test_cbor_io.py +1018 -0
- capdag-0.148.1428/tests/test_cbor_util.py +196 -0
- capdag-0.148.1428/tests/test_collection_input.py +65 -0
- capdag-0.148.1428/tests/test_executor.py +138 -0
- capdag-0.148.1428/tests/test_input_resolver.py +608 -0
- capdag-0.148.1428/tests/test_live_cap_fab.py +467 -0
- capdag-0.148.1428/tests/test_machine.py +959 -0
- capdag-0.148.1428/tests/test_manifest.py +298 -0
- capdag-0.148.1428/tests/test_media_profile.py +151 -0
- capdag-0.148.1428/tests/test_media_spec.py +753 -0
- capdag-0.148.1428/tests/test_media_urn.py +510 -0
- capdag-0.148.1428/tests/test_orchestrator_parser.py +305 -0
- capdag-0.148.1428/tests/test_orchestrator_plan_converter.py +228 -0
- capdag-0.148.1428/tests/test_orchestrator_types.py +51 -0
- capdag-0.148.1428/tests/test_plan.py +531 -0
- capdag-0.148.1428/tests/test_plan_builder.py +337 -0
- capdag-0.148.1428/tests/test_planner_argument_binding.py +370 -0
- capdag-0.148.1428/tests/test_registry.py +322 -0
- capdag-0.148.1428/tests/test_relay_switch.py +818 -0
- capdag-0.148.1428/tests/test_response.py +130 -0
- capdag-0.148.1428/tests/test_router.py +19 -0
- capdag-0.148.1428/tests/test_schema_validation.py +365 -0
- capdag-0.148.1428/tests/test_standard_caps.py +174 -0
- capdag-0.148.1428/tests/test_standard_format_conversion.py +32 -0
- capdag-0.148.1428/tests/test_validation.py +371 -0
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
|
+
Name: capdag
|
|
3
|
+
Version: 0.148.1428
|
|
4
|
+
Summary: Core cap URN and definition system for MACHFAB cartridges
|
|
5
|
+
Author: https://github.com/machinefabric
|
|
6
|
+
License: MIT
|
|
7
|
+
Requires-Python: >=3.10
|
|
8
|
+
Requires-Dist: tagged-urn>=0.16.68
|
|
9
|
+
Requires-Dist: cbor2>=5.4.0
|
|
10
|
+
Provides-Extra: dev
|
|
11
|
+
Requires-Dist: pytest>=7.0; extra == "dev"
|
|
12
|
+
Requires-Dist: pytest-cov>=4.0; extra == "dev"
|
|
@@ -0,0 +1,174 @@
|
|
|
1
|
+
# capdag-py
|
|
2
|
+
|
|
3
|
+
Python implementation of the capdag (Cap SDK) - Core cap URN and definition system for MACHFAB cartridges.
|
|
4
|
+
|
|
5
|
+
This library provides the fundamental cap URN system used across all MACHFAB cartridges and providers. It defines the formal structure for cap identifiers with flat tag-based naming, wildcard support, and specificity comparison.
|
|
6
|
+
|
|
7
|
+
## Features
|
|
8
|
+
|
|
9
|
+
- **MediaUrn**: Media type specification using tagged URN format with "media" prefix
|
|
10
|
+
- **CapUrn**: Cap identifiers with required `in` and `out` direction specs
|
|
11
|
+
- Semantic matching with wildcard support
|
|
12
|
+
- Specificity-based selection for finding best matching capabilities
|
|
13
|
+
- Full compatibility with the Rust reference implementation
|
|
14
|
+
|
|
15
|
+
## Installation
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Install in development mode
|
|
19
|
+
pip install -e .
|
|
20
|
+
|
|
21
|
+
# With development dependencies
|
|
22
|
+
pip install -e ".[dev]"
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Dependencies
|
|
26
|
+
|
|
27
|
+
- **tagged-urn**: Flat tag-based URN system (Python implementation)
|
|
28
|
+
|
|
29
|
+
## Usage
|
|
30
|
+
|
|
31
|
+
```python
|
|
32
|
+
from capdag import (
|
|
33
|
+
MediaUrn,
|
|
34
|
+
CapUrn,
|
|
35
|
+
CapUrnBuilder,
|
|
36
|
+
MEDIA_STRING,
|
|
37
|
+
MEDIA_OBJECT,
|
|
38
|
+
MEDIA_VOID,
|
|
39
|
+
)
|
|
40
|
+
|
|
41
|
+
# Create media URNs
|
|
42
|
+
string_urn = MediaUrn.from_string(MEDIA_STRING)
|
|
43
|
+
print(string_urn.is_text()) # True
|
|
44
|
+
print(string_urn.is_scalar()) # True
|
|
45
|
+
|
|
46
|
+
# Create cap URNs
|
|
47
|
+
cap = CapUrnBuilder() \
|
|
48
|
+
.in_spec(MEDIA_STRING) \
|
|
49
|
+
.out_spec(MEDIA_OBJECT) \
|
|
50
|
+
.tag("op", "generate") \
|
|
51
|
+
.tag("ext", "pdf") \
|
|
52
|
+
.build()
|
|
53
|
+
|
|
54
|
+
print(cap.to_string()) # cap:ext=pdf;in="media:textable";generate;out="media:record;textable"
|
|
55
|
+
|
|
56
|
+
# Matching semantics
|
|
57
|
+
request = CapUrn.from_string('cap:in="media:textable";out="media:record;textable";op=generate')
|
|
58
|
+
print(cap.accepts(request)) # True
|
|
59
|
+
|
|
60
|
+
# Specificity
|
|
61
|
+
print(cap.specificity()) # Higher score = more specific
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Testing
|
|
65
|
+
|
|
66
|
+
Tests mirror the Rust implementation with matching TEST### numbers for cross-tracking:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# Run all tests
|
|
70
|
+
pytest tests/
|
|
71
|
+
|
|
72
|
+
# Run specific test files
|
|
73
|
+
pytest tests/test_cap_urn.py
|
|
74
|
+
pytest tests/test_media_urn.py
|
|
75
|
+
|
|
76
|
+
# Run with coverage
|
|
77
|
+
pytest --cov=capdag tests/
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
### Test Coverage
|
|
81
|
+
|
|
82
|
+
The implementation includes comprehensive tests covering:
|
|
83
|
+
|
|
84
|
+
#### CapUrn Tests (TEST001-TEST052) - 52 tests ✅
|
|
85
|
+
- TEST001-TEST039: Core CapUrn functionality, parsing, serialization, matching
|
|
86
|
+
- TEST040-TEST052: Advanced matching semantics and direction handling
|
|
87
|
+
|
|
88
|
+
#### MediaUrn Tests (TEST057-TEST078, TEST304-TEST306) - 25 tests ✅
|
|
89
|
+
- TEST057-TEST078: MediaUrn parsing, type checking, matching, specificity
|
|
90
|
+
- TEST304-TEST306: Additional media URN constant validation
|
|
91
|
+
|
|
92
|
+
#### Cap Tests (TEST108-TEST116) - 9 tests ✅
|
|
93
|
+
- TEST108-TEST116: Cap creation, arguments, stdin, output, metadata, serialization
|
|
94
|
+
|
|
95
|
+
#### Manifest Tests (TEST148-TEST155) - 8 tests ✅
|
|
96
|
+
- TEST148-TEST155: Manifest creation, serialization, multiple caps, optional fields
|
|
97
|
+
|
|
98
|
+
#### Response Tests (TEST168-TEST170) - 3 tests ✅
|
|
99
|
+
- TEST168-TEST170: Response wrapper for JSON, primitives, and binary data
|
|
100
|
+
|
|
101
|
+
#### Standard Caps Tests (TEST307-TEST312) - 6 tests ✅
|
|
102
|
+
- TEST307-TEST312: Standard URN builders for capabilities
|
|
103
|
+
|
|
104
|
+
#### Validation Tests (TEST051-056) - 14 tests ✅
|
|
105
|
+
- TEST051-056: Input validation, argument checking, validation rules
|
|
106
|
+
- RULE1-RULE10: Comprehensive validation rule enforcement
|
|
107
|
+
|
|
108
|
+
#### Schema Validation Tests (TEST163-167) - 10 tests ✅
|
|
109
|
+
- TEST163-167: JSON schema validation for arguments and outputs
|
|
110
|
+
|
|
111
|
+
#### Caller Tests (TEST156-162, TEST274-283) - 21 tests ✅
|
|
112
|
+
- TEST156-162: StdinSource variants and debugging
|
|
113
|
+
- TEST274-283: CapArgumentValue creation and handling
|
|
114
|
+
|
|
115
|
+
#### Registry Tests (TEST135-147) - 17 tests ✅
|
|
116
|
+
- TEST135-147: Registry creation, caching, URL encoding, configuration
|
|
117
|
+
|
|
118
|
+
**Total: 165/308 passing tests (54% complete)**
|
|
119
|
+
|
|
120
|
+
## Architecture
|
|
121
|
+
|
|
122
|
+
### MediaUrn
|
|
123
|
+
|
|
124
|
+
Media URNs use the "media" prefix and describe data types using tags:
|
|
125
|
+
|
|
126
|
+
```
|
|
127
|
+
media:<markers>[;key=value]*
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
Examples:
|
|
131
|
+
- `media:bytes` - Binary data
|
|
132
|
+
- `media:textable` - Text, single value
|
|
133
|
+
- `media:pdf;bytes` - PDF document (binary)
|
|
134
|
+
|
|
135
|
+
### CapUrn
|
|
136
|
+
|
|
137
|
+
Cap URNs use the "cap" prefix and require `in` and `out` direction specs:
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
cap:in="<media-urn>";out="<media-urn>"[;key=value]*
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
Examples:
|
|
144
|
+
- `cap:in="media:void";test;out="media:void"` - No-op test capability
|
|
145
|
+
- `cap:in="media:pdf;bytes";generate-thumbnail;out="media:image;png;bytes;thumbnail"` - PDF thumbnail generator
|
|
146
|
+
|
|
147
|
+
### Matching Semantics
|
|
148
|
+
|
|
149
|
+
Matching follows tagged URN semantics with direction-aware rules:
|
|
150
|
+
|
|
151
|
+
- **Input matching**: `cap_input.accepts(request_input)` - Does the cap's input requirement accept the request's data?
|
|
152
|
+
- **Output matching**: `cap_output.conforms_to(request_output)` - Does the cap's output conform to the request's expectation?
|
|
153
|
+
- **Missing tags** are treated as wildcards (less specific, can handle any value)
|
|
154
|
+
- **Specificity**: Direction specs contribute their MediaUrn tag count; more tags = more specific
|
|
155
|
+
|
|
156
|
+
## Development
|
|
157
|
+
|
|
158
|
+
The Python implementation follows these principles:
|
|
159
|
+
|
|
160
|
+
1. **Production code only** - No placeholders, TODOs, or stopgaps
|
|
161
|
+
2. **Root cause fixes** - Issues are fixed at their source, not worked around
|
|
162
|
+
3. **Python conventions** - Follows Pythonic patterns while maintaining semantic compatibility
|
|
163
|
+
4. **Test-driven** - Tests expose issues and track completion
|
|
164
|
+
5. **Cross-language compatibility** - Tests numbered to match Rust reference implementation
|
|
165
|
+
|
|
166
|
+
## License
|
|
167
|
+
|
|
168
|
+
MIT
|
|
169
|
+
|
|
170
|
+
## Reference
|
|
171
|
+
|
|
172
|
+
- Rust reference implementation: [capdag](../capdag)
|
|
173
|
+
- Tagged URN Python: [tagged-urn-py](../tagged-urn-py)
|
|
174
|
+
- Tagged URN Rust: [tagged-urn-rs](https://github.com/tagged-urn-rs)
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
[build-system]
|
|
2
|
+
requires = ["setuptools>=61.0"]
|
|
3
|
+
build-backend = "setuptools.build_meta"
|
|
4
|
+
|
|
5
|
+
[project]
|
|
6
|
+
name = "capdag"
|
|
7
|
+
version = "0.148.1428"
|
|
8
|
+
description = "Core cap URN and definition system for MACHFAB cartridges"
|
|
9
|
+
authors = [{name = "https://github.com/machinefabric"}]
|
|
10
|
+
license = {text = "MIT"}
|
|
11
|
+
requires-python = ">=3.10"
|
|
12
|
+
dependencies = [
|
|
13
|
+
"tagged-urn>=0.16.68",
|
|
14
|
+
"cbor2>=5.4.0",
|
|
15
|
+
]
|
|
16
|
+
|
|
17
|
+
[project.optional-dependencies]
|
|
18
|
+
dev = [
|
|
19
|
+
"pytest>=7.0",
|
|
20
|
+
"pytest-cov>=4.0",
|
|
21
|
+
]
|
|
22
|
+
|
|
23
|
+
[tool.setuptools.packages.find]
|
|
24
|
+
where = ["src"]
|
|
25
|
+
|
|
26
|
+
[tool.pytest.ini_options]
|
|
27
|
+
testpaths = ["tests"]
|
|
28
|
+
python_files = ["test_*.py"]
|
|
29
|
+
python_functions = ["test_*"]
|
|
@@ -0,0 +1,495 @@
|
|
|
1
|
+
"""Cap SDK - Core cap URN and definition system
|
|
2
|
+
|
|
3
|
+
This library provides the fundamental cap URN system used across
|
|
4
|
+
all MACHFAB cartridges and providers. It defines the formal structure for cap
|
|
5
|
+
identifiers with flat tag-based naming, wildcard support, and specificity comparison.
|
|
6
|
+
"""
|
|
7
|
+
|
|
8
|
+
# URN module
|
|
9
|
+
from capdag.urn.media_urn import (
|
|
10
|
+
MediaUrn,
|
|
11
|
+
MediaUrnError,
|
|
12
|
+
# Standard media URN constants
|
|
13
|
+
MEDIA_VOID,
|
|
14
|
+
MEDIA_STRING,
|
|
15
|
+
MEDIA_INTEGER,
|
|
16
|
+
MEDIA_NUMBER,
|
|
17
|
+
MEDIA_BOOLEAN,
|
|
18
|
+
MEDIA_OBJECT,
|
|
19
|
+
MEDIA_IDENTITY,
|
|
20
|
+
MEDIA_LIST,
|
|
21
|
+
MEDIA_TEXTABLE_LIST,
|
|
22
|
+
MEDIA_STRING_LIST,
|
|
23
|
+
MEDIA_INTEGER_LIST,
|
|
24
|
+
MEDIA_NUMBER_LIST,
|
|
25
|
+
MEDIA_BOOLEAN_LIST,
|
|
26
|
+
MEDIA_OBJECT_LIST,
|
|
27
|
+
MEDIA_PNG,
|
|
28
|
+
MEDIA_JPEG,
|
|
29
|
+
MEDIA_GIF,
|
|
30
|
+
MEDIA_BMP,
|
|
31
|
+
MEDIA_TIFF,
|
|
32
|
+
MEDIA_WEBP,
|
|
33
|
+
MEDIA_AUDIO,
|
|
34
|
+
MEDIA_WAV,
|
|
35
|
+
MEDIA_MP3,
|
|
36
|
+
MEDIA_FLAC,
|
|
37
|
+
MEDIA_OGG,
|
|
38
|
+
MEDIA_AAC,
|
|
39
|
+
MEDIA_M4A,
|
|
40
|
+
MEDIA_AIFF,
|
|
41
|
+
MEDIA_OPUS,
|
|
42
|
+
MEDIA_VIDEO,
|
|
43
|
+
MEDIA_MP4,
|
|
44
|
+
MEDIA_MOV,
|
|
45
|
+
MEDIA_WEBM,
|
|
46
|
+
MEDIA_MKV,
|
|
47
|
+
MEDIA_AUDIO_SPEECH,
|
|
48
|
+
MEDIA_PDF,
|
|
49
|
+
MEDIA_EPUB,
|
|
50
|
+
MEDIA_MD,
|
|
51
|
+
MEDIA_TXT,
|
|
52
|
+
MEDIA_RST,
|
|
53
|
+
MEDIA_LOG,
|
|
54
|
+
MEDIA_HTML,
|
|
55
|
+
MEDIA_XML,
|
|
56
|
+
MEDIA_JSON,
|
|
57
|
+
MEDIA_JSON_SCHEMA,
|
|
58
|
+
MEDIA_YAML,
|
|
59
|
+
MEDIA_JSON_VALUE,
|
|
60
|
+
MEDIA_JSON_RECORD,
|
|
61
|
+
MEDIA_JSON_LIST,
|
|
62
|
+
MEDIA_JSON_LIST_RECORD,
|
|
63
|
+
MEDIA_YAML_VALUE,
|
|
64
|
+
MEDIA_YAML_RECORD,
|
|
65
|
+
MEDIA_YAML_LIST,
|
|
66
|
+
MEDIA_YAML_LIST_RECORD,
|
|
67
|
+
MEDIA_CSV,
|
|
68
|
+
MEDIA_CSV_LIST,
|
|
69
|
+
MEDIA_FILE_PATH,
|
|
70
|
+
MEDIA_TEXTABLE_PAGE,
|
|
71
|
+
MEDIA_MODEL_SPEC,
|
|
72
|
+
MEDIA_MODEL_SPEC_GGUF_VISION,
|
|
73
|
+
MEDIA_MODEL_SPEC_GGUF_LLM,
|
|
74
|
+
MEDIA_MODEL_SPEC_GGUF_EMBEDDINGS,
|
|
75
|
+
MEDIA_MODEL_SPEC_MLX_VISION,
|
|
76
|
+
MEDIA_MODEL_SPEC_MLX_LLM,
|
|
77
|
+
MEDIA_MODEL_SPEC_MLX_EMBEDDINGS,
|
|
78
|
+
MEDIA_MODEL_SPEC_CANDLE_VISION,
|
|
79
|
+
MEDIA_MODEL_SPEC_CANDLE_EMBEDDINGS,
|
|
80
|
+
MEDIA_MODEL_SPEC_CANDLE_IMAGE_EMBEDDINGS,
|
|
81
|
+
MEDIA_MODEL_SPEC_CANDLE_TRANSCRIPTION,
|
|
82
|
+
MEDIA_MLX_MODEL_PATH,
|
|
83
|
+
MEDIA_MODEL_REPO,
|
|
84
|
+
MEDIA_HF_TOKEN,
|
|
85
|
+
MEDIA_MODEL_ARCH_LIST,
|
|
86
|
+
MEDIA_MODEL_SEARCH_REQUEST,
|
|
87
|
+
MEDIA_MODEL_SEARCH_RESPONSE,
|
|
88
|
+
MEDIA_MODEL_FILTER_RESOLUTION,
|
|
89
|
+
MEDIA_MODEL_DIM,
|
|
90
|
+
MEDIA_DOWNLOAD_OUTPUT,
|
|
91
|
+
MEDIA_LIST_OUTPUT,
|
|
92
|
+
MEDIA_STATUS_OUTPUT,
|
|
93
|
+
MEDIA_CONTENTS_OUTPUT,
|
|
94
|
+
MEDIA_AVAILABILITY_OUTPUT,
|
|
95
|
+
MEDIA_PATH_OUTPUT,
|
|
96
|
+
MEDIA_EMBEDDING_VECTOR,
|
|
97
|
+
MEDIA_LLM_INFERENCE_OUTPUT,
|
|
98
|
+
MEDIA_IMAGE_DESCRIPTION,
|
|
99
|
+
MEDIA_TRANSCRIPTION_OUTPUT,
|
|
100
|
+
MEDIA_DECISION,
|
|
101
|
+
binary_media_urn_for_ext,
|
|
102
|
+
text_media_urn_for_ext,
|
|
103
|
+
image_media_urn_for_ext,
|
|
104
|
+
audio_media_urn_for_ext,
|
|
105
|
+
)
|
|
106
|
+
|
|
107
|
+
from capdag.urn.cap_urn import (
|
|
108
|
+
CapUrn,
|
|
109
|
+
CapUrnError,
|
|
110
|
+
CapUrnBuilder,
|
|
111
|
+
CapMatcher,
|
|
112
|
+
)
|
|
113
|
+
|
|
114
|
+
# Cap module
|
|
115
|
+
from capdag.cap.response import ResponseWrapper
|
|
116
|
+
from capdag.cap.definition import Cap, CapArg, CapOutput, RegisteredBy, StdinSource, PositionSource, CliFlagSource, MediaSpecDef
|
|
117
|
+
from capdag.cap.validation import (
|
|
118
|
+
validate_cap_args,
|
|
119
|
+
validate_positional_arguments,
|
|
120
|
+
ValidationError,
|
|
121
|
+
MissingRequiredArgumentError,
|
|
122
|
+
InvalidArgumentTypeError,
|
|
123
|
+
TooManyArgumentsError,
|
|
124
|
+
InvalidCapSchemaError,
|
|
125
|
+
MediaSpecValidationError,
|
|
126
|
+
RESERVED_CLI_FLAGS,
|
|
127
|
+
)
|
|
128
|
+
from capdag.cap.schema_validation import (
|
|
129
|
+
SchemaValidator,
|
|
130
|
+
SchemaValidationError,
|
|
131
|
+
SchemaCompilationError,
|
|
132
|
+
ArgumentValidationError,
|
|
133
|
+
OutputValidationError,
|
|
134
|
+
MediaUrnNotResolvedError,
|
|
135
|
+
)
|
|
136
|
+
from capdag.cap.caller import (
|
|
137
|
+
StdinSourceData,
|
|
138
|
+
StdinSourceFileReference,
|
|
139
|
+
CapArgumentValue,
|
|
140
|
+
CapResult,
|
|
141
|
+
CapResultKind,
|
|
142
|
+
)
|
|
143
|
+
from capdag.cap.registry import (
|
|
144
|
+
CapRegistry,
|
|
145
|
+
RegistryConfig,
|
|
146
|
+
RegistryError,
|
|
147
|
+
HttpError,
|
|
148
|
+
NotFoundError,
|
|
149
|
+
ParseError,
|
|
150
|
+
CacheError,
|
|
151
|
+
normalize_cap_urn,
|
|
152
|
+
)
|
|
153
|
+
|
|
154
|
+
# Media module
|
|
155
|
+
from capdag.media.registry import (
|
|
156
|
+
MediaUrnRegistry,
|
|
157
|
+
StoredMediaSpec,
|
|
158
|
+
MediaRegistryError,
|
|
159
|
+
ExtensionNotFoundError,
|
|
160
|
+
normalize_media_urn,
|
|
161
|
+
)
|
|
162
|
+
from capdag.media.spec import (
|
|
163
|
+
MediaValidation,
|
|
164
|
+
ResolvedMediaSpec,
|
|
165
|
+
MediaSpecError,
|
|
166
|
+
UnresolvableMediaUrn,
|
|
167
|
+
DuplicateMediaUrn,
|
|
168
|
+
resolve_media_urn,
|
|
169
|
+
validate_media_specs_no_duplicates,
|
|
170
|
+
# Profile URLs
|
|
171
|
+
SCHEMA_BASE,
|
|
172
|
+
PROFILE_STR,
|
|
173
|
+
PROFILE_INT,
|
|
174
|
+
PROFILE_NUM,
|
|
175
|
+
PROFILE_BOOL,
|
|
176
|
+
PROFILE_OBJ,
|
|
177
|
+
PROFILE_STR_ARRAY,
|
|
178
|
+
PROFILE_INT_ARRAY,
|
|
179
|
+
PROFILE_NUM_ARRAY,
|
|
180
|
+
PROFILE_BOOL_ARRAY,
|
|
181
|
+
PROFILE_OBJ_ARRAY,
|
|
182
|
+
PROFILE_VOID,
|
|
183
|
+
PROFILE_IMAGE,
|
|
184
|
+
PROFILE_AUDIO,
|
|
185
|
+
PROFILE_VIDEO,
|
|
186
|
+
PROFILE_TEXT,
|
|
187
|
+
PROFILE_PDF,
|
|
188
|
+
PROFILE_EPUB,
|
|
189
|
+
PROFILE_MD,
|
|
190
|
+
PROFILE_TXT,
|
|
191
|
+
PROFILE_RST,
|
|
192
|
+
PROFILE_LOG,
|
|
193
|
+
PROFILE_HTML,
|
|
194
|
+
PROFILE_XML,
|
|
195
|
+
PROFILE_JSON,
|
|
196
|
+
PROFILE_YAML,
|
|
197
|
+
PROFILE_CAPDAG_DOWNLOAD_OUTPUT,
|
|
198
|
+
PROFILE_CAPDAG_LOAD_OUTPUT,
|
|
199
|
+
PROFILE_CAPDAG_UNLOAD_OUTPUT,
|
|
200
|
+
PROFILE_CAPDAG_LIST_OUTPUT,
|
|
201
|
+
PROFILE_CAPDAG_STATUS_OUTPUT,
|
|
202
|
+
PROFILE_CAPDAG_CONTENTS_OUTPUT,
|
|
203
|
+
PROFILE_CAPDAG_GENERATE_OUTPUT,
|
|
204
|
+
PROFILE_CAPDAG_QUESTIONS_ARRAY,
|
|
205
|
+
get_schema_base,
|
|
206
|
+
get_profile_url,
|
|
207
|
+
)
|
|
208
|
+
|
|
209
|
+
# Bifaci module
|
|
210
|
+
from capdag.bifaci import decode_chunk_payload
|
|
211
|
+
from capdag.bifaci.manifest import CapManifest, CapGroup, default_group
|
|
212
|
+
from capdag.bifaci.relay import (
|
|
213
|
+
RelaySlave,
|
|
214
|
+
RelayMaster,
|
|
215
|
+
RelayError,
|
|
216
|
+
)
|
|
217
|
+
|
|
218
|
+
# Machine module
|
|
219
|
+
from capdag.machine import (
|
|
220
|
+
MachineSyntaxError,
|
|
221
|
+
MachineAbstractionError,
|
|
222
|
+
MachineParseError,
|
|
223
|
+
NoCapabilityStepsError,
|
|
224
|
+
UnknownCapError,
|
|
225
|
+
UnmatchedSourceInCapArgsError,
|
|
226
|
+
AmbiguousMachineNotationError,
|
|
227
|
+
CyclicMachineStrandError,
|
|
228
|
+
NodeId,
|
|
229
|
+
EdgeAssignmentBinding,
|
|
230
|
+
MachineEdge,
|
|
231
|
+
MachineStrand,
|
|
232
|
+
Machine,
|
|
233
|
+
parse_machine,
|
|
234
|
+
)
|
|
235
|
+
|
|
236
|
+
# Orchestrator module (imported as submodule to avoid name collisions with RegistryError)
|
|
237
|
+
import capdag.orchestrator # noqa: F401
|
|
238
|
+
|
|
239
|
+
# Standard module
|
|
240
|
+
from capdag.standard.caps import (
|
|
241
|
+
CAP_IDENTITY,
|
|
242
|
+
CAP_DISCARD,
|
|
243
|
+
CAP_ADAPTER_SELECTION,
|
|
244
|
+
identity_urn,
|
|
245
|
+
discard_urn,
|
|
246
|
+
adapter_selection_urn,
|
|
247
|
+
identity_cap,
|
|
248
|
+
discard_cap,
|
|
249
|
+
media_urn_for_type,
|
|
250
|
+
coercion_urn,
|
|
251
|
+
all_coercion_paths,
|
|
252
|
+
model_availability_urn,
|
|
253
|
+
model_path_urn,
|
|
254
|
+
llm_generate_text_urn,
|
|
255
|
+
render_page_image_urn,
|
|
256
|
+
format_conversion_urn,
|
|
257
|
+
)
|
|
258
|
+
|
|
259
|
+
__all__ = [
|
|
260
|
+
# MediaUrn
|
|
261
|
+
"MediaUrn",
|
|
262
|
+
"MediaUrnError",
|
|
263
|
+
# Media constants
|
|
264
|
+
"MEDIA_VOID",
|
|
265
|
+
"MEDIA_STRING",
|
|
266
|
+
"MEDIA_INTEGER",
|
|
267
|
+
"MEDIA_NUMBER",
|
|
268
|
+
"MEDIA_BOOLEAN",
|
|
269
|
+
"MEDIA_OBJECT",
|
|
270
|
+
"MEDIA_IDENTITY",
|
|
271
|
+
"MEDIA_LIST",
|
|
272
|
+
"MEDIA_TEXTABLE_LIST",
|
|
273
|
+
"MEDIA_STRING_LIST",
|
|
274
|
+
"MEDIA_INTEGER_LIST",
|
|
275
|
+
"MEDIA_NUMBER_LIST",
|
|
276
|
+
"MEDIA_BOOLEAN_LIST",
|
|
277
|
+
"MEDIA_OBJECT_LIST",
|
|
278
|
+
"MEDIA_PNG",
|
|
279
|
+
"MEDIA_JPEG",
|
|
280
|
+
"MEDIA_GIF",
|
|
281
|
+
"MEDIA_BMP",
|
|
282
|
+
"MEDIA_TIFF",
|
|
283
|
+
"MEDIA_WEBP",
|
|
284
|
+
"MEDIA_AUDIO",
|
|
285
|
+
"MEDIA_WAV",
|
|
286
|
+
"MEDIA_MP3",
|
|
287
|
+
"MEDIA_FLAC",
|
|
288
|
+
"MEDIA_OGG",
|
|
289
|
+
"MEDIA_AAC",
|
|
290
|
+
"MEDIA_M4A",
|
|
291
|
+
"MEDIA_AIFF",
|
|
292
|
+
"MEDIA_OPUS",
|
|
293
|
+
"MEDIA_VIDEO",
|
|
294
|
+
"MEDIA_MP4",
|
|
295
|
+
"MEDIA_MOV",
|
|
296
|
+
"MEDIA_WEBM",
|
|
297
|
+
"MEDIA_MKV",
|
|
298
|
+
"MEDIA_AUDIO_SPEECH",
|
|
299
|
+
"MEDIA_PDF",
|
|
300
|
+
"MEDIA_EPUB",
|
|
301
|
+
"MEDIA_MD",
|
|
302
|
+
"MEDIA_TXT",
|
|
303
|
+
"MEDIA_RST",
|
|
304
|
+
"MEDIA_LOG",
|
|
305
|
+
"MEDIA_HTML",
|
|
306
|
+
"MEDIA_XML",
|
|
307
|
+
"MEDIA_JSON",
|
|
308
|
+
"MEDIA_JSON_SCHEMA",
|
|
309
|
+
"MEDIA_YAML",
|
|
310
|
+
"MEDIA_JSON_VALUE",
|
|
311
|
+
"MEDIA_JSON_RECORD",
|
|
312
|
+
"MEDIA_JSON_LIST",
|
|
313
|
+
"MEDIA_JSON_LIST_RECORD",
|
|
314
|
+
"MEDIA_YAML_VALUE",
|
|
315
|
+
"MEDIA_YAML_RECORD",
|
|
316
|
+
"MEDIA_YAML_LIST",
|
|
317
|
+
"MEDIA_YAML_LIST_RECORD",
|
|
318
|
+
"MEDIA_CSV",
|
|
319
|
+
"MEDIA_CSV_LIST",
|
|
320
|
+
"MEDIA_FILE_PATH",
|
|
321
|
+
"MEDIA_TEXTABLE_PAGE",
|
|
322
|
+
"MEDIA_MODEL_SPEC",
|
|
323
|
+
"MEDIA_MODEL_SPEC_GGUF_VISION",
|
|
324
|
+
"MEDIA_MODEL_SPEC_GGUF_LLM",
|
|
325
|
+
"MEDIA_MODEL_SPEC_GGUF_EMBEDDINGS",
|
|
326
|
+
"MEDIA_MODEL_SPEC_MLX_VISION",
|
|
327
|
+
"MEDIA_MODEL_SPEC_MLX_LLM",
|
|
328
|
+
"MEDIA_MODEL_SPEC_MLX_EMBEDDINGS",
|
|
329
|
+
"MEDIA_MODEL_SPEC_CANDLE_VISION",
|
|
330
|
+
"MEDIA_MODEL_SPEC_CANDLE_EMBEDDINGS",
|
|
331
|
+
"MEDIA_MODEL_SPEC_CANDLE_IMAGE_EMBEDDINGS",
|
|
332
|
+
"MEDIA_MODEL_SPEC_CANDLE_TRANSCRIPTION",
|
|
333
|
+
"MEDIA_MLX_MODEL_PATH",
|
|
334
|
+
"MEDIA_MODEL_REPO",
|
|
335
|
+
"MEDIA_HF_TOKEN",
|
|
336
|
+
"MEDIA_MODEL_ARCH_LIST",
|
|
337
|
+
"MEDIA_MODEL_SEARCH_REQUEST",
|
|
338
|
+
"MEDIA_MODEL_SEARCH_RESPONSE",
|
|
339
|
+
"MEDIA_MODEL_FILTER_RESOLUTION",
|
|
340
|
+
"MEDIA_MODEL_DIM",
|
|
341
|
+
"MEDIA_DOWNLOAD_OUTPUT",
|
|
342
|
+
"MEDIA_LIST_OUTPUT",
|
|
343
|
+
"MEDIA_STATUS_OUTPUT",
|
|
344
|
+
"MEDIA_CONTENTS_OUTPUT",
|
|
345
|
+
"MEDIA_AVAILABILITY_OUTPUT",
|
|
346
|
+
"MEDIA_PATH_OUTPUT",
|
|
347
|
+
"MEDIA_EMBEDDING_VECTOR",
|
|
348
|
+
"MEDIA_LLM_INFERENCE_OUTPUT",
|
|
349
|
+
"MEDIA_IMAGE_DESCRIPTION",
|
|
350
|
+
"MEDIA_TRANSCRIPTION_OUTPUT",
|
|
351
|
+
"MEDIA_DECISION",
|
|
352
|
+
"binary_media_urn_for_ext",
|
|
353
|
+
"text_media_urn_for_ext",
|
|
354
|
+
"image_media_urn_for_ext",
|
|
355
|
+
"audio_media_urn_for_ext",
|
|
356
|
+
# CapUrn
|
|
357
|
+
"CapUrn",
|
|
358
|
+
"CapUrnError",
|
|
359
|
+
"CapUrnBuilder",
|
|
360
|
+
"CapMatcher",
|
|
361
|
+
# Response
|
|
362
|
+
"ResponseWrapper",
|
|
363
|
+
# Cap
|
|
364
|
+
"Cap",
|
|
365
|
+
"CapArg",
|
|
366
|
+
"CapOutput",
|
|
367
|
+
"StdinSource",
|
|
368
|
+
"PositionSource",
|
|
369
|
+
"CliFlagSource",
|
|
370
|
+
"MediaSpecDef",
|
|
371
|
+
# Manifest
|
|
372
|
+
"CapManifest",
|
|
373
|
+
"CapGroup",
|
|
374
|
+
"default_group",
|
|
375
|
+
# Bifaci utilities
|
|
376
|
+
"decode_chunk_payload",
|
|
377
|
+
# Validation
|
|
378
|
+
"validate_cap_args",
|
|
379
|
+
"validate_positional_arguments",
|
|
380
|
+
"ValidationError",
|
|
381
|
+
"MissingRequiredArgumentError",
|
|
382
|
+
"InvalidArgumentTypeError",
|
|
383
|
+
"TooManyArgumentsError",
|
|
384
|
+
"InvalidCapSchemaError",
|
|
385
|
+
"MediaSpecValidationError",
|
|
386
|
+
"RESERVED_CLI_FLAGS",
|
|
387
|
+
# Schema validation
|
|
388
|
+
"SchemaValidator",
|
|
389
|
+
"SchemaValidationError",
|
|
390
|
+
"SchemaCompilationError",
|
|
391
|
+
"ArgumentValidationError",
|
|
392
|
+
"OutputValidationError",
|
|
393
|
+
"MediaUrnNotResolvedError",
|
|
394
|
+
# Caller
|
|
395
|
+
"StdinSourceData",
|
|
396
|
+
"StdinSourceFileReference",
|
|
397
|
+
"CapArgumentValue",
|
|
398
|
+
"CapResult",
|
|
399
|
+
"CapResultKind",
|
|
400
|
+
# Registry
|
|
401
|
+
"CapRegistry",
|
|
402
|
+
"RegistryConfig",
|
|
403
|
+
"RegistryError",
|
|
404
|
+
"HttpError",
|
|
405
|
+
"NotFoundError",
|
|
406
|
+
"ParseError",
|
|
407
|
+
"CacheError",
|
|
408
|
+
"normalize_cap_urn",
|
|
409
|
+
# Media Registry
|
|
410
|
+
"MediaUrnRegistry",
|
|
411
|
+
"StoredMediaSpec",
|
|
412
|
+
"MediaRegistryError",
|
|
413
|
+
"ExtensionNotFoundError",
|
|
414
|
+
"normalize_media_urn",
|
|
415
|
+
# Media Spec
|
|
416
|
+
"MediaValidation",
|
|
417
|
+
"ResolvedMediaSpec",
|
|
418
|
+
"MediaSpecError",
|
|
419
|
+
"UnresolvableMediaUrn",
|
|
420
|
+
"DuplicateMediaUrn",
|
|
421
|
+
"resolve_media_urn",
|
|
422
|
+
"validate_media_specs_no_duplicates",
|
|
423
|
+
"SCHEMA_BASE",
|
|
424
|
+
"PROFILE_STR",
|
|
425
|
+
"PROFILE_INT",
|
|
426
|
+
"PROFILE_NUM",
|
|
427
|
+
"PROFILE_BOOL",
|
|
428
|
+
"PROFILE_OBJ",
|
|
429
|
+
"PROFILE_STR_ARRAY",
|
|
430
|
+
"PROFILE_INT_ARRAY",
|
|
431
|
+
"PROFILE_NUM_ARRAY",
|
|
432
|
+
"PROFILE_BOOL_ARRAY",
|
|
433
|
+
"PROFILE_OBJ_ARRAY",
|
|
434
|
+
"PROFILE_VOID",
|
|
435
|
+
"PROFILE_IMAGE",
|
|
436
|
+
"PROFILE_AUDIO",
|
|
437
|
+
"PROFILE_VIDEO",
|
|
438
|
+
"PROFILE_TEXT",
|
|
439
|
+
"PROFILE_PDF",
|
|
440
|
+
"PROFILE_EPUB",
|
|
441
|
+
"PROFILE_MD",
|
|
442
|
+
"PROFILE_TXT",
|
|
443
|
+
"PROFILE_RST",
|
|
444
|
+
"PROFILE_LOG",
|
|
445
|
+
"PROFILE_HTML",
|
|
446
|
+
"PROFILE_XML",
|
|
447
|
+
"PROFILE_JSON",
|
|
448
|
+
"PROFILE_YAML",
|
|
449
|
+
"PROFILE_CAPDAG_DOWNLOAD_OUTPUT",
|
|
450
|
+
"PROFILE_CAPDAG_LOAD_OUTPUT",
|
|
451
|
+
"PROFILE_CAPDAG_UNLOAD_OUTPUT",
|
|
452
|
+
"PROFILE_CAPDAG_LIST_OUTPUT",
|
|
453
|
+
"PROFILE_CAPDAG_STATUS_OUTPUT",
|
|
454
|
+
"PROFILE_CAPDAG_CONTENTS_OUTPUT",
|
|
455
|
+
"PROFILE_CAPDAG_GENERATE_OUTPUT",
|
|
456
|
+
"PROFILE_CAPDAG_QUESTIONS_ARRAY",
|
|
457
|
+
"get_schema_base",
|
|
458
|
+
"get_profile_url",
|
|
459
|
+
# Standard caps
|
|
460
|
+
"CAP_IDENTITY",
|
|
461
|
+
"CAP_DISCARD",
|
|
462
|
+
"CAP_ADAPTER_SELECTION",
|
|
463
|
+
"adapter_selection_urn",
|
|
464
|
+
"identity_urn",
|
|
465
|
+
"discard_urn",
|
|
466
|
+
"identity_cap",
|
|
467
|
+
"discard_cap",
|
|
468
|
+
"media_urn_for_type",
|
|
469
|
+
"coercion_urn",
|
|
470
|
+
"all_coercion_paths",
|
|
471
|
+
"model_availability_urn",
|
|
472
|
+
"model_path_urn",
|
|
473
|
+
"llm_generate_text_urn",
|
|
474
|
+
"render_page_image_urn",
|
|
475
|
+
"format_conversion_urn",
|
|
476
|
+
# Relay
|
|
477
|
+
"RelaySlave",
|
|
478
|
+
"RelayMaster",
|
|
479
|
+
"RelayError",
|
|
480
|
+
# Machine notation
|
|
481
|
+
"MachineSyntaxError",
|
|
482
|
+
"MachineAbstractionError",
|
|
483
|
+
"MachineParseError",
|
|
484
|
+
"NoCapabilityStepsError",
|
|
485
|
+
"UnknownCapError",
|
|
486
|
+
"UnmatchedSourceInCapArgsError",
|
|
487
|
+
"AmbiguousMachineNotationError",
|
|
488
|
+
"CyclicMachineStrandError",
|
|
489
|
+
"NodeId",
|
|
490
|
+
"EdgeAssignmentBinding",
|
|
491
|
+
"MachineEdge",
|
|
492
|
+
"MachineStrand",
|
|
493
|
+
"Machine",
|
|
494
|
+
"parse_machine",
|
|
495
|
+
]
|