CI & Build / Python lint (push) Successful in 2s
CI & Build / Plugin hooks (push) Successful in 16s
CI & Build / TypeScript typecheck (push) Successful in 36s
CI & Build / Python tests (push) Failing after 1m48s
CI & Build / integration (push) Successful in 2m26s
CI & Build / Build & push image (push) Skipped
A rule is in force at a moment of a session when it was delivered there. Each (session, rule, place) now carries at most one verdict (rule_adherence, migration 0134): followed, departed, broken or not applicable, with where it came from: - an enforce rule refusing the act: followed, recorded by the moment arm, and never replaced; - the session's own rule_outcome (applied, departed) and rule_misfired calls, which the plugin's outcome hook now also posts with the session id (/api/plugin/rule-verdict) onto the delivery being answered; - a transcript review: adherence_to_judge lists what has no verdict yet, by session, and judge_adherence records verdicts with their evidence. rule_adherence (MCP) and /api/retrieval/adherence give the readout: sessions in force, opened and each verdict per rule and per place. Settings > Moments shows it in a "Were they followed" panel, beside each moment's delivered and opened counts, and per rule inside each moment. Verdicts are pruned with their deliveries and left out of backups like them. Plugin 2026.11.23.2227. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
108 lines
4.6 KiB
Vue
108 lines
4.6 KiB
Vue
<script setup lang="ts">
|
|
import { computed } from "vue";
|
|
import type { AdherenceCounts, AdherencePayload } from "@/api/moments";
|
|
|
|
/**
|
|
* Whether the rules in force at each moment were followed there. A rule is in
|
|
* force at a moment of a session when it was delivered there; each such case
|
|
* is followed, departed from (with a stated reason), broken, not applicable,
|
|
* or not judged yet. Verdicts come from a refused act, the session's own
|
|
* `rule_outcome` / `rule_misfired`, and transcript reviews
|
|
* (`adherence_to_judge`). One row per rule; open a row for its places.
|
|
*/
|
|
const props = defineProps<{
|
|
data: AdherencePayload | null;
|
|
failed: boolean;
|
|
}>();
|
|
const emit = defineEmits<{ retry: [] }>();
|
|
|
|
const rows = computed(() => props.data?.by_rule ?? []);
|
|
|
|
// The verdict counts in reading order, each shown only when it is not zero,
|
|
// so a row says what happened rather than listing zeros.
|
|
const PARTS: [keyof AdherenceCounts, string][] = [
|
|
["followed", "followed"],
|
|
["departed", "departed"],
|
|
["broken", "broken"],
|
|
["not_applicable", "not applicable"],
|
|
["unjudged", "not judged"],
|
|
];
|
|
|
|
function parts(c: AdherenceCounts): { key: string; text: string }[] {
|
|
return PARTS.filter(([k]) => c[k] > 0).map(([k, label]) => ({ key: k, text: `${label} ${c[k]}` }));
|
|
}
|
|
</script>
|
|
|
|
<template>
|
|
<section class="adherence" aria-labelledby="adherence-title">
|
|
<h3 id="adherence-title" class="sub-title">Were they followed</h3>
|
|
<p v-if="failed" class="error-msg">
|
|
Adherence could not be loaded.
|
|
<button type="button" class="btn-text" @click="emit('retry')">Try again</button>
|
|
</p>
|
|
<p v-else-if="!data" class="empty-msg">Loading adherence…</p>
|
|
<p v-else-if="!rows.length" class="empty-msg">
|
|
No rule was in force at a moment in the last {{ data.days }} days.
|
|
</p>
|
|
<template v-else>
|
|
<p class="field-hint">
|
|
Sessions each rule was in force in over the last {{ data.days }} days, and what each was
|
|
judged. A review fills in the rest from transcripts with <code>adherence_to_judge</code>.
|
|
</p>
|
|
<div class="adherence-totals">
|
|
<span>in force {{ data.totals.in_force }}</span>
|
|
<span>opened {{ data.totals.opened }}</span>
|
|
<span v-for="p in parts(data.totals)" :key="p.key" :class="`v-${p.key}`">{{ p.text }}</span>
|
|
</div>
|
|
<ul class="adherence-list">
|
|
<li v-for="r in rows" :key="r.rule_id" class="adherence-rule">
|
|
<details>
|
|
<summary class="adherence-row">
|
|
<span class="adherence-title">{{ r.title ?? `Rule ${r.rule_id} (deleted)` }}</span>
|
|
<span class="adherence-counts">
|
|
<span>in force {{ r.in_force }}</span>
|
|
<span>opened {{ r.opened }}</span>
|
|
<span v-for="p in parts(r)" :key="p.key" :class="`v-${p.key}`">{{ p.text }}</span>
|
|
</span>
|
|
</summary>
|
|
<ul class="adherence-places">
|
|
<li v-for="m in r.by_moment" :key="m.at" class="adherence-row">
|
|
<code class="moment-name">{{ m.at }}</code>
|
|
<span class="adherence-counts">
|
|
<span>in force {{ m.in_force }}</span>
|
|
<span>opened {{ m.opened }}</span>
|
|
<span v-for="p in parts(m)" :key="p.key" :class="`v-${p.key}`">{{ p.text }}</span>
|
|
</span>
|
|
</li>
|
|
</ul>
|
|
</details>
|
|
</li>
|
|
</ul>
|
|
</template>
|
|
</section>
|
|
</template>
|
|
|
|
<style scoped>
|
|
.adherence { display: flex; flex-direction: column; gap: var(--fs-space-2); }
|
|
.sub-title { margin: 0; font-size: 0.95rem; color: var(--fs-text-primary); }
|
|
.adherence-totals,
|
|
.adherence-counts {
|
|
display: inline-flex; flex-wrap: wrap; gap: var(--fs-space-2);
|
|
font-size: var(--fs-size-tiny); color: var(--fs-text-secondary);
|
|
font-variant-numeric: tabular-nums;
|
|
}
|
|
.adherence-counts { margin-left: auto; justify-content: flex-end; }
|
|
.adherence-list,
|
|
.adherence-places { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--fs-space-1); }
|
|
.adherence-places { margin: var(--fs-space-1) 0 var(--fs-space-2) var(--fs-space-4); }
|
|
.adherence-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--fs-space-2); }
|
|
.adherence-rule summary { cursor: pointer; }
|
|
.adherence-title { font-size: var(--fs-size-body-sm); color: var(--fs-text-primary); }
|
|
/* Broken is the one count a person acts on, so it is the one that stands out;
|
|
not judged is a gap in the record, not a fault, and stays quiet. */
|
|
.v-broken { color: var(--fs-text-primary); font-weight: var(--fs-weight-medium); }
|
|
.v-unjudged { color: var(--fs-text-tertiary); font-style: italic; }
|
|
</style>
|
|
|
|
<style src="@/assets/moments-shared.css" />
|