@sidleo3/dsh-chat 0.0.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.
Files changed (47) hide show
  1. package/client/bot-list.js +243 -0
  2. package/client/bot-settings.js +175 -0
  3. package/client/bot-shared-settings.js +561 -0
  4. package/client/chat-ui.js +134 -0
  5. package/client/context-enhancement.js +435 -0
  6. package/client/delivery-targets.js +334 -0
  7. package/client/diagnostics.js +160 -0
  8. package/client/i18n.js +371 -0
  9. package/client/index.js +77 -0
  10. package/client/list-order.js +144 -0
  11. package/client/rpc.js +52 -0
  12. package/client/scoped-mode-editor.js +111 -0
  13. package/client/section.js +250 -0
  14. package/client/session-badges.js +263 -0
  15. package/client/styles.js +960 -0
  16. package/client/version-panel.js +97 -0
  17. package/cordis.patch.yml +5 -0
  18. package/host/bot-model.mjs +53 -0
  19. package/host/bot-settings.mjs +247 -0
  20. package/host/channel-registry.mjs +237 -0
  21. package/host/commands.mjs +857 -0
  22. package/host/deferred.mjs +291 -0
  23. package/host/delivery.mjs +377 -0
  24. package/host/file-log.mjs +169 -0
  25. package/host/guidance.mjs +73 -0
  26. package/host/index.mjs +7 -0
  27. package/host/interactions.mjs +330 -0
  28. package/host/json-store.mjs +144 -0
  29. package/host/log-tail.mjs +63 -0
  30. package/host/panel.mjs +1012 -0
  31. package/host/paths.mjs +50 -0
  32. package/host/plugin.mjs +873 -0
  33. package/host/prompt-context.mjs +70 -0
  34. package/host/rpc.mjs +147 -0
  35. package/host/session-keys.mjs +25 -0
  36. package/host/session-store.mjs +187 -0
  37. package/host/sessions.mjs +1348 -0
  38. package/host/tools.mjs +283 -0
  39. package/lib/client.js +4431 -0
  40. package/lib/index.js +5676 -0
  41. package/package.json +63 -0
  42. package/shared/access-policy.mjs +263 -0
  43. package/shared/channel-rail.mjs +156 -0
  44. package/shared/context-enhancement.mjs +415 -0
  45. package/shared/contract.mjs +120 -0
  46. package/shared/panel-sections.mjs +76 -0
  47. package/shared/reply-reference.mjs +115 -0
package/host/paths.mjs ADDED
@@ -0,0 +1,50 @@
1
+ /**
2
+ * host 侧路径解析。所有 dsh-chat 数据都放在 DSH_HOME/integrations 下,
3
+ * 渠道自己的历史目录(dsh-feishu / dsh-weixin)继续沿用,保证零重绑。
4
+ *
5
+ * @module dsh-chat/host/paths
6
+ */
7
+
8
+ import { homedir } from 'node:os';
9
+ import { join, resolve } from 'node:path';
10
+
11
+ /** @returns DSH_HOME(未设置时回落 ~/.dsh)。 */
12
+ export function dshHome() {
13
+ const configured = process.env.DSH_HOME;
14
+ return configured && configured.trim() ? resolve(configured.trim()) : join(homedir(), '.dsh');
15
+ }
16
+
17
+ /**
18
+ * hub 自己的数据目录。
19
+ *
20
+ * @param configured - 插件配置里的 dataDir。
21
+ * @returns 绝对路径。
22
+ */
23
+ export function hubDataDir(configured) {
24
+ return configured && String(configured).trim()
25
+ ? resolve(String(configured).trim())
26
+ : join(dshHome(), 'integrations', 'dsh-chat');
27
+ }
28
+
29
+ /**
30
+ * 某个渠道的历史数据目录(沿用 dsh-im 的目录名)。
31
+ *
32
+ * @param name - 目录名,如 'dsh-feishu'。
33
+ * @param integrationRoot - integrations 根目录(默认 DSH_HOME/integrations)。
34
+ * @returns 绝对路径。
35
+ */
36
+ export function channelDataDir(name, integrationRoot) {
37
+ return join(integrationRoot ?? join(dshHome(), 'integrations'), name);
38
+ }
39
+
40
+ /**
41
+ * integrations 根目录;测试可用配置覆盖,避免碰到真实用户数据。
42
+ *
43
+ * @param configured - 插件配置里的 integrationRoot。
44
+ * @returns 绝对路径。
45
+ */
46
+ export function integrationRoot(configured) {
47
+ return configured && String(configured).trim()
48
+ ? resolve(String(configured).trim())
49
+ : join(dshHome(), 'integrations');
50
+ }