Crate greentic_types

Crate greentic_types 

Source
Expand description

Shared types and helpers for Greentic multi-tenant flows.

§Overview

Greentic components share a single crate for tenancy, execution outcomes, network limits, and schema metadata. Use the strongly-typed identifiers to keep flows, packs, and components consistent across repositories and to benefit from serde + schema validation automatically.

§Tenant contexts

use greentic_types::{EnvId, TenantCtx, TenantId};

let ctx = TenantCtx::new("prod".parse().unwrap(), "tenant-42".parse().unwrap())
    .with_team(Some("team-ops".parse().unwrap()))
    .with_user(Some("agent-007".parse().unwrap()));
assert_eq!(ctx.tenant_id.as_str(), "tenant-42");

§Run results & serialization

use greentic_types::{FlowId, PackId, RunResult, RunStatus, SessionKey};
use semver::Version;
use time::OffsetDateTime;

let now = OffsetDateTime::UNIX_EPOCH;
let result = RunResult {
    session_id: SessionKey::from("sess-1"),
    pack_id: "greentic.demo.pack".parse().unwrap(),
    pack_version: Version::parse("1.0.0").unwrap(),
    flow_id: "demo-flow".parse().unwrap(),
    started_at_utc: now,
    finished_at_utc: now,
    status: RunStatus::Success,
    node_summaries: Vec::new(),
    failures: Vec::new(),
    artifacts_dir: None,
};
println!("{}", serde_json::to_string_pretty(&result).unwrap());

Published JSON Schemas are listed in SCHEMAS.md and hosted under https://greentic-ai.github.io/greentic-types/schemas/v1/.

Re-exports§

pub use bindings::hints::BindingsHints;
pub use bindings::hints::EnvHints;
pub use bindings::hints::McpHints;
pub use bindings::hints::McpServer;
pub use bindings::hints::NetworkHints;
pub use bindings::hints::SecretsHints;
pub use capabilities::Capabilities;
pub use capabilities::FsCaps;
pub use capabilities::HttpCaps;
pub use capabilities::KvCaps;
pub use capabilities::Limits;
pub use capabilities::NetCaps;
pub use capabilities::SecretsCaps;
pub use capabilities::TelemetrySpec;
pub use capabilities::ToolsCaps;
pub use context::Cloud;
pub use context::DeploymentCtx;
pub use context::Platform;
pub use error::ErrorCode;
pub use error::GResult;
pub use error::GreenticError;
pub use outcome::Outcome;
pub use pack::PackRef;
pub use pack::Signature;
pub use pack::SignatureAlgorithm;
pub use pack_spec::PackSpec;
pub use pack_spec::ToolSpec;
pub use policy::AllowList;
pub use policy::NetworkPolicy;
pub use policy::PolicyDecision;
pub use policy::Protocol;
pub use run::RunResult;
pub use run::NodeFailure;
pub use run::NodeStatus;
pub use run::NodeSummary;
pub use run::RunStatus;
pub use run::TranscriptOffset;
pub use session::canonical_session_key;
pub use session::SessionCursor;
pub use session::SessionData;
pub use session::SessionKey;
pub use state::StateKey;
pub use state::StatePath;
pub use telemetry::OtlpKeys;
pub use telemetry::SpanContext;
pub use tenant::Impersonation;
pub use tenant::TenantIdentity;

Modules§

bindings
Resource binding hints shared across Greentic tooling. This module codifies the canonical host binding invariants (network allowlists, secrets, environment passthrough, and MCP server stubs) so packs, hints generators, and runtime hosts agree on the same schema.
capabilities
Capability and resource declarations shared between manifests and runtimes.
context
Shared deployment context primitives for Greentic runtimes.
error
Shared error types for Greentic crates.
ids
Canonical schema IDs for the exported document types.
outcome
Normalized execution outcomes.
pack
Pack reference metadata.
pack_spec
Serde-ready representations for Greentic pack.yaml manifests.
policy
Network policy primitives.
run
Run-level telemetry shared between runners, CLIs, and CI integrations.
session
Session identity and cursor helpers.
state
State key and JSON pointer helpers.
telemetry
Telemetry helpers exposed by greentic-types.
tenant
Tenant-centric identity helpers.

Structs§

ComponentId
Identifier referencing a component binding in a pack.
EnvId
Environment identifier for a tenant context.
FlowId
Identifier referencing a flow inside a pack.
HashDigest
Content digest describing a pack or artifact.
InvocationDeadline
Deadline metadata for an invocation, stored as Unix epoch milliseconds.
InvocationEnvelope
Normalized ingress payload delivered to nodes.
NodeError
Error type emitted by Greentic nodes.
NodeId
Identifier referencing a node inside a flow graph.
PackId
Globally unique pack identifier.
RedactionPath
JSONPath expression pointing at sensitive fields that should be redacted.
SemverReq
Semantic version requirement validated by semver.
TeamId
Team identifier belonging to a tenant.
TenantContext
Compact tenant summary propagated to developers and tooling.
TenantCtx
Context that accompanies every invocation across Greentic runtimes.
TenantId
Tenant identifier within an environment.
UserId
User identifier within a tenant.

Enums§

ErrorDetail
Structured detail payload attached to a node error.
HashAlgorithm
Supported hashing algorithms for pack content digests.

Constants§

SCHEMA_BASE_URL
Base URL for all published JSON Schemas.
VERSION
Crate version string exposed for telemetry and capability negotiation.

Functions§

make_idempotency_key
Generates a stable idempotency key for a node invocation.

Type Aliases§

BinaryPayload
Primary payload representation shared across envelopes.
NodeResult
Alias for results returned by node handlers.