@mentra/sdk 2.1.24 → 2.1.26

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 (42) hide show
  1. package/dist/app/server/index.d.ts +2 -0
  2. package/dist/app/server/index.d.ts.map +1 -1
  3. package/dist/app/server/index.js +43 -21
  4. package/dist/app/session/dashboard.d.ts +7 -7
  5. package/dist/app/session/dashboard.d.ts.map +1 -1
  6. package/dist/app/session/dashboard.js +12 -12
  7. package/dist/app/session/events.d.ts.map +1 -1
  8. package/dist/app/session/index.d.ts +1 -1
  9. package/dist/app/session/index.d.ts.map +1 -1
  10. package/dist/app/session/index.js +9 -6
  11. package/dist/app/session/modules/camera.d.ts +17 -0
  12. package/dist/app/session/modules/camera.d.ts.map +1 -1
  13. package/dist/app/session/modules/camera.js +23 -0
  14. package/dist/index.d.ts +2 -3
  15. package/dist/index.d.ts.map +1 -1
  16. package/dist/index.js +18 -15
  17. package/dist/types/enums.d.ts +0 -20
  18. package/dist/types/enums.d.ts.map +1 -1
  19. package/dist/types/enums.js +2 -25
  20. package/dist/types/index.d.ts +0 -1
  21. package/dist/types/index.d.ts.map +1 -1
  22. package/dist/types/index.js +0 -2
  23. package/dist/types/layouts.d.ts +3 -3
  24. package/dist/types/layouts.d.ts.map +1 -1
  25. package/dist/types/message-types.d.ts +1 -1
  26. package/dist/types/message-types.d.ts.map +1 -1
  27. package/dist/types/message-types.js +8 -13
  28. package/dist/types/messages/base.d.ts.map +1 -1
  29. package/dist/types/messages/cloud-to-app.d.ts.map +1 -1
  30. package/dist/types/messages/cloud-to-glasses.d.ts +0 -7
  31. package/dist/types/messages/cloud-to-glasses.d.ts.map +1 -1
  32. package/dist/types/messages/glasses-to-cloud.d.ts +90 -8
  33. package/dist/types/messages/glasses-to-cloud.d.ts.map +1 -1
  34. package/dist/types/messages/glasses-to-cloud.js +44 -1
  35. package/dist/types/models.d.ts.map +1 -1
  36. package/dist/types/webhooks.d.ts +4 -51
  37. package/dist/types/webhooks.d.ts.map +1 -1
  38. package/dist/types/webhooks.js +0 -27
  39. package/package.json +1 -1
  40. package/dist/types/user-session.d.ts +0 -73
  41. package/dist/types/user-session.d.ts.map +0 -1
  42. package/dist/types/user-session.js +0 -17
@@ -5,13 +5,7 @@ export declare enum WebhookRequestType {
5
5
  /** Request to start a App session */
6
6
  SESSION_REQUEST = "session_request",
7
7
  /** Request to stop a App session */
8
- STOP_REQUEST = "stop_request",
9
- /** Server registration confirmation */
10
- SERVER_REGISTRATION = "server_registration",
11
- /** Server heartbeat response */
12
- SERVER_HEARTBEAT = "server_heartbeat",
13
- /** Session recovery request */
14
- SESSION_RECOVERY = "session_recovery"
8
+ STOP_REQUEST = "stop_request"
15
9
  }
16
10
  /**
17
11
  * Base interface for all webhook requests
@@ -43,46 +37,17 @@ export interface SessionWebhookRequest extends BaseWebhookRequest {
43
37
  */
44
38
  export interface StopWebhookRequest extends BaseWebhookRequest {
45
39
  type: WebhookRequestType.STOP_REQUEST;
46
- reason: 'user_disabled' | 'system_stop' | 'error';
47
- }
48
- /**
49
- * Server registration webhook
50
- *
51
- * Sent to a App when its server registration is confirmed
52
- */
53
- export interface ServerRegistrationWebhookRequest extends BaseWebhookRequest {
54
- type: WebhookRequestType.SERVER_REGISTRATION;
55
- registrationId: string;
56
- packageName: string;
57
- serverUrls: string[];
58
- }
59
- /**
60
- * Session recovery webhook
61
- *
62
- * Sent to a App when the system is trying to recover a session after server restart
63
- */
64
- export interface SessionRecoveryWebhookRequest extends BaseWebhookRequest {
65
- type: WebhookRequestType.SESSION_RECOVERY;
66
- mentraOSWebsocketUrl: string;
67
- }
68
- /**
69
- * Server heartbeat webhook
70
- *
71
- * Sent to a App to check its health status
72
- */
73
- export interface ServerHeartbeatWebhookRequest extends BaseWebhookRequest {
74
- type: WebhookRequestType.SERVER_HEARTBEAT;
75
- registrationId: string;
40
+ reason: "user_disabled" | "system_stop" | "error";
76
41
  }
77
42
  /**
78
43
  * Union type for all webhook requests
79
44
  */
