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 +214 -278
- package/dist/assets/{AutomationsPanel-CIkRctDa.js → AutomationsPanel-DPyx78VB.js} +1 -1
- package/dist/assets/{DirectoryHub-C5Qmidrq.js → DirectoryHub-qdoRipfo.js} +1 -1
- package/dist/assets/{ReviewPane-Bdgmw-KX.js → ReviewPane-d8B-VWFC.js} +1 -1
- package/dist/assets/ThreadConversation-BSeUPSAG.css +1 -0
- package/dist/assets/{ThreadConversation-B7LoyUC8.js → ThreadConversation-CfozD14u.js} +2 -2
- package/dist/assets/{ThreadTerminalPanel-BPKHKJzQ.js → ThreadTerminalPanel-hWwS8_eX.js} +1 -1
- package/dist/assets/{index-CL3S5U3K.js → index-D7o45WlH.js} +3 -3
- package/dist/assets/{index-BMqNqaVq.css → index-Dbxv7TvZ.css} +1 -1
- package/dist/index.html +2 -2
- package/package.json +1 -1
- package/dist/assets/ThreadConversation-DABmfqIb.css +0 -1
package/README.md
CHANGED
|
@@ -1,278 +1,214 @@
|
|
|
1
|
-
# 🔥
|
|
2
|
-
|
|
3
|
-
### 🚀 Run Codex App UI Anywhere: Linux, Windows, or Termux on Android 🚀
|
|
4
|
-
|
|
5
|
-
[](#-quick-start)
|
|
7
|
-
[](https://nodejs.org/)
|
|
8
|
-
[](./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
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
#
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
pkg
|
|
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
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
-
|
|
183
|
-
-
|
|
184
|
-
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
### Chat
|
|
217
|
-

|
|
218
|
-
|
|
219
|
-
### Mobile UI
|
|
220
|
-

|
|
221
|
-

|
|
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
|
+
[](https://www.npmjs.com/package/codex-mobile-re)
|
|
6
|
+
[](#-quick-start)
|
|
7
|
+
[](https://nodejs.org/)
|
|
8
|
+
[](./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-
|
|
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};
|