@max10240/opencode-plugin-infinite-loop 0.0.0-stage → 1.0.35
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 +84 -2
- package/README.zh-CN.md +76 -0
- package/dist/index.js +3 -0
- package/dist/src/controller.js +379 -0
- package/dist/src/duration.js +100 -0
- package/dist/src/index.js +277 -0
- package/dist/src/options.js +98 -0
- package/dist/src/rpc.js +118 -0
- package/dist/src/tracker.js +360 -0
- package/dist/src/tui.js +1320 -0
- package/dist/tui.js +9 -0
- package/package.json +67 -4
package/dist/src/tui.js
ADDED
|
@@ -0,0 +1,1320 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/tui.tsx
|
|
3
|
+
import { use as _$use } from "@opentui/solid";
|
|
4
|
+
import { createTextNode as _$createTextNode } from "@opentui/solid";
|
|
5
|
+
import { memo as _$memo } from "@opentui/solid";
|
|
6
|
+
import { effect as _$effect } from "@opentui/solid";
|
|
7
|
+
import { insertNode as _$insertNode } from "@opentui/solid";
|
|
8
|
+
import { insert as _$insert } from "@opentui/solid";
|
|
9
|
+
import { setProp as _$setProp } from "@opentui/solid";
|
|
10
|
+
import { createElement as _$createElement } from "@opentui/solid";
|
|
11
|
+
import { createComponent as _$createComponent } from "@opentui/solid";
|
|
12
|
+
import { Plugin } from "@opencode/plugin/tui";
|
|
13
|
+
import { TextAttributes } from "@opentui/core";
|
|
14
|
+
import { createEffect, createMemo, createSignal, For, onCleanup, onMount, Show } from "solid-js";
|
|
15
|
+
import { formatDuration, parseCooldown, parseDuration } from "./duration.js";
|
|
16
|
+
import { MAX_COOLDOWN_MS, infiniteLoopEnabled, parseInfiniteLoopOptions } from "./options.js";
|
|
17
|
+
import { InfiniteLoopRpc } from "./rpc.js";
|
|
18
|
+
var COMMAND_ID = "max10240.infinite-loop.open";
|
|
19
|
+
var OVERVIEW_COMMAND_ID = "max10240.infinite-loop.overview";
|
|
20
|
+
var SLASH_COMMAND = "infinite-loop";
|
|
21
|
+
var OVERVIEW_SLASH_COMMAND = "infinite-loops";
|
|
22
|
+
var tui_default = Plugin.define({
|
|
23
|
+
id: "max10240.infinite-loop.tui",
|
|
24
|
+
setup(context) {
|
|
25
|
+
return setupInfiniteLoopTui(context);
|
|
26
|
+
}
|
|
27
|
+
});
|
|
28
|
+
function setupInfiniteLoopTui(context) {
|
|
29
|
+
let options;
|
|
30
|
+
try {
|
|
31
|
+
options = parseInfiniteLoopOptions(context.options);
|
|
32
|
+
} catch (error) {
|
|
33
|
+
console.warn(`Infinite loop panel disabled: ${error instanceof Error ? error.message : "invalid options"}`);
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
if (!options.enabled || !infiniteLoopEnabled(context.options))
|
|
37
|
+
return;
|
|
38
|
+
context.keymap.layer(() => ({
|
|
39
|
+
mode: "global",
|
|
40
|
+
priority: 10,
|
|
41
|
+
commands: [{
|
|
42
|
+
id: COMMAND_ID,
|
|
43
|
+
title: "Open infinite loop",
|
|
44
|
+
description: "Keep the current session working: nudge it each time it idles until the time window ends",
|
|
45
|
+
group: "Session",
|
|
46
|
+
bind: options.keybind === false ? false : options.keybind,
|
|
47
|
+
palette: true,
|
|
48
|
+
slash: {
|
|
49
|
+
name: SLASH_COMMAND,
|
|
50
|
+
arguments: true
|
|
51
|
+
},
|
|
52
|
+
run: (input) => {
|
|
53
|
+
openInfiniteLoop(context, options, input);
|
|
54
|
+
}
|
|
55
|
+
}, {
|
|
56
|
+
id: OVERVIEW_COMMAND_ID,
|
|
57
|
+
title: "Open infinite loops",
|
|
58
|
+
description: "See and stop infinite loops across all projects",
|
|
59
|
+
group: "Session",
|
|
60
|
+
bind: options.overviewKeybind === false ? false : options.overviewKeybind,
|
|
61
|
+
palette: true,
|
|
62
|
+
slash: {
|
|
63
|
+
name: OVERVIEW_SLASH_COMMAND,
|
|
64
|
+
arguments: true
|
|
65
|
+
},
|
|
66
|
+
run: () => {
|
|
67
|
+
openInfiniteLoopOverview(context, options);
|
|
68
|
+
}
|
|
69
|
+
}]
|
|
70
|
+
}));
|
|
71
|
+
return setupInfiniteLoopStatus(context, options);
|
|
72
|
+
}
|
|
73
|
+
async function openInfiniteLoop(context, options, input) {
|
|
74
|
+
const sessionID = currentSessionID(context);
|
|
75
|
+
if (!sessionID) {
|
|
76
|
+
openInfiniteLoopOverview(context, options);
|
|
77
|
+
return;
|
|
78
|
+
}
|
|
79
|
+
const raw = input?.trim();
|
|
80
|
+
if (raw) {
|
|
81
|
+
const parsed = parseStartArgument(raw, options);
|
|
82
|
+
if (parsed.ok) {
|
|
83
|
+
await start(context, sessionID, parsed.durationMs, parsed.cooldownMs);
|
|
84
|
+
return;
|
|
85
|
+
}
|
|
86
|
+
context.ui.toast.show({
|
|
87
|
+
message: parsed.error,
|
|
88
|
+
variant: "error"
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
showPanel(context, options, "current", sessionID);
|
|
92
|
+
}
|
|
93
|
+
function openInfiniteLoopOverview(context, options) {
|
|
94
|
+
showPanel(context, options, "all", currentSessionID(context));
|
|
95
|
+
}
|
|
96
|
+
function showPanel(context, options, view, sessionID) {
|
|
97
|
+
context.ui.dialog.show(() => _$createComponent(InfiniteLoopPanel, {
|
|
98
|
+
context,
|
|
99
|
+
options,
|
|
100
|
+
initialView: view,
|
|
101
|
+
sessionID
|
|
102
|
+
}));
|
|
103
|
+
}
|
|
104
|
+
var statusListeners = new Set;
|
|
105
|
+
function notifyLoopStatusChanged() {
|
|
106
|
+
for (const listener of statusListeners)
|
|
107
|
+
listener();
|
|
108
|
+
}
|
|
109
|
+
function setupInfiniteLoopStatus(context, options) {
|
|
110
|
+
if (typeof context.ui?.slot !== "function")
|
|
111
|
+
return;
|
|
112
|
+
try {
|
|
113
|
+
return context.ui.slot({
|
|
114
|
+
append: "prompt.footer.status",
|
|
115
|
+
render: (input) => _$createComponent(InfiniteLoopStatusChip, {
|
|
116
|
+
context,
|
|
117
|
+
options,
|
|
118
|
+
get sessionID() {
|
|
119
|
+
return input.sessionID;
|
|
120
|
+
}
|
|
121
|
+
})
|
|
122
|
+
});
|
|
123
|
+
} catch {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
}
|
|
127
|
+
function InfiniteLoopStatusChip(props) {
|
|
128
|
+
const theme = props.context.theme;
|
|
129
|
+
const [status, setStatus] = createSignal();
|
|
130
|
+
const [hovered, setHovered] = createSignal(false);
|
|
131
|
+
let request = 0;
|
|
132
|
+
const refresh = async () => {
|
|
133
|
+
const sessionID = props.sessionID;
|
|
134
|
+
if (!sessionID) {
|
|
135
|
+
setStatus(undefined);
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const current = ++request;
|
|
139
|
+
try {
|
|
140
|
+
const value = await props.context.client.rpc(InfiniteLoopRpc).status({
|
|
141
|
+
sessionID
|
|
142
|
+
});
|
|
143
|
+
if (current !== request || props.sessionID !== sessionID)
|
|
144
|
+
return;
|
|
145
|
+
setStatus(value.active ? value : undefined);
|
|
146
|
+
} catch {
|
|
147
|
+
if (current === request && props.sessionID === sessionID)
|
|
148
|
+
setStatus(undefined);
|
|
149
|
+
}
|
|
150
|
+
};
|
|
151
|
+
const notify = () => {
|
|
152
|
+
refresh();
|
|
153
|
+
};
|
|
154
|
+
createEffect(() => {
|
|
155
|
+
props.sessionID;
|
|
156
|
+
refresh();
|
|
157
|
+
});
|
|
158
|
+
onMount(() => {
|
|
159
|
+
statusListeners.add(notify);
|
|
160
|
+
refresh();
|
|
161
|
+
const timer = setInterval(() => void refresh(), 60000);
|
|
162
|
+
let stopEvents;
|
|
163
|
+
if (typeof props.context.data?.listen === "function") {
|
|
164
|
+
try {
|
|
165
|
+
stopEvents = props.context.data.listen(({
|
|
166
|
+
details
|
|
167
|
+
}) => {
|
|
168
|
+
if (!details.type.startsWith("session.execution."))
|
|
169
|
+
return;
|
|
170
|
+
const sessionID = details.data?.sessionID;
|
|
171
|
+
if (sessionID === props.sessionID)
|
|
172
|
+
refresh();
|
|
173
|
+
});
|
|
174
|
+
} catch {}
|
|
175
|
+
}
|
|
176
|
+
onCleanup(() => {
|
|
177
|
+
statusListeners.delete(notify);
|
|
178
|
+
clearInterval(timer);
|
|
179
|
+
stopEvents?.();
|
|
180
|
+
});
|
|
181
|
+
});
|
|
182
|
+
const remaining = () => {
|
|
183
|
+
const deadline = status()?.deadline;
|
|
184
|
+
if (deadline === undefined)
|
|
185
|
+
return "";
|
|
186
|
+
return formatDuration(Math.max(0, deadline - Date.now()));
|
|
187
|
+
};
|
|
188
|
+
const label = () => {
|
|
189
|
+
const value = status();
|
|
190
|
+
if (!value?.active)
|
|
191
|
+
return "";
|
|
192
|
+
const time = remaining();
|
|
193
|
+
const phase = value.phase === "paused" ? "PAUSED" : "LOOP";
|
|
194
|
+
return time ? `\u221E ${phase} \xB7 ${time}` : `\u221E ${phase}`;
|
|
195
|
+
};
|
|
196
|
+
const color = () => status()?.phase === "paused" ? theme.text.feedback.warning.base : theme.text.action.primary.base;
|
|
197
|
+
return _$createComponent(Show, {
|
|
198
|
+
get when() {
|
|
199
|
+
return status()?.active;
|
|
200
|
+
},
|
|
201
|
+
get children() {
|
|
202
|
+
var _el$ = _$createElement("box"), _el$2 = _$createElement("text");
|
|
203
|
+
_$insertNode(_el$, _el$2);
|
|
204
|
+
_$setProp(_el$, "id", "infinite-loop-status-chip");
|
|
205
|
+
_$setProp(_el$, "flexShrink", 0);
|
|
206
|
+
_$setProp(_el$, "paddingLeft", 1);
|
|
207
|
+
_$setProp(_el$, "paddingRight", 1);
|
|
208
|
+
_$setProp(_el$, "onMouseOver", () => setHovered(true));
|
|
209
|
+
_$setProp(_el$, "onMouseOut", () => setHovered(false));
|
|
210
|
+
_$setProp(_el$, "onMouseUp", (event) => {
|
|
211
|
+
if (event.button !== 0 || !props.sessionID)
|
|
212
|
+
return;
|
|
213
|
+
event.stopPropagation();
|
|
214
|
+
showPanel(props.context, props.options, "current", props.sessionID);
|
|
215
|
+
});
|
|
216
|
+
_$setProp(_el$2, "wrapMode", "none");
|
|
217
|
+
_$insert(_el$2, label);
|
|
218
|
+
_$effect((_p$) => {
|
|
219
|
+
var _v$ = theme.background.raised.high, _v$2 = hovered() ? theme.text.action.primary.base : color(), _v$3 = TextAttributes.BOLD;
|
|
220
|
+
_v$ !== _p$.e && (_p$.e = _$setProp(_el$, "backgroundColor", _v$, _p$.e));
|
|
221
|
+
_v$2 !== _p$.t && (_p$.t = _$setProp(_el$2, "fg", _v$2, _p$.t));
|
|
222
|
+
_v$3 !== _p$.a && (_p$.a = _$setProp(_el$2, "attributes", _v$3, _p$.a));
|
|
223
|
+
return _p$;
|
|
224
|
+
}, {
|
|
225
|
+
e: undefined,
|
|
226
|
+
t: undefined,
|
|
227
|
+
a: undefined
|
|
228
|
+
});
|
|
229
|
+
return _el$;
|
|
230
|
+
}
|
|
231
|
+
});
|
|
232
|
+
}
|
|
233
|
+
function currentSessionID(context) {
|
|
234
|
+
const route = context.ui.router.current();
|
|
235
|
+
return route.type === "session" ? route.sessionID : undefined;
|
|
236
|
+
}
|
|
237
|
+
function parseStartArgument(raw, options) {
|
|
238
|
+
const tokens = raw.split(/\s+/).filter(Boolean);
|
|
239
|
+
const cooldownToken = tokens.find((token) => token.startsWith("cooldown="));
|
|
240
|
+
const durations = tokens.filter((token) => !token.startsWith("cooldown="));
|
|
241
|
+
if (durations.length !== 1) {
|
|
242
|
+
return {
|
|
243
|
+
ok: false,
|
|
244
|
+
error: "Use /infinite-loop 90m or /infinite-loop 90m cooldown=5m"
|
|
245
|
+
};
|
|
246
|
+
}
|
|
247
|
+
const duration = parseDuration(durations[0], {
|
|
248
|
+
minMs: options.minDurationMs,
|
|
249
|
+
maxMs: options.maxDurationMs
|
|
250
|
+
});
|
|
251
|
+
if (!duration.ok)
|
|
252
|
+
return duration;
|
|
253
|
+
if (cooldownToken === undefined)
|
|
254
|
+
return {
|
|
255
|
+
ok: true,
|
|
256
|
+
durationMs: duration.ms
|
|
257
|
+
};
|
|
258
|
+
const value = cooldownToken.slice("cooldown=".length).trim();
|
|
259
|
+
if (!value)
|
|
260
|
+
return {
|
|
261
|
+
ok: true,
|
|
262
|
+
durationMs: duration.ms
|
|
263
|
+
};
|
|
264
|
+
const cooldown = parseCooldown(value, {
|
|
265
|
+
minMs: 0,
|
|
266
|
+
maxMs: MAX_COOLDOWN_MS
|
|
267
|
+
});
|
|
268
|
+
if (!cooldown.ok)
|
|
269
|
+
return cooldown;
|
|
270
|
+
return {
|
|
271
|
+
ok: true,
|
|
272
|
+
durationMs: duration.ms,
|
|
273
|
+
cooldownMs: cooldown.ms
|
|
274
|
+
};
|
|
275
|
+
}
|
|
276
|
+
async function start(context, sessionID, durationMs, cooldownMs) {
|
|
277
|
+
try {
|
|
278
|
+
const status = await context.client.rpc(InfiniteLoopRpc).start({
|
|
279
|
+
sessionID,
|
|
280
|
+
durationMs,
|
|
281
|
+
...cooldownMs === undefined ? {} : {
|
|
282
|
+
cooldownMs
|
|
283
|
+
}
|
|
284
|
+
});
|
|
285
|
+
notifyLoopStatusChanged();
|
|
286
|
+
const effective = status.cooldownMs ?? cooldownMs ?? 0;
|
|
287
|
+
context.ui.toast.show({
|
|
288
|
+
message: `Infinite loop started \xB7 runs for ${formatDuration(durationMs)}${effective > 0 ? ` \xB7 cooldown ${formatDuration(effective)}` : " \xB7 no cooldown"}`,
|
|
289
|
+
variant: "success"
|
|
290
|
+
});
|
|
291
|
+
} catch (error) {
|
|
292
|
+
context.ui.toast.show({
|
|
293
|
+
message: describe(error),
|
|
294
|
+
variant: "error"
|
|
295
|
+
});
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
async function stop(context, sessionID) {
|
|
299
|
+
try {
|
|
300
|
+
const before = await context.client.rpc(InfiniteLoopRpc).status({
|
|
301
|
+
sessionID
|
|
302
|
+
});
|
|
303
|
+
if (!before.active) {
|
|
304
|
+
notifyLoopStatusChanged();
|
|
305
|
+
context.ui.toast.show({
|
|
306
|
+
message: "Infinite loop is not running",
|
|
307
|
+
variant: "info"
|
|
308
|
+
});
|
|
309
|
+
return before;
|
|
310
|
+
}
|
|
311
|
+
const status = await context.client.rpc(InfiniteLoopRpc).stop({
|
|
312
|
+
sessionID
|
|
313
|
+
});
|
|
314
|
+
notifyLoopStatusChanged();
|
|
315
|
+
context.ui.toast.show({
|
|
316
|
+
message: "Infinite loop stopped",
|
|
317
|
+
variant: "info"
|
|
318
|
+
});
|
|
319
|
+
return status;
|
|
320
|
+
} catch (error) {
|
|
321
|
+
context.ui.toast.show({
|
|
322
|
+
message: describe(error),
|
|
323
|
+
variant: "error"
|
|
324
|
+
});
|
|
325
|
+
return;
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function describe(error) {
|
|
329
|
+
const message = error instanceof Error ? error.message : error && typeof error === "object" && ("message" in error) && typeof error.message === "string" ? error.message : undefined;
|
|
330
|
+
if (message === undefined)
|
|
331
|
+
return "Infinite loop command failed";
|
|
332
|
+
if (message.includes("unavailable") || message.includes("not registered") || message.includes("No registered")) {
|
|
333
|
+
return "Infinite loop server is unavailable; enable features.infiniteLoop";
|
|
334
|
+
}
|
|
335
|
+
return message;
|
|
336
|
+
}
|
|
337
|
+
function InfiniteLoopPanel(props) {
|
|
338
|
+
const theme = props.context.theme.surface("dialog");
|
|
339
|
+
const bounds = {
|
|
340
|
+
minMs: props.options.minDurationMs,
|
|
341
|
+
maxMs: props.options.maxDurationMs
|
|
342
|
+
};
|
|
343
|
+
const cooldownBounds = {
|
|
344
|
+
minMs: 0,
|
|
345
|
+
maxMs: MAX_COOLDOWN_MS
|
|
346
|
+
};
|
|
347
|
+
const presets = props.options.presets.filter((preset) => parseDuration(preset, bounds).ok);
|
|
348
|
+
const [view, setView] = createSignal(props.initialView);
|
|
349
|
+
const [state, setState] = createSignal();
|
|
350
|
+
const [loops, setLoops] = createSignal([]);
|
|
351
|
+
const [selected, setSelected] = createSignal(0);
|
|
352
|
+
const [custom, setCustom] = createSignal("");
|
|
353
|
+
const [cooldownText, setCooldownText] = createSignal("");
|
|
354
|
+
const [working, setWorking] = createSignal(false);
|
|
355
|
+
const [error, setError] = createSignal();
|
|
356
|
+
const [help, setHelp] = createSignal(false);
|
|
357
|
+
const [loading, setLoading] = createSignal(true);
|
|
358
|
+
const [now, setNow] = createSignal(Date.now());
|
|
359
|
+
const [pendingStop, setPendingStop] = createSignal();
|
|
360
|
+
let durationInput;
|
|
361
|
+
let cooldownInput;
|
|
362
|
+
let loopList;
|
|
363
|
+
let refreshingCurrent = false;
|
|
364
|
+
let refreshingAll = false;
|
|
365
|
+
let scrollTimer;
|
|
366
|
+
let stopTimer;
|
|
367
|
+
const durationTarget = () => durationInput;
|
|
368
|
+
const cooldownTarget = () => cooldownInput;
|
|
369
|
+
const formBackground = theme.background?.formfield?.base ?? theme.background?.base;
|
|
370
|
+
const formFocusedBackground = theme.background?.formfield?.focused ?? theme.background?.raised?.high;
|
|
371
|
+
const formFocusedText = theme.text?.formfield?.focused ?? theme.text.formfield.base;
|
|
372
|
+
const clearPendingStop = () => {
|
|
373
|
+
if (stopTimer !== undefined)
|
|
374
|
+
clearTimeout(stopTimer);
|
|
375
|
+
stopTimer = undefined;
|
|
376
|
+
setPendingStop(undefined);
|
|
377
|
+
};
|
|
378
|
+
const armPendingStop = (sessionID) => {
|
|
379
|
+
clearPendingStop();
|
|
380
|
+
setPendingStop(sessionID);
|
|
381
|
+
stopTimer = setTimeout(() => {
|
|
382
|
+
stopTimer = undefined;
|
|
383
|
+
setPendingStop(undefined);
|
|
384
|
+
}, 3000);
|
|
385
|
+
};
|
|
386
|
+
const refreshCurrent = async () => {
|
|
387
|
+
if (!props.sessionID || refreshingCurrent)
|
|
388
|
+
return;
|
|
389
|
+
refreshingCurrent = true;
|
|
390
|
+
try {
|
|
391
|
+
setState(await props.context.client.rpc(InfiniteLoopRpc).status({
|
|
392
|
+
sessionID: props.sessionID
|
|
393
|
+
}));
|
|
394
|
+
if (view() === "current")
|
|
395
|
+
setError(undefined);
|
|
396
|
+
} catch (cause) {
|
|
397
|
+
setError(describe(cause));
|
|
398
|
+
} finally {
|
|
399
|
+
refreshingCurrent = false;
|
|
400
|
+
}
|
|
401
|
+
};
|
|
402
|
+
const refreshAll = async () => {
|
|
403
|
+
if (refreshingAll)
|
|
404
|
+
return;
|
|
405
|
+
refreshingAll = true;
|
|
406
|
+
try {
|
|
407
|
+
setLoops(await props.context.client.rpc(InfiniteLoopRpc).list({}));
|
|
408
|
+
if (view() === "all")
|
|
409
|
+
setError(undefined);
|
|
410
|
+
} catch (cause) {
|
|
411
|
+
setError(describe(cause));
|
|
412
|
+
} finally {
|
|
413
|
+
refreshingAll = false;
|
|
414
|
+
setLoading(false);
|
|
415
|
+
}
|
|
416
|
+
};
|
|
417
|
+
const refresh = async () => {
|
|
418
|
+
await Promise.all([refreshCurrent(), refreshAll()]);
|
|
419
|
+
};
|
|
420
|
+
const startWith = async (durationMs, cooldownMs) => {
|
|
421
|
+
if (!props.sessionID) {
|
|
422
|
+
props.context.ui.toast.show({
|
|
423
|
+
message: "Open a session first",
|
|
424
|
+
variant: "warning"
|
|
425
|
+
});
|
|
426
|
+
return;
|
|
427
|
+
}
|
|
428
|
+
setWorking(true);
|
|
429
|
+
clearPendingStop();
|
|
430
|
+
try {
|
|
431
|
+
const status = await props.context.client.rpc(InfiniteLoopRpc).start({
|
|
432
|
+
sessionID: props.sessionID,
|
|
433
|
+
durationMs,
|
|
434
|
+
...cooldownMs === undefined ? {} : {
|
|
435
|
+
cooldownMs
|
|
436
|
+
}
|
|
437
|
+
});
|
|
438
|
+
setState(status);
|
|
439
|
+
setError(undefined);
|
|
440
|
+
notifyLoopStatusChanged();
|
|
441
|
+
const effective = status.cooldownMs ?? cooldownMs ?? 0;
|
|
442
|
+
props.context.ui.toast.show({
|
|
443
|
+
message: `Infinite loop started \xB7 runs for ${formatDuration(durationMs)}${effective > 0 ? ` \xB7 cooldown ${formatDuration(effective)}` : " \xB7 no cooldown"}`,
|
|
444
|
+
variant: "success"
|
|
445
|
+
});
|
|
446
|
+
refreshAll();
|
|
447
|
+
} catch (cause) {
|
|
448
|
+
setError(describe(cause));
|
|
449
|
+
} finally {
|
|
450
|
+
setWorking(false);
|
|
451
|
+
}
|
|
452
|
+
};
|
|
453
|
+
const cooldownValue = () => {
|
|
454
|
+
const text = cooldownText().trim();
|
|
455
|
+
if (!text)
|
|
456
|
+
return {
|
|
457
|
+
ok: true
|
|
458
|
+
};
|
|
459
|
+
const parsed = parseCooldown(text, cooldownBounds);
|
|
460
|
+
if (!parsed.ok) {
|
|
461
|
+
props.context.ui.toast.show({
|
|
462
|
+
message: parsed.error,
|
|
463
|
+
variant: "error"
|
|
464
|
+
});
|
|
465
|
+
return {
|
|
466
|
+
ok: false
|
|
467
|
+
};
|
|
468
|
+
}
|
|
469
|
+
return {
|
|
470
|
+
ok: true,
|
|
471
|
+
value: parsed.ms
|
|
472
|
+
};
|
|
473
|
+
};
|
|
474
|
+
const startCustom = () => {
|
|
475
|
+
const text = custom().trim();
|
|
476
|
+
let durationMs = props.options.defaultDurationMs;
|
|
477
|
+
if (text) {
|
|
478
|
+
const parsed = parseDuration(text, bounds);
|
|
479
|
+
if (!parsed.ok) {
|
|
480
|
+
props.context.ui.toast.show({
|
|
481
|
+
message: parsed.error,
|
|
482
|
+
variant: "error"
|
|
483
|
+
});
|
|
484
|
+
return;
|
|
485
|
+
}
|
|
486
|
+
durationMs = parsed.ms;
|
|
487
|
+
}
|
|
488
|
+
const cooldown = cooldownValue();
|
|
489
|
+
if (!cooldown.ok)
|
|
490
|
+
return;
|
|
491
|
+
startWith(durationMs, cooldown.value);
|
|
492
|
+
};
|
|
493
|
+
const startPreset = (preset) => {
|
|
494
|
+
const parsed = parseDuration(preset, bounds);
|
|
495
|
+
if (!parsed.ok)
|
|
496
|
+
return;
|
|
497
|
+
const cooldown = cooldownValue();
|
|
498
|
+
if (!cooldown.ok)
|
|
499
|
+
return;
|
|
500
|
+
startWith(parsed.ms, cooldown.value);
|
|
501
|
+
};
|
|
502
|
+
const stopCurrent = async () => {
|
|
503
|
+
if (!props.sessionID || working())
|
|
504
|
+
return;
|
|
505
|
+
setWorking(true);
|
|
506
|
+
try {
|
|
507
|
+
setState(await stop(props.context, props.sessionID) ?? state());
|
|
508
|
+
clearPendingStop();
|
|
509
|
+
refreshAll();
|
|
510
|
+
} finally {
|
|
511
|
+
setWorking(false);
|
|
512
|
+
}
|
|
513
|
+
};
|
|
514
|
+
const stopSelected = async () => {
|
|
515
|
+
const item = selectedItem();
|
|
516
|
+
if (!item || working())
|
|
517
|
+
return;
|
|
518
|
+
setWorking(true);
|
|
519
|
+
try {
|
|
520
|
+
await stop(props.context, item.sessionID);
|
|
521
|
+
clearPendingStop();
|
|
522
|
+
await Promise.all([refreshAll(), item.sessionID === props.sessionID ? refreshCurrent() : Promise.resolve()]);
|
|
523
|
+
} finally {
|
|
524
|
+
setWorking(false);
|
|
525
|
+
}
|
|
526
|
+
};
|
|
527
|
+
const requestStopCurrent = () => {
|
|
528
|
+
if (!props.sessionID || working() || state()?.active !== true)
|
|
529
|
+
return;
|
|
530
|
+
if (pendingStop() === props.sessionID) {
|
|
531
|
+
clearPendingStop();
|
|
532
|
+
stopCurrent();
|
|
533
|
+
return;
|
|
534
|
+
}
|
|
535
|
+
armPendingStop(props.sessionID);
|
|
536
|
+
};
|
|
537
|
+
const requestStopSelected = () => {
|
|
538
|
+
const item = selectedItem();
|
|
539
|
+
if (!item || working())
|
|
540
|
+
return;
|
|
541
|
+
if (pendingStop() === item.sessionID) {
|
|
542
|
+
clearPendingStop();
|
|
543
|
+
stopSelected();
|
|
544
|
+
return;
|
|
545
|
+
}
|
|
546
|
+
armPendingStop(item.sessionID);
|
|
547
|
+
};
|
|
548
|
+
const stopAll = async () => {
|
|
549
|
+
clearPendingStop();
|
|
550
|
+
const items = loops();
|
|
551
|
+
if (items.length === 0) {
|
|
552
|
+
props.context.ui.toast.show({
|
|
553
|
+
message: "No running loops",
|
|
554
|
+
variant: "info"
|
|
555
|
+
});
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
setWorking(true);
|
|
559
|
+
const confirmed = await props.context.ui.dialog.confirm({
|
|
560
|
+
title: "Stop all infinite loops?",
|
|
561
|
+
message: `${items.length} ${items.length === 1 ? "loop" : "loops"} will stop.`,
|
|
562
|
+
label: {
|
|
563
|
+
confirm: "Stop all",
|
|
564
|
+
cancel: "Cancel"
|
|
565
|
+
}
|
|
566
|
+
});
|
|
567
|
+
if (confirmed) {
|
|
568
|
+
await Promise.allSettled(items.map((item) => props.context.client.rpc(InfiniteLoopRpc).stop({
|
|
569
|
+
sessionID: item.sessionID
|
|
570
|
+
})));
|
|
571
|
+
notifyLoopStatusChanged();
|
|
572
|
+
props.context.ui.toast.show({
|
|
573
|
+
message: `Stopped ${items.length} ${items.length === 1 ? "infinite loop" : "infinite loops"}`,
|
|
574
|
+
variant: "info"
|
|
575
|
+
});
|
|
576
|
+
}
|
|
577
|
+
setWorking(false);
|
|
578
|
+
showPanel(props.context, props.options, "all", props.sessionID);
|
|
579
|
+
};
|
|
580
|
+
const toggleView = () => {
|
|
581
|
+
if (view() === "all") {
|
|
582
|
+
if (!props.sessionID)
|
|
583
|
+
return;
|
|
584
|
+
setView("current");
|
|
585
|
+
setTimeout(() => durationTarget()?.focus(), 0);
|
|
586
|
+
refreshCurrent();
|
|
587
|
+
return;
|
|
588
|
+
}
|
|
589
|
+
setView("all");
|
|
590
|
+
refreshAll();
|
|
591
|
+
const index = loops().findIndex((item) => item.sessionID === props.sessionID);
|
|
592
|
+
setSelected(Math.max(0, index));
|
|
593
|
+
setTimeout(() => loopList?.focus(), 0);
|
|
594
|
+
};
|
|
595
|
+
const moveSelection = (delta) => {
|
|
596
|
+
const count = loops().length;
|
|
597
|
+
if (count === 0)
|
|
598
|
+
return;
|
|
599
|
+
setSelected((value) => Math.min(count - 1, Math.max(0, value + delta)));
|
|
600
|
+
};
|
|
601
|
+
createEffect(() => {
|
|
602
|
+
const count = loops().length;
|
|
603
|
+
if (selected() >= count)
|
|
604
|
+
setSelected(Math.max(0, count - 1));
|
|
605
|
+
});
|
|
606
|
+
createEffect(() => {
|
|
607
|
+
selected();
|
|
608
|
+
view();
|
|
609
|
+
clearPendingStop();
|
|
610
|
+
});
|
|
611
|
+
createEffect(() => {
|
|
612
|
+
const item = loops()[selected()];
|
|
613
|
+
if (!item || !loopList)
|
|
614
|
+
return;
|
|
615
|
+
if (scrollTimer !== undefined)
|
|
616
|
+
clearTimeout(scrollTimer);
|
|
617
|
+
scrollTimer = setTimeout(() => {
|
|
618
|
+
scrollTimer = undefined;
|
|
619
|
+
const box = loopList;
|
|
620
|
+
if (box && !box.isDestroyed)
|
|
621
|
+
box.scrollChildIntoView(item.sessionID);
|
|
622
|
+
}, 0);
|
|
623
|
+
});
|
|
624
|
+
createEffect(() => {
|
|
625
|
+
props.context.ui.dialog.set({
|
|
626
|
+
size: view() === "all" ? "large" : "medium",
|
|
627
|
+
centered: true
|
|
628
|
+
});
|
|
629
|
+
});
|
|
630
|
+
onMount(() => {
|
|
631
|
+
refresh();
|
|
632
|
+
setTimeout(() => {
|
|
633
|
+
if (view() === "all")
|
|
634
|
+
loopList?.focus();
|
|
635
|
+
else
|
|
636
|
+
durationTarget()?.focus();
|
|
637
|
+
}, 0);
|
|
638
|
+
const ticker = setInterval(() => {
|
|
639
|
+
setNow(Date.now());
|
|
640
|
+
refresh();
|
|
641
|
+
}, 1000);
|
|
642
|
+
onCleanup(() => {
|
|
643
|
+
clearInterval(ticker);
|
|
644
|
+
if (scrollTimer !== undefined)
|
|
645
|
+
clearTimeout(scrollTimer);
|
|
646
|
+
if (stopTimer !== undefined)
|
|
647
|
+
clearTimeout(stopTimer);
|
|
648
|
+
});
|
|
649
|
+
});
|
|
650
|
+
const currentTitle = () => {
|
|
651
|
+
if (!props.sessionID)
|
|
652
|
+
return "";
|
|
653
|
+
return props.context.data.session.get(props.sessionID)?.title ?? props.sessionID;
|
|
654
|
+
};
|
|
655
|
+
const clock = (timestamp) => {
|
|
656
|
+
if (timestamp === undefined)
|
|
657
|
+
return "--:--";
|
|
658
|
+
const date = new Date(timestamp);
|
|
659
|
+
return `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
|
|
660
|
+
};
|
|
661
|
+
const remaining = (timestamp) => {
|
|
662
|
+
if (timestamp === undefined)
|
|
663
|
+
return "";
|
|
664
|
+
return formatDuration(Math.max(0, timestamp - now()));
|
|
665
|
+
};
|
|
666
|
+
const sentLabel = (count) => {
|
|
667
|
+
const sent = count ?? 0;
|
|
668
|
+
return `${sent} ${sent === 1 ? "nudge" : "nudges"}`;
|
|
669
|
+
};
|
|
670
|
+
const currentHeadline = () => {
|
|
671
|
+
const value = state();
|
|
672
|
+
if (!value?.active)
|
|
673
|
+
return "This session \u25CB Not running";
|
|
674
|
+
return `This session \u25CF Running \xB7 sent ${sentLabel(value.sentCount)}`;
|
|
675
|
+
};
|
|
676
|
+
const currentDetails = () => {
|
|
677
|
+
const value = state();
|
|
678
|
+
if (!value)
|
|
679
|
+
return ["This session has no infinite loop."];
|
|
680
|
+
if (value.active) {
|
|
681
|
+
const cooldown = value.cooldownMs === undefined ? "" : value.cooldownMs > 0 ? ` \xB7 cooldown ${formatDuration(value.cooldownMs)}` : " \xB7 no cooldown";
|
|
682
|
+
const lines = [`ends ${clock(value.deadline)} \xB7 ${remaining(value.deadline)} left${cooldown}`];
|
|
683
|
+
if (value.phase === "paused") {
|
|
684
|
+
lines.push("Paused after manual interrupt \xB7 resumes after the next normal turn");
|
|
685
|
+
} else if (value.cooldownUntil !== undefined && value.cooldownUntil > now()) {
|
|
686
|
+
lines.push(`Cooling down \xB7 next nudge in ${remaining(value.cooldownUntil)}`);
|
|
687
|
+
} else if (value.nextNudgeAt !== undefined && value.nextNudgeAt > now()) {
|
|
688
|
+
lines.push(`Nudge in ${remaining(value.nextNudgeAt)}`);
|
|
689
|
+
} else if (value.phase === "checking") {
|
|
690
|
+
lines.push("Checking background work\u2026");
|
|
691
|
+
} else {
|
|
692
|
+
lines.push("Waiting for this session to go idle\u2026");
|
|
693
|
+
}
|
|
694
|
+
return lines;
|
|
695
|
+
}
|
|
696
|
+
if (value.outcome) {
|
|
697
|
+
const sent = value.outcome.sentCount ?? 0;
|
|
698
|
+
return [`${value.outcome.reason === "expired" ? "Expired" : "Stopped"} at ${clock(value.outcome.at)}${sent > 0 ? ` \xB7 sent ${sentLabel(sent)}` : ""}`];
|
|
699
|
+
}
|
|
700
|
+
return ["This session has no infinite loop."];
|
|
701
|
+
};
|
|
702
|
+
const durationPreview = createMemo(() => {
|
|
703
|
+
const text = custom().trim();
|
|
704
|
+
return text ? parseDuration(text, bounds) : undefined;
|
|
705
|
+
});
|
|
706
|
+
const cooldownPreview = createMemo(() => {
|
|
707
|
+
const text = cooldownText().trim();
|
|
708
|
+
return text ? parseCooldown(text, cooldownBounds) : undefined;
|
|
709
|
+
});
|
|
710
|
+
const grouped = createMemo(() => {
|
|
711
|
+
const groups = [];
|
|
712
|
+
const byDirectory = new Map;
|
|
713
|
+
for (const item of loops()) {
|
|
714
|
+
const directory = item.directory ?? "";
|
|
715
|
+
const list = byDirectory.get(directory) ?? [];
|
|
716
|
+
list.push(item);
|
|
717
|
+
byDirectory.set(directory, list);
|
|
718
|
+
}
|
|
719
|
+
for (const [directory, items] of byDirectory)
|
|
720
|
+
groups.push({
|
|
721
|
+
directory,
|
|
722
|
+
items
|
|
723
|
+
});
|
|
724
|
+
return groups;
|
|
725
|
+
});
|
|
726
|
+
const selectedItem = () => loops()[selected()];
|
|
727
|
+
const phaseLabel = (item) => {
|
|
728
|
+
if (item.phase === "paused")
|
|
729
|
+
return "paused";
|
|
730
|
+
if (item.cooldownUntil !== undefined && item.cooldownUntil > now())
|
|
731
|
+
return `cooling ${remaining(item.cooldownUntil)}`;
|
|
732
|
+
if (item.nextNudgeAt !== undefined && item.nextNudgeAt > now())
|
|
733
|
+
return `next ${remaining(item.nextNudgeAt)}`;
|
|
734
|
+
if (item.phase === "checking")
|
|
735
|
+
return "checking";
|
|
736
|
+
return "waiting";
|
|
737
|
+
};
|
|
738
|
+
props.context.keymap.layer(() => ({
|
|
739
|
+
mode: "modal",
|
|
740
|
+
priority: 20,
|
|
741
|
+
commands: [{
|
|
742
|
+
bind: "escape",
|
|
743
|
+
title: "Close infinite loop",
|
|
744
|
+
run: () => {
|
|
745
|
+
if (help())
|
|
746
|
+
setHelp(false);
|
|
747
|
+
else
|
|
748
|
+
props.context.ui.dialog.clear();
|
|
749
|
+
}
|
|
750
|
+
}, {
|
|
751
|
+
bind: "f1",
|
|
752
|
+
title: "Toggle infinite loop help",
|
|
753
|
+
run: () => {
|
|
754
|
+
setHelp((value) => !value);
|
|
755
|
+
}
|
|
756
|
+
}, {
|
|
757
|
+
bind: "ctrl+a",
|
|
758
|
+
title: "Toggle all infinite loops",
|
|
759
|
+
run: toggleView,
|
|
760
|
+
enabled: () => props.sessionID !== undefined
|
|
761
|
+
}, {
|
|
762
|
+
bind: "ctrl+d",
|
|
763
|
+
title: view() === "all" ? "Stop selected infinite loop" : "Stop this infinite loop",
|
|
764
|
+
enabled: () => !working() && (view() === "all" ? selectedItem() !== undefined : state()?.active === true),
|
|
765
|
+
run: () => {
|
|
766
|
+
if (view() === "all")
|
|
767
|
+
requestStopSelected();
|
|
768
|
+
else
|
|
769
|
+
requestStopCurrent();
|
|
770
|
+
}
|
|
771
|
+
}, {
|
|
772
|
+
bind: "ctrl+shift+d",
|
|
773
|
+
title: "Stop all infinite loops",
|
|
774
|
+
enabled: () => view() === "all" && !working(),
|
|
775
|
+
run: () => void stopAll()
|
|
776
|
+
}, {
|
|
777
|
+
bind: "ctrl+r",
|
|
778
|
+
title: "Refresh infinite loops",
|
|
779
|
+
enabled: () => view() === "all",
|
|
780
|
+
run: () => void refresh()
|
|
781
|
+
}, {
|
|
782
|
+
bind: "up",
|
|
783
|
+
title: "Previous infinite loop",
|
|
784
|
+
enabled: () => view() === "all",
|
|
785
|
+
run: () => moveSelection(-1)
|
|
786
|
+
}, {
|
|
787
|
+
bind: "down",
|
|
788
|
+
title: "Next infinite loop",
|
|
789
|
+
enabled: () => view() === "all",
|
|
790
|
+
run: () => moveSelection(1)
|
|
791
|
+
}]
|
|
792
|
+
}));
|
|
793
|
+
props.context.keymap.layer(() => ({
|
|
794
|
+
mode: "modal",
|
|
795
|
+
priority: 20,
|
|
796
|
+
target: durationTarget,
|
|
797
|
+
enabled: () => view() === "current",
|
|
798
|
+
commands: [{
|
|
799
|
+
bind: "return",
|
|
800
|
+
title: "Start infinite loop",
|
|
801
|
+
enabled: () => !working(),
|
|
802
|
+
run: startCustom
|
|
803
|
+
}, {
|
|
804
|
+
bind: "tab",
|
|
805
|
+
title: "Focus cooldown",
|
|
806
|
+
run: () => cooldownTarget()?.focus()
|
|
807
|
+
}, {
|
|
808
|
+
bind: "shift+tab",
|
|
809
|
+
title: "Focus cooldown",
|
|
810
|
+
run: () => cooldownTarget()?.focus()
|
|
811
|
+
}, {
|
|
812
|
+
bind: "f1",
|
|
813
|
+
title: "Toggle infinite loop help",
|
|
814
|
+
run: () => {
|
|
815
|
+
setHelp((value) => !value);
|
|
816
|
+
}
|
|
817
|
+
}]
|
|
818
|
+
}));
|
|
819
|
+
props.context.keymap.layer(() => ({
|
|
820
|
+
mode: "modal",
|
|
821
|
+
priority: 20,
|
|
822
|
+
target: cooldownTarget,
|
|
823
|
+
enabled: () => view() === "current",
|
|
824
|
+
commands: [{
|
|
825
|
+
bind: "return",
|
|
826
|
+
title: "Start infinite loop",
|
|
827
|
+
enabled: () => !working(),
|
|
828
|
+
run: startCustom
|
|
829
|
+
}, {
|
|
830
|
+
bind: "tab",
|
|
831
|
+
title: "Focus duration",
|
|
832
|
+
run: () => durationTarget()?.focus()
|
|
833
|
+
}, {
|
|
834
|
+
bind: "shift+tab",
|
|
835
|
+
title: "Focus duration",
|
|
836
|
+
run: () => durationTarget()?.focus()
|
|
837
|
+
}, {
|
|
838
|
+
bind: "f1",
|
|
839
|
+
title: "Toggle infinite loop help",
|
|
840
|
+
run: () => {
|
|
841
|
+
setHelp((value) => !value);
|
|
842
|
+
}
|
|
843
|
+
}]
|
|
844
|
+
}));
|
|
845
|
+
return (() => {
|
|
846
|
+
var _el$3 = _$createElement("box"), _el$4 = _$createElement("box"), _el$5 = _$createElement("text"), _el$6 = _$createElement("text");
|
|
847
|
+
_$insertNode(_el$3, _el$4);
|
|
848
|
+
_$setProp(_el$3, "paddingLeft", 2);
|
|
849
|
+
_$setProp(_el$3, "paddingRight", 2);
|
|
850
|
+
_$setProp(_el$3, "gap", 1);
|
|
851
|
+
_$insertNode(_el$4, _el$5);
|
|
852
|
+
_$insertNode(_el$4, _el$6);
|
|
853
|
+
_$setProp(_el$4, "flexDirection", "row");
|
|
854
|
+
_$setProp(_el$4, "justifyContent", "space-between");
|
|
855
|
+
_$insert(_el$5, (() => {
|
|
856
|
+
var _c$ = _$memo(() => view() === "all");
|
|
857
|
+
return () => _c$() ? `Infinite loops${loops().length > 0 ? ` \xB7 ${loops().length} running` : ""}` : "Infinite loop";
|
|
858
|
+
})());
|
|
859
|
+
_$insertNode(_el$6, _$createTextNode(`f1 help \xB7 esc close`));
|
|
860
|
+
_$insert(_el$3, _$createComponent(Show, {
|
|
861
|
+
get when() {
|
|
862
|
+
return view() === "current";
|
|
863
|
+
},
|
|
864
|
+
get children() {
|
|
865
|
+
return [(() => {
|
|
866
|
+
var _el$8 = _$createElement("text");
|
|
867
|
+
_$setProp(_el$8, "wrapMode", "word");
|
|
868
|
+
_$insert(_el$8, currentTitle);
|
|
869
|
+
_$effect((_$p) => _$setProp(_el$8, "fg", theme.text.muted, _$p));
|
|
870
|
+
return _el$8;
|
|
871
|
+
})(), (() => {
|
|
872
|
+
var _el$9 = _$createElement("text");
|
|
873
|
+
_$insert(_el$9, currentHeadline);
|
|
874
|
+
_$effect((_$p) => _$setProp(_el$9, "fg", theme.text.base, _$p));
|
|
875
|
+
return _el$9;
|
|
876
|
+
})(), _$createComponent(Show, {
|
|
877
|
+
get when() {
|
|
878
|
+
return _$memo(() => props.sessionID !== undefined)() && pendingStop() === props.sessionID;
|
|
879
|
+
},
|
|
880
|
+
get children() {
|
|
881
|
+
var _el$0 = _$createElement("text");
|
|
882
|
+
_$insertNode(_el$0, _$createTextNode(`Press ctrl+d again to stop this loop.`));
|
|
883
|
+
_$effect((_$p) => _$setProp(_el$0, "fg", theme.text.feedback?.warning?.base ?? theme.text.base, _$p));
|
|
884
|
+
return _el$0;
|
|
885
|
+
}
|
|
886
|
+
}), _$createComponent(For, {
|
|
887
|
+
get each() {
|
|
888
|
+
return currentDetails();
|
|
889
|
+
},
|
|
890
|
+
children: (line) => (() => {
|
|
891
|
+
var _el$33 = _$createElement("text");
|
|
892
|
+
_$setProp(_el$33, "wrapMode", "word");
|
|
893
|
+
_$insert(_el$33, line);
|
|
894
|
+
_$effect((_$p) => _$setProp(_el$33, "fg", theme.text.muted, _$p));
|
|
895
|
+
return _el$33;
|
|
896
|
+
})()
|
|
897
|
+
})];
|
|
898
|
+
}
|
|
899
|
+
}), null);
|
|
900
|
+
_$insert(_el$3, _$createComponent(Show, {
|
|
901
|
+
get when() {
|
|
902
|
+
return view() === "all";
|
|
903
|
+
},
|
|
904
|
+
get children() {
|
|
905
|
+
var _el$10 = _$createElement("text");
|
|
906
|
+
_$insertNode(_el$10, _$createTextNode(`All projects`));
|
|
907
|
+
_$effect((_$p) => _$setProp(_el$10, "fg", theme.text.muted, _$p));
|
|
908
|
+
return _el$10;
|
|
909
|
+
}
|
|
910
|
+
}), null);
|
|
911
|
+
_$insert(_el$3, _$createComponent(Show, {
|
|
912
|
+
get when() {
|
|
913
|
+
return error();
|
|
914
|
+
},
|
|
915
|
+
children: (message) => (() => {
|
|
916
|
+
var _el$34 = _$createElement("text");
|
|
917
|
+
_$setProp(_el$34, "wrapMode", "word");
|
|
918
|
+
_$insert(_el$34, message);
|
|
919
|
+
_$effect((_$p) => _$setProp(_el$34, "fg", theme.text.feedback?.error?.base ?? theme.text.base, _$p));
|
|
920
|
+
return _el$34;
|
|
921
|
+
})()
|
|
922
|
+
}), null);
|
|
923
|
+
_$insert(_el$3, _$createComponent(Show, {
|
|
924
|
+
get when() {
|
|
925
|
+
return help();
|
|
926
|
+
},
|
|
927
|
+
get children() {
|
|
928
|
+
var _el$12 = _$createElement("box"), _el$13 = _$createElement("text"), _el$15 = _$createElement("text"), _el$17 = _$createElement("text"), _el$19 = _$createElement("text"), _el$21 = _$createElement("text");
|
|
929
|
+
_$insertNode(_el$12, _el$13);
|
|
930
|
+
_$insertNode(_el$12, _el$15);
|
|
931
|
+
_$insertNode(_el$12, _el$17);
|
|
932
|
+
_$insertNode(_el$12, _el$19);
|
|
933
|
+
_$insertNode(_el$12, _el$21);
|
|
934
|
+
_$setProp(_el$12, "flexDirection", "column");
|
|
935
|
+
_$setProp(_el$12, "paddingLeft", 1);
|
|
936
|
+
_$setProp(_el$12, "paddingRight", 1);
|
|
937
|
+
_$insertNode(_el$13, _$createTextNode(`Keyboard help`));
|
|
938
|
+
_$insertNode(_el$15, _$createTextNode(`enter start \xB7 tab duration / cooldown \xB7 click a preset to start it`));
|
|
939
|
+
_$insertNode(_el$17, _$createTextNode(`ctrl+d stop this loop (press twice) \xB7 ctrl+a all projects / this session`));
|
|
940
|
+
_$insertNode(_el$19, _$createTextNode(`\u2191/\u2193 select \xB7 ctrl+d stop selected (twice) \xB7 ctrl+shift+d stop all \xB7 ctrl+r refresh`));
|
|
941
|
+
_$insertNode(_el$21, _$createTextNode(`f1 help \xB7 esc close`));
|
|
942
|
+
_$effect((_p$) => {
|
|
943
|
+
var _v$4 = theme.background.raised.high, _v$5 = theme.text.base, _v$6 = TextAttributes.BOLD, _v$7 = theme.text.muted, _v$8 = theme.text.muted, _v$9 = theme.text.muted, _v$0 = theme.text.muted;
|
|
944
|
+
_v$4 !== _p$.e && (_p$.e = _$setProp(_el$12, "backgroundColor", _v$4, _p$.e));
|
|
945
|
+
_v$5 !== _p$.t && (_p$.t = _$setProp(_el$13, "fg", _v$5, _p$.t));
|
|
946
|
+
_v$6 !== _p$.a && (_p$.a = _$setProp(_el$13, "attributes", _v$6, _p$.a));
|
|
947
|
+
_v$7 !== _p$.o && (_p$.o = _$setProp(_el$15, "fg", _v$7, _p$.o));
|
|
948
|
+
_v$8 !== _p$.i && (_p$.i = _$setProp(_el$17, "fg", _v$8, _p$.i));
|
|
949
|
+
_v$9 !== _p$.n && (_p$.n = _$setProp(_el$19, "fg", _v$9, _p$.n));
|
|
950
|
+
_v$0 !== _p$.s && (_p$.s = _$setProp(_el$21, "fg", _v$0, _p$.s));
|
|
951
|
+
return _p$;
|
|
952
|
+
}, {
|
|
953
|
+
e: undefined,
|
|
954
|
+
t: undefined,
|
|
955
|
+
a: undefined,
|
|
956
|
+
o: undefined,
|
|
957
|
+
i: undefined,
|
|
958
|
+
n: undefined,
|
|
959
|
+
s: undefined
|
|
960
|
+
});
|
|
961
|
+
return _el$12;
|
|
962
|
+
}
|
|
963
|
+
}), null);
|
|
964
|
+
_$insert(_el$3, _$createComponent(Show, {
|
|
965
|
+
get when() {
|
|
966
|
+
return view() === "current";
|
|
967
|
+
},
|
|
968
|
+
get children() {
|
|
969
|
+
return [(() => {
|
|
970
|
+
var _el$23 = _$createElement("text");
|
|
971
|
+
_$insertNode(_el$23, _$createTextNode(`Start`));
|
|
972
|
+
_$effect((_p$) => {
|
|
973
|
+
var _v$1 = theme.text.base, _v$10 = TextAttributes.BOLD;
|
|
974
|
+
_v$1 !== _p$.e && (_p$.e = _$setProp(_el$23, "fg", _v$1, _p$.e));
|
|
975
|
+
_v$10 !== _p$.t && (_p$.t = _$setProp(_el$23, "attributes", _v$10, _p$.t));
|
|
976
|
+
return _p$;
|
|
977
|
+
}, {
|
|
978
|
+
e: undefined,
|
|
979
|
+
t: undefined
|
|
980
|
+
});
|
|
981
|
+
return _el$23;
|
|
982
|
+
})(), _$createComponent(Show, {
|
|
983
|
+
get when() {
|
|
984
|
+
return presets.length > 0;
|
|
985
|
+
},
|
|
986
|
+
get children() {
|
|
987
|
+
var _el$25 = _$createElement("box");
|
|
988
|
+
_$setProp(_el$25, "flexDirection", "row");
|
|
989
|
+
_$setProp(_el$25, "gap", 1);
|
|
990
|
+
_$insert(_el$25, _$createComponent(For, {
|
|
991
|
+
each: presets,
|
|
992
|
+
children: (preset) => (() => {
|
|
993
|
+
var _el$35 = _$createElement("box"), _el$36 = _$createElement("text");
|
|
994
|
+
_$insertNode(_el$35, _el$36);
|
|
995
|
+
_$setProp(_el$35, "id", `infinite-loop-preset-${preset}`);
|
|
996
|
+
_$setProp(_el$35, "paddingLeft", 1);
|
|
997
|
+
_$setProp(_el$35, "paddingRight", 1);
|
|
998
|
+
_$setProp(_el$35, "onMouseUp", () => {
|
|
999
|
+
if (!working())
|
|
1000
|
+
startPreset(preset);
|
|
1001
|
+
});
|
|
1002
|
+
_$insert(_el$36, preset);
|
|
1003
|
+
_$effect((_p$) => {
|
|
1004
|
+
var _v$22 = theme.background.raised.high, _v$23 = theme.text.base;
|
|
1005
|
+
_v$22 !== _p$.e && (_p$.e = _$setProp(_el$35, "backgroundColor", _v$22, _p$.e));
|
|
1006
|
+
_v$23 !== _p$.t && (_p$.t = _$setProp(_el$36, "fg", _v$23, _p$.t));
|
|
1007
|
+
return _p$;
|
|
1008
|
+
}, {
|
|
1009
|
+
e: undefined,
|
|
1010
|
+
t: undefined
|
|
1011
|
+
});
|
|
1012
|
+
return _el$35;
|
|
1013
|
+
})()
|
|
1014
|
+
}));
|
|
1015
|
+
return _el$25;
|
|
1016
|
+
}
|
|
1017
|
+
}), (() => {
|
|
1018
|
+
var _el$26 = _$createElement("input");
|
|
1019
|
+
_$use((value) => {
|
|
1020
|
+
durationInput = value;
|
|
1021
|
+
setTimeout(() => value.focus(), 0);
|
|
1022
|
+
}, _el$26);
|
|
1023
|
+
_$setProp(_el$26, "onInput", setCustom);
|
|
1024
|
+
_$setProp(_el$26, "backgroundColor", formBackground);
|
|
1025
|
+
_$setProp(_el$26, "focusedBackgroundColor", formFocusedBackground);
|
|
1026
|
+
_$setProp(_el$26, "focusedTextColor", formFocusedText);
|
|
1027
|
+
_$effect((_p$) => {
|
|
1028
|
+
var _v$11 = `e.g. 90m, 2h, 1h30m \xB7 empty = ${formatDuration(props.options.defaultDurationMs)}`, _v$12 = theme.text.muted, _v$13 = theme.text.formfield.base, _v$14 = theme.text.formfield.base;
|
|
1029
|
+
_v$11 !== _p$.e && (_p$.e = _$setProp(_el$26, "placeholder", _v$11, _p$.e));
|
|
1030
|
+
_v$12 !== _p$.t && (_p$.t = _$setProp(_el$26, "placeholderColor", _v$12, _p$.t));
|
|
1031
|
+
_v$13 !== _p$.a && (_p$.a = _$setProp(_el$26, "textColor", _v$13, _p$.a));
|
|
1032
|
+
_v$14 !== _p$.o && (_p$.o = _$setProp(_el$26, "cursorColor", _v$14, _p$.o));
|
|
1033
|
+
return _p$;
|
|
1034
|
+
}, {
|
|
1035
|
+
e: undefined,
|
|
1036
|
+
t: undefined,
|
|
1037
|
+
a: undefined,
|
|
1038
|
+
o: undefined
|
|
1039
|
+
});
|
|
1040
|
+
return _el$26;
|
|
1041
|
+
})(), _$createComponent(Show, {
|
|
1042
|
+
get when() {
|
|
1043
|
+
return durationPreview();
|
|
1044
|
+
},
|
|
1045
|
+
get fallback() {
|
|
1046
|
+
return (() => {
|
|
1047
|
+
var _el$37 = _$createElement("text");
|
|
1048
|
+
_$insertNode(_el$37, _$createTextNode(`Bare numbers are hours: 2 = 2h`));
|
|
1049
|
+
_$effect((_$p) => _$setProp(_el$37, "fg", theme.text.muted, _$p));
|
|
1050
|
+
return _el$37;
|
|
1051
|
+
})();
|
|
1052
|
+
},
|
|
1053
|
+
children: (parsed) => _$createComponent(Show, {
|
|
1054
|
+
get when() {
|
|
1055
|
+
return parsed().ok;
|
|
1056
|
+
},
|
|
1057
|
+
get fallback() {
|
|
1058
|
+
return (() => {
|
|
1059
|
+
var _el$41 = _$createElement("text");
|
|
1060
|
+
_$setProp(_el$41, "wrapMode", "word");
|
|
1061
|
+
_$insert(_el$41, () => parsed().error);
|
|
1062
|
+
_$effect((_$p) => _$setProp(_el$41, "fg", theme.text.feedback?.error?.base ?? theme.text.base, _$p));
|
|
1063
|
+
return _el$41;
|
|
1064
|
+
})();
|
|
1065
|
+
},
|
|
1066
|
+
get children() {
|
|
1067
|
+
var _el$39 = _$createElement("text"), _el$40 = _$createTextNode(`= `);
|
|
1068
|
+
_$insertNode(_el$39, _el$40);
|
|
1069
|
+
_$insert(_el$39, () => formatDuration(parsed().ms), null);
|
|
1070
|
+
_$effect((_p$) => {
|
|
1071
|
+
var _v$24 = theme.text.base, _v$25 = TextAttributes.BOLD;
|
|
1072
|
+
_v$24 !== _p$.e && (_p$.e = _$setProp(_el$39, "fg", _v$24, _p$.e));
|
|
1073
|
+
_v$25 !== _p$.t && (_p$.t = _$setProp(_el$39, "attributes", _v$25, _p$.t));
|
|
1074
|
+
return _p$;
|
|
1075
|
+
}, {
|
|
1076
|
+
e: undefined,
|
|
1077
|
+
t: undefined
|
|
1078
|
+
});
|
|
1079
|
+
return _el$39;
|
|
1080
|
+
}
|
|
1081
|
+
})
|
|
1082
|
+
}), (() => {
|
|
1083
|
+
var _el$27 = _$createElement("input");
|
|
1084
|
+
_$use((value) => {
|
|
1085
|
+
cooldownInput = value;
|
|
1086
|
+
}, _el$27);
|
|
1087
|
+
_$setProp(_el$27, "onInput", setCooldownText);
|
|
1088
|
+
_$setProp(_el$27, "backgroundColor", formBackground);
|
|
1089
|
+
_$setProp(_el$27, "focusedBackgroundColor", formFocusedBackground);
|
|
1090
|
+
_$setProp(_el$27, "focusedTextColor", formFocusedText);
|
|
1091
|
+
_$effect((_p$) => {
|
|
1092
|
+
var _v$15 = `Cooldown \xB7 e.g. 5m, 1h, 0 \xB7 empty = ${formatDuration(props.options.cooldownMs)}`, _v$16 = theme.text.muted, _v$17 = theme.text.formfield.base, _v$18 = theme.text.formfield.base;
|
|
1093
|
+
_v$15 !== _p$.e && (_p$.e = _$setProp(_el$27, "placeholder", _v$15, _p$.e));
|
|
1094
|
+
_v$16 !== _p$.t && (_p$.t = _$setProp(_el$27, "placeholderColor", _v$16, _p$.t));
|
|
1095
|
+
_v$17 !== _p$.a && (_p$.a = _$setProp(_el$27, "textColor", _v$17, _p$.a));
|
|
1096
|
+
_v$18 !== _p$.o && (_p$.o = _$setProp(_el$27, "cursorColor", _v$18, _p$.o));
|
|
1097
|
+
return _p$;
|
|
1098
|
+
}, {
|
|
1099
|
+
e: undefined,
|
|
1100
|
+
t: undefined,
|
|
1101
|
+
a: undefined,
|
|
1102
|
+
o: undefined
|
|
1103
|
+
});
|
|
1104
|
+
return _el$27;
|
|
1105
|
+
})(), _$createComponent(Show, {
|
|
1106
|
+
get when() {
|
|
1107
|
+
return cooldownPreview();
|
|
1108
|
+
},
|
|
1109
|
+
get fallback() {
|
|
1110
|
+
return (() => {
|
|
1111
|
+
var _el$42 = _$createElement("text");
|
|
1112
|
+
_$insert(_el$42, () => `Cooldown default: ${formatDuration(props.options.cooldownMs)} \xB7 bare numbers are minutes: 5 = 5m`);
|
|
1113
|
+
_$effect((_$p) => _$setProp(_el$42, "fg", theme.text.muted, _$p));
|
|
1114
|
+
return _el$42;
|
|
1115
|
+
})();
|
|
1116
|
+
},
|
|
1117
|
+
children: (parsed) => _$createComponent(Show, {
|
|
1118
|
+
get when() {
|
|
1119
|
+
return parsed().ok;
|
|
1120
|
+
},
|
|
1121
|
+
get fallback() {
|
|
1122
|
+
return (() => {
|
|
1123
|
+
var _el$44 = _$createElement("text");
|
|
1124
|
+
_$setProp(_el$44, "wrapMode", "word");
|
|
1125
|
+
_$insert(_el$44, () => parsed().error);
|
|
1126
|
+
_$effect((_$p) => _$setProp(_el$44, "fg", theme.text.feedback?.error?.base ?? theme.text.base, _$p));
|
|
1127
|
+
return _el$44;
|
|
1128
|
+
})();
|
|
1129
|
+
},
|
|
1130
|
+
get children() {
|
|
1131
|
+
var _el$43 = _$createElement("text");
|
|
1132
|
+
_$insert(_el$43, (() => {
|
|
1133
|
+
var _c$2 = _$memo(() => parsed().ms === 0);
|
|
1134
|
+
return () => _c$2() ? "= no cooldown" : `= ${formatDuration(parsed().ms)}`;
|
|
1135
|
+
})());
|
|
1136
|
+
_$effect((_p$) => {
|
|
1137
|
+
var _v$26 = theme.text.base, _v$27 = TextAttributes.BOLD;
|
|
1138
|
+
_v$26 !== _p$.e && (_p$.e = _$setProp(_el$43, "fg", _v$26, _p$.e));
|
|
1139
|
+
_v$27 !== _p$.t && (_p$.t = _$setProp(_el$43, "attributes", _v$27, _p$.t));
|
|
1140
|
+
return _p$;
|
|
1141
|
+
}, {
|
|
1142
|
+
e: undefined,
|
|
1143
|
+
t: undefined
|
|
1144
|
+
});
|
|
1145
|
+
return _el$43;
|
|
1146
|
+
}
|
|
1147
|
+
})
|
|
1148
|
+
}), (() => {
|
|
1149
|
+
var _el$28 = _$createElement("text"), _el$29 = _$createTextNode(`Message: `);
|
|
1150
|
+
_$insertNode(_el$28, _el$29);
|
|
1151
|
+
_$setProp(_el$28, "wrapMode", "word");
|
|
1152
|
+
_$insert(_el$28, () => props.options.message, null);
|
|
1153
|
+
_$effect((_$p) => _$setProp(_el$28, "fg", theme.text.muted, _$p));
|
|
1154
|
+
return _el$28;
|
|
1155
|
+
})(), (() => {
|
|
1156
|
+
var _el$30 = _$createElement("text");
|
|
1157
|
+
_$setProp(_el$30, "wrapMode", "word");
|
|
1158
|
+
_$insert(_el$30, () => `${state()?.active ? "ctrl+d stop (twice) \xB7 " : ""}ctrl+a all projects \xB7 enter start \xB7 tab duration/cooldown \xB7 click preset \xB7 f1 help \xB7 esc close`);
|
|
1159
|
+
_$effect((_$p) => _$setProp(_el$30, "fg", theme.text.muted, _$p));
|
|
1160
|
+
return _el$30;
|
|
1161
|
+
})()];
|
|
1162
|
+
}
|
|
1163
|
+
}), null);
|
|
1164
|
+
_$insert(_el$3, _$createComponent(Show, {
|
|
1165
|
+
get when() {
|
|
1166
|
+
return view() === "all";
|
|
1167
|
+
},
|
|
1168
|
+
get children() {
|
|
1169
|
+
return _$createComponent(Show, {
|
|
1170
|
+
get when() {
|
|
1171
|
+
return _$memo(() => !!loading())() && loops().length === 0;
|
|
1172
|
+
},
|
|
1173
|
+
get fallback() {
|
|
1174
|
+
return _$createComponent(Show, {
|
|
1175
|
+
get when() {
|
|
1176
|
+
return loops().length > 0;
|
|
1177
|
+
},
|
|
1178
|
+
get fallback() {
|
|
1179
|
+
return (() => {
|
|
1180
|
+
var _el$48 = _$createElement("text");
|
|
1181
|
+
_$insertNode(_el$48, _$createTextNode(`No running loops. Start one with /infinite-loop.`));
|
|
1182
|
+
_$effect((_$p) => _$setProp(_el$48, "fg", theme.text.muted, _$p));
|
|
1183
|
+
return _el$48;
|
|
1184
|
+
})();
|
|
1185
|
+
},
|
|
1186
|
+
get children() {
|
|
1187
|
+
return [(() => {
|
|
1188
|
+
var _el$45 = _$createElement("scrollbox");
|
|
1189
|
+
_$use((value) => {
|
|
1190
|
+
loopList = value;
|
|
1191
|
+
}, _el$45);
|
|
1192
|
+
_$setProp(_el$45, "focusable", true);
|
|
1193
|
+
_$setProp(_el$45, "maxHeight", 18);
|
|
1194
|
+
_$insert(_el$45, _$createComponent(For, {
|
|
1195
|
+
get each() {
|
|
1196
|
+
return grouped();
|
|
1197
|
+
},
|
|
1198
|
+
children: (group) => [(() => {
|
|
1199
|
+
var _el$50 = _$createElement("text");
|
|
1200
|
+
_$insert(_el$50, (() => {
|
|
1201
|
+
var _c$3 = _$memo(() => !!group.directory);
|
|
1202
|
+
return () => _c$3() ? props.context.ui.format.path(group.directory) : "Unknown project";
|
|
1203
|
+
})());
|
|
1204
|
+
_$effect((_$p) => _$setProp(_el$50, "fg", theme.text.muted, _$p));
|
|
1205
|
+
return _el$50;
|
|
1206
|
+
})(), _$createComponent(For, {
|
|
1207
|
+
get each() {
|
|
1208
|
+
return group.items;
|
|
1209
|
+
},
|
|
1210
|
+
children: (item) => _$createComponent(LoopRow, {
|
|
1211
|
+
item,
|
|
1212
|
+
get selected() {
|
|
1213
|
+
return item.sessionID === selectedItem()?.sessionID;
|
|
1214
|
+
},
|
|
1215
|
+
get current() {
|
|
1216
|
+
return item.sessionID === props.sessionID;
|
|
1217
|
+
},
|
|
1218
|
+
theme,
|
|
1219
|
+
get now() {
|
|
1220
|
+
return now();
|
|
1221
|
+
},
|
|
1222
|
+
get phaseLabel() {
|
|
1223
|
+
return phaseLabel(item);
|
|
1224
|
+
},
|
|
1225
|
+
get pending() {
|
|
1226
|
+
return item.sessionID === pendingStop();
|
|
1227
|
+
}
|
|
1228
|
+
})
|
|
1229
|
+
})]
|
|
1230
|
+
}));
|
|
1231
|
+
return _el$45;
|
|
1232
|
+
})(), (() => {
|
|
1233
|
+
var _el$46 = _$createElement("text");
|
|
1234
|
+
_$insertNode(_el$46, _$createTextNode(`\u2191/\u2193 select \xB7 ctrl+d stop selected (twice) \xB7 ctrl+shift+d stop all \xB7 ctrl+r refresh \xB7 ctrl+a this session \xB7 f1 help \xB7 esc close`));
|
|
1235
|
+
_$setProp(_el$46, "wrapMode", "word");
|
|
1236
|
+
_$effect((_$p) => _$setProp(_el$46, "fg", theme.text.muted, _$p));
|
|
1237
|
+
return _el$46;
|
|
1238
|
+
})()];
|
|
1239
|
+
}
|
|
1240
|
+
});
|
|
1241
|
+
},
|
|
1242
|
+
get children() {
|
|
1243
|
+
var _el$31 = _$createElement("text");
|
|
1244
|
+
_$insertNode(_el$31, _$createTextNode(`Loading loops\u2026`));
|
|
1245
|
+
_$effect((_$p) => _$setProp(_el$31, "fg", theme.text.muted, _$p));
|
|
1246
|
+
return _el$31;
|
|
1247
|
+
}
|
|
1248
|
+
});
|
|
1249
|
+
}
|
|
1250
|
+
}), null);
|
|
1251
|
+
_$effect((_p$) => {
|
|
1252
|
+
var _v$19 = TextAttributes.BOLD, _v$20 = theme.text.base, _v$21 = theme.text.muted;
|
|
1253
|
+
_v$19 !== _p$.e && (_p$.e = _$setProp(_el$5, "attributes", _v$19, _p$.e));
|
|
1254
|
+
_v$20 !== _p$.t && (_p$.t = _$setProp(_el$5, "fg", _v$20, _p$.t));
|
|
1255
|
+
_v$21 !== _p$.a && (_p$.a = _$setProp(_el$6, "fg", _v$21, _p$.a));
|
|
1256
|
+
return _p$;
|
|
1257
|
+
}, {
|
|
1258
|
+
e: undefined,
|
|
1259
|
+
t: undefined,
|
|
1260
|
+
a: undefined
|
|
1261
|
+
});
|
|
1262
|
+
return _el$3;
|
|
1263
|
+
})();
|
|
1264
|
+
}
|
|
1265
|
+
function LoopRow(props) {
|
|
1266
|
+
const title = () => props.item.title ?? props.item.sessionID;
|
|
1267
|
+
const ends = () => {
|
|
1268
|
+
if (props.item.deadline === undefined)
|
|
1269
|
+
return "--:--";
|
|
1270
|
+
const date = new Date(props.item.deadline);
|
|
1271
|
+
return `${String(date.getHours()).padStart(2, "0")}:${String(date.getMinutes()).padStart(2, "0")}`;
|
|
1272
|
+
};
|
|
1273
|
+
const left = () => {
|
|
1274
|
+
if (props.item.deadline === undefined)
|
|
1275
|
+
return "";
|
|
1276
|
+
return formatDuration(Math.max(0, props.item.deadline - props.now));
|
|
1277
|
+
};
|
|
1278
|
+
const sent = () => {
|
|
1279
|
+
const count = props.item.sentCount ?? 0;
|
|
1280
|
+
return `${count} ${count === 1 ? "nudge" : "nudges"}`;
|
|
1281
|
+
};
|
|
1282
|
+
return (() => {
|
|
1283
|
+
var _el$51 = _$createElement("box"), _el$52 = _$createElement("text"), _el$53 = _$createElement("text");
|
|
1284
|
+
_$insertNode(_el$51, _el$52);
|
|
1285
|
+
_$insertNode(_el$51, _el$53);
|
|
1286
|
+
_$setProp(_el$51, "flexDirection", "column");
|
|
1287
|
+
_$setProp(_el$51, "paddingLeft", 1);
|
|
1288
|
+
_$setProp(_el$51, "paddingRight", 1);
|
|
1289
|
+
_$setProp(_el$52, "wrapMode", "word");
|
|
1290
|
+
_$insert(_el$52, () => `${props.selected ? "\u25B8 " : " "}${title()}${props.current ? " (current)" : ""}`);
|
|
1291
|
+
_$insert(_el$53, (() => {
|
|
1292
|
+
var _c$4 = _$memo(() => !!props.pending);
|
|
1293
|
+
return () => _c$4() ? "Press ctrl+d again to stop this loop." : `ends ${ends()} \xB7 ${left()} left \xB7 sent ${sent()} \xB7 ${props.phaseLabel}`;
|
|
1294
|
+
})());
|
|
1295
|
+
_$effect((_p$) => {
|
|
1296
|
+
var _v$28 = props.item.sessionID, _v$29 = props.selected ? props.theme.background.raised.high : undefined, _v$30 = props.selected ? props.theme.text.base : props.theme.text.muted, _v$31 = props.pending ? props.theme.text.feedback?.warning?.base ?? props.theme.text.base : props.theme.text.muted;
|
|
1297
|
+
_v$28 !== _p$.e && (_p$.e = _$setProp(_el$51, "id", _v$28, _p$.e));
|
|
1298
|
+
_v$29 !== _p$.t && (_p$.t = _$setProp(_el$51, "backgroundColor", _v$29, _p$.t));
|
|
1299
|
+
_v$30 !== _p$.a && (_p$.a = _$setProp(_el$52, "fg", _v$30, _p$.a));
|
|
1300
|
+
_v$31 !== _p$.o && (_p$.o = _$setProp(_el$53, "fg", _v$31, _p$.o));
|
|
1301
|
+
return _p$;
|
|
1302
|
+
}, {
|
|
1303
|
+
e: undefined,
|
|
1304
|
+
t: undefined,
|
|
1305
|
+
a: undefined,
|
|
1306
|
+
o: undefined
|
|
1307
|
+
});
|
|
1308
|
+
return _el$51;
|
|
1309
|
+
})();
|
|
1310
|
+
}
|
|
1311
|
+
export {
|
|
1312
|
+
COMMAND_ID,
|
|
1313
|
+
OVERVIEW_COMMAND_ID,
|
|
1314
|
+
OVERVIEW_SLASH_COMMAND,
|
|
1315
|
+
SLASH_COMMAND,
|
|
1316
|
+
tui_default as default,
|
|
1317
|
+
openInfiniteLoop,
|
|
1318
|
+
openInfiniteLoopOverview,
|
|
1319
|
+
setupInfiniteLoopTui
|
|
1320
|
+
};
|