teemux 1.8.0 → 1.9.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.
Files changed (102) hide show
  1. package/README.md +83 -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,29 @@
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
+ ---
4
22
 
5
23
  ## Motivation
6
24
 
7
25
  * 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).
26
+ * Needed a simple way to give agents a unified view of all the logs
9
27
 
10
28
  ## Install
11
29
 
@@ -29,7 +47,8 @@ The first process starts a local server on port 8336. Others connect automatical
29
47
  |--------|-------|---------|-------------|
30
48
  | `--name` | `-n` | command name | Identifier for this process in logs |
31
49
  | `--port` | `-p` | 8336 | Port for the log aggregation server |
32
- | `--tail` | `-t` | 1000 | Number of log lines to keep in buffer |
50
+ | `--buffer` | `-b` | 10000 | Number of log lines to keep in server buffer |
51
+ | `--force-leader` | `-f` | false | Force this process to become the leader, replacing any existing leader |
33
52
 
34
53
  All options can also be set via environment variables with `TEEMUX_` prefix:
35
54
 
@@ -55,32 +74,62 @@ curl http://127.0.0.1:8336/
55
74
 
56
75
  Plain text stream of all logs.
57
76
 
58
- ### AGENTS.md
77
+ ### MCP Server for AI Agents
59
78
 
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:
79
+ 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
80
 
62
- ````md
63
- ## Viewing Logs
81
+ The MCP server runs on the same port as the HTTP server at `/mcp` and provides these tools:
64
82
 
65
- All process logs are aggregated at http://127.0.0.1:8336/
83
+ | Tool | Description | Parameters |
84
+ |------|-------------|------------|
85
+ | `get_logs` | Get recent logs from buffer | `limit?`, `include?`, `exclude?` |
86
+ | `search_logs` | Search logs with patterns | `limit?`, `include?`, `exclude?` |
87
+ | `clear_logs` | Clear the log buffer | none |
88
+ | `get_process_names` | List all process names that have logged | none |
66
89
 
67
- ```bash
68
- # View all recent logs
69
- curl http://127.0.0.1:8336/
90
+ #### Configuring your AI agent
70
91
 
71
- # View logs from a specific process
72
- curl "http://127.0.0.1:8336/?include=api"
92
+ Add teemux as an MCP server in your AI tool's configuration. For Claude Code, add to your MCP settings:
73
93
 
74
- # View only errors (using wildcard for case variations)
75
- curl "http://127.0.0.1:8336/?include=*error*,*Error*,*ERROR*"
94
+ ```json
95
+ {
96
+ "mcpServers": {
97
+ "teemux": {
98
+ "url": "http://127.0.0.1:8336/mcp"
99
+ }
100
+ }
101
+ }
102
+ ```
76
103
 
77
- # View logs from api OR worker
78
- curl "http://127.0.0.1:8336/?include=api,worker"
104
+ Once configured, your AI agent can:
105
+ - **Inspect logs** when debugging issues ("What errors are in the logs?")
106
+ - **Search for specific events** ("Find all database connection errors")
107
+ - **Monitor processes** ("What processes are currently running?")
108
+ - **Clear logs** to start fresh when testing
109
+
110
+ #### Example MCP usage
79
111
 
80
- # Exclude noisy logs (using wildcard)
81
- curl "http://127.0.0.1:8336/?exclude=health*,DEBUG"
112
+ ```bash
113
+ # Initialize session
114
+ curl -X POST http://127.0.0.1:8336/mcp \
115
+ -H "Content-Type: application/json" \
116
+ -H "Accept: application/json, text/event-stream" \
117
+ -d '{"jsonrpc":"2.0","method":"initialize","params":{"protocolVersion":"2025-03-26","capabilities":{},"clientInfo":{"name":"test","version":"1.0"}},"id":1}'
118
+
119
+ # List available tools (use session ID from response above)
120
+ curl -X POST http://127.0.0.1:8336/mcp \
121
+ -H "Content-Type: application/json" \
122
+ -H "Accept: application/json, text/event-stream" \
123
+ -H "mcp-session-id: <session-id>" \
124
+ -d '{"jsonrpc":"2.0","method":"tools/list","params":{},"id":2}'
125
+
126
+ # Get recent logs
127
+ curl -X POST http://127.0.0.1:8336/mcp \
128
+ -H "Content-Type: application/json" \
129
+ -H "Accept: application/json, text/event-stream" \
130
+ -H "mcp-session-id: <session-id>" \
131
+ -d '{"jsonrpc":"2.0","method":"tools/call","params":{"name":"get_logs","arguments":{"limit":50}},"id":3}'
82
132
  ```
83
- ````
84
133
 
85
134
  ### Filtering Logs
86
135
 
@@ -181,3 +230,16 @@ teemux --name db -- docker run --rm my-database
181
230
  The flags:
182
231
  - `-i` = keep stdin open (for interactive input) ✅
183
232
  - `-t` = allocate pseudo-TTY (adds terminal formatting) ❌
233
+
234
+ ## Developing
235
+
236
+ ```bash
237
+ # Install dependencies
238
+ npm install
239
+
240
+ # Build and watch for changes
241
+ npm run dev
242
+
243
+ # In another terminal, run with fake logs
244
+ node dist/teemux.js -- node scripts/fake-logs.js
245
+ ```