@ottttto/dsh-scheduled-send 0.3.0 → 0.3.1
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/lib/client.js +5 -2
- package/package.json +2 -2
- package/src/client-view.js +5 -2
package/lib/client.js
CHANGED
|
@@ -315,6 +315,9 @@ function createClientPluginBody(React) {
|
|
|
315
315
|
try {
|
|
316
316
|
const payload = { content, sendAt: at, conversationId: props.sessionId };
|
|
317
317
|
await core.scheduleMessage(payload);
|
|
318
|
+
// sidebar panel has its own state: refresh it NOW (its 8s poll would
|
|
319
|
+
// otherwise lag ~10s behind a fresh task)
|
|
320
|
+
if (props.onTaskCreated) void props.onTaskCreated();
|
|
318
321
|
// spec: 内容转为定时任务并清空输入框 — 绝不立即发送(不调 submit)
|
|
319
322
|
if (props.inputActions && typeof props.inputActions.setDraft === "function") props.inputActions.setDraft("");
|
|
320
323
|
setOpen(false);
|
|
@@ -714,7 +717,7 @@ function createClientPluginBody(React) {
|
|
|
714
717
|
inject: (sessionId) => {
|
|
715
718
|
currentSessionId = sessionId;
|
|
716
719
|
core.setSession(sessionId); // dock/button are conversation-scoped
|
|
717
|
-
return { sessionId, core };
|
|
720
|
+
return { sessionId, core, onTaskCreated: () => panelCore.refresh() };
|
|
718
721
|
},
|
|
719
722
|
}, ScheduleButton));
|
|
720
723
|
scope.slots.inject("conversation.input.dock", () => scope.slots.register({
|
|
@@ -724,7 +727,7 @@ function createClientPluginBody(React) {
|
|
|
724
727
|
inject: (sessionId) => {
|
|
725
728
|
currentSessionId = sessionId;
|
|
726
729
|
core.setSession(sessionId);
|
|
727
|
-
return { sessionId, core };
|
|
730
|
+
return { sessionId, core, onTaskCreated: () => panelCore.refresh() };
|
|
728
731
|
},
|
|
729
732
|
}, ScheduledDock));
|
|
730
733
|
});
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ottttto/dsh-scheduled-send",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "DSH plugin: scheduled sending (⏰ composer button, dock list of pending tasks, sidebar 定时任务 panel with cross-session cancel, due-time delivery as a normal user bubble)",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/index.js",
|
|
@@ -52,4 +52,4 @@
|
|
|
52
52
|
"engines": {
|
|
53
53
|
"node": ">=18"
|
|
54
54
|
}
|
|
55
|
-
}
|
|
55
|
+
}
|
package/src/client-view.js
CHANGED
|
@@ -51,6 +51,9 @@ function createClientPluginBody(React) {
|
|
|
51
51
|
try {
|
|
52
52
|
const payload = { content, sendAt: at, conversationId: props.sessionId };
|
|
53
53
|
await core.scheduleMessage(payload);
|
|
54
|
+
// sidebar panel has its own state: refresh it NOW (its 8s poll would
|
|
55
|
+
// otherwise lag ~10s behind a fresh task)
|
|
56
|
+
if (props.onTaskCreated) void props.onTaskCreated();
|
|
54
57
|
// spec: 内容转为定时任务并清空输入框 — 绝不立即发送(不调 submit)
|
|
55
58
|
if (props.inputActions && typeof props.inputActions.setDraft === "function") props.inputActions.setDraft("");
|
|
56
59
|
setOpen(false);
|
|
@@ -450,7 +453,7 @@ function createClientPluginBody(React) {
|
|
|
450
453
|
inject: (sessionId) => {
|
|
451
454
|
currentSessionId = sessionId;
|
|
452
455
|
core.setSession(sessionId); // dock/button are conversation-scoped
|
|
453
|
-
return { sessionId, core };
|
|
456
|
+
return { sessionId, core, onTaskCreated: () => panelCore.refresh() };
|
|
454
457
|
},
|
|
455
458
|
}, ScheduleButton));
|
|
456
459
|
scope.slots.inject("conversation.input.dock", () => scope.slots.register({
|
|
@@ -460,7 +463,7 @@ function createClientPluginBody(React) {
|
|
|
460
463
|
inject: (sessionId) => {
|
|
461
464
|
currentSessionId = sessionId;
|
|
462
465
|
core.setSession(sessionId);
|
|
463
|
-
return { sessionId, core };
|
|
466
|
+
return { sessionId, core, onTaskCreated: () => panelCore.refresh() };
|
|
464
467
|
},
|
|
465
468
|
}, ScheduledDock));
|
|
466
469
|
});
|