@m1kad0/hannah-proto 0.3.7 → 0.3.9

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.
@@ -0,0 +1,54 @@
1
+ import { BinaryReader, BinaryWriter } from "@bufbuild/protobuf/wire";
2
+ export declare const protobufPackage = "hannah";
3
+ /** Sent by an automation service (e.g. telegram_autoresponder) over the AutomationConnect stream. */
4
+ export interface AutomationMessage {
5
+ /** sent once, right after connecting */
6
+ register?: AutomationRegister | undefined;
7
+ }
8
+ /** Identifies which automation this connection represents. */
9
+ export interface AutomationRegister {
10
+ /** e.g. "telegram_autoresponder" */
11
+ automation: string;
12
+ }
13
+ /** Sent by Hannah Core over the AutomationConnect stream. */
14
+ export interface AutomationCommand {
15
+ /** sent once, right after register */
16
+ snapshot?: AutomationSnapshot | undefined;
17
+ /** live delta */
18
+ stateChanged?: AutomationStateChanged | undefined;
19
+ }
20
+ /**
21
+ * Full list of users with the registered automation currently enabled.
22
+ * Sent once per connection, right after AutomationRegister — the recovery
23
+ * mechanism for state changes that happened while the service was offline.
24
+ */
25
+ export interface AutomationSnapshot {
26
+ userIds: number[];
27
+ }
28
+ /** A single user's enabled/disabled state changed for the registered automation. */
29
+ export interface AutomationStateChanged {
30
+ userId: number;
31
+ enabled: boolean;
32
+ }
33
+ export declare const AutomationMessage: MessageFns<AutomationMessage>;
34
+ export declare const AutomationRegister: MessageFns<AutomationRegister>;
35
+ export declare const AutomationCommand: MessageFns<AutomationCommand>;
36
+ export declare const AutomationSnapshot: MessageFns<AutomationSnapshot>;
37
+ export declare const AutomationStateChanged: MessageFns<AutomationStateChanged>;
38
+ type Builtin = Date | Function | Uint8Array | string | number | boolean | bigint | undefined;
39
+ export type DeepPartial<T> = T extends bigint ? string | number | bigint : T extends Builtin ? T : T extends globalThis.Array<infer U> ? globalThis.Array<DeepPartial<U>> : T extends ReadonlyArray<infer U> ? ReadonlyArray<DeepPartial<U>> : T extends {} ? {
40
+ [K in keyof T]?: DeepPartial<T[K]>;
41
+ } : Partial<T>;
42
+ type KeysOfUnion<T> = T extends T ? keyof T : never;
43
+ export type Exact<P, I extends P> = P extends Builtin ? P : P & {
44
+ [K in keyof P]: Exact<P[K], I[K]>;
45
+ } & {
46
+ [K in Exclude<keyof I, KeysOfUnion<P>>]: never;
47
+ };
48
+ export interface MessageFns<T> {
49
+ encode(message: T, writer?: BinaryWriter): BinaryWriter;
50
+ decode(input: BinaryReader | Uint8Array, length?: number): T;
51
+ create<I extends Exact<DeepPartial<T>, I>>(base?: I): T;
52
+ fromPartial<I extends Exact<DeepPartial<T>, I>>(object: I): T;
53
+ }
54
+ export {};
@@ -0,0 +1,253 @@
1
+ "use strict";
2
+ // Code generated by protoc-gen-ts_proto. DO NOT EDIT.
3
+ // versions:
4
+ // protoc-gen-ts_proto v2.12.0
5
+ // protoc unknown
6
+ // source: automation.proto
7
+ Object.defineProperty(exports, "__esModule", { value: true });
8
+ exports.AutomationStateChanged = exports.AutomationSnapshot = exports.AutomationCommand = exports.AutomationRegister = exports.AutomationMessage = exports.protobufPackage = void 0;
9
+ /* eslint-disable */
10
+ const wire_1 = require("@bufbuild/protobuf/wire");
11
+ exports.protobufPackage = "hannah";
12
+ function createBaseAutomationMessage() {
13
+ return { register: undefined };
14
+ }
15
+ exports.AutomationMessage = {
16
+ encode(message, writer = new wire_1.BinaryWriter()) {
17
+ if (message.register !== undefined) {
18
+ exports.AutomationRegister.encode(message.register, writer.uint32(10).fork()).join();
19
+ }
20
+ return writer;
21
+ },
22
+ decode(input, length) {
23
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
24
+ const end = length === undefined ? reader.len : reader.pos + length;
25
+ const message = createBaseAutomationMessage();
26
+ while (reader.pos < end) {
27
+ const tag = reader.uint32();
28
+ switch (tag >>> 3) {
29
+ case 1: {
30
+ if (tag !== 10) {
31
+ break;
32
+ }
33
+ message.register = exports.AutomationRegister.decode(reader, reader.uint32());
34
+ continue;
35
+ }
36
+ }
37
+ if ((tag & 7) === 4 || tag === 0) {
38
+ break;
39
+ }
40
+ reader.skip(tag & 7);
41
+ }
42
+ return message;
43
+ },
44
+ create(base) {
45
+ return exports.AutomationMessage.fromPartial(base ?? {});
46
+ },
47
+ fromPartial(object) {
48
+ const message = createBaseAutomationMessage();
49
+ message.register = (object.register !== undefined && object.register !== null)
50
+ ? exports.AutomationRegister.fromPartial(object.register)
51
+ : undefined;
52
+ return message;
53
+ },
54
+ };
55
+ function createBaseAutomationRegister() {
56
+ return { automation: "" };
57
+ }
58
+ exports.AutomationRegister = {
59
+ encode(message, writer = new wire_1.BinaryWriter()) {
60
+ if (message.automation !== "") {
61
+ writer.uint32(10).string(message.automation);
62
+ }
63
+ return writer;
64
+ },
65
+ decode(input, length) {
66
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
67
+ const end = length === undefined ? reader.len : reader.pos + length;
68
+ const message = createBaseAutomationRegister();
69
+ while (reader.pos < end) {
70
+ const tag = reader.uint32();
71
+ switch (tag >>> 3) {
72
+ case 1: {
73
+ if (tag !== 10) {
74
+ break;
75
+ }
76
+ message.automation = reader.string();
77
+ continue;
78
+ }
79
+ }
80
+ if ((tag & 7) === 4 || tag === 0) {
81
+ break;
82
+ }
83
+ reader.skip(tag & 7);
84
+ }
85
+ return message;
86
+ },
87
+ create(base) {
88
+ return exports.AutomationRegister.fromPartial(base ?? {});
89
+ },
90
+ fromPartial(object) {
91
+ const message = createBaseAutomationRegister();
92
+ message.automation = object.automation ?? "";
93
+ return message;
94
+ },
95
+ };
96
+ function createBaseAutomationCommand() {
97
+ return { snapshot: undefined, stateChanged: undefined };
98
+ }
99
+ exports.AutomationCommand = {
100
+ encode(message, writer = new wire_1.BinaryWriter()) {
101
+ if (message.snapshot !== undefined) {
102
+ exports.AutomationSnapshot.encode(message.snapshot, writer.uint32(10).fork()).join();
103
+ }
104
+ if (message.stateChanged !== undefined) {
105
+ exports.AutomationStateChanged.encode(message.stateChanged, writer.uint32(18).fork()).join();
106
+ }
107
+ return writer;
108
+ },
109
+ decode(input, length) {
110
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
111
+ const end = length === undefined ? reader.len : reader.pos + length;
112
+ const message = createBaseAutomationCommand();
113
+ while (reader.pos < end) {
114
+ const tag = reader.uint32();
115
+ switch (tag >>> 3) {
116
+ case 1: {
117
+ if (tag !== 10) {
118
+ break;
119
+ }
120
+ message.snapshot = exports.AutomationSnapshot.decode(reader, reader.uint32());
121
+ continue;
122
+ }
123
+ case 2: {
124
+ if (tag !== 18) {
125
+ break;
126
+ }
127
+ message.stateChanged = exports.AutomationStateChanged.decode(reader, reader.uint32());
128
+ continue;
129
+ }
130
+ }
131
+ if ((tag & 7) === 4 || tag === 0) {
132
+ break;
133
+ }
134
+ reader.skip(tag & 7);
135
+ }
136
+ return message;
137
+ },
138
+ create(base) {
139
+ return exports.AutomationCommand.fromPartial(base ?? {});
140
+ },
141
+ fromPartial(object) {
142
+ const message = createBaseAutomationCommand();
143
+ message.snapshot = (object.snapshot !== undefined && object.snapshot !== null)
144
+ ? exports.AutomationSnapshot.fromPartial(object.snapshot)
145
+ : undefined;
146
+ message.stateChanged = (object.stateChanged !== undefined && object.stateChanged !== null)
147
+ ? exports.AutomationStateChanged.fromPartial(object.stateChanged)
148
+ : undefined;
149
+ return message;
150
+ },
151
+ };
152
+ function createBaseAutomationSnapshot() {
153
+ return { userIds: [] };
154
+ }
155
+ exports.AutomationSnapshot = {
156
+ encode(message, writer = new wire_1.BinaryWriter()) {
157
+ writer.uint32(10).fork();
158
+ for (const v of message.userIds) {
159
+ writer.int32(v);
160
+ }
161
+ writer.join();
162
+ return writer;
163
+ },
164
+ decode(input, length) {
165
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
166
+ const end = length === undefined ? reader.len : reader.pos + length;
167
+ const message = createBaseAutomationSnapshot();
168
+ while (reader.pos < end) {
169
+ const tag = reader.uint32();
170
+ switch (tag >>> 3) {
171
+ case 1: {
172
+ if (tag === 8) {
173
+ message.userIds.push(reader.int32());
174
+ continue;
175
+ }
176
+ if (tag === 10) {
177
+ const end2 = reader.uint32() + reader.pos;
178
+ while (reader.pos < end2) {
179
+ message.userIds.push(reader.int32());
180
+ }
181
+ continue;
182
+ }
183
+ break;
184
+ }
185
+ }
186
+ if ((tag & 7) === 4 || tag === 0) {
187
+ break;
188
+ }
189
+ reader.skip(tag & 7);
190
+ }
191
+ return message;
192
+ },
193
+ create(base) {
194
+ return exports.AutomationSnapshot.fromPartial(base ?? {});
195
+ },
196
+ fromPartial(object) {
197
+ const message = createBaseAutomationSnapshot();
198
+ message.userIds = object.userIds?.map((e) => e) || [];
199
+ return message;
200
+ },
201
+ };
202
+ function createBaseAutomationStateChanged() {
203
+ return { userId: 0, enabled: false };
204
+ }
205
+ exports.AutomationStateChanged = {
206
+ encode(message, writer = new wire_1.BinaryWriter()) {
207
+ if (message.userId !== 0) {
208
+ writer.uint32(8).int32(message.userId);
209
+ }
210
+ if (message.enabled !== false) {
211
+ writer.uint32(16).bool(message.enabled);
212
+ }
213
+ return writer;
214
+ },
215
+ decode(input, length) {
216
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
217
+ const end = length === undefined ? reader.len : reader.pos + length;
218
+ const message = createBaseAutomationStateChanged();
219
+ while (reader.pos < end) {
220
+ const tag = reader.uint32();
221
+ switch (tag >>> 3) {
222
+ case 1: {
223
+ if (tag !== 8) {
224
+ break;
225
+ }
226
+ message.userId = reader.int32();
227
+ continue;
228
+ }
229
+ case 2: {
230
+ if (tag !== 16) {
231
+ break;
232
+ }
233
+ message.enabled = reader.bool();
234
+ continue;
235
+ }
236
+ }
237
+ if ((tag & 7) === 4 || tag === 0) {
238
+ break;
239
+ }
240
+ reader.skip(tag & 7);
241
+ }
242
+ return message;
243
+ },
244
+ create(base) {
245
+ return exports.AutomationStateChanged.fromPartial(base ?? {});
246
+ },
247
+ fromPartial(object) {
248
+ const message = createBaseAutomationStateChanged();
249
+ message.userId = object.userId ?? 0;
250
+ message.enabled = object.enabled ?? false;
251
+ return message;
252
+ },
253
+ };
package/dist/hannah.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  import { type CallOptions, type ChannelCredentials, Client, type ClientDuplexStream, type ClientOptions, type ClientReadableStream, type ClientUnaryCall, type handleBidiStreamingCall, type handleServerStreamingCall, type handleUnaryCall, type Metadata, type ServiceError, type UntypedServiceImplementation } from "@grpc/grpc-js";
2
2
  import { AgentCommand, AgentMessage, AgentNotification } from "./agent";
