1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
// @generated by idiolect-codegen. do not edit.
// source: dev.idiolect.encounter
//! A signed record of a single lens invocation. Encounters are the emergent-channel primitive: they record that a translation occurred, with enough context for aggregators (observations) and correctors to reason about it. `use` is a structured ThUse (see dev.idiolect.theory.use) covering action/material/purpose/actor; narrative commentary lives in `annotations`.
#![allow(
missing_docs,
clippy::doc_markdown,
clippy::struct_excessive_bools,
clippy::derive_partial_eq_without_eq
)]
use serde::{Deserialize, Serialize};
/// One invocation of a lens on a source, producing an output. The invoker asserts a purposeful invocation: structured `purpose` records the decision-relevant action/material/actor triple, resolvable against a community vocabulary.
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Encounter {
/// Narrative notes from the invoking party. Human commentary; not consumed by machine matchers.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub annotations: Option<String>,
/// Structured grounding for the assertion. Useful when `holder` is a third party and the record must state on what basis the invocation is being attributed.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub basis: Option<super::defs::Basis>,
/// Outcome as assessed by the invoking party at record time. 'corrected' signals a follow-up correction record is expected or exists.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub downstream_result: Option<EncounterDownstreamResult>,
/// DID of the party the encounter is attributed to. Omit for first-party records (holder is implicit in the repo owner); set explicitly for third-party attestations such as a labeler recording someone else's invocation.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub holder: Option<String>,
/// Fixed taxonomy at the Lexicon level. Observers declare how they weight each kind.
pub kind: EncounterKind,
/// The lens that was invoked.
pub lens: super::defs::LensRef,
/// When the lens invocation occurred. Distinct from the record's createdAt, which may be later.
pub occurred_at: String,
/// Optional content-addressed reference to the produced output.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub produced_output: Option<String>,
/// Optional content-addressed reference to the source instance, when the publisher is willing to include it. Omit when visibility restricts publication of source data.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub source_instance: Option<String>,
/// The source schema the lens translated from.
pub source_schema: super::defs::SchemaRef,
/// The target schema produced by the lens. Often implied by the lens; may be elided when unambiguous.
#[serde(default, skip_serializing_if = "Option::is_none")]
pub target_schema: Option<super::defs::SchemaRef>,
/// Structured record of the action performed, its material, its purpose, and its actor. Consumers match on action subsumption against the referenced vocabularies, not substring.
pub r#use: super::defs::Use,
pub visibility: super::defs::Visibility,
}
impl crate::Record for Encounter {
const NSID: &'static str = "dev.idiolect.encounter";
}
/// EncounterDownstreamResult.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum EncounterDownstreamResult {
Success,
Corrected,
Rejected,
Unknown,
}
/// EncounterKind.
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
#[serde(rename_all = "kebab-case")]
pub enum EncounterKind {
InvocationLog,
Curated,
RoundtripVerified,
Production,
Adversarial,
}