@raingor/pi-web-switch 0.3.2 → 0.4.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.ja.md CHANGED
@@ -55,6 +55,8 @@
55
55
  - **カスタムプロバイダー** — Ollama、vLLM、LM Studio 等を追加
56
56
  - **API キー管理** — プロバイダーごとに API キーを設定/削除
57
57
  - **プロバイダー設定** — baseUrl、API タイプ、カスタムヘッダー
58
+ - **有効モデルパネル** — 全プロバイダーの有効モデルを一覧表示し、ワンクリックで無効化/全無効化。各プロバイダーのモデルのオン/オフとリアルタイム同期
59
+ - **モデルをオンライン取得** — プロバイダーの `/models` エンドポイントからモデル一覧を取得し、ワンクリックでインポート
58
60
 
59
61
  ### 💬 セッション
60
62
  - **プロジェクトグループ化** — ディレクトリ名を自動デコード
@@ -71,7 +73,7 @@
71
73
  - サイドバー下部の言語切替器、セッション間で保持
72
74
 
73
75
  ### ⚙️ 設定
74
- - デフォルト値、テーマ(Light/Dark/System)、有効モデル、パッケージ管理
76
+ - デフォルト値、テーマ(Light/Dark/System)、画面ズーム(50%–200%)とフォントサイズ、パッケージ管理
75
77
  - インポート/エクスポート、リセット
76
78
 
77
79
  ## 🚀 始め方
@@ -84,6 +86,20 @@ npm run dev # 開発サーバー起動(~/.pi/agent/ を自動読込)
84
86
  npm run build # プロダクションビルド
