dsh-connect 0.7.2 → 0.9.0

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.
Files changed (153) hide show
  1. package/README.i18n.yaml +2 -2
  2. package/README.md +196 -43
  3. package/README.zh.md +171 -42
  4. package/client/client.js +817 -0
  5. package/client/client.js.map +7 -0
  6. package/client/locale.mjs +227 -0
  7. package/client/panel-state.mjs +54 -0
  8. package/client/settings-client.mjs +389 -0
  9. package/docs/images/settings-advanced-en.png +0 -0
  10. package/docs/images/settings-advanced-zh.png +0 -0
  11. package/docs/images/settings-defaults-en.png +0 -0
  12. package/docs/images/settings-defaults-zh.png +0 -0
  13. package/docs/images/settings-overview-en.png +0 -0
  14. package/docs/images/settings-overview-zh.png +0 -0
  15. package/examples/minimal.config.json +16 -0
  16. package/lib/binding.d.ts.map +1 -1
  17. package/lib/binding.js +2 -2
  18. package/lib/binding.js.map +1 -1
  19. package/lib/channels/dingtalk/adapter.d.ts +59 -0
  20. package/lib/channels/dingtalk/adapter.d.ts.map +1 -0
  21. package/lib/channels/dingtalk/adapter.js +123 -0
  22. package/lib/channels/dingtalk/adapter.js.map +1 -0
  23. package/lib/channels/dingtalk/i18n.d.ts +14 -0
  24. package/lib/channels/dingtalk/i18n.d.ts.map +1 -0
  25. package/lib/channels/dingtalk/i18n.js +16 -0
  26. package/lib/channels/dingtalk/i18n.js.map +1 -0
  27. package/lib/channels/dingtalk/index.d.ts +127 -0
  28. package/lib/channels/dingtalk/index.d.ts.map +1 -0
  29. package/lib/channels/dingtalk/index.js +144 -0
  30. package/lib/channels/dingtalk/index.js.map +1 -0
  31. package/lib/channels/dingtalk/message.d.ts +49 -0
  32. package/lib/channels/dingtalk/message.d.ts.map +1 -0
  33. package/lib/channels/dingtalk/message.js +50 -0
  34. package/lib/channels/dingtalk/message.js.map +1 -0
  35. package/lib/channels/dingtalk/stomp.d.ts +36 -0
  36. package/lib/channels/dingtalk/stomp.d.ts.map +1 -0
  37. package/lib/channels/dingtalk/stomp.js +107 -0
  38. package/lib/channels/dingtalk/stomp.js.map +1 -0
  39. package/lib/channels/dingtalk/stream.d.ts +53 -0
  40. package/lib/channels/dingtalk/stream.d.ts.map +1 -0
  41. package/lib/channels/dingtalk/stream.js +199 -0
  42. package/lib/channels/dingtalk/stream.js.map +1 -0
  43. package/lib/channels/dingtalk/webhook.d.ts +84 -0
  44. package/lib/channels/dingtalk/webhook.d.ts.map +1 -0
  45. package/lib/channels/dingtalk/webhook.js +143 -0
  46. package/lib/channels/dingtalk/webhook.js.map +1 -0
  47. package/lib/channels/feishu/adapter.d.ts +133 -0
  48. package/lib/channels/feishu/adapter.d.ts.map +1 -0
  49. package/lib/channels/feishu/adapter.js +662 -0
  50. package/lib/channels/feishu/adapter.js.map +1 -0
  51. package/lib/channels/feishu/i18n.d.ts +30 -0
  52. package/lib/channels/feishu/i18n.d.ts.map +1 -0
  53. package/lib/channels/feishu/i18n.js +42 -0
  54. package/lib/channels/feishu/i18n.js.map +1 -0
  55. package/lib/channels/feishu/index.d.ts +82 -0
  56. package/lib/channels/feishu/index.d.ts.map +1 -0
  57. package/lib/channels/feishu/index.js +103 -0
  58. package/lib/channels/feishu/index.js.map +1 -0
  59. package/lib/channels/feishu/onboard.d.ts +16 -0
  60. package/lib/channels/feishu/onboard.d.ts.map +1 -0
  61. package/lib/channels/feishu/onboard.js +86 -0
  62. package/lib/channels/feishu/onboard.js.map +1 -0
  63. package/lib/channels/telegram/adapter.d.ts +70 -0
  64. package/lib/channels/telegram/adapter.d.ts.map +1 -0
  65. package/lib/channels/telegram/adapter.js +460 -0
  66. package/lib/channels/telegram/adapter.js.map +1 -0
  67. package/lib/channels/telegram/client.d.ts +115 -0
  68. package/lib/channels/telegram/client.d.ts.map +1 -0
  69. package/lib/channels/telegram/client.js +198 -0
  70. package/lib/channels/telegram/client.js.map +1 -0
  71. package/lib/channels/telegram/i18n.d.ts +14 -0
  72. package/lib/channels/telegram/i18n.d.ts.map +1 -0
  73. package/lib/channels/telegram/i18n.js +18 -0
  74. package/lib/channels/telegram/i18n.js.map +1 -0
  75. package/lib/channels/telegram/index.d.ts +46 -0
  76. package/lib/channels/telegram/index.d.ts.map +1 -0
  77. package/lib/channels/telegram/index.js +54 -0
  78. package/lib/channels/telegram/index.js.map +1 -0
  79. package/lib/channels/web/adapter.d.ts +103 -0
  80. package/lib/channels/web/adapter.d.ts.map +1 -0
  81. package/lib/channels/web/adapter.js +161 -0
  82. package/lib/channels/web/adapter.js.map +1 -0
  83. package/lib/channels/web/index.d.ts +47 -0
  84. package/lib/channels/web/index.d.ts.map +1 -0
  85. package/lib/channels/web/index.js +59 -0
  86. package/lib/channels/web/index.js.map +1 -0
  87. package/lib/chat-key.d.ts +29 -0
  88. package/lib/chat-key.d.ts.map +1 -0
  89. package/lib/chat-key.js +38 -0
  90. package/lib/chat-key.js.map +1 -0
  91. package/lib/index.d.ts +78 -11
  92. package/lib/index.d.ts.map +1 -1
  93. package/lib/index.js +312 -9
  94. package/lib/index.js.map +1 -1
  95. package/lib/runner.d.ts +55 -2
  96. package/lib/runner.d.ts.map +1 -1
  97. package/lib/runner.js +158 -23
  98. package/lib/runner.js.map +1 -1
  99. package/lib/scheduler.d.ts.map +1 -1
  100. package/lib/scheduler.js +2 -2
  101. package/lib/scheduler.js.map +1 -1
  102. package/lib/service.d.ts +17 -1
  103. package/lib/service.d.ts.map +1 -1
  104. package/lib/service.js +47 -3
  105. package/lib/service.js.map +1 -1
  106. package/lib/settings/channel-runtime.d.ts +75 -0
  107. package/lib/settings/channel-runtime.d.ts.map +1 -0
  108. package/lib/settings/channel-runtime.js +165 -0
  109. package/lib/settings/channel-runtime.js.map +1 -0
  110. package/lib/settings/channels.d.ts +62 -0
  111. package/lib/settings/channels.d.ts.map +1 -0
  112. package/lib/settings/channels.js +132 -0
  113. package/lib/settings/channels.js.map +1 -0
  114. package/lib/settings/credential-store.d.ts +85 -0
  115. package/lib/settings/credential-store.d.ts.map +1 -0
  116. package/lib/settings/credential-store.js +142 -0
  117. package/lib/settings/credential-store.js.map +1 -0
  118. package/lib/settings/index.d.ts +14 -0
  119. package/lib/settings/index.d.ts.map +1 -0
  120. package/lib/settings/index.js +14 -0
  121. package/lib/settings/index.js.map +1 -0
  122. package/lib/settings/namespace.d.ts +175 -0
  123. package/lib/settings/namespace.d.ts.map +1 -0
  124. package/lib/settings/namespace.js +200 -0
  125. package/lib/settings/namespace.js.map +1 -0
  126. package/lib/settings/rpc-client.d.ts +36 -0
  127. package/lib/settings/rpc-client.d.ts.map +1 -0
  128. package/lib/settings/rpc-client.js +45 -0
  129. package/lib/settings/rpc-client.js.map +1 -0
  130. package/lib/settings/secret-disclosure.d.ts +50 -0
  131. package/lib/settings/secret-disclosure.d.ts.map +1 -0
  132. package/lib/settings/secret-disclosure.js +132 -0
  133. package/lib/settings/secret-disclosure.js.map +1 -0
  134. package/lib/settings/settings-model.d.ts +124 -0
  135. package/lib/settings/settings-model.d.ts.map +1 -0
  136. package/lib/settings/settings-model.js +118 -0
  137. package/lib/settings/settings-model.js.map +1 -0
  138. package/lib/settings/settings-rpc.d.ts +130 -0
  139. package/lib/settings/settings-rpc.d.ts.map +1 -0
  140. package/lib/settings/settings-rpc.js +233 -0
  141. package/lib/settings/settings-rpc.js.map +1 -0
  142. package/lib/settings/settings-service.d.ts +35 -0
  143. package/lib/settings/settings-service.d.ts.map +1 -0
  144. package/lib/settings/settings-service.js +171 -0
  145. package/lib/settings/settings-service.js.map +1 -0
  146. package/lib/state-dir.d.ts +28 -0
  147. package/lib/state-dir.d.ts.map +1 -0
  148. package/lib/state-dir.js +33 -0
  149. package/lib/state-dir.js.map +1 -0
  150. package/lib/stream.d.ts.map +1 -1
  151. package/lib/stream.js +3 -2
  152. package/lib/stream.js.map +1 -1
  153. package/package.json +56 -12
