teemux 1.8.0 → 1.9.1

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 (102) hide show
  1. package/README.md +101 -21
  2. package/dist/client/client.js +10 -0
  3. package/dist/client/favicon.ico +0 -0
  4. package/dist/teemux.js +225 -544
  5. package/dist/teemux.js.map +1 -1
  6. package/package.json +22 -5
  7. package/src/LogServer.ts +68 -534
  8. package/src/McpHandler.test.ts +428 -0
  9. package/src/McpHandler.ts +307 -0
  10. package/src/client/App.tsx +200 -0
  11. package/src/client/components/ClearButton.tsx +82 -0
  12. package/src/client/components/FilterBar.tsx +106 -0
  13. package/src/client/components/JsonView.tsx +465 -0
  14. package/src/client/components/LogContainer.tsx +188 -0
  15. package/src/client/components/LogRow.tsx +469 -0
  16. package/src/client/components/SummaryCapsules.tsx +115 -0
  17. package/src/client/components/TailButton.tsx +62 -0
  18. package/src/client/contexts/ColumnWidthContext.tsx +54 -0
  19. package/src/client/favicon.ico +0 -0
  20. package/src/client/hooks/useLogState.ts +285 -0
  21. package/src/client/main.tsx +44 -0
  22. package/src/client/panda.config.ts +164 -0
  23. package/src/client/postcss.config.cjs +5 -0
  24. package/src/client/styled-system/css/conditions.mjs +36 -0
  25. package/src/client/styled-system/css/css.d.ts +22 -0
  26. package/src/client/styled-system/css/css.mjs +45 -0
  27. package/src/client/styled-system/css/cva.d.ts +6 -0
  28. package/src/client/styled-system/css/cva.mjs +87 -0
  29. package/src/client/styled-system/css/cx.d.ts +5 -0
  30. package/src/client/styled-system/css/cx.mjs +15 -0
  31. package/src/client/styled-system/css/index.d.ts +5 -0
  32. package/src/client/styled-system/css/index.mjs +4 -0
  33. package/src/client/styled-system/css/sva.d.ts +4 -0
  34. package/src/client/styled-system/css/sva.mjs +46 -0
  35. package/src/client/styled-system/helpers.mjs +316 -0
  36. package/src/client/styled-system/patterns/aspect-ratio.d.ts +20 -0
  37. package/src/client/styled-system/patterns/aspect-ratio.mjs +38 -0
  38. package/src/client/styled-system/patterns/bleed.d.ts +21 -0
  39. package/src/client/styled-system/patterns/bleed.mjs +24 -0
  40. package/src/client/styled-system/patterns/box.d.ts +20 -0
  41. package/src/client/styled-system/patterns/box.mjs +15 -0
  42. package/src/client/styled-system/patterns/center.d.ts +20 -0
  43. package/src/client/styled-system/patterns/center.mjs +21 -0
  44. package/src/client/styled-system/patterns/circle.d.ts +20 -0
  45. package/src/client/styled-system/patterns/circle.mjs +25 -0
  46. package/src/client/styled-system/patterns/container.d.ts +20 -0
  47. package/src/client/styled-system/patterns/container.mjs +21 -0
  48. package/src/client/styled-system/patterns/cq.d.ts +21 -0
  49. package/src/client/styled-system/patterns/cq.mjs +21 -0
  50. package/src/client/styled-system/patterns/divider.d.ts +22 -0
  51. package/src/client/styled-system/patterns/divider.mjs +25 -0
  52. package/src/client/styled-system/patterns/flex.d.ts +26 -0
  53. package/src/client/styled-system/patterns/flex.mjs +26 -0
  54. package/src/client/styled-system/patterns/float.d.ts +23 -0
  55. package/src/client/styled-system/patterns/float.mjs +52 -0
  56. package/src/client/styled-system/patterns/grid-item.d.ts +25 -0
  57. package/src/client/styled-system/patterns/grid-item.mjs +25 -0
  58. package/src/client/styled-system/patterns/grid.d.ts +24 -0
  59. package/src/client/styled-system/patterns/grid.mjs +27 -0
  60. package/src/client/styled-system/patterns/hstack.d.ts +21 -0
  61. package/src/client/styled-system/patterns/hstack.mjs +24 -0
  62. package/src/client/styled-system/patterns/index.d.ts +21 -0
  63. package/src/client/styled-system/patterns/index.mjs +20 -0
  64. package/src/client/styled-system/patterns/link-overlay.d.ts +20 -0
  65. package/src/client/styled-system/patterns/link-overlay.mjs +24 -0
  66. package/src/client/styled-system/patterns/spacer.d.ts +20 -0
  67. package/src/client/styled-system/patterns/spacer.mjs +21 -0
  68. package/src/client/styled-system/patterns/square.d.ts +20 -0
  69. package/src/client/styled-system/patterns/square.mjs +24 -0
  70. package/src/client/styled-system/patterns/stack.d.ts +23 -0
  71. package/src/client/styled-system/patterns/stack.mjs +24 -0
  72. package/src/client/styled-system/patterns/visually-hidden.d.ts +20 -0
  73. package/src/client/styled-system/patterns/visually-hidden.mjs +18 -0
  74. package/src/client/styled-system/patterns/vstack.d.ts +21 -0
  75. package/src/client/styled-system/patterns/vstack.mjs +24 -0
  76. package/src/client/styled-system/patterns/wrap.d.ts +24 -0
  77. package/src/client/styled-system/patterns/wrap.mjs +25 -0
  78. package/src/client/styled-system/styles.css +756 -0
  79. package/src/client/styled-system/tokens/index.d.ts +9 -0
  80. package/src/client/styled-system/tokens/index.mjs +280 -0
  81. package/src/client/styled-system/tokens/tokens.d.ts +39 -0
  82. package/src/client/styled-system/types/composition.d.ts +227 -0
  83. package/src/client/styled-system/types/conditions.d.ts +310 -0
  84. package/src/client/styled-system/types/csstype.d.ts +21298 -0
  85. package/src/client/styled-system/types/global.d.ts +20 -0
  86. package/src/client/styled-system/types/index.d.ts +7 -0
  87. package/src/client/styled-system/types/parts.d.ts +8 -0
  88. package/src/client/styled-system/types/pattern.d.ts +78 -0
  89. package/src/client/styled-system/types/prop-type.d.ts +230 -0
  90. package/src/client/styled-system/types/recipe.d.ts +181 -0
  91. package/src/client/styled-system/types/selectors.d.ts +59 -0
  92. package/src/client/styled-system/types/static-css.d.ts +56 -0
  93. package/src/client/styled-system/types/style-props.d.ts +7504 -0
  94. package/src/client/styled-system/types/system-types.d.ts +269 -0
  95. package/src/client/tsconfig.json +25 -0
  96. package/src/client/types.ts +36 -0
  97. package/src/client/utils/extractJson.ts +134 -0
  98. package/src/client/utils/filtering.ts +51 -0
  99. package/src/client/utils/highlighting.ts +43 -0
  100. package/src/client/utils/summary.ts +74 -0
  101. package/src/client/vite.config.ts +30 -0
  102. /package/src/{ansi-to-html.d.ts → ansiToHtml.d.ts} +0 -0
