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,126 @@
1
+ // @generated by protobuf-ts 2.9.6 with parameter force_optimize_code_size,keep_enum_prefix,long_type_string
2
+ // @generated from protobuf file "server/index.proto" (package "server", syntax proto3)
3
+ // tslint:disable
4
+ import { MessageType } from "@protobuf-ts/runtime";
5
+ /**
6
+ * 服务端指令消息
7
+ *
8
+ * @generated from protobuf message server.ServDirective
9
+ */
10
+ export interface ServDirective {
11
+ /**
12
+ * @generated from protobuf field: server.ServOptEnum option = 1;
13
+ */
14
+ option: ServOptEnum; // 服务端指令类型
15
+ /**
16
+ * 以下字段根据option类型选择性填充
17
+ *
18
+ * @generated from protobuf field: string ack_id = 2;
19
+ */
20
+ ackId: string; // 服务端确认客户端消息回执(SERV_ACK)
21
+ /**
22
+ * @generated from protobuf field: string cid = 3;
23
+ */
24
+ cid: string; // 会话记录id(SERV_ACK/SERV_THINK/SERV_TOOL)
25
+ /**
26
+ * @generated from protobuf field: string task_id = 4;
27
+ */
28
+ taskId: string; // 任务id,多任务使用,分割(SERV_THINK/SERV_TOOL)
29
+ /**
30
+ * @generated from protobuf field: string msg = 5;
31
+ */
32
+ msg: string; // 错误消息(SERV_ACK/SERV_STOP_ERR)
33
+ /**
34
+ * @generated from protobuf field: string content = 6;
35
+ */
36
+ content: string; // 数据内容(SERV_TEXT/SERV_TOOLTEXT)
37
+ /**
38
+ * @generated from protobuf field: map<string, string> data = 7;
39
+ */
40
+ data: {
41
+ [key: string]: string;
42
+ }; // 模板数据(SERV_TOOLTMPL)
43
+ }
44
+ /**
45
+ * 指令类型枚举
46
+ *
47
+ * @generated from protobuf enum server.ServOptEnum
48
+ */
49
+ export enum ServOptEnum {
50
+ /**
51
+ * @generated from protobuf enum value: UNKONWN = 0;
52
+ */
53
+ UNKONWN = 0,
54
+ /**
55
+ * 客户端消息已确认收到(插入role=user会话记录)
56
+ *
57
+ * @generated from protobuf enum value: SERV_ACK = 1;
58
+ */
59
+ SERV_ACK = 1,
60
+ /**
61
+ * AI思考中(插入role=assistant会话记录)
62
+ *
63
+ * @generated from protobuf enum value: SERV_THINK = 2;
64
+ */
65
+ SERV_THINK = 2,
66
+ /**
67
+ * AI回复中: 文本内容Chunk
68
+ *
69
+ * @generated from protobuf enum value: SERV_TEXT = 3;
70
+ */
71
+ SERV_TEXT = 3,
72
+ /**
73
+ * AI回复完成: 文本内容Chunk接收完成;恢复默认状态
74
+ *
75
+ * @generated from protobuf enum value: SERV_DONE = 4;
76
+ */
77
+ SERV_DONE = 4,
78
+ /**
79
+ * AI工具处理/等待中(插入role=tool会话记录)
80
+ *
81
+ * @generated from protobuf enum value: SERV_TOOL = 5;
82
+ */
83
+ SERV_TOOL = 5,
84
+ /**
85
+ * AI工具回复中: 工具文本流内容Chunk需要等待
86
+ *
87
+ * @generated from protobuf enum value: SERV_TOOLTEXT = 6;
88
+ */
89
+ SERV_TOOLTEXT = 6,
90
+ /**
91
+ * AI工具处理中: 工具模版一次性输出结果
92
+ *
93
+ * @generated from protobuf enum value: SERV_TOOLTMPL = 7;
94
+ */
95
+ SERV_TOOLTMPL = 7,
96
+ /**
97
+ * AI回复中断:用户手动中断;恢复默认状态
98
+ *
99
+ * @generated from protobuf enum value: SERV_STOP_MANUAL = 8;
100
+ */
101
+ SERV_STOP_MANUAL = 8,
102
+ /**
103
+ * AI回复中断:服务端异常;恢复默认状态
104
+ *
105
+ * @generated from protobuf enum value: SERV_STOP_ERR = 9;
106
+ */
107
+ SERV_STOP_ERR = 9
108
+ }
109
+ // @generated message type with reflection information, may provide speed optimized methods
110
+ class ServDirective$Type extends MessageType<ServDirective> {
111
+ constructor() {
112
+ super("server.ServDirective", [
113
+ { no: 1, name: "option", kind: "enum", T: () => ["server.ServOptEnum", ServOptEnum] },
114
+ { no: 2, name: "ack_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
115
+ { no: 3, name: "cid", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
116
+ { no: 4, name: "task_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
117
+ { no: 5, name: "msg", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
118
+ { no: 6, name: "content", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
119
+ { no: 7, name: "data", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }
120
+ ]);
121
+ }
122
+ }
123
+ /**
124
+ * @generated MessageType for protobuf message server.ServDirective
125
+ */
126
+ export const ServDirective = new ServDirective$Type();
@@ -0,0 +1,181 @@
1
+ // @generated by protobuf-ts 2.9.6 with parameter force_optimize_speed,long_type_string
2
+ // @generated from protobuf file "client/index.proto" (package "client", syntax proto3)
3
+ // tslint:disable
4
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
5
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
6
+ import { WireType } from "@protobuf-ts/runtime";
7
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
8
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
9
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
10
+ import type { PartialMessage } from "@protobuf-ts/runtime";
11
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
12
+ import { MessageType } from "@protobuf-ts/runtime";
13
+ /**
14
+ * 客户端指令消息
15
+ *
16
+ * @generated from protobuf message client.ClientDirective
17
+ */
18
+ export interface ClientDirective {
19
+ /**
20
+ * @generated from protobuf field: client.ClientOptEnum option = 1;
21
+ */
22
+ option: ClientOptEnum; // 指令类型
23
+ /**
24
+ * 以下字段根据option类型选择性填充
25
+ *
26
+ * @generated from protobuf field: string ack_id = 2;
27
+ */
28
+ ackId: string; // 用于匹配后端回执
29
+ /**
30
+ * @generated from protobuf field: string cid = 3;
31
+ */
32
+ cid: string; // 会话记录ID(CLIENT_RELOAD/CLIENT_STOP/CLIENT_INTERACTION/CLIENT_EXPECT_ANSWER)
33
+ /**
34
+ * @generated from protobuf field: string content = 4;
35
+ */
36
+ content: string; // 用户问题/期望答案 (CLIENT_ASK/CLIENT_EXPECT_ANSWER)
37
+ /**
38
+ * @generated from protobuf field: string task_id = 5;
39
+ */
40
+ taskId: string; // 任务id (CLIENT_INTERACTION)
41
+ /**
42
+ * @generated from protobuf field: map<string, string> data = 6;
43
+ */
44
+ data: {
45
+ [key: string]: string;
46
+ }; // 用户交互数据 (CLIENT_INTERACTION)
47
+ }
48
+ /**
49
+ * 指令类型枚举
50
+ *
51
+ * @generated from protobuf enum client.ClientOptEnum
52
+ */
53
+ export enum ClientOptEnum {
54
+ /**
55
+ * @generated from protobuf enum value: UNKNOWN = 0;
56
+ */
57
+ UNKNOWN = 0,
58
+ /**
59
+ * @generated from protobuf enum value: CLIENT_ASK = 1;
60
+ */
61
+ CLIENT_ASK = 1,
62
+ /**
63
+ * @generated from protobuf enum value: CLIENT_INTERACTION = 2;
64
+ */
65
+ CLIENT_INTERACTION = 2,
66
+ /**
67
+ * @generated from protobuf enum value: CLIENT_RELOAD = 3;
68
+ */
69
+ CLIENT_RELOAD = 3,
70
+ /**
71
+ * @generated from protobuf enum value: CLIENT_STOP = 4;
72
+ */
73
+ CLIENT_STOP = 4,
74
+ /**
75
+ * @generated from protobuf enum value: CLIENT_EXPECT_ANSWER = 5;
76
+ */
77
+ CLIENT_EXPECT_ANSWER = 5
78
+ }
79
+ // @generated message type with reflection information, may provide speed optimized methods
80
+ class ClientDirective$Type extends MessageType<ClientDirective> {
81
+ constructor() {
82
+ super("client.ClientDirective", [
83
+ { no: 1, name: "option", kind: "enum", T: () => ["client.ClientOptEnum", ClientOptEnum] },
84
+ { no: 2, name: "ack_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
85
+ { no: 3, name: "cid", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
86
+ { no: 4, name: "content", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
87
+ { no: 5, name: "task_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
88
+ { no: 6, name: "data", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }
89
+ ]);
90
+ }
91
+ create(value?: PartialMessage<ClientDirective>): ClientDirective {
92
+ const message = globalThis.Object.create((this.messagePrototype!));
93
+ message.option = 0;
94
+ message.ackId = "";
95
+ message.cid = "";
96
+ message.content = "";
97
+ message.taskId = "";
98
+ message.data = {};
99
+ if (value !== undefined)
100
+ reflectionMergePartial<ClientDirective>(this, message, value);
101
+ return message;
102
+ }
103
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ClientDirective): ClientDirective {
104
+ let message = target ?? this.create(), end = reader.pos + length;
105
+ while (reader.pos < end) {
106
+ let [fieldNo, wireType] = reader.tag();
107
+ switch (fieldNo) {
108
+ case /* client.ClientOptEnum option */ 1:
109
+ message.option = reader.int32();
110
+ break;
111
+ case /* string ack_id */ 2:
112
+ message.ackId = reader.string();
113
+ break;
114
+ case /* string cid */ 3:
115
+ message.cid = reader.string();
116
+ break;
117
+ case /* string content */ 4:
118
+ message.content = reader.string();
119
+ break;
120
+ case /* string task_id */ 5:
121
+ message.taskId = reader.string();
122
+ break;
123
+ case /* map<string, string> data */ 6:
124
+ this.binaryReadMap6(message.data, reader, options);
125
+ break;
126
+ default:
127
+ let u = options.readUnknownField;
128
+ if (u === "throw")
129
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
130
+ let d = reader.skip(wireType);
131
+ if (u !== false)
132
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
133
+ }
134
+ }
135
+ return message;
136
+ }
137
+ private binaryReadMap6(map: ClientDirective["data"], reader: IBinaryReader, options: BinaryReadOptions): void {
138
+ let len = reader.uint32(), end = reader.pos + len, key: keyof ClientDirective["data"] | undefined, val: ClientDirective["data"][any] | undefined;
139
+ while (reader.pos < end) {
140
+ let [fieldNo, wireType] = reader.tag();
141
+ switch (fieldNo) {
142
+ case 1:
143
+ key = reader.string();
144
+ break;
145
+ case 2:
146
+ val = reader.string();
147
+ break;
148
+ default: throw new globalThis.Error("unknown map entry field for field client.ClientDirective.data");
149
+ }
150
+ }
151
+ map[key ?? ""] = val ?? "";
152
+ }
153
+ internalBinaryWrite(message: ClientDirective, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
154
+ /* client.ClientOptEnum option = 1; */
155
+ if (message.option !== 0)
156
+ writer.tag(1, WireType.Varint).int32(message.option);
157
+ /* string ack_id = 2; */
158
+ if (message.ackId !== "")
159
+ writer.tag(2, WireType.LengthDelimited).string(message.ackId);
160
+ /* string cid = 3; */
161
+ if (message.cid !== "")
162
+ writer.tag(3, WireType.LengthDelimited).string(message.cid);
163
+ /* string content = 4; */
164
+ if (message.content !== "")
165
+ writer.tag(4, WireType.LengthDelimited).string(message.content);
166
+ /* string task_id = 5; */
167
+ if (message.taskId !== "")
168
+ writer.tag(5, WireType.LengthDelimited).string(message.taskId);
169
+ /* map<string, string> data = 6; */
170
+ for (let k of globalThis.Object.keys(message.data))
171
+ writer.tag(6, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.data[k]).join();
172
+ let u = options.writeUnknownFields;
173
+ if (u !== false)
174
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
175
+ return writer;
176
+ }
177
+ }
178
+ /**
179
+ * @generated MessageType for protobuf message client.ClientDirective
180
+ */
181
+ export const ClientDirective = new ClientDirective$Type();
@@ -0,0 +1,227 @@
1
+ // @generated by protobuf-ts 2.9.6 with parameter force_optimize_speed,long_type_string
2
+ // @generated from protobuf file "server/index.proto" (package "server", syntax proto3)
3
+ // tslint:disable
4
+ import type { BinaryWriteOptions } from "@protobuf-ts/runtime";
5
+ import type { IBinaryWriter } from "@protobuf-ts/runtime";
6
+ import { WireType } from "@protobuf-ts/runtime";
7
+ import type { BinaryReadOptions } from "@protobuf-ts/runtime";
8
+ import type { IBinaryReader } from "@protobuf-ts/runtime";
9
+ import { UnknownFieldHandler } from "@protobuf-ts/runtime";
10
+ import type { PartialMessage } from "@protobuf-ts/runtime";
11
+ import { reflectionMergePartial } from "@protobuf-ts/runtime";
12
+ import { MessageType } from "@protobuf-ts/runtime";
13
+ /**
14
+ * 服务端指令消息
15
+ *
16
+ * @generated from protobuf message server.ServDirective
17
+ */
18
+ export interface ServDirective {
19
+ /**
20
+ * @generated from protobuf field: server.ServOptEnum option = 1;
21
+ */
22
+ option: ServOptEnum; // 服务端指令类型
23
+ /**
24
+ * 以下字段根据option类型选择性填充
25
+ *
26
+ * @generated from protobuf field: string ack_id = 2;
27
+ */
28
+ ackId: string; // 服务端确认客户端消息回执(SERV_ACK)
29
+ /**
30
+ * @generated from protobuf field: string cid = 3;
31
+ */
32
+ cid: string; // 会话记录id(SERV_ACK/SERV_THINK/SERV_TOOL)
33
+ /**
34
+ * @generated from protobuf field: string task_id = 4;
35
+ */
36
+ taskId: string; // 任务id,多任务使用,分割(SERV_THINK/SERV_TOOL)
37
+ /**
38
+ * @generated from protobuf field: string msg = 5;
39
+ */
40
+ msg: string; // 错误消息(SERV_ACK/SERV_STOP_ERR)
41
+ /**
42
+ * @generated from protobuf field: string content = 6;
43
+ */
44
+ content: string; // 数据内容(SERV_TEXT/SERV_TOOLTEXT)
45
+ /**
46
+ * @generated from protobuf field: map<string, string> data = 7;
47
+ */
48
+ data: {
49
+ [key: string]: string;
50
+ }; // 模板数据(SERV_TOOLTMPL)
51
+ }
52
+ /**
53
+ * 指令类型枚举
54
+ *
55
+ * @generated from protobuf enum server.ServOptEnum
56
+ */
57
+ export enum ServOptEnum {
58
+ /**
59
+ * @generated from protobuf enum value: UNKONWN = 0;
60
+ */
61
+ UNKONWN = 0,
62
+ /**
63
+ * 客户端消息已确认收到(插入role=user会话记录)
64
+ *
65
+ * @generated from protobuf enum value: SERV_ACK = 1;
66
+ */
67
+ SERV_ACK = 1,
68
+ /**
69
+ * AI思考中(插入role=assistant会话记录)
70
+ *
71
+ * @generated from protobuf enum value: SERV_THINK = 2;
72
+ */
73
+ SERV_THINK = 2,
74
+ /**
75
+ * AI回复中: 文本内容Chunk
76
+ *
77
+ * @generated from protobuf enum value: SERV_TEXT = 3;
78
+ */
79
+ SERV_TEXT = 3,
80
+ /**
81
+ * AI回复完成: 文本内容Chunk接收完成;恢复默认状态
82
+ *
83
+ * @generated from protobuf enum value: SERV_DONE = 4;
84
+ */
85
+ SERV_DONE = 4,
86
+ /**
87
+ * AI工具处理/等待中(插入role=tool会话记录)
88
+ *
89
+ * @generated from protobuf enum value: SERV_TOOL = 5;
90
+ */
91
+ SERV_TOOL = 5,
92
+ /**
93
+ * AI工具回复中: 工具文本流内容Chunk需要等待
94
+ *
95
+ * @generated from protobuf enum value: SERV_TOOLTEXT = 6;
96
+ */
97
+ SERV_TOOLTEXT = 6,
98
+ /**
99
+ * AI工具处理中: 工具模版一次性输出结果
100
+ *
101
+ * @generated from protobuf enum value: SERV_TOOLTMPL = 7;
102
+ */
103
+ SERV_TOOLTMPL = 7,
104
+ /**
105
+ * AI回复中断:用户手动中断;恢复默认状态
106
+ *
107
+ * @generated from protobuf enum value: SERV_STOP_MANUAL = 8;
108
+ */
109
+ SERV_STOP_MANUAL = 8,
110
+ /**
111
+ * AI回复中断:服务端异常;恢复默认状态
112
+ *
113
+ * @generated from protobuf enum value: SERV_STOP_ERR = 9;
114
+ */
115
+ SERV_STOP_ERR = 9
116
+ }
117
+ // @generated message type with reflection information, may provide speed optimized methods
118
+ class ServDirective$Type extends MessageType<ServDirective> {
119
+ constructor() {
120
+ super("server.ServDirective", [
121
+ { no: 1, name: "option", kind: "enum", T: () => ["server.ServOptEnum", ServOptEnum] },
122
+ { no: 2, name: "ack_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
123
+ { no: 3, name: "cid", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
124
+ { no: 4, name: "task_id", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
125
+ { no: 5, name: "msg", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
126
+ { no: 6, name: "content", kind: "scalar", T: 9 /*ScalarType.STRING*/ },
127
+ { no: 7, name: "data", kind: "map", K: 9 /*ScalarType.STRING*/, V: { kind: "scalar", T: 9 /*ScalarType.STRING*/ } }
128
+ ]);
129
+ }
130
+ create(value?: PartialMessage<ServDirective>): ServDirective {
131
+ const message = globalThis.Object.create((this.messagePrototype!));
132
+ message.option = 0;
133
+ message.ackId = "";
134
+ message.cid = "";
135
+ message.taskId = "";
136
+ message.msg = "";
137
+ message.content = "";
138
+ message.data = {};
139
+ if (value !== undefined)
140
+ reflectionMergePartial<ServDirective>(this, message, value);
141
+ return message;
142
+ }
143
+ internalBinaryRead(reader: IBinaryReader, length: number, options: BinaryReadOptions, target?: ServDirective): ServDirective {
144
+ let message = target ?? this.create(), end = reader.pos + length;
145
+ while (reader.pos < end) {
146
+ let [fieldNo, wireType] = reader.tag();
147
+ switch (fieldNo) {
148
+ case /* server.ServOptEnum option */ 1:
149
+ message.option = reader.int32();
150
+ break;
151
+ case /* string ack_id */ 2:
152
+ message.ackId = reader.string();
153
+ break;
154
+ case /* string cid */ 3:
155
+ message.cid = reader.string();
156
+ break;
157
+ case /* string task_id */ 4:
158
+ message.taskId = reader.string();
159
+ break;
160
+ case /* string msg */ 5:
161
+ message.msg = reader.string();
162
+ break;
163
+ case /* string content */ 6:
164
+ message.content = reader.string();
165
+ break;
166
+ case /* map<string, string> data */ 7:
167
+ this.binaryReadMap7(message.data, reader, options);
168
+ break;
169
+ default:
170
+ let u = options.readUnknownField;
171
+ if (u === "throw")
172
+ throw new globalThis.Error(`Unknown field ${fieldNo} (wire type ${wireType}) for ${this.typeName}`);
173
+ let d = reader.skip(wireType);
174
+ if (u !== false)
175
+ (u === true ? UnknownFieldHandler.onRead : u)(this.typeName, message, fieldNo, wireType, d);
176
+ }
177
+ }
178
+ return message;
179
+ }
180
+ private binaryReadMap7(map: ServDirective["data"], reader: IBinaryReader, options: BinaryReadOptions): void {
181
+ let len = reader.uint32(), end = reader.pos + len, key: keyof ServDirective["data"] | undefined, val: ServDirective["data"][any] | undefined;
182
+ while (reader.pos < end) {
183
+ let [fieldNo, wireType] = reader.tag();
184
+ switch (fieldNo) {
185
+ case 1:
186
+ key = reader.string();
187
+ break;
188
+ case 2:
189
+ val = reader.string();
190
+ break;
191
+ default: throw new globalThis.Error("unknown map entry field for field server.ServDirective.data");
192
+ }
193
+ }
194
+ map[key ?? ""] = val ?? "";
195
+ }
196
+ internalBinaryWrite(message: ServDirective, writer: IBinaryWriter, options: BinaryWriteOptions): IBinaryWriter {
197
+ /* server.ServOptEnum option = 1; */
198
+ if (message.option !== 0)
199
+ writer.tag(1, WireType.Varint).int32(message.option);
200
+ /* string ack_id = 2; */
201
+ if (message.ackId !== "")
202
+ writer.tag(2, WireType.LengthDelimited).string(message.ackId);
203
+ /* string cid = 3; */
204
+ if (message.cid !== "")
205
+ writer.tag(3, WireType.LengthDelimited).string(message.cid);
206
+ /* string task_id = 4; */
207
+ if (message.taskId !== "")
208
+ writer.tag(4, WireType.LengthDelimited).string(message.taskId);
209
+ /* string msg = 5; */
210
+ if (message.msg !== "")
211
+ writer.tag(5, WireType.LengthDelimited).string(message.msg);
212
+ /* string content = 6; */
213
+ if (message.content !== "")
214
+ writer.tag(6, WireType.LengthDelimited).string(message.content);
215
+ /* map<string, string> data = 7; */
216
+ for (let k of globalThis.Object.keys(message.data))
217
+ writer.tag(7, WireType.LengthDelimited).fork().tag(1, WireType.LengthDelimited).string(k).tag(2, WireType.LengthDelimited).string(message.data[k]).join();
218
+ let u = options.writeUnknownFields;
219
+ if (u !== false)
220
+ (u == true ? UnknownFieldHandler.onWrite : u)(this.typeName, message, writer);
221
+ return writer;
222
+ }
223
+ }
224
+ /**
225
+ * @generated MessageType for protobuf message server.ServDirective
226
+ */
227
+ export const ServDirective = new ServDirective$Type();