@@ -0,0 +1,47 @@
1
+ /**
2
+ * Web channel adapter for dsh-connect: enables DSH Web GUI to mirror and
3
+ * interact with Feishu conversations through the unified ChannelAdapter interface.
4
+ * @module dsh-connect/web
5
+ */
6
+ import type { Context } from "@deepseek-ai/cordis";
7
+ import z from "@deepseek-ai/schemastery";
8
+ import type { BindingStore } from "../../binding.js";
9
+ export { WebAdapter } from "./adapter.js";
10
+ /** Plugin configuration options. */
11
+ export declare const Config: z<Schemastery.ObjectS<{
12
+ /** Polling interval in milliseconds for detecting new mirror sessions. Default: 1000ms */
13
+ pollIntervalMs: z<number, number>;
14
+ }>, Schemastery.ObjectT<{
15
+ /** Polling interval in milliseconds for detecting new mirror sessions. Default: 1000ms */
16
+ pollIntervalMs: z<number, number>;
17
+ }>>;
18
+ export interface ConnectWebConfig {
19
+ pollIntervalMs?: number;
20
+ }
21
+ interface ConnectLike {
22
+ registerAdapter(adapter: unknown): void;
23
+ /** Public accessor for the binding routing store (added to ConnectService). */
24
+ bindingStore?: BindingStore;
25
+ }
26
+ /**
27
+ * Register and start the Web adapter. This enables the DSH Web GUI to
28
+ * automatically detect and interact with mirrored Feishu conversations.
29
+ * `connect` is the already-constructed `ConnectService` instance (passed from
30
+ * the merged entry, not resolved via `ctx.get`), so its public `bindingStore`
31
+ * getter is read directly.
32
+ *
33
+ * When a user runs `/mirror` in Feishu, the resulting webMirrorSessionId
34
+ * becomes accessible through this adapter, allowing the Web GUI to:
35
+ * - View the shared session history
36
+ * - Send messages (subject to lock ownership)
37
+ * - Receive real-time updates through DSH's session event system
38
+ */
39
+ export declare function register(connect: ConnectLike, config: (ConnectWebConfig | null) | undefined, ctx: Context): void;
40
+ /**
41
+ * Compatibility shell for the old split-plugin registration path (when `connect`
42
+ * is an already-active, separate plugin). The merged entry calls `register`
43
+ * directly instead, because `ctx.get("connect")` returns undefined inside this
44
+ * plugin's own `apply`.
45
+ */
46
+ export declare function apply(ctx: Context, config?: ConnectWebConfig | null): void;
47
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/channels/web/index.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AAEzC,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAErD,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,oCAAoC;AACpC,eAAO,MAAM,MAAM;IACjB,0FAA0F;;;IAA1F,0FAA0F;;GAE1F,CAAC;AAEH,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED,UAAU,WAAW;IACnB,eAAe,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAAC;IACxC,+EAA+E;IAC/E,YAAY,CAAC,EAAE,YAAY,CAAC;CAC7B;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,WAAW,EAAE,MAAM,GAAE,gBAAgB,GAAG,IAAI,aAAK,EAAE,GAAG,EAAE,OAAO,GAAG,IAAI,CA4BvG;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,GAAG,EAAE,OAAO,EAAE,MAAM,GAAE,gBAAgB,GAAG,IAAS,GAAG,IAAI,CAM9E"}
@@ -0,0 +1,59 @@
1
+ import z from "@deepseek-ai/schemastery";
2
+ import { WebAdapter } from "./adapter.js";
3
+ export { WebAdapter } from "./adapter.js";
4
+ /** Plugin configuration options. */
5
+ export const Config = z.object({
6
+ /** Polling interval in milliseconds for detecting new mirror sessions. Default: 1000ms */
7
+ pollIntervalMs: z.number(),
8
+ });
9
+ /**
10
+ * Register and start the Web adapter. This enables the DSH Web GUI to
11
+ * automatically detect and interact with mirrored Feishu conversations.
12
+ * `connect` is the already-constructed `ConnectService` instance (passed from
13
+ * the merged entry, not resolved via `ctx.get`), so its public `bindingStore`
14
+ * getter is read directly.
15
+ *
16
+ * When a user runs `/mirror` in Feishu, the resulting webMirrorSessionId
17
+ * becomes accessible through this adapter, allowing the Web GUI to:
18
+ * - View the shared session history
19
+ * - Send messages (subject to lock ownership)
20
+ * - Receive real-time updates through DSH's session event system
21
+ */
22
+ export function register(connect, config = {}, ctx) {
23
+ // The DSH loader passes `null` for entries without an explicit config.
24
+ config = config ?? {};
25
+ // Read the BindingStore from the connect service's public getter (part of the
26
+ // service contract), not via `ctx.get("connect")`.
27
+ const bindings = connect.bindingStore;
28
+ if (bindings === undefined) {
29
+ ctx.logger?.warn?.("connect-web: BindingStore not available, mirror detection disabled");
30
+ return;
31
+ }
32
+ try {
33
+ const adapter = new WebAdapter(bindings, {
34
+ pollIntervalMs: config.pollIntervalMs,
35
+ });
36
+ connect.registerAdapter(adapter);
37
+ void adapter.start().catch((error) => {
38
+ ctx.logger?.warn?.(`connect-web: start failed: ${String(error)}`);
39
+ });
40
+ ctx.logger?.info?.("connect-web: Web adapter registered, mirror detection active");
41
+ }
42
+ catch (error) {
43
+ ctx.logger?.warn?.(`connect-web: adapter init failed: ${String(error)}`);
44
+ }
45
+ }
46
+ /**
47
+ * Compatibility shell for the old split-plugin registration path (when `connect`
48
+ * is an already-active, separate plugin). The merged entry calls `register`
49
+ * directly instead, because `ctx.get("connect")` returns undefined inside this
50
+ * plugin's own `apply`.
51
+ */
52
+ export function apply(ctx, config = {}) {
53
+ const connect = ctx.get("connect");
54
+ if (connect === undefined) {
55
+ throw new Error("connect-web: the dsh-connect service is not present; load it before this adapter");
56
+ }
57
+ register(connect, config, ctx);
58
+ }
59
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/channels/web/index.ts"],"names":[],"mappings":"AAMA,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAG1C,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1C,oCAAoC;AACpC,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,CAAC,MAAM,CAAC;IA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;QAC1B,MAAM,IAAI,KAAK,CAAC,kFAAkF,CAAC,CAAC;IACtG,CAAC;IACD,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,GAAG,CAAC,CAAC;AACjC,CAAC"}
@@ -0,0 +1,29 @@
1
+ /**
2
+ * Thread-scoped chat keys.
3
+ *
4
+ * A chat key is otherwise opaque to the core: every channel picks whatever
5
+ * identifies one conversation (a Feishu `oc_…`, a Telegram chat id, a DingTalk
6
+ * `cid…`). Feishu's `threadIsolation` widens it — a group message inside a
7
+ * thread gets `chatId:thread=<rootId>` so each thread binds its own DSH session
8
+ * and its own runner.
9
+ *
10
+ * The allowlists in the plugin config are written with plain chat ids, so the
11
+ * core reduces a key to its base id before comparing (`baseChatId`). Keeping
12
+ * the encoding here rather than in the Feishu adapter is deliberate: the core
13
+ * gate and the adapter's pre-download gate must agree, and they only do so
14
+ * while a single module owns the format.
15
+ * @module dsh-connect/chat-key
16
+ */
17
+ /**
18
+ * Encode a chat key with an optional thread id. Outbound sends still target the
19
+ * base chat id (replies land in the thread via `replyRef`).
20
+ */
21
+ export declare function encodeChatKey(chatId: string, threadId?: string): string;
22
+ /** Decode a possibly thread-scoped chat key back to its base chat id. */
23
+ export declare function decodeChatKey(chatKey: string): {
24
+ chatId: string;
25
+ threadId?: string;
26
+ };
27
+ /** Base chat id of a chat key, thread-scoped or not. */
28
+ export declare function baseChatId(chatKey: string): string;
29
+ //# sourceMappingURL=chat-key.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-key.d.ts","sourceRoot":"","sources":["../src/chat-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAKH;;;GAGG;AACH,wBAAgB,aAAa,CAAC,MAAM,EAAE,MAAM,EAAE,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAEvE;AAED,yEAAyE;AACzE,wBAAgB,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,MAAM,CAAA;CAAE,CAIpF;AAED,wDAAwD;AACxD,wBAAgB,UAAU,CAAC,OAAO,EAAE,MAAM,GAAG,MAAM,CAGlD"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Thread-scoped chat keys.
3
+ *
4
+ * A chat key is otherwise opaque to the core: every channel picks whatever
5
+ * identifies one conversation (a Feishu `oc_…`, a Telegram chat id, a DingTalk
6
+ * `cid…`). Feishu's `threadIsolation` widens it — a group message inside a
7
+ * thread gets `chatId:thread=<rootId>` so each thread binds its own DSH session
8
+ * and its own runner.
9
+ *
10
+ * The allowlists in the plugin config are written with plain chat ids, so the
11
+ * core reduces a key to its base id before comparing (`baseChatId`). Keeping
12
+ * the encoding here rather than in the Feishu adapter is deliberate: the core
13
+ * gate and the adapter's pre-download gate must agree, and they only do so
14
+ * while a single module owns the format.
15
+ * @module dsh-connect/chat-key
16
+ */
17
+ /** Suffix joining a base chat id to its thread id. */
18
+ const THREAD_SEP = ":thread=";
19
+ /**
20
+ * Encode a chat key with an optional thread id. Outbound sends still target the
21
+ * base chat id (replies land in the thread via `replyRef`).
22
+ */
23
+ export function encodeChatKey(chatId, threadId) {
24
+ return threadId === undefined || threadId === "" ? chatId : `${chatId}${THREAD_SEP}${threadId}`;
25
+ }
26
+ /** Decode a possibly thread-scoped chat key back to its base chat id. */
27
+ export function decodeChatKey(chatKey) {
28
+ const sep = chatKey.indexOf(THREAD_SEP);
29
+ if (sep === -1)
30
+ return { chatId: chatKey };
31
+ return { chatId: chatKey.slice(0, sep), threadId: chatKey.slice(sep + THREAD_SEP.length) };
32
+ }
33
+ /** Base chat id of a chat key, thread-scoped or not. */
34
+ export function baseChatId(chatKey) {
35
+ const sep = chatKey.indexOf(THREAD_SEP);
36
+ return sep === -1 ? chatKey : chatKey.slice(0, sep);
37
+ }
38
+ //# sourceMappingURL=chat-key.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"chat-key.js","sourceRoot":"","sources":["../src/chat-key.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;GAeG;AAEH,sDAAsD;AACtD,MAAM,UAAU,GAAG,UAAU,CAAC;AAE9B;;;GAGG;AACH,MAAM,UAAU,aAAa,CAAC,MAAc,EAAE,QAAiB;IAC7D,OAAO,QAAQ,KAAK,SAAS,IAAI,QAAQ,KAAK,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,GAAG,MAAM,GAAG,UAAU,GAAG,QAAQ,EAAE,CAAC;AAClG,CAAC;AAED,yEAAyE;AACzE,MAAM,UAAU,aAAa,CAAC,OAAe;IAC3C,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,IAAI,GAAG,KAAK,CAAC,CAAC;QAAE,OAAO,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC;IAC3C,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,EAAE,QAAQ,EAAE,OAAO,CAAC,KAAK,CAAC,GAAG,GAAG,UAAU,CAAC,MAAM,CAAC,EAAE,CAAC;AAC7F,CAAC;AAED,wDAAwD;AACxD,MAAM,UAAU,UAAU,CAAC,OAAe;IACxC,MAAM,GAAG,GAAG,OAAO,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,OAAO,GAAG,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;AACtD,CAAC"}
package/lib/index.d.ts CHANGED
@@ -1,13 +1,8 @@
1
- /**
2
- * `dsh-connect` — channel-agnostic messaging bridge core for DeepSeek Harness.
3
- * Provides the `connect` service; channel adapters register into it and route
4
- * normalized messages to bound DSH agents, then stream replies back.
5
- * @module dsh-connect
6
- */
7
1
  import type { Context } from "@deepseek-ai/cordis";
