happy-imou-cloud 2.1.49 → 2.1.51

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 (55) hide show
  1. package/dist/AcpBackend-CqO3D07V.mjs +2619 -0
  2. package/dist/AcpBackend-XPiTd6ph.cjs +2621 -0
  3. package/dist/{BaseReasoningProcessor-Dn9NcoHz.cjs → BaseReasoningProcessor-BD9tiwep.cjs} +1 -144
  4. package/dist/{BaseReasoningProcessor-CAVeOdyo.mjs → BaseReasoningProcessor-CjlayL2f.mjs} +2 -144
  5. package/dist/ConversationHistory-Bl2doTA-.cjs +780 -0
  6. package/dist/ConversationHistory-CI5bBfuA.mjs +771 -0
  7. package/dist/{ProviderSelectionHandler-BJJc7qOR.cjs → ProviderSelectionHandler-C7GE5QjX.cjs} +6 -6
  8. package/dist/{ProviderSelectionHandler-DIYidT13.mjs → ProviderSelectionHandler-uQ8jzdzr.mjs} +2 -2
  9. package/dist/RuntimeShell-BDt42io_.mjs +252 -0
  10. package/dist/RuntimeShell-D_Te12wq.cjs +258 -0
  11. package/dist/bootstrapManagedProviderSession-Bln-TwyB.cjs +147 -0
  12. package/dist/bootstrapManagedProviderSession-D2Z6YU3n.mjs +145 -0
  13. package/dist/claude-BKNT-2fG.cjs +1080 -0
  14. package/dist/claude-CnN5WCWj.mjs +1073 -0
  15. package/dist/codex-DLGP8WF6.mjs +577 -0
  16. package/dist/codex-Fv2eali8.cjs +582 -0
  17. package/dist/{command-VcH4hbhi.cjs → command-BWPlJyCN.cjs} +16 -8
  18. package/dist/{command-CzfRRhVe.mjs → command-CELwsYoG.mjs} +15 -7
  19. package/dist/config-CFL0Gkqt.cjs +184 -0
  20. package/dist/config-ChSPe7p9.mjs +174 -0
  21. package/dist/createDefaultRuntimeShell-BXu3vCvT.cjs +33 -0
  22. package/dist/createDefaultRuntimeShell-DOg6g3-G.mjs +31 -0
  23. package/dist/cursor-Blq1cHdr.cjs +91 -0
  24. package/dist/cursor-CwPNSy_A.mjs +88 -0
  25. package/dist/future-Dq4Ha1Dn.cjs +24 -0
  26. package/dist/future-xRdLl3vf.mjs +22 -0
  27. package/dist/{index-xa1kwZoj.cjs → index-B_JYgMUS.cjs} +189 -5352
  28. package/dist/{index-7Z93BoVn.mjs → index-CX-F_fuk.mjs} +177 -5331
  29. package/dist/index.cjs +2 -2
  30. package/dist/index.mjs +2 -2
  31. package/dist/installFatalProcessHandlers-0vaw9MAz.mjs +55 -0
  32. package/dist/installFatalProcessHandlers-CyURn5Bp.cjs +57 -0
  33. package/dist/launch-BoCCEd5p.mjs +63 -0
  34. package/dist/launch-wZA5BcvS.cjs +66 -0
  35. package/dist/lib.cjs +2 -3
  36. package/dist/lib.d.cts +20 -17
  37. package/dist/lib.d.mts +20 -17
  38. package/dist/lib.mjs +1 -2
  39. package/dist/resolveCommand-B3BGyBE2.mjs +189 -0
  40. package/dist/resolveCommand-DYMd9PNC.cjs +193 -0
  41. package/dist/{runClaude-zCwRhpOw.mjs → runClaude-Be0myF9k.mjs} +8 -5
  42. package/dist/{runClaude-BBGNmGj6.cjs → runClaude-DZJt5er7.cjs} +46 -43
  43. package/dist/{runCodex-BbgLVjb9.mjs → runCodex-BSnyN4m7.mjs} +226 -117
  44. package/dist/{runCodex-jUU6U2tZ.cjs → runCodex-DTCcGRue.cjs} +269 -160
  45. package/dist/runCursor-Bn1PuwJy.cjs +506 -0
  46. package/dist/runCursor-M6dQ6bGF.mjs +504 -0
  47. package/dist/{runGemini-DcwNsudA.mjs → runGemini-BNm4vYKA.mjs} +279 -5
  48. package/dist/{runGemini-C0NT8MHK.cjs → runGemini-Bn3lFhz6.cjs} +309 -35
  49. package/dist/{registerKillSessionHandler-DLDg2EES.mjs → sessionControl-1bT_7OI6.mjs} +1643 -2405
  50. package/dist/{registerKillSessionHandler-CfCya6si.cjs → sessionControl-flKnQrx0.cjs} +1647 -2417
  51. package/dist/{api-DnqaNvyV.mjs → types-B5vtxa38.mjs} +55 -5
  52. package/dist/{api-D7nAeZi7.cjs → types-CttABk32.cjs} +55 -4
  53. package/package.json +2 -2
  54. package/dist/types-CiliQpqS.mjs +0 -52
  55. package/dist/types-DVk3crez.cjs +0 -54
