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 component::ComponentCapabilities;
pub use component::ComponentConfigurators;
pub use component::ComponentManifest;
pub use component::ComponentProfileError;
pub use component::ComponentProfiles;
pub use component::EnvCapabilities;
pub use component::EventsCapabilities;
pub use component::FilesystemCapabilities;
pub use component::FilesystemMode;
pub use component::FilesystemMount;
pub use component::HostCapabilities;
pub use component::HttpCapabilities;
pub use component::IaCCapabilities;
pub use component::MessagingCapabilities;
pub use component::SecretsCapabilities;
pub use component::StateCapabilities;
pub use component::TelemetryCapabilities;
pub use component::TelemetryScope;
pub use component::WasiCapabilities;
pub use context::Cloud;
pub use context::DeploymentCtx;
pub use context::Platform;
pub use deployment::ChannelPlan;
pub use deployment::DeploymentPlan;
pub use deployment::MessagingPlan;
pub use deployment::MessagingSubjectPlan;
pub use deployment::OAuthPlan;
pub use deployment::RunnerPlan;
pub use deployment::SecretPlan;
pub use deployment::TelemetryPlan;
pub use distributor::ArtifactLocation;
pub use distributor::CacheInfo;
pub use distributor::ComponentDigest;
pub use distributor::ComponentStatus;
pub use distributor::DistributorEnvironmentId;
pub use distributor::ResolveComponentRequest;
pub use distributor::ResolveComponentResponse;
pub use distributor::SignatureSummary;
pub use error::ErrorCode;
pub use error::GResult;
pub use error::GreenticError;
pub use events::EventEnvelope;
pub use events::EventId;
pub use events::EventMetadata;
pub use events_provider::EventProviderDescriptor;
pub use events_provider::EventProviderKind;
pub use events_provider::OrderingKind;
pub use events_provider::ReliabilityKind;
pub use events_provider::TransportKind;
pub use flow::Flow;
pub use flow::FlowKind;
pub use flow::FlowNodes;
pub use flow::FlowValidationError;
pub use flow::Node;
pub use messaging::Attachment;
pub use messaging::ChannelMessageEnvelope;
pub use messaging::MessageMetadata;
pub use outcome::Outcome;
pub use pack::PackRef;
pub use pack::Signature;
pub use pack::SignatureAlgorithm;
pub use pack_manifest::PackComponentRef;
pub use pack_manifest::PackFlowRef;
pub use pack_manifest::PackKind;
pub use pack_manifest::PackManifest;
pub use policy::AllowList;
pub use policy::NetworkPolicy;
pub use policy::PolicyDecision;
pub use policy::PolicyDecisionStatus;
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 store::ArtifactSelector;
pub use store::BundleSpec;
pub use store::CapabilityMap;
pub use store::Collection;
pub use store::ConnectionKind;
pub use store::DesiredState;
pub use store::DesiredStateExportSpec;
pub use store::DesiredSubscriptionEntry;
pub use store::Environment;
pub use store::LayoutSection;
pub use store::LayoutSectionKind;
pub use store::PackOrComponentRef;
pub use store::PlanLimits;
pub use store::PriceModel;
pub use store::ProductOverride;
pub use store::RolloutState;
pub use store::RolloutStatus;
pub use store::StoreFront;
pub use store::StorePlan;
pub use store::StoreProduct;
pub use store::StoreProductKind;
pub use store::Subscription;
pub use store::SubscriptionStatus;
pub use store::Theme;
pub use store::VersionStrategy;
pub use supply_chain::AttestationStatement;
pub use supply_chain::BuildPlan;
pub use supply_chain::BuildStatus;
pub use supply_chain::BuildStatusKind;
pub use supply_chain::MetadataRecord;
pub use supply_chain::PredicateType;
pub use supply_chain::RepoContext;
pub use supply_chain::ScanKind;
pub use supply_chain::ScanRequest;
pub use supply_chain::ScanResult;
pub use supply_chain::ScanStatusKind;
pub use supply_chain::SignRequest;
pub use supply_chain::StoreContext;
pub use supply_chain::VerifyRequest;
pub use supply_chain::VerifyResult;
pub use telemetry::OtlpKeys;
pub use telemetry::SpanContext;
pub use tenant::Impersonation;
pub use tenant::TenantIdentity;
pub use tenant_config::DefaultPipeline;
pub use tenant_config::DidContext;
pub use tenant_config::DidService;
pub use tenant_config::DistributorTarget;
pub use tenant_config::EnabledPacks;
pub use tenant_config::IdentityProviderOption;
pub use tenant_config::RepoAuth;
pub use tenant_config::RepoConfigFeatures;
pub use tenant_config::RepoSkin;
pub use tenant_config::RepoSkinLayout;
pub use tenant_config::RepoSkinTheme;
pub use tenant_config::RepoTenantConfig;
pub use tenant_config::RepoWorkerPanel;
pub use tenant_config::StoreTarget;
pub use tenant_config::TenantDidDocument;
pub use tenant_config::VerificationMethod;
pub use worker::WorkerMessage;
pub use worker::WorkerRequest;
pub use worker::WorkerResponse;

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.
component
Component manifest structures with generic capability declarations.
context
Shared deployment context primitives for Greentic runtimes.
deployment
Generic deployment planning structures shared between packs, runners, and deployers.
distributor
Distributor API data transfer objects used by runner/deployer clients.
error
Shared error types for Greentic crates.
events
Canonical Greentic event envelope shared across repos.
events_provider
Provider capability descriptors for event fabrics.
flow
Generic flow graph definitions used by packs and runtimes.
ids
Canonical schema IDs for the exported document types.
messaging
Generic channel messaging envelope shared across providers.
outcome
Normalized execution outcomes.
pack
Pack reference metadata.
pack_manifest
Canonical pack manifest (.gtpack) representation.
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.
store
Storefront, catalog, subscription, and desired state shared models.
supply_chain
Supply-chain oriented shared types (builds, scans, signing, metadata).
telemetry
Telemetry helpers exposed by greentic-types.
tenant
Tenant-centric identity helpers.
tenant_config
Tenant-facing configuration document shapes (skin/auth/config/did).
worker
Generic worker envelope shared across runner and messaging components.

