cadrumo.application.operator_surface.command_ports module¶
Inward command-surface ports consumed by outer composition roots.
The command graph is an outer concern, but the values exchanged with another composition root are application contracts. Keeping these records here lets the CLI and the retained harness share one schema, policy, and dispatch vocabulary without either side importing the other. Implementations remain free to resolve their own command graph; this module contains no Typer, Click, entrypoint, or process-launching code.
- class CommandNodeKind(*values)[source]¶
Bases:
StrEnumThe position a command node occupies in an outer command graph.
- ROOT¶
- GROUP¶
- LEAF¶
- class ParameterKind(*values)[source]¶
Bases:
StrEnumWhether a command input is positional or option-shaped.
- ARGUMENT¶
- OPTION¶
- class JsonType(*values)[source]¶
Bases:
StrEnumThe JSON scalar represented by a command input.
- STRING¶
- INTEGER¶
- NUMBER¶
- BOOLEAN¶
- class CommandWriteRoute(*values)[source]¶
Bases:
StrEnumThe storage scope through which a command may write.
- NONE¶
- PROFILE_BOUND¶
- BOOTSTRAP_ROOT¶
- class ProfileAuthenticationPosture(*values)[source]¶
Bases:
StrEnumThe authentication posture declared by a command registration.
- NOT_APPLICABLE¶
- RESUME_FALLBACK¶
- SELF_AUTHENTICATING¶
- class MachineSecretPresence(*values)[source]¶
Bases:
StrEnumPresence condition for a machine-secret payload variant.
- ABSENT¶
- PRESENT¶
- class CommandCapabilityClass(capabilities, side_effects, performance)[source]¶
Bases:
objectCapability/effect/performance classification supplied by the graph.
- Parameters:
-
performance:
TypeAliasType¶
- class CommandParameterMetadata(name, kind, cli_flag, off_flag, json_type, required, is_flag, multiple, choices, default, help)[source]¶
Bases:
objectOne language-specific parameter projection from a command declaration.
- Parameters:
-
kind:
ParameterKind¶
-
default:
TypeAliasType¶
- class MachineSecretFieldMetadata(name, json_type)[source]¶
Bases:
objectValue-free field shape for one machine-secret payload.
- class MachineSecretVariantConditionMetadata(option_name, presence)[source]¶
Bases:
objectCondition selecting one machine-secret payload variant.
- Parameters:
option_name (str)
presence (MachineSecretPresenceValue)
-
presence:
TypeAliasType¶
- class MachineSecretPayloadMetadata(key, fields, condition, maximum_bytes, same_scope_exclusive, duplicate_keys_forbidden, extra_fields_forbidden)[source]¶
Bases:
objectValue-free machine-secret payload contract exposed to a consumer.
- Parameters:
key (str)
fields (tuple[MachineSecretFieldMetadata, ...])
condition (MachineSecretVariantConditionMetadata | None)
maximum_bytes (int)
same_scope_exclusive (bool)
duplicate_keys_forbidden (bool)
extra_fields_forbidden (bool)
-
fields:
tuple[MachineSecretFieldMetadata,...]¶
-
condition:
MachineSecretVariantConditionMetadata|None¶
- class ProfileAuthenticationContractMetadata(fields, maximum_bytes, same_scope_exclusive, stdin_exclusive_across_scopes, descriptors_must_differ_across_scopes, duplicate_keys_forbidden, extra_fields_forbidden)[source]¶
Bases:
objectValue-free profile-authentication shape and collision rules.
- Parameters:
-
fields:
tuple[MachineSecretFieldMetadata,...]¶
- class CommandPolicyMetadata(capabilities, side_effects, performance, write_route, destructive, handoff, live_write)[source]¶
Bases:
objectGraph declaration from which an execution policy is projected.
- Parameters:
-
performance:
TypeAliasType¶
-
write_route:
TypeAliasType¶
- class CommandRegistrationMetadata(command, schema_name, schema_owner, schema_source_sha256, cli_path, parameters_by_language, help_by_language, hidden, policy, handler_owner, source_sha256, machine_secret_payloads=(), profile_authentication=ProfileAuthenticationPosture.NOT_APPLICABLE)[source]¶
Bases:
objectOne command registration projected without an entrypoint object.
- Parameters:
command (str)
schema_name (str)
schema_owner (str)
schema_source_sha256 (str)
parameters_by_language (tuple[tuple[str, tuple[CommandParameterMetadata, ...] | None], ...])
hidden (bool | None)
policy (CommandPolicyMetadata | None)
handler_owner (str | None)
source_sha256 (str | None)
machine_secret_payloads (tuple[MachineSecretPayloadMetadata, ...])
profile_authentication (ProfileAuthenticationPostureValue)
-
policy:
CommandPolicyMetadata|None¶
-
machine_secret_payloads:
tuple[MachineSecretPayloadMetadata,...]¶
-
profile_authentication:
TypeAliasType¶
- class LiveNodeRegistrationMetadata(path, kind, loader_owner, handler_owner, source_sha256, policy)[source]¶
Bases:
objectOne live command-tree node projected by an outer graph adapter.
- Parameters:
kind (CommandNodeKind)
loader_owner (str | None)
handler_owner (str)
source_sha256 (str | None)
policy (CommandPolicyMetadata | None)
-
kind:
CommandNodeKind¶
-
policy:
CommandPolicyMetadata|None¶
- class CommandRegistrationProjection(commands, nodes, profile_authentication_contract)[source]¶
Bases:
objectComplete registration projection shared by outer consumers.
- Parameters:
commands (tuple[CommandRegistrationMetadata, ...])
nodes (tuple[LiveNodeRegistrationMetadata, ...])
profile_authentication_contract (ProfileAuthenticationContractMetadata)
-
commands:
tuple[CommandRegistrationMetadata,...]¶
-
nodes:
tuple[LiveNodeRegistrationMetadata,...]¶
-
profile_authentication_contract:
ProfileAuthenticationContractMetadata¶
- class CommandExecutionPolicy(classification, write_route, destructive=False, handoff=False, live_write=False)[source]¶
Bases:
objectValidated immutable execution policy returned by the command port.
- Parameters:
classification (CommandCapabilityClass)
write_route (CommandWriteRouteValue)
destructive (bool)
handoff (bool)
live_write (bool)
-
classification:
CommandCapabilityClass¶
-
write_route:
TypeAliasType¶
- class RecoveryHandoffContract(**data)[source]¶
Bases:
BaseModelValue-free machine discovery for a two-way secret handoff.
- Parameters:
data (Any)
- handoff_option: str¶
- handoff_direction: Literal['write']¶
- verification_option: str¶
- verification_direction: Literal['read']¶
- required_together: bool¶
- json_fields: tuple[str, ...]¶
- maximum_bytes: int¶
- strict_utf8_object: bool¶
- duplicate_extra_missing_fields_refused: bool¶
- descriptors_closed: bool¶
- reserved_descriptors: tuple[int, ...]¶
- descriptors_must_differ: bool¶
- collides_with: tuple[str, ...]¶
- windows_handle_bootstrap: str¶
- class VerbLeafKind(*values)[source]¶
Bases:
StrEnumKind of resolved outer command leaf.
- COMMAND¶
- CALLBACK¶
- class VerbParameter(**data)[source]¶
Bases:
BaseModelOne input parameter in an application-owned verb schema.
- Parameters:
data (Any)
- name: str¶
- kind: ParameterKind¶
- cli_flag: str¶
- off_flag: str¶
- json_type: JsonType¶
- required: bool¶
- is_flag: bool¶
- multiple: bool¶
- choices: tuple[str, ...]¶
- default: bool | int | float | str | list[Any] | None¶
- help: str¶
- class ResolvedVerbLeaf(**data)[source]¶
Bases:
BaseModelOne command key resolved to its canonical outer path.
- Parameters:
data (Any)
- subject_leaf_key: str¶
- cli_path: tuple[str, ...]¶
- alias_paths: tuple[tuple[str, ...], ...]¶
- kind: VerbLeafKind¶
- class VerbLeafResolutionFailure(**data)[source]¶
Bases:
BaseModelOne failed command-key-to-schema resolution.
- Parameters:
data (Any)
- subject_leaf_key: str¶
- attempted_cli_path: tuple[str, ...]¶
- resolved_cli_path: tuple[str, ...]¶
- reason: str¶
- class VerbInputSchema(**data)[source]¶
Bases:
BaseModelApplication-owned input schema supplied by an outer command adapter.
- Parameters:
data (Any)
- command_key: str¶
- cli_path: tuple[str, ...]¶
- parameters: tuple[VerbParameter, ...]¶
- machine_secret_payloads: tuple[MachineSecretPayloadMetadata, ...]¶
- recovery_handoff_contract: RecoveryHandoffContract | None¶
- profile_authentication: ProfileAuthenticationPostureValue¶
- profile_authentication_contract: ProfileAuthenticationContractMetadata¶
- help: str¶
- property resolved_leaf: ResolvedVerbLeaf¶
Return the canonical command-leaf identity represented by this schema.
- property required_inputs: tuple[VerbParameter, ...]¶
Return parameters that must be supplied by a caller.
- exception SchemaResolutionError(failures)[source]¶
Bases:
CadrumoErrorRaised by an outer adapter when its live schema projection is incomplete.
- Parameters:
failures (tuple[VerbLeafResolutionFailure, ...])
- Return type:
None
- code¶
- cli_argv_for(schema, arguments)[source]¶
Encode named schema arguments into the canonical command argv tail.
- class CommandSchemaPort(*args, **kwargs)[source]¶
Bases:
ProtocolApplication boundary for an outer command graph’s schema projection.
- command_schema_type(command)[source]¶
Return the registered result schema for one command identity.
- Return type:
TypeAliasType- Parameters:
command (str)
- class CommandMetadataPort(*args, **kwargs)[source]¶
Bases:
ProtocolApplication boundary for command identity and exposure metadata.
- is_exposable_command(command_key)[source]¶
Return whether an identity is callable on the external surface.
- class CommandPolicyPort(*args, **kwargs)[source]¶
Bases:
ProtocolApplication boundary for policy lookup by canonical command path.
- class CommandSurfacePort(*args, **kwargs)[source]¶
Bases:
CommandSchemaPort,CommandMetadataPort,CommandPolicyPort,ProtocolComplete read-only command surface consumed by the retained harness.
- assert_schema_coverage(resolution_errors)[source]¶
Raise one typed error when an outer adapter cannot project a leaf.
- Return type:
- Parameters:
resolution_errors (tuple[VerbLeafResolutionFailure, ...])