package/README.md CHANGED
@@ -1,11 +1,43 @@
1
- # teemux
1
+ <p align="center">
2
+ <img src="assets/teemux.png" alt="teemux" width="120" />
3
+ </p>
2
4
 
3
- Aggregate logs from multiple processes in a single view – in browser or terminal.
5
+ <h1 align="center">teemux</h1>
6
+
7
+ <p align="center">
8
+ <strong>Aggregate logs from multiple processes in a single view</strong>
9
+ </p>
10
+
11
+ <p align="center">
12
+ View in browser or terminal • Filter with patterns • Stream to AI agents via MCP
13
+ </p>
14
+
15
+ <p align="center">
16
+ <a href="https://www.npmjs.com/package/teemux"><img src="https://img.shields.io/npm/v/teemux.svg" alt="npm version" /></a>
17
+ <a href="https://www.npmjs.com/package/teemux"><img src="https://img.shields.io/npm/dm/teemux.svg" alt="npm downloads" /></a>
18
+ <a href="https://github.com/gajus/teemux/blob/main/LICENSE"><img src="https://img.shields.io/npm/l/teemux.svg" alt="license" /></a>
19
+ </p>
20
+
21
+ <p align="center">
22
+ <img src="./preview.gif" alt="teemux demo" width="600" />
23
+ </p>
24
+
25
+ <p align="center">
26
+ <a href="https://teemux.com/">View a demo of Teemux in action</a>
27
+ </p>
28
+
29
+ ---
30
+
31
+ ## Demo
32
+
33
+ ```bash
34
+ npx teemux -- curl -N https://teemux.com/random-logs
35
+ ```
4
36
 
5
37
  ## Motivation
6
38
 
7
39
  * Needed a simple way to browse logs aggregated across multiple processes.
