@ao_zorin/zocket 1.0.0 → 1.2.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.
@@ -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
- python3 scripts/ai-autodeploy.py --repo-url https://github.com/your-org/zocket.git --repo-ref main
9
+ bash scripts/install-zocket.sh --source local
10
10
  ```
11
11
 
12
- If only the file is available, the script will clone the repo and run the platform installer.
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 scripts/ai-autodeploy.py with:
20
- --lang en
21
- --web-port 18001
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
- python3 scripts/ai-autodeploy.py \
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
@@ -0,0 +1,44 @@
1
+ # Git + npm Release Guide
2
+
3
+ ## 1) Initialize git project
4
+
5
+ ```bash
6
+ git init
7
+ git add .
8
+ git commit -m "feat: zocket initial release"
9
+ git branch -M main
10
+ git remote add origin git@github.com:your-org/zocket.git
11
+ git push -u origin main
12
+ ```
13
+
14
+ ## 2) Pre-release checks
15
+
16
+ ```bash
17
+ bash scripts/release-check.sh
18
+ ```
19
+
20
+ ## 3) Publish npm package
21
+
22
+ Update metadata in `package.json`:
23
+ - `name`
24
+ - `repository.url`
25
+ - `homepage`
26
+ - `bugs.url`
27
+
28
+ Then:
29
+ ```bash
30
+ npm login
31
+ npm publish --access public
32
+ ```
33
+
34
+ ## 4) Tag release
35
+
36
+ ```bash
37
+ git tag -a v1.0.0 -m "zocket v1.0.0"
38
+ git push origin v1.0.0
39
+ ```
40
+
41
+ ## 5) Optional GitHub Release artifacts
42
+
43
+ Upload:
44
+ - npm package tarball from `npm pack`
package/docs/INSTALL.md CHANGED
@@ -1,16 +1,15 @@
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/your-org/zocket/main/scripts/install-zocket.sh | bash
12
+ curl -fsSL https://raw.githubusercontent.com/aozorin/zocket/main/scripts/install-zocket.sh | bash
14
13
  ```
15
14
 
16
15
  If you run from a local clone:
@@ -20,7 +19,7 @@ bash scripts/install-zocket.sh --source local
20
19
 
21
20
  ### Windows (PowerShell)
22
21
  ```powershell
23
- irm https://raw.githubusercontent.com/your-org/zocket/main/scripts/install-zocket.ps1 | iex
22
+ irm https://raw.githubusercontent.com/aozorin/zocket/main/scripts/install-zocket.ps1 | iex
24
23
  ```
25
24
 
26
25
  If you run from a local clone:
@@ -32,16 +31,15 @@ powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1 -Source Lo
32
31
 
33
32
  ### Debian/Ubuntu and Debian-based
34
33
  Installer auto-installs:
35
- - `python3`
36
- - `python3-venv`
37
- - `python3-pip`
34
+ - `nodejs`
35
+ - `npm`
38
36
  - `git`
39
37
  - `curl`
40
38
 
41
39
  Equivalent manual install:
42
40
  ```bash
43
41
  sudo apt-get update
44
- sudo apt-get install -y python3 python3-venv python3-pip git curl
42
+ sudo apt-get install -y nodejs npm git curl
45
43
  ```
46
44
 
47
45
  ### Other Linux distros
@@ -52,192 +50,85 @@ Installer supports:
52
50
  - `apk` (Alpine)
53
51
 
54
52
  If your distro is unsupported, install manually:
55
- - Python `>=3.10`
56
- - `pip`
57
- - `venv`
53
+ - Node.js `>=18`
54
+ - `npm`
58
55
  - `git`
59
56
 
60
57
  ## 3) macOS details
61
58
 
62
59
  Installer uses Homebrew when dependencies are missing:
63
60
  ```bash
64
- brew install python git curl
61
+ brew install node git curl
65
62
  ```
66
63
 
67
64
  ## 4) Windows details
68
65
 
69
66
  Requirements:
70
- - Python 3.10+ (recommended from `python.org` or `winget`)
67
+ - Node.js 18+ (recommended from `nodejs.org` or `winget`)
71
68
  - Git for Windows
72
69
 
73
- Optional autostart:
70
+ Autostart (enabled by default):
74
71
  ```powershell
75
- powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1 -EnableAutostart
72
+ powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1
76
73
  ```
