codex-mobile-re 0.1.90 → 0.1.91

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 CHANGED
@@ -1,278 +1,214 @@
1
- # 🔥 codexapp
2
-
3
- ### 🚀 Run Codex App UI Anywhere: Linux, Windows, or Termux on Android 🚀
4
-
5
- [![npm](https://img.shields.io/npm/v/codexapp?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/codexapp)
6
- [![platform](https://img.shields.io/badge/Platform-Linux%20%7C%20Windows%20%7C%20Android-blue?style=for-the-badge)](#-quick-start)
7
- [![node](https://img.shields.io/badge/Node-18%2B-339933?style=for-the-badge&logo=node.js&logoColor=white)](https://nodejs.org/)
8
- [![license](https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge)](./LICENSE)
9
-
10
- > **Codex UI in your browser. No drama. One command.**
11
- >
12
- > **Yes, that is your Codex desktop app experience exposed over web UI. Yes, it runs cross-platform.**
13
-
14
- ```text
15
- ██████╗ ██████╗ ██████╗ ███████╗██╗ ██╗██╗ ██╗██╗
16
- ██╔════╝██╔═══██╗██╔══██╗██╔════╝╚██╗██╔╝██║ ██║██║
17
- ██║ ██║ ██║██║ ██║█████╗ ╚███╔╝ ██║ ██║██║
18
- ██║ ██║ ██║██║ ██║██╔══╝ ██╔██╗ ██║ ██║██║
19
- ╚██████╗╚██████╔╝██████╔╝███████╗██╔╝ ██╗╚██████╔╝██║
20
- ╚═════╝ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝
21
- ```
22
-
23
- ---
24
- <img width="1366" height="900" alt="image" src="https://github.com/user-attachments/assets/1a3578ba-add8-49a2-88b4-08195a7f0140" />
25
-
26
- ## 🤯 What Is This?
27
- **`codexapp`** is a lightweight bridge that gives you a browser-accessible UI for Codex app-server workflows.
28
-
29
- You run one command. It starts a local web server. You open it from your machine, your LAN, or wherever your setup allows.
30
-
31
- **TL;DR 🧠: Codex app UI, unlocked for Linux, Windows, and Termux-powered Android setups.**
32
-
33
- ---
34
-
35
- ## ⚡ Quick Start
36
- > **The main event.**
37
-
38
- ```bash
39
- # 🔓 Run instantly (recommended)
40
- npx codexapp
41
-
42
- # 🌐 Then open in browser
43
- # http://localhost:18923
44
- ```
45
-
46
- By default, `codexapp` now also starts:
47
-
48
- ```bash
49
- cloudflared tunnel --url http://localhost:<port>
50
- ```
51
-
52
- It prints the tunnel URL, terminal QR code, and password together in startup output.
53
- Use `--no-tunnel` to disable this behavior.
54
-
55
- If you are using a provider or AI gateway that is already authenticated and do not want `codexapp` to force `codex login` during startup, use:
56
-
57
- ```bash
58
- npx codexapp --no-login
59
- ```
60
-
61
- ### Linux 🐧
62
- ```bash
63
- node -v # should be 18+
64
- npx codexapp
65
- ```
66
-
67
- ### Windows 🪟 (PowerShell)
68
- ```powershell
69
- node -v # 18+
70
- npx codexapp
71
- ```
72
-
73
- ### Termux (Android) 🤖
74
- ```bash
75
- pkg update && pkg upgrade -y
76
- pkg install nodejs -y
77
- npx codexapp
78
- ```
79
-
80
- Android background requirements:
81
-
82
- 1. Keep `codexapp` running in the current Termux session (do not close it).
83
- 2. In Android settings, disable battery optimization for `Termux`.
84
- 3. Keep the persistent Termux notification enabled so Android is less likely to kill it.
85
- 4. Optional but recommended in Termux:
86
- ```bash
87
- termux-wake-lock
88
- ```
89
- 5. Open the shown URL in your Android browser. If the app is killed, return to Termux and run `npx codexapp` again.
90
-
91
- ---
92
-
93
- ## iPhone / iPad via Tailscale Serve
94
-
95
- If you want to use codexUI from iPhone or iPad Safari, serving it over HTTPS is recommended.
96
-
97
- A practical private setup is to run codexUI locally and publish it inside your tailnet with Tailscale Serve:
98
-
99
- ```powershell
100
- npx codexapp --no-tunnel --port 5900
101
- tailscale serve --bg 5900
102
- ```
103
-
104
- Then open:
105
-
106
- ```text
107
- https://<your-machine>.<your-tailnet>.ts.net
108
- ```
109
-
110
- This setup worked well in practice for:
111
-
112
- - iPhone Safari access
113
- - Add to Home Screen
114
- - the built-in dictation / transcription feature in the app
115
- - viewing the same projects and conversations from the Windows host
116
-
117
- Notes:
118
-
119
- - Tailscale Serve keeps access private to your tailnet
120
- - on iOS, HTTPS / secure context appears to be important for mobile browser access and dictation
121
- - some minor mobile Safari CSS issues may still exist, but they do not prevent normal use
122
- - depending on proxying details, authentication behavior may differ from direct remote access
123
- - if conversations created in the web UI do not immediately appear in the Windows app, restarting the Windows app may refresh them
124
-
125
- ---
126
-
127
- ## Features
128
- > **The payload.**
129
-
130
- - 🚀 One-command launch with `npx codexapp`
131
- - 🌍 Cross-platform support for Linux, Windows, and Termux on Android
132
- - 🖥️ Browser-first Codex UI flow on `http://localhost:18923`
133
- - 🌐 LAN-friendly access from other devices on the same network
134
- - 🧪 Remote/headless-friendly setup for server-based Codex usage
135
- - 🔌 Works with reverse proxies and tunneling setups
136
- - No global install required for quick experimentation
137
- - 🎙️ Built-in hold-to-dictate voice input with transcription to composer draft
138
- - 🤖 Optional Telegram bot bridge: send messages to bot, forward into mapped thread, send assistant reply back to Telegram
139
- - 💾 Project portability: export a project as a ZIP from project or thread menus, including matching Codex chat JSONL history under `.codex-project/chats/`
140
- - 📦 Project import: restore exported project ZIPs from the browser via `Import Project`
141
- - 🔁 Imported chats are rewritten for the destination `CODEX_HOME`, project path, and currently selected provider/model so they can be resumed in the new environment
142
- - ⚙️ Project ZIP performance: exports stream ZIP bytes with response backpressure handling and skip generated/git-ignored folders; imports still buffer the selected ZIP once because the browser upload arrives as a single file
143
-
144
- ### Telegram Bot Bridge (Optional)
145
-
146
- Set these environment variables before starting `codexapp`:
147
-
148
- ```bash
149
- export TELEGRAM_BOT_TOKEN="<your-telegram-bot-token>"
150
- export TELEGRAM_ALLOWED_USER_IDS="<your-telegram-user-id>,<optional-second-id>"
151
- export TELEGRAM_DEFAULT_CWD="$PWD" # optional, defaults to current working directory
152
- npx codexapp
153
- ```
154
-
155
- `TELEGRAM_ALLOWED_USER_IDS` is required for safe access. Only allowlisted Telegram user IDs can use the bridge. If no allowed user IDs are configured, incoming Telegram messages are rejected.
156
-
157
- To find your Telegram user ID:
158
-
159
- 1. Send a message to your bot.
160
- 2. Run `curl "https://api.telegram.org/bot<your-telegram-bot-token>/getUpdates"`.
161
- 3. Read `message.from.id` from the returned update payload.
162
-
163
- Bot commands:
164
-
165
- - `/start` show quick help and thread picker
166
- - `/threads` list recent threads and pick one
167
- - `/newthread` create and map a new Codex thread for this Telegram chat
168
- - `/thread <threadId>` map current Telegram chat to an existing thread
169
- - `/current` show currently connected thread for this chat
170
- - `/history` show recent history for current thread
171
- - `/status` show bridge/mapping status
172
- - `/whoami` show your Telegram user/chat IDs and authorization state
173
- - `/help` show command reference
174
-
175
- Outgoing assistant messages are sent with Telegram `parse_mode=HTML` for formatting, with automatic plain-text fallback if HTML delivery fails.
176
-
177
- ---
178
-
179
- ## 🧩 Recent Product Features (from main commits)
180
- > **Not just launch. Actual UX upgrades.**
181
-
182
- - 🗂️ Searchable project picker in new-thread flow
183
- - "Create Project" button next to "Select folder" with browser prompt
184
- - 📌 New projects get pinned to top automatically
185
- - 🧠 Smart default new-project name suggestion via server-side free-directory scan (`New Project (N)`)
186
- - 🔄 Project order persisted globally to workspace roots state
187
- - 🧵 Optimistic in-progress threads preserved during refresh/poll cycles
188
- - 📱 Mobile drawer sidebar in desktop layout (teleported overlay + swipe-friendly structure)
189
- - 🎛️ Skills Hub mobile-friendly spacing/toolbar layout improvements
190
- - 🪟 Skill detail modal tuned for mobile sheet-style behavior
191
- - 🧪 Skills Hub event typing fix for `SkillCard` select emit compatibility
192
- - 🎙️ Voice dictation flow in composer (`hold to dictate` -> transcribe -> append text)
193
-
194
- ---
195
-
196
- ## 🌍 What Can You Do With This?
197
-
198
- | 🔥 Use Case | 💥 What You Get |
199
- |---|---|
200
- | 💻 Linux workstation | Run Codex UI in browser without depending on desktop shell |
201
- | 🪟 Windows machine | Launch web UI and access from Chrome/Edge quickly |
202
- | 📱 Termux on Android | Start service in Termux and control from mobile browser |
203
- | 🧪 Remote dev box | Keep Codex process on server, view UI from client device |
204
- | 🌐 LAN sharing | Open UI from another device on same network |
205
- | 🧰 Headless workflows | Keep terminal + browser split for productivity |
206
- | 🔌 Custom routing | Put behind reverse proxy/tunnel if needed |
207
- | ⚡ Fast experiments | `npx` run without full global setup |
208
-
209
- ---
210
-
211
- ## 🖼️ Screenshots
212
-
213
- ### Skills Hub
214
- ![Skills Hub](docs/screenshots/skills-hub.png)
215
-
216
- ### Chat
217
- ![Chat](docs/screenshots/chat.png)
218
-
219
- ### Mobile UI
220
- ![Skills Hub Mobile](docs/screenshots/skills-hub-mobile.png)
221
- ![Chat Mobile](docs/screenshots/chat-mobile.png)
222
-
223
- ---
224
-
225
- ## 🏗️ Architecture
226
-
227
- ```text
228
- ┌─────────────────────────────┐
229
- │ Browser (Desktop/Mobile) │
230
- └──────────────┬──────────────┘
231
- │ HTTP/WebSocket
232
- ┌──────────────▼──────────────┐
233
- │ codexapp │
234
- │ (Express + Vue UI bridge) │
235
- └──────────────┬──────────────┘
236
- │ RPC/Bridge calls
237
- ┌──────────────▼──────────────┐
238
- │ Codex App Server │
239
- └─────────────────────────────┘
240
- ```
241
-
242
- ---
243
-
244
- ## 🎯 Requirements
245
- - ✅ Node.js `18+`
246
- - ✅ Codex app-server environment available
247
- - ✅ Browser access to host/port
248
- - ✅ Microphone permission (only for voice dictation)
249
-
250
- ---
251
-
252
- ## 🐛 Troubleshooting
253
-
254
- | ❌ Problem | ✅ Fix |
255
- |---|---|
256
- | Port already in use | Run on a free port or stop old process |
257
- | `npx` fails | Update npm/node, then retry |
258
- | Termux install fails | `pkg update && pkg upgrade` then reinstall `nodejs` |
259
- | Can’t open from other device | Check firewall, bind address, and LAN routing |
260
-
261
- ---
262
-
263
- ## 🤝 Contributing
264
- Issues and PRs are welcome.
265
- Bring bug reports, platform notes, and setup improvements.
266
-
267
- ---
268
-
269
- ## ⭐ Star This Repo
270
- If you believe Codex UI should be accessible from **any machine, any OS, any screen**, star this project and share it. ⭐
271
-
272
- <div align="center">
273
- Built for speed, portability, and a little bit of chaos 😏
274
- </div>
275
-
276
- ---
277
-
278
- Forked from [pavel-voronin/codex-web-local](https://github.com/pavel-voronin/codex-web-local) by Pavel Voronin.
1
+ # 🔥 codex-mobile-re
2
+
3
+ ### 🚀 Run Codex App UI Anywhere: Linux, Windows, or Termux on Android 🚀
4
+
5
+ [![npm](https://img.shields.io/npm/v/codex-mobile-re?style=for-the-badge&logo=npm&logoColor=white)](https://www.npmjs.com/package/codex-mobile-re)
6
+ [![platform](https://img.shields.io/badge/Platform-Linux%20%7C%20Windows%20%7C%20Android-blue?style=for-the-badge)](#-quick-start)
7
+ [![node](https://img.shields.io/badge/Node-18%2B-339933?style=for-the-badge&logo=node.js&logoColor=white)](https://nodejs.org/)
8
+ [![license](https://img.shields.io/badge/License-MIT-yellow?style=for-the-badge)](./LICENSE)
9
+
10
+ > **Codex UI in your browser. No drama. One command.**
11
+ >
12
+ > **Yes, that is your Codex desktop app experience exposed over web UI. Yes, it runs cross-platform.**
13
+
14
+ > **codex-mobile-re** is a fork rebuild of `codexapp` (upstream: [friuns2/codex-mobile](https://github.com/friuns2/codex-mobile), originally from [pavel-voronin/codex-web-local](https://github.com/pavel-voronin/codex-web-local)), focused on mobile-first web UI, thread/message rendering refinements, and long-session stability. It is published on npm as `codex-mobile-re` and released on GitHub as `cattails-lgao/codex-mobile`.
15
+
16
+ ```text
17
+ ██████╗ ██████╗ ██████╗ ███████╗██╗ ██╗██╗ ██╗██╗
18
+ ██╔════╝██╔═══██╗██╔══██╗██╔════╝╚██╗██╔╝██║ ██║██║
19
+ ██║ ██║ ██║██║ ██║█████╗ ╚███╔╝ ██║ ██║██║
20
+ ██║ ██║ ██║██║ ██║██╔══╝ ██╔██╗ ██║ ██║██║
21
+ ╚██████╗╚██████╔╝██████╔╝███████╗██╔╝ ██╗╚██████╔╝██║
22
+ ╚═════╝ ╚═════╝ ╚══════╝╚═╝ ╚═╝ ╚═════╝ ╚═╝ ╚═════╝
23
+ ```
24
+
25
+ ---
26
+
27
+ ## 🤯 What Is This?
28
+ **`codex-mobile-re`** is a lightweight bridge that gives you a browser-accessible UI for Codex app-server workflows.
29
+
30
+ You run one command. It starts a local web server. You open it from your machine, your LAN, or wherever your setup allows.
31
+
32
+ **TL;DR 🧠: Codex app UI, unlocked for Linux, Windows, and Termux-powered Android setups.**
33
+
34
+ ---
35
+
36
+ ## Quick Start
37
+ > **The main event.**
38
+
39
+ ```bash
40
+ # 🔓 Run instantly (recommended)
41
+ npx codex-mobile-re
42
+
43
+ # 🌐 Then open in browser
44
+ # http://localhost:5900
45
+ ```
46
+
47
+ By default, `codex-mobile-re` now also starts:
48
+
49
+ ```bash
50
+ cloudflared tunnel --url http://localhost:<port>
51
+ ```
52
+
53
+ It prints the tunnel URL, terminal QR code, and password together in startup output.
54
+ Use `--no-tunnel` to disable this behavior.
55
+
56
+ If you are using a provider or AI gateway that is already authenticated and do not want `codex-mobile-re` to force `codex login` during startup, use:
57
+
58
+ ```bash
59
+ npx codex-mobile-re --no-login
60
+ ```
61
+
62
+ ### Linux 🐧
63
+ ```bash
64
+ node -v # should be 18+
65
+ npx codex-mobile-re
66
+ ```
67
+
68
+ ### Windows 🪟 (PowerShell)
69
+ ```powershell
70
+ node -v # 18+
71
+ npx codex-mobile-re
72
+ ```
73
+
74
+ ### Termux (Android) 🤖
75
+ ```bash
76
+ pkg update && pkg upgrade -y
77
+ pkg install nodejs -y
78
+ npx codex-mobile-re
79
+ ```
80
+
81
+ Android background requirements:
82
+
83
+ 1. Keep `codex-mobile-re` running in the current Termux session (do not close it).
84
+ 2. In Android settings, disable battery optimization for `Termux`.
85
+ 3. Keep the persistent Termux notification enabled so Android is less likely to kill it.
86
+ 4. Optional but recommended in Termux:
87
+ ```bash
88
+ termux-wake-lock
89
+ ```
90
+ 5. Open the shown URL in your Android browser. If the app is killed, return to Termux and run `npx codex-mobile-re` again.
91
+
92
+ ---
93
+
94
+ ## ✨ Features
95
+ > **The payload.**
96
+
97
+ - 🚀 One-command launch with `npx codex-mobile-re`
98
+ - 🌍 Cross-platform support for Linux, Windows, and Termux on Android
99
+ - 🖥️ Browser-first Codex UI flow on `http://localhost:5900`
100
+ - 🌐 LAN-friendly access from other devices on the same network
101
+ - 🧪 Remote/headless-friendly setup for server-based Codex usage
102
+ - 🔌 Works with reverse proxies and tunneling setups
103
+ - ⚡ No global install required for quick experimentation
104
+ - 🎙️ Built-in hold-to-dictate voice input with transcription to composer draft
105
+ - 🤖 Optional Telegram bot bridge: send messages to bot, forward into mapped thread, send assistant reply back to Telegram
106
+ - 💾 Project portability: export a project as a ZIP from project or thread menus, including matching Codex chat JSONL history under `.codex-project/chats/`
107
+ - 📦 Project import: restore exported project ZIPs from the browser via `Import Project`
108
+ - 🔁 Imported chats are rewritten for the destination `CODEX_HOME`, project path, and currently selected provider/model so they can be resumed in the new environment
109
+ - ⚙️ Project ZIP performance: exports stream ZIP bytes with response backpressure handling and skip generated/git-ignored folders; imports still buffer the selected ZIP once because the browser upload arrives as a single file
110
+
111
+ ### Telegram Bot Bridge (Optional)
112
+
113
+ Set these environment variables before starting `codex-mobile-re`:
114
+
115
+ ```bash
116
+ export TELEGRAM_BOT_TOKEN="<your-telegram-bot-token>"
117
+ export TELEGRAM_ALLOWED_USER_IDS="<your-telegram-user-id>,<optional-second-id>"
118
+ export TELEGRAM_DEFAULT_CWD="$PWD" # optional, defaults to current working directory
119
+ npx codex-mobile-re
120
+ ```
121
+
122
+ `TELEGRAM_ALLOWED_USER_IDS` is required for safe access. Only allowlisted Telegram user IDs can use the bridge. If no allowed user IDs are configured, incoming Telegram messages are rejected.
123
+
124
+ To find your Telegram user ID:
125
+
126
+ 1. Send a message to your bot.
127
+ 2. Run `curl "https://api.telegram.org/bot<your-telegram-bot-token>/getUpdates"`.
128
+ 3. Read `message.from.id` from the returned update payload.
129
+
130
+ Bot commands:
131
+
132
+ - `/start` show quick help and thread picker
133
+ - `/threads` list recent threads and pick one
134
+ - `/newthread` create and map a new Codex thread for this Telegram chat
135
+ - `/thread <threadId>` map current Telegram chat to an existing thread
136
+ - `/current` show currently connected thread for this chat
137
+ - `/history` show recent history for current thread
138
+ - `/status` show bridge/mapping status
139
+ - `/whoami` show your Telegram user/chat IDs and authorization state
140
+ - `/help` show command reference
141
+
142
+ Outgoing assistant messages are sent with Telegram `parse_mode=HTML` for formatting, with automatic plain-text fallback if HTML delivery fails.
143
+
144
+ ---
145
+
146
+ ## 🌍 What Can You Do With This?
147
+
148
+ | 🔥 Use Case | 💥 What You Get |
149
+ |---|---|
150
+ | 💻 Linux workstation | Run Codex UI in browser without depending on desktop shell |
151
+ | 🪟 Windows machine | Launch web UI and access from Chrome/Edge quickly |
152
+ | 📱 Termux on Android | Start service in Termux and control from mobile browser |
153
+ | 🧪 Remote dev box | Keep Codex process on server, view UI from client device |
154
+ | 🌐 LAN sharing | Open UI from another device on same network |
155
+ | 🧰 Headless workflows | Keep terminal + browser split for productivity |
156
+ | 🔌 Custom routing | Put behind reverse proxy/tunnel if needed |
157
+ | Fast experiments | `npx` run without full global setup |
158
+
159
+ ---
160
+
161
+ ## 🏗️ Architecture
162
+
163
+ ```text
164
+ ┌─────────────────────────────┐
165
+ │ Browser (Desktop/Mobile) │
166
+ └──────────────┬──────────────┘
167
+ HTTP/WebSocket
168
+ ┌──────────────▼──────────────┐
169
+ │ codex-mobile-re │
170
+ │ (Express + Vue UI bridge) │
171
+ └──────────────┬──────────────┘
172
+ RPC/Bridge calls
173
+ ┌──────────────▼──────────────┐
174
+ │ Codex App Server │
175
+ └─────────────────────────────┘
176
+ ```
177
+
178
+ ---
179
+
180
+ ## 🎯 Requirements
181
+ - ✅ Node.js `18+`
182
+ - Codex app-server environment available
183
+ - Browser access to host/port
184
+ - Microphone permission (only for voice dictation)
185
+
186
+ ---
187
+
188
+ ## 🐛 Troubleshooting
189
+
190
+ | Problem | Fix |
191
+ |---|---|
192
+ | Port already in use | Run on a free port (`--port <port>`) or stop old process |
193
+ | `npx` fails | Update npm/node, then retry |
194
+ | Termux install fails | `pkg update && pkg upgrade` then reinstall `nodejs` |
195
+ | Can’t open from other device | Check firewall, bind address, and LAN routing |
196
+
197
+ ---
198
+
199
+ ## 🤝 Contributing
200
+ Issues and PRs are welcome.
201
+ Bring bug reports, platform notes, and setup improvements.
202
+
203
+ ---
204
+
205
+ ## Star This Repo
206
+ If you believe Codex UI should be accessible from **any machine, any OS, any screen**, star this project and share it. ⭐
207
+
208
+ <div align="center">
209
+ Built for speed, portability, and a little bit of chaos 😏
210
+ </div>
211
+
212
+ ---
213
+
214
+ Forked from [friuns2/codex-mobile](https://github.com/friuns2/codex-mobile), originally from [pavel-voronin/codex-web-local](https://github.com/pavel-voronin/codex-web-local).
@@ -1 +1 @@
1
- import{d as X,q as f,l as w,M as Z,as as tt,at,o as c,a as v,b as e,t as n,u as i,e as B,g as U,au as A,F as et,r as ot,a2 as x,w as I,n as st,c as L,av as F,j as nt,k as _,_ as ut}from"./index-CL3S5U3K.js";const it={class:"automations-panel"},lt={class:"automations-toolbar"},rt={class:"automations-summary"},ct={class:"automations-actions"},dt=["title"],mt=["disabled"],pt={key:0,class:"automations-error"},vt={key:1,class:"automations-empty"},ht={key:2,class:"automations-empty"},ft={key:3,class:"automations-layout"},_t=["aria-label"],yt=["onClick","onKeydown"],bt=["data-status"],gt={class:"automation-row-main"},At={class:"automation-row-title"},Lt={class:"automation-row-meta"},Et={class:"automation-row-side"},kt=["data-status"],Ct={class:"automation-row-schedule"},wt=["onClick"],It=["aria-label"],jt={class:"automation-detail-heading"},Rt=["data-status"],Tt={class:"automation-detail-title-wrap"},$t={class:"automation-detail-grid"},Kt=["title"],Mt={class:"automation-detail-prompt"},Nt=X({__name:"AutomationsPanel",props:{groups:{},projectCwdByName:{},projectDisplayNameById:{},selectedAutomationId:{}},emits:["select-automation","edit-automation","create-automation"],setup(V,{expose:Q,emit:Y}){const h=V,E=Y,j=f({}),R=f({}),{t:s}=nt(),y=f(!1),b=f(""),d=f(h.selectedAutomationId??""),p=f(""),z=_(()=>{const t=new Map;for(const a of h.groups)for(const o of a.threads)t.set(o.id,o.title);return t}),H=_(()=>{var a,o;const t=new Map;for(const l of h.groups){const u=(a=h.projectCwdByName[l.projectName])==null?void 0:a.trim(),g=((o=h.projectDisplayNameById[l.projectName])==null?void 0:o.trim())||l.projectName;u&&t.set(u,g)}return t}),m=_(()=>{const t=[];for(const[a,o]of Object.entries(j.value)){const l=z.value.get(a)??a;for(const u of o)t.push({rowKey:M("thread",a,u.id),automation:u,scope:"thread",scopeLabel:s("Heartbeat"),targetLabel:l,targetTitle:a,scheduleLabel:N(u)})}for(const[a,o]of Object.entries(R.value)){const l=H.value.get(a)??J(a);for(const u of o)t.push({rowKey:M("project",a,u.id),automation:u,scope:"project",scopeLabel:s("Project"),targetLabel:l,targetTitle:a,scheduleLabel:N(u)})}return t.sort((a,o)=>{const l=a.automation.status==="ACTIVE"?0:1,u=o.automation.status==="ACTIVE"?0:1;if(l!==u)return l-u;const g=a.automation.createdAtMs??0,P=o.automation.createdAtMs??0;if(g!==P)return P-g;const D=a.automation.updatedAtMs??0,S=o.automation.updatedAtMs??0;return D!==S?S-D:a.automation.name.localeCompare(o.automation.name)})}),O=_(()=>m.value.filter(t=>t.automation.status==="ACTIVE").length),W=_(()=>m.value.filter(t=>t.automation.status==="PAUSED").length),r=_(()=>m.value.find(t=>t.rowKey===p.value)??m.value.find(t=>t.automation.id===d.value)??m.value[0]??null);w(()=>h.selectedAutomationId,t=>{t&&(d.value=t,p.value=K(t))}),w(d,t=>{t&&E("select-automation",t)}),w(m,t=>{if(t.length===0){d.value="",p.value="";return}if(!(p.value&&t.some(a=>a.rowKey===p.value))){if(d.value&&t.some(a=>a.automation.id===d.value)){p.value=K(d.value);return}(!d.value||!t.some(a=>a.automation.id===d.value))&&(d.value=t[0].automation.id,p.value=t[0].rowKey)}}),Z(()=>{k()}),Q({loadAutomations:k});async function k(){y.value=!0,b.value="";try{const[t,a]=await Promise.all([tt(),at()]);j.value=t,R.value=a}catch(t){b.value=t instanceof Error?t.message:s("Failed to load automations")}finally{y.value=!1}}function T(t){return s(t==="PAUSED"?"Paused":"Active")}function $(t){E("edit-automation",{scope:t.scope,target:t.targetTitle,automation:t.automation})}function q(){E("create-automation")}function C(t){p.value=t.rowKey,d.value=t.automation.id}function K(t){var a;return((a=m.value.find(o=>o.automation.id===t))==null?void 0:a.rowKey)??""}function M(t,a,o){return`${t}:${a}:${o}`}function N(t){var o,l;if(t.status==="PAUSED")return s("Paused");if(t.nextRunAtMs)return`${s("Next")} ${G(t.nextRunAtMs)}`;const a=t.rrule.trim();if(/FREQ=MINUTELY/i.test(a)){const u=((o=/INTERVAL=(\d+)/i.exec(a))==null?void 0:o[1])??"1";return u==="1"?s("Every minute"):`${s("Every")} ${u} ${s("minutes")}`}if(/FREQ=HOURLY/i.test(a)){const u=((l=/INTERVAL=(\d+)/i.exec(a))==null?void 0:l[1])??"1";return u==="1"?s("Hourly"):`${s("Every")} ${u} ${s("hours")}`}return/FREQ=DAILY/i.test(a)?s("Daily"):/FREQ=WEEKLY/i.test(a)?s("Weekly"):s("Custom schedule")}function G(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function J(t){return t.replace(/\/+$/,"").split("/").filter(Boolean).pop()??t}return(t,a)=>(c(),v("div",it,[e("div",lt,[e("div",rt,[e("span",null,n(m.value.length)+" "+n(i(s)("total")),1),e("span",null,n(O.value)+" "+n(i(s)("active")),1),e("span",null,n(W.value)+" "+n(i(s)("paused")),1)]),e("div",ct,[e("button",{class:"automations-create",type:"button",title:i(s)("Create a new automation"),onClick:q},n(i(s)("New automation")),9,dt),e("button",{class:"automations-refresh",type:"button",disabled:y.value,onClick:k},n(y.value?i(s)("Refreshing..."):i(s)("Refresh")),9,mt)])]),b.value?(c(),v("p",pt,n(b.value),1)):B("",!0),y.value&&m.value.length===0?(c(),v("div",vt,[U(A,{class:"automations-empty-icon"}),e("p",null,n(i(s)("Loading automations...")),1)])):m.value.length===0?(c(),v("div",ht,[U(A,{class:"automations-empty-icon"}),e("p",null,n(i(s)("No automations yet")),1),e("span",null,n(i(s)("Use a thread or project menu to add an automation.")),1)])):(c(),v("div",ft,[e("section",{class:"automations-list","aria-label":i(s)("Automations")},[(c(!0),v(et,null,ot(m.value,o=>(c(),v("div",{key:o.rowKey,class:st(["automation-row",{"is-selected":p.value===o.rowKey}]),role:"button",tabindex:"0",onClick:l=>C(o),onKeydown:[x(I(l=>C(o),["prevent"]),["enter"]),x(I(l=>C(o),["prevent"]),["space"])]},[e("span",{class:"automation-row-icon","data-status":o.automation.status},[o.automation.status==="PAUSED"?(c(),L(F,{key:0})):(c(),L(A,{key:1}))],8,bt),e("span",gt,[e("span",At,n(o.automation.name),1),e("span",Lt,n(o.scopeLabel)+" • "+n(o.targetLabel),1)]),e("span",Et,[e("span",{class:"automation-row-status","data-status":o.automation.status},n(T(o.automation.status)),9,kt),e("span",Ct,n(o.scheduleLabel),1)]),e("button",{class:"automation-edit-button",type:"button",onClick:I(l=>$(o),["stop"])},n(i(s)("Edit")),9,wt)],42,yt))),128))],8,_t),r.value?(c(),v("aside",{key:0,class:"automation-detail","aria-label":i(s)("Automation details")},[e("div",jt,[e("span",{class:"automation-detail-icon","data-status":r.value.automation.status},[r.value.automation.status==="PAUSED"?(c(),L(F,{key:0})):(c(),L(A,{key:1}))],8,Rt),e("div",Tt,[e("h2",null,n(r.value.automation.name),1),e("span",null,n(r.value.scopeLabel),1)]),e("button",{class:"automation-detail-edit",type:"button",onClick:a[0]||(a[0]=o=>$(r.value))},n(i(s)("Edit")),1)]),e("dl",$t,[e("div",null,[e("dt",null,n(i(s)("Status")),1),e("dd",null,n(T(r.value.automation.status)),1)]),e("div",null,[e("dt",null,n(i(s)("Schedule")),1),e("dd",null,n(r.value.scheduleLabel),1)]),e("div",null,[e("dt",null,n(i(s)("Target")),1),e("dd",{title:r.value.targetTitle},n(r.value.targetLabel),9,Kt)]),e("div",null,[a[1]||(a[1]=e("dt",null,"ID",-1)),e("dd",null,n(r.value.automation.id),1)])]),e("section",Mt,[e("h3",null,n(i(s)("Prompt")),1),e("p",null,n(r.value.automation.prompt),1)])],8,It)):B("",!0)]))]))}}),Dt=ut(Nt,[["__scopeId","data-v-44d1a098"]]);export{Dt as default};
1
+ import{d as X,q as f,l as w,M as Z,as as tt,at,o as c,a as v,b as e,t as n,u as i,e as B,g as U,au as A,F as et,r as ot,a2 as x,w as I,n as st,c as L,av as F,j as nt,k as _,_ as ut}from"./index-D7o45WlH.js";const it={class:"automations-panel"},lt={class:"automations-toolbar"},rt={class:"automations-summary"},ct={class:"automations-actions"},dt=["title"],mt=["disabled"],pt={key:0,class:"automations-error"},vt={key:1,class:"automations-empty"},ht={key:2,class:"automations-empty"},ft={key:3,class:"automations-layout"},_t=["aria-label"],yt=["onClick","onKeydown"],bt=["data-status"],gt={class:"automation-row-main"},At={class:"automation-row-title"},Lt={class:"automation-row-meta"},Et={class:"automation-row-side"},kt=["data-status"],Ct={class:"automation-row-schedule"},wt=["onClick"],It=["aria-label"],jt={class:"automation-detail-heading"},Rt=["data-status"],Tt={class:"automation-detail-title-wrap"},$t={class:"automation-detail-grid"},Kt=["title"],Mt={class:"automation-detail-prompt"},Nt=X({__name:"AutomationsPanel",props:{groups:{},projectCwdByName:{},projectDisplayNameById:{},selectedAutomationId:{}},emits:["select-automation","edit-automation","create-automation"],setup(V,{expose:Q,emit:Y}){const h=V,E=Y,j=f({}),R=f({}),{t:s}=nt(),y=f(!1),b=f(""),d=f(h.selectedAutomationId??""),p=f(""),z=_(()=>{const t=new Map;for(const a of h.groups)for(const o of a.threads)t.set(o.id,o.title);return t}),H=_(()=>{var a,o;const t=new Map;for(const l of h.groups){const u=(a=h.projectCwdByName[l.projectName])==null?void 0:a.trim(),g=((o=h.projectDisplayNameById[l.projectName])==null?void 0:o.trim())||l.projectName;u&&t.set(u,g)}return t}),m=_(()=>{const t=[];for(const[a,o]of Object.entries(j.value)){const l=z.value.get(a)??a;for(const u of o)t.push({rowKey:M("thread",a,u.id),automation:u,scope:"thread",scopeLabel:s("Heartbeat"),targetLabel:l,targetTitle:a,scheduleLabel:N(u)})}for(const[a,o]of Object.entries(R.value)){const l=H.value.get(a)??J(a);for(const u of o)t.push({rowKey:M("project",a,u.id),automation:u,scope:"project",scopeLabel:s("Project"),targetLabel:l,targetTitle:a,scheduleLabel:N(u)})}return t.sort((a,o)=>{const l=a.automation.status==="ACTIVE"?0:1,u=o.automation.status==="ACTIVE"?0:1;if(l!==u)return l-u;const g=a.automation.createdAtMs??0,P=o.automation.createdAtMs??0;if(g!==P)return P-g;const D=a.automation.updatedAtMs??0,S=o.automation.updatedAtMs??0;return D!==S?S-D:a.automation.name.localeCompare(o.automation.name)})}),O=_(()=>m.value.filter(t=>t.automation.status==="ACTIVE").length),W=_(()=>m.value.filter(t=>t.automation.status==="PAUSED").length),r=_(()=>m.value.find(t=>t.rowKey===p.value)??m.value.find(t=>t.automation.id===d.value)??m.value[0]??null);w(()=>h.selectedAutomationId,t=>{t&&(d.value=t,p.value=K(t))}),w(d,t=>{t&&E("select-automation",t)}),w(m,t=>{if(t.length===0){d.value="",p.value="";return}if(!(p.value&&t.some(a=>a.rowKey===p.value))){if(d.value&&t.some(a=>a.automation.id===d.value)){p.value=K(d.value);return}(!d.value||!t.some(a=>a.automation.id===d.value))&&(d.value=t[0].automation.id,p.value=t[0].rowKey)}}),Z(()=>{k()}),Q({loadAutomations:k});async function k(){y.value=!0,b.value="";try{const[t,a]=await Promise.all([tt(),at()]);j.value=t,R.value=a}catch(t){b.value=t instanceof Error?t.message:s("Failed to load automations")}finally{y.value=!1}}function T(t){return s(t==="PAUSED"?"Paused":"Active")}function $(t){E("edit-automation",{scope:t.scope,target:t.targetTitle,automation:t.automation})}function q(){E("create-automation")}function C(t){p.value=t.rowKey,d.value=t.automation.id}function K(t){var a;return((a=m.value.find(o=>o.automation.id===t))==null?void 0:a.rowKey)??""}function M(t,a,o){return`${t}:${a}:${o}`}function N(t){var o,l;if(t.status==="PAUSED")return s("Paused");if(t.nextRunAtMs)return`${s("Next")} ${G(t.nextRunAtMs)}`;const a=t.rrule.trim();if(/FREQ=MINUTELY/i.test(a)){const u=((o=/INTERVAL=(\d+)/i.exec(a))==null?void 0:o[1])??"1";return u==="1"?s("Every minute"):`${s("Every")} ${u} ${s("minutes")}`}if(/FREQ=HOURLY/i.test(a)){const u=((l=/INTERVAL=(\d+)/i.exec(a))==null?void 0:l[1])??"1";return u==="1"?s("Hourly"):`${s("Every")} ${u} ${s("hours")}`}return/FREQ=DAILY/i.test(a)?s("Daily"):/FREQ=WEEKLY/i.test(a)?s("Weekly"):s("Custom schedule")}function G(t){return new Date(t).toLocaleString(void 0,{month:"short",day:"numeric",hour:"numeric",minute:"2-digit"})}function J(t){return t.replace(/\/+$/,"").split("/").filter(Boolean).pop()??t}return(t,a)=>(c(),v("div",it,[e("div",lt,[e("div",rt,[e("span",null,n(m.value.length)+" "+n(i(s)("total")),1),e("span",null,n(O.value)+" "+n(i(s)("active")),1),e("span",null,n(W.value)+" "+n(i(s)("paused")),1)]),e("div",ct,[e("button",{class:"automations-create",type:"button",title:i(s)("Create a new automation"),onClick:q},n(i(s)("New automation")),9,dt),e("button",{class:"automations-refresh",type:"button",disabled:y.value,onClick:k},n(y.value?i(s)("Refreshing..."):i(s)("Refresh")),9,mt)])]),b.value?(c(),v("p",pt,n(b.value),1)):B("",!0),y.value&&m.value.length===0?(c(),v("div",vt,[U(A,{class:"automations-empty-icon"}),e("p",null,n(i(s)("Loading automations...")),1)])):m.value.length===0?(c(),v("div",ht,[U(A,{class:"automations-empty-icon"}),e("p",null,n(i(s)("No automations yet")),1),e("span",null,n(i(s)("Use a thread or project menu to add an automation.")),1)])):(c(),v("div",ft,[e("section",{class:"automations-list","aria-label":i(s)("Automations")},[(c(!0),v(et,null,ot(m.value,o=>(c(),v("div",{key:o.rowKey,class:st(["automation-row",{"is-selected":p.value===o.rowKey}]),role:"button",tabindex:"0",onClick:l=>C(o),onKeydown:[x(I(l=>C(o),["prevent"]),["enter"]),x(I(l=>C(o),["prevent"]),["space"])]},[e("span",{class:"automation-row-icon","data-status":o.automation.status},[o.automation.status==="PAUSED"?(c(),L(F,{key:0})):(c(),L(A,{key:1}))],8,bt),e("span",gt,[e("span",At,n(o.automation.name),1),e("span",Lt,n(o.scopeLabel)+" • "+n(o.targetLabel),1)]),e("span",Et,[e("span",{class:"automation-row-status","data-status":o.automation.status},n(T(o.automation.status)),9,kt),e("span",Ct,n(o.scheduleLabel),1)]),e("button",{class:"automation-edit-button",type:"button",onClick:I(l=>$(o),["stop"])},n(i(s)("Edit")),9,wt)],42,yt))),128))],8,_t),r.value?(c(),v("aside",{key:0,class:"automation-detail","aria-label":i(s)("Automation details")},[e("div",jt,[e("span",{class:"automation-detail-icon","data-status":r.value.automation.status},[r.value.automation.status==="PAUSED"?(c(),L(F,{key:0})):(c(),L(A,{key:1}))],8,Rt),e("div",Tt,[e("h2",null,n(r.value.automation.name),1),e("span",null,n(r.value.scopeLabel),1)]),e("button",{class:"automation-detail-edit",type:"button",onClick:a[0]||(a[0]=o=>$(r.value))},n(i(s)("Edit")),1)]),e("dl",$t,[e("div",null,[e("dt",null,n(i(s)("Status")),1),e("dd",null,n(T(r.value.automation.status)),1)]),e("div",null,[e("dt",null,n(i(s)("Schedule")),1),e("dd",null,n(r.value.scheduleLabel),1)]),e("div",null,[e("dt",null,n(i(s)("Target")),1),e("dd",{title:r.value.targetTitle},n(r.value.targetLabel),9,Kt)]),e("div",null,[a[1]||(a[1]=e("dt",null,"ID",-1)),e("dd",null,n(r.value.automation.id),1)])]),e("section",Mt,[e("h3",null,n(i(s)("Prompt")),1),e("p",null,n(r.value.automation.prompt),1)])],8,It)):B("",!0)]))]))}}),Dt=ut(Nt,[["__scopeId","data-v-44d1a098"]]);export{Dt as default};