8
- * Needed a simple way to [give agents a unified view of all the logs](#agentsmd).
40
+ * Needed a simple way to give agents a unified view of all the logs
9
41
 
10
42
  ## Install
11
43
 
@@ -29,7 +61,8 @@ The first process starts a local server on port 8336. Others connect automatical
29
61
  |--------|-------|---------|-------------|
30
62
  | `--name` | `-n` | command name | Identifier for this process in logs |
31
63
  | `--port` | `-p` | 8336 | Port for the log aggregation server |
32
- | `--tail` | `-t` | 1000 | Number of log lines to keep in buffer |
64
+ | `--buffer` | `-b` | 10000 | Number of log lines to keep in server buffer |
65
+ | `--force-leader` | `-f` | false | Force this process to become the leader, replacing any existing leader |
33
66
 
34
67
  All options can also be set via environment variables with `TEEMUX_` prefix:
35
68
 
@@ -55,32 +88,66 @@ curl http://127.0.0.1:8336/
55
88
 
56
89
  Plain text stream of all logs.
57
90
 
58
- ### AGENTS.md
91
+ ### MCP Server for AI Agents
59
92
 
60
- If you want your coding agent to see the logs, simply add instructions to AGENTS.md to view the logs by running `curl http://127.0.0.1:8336/`. Example:
93
+ teemux includes a built-in [Model Context Protocol (MCP)](https://modelcontextprotocol.io/) server that enables AI agents to programmatically access logs in your development environment. This makes it easy for coding assistants like Claude, Cursor, or other AI tools to inspect application logs, search for errors, and understand what's happening in your running processes.
61
94
 
62
- ````md
63
- ## Viewing Logs
95
+ The MCP server runs on the same port as the HTTP server at `/mcp` and provides these tools:
64
96
 
65
- All process logs are aggregated at http://127.0.0.1:8336/
97
+ | Tool | Description | Parameters |
98
+ |------|-------------|------------|
99
+ | `get_logs` | Get recent logs from buffer | `limit?`, `include?`, `exclude?` |
100
+ | `search_logs` | Search logs with patterns | `limit?`, `include?`, `exclude?` |
101
+ | `clear_logs` | Clear the log buffer | none |
102
+ | `get_process_names` | List all process names that have logged | none |
66
103
 
67
- ```bash
68
- # View all recent logs
69
- curl http://127.0.0.1:8336/
104
+ #### Configuring your AI agent
70
105
 
71
- # View logs from a specific process
72
- curl "http://127.0.0.1:8336/?include=api"
106
+ Add teemux as an MCP server in your AI tool's configuration. For Claude Code, add to your MCP settings:
107
+
108
+ ```json
109
+ {
110
+ "mcpServers": {
111
+ "teemux": {
112
+ "command": "npx",
113
+ "args": [
114
+ "mcp-remote",
115
+ "http://127.0.0.1:8336/mcp"
116
+ ]
117
+ }
118
+ }
119
+ }
120
+ ```
73
121
 
74
- # View only errors (using wildcard for case variations)
75
- curl "http://127.0.0.1:8336/?include=*error*,*Error*,*ERROR*"
122
+ Once configured, your AI agent can:
123
+ - **Inspect logs** when debugging issues ("What errors are in the logs?")
124
+ - **Search for specific events** ("Find all database connection errors")
125
+ - **Monitor processes** ("What processes are currently running?")
126
+ - **Clear logs** to start fresh when testing
76
127
 
77
- # View logs from api OR worker
78
- curl "http://127.0.0.1:8336/?include=api,worker"
128
+ #### Example MCP usage
79
129
 
80
- # Exclude noisy logs (using wildcard)
81
- curl "http://127.0.0.1:8336/?exclude=health*,DEBUG"
130
+ ```bash
131
+ # Initialize session
132
+ curl -X POST http://127.0.0.1:8336/mcp \
133
+ -H "Content-Type: application/json" \
134
+ -H "Accept: application/json, text/event-stream" \
135
+ -d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}},"id":1}'
136
+
137
+ # List available tools (use session ID from response above)
138
+ curl -X POST http://127.0.0.1:8336/mcp \
139
+ -H "Content-Type: application/json" \
140
+ -H "Accept: application/json, text/event-stream" \
141
+ -H "mcp-session-id: <session-id>" \
142
+ -d '{"jsonrpc":"2.0","method":"tools/list","params":{},"id":2}'
143
+
144
+ # Get recent logs
145
+ curl -X POST http://127.0.0.1:8336/mcp \
146
+ -H "Content-Type: application/json" \
147
+ -H "Accept: application/json, text/event-stream" \
148
+ -H "mcp-session-id: <session-id>" \
149
+ -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_logs","arguments":{"limit":50}},"id":3}'
82
150
  ```
83
- ````
84
151
 
85
152
  ### Filtering Logs
86
153
 
@@ -181,3 +248,16 @@ teemux --name db -- docker run --rm my-database
181
248
  The flags:
182
249
  - `-i` = keep stdin open (for interactive input) ✅
183
250
  - `-t` = allocate pseudo-TTY (adds terminal formatting) ❌
251
+
252
+ ## Developing
253
+
254
+ ```bash
255
+ # Install dependencies
256
+ npm install
257
+
258
+ # Build and watch for changes
259
+ npm run dev
260
+
261
+ # In another terminal, run with fake logs
262
+ node dist/teemux.js -- node scripts/fake-logs.js
263
+ ```