Skip to main content

tf_types/generated/
permission_request.rs

1// GENERATED by `tf-schema codegen --target rust` — DO NOT EDIT BY HAND.
2
3#![allow(unused_imports, non_camel_case_types, non_snake_case, clippy::all)]
4
5use serde::{Deserialize, Serialize};
6use super::*;
7
8/// An AI agent's typed request to acquire authority for a specific action, target, and duration. The daemon validates the request, runs the policy engine, optionally collects approvals, and replies with a PermissionGrant or a denial. See TF-0006 "dynamic permission negotiation".
9#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
10pub struct PermissionRequest {
11    /// Version of the permission-request schema itself.
12    pub request_version: PermissionRequest_RequestVersion,
13    /// Stable identifier for this request; copied into the matching PermissionGrant.
14    pub id: String,
15    /// Agent actor making the request.
16    pub agent: ActorId,
17    /// Specific running instance of the agent.
18    #[serde(skip_serializing_if = "Option::is_none", default)]
19    pub instance: Option<InstanceId>,
20    /// Human principal the agent is acting on behalf of.
21    #[serde(skip_serializing_if = "Option::is_none", default)]
22    pub human: Option<ActorId>,
23    /// Provider-prefixed model identifier (e.g. anthropic:claude-opus-4-7).
24    #[serde(skip_serializing_if = "Option::is_none", default)]
25    pub model: Option<String>,
26    /// Tool the agent intends to invoke once the permission is granted.
27    #[serde(skip_serializing_if = "Option::is_none", default)]
28    pub tool: Option<String>,
29    /// Dotted action name being requested.
30    pub action: ActionName,
31    /// Target the action will operate on (file path, record id, URL, ...).
32    #[serde(skip_serializing_if = "Option::is_none", default)]
33    pub target: Option<String>,
34    /// Agent's self-declared risk class for the action.
35    #[serde(skip_serializing_if = "Option::is_none", default)]
36    pub risk: Option<RiskClass>,
37    /// Danger tags the agent already knows apply.
38    #[serde(skip_serializing_if = "Option::is_none", default)]
39    pub danger_tags: Option<Vec<DangerTag>>,
40    /// Maximum lifetime the agent is asking for; the daemon may cap it.
41    #[serde(skip_serializing_if = "Option::is_none", default)]
42    pub duration_seconds: Option<i64>,
43    /// Human-readable rationale visible to approvers.
44    pub reason: String,
45    /// Highest proof level the agent can produce if challenged.
46    #[serde(skip_serializing_if = "Option::is_none", default)]
47    pub proof_level_offered: Option<ProofLevel>,
48    /// When the request was created.
49    pub requested_at: Timestamp,
50    /// Free-form context the daemon and approvers can use.
51    #[serde(skip_serializing_if = "Option::is_none", default)]
52    pub context: Option<serde_json::Value>,
53}
54
55/// Version of the permission-request schema itself.
56#[derive(Clone, Debug, PartialEq, Eq, Serialize, Deserialize)]
57pub enum PermissionRequest_RequestVersion {
58    #[serde(rename = "1")]
59    V1,
60}