Files
FabledGrimoire/frontend/src/components/RecordReach.vue
T
bvandeusenandClaude Opus 5.5 b68aefc109
CI & Build / Python lint (push) Successful in 3s
CI & Build / Plugin hooks (push) Successful in 13s
CI & Build / TypeScript typecheck (push) Successful in 35s
CI & Build / Python tests (push) Failing after 2m1s
CI & Build / integration (push) Successful in 2m20s
CI & Build / Build & push image (push) Skipped
feat(7835): what resembles the work but is not shown is named by id in one pointer line
A pointer before a payload:
- the notes arms fetch a few results past the menu; those that cleared
  the floor but were held back by the gate, the band or the budget are
  named by id per kind, with the call that opens each kind, in one line
  ("Also resembling this, not shown: ...") at the message and the write
  path;
- they are recorded in the record ledger as `pointed`, so an open that
  follows is counted apart from pushed lines;
- setting a task in progress returns records_in_area: the notes and open
  issues tagged to the task's areas, by id (a work.start row in the
  kind x moment table says which kinds; it answers in a tool reply, so it
  is shown as unmeasured).

The static context says what a pointer line means. Plugin version minted.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-24 19:16:01 -05:00

117 lines
4.5 KiB
Vue

<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"],
["pointed", "named in a pointer"],
["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, named by id in a pointer line,
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" />