80
- export type WebhookRequest = SessionWebhookRequest | StopWebhookRequest | ServerRegistrationWebhookRequest | SessionRecoveryWebhookRequest | ServerHeartbeatWebhookRequest;
45
+ export type WebhookRequest = SessionWebhookRequest | StopWebhookRequest;
81
46
  /**
82
47
  * Response to a webhook request
83
48
  */
84
49
  export interface WebhookResponse {
85
- status: 'success' | 'error';
50
+ status: "success" | "error";
86
51
  message?: string;
87
52
  }
88
53
  /**
@@ -93,16 +58,4 @@ export declare function isSessionWebhookRequest(request: WebhookRequest): reques
93
58
  * Type guard to check if a webhook request is a stop request
94
59
  */
95
60
  export declare function isStopWebhookRequest(request: WebhookRequest): request is StopWebhookRequest;
96
- /**
97
- * Type guard to check if a webhook request is a server registration request
98
- */
99
- export declare function isServerRegistrationWebhookRequest(request: WebhookRequest): request is ServerRegistrationWebhookRequest;
100
- /**
101
- * Type guard to check if a webhook request is a session recovery request
102
- */
103
- export declare function isSessionRecoveryWebhookRequest(request: WebhookRequest): request is SessionRecoveryWebhookRequest;
104
- /**
105
- * Type guard to check if a webhook request is a server heartbeat request
106
- */
107
- export declare function isServerHeartbeatWebhookRequest(request: WebhookRequest): request is ServerHeartbeatWebhookRequest;
108
61
  //# sourceMappingURL=webhooks.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"webhooks.d.ts","sourceRoot":"","sources":["../../src/types/webhooks.ts"],"names":[],"mappings":"AAEA;;GAEG;AACH,oBAAY,kBAAkB;IAC5B,qCAAqC;IACrC,eAAe,oBAAoB;IAEnC,oCAAoC;IACpC,YAAY,iBAAiB;IAE7B,uCAAuC;IACvC,mBAAmB,wBAAwB;IAE3C,gCAAgC;IAChC,gBAAgB,qBAAqB;IAErC,+BAA+B;IAC/B,gBAAgB,qBAAqB;CACtC;AAEC;;GAEG;AACH,MAAM,WAAW,kBAAkB;IACjC,8BAA8B;IAC9B,IAAI,EAAE,kBAAkB,CAAC;IAEzB,iCAAiC;IACjC,SAAS,EAAE,MAAM,CAAC;IAElB,0CAA0C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EG;AACH,MAAM,WAAW,eAAe;IAC9B,MAAM,EAAE,SAAS,GAAG,OAAO,CAAC;IAC5B,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,cAAc,GACtB,OAAO,IAAI,qBAAqB,CAElC;AAED;;GAEG;AACH,wBAAgB,oBAAoB,CAClC,OAAO,EAAE,cAAc,GACtB,OAAO,IAAI,kBAAkB,CAE/B"}
@@ -4,9 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.WebhookRequestType = void 0;
5
5
  exports.isSessionWebhookRequest = isSessionWebhookRequest;
6
6
  exports.isStopWebhookRequest = isStopWebhookRequest;
7
- exports.isServerRegistrationWebhookRequest = isServerRegistrationWebhookRequest;
8
- exports.isSessionRecoveryWebhookRequest = isSessionRecoveryWebhookRequest;
9
- exports.isServerHeartbeatWebhookRequest = isServerHeartbeatWebhookRequest;
10
7
  /**
11
8
  * Types of webhook requests that can be sent to Apps
12
9
  */
@@ -16,12 +13,6 @@ var WebhookRequestType;
16
13
  WebhookRequestType["SESSION_REQUEST"] = "session_request";
17
14
  /** Request to stop a App session */
18
15
  WebhookRequestType["STOP_REQUEST"] = "stop_request";
19
- /** Server registration confirmation */
20
- WebhookRequestType["SERVER_REGISTRATION"] = "server_registration";
21
- /** Server heartbeat response */
22
- WebhookRequestType["SERVER_HEARTBEAT"] = "server_heartbeat";
23
- /** Session recovery request */
24
- WebhookRequestType["SESSION_RECOVERY"] = "session_recovery";
25
16
  })(WebhookRequestType || (exports.WebhookRequestType = WebhookRequestType = {}));
26
17
  /**
27
18
  * Type guard to check if a webhook request is a session request
@@ -35,21 +26,3 @@ function isSessionWebhookRequest(request) {
35
26
  function isStopWebhookRequest(request) {
36
27
  return request.type === WebhookRequestType.STOP_REQUEST;
37
28
  }
38
- /**
39
- * Type guard to check if a webhook request is a server registration request
40
- */
41
- function isServerRegistrationWebhookRequest(request) {
42
- return request.type === WebhookRequestType.SERVER_REGISTRATION;
43
- }
44
- /**
45
- * Type guard to check if a webhook request is a session recovery request
46
- */
47
- function isSessionRecoveryWebhookRequest(request) {
48
- return request.type === WebhookRequestType.SESSION_RECOVERY;
49
- }
50
- /**
51
- * Type guard to check if a webhook request is a server heartbeat request
52
- */
53
- function isServerHeartbeatWebhookRequest(request) {
54
- return request.type === WebhookRequestType.SERVER_HEARTBEAT;
55
- }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mentra/sdk",
3
- "version": "2.1.24",
3
+ "version": "2.1.26",
4
4
  "description": "Build apps for MentraOS smartglasses. This SDK provides everything you need to create real-time smartglasses applications.",