@@ -0,0 +1,145 @@
1
+ import { d as createSessionMetadata, e as publishSessionRegistration } from './index-CX-F_fuk.mjs';
2
+ import { s as startOfflineReconnection, c as configuration, i as isAuthenticationRequiredError, l as logger } from './types-B5vtxa38.mjs';
3
+ import { EventEmitter } from 'node:events';
4
+
5
+ function createOfflineSessionStub(sessionTag) {
6
+ const emitter = new EventEmitter();
7
+ let metadata = null;
8
+ let agentState = null;
9
+ const stub = {
10
+ sessionId: `offline-${sessionTag}`,
11
+ sendCodexMessage: () => {
12
+ },
13
+ sendAgentMessage: () => {
14
+ },
15
+ sendClaudeSessionMessage: () => {
16
+ },
17
+ keepAlive: () => {
18
+ },
19
+ sendSessionEvent: () => {
20
+ },
21
+ sendSessionDeath: () => {
22
+ },
23
+ updateLifecycleState: () => {
24
+ },
25
+ requestControlTransfer: async () => {
26
+ },
27
+ flush: async () => {
28
+ },
29
+ close: async () => {
30
+ },
31
+ updateMetadata: (handler) => {
32
+ metadata = handler(metadata || {});
33
+ emitter.emit("metadata-updated", metadata);
34
+ },
35
+ updateAgentState: (handler) => {
36
+ agentState = handler(agentState || {});
37
+ emitter.emit("agent-state-updated", agentState);
38
+ },
39
+ getMetadataSnapshot: () => metadata,
40
+ getAgentStateSnapshot: () => agentState,
41
+ waitForMetadataUpdate: async () => metadata,
42
+ onUserMessage: () => {
43
+ },
44
+ onSessionMessage: () => {
45
+ },
46
+ configureProtocolV3Sync: () => {
47
+ },
48
+ rpcHandlerManager: {
49
+ registerHandler: () => {
50
+ }
51
+ },
52
+ on: emitter.on.bind(emitter),
53
+ once: emitter.once.bind(emitter),
54
+ off: emitter.off.bind(emitter),
55
+ emit: emitter.emit.bind(emitter)
56
+ };
57
+ return stub;
58
+ }
59
+
60
+ function setupOfflineReconnection(opts) {
61
+ const { api, sessionTag, metadata, state, response, onSessionSwap } = opts;
62
+ let session;
63
+ let reconnectionHandle = null;
64
+ if (!response) {
65
+ session = createOfflineSessionStub(sessionTag);
66
+ reconnectionHandle = startOfflineReconnection({
67
+ serverUrl: configuration.serverUrl,
68
+ onReconnected: async () => {
69
+ const resp = await api.getOrCreateSession({ tag: sessionTag, metadata, state });
70
+ if (!resp) throw new Error("Server unavailable");
71
+ const realSession = api.sessionSyncClient(resp);
72
+ onSessionSwap(realSession);
73
+ return realSession;
74
+ },
75
+ onNotify: (msg) => {
76
+ console.log(msg);
77
+ }
78
+ });
79
+ return { session, reconnectionHandle, isOffline: true };
80
+ } else {
81
+ session = api.sessionSyncClient(response);
82
+ return { session, reconnectionHandle: null, isOffline: false };
83
+ }
84
+ }
85
+
86
+ async function bootstrapManagedProviderSession(opts) {
87
+ const { state, metadata, happyOrgStartupBinding } = createSessionMetadata({
88
+ flavor: opts.flavor,
89
+ machineId: opts.machineId,
90
+ startedBy: opts.startedBy,
91
+ managedSessionTag: opts.startedBy === "daemon" && (opts.flavor === "codex" || opts.flavor === "cursor") ? opts.sessionTag : void 0
92
+ });
93
+ const reconcileAttachedSessionMetadata = (session2) => {
94
+ if (!opts.reconcileMetadataOnAttach) {
95
+ return;
96
+ }
97
+ try {
98
+ session2.updateMetadata(() => metadata);
99
+ } catch (error) {
100
+ logger.debug(`[managed-session] Failed to reconcile metadata for ${opts.flavor} session`, error);
101
+ }
102
+ };
103
+ let response = null;
104
+ try {
105
+ response = await opts.api.getOrCreateSession({
106
+ tag: opts.sessionTag,
107
+ metadata,
108
+ state,
109
+ stableDataKeyPath: ["managed-session-tag", opts.sessionTag]
110
+ });
111
+ } catch (error) {
112
+ if (!isAuthenticationRequiredError(error)) {
113
+ throw error;
114
+ }
115
+ logger.debug(opts.authFallbackLogMessage);
116
+ }
117
+ const { session, reconnectionHandle } = setupOfflineReconnection({
118
+ api: opts.api,
119
+ sessionTag: opts.sessionTag,
120
+ metadata,
121
+ state,
122
+ response,
123
+ onSessionSwap: (newSession) => {
124
+ opts.onSessionSwap?.(newSession, metadata);
125
+ reconcileAttachedSessionMetadata(newSession);
126
+ void publishSessionRegistration(newSession.sessionId, metadata);
127
+ }
128
+ });
129
+ if (response) {
130
+ reconcileAttachedSessionMetadata(session);
131
+ }
132
+ if (response) {
133
+ await publishSessionRegistration(response.id, metadata);
134
+ }
135
+ return {
136
+ state,
137
+ metadata,
138
+ happyOrgStartupBinding,
139
+ response,
140
+ session,
141
+ reconnectionHandle
142
+ };
143
+ }
144
+
145
+ export { bootstrapManagedProviderSession as b };