77
74
 
78
- This creates scheduled tasks:
79
- - `ZocketWeb`
80
- - `ZocketMcpHttp`
81
-
82
- ## 5) NPM package usage
83
-
84
- This repo now includes an npm wrapper package.
75
+ This creates scheduled task:
76
+ - `Zocket`
85
77
 
86
- Global install from npm:
87
- ```bash
88
- npm i -g @zocket/cli
89
- zocket setup
78
+ Disable autostart:
79
+ ```powershell
80
+ powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1 -EnableAutostart:$false
90
81
  ```
91
82
 
92
- Or install from your git repo (example):
93
- ```bash
94
- npm i -g github:your-org/zocket
95
- ```
83
+ ## 5) NPM package usage
96
84
 
97
- First-run setup:
85
+ Global install from npm:
98
86
  ```bash
99
- zocket setup
87
+ npm i -g @ao_zorin/zocket
100
88
  ```
101
89
 
102
90
  Then use normal CLI:
103
91
  ```bash
104
92
  zocket init
105
- zocket web --host 127.0.0.1 --port 18001
106
- zocket mcp --transport sse --mode metadata --host 127.0.0.1 --port 18002
107
- zocket mcp --transport streamable-http --mode metadata --host 127.0.0.1 --port 18003
93
+ zocket start --host 127.0.0.1 --web-port 18001 --mcp-port 18002 --mcp-stream-port 18003 --mode admin
108
94
  ```
109
95
 
110
96
  ## 6) Systemd hardening on Linux (production)
111
97
 
112
- ```bash
113
- sudo env ZOCKET_HOME=/var/lib/zocket zocket harden install-linux-system \
114
- --service-user zocketd \
115
- --zocket-home /var/lib/zocket \
116
- --web-port 18001 \
117
- --mcp-host 127.0.0.1 \
118
- --mcp-port 18002 \
119
- --mcp-mode metadata
120
- ```
98
+ If you install with `--autostart system`, the installer creates and enables:
99
+ - `zocket.service` (web + SSE + streamable HTTP)
121
100
 
122
101
  Check:
123
102
  ```bash
124
- systemctl status zocket-web.service --no-pager
125
- systemctl status zocket-mcp-http.service --no-pager
126
- systemctl status zocket-mcp-http-streamable.service --no-pager
127
- ```
128
-
129
- ### Optional: systemd unit for Codex (streamable HTTP on 18003)
130
-
131
- Create `/etc/systemd/system/zocket-mcp-http-streamable.service`:
132
- ```ini
133
- [Unit]
134
- Description=Zocket MCP HTTP Streamable (system)
135
- After=network-online.target
136
- Wants=network-online.target
137
-
138
- [Service]
139
- Type=simple
140
- User=zocketd
141
- Group=zocketd
142
- Environment=ZOCKET_HOME=/var/lib/zocket
143
- ExecStart=/usr/bin/python3 -m zocket mcp --transport streamable-http --mode metadata --host 127.0.0.1 --port 18003
144
- Restart=on-failure
145
- RestartSec=2
146
- NoNewPrivileges=true
147
- PrivateTmp=true
148
- ProtectSystem=strict
149
- ProtectHome=read-only
150
- ProtectKernelTunables=true
151
- ProtectControlGroups=true
152
- LockPersonality=true
153
- MemoryDenyWriteExecute=true
154
- ReadWritePaths=/var/lib/zocket
155
-
156
- [Install]
157
- WantedBy=multi-user.target
158
- ```
159
-
160
- Enable and start:
161
- ```bash
162
- sudo systemctl daemon-reload
163
- sudo systemctl enable --now zocket-mcp-http-streamable.service
103
+ systemctl status zocket.service --no-pager
164
104
  ```
165
105
 
166
106
  ### Linux user-level autostart (no root)
167
107
  ```bash
