Skip to main content

GovernanceApi

Struct GovernanceApi 

Source
pub struct GovernanceApi { /* private fields */ }
Expand description

Agent governance: constitution, voting, permissions, emergency protocols

Implementations§

Source§

impl GovernanceApi

Source

pub async fn activate_safe_mode( &self, body: &ActivateSafeModeRequest, ) -> Result<EmergencyState>

Activate safe mode

Founder-only. Halts all non-essential agent execution platform-wide. Admin role is NOT sufficient.

POST /api/v1/governance/emergency/safe-mode

Source

pub async fn ambassador_veto( &self, body: &AmbassadorVetoRequest, ) -> Result<VetoRecord>

Veto

POST /api/v1/governance/ambassador/veto

Source

pub async fn amend_constitution( &self, body: &AmendConstitutionRequest, ) -> Result<ConstitutionDocument>

Amend constitution

POST /api/v1/governance/constitution/amend

Source

pub async fn bootstrap_ambassador(&self) -> Result<BootstrapAmbassadorResponse>

Bootstrap first ambassador

POST /api/v1/governance/ambassador/ambassadors/bootstrap

Source

pub async fn cast_ballot( &self, id: &str, body: &CastBallotRequest, ) -> Result<Ballot>

Cast ballot

POST /api/v1/governance/voting/proposals/{id}/ballot

Source

pub async fn check_deadlock(&self) -> Result<Map<String, Value>>

Check for deadlock

POST /api/v1/governance/emergency/deadlock-check

Source

pub async fn check_governance( &self, body: &CheckGovernanceRequest, ) -> Result<EnforcementResult>

Check governance compliance

POST /api/v1/governance/check

Source

pub async fn check_spawn_permission( &self, body: &CheckSpawnPermissionRequest, ) -> Result<PermissionCheckResult>

Check spawn permission

POST /api/v1/governance/permissions/check-spawn

Source

pub async fn create_ambassador_request( &self, body: &CreateAmbassadorRequestRequest, ) -> Result<Map<String, Value>>

Create request

POST /api/v1/governance/ambassador/requests

Source

pub async fn create_builder_request( &self, body: &DesignRequestCreate, ) -> Result<DesignRequest>

Create design request

POST /api/v1/governance/builder/requests

Source

pub async fn create_goal(&self, body: &CreateGoalRequest) -> Result<Goal>

Create goal

POST /api/v1/governance/goals

Source

pub async fn create_improvement_proposal( &self, agent_id: &str, body: &CreateImprovementProposalRequest, ) -> Result<ImprovementProposal>

Create improvement proposal

POST /api/v1/governance/improvement/{agentId}

Source

pub async fn create_voting_proposal( &self, body: &CreateVotingProposalRequest, ) -> Result<VotingProposal>

Create proposal

POST /api/v1/governance/voting/proposals

Source

pub async fn deactivate_safe_mode(&self) -> Result<DeactivateSafeModeResponse>

Deactivate safe mode

Founder-only. Returns the platform to normal mode after a safe-mode activation.

POST /api/v1/governance/emergency/deactivate

Source

pub async fn delete_spawn_policy(&self) -> Result<DeleteSpawnPolicyResponse>

Delete spawn policy

DELETE /api/v1/governance/permissions/spawn-policy

Source

pub async fn file_arbiter_appeal( &self, id: &str, body: &FileArbiterAppealRequest, ) -> Result<FileArbiterAppealResponse>

File appeal

POST /api/v1/governance/arbiter/cases/{id}/appeal

Source

pub async fn file_arbiter_case( &self, body: &FileArbiterCaseRequest, ) -> Result<Map<String, Value>>

File case

Files a new arbitration case. Returns 409 if the filer would have a conflict of interest with the chosen arbiter pool (server checks before persisting).

POST /api/v1/governance/arbiter/cases

Source

pub async fn get_agent_obligations( &self, agent_id: &str, ) -> Result<GetAgentObligationsResponse>

Get agent obligations

GET /api/v1/governance/obligations/{agentId}

Source

pub async fn get_agent_permissions( &self, agent_id: &str, ) -> Result<PermissionSet>

Get agent permissions

GET /api/v1/governance/permissions/{agentId}

Source

pub async fn get_agent_violations( &self, agent_id: &str, ) -> Result<GetAgentViolationsResponse>

Get agent violations

GET /api/v1/governance/violations/{agentId}

Source

pub async fn get_ambassador(&self, id: &str) -> Result<Ambassador>

