@gricha/perry 0.0.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 (47) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +153 -0
  3. package/dist/agent/index.js +6 -0
  4. package/dist/agent/router.js +1017 -0
  5. package/dist/agent/run.js +182 -0
  6. package/dist/agent/static.js +58 -0
  7. package/dist/agent/systemd.js +229 -0
  8. package/dist/agent/web/assets/index-9t2sFIJM.js +101 -0
  9. package/dist/agent/web/assets/index-CCFpTruF.css +1 -0
  10. package/dist/agent/web/index.html +14 -0
  11. package/dist/agent/web/vite.svg +1 -0
  12. package/dist/chat/handler.js +174 -0
  13. package/dist/chat/host-handler.js +170 -0
  14. package/dist/chat/host-opencode-handler.js +169 -0
  15. package/dist/chat/index.js +2 -0
  16. package/dist/chat/opencode-handler.js +177 -0
  17. package/dist/chat/opencode-websocket.js +95 -0
  18. package/dist/chat/websocket.js +100 -0
  19. package/dist/client/api.js +138 -0
  20. package/dist/client/config.js +34 -0
  21. package/dist/client/docker-proxy.js +103 -0
  22. package/dist/client/index.js +4 -0
  23. package/dist/client/proxy.js +96 -0
  24. package/dist/client/shell.js +71 -0
  25. package/dist/client/ws-shell.js +120 -0
  26. package/dist/config/loader.js +59 -0
  27. package/dist/docker/index.js +372 -0
  28. package/dist/docker/types.js +1 -0
  29. package/dist/index.js +475 -0
  30. package/dist/sessions/index.js +2 -0
  31. package/dist/sessions/metadata.js +55 -0
  32. package/dist/sessions/parser.js +553 -0
  33. package/dist/sessions/types.js +1 -0
  34. package/dist/shared/base-websocket.js +51 -0
  35. package/dist/shared/client-types.js +1 -0
  36. package/dist/shared/constants.js +11 -0
  37. package/dist/shared/types.js +5 -0
  38. package/dist/terminal/handler.js +86 -0
  39. package/dist/terminal/host-handler.js +76 -0
  40. package/dist/terminal/index.js +3 -0
  41. package/dist/terminal/types.js +8 -0
  42. package/dist/terminal/websocket.js +115 -0
  43. package/dist/workspace/index.js +3 -0
  44. package/dist/workspace/manager.js +475 -0
  45. package/dist/workspace/state.js +66 -0
  46. package/dist/workspace/types.js +1 -0
  47. package/package.json +68 -0
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Subroutine
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,153 @@
1
+ <p align="center">
2
+ <img src="assets/logo.png" alt="Perry" width="200">
3
+ </p>
4
+
5
+ <h1 align="center">Perry</h1>
6
+
7
+ <p align="center">
8
+ <a href="https://github.com/gricha/perry/actions/workflows/test.yml"><img src="https://github.com/gricha/perry/actions/workflows/test.yml/badge.svg" alt="Tests"></a>
9
+ <a href="https://www.npmjs.com/package/@gricha/perry"><img src="https://badge.fury.io/js/@gricha%2Fperry.svg" alt="npm version"></a>
10
+ <a href="https://opensource.org/licenses/MIT"><img src="https://img.shields.io/badge/License-MIT-yellow.svg" alt="License: MIT"></a>
11
+ </p>
12
+
13
+ <p align="center">Isolated, self-hosted workspaces accessible over Tailscale. AI coding agents, web UI, and remote terminal access.</p>
14
+
15
+ ## Features
16
+
17
+ - **AI Coding Agents** - Claude Code, OpenCode, GitHub Copilot pre-installed
18
+ - **Self-Hosted** - Run on your own hardware, full control
19
+ - **Remote Access** - Use from anywhere via Tailscale, CLI, web, or SSH
20
+ - **Web UI** - Manage workspaces from your browser
21
+ - **Isolated Environments** - Each workspace runs in its own container
22
+
23
+ ## Setup
24
+
25
+ ### Install
26
+
27
+ ```bash
28
+ npm install -g @gricha/perry
29
+ ```
30
+
31
+ ### Build Base Image
32
+
33
+ ```bash
34
+ perry build
35
+ ```
36
+
37
+ ### Start Agent
38
+
39
+ ```bash
40
+ perry agent run
41
+ ```
42
+
43
+ Web UI: **http://localhost:7391**
44
+
45
+ The agent runs on port 7391 by default. For remote access, install as a service:
46
+
47
+ ```bash
48
+ perry agent install
49
+ systemctl --user start perry-agent
50
+ ```
51
+
52
+ ### Create & Use Workspaces
53
+
54
+ **Via CLI:**
55
+
56
+ ```bash
57
+ # Create workspace
58
+ perry create myproject
59
+
60
+ # Or clone a repo
61
+ perry create myproject --clone git@github.com:user/repo.git
62
+
63
+ # SSH into workspace
64
+ perry list # Find SSH port
65
+ ssh -p 2201 workspace@localhost
66
+
67
+ # Manage workspaces
68
+ perry start myproject
69
+ perry stop myproject
70
+ perry delete myproject
71
+ ```
72
+
73
+ **Via Web UI:**
74
+
75
+ Open http://localhost:7391 and click "+" to create a workspace.
76
+
77
+ ## Security
78
+
79
+ Perry is designed for use within **secure networks** like [Tailscale](https://tailscale.com). The web UI and API have no authentication, making them ideal for private networks where you can safely access workspaces remotely without additional security concerns.
80
+
81
+ For public internet exposure, place behind a reverse proxy with authentication.
82
+
83
+ ## Configuration
84
+
85
+ Configure credentials and environment variables via Web UI → Settings or edit `~/.config/perry/config.json`:
86
+
87
+ ```json
88
+ {
89
+ "credentials": {
90
+ "env": {
91
+ "ANTHROPIC_API_KEY": "sk-ant-...",
92
+ "OPENAI_API_KEY": "sk-...",
93
+ "GITHUB_TOKEN": "ghp_..."
94
+ },
95
+ "files": {
96
+ "~/.ssh/id_ed25519": "~/.ssh/id_ed25519",
97
+ "~/.gitconfig": "~/.gitconfig"
98
+ }
99
+ }
100
+ }
101
+ ```
102
+
103
+ Restart workspaces to apply changes.
104
+
105
+ ## What's Inside Each Workspace
106
+
107
+ - Ubuntu 24.04 LTS
108
+ - Node.js 22, Python 3, Go
109
+ - Docker (for containerized development)
110
+ - Neovim + LazyVim
111
+ - Git, GitHub CLI, ripgrep, fd-find, jq
112
+ - Claude Code, OpenCode, Codex CLI
113
+
114
+ ## Commands
115
+
116
+ ```bash
117
+ # Agent
118
+ perry agent run [--port PORT]
119
+ perry agent install
120
+ perry agent uninstall
121
+ perry agent status
122
+
123
+ # Workspaces
124
+ perry create <name> [--clone URL]
125
+ perry start <name>
126
+ perry stop <name>
127
+ perry delete <name>
128
+ perry list
129
+ perry logs <name>
130
+
131
+ # Build
132
+ perry build [--no-cache]
133
+ ```
134
+
135
+ ## Development
136
+
137
+ ```bash
138
+ git clone https://github.com/gricha/perry.git
139
+ cd perry
140
+ bun install
141
+ bun run build
142
+ ```
143
+
144
+ Run tests:
145
+
146
+ ```bash
147
+ bun run validate # Lint, typecheck, build, test
148
+ bun run test # Tests only
149
+ ```
150
+
151
+ ## License
152
+
153
+ MIT
@@ -0,0 +1,6 @@
1
+ #!/usr/bin/env node
2
+ import { startAgent } from './run';
3
+ startAgent().catch((err) => {
4
+ console.error('[agent] Fatal error:', err);
5
+ process.exit(1);
6
+ });