dsh-mishu 0.7.3 → 0.7.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/README.md +4 -0
- package/lib/client.js +492 -354
- package/lib/core/index.js +1 -0
- package/lib/core/schedule/tasks.js +149 -0
- package/lib/dsh/api.js +44 -2
- package/lib/dsh/plugin.js +9 -0
- package/lib/dsh/runtime.js +24 -1
- package/lib/dsh/schedule.js +221 -0
- package/lib/types/core/index.d.ts +1 -0
- package/lib/types/core/schedule/tasks.d.ts +89 -0
- package/lib/types/dsh/runtime.d.ts +13 -0
- package/lib/types/dsh/schedule.d.ts +113 -0
- package/package.json +1 -1
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The bridge to DSH's own Schedule service (`@deepseek-ai/dsh-schedule`, the
|
|
3
|
+
* "自动化任务" page).
|
|
4
|
+
*
|
|
5
|
+
* Two directions, both kept small on purpose:
|
|
6
|
+
*
|
|
7
|
+
* - The daily brief can be handed to Schedule: the same text the desktop
|
|
8
|
+
* notification carries, delivered as a turn in a conversation instead. That
|
|
9
|
+
* is the one task the secretary creates on its own, and it is marked in its
|
|
10
|
+
* prompt so a later visit recognises it even after you edited the title.
|
|
11
|
+
* - Every task on the Host is listed for the settings page, so what the
|
|
12
|
+
* secretary scheduled and what you scheduled yourself sit in one place.
|
|
13
|
+
*
|
|
14
|
+
* Schedule is optional: a Host without the service simply has no bridge, and
|
|
15
|
+
* the page says so instead of offering a button that cannot work.
|
|
16
|
+
*/
|
|
17
|
+
import { type ScheduleEntry, type ScheduleTaskView } from '../core/index.ts';
|
|
18
|
+
import type { Lang } from '../core/i18n.ts';
|
|
19
|
+
import type { MishuStore } from '../core/store.ts';
|
|
20
|
+
/** The slice of `ScheduleService` this plugin uses. */
|
|
21
|
+
export interface ScheduleLike {
|
|
22
|
+
list(request?: {
|
|
23
|
+
active?: boolean;
|
|
24
|
+
limit?: number;
|
|
25
|
+
offset?: number;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
items: ScheduleEntry[];
|
|
28
|
+
shown: number;
|
|
29
|
+
total: number;
|
|
30
|
+
}>;
|
|
31
|
+
view(request: {
|
|
32
|
+
id: string;
|
|
33
|
+
}): Promise<ScheduleEntry | {
|
|
34
|
+
id: string;
|
|
35
|
+
code: string;
|
|
36
|
+
}>;
|
|
37
|
+
create(request: {
|
|
38
|
+
title: string;
|
|
39
|
+
prompt: string;
|
|
40
|
+
timing: Record<string, unknown>;
|
|
41
|
+
target?: Record<string, unknown>;
|
|
42
|
+
}): Promise<ScheduleEntry | {
|
|
43
|
+
id: string;
|
|
44
|
+
code: string;
|
|
45
|
+
}>;
|
|
46
|
+
edit(request: {
|
|
47
|
+
id: string;
|
|
48
|
+
action: 'update' | 'delete';
|
|
49
|
+
patch?: Record<string, unknown>;
|
|
50
|
+
expectedUpdatedAt?: string;
|
|
51
|
+
}): Promise<ScheduleEntry | {
|
|
52
|
+
id: string;
|
|
53
|
+
code: string;
|
|
54
|
+
deleted?: boolean;
|
|
55
|
+
}>;
|
|
56
|
+
run(request: {
|
|
57
|
+
id: string;
|
|
58
|
+
}): Promise<ScheduleEntry | {
|
|
59
|
+
id: string;
|
|
60
|
+
code: string;
|
|
61
|
+
}>;
|
|
62
|
+
}
|
|
63
|
+
export interface ScheduleView {
|
|
64
|
+
/** False when this Host has no Schedule service: the page then explains instead of offering buttons. */
|
|
65
|
+
available: boolean;
|
|
66
|
+
tasks: ScheduleTaskView[];
|
|
67
|
+
brief: {
|
|
68
|
+
/** The task id this notebook created, if it is still on the Host. */
|
|
69
|
+
id: string | null;
|
|
70
|
+
/** The brief's time, as the reminder settings have it. */
|
|
71
|
+
time: string;
|
|
72
|
+
timeZone: string;
|
|
73
|
+
/** Whether the brief is currently armed as a task. */
|
|
74
|
+
armed: boolean;
|
|
75
|
+
/** Last thing the service said when it was asked to arm it, if it failed. */
|
|
76
|
+
error: string | null;
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
export declare class ScheduleBridge {
|
|
80
|
+
private service;
|
|
81
|
+
private readonly store;
|
|
82
|
+
private readonly lang;
|
|
83
|
+
/** The brief's time and zone, as the reminder settings hold them. */
|
|
84
|
+
private readonly briefClock;
|
|
85
|
+
constructor(service: ScheduleLike, store: () => MishuStore | undefined, lang: () => Lang, briefClock: () => {
|
|
86
|
+
time: string;
|
|
87
|
+
timeZone: string;
|
|
88
|
+
});
|
|
89
|
+
/** A restarted service: same bridge, new handle. */
|
|
90
|
+
replace(service: ScheduleLike): void;
|
|
91
|
+
/** The page's language when it asked, else the notebook's. A task's wording is read by a person, not logged. */
|
|
92
|
+
private useLang;
|
|
93
|
+
private savedId;
|
|
94
|
+
/** Every task on the Host, newest rules first, plus whether the brief is armed. */
|
|
95
|
+
view(asked?: Lang): Promise<ScheduleView>;
|
|
96
|
+
/**
|
|
97
|
+
* Arm the brief as a daily task, or move it when the time changed. Reuses
|
|
98
|
+
* the task it made before — editing it in the automation page keeps it.
|
|
99
|
+
*/
|
|
100
|
+
armBrief(asked?: Lang): Promise<ScheduleView>;
|
|
101
|
+
/**
|
|
102
|
+
* Move the brief when its time changed on the settings page, and say
|
|
103
|
+
* nothing when it was never armed. Errors are kept, not thrown: this runs
|
|
104
|
+
* behind a save that has already succeeded.
|
|
105
|
+
*/
|
|
106
|
+
followBrief(asked?: Lang): Promise<void>;
|
|
107
|
+
/** Take the brief task off the Host; the desktop notification is unaffected. */
|
|
108
|
+
disarmBrief(asked?: Lang): Promise<ScheduleView>;
|
|
109
|
+
/** Delete any task on the Host — the secretary only ever deletes its own, but the page lists all. */
|
|
110
|
+
delete(id: string, asked?: Lang): Promise<ScheduleView>;
|
|
111
|
+
/** Run a task now, without waiting for its time. */
|
|
112
|
+
run(id: string, asked?: Lang): Promise<ScheduleView>;
|
|
113
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "dsh-mishu",
|
|
3
|
-
"version": "0.7.
|
|
3
|
+
"version": "0.7.4",
|
|
4
4
|
"description": "DSH secretary (小秘书) for DeepSeek Harness (dsh): watches GitHub notifications and the dated things you tell it (bills, renewals, documents, birthdays), closes what is already resolved, and keeps a short list of what actually needs you. Bilingual (中文 / English), macOS / Windows / Linux. · DSH 小秘书:提醒、通知、待办、消息、收件箱、秘书。GitHub 通知按当前状态分诊,交代一句就记下到期和周期事项。",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "lib/index.js",
|