Structs§

ApiKeyRef
API key reference used across secrets providers without exposing key material.
ArtifactRef
Artifact reference within a build or scan result.
AttestationId
Identifier referencing an attestation.
AttestationRef
Attestation reference within a supply chain.
BranchRef
Reference to a source control branch.
BuildLogRef
Reference to a build log output produced during execution.
BuildRef
Build reference within a supply chain.
BundleId
Identifier referencing a distributor bundle.
CollectionId
Identifier referencing a product collection.
CommitRef
Reference to a source control commit.
ComponentId
Identifier referencing a component binding in a pack.
ComponentRef
Supply-chain component reference (distinct from pack ComponentId).
DistributorRef
Identifier referencing a distributor instance.
EnvId
Environment identifier for a tenant context.
EnvironmentRef
Identifier referencing a deployment environment.
FlowId
Identifier referencing a flow inside a pack.
GitProviderRef
Identifier referencing a source control provider.
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.
MetadataRecordRef
Reference to a metadata record attached to artifacts or bundles.
NodeError
Error type emitted by Greentic nodes.
NodeId
Identifier referencing a node inside a flow graph.
OciImageRef
Reference to an OCI image for distribution.
PackId
Globally unique pack identifier.
PolicyInputRef
Reference to a policy input payload for evaluation.
PolicyRef
Policy reference within a supply chain.
RedactionPath
JSONPath expression pointing at sensitive fields that should be redacted.
RegistryRef
Registry reference for OCI or artifact storage.
RepoRef
Repository reference within a supply chain.
SbomRef
Reference to a Software Bill of Materials artifact.
ScanRef
Scan reference within a supply chain.
ScannerRef
Identifier referencing a scanner provider.
SemverReq
Semantic version requirement validated by semver.
SignatureRef
Reference to a generated signature.
SigningKeyRef
Reference to a signing key handle.
StatementRef
Reference to an attestation statement.
StoreFrontId
Identifier referencing a storefront.
StorePlanId
Identifier referencing a plan for a store product.
StoreProductId
Identifier referencing a product in the store catalog.
StoreRef
Content store reference within a supply chain.
SubscriptionId
Identifier referencing a subscription entry.
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.
VersionRef
Version reference for a component or metadata record.
WebhookId
Identifier referencing a registered webhook.

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.