8
2
  import z from "@deepseek-ai/schemastery";
9
3
  import { ConnectService } from "./service.js";
10
4
  import type { ConnectConfig } from "./runner.js";
5
+ import { type ChannelName } from "./settings/channels.js";
11
6
  export { ConnectService } from "./service.js";
12
7
  export { AgentRunner, resolveConnectConfig } from "./runner.js";
13
8
  export { MenuController } from "./menu-controller.js";
@@ -34,11 +29,37 @@ export type { Command } from "./commands.js";
34
29
  export { messages } from "./i18n.js";
35
30
  export type { Language, Messages } from "./i18n.js";
36
31
  export type { ChatType, ChoiceOption, ChoicePrompt, ChoiceResult, InboundMessage, OutboundTarget, SummaryCard, TurnReason, TurnOutcome, AsyncQueue, ChannelAdapter, } from "./types.js";
32
+ export * as feishu from "./channels/feishu/index.js";
33
+ export * as telegram from "./channels/telegram/index.js";
34
+ export * as dingtalk from "./channels/dingtalk/index.js";
35
+ export * as web from "./channels/web/index.js";
36
+ export * as settings from "./settings/index.js";
37
37
  /** Cordis plugin name used by loader diagnostics. */
38
38
  export declare const name = "connect";
