@max10240/opencode-plugin-delayed-queue 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 +66 -2
- package/README.zh-CN.md +64 -0
- package/dist/index.js +2 -0
- package/dist/src/controller.js +591 -0
- package/dist/src/index.js +286 -0
- package/dist/src/options.js +65 -0
- package/dist/src/rpc.js +204 -0
- package/dist/src/tui.js +487 -0
- package/dist/tui.js +11 -0
- package/package.json +67 -4
package/dist/src/tui.js
ADDED
|
@@ -0,0 +1,487 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/tui.tsx
|
|
3
|
+
import { memo as _$memo } from "@opentui/solid";
|
|
4
|
+
import { effect as _$effect } from "@opentui/solid";
|
|
5
|
+
import { createTextNode as _$createTextNode } from "@opentui/solid";
|
|
6
|
+
import { insertNode as _$insertNode } from "@opentui/solid";
|
|
7
|
+
import { insert as _$insert } from "@opentui/solid";
|
|
8
|
+
import { setProp as _$setProp } from "@opentui/solid";
|
|
9
|
+
import { createElement as _$createElement } from "@opentui/solid";
|
|
10
|
+
import { createComponent as _$createComponent } from "@opentui/solid";
|
|
11
|
+
import { Plugin } from "@opencode/plugin/tui";
|
|
12
|
+
import { createEffect, createMemo, createSignal, onCleanup, Show } from "solid-js";
|
|
13
|
+
import { parseDelayedQueueOptions } from "./options.js";
|
|
14
|
+
import { DelayedQueueRpc } from "./rpc.js";
|
|
15
|
+
var COMMAND_ID = "max10240.delayed-queue.open";
|
|
16
|
+
var ENQUEUE_COMMAND_ID = "max10240.delayed-queue.enqueue";
|
|
17
|
+
var SLASH_COMMAND = "delayed-queue";
|
|
18
|
+
var SLASH_ALIASES = ["delay", "dq"];
|
|
19
|
+
var SPLIT_BORDER = {
|
|
20
|
+
topLeft: "",
|
|
21
|
+
bottomLeft: "",
|
|
22
|
+
vertical: "\u2503",
|
|
23
|
+
topRight: "",
|
|
24
|
+
bottomRight: "",
|
|
25
|
+
horizontal: " ",
|
|
26
|
+
bottomT: "",
|
|
27
|
+
topT: "",
|
|
28
|
+
cross: "",
|
|
29
|
+
leftT: "",
|
|
30
|
+
rightT: ""
|
|
31
|
+
};
|
|
32
|
+
var tui_default = Plugin.define({
|
|
33
|
+
id: "max10240.delayed-queue.tui",
|
|
34
|
+
setup(context) {
|
|
35
|
+
return setupDelayedQueueTui(context);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
function setupDelayedQueueTui(context) {
|
|
39
|
+
let options;
|
|
40
|
+
try {
|
|
41
|
+
options = parseDelayedQueueOptions(context.options);
|
|
42
|
+
} catch (error) {
|
|
43
|
+
console.warn(`Delayed queue panel disabled: ${error instanceof Error ? error.message : "invalid options"}`);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
if (!options.enabled)
|
|
47
|
+
return;
|
|
48
|
+
context.keymap.layer(() => ({
|
|
49
|
+
mode: "global",
|
|
50
|
+
priority: 10,
|
|
51
|
+
commands: [{
|
|
52
|
+
id: COMMAND_ID,
|
|
53
|
+
title: "View delayed prompts",
|
|
54
|
+
description: "Manage messages waiting for this session to become idle",
|
|
55
|
+
group: "Prompt",
|
|
56
|
+
bind: options.keybind === false ? false : options.keybind,
|
|
57
|
+
palette: true,
|
|
58
|
+
slash: {
|
|
59
|
+
name: SLASH_COMMAND,
|
|
60
|
+
aliases: [...SLASH_ALIASES],
|
|
61
|
+
arguments: true
|
|
62
|
+
},
|
|
63
|
+
run: (input) => {
|
|
64
|
+
const route = context.ui.router.current();
|
|
65
|
+
if (route.type !== "session") {
|
|
66
|
+
context.ui.toast.show({
|
|
67
|
+
message: "Open a session first",
|
|
68
|
+
variant: "warning"
|
|
69
|
+
});
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
const text = input?.trim();
|
|
73
|
+
if (text) {
|
|
74
|
+
enqueue(context, route.sessionID, text, options);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
openPanel(context, route.sessionID, options);
|
|
78
|
+
}
|
|
79
|
+
}, {
|
|
80
|
+
id: ENQUEUE_COMMAND_ID,
|
|
81
|
+
title: "Queue delayed message",
|
|
82
|
+
description: "Queue the current prompt to run after this session is idle and its background work finishes",
|
|
83
|
+
group: "Prompt",
|
|
84
|
+
bind: options.queueKeybind === false ? false : options.queueKeybind,
|
|
85
|
+
palette: true,
|
|
86
|
+
run: () => {
|
|
87
|
+
const route = context.ui.router.current();
|
|
88
|
+
if (route.type !== "session") {
|
|
89
|
+
context.ui.toast.show({
|
|
90
|
+
message: "Open a session first",
|
|
91
|
+
variant: "warning"
|
|
92
|
+
});
|
|
93
|
+
return;
|
|
94
|
+
}
|
|
95
|
+
const composer = context.renderer.currentFocusedEditor;
|
|
96
|
+
const text = composer && typeof composer.plainText === "string" ? composer.plainText.trim() : "";
|
|
97
|
+
if (text) {
|
|
98
|
+
if (composer && typeof composer.setText === "function")
|
|
99
|
+
composer.setText("");
|
|
100
|
+
enqueue(context, route.sessionID, text, options);
|
|
101
|
+
return;
|
|
102
|
+
}
|
|
103
|
+
context.ui.dialog.prompt({
|
|
104
|
+
title: "Queue delayed message",
|
|
105
|
+
placeholder: "Message"
|
|
106
|
+
}).then((value) => {
|
|
107
|
+
const message = value?.trim();
|
|
108
|
+
if (message)
|
|
109
|
+
enqueue(context, route.sessionID, message, options);
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
}]
|
|
113
|
+
}));
|
|
114
|
+
const disposeSlot = context.ui.slot({
|
|
115
|
+
append: "session.composer.top",
|
|
116
|
+
render: (input) => _$createComponent(DelayedQueueDock, {
|
|
117
|
+
context,
|
|
118
|
+
get sessionID() {
|
|
119
|
+
return input.sessionID;
|
|
120
|
+
},
|
|
121
|
+
options
|
|
122
|
+
})
|
|
123
|
+
});
|
|
124
|
+
return () => {
|
|
125
|
+
disposeSlot();
|
|
126
|
+
};
|
|
127
|
+
}
|
|
128
|
+
function locationFor(context, sessionID) {
|
|
129
|
+
const session = context.data?.session?.get?.(sessionID);
|
|
130
|
+
if (session?.location)
|
|
131
|
+
return session.location;
|
|
132
|
+
if (context.location)
|
|
133
|
+
return context.location;
|
|
134
|
+
const fallback = context.data?.location?.default?.();
|
|
135
|
+
return fallback ?? {
|
|
136
|
+
directory: "/"
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
async function enqueue(context, sessionID, text, options) {
|
|
140
|
+
try {
|
|
141
|
+
const state = await context.client.rpc(DelayedQueueRpc).enqueue({
|
|
142
|
+
sessionID,
|
|
143
|
+
text,
|
|
144
|
+
jobs: await visibleJobs(context, sessionID)
|
|
145
|
+
}, {
|
|
146
|
+
location: locationFor(context, sessionID)
|
|
147
|
+
});
|
|
148
|
+
context.ui.toast.show({
|
|
149
|
+
message: state.paused ? `Delayed message queued \xB7 resume the queue to run it` : `Delayed message queued${options.waitKinds.length > 0 ? " \xB7 waits for idle and background work" : ""}`,
|
|
150
|
+
variant: "success"
|
|
151
|
+
});
|
|
152
|
+
} catch (error) {
|
|
153
|
+
context.ui.toast.show({
|
|
154
|
+
message: describe(error, "Could not queue the delayed message"),
|
|
155
|
+
variant: "error"
|
|
156
|
+
});
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
async function openPanel(context, sessionID, options) {
|
|
160
|
+
let state;
|
|
161
|
+
try {
|
|
162
|
+
state = await context.client.rpc(DelayedQueueRpc).status({
|
|
163
|
+
sessionID
|
|
164
|
+
}, {
|
|
165
|
+
location: locationFor(context, sessionID)
|
|
166
|
+
});
|
|
167
|
+
} catch (error) {
|
|
168
|
+
context.ui.toast.show({
|
|
169
|
+
message: describe(error, "Delayed queue is unavailable"),
|
|
170
|
+
variant: "error"
|
|
171
|
+
});
|
|
172
|
+
return;
|
|
173
|
+
}
|
|
174
|
+
if (state.items.length === 0) {
|
|
175
|
+
context.ui.toast.show({
|
|
176
|
+
message: "No delayed prompts",
|
|
177
|
+
variant: "info"
|
|
178
|
+
});
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
const items = state.items;
|
|
182
|
+
let pendingDelete;
|
|
183
|
+
let deleteTimer;
|
|
184
|
+
const clearPendingDelete = () => {
|
|
185
|
+
if (deleteTimer !== undefined)
|
|
186
|
+
clearTimeout(deleteTimer);
|
|
187
|
+
deleteTimer = undefined;
|
|
188
|
+
pendingDelete = undefined;
|
|
189
|
+
};
|
|
190
|
+
const armPendingDelete = (id) => {
|
|
191
|
+
clearPendingDelete();
|
|
192
|
+
pendingDelete = id;
|
|
193
|
+
deleteTimer = setTimeout(() => {
|
|
194
|
+
deleteTimer = undefined;
|
|
195
|
+
pendingDelete = undefined;
|
|
196
|
+
}, 3000);
|
|
197
|
+
};
|
|
198
|
+
const result = await context.ui.dialog.select({
|
|
199
|
+
title: "Delayed prompts",
|
|
200
|
+
placeholder: "Search",
|
|
201
|
+
options: items.map((item, index) => ({
|
|
202
|
+
title: item.text.replaceAll(`
|
|
203
|
+
`, " "),
|
|
204
|
+
value: item.id,
|
|
205
|
+
footer: state.paused ? "paused" : `${index + 1} of ${items.length}`
|
|
206
|
+
})),
|
|
207
|
+
search: (query, values) => {
|
|
208
|
+
const needle = query.trim().toLowerCase();
|
|
209
|
+
if (!needle)
|
|
210
|
+
return values;
|
|
211
|
+
return values.filter((value) => value.title.toLowerCase().includes(needle));
|
|
212
|
+
},
|
|
213
|
+
actions: [{
|
|
214
|
+
bind: "ctrl+s",
|
|
215
|
+
title: "steer now",
|
|
216
|
+
selection: "required",
|
|
217
|
+
onTrigger: (value) => {
|
|
218
|
+
clearPendingDelete();
|
|
219
|
+
deliver(context, sessionID, value);
|
|
220
|
+
}
|
|
221
|
+
}, {
|
|
222
|
+
bind: "ctrl+d",
|
|
223
|
+
title: "delete",
|
|
224
|
+
selection: "required",
|
|
225
|
+
onTrigger: (value) => {
|
|
226
|
+
if (pendingDelete !== value) {
|
|
227
|
+
armPendingDelete(value);
|
|
228
|
+
context.ui.toast.show({
|
|
229
|
+
message: "Press ctrl+d again to delete",
|
|
230
|
+
variant: "warning"
|
|
231
|
+
});
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
clearPendingDelete();
|
|
235
|
+
remove(context, sessionID, value, options);
|
|
236
|
+
}
|
|
237
|
+
}, {
|
|
238
|
+
bind: "ctrl+p",
|
|
239
|
+
title: state.paused ? "resume" : "pause",
|
|
240
|
+
selection: "none",
|
|
241
|
+
onTrigger: () => {
|
|
242
|
+
clearPendingDelete();
|
|
243
|
+
togglePause(context, sessionID, options, state.paused);
|
|
244
|
+
}
|
|
245
|
+
}]
|
|
246
|
+
});
|
|
247
|
+
clearPendingDelete();
|
|
248
|
+
if (result === undefined)
|
|
249
|
+
return;
|
|
250
|
+
await deliver(context, sessionID, result);
|
|
251
|
+
}
|
|
252
|
+
async function deliver(context, sessionID, id) {
|
|
253
|
+
try {
|
|
254
|
+
context.ui.dialog.clear();
|
|
255
|
+
const state = await context.client.rpc(DelayedQueueRpc).deliver({
|
|
256
|
+
sessionID,
|
|
257
|
+
id
|
|
258
|
+
}, {
|
|
259
|
+
location: locationFor(context, sessionID)
|
|
260
|
+
});
|
|
261
|
+
if (state.items.some((item) => item.id === id)) {
|
|
262
|
+
context.ui.toast.show({
|
|
263
|
+
message: "Delayed prompt is still waiting",
|
|
264
|
+
variant: "warning"
|
|
265
|
+
});
|
|
266
|
+
return;
|
|
267
|
+
}
|
|
268
|
+
context.ui.toast.show({
|
|
269
|
+
message: "Delayed prompt sent",
|
|
270
|
+
variant: "success"
|
|
271
|
+
});
|
|
272
|
+
} catch (error) {
|
|
273
|
+
context.ui.toast.show({
|
|
274
|
+
message: describe(error, "Could not send the delayed prompt"),
|
|
275
|
+
variant: "error"
|
|
276
|
+
});
|
|
277
|
+
}
|
|
278
|
+
}
|
|
279
|
+
async function remove(context, sessionID, id, options) {
|
|
280
|
+
try {
|
|
281
|
+
const state = await context.client.rpc(DelayedQueueRpc).remove({
|
|
282
|
+
sessionID,
|
|
283
|
+
ids: [id]
|
|
284
|
+
}, {
|
|
285
|
+
location: locationFor(context, sessionID)
|
|
286
|
+
});
|
|
287
|
+
context.ui.dialog.clear();
|
|
288
|
+
context.ui.toast.show({
|
|
289
|
+
message: state.items.length === 0 ? "Delayed prompt deleted" : "Delayed prompt deleted",
|
|
290
|
+
variant: "info"
|
|
291
|
+
});
|
|
292
|
+
if (state.items.length > 0)
|
|
293
|
+
setTimeout(() => void openPanel(context, sessionID, options), 0);
|
|
294
|
+
} catch (error) {
|
|
295
|
+
context.ui.toast.show({
|
|
296
|
+
message: describe(error, "Could not delete the delayed prompt"),
|
|
297
|
+
variant: "error"
|
|
298
|
+
});
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
async function togglePause(context, sessionID, options, paused) {
|
|
302
|
+
try {
|
|
303
|
+
if (paused)
|
|
304
|
+
await context.client.rpc(DelayedQueueRpc).resume({
|
|
305
|
+
sessionID
|
|
306
|
+
}, {
|
|
307
|
+
location: locationFor(context, sessionID)
|
|
308
|
+
});
|
|
309
|
+
else
|
|
310
|
+
await context.client.rpc(DelayedQueueRpc).pause({
|
|
311
|
+
sessionID
|
|
312
|
+
}, {
|
|
313
|
+
location: locationFor(context, sessionID)
|
|
314
|
+
});
|
|
315
|
+
context.ui.dialog.clear();
|
|
316
|
+
context.ui.toast.show({
|
|
317
|
+
message: paused ? "Delayed queue resumed" : "Delayed queue paused",
|
|
318
|
+
variant: "info"
|
|
319
|
+
});
|
|
320
|
+
setTimeout(() => void openPanel(context, sessionID, options), 0);
|
|
321
|
+
} catch (error) {
|
|
322
|
+
context.ui.toast.show({
|
|
323
|
+
message: describe(error, "Could not change the delayed queue"),
|
|
324
|
+
variant: "error"
|
|
325
|
+
});
|
|
326
|
+
}
|
|
327
|
+
}
|
|
328
|
+
function DelayedQueueDock(props) {
|
|
329
|
+
const theme = props.context.theme;
|
|
330
|
+
const [state, setState] = createSignal();
|
|
331
|
+
const [hover, setHover] = createSignal(false);
|
|
332
|
+
const next = createMemo(() => state()?.items[0]?.text.replaceAll(`
|
|
333
|
+
`, " "));
|
|
334
|
+
const count = createMemo(() => state()?.items.length ?? 0);
|
|
335
|
+
createEffect(() => {
|
|
336
|
+
const sessionID = props.sessionID;
|
|
337
|
+
let active = true;
|
|
338
|
+
const rpc = props.context.client.rpc(DelayedQueueRpc);
|
|
339
|
+
const apply = (value) => {
|
|
340
|
+
if (active && value.sessionID === sessionID)
|
|
341
|
+
setState(value);
|
|
342
|
+
};
|
|
343
|
+
const refresh = () => {
|
|
344
|
+
const location = locationFor(props.context, sessionID);
|
|
345
|
+
visibleJobs(props.context, sessionID).then(async (jobs) => {
|
|
346
|
+
const value = jobs === undefined ? await rpc.status({
|
|
347
|
+
sessionID
|
|
348
|
+
}, {
|
|
349
|
+
location
|
|
350
|
+
}) : await rpc.syncJobs({
|
|
351
|
+
sessionID,
|
|
352
|
+
jobs
|
|
353
|
+
}, {
|
|
354
|
+
location
|
|
355
|
+
});
|
|
356
|
+
apply(value);
|
|
357
|
+
}, () => {});
|
|
358
|
+
};
|
|
359
|
+
refresh();
|
|
360
|
+
const timer = setInterval(refresh, 1000);
|
|
361
|
+
const stop = rpc.events.on("changed", (event) => {
|
|
362
|
+
const data = event.data;
|
|
363
|
+
if (data.sessionID === sessionID)
|
|
364
|
+
apply(data.state);
|
|
365
|
+
});
|
|
366
|
+
onCleanup(() => {
|
|
367
|
+
active = false;
|
|
368
|
+
clearInterval(timer);
|
|
369
|
+
stop();
|
|
370
|
+
});
|
|
371
|
+
});
|
|
372
|
+
return _$createComponent(Show, {
|
|
373
|
+
get when() {
|
|
374
|
+
return count() > 0;
|
|
375
|
+
},
|
|
376
|
+
get children() {
|
|
377
|
+
var _el$ = _$createElement("box"), _el$2 = _$createElement("box"), _el$3 = _$createElement("text"), _el$4 = _$createElement("span"), _el$5 = _$createTextNode(` delayed`);
|
|
378
|
+
_$insertNode(_el$, _el$2);
|
|
379
|
+
_$setProp(_el$, "marginBottom", 1);
|
|
380
|
+
_$setProp(_el$, "border", ["left"]);
|
|
381
|
+
_$setProp(_el$, "customBorderChars", SPLIT_BORDER);
|
|
382
|
+
_$setProp(_el$, "onMouseOver", () => setHover(true));
|
|
383
|
+
_$setProp(_el$, "onMouseOut", () => setHover(false));
|
|
384
|
+
_$setProp(_el$, "onMouseUp", () => void openPanel(props.context, props.sessionID, props.options));
|
|
385
|
+
_$insertNode(_el$2, _el$3);
|
|
386
|
+
_$setProp(_el$2, "width", "100%");
|
|
387
|
+
_$setProp(_el$2, "paddingTop", 1);
|
|
388
|
+
_$setProp(_el$2, "paddingBottom", 1);
|
|
389
|
+
_$setProp(_el$2, "paddingLeft", 2);
|
|
390
|
+
_$setProp(_el$2, "paddingRight", 2);
|
|
391
|
+
_$setProp(_el$2, "flexDirection", "row");
|
|
392
|
+
_$insertNode(_el$3, _el$4);
|
|
393
|
+
_$setProp(_el$3, "wrapMode", "none");
|
|
394
|
+
_$setProp(_el$3, "truncate", true);
|
|
395
|
+
_$setProp(_el$3, "flexGrow", 1);
|
|
396
|
+
_$setProp(_el$3, "flexShrink", 1);
|
|
397
|
+
_$setProp(_el$3, "minWidth", 0);
|
|
398
|
+
_$insertNode(_el$4, _el$5);
|
|
399
|
+
_$insert(_el$4, count, _el$5);
|
|
400
|
+
_$insert(_el$3, _$createComponent(Show, {
|
|
401
|
+
get when() {
|
|
402
|
+
return next();
|
|
403
|
+
},
|
|
404
|
+
children: (text) => [" \xB7 ", _$memo(text)]
|
|
405
|
+
}), null);
|
|
406
|
+
_$insert(_el$3, _$createComponent(Show, {
|
|
407
|
+
get when() {
|
|
408
|
+
return state()?.paused;
|
|
409
|
+
},
|
|
410
|
+
children: " \xB7 paused"
|
|
411
|
+
}), null);
|
|
412
|
+
_$effect((_p$) => {
|
|
413
|
+
var _v$ = theme.border.base, _v$2 = hover() ? theme.decrease(theme.background.raised.base) : theme.background.raised.base, _v$3 = theme.text.muted, _v$4 = {
|
|
414
|
+
fg: theme.text.base
|
|
415
|
+
};
|
|
416
|
+
_v$ !== _p$.e && (_p$.e = _$setProp(_el$, "borderColor", _v$, _p$.e));
|
|
417
|
+
_v$2 !== _p$.t && (_p$.t = _$setProp(_el$2, "backgroundColor", _v$2, _p$.t));
|
|
418
|
+
_v$3 !== _p$.a && (_p$.a = _$setProp(_el$3, "fg", _v$3, _p$.a));
|
|
419
|
+
_v$4 !== _p$.o && (_p$.o = _$setProp(_el$4, "style", _v$4, _p$.o));
|
|
420
|
+
return _p$;
|
|
421
|
+
}, {
|
|
422
|
+
e: undefined,
|
|
423
|
+
t: undefined,
|
|
424
|
+
a: undefined,
|
|
425
|
+
o: undefined
|
|
426
|
+
});
|
|
427
|
+
return _el$;
|
|
428
|
+
}
|
|
429
|
+
});
|
|
430
|
+
}
|
|
431
|
+
async function visibleJobs(context, sessionID) {
|
|
432
|
+
try {
|
|
433
|
+
const jobs = await context.client.experimental.job.list({
|
|
434
|
+
sessionID,
|
|
435
|
+
descendants: true,
|
|
436
|
+
status: "running"
|
|
437
|
+
});
|
|
438
|
+
return jobs.map((job) => {
|
|
439
|
+
const base = {
|
|
440
|
+
id: job.id,
|
|
441
|
+
kind: job.kind,
|
|
442
|
+
sessionID: job.sessionID,
|
|
443
|
+
status: job.status
|
|
444
|
+
};
|
|
445
|
+
if (job.kind === "shell")
|
|
446
|
+
return {
|
|
447
|
+
...base,
|
|
448
|
+
shellID: job.shellID,
|
|
449
|
+
command: job.command,
|
|
450
|
+
title: job.title
|
|
451
|
+
};
|
|
452
|
+
if (job.kind === "subagent")
|
|
453
|
+
return {
|
|
454
|
+
...base,
|
|
455
|
+
childSessionID: job.childSessionID,
|
|
456
|
+
description: job.description,
|
|
457
|
+
title: job.title
|
|
458
|
+
};
|
|
459
|
+
if (job.kind === "image")
|
|
460
|
+
return {
|
|
461
|
+
...base,
|
|
462
|
+
path: job.path,
|
|
463
|
+
title: job.title
|
|
464
|
+
};
|
|
465
|
+
return base;
|
|
466
|
+
});
|
|
467
|
+
} catch {
|
|
468
|
+
return;
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
function describe(error, fallback) {
|
|
472
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
473
|
+
if (!message || message === "undefined" || message === "null")
|
|
474
|
+
return fallback;
|
|
475
|
+
return message;
|
|
476
|
+
}
|
|
477
|
+
export {
|
|
478
|
+
COMMAND_ID,
|
|
479
|
+
DelayedQueueDock,
|
|
480
|
+
ENQUEUE_COMMAND_ID,
|
|
481
|
+
SLASH_ALIASES,
|
|
482
|
+
SLASH_COMMAND,
|
|
483
|
+
tui_default as default,
|
|
484
|
+
enqueue,
|
|
485
|
+
openPanel,
|
|
486
|
+
setupDelayedQueueTui
|
|
487
|
+
};
|
package/dist/tui.js
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// tui.tsx
|
|
3
|
+
import { default as default2, setupDelayedQueueTui, COMMAND_ID, ENQUEUE_COMMAND_ID, SLASH_ALIASES, SLASH_COMMAND } from "./src/tui.js";
|
|
4
|
+
export {
|
|
5
|
+
COMMAND_ID,
|
|
6
|
+
ENQUEUE_COMMAND_ID,
|
|
7
|
+
SLASH_ALIASES,
|
|
8
|
+
SLASH_COMMAND,
|
|
9
|
+
default2 as default,
|
|
10
|
+
setupDelayedQueueTui
|
|
11
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,69 @@
|
|
|
1
1
|
{
|
|
2
|
+
"$schema": "https://json.schemastore.org/package.json",
|
|
2
3
|
"name": "@max10240/opencode-plugin-delayed-queue",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
4
|
+
"version": "1.0.35",
|
|
5
|
+
"description": "Queue messages that run only when a session is idle and its background work has finished",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"exports": {
|
|
8
|
+
".": "./dist/src/index.js",
|
|
9
|
+
"./tui": "./dist/src/tui.js"
|
|
10
|
+
},
|
|
11
|
+
"scripts": {
|
|
12
|
+
"test": "bun test test/*.test.ts && bun test --conditions=browser --preload @opentui/solid/preload test/tui",
|
|
13
|
+
"typecheck": "tsc --noEmit",
|
|
14
|
+
"build": "tsc -p tsconfig.build.json && bun build.mjs",
|
|
15
|
+
"prepack": "node ../../scripts/sync-recommended-rules.mjs && npm run build"
|
|
16
|
+
},
|
|
17
|
+
"files": [
|
|
18
|
+
"dist/**/*.js",
|
|
19
|
+
"README.md",
|
|
20
|
+
"README.zh-CN.md"
|
|
21
|
+
],
|
|
22
|
+
"keywords": [
|
|
23
|
+
"opencode",
|
|
24
|
+
"opencode-plugin",
|
|
25
|
+
"queue",
|
|
26
|
+
"idle",
|
|
27
|
+
"background",
|
|
28
|
+
"delayed"
|
|
29
|
+
],
|
|
30
|
+
"license": "MIT",
|
|
31
|
+
"peerDependencies": {
|
|
32
|
+
"@opentui/core": ">=0.5.10",
|
|
33
|
+
"@opentui/solid": ">=0.5.10",
|
|
34
|
+
"solid-js": ">=1.9.0",
|
|
35
|
+
"@opencode/plugin": "^2.2.7"
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@opentui/core": "^0.5.10",
|
|
39
|
+
"@opentui/solid": "^0.5.10",
|
|
40
|
+
"@types/bun": "^1.3.0",
|
|
41
|
+
"@types/node": "^22.0.0",
|
|
42
|
+
"solid-js": "^1.9.15",
|
|
43
|
+
"typescript": "^5.8.2",
|
|
44
|
+
"@opencode/plugin": "^2.2.7"
|
|
45
|
+
},
|
|
46
|
+
"publishConfig": {
|
|
47
|
+
"registry": "https://registry.npmjs.org/",
|
|
48
|
+
"access": "public"
|
|
49
|
+
},
|
|
50
|
+
"repository": {
|
|
51
|
+
"type": "git",
|
|
52
|
+
"url": "git+https://github.com/Max10240/opencode-plugin-unicorn.git",
|
|
53
|
+
"directory": "packages/opencode-plugin-delayed-queue"
|
|
54
|
+
},
|
|
55
|
+
"peerDependenciesMeta": {
|
|
56
|
+
"@opencode/plugin": {
|
|
57
|
+
"optional": true
|
|
58
|
+
},
|
|
59
|
+
"@opentui/core": {
|
|
60
|
+
"optional": true
|
|
61
|
+
},
|
|
62
|
+
"@opentui/solid": {
|
|
63
|
+
"optional": true
|
|
64
|
+
},
|
|
65
|
+
"solid-js": {
|
|
66
|
+
"optional": true
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
}
|