happy-imou-cloud 2.1.57 → 2.1.59

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 (48) hide show
  1. package/dist/{BaseReasoningProcessor-C67V1qL3.cjs → BaseReasoningProcessor-BSlD8znO.cjs} +1 -1
  2. package/dist/{BaseReasoningProcessor-D2Q8Nme5.mjs → BaseReasoningProcessor-CCk42d9N.mjs} +1 -1
  3. package/dist/{ConversationHistory-BBIe2m4P.mjs → ConversationHistory-DK27K3JQ.mjs} +3 -2
  4. package/dist/{ConversationHistory-atrS3PAx.cjs → ConversationHistory-DeQgZhJ6.cjs} +3 -2
  5. package/dist/{ProviderSelectionHandler-Qi2pFTxL.mjs → ProviderSelectionHandler-BOpj_9DE.mjs} +76 -3
  6. package/dist/{ProviderSelectionHandler-h3z4-foa.cjs → ProviderSelectionHandler-D8CA-qU2.cjs} +80 -6
  7. package/dist/{bootstrapManagedProviderSession-RLtyRq0n.cjs → bootstrapManagedProviderSession-CIeuJe8e.cjs} +8 -6
  8. package/dist/{bootstrapManagedProviderSession-AhAYHLGj.mjs → bootstrapManagedProviderSession-CIlq-ugZ.mjs} +5 -3
  9. package/dist/{command-CyzKMQbs.cjs → command-Di3Fzz-y.cjs} +14 -4
  10. package/dist/{command-DRRTqKEA.mjs → command-DwgpAaWb.mjs} +14 -4
  11. package/dist/index-DxN29QWa.cjs +13103 -0
  12. package/dist/index-lyHSYtcT.mjs +13085 -0
  13. package/dist/index.cjs +18 -11
  14. package/dist/index.mjs +18 -11
  15. package/dist/{installFatalProcessHandlers-DyyiLNrG.cjs → installFatalProcessHandlers-1tGjAPvJ.cjs} +1 -1
  16. package/dist/{installFatalProcessHandlers-B99QpyLN.mjs → installFatalProcessHandlers-D8bPk4i9.mjs} +1 -1
  17. package/dist/{launch-DRd9FuLt.mjs → launch-CZph2kt_.mjs} +14 -4
  18. package/dist/{launch-DnWvtpv4.cjs → launch-CtQOCN5k.cjs} +14 -4
  19. package/dist/lib.cjs +14 -4
  20. package/dist/lib.d.cts +3049 -381
  21. package/dist/lib.d.mts +3049 -381
  22. package/dist/lib.mjs +14 -4
  23. package/dist/{runClaude-DOlxK2PO.cjs → runClaude-CeqPnUbU.cjs} +38 -147
  24. package/dist/{runClaude-Df_7_PkI.mjs → runClaude-Xh_udlwO.mjs} +20 -129
  25. package/dist/runCodex-BSKTTl6d.mjs +9021 -0
  26. package/dist/runCodex-Dh9NvwOY.cjs +9026 -0
  27. package/dist/{runCursor-CqElKVpg.mjs → runCursor-2Q3v6cl1.mjs} +22 -13
  28. package/dist/{runCursor-ClUxehsP.cjs → runCursor-DddNgWaI.cjs} +23 -14
  29. package/dist/{runGemini-CmrMnkBU.cjs → runGemini-B_4ILaqM.cjs} +29 -293
  30. package/dist/{runGemini-CVyRbdZg.mjs → runGemini-C2xofHuV.mjs} +23 -287
  31. package/dist/{sessionControl-BovRthCu.mjs → sessionControl-Bmadpvu8.mjs} +68 -242
  32. package/dist/{sessionControl-C1bgV3SZ.cjs → sessionControl-JLtbfkf2.cjs} +67 -245
  33. package/dist/types-CYn-pPZa.cjs +64520 -0
  34. package/dist/types-CotaFNj0.mjs +64350 -0
  35. package/package.json +27 -20
  36. package/scripts/e2e/codex-app-server-goal-smoke.mjs +159 -0
  37. package/scripts/e2e/codex-mcp-memory-summarizer-smoke.mjs +255 -0
  38. package/scripts/e2e/fake-codex-app-server.mjs +267 -0
  39. package/scripts/e2e/local-server-session-roundtrip.mjs +1751 -432
  40. package/scripts/e2e/mcp-stdio-real-server-probe.mjs +189 -0
  41. package/dist/config-BXTUTPxJ.mjs +0 -174
  42. package/dist/config-BqFnXbs0.cjs +0 -184
  43. package/dist/index-BCLSXYQP.mjs +0 -7565
  44. package/dist/index-BoSqCbVr.cjs +0 -7582
  45. package/dist/runCodex-ClqZb2wh.cjs +0 -2307
  46. package/dist/runCodex-DP-67NuP.mjs +0 -2302
  47. package/dist/types-BZeEK90l.mjs +0 -14091
  48. package/dist/types-CcsR2bJq.cjs +0 -14185
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  var node_crypto = require('node:crypto');
4
- var persistence = require('./types-CcsR2bJq.cjs');
4
+ var persistence = require('./types-CYn-pPZa.cjs');
5
5
 
