Signal Composition — Examples
DATA PLATE
Multiple primitives can be queried and interpreted together. SimpleStates emits factual state only. Composition and enforcement are application-owned.
EXAMPLE
// Application-owned outcomes (illustrative only).
// SimpleStates does NOT decide or enforce.
// Read-time signal queries (facts only)
const plan = await planSignal.state({ subject });
const deny = await denySignal.state({ subject });
const exp = await expirySignal.state({ subject });
// Application-owned interpretation
// (Prefer explicit signals over "absence implies permission".)
const eligible =
plan.plan === "gold" &&
deny.signal === "denial_absent" &&
exp.signal === "not_expired";
// Optional: capture decision evidence for later verification.
// StateMirror records what the system *knew* at decision time.
// It does NOT decide outcomes.
await stateMirror.capture({
evidence_ref: `eligibility:${subject}:${Date.now()}`,
evidence_type: "eligibility_gate",
captured_at: new Date().toISOString(),
state_payload: {
inputs: { plan, deny, exp },
decision: eligible ? "approved" : "rejected",
},
});
// Enforcement stays outside SimpleStates
if (eligible) {
permit(); // your system chooses this outcome
} else {
denyAction("Not eligible"); // your system chooses this outcome
}
// Boundary reminder:
// State is queried.
// Decisions are made.
// Actions are executed.
// SimpleStates stops at state.