168
- zocket autostart install --target web --web-port 18001
169
- zocket autostart install --target mcp --mcp-port 18002 --mcp-mode metadata --mcp-host 127.0.0.1
170
- zocket autostart status --target both
108
+ systemctl --user enable --now zocket.service
109
+ systemctl --user status zocket.service --no-pager
171
110
  ```
172
111
 
173
- ### macOS launchd autostart (manual)
174
- Create `~/Library/LaunchAgents/dev.zocket.web.plist`, `dev.zocket.mcp-sse.plist`,
175
- and `dev.zocket.mcp-streamable.plist`:
176
-
177
- ```xml
178
- <?xml version="1.0" encoding="UTF-8"?>
179
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
180
- <plist version="1.0">
181
- <dict>
182
- <key>Label</key><string>dev.zocket.web</string>
183
- <key>ProgramArguments</key>
184
- <array>
185
- <string>/Users/YOUR_USER/.local/share/zocket/venv/bin/python3</string>
186
- <string>-m</string><string>zocket</string>
187
- <string>web</string><string>--host</string><string>127.0.0.1</string>
188
- <string>--port</string><string>18001</string>
189
- </array>
190
- <key>EnvironmentVariables</key>
191
- <dict>
192
- <key>ZOCKET_HOME</key><string>/Users/YOUR_USER/.zocket</string>
193
- </dict>
194
- <key>RunAtLoad</key><true/>
195
- <key>KeepAlive</key><true/>
196
- </dict>
197
- </plist>
198
- ```
199
-
200
- SSE MCP (`dev.zocket.mcp-sse.plist`):
201
- ```xml
202
- <?xml version="1.0" encoding="UTF-8"?>
203
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
204
- <plist version="1.0">
205
- <dict>
206
- <key>Label</key><string>dev.zocket.mcp-sse</string>
207
- <key>ProgramArguments</key>
208
- <array>
209
- <string>/Users/YOUR_USER/.local/share/zocket/venv/bin/python3</string>
210
- <string>-m</string><string>zocket</string>
211
- <string>mcp</string><string>--transport</string><string>sse</string>
212
- <string>--mode</string><string>metadata</string>
213
- <string>--host</string><string>127.0.0.1</string>
214
- <string>--port</string><string>18002</string>
215
- </array>
216
- <key>EnvironmentVariables</key>
217
- <dict>
218
- <key>ZOCKET_HOME</key><string>/Users/YOUR_USER/.zocket</string>
219
- </dict>
220
- <key>RunAtLoad</key><true/>
221
- <key>KeepAlive</key><true/>
222
- </dict>
223
- </plist>
224
- ```
112
+ ### macOS launchd autostart (installed by script)
113
+ Installer creates and loads:
114
+ - `~/Library/LaunchAgents/dev.zocket.plist`
225
115
 
226
- Streamable HTTP MCP (`dev.zocket.mcp-streamable.plist`):
116
+ Manual example:
227
117
  ```xml
228
118
  <?xml version="1.0" encoding="UTF-8"?>
229
119
  <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
230
120
  <plist version="1.0">
231
121
  <dict>
232
- <key>Label</key><string>dev.zocket.mcp-streamable</string>
122
+ <key>Label</key><string>dev.zocket</string>
233
123
  <key>ProgramArguments</key>
234
124
  <array>
235
- <string>/Users/YOUR_USER/.local/share/zocket/venv/bin/python3</string>
236
- <string>-m</string><string>zocket</string>
237
- <string>mcp</string><string>--transport</string><string>streamable-http</string>
238
- <string>--mode</string><string>metadata</string>
125
+ <string>/usr/local/bin/zocket</string>
126
+ <string>start</string>
239
127
  <string>--host</string><string>127.0.0.1</string>
240
- <string>--port</string><string>18003</string>
128
+ <string>--web-port</string><string>18001</string>
129
+ <string>--mcp-port</string><string>18002</string>
130
+ <string>--mcp-stream-port</string><string>18003</string>
131
+ <string>--mode</string><string>admin</string>
241
132
  </array>
242
133
  <key>EnvironmentVariables</key>
243
134
  <dict>
@@ -249,11 +140,9 @@ Streamable HTTP MCP (`dev.zocket.mcp-streamable.plist`):
249
140
  </plist>
250
141
  ```
251
142
 
252
- Load services:
143
+ Load service:
253
144
  ```bash