Get ambassador

GET /api/v1/governance/ambassador/ambassadors/{id}

Source

pub async fn get_arbiter_case(&self, id: &str) -> Result<ArbiterCase>

Get case

GET /api/v1/governance/arbiter/cases/{id}

Source

pub async fn get_arbiter_registry(&self) -> Result<ArbiterRegistry>

Get arbiter registry

GET /api/v1/governance/arbiter/registry

Source

pub async fn get_builder_request(&self, id: &str) -> Result<DesignRequest>

Get design request

GET /api/v1/governance/builder/requests/{id}

Source

pub async fn get_constitution(&self) -> Result<ConstitutionDocument>

Get constitution

GET /api/v1/governance/constitution

Source

pub async fn get_emergency_state(&self) -> Result<EmergencyState>

Get emergency state

GET /api/v1/governance/emergency/state

Source

pub async fn get_goal(&self, id: &str) -> Result<Goal>

Get goal

GET /api/v1/governance/goals/{id}

Source

pub async fn get_governance_ledger( &self, params: &GetGovernanceLedgerParams, ) -> Result<GetGovernanceLedgerResponse>

Get governance ledger

Entries visible to the calling tenant, newest first.

Walking prev_hash across this page is NOT a verification, and treating it as one produces false alarms. seq is global across all tenants while this list is scoped to one, so consecutive rows here are usually NOT consecutive in the ledger — the entry a row’s prev_hash names belongs to another tenant and is not returned. Measured against production on 2026-08-20 over three independent samples: every pair whose seq values were adjacent chained correctly, and every pair with a gap did not — 10/10 and 0/5 in the last sample, while GET /governance/ledger/verify answered valid: true at the same moment.

A client that walks the chain of a page therefore reports tampering in a ledger the server certifies as intact. Integrity has an authority, and it is GET /governance/ledger/verify; a page-local walk can say “adjacent and chained” or “cannot be checked from here”, never “broken”.

GET /api/v1/governance/ledger

Source

pub async fn get_improvement_proposal( &self, agent_id: &str, version: &str, ) -> Result<ImprovementProposal>

Get proposal

GET /api/v1/governance/improvement/{agentId}/{version}

Source

pub async fn get_permission_lineage( &self, agent_id: &str, ) -> Result<AgentLineage>

Get permission lineage

GET /api/v1/governance/permissions/{agentId}/lineage

Source

pub async fn get_root_agent(&self) -> Result<GetRootAgentResponse>

Get root agent

GET /api/v1/governance/emergency/root-agent

Source

pub async fn get_root_attestation(&self) -> Result<Map<String, Value>>

Get root attestation

GET /api/v1/governance/emergency/root-attestation

Source

pub async fn get_spawn_policy(&self) -> Result<SpawnPolicy>

Get spawn policy

GET /api/v1/governance/permissions/spawn-policy

Source

pub async fn get_voting_proposal(&self, id: &str) -> Result<VotingProposal>

Get proposal

GET /api/v1/governance/voting/proposals/{id}

Source

pub async fn issue_arbiter_ruling( &self, id: &str, body: &IssueArbiterRulingRequest, ) -> Result<IssueArbiterRulingResponse>

Issue ruling

POST /api/v1/governance/arbiter/cases/{id}/ruling

Source

pub async fn list_ambassador_requests( &self, params: &ListAmbassadorRequestsParams, ) -> Result<ListAmbassadorRequestsResponse>

List requests

GET /api/v1/governance/ambassador/requests

Source

pub async fn list_ambassadors(&self) -> Result<Vec<Ambassador>>

List ambassadors

GET /api/v1/governance/ambassador/ambassadors

Source

pub async fn list_ambassador_vetoes( &self, ) -> Result<ListAmbassadorVetoesResponse>

List vetoes

GET /api/v1/governance/ambassador/vetoes

Source

pub async fn list_arbiter_cases(&self) -> Result<ListArbiterCasesResponse>

List cases

GET /api/v1/governance/arbiter/cases

Source

pub async fn list_ballots(&self, id: &str) -> Result<ListBallotsResponse>

List ballots

GET /api/v1/governance/voting/proposals/{id}/ballots

Source

pub async fn list_builder_requests(&self) -> Result<ListBuilderRequestsResponse>

List design requests

GET /api/v1/governance/builder/requests

Source

pub async fn list_goals( &self, params: &ListGoalsParams, ) -> Result<ListGoalsResponse>

