glede-init 0.0.1

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 (33) hide show
  1. package/bin/cli.js +125 -0
  2. package/copy.js +94 -0
  3. package/package.json +19 -0
  4. package/templates/default/.editorconfig +22 -0
  5. package/templates/default/.env +2 -0
  6. package/templates/default/.vscode/extensions.json +5 -0
  7. package/templates/default/.vscode/settings.json +7 -0
  8. package/templates/default/README.md +29 -0
  9. package/templates/default/app.ts +19 -0
  10. package/templates/default/components/service/entry.ts +85 -0
  11. package/templates/default/configs/app-config.ts +31 -0
  12. package/templates/default/package.json +20 -0
  13. package/templates/default/protos/README.md +35 -0
  14. package/templates/default/protos/buf.yaml +5 -0
  15. package/templates/default/protos/code.gen.yaml +11 -0
  16. package/templates/default/protos/fast-text-encoding.js +1 -0
  17. package/templates/default/protos/gen/buf-min/client/index.ts +87 -0
  18. package/templates/default/protos/gen/buf-min/server/index.ts +126 -0
  19. package/templates/default/protos/gen/buf-speed/client/index.ts +181 -0
  20. package/templates/default/protos/gen/buf-speed/server/index.ts +227 -0
  21. package/templates/default/protos/gen/pb/index.d.ts +293 -0
  22. package/templates/default/protos/gen/pb/index.js +2 -0
  23. package/templates/default/protos/model/client/index.proto +24 -0
  24. package/templates/default/protos/model/client/oneof.proto.bak +39 -0
  25. package/templates/default/protos/model/server/index.proto +29 -0
  26. package/templates/default/protos/package.json +18 -0
  27. package/templates/default/protos/speed.gen.yaml +10 -0
  28. package/templates/default/routers/common/index.ts +11 -0
  29. package/templates/default/tsconfig.json +39 -0
  30. package/templates/default/types/global.d.ts +75 -0
  31. package/templates/default/utils/libs/index.ts +2 -0
  32. package/templates/default/utils/libs/limit.ts +30 -0
  33. package/templates/default/utils/libs/log.ts +10 -0
