@ao_zorin/zocket 1.1.0 → 1.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/README.md +15 -5
- package/dist/zocket.js +624 -41
- package/docs/AI_AUTODEPLOY.md +9 -13
- package/docs/GIT_NPM_RELEASE.md +4 -13
- package/docs/INSTALL.md +50 -118
- package/package.json +3 -1
- package/scripts/install-zocket.ps1 +34 -70
- package/scripts/install-zocket.sh +82 -143
package/docs/AI_AUTODEPLOY.md
CHANGED
|
@@ -6,22 +6,22 @@ This is the file you can send to an AI coding agent so it can deploy zocket end-
|
|
|
6
6
|
|
|
7
7
|
If this repo is already present locally:
|
|
8
8
|
```bash
|
|
9
|
-
|
|
9
|
+
bash scripts/install-zocket.sh --source local
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
If only the file is available, the script will
|
|
12
|
+
If only the file is available, the script will fetch and run the platform installer:
|
|
13
|
+
```bash
|
|
14
|
+
curl -fsSL https://raw.githubusercontent.com/aozorin/zocket/main/scripts/install-zocket.sh | bash
|
|
15
|
+
```
|
|
13
16
|
|
|
14
17
|
## Agent task prompt (copy/paste)
|
|
15
18
|
|
|
16
19
|
```text
|
|
17
20
|
Deploy zocket on this machine with secure defaults:
|
|
18
21
|
1) Detect OS and shell.
|
|
19
|
-
2) Run
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
--mcp-port 18002
|
|
23
|
-
--mcp-mode metadata
|
|
24
|
-
--autostart user (Linux/macOS) or enabled startup task (Windows)
|
|
22
|
+
2) Run installer:
|
|
23
|
+
- Linux/macOS: curl -fsSL https://raw.githubusercontent.com/aozorin/zocket/main/scripts/install-zocket.sh | bash
|
|
24
|
+
- Windows: irm https://raw.githubusercontent.com/aozorin/zocket/main/scripts/install-zocket.ps1 | iex
|
|
25
25
|
3) Verify:
|
|
26
26
|
- web panel on http://127.0.0.1:18001
|
|
27
27
|
- MCP SSE endpoint on http://127.0.0.1:18002/sse (Claude Code)
|
|
@@ -33,11 +33,7 @@ Deploy zocket on this machine with secure defaults:
|
|
|
33
33
|
## Optional production profile (Linux system services)
|
|
34
34
|
|
|
35
35
|
```bash
|
|
36
|
-
|
|
37
|
-
--repo-url https://github.com/your-org/zocket.git \
|
|
38
|
-
--repo-ref main \
|
|
39
|
-
--autostart system \
|
|
40
|
-
--zocket-home /var/lib/zocket
|
|
36
|
+
bash scripts/install-zocket.sh --source git --repo-url https://github.com/aozorin/zocket.git --repo-ref main --autostart system --zocket-home /var/lib/zocket
|
|
41
37
|
```
|
|
42
38
|
|
|
43
39
|
## Post-deploy checklist for agent
|
package/docs/GIT_NPM_RELEASE.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# Git + npm
|
|
1
|
+
# Git + npm Release Guide
|
|
2
2
|
|
|
3
3
|
## 1) Initialize git project
|
|
4
4
|
|
|
@@ -17,15 +17,7 @@ git push -u origin main
|
|
|
17
17
|
bash scripts/release-check.sh
|
|
18
18
|
```
|
|
19
19
|
|
|
20
|
-
## 3) Publish
|
|
21
|
-
|
|
22
|
-
```bash
|
|
23
|
-
python3 -m pip install --upgrade build twine
|
|
24
|
-
python3 -m build
|
|
25
|
-
twine upload dist/*
|
|
26
|
-
```
|
|
27
|
-
|
|
28
|
-
## 4) Publish npm package
|
|
20
|
+
## 3) Publish npm package
|
|
29
21
|
|
|
30
22
|
Update metadata in `package.json`:
|
|
31
23
|
- `name`
|
|
@@ -39,15 +31,14 @@ npm login
|
|
|
39
31
|
npm publish --access public
|
|
40
32
|
```
|
|
41
33
|
|
|
42
|
-
##
|
|
34
|
+
## 4) Tag release
|
|
43
35
|
|
|
44
36
|
```bash
|
|
45
37
|
git tag -a v1.0.0 -m "zocket v1.0.0"
|
|
46
38
|
git push origin v1.0.0
|
|
47
39
|
```
|
|
48
40
|
|
|
49
|
-
##
|
|
41
|
+
## 5) Optional GitHub Release artifacts
|
|
50
42
|
|
|
51
43
|
Upload:
|
|
52
|
-
- Python wheels/sdist from `dist/`
|
|
53
44
|
- npm package tarball from `npm pack`
|
package/docs/INSTALL.md
CHANGED
|
@@ -1,16 +1,20 @@
|
|
|
1
1
|
# Install Guide (Windows / Linux / macOS)
|
|
2
2
|
|
|
3
|
-
This guide installs **zocket** as:
|
|
3
|
+
This guide installs **zocket** (Node.js) as:
|
|
4
4
|
- local web panel on `127.0.0.1:18001`
|
|
5
5
|
- MCP SSE server on `127.0.0.1:18002/sse` (Claude Code)
|
|
6
6
|
- MCP streamable HTTP server on `127.0.0.1:18003/mcp` (Codex)
|
|
7
|
-
- optional MCP stdio server for local CLI use
|
|
8
7
|
|
|
9
8
|
## 1) Quick Install (recommended)
|
|
10
9
|
|
|
11
10
|
### Linux and macOS
|
|
12
11
|
```bash
|
|
13
|
-
curl -fsSL https://raw.githubusercontent.com/
|
|
12
|
+
curl -fsSL https://raw.githubusercontent.com/aozorin/zocket/main/scripts/install-zocket.sh | bash
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
MCP-only (no web panel):
|
|
16
|
+
```bash
|
|
17
|
+
curl -fsSL https://raw.githubusercontent.com/aozorin/zocket/main/scripts/install-zocket.sh | bash -s -- --no-web
|
|
14
18
|
```
|
|
15
19
|
|
|
16
20
|
If you run from a local clone:
|
|
@@ -20,7 +24,14 @@ bash scripts/install-zocket.sh --source local
|
|
|
20
24
|
|
|
21
25
|
### Windows (PowerShell)
|
|
22
26
|
```powershell
|
|
23
|
-
irm https://raw.githubusercontent.com/
|
|
27
|
+
irm https://raw.githubusercontent.com/aozorin/zocket/main/scripts/install-zocket.ps1 | iex
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
MCP-only (no web panel):
|
|
31
|
+
```powershell
|
|
32
|
+
$tmp = "$env:TEMP\\install-zocket.ps1"
|
|
33
|
+
irm https://raw.githubusercontent.com/aozorin/zocket/main/scripts/install-zocket.ps1 -OutFile $tmp
|
|
34
|
+
powershell -ExecutionPolicy Bypass -File $tmp -NoWeb
|
|
24
35
|
```
|
|
25
36
|
|
|
26
37
|
If you run from a local clone:
|
|
@@ -32,16 +43,15 @@ powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1 -Source Lo
|
|
|
32
43
|
|
|
33
44
|
### Debian/Ubuntu and Debian-based
|
|
34
45
|
Installer auto-installs:
|
|
35
|
-
- `
|
|
36
|
-
- `
|
|
37
|
-
- `python3-pip`
|
|
46
|
+
- `nodejs`
|
|
47
|
+
- `npm`
|
|
38
48
|
- `git`
|
|
39
49
|
- `curl`
|
|
40
50
|
|
|
41
51
|
Equivalent manual install:
|
|
42
52
|
```bash
|
|
43
53
|
sudo apt-get update
|
|
44
|
-
sudo apt-get install -y
|
|
54
|
+
sudo apt-get install -y nodejs npm git curl
|
|
45
55
|
```
|
|
46
56
|
|
|
47
57
|
### Other Linux distros
|
|
@@ -52,22 +62,21 @@ Installer supports:
|
|
|
52
62
|
- `apk` (Alpine)
|
|
53
63
|
|
|
54
64
|
If your distro is unsupported, install manually:
|
|
55
|
-
-
|
|
56
|
-
- `
|
|
57
|
-
- `venv`
|
|
65
|
+
- Node.js `>=18`
|
|
66
|
+
- `npm`
|
|
58
67
|
- `git`
|
|
59
68
|
|
|
60
69
|
## 3) macOS details
|
|
61
70
|
|
|
62
71
|
Installer uses Homebrew when dependencies are missing:
|
|
63
72
|
```bash
|
|
64
|
-
brew install
|
|
73
|
+
brew install node git curl
|
|
65
74
|
```
|
|
66
75
|
|
|
67
76
|
## 4) Windows details
|
|
68
77
|
|
|
69
78
|
Requirements:
|
|
70
|
-
-
|
|
79
|
+
- Node.js 18+ (recommended from `nodejs.org` or `winget`)
|
|
71
80
|
- Git for Windows
|
|
72
81
|
|
|
73
82
|
Autostart (enabled by default):
|
|
@@ -75,10 +84,8 @@ Autostart (enabled by default):
|
|
|
75
84
|
powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1
|
|
76
85
|
```
|
|
77
86
|
|
|
78
|
-
This creates scheduled
|
|
79
|
-
- `
|
|
80
|
-
- `ZocketMcpSse`
|
|
81
|
-
- `ZocketMcpStreamable`
|
|
87
|
+
This creates scheduled task:
|
|
88
|
+
- `Zocket`
|
|
82
89
|
|
|
83
90
|
Disable autostart:
|
|
84
91
|
```powershell
|
|
@@ -87,128 +94,58 @@ powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1 -EnableAut
|
|
|
87
94
|
|
|
88
95
|
## 5) NPM package usage
|
|
89
96
|
|
|
90
|
-
This repo now includes an npm wrapper package.
|
|
91
|
-
|
|
92
97
|
Global install from npm:
|
|
93
98
|
```bash
|
|
94
|
-
npm i -g @zocket
|
|
95
|
-
zocket setup
|
|
99
|
+
npm i -g @ao_zorin/zocket
|
|
96
100
|
```
|
|
97
101
|
|
|
98
|
-
|
|
99
|
-
```bash
|
|
100
|
-
npm i -g github:your-org/zocket
|
|
101
|
-
```
|
|
102
|
-
|
|
103
|
-
First-run setup:
|
|
102
|
+
Then use normal CLI:
|
|
104
103
|
```bash
|
|
105
|
-
zocket
|
|
104
|
+
zocket init
|
|
105
|
+
zocket start --host 127.0.0.1 --web-port 18001 --mcp-port 18002 --mcp-stream-port 18003 --mode admin
|
|
106
106
|
```
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
MCP-only (no web panel):
|
|
109
109
|
```bash
|
|
110
|
-
zocket
|
|
111
|
-
zocket web --host 127.0.0.1 --port 18001
|
|
112
|
-
zocket mcp --transport sse --mode metadata --host 127.0.0.1 --port 18002
|
|
113
|
-
zocket mcp --transport streamable-http --mode metadata --host 127.0.0.1 --port 18003
|
|
110
|
+
zocket server --host 127.0.0.1 --mcp-port 18002 --mcp-stream-port 18003 --mode admin
|
|
114
111
|
```
|
|
115
112
|
|
|
116
113
|
## 6) Systemd hardening on Linux (production)
|
|
117
114
|
|
|
118
115
|
If you install with `--autostart system`, the installer creates and enables:
|
|
119
|
-
- `zocket
|
|
120
|
-
- `zocket-mcp-sse.service` (Claude Code, 18002)
|
|
121
|
-
- `zocket-mcp-http.service` (Codex, 18003)
|
|
116
|
+
- `zocket.service` (web + SSE + streamable HTTP)
|
|
122
117
|
|
|
123
118
|
Check:
|
|
124
119
|
```bash
|
|
125
|
-
systemctl status zocket
|
|
126
|
-
systemctl status zocket-mcp-sse.service --no-pager
|
|
127
|
-
systemctl status zocket-mcp-http.service --no-pager
|
|
120
|
+
systemctl status zocket.service --no-pager
|
|
128
121
|
```
|
|
129
122
|
|
|
130
123
|
### Linux user-level autostart (no root)
|
|
131
124
|
```bash
|
|
132
|
-
systemctl --user enable --now zocket
|
|
133
|
-
systemctl --user
|
|
134
|
-
systemctl --user enable --now zocket-mcp-http.service
|
|
135
|
-
systemctl --user status zocket-web.service --no-pager
|
|
136
|
-
systemctl --user status zocket-mcp-sse.service --no-pager
|
|
137
|
-
systemctl --user status zocket-mcp-http.service --no-pager
|
|
125
|
+
systemctl --user enable --now zocket.service
|
|
126
|
+
systemctl --user status zocket.service --no-pager
|
|
138
127
|
```
|
|
139
128
|
|
|
140
129
|
### macOS launchd autostart (installed by script)
|
|
141
130
|
Installer creates and loads:
|
|
142
|
-
- `~/Library/LaunchAgents/dev.zocket.
|
|
143
|
-
- `~/Library/LaunchAgents/dev.zocket.mcp-sse.plist`
|
|
144
|
-
- `~/Library/LaunchAgents/dev.zocket.mcp-streamable.plist`
|
|
145
|
-
|
|
146
|
-
If you need to install manually, use:
|
|
147
|
-
|
|
148
|
-
```xml
|
|
149
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
150
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
151
|
-
<plist version="1.0">
|
|
152
|
-
<dict>
|
|
153
|
-
<key>Label</key><string>dev.zocket.web</string>
|
|
154
|
-
<key>ProgramArguments</key>
|
|
155
|
-
<array>
|
|
156
|
-
<string>/Users/YOUR_USER/.local/share/zocket/venv/bin/python3</string>
|
|
157
|
-
<string>-m</string><string>zocket</string>
|
|
158
|
-
<string>web</string><string>--host</string><string>127.0.0.1</string>
|
|
159
|
-
<string>--port</string><string>18001</string>
|
|
160
|
-
</array>
|
|
161
|
-
<key>EnvironmentVariables</key>
|
|
162
|
-
<dict>
|
|
163
|
-
<key>ZOCKET_HOME</key><string>/Users/YOUR_USER/.zocket</string>
|
|
164
|
-
</dict>
|
|
165
|
-
<key>RunAtLoad</key><true/>
|
|
166
|
-
<key>KeepAlive</key><true/>
|
|
167
|
-
</dict>
|
|
168
|
-
</plist>
|
|
169
|
-
```
|
|
170
|
-
|
|
171
|
-
SSE MCP (`dev.zocket.mcp-sse.plist`):
|
|
172
|
-
```xml
|
|
173
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
174
|
-
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
175
|
-
<plist version="1.0">
|
|
176
|
-
<dict>
|
|
177
|
-
<key>Label</key><string>dev.zocket.mcp-sse</string>
|
|
178
|
-
<key>ProgramArguments</key>
|
|
179
|
-
<array>
|
|
180
|
-
<string>/Users/YOUR_USER/.local/share/zocket/venv/bin/python3</string>
|
|
181
|
-
<string>-m</string><string>zocket</string>
|
|
182
|
-
<string>mcp</string><string>--transport</string><string>sse</string>
|
|
183
|
-
<string>--mode</string><string>metadata</string>
|
|
184
|
-
<string>--host</string><string>127.0.0.1</string>
|
|
185
|
-
<string>--port</string><string>18002</string>
|
|
186
|
-
</array>
|
|
187
|
-
<key>EnvironmentVariables</key>
|
|
188
|
-
<dict>
|
|
189
|
-
<key>ZOCKET_HOME</key><string>/Users/YOUR_USER/.zocket</string>
|
|
190
|
-
</dict>
|
|
191
|
-
<key>RunAtLoad</key><true/>
|
|
192
|
-
<key>KeepAlive</key><true/>
|
|
193
|
-
</dict>
|
|
194
|
-
</plist>
|
|
195
|
-
```
|
|
131
|
+
- `~/Library/LaunchAgents/dev.zocket.plist`
|
|
196
132
|
|
|
197
|
-
|
|
133
|
+
Manual example:
|
|
198
134
|
```xml
|
|
199
135
|
<?xml version="1.0" encoding="UTF-8"?>
|
|
200
136
|
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
201
137
|
<plist version="1.0">
|
|
202
138
|
<dict>
|
|
203
|
-
<key>Label</key><string>dev.zocket
|
|
139
|
+
<key>Label</key><string>dev.zocket</string>
|
|
204
140
|
<key>ProgramArguments</key>
|
|
205
141
|
<array>
|
|
206
|
-
<string>/
|
|
207
|
-
<string
|
|
208
|
-
<string>mcp</string><string>--transport</string><string>streamable-http</string>
|
|
209
|
-
<string>--mode</string><string>metadata</string>
|
|
142
|
+
<string>/usr/local/bin/zocket</string>
|
|
143
|
+
<string>start</string>
|
|
210
144
|
<string>--host</string><string>127.0.0.1</string>
|
|
211
|
-
<string>--port</string><string>
|
|
145
|
+
<string>--web-port</string><string>18001</string>
|
|
146
|
+
<string>--mcp-port</string><string>18002</string>
|
|
147
|
+
<string>--mcp-stream-port</string><string>18003</string>
|
|
148
|
+
<string>--mode</string><string>admin</string>
|
|
212
149
|
</array>
|
|
213
150
|
<key>EnvironmentVariables</key>
|
|
214
151
|
<dict>
|
|
@@ -220,11 +157,9 @@ Streamable HTTP MCP (`dev.zocket.mcp-streamable.plist`):
|
|
|
220
157
|
</plist>
|
|
221
158
|
```
|
|
222
159
|
|
|
223
|
-
Load
|
|
160
|
+
Load service:
|
|
224
161
|
```bash
|
|
225
|
-
launchctl load ~/Library/LaunchAgents/dev.zocket.
|
|
226
|
-
launchctl load ~/Library/LaunchAgents/dev.zocket.mcp-sse.plist
|
|
227
|
-
launchctl load ~/Library/LaunchAgents/dev.zocket.mcp-streamable.plist
|
|
162
|
+
launchctl load ~/Library/LaunchAgents/dev.zocket.plist
|
|
228
163
|
```
|
|
229
164
|
|
|
230
165
|
### Windows autostart (Task Scheduler)
|
|
@@ -234,13 +169,10 @@ powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1 -EnableAut
|
|
|
234
169
|
```
|
|
235
170
|
|
|
236
171
|
Or create manually:
|
|
237
|
-
- task `
|
|
238
|
-
-
|
|
239
|
-
-
|
|
240
|
-
-
|
|
241
|
-
- `python -m zocket web --host 127.0.0.1 --port 18001`
|
|
242
|
-
- `python -m zocket mcp --transport sse --mode metadata --host 127.0.0.1 --port 18002`
|
|
243
|
-
- `python -m zocket mcp --transport streamable-http --mode metadata --host 127.0.0.1 --port 18003`
|
|
172
|
+
- task `Zocket` on logon
|
|
173
|
+
- action:
|
|
174
|
+
- `zocket start --host 127.0.0.1 --web-port 18001 --mcp-port 18002 --mcp-stream-port 18003 --mode admin`
|
|
175
|
+
- add `--no-web` for MCP-only
|
|
244
176
|
|
|
245
177
|
## 7) First web open
|
|
246
178
|
|
|
@@ -255,5 +187,5 @@ Open `http://127.0.0.1:18001` and choose one:
|
|
|
255
187
|
curl -I http://127.0.0.1:18001/login
|
|
256
188
|
curl -I http://127.0.0.1:18002/sse
|
|
257
189
|
curl -I http://127.0.0.1:18003/mcp
|
|
258
|
-
zocket mcp --
|
|
190
|
+
zocket start --host 127.0.0.1 --web-port 18001 --mcp-port 18002 --mcp-stream-port 18003 --mode admin
|
|
259
191
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ao_zorin/zocket",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.0",
|
|
4
4
|
"description": "Local encrypted vault + web panel + MCP server for AI agent workflows",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"bin": {
|
|
@@ -18,6 +18,7 @@
|
|
|
18
18
|
"@anthropic-ai/sdk": "^0.78.0",
|
|
19
19
|
"@hono/node-server": "^1.13.0",
|
|
20
20
|
"@modelcontextprotocol/sdk": "^1.0.0",
|
|
21
|
+
"blessed": "^0.1.81",
|
|
21
22
|
"commander": "^12.0.0",
|
|
22
23
|
"hono": "^4.0.0",
|
|
23
24
|
"proper-lockfile": "^4.1.2",
|
|
@@ -33,6 +34,7 @@
|
|
|
33
34
|
},
|
|
34
35
|
"devDependencies": {
|
|
35
36
|
"@anthropic-ai/tokenizer": "^0.0.4",
|
|
37
|
+
"@types/blessed": "^0.1.24",
|
|
36
38
|
"@types/node": "^20.0.0",
|
|
37
39
|
"@types/proper-lockfile": "^4.1.4",
|
|
38
40
|
"js-tiktoken": "^1.0.21",
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
Param(
|
|
2
|
-
[ValidateSet("Auto", "Local", "Git", "
|
|
2
|
+
[ValidateSet("Auto", "Local", "Git", "Npm")]
|
|
3
3
|
[string]$Source = "Auto",
|
|
4
|
-
[string]$RepoUrl = "https://github.com/
|
|
4
|
+
[string]$RepoUrl = "https://github.com/aozorin/zocket.git",
|
|
5
5
|
[string]$RepoRef = "main",
|
|
6
|
-
[string]$InstallRoot = "$env:LOCALAPPDATA\zocket",
|
|
7
6
|
[string]$ZocketHome = "$env:USERPROFILE\.zocket",
|
|
8
7
|
[ValidateSet("en", "ru")]
|
|
9
8
|
[string]$Lang = "en",
|
|
@@ -11,106 +10,71 @@ Param(
|
|
|
11
10
|
[int]$McpPort = 18002,
|
|
12
11
|
[int]$McpStreamPort = 18003,
|
|
13
12
|
[ValidateSet("metadata", "admin")]
|
|
14
|
-
[string]$McpMode = "
|
|
15
|
-
[bool]$EnableAutostart = $true
|
|
13
|
+
[string]$McpMode = "admin",
|
|
14
|
+
[bool]$EnableAutostart = $true,
|
|
15
|
+
[switch]$NoWeb
|
|
16
16
|
)
|
|
17
17
|
|
|
18
18
|
$ErrorActionPreference = "Stop"
|
|
19
19
|
|
|
20
|
-
function
|
|
21
|
-
if (
|
|
22
|
-
|
|
23
|
-
}
|
|
24
|
-
if (Get-Command python -ErrorAction SilentlyContinue) {
|
|
25
|
-
return @{Cmd = "python"; Prefix = @()}
|
|
20
|
+
function Ensure-Dir([string]$Path) {
|
|
21
|
+
if (-not (Test-Path -LiteralPath $Path)) {
|
|
22
|
+
New-Item -ItemType Directory -Path $Path | Out-Null
|
|
26
23
|
}
|
|
27
|
-
throw "Python 3.10+ not found. Install Python and rerun."
|
|
28
24
|
}
|
|
29
25
|
|
|
30
|
-
function
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
throw "Command failed: $Cmd $($Args -join ' ')"
|
|
26
|
+
function Ensure-Node {
|
|
27
|
+
if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
|
|
28
|
+
throw "Node.js not found. Install Node.js 18+ and rerun."
|
|
34
29
|
}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
function Ensure-Dir([string]$Path) {
|
|
38
|
-
if (-not (Test-Path -LiteralPath $Path)) {
|
|
39
|
-
New-Item -ItemType Directory -Path $Path | Out-Null
|
|
30
|
+
if (-not (Get-Command npm -ErrorAction SilentlyContinue)) {
|
|
31
|
+
throw "npm not found. Install Node.js 18+ (includes npm) and rerun."
|
|
40
32
|
}
|
|
41
33
|
}
|
|
42
34
|
|
|
35
|
+
Ensure-Node
|
|
36
|
+
|
|
43
37
|
$repoRoot = Split-Path -Parent $PSScriptRoot
|
|
44
38
|
if ($Source -eq "Auto") {
|
|
45
|
-
if (Test-Path -LiteralPath (Join-Path $repoRoot "
|
|
39
|
+
if (Test-Path -LiteralPath (Join-Path $repoRoot "package.json")) {
|
|
46
40
|
$Source = "Local"
|
|
47
41
|
} else {
|
|
48
|
-
$Source = "
|
|
42
|
+
$Source = "Npm"
|
|
49
43
|
}
|
|
50
44
|
}
|
|
51
45
|
|
|
52
|
-
Ensure-Dir $InstallRoot
|
|
53
|
-
$srcDir = Join-Path $InstallRoot "src"
|
|
54
|
-
|
|
55
|
-
$pkgSource = $null
|
|
56
46
|
if ($Source -eq "Local") {
|
|
57
|
-
|
|
47
|
+
npm i -g $repoRoot
|
|
58
48
|
} elseif ($Source -eq "Git") {
|
|
59
|
-
|
|
60
|
-
Run-Step "git" @("-C", $srcDir, "fetch", "--all", "--tags")
|
|
61
|
-
Run-Step "git" @("-C", $srcDir, "checkout", $RepoRef)
|
|
62
|
-
Run-Step "git" @("-C", $srcDir, "pull", "--ff-only")
|
|
63
|
-
} else {
|
|
64
|
-
if (Test-Path -LiteralPath $srcDir) {
|
|
65
|
-
Remove-Item -LiteralPath $srcDir -Recurse -Force
|
|
66
|
-
}
|
|
67
|
-
Run-Step "git" @("clone", "--depth", "1", "--branch", $RepoRef, $RepoUrl, $srcDir)
|
|
68
|
-
}
|
|
69
|
-
$pkgSource = $srcDir
|
|
49
|
+
npm i -g "git+$RepoUrl#$RepoRef"
|
|
70
50
|
} else {
|
|
71
|
-
|
|
51
|
+
npm i -g @ao_zorin/zocket
|
|
72
52
|
}
|
|
73
53
|
|
|
74
|
-
$
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
$zocketExe = Join-Path $venvDir "Scripts\zocket.exe"
|
|
78
|
-
|
|
79
|
-
Run-Step $py.Cmd ($py.Prefix + @("-m", "venv", $venvDir))
|
|
80
|
-
Run-Step $venvPy @("-m", "pip", "install", "--upgrade", "pip", "setuptools", "wheel")
|
|
81
|
-
|
|
82
|
-
if ($Source -eq "PyPI") {
|
|
83
|
-
Run-Step $venvPy @("-m", "pip", "install", "--upgrade", $pkgSource)
|
|
84
|
-
} else {
|
|
85
|
-
Run-Step $venvPy @("-m", "pip", "install", "--upgrade", $pkgSource)
|
|
54
|
+
$zocketBin = (Get-Command zocket).Source
|
|
55
|
+
if (-not $zocketBin) {
|
|
56
|
+
throw "zocket binary not found after install"
|
|
86
57
|
}
|
|
87
58
|
|
|
88
59
|
Ensure-Dir $ZocketHome
|
|
89
60
|
$env:ZOCKET_HOME = $ZocketHome
|
|
90
61
|
|
|
91
|
-
|
|
92
|
-
Run-Step $zocketExe @("init")
|
|
93
|
-
}
|
|
94
|
-
Run-Step $zocketExe @("config", "set-language", $Lang)
|
|
62
|
+
& $zocketBin init | Out-Null
|
|
95
63
|
|
|
96
64
|
if ($EnableAutostart) {
|
|
97
|
-
$
|
|
98
|
-
$
|
|
99
|
-
$
|
|
100
|
-
|
|
101
|
-
$webCmd = "`"$venvPy`" -m zocket web --host 127.0.0.1 --port $WebPort"
|
|
102
|
-
$mcpSseCmd = "`"$venvPy`" -m zocket mcp --transport sse --mode $McpMode --host 127.0.0.1 --port $McpPort"
|
|
103
|
-
$mcpStreamCmd = "`"$venvPy`" -m zocket mcp --transport streamable-http --mode $McpMode --host 127.0.0.1 --port $McpStreamPort"
|
|
104
|
-
|
|
105
|
-
schtasks /Create /F /SC ONLOGON /RL LIMITED /TN $webTask /TR $webCmd | Out-Null
|
|
106
|
-
schtasks /Create /F /SC ONLOGON /RL LIMITED /TN $mcpSseTask /TR $mcpSseCmd | Out-Null
|
|
107
|
-
schtasks /Create /F /SC ONLOGON /RL LIMITED /TN $mcpStreamTask /TR $mcpStreamCmd | Out-Null
|
|
65
|
+
$taskName = "Zocket"
|
|
66
|
+
$cmd = "\"$zocketBin\" start --host 127.0.0.1 --web-port $WebPort --mcp-port $McpPort --mcp-stream-port $McpStreamPort --mode $McpMode"
|
|
67
|
+
if ($NoWeb) { $cmd = "$cmd --no-web" }
|
|
68
|
+
schtasks /Create /F /SC ONLOGON /RL LIMITED /TN $taskName /TR $cmd | Out-Null
|
|
108
69
|
}
|
|
109
70
|
|
|
110
71
|
Write-Output "zocket installed successfully."
|
|
111
|
-
Write-Output "
|
|
112
|
-
Write-Output "zocket: $zocketExe"
|
|
72
|
+
Write-Output "zocket: $zocketBin"
|
|
113
73
|
Write-Output "ZOCKET_HOME=$ZocketHome"
|
|
114
|
-
|
|
74
|
+
if ($NoWeb) {
|
|
75
|
+
Write-Output "web panel: disabled"
|
|
76
|
+
} else {
|
|
77
|
+
Write-Output "web panel: http://127.0.0.1:$WebPort"
|
|
78
|
+
}
|
|
115
79
|
Write-Output "mcp sse: http://127.0.0.1:$McpPort/sse"
|
|
116
80
|
Write-Output "mcp http: http://127.0.0.1:$McpStreamPort/mcp"
|