6
6
  class BaseReasoningProcessor {
7
7
  accumulator = "";
@@ -1,5 +1,5 @@
1
1
  import { randomUUID } from 'node:crypto';
2
- import { U as logger } from './types-BZeEK90l.mjs';
2
+ import { aE as logger } from './types-CotaFNj0.mjs';
3
3
 
4
4
  class BaseReasoningProcessor {
5
5
  accumulator = "";
@@ -1,5 +1,5 @@
1
- import { l as RuntimeShell, K as formatDisplayMessage, ad as truncateDisplayMessage, U as logger } from './types-BZeEK90l.mjs';
2
- import { j as renderTerminalOutputPreview } from './sessionControl-BovRthCu.mjs';
1
+ import { q as RuntimeShell, ac as formatDisplayMessage, bp as truncateDisplayMessage, aE as logger } from './types-CotaFNj0.mjs';
2
+ import { d as renderTerminalOutputPreview } from './sessionControl-Bmadpvu8.mjs';
3
3
 
4
4
  async function launchRuntimeHandleWithFactoryResult(opts) {
5
5
  const shell = opts.shell ?? new RuntimeShell();
@@ -8,6 +8,7 @@ async function launchRuntimeHandleWithFactoryResult(opts) {
8
8
  provider: opts.provider,
9
9
  cwd: opts.cwd,
10
10
  env: opts.env,
11
+ mcpServers: opts.mcpServers,
11
12
  createBackend: (factoryOpts) => {
12
13
  factoryResult = opts.createBackendResult(factoryOpts);
13
14
  return factoryResult.backend;
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./types-CcsR2bJq.cjs');
4
- var sessionControl = require('./sessionControl-C1bgV3SZ.cjs');
3
+ var persistence = require('./types-CYn-pPZa.cjs');
4
+ var sessionControl = require('./sessionControl-JLtbfkf2.cjs');
5
5
 
6
6
  async function launchRuntimeHandleWithFactoryResult(opts) {
7
7
  const shell = opts.shell ?? new persistence.RuntimeShell();
@@ -10,6 +10,7 @@ async function launchRuntimeHandleWithFactoryResult(opts) {
10
10
  provider: opts.provider,
11
11
  cwd: opts.cwd,
12
12
  env: opts.env,
13
+ mcpServers: opts.mcpServers,
13
14
  createBackend: (factoryOpts) => {
14
15
  factoryResult = opts.createBackendResult(factoryOpts);
15
16
  return factoryResult.backend;
@@ -1,5 +1,6 @@
1
- import { U as logger } from './types-BZeEK90l.mjs';
2
- import { h as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, b as INTERACTION_TIMED_OUT_ERROR } from './sessionControl-BovRthCu.mjs';
1
+ import { aE as logger, a3 as delay, ai as getPendingInteractionTimeoutMs, I as INTERACTION_SUPERSEDED_ERROR, o as INTERACTION_TIMED_OUT_ERROR } from './types-CotaFNj0.mjs';
2
+ import { stat, watch } from 'fs/promises';
3
+ import { dirname, basename } from 'node:path';
3
4
 
4
5
  async function runModeLoop(opts) {
5
6
  let currentMode = opts.startingMode;
@@ -51,6 +52,76 @@ function createKeepAliveController(opts) {
51
52
  };
52
53
  }
53
54
 
55
+ function startFileWatcher(file, onFileChange) {
56
+ const abortController = new AbortController();
57
+ const parentDir = dirname(file);
58
+ const targetName = basename(file);
59
+ void (async () => {
60
+ while (true) {
61
+ try {
62
+ try {
63
+ await stat(file);
64
+ } catch (e) {
65
+ if (abortController.signal.aborted) {
66
+ return;
67
+ }
68
+ if (e?.code === "ENOENT") {
69
+ logger.debug(`[FILE_WATCHER] Waiting for file to exist: ${file}`);
70
+ const dirWatcher = watch(parentDir, { persistent: true, signal: abortController.signal });
71
+ try {
72
+ await stat(file);
73
+ } catch (err) {
74
+ if (err?.code !== "ENOENT") {
75
+ throw err;
76
+ }
77
+ for await (const event of dirWatcher) {
78
+ if (abortController.signal.aborted) {
79
+ return;
80
+ }
81
+ const name = typeof event?.filename === "string" ? String(event.filename) : null;
82
+ if (name && name !== targetName) {
83
+ continue;
84
+ }
85
+ try {
86
+ await stat(file);
87
+ logger.debug(`[FILE_WATCHER] File appeared: ${file}`);
88
+ break;
89
+ } catch (nextErr) {
90
+ if (nextErr?.code === "ENOENT") {
91
+ continue;
92
+ }
93
+ throw nextErr;
94
+ }
95
+ }
96
+ }
97
+ } else {
98
+ throw e;
99
+ }
100
+ }
101
+ onFileChange(file);
102
+ logger.debug(`[FILE_WATCHER] Starting watcher for ${file}`);
103
+ const watcher = watch(file, { persistent: true, signal: abortController.signal });
104
+ for await (const event of watcher) {
105
+ if (abortController.signal.aborted) {
106
+ return;
107
+ }
108
+ logger.debug(`[FILE_WATCHER] File changed: ${file}`);
109
+ onFileChange(file);
110
+ }
111
+ } catch (e) {
112
+ if (abortController.signal.aborted) {
113
+ return;
114
+ }
115
+ logger.debug(`[FILE_WATCHER] Watch error: ${e.message}, restarting watcher in a second`);
116
+ await delay(1e3);
117
+ }
118
+ }
119
+ })();
120
+ return () => {
121
+ abortController.abort();
122
+ };
123
+ }
124
+
54
125
  class ProviderSelectionHandler {
55
126
  pendingRequests = /* @__PURE__ */ new Map();
56
127
  session;
@@ -81,6 +152,7 @@ class ProviderSelectionHandler {
81
152
  ...currentState.requests,
82
153
  [request.id]: {
83
154
  tool: "AskUserQuestion",
155
+ kind: "user_action",
84
156
  arguments: {
85
157
  requestKind: "selection",
86
158
  questions: [
@@ -225,6 +297,7 @@ class ProviderSelectionHandler {
225
297
  this.session.updateAgentState((currentState) => {
226
298
  const request = currentState.requests?.[requestId] || {
227
299
  tool: "AskUserQuestion",
300
+ kind: "user_action",
228
301
  arguments: {
229
302
  requestKind: "selection",
230
303
  questions: []
@@ -258,4 +331,4 @@ class ProviderSelectionHandler {
258
331
  }
259
332
  }
260
333
 
261
- export { ProviderSelectionHandler as P, createKeepAliveController as c, runModeLoop as r };
334
+ export { ProviderSelectionHandler as P, createKeepAliveController as c, runModeLoop as r, startFileWatcher as s };
@@ -1,7 +1,8 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./types-CcsR2bJq.cjs');
4
- var sessionControl = require('./sessionControl-C1bgV3SZ.cjs');
3
+ var persistence = require('./types-CYn-pPZa.cjs');
4
+ var fs = require('fs/promises');
5
+ var path = require('node:path');
5
6
 
6
7
  async function runModeLoop(opts) {
7
8
  let currentMode = opts.startingMode;
@@ -53,6 +54,76 @@ function createKeepAliveController(opts) {
53
54
  };
54
55
  }
55
56
 
57
+ function startFileWatcher(file, onFileChange) {
58
+ const abortController = new AbortController();
59
+ const parentDir = path.dirname(file);
60
+ const targetName = path.basename(file);
61
+ void (async () => {
62
+ while (true) {
63
+ try {
64
+ try {
65
+ await fs.stat(file);
66
+ } catch (e) {
67
+ if (abortController.signal.aborted) {
68
+ return;
69
+ }
70
+ if (e?.code === "ENOENT") {
71
+ persistence.logger.debug(`[FILE_WATCHER] Waiting for file to exist: ${file}`);
72
+ const dirWatcher = fs.watch(parentDir, { persistent: true, signal: abortController.signal });
73
+ try {
74
+ await fs.stat(file);
75
+ } catch (err) {
76
+ if (err?.code !== "ENOENT") {
77
+ throw err;
78
+ }
79
+ for await (const event of dirWatcher) {
80
+ if (abortController.signal.aborted) {
81
+ return;
82
+ }
83
+ const name = typeof event?.filename === "string" ? String(event.filename) : null;
84
+ if (name && name !== targetName) {
85
+ continue;
86
+ }
87
+ try {
88
+ await fs.stat(file);
89
+ persistence.logger.debug(`[FILE_WATCHER] File appeared: ${file}`);
90
+ break;
91
+ } catch (nextErr) {
92
+ if (nextErr?.code === "ENOENT") {
93
+ continue;
94
+ }
95
+ throw nextErr;
96
+ }
97
+ }
98
+ }
99
+ } else {
100
+ throw e;
101
+ }
102
+ }
103
+ onFileChange(file);
104
+ persistence.logger.debug(`[FILE_WATCHER] Starting watcher for ${file}`);
105
+ const watcher = fs.watch(file, { persistent: true, signal: abortController.signal });
106
+ for await (const event of watcher) {
107
+ if (abortController.signal.aborted) {
108
+ return;
109
+ }
110
+ persistence.logger.debug(`[FILE_WATCHER] File changed: ${file}`);
111
+ onFileChange(file);
112
+ }
113
+ } catch (e) {
114
+ if (abortController.signal.aborted) {
115
+ return;
116
+ }
117
+ persistence.logger.debug(`[FILE_WATCHER] Watch error: ${e.message}, restarting watcher in a second`);
118
+ await persistence.delay(1e3);
119
+ }
120
+ }
121
+ })();
122
+ return () => {
123
+ abortController.abort();
124
+ };
125
+ }
126
+
56
127
  class ProviderSelectionHandler {
57
128
  pendingRequests = /* @__PURE__ */ new Map();
58
129
  session;
@@ -75,7 +146,7 @@ class ProviderSelectionHandler {
75
146
  };
76
147
  pending.timeoutHandle = setTimeout(() => {
77
148
  this.handleSelectionTimeout(request.id, pending);
78
- }, sessionControl.getPendingInteractionTimeoutMs());
149
+ }, persistence.getPendingInteractionTimeoutMs());
79
150
  this.pendingRequests.set(request.id, pending);
80
151
  this.session.updateAgentState((currentState) => ({
81
152
  ...currentState,
@@ -83,6 +154,7 @@ class ProviderSelectionHandler {
83
154
  ...currentState.requests,
84
155
  [request.id]: {
85
156
  tool: "AskUserQuestion",
157
+ kind: "user_action",
86
158
  arguments: {
87
159
  requestKind: "selection",
88
160
  questions: [
@@ -111,7 +183,7 @@ class ProviderSelectionHandler {
111
183
  hasPendingRequests() {
112
184
  return this.pendingRequests.size > 0;
113
185
  }
114
- supersedePendingRequests(reason = sessionControl.INTERACTION_SUPERSEDED_ERROR) {
186
+ supersedePendingRequests(reason = persistence.INTERACTION_SUPERSEDED_ERROR) {
115
187
  const pendingSnapshot = Array.from(this.pendingRequests.entries());
116
188
  if (pendingSnapshot.length === 0) {
117
189
  return 0;
@@ -223,10 +295,11 @@ class ProviderSelectionHandler {
223
295
  }
224
296
  this.pendingRequests.delete(requestId);
225
297
  this.clearPendingRequestTimeout(active);
226
- active.reject(new Error(sessionControl.INTERACTION_TIMED_OUT_ERROR));
298
+ active.reject(new Error(persistence.INTERACTION_TIMED_OUT_ERROR));
227
299
  this.session.updateAgentState((currentState) => {
228
300
  const request = currentState.requests?.[requestId] || {
229
301
  tool: "AskUserQuestion",
302
+ kind: "user_action",
230
303
  arguments: {
231
304
  requestKind: "selection",
232
305
  questions: []
@@ -246,7 +319,7 @@ class ProviderSelectionHandler {
246
319
  ...request,
247
320
  completedAt: Date.now(),
248
321
  status: "canceled",
249
- reason: sessionControl.INTERACTION_TIMED_OUT_ERROR,
322
+ reason: persistence.INTERACTION_TIMED_OUT_ERROR,
250
323
  requestKind: "selection"
251
324
  }
252
325
  }
@@ -263,3 +336,4 @@ class ProviderSelectionHandler {
263
336
  exports.ProviderSelectionHandler = ProviderSelectionHandler;
264
337
  exports.createKeepAliveController = createKeepAliveController;
265
338
  exports.runModeLoop = runModeLoop;
339
+ exports.startFileWatcher = startFileWatcher;
@@ -1,7 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var index = require('./index-BoSqCbVr.cjs');
4
- var persistence = require('./types-CcsR2bJq.cjs');
3
+ var persistence = require('./types-CYn-pPZa.cjs');
5
4
  var node_events = require('node:events');
6
5
 
7
6
  function createOfflineSessionStub(sessionTag) {
@@ -86,7 +85,7 @@ function setupOfflineReconnection(opts) {
86
85
  }
87
86
 
88
87
  async function bootstrapManagedProviderSession(opts) {
89
- const { state, metadata, happyOrgStartupBinding } = index.createSessionMetadata({
88
+ const { state, metadata, happyOrgStartupBinding } = persistence.createSessionMetadata({
90
89
  flavor: opts.flavor,
91
90
  machineId: opts.machineId,
92
91
  startedBy: opts.startedBy,
@@ -97,7 +96,10 @@ async function bootstrapManagedProviderSession(opts) {
97
96
  return;
98
97
  }
99
98
  try {
100
- session2.updateMetadata(() => metadata);
99
+ session2.updateMetadata((currentMetadata) => ({
100
+ ...currentMetadata,
101
+ ...metadata
102
+ }));
101
103
  } catch (error) {
102
104
  persistence.logger.debug(`[managed-session] Failed to reconcile metadata for ${opts.flavor} session`, error);
103
105
  }
@@ -125,14 +127,14 @@ async function bootstrapManagedProviderSession(opts) {
125
127
  onSessionSwap: (newSession) => {
126
128
  opts.onSessionSwap?.(newSession, metadata);
127
129
  reconcileAttachedSessionMetadata(newSession);
128
- void index.publishSessionRegistration(newSession.sessionId, metadata);
130
+ void persistence.publishSessionRegistration(newSession.sessionId, metadata);
129
131
  }
130
132
  });
131
133
  if (response) {
132
134
  reconcileAttachedSessionMetadata(session);
133
135
  }
134
136
  if (response) {
135
- await index.publishSessionRegistration(response.id, metadata);
137
+ await persistence.publishSessionRegistration(response.id, metadata);
136
138
  }
137
139
  return {
138
140
  state,
@@ -1,5 +1,4 @@
1
- import { d as createSessionMetadata, p as publishSessionRegistration } from './index-BCLSXYQP.mjs';
2
- import { ac as startOfflineReconnection, v as configuration, Q as isAuthenticationRequiredError, U as logger } from './types-BZeEK90l.mjs';
1
+ import { bl as startOfflineReconnection, Q as configuration, a0 as createSessionMetadata, aq as isAuthenticationRequiredError, aE as logger, aU as publishSessionRegistration } from './types-CotaFNj0.mjs';
3
2
  import { EventEmitter } from 'node:events';
4
3
 
5
4
  function createOfflineSessionStub(sessionTag) {
@@ -95,7 +94,10 @@ async function bootstrapManagedProviderSession(opts) {
95
94
  return;
96
95
  }
97
96
  try {
98
- session2.updateMetadata(() => metadata);
97
+ session2.updateMetadata((currentMetadata) => ({
98
+ ...currentMetadata,
99
+ ...metadata
100
+ }));
99
101
  } catch (error) {
100
102
  logger.debug(`[managed-session] Failed to reconcile metadata for ${opts.flavor} session`, error);
101
103
  }
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
 
3
- var persistence = require('./types-CcsR2bJq.cjs');
3
+ var persistence = require('./types-CYn-pPZa.cjs');
4
4
  require('axios');
5
5
  require('chalk');
6
6
  require('fs');
@@ -18,15 +18,25 @@ require('crypto');
18
18
  require('path');
19
19
  require('sharp');
20
20
  require('node:child_process');
21
+ require('@noble/hashes/hmac');
22
+ require('@noble/hashes/sha512');
23
+ require('base64-js');
24
+ require('child_process');
25
+ require('util');
21
26
  require('cross-spawn');
22
27
  require('@agentclientprotocol/sdk');
23
28
  require('ps-list');
24
- require('os');
25
- require('child_process');
26
29
  require('url');
27
- require('node:readline');
30
+ require('node:util');
31
+ require('node:stream');
32
+ require('node:stream/promises');
28
33
  require('node:url');
34
+ require('os');
35
+ require('node:readline');
36
+ require('fastify');
37
+ require('fastify-type-provider-zod');
29
38
  require('expo-server-sdk');
39
+ require('node:module');
30
40
 
31
41
  function listRuntimeProviders() {
32
42
  const shell = persistence.createDefaultRuntimeShell();
@@ -1,4 +1,4 @@
1
- import { B as createDefaultRuntimeShell } from './types-BZeEK90l.mjs';
1
+ import { Y as createDefaultRuntimeShell } from './types-CotaFNj0.mjs';
2
2
  import 'axios';
3
3
  import 'chalk';
4
4
  import 'fs';
@@ -16,15 +16,25 @@ import 'crypto';
16
16
  import 'path';
17
17
  import 'sharp';
18
18
  import 'node:child_process';
19
+ import '@noble/hashes/hmac';
20
+ import '@noble/hashes/sha512';
21
+ import 'base64-js';
22
+ import 'child_process';
23
+ import 'util';
19
24
  import 'cross-spawn';
20
25
  import '@agentclientprotocol/sdk';
21
26
  import 'ps-list';
22
- import 'os';
23
- import 'child_process';
24
27
  import 'url';
25
- import 'node:readline';
28
+ import 'node:util';
29
+ import 'node:stream';
30
+ import 'node:stream/promises';
26
31
  import 'node:url';
32
+ import 'os';
33
+ import 'node:readline';
34
+ import 'fastify';
35
+ import 'fastify-type-provider-zod';
27
36
  import 'expo-server-sdk';
37
+ import 'node:module';
28
38
 
29
39
  function listRuntimeProviders() {
30
40
  const shell = createDefaultRuntimeShell();