3
+ import { AutomationCommand, AutomationMessage } from "./automation";
3
4
  import { CarStateResponse, GetAllCarStatesResponse } from "./car_state";
4
5
  import { AnnounceRequest, CreateAlarmRequest, CreateAlarmResponse, CreateBleTagRequest, CreateBleTagResponse, CreateCarRequest, CreateCarResponse, CreateGroupRequest, CreateRoutineRequest, CreateRoutineResponse, CreateTriggerRequest, DeleteAlarmRequest, DeleteBleTagRequest, DeleteCarRequest, DeleteGroupRequest, DeleteRoutineRequest, DeleteSatelliteRequest, DeleteTriggerRequest, GetAlarmsResponse, GetBleTagsResponse, GetCarsResponse, GetGroupsResponse, GetRoomsResponse, GetRoutinesResponse, GetSatellitesResponse, GetSettingsResponse, GetTriggersResponse, SetGroupRoomsRequest, SetSatelliteDisplayNameRequest, SetSatelliteOwnerRequest, SetSatelliteRoomRequest, SubmitTextRequest, SubmitTextResponse, SubmitVoiceRequest, SubmitVoiceResponse, UpdateAlarmRequest, UpdateBleTagRequest, UpdateCarRequest, UpdateConfigRequest, UpdateGroupRequest, UpdateRoutineRequest, UpdateTriggerRequest } from "./control";
