pub struct InvocationRecord {Show 16 fields
pub id: Uuid,
pub session_id: String,
pub timestamp: DateTime<Utc>,
pub duration_ms: Option<i64>,
pub cwd: String,
pub cmd: String,
pub executable: Option<String>,
pub runner_id: Option<String>,
pub exit_code: Option<i32>,
pub status: String,
pub format_hint: Option<String>,
pub client_id: String,
pub hostname: Option<String>,
pub username: Option<String>,
pub tag: Option<String>,
pub metadata: HashMap<String, Value>,
}Expand description
An invocation record (a captured command/process execution).
Fields§
§id: UuidUnique identifier (UUIDv7 for time-ordering).
session_id: StringSession identifier (groups related invocations).
timestamp: DateTime<Utc>When the invocation started.
duration_ms: Option<i64>How long the invocation took in milliseconds.
cwd: StringWorking directory when invocation was executed.
cmd: StringThe full command string.
executable: Option<String>Extracted executable name (e.g., “make” from “make test”).
runner_id: Option<String>Runner identifier for liveness checking of pending invocations. Format depends on execution context:
- Local process: “pid:12345”
- GitHub Actions: “gha:run:12345678”
- Kubernetes: “k8s:pod:abc123”
exit_code: Option<i32>Exit code (None while pending).
status: StringInvocation status: “pending”, “completed”, “orphaned”.
format_hint: Option<String>Detected output format (e.g., “gcc”, “pytest”).
client_id: StringClient identifier (user@hostname).
hostname: Option<String>Hostname where invocation was executed.
username: Option<String>Username who executed the invocation.
tag: Option<String>User-defined tag (unique alias for this invocation, like git tags).
metadata: HashMap<String, Value>Extensible metadata (VCS info, CI context, etc.). Stored on the AttemptRecord when converted to v5 schema.
Implementations§
Source§impl InvocationRecord
impl InvocationRecord
Sourcepub fn new(
session_id: impl Into<String>,
cmd: impl Into<String>,
cwd: impl Into<String>,
exit_code: i32,
client_id: impl Into<String>,
) -> Self
pub fn new( session_id: impl Into<String>, cmd: impl Into<String>, cwd: impl Into<String>, exit_code: i32, client_id: impl Into<String>, ) -> Self
Create a new invocation record.
If BIRD_INVOCATION_UUID is set in the environment, uses that UUID
to enable deduplication across nested BIRD clients.
Sourcepub fn with_id(
id: Uuid,
session_id: impl Into<String>,
cmd: impl Into<String>,
cwd: impl Into<String>,
exit_code: i32,
client_id: impl Into<String>,
) -> Self
pub fn with_id( id: Uuid, session_id: impl Into<String>, cmd: impl Into<String>, cwd: impl Into<String>, exit_code: i32, client_id: impl Into<String>, ) -> Self
Create a new invocation record with an explicit UUID.
Use this when you need to control the UUID (e.g., for testing or when the UUID is provided externally).
Sourcepub fn new_pending(
session_id: impl Into<String>,
cmd: impl Into<String>,
cwd: impl Into<String>,
runner_id: impl Into<String>,
client_id: impl Into<String>,
) -> Self
pub fn new_pending( session_id: impl Into<String>, cmd: impl Into<String>, cwd: impl Into<String>, runner_id: impl Into<String>, client_id: impl Into<String>, ) -> Self
Create a new pending invocation record.
Use this when a command starts but hasn’t completed yet. The exit_code is None and status is “pending”.
runner_id identifies the execution context for liveness checking:
- Local process: “pid:12345”
- GitHub Actions: “gha:run:12345678”
- Kubernetes: “k8s:pod:abc123”
Sourcepub fn new_pending_local(
session_id: impl Into<String>,
cmd: impl Into<String>,
cwd: impl Into<String>,
pid: i32,
client_id: impl Into<String>,
) -> Self
pub fn new_pending_local( session_id: impl Into<String>, cmd: impl Into<String>, cwd: impl Into<String>, pid: i32, client_id: impl Into<String>, ) -> Self
Create a pending invocation for a local process.
Convenience method that formats the PID as “pid:{pid}”.
Sourcepub fn complete(self, exit_code: i32, duration_ms: Option<i64>) -> Self
pub fn complete(self, exit_code: i32, duration_ms: Option<i64>) -> Self
Mark this invocation as completed with the given exit code.
Sourcepub fn mark_orphaned(self) -> Self
pub fn mark_orphaned(self) -> Self
Mark this invocation as orphaned (process died without cleanup).
Sourcepub fn with_runner_id(self, runner_id: impl Into<String>) -> Self
pub fn with_runner_id(self, runner_id: impl Into<String>) -> Self
Set the runner ID.
Sourcepub fn is_inherited() -> bool
pub fn is_inherited() -> bool
Check if this invocation was inherited from a parent BIRD client.
Sourcepub fn parent_client() -> Option<String>
pub fn parent_client() -> Option<String>
Get the parent BIRD client name, if any.
Sourcepub fn with_duration(self, duration_ms: i64) -> Self
pub fn with_duration(self, duration_ms: i64) -> Self
Set the duration.
Sourcepub fn with_format_hint(self, hint: impl Into<String>) -> Self
pub fn with_format_hint(self, hint: impl Into<String>) -> Self
Set the format hint.
Sourcepub fn with_tag(self, tag: impl Into<String>) -> Self
pub fn with_tag(self, tag: impl Into<String>) -> Self
Set the tag (unique alias for this invocation).
Sourcepub fn with_metadata_entry(self, key: impl Into<String>, value: Value) -> Self
pub fn with_metadata_entry(self, key: impl Into<String>, value: Value) -> Self
Add a single metadata entry.
Sourcepub fn with_metadata(self, metadata: HashMap<String, Value>) -> Self
pub fn with_metadata(self, metadata: HashMap<String, Value>) -> Self
Set all metadata from a HashMap.
Sourcepub fn merge_metadata(self, metadata: HashMap<String, Value>) -> Self
pub fn merge_metadata(self, metadata: HashMap<String, Value>) -> Self
Merge metadata from a HashMap (existing entries are preserved).
Sourcepub fn to_attempt(&self) -> AttemptRecord
pub fn to_attempt(&self) -> AttemptRecord
Convert this invocation record to an AttemptRecord (v5 schema).
Sourcepub fn to_outcome(&self) -> Option<OutcomeRecord>
pub fn to_outcome(&self) -> Option<OutcomeRecord>
Convert this invocation record to an OutcomeRecord (v5 schema).
Returns None if this is a pending invocation (no outcome yet).
Sourcepub fn from_attempt_outcome(
attempt: &AttemptRecord,
outcome: Option<&OutcomeRecord>,
) -> Self
pub fn from_attempt_outcome( attempt: &AttemptRecord, outcome: Option<&OutcomeRecord>, ) -> Self
Create an InvocationRecord from AttemptRecord and optional OutcomeRecord (v5 schema).
Trait Implementations§
Source§impl Clone for InvocationRecord
impl Clone for InvocationRecord
Source§fn clone(&self) -> InvocationRecord
fn clone(&self) -> InvocationRecord
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more