aicodeman 1.1.2 → 1.1.4
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/web/public/api-client.c9b1cddc.js.gz +0 -0
- package/dist/web/public/{app.eaa14cdd.js → app.6b133aaf.js} +5 -5
- package/dist/web/public/app.6b133aaf.js.br +0 -0
- package/dist/web/public/app.6b133aaf.js.gz +0 -0
- package/dist/web/public/constants.1c779517.js.gz +0 -0
- package/dist/web/public/image-input.0ea86695.js.gz +0 -0
- package/dist/web/public/index.html +13 -5
- package/dist/web/public/index.html.br +0 -0
- package/dist/web/public/index.html.gz +0 -0
- package/dist/web/public/input-cjk.b8686b5e.js.gz +0 -0
- package/dist/web/public/keyboard-accessory.bc753cc7.js.gz +0 -0
- package/dist/web/public/mobile-handlers.db3dc3c8.js.gz +0 -0
- package/dist/web/public/mobile.06b38d3a.css.gz +0 -0
- package/dist/web/public/notification-manager.9c984ac2.js.gz +0 -0
- package/dist/web/public/orchestrator-panel.js.gz +0 -0
- package/dist/web/public/panels-ui.f3f08e26.js.gz +0 -0
- package/dist/web/public/ralph-panel.6de2d0f8.js.gz +0 -0
- package/dist/web/public/ralph-wizard.13a1831e.js.gz +0 -0
- package/dist/web/public/respawn-ui.2d249da9.js.gz +0 -0
- package/dist/web/public/sanitize-html.bc7078d6.js.gz +0 -0
- package/dist/web/public/session-ui.1463b824.js.gz +0 -0
- package/dist/web/public/settings-ui.08f7708b.js +55 -0
- package/dist/web/public/settings-ui.08f7708b.js.br +0 -0
- package/dist/web/public/settings-ui.08f7708b.js.gz +0 -0
- package/dist/web/public/{styles.7e612fc4.css → styles.379f31e0.css} +1 -1
- package/dist/web/public/styles.379f31e0.css.br +0 -0
- package/dist/web/public/styles.379f31e0.css.gz +0 -0
- package/dist/web/public/{subagent-windows.a366a4ad.js → subagent-windows.07e139f2.js} +9 -0
- package/dist/web/public/subagent-windows.07e139f2.js.br +0 -0
- package/dist/web/public/subagent-windows.07e139f2.js.gz +0 -0
- package/dist/web/public/sw.js.gz +0 -0
- package/dist/web/public/terminal-ui.a7e046da.js.gz +0 -0
- package/dist/web/public/ultracode-panel.js +10 -0
- package/dist/web/public/ultracode-panel.js.br +0 -0
- package/dist/web/public/ultracode-panel.js.gz +0 -0
- package/dist/web/public/ultracode-windows.js +382 -0
- package/dist/web/public/ultracode-windows.js.br +0 -0
- package/dist/web/public/ultracode-windows.js.gz +0 -0
- package/dist/web/public/upload.html.gz +0 -0
- package/dist/web/public/vendor/dompurify.min.js.gz +0 -0
- package/dist/web/public/vendor/marked.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-fit.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-serialize.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-unicode11.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-addon-webgl.min.js.gz +0 -0
- package/dist/web/public/vendor/xterm-zerolag-input.137ad9f0.js.gz +0 -0
- package/dist/web/public/vendor/xterm.css.gz +0 -0
- package/dist/web/public/vendor/xterm.min.js.gz +0 -0
- package/dist/web/public/voice-input.085e9e73.js.gz +0 -0
- package/dist/web/routes/system-routes.d.ts.map +1 -1
- package/dist/web/routes/system-routes.js +4 -2
- package/dist/web/routes/system-routes.js.map +1 -1
- package/dist/web/schemas.d.ts +1 -0
- package/dist/web/schemas.d.ts.map +1 -1
- package/dist/web/schemas.js +2 -0
- package/dist/web/schemas.js.map +1 -1
- package/dist/web/server.d.ts +2 -0
- package/dist/web/server.d.ts.map +1 -1
- package/dist/web/server.js +3 -1
- package/dist/web/server.js.map +1 -1
- package/dist/workflow-run-watcher.d.ts +50 -12
- package/dist/workflow-run-watcher.d.ts.map +1 -1
- package/dist/workflow-run-watcher.js +205 -37
- package/dist/workflow-run-watcher.js.map +1 -1
- package/package.json +1 -1
- package/dist/web/public/app.eaa14cdd.js.br +0 -0
- package/dist/web/public/app.eaa14cdd.js.gz +0 -0
- package/dist/web/public/settings-ui.601c30c1.js +0 -55
- package/dist/web/public/settings-ui.601c30c1.js.br +0 -0
- package/dist/web/public/settings-ui.601c30c1.js.gz +0 -0
- package/dist/web/public/styles.7e612fc4.css.br +0 -0
- package/dist/web/public/styles.7e612fc4.css.gz +0 -0
- package/dist/web/public/subagent-windows.a366a4ad.js.br +0 -0
- package/dist/web/public/subagent-windows.a366a4ad.js.gz +0 -0
|
@@ -1,19 +1,33 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @fileoverview Workflow (ultracode) Run Watcher
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
* the
|
|
6
|
-
*
|
|
7
|
-
* LEFT, per-agent tokens/tool-calls on the RIGHT).
|
|
4
|
+
* Emits events powering the master-detail "working agents" view (tasks/phases on
|
|
5
|
+
* the LEFT, per-agent tokens/tool-calls on the RIGHT) AND the floating run
|
|
6
|
+
* windows, from TWO disk sources per run:
|
|
8
7
|
*
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
* the
|
|
12
|
-
*
|
|
8
|
+
* 1. COMPLETION artifact — `…/workflows/wf_<id>.json`. The Workflow runtime
|
|
9
|
+
* writes this with the FULL run state (phases, per-agent tokens/tool-calls,
|
|
10
|
+
* result), but — as of the mid-2026 runtime — only when the run FINISHES
|
|
11
|
+
* (always a terminal status). It is the authoritative, detailed record.
|
|
12
|
+
* 2. LIVE transcript dir — `…/subagents/workflows/wf_<id>/` (agent-*.jsonl +
|
|
13
|
+
* journal.jsonl). This appears WHILE a run is in flight, before any
|
|
14
|
+
* `wf_<id>.json` exists. From it we synthesize a minimal ACTIVE run
|
|
15
|
+
* (status 'running', agent slots keyed by agentId, lastActivityAt from file
|
|
16
|
+
* mtimes) so the floating window pops DURING the run instead of only after.
|
|
17
|
+
*
|
|
18
|
+
* Precedence: when a completion `wf_<id>.json` exists it ALWAYS supersedes the
|
|
19
|
+
* synthesized live record (same runId), so a finished run shows full detail and
|
|
20
|
+
* the normal finish→auto-close flow runs. Without source 2 the floating-window
|
|
21
|
+
* feature is dead for live runs (the completion file only lands at the end, so
|
|
22
|
+
* the watcher would never see a run while it is active).
|
|
23
|
+
*
|
|
24
|
+
* Still STANDALONE: it never imports from or touches subagent-watcher.ts. It
|
|
25
|
+
* independently reads the same `subagents/workflows/` tree subagent-watcher uses,
|
|
26
|
+
* but as a separate singleton with no shared mutable state.
|
|
13
27
|
*
|
|
14
28
|
* Discovery is dual: a periodic poll (catches new run dirs + removals) plus a
|
|
15
|
-
* per-
|
|
16
|
-
*
|
|
29
|
+
* per-dir chokidar watcher (live updates). A per-source mtime skip keeps the hot
|
|
30
|
+
* path cheap — the completion JSON / live dir is re-read only when its mtime moves.
|
|
17
31
|
*
|
|
18
32
|
* @module workflow-run-watcher
|
|
19
33
|
*/
|
|
@@ -25,8 +39,11 @@ import { watch as chokidarWatch } from 'chokidar';
|
|
|
25
39
|
import { LRUMap } from './utils/lru-map.js';
|
|
26
40
|
import { WORKFLOW_RUN_POLL_INTERVAL_MS, MAX_CACHED_WORKFLOW_RUNS, WORKFLOW_RUN_RECENT_WINDOW_MIN, } from './config/workflow-config.js';
|
|
27
41
|
const WORKFLOWS_SUBDIR = 'workflows';
|
|
42
|
+
const SUBAGENTS_SUBDIR = 'subagents';
|
|
28
43
|
const RUN_FILE_PREFIX = 'wf_';
|
|
29
44
|
const RUN_FILE_SUFFIX = '.json';
|
|
45
|
+
const LIVE_JOURNAL_FILE = 'journal.jsonl';
|
|
46
|
+
const LIVE_AGENT_PREFIX = 'agent-';
|
|
30
47
|
/** Hard caps on the largest per-agent strings so a 28-agent run stays compact. */
|
|
31
48
|
const PROMPT_PREVIEW_MAX = 200;
|
|
32
49
|
const RESULT_PREVIEW_MAX = 240;
|
|
@@ -51,7 +68,11 @@ export class WorkflowRunWatcher extends EventEmitter {
|
|
|
51
68
|
fileMtimes = new Map();
|
|
52
69
|
/** runId -> absolute run-file path (for mtime cleanup on removal). */
|
|
53
70
|
runIdToPath = new Map();
|
|
54
|
-
/**
|
|
71
|
+
/** absolute live transcript-dir path -> newest member mtimeMs (skip unchanged live runs). */
|
|
72
|
+
liveDirMtimes = new Map();
|
|
73
|
+
/** runId -> absolute live transcript-dir path (for mtime cleanup on removal). */
|
|
74
|
+
runIdToLiveDir = new Map();
|
|
75
|
+
/** watched-dir absolute path -> chokidar watcher (workflows/ + subagents/workflows/). */
|
|
55
76
|
dirWatchers = new Map();
|
|
56
77
|
constructor(projectsDir) {
|
|
57
78
|
super();
|
|
@@ -82,6 +103,8 @@ export class WorkflowRunWatcher extends EventEmitter {
|
|
|
82
103
|
this.runs.clear();
|
|
83
104
|
this.fileMtimes.clear();
|
|
84
105
|
this.runIdToPath.clear();
|
|
106
|
+
this.liveDirMtimes.clear();
|
|
107
|
+
this.runIdToLiveDir.clear();
|
|
85
108
|
}
|
|
86
109
|
/** All cached runs (no recency filter), most-recently-active first. */
|
|
87
110
|
getAllRuns() {
|
|
@@ -125,20 +148,30 @@ export class WorkflowRunWatcher extends EventEmitter {
|
|
|
125
148
|
});
|
|
126
149
|
}
|
|
127
150
|
async pollAsync() {
|
|
128
|
-
const { files,
|
|
129
|
-
// Install a live watcher for each
|
|
130
|
-
for (const dir of
|
|
151
|
+
const { files, liveDirs, watchDirs } = await this.discover();
|
|
152
|
+
// Install a live watcher for each watched dir; tear down watchers for dirs that vanished.
|
|
153
|
+
for (const dir of watchDirs)
|
|
131
154
|
this.ensureDirWatcher(dir);
|
|
132
155
|
for (const dir of Array.from(this.dirWatchers.keys())) {
|
|
133
|
-
if (!
|
|
156
|
+
if (!watchDirs.has(dir))
|
|
134
157
|
this.removeDirWatcher(dir);
|
|
135
158
|
}
|
|
136
159
|
const seenRunIds = new Set();
|
|
160
|
+
const realRunIds = new Set();
|
|
137
161
|
for (const file of files) {
|
|
138
162
|
seenRunIds.add(file.runId);
|
|
163
|
+
realRunIds.add(file.runId);
|
|
139
164
|
await this.maybeParse(file);
|
|
140
165
|
}
|
|
141
|
-
//
|
|
166
|
+
// In-flight runs: synthesize from the transcript tree ONLY while no completion
|
|
167
|
+
// wf_*.json exists yet — the real file (full detail + terminal status) supersedes.
|
|
168
|
+
for (const live of liveDirs) {
|
|
169
|
+
if (realRunIds.has(live.runId))
|
|
170
|
+
continue;
|
|
171
|
+
seenRunIds.add(live.runId);
|
|
172
|
+
await this.maybeParseLive(live);
|
|
173
|
+
}
|
|
174
|
+
// Removal by set-diff: a cached run discoverable from neither source.
|
|
142
175
|
for (const runId of Array.from(this.runs.keys())) {
|
|
143
176
|
if (!seenRunIds.has(runId)) {
|
|
144
177
|
this.runs.delete(runId);
|
|
@@ -146,20 +179,30 @@ export class WorkflowRunWatcher extends EventEmitter {
|
|
|
146
179
|
if (path)
|
|
147
180
|
this.fileMtimes.delete(path);
|
|
148
181
|
this.runIdToPath.delete(runId);
|
|
182
|
+
const liveDir = this.runIdToLiveDir.get(runId);
|
|
183
|
+
if (liveDir)
|
|
184
|
+
this.liveDirMtimes.delete(liveDir);
|
|
185
|
+
this.runIdToLiveDir.delete(runId);
|
|
149
186
|
this.emit('run_removed', { runId });
|
|
150
187
|
}
|
|
151
188
|
}
|
|
152
189
|
}
|
|
153
|
-
/**
|
|
190
|
+
/**
|
|
191
|
+
* Walk projects/<projHash>/<sessionUuid>/ for both run sources:
|
|
192
|
+
* - completion files: `workflows/wf_*.json`
|
|
193
|
+
* - in-flight runs: `subagents/workflows/wf_<id>/` (transcript dirs)
|
|
194
|
+
* Returns the dirs to chokidar-watch (so a new run/file is caught sub-poll).
|
|
195
|
+
*/
|
|
154
196
|
async discover() {
|
|
155
197
|
const files = [];
|
|
156
|
-
const
|
|
198
|
+
const liveDirs = [];
|
|
199
|
+
const watchDirs = new Set();
|
|
157
200
|
let projectHashes;
|
|
158
201
|
try {
|
|
159
202
|
projectHashes = await readdir(this.projectsDir);
|
|
160
203
|
}
|
|
161
204
|
catch {
|
|
162
|
-
return { files,
|
|
205
|
+
return { files, liveDirs, watchDirs };
|
|
163
206
|
}
|
|
164
207
|
for (const projectHash of projectHashes) {
|
|
165
208
|
let sessions;
|
|
@@ -170,31 +213,54 @@ export class WorkflowRunWatcher extends EventEmitter {
|
|
|
170
213
|
continue;
|
|
171
214
|
}
|
|
172
215
|
for (const sessionUuid of sessions) {
|
|
173
|
-
const
|
|
174
|
-
|
|
216
|
+
const sessionDir = join(this.projectsDir, projectHash, sessionUuid);
|
|
217
|
+
// (1) Completion artifacts: workflows/wf_*.json
|
|
218
|
+
const workflowsDir = join(sessionDir, WORKFLOWS_SUBDIR);
|
|
175
219
|
try {
|
|
176
|
-
names = await readdir(workflowsDir);
|
|
220
|
+
const names = await readdir(workflowsDir);
|
|
221
|
+
let hasRun = false;
|
|
222
|
+
for (const name of names) {
|
|
223
|
+
if (!name.startsWith(RUN_FILE_PREFIX) || !name.endsWith(RUN_FILE_SUFFIX))
|
|
224
|
+
continue;
|
|
225
|
+
hasRun = true;
|
|
226
|
+
files.push({
|
|
227
|
+
filePath: join(workflowsDir, name),
|
|
228
|
+
projectHash,
|
|
229
|
+
sessionUuid,
|
|
230
|
+
runId: name.slice(0, -RUN_FILE_SUFFIX.length),
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
if (hasRun)
|
|
234
|
+
watchDirs.add(workflowsDir);
|
|
177
235
|
}
|
|
178
236
|
catch {
|
|
179
|
-
|
|
237
|
+
// no workflows dir for this session — normal
|
|
180
238
|
}
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
239
|
+
// (2) In-flight runs: subagents/workflows/wf_*/
|
|
240
|
+
const liveParent = join(sessionDir, SUBAGENTS_SUBDIR, WORKFLOWS_SUBDIR);
|
|
241
|
+
try {
|
|
242
|
+
const names = await readdir(liveParent);
|
|
243
|
+
let hasLive = false;
|
|
244
|
+
for (const name of names) {
|
|
245
|
+
if (!name.startsWith(RUN_FILE_PREFIX) || name.endsWith(RUN_FILE_SUFFIX))
|
|
246
|
+
continue; // wf_<id> dir, not a file
|
|
247
|
+
hasLive = true;
|
|
248
|
+
liveDirs.push({
|
|
249
|
+
dirPath: join(liveParent, name),
|
|
250
|
+
projectHash,
|
|
251
|
+
sessionUuid,
|
|
252
|
+
runId: name,
|
|
253
|
+
});
|
|
254
|
+
}
|
|
255
|
+
if (hasLive)
|
|
256
|
+
watchDirs.add(liveParent);
|
|
257
|
+
}
|
|
258
|
+
catch {
|
|
259
|
+
// no subagents/workflows dir for this session — normal
|
|
192
260
|
}
|
|
193
|
-
if (hasRun)
|
|
194
|
-
dirs.add(workflowsDir);
|
|
195
261
|
}
|
|
196
262
|
}
|
|
197
|
-
return { files,
|
|
263
|
+
return { files, liveDirs, watchDirs };
|
|
198
264
|
}
|
|
199
265
|
async maybeParse(file) {
|
|
200
266
|
let mtime;
|
|
@@ -215,6 +281,105 @@ export class WorkflowRunWatcher extends EventEmitter {
|
|
|
215
281
|
this.runIdToPath.set(info.runId, file.filePath);
|
|
216
282
|
this.emit(existed ? 'run_updated' : 'run_discovered', info);
|
|
217
283
|
}
|
|
284
|
+
/**
|
|
285
|
+
* Re-synthesize an in-flight run from its transcript dir when its newest member
|
|
286
|
+
* mtime moved (skip otherwise so we don't re-emit run_updated on idle polls).
|
|
287
|
+
*/
|
|
288
|
+
async maybeParseLive(live) {
|
|
289
|
+
const info = await this.parseLiveDir(live);
|
|
290
|
+
if (!info)
|
|
291
|
+
return;
|
|
292
|
+
if (this.liveDirMtimes.get(live.dirPath) === info.lastActivityAt)
|
|
293
|
+
return;
|
|
294
|
+
this.liveDirMtimes.set(live.dirPath, info.lastActivityAt);
|
|
295
|
+
const existed = this.runs.has(info.runId);
|
|
296
|
+
this.runs.set(info.runId, info);
|
|
297
|
+
this.runIdToLiveDir.set(info.runId, live.dirPath);
|
|
298
|
+
this.emit(existed ? 'run_updated' : 'run_discovered', info);
|
|
299
|
+
}
|
|
300
|
+
/**
|
|
301
|
+
* Build a minimal ACTIVE WorkflowRunInfo from `subagents/workflows/wf_<id>/`.
|
|
302
|
+
* The transcript tree carries no phases/tokens — those arrive with the
|
|
303
|
+
* completion wf_*.json — so we expose: the agent slots (keyed by agentId, so the
|
|
304
|
+
* card→transcript click still works), each marked done/running from journal
|
|
305
|
+
* `result` lines, and lastActivityAt from the newest agent/journal mtime.
|
|
306
|
+
*/
|
|
307
|
+
async parseLiveDir(live) {
|
|
308
|
+
let entries;
|
|
309
|
+
try {
|
|
310
|
+
entries = await readdir(live.dirPath);
|
|
311
|
+
}
|
|
312
|
+
catch {
|
|
313
|
+
return null; // vanished between discover and read
|
|
314
|
+
}
|
|
315
|
+
const agentIds = new Set();
|
|
316
|
+
let newestMtime = 0;
|
|
317
|
+
for (const name of entries) {
|
|
318
|
+
if (name.startsWith(LIVE_AGENT_PREFIX)) {
|
|
319
|
+
const stem = name.slice(LIVE_AGENT_PREFIX.length).replace(/\.(meta\.json|jsonl)$/, '');
|
|
320
|
+
if (stem)
|
|
321
|
+
agentIds.add(stem);
|
|
322
|
+
}
|
|
323
|
+
if (name === LIVE_JOURNAL_FILE || name.startsWith(LIVE_AGENT_PREFIX)) {
|
|
324
|
+
try {
|
|
325
|
+
const m = (await stat(join(live.dirPath, name))).mtimeMs;
|
|
326
|
+
if (m > newestMtime)
|
|
327
|
+
newestMtime = m;
|
|
328
|
+
}
|
|
329
|
+
catch {
|
|
330
|
+
// entry vanished — ignore
|
|
331
|
+
}
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
if (agentIds.size === 0)
|
|
335
|
+
return null; // nothing to show yet
|
|
336
|
+
const doneIds = await this.readJournalDoneAgents(join(live.dirPath, LIVE_JOURNAL_FILE));
|
|
337
|
+
const agents = Array.from(agentIds)
|
|
338
|
+
.sort()
|
|
339
|
+
.map((id, i) => ({
|
|
340
|
+
index: i + 1,
|
|
341
|
+
label: `agent ${i + 1}`,
|
|
342
|
+
phaseIndex: 1,
|
|
343
|
+
phaseTitle: '',
|
|
344
|
+
model: '',
|
|
345
|
+
state: doneIds.has(id) ? 'done' : 'progress',
|
|
346
|
+
agentId: id,
|
|
347
|
+
}));
|
|
348
|
+
return {
|
|
349
|
+
runId: live.runId,
|
|
350
|
+
status: 'running',
|
|
351
|
+
agentCount: agents.length,
|
|
352
|
+
phases: [],
|
|
353
|
+
agents,
|
|
354
|
+
sessionUuid: live.sessionUuid,
|
|
355
|
+
projectHash: live.projectHash,
|
|
356
|
+
lastActivityAt: newestMtime || 0,
|
|
357
|
+
};
|
|
358
|
+
}
|
|
359
|
+
/** Agent ids that already emitted a `result` event in the run journal. */
|
|
360
|
+
async readJournalDoneAgents(journalPath) {
|
|
361
|
+
const done = new Set();
|
|
362
|
+
let text;
|
|
363
|
+
try {
|
|
364
|
+
text = await readFile(journalPath, 'utf-8');
|
|
365
|
+
}
|
|
366
|
+
catch {
|
|
367
|
+
return done; // journal not written yet — all agents still in progress
|
|
368
|
+
}
|
|
369
|
+
for (const line of text.split('\n')) {
|
|
370
|
+
if (!line)
|
|
371
|
+
continue;
|
|
372
|
+
try {
|
|
373
|
+
const ev = JSON.parse(line);
|
|
374
|
+
if (ev && ev.type === 'result' && typeof ev.agentId === 'string')
|
|
375
|
+
done.add(ev.agentId);
|
|
376
|
+
}
|
|
377
|
+
catch {
|
|
378
|
+
// tolerate a partially-written trailing line
|
|
379
|
+
}
|
|
380
|
+
}
|
|
381
|
+
return done;
|
|
382
|
+
}
|
|
218
383
|
/**
|
|
219
384
|
* Parse a wf_<runId>.json into WorkflowRunInfo, STRIPPING the heavyweight
|
|
220
385
|
* `script`/`scriptPath`/`result`/`logs` fields (the embedded script alone is
|
|
@@ -304,6 +469,9 @@ export class WorkflowRunWatcher extends EventEmitter {
|
|
|
304
469
|
watcher.on('add', handler);
|
|
305
470
|
watcher.on('change', handler);
|
|
306
471
|
watcher.on('unlink', handler);
|
|
472
|
+
// subagents/workflows/ children are wf_<id>/ DIRS — catch their add/remove too.
|
|
473
|
+
watcher.on('addDir', handler);
|
|
474
|
+
watcher.on('unlinkDir', handler);
|
|
307
475
|
watcher.on('error', () => {
|
|
308
476
|
// chokidar surfaced an error for this dir — drop the watcher; poll still covers it.
|
|
309
477
|
this.removeDirWatcher(workflowsDir);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"workflow-run-watcher.js","sourceRoot":"","sources":["../src/workflow-run-watcher.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;GAkBG;AAEH,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EAAE,KAAK,IAAI,aAAa,EAAqC,MAAM,UAAU,CAAC;AAGrF,OAAO,EAAE,MAAM,EAAE,MAAM,oBAAoB,CAAC;AAC5C,OAAO,EACL,6BAA6B,EAC7B,wBAAwB,EACxB,8BAA8B,GAC/B,MAAM,6BAA6B,CAAC;AAErC,MAAM,gBAAgB,GAAG,WAAW,CAAC;AACrC,MAAM,eAAe,GAAG,KAAK,CAAC;AAC9B,MAAM,eAAe,GAAG,OAAO,CAAC;AAEhC,kFAAkF;AAClF,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAC/B,MAAM,kBAAkB,GAAG,GAAG,CAAC;AAE/B,SAAS,QAAQ,CAAC,KAAyB,EAAE,GAAW;IACtD,IAAI,OAAO,KAAK,KAAK,QAAQ;QAAE,OAAO,SAAS,CAAC;IAChD,OAAO,KAAK,CAAC,MAAM,GAAG,GAAG,CAAC,CAAC,CAAC,GAAG,KAAK,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,GAAG,CAAC,CAAC,CAAC,KAAK,CAAC;AAChE,CAAC;AAED,uDAAuD;AACvD,MAAM,UAAU,YAAY,CAAC,IAAqB;IAChD,MAAM,EAA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,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,EAAE,OAAO,CAAC,CAAC;QAC9C,CAAC;QAAC,MAAM,CAAC;YACP,8DAA8D;QAChE,CAAC;IACH,CAAC;IAEO,gBAAgB,CAAC,YAAoB;QAC3C,MAAM,OAAO,GAAG,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;QACnD,IAAI,OAAO,EAAE,CAAC;YACZ,OAAO,CAAC,KAAK,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAC;YAChC,IAAI,CAAC,WAAW,CAAC,MAAM,CAAC,YAAY,CAAC,CAAC;QACxC,CAAC;IACH,CAAC;CACF;AAED,uEAAuE;AACvE,MAAM,CAAC,MAAM,kBAAkB,GAAG,IAAI,kBAAkB,EAAE,CAAC"}
|
package/package.json
CHANGED
|
Binary file
|
|
Binary file
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
"use strict";Object.assign(CodemanApp.prototype,{_onHookIdlePrompt(e){e.sessionId&&this.setPendingHook(e.sessionId,"idle_prompt"),this._notifySession(e.sessionId,"warning","hook-idle","Waiting for Input",e.message||"Claude is idle and waiting for a prompt")},_onHookPermissionPrompt(e){e.sessionId&&this.setPendingHook(e.sessionId,"permission_prompt");const t=e.tool?`${e.tool}${e.command?": "+e.command:e.file?": "+e.file:""}`:"";this._notifySession(e.sessionId,"critical","hook-permission","Permission Required",t||"Claude needs tool approval to continue")},_onHookElicitationDialog(e){e.sessionId&&this.setPendingHook(e.sessionId,"elicitation_dialog"),this._notifySession(e.sessionId,"critical","hook-elicitation","Question Asked",e.question||"Claude is asking a question and waiting for your answer")},_onHookStop(e){e.sessionId&&this.clearPendingHooks(e.sessionId),this._notifySession(e.sessionId,"info","hook-stop","Response Complete",e.reason||"Claude has finished responding")},_onHookTeammateIdle(e){const t=this.sessions.get(e.sessionId);this._notifySession(e.sessionId,"warning","hook-teammate-idle","Teammate Idle",`A teammate is idle in ${t?.name||e.sessionId}`)},_onHookTaskCompleted(e){const t=this.sessions.get(e.sessionId);this._notifySession(e.sessionId,"info","hook-task-completed","Task Completed",`A team task completed in ${t?.name||e.sessionId}`)},_onTunnelStarted(e){console.log("[Tunnel] Started:",e.url),this._tunnelUrl=e.url,this._dismissTunnelConnecting(),this._updateTunnelUrlDisplay(e.url),this._updateTunnelIndicator(!0),document.getElementById("welcomeOverlay")?.classList.contains("visible")?(this._updateWelcomeTunnelBtn(!0,e.url,!0),this.showToast("Tunnel active","success")):(this._updateWelcomeTunnelBtn(!0,e.url),this.showToast(`Tunnel active: ${e.url}`,"success"),this.showTunnelQR())},_onTunnelStopped(){console.log("[Tunnel] Stopped"),this._tunnelUrl=null,this._dismissTunnelConnecting(),this._updateTunnelUrlDisplay(null),this._updateWelcomeTunnelBtn(!1),this._updateTunnelIndicator(!1),this.closeTunnelPanel(),this.closeTunnelQR()},_onTunnelProgress(e){console.log("[Tunnel] Progress:",e.message);const t=document.getElementById("tunnelConnectingToast");t&&(t.innerHTML=`<span class="tunnel-spinner"></span> ${e.message}`);const n=document.getElementById("welcomeTunnelBtn");n?.classList.contains("connecting")&&(n.innerHTML=`<span class="tunnel-spinner"></span> ${e.message}`)},_onTunnelError(e){console.warn("[Tunnel] Error:",e.message),this._dismissTunnelConnecting(),this.showToast(`Tunnel error: ${e.message}`,"error");const t=document.getElementById("welcomeTunnelBtn");t&&(t.disabled=!1,t.classList.remove("connecting"))},_onTunnelQrRotated(e){if(e.svg){const t=document.getElementById("tunnelQrContainer");t&&(t.innerHTML=e.svg);const n=document.getElementById("welcomeQrInner");n&&(n.innerHTML=e.svg)}else this._refreshTunnelQrFromApi();this._resetQrCountdown()},_onTunnelQrRegenerated(e){if(e.svg){const t=document.getElementById("tunnelQrContainer");t&&(t.innerHTML=e.svg);const n=document.getElementById("welcomeQrInner");n&&(n.innerHTML=e.svg)}else this._refreshTunnelQrFromApi();this._resetQrCountdown()},_onTunnelQrAuthUsed(e){const n=(e.ua||"Unknown device").match(/Chrome|Firefox|Safari|Edge|Mobile/)?.[0]||"Browser";this.showToast(`Device authenticated via QR (${n}, ${e.ip}). Not you?`,"warning",{duration:1e4,action:{label:"Revoke All",onClick:()=>{fetch("/api/auth/revoke",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}).then(()=>this.showToast("All sessions revoked","success")).catch(()=>this.showToast("Failed to revoke sessions","error"))}}})},registerServiceWorker(){"serviceWorker"in navigator&&navigator.serviceWorker.register("/sw.js").then(e=>{this._swRegistration=e,navigator.serviceWorker.addEventListener("message",t=>{if(t.data?.type==="notification-click"){const{sessionId:n}=t.data;n&&this.sessions.has(n)&&this.selectSession(n),window.focus()}}),e.pushManager.getSubscription().then(t=>{t&&(this._pushSubscription=t,this._updatePushUI(!0))})}).catch(()=>{})},async subscribeToPush(){if(!this._swRegistration){this.showToast("Service worker not available. HTTPS or localhost required.","error");return}try{const e=await this._apiJson("/api/push/vapid-key");if(!e)throw new Error("Failed to get VAPID key");const t=urlBase64ToUint8Array(e.publicKey),n=await this._swRegistration.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:t}),s=n.toJSON(),o=await this._apiJson("/api/push/subscribe",{method:"POST",body:{endpoint:s.endpoint,keys:s.keys,userAgent:navigator.userAgent,pushPreferences:this._buildPushPreferences()}});if(!o)throw new Error("Failed to register subscription");this._pushSubscription=n,this._pushSubscriptionId=o.id,localStorage.setItem("codeman-push-subscription-id",o.id),this._updatePushUI(!0),this.showToast("Push notifications enabled","success")}catch(e){this.showToast("Push subscription failed: "+(e.message||e),"error")}},async unsubscribeFromPush(){try{this._pushSubscription&&await this._pushSubscription.unsubscribe();const e=this._pushSubscriptionId||localStorage.getItem("codeman-push-subscription-id");e&&await fetch(`/api/push/subscribe/${e}`,{method:"DELETE"}).catch(()=>{}),this._pushSubscription=null,this._pushSubscriptionId=null,localStorage.removeItem("codeman-push-subscription-id"),this._updatePushUI(!1),this.showToast("Push notifications disabled","success")}catch(e){this.showToast("Failed to unsubscribe: "+(e.message||e),"error")}},async togglePushSubscription(){this._pushSubscription?await this.unsubscribeFromPush():await this.subscribeToPush()},async _syncPushPreferences(){const e=this._pushSubscriptionId||localStorage.getItem("codeman-push-subscription-id");if(e)try{await fetch(`/api/push/subscribe/${e}`,{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({pushPreferences:this._buildPushPreferences()})})}catch{}},_buildPushPreferences(){const e={},t={"hook:permission_prompt":"eventPermissionPush","hook:elicitation_dialog":"eventQuestionPush","hook:idle_prompt":"eventIdlePush","hook:stop":"eventStopPush","respawn:blocked":"eventRespawnPush","session:ralphCompletionDetected":"eventRalphPush"};for(const[n,s]of Object.entries(t)){const o=document.getElementById(s);e[n]=o?o.checked:!0}return e["session:error"]=!0,e},_updatePushUI(e){const t=document.getElementById("pushSubscribeBtn"),n=document.getElementById("pushSubscriptionStatus");t&&(t.textContent=e?"Unsubscribe":"Subscribe"),n&&(n.textContent=e?"active":"off",n.classList.remove("granted","denied"),e&&n.classList.add("granted"))},openAppSettings(){const e=this.loadAppSettingsFromStorage();document.getElementById("appSettingsClaudeMdPath").value=e.defaultClaudeMdPath||"",document.getElementById("appSettingsDefaultDir").value=e.defaultWorkingDir||"";const t=this.getDefaultSettings();document.getElementById("appSettingsRalphEnabled").checked=e.ralphTrackerEnabled??t.ralphTrackerEnabled??!1,document.getElementById("appSettingsShowFontControls").checked=e.showFontControls??t.showFontControls??!1,document.getElementById("appSettingsShowSystemStats").checked=e.showSystemStats??t.showSystemStats??!0,document.getElementById("appSettingsShowLifecycleLog").checked=e.showLifecycleLog??t.showLifecycleLog??!0,document.getElementById("appSettingsShowResponseViewer").checked=e.showResponseViewer??t.showResponseViewer??!1,document.getElementById("appSettingsShowAttachmentsButton").checked=e.showAttachmentsButton??t.showAttachmentsButton??!1,document.getElementById("appSettingsSkin").value=e.skin??t.skin??"daylight-blue",document.getElementById("appSettingsShowMonitor").checked=e.showMonitor??t.showMonitor??!1,document.getElementById("appSettingsShowProjectInsights").checked=e.showProjectInsights??t.showProjectInsights??!1,document.getElementById("appSettingsShowFileBrowser").checked=e.showFileBrowser??t.showFileBrowser??!1,document.getElementById("appSettingsShowSubagents").checked=e.showSubagents??t.showSubagents??!1,document.getElementById("appSettingsShowUltracodeAgents").checked=e.showUltracodeAgents??t.showUltracodeAgents??!1,document.getElementById("appSettingsShowMultiMonitorButton").checked=e.showMultiMonitorButton??t.showMultiMonitorButton??!1,document.getElementById("appSettingsShowPlanUsageLimits").checked=e.showPlanUsageLimits??t.showPlanUsageLimits??!1;const n=document.getElementById("appSettingsGestureControlItem");n&&(n.style.display=window.__codemanGestureAvailable?"":"none"),document.getElementById("appSettingsGestureControl").checked=e.gestureControlEnabled??t.gestureControlEnabled??!1,document.getElementById("appSettingsSubagentTracking").checked=e.subagentTrackingEnabled??t.subagentTrackingEnabled??!0,document.getElementById("appSettingsSubagentActiveTabOnly").checked=e.subagentActiveTabOnly??t.subagentActiveTabOnly??!0,document.getElementById("appSettingsImageWatcherEnabled").checked=e.imageWatcherEnabled??t.imageWatcherEnabled??!1,document.getElementById("appSettingsTunnelEnabled").checked=e.tunnelEnabled??!1,this.loadTunnelStatus(),document.getElementById("appSettingsLocalEcho").checked=e.localEchoEnabled??MobileDetection.isTouchDevice(),document.getElementById("appSettingsCjkInput").checked=e.cjkInputEnabled??t.cjkInputEnabled??!1,document.getElementById("appSettingsExtendedKeyboardBar").checked=e.extendedKeyboardBar??!1,document.getElementById("appSettingsTabTwoRows").checked=e.tabTwoRows??t.tabTwoRows??!1;const s=document.getElementById("appSettingsClaudeMode"),o=document.getElementById("allowedToolsRow");s.value=e.claudeMode||"dangerously-skip-permissions",document.getElementById("appSettingsAllowedTools").value=e.allowedTools||"",o.style.display=s.value==="allowedTools"?"":"none",s.onchange=()=>{o.style.display=s.value==="allowedTools"?"":"none"},document.getElementById("appSettingsCodexDangerouslyBypassApprovals").checked=e.codexDangerouslyBypassApprovals??!1,document.getElementById("appSettingsAgentTeams").checked=e.agentTeamsEnabled??!1,document.getElementById("appSettingsClaudeModel").value=e.claudeModel??"",document.getElementById("appSettingsOpusContext1m").checked=e.opusContext1mEnabled??!1,document.getElementById("appSettingsThinkingEffort").value=e.thinkingEffort??"";const a=e.nice||{};document.getElementById("appSettingsNiceEnabled").checked=a.enabled??!1,document.getElementById("appSettingsNiceValue").value=a.niceValue??10,this.loadModelConfigForSettings();const i=this.notificationManager?.preferences||{};document.getElementById("appSettingsNotifEnabled").checked=i.enabled??!0,document.getElementById("appSettingsNotifBrowser").checked=i.browserNotifications??!1,document.getElementById("appSettingsNotifAudio").checked=i.audioAlerts??!1,document.getElementById("appSettingsNotifStuckMins").value=Math.round((i.stuckThresholdMs||6e5)/6e4),document.getElementById("appSettingsNotifCritical").checked=!i.muteCritical,document.getElementById("appSettingsNotifWarning").checked=!i.muteWarning,document.getElementById("appSettingsNotifInfo").checked=!i.muteInfo,document.getElementById("appSettingsPushEnabled").checked=!!this._pushSubscription,this._updatePushUI(!!this._pushSubscription);const l=i.eventTypes||{},r=l.permission_prompt||{};document.getElementById("eventPermissionEnabled").checked=r.enabled??!0,document.getElementById("eventPermissionBrowser").checked=r.browser??!0,document.getElementById("eventPermissionPush").checked=r.push??!1,document.getElementById("eventPermissionAudio").checked=r.audio??!0;const c=l.elicitation_dialog||{};document.getElementById("eventQuestionEnabled").checked=c.enabled??!0,document.getElementById("eventQuestionBrowser").checked=c.browser??!0,document.getElementById("eventQuestionPush").checked=c.push??!1,document.getElementById("eventQuestionAudio").checked=c.audio??!0;const d=l.idle_prompt||{};document.getElementById("eventIdleEnabled").checked=d.enabled??!0,document.getElementById("eventIdleBrowser").checked=d.browser??!0,document.getElementById("eventIdlePush").checked=d.push??!1,document.getElementById("eventIdleAudio").checked=d.audio??!1;const u=l.stop||{};document.getElementById("eventStopEnabled").checked=u.enabled??!0,document.getElementById("eventStopBrowser").checked=u.browser??!1,document.getElementById("eventStopPush").checked=u.push??!1,document.getElementById("eventStopAudio").checked=u.audio??!1;const p=l.respawn_cycle||{};document.getElementById("eventRespawnEnabled").checked=p.enabled??!0,document.getElementById("eventRespawnBrowser").checked=p.browser??!1,document.getElementById("eventRespawnPush").checked=p.push??!1,document.getElementById("eventRespawnAudio").checked=p.audio??!1;const h=l.ralph_complete||{};document.getElementById("eventRalphEnabled").checked=h.enabled??!0,document.getElementById("eventRalphBrowser").checked=h.browser??!0,document.getElementById("eventRalphPush").checked=h.push??!1,document.getElementById("eventRalphAudio").checked=h.audio??!0;const m=l.subagent_spawn||{};document.getElementById("eventSubagentEnabled").checked=m.enabled??!1,document.getElementById("eventSubagentBrowser").checked=m.browser??!1,document.getElementById("eventSubagentPush").checked=m.push??!1,document.getElementById("eventSubagentAudio").checked=m.audio??!1;const f=document.getElementById("notifPermissionStatus");if(f&&typeof Notification<"u"){const g=Notification.permission;f.textContent=g==="granted"?"\u2713":g==="denied"?"\u2717":"?",f.classList.remove("granted","denied"),g==="granted"?f.classList.add("granted"):g==="denied"&&f.classList.add("denied")}const y=VoiceInput._getDeepgramConfig();document.getElementById("voiceDeepgramKey").value=y.apiKey||"",document.getElementById("voiceLanguage").value=y.language||"en-US",document.getElementById("voiceKeyterms").value=y.keyterms||"refactor, endpoint, middleware, callback, async, regex, TypeScript, npm, API, deploy, config, linter, env, webhook, schema, CLI, JSON, CSS, DOM, SSE, backend, frontend, localhost, dependencies, repository, merge, rebase, diff, commit, com",document.getElementById("voiceInsertMode").value=y.insertMode||"direct";const S=document.getElementById("voiceDeepgramKey");S.type="password",document.getElementById("voiceKeyToggleBtn").textContent="Show";const b=VoiceInput.getActiveProviderName(),v=document.getElementById("voiceProviderStatus");v.textContent=b,v.className="voice-provider-status"+(b.startsWith("Deepgram")?" active":""),this._initUpdatesSection(),this.switchSettingsTab("settings-display");const w=document.getElementById("appSettingsModal");w.querySelectorAll(".modal-tabs .modal-tab-btn").forEach(g=>{g.onclick=()=>this.switchSettingsTab(g.dataset.tab)}),w.classList.add("active"),this.activeFocusTrap=new FocusTrap(w),this.activeFocusTrap.activate()},switchSettingsTab(e){const t=document.getElementById("appSettingsModal");t.querySelectorAll(".modal-tabs .modal-tab-btn").forEach(n=>{n.classList.toggle("active",n.dataset.tab===e)}),t.querySelectorAll(".modal-tab-content").forEach(n=>{n.classList.toggle("hidden",n.id!==e)})},closeAppSettings(){document.getElementById("appSettingsModal").classList.remove("active"),this.activeFocusTrap&&(this.activeFocusTrap.deactivate(),this.activeFocusTrap=null)},_updatePhaseText(e){return{queued:"Queued\u2026",preparing:"Preparing\u2026",stashing:"Stashing local changes\u2026",fetching:"Fetching release\u2026",checkout:"Checking out release\u2026",installing:"Installing dependencies\u2026",building:"Building\u2026",restarting:"Restarting Codeman\u2026"}[e]||e},_initUpdatesSection(){const e=this.$("updateCurrentVersion");e&&(e.textContent=(this.$("versionDisplay")?.textContent||"").trim()||"\u2014");for(const t of["updateResult","updateActionRow","updateNotes","updateProgress"]){const n=this.$(t);n&&(n.style.display="none")}this._updateCheck=null},_setUpdateResult(e){const t=this.$("updateResult");t&&(t.style.display="block",t.innerHTML=e)},_setUpdateProgress(e){const t=this.$("updateProgress");t&&(t.style.display="block",t.innerHTML=e)},async checkForUpdate(){const e=this.$("updateCheckBtn");e&&(e.disabled=!0,e.textContent="Checking\u2026");const t=await this._apiJson("/api/system/update/check");e&&(e.disabled=!1,e.textContent="Check now");const n=this.$("updateActionRow"),s=this.$("updateNotes");if(n&&(n.style.display="none"),s&&(s.style.display="none"),!t){this._setUpdateResult("Could not check for updates. Try again later.");return}this._updateCheck=t;const o=this.$("updateCurrentVersion");if(o&&t.currentVersion&&(o.textContent=`v${t.currentVersion}`),t.installKind&&t.installKind!=="git"){this._setUpdateResult(`This install can't update itself (${escapeHtml(t.installKind)}). Update with <code>npm i -g aicodeman@latest</code>.`);return}if(t.selfUpdateEnabled===!1){this._setUpdateResult("In-app updates are disabled on this server (CODEMAN_DISABLE_SELF_UPDATE=1).");return}if(t.error&&!t.updateAvailable){this._setUpdateResult(escapeHtml(t.error));return}if(t.updateAvailable&&t.latestVersion){this._setUpdateResult(`Update available: <strong>v${escapeHtml(t.latestVersion)}</strong> (current v${escapeHtml(t.currentVersion||"")})`);const a=this.$("updateActionLabel");a&&(a.textContent=`Update to v${t.latestVersion}`),n&&(n.style.display="flex");const i=this.$("updateNowBtn");i&&(i.disabled=!1,i.textContent="Update now"),s&&t.notes&&(s.style.display="block",s.textContent=t.notes)}else this._setUpdateResult(`You're up to date (v${escapeHtml(t.currentVersion||"")}).`)},async startSelfUpdate(){const e=this._updateCheck?.latestVersion?`v${this._updateCheck.latestVersion}`:"the latest release";if(!confirm(`Update Codeman to ${e}? The server will restart and this page will reload.`))return;const t=this.$("updateNowBtn");t&&(t.disabled=!0,t.textContent="Starting\u2026");const n=await this._apiPost("/api/system/update",{});if(!n||!n.ok){let a="Failed to start the update.";try{const i=await n.json();typeof i?.error=="string"&&i.error&&(a=i.error)}catch{}this._setUpdateProgress(`<span style="color:var(--danger,#e5534b)">${escapeHtml(a)}</span>`),t&&(t.disabled=!1,t.textContent="Update now");return}const s=this.$("updateActionRow");s&&(s.style.display="none");const o=this.$("updateNotes");o&&(o.style.display="none"),this._setUpdateProgress("Starting update\u2026"),this._pollUpdateStatus()},_stopUpdatePolling(){this._updatePollTimer&&(clearInterval(this._updatePollTimer),this._updatePollTimer=null)},_pollUpdateStatus(){this._stopUpdatePolling();const e=new Set(["completed","completed-needs-manual-restart","failed","idle"]),t=async()=>{let n=null;try{const s=await fetch("/api/system/update/status");if(s.ok){const o=await s.json();n=o&&o.success===!0?o.data:o}}catch{}if(!n){this._setUpdateProgress("\u21BB Restarting Codeman\u2026");return}if(!e.has(n.phase)){const s=n.message&&n.message.trim()?n.message.trim():this._updatePhaseText(n.phase);let o="";n.startedAt&&(o=` <span style="color:var(--text-secondary)">\xB7 ${Math.max(0,Math.round((Date.now()-n.startedAt)/1e3))}s</span>`),this._setUpdateProgress(`<span class="tunnel-spinner"></span> ${escapeHtml(s)}${o}`);return}if(this._stopUpdatePolling(),n.phase==="completed"){let s=`<span style="color:var(--success,#3fb950)">\u2713 Updated to v${escapeHtml(n.toVersion||"")}. Reloading\u2026</span>`;n.stashRef&&(s+=`<br><span style="color:var(--text-secondary)">Local changes stashed as <code>${escapeHtml(n.stashRef)}</code> \u2014 run <code>git stash pop</code> to restore.</span>`),this._setUpdateProgress(s),setTimeout(()=>location.reload(),2500)}else if(n.phase==="completed-needs-manual-restart")this._setUpdateProgress(`Update staged. Restart Codeman to apply:<br><code>${escapeHtml(n.manualRestartCommand||"restart codeman web")}</code>`);else if(n.phase==="failed"){let s=`<span style="color:var(--danger,#e5534b)">\u2717 ${escapeHtml(n.message||"Update failed")}.</span>`;n.error&&(s+=`<br><span style="color:var(--text-secondary)">${escapeHtml(n.error)}</span>`),s+='<br><span style="color:var(--text-secondary)">The previous version is still running.</span>',n.stashRef&&(s+=`<br><span style="color:var(--text-secondary)">Local changes stashed as <code>${escapeHtml(n.stashRef)}</code>.</span>`),this._setUpdateProgress(s);const o=this.$("updateNowBtn"),a=this.$("updateActionRow");o&&(o.disabled=!1,o.textContent="Try again"),a&&(a.style.display="flex")}};t(),this._updatePollTimer=setInterval(t,1500)},async loadTunnelStatus(){try{const t=await(await fetch("/api/tunnel/status")).json(),n=t?.success===!0?t.data:t,s=n.running&&n.url;this._tunnelUrl=s?n.url:null,this._updateTunnelUrlDisplay(this._tunnelUrl),this._updateWelcomeTunnelBtn(!!s,this._tunnelUrl),this._updateTunnelIndicator(!!s)}catch{this._tunnelUrl=null,this._updateTunnelUrlDisplay(null),this._updateWelcomeTunnelBtn(!1),this._updateTunnelIndicator(!1)}},_updateTunnelUrlRow(e,t,n,s=""){const o=document.getElementById(e),a=document.getElementById(t);if(!(!o||!a))if(n){const i=n+s;o.style.display="",a.textContent=i,a.onclick=()=>{navigator.clipboard.writeText(i).then(()=>{this.showToast(`${s?"Upload":"Tunnel"} URL copied`,"success")})}}else o.style.display="none",a.textContent="",a.onclick=null},_updateTunnelUrlDisplay(e){this._updateTunnelUrlRow("tunnelUrlRow","tunnelUrlDisplay",e),this._updateTunnelUrlRow("tunnelUploadUrlRow","tunnelUploadUrlDisplay",e,"/upload.html")},showTunnelQR(){this.closeTunnelQR();const e=document.createElement("div");e.id="tunnelQrOverlay",e.style.cssText="position:fixed;inset:0;background:rgba(0,0,0,0.7);z-index:5000;display:flex;align-items:center;justify-content:center;cursor:pointer",e.onclick=n=>{n.target===e&&this.closeTunnelQR()};const t=document.createElement("div");t.style.cssText="background:var(--bg-card);border:1px solid var(--border);border-radius:12px;padding:24px;text-align:center;max-width:340px;width:90vw;box-shadow:var(--shadow-lg);cursor:default",t.innerHTML=`
|
|
2
|
-
<div style="font-size:14px;font-weight:600;color:var(--text-primary);margin-bottom:16px">Scan to connect</div>
|
|
3
|
-
<div id="tunnelQrContainer" style="background:#fff;border-radius:8px;padding:16px;display:inline-block">
|
|
4
|
-
<div style="color:#666;font-size:12px">Loading...</div>
|
|
5
|
-
</div>
|
|
6
|
-
<div id="tunnelQrUrl" style="margin-top:12px;font-family:monospace;font-size:11px;color:var(--text-muted);word-break:break-all;cursor:pointer" title="Click to copy"></div>
|
|
7
|
-
<button onclick="app.closeTunnelQR()" style="margin-top:16px;padding:6px 20px;background:var(--bg-elevated);border:1px solid var(--border);border-radius:6px;color:var(--text-primary);cursor:pointer;font-size:13px">Close</button>
|
|
8
|
-
`,e.appendChild(t),document.body.appendChild(e),fetch("/api/tunnel/qr").then(n=>{if(!n.ok)throw new Error("Tunnel not running");return n.json()}).then(n=>{const s=n?.success===!0?n.data:n,o=document.getElementById("tunnelQrContainer");if(o&&s.svg&&(o.innerHTML=s.svg),s.authEnabled){const a=document.createElement("div");a.id="tunnelQrBadge",a.style.cssText="margin-top:8px;font-size:11px;color:var(--text-muted)",a.textContent="Single-use auth \xB7 expires in 60s";const i=document.createElement("button");i.textContent="Regenerate QR",i.style.cssText="margin-top:8px;padding:4px 12px;background:var(--bg-elevated);border:1px solid var(--border);border-radius:4px;color:var(--text-secondary);cursor:pointer;font-size:11px",i.onclick=()=>{fetch("/api/tunnel/qr/regenerate",{method:"POST"}).then(()=>this.showToast("QR code regenerated","success")).catch(()=>this.showToast("Failed to regenerate QR","error"))};const l=o.parentElement;l&&(l.appendChild(a),l.appendChild(i)),this._resetQrCountdown()}}).catch(()=>{const n=document.getElementById("tunnelQrContainer");n&&(n.innerHTML='<div style="color:#c00;font-size:12px;padding:20px">Tunnel not active</div>')}),fetch("/api/tunnel/status").then(n=>n.json()).then(n=>{const s=n?.success===!0?n.data:n,o=document.getElementById("tunnelQrUrl");o&&s.url&&(o.textContent=s.url,o.onclick=()=>{navigator.clipboard.writeText(s.url).then(()=>{this.showToast("Tunnel URL copied","success")})})}).catch(()=>{}),this._tunnelQrEscHandler=n=>{n.key==="Escape"&&this.closeTunnelQR()},document.addEventListener("keydown",this._tunnelQrEscHandler)},closeTunnelQR(){const e=document.getElementById("tunnelQrOverlay");e&&e.remove(),this._tunnelQrEscHandler&&(document.removeEventListener("keydown",this._tunnelQrEscHandler),this._tunnelQrEscHandler=null),this._clearQrCountdown()},_refreshTunnelQrFromApi(){fetch("/api/tunnel/qr").then(e=>e.ok?e.json():null).then(e=>{const t=e?.success===!0?e.data:e;if(!t?.svg)return;const n=document.getElementById("tunnelQrContainer");n&&(n.innerHTML=t.svg);const s=document.getElementById("welcomeQrInner");s&&(s.innerHTML=t.svg)}).catch(()=>{})},_resetQrCountdown(){this._clearQrCountdown(),this._qrCountdownSec=60,this._updateQrCountdownText(),this._qrCountdownTimer=setInterval(()=>{if(this._qrCountdownSec--,this._qrCountdownSec<=0){this._clearQrCountdown();return}this._updateQrCountdownText()},1e3)},_updateQrCountdownText(){const e=document.getElementById("tunnelQrBadge");e&&(e.textContent=`Single-use auth \xB7 expires in ${this._qrCountdownSec}s`)},_clearQrCountdown(){this._qrCountdownTimer&&(clearInterval(this._qrCountdownTimer),this._qrCountdownTimer=null)},async toggleTunnelFromWelcome(){const e=document.getElementById("welcomeTunnelBtn");if(!e)return;const t=e.classList.contains("active");e.disabled=!0;try{const n=!t,s=await fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tunnelEnabled:n})});if(n&&await this._handleTunnelEnableRefusal(s)){this._dismissTunnelConnecting(),this._updateWelcomeTunnelBtn(!1),e.disabled=!1;return}n?(this._showTunnelConnecting(),this._pollTunnelStatus()):(this._dismissTunnelConnecting(),this.showToast("Tunnel stopped","info"),this._updateWelcomeTunnelBtn(!1),e.disabled=!1)}catch{this._dismissTunnelConnecting(),this.showToast("Failed to toggle tunnel","error"),e.disabled=!1}},_showTunnelConnecting(){const e=document.getElementById("tunnelConnectingToast");e&&e.remove();const t=document.getElementById("welcomeTunnelBtn");t&&(t.classList.add("connecting"),t.innerHTML=`
|
|
9
|
-
<span class="tunnel-spinner"></span>
|
|
10
|
-
Connecting...`);const n=document.createElement("div");n.className="toast toast-info show",n.id="tunnelConnectingToast",n.innerHTML='<span class="tunnel-spinner"></span> Cloudflare Tunnel connecting...',n.style.pointerEvents="auto",this._toastContainer||(this._toastContainer=document.querySelector(".toast-container"),this._toastContainer||(this._toastContainer=document.createElement("div"),this._toastContainer.className="toast-container",document.body.appendChild(this._toastContainer))),this._toastContainer.appendChild(n)},_dismissTunnelConnecting(){clearTimeout(this._tunnelPollTimer),this._tunnelPollTimer=null;const e=document.getElementById("tunnelConnectingToast");e&&(e.classList.remove("show"),setTimeout(()=>e.remove(),200));const t=document.getElementById("welcomeTunnelBtn");t&&t.classList.remove("connecting")},_pollTunnelStatus(e=0){e>15||(this._tunnelPollTimer=setTimeout(async()=>{try{const n=await(await fetch("/api/tunnel/status")).json(),s=n?.success===!0?n.data:n;if(s.running&&s.url){this._dismissTunnelConnecting(),this._updateTunnelUrlDisplay(s.url),document.getElementById("welcomeOverlay")?.classList.contains("visible")?(this._updateWelcomeTunnelBtn(!0,s.url,!0),this.showToast("Tunnel active","success")):(this._updateWelcomeTunnelBtn(!0,s.url),this.showToast(`Tunnel active: ${s.url}`,"success"),this.showTunnelQR());return}}catch{}this._pollTunnelStatus(e+1)},2e3))},_updateWelcomeTunnelBtn(e,t,n=!1){const s=document.getElementById("welcomeTunnelBtn");s&&(s.disabled=!1,e?(s.classList.remove("connecting"),s.classList.add("active"),s.innerHTML=`
|
|
11
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg>
|
|
12
|
-
Tunnel Active`):(s.classList.remove("active","connecting"),s.innerHTML=`
|
|
13
|
-
<svg width="20" height="20" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg>
|
|
14
|
-
Cloudflare Tunnel`));const o=document.getElementById("welcomeQr"),a=document.getElementById("welcomeQrInner"),i=document.getElementById("welcomeQrUrl");!o||!a||(e?(o.classList.add("visible"),n&&(o.classList.add("expanded"),clearTimeout(this._welcomeQrShrinkTimer),this._welcomeQrShrinkTimer=setTimeout(()=>{o.classList.remove("expanded")},8e3)),t&&(i.textContent=t,i.title="Click QR to enlarge"),fetch("/api/tunnel/qr").then(l=>{if(!l.ok)throw new Error;return l.json()}).then(l=>{const r=l?.success===!0?l.data:l;r.svg&&(a.innerHTML=r.svg)}).catch(()=>{a.innerHTML='<div style="color:#999;font-size:11px;padding:20px">QR unavailable</div>'})):(clearTimeout(this._welcomeQrShrinkTimer),o.classList.remove("visible","expanded"),a.innerHTML="",i&&(i.textContent="")))},toggleWelcomeQrSize(){const e=document.getElementById("welcomeQr");e&&(clearTimeout(this._welcomeQrShrinkTimer),e.classList.toggle("expanded"))},_updateTunnelIndicator(e){if(MobileDetection.getDeviceType()==="mobile")return;const t=document.getElementById("tunnelIndicator");t&&(t.style.display=e?"flex":"none",t.classList.remove("connecting"))},toggleTunnelPanel(){if(document.getElementById("tunnelPanel")){this.closeTunnelPanel();return}this._openTunnelPanel()},async _openTunnelPanel(){const e=document.createElement("div");e.className="tunnel-panel",e.id="tunnelPanel",e.innerHTML=`
|
|
15
|
-
<div class="tunnel-panel-header">
|
|
16
|
-
<h3>
|
|
17
|
-
<svg width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2"><path d="M12 2L2 7l10 5 10-5-10-5z"/><path d="M2 17l10 5 10-5"/><path d="M2 12l10 5 10-5"/></svg>
|
|
18
|
-
Cloudflare Tunnel
|
|
19
|
-
<span class="tunnel-panel-status" id="tunnelPanelStatus">Loading...</span>
|
|
20
|
-
</h3>
|
|
21
|
-
</div>
|
|
22
|
-
<div class="tunnel-panel-body" id="tunnelPanelBody">
|
|
23
|
-
<div style="font-size:12px;color:var(--text-muted);padding:8px 0">Loading...</div>
|
|
24
|
-
</div>
|
|
25
|
-
`,document.body.appendChild(e),this._tunnelPanelClickHandler=t=>{!e.contains(t.target)&&t.target.id!=="tunnelIndicator"&&!t.target.closest(".tunnel-indicator")&&this.closeTunnelPanel()},setTimeout(()=>document.addEventListener("click",this._tunnelPanelClickHandler),0),this._tunnelPanelEscHandler=t=>{t.key==="Escape"&&this.closeTunnelPanel()},document.addEventListener("keydown",this._tunnelPanelEscHandler);try{const n=await(await fetch("/api/tunnel/info")).json(),s=n?.success===!0?n.data:n;this._renderTunnelPanel(s)}catch{const t=document.getElementById("tunnelPanelBody");t&&(t.innerHTML='<div style="font-size:12px;color:var(--red);padding:8px 0">Failed to load tunnel info</div>')}},_renderTunnelPanel(e){const t=document.getElementById("tunnelPanelStatus"),n=document.getElementById("tunnelPanelBody");if(!t||!n)return;t.textContent=e.running?"Connected":"Offline",t.className="tunnel-panel-status"+(e.running?"":" offline");let s="";if(e.url&&(s+=`
|
|
26
|
-
<div class="tunnel-panel-section">
|
|
27
|
-
<div class="tunnel-panel-label">URL</div>
|
|
28
|
-
<div class="tunnel-panel-url" id="tunnelPanelUrl" title="Click to copy">${escapeHtml(e.url)}</div>
|
|
29
|
-
</div>`),s+=`
|
|
30
|
-
<div class="tunnel-panel-section">
|
|
31
|
-
<div class="tunnel-panel-label">Connections</div>
|
|
32
|
-
<div class="tunnel-panel-stat">
|
|
33
|
-
<span>Remote Clients</span>
|
|
34
|
-
<span class="tunnel-panel-stat-value">${e.sseClients}</span>
|
|
35
|
-
</div>`,e.authEnabled&&(s+=`
|
|
36
|
-
<div class="tunnel-panel-stat">
|
|
37
|
-
<span>Auth Sessions</span>
|
|
38
|
-
<span class="tunnel-panel-stat-value">${e.authSessions.length}</span>
|
|
39
|
-
</div>`),s+="</div>",e.authEnabled&&e.authSessions.length>0){s+='<div class="tunnel-panel-section"><div class="tunnel-panel-label">Authenticated Devices</div>';for(const a of e.authSessions){const i=a.ua||"Unknown",l=i.match(/Chrome|Firefox|Safari|Edge|Mobile/)?.[0]||"Browser",r=this._formatTimeAgo(a.createdAt);s+=`
|
|
40
|
-
<div class="tunnel-panel-session">
|
|
41
|
-
<span class="tunnel-panel-session-dot"></span>
|
|
42
|
-
<span class="tunnel-panel-session-info" title="${escapeHtml(i)}">${escapeHtml(l)} · ${escapeHtml(a.ip)} · ${r}</span>
|
|
43
|
-
<span class="tunnel-panel-session-method">${a.method}</span>
|
|
44
|
-
</div>`}s+="</div>"}s+='<div class="tunnel-panel-actions">',e.running?s+=`
|
|
45
|
-
<button class="tunnel-panel-btn btn-qr" onclick="app.showTunnelQR();app.closeTunnelPanel()">QR Code</button>
|
|
46
|
-
<button class="tunnel-panel-btn btn-stop" onclick="app._tunnelPanelToggle(false)">Stop Tunnel</button>`:s+='<button class="tunnel-panel-btn btn-start" onclick="app._tunnelPanelToggle(true)">Start Tunnel</button>',s+="</div>",e.authEnabled&&e.authSessions.length>0&&(s+=`
|
|
47
|
-
<div style="padding-top:8px">
|
|
48
|
-
<button class="tunnel-panel-btn btn-revoke" style="width:100%" onclick="app._tunnelPanelRevokeAll()">Revoke All Sessions</button>
|
|
49
|
-
</div>`),n.innerHTML=s;const o=document.getElementById("tunnelPanelUrl");o&&(o.onclick=()=>{navigator.clipboard.writeText(e.url).then(()=>this.showToast("Tunnel URL copied","success"))})},_formatTimeAgo(e){const t=Date.now()-e,n=Math.floor(t/6e4);if(n<1)return"just now";if(n<60)return`${n}m ago`;const s=Math.floor(n/60);return s<24?`${s}h ago`:`${Math.floor(s/24)}d ago`},async _handleTunnelEnableRefusal(e){if(!e||e.ok)return!1;let t="Tunnel refused: set CODEMAN_PASSWORD before exposing Codeman publicly.";try{const n=await e.json();n&&n.error&&(t=n.error)}catch{}return this._dismissTunnelConnecting?.(),this.showToast(t,"error"),!0},async _tunnelPanelToggle(e){try{const t=await fetch("/api/settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({tunnelEnabled:e})});if(e&&await this._handleTunnelEnableRefusal(t)){this.closeTunnelPanel();return}if(e){this._updateTunnelIndicator(!1);const n=document.getElementById("tunnelIndicator");n&&(n.style.display="flex",n.classList.add("connecting")),this.showToast("Tunnel starting...","info"),this._showTunnelConnecting(),this._pollTunnelStatus()}else this.showToast("Tunnel stopped","info");this.closeTunnelPanel()}catch{this.showToast("Failed to toggle tunnel","error")}},async _tunnelPanelRevokeAll(){try{await fetch("/api/auth/revoke",{method:"POST",headers:{"Content-Type":"application/json"},body:"{}"}),this.showToast("All sessions revoked","success");const t=await(await fetch("/api/tunnel/info")).json(),n=t?.success===!0?t.data:t;this._renderTunnelPanel(n)}catch{this.showToast("Failed to revoke sessions","error")}},closeTunnelPanel(){const e=document.getElementById("tunnelPanel");e&&e.remove(),this._tunnelPanelClickHandler&&(document.removeEventListener("click",this._tunnelPanelClickHandler),this._tunnelPanelClickHandler=null),this._tunnelPanelEscHandler&&(document.removeEventListener("keydown",this._tunnelPanelEscHandler),this._tunnelPanelEscHandler=null)},toggleDeepgramKeyVisibility(){const e=document.getElementById("voiceDeepgramKey"),t=document.getElementById("voiceKeyToggleBtn");e.type==="password"?(e.type="text",t.textContent="Hide"):(e.type="password",t.textContent="Show")},openLifecycleLog(){const e=document.getElementById("lifecycleWindow");e.style.display="block",e._dragInitialized||(e.style.left="50%",e.style.transform="translateX(-50%)",this._initLifecycleDrag(e),e._dragInitialized=!0),this.loadLifecycleLog()},closeLifecycleLog(){document.getElementById("lifecycleWindow").style.display="none"},_initLifecycleDrag(e){const t=document.getElementById("lifecycleWindowHeader");let n=!1,s,o,a,i;t.addEventListener("mousedown",l=>{if(l.target.tagName==="SELECT"||l.target.tagName==="INPUT"||l.target.tagName==="BUTTON")return;n=!0;const r=e.getBoundingClientRect();e.style.transform="none",e.style.left=r.left+"px",e.style.top=r.top+"px",s=l.clientX,o=l.clientY,a=r.left,i=r.top,l.preventDefault()}),document.addEventListener("mousemove",l=>{n&&(e.style.left=a+l.clientX-s+"px",e.style.top=i+l.clientY-o+"px")}),document.addEventListener("mouseup",()=>{n=!1})},async loadLifecycleLog(){const e=document.getElementById("lifecycleFilterEvent").value,t=document.getElementById("lifecycleFilterSession").value.trim(),n=new URLSearchParams;e&&n.set("event",e),t&&n.set("sessionId",t),n.set("limit","300");try{const o=await(await fetch(`/api/session-lifecycle?${n}`)).json(),a=o?.success===!0?o.data:o,i=document.getElementById("lifecycleTableBody"),l=document.getElementById("lifecycleEmpty");if(!a.entries||a.entries.length===0){i.innerHTML="",l.style.display="";return}l.style.display="none";const r={created:"#4ade80",started:"#4ade80",recovered:"#4ade80",exit:"#fbbf24",mux_died:"#f87171",deleted:"#f87171",stale_cleaned:"#f87171",server_started:"#666",server_stopped:"#666"};i.innerHTML=a.entries.map(c=>{const d=new Date(c.ts).toLocaleString(),u=r[c.event]||"#888",p=c.name||(c.sessionId==="*"?"\u2014":this.getShortId(c.sessionId)),h=[];return c.exitCode!==void 0&&c.exitCode!==null&&h.push(`code=${c.exitCode}`),c.mode&&h.push(c.mode),`<tr style="border-bottom:1px solid #1a1a2e">
|
|
50
|
-
<td style="padding:3px 8px;color:#888;white-space:nowrap">${d}</td>
|
|
51
|
-
<td style="padding:3px 8px;color:${u};font-weight:600">${c.event}</td>
|
|
52
|
-
<td style="padding:3px 8px;color:#e0e0e0" title="${c.sessionId}">${p}</td>
|
|
53
|
-
<td style="padding:3px 8px;color:#aaa">${c.reason||""}</td>
|
|
54
|
-
<td style="padding:3px 8px;color:#666">${h.join(", ")}</td>
|
|
55
|
-
</tr>`}).join("")}catch(s){console.error("Failed to load lifecycle log:",s)}},async saveAppSettings(){const e=this.loadAppSettingsFromStorage(),t=(e.gestureControlEnabled??!1)===!0,n={defaultClaudeMdPath:document.getElementById("appSettingsClaudeMdPath").value.trim(),defaultWorkingDir:document.getElementById("appSettingsDefaultDir").value.trim(),ralphTrackerEnabled:document.getElementById("appSettingsRalphEnabled").checked,showFontControls:document.getElementById("appSettingsShowFontControls").checked,showSystemStats:document.getElementById("appSettingsShowSystemStats").checked,showLifecycleLog:document.getElementById("appSettingsShowLifecycleLog").checked,showResponseViewer:document.getElementById("appSettingsShowResponseViewer").checked,showAttachmentsButton:document.getElementById("appSettingsShowAttachmentsButton").checked,showMonitor:document.getElementById("appSettingsShowMonitor").checked,showProjectInsights:document.getElementById("appSettingsShowProjectInsights").checked,showFileBrowser:document.getElementById("appSettingsShowFileBrowser").checked,showSubagents:document.getElementById("appSettingsShowSubagents").checked,showUltracodeAgents:document.getElementById("appSettingsShowUltracodeAgents").checked,showMultiMonitorButton:document.getElementById("appSettingsShowMultiMonitorButton").checked,showPlanUsageLimits:document.getElementById("appSettingsShowPlanUsageLimits").checked,gestureControlEnabled:document.getElementById("appSettingsGestureControl").checked,subagentTrackingEnabled:document.getElementById("appSettingsSubagentTracking").checked,subagentActiveTabOnly:document.getElementById("appSettingsSubagentActiveTabOnly").checked,imageWatcherEnabled:document.getElementById("appSettingsImageWatcherEnabled").checked,tunnelEnabled:document.getElementById("appSettingsTunnelEnabled").checked,localEchoEnabled:document.getElementById("appSettingsLocalEcho").checked,cjkInputEnabled:document.getElementById("appSettingsCjkInput").checked,extendedKeyboardBar:document.getElementById("appSettingsExtendedKeyboardBar").checked,tabTwoRows:document.getElementById("appSettingsTabTwoRows").checked,skin:document.getElementById("appSettingsSkin").value,claudeMode:document.getElementById("appSettingsClaudeMode").value,allowedTools:document.getElementById("appSettingsAllowedTools").value.trim(),codexDangerouslyBypassApprovals:document.getElementById("appSettingsCodexDangerouslyBypassApprovals").checked,agentTeamsEnabled:document.getElementById("appSettingsAgentTeams").checked,claudeModel:document.getElementById("appSettingsClaudeModel").value,opusContext1mEnabled:document.getElementById("appSettingsOpusContext1m").checked,thinkingEffort:document.getElementById("appSettingsThinkingEffort").value,nice:{enabled:document.getElementById("appSettingsNiceEnabled").checked,niceValue:parseInt(document.getElementById("appSettingsNiceValue").value)||10}};e.showTokenCount!==void 0&&(n.showTokenCount=e.showTokenCount),e.showCost!==void 0&&(n.showCost=e.showCost),this.saveAppSettingsToStorage(n),this._updateLocalEchoState();const s={apiKey:document.getElementById("voiceDeepgramKey").value.trim(),language:document.getElementById("voiceLanguage").value,keyterms:document.getElementById("voiceKeyterms").value.trim(),insertMode:document.getElementById("voiceInsertMode").value};VoiceInput._saveDeepgramConfig(s);const o={enabled:document.getElementById("appSettingsNotifEnabled").checked,browserNotifications:document.getElementById("appSettingsNotifBrowser").checked,audioAlerts:document.getElementById("appSettingsNotifAudio").checked,stuckThresholdMs:(parseInt(document.getElementById("appSettingsNotifStuckMins").value)||10)*6e4,muteCritical:!document.getElementById("appSettingsNotifCritical").checked,muteWarning:!document.getElementById("appSettingsNotifWarning").checked,muteInfo:!document.getElementById("appSettingsNotifInfo").checked,eventTypes:{permission_prompt:{enabled:document.getElementById("eventPermissionEnabled").checked,browser:document.getElementById("eventPermissionBrowser").checked,push:document.getElementById("eventPermissionPush").checked,audio:document.getElementById("eventPermissionAudio").checked},elicitation_dialog:{enabled:document.getElementById("eventQuestionEnabled").checked,browser:document.getElementById("eventQuestionBrowser").checked,push:document.getElementById("eventQuestionPush").checked,audio:document.getElementById("eventQuestionAudio").checked},idle_prompt:{enabled:document.getElementById("eventIdleEnabled").checked,browser:document.getElementById("eventIdleBrowser").checked,push:document.getElementById("eventIdlePush").checked,audio:document.getElementById("eventIdleAudio").checked},stop:{enabled:document.getElementById("eventStopEnabled").checked,browser:document.getElementById("eventStopBrowser").checked,push:document.getElementById("eventStopPush").checked,audio:document.getElementById("eventStopAudio").checked},session_error:{enabled:!0,browser:this.notificationManager?.preferences?.eventTypes?.session_error?.browser??!0,push:this.notificationManager?.preferences?.eventTypes?.session_error?.push??!1,audio:!1},respawn_cycle:{enabled:document.getElementById("eventRespawnEnabled").checked,browser:document.getElementById("eventRespawnBrowser").checked,push:document.getElementById("eventRespawnPush").checked,audio:document.getElementById("eventRespawnAudio").checked},token_milestone:{enabled:!0,browser:!1,push:!1,audio:!1},ralph_complete:{enabled:document.getElementById("eventRalphEnabled").checked,browser:document.getElementById("eventRalphBrowser").checked,push:document.getElementById("eventRalphPush").checked,audio:document.getElementById("eventRalphAudio").checked},subagent_spawn:{enabled:document.getElementById("eventSubagentEnabled").checked,browser:document.getElementById("eventSubagentBrowser").checked,push:document.getElementById("eventSubagentPush").checked,audio:document.getElementById("eventSubagentAudio").checked},subagent_complete:{enabled:document.getElementById("eventSubagentEnabled").checked,browser:document.getElementById("eventSubagentBrowser").checked,push:document.getElementById("eventSubagentPush").checked,audio:document.getElementById("eventSubagentAudio").checked}},_version:4};this.notificationManager&&(this.notificationManager.preferences=o,this.notificationManager.savePreferences()),this._syncPushPreferences(),this.applyHeaderVisibilitySettings(),this.applySkin(),this.applyTabWrapSettings(),this._updateTokensImmediate(),this.applyMonitorVisibility(),this.renderProjectInsightsPanel(),this.updateSubagentWindowVisibility(),this._updateCjkInputState(),KeyboardAccessoryBar.setMode(n.extendedKeyboardBar?"extended":"simple");const{localEchoEnabled:a,cjkInputEnabled:i,extendedKeyboardBar:l,skin:r,showPlanUsageLimits:c,showAttachmentsButton:d,...u}=n;try{const p=await this._apiPut("/api/settings",{...u,...n.showPlanUsageLimits?{statusLineTelemetry:!0}:{},notificationPreferences:o,voiceSettings:s});if(n.tunnelEnabled&&await this._handleTunnelEnableRefusal(p)){n.tunnelEnabled=!1,this.saveAppSettingsToStorage(n);const h=document.getElementById("appSettingsTunnelEnabled");h&&(h.checked=!1),this.closeAppSettings();return}await this.saveModelConfigFromSettings(),this.showToast("Settings saved","success"),n.tunnelEnabled&&this.showToast("Tunnel starting \u2014 QR code will appear when ready...","info")}catch{this.showToast("Settings saved locally","warning")}this.closeAppSettings(),n.gestureControlEnabled!==t&&(this.showToast(n.gestureControlEnabled?"Enabling gesture control \u2014 reloading\u2026":"Disabling gesture control \u2014 reloading\u2026","info"),setTimeout(()=>location.reload(),400))},async loadModelConfigForSettings(){try{const t=await(await fetch("/api/execution/model-config")).json();if(t.success&&t.data){const n=t.data,s=document.getElementById("appSettingsDefaultModel");s&&(s.value=n.defaultModel||"");const o=document.getElementById("appSettingsShowModelRecommendations");o&&(o.checked=n.showRecommendations??!0);const a=n.agentTypeOverrides||{},i=document.getElementById("appSettingsModelExplore"),l=document.getElementById("appSettingsModelImplement"),r=document.getElementById("appSettingsModelTest"),c=document.getElementById("appSettingsModelReview");i&&(i.value=a.explore||""),l&&(l.value=a.implement||""),r&&(r.value=a.test||""),c&&(c.value=a.review||"")}}catch(e){console.warn("Failed to load model config:",e)}},async saveModelConfigFromSettings(){const e=document.getElementById("appSettingsDefaultModel"),t=document.getElementById("appSettingsShowModelRecommendations"),n=document.getElementById("appSettingsModelExplore"),s=document.getElementById("appSettingsModelImplement"),o=document.getElementById("appSettingsModelTest"),a=document.getElementById("appSettingsModelReview"),i={};n?.value&&(i.explore=n.value),s?.value&&(i.implement=s.value),o?.value&&(i.test=o.value),a?.value&&(i.review=a.value);const l={defaultModel:e?.value||"",showRecommendations:t?.checked??!0,agentTypeOverrides:i};try{await fetch("/api/execution/model-config",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(l)})}catch(r){console.warn("Failed to save model config:",r)}},isRalphTrackerEnabledByDefault(){return this.loadAppSettingsFromStorage().ralphTrackerEnabled??!1},getSettingsStorageKey(){return MobileDetection.getDeviceType()==="mobile"?"codeman-app-settings-mobile":"codeman-app-settings"},getDefaultSettings(){return MobileDetection.getDeviceType()==="mobile"?{showFontControls:!1,showSystemStats:!1,showTokenCount:!1,showCost:!1,showMonitor:!1,showProjectInsights:!1,showFileBrowser:!1,showSubagents:!1,showUltracodeAgents:!1,showMultiMonitorButton:!1,showPlanUsageLimits:!1,showAttachmentsButton:!1,gestureControlEnabled:!1,subagentTrackingEnabled:!0,subagentActiveTabOnly:!0,imageWatcherEnabled:!1,ralphTrackerEnabled:!1,tabTwoRows:!1,cjkInputEnabled:!1,skin:"daylight-blue"}:{}},loadAppSettingsFromStorage(){if(this._cachedAppSettings)return this._cachedAppSettings;try{const e=this.getSettingsStorageKey(),t=localStorage.getItem(e);if(t)return this._cachedAppSettings=JSON.parse(t),this._cachedAppSettings}catch(e){console.error("Failed to load app settings:",e)}return this._cachedAppSettings=this.getDefaultSettings(),this._cachedAppSettings},saveAppSettingsToStorage(e){this._cachedAppSettings=e;try{const t=this.getSettingsStorageKey();localStorage.setItem(t,JSON.stringify(e))}catch(t){console.error("Failed to save app settings:",t)}},applySkin(){const e=this.loadAppSettingsFromStorage(),t=this.getDefaultSettings(),n=e.skin??t.skin??"daylight-blue";document.documentElement.setAttribute("data-skin",n),window.__codemanSkin=n;try{localStorage.setItem("codeman:skin",n)}catch{}typeof this.applyTerminalSkin=="function"&&this.applyTerminalSkin(n)},applyHeaderVisibilitySettings(){const e=this.loadAppSettingsFromStorage(),t=this.getDefaultSettings(),n=MobileDetection.getDeviceType()!=="desktop",s=n?!1:e.showFontControls??t.showFontControls??!1,o=n?!1:e.showSystemStats??t.showSystemStats??!0,a=n?!1:e.showTokenCount??t.showTokenCount??!0,i=document.querySelector(".header-font-controls"),l=document.getElementById("headerSystemStats"),r=document.getElementById("headerTokens");i&&(i.style.display=s?"":"none"),l&&(l.style.display=o?"":"none"),r&&(r.style.display=a?"":"none");const c=e.showLifecycleLog??t.showLifecycleLog??!0,d=document.querySelector(".btn-lifecycle-log");d&&(d.style.display=c?"":"none");const u=e.showResponseViewer??t.showResponseViewer??!1,p=document.querySelector(".btn-response-viewer-header");p&&p.classList.toggle("btn-response-viewer-header--hidden",!u);const h=e.showAttachmentsButton??t.showAttachmentsButton??!1,m=document.getElementById("attachmentsHistoryBtn");m&&m.classList.toggle("btn-attachments-history--hidden",!h);const f=e.showMultiMonitorButton??t.showMultiMonitorButton??!1,y=document.querySelector(".btn-multimonitor");y&&y.classList.toggle("btn-multimonitor--hidden",!f);const S=e.showUltracodeAgents??t.showUltracodeAgents??!1,b=document.querySelector(".btn-ultracode-agents");b&&b.classList.toggle("btn-ultracode-agents--hidden",!S);const v=e.showPlanUsageLimits??t.showPlanUsageLimits??!1,w=document.getElementById("planUsageChip");w&&w.classList.toggle("header-plan-usage--hidden",!v);const g=document.querySelector(".btn-notifications");if(g&&(g.style.display="none"),!(this.notificationManager?.preferences?.enabled??!0)){const E=document.getElementById("notifDrawer");E&&E.classList.remove("open")}},applyTabWrapSettings(){const e=this.loadAppSettingsFromStorage(),t=this.getDefaultSettings(),s=MobileDetection.getDeviceType()==="desktop"?e.tabTwoRows??t.tabTwoRows??!1:!1,o=this._tallTabsEnabled;this._tallTabsEnabled=s;const a=document.getElementById("sessionTabs");a&&(a.classList.toggle("tabs-two-rows",s),a.classList.toggle("tabs-show-folder",s)),o!==void 0&&o!==s&&this._fullRenderSessionTabs()},applyMonitorVisibility(){const e=this.loadAppSettingsFromStorage(),t=this.getDefaultSettings(),n=e.showMonitor??t.showMonitor??!1,s=e.showSubagents??t.showSubagents??!1,o=e.showFileBrowser??t.showFileBrowser??!1,a=document.getElementById("monitorPanel");a&&(a.style.display=n?"":"none",n?a.classList.add("open"):a.classList.remove("open"));const i=document.getElementById("subagentsPanel");i&&(s?i.classList.remove("hidden"):i.classList.add("hidden"));const l=e.showUltracodeAgents??t.showUltracodeAgents??!1,r=document.getElementById("ultracodeAgentsPanel");r&&(l?r.classList.remove("hidden"):(r.classList.remove("open"),r.classList.add("hidden")));const c=document.getElementById("fileBrowserPanel");if(c)if(o&&this.activeSessionId){if(c.classList.add("visible"),this.loadFileBrowser(this.activeSessionId),!this.fileBrowserDragListeners){const d=c.querySelector(".file-browser-header");if(d){const u=()=>{if(!c.style.left){const p=c.getBoundingClientRect();c.style.left=`${p.left}px`,c.style.top=`${p.top}px`,c.style.right="auto"}};d.addEventListener("mousedown",u),d.addEventListener("touchstart",u,{passive:!0}),this.fileBrowserDragListeners=this.makeWindowDraggable(c,d),this.fileBrowserDragListeners._onFirstDrag=u}}}else c.classList.remove("visible")},closeMonitor(){const e=document.getElementById("monitorPanel");e&&(e.classList.remove("open"),e.style.display="none");const t=this.loadAppSettingsFromStorage();t.showMonitor=!1,this.saveAppSettingsToStorage(t)},closeSubagentsPanel(){const e=document.getElementById("subagentsPanel");e&&(e.classList.remove("open"),e.classList.add("hidden")),this.subagentPanelVisible=!1;const t=this.loadAppSettingsFromStorage();t.showSubagents=!1,this.saveAppSettingsToStorage(t)},async clearAllSubagents(){const e=this.subagents.size;if(e===0){this.showToast("No subagents to clear","info");return}if(confirm(`Clear all ${e} tracked subagent(s)? This removes them from the UI but does not affect running processes.`))try{const n=await(await fetch("/api/subagents",{method:"DELETE"})).json();n.success?(this.subagents.clear(),this.subagentActivity.clear(),this.subagentToolResults.clear(),this.cleanupAllFloatingWindows(),this.renderSubagentPanel(),this.renderMonitorSubagents(),this.updateSubagentBadge(),this.showToast(`Cleared ${n.data.cleared} subagent(s)`,"success")):this.showToast("Failed to clear subagents: "+n.error,"error")}catch{this.showToast("Failed to clear subagents","error")}},toggleSubagentsPanel(){const e=document.getElementById("subagentsPanel"),t=document.getElementById("subagentsToggleBtn");if(e){if(e.classList.contains("hidden")){e.classList.remove("hidden");const n=this.loadAppSettingsFromStorage();n.showSubagents=!0,this.saveAppSettingsToStorage(n)}e.classList.toggle("open"),this.subagentPanelVisible=e.classList.contains("open"),t&&(t.innerHTML=this.subagentPanelVisible?"▼":"▲"),this.subagentPanelVisible&&this.renderSubagentPanel()}},async loadAppSettingsFromServer(e=null){try{if(MobileDetection.getDeviceType()==="mobile"&&!localStorage.getItem("codeman:planUsagePerDeviceMigrated")){const t=this.loadAppSettingsFromStorage();t&&t.showPlanUsageLimits&&(t.showPlanUsageLimits=!1,this.saveAppSettingsToStorage(t)),localStorage.setItem("codeman:planUsagePerDeviceMigrated","1")}}catch{}try{const t=e?await e:await fetch("/api/settings").then(n=>n.ok?n.json():null).then(n=>n?.success===!0?n.data:n);if(t){const{notificationPreferences:n,voiceSettings:s,respawnPresets:o,runMode:a,...i}=t,l=new Set(["showFontControls","showSystemStats","showTokenCount","showCost","showLifecycleLog","showResponseViewer","showMonitor","showProjectInsights","showFileBrowser","showSubagents","subagentActiveTabOnly","tabTwoRows","localEchoEnabled","cjkInputEnabled","extendedKeyboardBar","skin","showPlanUsageLimits","showAttachmentsButton"]);delete i.showPlanUsageLimits;const r=this.loadAppSettingsFromStorage(),c={...r};for(const[d,u]of Object.entries(i))l.has(d)&&d in r||(c[d]=u);if(this.saveAppSettingsToStorage(c),n&&this.notificationManager&&(localStorage.getItem(this.notificationManager.getStorageKey())||(this.notificationManager.preferences=n,this.notificationManager.savePreferences())),s){const d=localStorage.getItem("codeman-voice-settings");(!d||!JSON.parse(d).apiKey)&&VoiceInput._saveDeepgramConfig(s)}if(o&&Array.isArray(o))this._serverRespawnPresets=o,localStorage.setItem("codeman-respawn-presets",JSON.stringify(o));else{const d=localStorage.getItem("codeman-respawn-presets");if(d){const u=JSON.parse(d);u.length>0&&(this._serverRespawnPresets=u,this._apiPut("/api/settings",{respawnPresets:u}).catch(()=>{}))}}if(a){this.runMode=a;try{localStorage.setItem("codeman_runMode",a)}catch{}this._applyRunMode()}return c}}catch(t){console.error("Failed to load settings from server:",t)}return this.loadAppSettingsFromStorage()},async loadSubagentWindowStates(){let e=null;try{const t=await fetch("/api/subagent-window-states");if(t.ok){const n=await t.json();e=n?.success===!0?n.data:n,localStorage.setItem("codeman-subagent-window-states",JSON.stringify(e))}}catch(t){console.error("Failed to load subagent window states from server:",t)}if(!e)try{const t=localStorage.getItem("codeman-subagent-window-states");t&&(e=JSON.parse(t))}catch(t){console.error("Failed to load subagent window states from localStorage:",t)}return e||{minimized:{},open:[]}},async saveSubagentParentMap(){const e=Object.fromEntries(this.subagentParentMap);try{localStorage.setItem("codeman-subagent-parents",JSON.stringify(e))}catch(t){console.error("Failed to save subagent parents to localStorage:",t)}try{await fetch("/api/subagent-parents",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)})}catch(t){console.error("Failed to save subagent parents to server:",t)}},async loadSubagentParentMap(){let e=null;try{const t=await fetch("/api/subagent-parents");if(t.ok){const n=await t.json();e=n?.success===!0?n.data:n,localStorage.setItem("codeman-subagent-parents",JSON.stringify(e))}}catch(t){console.error("Failed to load subagent parents from server:",t)}if(!e)try{const t=localStorage.getItem("codeman-subagent-parents");t&&(e=JSON.parse(t))}catch(t){console.error("Failed to load subagent parents from localStorage:",t)}if(e&&typeof e=="object")for(const[t,n]of Object.entries(e))this.sessions.has(n)&&this.subagents.has(t)&&this.subagentParentMap.set(t,n)},getAgentParentSessionId(e){return this.subagentParentMap.get(e)||null},setAgentParentSessionId(e,t){if(!e||!t||this.subagentParentMap.has(e))return;this.subagentParentMap.set(e,t),this.saveSubagentParentMap();const n=this.subagents.get(e);if(n){n.parentSessionId=t;const s=this.sessions.get(t);s&&(n.parentSessionName=this.getSessionName(s)),this.subagents.set(e,n)}},showHelp(){const e=document.getElementById("helpModal");e.classList.add("active"),this.activeFocusTrap=new FocusTrap(e),this.activeFocusTrap.activate()},closeHelp(){document.getElementById("helpModal").classList.remove("active"),this.activeFocusTrap&&(this.activeFocusTrap.deactivate(),this.activeFocusTrap=null)},closeAllPanels(){this.closeSessionOptions(),this.closeAppSettings(),this.cancelCloseSession(),this.closeTokenStats(),document.getElementById("monitorPanel").classList.remove("open");const e=document.getElementById("subagentsPanel");e&&e.classList.remove("open"),this.subagentPanelVisible=!1}});
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|