@pixelbyte-software/pixcode 1.31.12 → 1.32.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/dist/assets/index-Byb8Wnts.css +32 -0
- package/dist/assets/{index-Bb2tV2Uy.js → index-DcAn_NI0.js} +169 -157
- package/dist/index.html +2 -2
- package/dist-server/server/index.js +62 -4
- package/dist-server/server/index.js.map +1 -1
- package/dist-server/server/modules/providers/list/opencode/opencode-auth.provider.js +113 -0
- package/dist-server/server/modules/providers/list/opencode/opencode-auth.provider.js.map +1 -0
- package/dist-server/server/modules/providers/list/opencode/opencode-mcp.provider.js +98 -0
- package/dist-server/server/modules/providers/list/opencode/opencode-mcp.provider.js.map +1 -0
- package/dist-server/server/modules/providers/list/opencode/opencode-sessions.provider.js +138 -0
- package/dist-server/server/modules/providers/list/opencode/opencode-sessions.provider.js.map +1 -0
- package/dist-server/server/modules/providers/list/opencode/opencode.provider.js +27 -0
- package/dist-server/server/modules/providers/list/opencode/opencode.provider.js.map +1 -0
- package/dist-server/server/modules/providers/provider.registry.js +2 -0
- package/dist-server/server/modules/providers/provider.registry.js.map +1 -1
- package/dist-server/server/modules/providers/provider.routes.js +4 -1
- package/dist-server/server/modules/providers/provider.routes.js.map +1 -1
- package/dist-server/server/modules/providers/shared/provider-configs.js +24 -0
- package/dist-server/server/modules/providers/shared/provider-configs.js.map +1 -1
- package/dist-server/server/routes/auth.js +5 -1
- package/dist-server/server/routes/auth.js.map +1 -1
- package/dist-server/server/routes/network.js +14 -21
- package/dist-server/server/routes/network.js.map +1 -1
- package/dist-server/server/services/external-access.js +18 -78
- package/dist-server/server/services/external-access.js.map +1 -1
- package/dist-server/server/services/install-jobs.js +2 -0
- package/dist-server/server/services/install-jobs.js.map +1 -1
- package/dist-server/server/services/provider-credentials.js +4 -0
- package/dist-server/server/services/provider-credentials.js.map +1 -1
- package/dist-server/server/services/telegram/bot.js +6 -6
- package/dist-server/server/services/telegram/bot.js.map +1 -1
- package/dist-server/server/services/telegram/telegram-http-client.js +130 -0
- package/dist-server/server/services/telegram/telegram-http-client.js.map +1 -0
- package/dist-server/shared/modelConstants.js +20 -0
- package/dist-server/shared/modelConstants.js.map +1 -1
- package/package.json +178 -178
- package/server/index.js +57 -4
- package/server/modules/providers/list/opencode/opencode-auth.provider.ts +130 -0
- package/server/modules/providers/list/opencode/opencode-mcp.provider.ts +126 -0
- package/server/modules/providers/list/opencode/opencode-sessions.provider.ts +155 -0
- package/server/modules/providers/list/opencode/opencode.provider.ts +29 -0
- package/server/modules/providers/provider.registry.ts +2 -0
- package/server/modules/providers/provider.routes.ts +4 -0
- package/server/modules/providers/shared/provider-configs.ts +24 -0
- package/server/routes/auth.js +5 -1
- package/server/routes/network.js +13 -21
- package/server/services/external-access.js +171 -240
- package/server/services/install-jobs.js +2 -0
- package/server/services/provider-credentials.js +8 -4
- package/server/services/telegram/bot.js +6 -7
- package/server/services/telegram/telegram-http-client.js +130 -0
- package/server/shared/types.ts +1 -1
- package/shared/modelConstants.js +22 -0
- package/dist/assets/index-CLxSMbv1.css +0 -32
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"modelConstants.js","sourceRoot":"","sources":["../../shared/modelConstants.js"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;;;;;GAMG;AACH,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,qDAAqD;IACrD,OAAO,EAAE;QACP,EAAE,KAAK,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAQ,EAAE;QACpC,EAAE,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE;QAChC,EAAE,KAAK,EAAE,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE;QAClC,8EAA8E;QAC9E,mEAAmE;QACnE,EAAE,KAAK,EAAE,iBAAiB,EAAE,KAAK,EAAE,UAAU,EAAE;QAC/C,EAAE,KAAK,EAAE,UAAU,EAAE,KAAK,EAAE,WAAW,EAAE;QACzC,EAAE,K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,KAAK,EAAE,gBAAgB,EAAE,KAAK,EAAE,gBAAgB,EAAE;QACpD,EAAE,KAAK,EAAE,uBAAuB,EAAE,KAAK,EAAE,uBAAuB,EAAE;QAClE,EAAE,KAAK,EAAE,kBAAkB,EAAE,KAAK,EAAE,kBAAkB,EAAE;QACxD,EAAE,KAAK,EAAE,oBAAoB,EAAE,KAAK,EAAE,6BAA6B,EAAE;QACrE;YACE,KAAK,EAAE,+BAA+B;YACtC,KAAK,EAAE,2BAA2B;SACnC;KACF;IAED,OAAO,EAAE,wBAAwB;CAClC,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,178 +1,178 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "@pixelbyte-software/pixcode",
|
|
3
|
-
"version": "1.
|
|
4
|
-
"description": "Pixcode — a desktop and mobile web UI for Claude Code, Cursor CLI, Codex,
|
|
5
|
-
"type": "module",
|
|
6
|
-
"main": "dist-server/server/index.js",
|
|
7
|
-
"bin": {
|
|
8
|
-
"pixcode": "dist-server/server/cli.js"
|
|
9
|
-
},
|
|
10
|
-
"files": [
|
|
11
|
-
"server/",
|
|
12
|
-
"shared/",
|
|
13
|
-
"dist/",
|
|
14
|
-
"dist-server/",
|
|
15
|
-
"scripts/",
|
|
16
|
-
"README.md"
|
|
17
|
-
],
|
|
18
|
-
"homepage": "https://github.com/alicomert/pixcode",
|
|
19
|
-
"repository": {
|
|
20
|
-
"type": "git",
|
|
21
|
-
"url": "git+https://github.com/alicomert/pixcode.git"
|
|
22
|
-
},
|
|
23
|
-
"bugs": {
|
|
24
|
-
"url": "https://github.com/alicomert/pixcode/issues"
|
|
25
|
-
},
|
|
26
|
-
"publishConfig": {
|
|
27
|
-
"access": "public"
|
|
28
|
-
},
|
|
29
|
-
"scripts": {
|
|
30
|
-
"dev": "npm run server:dev",
|
|
31
|
-
"server": "node dist-server/server/cli.js start",
|
|
32
|
-
"server:dev": "node server/cli.js daemon install --mode system --port 3001 --frontend-port 5173",
|
|
33
|
-
"server:dev-watch": "node server/cli.js daemon restart --mode system --port 3001 --frontend-port 5173",
|
|
34
|
-
"client": "vite",
|
|
35
|
-
"build": "npm run build:client && npm run build:server",
|
|
36
|
-
"build:client": "vite build",
|
|
37
|
-
"prebuild:server": "node -e \"require('node:fs').rmSync('dist-server', { recursive: true, force: true })\"",
|
|
38
|
-
"build:server": "tsc -p server/tsconfig.json && tsc-alias -p server/tsconfig.json",
|
|
39
|
-
"preview": "vite preview",
|
|
40
|
-
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p server/tsconfig.json",
|
|
41
|
-
"lint": "eslint src/ server/",
|
|
42
|
-
"lint:fix": "eslint src/ server/ --fix",
|
|
43
|
-
"start": "npm run build && npm run server",
|
|
44
|
-
"release": "./release.sh",
|
|
45
|
-
"prepublishOnly": "npm run build",
|
|
46
|
-
"postinstall": "node scripts/fix-node-pty.js",
|
|
47
|
-
"prepare": "husky",
|
|
48
|
-
"update:platform": "./update-platform.sh"
|
|
49
|
-
},
|
|
50
|
-
"keywords": [
|
|
51
|
-
"claude code",
|
|
52
|
-
"claude-code",
|
|
53
|
-
"pixcode",
|
|
54
|
-
"codex",
|
|
55
|
-
"gemini",
|
|
56
|
-
"gemini-cli",
|
|
57
|
-
"cursor",
|
|
58
|
-
"cursor-cli",
|
|
59
|
-
"
|
|
60
|
-
"
|
|
61
|
-
"
|
|
62
|
-
"
|
|
63
|
-
"
|
|
64
|
-
"
|
|
65
|
-
"
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
"@
|
|
73
|
-
"@
|
|
74
|
-
"@
|
|
75
|
-
"@
|
|
76
|
-
"
|
|
77
|
-
"
|
|
78
|
-
"
|
|
79
|
-
"
|
|
80
|
-
"
|
|
81
|
-
"
|
|
82
|
-
"
|
|
83
|
-
"
|
|
84
|
-
"
|
|
85
|
-
"
|
|
86
|
-
"
|
|
87
|
-
"
|
|
88
|
-
"
|
|
89
|
-
"
|
|
90
|
-
"
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
"
|
|
94
|
-
"
|
|
95
|
-
"
|
|
96
|
-
"
|
|
97
|
-
"
|
|
98
|
-
"
|
|
99
|
-
"
|
|
100
|
-
"
|
|
101
|
-
"
|
|
102
|
-
"
|
|
103
|
-
"
|
|
104
|
-
"
|
|
105
|
-
"
|
|
106
|
-
"
|
|
107
|
-
"
|
|
108
|
-
"
|
|
109
|
-
"
|
|
110
|
-
"
|
|
111
|
-
"node
|
|
112
|
-
"
|
|
113
|
-
"
|
|
114
|
-
"
|
|
115
|
-
"react": "^
|
|
116
|
-
"react
|
|
117
|
-
"
|
|
118
|
-
"
|
|
119
|
-
"
|
|
120
|
-
"
|
|
121
|
-
"
|
|
122
|
-
"
|
|
123
|
-
"
|
|
124
|
-
"
|
|
125
|
-
"
|
|
126
|
-
"
|
|
127
|
-
"
|
|
128
|
-
"
|
|
129
|
-
"
|
|
130
|
-
"
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
"
|
|
134
|
-
"
|
|
135
|
-
"
|
|
136
|
-
"
|
|
137
|
-
"
|
|
138
|
-
"
|
|
139
|
-
"
|
|
140
|
-
"
|
|
141
|
-
"
|
|
142
|
-
"
|
|
143
|
-
"
|
|
144
|
-
"
|
|
145
|
-
"
|
|
146
|
-
"
|
|
147
|
-
"
|
|
148
|
-
"
|
|
149
|
-
"
|
|
150
|
-
"
|
|
151
|
-
"
|
|
152
|
-
"
|
|
153
|
-
"
|
|
154
|
-
"
|
|
155
|
-
"
|
|
156
|
-
"
|
|
157
|
-
"
|
|
158
|
-
"
|
|
159
|
-
"
|
|
160
|
-
"
|
|
161
|
-
"
|
|
162
|
-
"
|
|
163
|
-
"
|
|
164
|
-
"tailwindcss": "^3.4.0",
|
|
165
|
-
"tsc-alias": "^1.8.16",
|
|
166
|
-
"tsx": "^4.21.0",
|
|
167
|
-
"typescript": "^5.9.3",
|
|
168
|
-
"typescript-eslint": "^8.56.1",
|
|
169
|
-
"vite": "^7.0.4"
|
|
170
|
-
},
|
|
171
|
-
"lint-staged": {
|
|
172
|
-
"src/**/*.{ts,tsx,js,jsx}": "eslint",
|
|
173
|
-
"server/**/*.{js,ts}": "eslint"
|
|
174
|
-
},
|
|
175
|
-
"overrides": {
|
|
176
|
-
"undici": ">=6.23.1"
|
|
177
|
-
}
|
|
178
|
-
}
|
|
1
|
+
{
|
|
2
|
+
"name": "@pixelbyte-software/pixcode",
|
|
3
|
+
"version": "1.32.0",
|
|
4
|
+
"description": "Pixcode — a desktop and mobile web UI for Claude Code, Cursor CLI, Codex, Gemini CLI, Qwen Code, and OpenCode.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "dist-server/server/index.js",
|
|
7
|
+
"bin": {
|
|
8
|
+
"pixcode": "dist-server/server/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"server/",
|
|
12
|
+
"shared/",
|
|
13
|
+
"dist/",
|
|
14
|
+
"dist-server/",
|
|
15
|
+
"scripts/",
|
|
16
|
+
"README.md"
|
|
17
|
+
],
|
|
18
|
+
"homepage": "https://github.com/alicomert/pixcode",
|
|
19
|
+
"repository": {
|
|
20
|
+
"type": "git",
|
|
21
|
+
"url": "git+https://github.com/alicomert/pixcode.git"
|
|
22
|
+
},
|
|
23
|
+
"bugs": {
|
|
24
|
+
"url": "https://github.com/alicomert/pixcode/issues"
|
|
25
|
+
},
|
|
26
|
+
"publishConfig": {
|
|
27
|
+
"access": "public"
|
|
28
|
+
},
|
|
29
|
+
"scripts": {
|
|
30
|
+
"dev": "npm run server:dev",
|
|
31
|
+
"server": "node dist-server/server/cli.js start",
|
|
32
|
+
"server:dev": "node server/cli.js daemon install --mode system --port 3001 --frontend-port 5173",
|
|
33
|
+
"server:dev-watch": "node server/cli.js daemon restart --mode system --port 3001 --frontend-port 5173",
|
|
34
|
+
"client": "vite",
|
|
35
|
+
"build": "npm run build:client && npm run build:server",
|
|
36
|
+
"build:client": "vite build",
|
|
37
|
+
"prebuild:server": "node -e \"require('node:fs').rmSync('dist-server', { recursive: true, force: true })\"",
|
|
38
|
+
"build:server": "tsc -p server/tsconfig.json && tsc-alias -p server/tsconfig.json",
|
|
39
|
+
"preview": "vite preview",
|
|
40
|
+
"typecheck": "tsc --noEmit -p tsconfig.json && tsc --noEmit -p server/tsconfig.json",
|
|
41
|
+
"lint": "eslint src/ server/",
|
|
42
|
+
"lint:fix": "eslint src/ server/ --fix",
|
|
43
|
+
"start": "npm run build && npm run server",
|
|
44
|
+
"release": "./release.sh",
|
|
45
|
+
"prepublishOnly": "npm run build",
|
|
46
|
+
"postinstall": "node scripts/fix-node-pty.js",
|
|
47
|
+
"prepare": "husky",
|
|
48
|
+
"update:platform": "./update-platform.sh"
|
|
49
|
+
},
|
|
50
|
+
"keywords": [
|
|
51
|
+
"claude code",
|
|
52
|
+
"claude-code",
|
|
53
|
+
"pixcode",
|
|
54
|
+
"codex",
|
|
55
|
+
"gemini",
|
|
56
|
+
"gemini-cli",
|
|
57
|
+
"cursor",
|
|
58
|
+
"cursor-cli",
|
|
59
|
+
"opencode",
|
|
60
|
+
"opencode-cli",
|
|
61
|
+
"anthropic",
|
|
62
|
+
"openai",
|
|
63
|
+
"google",
|
|
64
|
+
"coding-agent",
|
|
65
|
+
"web-ui",
|
|
66
|
+
"ui",
|
|
67
|
+
"mobile IDE"
|
|
68
|
+
],
|
|
69
|
+
"author": "Pixcode Contributors",
|
|
70
|
+
"license": "AGPL-3.0-or-later",
|
|
71
|
+
"dependencies": {
|
|
72
|
+
"@anthropic-ai/claude-agent-sdk": "^0.2.116",
|
|
73
|
+
"@iarna/toml": "^2.2.5",
|
|
74
|
+
"@octokit/rest": "^22.0.0",
|
|
75
|
+
"@openai/codex-sdk": "^0.101.0",
|
|
76
|
+
"bcryptjs": "^3.0.3",
|
|
77
|
+
"better-sqlite3": "^12.6.2",
|
|
78
|
+
"chokidar": "^4.0.3",
|
|
79
|
+
"cors": "^2.8.5",
|
|
80
|
+
"cross-spawn": "^7.0.3",
|
|
81
|
+
"express": "^4.18.2",
|
|
82
|
+
"gray-matter": "^4.0.3",
|
|
83
|
+
"jsonwebtoken": "^9.0.2",
|
|
84
|
+
"mime-types": "^3.0.1",
|
|
85
|
+
"multer": "^2.0.1",
|
|
86
|
+
"node-fetch": "^2.7.0",
|
|
87
|
+
"node-pty": "^1.2.0-beta.12",
|
|
88
|
+
"tar": "^7.5.13",
|
|
89
|
+
"web-push": "^3.6.7",
|
|
90
|
+
"ws": "^8.14.2"
|
|
91
|
+
},
|
|
92
|
+
"devDependencies": {
|
|
93
|
+
"@codemirror/lang-css": "^6.3.1",
|
|
94
|
+
"@codemirror/lang-html": "^6.4.9",
|
|
95
|
+
"@codemirror/lang-javascript": "^6.2.4",
|
|
96
|
+
"@codemirror/lang-json": "^6.0.1",
|
|
97
|
+
"@codemirror/lang-markdown": "^6.3.3",
|
|
98
|
+
"@codemirror/lang-python": "^6.2.1",
|
|
99
|
+
"@codemirror/merge": "^6.11.1",
|
|
100
|
+
"@codemirror/theme-one-dark": "^6.1.2",
|
|
101
|
+
"@commitlint/cli": "^20.5.0",
|
|
102
|
+
"@commitlint/config-conventional": "^20.5.0",
|
|
103
|
+
"@eslint/js": "^9.39.3",
|
|
104
|
+
"@heroicons/react": "^2.2.0",
|
|
105
|
+
"@release-it/conventional-changelog": "^10.0.5",
|
|
106
|
+
"@replit/codemirror-minimap": "^0.5.2",
|
|
107
|
+
"@tailwindcss/typography": "^0.5.16",
|
|
108
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
109
|
+
"@types/cross-spawn": "^6.0.6",
|
|
110
|
+
"@types/express": "^5.0.6",
|
|
111
|
+
"@types/node": "^22.19.7",
|
|
112
|
+
"@types/qrcode": "^1.5.6",
|
|
113
|
+
"@types/react": "^18.2.43",
|
|
114
|
+
"@types/react-dom": "^18.2.17",
|
|
115
|
+
"@uiw/react-codemirror": "^4.23.13",
|
|
116
|
+
"@vitejs/plugin-react": "^4.6.0",
|
|
117
|
+
"@xterm/addon-clipboard": "^0.1.0",
|
|
118
|
+
"@xterm/addon-fit": "^0.10.0",
|
|
119
|
+
"@xterm/addon-web-links": "^0.11.0",
|
|
120
|
+
"@xterm/addon-webgl": "^0.18.0",
|
|
121
|
+
"@xterm/xterm": "^5.5.0",
|
|
122
|
+
"auto-changelog": "^2.5.0",
|
|
123
|
+
"autoprefixer": "^10.4.16",
|
|
124
|
+
"class-variance-authority": "^0.7.1",
|
|
125
|
+
"clsx": "^2.1.1",
|
|
126
|
+
"concurrently": "^8.2.2",
|
|
127
|
+
"eslint": "^9.39.3",
|
|
128
|
+
"eslint-import-resolver-typescript": "^4.4.4",
|
|
129
|
+
"eslint-plugin-boundaries": "^6.0.2",
|
|
130
|
+
"eslint-plugin-import-x": "^4.16.1",
|
|
131
|
+
"eslint-plugin-react": "^7.37.5",
|
|
132
|
+
"eslint-plugin-react-hooks": "^7.0.1",
|
|
133
|
+
"eslint-plugin-react-refresh": "^0.5.2",
|
|
134
|
+
"eslint-plugin-tailwindcss": "^3.18.2",
|
|
135
|
+
"eslint-plugin-unused-imports": "^4.4.1",
|
|
136
|
+
"fuse.js": "^7.0.0",
|
|
137
|
+
"globals": "^17.4.0",
|
|
138
|
+
"gsap": "^3.12.5",
|
|
139
|
+
"husky": "^9.1.7",
|
|
140
|
+
"i18next": "^25.7.4",
|
|
141
|
+
"i18next-browser-languagedetector": "^8.2.0",
|
|
142
|
+
"jszip": "^3.10.1",
|
|
143
|
+
"katex": "^0.16.25",
|
|
144
|
+
"lint-staged": "^16.3.2",
|
|
145
|
+
"lucide-react": "^0.515.0",
|
|
146
|
+
"node-gyp": "^12.0.0",
|
|
147
|
+
"postcss": "^8.4.32",
|
|
148
|
+
"qrcode": "^1.5.4",
|
|
149
|
+
"react": "^18.2.0",
|
|
150
|
+
"react-dom": "^18.2.0",
|
|
151
|
+
"react-dropzone": "^14.2.3",
|
|
152
|
+
"react-error-boundary": "^4.1.2",
|
|
153
|
+
"react-i18next": "^16.5.3",
|
|
154
|
+
"react-markdown": "^10.1.0",
|
|
155
|
+
"react-router-dom": "^6.8.1",
|
|
156
|
+
"react-syntax-highlighter": "^16.1.1",
|
|
157
|
+
"rehype-katex": "^7.0.1",
|
|
158
|
+
"rehype-raw": "^7.0.0",
|
|
159
|
+
"release-it": "^19.0.5",
|
|
160
|
+
"remark-gfm": "^4.0.0",
|
|
161
|
+
"remark-math": "^6.0.0",
|
|
162
|
+
"sharp": "^0.34.2",
|
|
163
|
+
"tailwind-merge": "^3.3.1",
|
|
164
|
+
"tailwindcss": "^3.4.0",
|
|
165
|
+
"tsc-alias": "^1.8.16",
|
|
166
|
+
"tsx": "^4.21.0",
|
|
167
|
+
"typescript": "^5.9.3",
|
|
168
|
+
"typescript-eslint": "^8.56.1",
|
|
169
|
+
"vite": "^7.0.4"
|
|
170
|
+
},
|
|
171
|
+
"lint-staged": {
|
|
172
|
+
"src/**/*.{ts,tsx,js,jsx}": "eslint",
|
|
173
|
+
"server/**/*.{js,ts}": "eslint"
|
|
174
|
+
},
|
|
175
|
+
"overrides": {
|
|
176
|
+
"undici": ">=6.23.1"
|
|
177
|
+
}
|
|
178
|
+
}
|
package/server/index.js
CHANGED
|
@@ -90,7 +90,7 @@ import { IS_PLATFORM } from './constants/config.js';
|
|
|
90
90
|
import { getConnectableHost } from '../shared/networkHosts.js';
|
|
91
91
|
import { buildDaemonCliCommand, handleDaemonCommand } from './daemon-manager.js';
|
|
92
92
|
|
|
93
|
-
const VALID_PROVIDERS = ['claude', 'codex', 'cursor', 'gemini', 'qwen'];
|
|
93
|
+
const VALID_PROVIDERS = ['claude', 'codex', 'cursor', 'gemini', 'qwen', 'opencode'];
|
|
94
94
|
|
|
95
95
|
// File system watchers for provider project/session folders
|
|
96
96
|
const PROVIDER_WATCH_PATHS = [
|
|
@@ -600,16 +600,56 @@ app.post('/api/system/update', authenticateToken, async (req, res) => {
|
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
|
|
603
|
+
// Short-circuit for "already on latest" in the npm-global path so
|
|
604
|
+
// users don't accidentally crash their own daemon by clicking Update
|
|
605
|
+
// while already up to date. The runtime-dir branch above already has
|
|
606
|
+
// this guard (line ~504); replicate it for npm mode. Git mode skips
|
|
607
|
+
// this since `git pull` is harmless when already up to date.
|
|
608
|
+
if (!IS_PLATFORM && installMode === 'npm') {
|
|
609
|
+
try {
|
|
610
|
+
send('log', { stream: 'meta', chunk: 'Querying registry for latest version…\n' });
|
|
611
|
+
const registryRes = await fetch('https://registry.npmjs.org/@pixelbyte-software/pixcode');
|
|
612
|
+
if (registryRes.ok) {
|
|
613
|
+
const metadata = await registryRes.json();
|
|
614
|
+
const latestVersion = metadata['dist-tags']?.latest;
|
|
615
|
+
if (latestVersion && latestVersion === SERVER_VERSION) {
|
|
616
|
+
send('log', { stream: 'meta', chunk: `Already on ${SERVER_VERSION} — nothing to do.\n` });
|
|
617
|
+
send('done', {
|
|
618
|
+
success: true,
|
|
619
|
+
version: SERVER_VERSION,
|
|
620
|
+
alreadyLatest: true,
|
|
621
|
+
message: 'Already on the latest version.',
|
|
622
|
+
});
|
|
623
|
+
endStream();
|
|
624
|
+
return;
|
|
625
|
+
}
|
|
626
|
+
}
|
|
627
|
+
} catch (err) {
|
|
628
|
+
// Registry unreachable — fall through to the install attempt
|
|
629
|
+
// rather than block the user. Log and continue.
|
|
630
|
+
console.warn('[update] Registry precheck failed:', (err && err.message) || err);
|
|
631
|
+
}
|
|
632
|
+
}
|
|
633
|
+
|
|
603
634
|
send('log', { stream: 'meta', chunk: `Running: ${updateCommand}\n` });
|
|
604
635
|
|
|
605
|
-
// Cross-platform shell invocation.
|
|
606
|
-
//
|
|
607
|
-
//
|
|
636
|
+
// Cross-platform shell invocation. `detached: true` + `unref()` below
|
|
637
|
+
// means the install child survives if this server process gets killed
|
|
638
|
+
// mid-install (which is common on Linux when `npm install -g`
|
|
639
|
+
// overwrites the running package's own files — the running process
|
|
640
|
+
// can segfault or the supervisor kills it). Without detachment, a
|
|
641
|
+
// killed parent tears down the npm child too and users end up with
|
|
642
|
+
// a half-installed package and no server at all.
|
|
608
643
|
const child = spawn(updateCommand, {
|
|
609
644
|
cwd: updateCwd,
|
|
610
645
|
env: process.env,
|
|
611
646
|
shell: true,
|
|
647
|
+
detached: true,
|
|
648
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
612
649
|
});
|
|
650
|
+
// Don't hold a reference that keeps the event loop alive or ties the
|
|
651
|
+
// child's lifetime to ours — we want it to outlive a daemon restart.
|
|
652
|
+
try { child.unref(); } catch { /* noop */ }
|
|
613
653
|
|
|
614
654
|
let clientAborted = false;
|
|
615
655
|
req.on('close', () => {
|
|
@@ -2030,6 +2070,19 @@ function handleShellConnection(ws) {
|
|
|
2030
2070
|
} else {
|
|
2031
2071
|
shellCommand = command;
|
|
2032
2072
|
}
|
|
2073
|
+
} else if (provider === 'opencode') {
|
|
2074
|
+
// OpenCode uses `--session <id>` for resumption per the
|
|
2075
|
+
// 2026 CLI docs. The session IDs the TUI creates match
|
|
2076
|
+
// our `safeSessionIdPattern` regex (ulid/nanoid), so
|
|
2077
|
+
// we pass them straight through without a cliSessionId
|
|
2078
|
+
// mapping layer — OpenCode doesn't renumber IDs the way
|
|
2079
|
+
// Gemini does.
|
|
2080
|
+
const command = initialCommand || 'opencode';
|
|
2081
|
+
if (hasSession && sessionId && safeSessionIdPattern.test(sessionId)) {
|
|
2082
|
+
shellCommand = `${command} --session "${sessionId}"`;
|
|
2083
|
+
} else {
|
|
2084
|
+
shellCommand = command;
|
|
2085
|
+
}
|
|
2033
2086
|
} else {
|
|
2034
2087
|
// Claude (default provider)
|
|
2035
2088
|
const command = initialCommand || 'claude';
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
import { readFile } from 'node:fs/promises';
|
|
2
|
+
import os from 'node:os';
|
|
3
|
+
import path from 'node:path';
|
|
4
|
+
|
|
5
|
+
import spawn from 'cross-spawn';
|
|
6
|
+
|
|
7
|
+
import type { IProviderAuth } from '@/shared/interfaces.js';
|
|
8
|
+
import type { ProviderAuthStatus } from '@/shared/types.js';
|
|
9
|
+
import { readObjectRecord, readOptionalString } from '@/shared/utils.js';
|
|
10
|
+
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
|
|
11
|
+
// @ts-ignore — plain-JS module, typed via inference
|
|
12
|
+
import { getProviderCredentials } from '@/services/provider-credentials.js';
|
|
13
|
+
|
|
14
|
+
type OpencodeCredentialsStatus = {
|
|
15
|
+
authenticated: boolean;
|
|
16
|
+
email: string | null;
|
|
17
|
+
method: string | null;
|
|
18
|
+
error?: string;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* OpenCode auth checker.
|
|
23
|
+
*
|
|
24
|
+
* OpenCode stores credentials at `~/.local/share/opencode/auth.json` (XDG
|
|
25
|
+
* data dir — different layout from the other providers which use
|
|
26
|
+
* `~/.<name>/`). The file is a JSON map of `providerName → { type, ... }`
|
|
27
|
+
* where type is `api` (API key), `oauth` (OAuth tokens), or similar.
|
|
28
|
+
*
|
|
29
|
+
* Windows layout (as of the 2026 release): `%LOCALAPPDATA%\opencode\auth.json`.
|
|
30
|
+
*
|
|
31
|
+
* Since OpenCode is multi-provider (OpenAI, Anthropic, Google, Ollama,
|
|
32
|
+
* OpenCode Zen), "authenticated" here means "at least ONE provider in
|
|
33
|
+
* auth.json has credentials" — we don't care which.
|
|
34
|
+
*/
|
|
35
|
+
export class OpencodeProviderAuth implements IProviderAuth {
|
|
36
|
+
private checkInstalled(): boolean {
|
|
37
|
+
const cliPath = process.env.OPENCODE_CLI_PATH || 'opencode';
|
|
38
|
+
try {
|
|
39
|
+
const result = spawn.sync(cliPath, ['--version'], { stdio: 'ignore', timeout: 5000 });
|
|
40
|
+
return !result.error && result.status === 0;
|
|
41
|
+
} catch {
|
|
42
|
+
return false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
async getStatus(): Promise<ProviderAuthStatus> {
|
|
47
|
+
const installed = this.checkInstalled();
|
|
48
|
+
|
|
49
|
+
if (!installed) {
|
|
50
|
+
return {
|
|
51
|
+
installed,
|
|
52
|
+
provider: 'opencode',
|
|
53
|
+
authenticated: false,
|
|
54
|
+
email: null,
|
|
55
|
+
method: null,
|
|
56
|
+
error: 'OpenCode CLI is not installed',
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
const credentials = await this.checkCredentials();
|
|
61
|
+
|
|
62
|
+
return {
|
|
63
|
+
installed,
|
|
64
|
+
provider: 'opencode',
|
|
65
|
+
authenticated: credentials.authenticated,
|
|
66
|
+
email: credentials.email,
|
|
67
|
+
method: credentials.method,
|
|
68
|
+
error: credentials.authenticated ? undefined : credentials.error || 'Not authenticated',
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
private async checkCredentials(): Promise<OpencodeCredentialsStatus> {
|
|
73
|
+
// Pixcode-managed credentials come first — if the user stored an API
|
|
74
|
+
// key via Settings > Agents > API Key, trust that regardless of
|
|
75
|
+
// env vars or auth.json.
|
|
76
|
+
try {
|
|
77
|
+
const creds = await getProviderCredentials('opencode');
|
|
78
|
+
if (creds?.apiKey) {
|
|
79
|
+
return { authenticated: true, email: 'API Key Auth', method: 'pixcode_store' };
|
|
80
|
+
}
|
|
81
|
+
} catch { /* fall through */ }
|
|
82
|
+
|
|
83
|
+
// Env-var shortcut — any of the multi-provider keys OpenCode recognises.
|
|
84
|
+
const envKeys = ['ANTHROPIC_API_KEY', 'OPENAI_API_KEY', 'GOOGLE_API_KEY', 'OPENROUTER_API_KEY'];
|
|
85
|
+
for (const k of envKeys) {
|
|
86
|
+
if (process.env[k]?.trim()) {
|
|
87
|
+
return { authenticated: true, email: `${k.replace('_API_KEY', '')} env`, method: 'api_key' };
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
// auth.json — written by `opencode auth login`. On Windows the XDG
|
|
92
|
+
// data dir typically resolves to `%LOCALAPPDATA%\opencode`, but since
|
|
93
|
+
// Node's `os.homedir()` + `.local/share/opencode` covers the Linux
|
|
94
|
+
// default and most WSL cases, we check both paths.
|
|
95
|
+
const candidatePaths = [
|
|
96
|
+
path.join(os.homedir(), '.local', 'share', 'opencode', 'auth.json'),
|
|
97
|
+
path.join(os.homedir(), 'AppData', 'Local', 'opencode', 'auth.json'),
|
|
98
|
+
];
|
|
99
|
+
|
|
100
|
+
for (const credsPath of candidatePaths) {
|
|
101
|
+
try {
|
|
102
|
+
const content = await readFile(credsPath, 'utf8');
|
|
103
|
+
const creds = readObjectRecord(JSON.parse(content)) ?? {};
|
|
104
|
+
const providerNames = Object.keys(creds);
|
|
105
|
+
if (providerNames.length > 0) {
|
|
106
|
+
// Prefer a real provider label over a generic one when we can
|
|
107
|
+
// identify it.
|
|
108
|
+
const firstProvider = providerNames[0];
|
|
109
|
+
const firstConfig = readObjectRecord(creds[firstProvider]) ?? {};
|
|
110
|
+
const authType = readOptionalString(firstConfig.type) ?? 'stored';
|
|
111
|
+
const label = providerNames.length === 1
|
|
112
|
+
? `${firstProvider} (${authType})`
|
|
113
|
+
: `${providerNames.length} providers configured`;
|
|
114
|
+
return {
|
|
115
|
+
authenticated: true,
|
|
116
|
+
email: label,
|
|
117
|
+
method: authType === 'oauth' ? 'credentials_file' : 'api_key',
|
|
118
|
+
};
|
|
119
|
+
}
|
|
120
|
+
} catch { /* try next path */ }
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
return {
|
|
124
|
+
authenticated: false,
|
|
125
|
+
email: null,
|
|
126
|
+
method: null,
|
|
127
|
+
error: 'OpenCode is not configured — run `opencode auth login`.',
|
|
128
|
+
};
|
|
129
|
+
}
|
|
130
|
+
}
|