treesap 0.1.12 → 0.1.13

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 +217 -0
  2. package/package.json +1 -1
package/README.md ADDED
@@ -0,0 +1,217 @@
1
+ # Treesap
2
+
3
+ **AI Agent Framework for Distributed Development Teams**
4
+
5
+ Treesap is a revolutionary development platform that enables multiple AI agents and human developers to collaborate in real-time through persistent terminal sessions and WebSocket-based coordination. Built for the future of software development where AI agents work alongside humans in coordinated teams.
6
+
7
+ ## 🌟 Key Features
8
+
9
+ - **Multi-Agent Terminal Orchestration** - Multiple AI agents can work simultaneously across different terminal sessions
10
+ - **Real-Time Cross-Session Monitoring** - External agents can observe and control multiple terminal sessions
11
+ - **Mobile-Responsive Terminal Interface** - Chat-style input for better mobile development experience
12
+ - **WebSocket-Based Architecture** - Real-time bidirectional communication between terminals, web UI, and external agents
13
+ - **Framework Agnostic** - Works with any development stack (Hono, Vite, React, etc.)
14
+ - **Persistent Terminal Sessions** - Sessions survive across browser refreshes and disconnections
15
+ - **Live Preview Integration** - Built-in development server with live reload
16
+
17
+ ## 🚀 Quick Start
18
+
19
+ ### Installation
20
+
21
+ ```bash
22
+ npm install treesap
23
+ ```
24
+
25
+ ### Basic Setup
26
+
27
+ 1. Create a `treesap.config.ts` file in your project root:
28
+
29
+ ```typescript
30
+ import type { TreesapConfig } from 'treesap';
31
+
32
+ const config: TreesapConfig = {
33
+ port: 1235, // Treesap server port
34
+ previewPort: 5173, // Your app's dev server port
35
+ devCommand: "npm run dev", // Command to start your dev server
36
+ devPort: 5173, // Port your dev server runs on
37
+ projectRoot: process.cwd()
38
+ };
39
+
40
+ export default config;
41
+ ```
42
+
43
+ 2. Add scripts to your `package.json`:
44
+
45
+ ```json
46
+ {
47
+ "scripts": {
48
+ "dev:treesap": "treesap dev",
49
+ "treesap": "treesap start"
50
+ }
51
+ }
52
+ ```
53
+
54
+ 3. Start Treesap:
55
+
56
+ ```bash
57
+ npm run dev:treesap
58
+ ```
59
+
60
+ Visit `http://localhost:1235` to access the Treesap interface with integrated terminal and live preview.
61
+
62
+ ## 🏗️ Core Concepts
63
+
64
+ ### Terminal Sessions
65
+ Each terminal session is persistent and can be shared across multiple clients (browsers, agents, etc.). Sessions survive disconnections and can be resumed at any time.
66
+
67
+ ### WebSocket Communication
68
+ All terminal I/O, resize events, and cross-session communication happens over WebSockets, enabling real-time collaboration between humans and AI agents.
69
+
70
+ ### Agent Coordination
71
+ External AI agents can:
72
+ - Monitor multiple terminal sessions simultaneously
73
+ - Send commands to specific terminals
74
+ - Receive real-time output from all monitored sessions
75
+ - Coordinate complex multi-step tasks across multiple environments
76
+
77
+ ## 📱 Mobile-First Design
78
+
79
+ Treesap features a responsive terminal interface with:
80
+ - **Chat-style input** - Familiar textarea interface for mobile users
81
+ - **Two-step command execution** - Send to input field, then execute
82
+ - **Automatic terminal resizing** - Adapts to mobile screen sizes and orientation changes
83
+ - **Touch-optimized controls** - Better interaction on mobile devices
84
+
85
+ ## ⚙️ Configuration
86
+
87
+ The `TreesapConfig` interface supports these options:
88
+
89
+ ```typescript
90
+ interface TreesapConfig {
91
+ port?: number; // Treesap server port (default: 1235)
92
+ previewPort?: number; // Preview iframe port (default: 3000)
93
+ devCommand?: string; // Command to auto-start dev server
94
+ devPort?: number; // Dev server port to auto-start
95
+ projectRoot?: string; // Project root directory
96
+ }
97
+ ```
98
+
99
+ ## 🧠 Multi-Agent Development
100
+
101
+ Treesap enables unprecedented AI agent collaboration:
102
+
103
+ ### Agent Orchestration
104
+ - **Supervisor Agents** - Monitor multiple coding agents across different terminals
105
+ - **Specialized Agents** - Each agent can work in its dedicated terminal session
106
+ - **Cross-Agent Communication** - Agents can coordinate through the WebSocket infrastructure
107
+
108
+ ### Human-AI Collaboration
109
+ - **Seamless Handoffs** - Switch between human and AI control of terminal sessions
110
+ - **Real-time Monitoring** - Watch AI agents work while maintaining override capability
111
+ - **Collaborative Debugging** - Multiple agents can work on the same problem simultaneously
112
+
113
+ ## 🛠️ Architecture
114
+
115
+ ### WebSocket Terminal Service
116
+ - Persistent terminal sessions using `node-pty`
117
+ - Multi-client session sharing
118
+ - Cross-session monitoring and control
119
+ - Real-time input/output streaming
120
+
121
+ ### Sapling Islands Components
122
+ - Reactive terminal interface
123
+ - Live preview integration
124
+ - Mobile-responsive design
125
+ - Chat-style input system
126
+
127
+ ### External Agent Integration
128
+ ```typescript
129
+ // Connect to WebSocket for monitoring
130
+ const ws = new WebSocket('ws://localhost:1235/terminal/ws');
131
+
132
+ // Join a terminal session
133
+ ws.send(JSON.stringify({
134
+ type: 'join',
135
+ sessionId: 'terminal-1',
136
+ terminalId: 'terminal-1'
137
+ }));
138
+
139
+ // Send commands
140
+ ws.send(JSON.stringify({
141
+ type: 'input',
142
+ sessionId: 'terminal-1',
143
+ data: 'npm test\r'
144
+ }));
145
+ ```
146
+
147
+ ## 🎯 Use Cases
148
+
149
+ ### AI Development Teams
150
+ - Multiple AI agents working on different parts of a large codebase
151
+ - Coordinated testing and deployment across multiple environments
152
+ - Real-time code review and collaboration between AI agents
153
+
154
+ ### Educational Platforms
155
+ - Instructors monitoring multiple student coding sessions
156
+ - AI tutors providing real-time assistance
157
+ - Collaborative coding exercises with mixed human-AI teams
158
+
159
+ ### DevOps Orchestration
160
+ - Coordinated deployments across multiple servers
161
+ - Real-time monitoring and intervention capabilities
162
+ - Automated testing with human oversight
163
+
164
+ ## 📚 API Reference
165
+
166
+ ### WebSocket Message Types
167
+ - `join` - Join a terminal session
168
+ - `leave` - Leave a terminal session
169
+ - `input` - Send input to terminal
170
+ - `resize` - Resize terminal dimensions
171
+ - `ping/pong` - Connection health checks
172
+
173
+ ### Terminal Service Methods
174
+ - `getActiveSessions()` - List all active sessions
175
+ - `sendCommandToSession(sessionId, command)` - Send command to session
176
+ - `getSessionClients(sessionId)` - Get connected clients
177
+ - `closeSession(sessionId)` - Terminate a session
178
+
179
+ ## 🔧 Development
180
+
181
+ ### Prerequisites
182
+ - Node.js >=18.0.0
183
+ - TypeScript support
184
+
185
+ ### Building from Source
186
+ ```bash
187
+ git clone https://github.com/withtreesap/treesap.git
188
+ cd treesap/packages/treesap
189
+ npm install
190
+ npm run build
191
+ ```
192
+
193
+ ### Development Scripts
194
+ ```bash
195
+ npm run dev # Start with hot reload
196
+ npm run dev:css # Watch CSS changes
197
+ npm run build # Build for production
198
+ npm run clean # Clean build artifacts
199
+ ```
200
+
201
+ ## 🤝 Contributing
202
+
203
+ We welcome contributions! Treesap is building the foundation for the future of AI-powered development.
204
+
205
+ ## 📄 License
206
+
207
+ MIT License - see LICENSE file for details.
208
+
209
+ ## 🔗 Links
210
+
211
+ - [GitHub Repository](https://github.com/withtreesap/treesap)
212
+ - [Issues & Bug Reports](https://github.com/withtreesap/treesap/issues)
213
+ - [NPM Package](https://www.npmjs.com/package/treesap)
214
+
215
+ ---
216
+
217
+ **Treesap** - *Growing the future of collaborative development* 🌳
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "treesap",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "AI Agent Framework",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",