@dsh-plus/notify-email 0.1.12 → 0.1.13

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 CHANGED
@@ -385,9 +385,10 @@ ${extra}
385
385
  //#region src/ns.ts
386
386
  /**
387
387
  * settings 命名空间字面量(纯常量,零依赖,浏览器半可安全引入)。
388
- * 服务端经 settingsNamespace() 品牌化后使用(config.ts),浏览器半将其作为
389
- * settings.plugin.item keyed 槽位的 key —— 同一字面量两处共用,防止漂移。
390
- * 契约:该槽位按「卡片编辑的 settings 命名空间」作 key 分发(0.1.2-alpha.1 基线),
388
+ * 服务端直接以字面量注册(0.1.2-alpha.2 起编译期校验命名空间语法,见
389
+ * config.ts),浏览器半将其作为 settings.plugin.item keyed 槽位的 key ——
390
+ * 同一字面量两处共用,防止漂移。
391
+ * 契约:该槽位按「卡片编辑的 settings 命名空间」作 key 分发,
391
392
  * 官方配置页只渲染 key 命中 Host 已注册命名空间的卡片。
392
393
  * @module notify-email/ns
393
394
  */
package/lib/index.js CHANGED
@@ -1,4 +1,3 @@
1
- import { installSettingsSection, settingsNamespace } from "@deepseek-ai/dsh-settings";
2
1
  import z from "@deepseek-ai/schemastery";
3
2
  import { Context, Service } from "@deepseek-ai/cordis";
4
3
  import { dshHomePath } from "@deepseek-ai/dsh-home-paths";
@@ -13,8 +12,8 @@ import nodemailer from "nodemailer";
13
12
  * 共用同一 schemastery schema。SMTP 密码标记 secret 角色,任何读取通道不得回传。
14
13
  * @module notify-email/config
15
14
  */
