@recallai/desktop-sdk 2025.3.21-bac17c323e1c541c8e37a11aa29e369f59b0dc28 → 2025.3.24-430771fa71a1136b9be5e37d541f0574ada1385d
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.
- package/desktop_sdk_macos_exe +0 -0
- package/desktop_sdk_macos_frameworks.tar +0 -0
- package/index.d.ts +14 -0
- package/index.js +71 -8
- package/package.json +6 -2
package/desktop_sdk_macos_exe
CHANGED
|
Binary file
|
|
Binary file
|
package/index.d.ts
CHANGED
|
@@ -24,10 +24,16 @@ declare module '@recallai/desktop-sdk' {
|
|
|
24
24
|
'error': ErrorEvent;
|
|
25
25
|
'media-capture-status': MediaCaptureStatusEvent;
|
|
26
26
|
'permissions-granted': PermissionsGrantedEvent;
|
|
27
|
+
'permission-status': PermissionStatusEvent;
|
|
27
28
|
'realtime-event': RealtimeEvent;
|
|
28
29
|
'shutdown': ShutdownEvent;
|
|
29
30
|
};
|
|
30
31
|
|
|
32
|
+
export type Permission =
|
|
33
|
+
| 'accessibility'
|
|
34
|
+
| 'screen-capture'
|
|
35
|
+
| 'microphone';
|
|
36
|
+
|
|
31
37
|
export function addEventListener<T extends keyof EventTypeToPayloadMap>(
|
|
32
38
|
type: T,
|
|
33
39
|
listener: (event: EventTypeToPayloadMap[T]) => void
|
|
@@ -40,6 +46,7 @@ declare module '@recallai/desktop-sdk' {
|
|
|
40
46
|
export function stopRecording(config: StopRecordingConfig): Promise<null>;
|
|
41
47
|
export function uploadRecording(config: UploadRecordingConfig): Promise<null>;
|
|
42
48
|
export function prepareDesktopAudioRecording(): Promise<string>;
|
|
49
|
+
export function requestPermission(permission: Permission): Promise<null>;
|
|
43
50
|
export function shutdown(): Promise<null>;
|
|
44
51
|
|
|
45
52
|
///
|
|
@@ -53,6 +60,8 @@ declare module '@recallai/desktop-sdk' {
|
|
|
53
60
|
|
|
54
61
|
export interface RecallAiSdkConfig {
|
|
55
62
|
api_url: string;
|
|
63
|
+
acquirePermissionsOnStartup?: Permission[];
|
|
64
|
+
restartOnError?: boolean;
|
|
56
65
|
}
|
|
57
66
|
|
|
58
67
|
export interface StartRecordingConfig {
|
|
@@ -119,6 +128,11 @@ declare module '@recallai/desktop-sdk' {
|
|
|
119
128
|
|
|
120
129
|
export interface PermissionsGrantedEvent {}
|
|
121
130
|
|
|
131
|
+
export interface PermissionStatusEvent {
|
|
132
|
+
permission: Permission;
|
|
133
|
+
granted: boolean;
|
|
134
|
+
}
|
|
135
|
+
|
|
122
136
|
export interface ErrorEvent {
|
|
123
137
|
window?: RecallAiSdkWindow;
|
|
124
138
|
type: string;
|
package/index.js
CHANGED
|
@@ -45,6 +45,41 @@ let proc;
|
|
|
45
45
|
const listeners = [];
|
|
46
46
|
const pendingCommands = {};
|
|
47
47
|
|
|
48
|
+
let lastOptions;
|
|
49
|
+
let remainingAutomaticRestarts = 10;
|
|
50
|
+
let unexpectedShutdown = false;
|
|
51
|
+
|
|
52
|
+
async function doLog(level, log) {
|
|
53
|
+
try {
|
|
54
|
+
const levelMap = {
|
|
55
|
+
"info": "log",
|
|
56
|
+
"warning": "warn",
|
|
57
|
+
"error": "error"
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
console[levelMap[level]](...log);
|
|
61
|
+
|
|
62
|
+
await sendCommand("log", {
|
|
63
|
+
log: log.join(" "),
|
|
64
|
+
level: level
|
|
65
|
+
});
|
|
66
|
+
} catch (e) {
|
|
67
|
+
//console.error("Log failed:", e.message, e.stack);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
function log(...log) {
|
|
72
|
+
doLog("info", log);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
function logWarning(...log) {
|
|
76
|
+
doLog("warning", log);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
function logError(...log) {
|
|
80
|
+
doLog("error", log);
|
|
81
|
+
}
|
|
82
|
+
|
|
48
83
|
function emitEvent(type, payload) {
|
|
49
84
|
for (const listener of listeners) {
|
|
50
85
|
if (listener.type === type)
|
|
@@ -65,12 +100,12 @@ function startProcess() {
|
|
|
65
100
|
const exe_path = exe_paths.find(fs.existsSync);
|
|
66
101
|
|
|
67
102
|
if (!exe_path) {
|
|
68
|
-
|
|
103
|
+
logError(`Desktop SDK: Couldn't launch! This is likely an issue with the build tool you're using.`);
|
|
69
104
|
|
|
70
105
|
for (const exe_path of exe_paths)
|
|
71
|
-
|
|
106
|
+
logError("Tried:", exe_path);
|
|
72
107
|
|
|
73
|
-
|
|
108
|
+
log();
|
|
74
109
|
|
|
75
110
|
return;
|
|
76
111
|
}
|
|
@@ -117,7 +152,7 @@ function startProcess() {
|
|
|
117
152
|
break;
|
|
118
153
|
}
|
|
119
154
|
} catch (err) {
|
|
120
|
-
|
|
155
|
+
logError("Desktop SDK: Failed to parse incoming data:", err);
|
|
121
156
|
}
|
|
122
157
|
});
|
|
123
158
|
|
|
@@ -127,7 +162,7 @@ function startProcess() {
|
|
|
127
162
|
type: 'process',
|
|
128
163
|
message: `The Desktop SDK server process has failed to start or exited improperly.`
|
|
129
164
|
});
|
|
130
|
-
|
|
165
|
+
logError(`Desktop SDK: Process error: ${error.message}`);
|
|
131
166
|
});
|
|
132
167
|
|
|
133
168
|
proc.on('close', (code, signal) => {
|
|
@@ -137,12 +172,20 @@ function startProcess() {
|
|
|
137
172
|
if (code === 0 || signal == 'SIGINT')
|
|
138
173
|
return;
|
|
139
174
|
|
|
140
|
-
|
|
175
|
+
logError(`Desktop SDK: Process exited with code ${code}, signal ${signal}`);
|
|
141
176
|
|
|
142
177
|
emitEvent('error', {
|
|
143
178
|
type: 'process',
|
|
144
179
|
message: "The Desktop SDK server process exited unexpectedly."
|
|
145
180
|
});
|
|
181
|
+
|
|
182
|
+
unexpectedShutdown = true;
|
|
183
|
+
|
|
184
|
+
if (lastOptions.restartOnError && remainingAutomaticRestarts > 0) {
|
|
185
|
+
remainingAutomaticRestarts--;
|
|
186
|
+
console.error("Automatically restarting Desktop SDK due to unexpected exit!");
|
|
187
|
+
doInit(lastOptions);
|
|
188
|
+
}
|
|
146
189
|
});
|
|
147
190
|
}
|
|
148
191
|
|
|
@@ -166,14 +209,29 @@ function sendCommand(command, params = {}) {
|
|
|
166
209
|
});
|
|
167
210
|
}
|
|
168
211
|
|
|
212
|
+
function doInit(options) {
|
|
213
|
+
startProcess();
|
|
214
|
+
|
|
215
|
+
if (unexpectedShutdown) {
|
|
216
|
+
logError("Desktop SDK: Recovered from unexpected shutdown");
|
|
217
|
+
unexpectedShutdown = false;
|
|
218
|
+
}
|
|
219
|
+
|
|
220
|
+
return sendCommand("init", { config: JSON.stringify(options) });
|
|
221
|
+
}
|
|
222
|
+
|
|
169
223
|
function init(options) {
|
|
170
224
|
let { api_url, dev } = options;
|
|
225
|
+
|
|
171
226
|
if (!dev && (!api_url || !api_url.startsWith("https"))) {
|
|
172
227
|
throw new Error(`api_url must be an https url, got: ${api_url}`);
|
|
173
228
|
}
|
|
174
229
|
|
|
175
|
-
|
|
176
|
-
|
|
230
|
+
if (options.restartOnError === undefined)
|
|
231
|
+
options.restartOnError = true;
|
|
232
|
+
|
|
233
|
+
lastOptions = options;
|
|
234
|
+
doInit(options);
|
|
177
235
|
}
|
|
178
236
|
|
|
179
237
|
async function shutdown() {
|
|
@@ -215,6 +273,10 @@ function prepareDesktopAudioRecording() {
|
|
|
215
273
|
return sendCommand("prepareDesktopAudioRecording");
|
|
216
274
|
}
|
|
217
275
|
|
|
276
|
+
function requestPermission(permission) {
|
|
277
|
+
return sendCommand("requestPermission", { permission });
|
|
278
|
+
}
|
|
279
|
+
|
|
218
280
|
function addEventListener(type, callback) {
|
|
219
281
|
listeners.push({ type, callback });
|
|
220
282
|
}
|
|
@@ -229,4 +291,5 @@ module.exports = {
|
|
|
229
291
|
stopRecording,
|
|
230
292
|
uploadRecording,
|
|
231
293
|
prepareDesktopAudioRecording,
|
|
294
|
+
requestPermission
|
|
232
295
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@recallai/desktop-sdk",
|
|
3
|
-
"version": "2025.03.
|
|
3
|
+
"version": "2025.03.24-430771fa71a1136b9be5e37d541f0574ada1385d",
|
|
4
4
|
"description": "Recall Desktop SDK (Alpha)",
|
|
5
5
|
"main": "./index.js",
|
|
6
6
|
"types": "./index.d.ts",
|
|
@@ -8,6 +8,10 @@
|
|
|
8
8
|
"uuid": "^11.1.0"
|
|
9
9
|
},
|
|
10
10
|
"scripts": {
|
|
11
|
-
"install": "./unpack-frameworks.sh"
|
|
11
|
+
"install": "./unpack-frameworks.sh",
|
|
12
|
+
"validate-types": "tsc --noEmit index.d.ts"
|
|
13
|
+
},
|
|
14
|
+
"devDependencies": {
|
|
15
|
+
"typescript": "^5.3.3"
|
|
12
16
|
}
|
|
13
17
|
}
|