List goals

GET /api/v1/governance/goals

Source

pub async fn list_improvement_proposals( &self, agent_id: &str, ) -> Result<Vec<ImprovementProposal>>

List improvement proposals

GET /api/v1/governance/improvement/{agentId}

Source

pub async fn list_voting_proposals(&self) -> Result<ListVotingProposalsResponse>

List proposals

GET /api/v1/governance/voting/proposals

Source

pub async fn register_ambassador( &self, body: &RegisterAmbassadorRequest, ) -> Result<RegisterAmbassadorResponse>

Register ambassador

POST /api/v1/governance/ambassador/ambassadors

Source

pub async fn replace_constitution( &self, body: &ReplaceConstitutionRequest, ) -> Result<ConstitutionDocument>

Replace constitution

PUT /api/v1/governance/constitution

Source

pub async fn resolve_ambassador_request( &self, id: &str, body: &ResolveAmbassadorRequestRequest, ) -> Result<Map<String, Value>>

Resolve request

POST /api/v1/governance/ambassador/requests/{id}/resolve

Source

pub async fn set_agent_permissions( &self, agent_id: &str, body: &PermissionSetUpdate, ) -> Result<SetAgentPermissionsResponse>

Set agent permissions

WRITE SEMANTICS: merges. A field the body omits keeps its stored value; only a FIRST write falls back to the documented defaults (budget 1.0, spawn depth 3, empty lists). A field that IS present but of the wrong type falls to the safe default rather than to the stored value — on a permissions surface a malformed write must fail closed, not become a silent no-op. created_at is server-owned and ignored from the body.

PUT /api/v1/governance/permissions/{agentId}

Source

pub async fn set_arbiter_registry( &self, body: &Map<String, Value>, ) -> Result<SetArbiterRegistryResponse>

Set arbiter registry

PUT /api/v1/governance/arbiter/registry

Source

pub async fn set_root_agent( &self, body: &SetRootAgentRequest, ) -> Result<SetRootAgentResponse>

Set root agent

PUT /api/v1/governance/emergency/root-agent

Source

pub async fn set_root_attestation( &self, body: &Map<String, Value>, ) -> Result<SetRootAttestationResponse>

Set root attestation

WRITE SEMANTICS: replaces. The body IS the attestation record — every field is required and nothing is carried over, which is why a body missing one answers 422 rather than storing a partial record. created_at is server-stamped, never taken from the caller.

PUT /api/v1/governance/emergency/root-attestation

Source

pub async fn set_spawn_policy( &self, body: &SpawnPolicyUpdate, ) -> Result<SetSpawnPolicyResponse>

Set spawn policy

PUT /api/v1/governance/permissions/spawn-policy

Source

pub async fn tally_votes(&self, id: &str) -> Result<VoteResult>

Tally votes

POST /api/v1/governance/voting/proposals/{id}/tally

Source

pub async fn update_builder_request_status( &self, id: &str, body: &UpdateBuilderRequestStatusRequest, ) -> Result<DesignRequest>

Update request status

PUT /api/v1/governance/builder/requests/{id}/status

Source

pub async fn update_goal_status( &self, id: &str, body: &UpdateGoalStatusRequest, ) -> Result<Map<String, Value>>

Update goal status

PUT /api/v1/governance/goals/{id}/status

Source

pub async fn update_improvement_status( &self, agent_id: &str, version: &str, body: &UpdateImprovementStatusRequest, ) -> Result<ImprovementProposal>

Update proposal status (state machine enforced)

Allowed transitions:

  • proposedarbiter_review | rejected
  • arbiter_reviewvoting | rejected
  • votingsandbox_testing | rejected
  • sandbox_testingapproved | rejected
  • approvedapplied

Any other transition returns 400. Requires admin/founder role.

PUT /api/v1/governance/improvement/{agentId}/{version}/status

Source

pub async fn verify_governance_ledger( &self, params: &VerifyGovernanceLedgerParams, ) -> Result<LedgerIntegrity>

Verify ledger integrity

GET /api/v1/governance/ledger/verify

Source

pub async fn veto_proposal( &self, id: &str, body: &VetoProposalRequest, ) -> Result<VetoProposalResponse>

Veto proposal

POST /api/v1/governance/voting/proposals/{id}/veto

Trait Implementations§

Source§

impl Clone for GovernanceApi

Source§

fn clone(&self) -> GovernanceApi

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for GovernanceApi

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more