English fallback
This translation is missing; the canonical English reference follows.
fuzzy1337.executors.contracts¶
fuzzy1337.executors.contracts
¶
Typed contracts for governed executor providers and local process execution.
CapabilityDescriptor
dataclass
¶
One executable capability derived from a provider declaration.
Source code in fuzzy1337/executors/contracts.py
104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
__post_init__() -> None
¶
Validate the capability declaration.
Source code in fuzzy1337/executors/contracts.py
113 114 115 116 117 118 119 120 121 122 123 124 125 126 | |
ExecutionAuthorization
dataclass
¶
Upstream scope/policy decision bound to one exact prepared invocation.
Source code in fuzzy1337/executors/contracts.py
150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
__post_init__() -> None
¶
Validate the authorization binding.
Source code in fuzzy1337/executors/contracts.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | |
ExecutionResources
dataclass
¶
Portable resource bounds enforced by the local executor.
Source code in fuzzy1337/executors/contracts.py
177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
__post_init__() -> None
¶
Validate portable executor resource bounds.
Source code in fuzzy1337/executors/contracts.py
185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 | |
LocalExecutionRequest
dataclass
¶
Fully bound request accepted by the local subprocess executor.
Source code in fuzzy1337/executors/contracts.py
232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
__post_init__() -> None
¶
Validate that the request is internally consistent and authorized.
Source code in fuzzy1337/executors/contracts.py
243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 | |
ExecutionEventKind
¶
Bases: StrEnum
Structured progress events emitted by an executor.
Source code in fuzzy1337/executors/contracts.py
276 277 278 279 280 281 282 | |
ExecutionTermination
¶
Bases: StrEnum
Why the local executor stopped owning the process.
Source code in fuzzy1337/executors/contracts.py
285 286 287 288 289 290 291 | |
ExecutionEvent
dataclass
¶
One monotonically sequenced executor observation.
Source code in fuzzy1337/executors/contracts.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
__post_init__() -> None
¶
Validate the event payload and lifecycle semantics.
Source code in fuzzy1337/executors/contracts.py
303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 | |
LocalExecutionResult
dataclass
¶
Complete local process outcome plus bounded raw output and event history.
Source code in fuzzy1337/executors/contracts.py
334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
__post_init__() -> None
¶
Validate the completed result and deterministic event sequence.
Source code in fuzzy1337/executors/contracts.py
344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 | |
AdapterRegistration
dataclass
¶
Store one lazy adapter registration.
Source code in fuzzy1337/executors/contracts.py
370 371 372 373 374 375 376 | |
LazyAdapterRegistry
¶
Resolve declared providers only when one of their capabilities is requested.
Source code in fuzzy1337/executors/contracts.py
379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | |
Capabilities: tuple[str, ...]
property
¶
Return declared capabilities without loading provider implementations.
Returns:
| Type | Description |
|---|---|
tuple[str, ...]
|
Sorted declared capability identifiers without loading providers. |
__init__() -> None
¶
Create an empty registry without loading providers.
Source code in fuzzy1337/executors/contracts.py
382 383 384 385 386 | |
Register(descriptor: AdapterDescriptor, loader: AdapterLoader) -> None
¶
Register immutable metadata and a lazy provider factory.
Mutates registry indexes without loading or executing the provider.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
descriptor
|
AdapterDescriptor
|
Immutable declaration to index |
required |
loader
|
AdapterLoader
|
Deferred factory called on first resolution. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
The adapter identifier is already registered. |
TypeError
|
The loader is not callable. |
Source code in fuzzy1337/executors/contracts.py
398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 | |
Resolve(capability: str, adapter_id: str | None = None) -> ToolAdapter
¶
Load one provider deterministically and validate its declared identity.
First resolution invokes the loader and caches its result. Loader exceptions propagate. Resolution grants no execution authority.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
capability
|
str
|
Declared capability to resolve |
required |
adapter_id
|
str | None
|
Explicit provider when selection would otherwise be ambiguous. |
None
|
Returns:
| Type | Description |
|---|---|
ToolAdapter
|
Cached or newly loaded provider with a matching descriptor. |
Raises:
| Type | Description |
|---|---|
LookupError
|
The capability is unknown, ambiguous or absent from the adapter. |
TypeError
|
The loader result does not implement ToolAdapter. |
ValueError
|
The loaded descriptor differs from the registered metadata. |
Source code in fuzzy1337/executors/contracts.py
423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 | |
RequireIdentifier(value: str, field_name: str) -> None
¶
Require a portable lowercase machine identifier.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Candidate portable lowercase identifier |
required |
field_name
|
str
|
Field label in validation errors. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
The value fails the identifier grammar. |
Source code in fuzzy1337/executors/contracts.py
34 35 36 37 38 39 40 41 42 43 44 45 46 | |
RequireReference(value: str, field_name: str) -> None
¶
Require a non-empty single-line reference value.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
value
|
str
|
Nonempty single-line text without NUL |
required |
field_name
|
str
|
Field label in validation errors. |
required |
Raises:
| Type | Description |
|---|---|
ValueError
|
The reference is not valid nonempty single-line text. |
Source code in fuzzy1337/executors/contracts.py
49 50 51 52 53 54 55 56 57 58 59 60 61 | |
UniqueIdentifiers(values: tuple[str, ...], field_name: str) -> tuple[str, ...]
¶
Validate and freeze a sequence of unique identifiers.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
values
|
tuple[str, ...]
|
Identifiers to validate without reordering |
required |
field_name
|
str
|
Field label in validation errors. |
required |
Returns:
| Type | Description |
|---|---|
tuple[str, ...]
|
Validated immutable tuple in declaration order. |
Raises:
| Type | Description |
|---|---|
ValueError
|
An identifier is invalid or duplicated. |
Source code in fuzzy1337/executors/contracts.py
64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | |
InvocationDigest(invocation: AdapterInvocation) -> str
¶
Bind an authorization record to the exact immutable adapter invocation.
A digest binds metadata; it does not establish authorization by itself.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invocation
|
AdapterInvocation
|
Exact prepared invocation to bind to authorization. |
required |
Returns:
| Type | Description |
|---|---|
str
|
Lowercase SHA-256 of the deterministic serialized invocation. |
Source code in fuzzy1337/executors/contracts.py
89 90 91 92 93 94 95 96 97 98 99 100 101 | |
CapabilityDescriptors(descriptor: AdapterDescriptor) -> tuple[CapabilityDescriptor, ...]
¶
Expand one adapter declaration into deterministic capability records.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
descriptor
|
AdapterDescriptor
|
Validated adapter metadata and privilege declarations. |
required |
Returns:
| Type | Description |
|---|---|
tuple[CapabilityDescriptor, ...]
|
Capability records in the adapter declaration order. |
Source code in fuzzy1337/executors/contracts.py
129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 | |
FreezeEnvironment(environment: Mapping[str, str]) -> Mapping[str, str]
¶
Return validated immutable environment overrides.
Syntax validation does not detect secrets; callers must avoid recording secret values.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
environment
|
Mapping[str, str]
|
Explicit name/value overrides for the child environment. |
required |
Returns:
| Type | Description |
|---|---|
Mapping[str, str]
|
Immutable mapping in deterministic name order. |
Raises:
| Type | Description |
|---|---|
ValueError
|
A name is not portable or a value is not text or contains NUL. |
Source code in fuzzy1337/executors/contracts.py
203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 | |