@tiflis-io/tiflis-code-workstation 0.3.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.
- package/LICENSE +100 -0
- package/README.md +281 -0
- package/dist/chunk-JSN52PLR.js +36 -0
- package/dist/main.d.ts +2 -0
- package/dist/main.js +9270 -0
- package/dist/session-id-VKOYWZAK.js +7 -0
- package/package.json +83 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
# Functional Source License, Version 1.1 (No Future Conversion)
|
|
2
|
+
|
|
3
|
+
## Abbreviation
|
|
4
|
+
|
|
5
|
+
FSL-1.1-NC
|
|
6
|
+
|
|
7
|
+
## Notice
|
|
8
|
+
|
|
9
|
+
Copyright 2025 Roman Barinov <rbarinov@gmail.com>
|
|
10
|
+
|
|
11
|
+
## Terms and Conditions
|
|
12
|
+
|
|
13
|
+
### Licensor ("We")
|
|
14
|
+
|
|
15
|
+
The party offering the Software under these Terms and Conditions.
|
|
16
|
+
|
|
17
|
+
### The Software
|
|
18
|
+
|
|
19
|
+
The "Software" is each version of the software that we make available under
|
|
20
|
+
these Terms and Conditions, as indicated by our inclusion of these Terms and
|
|
21
|
+
Conditions with the Software.
|
|
22
|
+
|
|
23
|
+
### License Grant
|
|
24
|
+
|
|
25
|
+
Subject to your compliance with this License Grant and the Patents,
|
|
26
|
+
Redistribution and Trademark clauses below, we hereby grant you the right to
|
|
27
|
+
use, copy, modify, create derivative works, publicly perform, publicly display
|
|
28
|
+
and redistribute the Software for any Permitted Purpose identified below.
|
|
29
|
+
|
|
30
|
+
### Permitted Purpose
|
|
31
|
+
|
|
32
|
+
A Permitted Purpose is any purpose other than a Competing Use. A "Competing
|
|
33
|
+
Use" means making the Software available to others in a commercial product or
|
|
34
|
+
service that:
|
|
35
|
+
|
|
36
|
+
1. substitutes for the Software;
|
|
37
|
+
|
|
38
|
+
2. substitutes for any other product or service we offer using the Software
|
|
39
|
+
that exists as of the date we make the Software available; or
|
|
40
|
+
|
|
41
|
+
3. offers the same or substantially similar functionality as the Software.
|
|
42
|
+
|
|
43
|
+
Permitted Purposes specifically include using the Software:
|
|
44
|
+
|
|
45
|
+
1. for your internal use and access;
|
|
46
|
+
|
|
47
|
+
2. for non-commercial education;
|
|
48
|
+
|
|
49
|
+
3. for non-commercial research; and
|
|
50
|
+
|
|
51
|
+
4. in connection with professional services that you provide to a licensee
|
|
52
|
+
using the Software in accordance with these Terms and Conditions.
|
|
53
|
+
|
|
54
|
+
### Patents
|
|
55
|
+
|
|
56
|
+
To the extent your use for a Permitted Purpose would necessarily infringe our
|
|
57
|
+
patents, the license grant above includes a license under our patents. If you
|
|
58
|
+
make a claim against any party that the Software infringes or contributes to
|
|
59
|
+
the infringement of any patent, then your patent license to the Software ends
|
|
60
|
+
immediately.
|
|
61
|
+
|
|
62
|
+
### Redistribution
|
|
63
|
+
|
|
64
|
+
The Terms and Conditions apply to all copies, modifications and derivatives of
|
|
65
|
+
the Software.
|
|
66
|
+
|
|
67
|
+
If you redistribute any copies, modifications or derivatives of the Software,
|
|
68
|
+
you must include a copy of or a link to these Terms and Conditions and not
|
|
69
|
+
remove any copyright notices provided in or with the Software.
|
|
70
|
+
|
|
71
|
+
### Disclaimer
|
|
72
|
+
|
|
73
|
+
THE SOFTWARE IS PROVIDED "AS IS" AND WITHOUT WARRANTIES OF ANY KIND, EXPRESS OR
|
|
74
|
+
IMPLIED, INCLUDING WITHOUT LIMITATION WARRANTIES OF FITNESS FOR A PARTICULAR
|
|
75
|
+
PURPOSE, MERCHANTABILITY, TITLE OR NON-INFRINGEMENT.
|
|
76
|
+
|
|
77
|
+
IN NO EVENT WILL WE HAVE ANY LIABILITY TO YOU ARISING OUT OF OR RELATED TO THE
|
|
78
|
+
SOFTWARE, INCLUDING INDIRECT, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES,
|
|
79
|
+
EVEN IF WE HAVE BEEN INFORMED OF THEIR POSSIBILITY IN ADVANCE.
|
|
80
|
+
|
|
81
|
+
### Trademarks
|
|
82
|
+
|
|
83
|
+
Except for displaying the License Details and identifying us as the origin of
|
|
84
|
+
the Software, you have no right under these Terms and Conditions to use our
|
|
85
|
+
trademarks, trade names, service marks or product names.
|
|
86
|
+
|
|
87
|
+
## Commercial Licensing
|
|
88
|
+
|
|
89
|
+
For commercial use that constitutes a Competing Use, you must obtain a separate
|
|
90
|
+
commercial license from the Licensor.
|
|
91
|
+
|
|
92
|
+
Contact: rbarinov@gmail.com
|
|
93
|
+
|
|
94
|
+
## License Details
|
|
95
|
+
|
|
96
|
+
| Field | Value |
|
|
97
|
+
|-------|-------|
|
|
98
|
+
| Licensor | Roman Barinov |
|
|
99
|
+
| Software | Tiflis Code |
|
|
100
|
+
| Use Grant | Any Permitted Purpose |
|
package/README.md
ADDED
|
@@ -0,0 +1,281 @@
|
|
|
1
|
+
# @tiflis/tiflis-code-workstation
|
|
2
|
+
|
|
3
|
+
<p align="center">
|
|
4
|
+
<img src="../../assets/branding/logo.svg" width="80" height="80" alt="Tiflis Code">
|
|
5
|
+
</p>
|
|
6
|
+
|
|
7
|
+
<p align="center">
|
|
8
|
+
<strong>Agent sessions and terminal access manager for Tiflis Code</strong>
|
|
9
|
+
</p>
|
|
10
|
+
|
|
11
|
+
<p align="center">
|
|
12
|
+
<a href="#installation">Installation</a> •
|
|
13
|
+
<a href="#quick-start">Quick Start</a> •
|
|
14
|
+
<a href="#configuration">Configuration</a> •
|
|
15
|
+
<a href="#docker">Docker</a> •
|
|
16
|
+
<a href="#architecture">Architecture</a>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## Overview
|
|
22
|
+
|
|
23
|
+
The Workstation Server runs on the user's machine and provides:
|
|
24
|
+
|
|
25
|
+
- **AI Agent Sessions**: Create and manage headless agent sessions (Cursor, Claude Code, OpenCode)
|
|
26
|
+
- **Terminal Access**: Full PTY terminal sessions via node-pty
|
|
27
|
+
- **Supervisor Agent**: LangGraph-based assistant for workspace discovery and session management
|
|
28
|
+
- **Tunnel Connection**: Connects to the tunnel server for remote mobile access
|
|
29
|
+
- **Tunnel ID Persistence**: Stores tunnel_id in SQLite database, survives restarts and reclaims ID after tunnel server restarts
|
|
30
|
+
- **Message Persistence**: SQLite database for conversation history
|
|
31
|
+
- **Audio Storage**: File system storage for voice recordings (TTS/STT)
|
|
32
|
+
|
|
33
|
+
```
|
|
34
|
+
┌─────────────────┐ ┌─────────────────┐ ┌─────────────────────┐
|
|
35
|
+
│ Mobile Client │◄───────►│ Tunnel Server │◄───────►│ Workstation Server │
|
|
36
|
+
│ (iOS/watchOS) │ WSS │ (VPS) │ WS │ (Your Machine) │
|
|
37
|
+
└─────────────────┘ └─────────────────┘ └─────────────────────┘
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
## Installation
|
|
41
|
+
|
|
42
|
+
```bash
|
|
43
|
+
# Using npm
|
|
44
|
+
npm install @tiflis-io/tiflis-code-workstation
|
|
45
|
+
|
|
46
|
+
# Using pnpm
|
|
47
|
+
pnpm add @tiflis-io/tiflis-code-workstation
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
## Quick Start
|
|
51
|
+
|
|
52
|
+
### 1. Set Environment Variables
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
# Required: Tunnel connection
|
|
56
|
+
export TUNNEL_URL="wss://tunnel.example.com/ws"
|
|
57
|
+
export TUNNEL_API_KEY="your-tunnel-api-key-32-chars-min!!"
|
|
58
|
+
export WORKSTATION_AUTH_KEY="your-client-auth-key"
|
|
59
|
+
|
|
60
|
+
# Required: Workspaces location
|
|
61
|
+
export WORKSPACES_ROOT="$HOME/work"
|
|
62
|
+
|
|
63
|
+
# Required: AI Agent configuration
|
|
64
|
+
export AGENT_API_KEY="your-openai-api-key"
|
|
65
|
+
```
|
|
66
|
+
|
|
67
|
+
### 2. Run the Server
|
|
68
|
+
|
|
69
|
+
```bash
|
|
70
|
+
# Prerequisites (Linux only - for better-sqlite3 native compilation)
|
|
71
|
+
# Ubuntu/Debian: sudo apt install -y build-essential
|
|
72
|
+
# RHEL/CentOS: sudo dnf groupinstall "Development Tools"
|
|
73
|
+
|
|
74
|
+
# Create a working directory with config (avoid leading dot in name)
|
|
75
|
+
mkdir -p ~/tiflis-workstation && cd ~/tiflis-workstation
|
|
76
|
+
npm init -y
|
|
77
|
+
npm install @tiflis-io/tiflis-code-workstation
|
|
78
|
+
|
|
79
|
+
# Create .env file with your configuration (see below)
|
|
80
|
+
# Then run with dotenv-cli
|
|
81
|
+
npx dotenv-cli -e .env -- node node_modules/@tiflis-io/tiflis-code-workstation/dist/main.js
|
|
82
|
+
|
|
83
|
+
# Or set environment variables directly
|
|
84
|
+
TUNNEL_URL=wss://tunnel.example.com/ws \
|
|
85
|
+
TUNNEL_API_KEY=your-key \
|
|
86
|
+
WORKSTATION_AUTH_KEY=your-auth-key \
|
|
87
|
+
WORKSPACES_ROOT=$HOME/work \
|
|
88
|
+
node node_modules/@tiflis-io/tiflis-code-workstation/dist/main.js
|
|
89
|
+
|
|
90
|
+
# Development mode (from monorepo)
|
|
91
|
+
pnpm dev
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
### 3. Verify It's Running
|
|
95
|
+
|
|
96
|
+
```bash
|
|
97
|
+
curl http://localhost:3002/health
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
<p align="center">
|
|
101
|
+
<img src="../../assets/screenshots/workstation/startup.png" alt="Workstation Server Startup" width="600">
|
|
102
|
+
</p>
|
|
103
|
+
|
|
104
|
+
## Configuration
|
|
105
|
+
|
|
106
|
+
All configuration is done via environment variables:
|
|
107
|
+
|
|
108
|
+
### Core Settings
|
|
109
|
+
|
|
110
|
+
| Variable | Required | Default | Description |
|
|
111
|
+
| ---------------------- | -------- | ---------------- | ---------------------------------------------------- |
|
|
112
|
+
| `TUNNEL_URL` | ✅ | — | WebSocket URL of the tunnel server |
|
|
113
|
+
| `TUNNEL_API_KEY` | ✅ | — | API key for tunnel registration |
|
|
114
|
+
| `WORKSTATION_AUTH_KEY` | ✅ | — | Auth key for mobile client access |
|
|
115
|
+
| `WORKSPACES_ROOT` | ✅ | — | Root directory containing workspaces |
|
|
116
|
+
| `PORT` | ❌ | `3002` | HTTP server port |
|
|
117
|
+
| `LOG_LEVEL` | ❌ | `info` | Log level: `trace`, `debug`, `info`, `warn`, `error` |
|
|
118
|
+
| `WORKSTATION_NAME` | ❌ | hostname | Display name for this workstation |
|
|
119
|
+
| `DATA_DIR` | ❌ | `~/.tiflis-code` | Data directory for SQLite and audio files |
|
|
120
|
+
|
|
121
|
+
### AI Agent (Supervisor)
|
|
122
|
+
|
|
123
|
+
| Variable | Required | Default | Description |
|
|
124
|
+
| ------------------- | -------- | ---------------- | ----------------------------------------------- |
|
|
125
|
+
| `AGENT_PROVIDER` | ❌ | `openai` | LLM provider: `openai`, `cerebras`, `anthropic` |
|
|
126
|
+
| `AGENT_API_KEY` | ✅ | — | API key for LLM provider |
|
|
127
|
+
| `AGENT_MODEL_NAME` | ❌ | `gpt-4o-mini` | Model name |
|
|
128
|
+
| `AGENT_BASE_URL` | ❌ | provider default | Custom API base URL |
|
|
129
|
+
| `AGENT_TEMPERATURE` | ❌ | `0` | LLM temperature (0-2) |
|
|
130
|
+
|
|
131
|
+
### Speech Services
|
|
132
|
+
|
|
133
|
+
| Variable | Required | Default | Description |
|
|
134
|
+
| -------------- | -------- | ----------- | ------------------------------------ |
|
|
135
|
+
| `STT_PROVIDER` | ❌ | `openai` | STT provider: `openai`, `elevenlabs` |
|
|
136
|
+
| `STT_API_KEY` | ❌ | — | API key for STT provider |
|
|
137
|
+
| `STT_MODEL` | ❌ | `whisper-1` | STT model name |
|
|
138
|
+
| `TTS_PROVIDER` | ❌ | `openai` | TTS provider: `openai`, `elevenlabs` |
|
|
139
|
+
| `TTS_API_KEY` | ❌ | — | API key for TTS provider |
|
|
140
|
+
| `TTS_MODEL` | ❌ | `tts-1` | TTS model name |
|
|
141
|
+
| `TTS_VOICE` | ❌ | `alloy` | Voice ID for TTS |
|
|
142
|
+
|
|
143
|
+
### Example `.env.local` File
|
|
144
|
+
|
|
145
|
+
```bash
|
|
146
|
+
NODE_ENV=development
|
|
147
|
+
PORT=3002
|
|
148
|
+
LOG_LEVEL=debug
|
|
149
|
+
|
|
150
|
+
# Tunnel connection
|
|
151
|
+
TUNNEL_URL=wss://tunnel.example.com/ws
|
|
152
|
+
TUNNEL_API_KEY=your-tunnel-api-key-32-chars-min!!
|
|
153
|
+
WORKSTATION_NAME=my-macbook
|
|
154
|
+
WORKSTATION_AUTH_KEY=dev-workstation-key
|
|
155
|
+
|
|
156
|
+
# Workspaces
|
|
157
|
+
WORKSPACES_ROOT=/Users/yourname/work
|
|
158
|
+
DATA_DIR=/Users/yourname/.tiflis-code
|
|
159
|
+
|
|
160
|
+
# LLM (Supervisor Agent)
|
|
161
|
+
AGENT_PROVIDER=openai
|
|
162
|
+
AGENT_API_KEY=sk-xxx
|
|
163
|
+
AGENT_MODEL_NAME=gpt-4o-mini
|
|
164
|
+
|
|
165
|
+
# Speech-to-Text
|
|
166
|
+
STT_PROVIDER=openai
|
|
167
|
+
STT_API_KEY=sk-xxx
|
|
168
|
+
|
|
169
|
+
# Text-to-Speech
|
|
170
|
+
TTS_PROVIDER=openai
|
|
171
|
+
TTS_API_KEY=sk-xxx
|
|
172
|
+
TTS_VOICE=alloy
|
|
173
|
+
```
|
|
174
|
+
|
|
175
|
+
## Docker
|
|
176
|
+
|
|
177
|
+
### Quick Start with Docker
|
|
178
|
+
|
|
179
|
+
```bash
|
|
180
|
+
docker run -d \
|
|
181
|
+
--name tiflis-workstation \
|
|
182
|
+
-p 3002:3002 \
|
|
183
|
+
-v "$HOME/work:/workspaces" \
|
|
184
|
+
-v "$HOME/.tiflis-code:/data" \
|
|
185
|
+
-e TUNNEL_URL="wss://tunnel.example.com/ws" \
|
|
186
|
+
-e TUNNEL_API_KEY="your-api-key" \
|
|
187
|
+
-e WORKSTATION_AUTH_KEY="your-auth-key" \
|
|
188
|
+
-e WORKSPACES_ROOT="/workspaces" \
|
|
189
|
+
-e DATA_DIR="/data" \
|
|
190
|
+
-e AGENT_API_KEY="your-openai-key" \
|
|
191
|
+
ghcr.io/tiflis-io/tiflis-code-workstation:latest
|
|
192
|
+
```
|
|
193
|
+
|
|
194
|
+
### Docker Compose
|
|
195
|
+
|
|
196
|
+
```yaml
|
|
197
|
+
services:
|
|
198
|
+
workstation:
|
|
199
|
+
image: ghcr.io/tiflis-io/tiflis-code-workstation:latest
|
|
200
|
+
ports:
|
|
201
|
+
- "3002:3002"
|
|
202
|
+
volumes:
|
|
203
|
+
- "${HOME}/work:/workspaces"
|
|
204
|
+
- "${HOME}/.tiflis-code:/data"
|
|
205
|
+
environment:
|
|
206
|
+
NODE_ENV: production
|
|
207
|
+
LOG_LEVEL: info
|
|
208
|
+
TUNNEL_URL: ${TUNNEL_URL}
|
|
209
|
+
TUNNEL_API_KEY: ${TUNNEL_API_KEY}
|
|
210
|
+
WORKSTATION_AUTH_KEY: ${WORKSTATION_AUTH_KEY}
|
|
211
|
+
WORKSPACES_ROOT: /workspaces
|
|
212
|
+
DATA_DIR: /data
|
|
213
|
+
AGENT_API_KEY: ${AGENT_API_KEY}
|
|
214
|
+
restart: unless-stopped
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### Multi-Architecture Support
|
|
218
|
+
|
|
219
|
+
The Docker image supports both architectures:
|
|
220
|
+
|
|
221
|
+
- `linux/amd64` (x86_64)
|
|
222
|
+
- `linux/arm64` (Apple Silicon, AWS Graviton)
|
|
223
|
+
|
|
224
|
+
## Architecture
|
|
225
|
+
|
|
226
|
+
```
|
|
227
|
+
src/
|
|
228
|
+
├── config/ # Environment and constants
|
|
229
|
+
├── domain/ # Business logic
|
|
230
|
+
│ ├── entities/ # Session, Client entities
|
|
231
|
+
│ ├── value-objects/ # SessionId, DeviceId, ChatMessage
|
|
232
|
+
│ ├── ports/ # Interface definitions
|
|
233
|
+
│ └── errors/ # Domain errors
|
|
234
|
+
├── application/ # Use cases
|
|
235
|
+
│ ├── commands/ # Create/Terminate sessions
|
|
236
|
+
│ ├── queries/ # List sessions
|
|
237
|
+
│ └── services/ # Subscriptions, broadcasting, chat history
|
|
238
|
+
├── infrastructure/ # External adapters
|
|
239
|
+
│ ├── agents/ # Agent session management
|
|
240
|
+
│ │ └── supervisor/ # LangGraph Supervisor Agent
|
|
241
|
+
│ │ └── tools/ # Workspace, session, filesystem tools
|
|
242
|
+
│ ├── websocket/ # Tunnel client, message router
|
|
243
|
+
│ ├── persistence/ # SQLite, in-memory registries
|
|
244
|
+
│ ├── terminal/ # PTY management
|
|
245
|
+
│ ├── speech/ # TTS/STT services
|
|
246
|
+
│ └── workspace/ # File system discovery
|
|
247
|
+
└── protocol/ # Message types and schemas
|
|
248
|
+
```
|
|
249
|
+
|
|
250
|
+
## API Endpoints
|
|
251
|
+
|
|
252
|
+
| Endpoint | Method | Description |
|
|
253
|
+
| ---------- | --------- | ----------------------- |
|
|
254
|
+
| `/health` | GET | Detailed health check |
|
|
255
|
+
| `/healthz` | GET | Simple liveness probe |
|
|
256
|
+
| `/readyz` | GET | Readiness probe |
|
|
257
|
+
| `/ws` | WebSocket | Main WebSocket endpoint |
|
|
258
|
+
|
|
259
|
+
## Development
|
|
260
|
+
|
|
261
|
+
```bash
|
|
262
|
+
# Clone the repository
|
|
263
|
+
git clone https://github.com/tiflis-io/tiflis-code.git
|
|
264
|
+
cd tiflis-code/packages/workstation
|
|
265
|
+
|
|
266
|
+
# Install dependencies
|
|
267
|
+
pnpm install
|
|
268
|
+
|
|
269
|
+
# Run in development mode
|
|
270
|
+
pnpm dev
|
|
271
|
+
|
|
272
|
+
# Run tests
|
|
273
|
+
pnpm test
|
|
274
|
+
|
|
275
|
+
# Build for production
|
|
276
|
+
pnpm build
|
|
277
|
+
```
|
|
278
|
+
|
|
279
|
+
## License
|
|
280
|
+
|
|
281
|
+
FSL-1.1-NC © [Roman Barinov](mailto:rbarinov@gmail.com)
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
var __defProp = Object.defineProperty;
|
|
3
|
+
var __export = (target, all) => {
|
|
4
|
+
for (var name in all)
|
|
5
|
+
__defProp(target, name, { get: all[name], enumerable: true });
|
|
6
|
+
};
|
|
7
|
+
|
|
8
|
+
// src/domain/value-objects/session-id.ts
|
|
9
|
+
var SessionId = class {
|
|
10
|
+
_value;
|
|
11
|
+
constructor(value) {
|
|
12
|
+
if (!value || value.length < 8) {
|
|
13
|
+
throw new Error("Session ID must be at least 8 characters");
|
|
14
|
+
}
|
|
15
|
+
this._value = value;
|
|
16
|
+
}
|
|
17
|
+
get value() {
|
|
18
|
+
return this._value;
|
|
19
|
+
}
|
|
20
|
+
equals(other) {
|
|
21
|
+
return this._value === other._value;
|
|
22
|
+
}
|
|
23
|
+
toString() {
|
|
24
|
+
return this._value;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export {
|
|
29
|
+
__export,
|
|
30
|
+
SessionId
|
|
31
|
+
};
|
|
32
|
+
/**
|
|
33
|
+
* @file session-id.ts
|
|
34
|
+
* @copyright 2025 Roman Barinov <rbarinov@gmail.com>
|
|
35
|
+
* @license FSL-1.1-NC
|
|
36
|
+
*/
|
package/dist/main.d.ts
ADDED