{"_id":"@arvoretech/pi-monitor","name":"@arvoretech/pi-monitor","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@arvoretech/pi-monitor","version":"1.0.0","description":"PI extension that watches a background process and pushes matching output lines to the agent as notifications (no polling)","main":"dist/index.js","types":"dist/index.d.ts","type":"module","scripts":{"build":"tsc","dev":"tsc --watch","lint":"tsc --noEmit"},"peerDependencies":{"@earendil-works/pi-coding-agent":">=0.74.0"},"devDependencies":{"@earendil-works/pi-coding-agent":"latest","@earendil-works/pi-ai":"latest","@earendil-works/pi-tui":"latest","@types/node":"^20.10.0","typescript":"^5.3.0"},"pi":{"extensions":["./dist/index.js"]},"keywords":["pi-package","pi","extension","monitor","background-process","streaming"],"repository":{"type":"git","url":"git+https://github.com/arvoreeducacao/arvore-pi-extensions.git","directory":"packages/monitor"},"author":{"name":"Arvore"},"license":"MIT","_id":"@arvoretech/pi-monitor@1.0.0","gitHead":"2a77fc53c52ed8fc6d6981c817a1716821dafc87","bugs":{"url":"https://github.com/arvoreeducacao/arvore-pi-extensions/issues"},"homepage":"https://github.com/arvoreeducacao/arvore-pi-extensions#readme","_nodeVersion":"22.21.1","_npmVersion":"10.9.4","dist":{"integrity":"sha512-TLAk6d3NbpcFAytt8rMEb3h5SUotQelGU7MU0MIiVfhgdInhp0EYl+Kk8S33rPdu5yF12/1+IqSXFOer9f4qsQ==","shasum":"1e20f2a79f7e987b2b2646328b75780756ea39ce","tarball":"https://registry.npmjs.org/@arvoretech/pi-monitor/-/pi-monitor-1.0.0.tgz","fileCount":10,"unpackedSize":35488,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIFc9RzLL8VfrMvywu0G4yj4rAeRAD+JQukuwwh2I+asLAiEA95/el3g8NAA32dHzXe1Iibl/M8wI0pzf1wa/UTHj5sA="}]},"_npmUser":{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},"directories":{},"maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},{"name":"rafsouza","email":"rafasouza@protonmail.com"},{"name":"pedro.adas","email":"pedro.adas@gmail.com"},{"name":"guilhermebs","email":"guilhermebscontact@gmail.com"},{"name":"ricardoraposorfox","email":"ricardorbxx1@gmail.com"},{"name":"jott4","email":"jvgcunha2002@gmail.com"},{"name":"vitor.piovezan","email":"vitor.piovezan@arvore.com.br"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/pi-monitor_1.0.0_1783364382448_0.9476560782513057"},"_hasShrinkwrap":false}},"time":{"created":"2026-07-06T18:59:42.295Z","1.0.0":"2026-07-06T18:59:42.585Z","modified":"2026-07-06T18:59:42.898Z"},"maintainers":[{"name":"joao.barros.arvore","email":"joao.barros@arvore.com.br"},{"name":"rafsouza","email":"rafasouza@protonmail.com"},{"name":"pedro.adas","email":"pedro.adas@gmail.com"},{"name":"guilhermebs","email":"guilhermebscontact@gmail.com"},{"name":"ricardoraposorfox","email":"ricardorbxx1@gmail.com"},{"name":"jott4","email":"jvgcunha2002@gmail.com"},{"name":"vitor.piovezan","email":"vitor.piovezan@arvore.com.br"}],"description":"PI extension that watches a background process and pushes matching output lines to the agent as notifications (no polling)","homepage":"https://github.com/arvoreeducacao/arvore-pi-extensions#readme","keywords":["pi-package","pi","extension","monitor","background-process","streaming"],"repository":{"type":"git","url":"git+https://github.com/arvoreeducacao/arvore-pi-extensions.git","directory":"packages/monitor"},"author":{"name":"Arvore"},"bugs":{"url":"https://github.com/arvoreeducacao/arvore-pi-extensions/issues"},"license":"MIT","readme":"# @arvoretech/pi-monitor\n\nWatch a long-running background process and push each matching output line to the agent as a notification — no polling. Inspired by Claude Code's Monitor tool, with stderr + exit-code capture and flood protection on top.\n\n## How it works\n\n```\nmonitor_start → spawn(command, shell) → readline(stdout/stderr)\n                        │\n              line matches include/exclude filter\n                        │\n        pi.sendUserMessage(line, { deliverAs: \"steer\" })  → agent reacts mid-conversation\n```\n\nThe agent keeps working and is interrupted only when a matching line arrives. Monitors are session-scoped and are killed on `session_shutdown`.\n\n## Tools\n\n- `monitor_start` — start a background monitor. Params: `id`, `command`, `cwd?`, `include?` (regex), `exclude?` (regex), `captureStderr?` (default true), `reportExit?` (default true), `deliverAs?` (`steer` | `followUp`, default `steer`), `maxEventsPerWindow?` (default 40 / 60s).\n- `monitor_stop` — stop by `id`, or `all: true`.\n- `monitor_list` — list running monitors with uptime and event counts.\n\n## Command\n\n- `/monitors` — abre o painel de logs (monitores ativos + eventos recentes). Esc fecha.\n\n## Footer\n\nEnquanto houver monitores rodando, um item aparece no rodapé (`1 monitor ativo · /monitors p/ logs`). Ele some sozinho quando o último monitor termina, e pode ser escondido pela extensão `widget-wrangler` (`/wrangle`).\n\n## Notes vs Claude Code Monitor\n\n- Captures **stderr and exit code** (Claude's forwards stdout only, so silent failures look healthy).\n- **Filter is applied in-process** via `include`/`exclude` regex to avoid flooding context.\n- **Flood guard**: a monitor emitting more than `maxEventsPerWindow` matching lines per 60s window auto-stops and tells the agent to restart with a tighter filter.\n- Pipe-buffering caveat still applies to your command: use `grep --line-buffered` when filtering upstream.\n\n## Usage\n\nAdd to `.pi/settings.json`:\n```json\n{ \"packages\": [\"npm:@arvoretech/pi-monitor\"] }\n```\n\nThen ask in natural language:\n> Run `docker compose up --build` in the background and tell me the moment any line contains \"error\" or when a service reports \"healthy\".\n","readmeFilename":"README.md","_rev":"1-5c457bcc49beca75301d7acdec5abe90"}