5
6
  import { ControlDeviceRequest, GetDevicesResponse } from "./device_control_menu";
@@ -10,7 +11,7 @@ import { Empty, StatusResponse } from "./shared";
10
11
  import { EnrollVoiceprintRequest } from "./speaker_enrollment";
11
12
  import { DeleteTimerRequest, GetTimersRequest, GetTimersResponse } from "./timer_admin";
12
13
  import { TimerCommand, TimerMessage } from "./timer_service";
13
- import { CreateUserRequest, CreateUserResponse, DeleteUserRequest, GetResidentsResponse, GetUserRequest, GetUsersRequest, GetUsersResponse, LinkAccountRequest, LoginRequest, SetSystemMessagesRequest, SetTrustLevelRequest, UnlinkAccountRequest, UpdateUserRequest, UserResponse } from "./user_registry";
14
+ import { CreateUserRequest, CreateUserResponse, DeleteUserRequest, GetResidentsResponse, GetUserRequest, GetUsersRequest, GetUsersResponse, LinkAccountRequest, LoginRequest, SetAutomationRequest, SetSystemMessagesRequest, SetTrustLevelRequest, UnlinkAccountRequest, UpdateUserRequest, UserResponse } from "./user_registry";
14
15
  import { SatelliteAudioChunk, SatelliteCaptureRequest, SatelliteCaptureResponse, TriggerPlinkRequest } from "./wakeword_capture";
