@dudousxd/nestjs-agent-telescope 0.7.1 → 0.8.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +66 -1
- package/dist/index.cjs +696 -8
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +223 -16
- package/dist/index.d.ts +223 -16
- package/dist/index.js +669 -5
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,7 +6,7 @@ Adds an **Agent** dashboard to Telescope. It subscribes to the `aviary:agent:*`
|
|
|
6
6
|
and surfaces runs, messages, tool calls, delegations, quota events, and cost — no instrumentation in
|
|
7
7
|
your code.
|
|
8
8
|
|
|
9
|
-
The dashboard is fed by **
|
|
9
|
+
The dashboard is fed by **three sources**:
|
|
10
10
|
|
|
11
11
|
- **Live activity** — the `aviary:agent:*` diagnostics watcher records into Telescope's ephemeral
|
|
12
12
|
event storage. Powers the **Overview** (runs / tokens) and **Tools** (status breakdown + recent
|
|
@@ -17,6 +17,22 @@ The dashboard is fed by **two sources**:
|
|
|
17
17
|
spend/tokens trend (timeseries).
|
|
18
18
|
- **Models** — per-model requests / input+output tokens / cost table.
|
|
19
19
|
- **Actors** — spend share by actor (breakdown) + spend-by-actor table.
|
|
20
|
+
- **Retrieval telemetry** — the `aviary:rag:retrieval` channel `@dudousxd/nestjs-agent-rag` emits,
|
|
21
|
+
recorded as its own `agent-rag` entry type. Powers:
|
|
22
|
+
- **Retrieval** — retrievals, zero-hit rate, passages per retrieval, a latency histogram with
|
|
23
|
+
p50/p95/p99 markers, a top-score histogram (dense retrievals only — see below), and a
|
|
24
|
+
retrievals/zero-hits trend.
|
|
25
|
+
- **Retrieval sources** — retrievals by store and by retriever kind, a per-collection rollup, and
|
|
26
|
+
the slowest retrievals in the window.
|
|
27
|
+
|
|
28
|
+
These need no DI binding, but stay empty until something emits retrieval telemetry:
|
|
29
|
+
`createRetrievalTool` does by default, `instrumentRetriever(retriever)` covers every other call
|
|
30
|
+
path. They read Telescope's own storage, so they show what **this process** has seen within
|
|
31
|
+
Telescope's retention — a live view, not a ledger.
|
|
32
|
+
|
|
33
|
+
The score histogram is bound to one retriever kind (`query: { retriever: 'embedding' }`) on
|
|
34
|
+
purpose: a cosine similarity, a BM25 score and an RRF rank score share no scale, so pouring them
|
|
35
|
+
into one histogram gives bins that mean a different thing per bar.
|
|
20
36
|
|
|
21
37
|
## Wiring the governance sections
|
|
22
38
|
|
|
@@ -40,6 +56,55 @@ export class ObservabilityModule {}
|
|
|
40
56
|
If the token is not bound, the governance panels render an empty state; the live watcher-fed panels
|
|
41
57
|
keep working regardless.
|
|
42
58
|
|
|
59
|
+
## Adding your own panels to this dashboard
|
|
60
|
+
|
|
61
|
+
An application's own RAG data — its knowledge-base collections, its ingestion log — lives in the
|
|
62
|
+
app, not in this library. Contribute it through **this** extension:
|
|
63
|
+
|
|
64
|
+
```ts
|
|
65
|
+
agentTelescopeExtension({
|
|
66
|
+
providers: [
|
|
67
|
+
{ name: 'myapp.rag.collections', resolve: async () => ({ rows: await listCollections() }) },
|
|
68
|
+
{ name: 'myapp.rag.documents', resolve: async () => ({ value: await countDocuments() }) },
|
|
69
|
+
],
|
|
70
|
+
sections: [
|
|
71
|
+
{
|
|
72
|
+
title: 'Knowledge base',
|
|
73
|
+
cols: 2,
|
|
74
|
+
panels: [
|
|
75
|
+
{ kind: 'stat', title: 'Documents', data: { provider: 'myapp.rag.documents' } },
|
|
76
|
+
{
|
|
77
|
+
kind: 'table',
|
|
78
|
+
title: 'Collections',
|
|
79
|
+
data: { provider: 'myapp.rag.collections' },
|
|
80
|
+
columns: [
|
|
81
|
+
{ key: 'name', label: 'Collection' },
|
|
82
|
+
{ key: 'documents', label: 'Documents' },
|
|
83
|
+
],
|
|
84
|
+
},
|
|
85
|
+
],
|
|
86
|
+
},
|
|
87
|
+
],
|
|
88
|
+
});
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Two rules, both load-bearing:
|
|
92
|
+
|
|
93
|
+
- **Register the providers here, not in a second extension.** The UI derives the request path from
|
|
94
|
+
the dashboard id (`agent.overview` → `GET /ext/agent/data/:provider`) and the server 404s when the
|
|
95
|
+
provider's owning extension does not match that segment. A provider contributed by another
|
|
96
|
+
extension is unreachable from a panel on this page — the panel renders an error, not data.
|
|
97
|
+
- **Name them under your own prefix.** Anything starting with `agent.` is refused at boot; a
|
|
98
|
+
collision there surfaces as Telescope's generic "contributed by both agent and agent" error, which
|
|
99
|
+
names the same extension twice.
|
|
100
|
+
|
|
101
|
+
Sections are appended after the built-in ones. Size each one's panel count to an exact multiple of
|
|
102
|
+
its `cols` — the renderer lays a section out as a fixed `grid-cols-N` grid with no `colSpan`, so an
|
|
103
|
+
orphan panel leaves a visible hole beside it.
|
|
104
|
+
|
|
105
|
+
Providers resolve `ctx.moduleRef` at request time, so they can reach any host service the module
|
|
106
|
+
container exposes.
|
|
107
|
+
|
|
43
108
|
## Install
|
|
44
109
|
|
|
45
110
|
```bash
|