85
87
  ```
86
88
 
89
+ ## 🖥️ デスクトップアプリ(Electron)
90
+
91
+ pi-web-switch はデスクトップアプリ(macOS / Windows / Linux)としても利用でき、専用ブランドアイコンを備えています。
92
+
93
+ ```bash
94
+ # 開発モードで実行(Vite 開発サーバー + Electron、HMR 対応)
95
+ npm run electron:dev
96
+
97
+ # インストーラー(DMG / NSIS / AppImage)を release/ にビルド
98
+ npm run electron:build
99
+ ```
100
+
101
+ アプリアイコンは `build/`(`icon.icns` / `icon.ico` / `icon.png`)にあり、プラットフォームごとに electron-builder へ組み込まれています。開発モードでは実行時に macOS の Dock アイコンを設定します。
102
+
87
103
  ## 🏗️ 技術スタック
88
104
 
89
105
  React 19 + TypeScript 5.8 + Vite 6 + Tailwind CSS v4 + Zustand + Recharts + Lucide React + React Router v7
package/README.md CHANGED
@@ -56,6 +56,8 @@
56
56
  - **Custom Providers** — Add Ollama, vLLM, LM Studio, or any OpenAI-compatible provider
57
57
  - **API Key Management** — Set/remove API keys per provider (saved to `auth.json`)
58
58
  - **Provider Configuration** — baseUrl, API type, custom headers, auth method
59
+ - **Enabled Models Panel** — Cross-provider list of every enabled model with one-click disable / disable-all, kept in sync with each provider's per-model toggles
60
+ - **Fetch Models Online** — Pull a provider's live model list from its `/models` endpoint and import with one click
59
61
 
60
62
  ### 💬 Sessions
61
63
  - **Project Grouping** — Auto-decodes session directory names into project paths
@@ -80,7 +82,7 @@
80
82
  ### ⚙️ Settings
81
83
  - **Defaults** — Default provider, model, thinking level, project trust
82
84
  - **Theme** — Light / Dark / System with immediate toggle (CSS variables for both modes)
83
- - **Enabled Models** — View and manage the full enabled models list
85
+ - **Interface Zoom** — Scale the entire UI by percentage (50%–200%), plus a font-size slider
84
86
  - **Extensions & Packages** — Manage pi packages list
85
87
  - **Import/Export** — Download full config as JSON, restore from backup
86
88
  - **Reset** — Factory reset to blank configuration
@@ -135,6 +137,20 @@ npm run preview
135
137
 
136
138
  The dev server automatically serves pi configuration via Vite middleware at `/api/pi/*` — no separate backend process needed.
137
139
 
140
+ ## 🖥️ Desktop App (Electron)
141
+
142
+ pi-web-switch also runs as a desktop app (macOS / Windows / Linux) with its own branded app icon.
143
+
144
+ ```bash
145
+ # Run in development (Vite dev server + Electron with HMR)
146
+ npm run electron:dev
147
+
148
+ # Build installers (DMG / NSIS / AppImage) into release/
149
+ npm run electron:build
150
+ ```
151
+
152
+ App icons live in `build/` (`icon.icns` / `icon.ico` / `icon.png`) and are wired into electron-builder per platform; in development the macOS dock icon is set at runtime.
153
+
138
154
  ## 🏗️ Tech Stack
139
155
 
140
156
  | Layer | Technology |
package/README.zh-CN.md CHANGED
@@ -55,6 +55,8 @@
55
55
  - **自定义提供商** — 添加 Ollama、vLLM、LM Studio 或任意 OpenAI 兼容提供商
56
56
  - **API Key 管理** — 为每个提供商设置/删除 API Key(保存到 `auth.json`)
57
57
  - **提供商配置** — baseUrl、API 类型、自定义请求头、认证方式
58
+ - **已启用模型面板** — 跨提供商汇总所有已启用模型,支持一键禁用/全部禁用,并与各提供商内的模型开关实时同步
59
+ - **在线获取模型** — 从提供商的 `/models` 端点拉取实时模型列表,一键导入
58
60
 
59
61
  ### 💬 会话浏览
60
62
  - **项目分组** — 自动将会话目录名解码为项目路径
@@ -79,7 +81,7 @@
79
81
  ### ⚙️ 设置
80
82
  - **默认值** — 默认提供商、模型、思考级别、项目信任级别
81
83
  - **主题** — 浅色 / 深色 / 跟随系统,即时切换(CSS 变量双主题)
82
- - **已启用模型**查看和管理完整的启用模型列表
84
+ - **界面缩放**按百分比缩放整个界面(50%–200%),并提供字体大小调节
83
85
  - **扩展与包** — 管理 pi 的 packages 列表
84
86
  - **导入/导出** — 下载完整配置为 JSON,从备份恢复
85
87
  - **重置** — 恢复空白默认配置
@@ -122,6 +124,20 @@ npm run build # 构建生产版本
122
124
  npm run preview # 预览生产构建
123
125
  ```
124
126
 
127
+ ## 🖥️ 桌面应用(Electron)
128
+
129
+ pi-web-switch 同样提供桌面应用(macOS / Windows / Linux),并带有专属品牌图标。
130
+
131
+ ```bash
132
+ # 开发模式运行(Vite 开发服务器 + Electron,支持 HMR)
133
+ npm run electron:dev
134
+
135
+ # 构建安装包(DMG / NSIS / AppImage)到 release/
136
+ npm run electron:build
137
+ ```
138
+
139
+ 应用图标位于 `build/`(`icon.icns` / `icon.ico` / `icon.png`),已按平台接入 electron-builder;开发模式下会在运行时设置 macOS 程序坞图标。
140
+
125
141
  ## 🏗️ 技术栈
126
142
 
127
143
  React 19 + TypeScript 5.8 + Vite 6 + Tailwind CSS v4 + Zustand + Recharts + Lucide React + React Router v7
package/package.json CHANGED
@@ -1,9 +1,9 @@
1
1
  {
2
2
  "name": "@raingor/pi-web-switch",
3
3
  "private": false,
4
- "version": "0.3.2",
4
+ "version": "0.4.0",
5
5
  "type": "module",
6
- "main": "pi-package/index.ts",
6
+ "main": "dist-electron/main.js",
7
7
  "description": "Web UI for pi coding agent — live configuration management, session browser, and memory viewer",
8
8
  "keywords": [
9
9
  "pi-package",
@@ -26,8 +26,23 @@
26
26
  "scripts": {
27
27
  "dev": "vite",
28
28
  "build": "tsc -b && vite build",
29
- "preview": "vite preview"
29
+ "preview": "vite preview",
30
+ "electron:dev": "node scripts/electron-dev.mjs",
31
+ "electron:build": "tsc -b && vite build && vite build --config vite.electron.config.ts && vite build --config vite.preload.config.ts && electron-builder",
32
+ "electron:preview": "vite build && vite build --config vite.electron.config.ts && vite build --config vite.preload.config.ts && env -u ELECTRON_RUN_AS_NODE npx electron ."
30
33
  },
34
+ "files": [
35
+ "pi-package",
36
+ "server",
37
+ "src",
38
+ "public",
39
+ "index.html",
40
+ "vite.config.ts",
41
+ "tsconfig.json",
42
+ "README.md",
43
+ "README.zh-CN.md",
44
+ "README.ja.md"
45
+ ],
31
46
  "pi": {
32
47
  "extensions": [
33
48
  "./pi-package/index.ts"
@@ -49,9 +64,37 @@
49
64
  "@types/react": "^19.1.2",
50
65
  "@types/react-dom": "^19.1.2",
51
66
  "@vitejs/plugin-react": "^4.4.1",
67
+ "electron": "^43.2.0",
68
+ "electron-builder": "^26.15.3",
69
+ "electron-vite": "^5.0.0",
52
70
  "tailwindcss": "^4.1.4",
53
71
  "typescript": "~5.8.3",
72
+ "undici": "^8.9.0",
54
73
  "vite": "^6.3.2",
74
+ "vite-plugin-electron": "^1.1.0",
55
75
  "vite-plugin-pwa": "^1.3.0"
76
+ },
77
+ "build": {
78
+ "appId": "com.raingor.pi-web-switch",
79
+ "productName": "pi-web-switch",
80
+ "directories": {
81
+ "output": "release"
82
+ },
83
+ "files": [
84
+ "dist/**/*",
85
+ "dist-electron/**/*"
86
+ ],
87
+ "mac": {
88
+ "target": "dmg",
89
+ "icon": "build/icon.icns"
90
+ },
91
+ "win": {
92
+ "target": "nsis",
93
+ "icon": "build/icon.ico"
94
+ },
95
+ "linux": {
96
+ "target": "AppImage",
97
+ "icon": "build/icon.png"
98
+ }
56
99
  }