15
16
  export declare const protobufPackage = "hannah";
16
17
  export type HannahServiceService = typeof HannahServiceService;
@@ -70,6 +71,19 @@ export declare const HannahServiceService: {
70
71
  readonly responseSerialize: (value: StatusResponse) => Buffer;
71
72
  readonly responseDeserialize: (value: Buffer) => StatusResponse;
72
73
  };
74
+ /**
75
+ * Enable/disable an automation service (e.g. "telegram_autoresponder") for a user.
76
+ * Pushes a live update to any connected AutomationConnect stream registered for it.
77
+ */
78
+ readonly setAutomation: {
79
+ readonly path: "/hannah.HannahService/SetAutomation";
80
+ readonly requestStream: false;
81
+ readonly responseStream: false;
82
+ readonly requestSerialize: (value: SetAutomationRequest) => Buffer;
83
+ readonly requestDeserialize: (value: Buffer) => SetAutomationRequest;
84
+ readonly responseSerialize: (value: StatusResponse) => Buffer;
85
+ readonly responseDeserialize: (value: Buffer) => StatusResponse;
86
+ };
73
87
  readonly login: {
74
88
  readonly path: "/hannah.HannahService/Login";
75
89
  readonly requestStream: false;
@@ -725,6 +739,24 @@ export declare const HannahServiceService: {
725
739
  readonly responseSerialize: (value: AgentCommand) => Buffer;
726
740
  readonly responseDeserialize: (value: Buffer) => AgentCommand;
727
741
  };
742
+ /**
743
+ * --- Automations ---
744
+ * Bidirectional stream for external automation services (e.g. telegram_autoresponder).
745
+ * The service sends an AutomationRegister identifying itself, then Hannah replies with
746
+ * an AutomationSnapshot (all users with it currently enabled) followed by live
747
+ * AutomationStateChanged deltas as users toggle it via SetAutomation/voice.
748
+ * Chosen over SubscribeEvents so a reconnecting service always gets a fresh snapshot
749
+ * instead of missing state changes that happened while it was offline.
750
+ */
751
+ readonly automationConnect: {
752
+ readonly path: "/hannah.HannahService/AutomationConnect";
753
+ readonly requestStream: true;
754
+ readonly responseStream: true;
755
+ readonly requestSerialize: (value: AutomationMessage) => Buffer;
756
+ readonly requestDeserialize: (value: Buffer) => AutomationMessage;
757
+ readonly responseSerialize: (value: AutomationCommand) => Buffer;
758
+ readonly responseDeserialize: (value: Buffer) => AutomationCommand;
759
+ };
728
760
  };
