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

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 +30 -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,146 @@
1
+ import { Cancelable } from 'gugle-event';
2
+ import { QQBot } from '@/index';
3
+ import {
4
+ GroupDecreaseNoticeWSMSG,
5
+ GroupIncreaseNoticeWSMSG,
6
+ GroupMessageWSMSG,
7
+ GroupRequestWSMSG,
8
+ NotifyNoticeWSMSG,
9
+ PrivateMessageWSMSG
10
+ } from '@/type/index';
11
+ import { RawData } from 'ws';
12
+ import { CommandManager } from 'gugle-command';
13
+
14
+ /**
15
+ * 定义机器人运行时事件类型的元组
16
+ * 用于标识机器人在不同运行阶段所触发的事件
17
+ */
18
+ export declare type BeforeStartEvent = 'before-start';
19
+ export declare type AfterStartEvent = 'after-start';
20
+ export declare type BeforeStopEvent = 'before-stop';
21
+ export declare type AfterStopEvent = 'after-stop';
22
+ export declare type CommandRegisterEvent = 'command-register';
23
+
24
+ export declare type BotRuntimeEvent =
25
+ | BeforeStartEvent
26
+ | AfterStartEvent
27
+ | BeforeStopEvent
28
+ | AfterStopEvent
29
+ | CommandRegisterEvent;
30
+
31
+ /**
32
+ * 定义HeyBox事件类型的元组
33
+ * 用于标识HeyBox特定事件,如命令消息、用户表情反应等
34
+ */
35
+ export declare type GroupMessageEvent = 'message-event-group';
36
+ export declare type PrivateMessageEvent = 'message-event-private';
37
+ export declare type NotifyNoticeEvent = 'notice-event-notify';
38
+ export declare type GroupDecreaseNoticeEvent = 'notice-event-group-decrease';
39
+ export declare type GroupIncreaseNoticeEvent = 'notice-event-group-increase';
40
+ export declare type GroupRequestEvent = 'request-event-group';
41
+
42
+ export declare type QQEvent =
43
+ | GroupMessageEvent
44
+ | PrivateMessageEvent
45
+ | NotifyNoticeEvent
46
+ | GroupDecreaseNoticeEvent
47
+ | GroupIncreaseNoticeEvent
48
+ | GroupRequestEvent;
49
+
50
+ /**
51
+ * 定义机器人所有事件类型的元组
52
+ * 用于标识机器人在不同阶段所触发的事件,包括运行时事件、WebSocket消息事件和HeyBox事件
53
+ */
54
+ export declare type WebSocketMessageEvent = 'websocket-message';
55
+
56
+ export declare type BotEvent = BotRuntimeEvent | WebSocketMessageEvent | QQEvent | string;
57
+
58
+ /**
59
+ * 定义事件是否可取消的类型
60
+ * 用于指示事件处理函数是否支持取消事件的默认行为
61
+ */
62
+ export declare type BotEventCancelable = boolean;
63
+
64
+ export declare type CommandRegisterEventCallback<C extends BotEventCancelable> = C extends true
65
+ ? (cancelable: Cancelable, bot: QQBot, command: CommandManager) => void
66
+ : (bot: QQBot, command: CommandManager) => void;
67
+
68
+ /**
69
+ * 定义机器人运行时事件的回调函数类型
70
+ * 根据事件类型和是否可取消,决定回调函数的参数和返回类型
71
+ */
72
+ export declare type BotRuntimeEventCallback<
73
+ T extends BotRuntimeEvent,
74
+ C extends BotEventCancelable
75
+ > = T extends CommandRegisterEvent
76
+ ? CommandRegisterEventCallback<C>
77
+ : T extends BeforeStartEvent
78
+ ? C extends true
79
+ ? (cancelable: Cancelable, bot: QQBot, path: string) => void
80
+ : (bot: QQBot, path: string) => void
81
+ : C extends true
82
+ ? (cancelable: Cancelable, bot: QQBot) => void
83
+ : (bot: QQBot) => void;
84
+
85
+ declare type GroupMessageEventCallback<C extends BotEventCancelable> = C extends true
86
+ ? (cancelable: Cancelable, bot: QQBot, message: GroupMessageWSMSG) => void
87
+ : (bot: QQBot, message: GroupMessageWSMSG) => void;
88
+
89
+ declare type PrivateMessageEventCallback<C extends BotEventCancelable> = C extends true
90
+ ? (cancelable: Cancelable, bot: QQBot, message: PrivateMessageWSMSG) => void
91
+ : (bot: QQBot, message: PrivateMessageWSMSG) => void;
92
+
93
+ declare type NotifyNoticeEventCallback<C extends BotEventCancelable> = C extends true
94
+ ? (cancelable: Cancelable, bot: QQBot, message: NotifyNoticeWSMSG) => void
95
+ : (bot: QQBot, message: NotifyNoticeWSMSG) => void;
96
+
97
+ declare type GroupDecreaseNoticeEventCallback<C extends BotEventCancelable> = C extends true
98
+ ? (cancelable: Cancelable, bot: QQBot, message: GroupDecreaseNoticeWSMSG) => void
99
+ : (bot: QQBot, message: GroupDecreaseNoticeWSMSG) => void;
100
+
101
+ declare type GroupIncreaseNoticeEventCallback<C extends BotEventCancelable> = C extends true
102
+ ? (cancelable: Cancelable, bot: QQBot, message: GroupIncreaseNoticeWSMSG) => void
103
+ : (bot: QQBot, message: GroupIncreaseNoticeWSMSG) => void;
104
+
105
+ declare type GroupRequestEventCallback<C extends BotEventCancelable> = C extends true
106
+ ? (cancelable: Cancelable, bot: QQBot, message: GroupRequestWSMSG) => void
107
+ : (bot: QQBot, message: GroupRequestWSMSG) => void;
108
+
109
+ export type GeneralEventCallback<T extends BotEvent, C extends BotEventCancelable> = C extends true
110
+ ? (cancelable: Cancelable, ...args: any) => void
111
+ : (...args: any) => void;
112
+
113
+ /**
114
+ * 定义QQ事件的回调函数类型
115
+ * 根据事件类型和是否可取消,决定回调函数的参数和返回类型
116
+ */
117
+ export declare type QQEventCallback<T extends QQEvent, C extends BotEventCancelable> = T extends GroupMessageEvent
118
+ ? GroupMessageEventCallback<C>
119
+ : T extends PrivateMessageEvent
120
+ ? PrivateMessageEventCallback<C>
121
+ : T extends NotifyNoticeEvent
122
+ ? NotifyNoticeEventCallback<C>
123
+ : T extends GroupDecreaseNoticeEvent
124
+ ? GroupDecreaseNoticeEventCallback<C>
125
+ : T extends GroupIncreaseNoticeEvent
126
+ ? GroupIncreaseNoticeEventCallback<C>
127
+ : T extends GroupRequestEvent
128
+ ? GroupRequestEventCallback<C>
129
+ : GeneralEventCallback<T, C>;
130
+
131
+ declare type WebSocketMessageEventCallback<
132
+ T extends WebSocketMessageEvent,
133
+ C extends BotEventCancelable
134
+ > = C extends true ? (cancelable: Cancelable, bot: QQBot, data: RawData) => void : (bot: QQBot, data: RawData) => void;
135
+
136
+ /**
137
+ * 定义通用事件回调函数类型
138
+ * 根据事件类型和是否可取消,决定回调函数的参数和返回类型
139
+ */
140
+ export declare type EventCallback<T extends BotEvent, C extends BotEventCancelable> = T extends BotRuntimeEvent
141
+ ? BotRuntimeEventCallback<T, C>
142
+ : T extends WebSocketMessageEvent
143
+ ? WebSocketMessageEventCallback<T, C>
144
+ : T extends QQEvent
145
+ ? QQEventCallback<T, C>
146
+ : GeneralEventCallback<T, C>;
@@ -0,0 +1,446 @@
1
+ export interface User {
2
+ avatar_url: string;
3
+ deleted?: boolean;
4
+ email?: string;
5
+ html_url: string;
6
+ id: number;
7
+ login: string;
8
+ name?: string;
9
+ type: 'Bot' | 'User' | 'Organization';
10
+ }
11
+
12
+ export interface Label {
13
+ color: string;
14
+ name: string;
15
+ description?: string;
16
+ }
17
+
18
+ export type State = 'open' | 'closed';
19
+
20
+ export type IssueStateReason = 'completed' | 'duplicate' | 'not_planned' | string;
21
+
22
+ export interface Issue {
23
+ title: string | number;
24
+ number: number;
25
+ body?: string;
26
+ assignee?: User;
27
+ state: State;
28
+ state_reason?: IssueStateReason;
29
+ milestone?: Milestone;
30
+ labels: Label[];
31
+ assignees?: User[];
32
+ type: string;
33
+ user: User;
34
+ created_at: string;
35
+ html_url?: string;
36
+ repository_url?: string;
37
+ }
38
+
39
+ export interface PullRequest {
40
+ title: string | number;
41
+ number: number;
42
+ body?: string;
43
+ requested_reviewers?: User;
44
+ assignee?: User;
45
+ state: State;
46
+ milestone?: Milestone;
47
+ labels: Label[];
48
+ assignees?: User[];
49
+ user: User;
50
+ merged: boolean;
51
+ draft?: boolean;
52
+ created_at: string;
53
+ html_url?: string;
54
+ repository_url?: string;
55
+ }
56
+
57
+ export interface Organization {
58
+ id: number;
59
+ login: string;
60
+ description: string;
61
+ avatar_url: string;
62
+ }
63
+
64
+ export type Privacy = State | 'secret';
65
+ export interface Team {
66
+ id: number;
67
+ name: string;
68
+ slug: string;
69
+ description: string;
70
+ node_id: string;
71
+ url: string;
72
+ html_url: string;
73
+ repositories_url: string;
74
+ members_url: string;
75
+ permission: string;
76
+ privacy: Privacy;
77
+ deleted?: boolean;
78
+ parent?: Team;
79
+ }
80
+
81
+ export interface Repository {
82
+ id: number;
83
+ name: string;
84
+ full_name: string;
85
+ owner: User;
86
+ html_url: string;
87
+ }
88
+
89
+ export interface Milestone {
90
+ closed_at?: string;
91
+ closed_issues: number;
92
+ created_at: string;
93
+ creator?: User;
94
+ description?: string;
95
+ due_on?: string;
96
+ html_url: string;
97
+ labels_url: string;
98
+ node_id: string;
99
+ number: string;
100
+ open_issues: number;
101
+ state: State;
102
+ title: string;
103
+ updated_at: string;
104
+ url: string;
105
+ }
106
+
107
+ export interface TypeOfIssue {
108
+ id: number;
109
+ name: string;
110
+ description?: string;
111
+ color?: string;
112
+ created_at?: string;
113
+ updated_at?: string;
114
+ is_enabled?: boolean;
115
+ }
116
+
117
+ export interface IssueEvent {
118
+ issue: Issue;
119
+ organization?: Organization;
120
+ repository: Repository;
121
+ sender: User;
122
+ }
123
+
124
+ export type AssignedIssueEvent = IssueEvent & {
125
+ action: 'assigned';
126
+ assignee?: User;
127
+ };
128
+
129
+ export type ClosedIssueEvent = IssueEvent & {
130
+ action: 'closed';
131
+ };
132
+
133
+ export type DeletedIssueEvent = IssueEvent & {
134
+ action: 'deleted';
135
+ };
136
+
137
+ export type DemilestonedIssueEvent = IssueEvent & {
138
+ action: 'demilestoned';
139
+ milestone: Milestone;
140
+ };
141
+
142
+ export type EditedIssueEvent = IssueEvent & {
143
+ action: 'edited';
144
+ changes: {
145
+ body?: {
146
+ from: string;
147
+ };
148
+ title?: {
149
+ from: string;
150
+ };
151
+ };
152
+ };
153
+
154
+ export type LabeledIssueEvent = IssueEvent & {
155
+ action: 'labeled';
156
+ label: Label;
157
+ };
158
+
159
+ export type LockedIssueEvent = IssueEvent & {
160
+ action: 'locked';
161
+ };
162
+
163
+ export type MilestonedIssueEvent = IssueEvent & {
164
+ action: 'milestoned';
165
+ milestone: Milestone;
166
+ };
167
+
168
+ export type OpenedIssueEvent = IssueEvent & {
169
+ action: 'opened';
170
+ changes?: {
171
+ old_issue: Issue;
172
+ old_repository: Repository;
173
+ };
174
+ };
175
+
176
+ export type PinnedIssueEvent = IssueEvent & {
177
+ action: 'pinned';
178
+ };
179
+
180
+ export type ReopenedIssueEvent = IssueEvent & {
181
+ action: 'reopened';
182
+ };
183
+
184
+ export type TransferredIssueEvent = IssueEvent & {
185
+ action: 'transferred';
186
+ changes: {
187
+ new_issue: Issue;
188
+ new_repository: Repository;
189
+ };
190
+ };
191
+
192
+ export type TypedIssueEvent = IssueEvent & {
193
+ action: 'typed';
194
+ type: TypeOfIssue;
195
+ };
196
+
197
+ export type UnassignedIssueEvent = IssueEvent & {
198
+ action: 'unassigned';
199
+ assignee?: User;
200
+ };
201
+
202
+ export type UnlabeledIssueEvent = IssueEvent & {
203
+ action: 'unlabeled';
204
+ label?: Label;
205
+ };
206
+
207
+ export type UnpinnedIssueEvent = IssueEvent & {
208
+ action: 'unpinned';
209
+ };
210
+
211
+ export type UntypedIssueEvent = IssueEvent & {
212
+ action: 'untyped';
213
+ type: TypeOfIssue;
214
+ };
215
+
216
+ export type AllIssueEvent =
217
+ | AssignedIssueEvent
218
+ | ClosedIssueEvent
219
+ | DeletedIssueEvent
220
+ | DemilestonedIssueEvent
221
+ | EditedIssueEvent
222
+ | LabeledIssueEvent
223
+ | LockedIssueEvent
224
+ | MilestonedIssueEvent
225
+ | OpenedIssueEvent
226
+ | PinnedIssueEvent
227
+ | ReopenedIssueEvent
228
+ | TransferredIssueEvent
229
+ | TypedIssueEvent
230
+ | UnassignedIssueEvent
231
+ | UnlabeledIssueEvent
232
+ | UnpinnedIssueEvent
233
+ | UntypedIssueEvent;
234
+
235
+ export interface PullRequestEvent {
236
+ pull_request: PullRequest;
237
+ organization?: Organization;
238
+ repository: Repository;
239
+ sender: User;
240
+ }
241
+
242
+ export type AssignedPullRequestEvent = PullRequestEvent & {
243
+ action: 'assigned';
244
+ assignee?: User;
245
+ };
246
+
247
+ export type AutoMergeDisabledPullRequestEvent = PullRequestEvent & {
248
+ action: 'auto_merge_disabled';
249
+ reason: string;
250
+ };
251
+
252
+ export type AutoMergeEnabledPullRequestEvent = PullRequestEvent & {
253
+ action: 'auto_merge_enabled';
254
+ reason?: string;
255
+ };
256
+
257
+ export type ClosedPullRequestEvent = PullRequestEvent & {
258
+ action: 'closed';
259
+ };
260
+
261
+ export type ConvertedToDraftPullRequestEvent = PullRequestEvent & {
262
+ action: 'converted_to_draft';
263
+ };
264
+
265
+ export type DemilestonedPullRequestEvent = PullRequestEvent & {
266
+ action: 'demilestoned';
267
+ milestone?: Milestone;
268
+ };
269
+
270
+ export type DequeuedReason =
271
+ | 'UNKNOWN_REMOVAL_REASON'
272
+ | 'MANUAL'
273
+ | 'MERGE'
274
+ | 'MERGE_CONFLICT'
275
+ | 'CI_FAILURE'
276
+ | 'CI_TIMEOUT'
277
+ | 'ALREADY_MERGED'
278
+ | 'QUEUE_CLEARED'
279
+ | 'ROLL_BACK'
280
+ | 'BRANCH_PROTECTIONS'
281
+ | 'GIT_TREE_INVALID'
282
+ | 'INVALID_MERGE_COMMIT';
283
+ export type DequeuedPullRequestEvent = PullRequestEvent & {
284
+ action: 'dequeued';
285
+ reason: DequeuedReason;
286
+ };
287
+
288
+ export type EditedPullRequestEvent = PullRequestEvent & {
289
+ action: 'edited';
290
+ changes: {
291
+ base: {
292
+ ref: {
293
+ from: string;
294
+ };
295
+ sha: {
296
+ from: string;
297
+ };
298
+ };
299
+ body?: {
300
+ from: string;
301
+ };
302
+ title?: {
303
+ from: string;
304
+ };
305
+ };
306
+ };
307
+
308
+ export type EnqueuedPullRequestEvent = PullRequestEvent & {
309
+ action: 'enqueued';
310
+ };
311
+
312
+ export type LabeledPullRequestEvent = PullRequestEvent & {
313
+ action: 'labeled';
314
+ label?: Label;
315
+ };
316
+
317
+ export type LockedPullRequestEvent = PullRequestEvent & {
318
+ action: 'locked';
319
+ };
320
+
321
+ export type MilestonedPullRequestEvent = PullRequestEvent & {
322
+ action: 'milestoned';
323
+ milestone?: Milestone;
324
+ };
325
+
326
+ export type OpenedPullRequestEvent = PullRequestEvent & {
327
+ action: 'opened';
328
+ };
329
+
330
+ export type ReadyForReviewPullRequestEvent = PullRequestEvent & {
331
+ action: 'ready_for_review';
332
+ };
333
+
334
+ export type ReopenedPullRequestEvent = PullRequestEvent & {
335
+ action: 'reopened';
336
+ };
337
+
338
+ export type ReviewRequestRemovedPullRequestEvent = PullRequestEvent & {
339
+ action: 'review_request_removed';
340
+ requested_reviewer?: User;
341
+ requested_team: Team;
342
+ };
343
+
344
+ export type ReviewRequestedPullRequestEvent = PullRequestEvent & {
345
+ action: 'review_requested';
346
+ requested_reviewer?: User;
347
+ requested_team: Team;
348
+ };
349
+
350
+ export type SynchronizePullRequestEvent = PullRequestEvent & {
351
+ action: 'synchronize';
352
+ after: string;
353
+ before: string;
354
+ };
355
+
356
+ export type UnassignedPullRequestEvent = PullRequestEvent & {
357
+ action: 'unassigned';
358
+ assignee?: User;
359
+ };
360
+
361
+ export type UnlabeledPullRequestEvent = PullRequestEvent & {
362
+ action: 'unlabeled';
363
+ label?: Label;
364
+ };
365
+
366
+ export type UnlockedPullRequestEvent = PullRequestEvent & {
367
+ action: 'unlocked';
368
+ };
369
+
370
+ export type AllPullRequestEvent =
371
+ | AssignedPullRequestEvent
372
+ | AutoMergeDisabledPullRequestEvent
373
+ | AutoMergeEnabledPullRequestEvent
374
+ | ClosedPullRequestEvent
375
+ | ConvertedToDraftPullRequestEvent
376
+ | DemilestonedPullRequestEvent
377
+ | DequeuedPullRequestEvent
378
+ | EditedPullRequestEvent
379
+ | EnqueuedPullRequestEvent
380
+ | LabeledPullRequestEvent
381
+ | LockedPullRequestEvent
382
+ | MilestonedPullRequestEvent
383
+ | OpenedPullRequestEvent
384
+ | ReadyForReviewPullRequestEvent
385
+ | ReopenedPullRequestEvent
386
+ | ReviewRequestRemovedPullRequestEvent
387
+ | ReviewRequestedPullRequestEvent
388
+ | SynchronizePullRequestEvent
389
+ | UnassignedPullRequestEvent
390
+ | UnlabeledPullRequestEvent
391
+ | UnlockedPullRequestEvent;
392
+
393
+ /** release 上传的附件(如 jar 构建产物) */
394
+ export interface ReleaseAsset {
395
+ id: number;
396
+ name: string;
397
+ label?: string | null;
398
+ content_type: string;
399
+ state: 'uploaded' | 'open' | string;
400
+ size: number;
401
+ download_count: number;
402
+ created_at: string;
403
+ updated_at: string;
404
+ browser_download_url: string;
405
+ uploader?: User;
406
+ }
407
+
408
+ export interface Release {
409
+ id: number;
410
+ tag_name: string;
411
+ target_commitish: string;
412
+ name: string | null;
413
+ body?: string | null;
414
+ draft: boolean;
415
+ prerelease: boolean;
416
+ created_at: string;
417
+ published_at: string | null;
418
+ html_url: string;
419
+ url: string;
420
+ tarball_url?: string | null;
421
+ zipball_url?: string | null;
422
+ author: User;
423
+ assets: ReleaseAsset[];
424
+ }
425
+
426
+ export type ReleaseEvent = {
427
+ action: 'published' | 'released' | 'created' | 'edited' | 'deleted' | 'prereleased' | 'unpublished';
428
+ release: Release;
429
+ repository: Repository;
430
+ sender: User;
431
+ organization?: Organization;
432
+ };
433
+
434
+ export type PublishedReleaseEvent = ReleaseEvent & {
435
+ action: 'published';
436
+ };
437
+
438
+ export type ReleasedReleaseEvent = ReleaseEvent & {
439
+ action: 'released';
440
+ };
441
+
442
+ export type PrereleasedReleaseEvent = ReleaseEvent & {
443
+ action: 'prereleased';
444
+ };
445
+
446
+ export type AllReleaseEvent = ReleaseEvent;