57
100
  }
Binary file
Binary file
Binary file
package/public/pi.svg CHANGED
@@ -1,4 +1,47 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" width="32" height="32" viewBox="0 0 32 32" fill="none">
2
- <rect width="32" height="32" rx="6" fill="#2563eb"/>
3
- <text x="16" y="22" text-anchor="middle" font-size="18" font-weight="bold" fill="white" font-family="system-ui">π</text>
4
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" width="512" height="512" viewBox="0 0 512 512" fill="none">
2
+ <defs>
3
+ <!-- Brand blue diagonal gradient -->
4
+ <linearGradient id="bg" x1="0" y1="0" x2="1" y2="1">
5
+ <stop offset="0" stop-color="#6ba6fb"/>
6
+ <stop offset="0.5" stop-color="#2563eb"/>
7
+ <stop offset="1" stop-color="#1e40af"/>
8
+ </linearGradient>
9
+ <!-- Soft top gloss for a tactile, premium feel -->
10
+ <linearGradient id="gloss" x1="0" y1="0" x2="0" y2="1">
11
+ <stop offset="0" stop-color="#ffffff" stop-opacity="0.28"/>
12
+ <stop offset="1" stop-color="#ffffff" stop-opacity="0"/>
13
+ </linearGradient>
14
+ <!-- Subtle vertical shading on the pi glyph -->
15
+ <linearGradient id="piGrad" x1="0" y1="0" x2="0" y2="1">
16
+ <stop offset="0" stop-color="#ffffff"/>
17
+ <stop offset="1" stop-color="#d9e6ff"/>
18
+ </linearGradient>
19
+ <!-- Toggle knob highlight -->
20
+ <radialGradient id="knob" cx="0.35" cy="0.3" r="0.85">
21
+ <stop offset="0" stop-color="#ffffff"/>
22
+ <stop offset="1" stop-color="#cdd9f2"/>
23
+ </radialGradient>
24
+ <filter id="softShadow" x="-30%" y="-30%" width="160%" height="160%">
25
+ <feDropShadow dx="0" dy="7" stdDeviation="11" flood-color="#0a2a6b" flood-opacity="0.38"/>
26
+ </filter>
27
+ <filter id="knobShadow" x="-60%" y="-60%" width="220%" height="220%">
28
+ <feDropShadow dx="0" dy="3" stdDeviation="5" flood-color="#0a2a6b" flood-opacity="0.35"/>
29
+ </filter>
30
+ </defs>
31
+
32
+ <!-- Squircle background -->
33
+ <rect x="0" y="0" width="512" height="512" rx="115" fill="url(#bg)"/>
34
+ <!-- Top gloss highlight -->
35
+ <rect x="0" y="0" width="512" height="250" rx="115" fill="url(#gloss)"/>
36
+
37
+ <!-- Toggle switch track (behind the pi) -->
38
+ <rect x="92" y="217" width="328" height="78" rx="39" fill="#ffffff" opacity="0.20"/>
39
+ <rect x="92" y="217" width="328" height="78" rx="39" fill="none" stroke="#ffffff" stroke-opacity="0.25" stroke-width="2"/>
40
+ <!-- Toggle knob in the "on" position -->
41
+ <circle cx="378" cy="256" r="30" fill="url(#knob)" filter="url(#knobShadow)"/>
42
+
43
+ <!-- Pi glyph -->
44
+ <text x="256" y="256" text-anchor="middle" dominant-baseline="central"
45
+ font-family="-apple-system, 'SF Pro Display', 'Segoe UI', Roboto, Helvetica, Arial, sans-serif"
46
+ font-size="258" font-weight="700" fill="url(#piGrad)" filter="url(#softShadow)">π</text>
47
+ </svg>