@agimon-ai/doompi-log 0.0.1-alpha.21 → 0.0.1-alpha.22

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.
Files changed (2) hide show
  1. package/README.md +43 -37
  2. package/package.json +5 -5
package/README.md CHANGED
@@ -1,63 +1,69 @@
1
1
  # @agimon-ai/doompi-log
2
2
 
3
- **If the agent emits telemetry, you should be able to see it.**
3
+ Session metrics, findings, sink status, and a Log Metrics overlay for Pi.
4
4
 
5
- This package turns Doompi's LogSink records into session-local metrics and a terminal
6
- overlay. Counters and spans stay useful to the person running the session instead of
7
- disappearing into a database nobody opens.
5
+ The extension aggregates telemetry it observes in-process and can query historical data from `@agimon-ai/log-sink-mcp`.
8
6
 
9
- This is part of [Doompi](https://www.npmjs.com/package/@agimon-ai/doompi). Most users get
10
- it with the distribution.
7
+ > **Alpha:** metric attribution and UI contracts may change between releases.
8
+
9
+ ## Requirements
10
+
11
+ - Node.js 22.19.0 or newer
12
+ - Pi 0.84.2 and Pi TUI 0.84.2
11
13
 
12
14
  ## Install
13
15
 
16
+ DoomPi loads Log as core. For standalone Pi:
17
+
14
18
  ```bash
15
- npm install @agimon-ai/doompi-log
19
+ pi install npm:@agimon-ai/doompi-log
16
20
  ```
17
21
 
18
- ## How it loads
22
+ Use `SPC h l` to open the current session's Log Metrics overlay.
19
23
 
20
- Doompi loads the log viewer as core. It is not a layer and does not appear in
21
- `.doom/modes.yaml`. The bare package name follows its Pi manifest and loads the Pi adapter.
24
+ ## What is collected
22
25
 
23
- ## Leader
26
+ The in-process aggregator tracks operational records such as turn token totals, cache use, tool calls and failures, operation durations, recent errors, and event counts. It derives findings from those records without requiring an external sink.
24
27
 
25
- `SPC h l` opens the Log Metrics overlay for the current session.
28
+ Historical panels resolve a sink over HTTP first and then use the Log Sink CLI fallback. Without a reachable sink, current-session headline, findings, errors, and tool metrics still work; historical top-consumer and burn-rate views are unavailable. Sink failures are reported in status rather than failing the Pi session.
26
29
 
27
- ## What the overlay shows
30
+ Turn cost attribution is contextual: when a turn invokes several tools, the emitted turn total can be associated with each participating tool. The overlay uses that value for ranking, not as a precise per-tool share.
28
31
 
29
- The panel answers two questions what is this session costing, and what should change
30
- next — so every row is something you can act on.
32
+ Keys: `r` refreshes, `g` changes dimension, `p` changes period, `?` opens details, and Escape closes.
31
33
 
32
- | Panel | What it tells you |
33
- | --------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
34
- | Headline | Tokens, cache hit rate, cost per turn, tool failure rate, and issues. Cache and tool-failure values are coloured against a threshold; the rest are workload-dependent and stay neutral. |
35
- | `WHAT TO FIX` | Ranked findings derived from the session, each paired with the change that moves it: a failing tool, redone turns, a cold cache, a tool dragging outsized turns. Critical first. |
36
- | `TOOL COST` | Tools ranked by cost per call rather than by how often they run, with call count, failure rate, and p95 latency alongside. |
37
- | `TOP CONSUMERS` | Biggest token consumers from the sink database for the selected dimension and period. Rows with issues render in the error colour. |
38
- | `TOKEN BURN` | Token spend per time bucket, newest last. |
39
- | `RECENT ERRORS` | The session's most recent failures, newest first. |
40
- | `SINK STATUS` | Backend and endpoint. Press `?` for full wiring, collection scope, and the caveats behind each panel. |
34
+ ## Telemetry controls
41
35
 
42
- Findings are computed in-process from records the extension already emits, so the panel
43
- keeps working with no sink connected — only `TOP CONSUMERS` and `TOKEN BURN` need one.
36
+ | Variable | Effect |
37
+ | -------------------------- | ------------------------------------------------------ |
38
+ | `AGENT_TELEMETRY_DISABLED` | Disables the extension's telemetry export |
39
+ | `OTEL_SDK_DISABLED` | Disables OpenTelemetry SDK export |
40
+ | `AGENT_OTEL_TRACES` | Enables/disables trace export; logs can remain enabled |
44
41
 
45
- Thresholds are deliberately conservative: a finding that fires on a healthy session
46
- teaches you to ignore the panel.
42
+ File fallback is opt-in through host options. No configured/reachable endpoint does not prevent in-process aggregation. Exceptions and caller-supplied attributes can still be sensitive; do not assume “metadata” is harmless.
47
43
 
48
- ### A note on `TOOL COST`
44
+ The overlay requires a TUI. The aggregator, findings, and metrics-source APIs can be embedded in headless hosts.
49
45
 
50
- The column reports the p90 _turn_ total for turns a tool took part in, which is the only
51
- attribution Pi emits. A turn running several tools attributes its total to each of them,
52
- so the number ranks tools by the weight of the turns they appear in — it is not a per-tool
53
- share of spend. The same caveat is available in the overlay under `?`.
46
+ ## Public API
54
47
 
55
- Keys: `r` refresh · `g` cycle dimension · `p` cycle period · `?` detail · `esc` close.
48
+ ```ts
49
+ import {
50
+ createDoomLogExtension,
51
+ deriveFindings,
52
+ LogMetricsAggregator,
53
+ openLogMetricsOverlay,
54
+ } from '@agimon-ai/doompi-log';
55
+ ```
56
56
 
57
- ## Public API
57
+ Focused exports provide extension options, metrics types, the metrics source, and the overlay component.
58
+
59
+ ## Development
58
60
 
59
- The package exports the extension, metrics source, overlay, and Pi adapter through declared
60
- subpaths. See `package.json` for the complete list.
61
+ ```bash
62
+ pnpm build
63
+ pnpm typecheck
64
+ pnpm test
65
+ pnpm lint
66
+ ```
61
67
 
62
68
  ## License
63
69
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@agimon-ai/doompi-log",
3
- "version": "0.0.1-alpha.21",
3
+ "version": "0.0.1-alpha.22",
4
4
  "description": "Pi log-sink telemetry extension with session-local metrics and a Log Metrics overlay",
5
5
  "keywords": [
6
6
  "ai",
@@ -57,9 +57,9 @@
57
57
  "registry": "https://registry.npmjs.org/"
58
58
  },
59
59
  "dependencies": {
60
- "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.21",
61
- "@agimon-ai/doompi-telemetry": "0.0.1-alpha.21",
62
- "@agimon-ai/log-sink-mcp": "0.29.11"
60
+ "@agimon-ai/doompi-extension-contracts": "0.0.1-alpha.22",
61
+ "@agimon-ai/doompi-telemetry": "0.0.1-alpha.22",
62
+ "@agimon-ai/log-sink-mcp": "0.29.12"
63
63
  },
64
64
  "devDependencies": {
65
65
  "@earendil-works/pi-coding-agent": "0.84.2",
@@ -69,7 +69,7 @@
69
69
  "tsdown": "0.22.14",
70
70
  "typescript": "6.0.3",
71
71
  "vitest": "4.1.10",
72
- "@agimon-ai/doompi-ui": "0.0.1-alpha.21"
72
+ "@agimon-ai/doompi-ui": "0.0.1-alpha.22"
73
73
  },
74
74
  "peerDependencies": {
75
75
  "@earendil-works/pi-coding-agent": "0.84.2",