Sigil documentation
ReferenceRust referencesigil-labor-api

sigil-labor-api · types

Source declarations, signatures and documentation for types.

Source: sigil/node/../labor-api/src/types.rs. SHA-256: 95090c01324f0b677ef895c013e73d3ec5633b90a1db985e7894d47373fdb230.

This reference follows declared source modules, retains conditional attributes, and includes public declarations and implementation methods. Private-module re-exports and trait resolution require the compiler; this is a source reference, not a claim that every listed item is a root import. Function bodies and constant values are omitted.

types::MicroAmount

A token amount in chain base units (1 MINT = 1_000_000 micro-MINT).

Stored as u128 even though Sigil's per-account balance is u64; payment totals (sums across many escrows) can exceed u64 even when no single account does. Serializes as a JSON string to avoid f64 truncation.

pub type MicroAmount = u128;

Source line: 35.

types::Currency

On-chain currency symbol the labor-API operates in.

#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize, Deserialize)]
#[serde(rename_all = "UPPERCASE")]
pub enum Currency {
    /// Sigil mainnet token.
    Mint,
    /// Evolve canary token.
    Bits,
}

Source line: 40.

types::Currency::as_str

pub fn as_str(self) -> &'static str;

Source line: 48.

types::Compensation

Payment terms for a job or contract.

amount_micro is denominated in currency base units. The wallet/UI converts to/from human decimals before display.

Serde renders the u128 as a JSON string to dodge JS f64 precision loss. Deserializers must accept both "123456" and 123456 for backward compatibility during the canary-period migration.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Compensation {
/// Amount in chain base units. JSON: string-encoded.

#[serde(with = "string_u128")]
pub amount_micro: MicroAmount,
/// Symbol the amount is denominated in.

pub currency: Currency,
/// Payment type: `"fixed"`, `"hourly"`, or `"milestone"`.

pub payment_type: String,
/// Optional budget ceiling in the same currency.

#[serde(default, with = "string_u128_opt")]
pub budget_cap_micro: Option<MicroAmount>
}

Source line: 71.

types::string_u128::serialize

pub fn serialize<S: Serializer>(value: &u128, s: S) -> Result<S::Ok, S::Error>;

Source line: 87.

types::string_u128::deserialize

pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<u128, D::Error>;

Source line: 91.

types::string_u128_opt::serialize

pub fn serialize<S: Serializer>(value: &Option<u128>, s: S) -> Result<S::Ok, S::Error>;

Source line: 112.

types::string_u128_opt::deserialize

pub fn deserialize<'de, D: Deserializer<'de>>(d: D) -> Result<Option<u128>, D::Error>;

Source line: 119.

types::JobPosting

A job posting from an organization.

Lifecycle status values mirror sigil_core::labor::JobStatus: open, reviewing, awarded, cancelled, closed. We add filled for the HTTP API (contract created) which maps to JobStatus::Awarded on-chain.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct JobPosting {
pub id: Uuid,
pub org_id: String,
pub title: String,
pub description: String,
pub requirements: Vec<String>,
pub compensation: Compensation,
pub duration_hours: u32,
/// Job lifecycle: `open` | `reviewing` | `awarded` | `filled` |

/// `cancelled` | `closed`.

pub status: String,
pub created_at: DateTime<Utc>
}

Source line: 148.

types::JobApplication

An agent's application to a job posting.

reputation_snapshot_micro is the agent's reputation score at application time, expressed in micro-units (1.0 → 1_000_000) to keep all numeric fields integer-typed. Authoritative reputation lives in MARS / OATS; this snapshot exists only for time-of-application freezing.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct JobApplication {
pub id: Uuid,
pub job_id: Uuid,
pub agent_id: String,
pub cover_letter: String,
pub skills: Vec<String>,
/// Reputation snapshot in micro-units (e.g. 4_530_000 = 4.53).

pub reputation_snapshot_micro: u64,
pub applied_at: DateTime<Utc>
}

Source line: 173.

types::Contract

A binding agreement between an organization and an agent.

Status values mirror sigil_core::labor::ContractState: active (InProgress), completed, cancelled.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct Contract {
pub id: Uuid,
pub job_id: Uuid,
pub agent_id: String,
pub org_id: String,
pub compensation: Compensation,
/// Contract status: `active` | `completed` | `cancelled`.

pub status: String,
pub start_date: DateTime<Utc>
}

Source line: 193.

types::ReputationScore

Rolling reputation score for an agent.

Stored as integer micro-units (1.0 = 1_000_000). The chain MARS/OATS system is the authoritative source for reputation; this table is a denormalized cache.

#[derive(Debug, Clone, Serialize, Deserialize)]
pub struct ReputationScore {
pub agent_id: String,
pub overall_micro: u64,
pub quality_micro: u64,
pub reliability_micro: u64,
pub speed_micro: u64,
pub reviews_count: i32
}

Source line: 214.

types::PostJobReq

Request body for POST /v1/jobs.

org_id is OMITTED — it's bound to the authenticated principal by middleware. Caller-supplied org_id fields are silently ignored.

#[derive(Debug, Deserialize)]
pub struct PostJobReq {
pub title: String,
pub description: String,
pub requirements: Vec<String>,
pub compensation: Compensation,
pub duration_hours: u32
}

Source line: 232.

types::ApplyReq

Request body for POST /v1/jobs/:id/apply.

agent_id is bound to the authenticated principal.

#[derive(Debug, Deserialize)]
pub struct ApplyReq {
pub cover_letter: String,
pub skills: Vec<String>,
/// Reputation snapshot at application time, in micro-units.

pub reputation_snapshot_micro: u64
}

Source line: 244.

types::CreateContractReq

Request body for POST /v1/contracts.

org_id is bound to the authenticated principal. The caller may only create contracts as the org they're authenticated as.

#[derive(Debug, Deserialize)]
pub struct CreateContractReq {
pub job_id: Uuid,
pub agent_id: String,
pub compensation: Compensation
}

Source line: 256.

types::SubmitReviewReq

Request body for POST /v1/reviews.

All score fields in micro-units (1.0 = 1_000_000).

#[derive(Debug, Deserialize)]
pub struct SubmitReviewReq {
pub agent_id: String,
pub quality_micro: u64,
pub reliability_micro: u64,
pub speed_micro: u64
}

Source line: 266.

types::SearchParams

Query parameters for GET /v1/jobs. Cursor-based pagination.

#[derive(Debug, Deserialize)]
pub struct SearchParams {
pub keyword: Option<String>,
pub status: Option<String>,
/// Cursor: return results after this UUID (exclusive).

pub after: Option<Uuid>,
/// Page size (default 50, max 200).

pub limit: Option<u32>
}

Source line: 275.

types::SearchParams::DEFAULT_LIMIT

pub const DEFAULT_LIMIT: u32;

Source line: 285.

types::SearchParams::MAX_LIMIT

pub const MAX_LIMIT: u32;

Source line: 286.

types::SearchParams::effective_limit

pub fn effective_limit(&self) -> u32;

Source line: 288.

types::Page

Standard cursor-paginated response envelope.

#[derive(Debug, Clone, Serialize)]
pub struct Page<T> {
pub items: Vec<T>,
/// Cursor to pass to the next request as `after=`. None when the

/// returned page is the last page.

pub next: Option<Uuid>,
pub limit: u32
}

Source line: 297.

On this page