@zhin.js/plugin-reminder 1.0.5 → 1.0.7
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 +8 -2
- package/commands/remind/after/index.js +6 -5
- package/commands/remind/after/index.ts +6 -5
- package/commands/remind/at/index.js +8 -7
- package/commands/remind/at/index.ts +6 -5
- package/commands/remind/cancel/index.js +5 -4
- package/commands/remind/cancel/index.ts +5 -4
- package/commands/remind/create/index.js +3 -3
- package/commands/remind/create/index.ts +3 -3
- package/commands/remind/every/index.js +6 -5
- package/commands/remind/every/index.ts +6 -5
- package/commands/remind/list/index.js +5 -4
- package/commands/remind/list/index.ts +5 -4
- package/lib/admin-i18n.d.ts +155 -0
- package/lib/admin-i18n.d.ts.map +1 -0
- package/lib/admin-i18n.js +152 -0
- package/lib/admin-i18n.js.map +1 -0
- package/lib/admin-tasks.d.ts +35 -5
- package/lib/admin-tasks.d.ts.map +1 -1
- package/lib/admin-tasks.js +77 -57
- package/lib/admin-tasks.js.map +1 -1
- package/lib/caller.d.ts +2 -1
- package/lib/caller.d.ts.map +1 -1
- package/lib/caller.js +5 -3
- package/lib/caller.js.map +1 -1
- package/lib/config.js +6 -6
- package/lib/config.js.map +1 -1
- package/lib/create-reminder.d.ts.map +1 -1
- package/lib/create-reminder.js +31 -25
- package/lib/create-reminder.js.map +1 -1
- package/lib/duration.d.ts +2 -1
- package/lib/duration.d.ts.map +1 -1
- package/lib/duration.js +4 -3
- package/lib/duration.js.map +1 -1
- package/lib/i18n.d.ts +2 -0
- package/lib/i18n.d.ts.map +1 -0
- package/lib/i18n.js +336 -0
- package/lib/i18n.js.map +1 -0
- package/lib/natural-time.d.ts +5 -1
- package/lib/natural-time.d.ts.map +1 -1
- package/lib/natural-time.js +71 -57
- package/lib/natural-time.js.map +1 -1
- package/lib/service.d.ts +8 -2
- package/lib/service.d.ts.map +1 -1
- package/lib/service.js +47 -36
- package/lib/service.js.map +1 -1
- package/lib/storage.d.ts.map +1 -1
- package/lib/storage.js +7 -5
- package/lib/storage.js.map +1 -1
- package/lib/timing.d.ts +2 -1
- package/lib/timing.d.ts.map +1 -1
- package/lib/timing.js +5 -4
- package/lib/timing.js.map +1 -1
- package/lib/tool-actor.d.ts +2 -0
- package/lib/tool-actor.d.ts.map +1 -1
- package/lib/tool-actor.js +14 -4
- package/lib/tool-actor.js.map +1 -1
- package/package.json +9 -9
- package/plugin.js +8 -3
- package/schema.json +30 -0
- package/skills/reminder/tools/reminder_cancel/index.js +3 -2
- package/skills/reminder/tools/reminder_cancel/index.ts +3 -2
- package/skills/reminder/tools/reminder_create/index.js +7 -6
- package/skills/reminder/tools/reminder_create/index.ts +7 -6
- package/skills/reminder/tools/reminder_list/index.js +3 -2
- package/skills/reminder/tools/reminder_list/index.ts +3 -2
- package/src/admin-i18n.ts +154 -0
- package/src/admin-tasks.ts +79 -53
- package/src/caller.ts +5 -3
- package/src/config.ts +6 -6
- package/src/create-reminder.ts +33 -25
- package/src/duration.ts +5 -3
- package/src/i18n.ts +336 -0
- package/src/natural-time.ts +40 -30
- package/src/service.ts +51 -38
- package/src/storage.ts +7 -5
- package/src/timing.ts +6 -4
- package/src/tool-actor.ts +15 -4
package/README.md
CHANGED
|
@@ -54,9 +54,9 @@ remind cancel <任务 ID>
|
|
|
54
54
|
|
|
55
55
|
延迟是 1 秒至一年;周期是 60 秒至一年;内容是 1–500 字符。时间必须在未来一年内。指令权限经过框架 PermissionHost;插件没有额外权限旁路或取消其他发送者任务的管理员接口。
|
|
56
56
|
|
|
57
|
-
`create` 创建一次性个人提醒,不依赖 AI。缺少时间或正文时逐项补问,随后用纯文字显示绝对日期、IANA
|
|
57
|
+
`create` 创建一次性个人提醒,不依赖 AI。缺少时间或正文时逐项补问,随后用纯文字显示绝对日期、IANA 时区、正文和完整原会话;只有按本次流程语言明确回复 `确认`(中文)或 `confirm`(英文)才保存。后续回答不加命令前缀;中文流程只接受 `取消`,英文流程只接受 `cancel`。流程开始后固定语言,切换个人偏好只影响新操作。每步有时限且整个流程最多三分钟,输错不会无限续期。超时、取消或热重载结束旧流程,均不创建任务。确认时已过期的时间不会自动顺延。
|
|
58
58
|
|
|
59
|
-
|
|
59
|
+
自然时间按当前语言选择有限语法:中文如 `10分钟后`、`一天后`(固定 24 小时)、`今天18:30`、`明天九点`、`后天九点半`、`明天下午三点半`;英文如 `in 10 minutes`、`in 2 hours`、`today at 18:30`、`tomorrow at 09:00`、`day after tomorrow at 09:30`。英文只接受整数时长和 24 小时制时刻;两种语言均接受带 offset 的 ISO 时间,不交叉接受另一语言的自然表达。裸写 `九点`、日历周期和夏令时重复/不存在时刻不会猜测。按钮、Markdown 和图片均非必需;非聊天 CLI 没有真实发送者和交互能力时不能创建。完整操作与边界见[无需 AI 的提醒指南](https://zhin.js.org/solutions/reminders)。
|
|
60
60
|
|
|
61
61
|
## 执行与恢复
|
|
62
62
|
|
|
@@ -114,3 +114,9 @@ schedules/poll/index.ts # 正式 Schedule Feature 入口
|
|
|
114
114
|
### 事务化任务存储
|
|
115
115
|
|
|
116
116
|
提醒与管理员 RSS 的任务、认领、操作回执和文章明细使用独立数据表,在一个事务中提交;原 CAS JSON 只用于首次迁移。支持 SQLite、MySQL、PostgreSQL,升级须完整重启,不能与旧版本进程混写。`unknown` 投递仍不会自动重试。迁移和字段说明见[结构化存储](../../../docs/operations/structured-storage.md)。
|
|
117
|
+
|
|
118
|
+
## Language / 语言
|
|
119
|
+
|
|
120
|
+
聊天回复使用当前发送者的语言。提醒创建时保存语言:聊天任务使用创建者当时的语言,Console 管理员任务使用项目语言。后续切换个人、项目或 Console 语言不修改既有任务的通知语言;数据库重启和热重载也保留它。管理员列表、错误和操作回执按当前 Console 请求语言展示,不影响 CAS 版本或请求去重。旧任务没有语言字段时按原中文行为读取。
|
|
121
|
+
|
|
122
|
+
English flows accept `confirm` and `cancel`, and finite expressions such as `in 10 minutes` or `tomorrow at 09:00`. Timezone remains a separate IANA setting; no locale-based timezone inference or DST guessing is performed. Command hints use the actual endpoint prefix and plugin namespace resolved by the dispatcher. Notifications keep the language captured when the task was created.
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { reminderMessages as t } from "../../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { reminderServiceToken } from "../../../lib/runtime.js";
|
|
4
5
|
import { reminderActor, replyReminder } from "../../../lib/caller.js";
|
|
5
6
|
import { MAX_DELAY_SECONDS } from "../../../lib/service.js";
|
|
6
7
|
export default defineCommand({
|
|
7
|
-
description: '创建一次性延迟提醒',
|
|
8
|
-
params: { seconds: { type: 'integer', min: 1, max: MAX_DELAY_SECONDS, description: '延迟秒数' }, text: { type: 'text', min: 1, max: 500, description: '提醒内容' } },
|
|
9
|
-
async execute({ input, params, use }) {
|
|
8
|
+
description: '创建一次性延迟提醒', descriptionI18n: { en: "Create a one-time reminder after a delay" },
|
|
9
|
+
params: { seconds: { type: 'integer', min: 1, max: MAX_DELAY_SECONDS, description: '延迟秒数', descriptionI18n: { en: "Delay in seconds" } }, text: { type: 'text', min: 1, max: 500, description: '提醒内容', descriptionI18n: { en: "Reminder text" } } },
|
|
10
|
+
async execute({ input, params, use, locale }) {
|
|
10
11
|
return replyReminder(async () => {
|
|
11
12
|
const service = use(reminderServiceToken);
|
|
12
|
-
const task = await service.add(reminderActor(input), params.text, Date.now() + params.seconds * 1000, null);
|
|
13
|
-
return
|
|
13
|
+
const task = await service.add(reminderActor(input, locale), params.text, Date.now() + params.seconds * 1000, null);
|
|
14
|
+
return `${t(locale, 'created')}\n${service.describe(task, locale)}`;
|
|
14
15
|
});
|
|
15
16
|
},
|
|
16
17
|
});
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { reminderMessages as t } from '../../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import { reminderServiceToken } from '../../../src/runtime.js';
|
|
3
4
|
import { reminderActor, replyReminder } from '../../../src/caller.js';
|
|
4
5
|
import { MAX_DELAY_SECONDS } from '../../../src/service.js';
|
|
5
6
|
|
|
6
7
|
export default defineCommand({
|
|
7
|
-
description: '创建一次性延迟提醒',
|
|
8
|
-
params: { seconds: { type: 'integer', min: 1, max: MAX_DELAY_SECONDS, description: '延迟秒数' }, text: { type: 'text', min: 1, max: 500, description: '提醒内容' } },
|
|
9
|
-
async execute({ input, params, use }) {
|
|
8
|
+
description: '创建一次性延迟提醒', descriptionI18n: { en: "Create a one-time reminder after a delay" },
|
|
9
|
+
params: { seconds: { type: 'integer', min: 1, max: MAX_DELAY_SECONDS, description: '延迟秒数', descriptionI18n: { en: "Delay in seconds" } }, text: { type: 'text', min: 1, max: 500, description: '提醒内容', descriptionI18n: { en: "Reminder text" } } },
|
|
10
|
+
async execute({ input, params, use, locale }) {
|
|
10
11
|
return replyReminder(async () => {
|
|
11
12
|
const service = use(reminderServiceToken);
|
|
12
|
-
const task = await service.add(reminderActor(input), params.text, Date.now() + params.seconds * 1000, null);
|
|
13
|
-
return
|
|
13
|
+
const task = await service.add(reminderActor(input, locale), params.text, Date.now() + params.seconds * 1000, null);
|
|
14
|
+
return `${t(locale, 'created')}\n${service.describe(task, locale)}`;
|
|
14
15
|
});
|
|
15
16
|
},
|
|
16
17
|
});
|
|
@@ -1,22 +1,23 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { reminderMessages as t } from "../../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { reminderServiceToken } from "../../../lib/runtime.js";
|
|
4
5
|
import { reminderActor, replyReminder } from "../../../lib/caller.js";
|
|
5
6
|
import { parseReminderInstant } from "../../../lib/service.js";
|
|
6
7
|
export default defineCommand({
|
|
7
|
-
description: '创建绝对时间提醒',
|
|
8
|
-
params: { time: { type: 'string', description: '包含 Z 或 ±hh:mm 的 ISO 时间', validate: (value) => { try {
|
|
8
|
+
description: '创建绝对时间提醒', descriptionI18n: { en: "Create a reminder at an absolute time" },
|
|
9
|
+
params: { time: { type: 'string', description: '包含 Z 或 ±hh:mm 的 ISO 时间', descriptionI18n: { en: "ISO timestamp with Z or an explicit ±hh:mm offset" }, validate: (value) => { try {
|
|
9
10
|
parseReminderInstant(String(value));
|
|
10
11
|
return true;
|
|
11
12
|
}
|
|
12
13
|
catch {
|
|
13
|
-
return
|
|
14
|
-
} } }, text: { type: 'text', min: 1, max: 500, description: '提醒内容' } },
|
|
15
|
-
async execute({ input, params, use }) {
|
|
14
|
+
return false;
|
|
15
|
+
} } }, text: { type: 'text', min: 1, max: 500, description: '提醒内容', descriptionI18n: { en: "Reminder text" } } },
|
|
16
|
+
async execute({ input, params, use, locale }) {
|
|
16
17
|
return replyReminder(async () => {
|
|
17
18
|
const service = use(reminderServiceToken);
|
|
18
|
-
const task = await service.add(reminderActor(input), params.text, parseReminderInstant(params.time), null);
|
|
19
|
-
return
|
|
19
|
+
const task = await service.add(reminderActor(input, locale), params.text, parseReminderInstant(params.time, locale), null);
|
|
20
|
+
return `${t(locale, 'created')}\n${service.describe(task, locale)}`;
|
|
20
21
|
});
|
|
21
22
|
},
|
|
22
23
|
});
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { reminderMessages as t } from '../../../src/i18n.js';
|
|
1
2
|
import { defineCommand, type CommandParameterValue } from 'zhin.js/command';
|
|
2
3
|
import { reminderServiceToken } from '../../../src/runtime.js';
|
|
3
4
|
import { reminderActor, replyReminder } from '../../../src/caller.js';
|
|
4
5
|
import { parseReminderInstant } from '../../../src/service.js';
|
|
5
6
|
|
|
6
7
|
export default defineCommand({
|
|
7
|
-
description: '创建绝对时间提醒',
|
|
8
|
-
params: { time: { type: 'string', description: '包含 Z 或 ±hh:mm 的 ISO 时间', validate: (value: CommandParameterValue) => { try { parseReminderInstant(String(value)); return true; } catch { return
|
|
9
|
-
async execute({ input, params, use }) {
|
|
8
|
+
description: '创建绝对时间提醒', descriptionI18n: { en: "Create a reminder at an absolute time" },
|
|
9
|
+
params: { time: { type: 'string', description: '包含 Z 或 ±hh:mm 的 ISO 时间', descriptionI18n: { en: "ISO timestamp with Z or an explicit ±hh:mm offset" }, validate: (value: CommandParameterValue) => { try { parseReminderInstant(String(value)); return true; } catch { return false; } } }, text: { type: 'text', min: 1, max: 500, description: '提醒内容', descriptionI18n: { en: "Reminder text" } } },
|
|
10
|
+
async execute({ input, params, use, locale }) {
|
|
10
11
|
return replyReminder(async () => {
|
|
11
12
|
const service = use(reminderServiceToken);
|
|
12
|
-
const task = await service.add(reminderActor(input), params.text, parseReminderInstant(params.time), null);
|
|
13
|
-
return
|
|
13
|
+
const task = await service.add(reminderActor(input, locale), params.text, parseReminderInstant(params.time, locale), null);
|
|
14
|
+
return `${t(locale, 'created')}\n${service.describe(task, locale)}`;
|
|
14
15
|
});
|
|
15
16
|
},
|
|
16
17
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { reminderMessages as t } from "../../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { reminderServiceToken } from "../../../lib/runtime.js";
|
|
4
5
|
import { reminderActor, replyReminder } from "../../../lib/caller.js";
|
|
5
6
|
export default defineCommand({
|
|
6
|
-
description: '取消本人在当前会话的提醒',
|
|
7
|
-
params: { id: { type: 'string', description: 'remind list 中的任务 ID' } },
|
|
8
|
-
async execute({ input, params, use }) {
|
|
9
|
-
return replyReminder(async () => await use(reminderServiceToken).cancel(reminderActor(input), params.id) ? '
|
|
7
|
+
description: '取消本人在当前会话的提醒', descriptionI18n: { en: "Cancel your reminder in this conversation" },
|
|
8
|
+
params: { id: { type: 'string', description: 'remind list 中的任务 ID', descriptionI18n: { en: "Task ID from the reminder list" } } },
|
|
9
|
+
async execute({ input, params, use, locale }) {
|
|
10
|
+
return replyReminder(async () => await use(reminderServiceToken).cancel(reminderActor(input, locale), params.id) ? t(locale, 'cancelled') : t(locale, 'notFound'));
|
|
10
11
|
},
|
|
11
12
|
});
|
|
@@ -1,11 +1,12 @@
|
|
|
1
|
+
import { reminderMessages as t } from '../../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import { reminderServiceToken } from '../../../src/runtime.js';
|
|
3
4
|
import { reminderActor, replyReminder } from '../../../src/caller.js';
|
|
4
5
|
|
|
5
6
|
export default defineCommand({
|
|
6
|
-
description: '取消本人在当前会话的提醒',
|
|
7
|
-
params: { id: { type: 'string', description: 'remind list 中的任务 ID' } },
|
|
8
|
-
async execute({ input, params, use }) {
|
|
9
|
-
return replyReminder(async () => await use(reminderServiceToken).cancel(reminderActor(input), params.id) ? '
|
|
7
|
+
description: '取消本人在当前会话的提醒', descriptionI18n: { en: "Cancel your reminder in this conversation" },
|
|
8
|
+
params: { id: { type: 'string', description: 'remind list 中的任务 ID', descriptionI18n: { en: "Task ID from the reminder list" } } },
|
|
9
|
+
async execute({ input, params, use, locale }) {
|
|
10
|
+
return replyReminder(async () => await use(reminderServiceToken).cancel(reminderActor(input, locale), params.id) ? t(locale, 'cancelled') : t(locale, 'notFound'));
|
|
10
11
|
},
|
|
11
12
|
});
|
|
@@ -2,11 +2,11 @@
|
|
|
2
2
|
import { defineCommand } from 'zhin.js/command';
|
|
3
3
|
import { createPersonalReminder } from "../../../lib/create-reminder.js";
|
|
4
4
|
const params = {
|
|
5
|
-
when: { type: 'string', optional: true, max: 200, description: '提醒时间,例如 10分钟后、明天上午九点;含空格须加引号' },
|
|
6
|
-
text: { type: 'text', optional: true, max: 500, description: '个人提醒正文;缺省时会逐步补问' },
|
|
5
|
+
when: { type: 'string', optional: true, max: 200, description: '提醒时间,例如 10分钟后、明天上午九点;含空格须加引号', descriptionI18n: { en: "Reminder time, such as in 10 minutes or tomorrow at 09:00; quote expressions containing spaces" } },
|
|
6
|
+
text: { type: 'text', optional: true, max: 500, description: '个人提醒正文;缺省时会逐步补问', descriptionI18n: { en: "Personal reminder text; missing fields are requested step by step" } },
|
|
7
7
|
};
|
|
8
8
|
export default defineCommand({
|
|
9
|
-
description: '逐步补全时间和正文,明确确认后创建一次性个人提醒',
|
|
9
|
+
description: '逐步补全时间和正文,明确确认后创建一次性个人提醒', descriptionI18n: { en: "Complete the time and text, then explicitly confirm a one-time personal reminder" },
|
|
10
10
|
params,
|
|
11
11
|
execute: context => createPersonalReminder(context, context.params),
|
|
12
12
|
});
|
|
@@ -3,12 +3,12 @@ import type { ReminderConfig } from '../../../src/config.js';
|
|
|
3
3
|
import { createPersonalReminder } from '../../../src/create-reminder.js';
|
|
4
4
|
|
|
5
5
|
const params = {
|
|
6
|
-
when: { type: 'string', optional: true, max: 200, description: '提醒时间,例如 10分钟后、明天上午九点;含空格须加引号' },
|
|
7
|
-
text: { type: 'text', optional: true, max: 500, description: '个人提醒正文;缺省时会逐步补问' },
|
|
6
|
+
when: { type: 'string', optional: true, max: 200, description: '提醒时间,例如 10分钟后、明天上午九点;含空格须加引号', descriptionI18n: { en: "Reminder time, such as in 10 minutes or tomorrow at 09:00; quote expressions containing spaces" } },
|
|
7
|
+
text: { type: 'text', optional: true, max: 500, description: '个人提醒正文;缺省时会逐步补问', descriptionI18n: { en: "Personal reminder text; missing fields are requested step by step" } },
|
|
8
8
|
} as const;
|
|
9
9
|
|
|
10
10
|
export default defineCommand<ReminderConfig, string | undefined, CommandMessage, typeof params>({
|
|
11
|
-
description: '逐步补全时间和正文,明确确认后创建一次性个人提醒',
|
|
11
|
+
description: '逐步补全时间和正文,明确确认后创建一次性个人提醒', descriptionI18n: { en: "Complete the time and text, then explicitly confirm a one-time personal reminder" },
|
|
12
12
|
params,
|
|
13
13
|
execute: context => createPersonalReminder(context, context.params),
|
|
14
14
|
});
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { reminderMessages as t } from "../../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { reminderServiceToken } from "../../../lib/runtime.js";
|
|
4
5
|
import { reminderActor, replyReminder } from "../../../lib/caller.js";
|
|
5
6
|
import { MAX_DELAY_SECONDS } from "../../../lib/service.js";
|
|
6
7
|
export default defineCommand({
|
|
7
|
-
description: '创建固定周期提醒',
|
|
8
|
-
params: { seconds: { type: 'integer', min: 60, max: MAX_DELAY_SECONDS, description: '周期秒数(至少 60)' }, text: { type: 'text', min: 1, max: 500, description: '提醒内容' } },
|
|
9
|
-
async execute({ input, params, use }) {
|
|
8
|
+
description: '创建固定周期提醒', descriptionI18n: { en: "Create a recurring reminder with a fixed interval" },
|
|
9
|
+
params: { seconds: { type: 'integer', min: 60, max: MAX_DELAY_SECONDS, description: '周期秒数(至少 60)', descriptionI18n: { en: "Interval in seconds (at least 60)" } }, text: { type: 'text', min: 1, max: 500, description: '提醒内容', descriptionI18n: { en: "Reminder text" } } },
|
|
10
|
+
async execute({ input, params, use, locale }) {
|
|
10
11
|
return replyReminder(async () => {
|
|
11
12
|
const service = use(reminderServiceToken);
|
|
12
|
-
const task = await service.add(reminderActor(input), params.text, Date.now() + params.seconds * 1000, params.seconds * 1000);
|
|
13
|
-
return
|
|
13
|
+
const task = await service.add(reminderActor(input, locale), params.text, Date.now() + params.seconds * 1000, params.seconds * 1000);
|
|
14
|
+
return `${t(locale, 'createdPeriodic')}\n${service.describe(task, locale)}`;
|
|
14
15
|
});
|
|
15
16
|
},
|
|
16
17
|
});
|
|
@@ -1,16 +1,17 @@
|
|
|
1
|
+
import { reminderMessages as t } from '../../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import { reminderServiceToken } from '../../../src/runtime.js';
|
|
3
4
|
import { reminderActor, replyReminder } from '../../../src/caller.js';
|
|
4
5
|
import { MAX_DELAY_SECONDS } from '../../../src/service.js';
|
|
5
6
|
|
|
6
7
|
export default defineCommand({
|
|
7
|
-
description: '创建固定周期提醒',
|
|
8
|
-
params: { seconds: { type: 'integer', min: 60, max: MAX_DELAY_SECONDS, description: '周期秒数(至少 60)' }, text: { type: 'text', min: 1, max: 500, description: '提醒内容' } },
|
|
9
|
-
async execute({ input, params, use }) {
|
|
8
|
+
description: '创建固定周期提醒', descriptionI18n: { en: "Create a recurring reminder with a fixed interval" },
|
|
9
|
+
params: { seconds: { type: 'integer', min: 60, max: MAX_DELAY_SECONDS, description: '周期秒数(至少 60)', descriptionI18n: { en: "Interval in seconds (at least 60)" } }, text: { type: 'text', min: 1, max: 500, description: '提醒内容', descriptionI18n: { en: "Reminder text" } } },
|
|
10
|
+
async execute({ input, params, use, locale }) {
|
|
10
11
|
return replyReminder(async () => {
|
|
11
12
|
const service = use(reminderServiceToken);
|
|
12
|
-
const task = await service.add(reminderActor(input), params.text, Date.now() + params.seconds * 1000, params.seconds * 1000);
|
|
13
|
-
return
|
|
13
|
+
const task = await service.add(reminderActor(input, locale), params.text, Date.now() + params.seconds * 1000, params.seconds * 1000);
|
|
14
|
+
return `${t(locale, 'createdPeriodic')}\n${service.describe(task, locale)}`;
|
|
14
15
|
});
|
|
15
16
|
},
|
|
16
17
|
});
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
// Generated by build-plugin-runtime-entries.mjs. Do not edit.
|
|
2
|
+
import { reminderMessages as t } from "../../../lib/i18n.js";
|
|
2
3
|
import { defineCommand } from 'zhin.js/command';
|
|
3
4
|
import { reminderServiceToken } from "../../../lib/runtime.js";
|
|
4
5
|
import { reminderActor, replyReminder } from "../../../lib/caller.js";
|
|
5
6
|
export default defineCommand({
|
|
6
|
-
description: '查看本人在当前会话的提醒',
|
|
7
|
-
async execute({ input, use }) {
|
|
7
|
+
description: '查看本人在当前会话的提醒', descriptionI18n: { en: "List your reminders in this conversation" },
|
|
8
|
+
async execute({ input, use, locale }) {
|
|
8
9
|
return replyReminder(async () => {
|
|
9
10
|
const service = use(reminderServiceToken);
|
|
10
|
-
const tasks = await service.list(reminderActor(input));
|
|
11
|
-
return tasks.length ? tasks.map(task => service.describe(task)).join('\n\n') : '
|
|
11
|
+
const tasks = await service.list(reminderActor(input, locale));
|
|
12
|
+
return tasks.length ? tasks.map(task => service.describe(task, locale)).join('\n\n') : t(locale, 'empty');
|
|
12
13
|
});
|
|
13
14
|
},
|
|
14
15
|
});
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
+
import { reminderMessages as t } from '../../../src/i18n.js';
|
|
1
2
|
import { defineCommand } from 'zhin.js/command';
|
|
2
3
|
import { reminderServiceToken } from '../../../src/runtime.js';
|
|
3
4
|
import { reminderActor, replyReminder } from '../../../src/caller.js';
|
|
4
5
|
|
|
5
6
|
export default defineCommand({
|
|
6
|
-
description: '查看本人在当前会话的提醒',
|
|
7
|
-
async execute({ input, use }) {
|
|
7
|
+
description: '查看本人在当前会话的提醒', descriptionI18n: { en: "List your reminders in this conversation" },
|
|
8
|
+
async execute({ input, use, locale }) {
|
|
8
9
|
return replyReminder(async () => {
|
|
9
10
|
const service = use(reminderServiceToken);
|
|
10
|
-
const tasks = await service.list(reminderActor(input));
|
|
11
|
-
return tasks.length ? tasks.map(task => service.describe(task)).join('\n\n') : '
|
|
11
|
+
const tasks = await service.list(reminderActor(input, locale));
|
|
12
|
+
return tasks.length ? tasks.map(task => service.describe(task, locale)).join('\n\n') : t(locale, 'empty');
|
|
12
13
|
});
|
|
13
14
|
},
|
|
14
15
|
});
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
import { type Locale } from 'zhin.js/i18n';
|
|
2
|
+
import { PluginTaskError } from 'zhin.js/plugin-runtime';
|
|
3
|
+
declare const catalog: {
|
|
4
|
+
readonly invalidTarget: {
|
|
5
|
+
readonly "zh-CN": "请提供完整有效的目标账号、会话、父容器和线程";
|
|
6
|
+
readonly en: "Provide a complete valid account, conversation, parent container and thread.";
|
|
7
|
+
};
|
|
8
|
+
readonly requestReused: {
|
|
9
|
+
readonly "zh-CN": "同一请求 ID 已用于其他内容";
|
|
10
|
+
readonly en: "This request ID was already used for different content.";
|
|
11
|
+
};
|
|
12
|
+
readonly invalidAction: {
|
|
13
|
+
readonly "zh-CN": "任务 ID 或操作无效";
|
|
14
|
+
readonly en: "Invalid task ID or action.";
|
|
15
|
+
};
|
|
16
|
+
readonly updateParameters: {
|
|
17
|
+
readonly "zh-CN": "仅编辑操作接受参数";
|
|
18
|
+
readonly en: "Only the update action accepts parameters.";
|
|
19
|
+
};
|
|
20
|
+
readonly finished: {
|
|
21
|
+
readonly "zh-CN": "任务已结束,不能再次取消";
|
|
22
|
+
readonly en: "This task has ended and cannot be cancelled again.";
|
|
23
|
+
};
|
|
24
|
+
readonly invalidMutation: {
|
|
25
|
+
readonly "zh-CN": "操作须包含 UUID requestId 和读取到的 expectedRevision";
|
|
26
|
+
readonly en: "The operation requires a UUID requestId and the expectedRevision read from the task list.";
|
|
27
|
+
};
|
|
28
|
+
readonly replayConflict: {
|
|
29
|
+
readonly "zh-CN": "同一操作请求 ID 已用于其他内容,禁止重放";
|
|
30
|
+
readonly en: "This operation request ID was used for different content and cannot be replayed.";
|
|
31
|
+
};
|
|
32
|
+
readonly delivering: {
|
|
33
|
+
readonly "zh-CN": "投递中或未确认;不会自动重试";
|
|
34
|
+
readonly en: "Delivery is in progress or unconfirmed; no automatic retry.";
|
|
35
|
+
};
|
|
36
|
+
readonly quota: {
|
|
37
|
+
readonly "zh-CN": "管理员提醒池已达上限,请先取消任务;聊天个人提醒使用独立配额";
|
|
38
|
+
readonly en: "The administrator reminder quota is full. Cancel a task first; chat reminders have a separate quota.";
|
|
39
|
+
};
|
|
40
|
+
readonly notFound: {
|
|
41
|
+
readonly "zh-CN": "未找到当前实例的管理员任务;聊天任务不在此入口管理";
|
|
42
|
+
readonly en: "No administrator task was found in this instance. Chat tasks are managed separately.";
|
|
43
|
+
};
|
|
44
|
+
readonly pauseState: {
|
|
45
|
+
readonly "zh-CN": "仅待执行任务可以暂停;未确认投递不能暂停或恢复";
|
|
46
|
+
readonly en: "Only scheduled tasks can be paused. Unconfirmed deliveries cannot be paused or resumed.";
|
|
47
|
+
};
|
|
48
|
+
readonly resumeState: {
|
|
49
|
+
readonly "zh-CN": "仅已暂停任务可以恢复;未确认投递不能恢复或重试";
|
|
50
|
+
readonly en: "Only paused tasks can be resumed. Unconfirmed deliveries cannot be resumed or retried.";
|
|
51
|
+
};
|
|
52
|
+
readonly expired: {
|
|
53
|
+
readonly "zh-CN": "一次性任务时间已过,请先编辑为未来时间再恢复";
|
|
54
|
+
readonly en: "This one-time reminder is past due. Set a future time before resuming.";
|
|
55
|
+
};
|
|
56
|
+
readonly updateState: {
|
|
57
|
+
readonly "zh-CN": "编辑前请先暂停任务;未确认投递不能编辑";
|
|
58
|
+
readonly en: "Pause the task before editing. Unconfirmed deliveries cannot be edited.";
|
|
59
|
+
};
|
|
60
|
+
readonly stopped: {
|
|
61
|
+
readonly "zh-CN": "管理员提醒服务属于已停止的插件实例";
|
|
62
|
+
readonly en: "This administrator reminder service belongs to a stopped plugin instance.";
|
|
63
|
+
};
|
|
64
|
+
readonly retired: {
|
|
65
|
+
readonly "zh-CN": "管理员提醒服务属于未发布或已退役的 generation";
|
|
66
|
+
readonly en: "This administrator reminder service belongs to an unpublished or retired generation.";
|
|
67
|
+
};
|
|
68
|
+
readonly invalidParameters: {
|
|
69
|
+
readonly "zh-CN": "参数须包含 1–500 字提醒内容、带 offset 的 ISO 时间及可选的 60 秒至一年整数周期";
|
|
70
|
+
readonly en: "Provide 1–500 characters of reminder text, an ISO time with an explicit offset, and optionally an integer interval from 60 seconds to one year.";
|
|
71
|
+
};
|
|
72
|
+
readonly invalidInstant: {
|
|
73
|
+
readonly "zh-CN": "提醒时间须为有效且带 Z 或 ±hh:mm 的 ISO 时间";
|
|
74
|
+
readonly en: "Use a valid ISO reminder time with Z or an explicit ±hh:mm offset.";
|
|
75
|
+
};
|
|
76
|
+
readonly future: {
|
|
77
|
+
readonly "zh-CN": "提醒时间须在未来一年内";
|
|
78
|
+
readonly en: "The reminder must be scheduled within the next year.";
|
|
79
|
+
};
|
|
80
|
+
readonly revision: {
|
|
81
|
+
readonly "zh-CN": "任务列表已变化,请刷新后重新确认操作";
|
|
82
|
+
readonly en: "The task list changed. Refresh it and confirm the operation again.";
|
|
83
|
+
};
|
|
84
|
+
readonly capacity: {
|
|
85
|
+
readonly "zh-CN": "管理员提醒池状态达到 32 条或 60 KiB 上限,请先取消并整理任务";
|
|
86
|
+
readonly en: "Administrator reminders reached the 32-task or 60 KiB limit. Cancel and clean up tasks first.";
|
|
87
|
+
};
|
|
88
|
+
readonly corrupt: {
|
|
89
|
+
readonly "zh-CN": "管理员提醒持久状态格式无效,已停止投递";
|
|
90
|
+
readonly en: "Administrator reminder storage is invalid. Delivery has stopped.";
|
|
91
|
+
};
|
|
92
|
+
readonly waiting: {
|
|
93
|
+
readonly "zh-CN": "等待执行";
|
|
94
|
+
readonly en: "Waiting to run";
|
|
95
|
+
};
|
|
96
|
+
readonly paused: {
|
|
97
|
+
readonly "zh-CN": "管理员暂停";
|
|
98
|
+
readonly en: "Paused by an administrator";
|
|
99
|
+
};
|
|
100
|
+
readonly resumedSkipping: {
|
|
101
|
+
readonly "zh-CN": "已恢复,并跳过错过的周期轮次";
|
|
102
|
+
readonly en: "Resumed; missed intervals were skipped";
|
|
103
|
+
};
|
|
104
|
+
readonly resumed: {
|
|
105
|
+
readonly "zh-CN": "管理员恢复";
|
|
106
|
+
readonly en: "Resumed by an administrator";
|
|
107
|
+
};
|
|
108
|
+
readonly edited: {
|
|
109
|
+
readonly "zh-CN": "已编辑,保持暂停;请确认后恢复";
|
|
110
|
+
readonly en: "Updated and still paused. Confirm before resuming.";
|
|
111
|
+
};
|
|
112
|
+
readonly cancelled: {
|
|
113
|
+
readonly "zh-CN": "管理员取消;已经开始的投递无法撤回";
|
|
114
|
+
readonly en: "Cancelled by an administrator. A delivery already in progress cannot be recalled.";
|
|
115
|
+
};
|
|
116
|
+
readonly skipped: {
|
|
117
|
+
readonly "zh-CN": "已跳过错过的周期轮次";
|
|
118
|
+
readonly en: "Missed intervals were skipped";
|
|
119
|
+
};
|
|
120
|
+
readonly unknown: {
|
|
121
|
+
readonly "zh-CN": "平台未确认投递,请核实目标会话后取消并另建任务;不会自动重试";
|
|
122
|
+
readonly en: "The platform did not confirm delivery. Check the target conversation, then cancel and create another task; no automatic retry.";
|
|
123
|
+
};
|
|
124
|
+
readonly delivered: {
|
|
125
|
+
readonly "zh-CN": "已确认投递";
|
|
126
|
+
readonly en: "Delivery confirmed";
|
|
127
|
+
};
|
|
128
|
+
readonly rejected: {
|
|
129
|
+
readonly "zh-CN": "平台明确未投递或拒绝;任务已停止";
|
|
130
|
+
readonly en: "The platform confirmed no delivery or rejected it. The task has stopped.";
|
|
131
|
+
};
|
|
132
|
+
readonly stateNote: {
|
|
133
|
+
readonly "zh-CN": "{detail};状态仅表示调度事实,不代表平台连接或投递健康";
|
|
134
|
+
readonly en: "{detail}; state records scheduling facts, not platform connection or delivery health.";
|
|
135
|
+
};
|
|
136
|
+
};
|
|
137
|
+
export declare const adminText: (locale: Locale | undefined, key: "invalidTarget" | "requestReused" | "invalidAction" | "updateParameters" | "finished" | "invalidMutation" | "replayConflict" | "delivering" | "quota" | "notFound" | "pauseState" | "resumeState" | "expired" | "updateState" | "stopped" | "retired" | "invalidParameters" | "invalidInstant" | "future" | "revision" | "capacity" | "corrupt" | "waiting" | "paused" | "resumedSkipping" | "resumed" | "edited" | "cancelled" | "skipped" | "unknown" | "delivered" | "rejected" | "stateNote", values?: import("zhin.js").MessageValues) => string;
|
|
138
|
+
export type AdminTextKey = keyof typeof catalog;
|
|
139
|
+
export declare function isAdminTextKey(value: unknown): value is AdminTextKey;
|
|
140
|
+
/** Persist a stable presentation key; preserve legacy text for older readers. */
|
|
141
|
+
export declare function taskDetail(detailKey: AdminTextKey): {
|
|
142
|
+
detailKey: "invalidTarget" | "requestReused" | "invalidAction" | "updateParameters" | "finished" | "invalidMutation" | "replayConflict" | "delivering" | "quota" | "notFound" | "pauseState" | "resumeState" | "expired" | "updateState" | "stopped" | "retired" | "invalidParameters" | "invalidInstant" | "future" | "revision" | "capacity" | "corrupt" | "waiting" | "paused" | "resumedSkipping" | "resumed" | "edited" | "cancelled" | "skipped" | "unknown" | "delivered" | "rejected" | "stateNote";
|
|
143
|
+
detail: string;
|
|
144
|
+
};
|
|
145
|
+
export declare function formatTaskDetail(task: {
|
|
146
|
+
detail: string;
|
|
147
|
+
detailKey?: AdminTextKey;
|
|
148
|
+
}, locale?: Locale): string;
|
|
149
|
+
export declare class LocalizedTaskError extends PluginTaskError {
|
|
150
|
+
readonly messageKey: AdminTextKey;
|
|
151
|
+
constructor(code: ConstructorParameters<typeof PluginTaskError>[0], messageKey: AdminTextKey);
|
|
152
|
+
localize(locale?: Locale): PluginTaskError;
|
|
153
|
+
}
|
|
154
|
+
export {};
|
|
155
|
+
//# sourceMappingURL=admin-i18n.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-i18n.d.ts","sourceRoot":"","sources":["../src/admin-i18n.ts"],"names":[],"mappings":"AAAA,OAAO,EAAkB,KAAK,MAAM,EAAE,MAAM,cAAc,CAAC;AAC3D,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AAEzD,QAAA,MAAM,OAAO;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAqIH,CAAC;AACX,eAAO,MAAM,SAAS,yjBAA0B,CAAC;AACjD,MAAM,MAAM,YAAY,GAAG,MAAM,OAAO,OAAO,CAAC;AAChD,wBAAgB,cAAc,CAAC,KAAK,EAAE,OAAO,GAAG,KAAK,IAAI,YAAY,CAAuE;AAE5I,iFAAiF;AACjF,wBAAgB,UAAU,CAAC,SAAS,EAAE,YAAY;;;EAAkE;AACpH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,CAAC,EAAE,YAAY,CAAA;CAAE,EAAE,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAE5G;AAED,qBAAa,kBAAmB,SAAQ,eAAe;IACrD,QAAQ,CAAC,UAAU,EAAE,YAAY,CAAC;gBACtB,IAAI,EAAE,qBAAqB,CAAC,OAAO,eAAe,CAAC,CAAC,CAAC,CAAC,EAAE,UAAU,EAAE,YAAY;IAG5F,QAAQ,CAAC,MAAM,CAAC,EAAE,MAAM,GAAG,eAAe;CAC3C"}
|
|
@@ -0,0 +1,152 @@
|
|
|
1
|
+
import { createMessages } from 'zhin.js/i18n';
|
|
2
|
+
import { PluginTaskError } from 'zhin.js/plugin-runtime';
|
|
3
|
+
const catalog = {
|
|
4
|
+
"invalidTarget": {
|
|
5
|
+
"zh-CN": "请提供完整有效的目标账号、会话、父容器和线程",
|
|
6
|
+
"en": "Provide a complete valid account, conversation, parent container and thread."
|
|
7
|
+
},
|
|
8
|
+
"requestReused": {
|
|
9
|
+
"zh-CN": "同一请求 ID 已用于其他内容",
|
|
10
|
+
"en": "This request ID was already used for different content."
|
|
11
|
+
},
|
|
12
|
+
"invalidAction": {
|
|
13
|
+
"zh-CN": "任务 ID 或操作无效",
|
|
14
|
+
"en": "Invalid task ID or action."
|
|
15
|
+
},
|
|
16
|
+
"updateParameters": {
|
|
17
|
+
"zh-CN": "仅编辑操作接受参数",
|
|
18
|
+
"en": "Only the update action accepts parameters."
|
|
19
|
+
},
|
|
20
|
+
"finished": {
|
|
21
|
+
"zh-CN": "任务已结束,不能再次取消",
|
|
22
|
+
"en": "This task has ended and cannot be cancelled again."
|
|
23
|
+
},
|
|
24
|
+
"invalidMutation": {
|
|
25
|
+
"zh-CN": "操作须包含 UUID requestId 和读取到的 expectedRevision",
|
|
26
|
+
"en": "The operation requires a UUID requestId and the expectedRevision read from the task list."
|
|
27
|
+
},
|
|
28
|
+
"replayConflict": {
|
|
29
|
+
"zh-CN": "同一操作请求 ID 已用于其他内容,禁止重放",
|
|
30
|
+
"en": "This operation request ID was used for different content and cannot be replayed."
|
|
31
|
+
},
|
|
32
|
+
"delivering": {
|
|
33
|
+
"zh-CN": "投递中或未确认;不会自动重试",
|
|
34
|
+
"en": "Delivery is in progress or unconfirmed; no automatic retry."
|
|
35
|
+
},
|
|
36
|
+
"quota": {
|
|
37
|
+
"zh-CN": "管理员提醒池已达上限,请先取消任务;聊天个人提醒使用独立配额",
|
|
38
|
+
"en": "The administrator reminder quota is full. Cancel a task first; chat reminders have a separate quota."
|
|
39
|
+
},
|
|
40
|
+
"notFound": {
|
|
41
|
+
"zh-CN": "未找到当前实例的管理员任务;聊天任务不在此入口管理",
|
|
42
|
+
"en": "No administrator task was found in this instance. Chat tasks are managed separately."
|
|
43
|
+
},
|
|
44
|
+
"pauseState": {
|
|
45
|
+
"zh-CN": "仅待执行任务可以暂停;未确认投递不能暂停或恢复",
|
|
46
|
+
"en": "Only scheduled tasks can be paused. Unconfirmed deliveries cannot be paused or resumed."
|
|
47
|
+
},
|
|
48
|
+
"resumeState": {
|
|
49
|
+
"zh-CN": "仅已暂停任务可以恢复;未确认投递不能恢复或重试",
|
|
50
|
+
"en": "Only paused tasks can be resumed. Unconfirmed deliveries cannot be resumed or retried."
|
|
51
|
+
},
|
|
52
|
+
"expired": {
|
|
53
|
+
"zh-CN": "一次性任务时间已过,请先编辑为未来时间再恢复",
|
|
54
|
+
"en": "This one-time reminder is past due. Set a future time before resuming."
|
|
55
|
+
},
|
|
56
|
+
"updateState": {
|
|
57
|
+
"zh-CN": "编辑前请先暂停任务;未确认投递不能编辑",
|
|
58
|
+
"en": "Pause the task before editing. Unconfirmed deliveries cannot be edited."
|
|
59
|
+
},
|
|
60
|
+
"stopped": {
|
|
61
|
+
"zh-CN": "管理员提醒服务属于已停止的插件实例",
|
|
62
|
+
"en": "This administrator reminder service belongs to a stopped plugin instance."
|
|
63
|
+
},
|
|
64
|
+
"retired": {
|
|
65
|
+
"zh-CN": "管理员提醒服务属于未发布或已退役的 generation",
|
|
66
|
+
"en": "This administrator reminder service belongs to an unpublished or retired generation."
|
|
67
|
+
},
|
|
68
|
+
"invalidParameters": {
|
|
69
|
+
"zh-CN": "参数须包含 1–500 字提醒内容、带 offset 的 ISO 时间及可选的 60 秒至一年整数周期",
|
|
70
|
+
"en": "Provide 1–500 characters of reminder text, an ISO time with an explicit offset, and optionally an integer interval from 60 seconds to one year."
|
|
71
|
+
},
|
|
72
|
+
"invalidInstant": {
|
|
73
|
+
"zh-CN": "提醒时间须为有效且带 Z 或 ±hh:mm 的 ISO 时间",
|
|
74
|
+
"en": "Use a valid ISO reminder time with Z or an explicit ±hh:mm offset."
|
|
75
|
+
},
|
|
76
|
+
"future": {
|
|
77
|
+
"zh-CN": "提醒时间须在未来一年内",
|
|
78
|
+
"en": "The reminder must be scheduled within the next year."
|
|
79
|
+
},
|
|
80
|
+
"revision": {
|
|
81
|
+
"zh-CN": "任务列表已变化,请刷新后重新确认操作",
|
|
82
|
+
"en": "The task list changed. Refresh it and confirm the operation again."
|
|
83
|
+
},
|
|
84
|
+
"capacity": {
|
|
85
|
+
"zh-CN": "管理员提醒池状态达到 32 条或 60 KiB 上限,请先取消并整理任务",
|
|
86
|
+
"en": "Administrator reminders reached the 32-task or 60 KiB limit. Cancel and clean up tasks first."
|
|
87
|
+
},
|
|
88
|
+
"corrupt": {
|
|
89
|
+
"zh-CN": "管理员提醒持久状态格式无效,已停止投递",
|
|
90
|
+
"en": "Administrator reminder storage is invalid. Delivery has stopped."
|
|
91
|
+
},
|
|
92
|
+
"waiting": {
|
|
93
|
+
"zh-CN": "等待执行",
|
|
94
|
+
"en": "Waiting to run"
|
|
95
|
+
},
|
|
96
|
+
"paused": {
|
|
97
|
+
"zh-CN": "管理员暂停",
|
|
98
|
+
"en": "Paused by an administrator"
|
|
99
|
+
},
|
|
100
|
+
"resumedSkipping": {
|
|
101
|
+
"zh-CN": "已恢复,并跳过错过的周期轮次",
|
|
102
|
+
"en": "Resumed; missed intervals were skipped"
|
|
103
|
+
},
|
|
104
|
+
"resumed": {
|
|
105
|
+
"zh-CN": "管理员恢复",
|
|
106
|
+
"en": "Resumed by an administrator"
|
|
107
|
+
},
|
|
108
|
+
"edited": {
|
|
109
|
+
"zh-CN": "已编辑,保持暂停;请确认后恢复",
|
|
110
|
+
"en": "Updated and still paused. Confirm before resuming."
|
|
111
|
+
},
|
|
112
|
+
"cancelled": {
|
|
113
|
+
"zh-CN": "管理员取消;已经开始的投递无法撤回",
|
|
114
|
+
"en": "Cancelled by an administrator. A delivery already in progress cannot be recalled."
|
|
115
|
+
},
|
|
116
|
+
"skipped": {
|
|
117
|
+
"zh-CN": "已跳过错过的周期轮次",
|
|
118
|
+
"en": "Missed intervals were skipped"
|
|
119
|
+
},
|
|
120
|
+
"unknown": {
|
|
121
|
+
"zh-CN": "平台未确认投递,请核实目标会话后取消并另建任务;不会自动重试",
|
|
122
|
+
"en": "The platform did not confirm delivery. Check the target conversation, then cancel and create another task; no automatic retry."
|
|
123
|
+
},
|
|
124
|
+
"delivered": {
|
|
125
|
+
"zh-CN": "已确认投递",
|
|
126
|
+
"en": "Delivery confirmed"
|
|
127
|
+
},
|
|
128
|
+
"rejected": {
|
|
129
|
+
"zh-CN": "平台明确未投递或拒绝;任务已停止",
|
|
130
|
+
"en": "The platform confirmed no delivery or rejected it. The task has stopped."
|
|
131
|
+
},
|
|
132
|
+
"stateNote": {
|
|
133
|
+
"zh-CN": "{detail};状态仅表示调度事实,不代表平台连接或投递健康",
|
|
134
|
+
"en": "{detail}; state records scheduling facts, not platform connection or delivery health."
|
|
135
|
+
}
|
|
136
|
+
};
|
|
137
|
+
export const adminText = createMessages(catalog);
|
|
138
|
+
export function isAdminTextKey(value) { return typeof value === 'string' && Object.hasOwn(catalog, value); }
|
|
139
|
+
/** Persist a stable presentation key; preserve legacy text for older readers. */
|
|
140
|
+
export function taskDetail(detailKey) { return { detailKey, detail: adminText('zh-CN', detailKey) }; }
|
|
141
|
+
export function formatTaskDetail(task, locale) {
|
|
142
|
+
return task.detailKey ? adminText(locale, task.detailKey) : task.detail;
|
|
143
|
+
}
|
|
144
|
+
export class LocalizedTaskError extends PluginTaskError {
|
|
145
|
+
messageKey;
|
|
146
|
+
constructor(code, messageKey) {
|
|
147
|
+
super(code, adminText('zh-CN', messageKey));
|
|
148
|
+
this.messageKey = messageKey;
|
|
149
|
+
}
|
|
150
|
+
localize(locale) { return new PluginTaskError(this.code, adminText(locale, this.messageKey)); }
|
|
151
|
+
}
|
|
152
|
+
//# sourceMappingURL=admin-i18n.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"admin-i18n.js","sourceRoot":"","sources":["../src/admin-i18n.ts"],"names":[],"mappings":"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"}
|