Skip to main content

Crate orcs_types

Crate orcs_types 

Source
Expand description

Core types for ORCS CLI.

This crate provides foundational identifier types for the ORCS (Orchestrated Runtime for Collaborative Systems) architecture.

§Crate Architecture

┌─────────────────────────────────────────────────────────────┐
│                    Plugin SDK Layer                          │
│  (External, SemVer stable, safe to depend on)               │
├─────────────────────────────────────────────────────────────┤
│  orcs-types     : ID types, Principal, ErrorCode  ◄── HERE   │
│  orcs-event     : Signal, Request, Event                    │
│  orcs-component : Component trait (WIT target)              │
└─────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────┐
│                    Runtime Layer                             │
│  (Internal implementation, NOT for plugins)                  │
├─────────────────────────────────────────────────────────────┤
│  orcs-runtime   : auth, channel, engine                     │
└─────────────────────────────────────────────────────────────┘
                              ↓
┌─────────────────────────────────────────────────────────────┐
│                   Frontend Layer                             │
│  (CLI, GUI, Network interfaces)                              │
├─────────────────────────────────────────────────────────────┤
│  orcs-cli       : Command-line interface                    │
└─────────────────────────────────────────────────────────────┘

§Why Plugin SDK?

This crate is part of the Plugin SDK layer because:

  • SemVer stable: API changes follow semantic versioning
  • Minimal dependencies: Only what plugins truly need
  • WIT compatible: Types can be exported to WASM components
  • Implementation freedom: Runtime can change without breaking plugins

§Event Architecture

ORCS uses an EventBus-based architecture where all communication between Components flows through unified message types:

  • Request/Response: Synchronous queries between Components
  • Event: Asynchronous broadcasts (no response expected)
  • Signal: Human control interrupts (highest priority)

§Identifier Design

All identifiers are UUID-based for:

  • Network compatibility: Safe to transmit across processes/machines
  • Cloud readiness: Globally unique without coordination
  • Serialization: First-class serde support

§Example

use orcs_types::{ComponentId, ChannelId, RequestId, EventId};

// Builtin components have deterministic UUIDs
let llm = ComponentId::builtin("llm");
let llm2 = ComponentId::builtin("llm");
assert_eq!(llm, llm2);  // Same UUID

// Custom components get random UUIDs
let plugin = ComponentId::new("plugin", "my-tool");

// Channel for parallel execution context
let channel = ChannelId::new();

// Request/Response tracking
let req_id = RequestId::new();

// Event broadcast tracking
let evt_id = EventId::new();

Re-exports§

pub use intent::ActionIntent;
pub use intent::Confidence;
pub use intent::ContentBlock;
pub use intent::IntentDef;
pub use intent::IntentMeta;
pub use intent::IntentResolver;
pub use intent::IntentResult;
pub use intent::IntentSource;
pub use intent::MessageContent;
pub use intent::Priority;
pub use intent::Role;
pub use intent::StopReason;

Modules§

intent
ActionIntent domain types.

Structs§

ChannelId
Identifier for a Channel in the ORCS architecture.
ComponentId
Identifier for a Component in the ORCS architecture.
EventId
Identifier for an Event in the ORCS EventBus.
PrincipalId
Identifier for a Principal (actor) in the ORCS system.
RequestId
Identifier for a Request in the ORCS EventBus.

Enums§

Principal
The actor performing an action.
SignalScope
The scope affected by a signal or permission check.

Traits§

ErrorCode
Unified error code interface for ORCS errors.
TryNew
Trait for fallible construction with validation.

Functions§

assert_error_code
Validates that an error code follows ORCS conventions.
assert_error_codes
Validates multiple error codes at once.