16
- /** settings 命名空间;webui 配置卡片与插件运行期读取同一份(字面量见 ./ns.ts)。 */
17
- const SETTINGS_NS = settingsNamespace("dsh-plus-notify-email");
15
+ /** settings 命名空间(字面量即合法命名空间,0.1.2-alpha.2 起编译期校验;webui 配置卡片与插件运行期读取同一份)。 */
16
+ const SETTINGS_NS = "dsh-plus-notify-email";
18
17
  const SmtpSchema = z.object({
19
18
  host: z.string().description("SMTP 服务器主机名").default(""),
20
19
  port: z.natural().max(65535).description("SMTP 端口").default(465),
@@ -409,7 +408,7 @@ function installTurnEndWatcher(ctx, service, resolveConfig) {
409
408
  //#region src/service.ts
410
409
  /**
411
410
  * NotifyEmailService:通知编排中枢。
412
- * - 配置:installSettingsSection 接入 settings 用户层($DSH_HOME/settings.yaml,热生效),
411
+ * - 配置:settings.installSection 接入 settings 用户层($DSH_HOME/settings.yaml,热生效),
413
412
  * 无 settings provider 时退化为 cordis 行级 config。
414
413
  * - 触发器:registerTrigger 是第三方插件的扩展接口;内置官方适配器同路径注册。
415
414
  * - 投递:首个非空 EmailNotice 经 Mailer 发送;单个触发器抛错不影响其余。
@@ -423,11 +422,13 @@ var NotifyEmailService = class extends Service {
423
422
  constructor(ctx, config) {
424
423
  super(ctx, "notifyEmail");
425
424
  this.current = () => config;
426
- installSettingsSection(ctx, SETTINGS_NS, Config, config, {
427
- setSource: (source) => {
428
- this.current = source;
429
- },
430
- onChange: () => {}
425
+ ctx.inject(["settings"], (settingsCtx) => {
426
+ settingsCtx.settings.installSection(ctx, SETTINGS_NS, Config, config, {
427
+ setSource: (source) => {
428
+ this.current = source;
429
+ },
430
+ onChange: () => {}
431
+ });
431
432
  });
432
433
  const logger = ctx.logger("notify-email");
433
434
  const audit = createJsonlAuditSink(dshHomePath("logs", "notify-email.jsonl"), (message) => logger.warn(`audit write failed: ${message}`));
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dsh-plus/notify-email",
3
- "version": "0.1.12",
3
+ "version": "0.1.13",
4
4
  "description": "dsh-plus service+ui plugin: 任务结束/等待决策/出错时向指定邮箱发送邮件通知",
5
5
  "type": "module",
6
6
  "main": "lib/index.js",
@@ -31,27 +31,27 @@
31
31
  }
32
32
  },
33
33
  "dependencies": {
34
- "nodemailer": "9.0.5",
35
- "@dsh-plus/shared": "0.1.6"
34
+ "nodemailer": "9.0.6",
35
+ "@dsh-plus/shared": "0.1.7"
36
36
  },
37
37
  "peerDependencies": {
38
38
  "@deepseek-ai/cordis": "^4.0.1",
39
- "@deepseek-ai/dsh-home-paths": "^0.1.2-alpha.1",
40
- "@deepseek-ai/dsh-settings": "^0.1.2-alpha.1",
39
+ "@deepseek-ai/dsh-home-paths": "^0.1.2-alpha.2",
40
+ "@deepseek-ai/dsh-settings": "^0.1.2-alpha.2",
41
41
  "@deepseek-ai/schemastery": "^3.18.1"
42
42
  },
43
43
  "devDependencies": {
44
- "@deepseek-ai/cordis": "4.0.1",
45
- "@deepseek-ai/dsh-agent": "0.1.2-alpha.1",
46
- "@deepseek-ai/dsh-home-paths": "0.1.2-alpha.1",
47
- "@deepseek-ai/dsh-host-webserver": "0.1.2-alpha.1",
48
- "@deepseek-ai/dsh-llm": "0.1.2-alpha.1",
49
- "@deepseek-ai/dsh-session": "0.1.2-alpha.1",
50
- "@deepseek-ai/dsh-settings": "0.1.2-alpha.1",
51
- "@deepseek-ai/dsh-tools": "0.1.2-alpha.1",
52
- "@deepseek-ai/schemastery": "3.18.1",
44
+ "@deepseek-ai/cordis": "4.0.2",
45
+ "@deepseek-ai/dsh-agent": "0.1.2-alpha.2",
46
+ "@deepseek-ai/dsh-home-paths": "0.1.2-alpha.2",
47
+ "@deepseek-ai/dsh-host-webserver": "0.1.2-alpha.2",
48
+ "@deepseek-ai/dsh-llm": "0.1.2-alpha.2",
49
+ "@deepseek-ai/dsh-session": "0.1.2-alpha.2",
50
+ "@deepseek-ai/dsh-settings": "0.1.2-alpha.2",
51
+ "@deepseek-ai/dsh-tools": "0.1.2-alpha.2",
52
+ "@deepseek-ai/schemastery": "3.18.2",
53
53
  "@types/nodemailer": "8.0.1",
54
- "@types/react": "~18.3.1",
54
+ "@types/react": "~18.3.31",
55
55
  "react": "^18.2.0"
56
56
  },
57
57
  "publishConfig": {
@@ -5,8 +5,8 @@
5
5
  *
6
6
  * 类型说明:浏览器半只用到 slots/locale/remote 的很窄一面,
7
7
  * scope 与基础控件走 @dsh-plus/shared/client 套件(收编自本插件原实现)。
8
- * 该插槽为 keyed 槽位(0.1.2-alpha.1 基线):key 必须是卡片编辑的 settings
9
- * 命名空间(即服务端 settingsNamespace() 注册的同一字面量,见 ../ns.ts),
8
+ * 该插槽为 keyed 槽位(0.1.2-alpha.2 复核不变):key 必须是卡片编辑的 settings
9
+ * 命名空间(即服务端注册的同一字面量,见 ../ns.ts),
10
10
  * 官方配置页按此 key 与 Host 已注册命名空间配对分发。
11
11
  * 配置读写经 ctx.remote.settings 直连(0.1.2-alpha.1 起 connection.api.settings
12
12
  * 已移除;不复用 settingsScope 服务——非 loopback 页面下它固定 memory 模式无数据);
package/src/config.ts CHANGED
@@ -5,13 +5,12 @@
5
5
  * @module notify-email/config
6
6
  */
7
7
 
8
- import { settingsNamespace } from '@deepseek-ai/dsh-settings'
9
8
  import z from '@deepseek-ai/schemastery'
10
9
 
11
10
  import { SETTINGS_NS as NS_LITERAL } from './ns.ts'
12
11
 
13
- /** settings 命名空间;webui 配置卡片与插件运行期读取同一份(字面量见 ./ns.ts)。 */
14
- export const SETTINGS_NS = settingsNamespace(NS_LITERAL)
12
+ /** settings 命名空间(字面量即合法命名空间,0.1.2-alpha.2 起编译期校验;webui 配置卡片与插件运行期读取同一份)。 */
13
+ export const SETTINGS_NS = NS_LITERAL
15
14
 
16
15
  const SmtpSchema = z.object({
17
16
  host: z.string().description('SMTP 服务器主机名').default(''),
package/src/ns.ts CHANGED
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * settings 命名空间字面量(纯常量,零依赖,浏览器半可安全引入)。
3
- * 服务端经 settingsNamespace() 品牌化后使用(config.ts),浏览器半将其作为
4
- * settings.plugin.item keyed 槽位的 key —— 同一字面量两处共用,防止漂移。
5
- * 契约:该槽位按「卡片编辑的 settings 命名空间」作 key 分发(0.1.2-alpha.1 基线),
3
+ * 服务端直接以字面量注册(0.1.2-alpha.2 起编译期校验命名空间语法,见
4
+ * config.ts),浏览器半将其作为 settings.plugin.item keyed 槽位的 key ——
5
+ * 同一字面量两处共用,防止漂移。
6
+ * 契约:该槽位按「卡片编辑的 settings 命名空间」作 key 分发,
6
7
  * 官方配置页只渲染 key 命中 Host 已注册命名空间的卡片。
7
8
  * @module notify-email/ns
8
9
  */
package/src/service.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * NotifyEmailService:通知编排中枢。
3
- * - 配置:installSettingsSection 接入 settings 用户层($DSH_HOME/settings.yaml,热生效),
3
+ * - 配置:settings.installSection 接入 settings 用户层($DSH_HOME/settings.yaml,热生效),
4
4
  * 无 settings provider 时退化为 cordis 行级 config。
5
5
  * - 触发器:registerTrigger 是第三方插件的扩展接口;内置官方适配器同路径注册。
6
6
  * - 投递:首个非空 EmailNotice 经 Mailer 发送;单个触发器抛错不影响其余。
@@ -8,7 +8,7 @@
8
8
  */
9
9
  import { Context, Service } from '@deepseek-ai/cordis'
10
10
  import { dshHomePath } from '@deepseek-ai/dsh-home-paths'
11
- import { installSettingsSection } from '@deepseek-ai/dsh-settings'
11
+ import type {} from '@deepseek-ai/dsh-settings'
12
12
  import { createJsonlAuditSink } from './audit.ts'
13
13
  import { Config, type NotifyEmailConfig, SETTINGS_NS } from './config.ts'
14
14
  import { registerTestApi } from './config-api.ts'
@@ -34,11 +34,15 @@ export class NotifyEmailService extends Service {
34
34
  constructor(ctx: Context, config: NotifyEmailConfig) {
35
35
  super(ctx, 'notifyEmail')
36
36
  this.current = () => config
37
- installSettingsSection(ctx, SETTINGS_NS, Config, config, {
38
- setSource: (source) => {
39
- this.current = source
40
- },
41
- onChange: () => {},
37
+ // 官方 installSection 范式(0.1.2-alpha.2):settings 在时以行级 config 为
38
+ // base 注册用户层,缺席/detach 时回落行级 config。
39
+ ctx.inject(['settings'], (settingsCtx) => {
40
+ settingsCtx.settings.installSection(ctx, SETTINGS_NS, Config, config, {
41
+ setSource: (source) => {
42
+ this.current = source
43
+ },
44
+ onChange: () => {},
45
+ })
42
46
  })
43
47
  const logger = ctx.logger('notify-email')
44
48
  const audit = createJsonlAuditSink(dshHomePath('logs', 'notify-email.jsonl'), (message) =>