lightspeed/transport/progressive_enhancement

Transport compatibility negotiation and progressive enhancement expansion for M56.

Types

Negotiation connect result.

pub type ConnectResult {
  Connected(
    state: NegotiatedState,
    outbound_frames: List(String),
  )
  Rejected(error: contract.AdapterError)
}

Constructors

Negotiation preference for the first transport mode.

pub type ModePreference {
  PreferPrimary
  PreferFallback
}

Constructors

  • PreferPrimary
  • PreferFallback

Mutation result with normalized frame-drain behavior.

pub type MutationResult {
  MutationResult(
    state: NegotiatedState,
    frame_labels: String,
    counter: Int,
    mode: String,
  )
}

Constructors

  • MutationResult(
      state: NegotiatedState,
      frame_labels: String,
      counter: Int,
      mode: String,
    )

Negotiated transport runtime state.

pub opaque type NegotiatedState

Progressive-enhancement negotiation policy.

pub type NegotiationPolicy {
  NegotiationPolicy(
    preference: ModePreference,
    allow_upgrade: Bool,
    require_bidirectional_mutations: Bool,
  )
}

Constructors

  • NegotiationPolicy(
      preference: ModePreference,
      allow_upgrade: Bool,
      require_bidirectional_mutations: Bool,
    )

Proxy guidance assessment.

pub type ProxyAssessment {
  ProxyAssessment(accepted: Bool, warnings: List(String))
}

Constructors

  • ProxyAssessment(accepted: Bool, warnings: List(String))

Proxy headers used for transport guidance checks.

pub type ProxyHeaders {
  ProxyHeaders(
    forwarded_proto: String,
    connection: String,
    upgrade: String,
    forwarded_for: String,
    request_id: String,
  )
}

Constructors

  • ProxyHeaders(
      forwarded_proto: String,
      connection: String,
      upgrade: String,
      forwarded_for: String,
      request_id: String,
    )

Degraded workflow report.

pub type WorkflowReport {
  WorkflowReport(
    navigation_signature: String,
    form_signature: String,
    mutation_signature: String,
    mutation_equivalence_signature: String,
    protocol_signature: String,
  )
}

Constructors

  • WorkflowReport(
      navigation_signature: String,
      form_signature: String,
      mutation_signature: String,
      mutation_equivalence_signature: String,
      protocol_signature: String,
    )

Values

pub fn apply_increment(
  state: NegotiatedState,
  now_ms: Int,
) -> MutationResult

Apply one increment mutation and normalize frame drain across transport modes.

pub fn assess_proxy_headers(
  headers: ProxyHeaders,
  policy: NegotiationPolicy,
) -> ProxyAssessment

Stable proxy guidance assessment.

pub fn bidirectional_mutation_policy() -> NegotiationPolicy

Bidirectional mutation policy used for explicit upgrade checks.

pub fn capability_signature(state: NegotiatedState) -> String

Stable capability signature for current negotiated mode.

pub fn connect(
  session_state: session.Session,
  request: matrix.ConnectRequest,
  profile: matrix.Profile,
  auth_hook: contract.AuthHook,
  policy: NegotiationPolicy,
  proxy_headers: ProxyHeaders,
) -> ConnectResult

Connect and negotiate initial transport mode.

pub fn default_policy() -> NegotiationPolicy

Default M56 policy.

pub fn default_proxy_headers() -> ProxyHeaders

Default trusted proxy headers.

pub fn downgrade(
  state: NegotiatedState,
  request: matrix.ConnectRequest,
  auth_hook: contract.AuthHook,
) -> ConnectResult

Explicitly downgrade to fallback polling mode when profile allows it.

pub fn fallback_first_policy() -> NegotiationPolicy

Fallback-first policy for degraded-path certification.

pub fn mode_label(state: NegotiatedState) -> String

Current mode label accessor.

pub fn protocol_invariant_signature(
  state: NegotiatedState,
) -> String

Protocol invariants signature.

pub fn proxy_assessment(
  state: NegotiatedState,
) -> ProxyAssessment

Proxy assessment accessor for an established state.

pub fn proxy_assessment_signature(
  assessment: ProxyAssessment,
) -> String

Stable proxy assessment signature.

pub fn run_degraded_workflows(
  state: NegotiatedState,
  now_ms: Int,
) -> #(NegotiatedState, WorkflowReport)

Run deterministic navigation/form/mutation workflows without app branching.

pub fn transition_signature(state: NegotiatedState) -> String

Stable transition signature.

pub fn transport_label(state: NegotiatedState) -> String

Current transport label accessor.

pub fn upgrade(
  state: NegotiatedState,
  request: matrix.ConnectRequest,
  auth_hook: contract.AuthHook,
) -> ConnectResult

Explicitly upgrade to primary realtime mode.

pub fn workflow_equivalence_signature(
  report: WorkflowReport,
) -> String

Cross-mode workflow equivalence signature.

pub fn workflow_signature(report: WorkflowReport) -> String

Workflow signature accessor.

Search Document