feat(7831): every record a session is shown, asks for or opens on its own is recorded per session, by kind
CI & Build / Plugin hooks (push) Successful in 18s
CI & Build / Python lint (push) Successful in 2s
CI & Build / TypeScript typecheck (push) Successful in 38s
CI & Build / Python tests (push) Successful in 1m59s
CI & Build / integration (push) Successful in 2m6s
CI & Build / Build & push image (push) Successful in 32s
CI & Build / Plugin hooks (push) Successful in 18s
CI & Build / Python lint (push) Successful in 2s
CI & Build / TypeScript typecheck (push) Successful in 38s
CI & Build / Python tests (push) Successful in 1m59s
CI & Build / integration (push) Successful in 2m6s
CI & Build / Build & push image (push) Successful in 32s
A ledger beside the rule deliveries (record_deliveries, migration 0136): - every note, snippet, issue, lesson or process line a plugin door pushes is recorded against the session, only when the payload kept it; - a search the session runs itself records its results as asked, matched to the server log of that call; - an open is stamped on the delivery it followed, or recorded as direct when nothing showed the record first. The plugin reports opens and searches from the tool calls (grimoire_record_read.sh). The readout is in retrieval_telemetry (record_reach), at /api/retrieval/record-reach, and in Settings > Moments as "How records reach the work". Plugin 2026.11.24.1827. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,115 @@
|
||||
<script setup lang="ts">
|
||||
import { computed } from "vue";
|
||||
import type { RecordReachPayload, RecordWay, WayCounts } from "@/api/moments";
|
||||
|
||||
/**
|
||||
* How records other than rules reached sessions: shown by a hook, found by a
|
||||
* search the session ran itself, or opened with nothing showing them first —
|
||||
* and how many were opened each way. It says, per kind, whether a record is
|
||||
* found by being pushed or by being asked for. One row per kind; open a row
|
||||
* for the doors behind it.
|
||||
*/
|
||||
const props = defineProps<{
|
||||
data: RecordReachPayload | null;
|
||||
failed: boolean;
|
||||
}>();
|
||||
const emit = defineEmits<{ retry: [] }>();
|
||||
|
||||
const rows = computed(() => props.data?.by_kind ?? []);
|
||||
|
||||
const KIND_LABELS: Record<string, string> = {
|
||||
snippet: "Snippets",
|
||||
note: "Notes",
|
||||
lesson: "Lessons",
|
||||
process: "Processes",
|
||||
"task:issue": "Issues",
|
||||
"task:work": "Work tasks",
|
||||
"task:spike": "Spikes",
|
||||
};
|
||||
|
||||
function kindLabel(kind: string): string {
|
||||
return KIND_LABELS[kind] ?? kind;
|
||||
}
|
||||
|
||||
// Each way in reading order. A direct open is opened by definition, so it
|
||||
// shows one number; the others show how many of those delivered were opened.
|
||||
const WAYS: [RecordWay, string][] = [
|
||||
["pushed", "shown by a hook"],
|
||||
["asked", "from its own search"],
|
||||
["direct", "opened unshown"],
|
||||
];
|
||||
|
||||
function wayText(way: RecordWay, c: WayCounts): string {
|
||||
return way === "direct" ? `${c.opened}` : `${c.opened} of ${c.delivered}`;
|
||||
}
|
||||
</script>
|
||||
|
||||
<template>
|
||||
<section class="reach" aria-labelledby="reach-title">
|
||||
<h3 id="reach-title" class="sub-title">How records reach the work</h3>
|
||||
<p v-if="failed" class="error-msg">
|
||||
Record reach 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 record reach…</p>
|
||||
<p v-else-if="!rows.length" class="empty-msg">
|
||||
No record reached a session in the last {{ data.days }} days from a plugin that reports opens.
|
||||
</p>
|
||||
<template v-else>
|
||||
<p class="field-hint">
|
||||
Records opened, out of those delivered, over the last {{ data.days }} days across
|
||||
{{ data.sessions }} sessions: shown by a hook, returned by a search the session ran,
|
||||
or opened with nothing showing them first.
|
||||
</p>
|
||||
<div class="reach-totals">
|
||||
<span v-for="[way, label] in WAYS" :key="way">
|
||||
{{ label }} {{ wayText(way, data.totals[way]) }}
|
||||
</span>
|
||||
</div>
|
||||
<ul class="reach-list">
|
||||
<li v-for="r in rows" :key="r.kind" class="reach-kind">
|
||||
<details>
|
||||
<summary class="reach-row">
|
||||
<span class="reach-title">{{ kindLabel(r.kind) }}</span>
|
||||
<span class="reach-counts">
|
||||
<span v-for="[way, label] in WAYS" :key="way" :class="{ 'way-none': !r.ways[way].delivered }">
|
||||
{{ label }} {{ wayText(way, r.ways[way]) }}
|
||||
</span>
|
||||
</span>
|
||||
</summary>
|
||||
<ul class="reach-sources">
|
||||
<li v-for="s in r.sources" :key="`${s.way}:${s.source}`" class="reach-row">
|
||||
<code class="moment-name">{{ s.source }}</code>
|
||||
<span class="reach-counts">
|
||||
<span>{{ s.way === "direct" ? `${s.opened} opened` : `${s.opened} of ${s.delivered} opened` }}</span>
|
||||
</span>
|
||||
</li>
|
||||
</ul>
|
||||
</details>
|
||||
</li>
|
||||
</ul>
|
||||
</template>
|
||||
</section>
|
||||
</template>
|
||||
|
||||
<style scoped>
|
||||
.reach { display: flex; flex-direction: column; gap: var(--fs-space-2); }
|
||||
.sub-title { margin: 0; font-size: 0.95rem; color: var(--fs-text-primary); }
|
||||
.reach-totals,
|
||||
.reach-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;
|
||||
}
|
||||
.reach-counts { margin-left: auto; justify-content: flex-end; }
|
||||
.reach-list,
|
||||
.reach-sources { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--fs-space-1); }
|
||||
.reach-sources { margin: var(--fs-space-1) 0 var(--fs-space-2) var(--fs-space-4); }
|
||||
.reach-row { display: flex; flex-wrap: wrap; align-items: baseline; gap: var(--fs-space-2); }
|
||||
.reach-kind summary { cursor: pointer; }
|
||||
.reach-title { font-size: var(--fs-size-body-sm); color: var(--fs-text-primary); }
|
||||
/* A way that delivered nothing for this kind is a gap, not a zero to read. */
|
||||
.way-none { color: var(--fs-text-tertiary); }
|
||||
</style>
|
||||
|
||||
<style src="@/assets/moments-shared.css" />
|
||||
Reference in New Issue
Block a user