254
- launchctl load ~/Library/LaunchAgents/dev.zocket.web.plist
255
- launchctl load ~/Library/LaunchAgents/dev.zocket.mcp-sse.plist
256
- launchctl load ~/Library/LaunchAgents/dev.zocket.mcp-streamable.plist
145
+ launchctl load ~/Library/LaunchAgents/dev.zocket.plist
257
146
  ```
258
147
 
259
148
  ### Windows autostart (Task Scheduler)
@@ -263,13 +152,9 @@ powershell -ExecutionPolicy Bypass -File .\scripts\install-zocket.ps1 -EnableAut
263
152
  ```
264
153
 
265
154
  Or create manually:
266
- - task `ZocketWeb` on logon
267
- - task `ZocketMcpSse` on logon
268
- - task `ZocketMcpStreamable` on logon
269
- - actions:
270
- - `python -m zocket web --host 127.0.0.1 --port 18001`
271
- - `python -m zocket mcp --transport sse --mode metadata --host 127.0.0.1 --port 18002`
272
- - `python -m zocket mcp --transport streamable-http --mode metadata --host 127.0.0.1 --port 18003`
155
+ - task `Zocket` on logon
156
+ - action:
157
+ - `zocket start --host 127.0.0.1 --web-port 18001 --mcp-port 18002 --mcp-stream-port 18003 --mode admin`
273
158
 
274
159
  ## 7) First web open
275
160
 
@@ -284,5 +169,5 @@ Open `http://127.0.0.1:18001` and choose one:
284
169
  curl -I http://127.0.0.1:18001/login
285
170
  curl -I http://127.0.0.1:18002/sse
286
171
  curl -I http://127.0.0.1:18003/mcp
