@dsh-plugin/dsh-synapse 0.0.0-stage → 0.1.0-dev.41044818627

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 (150) hide show
  1. package/LICENSE +661 -0
  2. package/NOTICE.md +18 -0
  3. package/README.md +136 -2
  4. package/cordis.patch.yml +3 -0
  5. package/lib/bot.cjs +8314 -0
  6. package/lib/bot.cjs.map +7 -0
  7. package/lib/build.json +1 -0
  8. package/lib/client.js +46 -0
  9. package/lib/host/agent.d.ts +21 -0
  10. package/lib/host/agent.js +151 -0
  11. package/lib/host/agent.js.map +1 -0
  12. package/lib/host/bot.d.ts +17 -0
  13. package/lib/host/bot.js +158 -0
  14. package/lib/host/bot.js.map +1 -0
  15. package/lib/host/client.d.ts +2 -0
  16. package/lib/host/client.js +19 -0
  17. package/lib/host/client.js.map +1 -0
  18. package/lib/host/config.d.ts +24 -0
  19. package/lib/host/config.js +192 -0
  20. package/lib/host/config.js.map +1 -0
  21. package/lib/host/files.d.ts +29 -0
  22. package/lib/host/files.js +188 -0
  23. package/lib/host/files.js.map +1 -0
  24. package/lib/host/gateway.d.ts +33 -0
  25. package/lib/host/gateway.js +237 -0
  26. package/lib/host/gateway.js.map +1 -0
  27. package/lib/host/github.d.ts +47 -0
  28. package/lib/host/github.js +219 -0
  29. package/lib/host/github.js.map +1 -0
  30. package/lib/host/http.d.ts +4 -0
  31. package/lib/host/http.js +41 -0
  32. package/lib/host/http.js.map +1 -0
  33. package/lib/host/index.d.ts +32 -0
  34. package/lib/host/index.js +192 -0
  35. package/lib/host/index.js.map +1 -0
  36. package/lib/host/inference-worker.d.ts +1 -0
  37. package/lib/host/inference-worker.js +72 -0
  38. package/lib/host/inference-worker.js.map +1 -0
  39. package/lib/host/mcp.d.ts +138 -0
  40. package/lib/host/mcp.js +104 -0
  41. package/lib/host/mcp.js.map +1 -0
  42. package/lib/host/memory.d.ts +26 -0
  43. package/lib/host/memory.js +155 -0
  44. package/lib/host/memory.js.map +1 -0
  45. package/lib/host/panel.d.ts +1 -0
  46. package/lib/host/panel.html +174 -0
  47. package/lib/host/panel.js +388 -0
  48. package/lib/host/panel.js.map +1 -0
  49. package/lib/host/runtime.d.ts +21 -0
  50. package/lib/host/runtime.js +145 -0
  51. package/lib/host/runtime.js.map +1 -0
  52. package/lib/host/types.d.ts +112 -0
  53. package/lib/host/types.js +2 -0
  54. package/lib/host/types.js.map +1 -0
  55. package/package.json +94 -4
  56. package/scripts/build.mjs +90 -0
  57. package/scripts/check.mjs +13 -0
  58. package/scripts/dump-npm-latest.mjs +49 -0
  59. package/scripts/model-smoke.mjs +25 -0
  60. package/src/agent.ts +203 -0
  61. package/src/bot.ts +173 -0
  62. package/src/client.ts +20 -0
  63. package/src/config.ts +217 -0
  64. package/src/files.ts +206 -0
  65. package/src/gateway.ts +276 -0
  66. package/src/github.ts +263 -0
  67. package/src/http.ts +41 -0
  68. package/src/index.ts +227 -0
  69. package/src/inference-worker.ts +89 -0
  70. package/src/mcp.ts +112 -0
  71. package/src/memory.ts +178 -0
  72. package/src/panel.html +174 -0
  73. package/src/panel.ts +440 -0
  74. package/src/runtime.ts +164 -0
  75. package/src/types.ts +106 -0
  76. package/test/core.test.mjs +279 -0
  77. package/test/fixtures/mcp-server.mjs +14 -0
  78. package/test/integration.test.mjs +253 -0
  79. package/test/panel.test.mjs +73 -0
  80. package/tsconfig.json +18 -0
  81. package/vendor/gugle-chat-bot/LICENSE +661 -0
  82. package/vendor/gugle-chat-bot/package.json +57 -0
  83. package/vendor/gugle-chat-bot/src/allow-rule.yml +9345 -0
  84. package/vendor/gugle-chat-bot/src/api.json +4285 -0
  85. package/vendor/gugle-chat-bot/src/command/index.ts +141 -0
  86. package/vendor/gugle-chat-bot/src/config/features.ts +548 -0
  87. package/vendor/gugle-chat-bot/src/config/index.ts +184 -0
  88. package/vendor/gugle-chat-bot/src/config/manager.ts +357 -0
  89. package/vendor/gugle-chat-bot/src/constants/index.ts +13 -0
  90. package/vendor/gugle-chat-bot/src/custom.ts +548 -0
  91. package/vendor/gugle-chat-bot/src/event/index.ts +118 -0
  92. package/vendor/gugle-chat-bot/src/features/admin/index.ts +414 -0
  93. package/vendor/gugle-chat-bot/src/features/bili/image/impl/video.ts +39 -0
  94. package/vendor/gugle-chat-bot/src/features/bili/image/index.ts +37 -0
  95. package/vendor/gugle-chat-bot/src/features/bili/index.ts +65 -0
  96. package/vendor/gugle-chat-bot/src/features/bili/template/style/video.css +97 -0
  97. package/vendor/gugle-chat-bot/src/features/bili/template/video.html +57 -0
  98. package/vendor/gugle-chat-bot/src/features/discord-bridge/index.ts +1128 -0
  99. package/vendor/gugle-chat-bot/src/features/discord-bridge/markdown.ts +105 -0
  100. package/vendor/gugle-chat-bot/src/features/discord-bridge/slash.ts +355 -0
  101. package/vendor/gugle-chat-bot/src/features/discord-bridge/source.ts +96 -0
  102. package/vendor/gugle-chat-bot/src/features/discord-bridge/template/message.html +14 -0
  103. package/vendor/gugle-chat-bot/src/features/discord-bridge/template/style/message.css +144 -0
  104. package/vendor/gugle-chat-bot/src/features/github/api.ts +93 -0
  105. package/vendor/gugle-chat-bot/src/features/github/binding.ts +161 -0
  106. package/vendor/gugle-chat-bot/src/features/github/image/impl/issue.ts +132 -0
  107. package/vendor/gugle-chat-bot/src/features/github/image/impl/pr.ts +144 -0
  108. package/vendor/gugle-chat-bot/src/features/github/image/impl/release.ts +160 -0
  109. package/vendor/gugle-chat-bot/src/features/github/image/index.ts +310 -0
  110. package/vendor/gugle-chat-bot/src/features/github/index.ts +302 -0
  111. package/vendor/gugle-chat-bot/src/features/github/template/issue.html +118 -0
  112. package/vendor/gugle-chat-bot/src/features/github/template/pull_request.html +125 -0
  113. package/vendor/gugle-chat-bot/src/features/github/template/release.html +53 -0
  114. package/vendor/gugle-chat-bot/src/features/github/template/style/issue.css +468 -0
  115. package/vendor/gugle-chat-bot/src/features/github/template/style/pull_request.css +469 -0
  116. package/vendor/gugle-chat-bot/src/features/github/template/style/release.css +412 -0
  117. package/vendor/gugle-chat-bot/src/features/hermes/client.ts +184 -0
  118. package/vendor/gugle-chat-bot/src/features/hermes/config.ts +210 -0
  119. package/vendor/gugle-chat-bot/src/features/hermes/context.ts +67 -0
  120. package/vendor/gugle-chat-bot/src/features/hermes/history.ts +86 -0
  121. package/vendor/gugle-chat-bot/src/features/hermes/index.ts +1533 -0
  122. package/vendor/gugle-chat-bot/src/features/hermes/message.ts +319 -0
  123. package/vendor/gugle-chat-bot/src/features/hermes/reaction.ts +181 -0
  124. package/vendor/gugle-chat-bot/src/features/hermes/render.ts +118 -0
  125. package/vendor/gugle-chat-bot/src/features/hermes/reply-units.ts +331 -0
  126. package/vendor/gugle-chat-bot/src/features/hermes/skills.ts +406 -0
  127. package/vendor/gugle-chat-bot/src/features/hermes/template/approval.html +30 -0
  128. package/vendor/gugle-chat-bot/src/features/hermes/template/progress.html +21 -0
  129. package/vendor/gugle-chat-bot/src/features/hermes/template/style/approval.css +81 -0
  130. package/vendor/gugle-chat-bot/src/features/hermes/template/style/progress.css +120 -0
  131. package/vendor/gugle-chat-bot/src/features/hermes/trigger.ts +86 -0
  132. package/vendor/gugle-chat-bot/src/features/hermes/types.ts +327 -0
  133. package/vendor/gugle-chat-bot/src/features/management/index.ts +156 -0
  134. package/vendor/gugle-chat-bot/src/features/minecraft/index.ts +127 -0
  135. package/vendor/gugle-chat-bot/src/features/modrinth/index.ts +71 -0
  136. package/vendor/gugle-chat-bot/src/features/parentheses/index.ts +117 -0
  137. package/vendor/gugle-chat-bot/src/features/peak-valley-timer/index.ts +452 -0
  138. package/vendor/gugle-chat-bot/src/features/poke/index.ts +24 -0
  139. package/vendor/gugle-chat-bot/src/features/version-tracker/index.ts +78 -0
  140. package/vendor/gugle-chat-bot/src/features/welcome/index.ts +58 -0
  141. package/vendor/gugle-chat-bot/src/github-ip.json +5814 -0
  142. package/vendor/gugle-chat-bot/src/image/index.ts +278 -0
  143. package/vendor/gugle-chat-bot/src/index.ts +695 -0
  144. package/vendor/gugle-chat-bot/src/logger/index.ts +54 -0
  145. package/vendor/gugle-chat-bot/src/result.json +359 -0
  146. package/vendor/gugle-chat-bot/src/type/bili.d.ts +825 -0
  147. package/vendor/gugle-chat-bot/src/type/event.d.ts +146 -0
  148. package/vendor/gugle-chat-bot/src/type/github.d.ts +446 -0
  149. package/vendor/gugle-chat-bot/src/type/index.d.ts +254 -0
  150. package/vendor/gugle-chat-bot/tsconfig.json +46 -0
