CI / UI Checks (pull_request) Successful in 11s
CI / Rust Checks (pull_request) Successful in 12m45s
CI / Rust Feature Validation (pull_request) Skipped
CI / Frontend E2E (pull_request) Skipped
CI / Community Image Smoke (pull_request) Skipped
CI / Required Checks (pull_request) Successful in 1s
CI / Deploy (pull_request) Skipped
Community Release / release (push) Successful in 40m35s
Tool Draft фиксирует synchronous/background/adaptive, deadline и fallback; runtime применяет единый снимок политики (concurrency, очередь, approval, deadline) до внешнего действия. Насыщение отклоняется typed overload с retry guidance, mandatory safety store fail closed, background/adaptive используют опубликованный synchronous/unsupported fallback. Refs: #29
102 lines
4.3 KiB
Rust
102 lines
4.3 KiB
Rust
use crank_core::{ExecutionMode, OperationSafetyClass, Protocol, ProtocolAdapterError};
|
|
use crank_mapping::MappingError;
|
|
use crank_schema::SchemaError;
|
|
use thiserror::Error;
|
|
|
|
#[derive(Debug, Error)]
|
|
pub enum RuntimeError {
|
|
#[error("execution request is invalid")]
|
|
InvalidExecutionRequest,
|
|
#[error("execution deadline elapsed")]
|
|
ExecutionDeadlineElapsed { may_have_dispatched: bool },
|
|
#[error(transparent)]
|
|
Schema(#[from] SchemaError),
|
|
#[error(transparent)]
|
|
InputSchema(SchemaError),
|
|
#[error(transparent)]
|
|
OutputSchema(SchemaError),
|
|
#[error(transparent)]
|
|
Mapping(#[from] MappingError),
|
|
#[error(transparent)]
|
|
InputMapping(MappingError),
|
|
#[error(transparent)]
|
|
OutputMapping(MappingError),
|
|
#[error(transparent)]
|
|
ProtocolAdapter(#[from] ProtocolAdapterError),
|
|
#[error("protocol {protocol:?} is not supported by runtime")]
|
|
UnsupportedProtocol { protocol: Protocol },
|
|
#[error("operation {operation_id} does not support requested execution mode {mode:?}")]
|
|
UnsupportedExecutionMode {
|
|
operation_id: String,
|
|
mode: ExecutionMode,
|
|
},
|
|
#[error("runtime concurrency limit exceeded for {kind} executions (limit {limit})")]
|
|
ConcurrencyLimitExceeded { kind: &'static str, limit: usize },
|
|
#[error("invalid prepared request at {field}: {reason}")]
|
|
InvalidPreparedRequest { field: String, reason: String },
|
|
#[error(
|
|
"operation {operation_id} requires confirmation for {safety_class:?} action; retry with confirmation token {confirmation_token}"
|
|
)]
|
|
ConfirmationRequired {
|
|
operation_id: String,
|
|
safety_class: OperationSafetyClass,
|
|
confirmation_token: String,
|
|
expires_in_ms: u64,
|
|
},
|
|
#[error(
|
|
"execution mode {mode:?} of operation {operation_id} is unavailable without a durable Task transport"
|
|
)]
|
|
ExecutionPolicyUnsupported {
|
|
operation_id: String,
|
|
mode: crank_core::ToolExecutionMode,
|
|
},
|
|
#[error(
|
|
"execution admission is overloaded for operation {operation_id}; retry after {retry_after_ms} ms"
|
|
)]
|
|
AdmissionOverloaded {
|
|
operation_id: String,
|
|
retry_after_ms: u64,
|
|
},
|
|
#[error("execution admission requires a verified approval for operation {operation_id}")]
|
|
AdmissionApprovalRequired { operation_id: String },
|
|
#[error("execution admission store is unavailable for operation {operation_id}: {details}")]
|
|
AdmissionStoreUnavailable {
|
|
operation_id: String,
|
|
details: String,
|
|
},
|
|
#[error("confirmation token for operation {operation_id} is invalid, expired, or already used")]
|
|
InvalidConfirmationToken { operation_id: String },
|
|
#[error("confirmation store is unavailable for operation {operation_id}")]
|
|
ConfirmationStoreUnavailable { operation_id: String },
|
|
#[error("idempotency store is unavailable for operation {operation_id}")]
|
|
IdempotencyStoreUnavailable { operation_id: String },
|
|
#[error("operation {operation_id} is already executing for this idempotency key")]
|
|
IdempotencyInProgress { operation_id: String },
|
|
#[error("idempotency key for operation {operation_id} was reused with different input")]
|
|
IdempotencyConflict { operation_id: String },
|
|
#[error("the outcome of operation {operation_id} is unknown; automatic retry is unsafe")]
|
|
IdempotencyOutcomeUnknown { operation_id: String },
|
|
#[error("idempotency completion is unavailable after operation {operation_id} dispatch")]
|
|
IdempotencyCompletionUnknown { operation_id: String },
|
|
#[error("authorization storage is unavailable")]
|
|
AuthorizationStoreUnavailable,
|
|
#[error("auth profile {auth_profile_id} was not found")]
|
|
MissingAuthProfile { auth_profile_id: String },
|
|
#[error("auth profile {auth_profile_id} is invalid: {reason}")]
|
|
InvalidAuthProfileConfig {
|
|
auth_profile_id: String,
|
|
reason: String,
|
|
},
|
|
#[error("secret {secret_id} was not found")]
|
|
MissingSecret { secret_id: String },
|
|
#[error("secret {secret_id} does not have current version {version}")]
|
|
MissingSecretVersion { secret_id: String, version: u32 },
|
|
#[error("invalid secret payload for {secret_id}: {reason}")]
|
|
InvalidAuthSecretValue { secret_id: String, reason: String },
|
|
#[error("secret crypto error during {operation}: {details}")]
|
|
SecretCrypto {
|
|
operation: &'static str,
|
|
details: String,
|
|
},
|
|
}
|