287
- zocket mcp --transport stdio --mode metadata
172
+ zocket start --host 127.0.0.1 --web-port 18001 --mcp-port 18002 --mcp-stream-port 18003 --mode admin
288
173
  ```
@@ -0,0 +1,29 @@
1
+ # External References Used
2
+
3
+ Official docs used while preparing client/install instructions:
4
+
5
+ - OpenAI Codex CLI MCP docs:
6
+ - https://platform.openai.com/docs/codex/mcp
7
+ - https://developers.openai.com/codex/cli
8
+ - Claude Code MCP docs:
9
+ - https://docs.anthropic.com/en/docs/claude-code/mcp
10
+ - Claude Desktop MCP setup/help:
11
+ - https://support.claude.com/en/articles/12304248-setting-up-remote-mcp-servers-in-claude-desktop
12
+ - OpenCode docs:
13
+ - https://opencode.ai/docs/
14
+ - https://opencode.ai/docs/config
15
+ - https://opencode.ai/docs/providers
16
+ - https://opencode.ai/docs/mcp-servers
17
+ - Qwen Code docs:
18
+ - https://qwenlm.github.io/qwen-code-docs/getting-started/
19
+ - https://qwenlm.github.io/qwen-code-docs/advanced/model-providers/
20
+ - https://qwenlm.github.io/qwen-code-docs/advanced/mcp/
21
+ - Windsurf MCP docs:
22
+ - https://docs.windsurf.com/windsurf/cascade/mcp
23
+ - Antigravity MCP setup docs:
24
+ - https://docs.cloud.google.com/vertex-ai/generative-ai/docs/agent-engine/mcp/use-with-antigravity
25
+ - https://firebase.google.com/docs/studio/set-up-mcp-server
26
+ - Ollama docs:
27
+ - https://docs.ollama.com/
28
+ - Hugging Face local/openai-compatible docs:
29
+ - https://huggingface.co/docs/text-generation-inference/main/en/messages_api
package/package.json CHANGED
@@ -1,52 +1,64 @@
1
1
  {
2
2
  "name": "@ao_zorin/zocket",
3
- "version": "1.0.0",
4
- "description": "Cross-platform npm launcher for Zocket (local MCP + web vault)",
5
- "license": "MIT",
6
- "private": false,
7
- "type": "commonjs",
3
+ "version": "1.2.0",
4
+ "description": "Local encrypted vault + web panel + MCP server for AI agent workflows",
5
+ "type": "module",
8
6
  "bin": {
9
- "zocket": "bin/zocket.cjs",
10
- "zocket-setup": "bin/zocket-setup.cjs"
7
+ "zocket": "dist/zocket.js"
8
+ },
9
+ "scripts": {
10
+ "build": "tsup",
11
+ "dev": "tsup --watch",
12
+ "test": "vitest run",
13
+ "test:watch": "vitest",
14
+ "typecheck": "tsc --noEmit",
15
+ "prepublishOnly": "npm run build"
16
+ },
17
+ "dependencies": {
18
+ "@anthropic-ai/sdk": "^0.78.0",
19
+ "@hono/node-server": "^1.13.0",
20
+ "@modelcontextprotocol/sdk": "^1.0.0",
21
+ "commander": "^12.0.0",
22
+ "hono": "^4.0.0",
23
+ "proper-lockfile": "^4.1.2",
24
+ "zod": "^3.22.0"
25
+ },
26
+ "peerDependencies": {
27
+ "keytar": "^7.0.0"
28
+ },
29
+ "peerDependenciesMeta": {
30
+ "keytar": {
31
+ "optional": true
32
+ }
33
+ },
34
+ "devDependencies": {
35
+ "@anthropic-ai/tokenizer": "^0.0.4",
36
+ "@types/node": "^20.0.0",
37
+ "@types/proper-lockfile": "^4.1.4",
38
+ "js-tiktoken": "^1.0.21",
39
+ "tsup": "^8.0.0",
40
+ "typescript": "^5.0.0",
41
+ "vitest": "^2.0.0"
42
+ },
43
+ "engines": {
44
+ "node": ">=18.0.0"
11
45
  },
12
46
  "files": [
13
- "bin/",
47
+ "dist",
48
+ "README.md",
49
+ "LICENSE",
14
50
  "docs/AI_AUTODEPLOY.md",
15
51
  "docs/CLIENTS_MCP.md",
52
+ "docs/GIT_NPM_RELEASE.md",
16
53
  "docs/INSTALL.md",
17
54
  "docs/LOCAL_MODELS.md",
18
- "scripts/ai-autodeploy.py",
55
+ "docs/SOURCES.md",
19
56
  "scripts/install-zocket.sh",
20
- "scripts/install-zocket.ps1",
21
- "zocket/*.py",
22
- "zocket/templates/*.html",
23
- "pyproject.toml",
24
- "README.md",
25
- "LICENSE"
26
- ],
27
- "engines": {
28
- "node": ">=18"
29
- },
30
- "scripts": {
31
- "test:python": "PYTHONPATH=. pytest -q",
32
- "smoke:npm": "node ./bin/zocket.cjs --help"
33
- },
34
- "keywords": [
35
- "mcp",
36
- "model-context-protocol",
37
- "secrets",
38
- "vault",
39
- "cli",
40
- "agents",
41
- "codex",
42
- "claude"
57
+ "scripts/install-zocket.ps1"
43
58
  ],
59
+ "license": "MIT",
44
60
  "repository": {
45
61
  "type": "git",
46
- "url": "https://github.com/aozorin/zocket.git"
47
- },
48
- "homepage": "https://github.com/aozorin/zocket#readme",
49
- "bugs": {
50
- "url": "https://github.com/aozorin/zocket/issues"
62
+ "url": "git+https://github.com/aozorin/zocket.git"
51
63
  }
52
64
  }
@@ -1,9 +1,8 @@
1
1
  Param(
2
- [ValidateSet("Auto", "Local", "Git", "PyPI")]
2
+ [ValidateSet("Auto", "Local", "Git", "Npm")]
3
3
  [string]$Source = "Auto",
4
- [string]$RepoUrl = "https://github.com/your-org/zocket.git",
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,105 +10,64 @@ Param(
11
10
  [int]$McpPort = 18002,
12
11
  [int]$McpStreamPort = 18003,
13
12
  [ValidateSet("metadata", "admin")]
14
- [string]$McpMode = "metadata",
15
- [switch]$EnableAutostart
13
+ [string]$McpMode = "admin",
14
+ [bool]$EnableAutostart = $true
16
15
  )
17
16
 
18
17
  $ErrorActionPreference = "Stop"
19
18
 
20
- function Resolve-Python {
21
- if (Get-Command py -ErrorAction SilentlyContinue) {
22
- return @{Cmd = "py"; Prefix = @("-3")}
23
- }
24
- if (Get-Command python -ErrorAction SilentlyContinue) {
25
- return @{Cmd = "python"; Prefix = @()}
19
+ function Ensure-Dir([string]$Path) {
20
+ if (-not (Test-Path -LiteralPath $Path)) {
21
+ New-Item -ItemType Directory -Path $Path | Out-Null
26
22
  }
27
- throw "Python 3.10+ not found. Install Python and rerun."
28
23
  }
29
24
 
30
- function Run-Step([string]$Cmd, [string[]]$Args) {
31
- & $Cmd @Args
32
- if ($LASTEXITCODE -ne 0) {
33
- throw "Command failed: $Cmd $($Args -join ' ')"
25
+ function Ensure-Node {
26
+ if (-not (Get-Command node -ErrorAction SilentlyContinue)) {
27
+ throw "Node.js not found. Install Node.js 18+ and rerun."
34
28
  }
35
- }
36
-
37
- function Ensure-Dir([string]$Path) {
38
- if (-not (Test-Path -LiteralPath $Path)) {
39
- New-Item -ItemType Directory -Path $Path | Out-Null
29
+ if (-not (Get-Command npm -ErrorAction SilentlyContinue)) {
30
+ throw "npm not found. Install Node.js 18+ (includes npm) and rerun."
40
31
  }
41
32
  }
42
33
 
34
+ Ensure-Node
35
+
43
36
  $repoRoot = Split-Path -Parent $PSScriptRoot
44
37
  if ($Source -eq "Auto") {
45
- if (Test-Path -LiteralPath (Join-Path $repoRoot "pyproject.toml")) {
38
+ if (Test-Path -LiteralPath (Join-Path $repoRoot "package.json")) {
46
39
  $Source = "Local"
47
40
  } else {
48
- $Source = "Git"
41
+ $Source = "Npm"
49
42
  }
50
43
  }
51
44
 
52
- Ensure-Dir $InstallRoot
53
- $srcDir = Join-Path $InstallRoot "src"
54
-
55
- $pkgSource = $null
56
45
  if ($Source -eq "Local") {
57
- $pkgSource = $repoRoot
46
+ npm i -g $repoRoot
58
47
  } elseif ($Source -eq "Git") {
59
- if (Test-Path -LiteralPath (Join-Path $srcDir ".git")) {
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
48
+ npm i -g "git+$RepoUrl#$RepoRef"
70
49
  } else {
71
- $pkgSource = "zocket"
50
+ npm i -g @ao_zorin/zocket
72
51
  }
73
52
 
74
- $py = Resolve-Python
75
- $venvDir = Join-Path $InstallRoot "venv"
76
- $venvPy = Join-Path $venvDir "Scripts\python.exe"
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)
53
+ $zocketBin = (Get-Command zocket).Source
54
+ if (-not $zocketBin) {
55
+ throw "zocket binary not found after install"
86
56
  }
87
57
 
88
58
  Ensure-Dir $ZocketHome
89
59
  $env:ZOCKET_HOME = $ZocketHome
90
60
 
91
- if (-not (Test-Path -LiteralPath (Join-Path $ZocketHome "vault.enc"))) {
92
- Run-Step $zocketExe @("init")
93
- }
94
- Run-Step $zocketExe @("config", "set-language", $Lang)
61
+ & $zocketBin init | Out-Null
95
62
 
96
63
  if ($EnableAutostart) {
97
- $webTask = "ZocketWeb"
98
- $mcpSseTask = "ZocketMcpSse"
99
- $mcpStreamTask = "ZocketMcpStreamable"
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
64
+ $taskName = "Zocket"
65
+ $cmd = "\"$zocketBin\" start --host 127.0.0.1 --web-port $WebPort --mcp-port $McpPort --mcp-stream-port $McpStreamPort --mode $McpMode"
66
+ schtasks /Create /F /SC ONLOGON /RL LIMITED /TN $taskName /TR $cmd | Out-Null
108
67
  }
109
68
 
110
69
  Write-Output "zocket installed successfully."
111
- Write-Output "venv: $venvDir"
112
- Write-Output "zocket: $zocketExe"
70
+ Write-Output "zocket: $zocketBin"
113
71
  Write-Output "ZOCKET_HOME=$ZocketHome"
114
72
  Write-Output "web panel: http://127.0.0.1:$WebPort"
115
73
  Write-Output "mcp sse: http://127.0.0.1:$McpPort/sse"