@@ -0,0 +1,293 @@
1
+ import * as $protobuf from "protobufjs";
2
+ import Long = require("long");
3
+ /** Namespace client. */
4
+ export namespace client {
5
+
6
+ /** Properties of a ClientDirective. */
7
+ interface IClientDirective {
8
+
9
+ /** ClientDirective option */
10
+ option?: (client.ClientOptEnum|null);
11
+
12
+ /** ClientDirective ackId */
13
+ ackId?: (string|null);
14
+
15
+ /** ClientDirective cid */
16
+ cid?: (string|null);
17
+
18
+ /** ClientDirective content */
19
+ content?: (string|null);
20
+
21
+ /** ClientDirective taskId */
22
+ taskId?: (string|null);
23
+
24
+ /** ClientDirective data */
25
+ data?: ({ [k: string]: string }|null);
26
+ }
27
+
28
+ /** Represents a ClientDirective. */
29
+ class ClientDirective implements IClientDirective {
30
+
31
+ /**
32
+ * Constructs a new ClientDirective.
33
+ * @param [properties] Properties to set
34
+ */
35
+ constructor(properties?: client.IClientDirective);
36
+
37
+ /** ClientDirective option. */
38
+ public option: client.ClientOptEnum;
39
+
40
+ /** ClientDirective ackId. */
41
+ public ackId: string;
42
+
43
+ /** ClientDirective cid. */
44
+ public cid: string;
45
+
46
+ /** ClientDirective content. */
47
+ public content: string;
48
+
49
+ /** ClientDirective taskId. */
50
+ public taskId: string;
51
+
52
+ /** ClientDirective data. */
53
+ public data: { [k: string]: string };
54
+
55
+ /**
56
+ * Creates a new ClientDirective instance using the specified properties.
57
+ * @param [properties] Properties to set
58
+ * @returns ClientDirective instance
59
+ */
60
+ public static create(properties?: client.IClientDirective): client.ClientDirective;
61
+
62
+ /**
63
+ * Encodes the specified ClientDirective message. Does not implicitly {@link client.ClientDirective.verify|verify} messages.
64
+ * @param message ClientDirective message or plain object to encode
65
+ * @param [writer] Writer to encode to
66
+ * @returns Writer
67
+ */
68
+ public static encode(message: client.IClientDirective, writer?: $protobuf.Writer): $protobuf.Writer;
69
+
70
+ /**
71
+ * Encodes the specified ClientDirective message, length delimited. Does not implicitly {@link client.ClientDirective.verify|verify} messages.
72
+ * @param message ClientDirective message or plain object to encode
73
+ * @param [writer] Writer to encode to
74
+ * @returns Writer
75
+ */
76
+ public static encodeDelimited(message: client.IClientDirective, writer?: $protobuf.Writer): $protobuf.Writer;
77
+
78
+ /**
79
+ * Decodes a ClientDirective message from the specified reader or buffer.
80
+ * @param reader Reader or buffer to decode from
81
+ * @param [length] Message length if known beforehand
82
+ * @returns ClientDirective
83
+ * @throws {Error} If the payload is not a reader or valid buffer
84
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
85
+ */
86
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): client.ClientDirective;
87
+
88
+ /**
89
+ * Decodes a ClientDirective message from the specified reader or buffer, length delimited.
90
+ * @param reader Reader or buffer to decode from
91
+ * @returns ClientDirective
92
+ * @throws {Error} If the payload is not a reader or valid buffer
93
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
94
+ */
95
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): client.ClientDirective;
96
+
97
+ /**
98
+ * Verifies a ClientDirective message.
99
+ * @param message Plain object to verify
100
+ * @returns `null` if valid, otherwise the reason why it is not
101
+ */
102
+ public static verify(message: { [k: string]: any }): (string|null);
103
+
104
+ /**
105
+ * Creates a ClientDirective message from a plain object. Also converts values to their respective internal types.
106
+ * @param object Plain object
107
+ * @returns ClientDirective
108
+ */
109
+ public static fromObject(object: { [k: string]: any }): client.ClientDirective;
110
+
111
+ /**
112
+ * Creates a plain object from a ClientDirective message. Also converts values to other types if specified.
113
+ * @param message ClientDirective
114
+ * @param [options] Conversion options
115
+ * @returns Plain object
116
+ */
117
+ public static toObject(message: client.ClientDirective, options?: $protobuf.IConversionOptions): { [k: string]: any };
118
+
119
+ /**
120
+ * Converts this ClientDirective to JSON.
121
+ * @returns JSON object
122
+ */
123
+ public toJSON(): { [k: string]: any };
124
+
125
+ /**
126
+ * Gets the default type url for ClientDirective
127
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
128
+ * @returns The default type url
129
+ */
130
+ public static getTypeUrl(typeUrlPrefix?: string): string;
131
+ }
132
+
133
+ /** ClientOptEnum enum. */
134
+ enum ClientOptEnum {
135
+ UNKNOWN = 0,
136
+ CLIENT_ASK = 1,
137
+ CLIENT_INTERACTION = 2,
138
+ CLIENT_RELOAD = 3,
139
+ CLIENT_STOP = 4,
140
+ CLIENT_EXPECT_ANSWER = 5
141
+ }
142
+ }
143
+
144
+ /** Namespace server. */
145
+ export namespace server {
146
+
147
+ /** Properties of a ServDirective. */
148
+ interface IServDirective {
149
+
150
+ /** ServDirective option */
151
+ option?: (server.ServOptEnum|null);
152
+
153
+ /** ServDirective ackId */
154
+ ackId?: (string|null);
155
+
156
+ /** ServDirective cid */
157
+ cid?: (string|null);
158
+
159
+ /** ServDirective taskId */
160
+ taskId?: (string|null);
161
+
162
+ /** ServDirective msg */
163
+ msg?: (string|null);
164
+
165
+ /** ServDirective content */
166
+ content?: (string|null);
167
+
168
+ /** ServDirective data */
169
+ data?: ({ [k: string]: string }|null);
170
+ }
171
+
172
+ /** Represents a ServDirective. */
173
+ class ServDirective implements IServDirective {
174
+
175
+ /**
176
+ * Constructs a new ServDirective.
177
+ * @param [properties] Properties to set
178
+ */
179
+ constructor(properties?: server.IServDirective);
180
+
181
+ /** ServDirective option. */
182
+ public option: server.ServOptEnum;
183
+
184
+ /** ServDirective ackId. */
185
+ public ackId: string;
186
+
187
+ /** ServDirective cid. */
188
+ public cid: string;
189
+
190
+ /** ServDirective taskId. */
191
+ public taskId: string;
192
+
193
+ /** ServDirective msg. */
194
+ public msg: string;
195
+
196
+ /** ServDirective content. */
197
+ public content: string;
198
+
199
+ /** ServDirective data. */
200
+ public data: { [k: string]: string };
201
+
202
+ /**
203
+ * Creates a new ServDirective instance using the specified properties.
204
+ * @param [properties] Properties to set
205
+ * @returns ServDirective instance
206
+ */
207
+ public static create(properties?: server.IServDirective): server.ServDirective;
208
+
209
+ /**
210
+ * Encodes the specified ServDirective message. Does not implicitly {@link server.ServDirective.verify|verify} messages.
211
+ * @param message ServDirective message or plain object to encode
212
+ * @param [writer] Writer to encode to
213
+ * @returns Writer
214
+ */
215
+ public static encode(message: server.IServDirective, writer?: $protobuf.Writer): $protobuf.Writer;
216
+
217
+ /**
218
+ * Encodes the specified ServDirective message, length delimited. Does not implicitly {@link server.ServDirective.verify|verify} messages.
219
+ * @param message ServDirective message or plain object to encode
220
+ * @param [writer] Writer to encode to
221
+ * @returns Writer
222
+ */
223
+ public static encodeDelimited(message: server.IServDirective, writer?: $protobuf.Writer): $protobuf.Writer;
224
+
225
+ /**
226
+ * Decodes a ServDirective message from the specified reader or buffer.
227
+ * @param reader Reader or buffer to decode from
228
+ * @param [length] Message length if known beforehand
229
+ * @returns ServDirective
230
+ * @throws {Error} If the payload is not a reader or valid buffer
231
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
232
+ */
233
+ public static decode(reader: ($protobuf.Reader|Uint8Array), length?: number): server.ServDirective;
234
+
235
+ /**
236
+ * Decodes a ServDirective message from the specified reader or buffer, length delimited.
237
+ * @param reader Reader or buffer to decode from
238
+ * @returns ServDirective
239
+ * @throws {Error} If the payload is not a reader or valid buffer
240
+ * @throws {$protobuf.util.ProtocolError} If required fields are missing
241
+ */
242
+ public static decodeDelimited(reader: ($protobuf.Reader|Uint8Array)): server.ServDirective;
243
+
244
+ /**
245
+ * Verifies a ServDirective message.
246
+ * @param message Plain object to verify
247
+ * @returns `null` if valid, otherwise the reason why it is not
248
+ */
249
+ public static verify(message: { [k: string]: any }): (string|null);
250
+
251
+ /**
252
+ * Creates a ServDirective message from a plain object. Also converts values to their respective internal types.
253
+ * @param object Plain object
254
+ * @returns ServDirective
255
+ */
256
+ public static fromObject(object: { [k: string]: any }): server.ServDirective;
257
+
258
+ /**
259
+ * Creates a plain object from a ServDirective message. Also converts values to other types if specified.
260
+ * @param message ServDirective
261
+ * @param [options] Conversion options
262
+ * @returns Plain object
263
+ */
264
+ public static toObject(message: server.ServDirective, options?: $protobuf.IConversionOptions): { [k: string]: any };
265
+
266
+ /**
267
+ * Converts this ServDirective to JSON.
268
+ * @returns JSON object
269
+ */
270
+ public toJSON(): { [k: string]: any };
271
+
272
+ /**
273
+ * Gets the default type url for ServDirective
274
+ * @param [typeUrlPrefix] your custom typeUrlPrefix(default "type.googleapis.com")
275
+ * @returns The default type url
276
+ */
277
+ public static getTypeUrl(typeUrlPrefix?: string): string;
278
+ }
279
+
280
+ /** ServOptEnum enum. */
281
+ enum ServOptEnum {
282
+ UNKONWN = 0,
283
+ SERV_ACK = 1,
284
+ SERV_THINK = 2,
285
+ SERV_TEXT = 3,
286
+ SERV_DONE = 4,
287
+ SERV_TOOL = 5,
288
+ SERV_TOOLTEXT = 6,
289
+ SERV_TOOLTMPL = 7,
290
+ SERV_STOP_MANUAL = 8,
291
+ SERV_STOP_ERR = 9
292
+ }
293
+ }
@@ -0,0 +1,2 @@
1
+ // @bun
2
+ var eG=Object.create;var{getPrototypeOf:GJ,defineProperty:JG,getOwnPropertyNames:JJ}=Object;var QJ=Object.prototype.hasOwnProperty;var YJ=(Y,G,Q)=>{Q=Y!=null?eG(GJ(Y)):{};let J=G||!Y||!Y.__esModule?JG(Q,"default",{value:Y,enumerable:!0}):Q;for(let H of JJ(Y))if(!QJ.call(J,H))JG(J,H,{get:()=>Y[H],enumerable:!0});return J};var T=(Y,G)=>()=>(G||Y((G={exports:{}}).exports,G),G.exports);var YG=T((IJ,QG)=>{QG.exports=HJ;function HJ(Y,G){var Q=new Array(arguments.length-1),J=0,H=2,Z=!0;while(H<arguments.length)Q[J++]=arguments[H++];return new Promise(function X(q,K){Q[J]=function M(F){if(Z)if(Z=!1,F)K(F);else{var A=new Array(arguments.length-1),B=0;while(B<A.length)A[B++]=arguments[B];q.apply(null,A)}};try{Y.apply(G||null,Q)}catch(M){if(Z)Z=!1,K(M)}})}});var KG=T((XG)=>{var d=XG;d.length=function Y(G){var Q=G.length;if(!Q)return 0;var J=0;while(--Q%4>1&&G.charAt(Q)==="=")++J;return Math.ceil(G.length*3)/4-J};var j=new Array(64),ZG=new Array(123);for(L=0;L<64;)ZG[j[L]=L<26?L+65:L<52?L+71:L<62?L-4:L-59|43]=L++;var L;d.encode=function Y(G,Q,J){var H=null,Z=[],X=0,q=0,K;while(Q<J){var M=G[Q++];switch(q){case 0:Z[X++]=j[M>>2],K=(M&3)<<4,q=1;break;case 1:Z[X++]=j[K|M>>4],K=(M&15)<<2,q=2;break;case 2:Z[X++]=j[K|M>>6],Z[X++]=j[M&63],q=0;break}if(X>8191)(H||(H=[])).push(String.fromCharCode.apply(String,Z)),X=0}if(q){if(Z[X++]=j[K],Z[X++]=61,q===1)Z[X++]=61}if(H){if(X)H.push(String.fromCharCode.apply(String,Z.slice(0,X)));return H.join("")}return String.fromCharCode.apply(String,Z.slice(0,X))};var HG="invalid encoding";d.decode=function Y(G,Q,J){var H=J,Z=0,X;for(var q=0;q<G.length;){var K=G.charCodeAt(q++);if(K===61&&Z>1)break;if((K=ZG[K])===void 0)throw Error(HG);switch(Z){case 0:X=K,Z=1;break;case 1:Q[J++]=X<<2|(K&48)>>4,X=K,Z=2;break;case 2:Q[J++]=(X&15)<<4|(K&60)>>2,X=K,Z=3;break;case 3:Q[J++]=(X&3)<<6|K,Z=0;break}}if(Z===1)throw Error(HG);return J-H};d.test=function Y(G){return/^(?:[A-Za-z0-9+/]{4})*(?:[A-Za-z0-9+/]{2}==|[A-Za-z0-9+/]{3}=)?$/.test(G)}});var qG=T((zJ,MG)=>{MG.exports=v;function v(){this._listeners={}}v.prototype.on=function Y(G,Q,J){return(this._listeners[G]||(this._listeners[G]=[])).push({fn:Q,ctx:J||this}),this};v.prototype.off=function Y(G,Q){if(G===void 0)this._listeners={};else if(Q===void 0)this._listeners[G]=[];else{var J=this._listeners[G];for(var H=0;H<J.length;)if(J[H].fn===Q)J.splice(H,1);else++H}return this};v.prototype.emit=function Y(G){var Q=this._listeners[G];if(Q){var J=[],H=1;for(;H<arguments.length;)J.push(arguments[H++]);for(H=0;H<Q.length;)Q[H].fn.apply(Q[H++].ctx,J)}return this}});var TG=T(($J,IG)=>{IG.exports=NG(NG);function NG(Y){if(typeof Float32Array!=="undefined")(function(){var G=new Float32Array([-0]),Q=new Uint8Array(G.buffer),J=Q[3]===128;function H(K,M,F){G[0]=K,M[F]=Q[0],M[F+1]=Q[1],M[F+2]=Q[2],M[F+3]=Q[3]}function Z(K,M,F){G[0]=K,M[F]=Q[3],M[F+1]=Q[2],M[F+2]=Q[1],M[F+3]=Q[0]}Y.writeFloatLE=J?H:Z,Y.writeFloatBE=J?Z:H;function X(K,M){return Q[0]=K[M],Q[1]=K[M+1],Q[2]=K[M+2],Q[3]=K[M+3],G[0]}function q(K,M){return Q[3]=K[M],Q[2]=K[M+1],Q[1]=K[M+2],Q[0]=K[M+3],G[0]}Y.readFloatLE=J?X:q,Y.readFloatBE=J?q:X})();else(function(){function G(J,H,Z,X){var q=H<0?1:0;if(q)H=-H;if(H===0)J(1/H>0?0:2147483648,Z,X);else if(isNaN(H))J(2143289344,Z,X);else if(H>340282346638528860000000000000000000000)J((q<<31|2139095040)>>>0,Z,X);else if(H<0.000000000000000000000000000000000000011754943508222875)J((q<<31|Math.round(H/0.000000000000000000000000000000000000000000001401298464324817))>>>0,Z,X);else{var K=Math.floor(Math.log(H)/Math.LN2),M=Math.round(H*Math.pow(2,-K)*8388608)&8388607;J((q<<31|K+127<<23|M)>>>0,Z,X)}}Y.writeFloatLE=G.bind(null,FG),Y.writeFloatBE=G.bind(null,VG);function Q(J,H,Z){var X=J(H,Z),q=(X>>31)*2+1,K=X>>>23&255,M=X&8388607;return K===255?M?NaN:q*(1/0):K===0?q*0.000000000000000000000000000000000000000000001401298464324817*M:q*Math.pow(2,K-150)*(M+8388608)}Y.readFloatLE=Q.bind(null,PG),Y.readFloatBE=Q.bind(null,AG)})();if(typeof Float64Array!=="undefined")(function(){var G=new Float64Array([-0]),Q=new Uint8Array(G.buffer),J=Q[7]===128;function H(K,M,F){G[0]=K,M[F]=Q[0],M[F+1]=Q[1],M[F+2]=Q[2],M[F+3]=Q[3],M[F+4]=Q[4],M[F+5]=Q[5],M[F+6]=Q[6],M[F+7]=Q[7]}function Z(K,M,F){G[0]=K,M[F]=Q[7],M[F+1]=Q[6],M[F+2]=Q[5],M[F+3]=Q[4],M[F+4]=Q[3],M[F+5]=Q[2],M[F+6]=Q[1],M[F+7]=Q[0]}Y.writeDoubleLE=J?H:Z,Y.writeDoubleBE=J?Z:H;function X(K,M){return Q[0]=K[M],Q[1]=K[M+1],Q[2]=K[M+2],Q[3]=K[M+3],Q[4]=K[M+4],Q[5]=K[M+5],Q[6]=K[M+6],Q[7]=K[M+7],G[0]}function q(K,M){return Q[7]=K[M],Q[6]=K[M+1],Q[5]=K[M+2],Q[4]=K[M+3],Q[3]=K[M+4],Q[2]=K[M+5],Q[1]=K[M+6],Q[0]=K[M+7],G[0]}Y.readDoubleLE=J?X:q,Y.readDoubleBE=J?q:X})();else(function(){function G(J,H,Z,X,q,K){var M=X<0?1:0;if(M)X=-X;if(X===0)J(0,q,K+H),J(1/X>0?0:2147483648,q,K+Z);else if(isNaN(X))J(0,q,K+H),J(2146959360,q,K+Z);else if(X>179769313486231570000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000)J(0,q,K+H),J((M<<31|2146435072)>>>0,q,K+Z);else{var F;if(X<0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000022250738585072014)F=X/0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005,J(F>>>0,q,K+H),J((M<<31|F/4294967296)>>>0,q,K+Z);else{var A=Math.floor(Math.log(X)/Math.LN2);if(A===1024)A=1023;F=X*Math.pow(2,-A),J(F*4503599627370496>>>0,q,K+H),J((M<<31|A+1023<<20|F*1048576&1048575)>>>0,q,K+Z)}}}Y.writeDoubleLE=G.bind(null,FG,0,4),Y.writeDoubleBE=G.bind(null,VG,4,0);function Q(J,H,Z,X,q){var K=J(X,q+H),M=J(X,q+Z),F=(M>>31)*2+1,A=M>>>20&2047,B=4294967296*(M&1048575)+K;return A===2047?B?NaN:F*(1/0):A===0?F*0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000005*B:F*Math.pow(2,A-1075)*(B+4503599627370496)}Y.readDoubleLE=Q.bind(null,PG,0,4),Y.readDoubleBE=Q.bind(null,AG,4,0)})();return Y}function FG(Y,G,Q){G[Q]=Y&255,G[Q+1]=Y>>>8&255,G[Q+2]=Y>>>16&255,G[Q+3]=Y>>>24}function VG(Y,G,Q){G[Q]=Y>>>24,G[Q+1]=Y>>>16&255,G[Q+2]=Y>>>8&255,G[Q+3]=Y&255}function PG(Y,G){return(Y[G]|Y[G+1]<<8|Y[G+2]<<16|Y[G+3]<<24)>>>0}function AG(Y,G){return(Y[G]<<24|Y[G+1]<<16|Y[G+2]<<8|Y[G+3])>>>0}});var $G=T((zG,p)=>{p.exports=ZJ;function ZJ(moduleName){try{var mod=eval("quire".replace(/^/,"re"))(moduleName);if(mod&&(mod.length||Object.keys(mod).length))return mod}catch(Y){}return null}});var CG=T((LG)=>{var b=LG;b.length=function Y(G){var Q=0,J=0;for(var H=0;H<G.length;++H)if(J=G.charCodeAt(H),J<128)Q+=1;else if(J<2048)Q+=2;else if((J&64512)===55296&&(G.charCodeAt(H+1)&64512)===56320)++H,Q+=4;else Q+=3;return Q};b.read=function Y(G,Q,J){var H=J-Q;if(H<1)return"";var Z=null,X=[],q=0,K;while(Q<J){if(K=G[Q++],K<128)X[q++]=K;else if(K>191&&K<224)X[q++]=(K&31)<<6|G[Q++]&63;else if(K>239&&K<365)K=((K&7)<<18|(G[Q++]&63)<<12|(G[Q++]&63)<<6|G[Q++]&63)-65536,X[q++]=55296+(K>>10),X[q++]=56320+(K&1023);else X[q++]=(K&15)<<12|(G[Q++]&63)<<6|G[Q++]&63;if(q>8191)(Z||(Z=[])).push(String.fromCharCode.apply(String,X)),q=0}if(Z){if(q)Z.push(String.fromCharCode.apply(String,X.slice(0,q)));return Z.join("")}return String.fromCharCode.apply(String,X.slice(0,q))};b.write=function Y(G,Q,J){var H=J,Z,X;for(var q=0;q<G.length;++q)if(Z=G.charCodeAt(q),Z<128)Q[J++]=Z;else if(Z<2048)Q[J++]=Z>>6|192,Q[J++]=Z&63|128;else if((Z&64512)===55296&&((X=G.charCodeAt(q+1))&64512)===56320)Z=65536+((Z&1023)<<10)+(X&1023),++q,Q[J++]=Z>>18|240,Q[J++]=Z>>12&63|128,Q[J++]=Z>>6&63|128,Q[J++]=Z&63|128;else Q[J++]=Z>>12|224,Q[J++]=Z>>6&63|128,Q[J++]=Z&63|128;return J-H}});var WG=T((CJ,DG)=>{DG.exports=XJ;function XJ(Y,G,Q){var J=Q||8192,H=J>>>1,Z=null,X=J;return function q(K){if(K<1||K>H)return Y(K);if(X+K>J)Z=Y(J),X=0;var M=G.call(Z,X,X+=K);if(X&7)X=(X|7)+1;return M}}});var SG=T((DJ,UG)=>{UG.exports=I;var h=_();function I(Y,G){this.lo=Y>>>0,this.hi=G>>>0}var x=I.zero=new I(0,0);x.toNumber=function(){return 0};x.zzEncode=x.zzDecode=function(){return this};x.length=function(){return 1};var KJ=I.zeroHash="\x00\x00\x00\x00\x00\x00\x00\x00";I.fromNumber=function Y(G){if(G===0)return x;var Q=G<0;if(Q)G=-G;var J=G>>>0,H=(G-J)/4294967296>>>0;if(Q){if(H=~H>>>0,J=~J>>>0,++J>4294967295){if(J=0,++H>4294967295)H=0}}return new I(J,H)};I.from=function Y(G){if(typeof G==="number")return I.fromNumber(G);if(h.isString(G))if(h.Long)G=h.Long.fromString(G);else return I.fromNumber(parseInt(G,10));return G.low||G.high?new I(G.low>>>0,G.high>>>0):x};I.prototype.toNumber=function Y(G){if(!G&&this.hi>>>31){var Q=~this.lo+1>>>0,J=~this.hi>>>0;if(!Q)J=J+1>>>0;return-(Q+J*4294967296)}return this.lo+this.hi*4294967296};I.prototype.toLong=function Y(G){return h.Long?new h.Long(this.lo|0,this.hi|0,Boolean(G)):{low:this.lo|0,high:this.hi|0,unsigned:Boolean(G)}};var O=String.prototype.charCodeAt;I.fromHash=function Y(G){if(G===KJ)return x;return new I((O.call(G,0)|O.call(G,1)<<8|O.call(G,2)<<16|O.call(G,3)<<24)>>>0,(O.call(G,4)|O.call(G,5)<<8|O.call(G,6)<<16|O.call(G,7)<<24)>>>0)};I.prototype.toHash=function Y(){return String.fromCharCode(this.lo&255,this.lo>>>8&255,this.lo>>>16&255,this.lo>>>24,this.hi&255,this.hi>>>8&255,this.hi>>>16&255,this.hi>>>24)};I.prototype.zzEncode=function Y(){var G=this.hi>>31;return this.hi=((this.hi<<1|this.lo>>>31)^G)>>>0,this.lo=(this.lo<<1^G)>>>0,this};I.prototype.zzDecode=function Y(){var G=-(this.lo&1);return this.lo=((this.lo>>>1|this.hi<<31)^G)>>>0,this.hi=(this.hi>>>1^G)>>>0,this};I.prototype.length=function Y(){var G=this.lo,Q=(this.lo>>>28|this.hi<<4)>>>0,J=this.hi>>>24;return J===0?Q===0?G<16384?G<128?1:2:G<2097152?3:4:Q<16384?Q<128?5:6:Q<2097152?7:8:J<128?9:10}});var _=T((n)=>{var N=n;N.asPromise=YG();N.base64=KG();N.EventEmitter=qG();N.float=TG();N.inquire=$G();N.utf8=CG();N.pool=WG();N.LongBits=SG();N.isNode=Boolean(typeof global!=="undefined"&&global&&global.process&&global.process.versions&&global.process.versions.node);N.global=N.isNode&&global||typeof window!=="undefined"&&window||typeof self!=="undefined"&&self||n;N.emptyArray=Object.freeze?Object.freeze([]):[];N.emptyObject=Object.freeze?Object.freeze({}):{};N.isInteger=Number.isInteger||function Y(G){return typeof G==="number"&&isFinite(G)&&Math.floor(G)===G};N.isString=function Y(G){return typeof G==="string"||G instanceof String};N.isObject=function Y(G){return G&&typeof G==="object"};N.isset=N.isSet=function Y(G,Q){var J=G[Q];if(J!=null&&G.hasOwnProperty(Q))return typeof J!=="object"||(Array.isArray(J)?J.length:Object.keys(J).length)>0;return!1};N.Buffer=function(){try{var Y=N.inquire("buffer").Buffer;return Y.prototype.utf8Write?Y:null}catch(G){return null}}();N._Buffer_from=null;N._Buffer_allocUnsafe=null;N.newBuffer=function Y(G){return typeof G==="number"?N.Buffer?N._Buffer_allocUnsafe(G):new N.Array(G):N.Buffer?N._Buffer_from(G):typeof Uint8Array==="undefined"?G:new Uint8Array(G)};N.Array=typeof Uint8Array!=="undefined"?Uint8Array:Array;N.Long=N.global.dcodeIO&&N.global.dcodeIO.Long||N.global.Long||N.inquire("long");N.key2Re=/^true|false|0|1$/;N.key32Re=/^-?(?:0|[1-9][0-9]*)$/;N.key64Re=/^(?:[\\x00-\\xff]{8}|-?(?:0|[1-9][0-9]*))$/;N.longToHash=function Y(G){return G?N.LongBits.from(G).toHash():N.LongBits.zeroHash};N.longFromHash=function Y(G,Q){var J=N.LongBits.fromHash(G);if(N.Long)return N.Long.fromBits(J.lo,J.hi,Q);return J.toNumber(Boolean(Q))};function EG(Y,G,Q){for(var J=Object.keys(G),H=0;H<J.length;++H)if(Y[J[H]]===void 0||!Q)Y[J[H]]=G[J[H]];return Y}N.merge=EG;N.lcFirst=function Y(G){return G.charAt(0).toLowerCase()+G.substring(1)};function OG(Y){function G(Q,J){if(!(this instanceof G))return new G(Q,J);if(Object.defineProperty(this,"message",{get:function(){return Q}}),Error.captureStackTrace)Error.captureStackTrace(this,G);else Object.defineProperty(this,"stack",{value:new Error().stack||""});if(J)EG(this,J)}return G.prototype=Object.create(Error.prototype,{constructor:{value:G,writable:!0,enumerable:!1,configurable:!0},name:{get:function Q(){return Y},set:void 0,enumerable:!1,configurable:!0},toString:{value:function Q(){return this.name+": "+this.message},writable:!0,enumerable:!1,configurable:!0}}),G}N.newError=OG;N.ProtocolError=OG("ProtocolError");N.oneOfGetter=function Y(G){var Q={};for(var J=0;J<G.length;++J)Q[G[J]]=1;return function(){for(var H=Object.keys(this),Z=H.length-1;Z>-1;--Z)if(Q[H[Z]]===1&&this[H[Z]]!==void 0&&this[H[Z]]!==null)return H[Z]}};N.oneOfSetter=function Y(G){return function(Q){for(var J=0;J<G.length;++J)if(G[J]!==Q)delete this[G[J]]}};N.toJSONOptions={longs:String,enums:String,bytes:String,json:!0};N._configure=function(){var Y=N.Buffer;if(!Y){N._Buffer_from=N._Buffer_allocUnsafe=null;return}N._Buffer_from=Y.from!==Uint8Array.from&&Y.from||function G(Q,J){return new Y(Q,J)},N._Buffer_allocUnsafe=Y.allocUnsafe||function G(Q){return new Y(Q)}}});var t=T((UJ,BG)=>{BG.exports=V;var C=_(),f,g=C.LongBits,_G=C.base64,RG=C.utf8;function y(Y,G,Q){this.fn=Y,this.len=G,this.next=void 0,this.val=Q}function u(){}function MJ(Y){this.head=Y.head,this.tail=Y.tail,this.len=Y.len,this.next=Y.states}function V(){this.len=0,this.head=new y(u,0,0),this.tail=this.head,this.states=null}var kG=function Y(){return C.Buffer?function G(){return(V.create=function Q(){return new f})()}:function G(){return new V}};V.create=kG();V.alloc=function Y(G){return new C.Array(G)};if(C.Array!==Array)V.alloc=C.pool(V.alloc,C.Array.prototype.subarray);V.prototype._push=function Y(G,Q,J){return this.tail=this.tail.next=new y(G,Q,J),this.len+=Q,this};function o(Y,G,Q){G[Q]=Y&255}function qJ(Y,G,Q){while(Y>127)G[Q++]=Y&127|128,Y>>>=7;G[Q]=Y}function i(Y,G){this.len=Y,this.next=void 0,this.val=G}i.prototype=Object.create(y.prototype);i.prototype.fn=qJ;V.prototype.uint32=function Y(G){return this.len+=(this.tail=this.tail.next=new i((G=G>>>0)<128?1:G<16384?2:G<2097152?3:G<268435456?4:5,G)).len,this};V.prototype.int32=function Y(G){return G<0?this._push(a,10,g.fromNumber(G)):this.uint32(G)};V.prototype.sint32=function Y(G){return this.uint32((G<<1^G>>31)>>>0)};function a(Y,G,Q){while(Y.hi)G[Q++]=Y.lo&127|128,Y.lo=(Y.lo>>>7|Y.hi<<25)>>>0,Y.hi>>>=7;while(Y.lo>127)G[Q++]=Y.lo&127|128,Y.lo=Y.lo>>>7;G[Q++]=Y.lo}V.prototype.uint64=function Y(G){var Q=g.from(G);return this._push(a,Q.length(),Q)};V.prototype.int64=V.prototype.uint64;V.prototype.sint64=function Y(G){var Q=g.from(G).zzEncode();return this._push(a,Q.length(),Q)};V.prototype.bool=function Y(G){return this._push(o,1,G?1:0)};function l(Y,G,Q){G[Q]=Y&255,G[Q+1]=Y>>>8&255,G[Q+2]=Y>>>16&255,G[Q+3]=Y>>>24}V.prototype.fixed32=function Y(G){return this._push(l,4,G>>>0)};V.prototype.sfixed32=V.prototype.fixed32;V.prototype.fixed64=function Y(G){var Q=g.from(G);return this._push(l,4,Q.lo)._push(l,4,Q.hi)};V.prototype.sfixed64=V.prototype.fixed64;V.prototype.float=function Y(G){return this._push(C.float.writeFloatLE,4,G)};V.prototype.double=function Y(G){return this._push(C.float.writeDoubleLE,8,G)};var NJ=C.Array.prototype.set?function Y(G,Q,J){Q.set(G,J)}:function Y(G,Q,J){for(var H=0;H<G.length;++H)Q[J+H]=G[H]};V.prototype.bytes=function Y(G){var Q=G.length>>>0;if(!Q)return this._push(o,1,0);if(C.isString(G)){var J=V.alloc(Q=_G.length(G));_G.decode(G,J,0),G=J}return this.uint32(Q)._push(NJ,Q,G)};V.prototype.string=function Y(G){var Q=RG.length(G);return Q?this.uint32(Q)._push(RG.write,Q,G):this._push(o,1,0)};V.prototype.fork=function Y(){return this.states=new MJ(this),this.head=this.tail=new y(u,0,0),this.len=0,this};V.prototype.reset=function Y(){if(this.states)this.head=this.states.head,this.tail=this.states.tail,this.len=this.states.len,this.states=this.states.next;else this.head=this.tail=new y(u,0,0),this.len=0;return this};V.prototype.ldelim=function Y(){var G=this.head,Q=this.tail,J=this.len;if(this.reset().uint32(J),J)this.tail.next=G.next,this.tail=Q,this.len+=J;return this};V.prototype.finish=function Y(){var G=this.head.next,Q=this.constructor.alloc(this.len),J=0;while(G)G.fn(G.val,Q,J),J+=G.len,G=G.next;return Q};V._configure=function(Y){f=Y,V.create=kG(),f._configure()}});var jG=T((SJ,wG)=>{wG.exports=E;var xG=t();(E.prototype=Object.create(xG.prototype)).constructor=E;var R=_();function E(){xG.call(this)}E._configure=function(){E.alloc=R._Buffer_allocUnsafe,E.writeBytesBuffer=R.Buffer&&R.Buffer.prototype instanceof Uint8Array&&R.Buffer.prototype.set.name==="set"?function Y(G,Q,J){Q.set(G,J)}:function Y(G,Q,J){if(G.copy)G.copy(Q,J,0,G.length);else for(var H=0;H<G.length;)Q[J++]=G[H++]}};E.prototype.bytes=function Y(G){if(R.isString(G))G=R._Buffer_from(G,"base64");var Q=G.length>>>0;if(this.uint32(Q),Q)this._push(E.writeBytesBuffer,Q,G);return this};function FJ(Y,G,Q){if(Y.length<40)R.utf8.write(Y,G,Q);else if(G.utf8Write)G.utf8Write(Y,Q);else G.write(Y,Q)}E.prototype.string=function Y(G){var Q=R.Buffer.byteLength(G);if(this.uint32(Q),Q)this._push(FJ,Q,G);return this};E._configure()});var e=T((EJ,vG)=>{vG.exports=P;var W=_(),s,cG=W.LongBits,VJ=W.utf8;function U(Y,G){return RangeError("index out of range: "+Y.pos+" + "+(G||1)+" > "+Y.len)}function P(Y){this.buf=Y,this.pos=0,this.len=Y.length}var hG=typeof Uint8Array!=="undefined"?function Y(G){if(G instanceof Uint8Array||Array.isArray(G))return new P(G);throw Error("illegal buffer")}:function Y(G){if(Array.isArray(G))return new P(G);throw Error("illegal buffer")},dG=function Y(){return W.Buffer?function G(Q){return(P.create=function J(H){return W.Buffer.isBuffer(H)?new s(H):hG(H)})(Q)}:hG};P.create=dG();P.prototype._slice=W.Array.prototype.subarray||W.Array.prototype.slice;P.prototype.uint32=function Y(){var G=4294967295;return function Q(){if(G=(this.buf[this.pos]&127)>>>0,this.buf[this.pos++]<128)return G;if(G=(G|(this.buf[this.pos]&127)<<7)>>>0,this.buf[this.pos++]<128)return G;if(G=(G|(this.buf[this.pos]&127)<<14)>>>0,this.buf[this.pos++]<128)return G;if(G=(G|(this.buf[this.pos]&127)<<21)>>>0,this.buf[this.pos++]<128)return G;if(G=(G|(this.buf[this.pos]&15)<<28)>>>0,this.buf[this.pos++]<128)return G;if((this.pos+=5)>this.len)throw this.pos=this.len,U(this,10);return G}}();P.prototype.int32=function Y(){return this.uint32()|0};P.prototype.sint32=function Y(){var G=this.uint32();return G>>>1^-(G&1)|0};function r(){var Y=new cG(0,0),G=0;if(this.len-this.pos>4){for(;G<4;++G)if(Y.lo=(Y.lo|(this.buf[this.pos]&127)<<G*7)>>>0,this.buf[this.pos++]<128)return Y;if(Y.lo=(Y.lo|(this.buf[this.pos]&127)<<28)>>>0,Y.hi=(Y.hi|(this.buf[this.pos]&127)>>4)>>>0,this.buf[this.pos++]<128)return Y;G=0}else{for(;G<3;++G){if(this.pos>=this.len)throw U(this);if(Y.lo=(Y.lo|(this.buf[this.pos]&127)<<G*7)>>>0,this.buf[this.pos++]<128)return Y}return Y.lo=(Y.lo|(this.buf[this.pos++]&127)<<G*7)>>>0,Y}if(this.len-this.pos>4){for(;G<5;++G)if(Y.hi=(Y.hi|(this.buf[this.pos]&127)<<G*7+3)>>>0,this.buf[this.pos++]<128)return Y}else for(;G<5;++G){if(this.pos>=this.len)throw U(this);if(Y.hi=(Y.hi|(this.buf[this.pos]&127)<<G*7+3)>>>0,this.buf[this.pos++]<128)return Y}throw Error("invalid varint encoding")}P.prototype.bool=function Y(){return this.uint32()!==0};function m(Y,G){return(Y[G-4]|Y[G-3]<<8|Y[G-2]<<16|Y[G-1]<<24)>>>0}P.prototype.fixed32=function Y(){if(this.pos+4>this.len)throw U(this,4);return m(this.buf,this.pos+=4)};P.prototype.sfixed32=function Y(){if(this.pos+4>this.len)throw U(this,4);return m(this.buf,this.pos+=4)|0};function yG(){if(this.pos+8>this.len)throw U(this,8);return new cG(m(this.buf,this.pos+=4),m(this.buf,this.pos+=4))}P.prototype.float=function Y(){if(this.pos+4>this.len)throw U(this,4);var G=W.float.readFloatLE(this.buf,this.pos);return this.pos+=4,G};P.prototype.double=function Y(){if(this.pos+8>this.len)throw U(this,4);var G=W.float.readDoubleLE(this.buf,this.pos);return this.pos+=8,G};P.prototype.bytes=function Y(){var G=this.uint32(),Q=this.pos,J=this.pos+G;if(J>this.len)throw U(this,G);if(this.pos+=G,Array.isArray(this.buf))return this.buf.slice(Q,J);if(Q===J){var H=W.Buffer;return H?H.alloc(0):new this.buf.constructor(0)}return this._slice.call(this.buf,Q,J)};P.prototype.string=function Y(){var G=this.bytes();return VJ.read(G,0,G.length)};P.prototype.skip=function Y(G){if(typeof G==="number"){if(this.pos+G>this.len)throw U(this,G);this.pos+=G}else do if(this.pos>=this.len)throw U(this);while(this.buf[this.pos++]&128);return this};P.prototype.skipType=function(Y){switch(Y){case 0:this.skip();break;case 1:this.skip(8);break;case 2:this.skip(this.uint32());break;case 3:while((Y=this.uint32()&7)!==4)this.skipType(Y);break;case 5:this.skip(4);break;default:throw Error("invalid wire type "+Y+" at offset "+this.pos)}return this};P._configure=function(Y){s=Y,P.create=dG(),s._configure();var G=W.Long?"toLong":"toNumber";W.merge(P.prototype,{int64:function Q(){return r.call(this)[G](!1)},uint64:function Q(){return r.call(this)[G](!0)},sint64:function Q(){return r.call(this).zzDecode()[G](!1)},fixed64:function Q(){return yG.call(this)[G](!0)},sfixed64:function Q(){return yG.call(this)[G](!1)}})}});var bG=T((OJ,pG)=>{pG.exports=w;var mG=e();(w.prototype=Object.create(mG.prototype)).constructor=w;var gG=_();function w(Y){mG.call(this,Y)}w._configure=function(){if(gG.Buffer)w.prototype._slice=gG.Buffer.prototype.slice};w.prototype.string=function Y(){var G=this.uint32();return this.buf.utf8Slice?this.buf.utf8Slice(this.pos,this.pos=Math.min(this.pos+G,this.len)):this.buf.toString("utf-8",this.pos,this.pos=Math.min(this.pos+G,this.len))};w._configure()});var fG=T((_J,nG)=>{nG.exports=c;var GG=_();(c.prototype=Object.create(GG.EventEmitter.prototype)).constructor=c;function c(Y,G,Q){if(typeof Y!=="function")throw TypeError("rpcImpl must be a function");GG.EventEmitter.call(this),this.rpcImpl=Y,this.requestDelimited=Boolean(G),this.responseDelimited=Boolean(Q)}c.prototype.rpcCall=function Y(G,Q,J,H,Z){if(!H)throw TypeError("request must be specified");var X=this;if(!Z)return GG.asPromise(Y,X,G,Q,J,H);if(!X.rpcImpl){setTimeout(function(){Z(Error("already ended"))},0);return}try{return X.rpcImpl(G,Q[X.requestDelimited?"encodeDelimited":"encode"](H).finish(),function q(K,M){if(K)return X.emit("error",K,G),Z(K);if(M===null){X.end(!0);return}if(!(M instanceof J))try{M=J[X.responseDelimited?"decodeDelimited":"decode"](M)}catch(F){return X.emit("error",F,G),Z(F)}return X.emit("data",M,G),Z(null,M)})}catch(q){X.emit("error",q,G),setTimeout(function(){Z(q)},0);return}};c.prototype.end=function Y(G){if(this.rpcImpl){if(!G)this.rpcImpl(null,null,null);this.rpcImpl=null,this.emit("end").off()}return this}});var uG=T((lG)=>{var PJ=lG;PJ.Service=fG()});var iG=T((kJ,oG)=>{oG.exports={}});var rG=T((tG)=>{var $=tG;$.build="minimal";$.Writer=t();$.BufferWriter=jG();$.Reader=e();$.BufferReader=bG();$.util=_();$.rpc=uG();$.roots=iG();$.configure=aG;function aG(){$.util._configure(),$.Writer._configure($.BufferWriter),$.Reader._configure($.BufferReader)}aG()});var S=YJ(rG(),1),k=S.Reader,sG=S.Writer,z=S.util,D=S.roots.default||(S.roots.default={}),xJ=D.client=(()=>{let Y={};return Y.ClientDirective=function(){function G(Q){if(this.data={},Q){for(let J=Object.keys(Q),H=0;H<J.length;++H)if(Q[J[H]]!=null)this[J[H]]=Q[J[H]]}}return G.prototype.option=0,G.prototype.ackId="",G.prototype.cid="",G.prototype.content="",G.prototype.taskId="",G.prototype.data=z.emptyObject,G.create=function Q(J){return new G(J)},G.encode=function Q(J,H){if(!H)H=sG.create();if(J.option!=null&&Object.hasOwnProperty.call(J,"option"))H.uint32(8).int32(J.option);if(J.ackId!=null&&Object.hasOwnProperty.call(J,"ackId"))H.uint32(18).string(J.ackId);if(J.cid!=null&&Object.hasOwnProperty.call(J,"cid"))H.uint32(26).string(J.cid);if(J.content!=null&&Object.hasOwnProperty.call(J,"content"))H.uint32(34).string(J.content);if(J.taskId!=null&&Object.hasOwnProperty.call(J,"taskId"))H.uint32(42).string(J.taskId);if(J.data!=null&&Object.hasOwnProperty.call(J,"data"))for(let Z=Object.keys(J.data),X=0;X<Z.length;++X)H.uint32(50).fork().uint32(10).string(Z[X]).uint32(18).string(J.data[Z[X]]).ldelim();return H},G.encodeDelimited=function Q(J,H){return this.encode(J,H).ldelim()},G.decode=function Q(J,H){if(!(J instanceof k))J=k.create(J);let Z=H===void 0?J.len:J.pos+H,X=new D.client.ClientDirective,q,K;while(J.pos<Z){let M=J.uint32();switch(M>>>3){case 1:{X.option=J.int32();break}case 2:{X.ackId=J.string();break}case 3:{X.cid=J.string();break}case 4:{X.content=J.string();break}case 5:{X.taskId=J.string();break}case 6:{if(X.data===z.emptyObject)X.data={};let F=J.uint32()+J.pos;q="",K="";while(J.pos<F){let A=J.uint32();switch(A>>>3){case 1:q=J.string();break;case 2:K=J.string();break;default:J.skipType(A&7);break}}X.data[q]=K;break}default:J.skipType(M&7);break}}return X},G.decodeDelimited=function Q(J){if(!(J instanceof k))J=new k(J);return this.decode(J,J.uint32())},G.verify=function Q(J){if(typeof J!=="object"||J===null)return"object expected";if(J.option!=null&&J.hasOwnProperty("option"))switch(J.option){default:return"option: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:break}if(J.ackId!=null&&J.hasOwnProperty("ackId")){if(!z.isString(J.ackId))return"ackId: string expected"}if(J.cid!=null&&J.hasOwnProperty("cid")){if(!z.isString(J.cid))return"cid: string expected"}if(J.content!=null&&J.hasOwnProperty("content")){if(!z.isString(J.content))return"content: string expected"}if(J.taskId!=null&&J.hasOwnProperty("taskId")){if(!z.isString(J.taskId))return"taskId: string expected"}if(J.data!=null&&J.hasOwnProperty("data")){if(!z.isObject(J.data))return"data: object expected";let H=Object.keys(J.data);for(let Z=0;Z<H.length;++Z)if(!z.isString(J.data[H[Z]]))return"data: string{k:string} expected"}return null},G.fromObject=function Q(J){if(J instanceof D.client.ClientDirective)return J;let H=new D.client.ClientDirective;switch(J.option){default:if(typeof J.option==="number"){H.option=J.option;break}break;case"UNKNOWN":case 0:H.option=0;break;case"CLIENT_ASK":case 1:H.option=1;break;case"CLIENT_INTERACTION":case 2:H.option=2;break;case"CLIENT_RELOAD":case 3:H.option=3;break;case"CLIENT_STOP":case 4:H.option=4;break;case"CLIENT_EXPECT_ANSWER":case 5:H.option=5;break}if(J.ackId!=null)H.ackId=String(J.ackId);if(J.cid!=null)H.cid=String(J.cid);if(J.content!=null)H.content=String(J.content);if(J.taskId!=null)H.taskId=String(J.taskId);if(J.data){if(typeof J.data!=="object")throw TypeError(".client.ClientDirective.data: object expected");H.data={};for(let Z=Object.keys(J.data),X=0;X<Z.length;++X)H.data[Z[X]]=String(J.data[Z[X]])}return H},G.toObject=function Q(J,H){if(!H)H={};let Z={};if(H.objects||H.defaults)Z.data={};if(H.defaults)Z.option=H.enums===String?"UNKNOWN":0,Z.ackId="",Z.cid="",Z.content="",Z.taskId="";if(J.option!=null&&J.hasOwnProperty("option"))Z.option=H.enums===String?D.client.ClientOptEnum[J.option]===void 0?J.option:D.client.ClientOptEnum[J.option]:J.option;if(J.ackId!=null&&J.hasOwnProperty("ackId"))Z.ackId=J.ackId;if(J.cid!=null&&J.hasOwnProperty("cid"))Z.cid=J.cid;if(J.content!=null&&J.hasOwnProperty("content"))Z.content=J.content;if(J.taskId!=null&&J.hasOwnProperty("taskId"))Z.taskId=J.taskId;let X;if(J.data&&(X=Object.keys(J.data)).length){Z.data={};for(let q=0;q<X.length;++q)Z.data[X[q]]=J.data[X[q]]}return Z},G.prototype.toJSON=function Q(){return this.constructor.toObject(this,S.util.toJSONOptions)},G.getTypeUrl=function Q(J){if(J===void 0)J="type.googleapis.com";return J+"/client.ClientDirective"},G}(),Y.ClientOptEnum=function(){let G={},Q=Object.create(G);return Q[G[0]="UNKNOWN"]=0,Q[G[1]="CLIENT_ASK"]=1,Q[G[2]="CLIENT_INTERACTION"]=2,Q[G[3]="CLIENT_RELOAD"]=3,Q[G[4]="CLIENT_STOP"]=4,Q[G[5]="CLIENT_EXPECT_ANSWER"]=5,Q}(),Y})(),wJ=D.server=(()=>{let Y={};return Y.ServDirective=function(){function G(Q){if(this.data={},Q){for(let J=Object.keys(Q),H=0;H<J.length;++H)if(Q[J[H]]!=null)this[J[H]]=Q[J[H]]}}return G.prototype.option=0,G.prototype.ackId="",G.prototype.cid="",G.prototype.taskId="",G.prototype.msg="",G.prototype.content="",G.prototype.data=z.emptyObject,G.create=function Q(J){return new G(J)},G.encode=function Q(J,H){if(!H)H=sG.create();if(J.option!=null&&Object.hasOwnProperty.call(J,"option"))H.uint32(8).int32(J.option);if(J.ackId!=null&&Object.hasOwnProperty.call(J,"ackId"))H.uint32(18).string(J.ackId);if(J.cid!=null&&Object.hasOwnProperty.call(J,"cid"))H.uint32(26).string(J.cid);if(J.taskId!=null&&Object.hasOwnProperty.call(J,"taskId"))H.uint32(34).string(J.taskId);if(J.msg!=null&&Object.hasOwnProperty.call(J,"msg"))H.uint32(42).string(J.msg);if(J.content!=null&&Object.hasOwnProperty.call(J,"content"))H.uint32(50).string(J.content);if(J.data!=null&&Object.hasOwnProperty.call(J,"data"))for(let Z=Object.keys(J.data),X=0;X<Z.length;++X)H.uint32(58).fork().uint32(10).string(Z[X]).uint32(18).string(J.data[Z[X]]).ldelim();return H},G.encodeDelimited=function Q(J,H){return this.encode(J,H).ldelim()},G.decode=function Q(J,H){if(!(J instanceof k))J=k.create(J);let Z=H===void 0?J.len:J.pos+H,X=new D.server.ServDirective,q,K;while(J.pos<Z){let M=J.uint32();switch(M>>>3){case 1:{X.option=J.int32();break}case 2:{X.ackId=J.string();break}case 3:{X.cid=J.string();break}case 4:{X.taskId=J.string();break}case 5:{X.msg=J.string();break}case 6:{X.content=J.string();break}case 7:{if(X.data===z.emptyObject)X.data={};let F=J.uint32()+J.pos;q="",K="";while(J.pos<F){let A=J.uint32();switch(A>>>3){case 1:q=J.string();break;case 2:K=J.string();break;default:J.skipType(A&7);break}}X.data[q]=K;break}default:J.skipType(M&7);break}}return X},G.decodeDelimited=function Q(J){if(!(J instanceof k))J=new k(J);return this.decode(J,J.uint32())},G.verify=function Q(J){if(typeof J!=="object"||J===null)return"object expected";if(J.option!=null&&J.hasOwnProperty("option"))switch(J.option){default:return"option: enum value expected";case 0:case 1:case 2:case 3:case 4:case 5:case 6:case 7:case 8:case 9:break}if(J.ackId!=null&&J.hasOwnProperty("ackId")){if(!z.isString(J.ackId))return"ackId: string expected"}if(J.cid!=null&&J.hasOwnProperty("cid")){if(!z.isString(J.cid))return"cid: string expected"}if(J.taskId!=null&&J.hasOwnProperty("taskId")){if(!z.isString(J.taskId))return"taskId: string expected"}if(J.msg!=null&&J.hasOwnProperty("msg")){if(!z.isString(J.msg))return"msg: string expected"}if(J.content!=null&&J.hasOwnProperty("content")){if(!z.isString(J.content))return"content: string expected"}if(J.data!=null&&J.hasOwnProperty("data")){if(!z.isObject(J.data))return"data: object expected";let H=Object.keys(J.data);for(let Z=0;Z<H.length;++Z)if(!z.isString(J.data[H[Z]]))return"data: string{k:string} expected"}return null},G.fromObject=function Q(J){if(J instanceof D.server.ServDirective)return J;let H=new D.server.ServDirective;switch(J.option){default:if(typeof J.option==="number"){H.option=J.option;break}break;case"UNKONWN":case 0:H.option=0;break;case"SERV_ACK":case 1:H.option=1;break;case"SERV_THINK":case 2:H.option=2;break;case"SERV_TEXT":case 3:H.option=3;break;case"SERV_DONE":case 4:H.option=4;break;case"SERV_TOOL":case 5:H.option=5;break;case"SERV_TOOLTEXT":case 6:H.option=6;break;case"SERV_TOOLTMPL":case 7:H.option=7;break;case"SERV_STOP_MANUAL":case 8:H.option=8;break;case"SERV_STOP_ERR":case 9:H.option=9;break}if(J.ackId!=null)H.ackId=String(J.ackId);if(J.cid!=null)H.cid=String(J.cid);if(J.taskId!=null)H.taskId=String(J.taskId);if(J.msg!=null)H.msg=String(J.msg);if(J.content!=null)H.content=String(J.content);if(J.data){if(typeof J.data!=="object")throw TypeError(".server.ServDirective.data: object expected");H.data={};for(let Z=Object.keys(J.data),X=0;X<Z.length;++X)H.data[Z[X]]=String(J.data[Z[X]])}return H},G.toObject=function Q(J,H){if(!H)H={};let Z={};if(H.objects||H.defaults)Z.data={};if(H.defaults)Z.option=H.enums===String?"UNKONWN":0,Z.ackId="",Z.cid="",Z.taskId="",Z.msg="",Z.content="";if(J.option!=null&&J.hasOwnProperty("option"))Z.option=H.enums===String?D.server.ServOptEnum[J.option]===void 0?J.option:D.server.ServOptEnum[J.option]:J.option;if(J.ackId!=null&&J.hasOwnProperty("ackId"))Z.ackId=J.ackId;if(J.cid!=null&&J.hasOwnProperty("cid"))Z.cid=J.cid;if(J.taskId!=null&&J.hasOwnProperty("taskId"))Z.taskId=J.taskId;if(J.msg!=null&&J.hasOwnProperty("msg"))Z.msg=J.msg;if(J.content!=null&&J.hasOwnProperty("content"))Z.content=J.content;let X;if(J.data&&(X=Object.keys(J.data)).length){Z.data={};for(let q=0;q<X.length;++q)Z.data[X[q]]=J.data[X[q]]}return Z},G.prototype.toJSON=function Q(){return this.constructor.toObject(this,S.util.toJSONOptions)},G.getTypeUrl=function Q(J){if(J===void 0)J="type.googleapis.com";return J+"/server.ServDirective"},G}(),Y.ServOptEnum=function(){let G={},Q=Object.create(G);return Q[G[0]="UNKONWN"]=0,Q[G[1]="SERV_ACK"]=1,Q[G[2]="SERV_THINK"]=2,Q[G[3]="SERV_TEXT"]=3,Q[G[4]="SERV_DONE"]=4,Q[G[5]="SERV_TOOL"]=5,Q[G[6]="SERV_TOOLTEXT"]=6,Q[G[7]="SERV_TOOLTMPL"]=7,Q[G[8]="SERV_STOP_MANUAL"]=8,Q[G[9]="SERV_STOP_ERR"]=9,Q}(),Y})();export{wJ as server,D as default,xJ as client};
@@ -0,0 +1,24 @@
1
+ syntax = "proto3";
2
+
3
+ package client;
4
+
5
+ // 客户端指令消息
6
+ message ClientDirective {
7
+ ClientOptEnum option = 1; // 指令类型
8
+ // 以下字段根据option类型选择性填充
9
+ string ack_id = 2; // 用于匹配后端回执
10
+ string cid = 3; // 会话记录ID(CLIENT_RELOAD/CLIENT_STOP/CLIENT_INTERACTION/CLIENT_EXPECT_ANSWER)
11
+ string content = 4; // 用户问题/期望答案 (CLIENT_ASK/CLIENT_EXPECT_ANSWER)
12
+ string task_id = 5; // 任务id (CLIENT_INTERACTION)
13
+ map<string, string> data = 6; // 用户交互数据 (CLIENT_INTERACTION)
14
+ }
15
+
16
+ // 指令类型枚举
17
+ enum ClientOptEnum {
18
+ UNKNOWN = 0;
19
+ CLIENT_ASK = 1;
20
+ CLIENT_INTERACTION = 2;
21
+ CLIENT_RELOAD = 3;
22
+ CLIENT_STOP = 4;
23
+ CLIENT_EXPECT_ANSWER = 5;
24
+ }
@@ -0,0 +1,39 @@
1
+ syntax = "proto3";
2
+
3
+ package client_oneof;
4
+
5
+ // 客户端指令类型枚举
6
+ enum ClientOptEnum {
7
+ UNKNOWN = 0;
8
+ CLIENT_ASK = 1;
9
+ CLIENT_INTERACTION = 2;
10
+ CLIENT_RELOAD = 3;
11
+ CLIENT_STOP = 4;
12
+ CLIENT_EXPECT_ANSWER = 5;
13
+ }
14
+
15
+ // 客户端基础消息
16
+ message ClientDirective {
17
+ ClientOptEnum option = 1; // 指令类型
18
+ string ack_id = 2; // 消息回执ID
19
+
20
+ oneof payload {
21
+ string content = 3; // 用户问题(CLIENT_ASK)
22
+ string cid = 4; // 会话记录ID(CLIENT_RELOAD, CLIENT_STOP)
23
+ ClientInteraction interaction = 5; // 交互数据(CLIENT_INTERACTION)
24
+ ClientExpectAnswer expect_answer = 6; // 期望答案(CLIENT_EXPECT_ANSWER)
25
+ }
26
+ }
27
+
28
+ // 交互数据消息
29
+ message ClientInteraction {
30
+ string cid = 1; // 会话记录ID
31
+ string task_id = 2; // 任务ID
32
+ map<string, string> data = 3; // 交互数据
33
+ }
34
+
35
+ // 期望答案消息
36
+ message ClientExpectAnswer {
37
+ string cid = 1; // 会话记录ID
38
+ string content = 2; // 期望答案内容
39
+ }
@@ -0,0 +1,29 @@
1
+ syntax = "proto3";
2
+
3
+ package server;
4
+
5
+ // 服务端指令消息
6
+ message ServDirective {
7
+ ServOptEnum option = 1; // 服务端指令类型
8
+ // 以下字段根据option类型选择性填充
9
+ string ack_id = 2; // 服务端确认客户端消息回执(SERV_ACK)
10
+ string cid = 3; // 会话记录id(SERV_ACK/SERV_THINK/SERV_TOOL)
11
+ string task_id = 4; // 任务id,多任务使用,分割(SERV_THINK/SERV_TOOL)
12
+ string msg = 5; // 错误消息(SERV_ACK/SERV_STOP_ERR)
13
+ string content = 6; // 数据内容(SERV_TEXT/SERV_TOOLTEXT)
14
+ map<string, string> data = 7; // 模板数据(SERV_TOOLTMPL)
15
+ }
16
+
17
+ // 指令类型枚举
18
+ enum ServOptEnum {
19
+ UNKONWN = 0;
20
+ SERV_ACK = 1; // 客户端消息已确认收到(插入role=user会话记录)
21
+ SERV_THINK = 2; // AI思考中(插入role=assistant会话记录)
22
+ SERV_TEXT = 3; // AI回复中: 文本内容Chunk
23
+ SERV_DONE = 4; // AI回复完成: 文本内容Chunk接收完成;恢复默认状态
24
+ SERV_TOOL = 5; // AI工具处理/等待中(插入role=tool会话记录)
25
+ SERV_TOOLTEXT = 6; // AI工具回复中: 工具文本流内容Chunk需要等待
26
+ SERV_TOOLTMPL = 7; // AI工具处理中: 工具模版一次性输出结果
27
+ SERV_STOP_MANUAL = 8; // AI回复中断:用户手动中断;恢复默认状态
28
+ SERV_STOP_ERR = 9; // AI回复中断:服务端异常;恢复默认状态
29
+ }
@@ -0,0 +1,18 @@
1
+ {
2
+ "scripts": {
3
+ "buf": "bunx buf generate --template speed.gen.yaml",
4
+ "buf:min": "bunx buf generate --template code.gen.yaml",
5
+ "pbjs": "mkdir -p gen/pb && bunx pbjs -t static-module -w es6 -o gen/pb/index.js --path ./model model/**/*.proto",
6
+ "pbts": "bunx pbts -o gen/pb/index.d.ts gen/pb/index.js",
7
+ "pb:extract": "bun build gen/pb/index.js --target=bun --minify --outdir ./gen/pb",
8
+ "pb": "bun pbjs && bun pbts && bun pb:extract"
9
+ },
10
+ "dependencies": {
11
+ "@protobuf-ts/plugin": "^2.9.6",
12
+ "protobufjs": "^7.4.0"
13
+ },
14
+ "devDependencies": {
15
+ "@bufbuild/buf": "^1.51.0",
16
+ "protobufjs-cli": "^1.1.3"
17
+ }
18
+ }
@@ -0,0 +1,10 @@
1
+ # Learn more: https://buf.build/docs/configuration/v2/buf-gen-yaml
2
+ version: v2
3
+ inputs:
4
+ - directory: model
5
+ plugins:
6
+ - local: protoc-gen-ts
7
+ opt:
8
+ - force_optimize_speed
9
+ - long_type_string
10
+ out: gen/buf-speed
@@ -0,0 +1,11 @@
1
+ export class Router extends GSD.GledeRouter {
2
+ @GSD.Get('/')
3
+ index(req: GledeBunRequest, data: GledeReqData) {
4
+ return {
5
+ code: 0,
6
+ data: {
7
+ message: 'Hello GledeServer!'
8
+ }
9
+ };
10
+ }
11
+ }
@@ -0,0 +1,39 @@
1
+ {
2
+ "compilerOptions": {
3
+ "lib": [
4
+ "ESNext"
5
+ ],
6
+ "allowImportingTsExtensions": true,
7
+ "experimentalDecorators": true,
8
+ "target": "ESNext",
9
+ "module": "ESNext",
10
+ "allowJs": true,
11
+ "moduleDetection": "force",
12
+ "moduleResolution": "bundler",
13
+ "resolveJsonModule": true,
14
+ "removeComments": true,
15
+ "verbatimModuleSyntax": true,
16
+ "strictNullChecks": false,
17
+ "noEmit": true,
18
+ "strict": true,
19
+ "noImplicitAny": false,
20
+ "noImplicitThis": false,
21
+ "skipLibCheck": true,
22
+ "noFallthroughCasesInSwitch": true,
23
+ "noUncheckedIndexedAccess": true,
24
+ "noUnusedLocals": false,
25
+ "noUnusedParameters": false,
26
+ "noPropertyAccessFromIndexSignature": false,
27
+ "baseUrl": "./",
28
+ "paths": {
29
+ "@/*": [
30
+ "./*"
31
+ ]
32
+ }
33
+ },
34
+ "include": [
35
+ "./**/*",
36
+ "node_modules/@types/**/*",
37
+ "node_modules/glede-server-bun"
38
+ ]
39
+ }
@@ -0,0 +1,75 @@
1
+ import type { Redis } from 'ioredis';
2
+
3
+ export interface Logger {
4
+ /**
5
+ * 输出info级别日志 0 红色
6
+ * [2023-12-10 03:14:32] [ERROR] $message
7
+ */
8
+ error(message: string): void;
9
+
10
+ /**
11
+ * 输出info级别日志 1 黄色
12
+ * [2023-12-10 03:14:32] [WARN] $message
13
+ */
14
+ warn(message: string): void;
15
+
16
+ /**
17
+ * 输出info级别日志 2 绿色
18
+ * [2023-12-10 03:14:32] [INFO] $message
19
+ */
20
+ info(message: string): void;
21
+
22
+ /**
23
+ * 输出到控制台, 不同level对应颜色不同; 默认info 绿色
24
+ * [2023-12-10 03:14:32] [$level] $message
25
+ */
26
+ log(message: string, level?: 0 | 1 | 2): void;
27
+ }
28
+
29
+ declare global {
30
+ /** 输出日志 */
31
+ var logger: Logger;
32
+ /**
33
+ * 传入Promise为之绑定catch方法并返回,设置打印错误日志
34
+ * @param p Promise
35
+ * @param errHead 补全日志头部描述
36
+ * @param level 错误级别 0 error | 1 warn | 2 info
37
+ * @returns 绑定了catch回调的Promise本身
38
+ */
39
+ function CatchExec<T = any>(p: any, errHead?: string, level?: 0 | 1 | 2): Promise<T>;
40
+ /**
41
+ * 服务启动配置
42
+ */
43
+ var serverConf: Omit<GledeServerOpts, 'conf'>;
44
+ /**
45
+ * Router错误快捷返回
46
+ */
47
+ var serr: {
48
+ /** 入参错误 */
49
+ params(msg?: any): {
50
+ code: 1;
51
+ data: null;
52
+ msg: string;
53
+ };
54
+ /** 服务错误 */
55
+ process(msg?: any): {
56
+ code: 2;
57
+ data: null;
58
+ msg: string;
59
+ };
60
+ /** 禁用下次回调 */
61
+ ban(msg?: any): {
62
+ code: 3;
63
+ data: null;
64
+ msg: string;
65
+ };
66
+ };
67
+ /**
68
+ * Redis实例
69
+ */
70
+ var redis: Redis;
71
+ /**
72
+ * Postgres实例
73
+ */
74
+ var sql: Bun.SQL;
75
+ }
@@ -0,0 +1,2 @@
1
+ export * from './limit';
2
+ export * from './log';
@@ -0,0 +1,30 @@
1
+ /**
2
+ * @file 测控工具
3
+ * @date 2022-07-14
4
+ * @author Perfumere
5
+ */
6
+
7
+ import { logger } from './log';
8
+
9
+ /**
10
+ * 传入Promise为之绑定catch方法并返回,设置打印错误日志
11
+ * @param p Promise
12
+ * @param errHead 补全日志头部描述
13
+ * @param level 错误级别 0 error | 1 warn | 2 info
14
+ * @returns 绑定了catch回调的Promise本身
15
+ */
16
+ export function CatchExec<T = any>(p: any, errHead = '', level: 0 | 1 | 2 = 0): Promise<T> {
17
+ return p.catch(e => {
18
+ const errMsg = `${errHead} ${e}`;
19
+
20
+ if (level === 0) {
21
+ logger.error(errMsg);
22
+ }
23
+ if (level === 1) {
24
+ logger.warn(errMsg);
25
+ }
26
+ if (level === 2) {
27
+ logger.info(errMsg);
28
+ }
29
+ });
30
+ }