@recallai/desktop-sdk 2025.7.7-3c1cd321bde07a26823d214e97385d2710d9b350 → 2025.7.7-f942f66dd0374c767882a285f9f4fd8ae0f428e4

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 (2) hide show
  1. package/index.js +10 -35
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -28,19 +28,6 @@ let lastOptions;
28
28
  let remainingAutomaticRestarts = 10;
29
29
  let unexpectedShutdown = false;
30
30
 
31
- let logBuffer = [];
32
- let logIndex = 0;
33
-
34
- function flushLogBuffer() {
35
- const buf = logBuffer.slice();
36
-
37
- logBuffer = [];
38
- logIndex = 0;
39
-
40
- for (const idx in buf)
41
- doLog(buf[idx].level, [buf[idx].log]);
42
- }
43
-
44
31
  async function doLog(level, log) {
45
32
  try {
46
33
  const levelMap = {
@@ -51,21 +38,12 @@ async function doLog(level, log) {
51
38
 
52
39
  console[levelMap[level]](...log);
53
40
 
54
- let logPayload = {
41
+ await sendCommand("log", {
55
42
  log: log.join(" "),
56
43
  level: level
57
- };
58
-
59
- let idx = logIndex++;
60
-
61
- logBuffer[idx] = logPayload;
62
-
63
- if (proc && proc.exitCode === null) {
64
- await sendCommand("log", logPayload);
65
- delete logBuffer[idx];
66
- }
44
+ });
67
45
  } catch (e) {
68
- console.error("Failed to send log to Desktop SDK", e.stack, e.message);
46
+ //console.error("Log failed:", e.message, e.stack);
69
47
  }
70
48
  }
71
49
 
@@ -96,10 +74,7 @@ function flushPendingCommands(err) {
96
74
  }
97
75
 
98
76
  function startProcess() {
99
- if (proc && proc.exitCode === null) {
100
- logError("Desktop SDK: Trying to start process while it is already started");
101
- return;
102
- }
77
+ if (proc && proc.exitCode === null) return;
103
78
 
104
79
  const exe_path = exe_paths.find(fs.existsSync);
105
80
 
@@ -109,6 +84,8 @@ function startProcess() {
109
84
  for (const exe_path of exe_paths)
110
85
  logError("Tried:", exe_path);
111
86
 
87
+ log();
88
+
112
89
  return;
113
90
  }
114
91
 
@@ -179,7 +156,7 @@ function startProcess() {
179
156
  logError(`Desktop SDK: Process error: ${error.message}`);
180
157
  });
181
158
 
182
- proc.on('close', async (code, signal) => {
159
+ proc.on('close', (code, signal) => {
183
160
  flushPendingCommands(new Error(`Process exited with code ${code}, signal ${signal}.`));
184
161
  emitEvent('shutdown', { code, signal });
185
162
 
@@ -193,12 +170,11 @@ function startProcess() {
193
170
  message: "The Desktop SDK server process exited unexpectedly."
194
171
  });
195
172
 
196
- proc = null;
197
173
  unexpectedShutdown = true;
198
174
 
199
175
  if (lastOptions.restartOnError && remainingAutomaticRestarts > 0) {
200
176
  remainingAutomaticRestarts--;
201
- logError(`Automatically restarting Desktop SDK due to unexpected exit! Automatic restarts left: ${remainingAutomaticRestarts}`);
177
+ console.error("Automatically restarting Desktop SDK due to unexpected exit!");
202
178
  doInit(lastOptions);
203
179
  }
204
180
  });
@@ -224,7 +200,7 @@ function sendCommand(command, params = {}) {
224
200
  });
225
201
  }
226
202
 
227
- async function doInit(options) {
203
+ function doInit(options) {
228
204
  startProcess();
229
205
 
230
206
  if (unexpectedShutdown) {
@@ -232,8 +208,7 @@ async function doInit(options) {
232
208
  unexpectedShutdown = false;
233
209
  }
234
210
 
235
- await sendCommand("init", { config: JSON.stringify(options) });
236
- flushLogBuffer();
211
+ return sendCommand("init", { config: JSON.stringify(options) });
237
212
  }
238
213
 
239
214
  async function init(options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@recallai/desktop-sdk",
3
- "version": "2025.07.07-3c1cd321bde07a26823d214e97385d2710d9b350",
3
+ "version": "2025.07.07-f942f66dd0374c767882a285f9f4fd8ae0f428e4",
4
4
  "description": "Recall Desktop SDK (Alpha)",
5
5
  "main": "./index.js",
6
6
  "types": "./index.d.ts",