happy-imou-cloud 2.0.0 → 2.0.2
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/dist/{BaseReasoningProcessor-BRCQXCZY.cjs → BaseReasoningProcessor-B6tJ_eL5.cjs} +96 -9
- package/dist/{BaseReasoningProcessor-BKLRCKTU.mjs → BaseReasoningProcessor-D8VhEbs2.mjs} +95 -10
- package/dist/{api-D7OK-mML.cjs → api-D2Njw9Im.cjs} +124 -6
- package/dist/{api-BGXYX0yH.mjs → api-MYhAGPLn.mjs} +122 -7
- package/dist/{command-G85giEAF.cjs → command-CVldr51S.cjs} +3 -3
- package/dist/{command-CnLtKtP-.mjs → command-nmK6O-ab.mjs} +3 -3
- package/dist/{index-C7Y0R-MI.mjs → index-B97L7qLD.mjs} +689 -229
- package/dist/{index-B_wlQBy2.cjs → index-Bg-YziG2.cjs} +691 -229
- package/dist/index.cjs +4 -4
- package/dist/index.mjs +4 -4
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +7 -0
- package/dist/lib.d.mts +7 -0
- package/dist/lib.mjs +1 -1
- package/dist/{persistence-DHgf1CTG.cjs → persistence-D_2GkJAO.cjs} +28 -6
- package/dist/{persistence-BA_unuca.mjs → persistence-Dkm7rm8k.mjs} +29 -7
- package/dist/{registerKillSessionHandler-C2-yHm1V.mjs → registerKillSessionHandler-5GbrO0FM.mjs} +6 -4
- package/dist/{registerKillSessionHandler-CLREXN11.cjs → registerKillSessionHandler-BAXmJQRt.cjs} +6 -4
- package/dist/{runClaude-CwAitpX-.cjs → runClaude-B-GNEkKg.cjs} +237 -45
- package/dist/{runClaude-uNC5Eym4.mjs → runClaude-Cii3R2Fv.mjs} +238 -46
- package/dist/{runCodex-B-05E-YZ.mjs → runCodex-C--ZwAhl.mjs} +636 -819
- package/dist/{runCodex-Cm0VTqw_.cjs → runCodex-CPHyGwj9.cjs} +639 -819
- package/dist/{runGemini-_biXvQAH.mjs → runGemini-CQp7Nuzn.mjs} +20 -16
- package/dist/{runGemini-CLWjwDYS.cjs → runGemini-DaDz1bzQ.cjs} +20 -16
- package/package.json +14 -15
- package/scripts/env-wrapper.cjs +11 -11
- package/scripts/setup-dev.cjs +4 -4
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('chalk');
|
|
4
|
-
require('./api-
|
|
5
|
-
require('./persistence-
|
|
4
|
+
require('./api-D2Njw9Im.cjs');
|
|
5
|
+
require('./persistence-D_2GkJAO.cjs');
|
|
6
6
|
require('zod');
|
|
7
|
-
require('./index-
|
|
7
|
+
require('./index-Bg-YziG2.cjs');
|
|
8
8
|
require('node:child_process');
|
|
9
9
|
require('node:fs');
|
|
10
10
|
require('@agentclientprotocol/sdk');
|
|
@@ -13,9 +13,9 @@ require('fs');
|
|
|
13
13
|
require('path');
|
|
14
14
|
require('os');
|
|
15
15
|
require('child_process');
|
|
16
|
-
require('node:os');
|
|
17
16
|
require('node:path');
|
|
18
17
|
require('axios');
|
|
18
|
+
require('node:os');
|
|
19
19
|
require('node:events');
|
|
20
20
|
require('socket.io-client');
|
|
21
21
|
require('tweetnacl');
|
package/dist/index.mjs
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import 'chalk';
|
|
2
|
-
import './api-
|
|
3
|
-
import './persistence-
|
|
2
|
+
import './api-MYhAGPLn.mjs';
|
|
3
|
+
import './persistence-Dkm7rm8k.mjs';
|
|
4
4
|
import 'zod';
|
|
5
|
-
import './index-
|
|
5
|
+
import './index-B97L7qLD.mjs';
|
|
6
6
|
import 'node:child_process';
|
|
7
7
|
import 'node:fs';
|
|
8
8
|
import '@agentclientprotocol/sdk';
|
|
@@ -11,9 +11,9 @@ import 'fs';
|
|
|
11
11
|
import 'path';
|
|
12
12
|
import 'os';
|
|
13
13
|
import 'child_process';
|
|
14
|
-
import 'node:os';
|
|
15
14
|
import 'node:path';
|
|
16
15
|
import 'axios';
|
|
16
|
+
import 'node:os';
|
|
17
17
|
import 'node:events';
|
|
18
18
|
import 'socket.io-client';
|
|
19
19
|
import 'tweetnacl';
|
package/dist/lib.cjs
CHANGED
package/dist/lib.d.cts
CHANGED
|
@@ -468,6 +468,7 @@ type Metadata = {
|
|
|
468
468
|
};
|
|
469
469
|
machineId?: string;
|
|
470
470
|
claudeSessionId?: string;
|
|
471
|
+
claudeTranscriptPath?: string;
|
|
471
472
|
codexSessionId?: string;
|
|
472
473
|
tools?: string[];
|
|
473
474
|
slashCommands?: string[];
|
|
@@ -687,6 +688,8 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
687
688
|
private encryptionKey;
|
|
688
689
|
private encryptionVariant;
|
|
689
690
|
private pendingReliableCodexMessages;
|
|
691
|
+
private reconnectAfterServerDisconnectTimer;
|
|
692
|
+
private lastSocketServerError;
|
|
690
693
|
constructor(credentials: Credentials, session: Session);
|
|
691
694
|
onUserMessage(callback: (data: UserMessage) => void): void;
|
|
692
695
|
getMetadataSnapshot(): Metadata | null;
|
|
@@ -748,6 +751,9 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
748
751
|
private emitEncryptedSessionMessage;
|
|
749
752
|
private flushReliableCodexMessages;
|
|
750
753
|
private shouldBufferReliableCodexMessage;
|
|
754
|
+
private retryAfterServerDisconnect;
|
|
755
|
+
private clearReconnectAfterServerDisconnectTimer;
|
|
756
|
+
private normalizeSocketError;
|
|
751
757
|
}
|
|
752
758
|
|
|
753
759
|
interface SpawnSessionOptions {
|
|
@@ -845,6 +851,7 @@ declare class ApiClient {
|
|
|
845
851
|
private readonly credential;
|
|
846
852
|
private readonly pushClient;
|
|
847
853
|
private constructor();
|
|
854
|
+
private createAuthenticationError;
|
|
848
855
|
private request;
|
|
849
856
|
/**
|
|
850
857
|
* Create a new session or load existing one with the given tag
|
package/dist/lib.d.mts
CHANGED
|
@@ -468,6 +468,7 @@ type Metadata = {
|
|
|
468
468
|
};
|
|
469
469
|
machineId?: string;
|
|
470
470
|
claudeSessionId?: string;
|
|
471
|
+
claudeTranscriptPath?: string;
|
|
471
472
|
codexSessionId?: string;
|
|
472
473
|
tools?: string[];
|
|
473
474
|
slashCommands?: string[];
|
|
@@ -687,6 +688,8 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
687
688
|
private encryptionKey;
|
|
688
689
|
private encryptionVariant;
|
|
689
690
|
private pendingReliableCodexMessages;
|
|
691
|
+
private reconnectAfterServerDisconnectTimer;
|
|
692
|
+
private lastSocketServerError;
|
|
690
693
|
constructor(credentials: Credentials, session: Session);
|
|
691
694
|
onUserMessage(callback: (data: UserMessage) => void): void;
|
|
692
695
|
getMetadataSnapshot(): Metadata | null;
|
|
@@ -748,6 +751,9 @@ declare class ApiSessionClient extends EventEmitter {
|
|
|
748
751
|
private emitEncryptedSessionMessage;
|
|
749
752
|
private flushReliableCodexMessages;
|
|
750
753
|
private shouldBufferReliableCodexMessage;
|
|
754
|
+
private retryAfterServerDisconnect;
|
|
755
|
+
private clearReconnectAfterServerDisconnectTimer;
|
|
756
|
+
private normalizeSocketError;
|
|
751
757
|
}
|
|
752
758
|
|
|
753
759
|
interface SpawnSessionOptions {
|
|
@@ -845,6 +851,7 @@ declare class ApiClient {
|
|
|
845
851
|
private readonly credential;
|
|
846
852
|
private readonly pushClient;
|
|
847
853
|
private constructor();
|
|
854
|
+
private createAuthenticationError;
|
|
848
855
|
private request;
|
|
849
856
|
/**
|
|
850
857
|
* Create a new session or load existing one with the given tag
|
package/dist/lib.mjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-
|
|
1
|
+
export { A as ApiClient, a as ApiSessionClient, c as configuration, l as logger } from './api-MYhAGPLn.mjs';
|
|
2
2
|
export { R as RawJSONLinesSchema } from './types-CiliQpqS.mjs';
|
|
3
3
|
import 'axios';
|
|
4
4
|
import 'chalk';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
var promises = require('node:fs/promises');
|
|
4
4
|
var fs = require('node:fs');
|
|
5
5
|
var path = require('node:path');
|
|
6
|
-
var api = require('./api-
|
|
6
|
+
var api = require('./api-D2Njw9Im.cjs');
|
|
7
7
|
var z = require('zod');
|
|
8
8
|
require('axios');
|
|
9
9
|
require('chalk');
|
|
@@ -206,16 +206,37 @@ async function updateSettings(updater) {
|
|
|
206
206
|
const LOCK_RETRY_INTERVAL_MS = 100;
|
|
207
207
|
const MAX_LOCK_ATTEMPTS = 50;
|
|
208
208
|
const STALE_LOCK_TIMEOUT_MS = 1e4;
|
|
209
|
+
const LOCK_CONTENTION_CODES = /* @__PURE__ */ new Set(["EEXIST", "EPERM", "EACCES", "EBUSY"]);
|
|
210
|
+
const LOCK_RELEASE_RETRYABLE_CODES = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY"]);
|
|
209
211
|
const lockFile = api.configuration.settingsFile + ".lock";
|
|
210
|
-
const tmpFile = `${api.configuration.settingsFile}.${process.pid}.${Date.now()}.tmp`;
|
|
212
|
+
const tmpFile = `${api.configuration.settingsFile}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
211
213
|
let fileHandle;
|
|
212
214
|
let attempts = 0;
|
|
215
|
+
if (!fs.existsSync(api.configuration.happyCloudHomeDir)) {
|
|
216
|
+
await promises.mkdir(api.configuration.happyCloudHomeDir, { recursive: true });
|
|
217
|
+
}
|
|
218
|
+
async function removeFileWithRetry(path) {
|
|
219
|
+
for (let attempt = 1; attempt <= 20; attempt++) {
|
|
220
|
+
try {
|
|
221
|
+
await promises.unlink(path);
|
|
222
|
+
return;
|
|
223
|
+
} catch (err) {
|
|
224
|
+
if (err?.code === "ENOENT") {
|
|
225
|
+
return;
|
|
226
|
+
}
|
|
227
|
+
if (!LOCK_RELEASE_RETRYABLE_CODES.has(err?.code) || attempt === 20) {
|
|
228
|
+
throw err;
|
|
229
|
+
}
|
|
230
|
+
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
}
|
|
213
234
|
while (attempts < MAX_LOCK_ATTEMPTS) {
|
|
214
235
|
try {
|
|
215
236
|
fileHandle = await promises.open(lockFile, fs.constants.O_CREAT | fs.constants.O_EXCL | fs.constants.O_WRONLY);
|
|
216
237
|
break;
|
|
217
238
|
} catch (err) {
|
|
218
|
-
if (err
|
|
239
|
+
if (LOCK_CONTENTION_CODES.has(err?.code)) {
|
|
219
240
|
attempts++;
|
|
220
241
|
await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_INTERVAL_MS));
|
|
221
242
|
try {
|
|
@@ -245,11 +266,12 @@ async function updateSettings(updater) {
|
|
|
245
266
|
return updated;
|
|
246
267
|
} finally {
|
|
247
268
|
if (fs.existsSync(tmpFile)) {
|
|
248
|
-
await
|
|
269
|
+
await removeFileWithRetry(tmpFile).catch(() => {
|
|
249
270
|
});
|
|
250
271
|
}
|
|
251
|
-
await fileHandle.close()
|
|
252
|
-
|
|
272
|
+
await fileHandle.close().catch(() => {
|
|
273
|
+
});
|
|
274
|
+
await removeFileWithRetry(lockFile).catch(() => {
|
|
253
275
|
});
|
|
254
276
|
}
|
|
255
277
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { readFile, unlink, open, stat,
|
|
1
|
+
import { readFile, unlink, mkdir, open, stat, writeFile, rename } from 'node:fs/promises';
|
|
2
2
|
import { existsSync, unlinkSync, writeFileSync, readdirSync, readFileSync, constants } from 'node:fs';
|
|
3
3
|
import { join, dirname } from 'node:path';
|
|
4
|
-
import { c as configuration, l as logger, e as encodeBase64 } from './api-
|
|
4
|
+
import { c as configuration, l as logger, e as encodeBase64 } from './api-MYhAGPLn.mjs';
|
|
5
5
|
import * as z from 'zod';
|
|
6
6
|
import 'axios';
|
|
7
7
|
import 'chalk';
|
|
@@ -185,16 +185,37 @@ async function updateSettings(updater) {
|
|
|
185
185
|
const LOCK_RETRY_INTERVAL_MS = 100;
|
|
186
186
|
const MAX_LOCK_ATTEMPTS = 50;
|
|
187
187
|
const STALE_LOCK_TIMEOUT_MS = 1e4;
|
|
188
|
+
const LOCK_CONTENTION_CODES = /* @__PURE__ */ new Set(["EEXIST", "EPERM", "EACCES", "EBUSY"]);
|
|
189
|
+
const LOCK_RELEASE_RETRYABLE_CODES = /* @__PURE__ */ new Set(["EPERM", "EACCES", "EBUSY"]);
|
|
188
190
|
const lockFile = configuration.settingsFile + ".lock";
|
|
189
|
-
const tmpFile = `${configuration.settingsFile}.${process.pid}.${Date.now()}.tmp`;
|
|
191
|
+
const tmpFile = `${configuration.settingsFile}.${process.pid}.${Date.now()}.${Math.random().toString(36).slice(2)}.tmp`;
|
|
190
192
|
let fileHandle;
|
|
191
193
|
let attempts = 0;
|
|
194
|
+
if (!existsSync(configuration.happyCloudHomeDir)) {
|
|
195
|
+
await mkdir(configuration.happyCloudHomeDir, { recursive: true });
|
|
196
|
+
}
|
|
197
|
+
async function removeFileWithRetry(path) {
|
|
198
|
+
for (let attempt = 1; attempt <= 20; attempt++) {
|
|
199
|
+
try {
|
|
200
|
+
await unlink(path);
|
|
201
|
+
return;
|
|
202
|
+
} catch (err) {
|
|
203
|
+
if (err?.code === "ENOENT") {
|
|
204
|
+
return;
|
|
205
|
+
}
|
|
206
|
+
if (!LOCK_RELEASE_RETRYABLE_CODES.has(err?.code) || attempt === 20) {
|
|
207
|
+
throw err;
|
|
208
|
+
}
|
|
209
|
+
await new Promise((resolve) => setTimeout(resolve, 25));
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
}
|
|
192
213
|
while (attempts < MAX_LOCK_ATTEMPTS) {
|
|
193
214
|
try {
|
|
194
215
|
fileHandle = await open(lockFile, constants.O_CREAT | constants.O_EXCL | constants.O_WRONLY);
|
|
195
216
|
break;
|
|
196
217
|
} catch (err) {
|
|
197
|
-
if (err
|
|
218
|
+
if (LOCK_CONTENTION_CODES.has(err?.code)) {
|
|
198
219
|
attempts++;
|
|
199
220
|
await new Promise((resolve) => setTimeout(resolve, LOCK_RETRY_INTERVAL_MS));
|
|
200
221
|
try {
|
|
@@ -224,11 +245,12 @@ async function updateSettings(updater) {
|
|
|
224
245
|
return updated;
|
|
225
246
|
} finally {
|
|
226
247
|
if (existsSync(tmpFile)) {
|
|
227
|
-
await
|
|
248
|
+
await removeFileWithRetry(tmpFile).catch(() => {
|
|
228
249
|
});
|
|
229
250
|
}
|
|
230
|
-
await fileHandle.close()
|
|
231
|
-
|
|
251
|
+
await fileHandle.close().catch(() => {
|
|
252
|
+
});
|
|
253
|
+
await removeFileWithRetry(lockFile).catch(() => {
|
|
232
254
|
});
|
|
233
255
|
}
|
|
234
256
|
}
|
package/dist/{registerKillSessionHandler-C2-yHm1V.mjs → registerKillSessionHandler-5GbrO0FM.mjs}
RENAMED
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { f as formatDisplayMessage } from './index-B97L7qLD.mjs';
|
|
2
|
+
import { l as logger } from './api-MYhAGPLn.mjs';
|
|
2
3
|
import { createHash } from 'crypto';
|
|
3
4
|
import 'axios';
|
|
4
5
|
import 'node:events';
|
|
@@ -17,7 +18,7 @@ class MessageBuffer {
|
|
|
17
18
|
const message = {
|
|
18
19
|
id: `msg-${this.nextId++}`,
|
|
19
20
|
timestamp: /* @__PURE__ */ new Date(),
|
|
20
|
-
content,
|
|
21
|
+
content: formatDisplayMessage(content),
|
|
21
22
|
type
|
|
22
23
|
};
|
|
23
24
|
this.messages.push(message);
|
|
@@ -28,19 +29,20 @@ class MessageBuffer {
|
|
|
28
29
|
* Useful for streaming responses where deltas should accumulate in one message
|
|
29
30
|
*/
|
|
30
31
|
updateLastMessage(contentDelta, type = "assistant") {
|
|
32
|
+
const normalizedDelta = formatDisplayMessage(contentDelta);
|
|
31
33
|
for (let i = this.messages.length - 1; i >= 0; i--) {
|
|
32
34
|
if (this.messages[i].type === type) {
|
|
33
35
|
const oldMessage = this.messages[i];
|
|
34
36
|
const updatedMessage = {
|
|
35
37
|
...oldMessage,
|
|
36
|
-
content: oldMessage.content +
|
|
38
|
+
content: oldMessage.content + normalizedDelta
|
|
37
39
|
};
|
|
38
40
|
this.messages[i] = updatedMessage;
|
|
39
41
|
this.notifyListeners();
|
|
40
42
|
return;
|
|
41
43
|
}
|
|
42
44
|
}
|
|
43
|
-
this.addMessage(
|
|
45
|
+
this.addMessage(normalizedDelta, type);
|
|
44
46
|
}
|
|
45
47
|
/**
|
|
46
48
|
* Remove the last message of a specific type
|
package/dist/{registerKillSessionHandler-CLREXN11.cjs → registerKillSessionHandler-BAXmJQRt.cjs}
RENAMED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var index = require('./index-Bg-YziG2.cjs');
|
|
4
|
+
var api = require('./api-D2Njw9Im.cjs');
|
|
4
5
|
var crypto = require('crypto');
|
|
5
6
|
require('axios');
|
|
6
7
|
require('node:events');
|
|
@@ -19,7 +20,7 @@ class MessageBuffer {
|
|
|
19
20
|
const message = {
|
|
20
21
|
id: `msg-${this.nextId++}`,
|
|
21
22
|
timestamp: /* @__PURE__ */ new Date(),
|
|
22
|
-
content,
|
|
23
|
+
content: index.formatDisplayMessage(content),
|
|
23
24
|
type
|
|
24
25
|
};
|
|
25
26
|
this.messages.push(message);
|
|
@@ -30,19 +31,20 @@ class MessageBuffer {
|
|
|
30
31
|
* Useful for streaming responses where deltas should accumulate in one message
|
|
31
32
|
*/
|
|
32
33
|
updateLastMessage(contentDelta, type = "assistant") {
|
|
34
|
+
const normalizedDelta = index.formatDisplayMessage(contentDelta);
|
|
33
35
|
for (let i = this.messages.length - 1; i >= 0; i--) {
|
|
34
36
|
if (this.messages[i].type === type) {
|
|
35
37
|
const oldMessage = this.messages[i];
|
|
36
38
|
const updatedMessage = {
|
|
37
39
|
...oldMessage,
|
|
38
|
-
content: oldMessage.content +
|
|
40
|
+
content: oldMessage.content + normalizedDelta
|
|
39
41
|
};
|
|
40
42
|
this.messages[i] = updatedMessage;
|
|
41
43
|
this.notifyListeners();
|
|
42
44
|
return;
|
|
43
45
|
}
|
|
44
46
|
}
|
|
45
|
-
this.addMessage(
|
|
47
|
+
this.addMessage(normalizedDelta, type);
|
|
46
48
|
}
|
|
47
49
|
/**
|
|
48
50
|
* Remove the last message of a specific type
|