39
- /** Host-plane services this plugin requires before it can route messages. */
39
+ /**
40
+ * Host-plane services this plugin must wait for before `apply` runs. All four
41
+ * are rows in the always-loaded `@deepseek-ai/dsh-base` bundle — the shared core
42
+ * of every base-backed profile — so requiring them cannot stall the plugin in
43
+ * any profile that can load `dsh-connect` at all.
44
+ *
45
+ * `credentials` must be listed here, not read lazily inside `apply`: a
46
+ * `ctx.get("credentials")` at apply time returns `undefined`, because this
47
+ * plugin activates before the credentials row does. That silently disabled the
48
+ * whole credential path — `migrateConfigSecrets` never seeded the store (so an
49
+ * upgraded user's working channels displayed "未配置凭据"), `injectSecrets`
50
+ * never merged store-backed secrets into a channel config, and
51
+ * `settings.saveCredentials` threw `not-configured` for every pane save. Note
52
+ * cordis v4 has no `?` optional-inject marker, so `"credentials?"` would be read
53
+ * as a required service literally named `"credentials?"` — that is a syntax
54
+ * hazard, not a reason the service itself is unavailable.
55
+ */
40
56
  export declare const inject: string[];
41
- /** Plugin config; all fields optional — `apply` fills code defaults. */
57
+ /**
58
+ * Full plugin config: the channel-agnostic core fields plus the channel
59
+ * selector (`channels`), shared `channelDefaults`, per-channel config, and the
60
+ * web-settings state path. Each channel's own `Config` schema is also exported
61
+ * (as `feishu.Config`, etc.) for reference; the merged entry validates loosely.
62
+ */
42
63
  export declare const Config: z<Schemastery.ObjectS<{
43
64
  /** Agent preset id composed into each bound session; omit for the roster default. */
44
65
  agentPreset: z<string, string>;
@@ -70,6 +91,16 @@ export declare const Config: z<Schemastery.ObjectS<{
70
91
  notifyLevel: z<"full" | "important" | "result", "full" | "important" | "result">;
71
92
  /** Proactive progress-notice interval ms when a turn stays silent (default: 300000 = 5 min; 0 disables). */
72
93
  progressTimeoutMs: z<number, number>;
94
+ /** Channels to activate; default: all built-in channels. */
95
+ channels: z<("feishu" | "web" | "telegram" | "dingtalk")[], ("feishu" | "web" | "telegram" | "dingtalk")[]>;
96
+ /** Keys applied to every channel that doesn't set its own (e.g. a shared `language`). */
97
+ channelDefaults: z<any, any>;
98
+ feishu: z<any, any>;
99
+ telegram: z<any, any>;
100
+ dingtalk: z<any, any>;
101
+ web: z<any, any>;
102
+ /** Optional path to persist web-settings edits (non-secret). */
103
+ settingsStatePath: z<string, string>;
73
104
  }>, Schemastery.ObjectT<{
74
105
  /** Agent preset id composed into each bound session; omit for the roster default. */
75
106
  agentPreset: z<string, string>;
@@ -101,13 +132,49 @@ export declare const Config: z<Schemastery.ObjectS<{
101
132
  notifyLevel: z<"full" | "important" | "result", "full" | "important" | "result">;
102
133
  /** Proactive progress-notice interval ms when a turn stays silent (default: 300000 = 5 min; 0 disables). */
103
134
  progressTimeoutMs: z<number, number>;
135
+ /** Channels to activate; default: all built-in channels. */
136
+ channels: z<("feishu" | "web" | "telegram" | "dingtalk")[], ("feishu" | "web" | "telegram" | "dingtalk")[]>;
137
+ /** Keys applied to every channel that doesn't set its own (e.g. a shared `language`). */
138
+ channelDefaults: z<any, any>;
139
+ feishu: z<any, any>;
140
+ telegram: z<any, any>;
141
+ dingtalk: z<any, any>;
142
+ web: z<any, any>;
143
+ /** Optional path to persist web-settings edits (non-secret). */
144
+ settingsStatePath: z<string, string>;
104
145
  }>>;
146
+ /** The merged plugin's config type (core fields + channel selector + settings). */
147
+ export interface ConnectSettingsConfig extends ConnectConfig {
148
+ /** Channels to activate; default: all built-in channels. */
149
+ channels?: ChannelName[];
150
+ /** Keys applied to every channel that doesn't set its own (e.g. a shared `language`). */
151
+ channelDefaults?: Record<string, unknown>;
152
+ feishu?: Record<string, unknown>;
153
+ telegram?: Record<string, unknown>;
154
+ dingtalk?: Record<string, unknown>;
155
+ web?: Record<string, unknown>;
156
+ /** Optional path to persist web-settings edits (non-secret). */
157
+ settingsStatePath?: string;
158
+ }
159
+ /** Convenience alias for the settings stack's channel-orchestration config. */
160
+ export type { ChannelsConfig, ChannelApply } from "./settings/channels.js";
105
161
  declare module "@deepseek-ai/cordis" {
106
162
  interface Context {
107
163
  connect: ConnectService;
108
164
  }
109
165
  }
110
- /** Register the `connect` service; adapters resolve it via `inject: ["connect"]`. */
111
- export declare function apply(ctx: Context, config?: ConnectConfig | null): void;
112
- export default ConnectService;
166
+ /**
167
+ * Register the `connect` service and start the enabled channel adapters, then
168
+ * expose the web-settings RPC. `connect` is constructed first and passed *by
169
+ * instance* into each channel's `register` — never resolved via
170
+ * `ctx.get("connect")`, which returns undefined inside this plugin's own
171
+ * `apply` (the fiber is still LOADING until this function resolves).
172
+ */
173
+ export declare function apply(ctx: Context, config?: ConnectSettingsConfig | null): Promise<void>;
174
+ declare const _default: {
175
+ apply: typeof apply;
176
+ name: string;
177
+ inject: string[];
178
+ };
179
+ export default _default;
113
180
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AACH,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,CAAC,MAAM,0BAA0B,CAAC;AACzC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9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