@@ -0,0 +1,254 @@
1
+ export interface Sender {
2
+ user_id: number;
3
+ nickname: string;
4
+ card: string;
5
+ }
6
+
7
+ export type GroupSender = Sender & {
8
+ role: 'member' | 'owner' | 'admin';
9
+ };
10
+
11
+ export interface TextMessage {
12
+ type: 'text';
13
+ data: {
14
+ text: string;
15
+ };
16
+ }
17
+
18
+ export interface AtMessage {
19
+ type: 'at';
20
+ data: {
21
+ qq: number;
22
+ };
23
+ }
24
+
25
+ export interface ImageMessage {
26
+ type: 'image';
27
+ data: {
28
+ file: string;
29
+ /** NapCat/OneBot 下发的可访问直链(接收消息时存在,转发用) */
30
+ url?: string;
31
+ };
32
+ }
33
+
34
+ export interface FaceMessage {
35
+ type: 'face';
36
+ data: {
37
+ id: number;
38
+ };
39
+ }
40
+
41
+ export interface JsonMessage {
42
+ type: 'json';
43
+ data: {
44
+ data: string;
45
+ };
46
+ }
47
+
48
+ export interface RecordMessage {
49
+ type: 'record';
50
+ data: {
51
+ file: string;
52
+ /** NapCat/OneBot 下发的可访问直链(接收消息时存在,转发用) */
53
+ url?: string;
54
+ };
55
+ }
56
+
57
+ export interface VideoMessage {
58
+ type: 'video';
59
+ data: {
60
+ file: string;
61
+ /** NapCat/OneBot 下发的可访问直链(接收消息时存在,转发用) */
62
+ url?: string;
63
+ };
64
+ }
65
+
66
+ export interface ReplyMessage {
67
+ type: 'reply';
68
+ data: {
69
+ id: number;
70
+ };
71
+ }
72
+
73
+ export interface EnumMusicMessageData {
74
+ type: '163' | 'qq';
75
+ id: string;
76
+ }
77
+
78
+ export interface CustomMusicMessageData {
79
+ type: 'custom';
80
+ url: string;
81
+ audio: string;
82
+ title: string;
83
+ image: string;
84
+ }
85
+
86
+ export type MusicMessageData = EnumMusicMessageData | CustomMusicMessageData;
87
+
88
+ export interface MusicMessage {
89
+ type: 'music';
90
+ data: MusicMessageData;
91
+ }
92
+
93
+ export interface DiceMessage {
94
+ type: 'dice';
95
+ }
96
+
97
+ export interface RpsMessage {
98
+ type: 'rps';
99
+ }
100
+
101
+ export interface FileMessage {
102
+ type: 'file';
103
+ data: {
104
+ file: string;
105
+ /** NapCat/OneBot 下发的可访问直链(接收消息时存在,转发用) */
106
+ url?: string;
107
+ };
108
+ }
109
+
110
+ export type Message =
111
+ | TextMessage
112
+ | AtMessage
113
+ | FaceMessage
114
+ | JsonMessage
115
+ | RecordMessage
116
+ | VideoMessage
117
+ | ImageMessage
118
+ | ReplyMessage
119
+ | MusicMessage
120
+ | DiceMessage
121
+ | RpsMessage
122
+ | FileMessage;
123
+
124
+ export interface NodeMessage {
125
+ type: 'node';
126
+ data: {
127
+ user_id: number;
128
+ nickname: string;
129
+ content: Message[];
130
+ };
131
+ }
132
+
133
+ export interface ForwardMessage {
134
+ type: 'forward';
135
+ data: {
136
+ id: string;
137
+ };
138
+ }
139
+
140
+ export type SentMessage = Message[] | NodeMessage[];
141
+
142
+ export type ReceiveMessage = Message[] | ForwardMessage[];
143
+
144
+ export interface MetaEventWSMSG {
145
+ post_type: 'meta_event';
146
+ time: number;
147
+ self_id: number;
148
+ }
149
+
150
+ export type HeartbeatMetaEventWSMSG = MetaEventWSMSG & {
151
+ meta_event_type: 'heartbeat';
152
+ status: { online: boolean; good: boolean };
153
+ interval: number;
154
+ };
155
+
156
+ export type LifecycleMetaEventWSMSG = MetaEventWSMSG & {
157
+ meta_event_type: 'lifecycle';
158
+ sub_type: 'connect';
159
+ };
160
+
161
+ export type AllMetaEventWSMSG = LifecycleMetaEventWSMSG | HeartbeatMetaEventWSMSG;
162
+
163
+ export interface MessageWSMSG {
164
+ post_type: 'message';
165
+ self_id: number;
166
+ user_id: number;
167
+ time: number;
168
+ message_id: number;
169
+ message_seq: number;
170
+ real_id: number;
171
+ real_seq: string;
172
+ raw_message: string;
173
+ font: number;
174
+ sub_type: 'friend' | 'normal';
175
+ message: ReceiveMessage;
176
+ }
177
+
178
+ export type GroupMessageWSMSG = MessageWSMSG & {
179
+ message_type: 'group';
180
+ sender: GroupSender;
181
+ group_id: number;
182
+ group_name: string;
183
+ };
184
+
185
+ export type PrivateMessageWSMSG = MessageWSMSG & {
186
+ message_type: 'private';
187
+ sender: Sender;
188
+ target_id: number;
189
+ };
190
+
191
+ export type AllMessageWSMSG = GroupMessageWSMSG | PrivateMessageWSMSG;
192
+
193
+ export type NoticeWSMSG = {
194
+ post_type: 'notice';
195
+ };
196
+
197
+ export type NotifyNoticeWSMSG = NoticeWSMSG & {
198
+ notice_type: 'notify';
199
+ sub_type: 'poke' | string;
200
+ group_id?: number;
201
+ target_id: number;
202
+ self_id: number;
203
+ user_id: number;
204
+ };
205
+
206
+ export type GroupDecreaseNoticeWSMSG = NoticeWSMSG & {
207
+ notice_type: 'group_decrease';
208
+ self_id: number;
209
+ group_id: number;
210
+ user_id: number;
211
+ sub_type: 'kick' | 'leave';
212
+ operator_id: number;
213
+ };
214
+
215
+ export type GroupIncreaseNoticeWSMSG = NoticeWSMSG & {
216
+ notice_type: 'group_increase';
217
+ self_id: number;
218
+ group_id: number;
219
+ user_id: number;
220
+ sub_type: 'invite' | 'approve';
221
+ operator_id: number;
222
+ };
223
+
224
+ export type AllNoticeWSMSG = NotifyNoticeWSMSG | GroupDecreaseNoticeWSMSG | GroupIncreaseNoticeWSMSG;
225
+
226
+ export type RequestWSMSG = {
227
+ post_type: 'request';
228
+ };
229
+
230
+ export type GroupRequestWSMSG = RequestWSMSG & {
231
+ request_type: 'group';
232
+ self_id: number;
233
+ group_id: number;
234
+ user_id: number;
235
+ comment: string;
236
+ flag: string;
237
+ sub_type: 'add';
238
+ };
239
+
240
+ export type AllRequestWSMSG = GroupRequestWSMSG;
241
+
242
+ export type WSMSG = AllMetaEventWSMSG | AllMessageWSMSG | AllNoticeWSMSG | AllRequestWSMSG;
243
+
244
+ export interface LoginInfoData {
245
+ user_id: number;
246
+ nickname: string;
247
+ }
248
+
249
+ export interface LoginInfo {
250
+ retcode: number;
251
+ data: LoginInfoData;
252
+ message: string;
253
+ wording: string;
254
+ }
@@ -0,0 +1,46 @@
1
+ {
2
+ // Visit https://aka.ms/tsconfig to read more about this file
3
+ "compilerOptions": {
4
+ // File Layout
5
+ "rootDir": "./src",
6
+ "outDir": "./dist",
7
+ "baseUrl": "./",
8
+ "paths": {
9
+ "@/*": ["src/*"]
10
+ },
11
+ // Environment Settings
12
+ // See also https://aka.ms/tsconfig/module
13
+ "module": "commonjs",
14
+ "target": "es2017",
15
+ // For nodejs:
16
+ // "lib": ["esnext"],
17
+ "types": ["node"],
18
+ // and npm install -D @types/node
19
+
20
+ // Other Outputs
21
+ "sourceMap": true,
22
+ "declaration": true,
23
+ "declarationMap": true,
24
+ // Stricter Typechecking Options
25
+ "noUncheckedIndexedAccess": true,
26
+ "exactOptionalPropertyTypes": true,
27
+ // Style Options
28
+ // "noImplicitReturns": true,
29
+ // "noImplicitOverride": true,
30
+ // "noUnusedLocals": true,
31
+ // "noUnusedParameters": true,
32
+ // "noFallthroughCasesInSwitch": true,
33
+ // "noPropertyAccessFromIndexSignature": true,
34
+
35
+ // Recommended Options
36
+ "strict": true,
37
+ "jsx": "react-jsx",
38
+ // "verbatimModuleSyntax": true,
39
+ "esModuleInterop": true,
40
+ "isolatedModules": true,
41
+ "noUncheckedSideEffectImports": true,
42
+ "moduleDetection": "force",
43
+ "skipLibCheck": true
44
+ },
45
+ "exclude": ["node_modules", "dist", "scripts"]
46
+ }