greentic-interfaces 0.4.113

Greentic ABI: WIT contracts, generated bindings, thin mappers
Documentation
// SPDX-License-Identifier: MIT

package greentic:interfaces-types@0.1.0;

interface types {
  /// Environment identifier.
  type env-id = string;

  /// Tenant identifier propagated across providers.
  type tenant-id = string;

  /// Team identifier scoped to a tenant.
  type team-id = string;

  /// User identifier scoped to a tenant.
  type user-id = string;

  /// Stable key referencing persisted state blobs.
  type state-key = string;

  /// Stable key referencing sessions.
  type session-key = string;

  /// Impersonation context propagated with a tenant.
  record impersonation {
    actor-id: user-id,
    reason: option<string>,
  }

  /// Invocation tenant context shared across Greentic surfaces.
  record tenant-ctx {
    env: env-id,
    tenant: tenant-id,
    tenant-id: tenant-id,
    team: option<team-id>,
    team-id: option<team-id>,
    user: option<user-id>,
    user-id: option<user-id>,
    trace-id: option<string>,
    i18n-id: option<string>,
    correlation-id: option<string>,
    attributes: list<tuple<string, string>>,
    session-id: option<string>,
    flow-id: option<string>,
    node-id: option<string>,
    provider-id: option<string>,
    deadline-ms: option<s64>,
    attempt: u32,
    idempotency-key: option<string>,
    impersonation: option<impersonation>,
  }

  /// Cursor describing a session position.
  record session-cursor {
    node-pointer: string,
    wait-reason: option<string>,
    outbox-marker: option<string>,
  }

  /// Canonical error codes surfaced by the platform.
  enum error-code {
    unknown,
    invalid-input,
    not-found,
    conflict,
    timeout,
    unauthenticated,
    permission-denied,
    rate-limited,
    unavailable,
    internal,
  }

  /// Canonical host error payload.
  record host-error {
    code: string,
    message: string,
  }

  /// Standard error codes returned by host services.
  enum iface-error {
    invalid-arg,
    not-found,
    denied,
    unavailable,
    internal,
  }

  /// Pending outcome payload.
  record outcome-pending {
    reason: string,
    expected-input: option<list<string>>,
  }

  /// Error outcome payload.
  record outcome-error {
    code: error-code,
    message: string,
  }

  /// Execution outcome for string payloads.
  variant outcome {
    done(string),
    pending(outcome-pending),
    error(outcome-error),
  }

  /// Supported network protocols.
  variant protocol {
    http,
    https,
    tcp,
    udp,
    grpc,
    custom(string),
  }

  /// Allow list describing permitted connectivity.
  record allow-list {
    domains: list<string>,
    ports: list<u16>,
    protocols: list<protocol>,
  }

  /// Network policy composed of allow lists.
  record network-policy {
    egress: allow-list,
    deny-on-miss: bool,
  }

  /// Detached signature accompanying a pack.
  variant signature-algorithm {
    ed25519,
    other(string),
  }

  record signature {
    key-id: string,
    algorithm: signature-algorithm,
    signature: list<u8>,
  }

  /// Pack reference stored in registries.
  record pack-ref {
    oci-url: string,
    version: string,
    digest: string,
    signatures: list<signature>,
  }

  /// Minimal telemetry span context.
  record span-context {
    tenant: tenant-id,
    session-id: option<session-key>,
    flow-id: string,
    node-id: option<string>,
    provider: string,
    start-ms: option<s64>,
    end-ms: option<s64>,
  }
}