729
761
  export interface HannahServiceServer extends UntypedServiceImplementation {
730
762
  /** --- User Registry --- */
@@ -734,6 +766,11 @@ export interface HannahServiceServer extends UntypedServiceImplementation {
734
766
  unlinkAccount: handleUnaryCall<UnlinkAccountRequest, StatusResponse>;
735
767
  setTrustLevel: handleUnaryCall<SetTrustLevelRequest, StatusResponse>;
736
768
  setSystemMessages: handleUnaryCall<SetSystemMessagesRequest, StatusResponse>;
769
+ /**
770
+ * Enable/disable an automation service (e.g. "telegram_autoresponder") for a user.
771
+ * Pushes a live update to any connected AutomationConnect stream registered for it.
772
+ */
773
+ setAutomation: handleUnaryCall<SetAutomationRequest, StatusResponse>;
737
774
  login: handleUnaryCall<LoginRequest, UserResponse>;
738
775
  /** --- User-Verwaltung (Admin-UI, #27 Phase 6) --- */
739
776
  createUser: handleUnaryCall<CreateUserRequest, CreateUserResponse>;
@@ -893,6 +930,16 @@ export interface HannahServiceServer extends UntypedServiceImplementation {
893
930
  * The adapter initiates the connection; if Hannah restarts, the adapter reconnects.
894
931
  */
895
932
  agentConnect: handleBidiStreamingCall<AgentMessage, AgentCommand>;
933
+ /**
934
+ * --- Automations ---
935
+ * Bidirectional stream for external automation services (e.g. telegram_autoresponder).
936
+ * The service sends an AutomationRegister identifying itself, then Hannah replies with
937
+ * an AutomationSnapshot (all users with it currently enabled) followed by live
938
+ * AutomationStateChanged deltas as users toggle it via SetAutomation/voice.
939
+ * Chosen over SubscribeEvents so a reconnecting service always gets a fresh snapshot
940
+ * instead of missing state changes that happened while it was offline.
941
+ */
942
+ automationConnect: handleBidiStreamingCall<AutomationMessage, AutomationCommand>;
896
943
  }
897
944
  export interface HannahServiceClient extends Client {
898
945
  /** --- User Registry --- */
@@ -914,6 +961,13 @@ export interface HannahServiceClient extends Client {
914
961
  setSystemMessages(request: SetSystemMessagesRequest, callback: (error: ServiceError | null, response: StatusResponse) => void): ClientUnaryCall;
915
962
  setSystemMessages(request: SetSystemMessagesRequest, metadata: Metadata, callback: (error: ServiceError | null, response: StatusResponse) => void): ClientUnaryCall;
916
963
  setSystemMessages(request: SetSystemMessagesRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: StatusResponse) => void): ClientUnaryCall;
964
+ /**
965
+ * Enable/disable an automation service (e.g. "telegram_autoresponder") for a user.
966
+ * Pushes a live update to any connected AutomationConnect stream registered for it.
967
+ */
968
+ setAutomation(request: SetAutomationRequest, callback: (error: ServiceError | null, response: StatusResponse) => void): ClientUnaryCall;
969
+ setAutomation(request: SetAutomationRequest, metadata: Metadata, callback: (error: ServiceError | null, response: StatusResponse) => void): ClientUnaryCall;
970
+ setAutomation(request: SetAutomationRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: StatusResponse) => void): ClientUnaryCall;
917
971
  login(request: LoginRequest, callback: (error: ServiceError | null, response: UserResponse) => void): ClientUnaryCall;
918
972
  login(request: LoginRequest, metadata: Metadata, callback: (error: ServiceError | null, response: UserResponse) => void): ClientUnaryCall;
919
973
  login(request: LoginRequest, metadata: Metadata, options: Partial<CallOptions>, callback: (error: ServiceError | null, response: UserResponse) => void): ClientUnaryCall;
@@ -1195,6 +1249,18 @@ export interface HannahServiceClient extends Client {
1195
1249
  agentConnect(): ClientDuplexStream<AgentMessage, AgentCommand>;
1196
1250
  agentConnect(options: Partial<CallOptions>): ClientDuplexStream<AgentMessage, AgentCommand>;
1197
1251
  agentConnect(metadata: Metadata, options?: Partial<CallOptions>): ClientDuplexStream<AgentMessage, AgentCommand>;
1252
+ /**
1253
+ * --- Automations ---
1254
+ * Bidirectional stream for external automation services (e.g. telegram_autoresponder).
1255
+ * The service sends an AutomationRegister identifying itself, then Hannah replies with
1256
+ * an AutomationSnapshot (all users with it currently enabled) followed by live
1257
+ * AutomationStateChanged deltas as users toggle it via SetAutomation/voice.
1258
+ * Chosen over SubscribeEvents so a reconnecting service always gets a fresh snapshot
1259
+ * instead of missing state changes that happened while it was offline.
1260
+ */
1261
+ automationConnect(): ClientDuplexStream<AutomationMessage, AutomationCommand>;
1262
+ automationConnect(options: Partial<CallOptions>): ClientDuplexStream<AutomationMessage, AutomationCommand>;
1263
+ automationConnect(metadata: Metadata, options?: Partial<CallOptions>): ClientDuplexStream<AutomationMessage, AutomationCommand>;
1198
1264
  }
1199
1265
  export declare const HannahServiceClient: {
1200
1266
  new (address: string, credentials: ChannelCredentials, options?: Partial<ClientOptions>): HannahServiceClient;
package/dist/hannah.js CHANGED
@@ -9,6 +9,7 @@ exports.HannahServiceClient = exports.HannahServiceService = exports.protobufPac
9
9
  /* eslint-disable */
10
10
  const grpc_js_1 = require("@grpc/grpc-js");
11
11
  const agent_1 = require("./agent");
12
+ const automation_1 = require("./automation");
12
13
  const car_state_1 = require("./car_state");
13
14
  const control_1 = require("./control");
14
15
  const device_control_menu_1 = require("./device_control_menu");
@@ -78,6 +79,19 @@ exports.HannahServiceService = {
78
79
  responseSerialize: (value) => Buffer.from(shared_1.StatusResponse.encode(value).finish()),
79
80
  responseDeserialize: (value) => shared_1.StatusResponse.decode(value),
80
81
  },
82
+ /**
83
+ * Enable/disable an automation service (e.g. "telegram_autoresponder") for a user.
84
+ * Pushes a live update to any connected AutomationConnect stream registered for it.
85
+ */
86
+ setAutomation: {
87
+ path: "/hannah.HannahService/SetAutomation",
88
+ requestStream: false,
89
+ responseStream: false,
90
+ requestSerialize: (value) => Buffer.from(user_registry_1.SetAutomationRequest.encode(value).finish()),
91
+ requestDeserialize: (value) => user_registry_1.SetAutomationRequest.decode(value),
92
+ responseSerialize: (value) => Buffer.from(shared_1.StatusResponse.encode(value).finish()),
93
+ responseDeserialize: (value) => shared_1.StatusResponse.decode(value),
94
+ },
81
95
  login: {
82
96
  path: "/hannah.HannahService/Login",
83
97
  requestStream: false,
@@ -733,5 +747,23 @@ exports.HannahServiceService = {
733
747
  responseSerialize: (value) => Buffer.from(agent_1.AgentCommand.encode(value).finish()),
734
748
  responseDeserialize: (value) => agent_1.AgentCommand.decode(value),
735
749
  },
750
+ /**
751
+ * --- Automations ---
752
+ * Bidirectional stream for external automation services (e.g. telegram_autoresponder).
753
+ * The service sends an AutomationRegister identifying itself, then Hannah replies with
754
+ * an AutomationSnapshot (all users with it currently enabled) followed by live
755
+ * AutomationStateChanged deltas as users toggle it via SetAutomation/voice.
756
+ * Chosen over SubscribeEvents so a reconnecting service always gets a fresh snapshot
757
+ * instead of missing state changes that happened while it was offline.
758
+ */
759
+ automationConnect: {
760
+ path: "/hannah.HannahService/AutomationConnect",
761
+ requestStream: true,
762
+ responseStream: true,
763
+ requestSerialize: (value) => Buffer.from(automation_1.AutomationMessage.encode(value).finish()),
764
+ requestDeserialize: (value) => automation_1.AutomationMessage.decode(value),
765
+ responseSerialize: (value) => Buffer.from(automation_1.AutomationCommand.encode(value).finish()),
766
+ responseDeserialize: (value) => automation_1.AutomationCommand.decode(value),
767
+ },
736
768
  };
737
769
  exports.HannahServiceClient = (0, grpc_js_1.makeGenericClientConstructor)(exports.HannahServiceService, "hannah.HannahService");
package/dist/index.d.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from './version';
2
2
  export * as agent from './agent';
3
+ export * as automation from './automation';
3
4
  export * as car_state from './car_state';
4
5
  export * as control from './control';
5
6
  export * as device_control_menu from './device_control_menu';
package/dist/index.js CHANGED
@@ -36,9 +36,10 @@ var __importStar = (this && this.__importStar) || (function () {
36
36
  };
37
37
  })();
38
38
  Object.defineProperty(exports, "__esModule", { value: true });
39
- exports.wakeword_capture = exports.user_registry = exports.timer_service = exports.timer_admin = exports.speaker_enrollment = exports.shared = exports.satellite_proxy = exports.satellite_provisioning = exports.hannah = exports.event_stream = exports.device_control_menu = exports.control = exports.car_state = exports.agent = void 0;
39
+ exports.wakeword_capture = exports.user_registry = exports.timer_service = exports.timer_admin = exports.speaker_enrollment = exports.shared = exports.satellite_proxy = exports.satellite_provisioning = exports.hannah = exports.event_stream = exports.device_control_menu = exports.control = exports.car_state = exports.automation = exports.agent = void 0;
40
40
  __exportStar(require("./version"), exports);
41
41
  exports.agent = __importStar(require("./agent"));
42
+ exports.automation = __importStar(require("./automation"));
42
43
  exports.car_state = __importStar(require("./car_state"));
43
44
  exports.control = __importStar(require("./control"));
44
45
  exports.device_control_menu = __importStar(require("./device_control_menu"));
@@ -17,6 +17,11 @@ export interface User {
17
17
  email: string;
18
18
  /** "roomie" | "guest" | "pet", #27 Phase 6 */
19
19
  type: string;
20
+ /**
21
+ * Keys of automation services (e.g. "telegram_autoresponder") currently enabled for
22
+ * this user. Presence-based: a key is only listed here when enabled, absent = disabled.
23
+ */
24
+ enabledAutomations: string[];
20
25
  }
21
26
  export interface User_LinkedAccountsEntry {
22
27
  key: string;
@@ -80,6 +85,12 @@ export interface SetSystemMessagesRequest {
80
85
  userId: number;
81
86
  enabled: boolean;
82
87
  }
88
+ export interface SetAutomationRequest {
89
+ userId: number;
90
+ /** e.g. "telegram_autoresponder" */
91
+ automation: string;
92
+ enabled: boolean;
93
+ }
83
94
  export interface CreateUserRequest {
84
95
  username: string;
85
96
  /** Klartext, wird serverseitig gehasht — gleicher akzeptierter Constraint wie LoginRequest */
@@ -131,6 +142,7 @@ export declare const LinkAccountRequest: MessageFns<LinkAccountRequest>;
131
142
  export declare const UnlinkAccountRequest: MessageFns<UnlinkAccountRequest>;
132
143
  export declare const SetTrustLevelRequest: MessageFns<SetTrustLevelRequest>;
133
144
  export declare const SetSystemMessagesRequest: MessageFns<SetSystemMessagesRequest>;
145
+ export declare const SetAutomationRequest: MessageFns<SetAutomationRequest>;
134
146
  export declare const CreateUserRequest: MessageFns<CreateUserRequest>;
135
147
  export declare const CreateUserResponse: MessageFns<CreateUserResponse>;
136
148
  export declare const UpdateUserRequest: MessageFns<UpdateUserRequest>;
@@ -5,7 +5,7 @@
5
5
  // protoc unknown
6
6
  // source: user_registry.proto
7
7
  Object.defineProperty(exports, "__esModule", { value: true });
8
- exports.GetResidentsResponse = exports.Resident = exports.DeleteUserRequest = exports.UpdateUserRequest = exports.CreateUserResponse = exports.CreateUserRequest = exports.SetSystemMessagesRequest = exports.SetTrustLevelRequest = exports.UnlinkAccountRequest = exports.LinkAccountRequest = exports.LoginRequest = exports.UserResponse = exports.LinkedAccountLookup = exports.GetUserRequest = exports.GetUsersResponse = exports.GetUsersRequest = exports.User_LinkedAccountsEntry = exports.User = exports.protobufPackage = void 0;
8
+ exports.GetResidentsResponse = exports.Resident = exports.DeleteUserRequest = exports.UpdateUserRequest = exports.CreateUserResponse = exports.CreateUserRequest = exports.SetAutomationRequest = exports.SetSystemMessagesRequest = exports.SetTrustLevelRequest = exports.UnlinkAccountRequest = exports.LinkAccountRequest = exports.LoginRequest = exports.UserResponse = exports.LinkedAccountLookup = exports.GetUserRequest = exports.GetUsersResponse = exports.GetUsersRequest = exports.User_LinkedAccountsEntry = exports.User = exports.protobufPackage = void 0;
9
9
  /* eslint-disable */
10
10
  const wire_1 = require("@bufbuild/protobuf/wire");
11
11
  exports.protobufPackage = "hannah";
@@ -20,6 +20,7 @@ function createBaseUser() {
20
20
  systemMessages: false,
21
21
  email: "",
22
22
  type: "",
23
+ enabledAutomations: [],
23
24
  };
24
25
  }
25
26
  exports.User = {
@@ -51,6 +52,9 @@ exports.User = {
51
52
  if (message.type !== "") {
52
53
  writer.uint32(74).string(message.type);
53
54
  }
55
+ for (const v of message.enabledAutomations) {
56
+ writer.uint32(82).string(v);
57
+ }
54
58
  return writer;
55
59
  },
56
60
  decode(input, length) {
@@ -126,6 +130,13 @@ exports.User = {
126
130
  message.type = reader.string();
127
131
  continue;
128
132
  }
133
+ case 10: {
134
+ if (tag !== 82) {
135
+ break;
136
+ }
137
+ message.enabledAutomations.push(reader.string());
138
+ continue;
139
+ }
129
140
  }
130
141
  if ((tag & 7) === 4 || tag === 0) {
131
142
  break;
@@ -153,6 +164,7 @@ exports.User = {
153
164
  message.systemMessages = object.systemMessages ?? false;
154
165
  message.email = object.email ?? "";
155
166
  message.type = object.type ?? "";
167
+ message.enabledAutomations = object.enabledAutomations?.map((e) => e) || [];
156
168
  return message;
157
169
  },
158
170
  };
@@ -774,6 +786,69 @@ exports.SetSystemMessagesRequest = {
774
786
  return message;
775
787
  },
776
788
  };
789
+ function createBaseSetAutomationRequest() {
790
+ return { userId: 0, automation: "", enabled: false };
791
+ }
792
+ exports.SetAutomationRequest = {
793
+ encode(message, writer = new wire_1.BinaryWriter()) {
794
+ if (message.userId !== 0) {
795
+ writer.uint32(8).int32(message.userId);
796
+ }
797
+ if (message.automation !== "") {
798
+ writer.uint32(18).string(message.automation);
799
+ }
800
+ if (message.enabled !== false) {
801
+ writer.uint32(24).bool(message.enabled);
802
+ }
803
+ return writer;
804
+ },
805
+ decode(input, length) {
806
+ const reader = input instanceof wire_1.BinaryReader ? input : new wire_1.BinaryReader(input);
807
+ const end = length === undefined ? reader.len : reader.pos + length;
808
+ const message = createBaseSetAutomationRequest();
809
+ while (reader.pos < end) {
810
+ const tag = reader.uint32();
811
+ switch (tag >>> 3) {
812
+ case 1: {
813
+ if (tag !== 8) {
814
+ break;
815
+ }
816
+ message.userId = reader.int32();
817
+ continue;
818
+ }
819
+ case 2: {
820
+ if (tag !== 18) {
821
+ break;
822
+ }
823
+ message.automation = reader.string();
824
+ continue;
825
+ }
826
+ case 3: {
827
+ if (tag !== 24) {
828
+ break;
829
+ }
830
+ message.enabled = reader.bool();
831
+ continue;
832
+ }
833
+ }
834
+ if ((tag & 7) === 4 || tag === 0) {
835
+ break;
836
+ }
837
+ reader.skip(tag & 7);
838
+ }
839
+ return message;
840
+ },
841
+ create(base) {
842
+ return exports.SetAutomationRequest.fromPartial(base ?? {});
843
+ },
844
+ fromPartial(object) {
845
+ const message = createBaseSetAutomationRequest();
846
+ message.userId = object.userId ?? 0;
847
+ message.automation = object.automation ?? "";
848
+ message.enabled = object.enabled ?? false;
849
+ return message;
850
+ },
851
+ };
777
852
  function createBaseCreateUserRequest() {
778
853
  return { username: "", password: "", email: "", displayName: "", type: "" };
779
854
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@m1kad0/hannah-proto",
3
- "version": "0.3.7",
3
+ "version": "0.3.9",
4
4
  "description": "Generated TypeScript gRPC-js client stubs for the Hannah voice assistant proto schema",
5
5
  "license": "UNLICENSED",
6
6
  "main": "dist/index.js",