English fallback
This translation is missing; the canonical English reference follows.
fuzzy1337.adapters.contracts¶
fuzzy1337.adapters.contracts
¶
Provider-neutral contracts for governed security-tool adapters.
ImpactLevel
¶
Bases: StrEnum
Declared maximum impact for a provider, independent from authorization.
源代码位于: fuzzy1337/adapters/contracts.py
24 25 26 27 28 29 30 31 | |
AdapterHealthState
¶
Bases: StrEnum
Health state reported by an adapter without implying execution authority.
源代码位于: fuzzy1337/adapters/contracts.py
34 35 36 37 38 39 | |
ExecutionState
¶
Bases: StrEnum
Terminal executor state preserved for adapter normalization.
源代码位于: fuzzy1337/adapters/contracts.py
42 43 44 45 46 47 48 | |
AdapterDescriptor
dataclass
¶
Static provider declaration consumed by capability and policy layers.
源代码位于: fuzzy1337/adapters/contracts.py
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 274 275 276 277 278 279 280 281 282 283 284 285 286 287 | |
__post_init__() -> None
¶
Validate provider declarations before an adapter can be registered.
源代码位于: fuzzy1337/adapters/contracts.py
256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 | |
Supports(capability: str) -> bool
¶
Return whether this provider declares a capability without authorizing it.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
capability
|
str
|
Capability identifier to look up. |
必需 |
返回:
| 类型 | 描述 |
|---|---|
bool
|
True if declared, without implying authorization or runtime health. |
源代码位于: fuzzy1337/adapters/contracts.py
277 278 279 280 281 282 283 284 285 286 287 | |
AdapterHealth
dataclass
¶
Observed adapter health and provider version at a bounded check boundary.
源代码位于: fuzzy1337/adapters/contracts.py
290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 | |
__post_init__() -> None
¶
Reject ambiguous health values before callers act on them.
源代码位于: fuzzy1337/adapters/contracts.py
299 300 301 302 303 304 305 306 307 308 | |
AdapterRequest
dataclass
¶
Approved capability request passed to an adapter for invocation preparation.
源代码位于: fuzzy1337/adapters/contracts.py
311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 | |
__post_init__() -> None
¶
Validate request metadata while keeping credentials as opaque references.
源代码位于: fuzzy1337/adapters/contracts.py
321 322 323 324 325 326 327 328 329 330 331 332 333 | |
AdapterInvocation
dataclass
¶
Prepared non-secret command metadata owned by a future executor boundary.
源代码位于: fuzzy1337/adapters/contracts.py
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 | |
__post_init__() -> None
¶
Require a bounded explicit argv without invoking a process.
源代码位于: fuzzy1337/adapters/contracts.py
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 | |
EvidenceReference
dataclass
¶
Reference immutable raw evidence without embedding raw provider payloads.
源代码位于: fuzzy1337/adapters/contracts.py
366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
__post_init__() -> None
¶
Accept only relative, hash-addressed evidence references.
源代码位于: fuzzy1337/adapters/contracts.py
376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 | |
AdapterExecution
dataclass
¶
Terminal executor outcome preserved before adapter parsing and normalization.
源代码位于: fuzzy1337/adapters/contracts.py
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 | |
__post_init__() -> None
¶
Prevent failed, timed-out, or cancelled execution from becoming success.
源代码位于: fuzzy1337/adapters/contracts.py
408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 | |
AdapterReport
dataclass
¶
Executor-owned facts and raw-evidence references supplied to an adapter parser.
源代码位于: fuzzy1337/adapters/contracts.py
429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 | |
__post_init__() -> None
¶
Freeze evidence ordering and reject ambiguous duplicate references.
源代码位于: fuzzy1337/adapters/contracts.py
437 438 439 440 441 442 443 444 | |
NormalizedObservation
dataclass
¶
Provider-neutral observation envelope for a later Security Object Model update.
源代码位于: fuzzy1337/adapters/contracts.py
447 448 449 450 451 452 453 454 455 456 457 458 459 460 | |
__post_init__() -> None
¶
Freeze generic observation fields without assigning core schema semantics.
源代码位于: fuzzy1337/adapters/contracts.py
455 456 457 458 459 460 | |
NormalizedFinding
dataclass
¶
Provider-neutral finding envelope backed by the enclosing raw evidence.
源代码位于: fuzzy1337/adapters/contracts.py
463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 | |
__post_init__() -> None
¶
Freeze generic finding attributes while retaining a human-readable summary.
源代码位于: fuzzy1337/adapters/contracts.py
472 473 474 475 476 477 478 | |
ObjectEnrichment
dataclass
¶
Generic object attribute enrichment without introducing provider-owned types.
源代码位于: fuzzy1337/adapters/contracts.py
481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
__post_init__() -> None
¶
Keep object enrichment references typed and immutable.
源代码位于: fuzzy1337/adapters/contracts.py
489 490 491 492 493 494 | |
RelationEnrichment
dataclass
¶
Generic relation attribute enrichment without mutating shared state directly.
源代码位于: fuzzy1337/adapters/contracts.py
497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 | |
__post_init__() -> None
¶
Keep relation references typed and immutable.
源代码位于: fuzzy1337/adapters/contracts.py
506 507 508 509 510 511 512 | |
AdapterResult
dataclass
¶
Normalized adapter output that remains separate from persistence and policy.
源代码位于: fuzzy1337/adapters/contracts.py
515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 | |
__post_init__() -> None
¶
Freeze result collections so downstream consumers receive stable evidence.
源代码位于: fuzzy1337/adapters/contracts.py
525 526 527 528 529 530 531 | |
ToolAdapter
¶
Bases: Protocol
Provider contract that cannot execute outside the future governed executor.
源代码位于: fuzzy1337/adapters/contracts.py
534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 | |
Descriptor: AdapterDescriptor
property
¶
Return the immutable provider declaration.
返回:
| 类型 | 描述 |
|---|---|
AdapterDescriptor
|
Immutable provider declaration and capability metadata. |
CheckHealth() -> AdapterHealth
¶
Return a bounded health result without claiming authorization.
Implementations must bound the health probe and preserve unavailable/degraded states.
返回:
| 类型 | 描述 |
|---|---|
AdapterHealth
|
Provider availability and version evidence, without permission to execute. |
源代码位于: fuzzy1337/adapters/contracts.py
548 549 550 551 552 553 554 555 556 557 | |
PrepareInvocation(request: AdapterRequest) -> AdapterInvocation
¶
Prepare a bounded invocation from an already-approved request.
Preparation must not start a process or resolve credential values into persisted metadata.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
request
|
AdapterRequest
|
Capability request approved by upstream scope/policy. |
必需 |
返回:
| 类型 | 描述 |
|---|---|
AdapterInvocation
|
Explicit bounded argv and metadata for the governed executor. |
源代码位于: fuzzy1337/adapters/contracts.py
559 560 561 562 563 564 565 566 567 568 569 570 571 572 | |
NormalizeReport(report: AdapterReport) -> AdapterResult
¶
Normalize an executor report without mutating shared security state.
Normalization preserves failed execution and cannot mutate shared security state.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
report
|
AdapterReport
|
Executor-owned terminal facts and immutable raw-evidence references. |
必需 |
返回:
| 类型 | 描述 |
|---|---|
AdapterResult
|
Provider-neutral observations, findings and enrichment requests. |
源代码位于: fuzzy1337/adapters/contracts.py
574 575 576 577 578 579 580 581 582 583 584 585 586 | |
RequireIdentifier(value: str, field_name: str) -> None
¶
Reject identifiers that cannot be used as stable machine-readable keys.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
value
|
str
|
Candidate lowercase machine identifier |
必需 |
field_name
|
str
|
Field label in validation errors. |
必需 |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
The value fails the identifier grammar. |
源代码位于: fuzzy1337/adapters/contracts.py
51 52 53 54 55 56 57 58 59 60 61 62 63 | |
RequireText(value: str, field_name: str) -> None
¶
Reject empty or multi-line user-visible contract text.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
value
|
str
|
Nonempty single-line text without NUL |
必需 |
field_name
|
str
|
Field label in validation errors. |
必需 |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
The value is not valid nonempty single-line text. |
源代码位于: fuzzy1337/adapters/contracts.py
66 67 68 69 70 71 72 73 74 75 76 77 78 | |
FreezeJson(value: object) -> object
¶
Return a recursively immutable JSON-like value or fail closed.
No objects are persisted and no provider code is invoked.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
value
|
object
|
JSON scalars, string-keyed mappings or sequences to freeze. |
必需 |
返回:
| 类型 | 描述 |
|---|---|
object
|
Scalars unchanged, sorted read-only mappings, or recursively frozen tuples. |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
A key, number or nested value is outside the JSON contract. |
源代码位于: fuzzy1337/adapters/contracts.py
81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 | |
FreezeMapping(value: Mapping[str, object]) -> Mapping[str, object]
¶
Freeze a JSON object while retaining a read-only mapping contract.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
value
|
Mapping[str, object]
|
JSON object to copy into immutable nested structures. |
必需 |
返回:
| 类型 | 描述 |
|---|---|
Mapping[str, object]
|
Read-only mapping with deterministic key order. |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
The value is not a valid JSON object. |
源代码位于: fuzzy1337/adapters/contracts.py
119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 | |
UniqueIdentifiers(values: tuple[str, ...], field_name: str) -> tuple[str, ...]
¶
Validate a stable identifier collection without changing declaration order.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
values
|
tuple[str, ...]
|
Identifiers to validate in original order |
必需 |
field_name
|
str
|
Field label in validation errors. |
必需 |
返回:
| 类型 | 描述 |
|---|---|
tuple[str, ...]
|
Validated identifiers as an ordered tuple. |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
An identifier is invalid or duplicated. |
源代码位于: fuzzy1337/adapters/contracts.py
138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | |
UniqueReferences(values: tuple[str, ...], field_name: str) -> tuple[str, ...]
¶
Validate opaque non-secret references without assigning their semantics.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
values
|
tuple[str, ...]
|
Opaque non-secret reference strings |
必需 |
field_name
|
str
|
Field label in validation errors. |
必需 |
返回:
| 类型 | 描述 |
|---|---|
tuple[str, ...]
|
Validated reference tuple in declaration order. |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
A reference is invalid or duplicated. |
源代码位于: fuzzy1337/adapters/contracts.py
161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 | |
JsonValue(value: object) -> object
¶
Render one immutable contract value as deterministic JSON-compatible data.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
value
|
object
|
Contract dataclass, enum, mapping, sequence or JSON scalar. |
必需 |
返回:
| 类型 | 描述 |
|---|---|
object
|
JSON-compatible data with sorted keys and list sequences. |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
A key, number or value is outside the JSON contract. |
源代码位于: fuzzy1337/adapters/contracts.py
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 | |
SerializeContract(value: object) -> str
¶
Serialize a contract value with stable key order and no non-JSON numbers.
参数:
| 名称 | 类型 | 描述 | 默认 |
|---|---|---|---|
value
|
object
|
Supported contract value to serialize. |
必需 |
返回:
| 类型 | 描述 |
|---|---|
str
|
Compact deterministic JSON text with sorted keys. |
引发:
| 类型 | 描述 |
|---|---|
ValueError
|
The value is outside the strict JSON contract. |
源代码位于: fuzzy1337/adapters/contracts.py
224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 | |