5
5
  "source": "src/index.ts",
6
6
  "main": "dist/index.js",
@@ -1,73 +0,0 @@
1
- import { WebSocket } from "ws";
2
- import { AppI, TranscriptI } from "./models";
3
- import { DisplayRequest } from "./layouts";
4
- import { Transform } from "stream";
5
- import { ConversationTranscriber, PushAudioInputStream } from "microsoft-cognitiveservices-speech-sdk";
6
- import { ExtendedStreamType } from "./streams";
7
- import pino from "pino";
8
- /**
9
- * Session for an application
10
- */
11
- /**
12
- * Audio processor configuration
13
- */
14
- export interface AudioProcessorConfig {
15
- threshold: number;
16
- ratio: number;
17
- attack: number;
18
- release: number;
19
- gainDb: number;
20
- sampleRate: number;
21
- channels: number;
22
- }
23
- /**
24
- * Audio processor interface
25
- */
26
- export interface AudioProcessorI extends Transform {
27
- }
28
- /**
29
- * The display manager interface
30
- */
31
- export interface DisplayManagerI {
32
- handleDisplayEvent(displayRequest: DisplayRequest, userSession: UserSession): boolean;
33
- handleAppStart(packageName: string, userSession: UserSession): void;
34
- handleAppStop(packageName: string, userSession: UserSession): void;
35
- }
36
- /**
37
- * Currently active display
38
- */
39
- export interface ActiveDisplay {
40
- displayRequest: DisplayRequest;
41
- startedAt: Date;
42
- expiresAt?: Date;
43
- }
44
- /**
45
- * User session with glasses client
46
- */
47
- export interface UserSession {
48
- sessionId: string;
49
- userId: string;
50
- startTime: Date;
51
- disconnectedAt: Date | null;
52
- logger: pino.Logger;
53
- installedApps: AppI[];
54
- activeAppSessions: string[];
55
- loadingApps: Set<string>;
56
- appSubscriptions: Map<string, ExtendedStreamType[]> | object;
57
- appConnections: Map<string, WebSocket>;
58
- websocket: WebSocket;
59
- transcript: TranscriptI;
60
- pushStream?: PushAudioInputStream;
61
- recognizer?: ConversationTranscriber;
62
- isTranscribing: boolean;
63
- lastAudioTimestamp?: number;
64
- isGracefullyClosing?: boolean;
65
- bufferedAudio: ArrayBufferLike[];
66
- audioProcessor?: AudioProcessorI;
67
- isAudioProcessing?: boolean;
68
- whatToStream: ExtendedStreamType[];
69
- }
70
- /**
71
- * App session within a user session
72
- */
73
- //# sourceMappingURL=user-session.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"user-session.d.ts","sourceRoot":"","sources":["../../src/types/user-session.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAC/B,OAAO,EAAE,IAAI,EAAe,WAAW,EAAE,MAAM,UAAU,CAAC;AAE1D,OAAO,EAAE,cAAc,EAAU,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,SAAS,EAAE,MAAM,QAAQ,CAAC;AACnC,OAAO,EACL,uBAAuB,EACvB,oBAAoB,EACrB,MAAM,wCAAwC,CAAC;AAChD,OAAO,EAAE,kBAAkB,EAAc,MAAM,WAAW,CAAC;AAE3D,OAAO,IAAI,MAAM,MAAM,CAAC;AAExB;;GAEG;AAkBH;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,MAAM,CAAC;IAClB,KAAK,EAAE,MAAM,CAAC;IACd,MAAM,EAAE,MAAM,CAAC;IACf,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB;AAED;;GAEG;AACH,MAAM,WAAW,eAAgB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eAAe,CAAC;IACjC,iBAAiB,CAAC,EAAE,OAAO,CAAC;IAG5B,YAAY,EAAE,kBAAkB,EAAE,CAAC;CACpC;AAED;;GAEG"}
@@ -1,17 +0,0 @@
1
- "use strict";
2
- // src/sessions.ts - Session-related interfaces
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- /**
5
- * App session within a user session
6
- */
7
- // This is not actually used anywhere so i commented it out.
8
- // export interface AppSession {
9
- // packageName: string;
10
- // userId: string;
11
- // subscriptions: StreamType[];
12
- // settings: AppSettings;
13
- // websocket?: WebSocket;
14
- // state: AppState;
15
- // startTime: Date;
16
- // lastActiveTime: Date;
17
- // }