happy-imou-cloud 2.1.52 → 2.1.53
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/{AcpBackend-DtxGBKiz.cjs → AcpBackend-B3s99ivd.cjs} +3 -3
- package/dist/{AcpBackend-3-XDjrku.mjs → AcpBackend-Dephumdg.mjs} +3 -3
- package/dist/{BaseReasoningProcessor-GrsmssbV.mjs → BaseReasoningProcessor-D0lBynU3.mjs} +1 -1
- package/dist/{BaseReasoningProcessor-CAQB14n9.cjs → BaseReasoningProcessor-DgyEX2ex.cjs} +1 -1
- package/dist/{ConversationHistory-DblMPp5X.cjs → ConversationHistory-DYF60lvE.cjs} +3 -3
- package/dist/{ConversationHistory-BtPGSkJU.mjs → ConversationHistory-Dr1H-t58.mjs} +3 -3
- package/dist/{ProviderSelectionHandler-DrWMeahq.cjs → ProviderSelectionHandler-BsIj6tUM.cjs} +2 -2
- package/dist/{ProviderSelectionHandler-AbhoRyth.mjs → ProviderSelectionHandler-oIejggTi.mjs} +2 -2
- package/dist/{RuntimeShell-DCeyYzOs.cjs → RuntimeShell-CoXntnel.cjs} +2 -2
- package/dist/{RuntimeShell-BbEINPUC.mjs → RuntimeShell-DZhi4Zhd.mjs} +2 -2
- package/dist/{bootstrapManagedProviderSession-BM1PDHRS.cjs → bootstrapManagedProviderSession-DuPoeGsz.cjs} +2 -2
- package/dist/{bootstrapManagedProviderSession-pAWC0cg8.mjs → bootstrapManagedProviderSession-HezKZOHo.mjs} +2 -2
- package/dist/{claude-Cd1EV34h.cjs → claude-DJ98mF1g.cjs} +3 -3
- package/dist/{claude-CwRWUUVR.mjs → claude-Dm0RQqLD.mjs} +3 -3
- package/dist/{codex-suiruFqm.cjs → codex-CGoezd1l.cjs} +4 -4
- package/dist/{codex-B0MiKtqc.mjs → codex-CjtUx7la.mjs} +4 -4
- package/dist/{command-BNdy9kbh.mjs → command-CX3Ijure.mjs} +8 -8
- package/dist/{command-DD7nnM4r.cjs → command-DAb1FNFD.cjs} +8 -8
- package/dist/{config-BuQStBK_.cjs → config-D9ppiOqF.cjs} +1 -1
- package/dist/{config-C9Yb905M.mjs → config-DsOkKwwg.mjs} +1 -1
- package/dist/{createDefaultRuntimeShell-BM2lyPQ4.mjs → createDefaultRuntimeShell-BJdgPwWt.mjs} +6 -6
- package/dist/{createDefaultRuntimeShell-DQlet_Es.cjs → createDefaultRuntimeShell-Dt2klFXx.cjs} +6 -6
- package/dist/{cursor-Cf87RaxN.mjs → cursor-BxWThmbf.mjs} +4 -4
- package/dist/{cursor-D4eQeadD.cjs → cursor-DOu6sau_.cjs} +4 -4
- package/dist/{index-CxPxEDeE.mjs → index-B_Cm6MhB.mjs} +11 -11
- package/dist/{index-Ca00OSY5.cjs → index-Cd7d2BMe.cjs} +14 -14
- package/dist/index.cjs +2 -2
- package/dist/index.mjs +2 -2
- package/dist/{installFatalProcessHandlers-CwVyatD4.cjs → installFatalProcessHandlers-CNnOiioM.cjs} +1 -1
- package/dist/{installFatalProcessHandlers-DG1QZYHP.mjs → installFatalProcessHandlers-DeJFoOCl.mjs} +1 -1
- package/dist/{launch-Cj9fXgj3.mjs → launch-CTC8E1YI.mjs} +8 -8
- package/dist/{launch-BZfxJTsA.cjs → launch-CVYm-vTg.cjs} +8 -8
- package/dist/lib.cjs +1 -1
- package/dist/lib.d.cts +8 -1
- package/dist/lib.d.mts +8 -1
- package/dist/lib.mjs +1 -1
- package/dist/{runClaude-CqqJipYj.mjs → runClaude-BB-5Su2y.mjs} +29 -37
- package/dist/{runClaude-vRuF9RZV.cjs → runClaude-DbiPMUS4.cjs} +29 -37
- package/dist/{runCodex-BuENvdll.mjs → runCodex-BAWWDwBE.mjs} +49 -34
- package/dist/{runCodex-D61xJnYS.cjs → runCodex-CIZFYkTI.cjs} +49 -34
- package/dist/{runCursor-BuIUSR5U.mjs → runCursor-DJgPZ-11.mjs} +17 -28
- package/dist/{runCursor-avWVar8f.cjs → runCursor-GR8a5T-H.cjs} +17 -28
- package/dist/{runGemini-DPeGLZXt.mjs → runGemini-CwKyhP0O.mjs} +23 -34
- package/dist/{runGemini-Dkmy1MA6.cjs → runGemini-yWXF4JBe.cjs} +23 -34
- package/dist/{sessionControl-DoQKVLbo.cjs → sessionControl-BM3380c0.cjs} +122 -3
- package/dist/{sessionControl-BmmjRdC4.mjs → sessionControl-D8sHsOfs.mjs} +122 -4
- package/dist/{types-CwpYbO-W.cjs → types-Be833t7e.cjs} +82 -11
- package/dist/{types-DleyDaIf.mjs → types-CDuesyX_.mjs} +83 -12
- package/package.json +1 -1
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { m as preserveSessionRuntimeMetadata, l as logger, h as hashObject,
|
|
2
|
-
import { B as BasePermissionHandler,
|
|
3
|
-
import { b as closeProviderSession, s as stopCaffeinate, r as readManagedSessionTag, a as resolveManagedSessionTag } from './index-
|
|
1
|
+
import { m as preserveSessionRuntimeMetadata, l as logger, h as hashObject, b as connectionState, A as ApiClient } from './types-CDuesyX_.mjs';
|
|
2
|
+
import { B as BasePermissionHandler, c as BufferedAssistantStreamEmitter, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, h as finalizeHappyOrgTurnWithBusinessAck, r as registerKillSessionHandler, j as renderTerminalOutputPreview, p as prepareTerminalOutputForForwarding, k as inferToolResultError, i as forwardAgentMessageToProviderSession, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, d as resolveHappyOrgQueuedTurn, s as syncControlledByUserState } from './sessionControl-D8sHsOfs.mjs';
|
|
3
|
+
import { b as closeProviderSession, s as stopCaffeinate, r as readManagedSessionTag, a as resolveManagedSessionTag } from './index-B_Cm6MhB.mjs';
|
|
4
4
|
import 'cross-spawn';
|
|
5
5
|
import '@agentclientprotocol/sdk';
|
|
6
6
|
import { randomUUID } from 'node:crypto';
|
|
@@ -24,18 +24,18 @@ import 'tweetnacl';
|
|
|
24
24
|
import 'open';
|
|
25
25
|
import React, { useState, useRef, useEffect, useCallback } from 'react';
|
|
26
26
|
import { useStdout, useInput, Box, Text, render } from 'ink';
|
|
27
|
-
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-
|
|
27
|
+
import { c as createKeepAliveController, P as ProviderSelectionHandler, r as runModeLoop } from './ProviderSelectionHandler-oIejggTi.mjs';
|
|
28
28
|
import 'socket.io-client';
|
|
29
29
|
import 'expo-server-sdk';
|
|
30
|
-
import { M as MessageBuffer, C as ConversationHistory$1, b as buildTurnResultPushNotification, a as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, d as createSessionTranscriptInkRenderer, e as extractPermissionRequestPushContext, c as buildPermissionPushNotification } from './ConversationHistory-
|
|
31
|
-
import { f as formatDisplayMessage, t as truncateDisplayMessage } from './RuntimeShell-
|
|
32
|
-
import { A as AcpBackend } from './AcpBackend-
|
|
30
|
+
import { M as MessageBuffer, C as ConversationHistory$1, b as buildTurnResultPushNotification, a as buildReadyPushNotification, l as launchRuntimeHandleWithFactoryResult, d as createSessionTranscriptInkRenderer, e as extractPermissionRequestPushContext, c as buildPermissionPushNotification } from './ConversationHistory-Dr1H-t58.mjs';
|
|
31
|
+
import { f as formatDisplayMessage, t as truncateDisplayMessage } from './RuntimeShell-DZhi4Zhd.mjs';
|
|
32
|
+
import { A as AcpBackend } from './AcpBackend-Dephumdg.mjs';
|
|
33
33
|
import { v as validateCodexAcpSpawn } from './resolveCommand-B3BGyBE2.mjs';
|
|
34
|
-
import { c as createCodexBackend, a as resolveCodexExecutable, s as shouldUseShellForCodex } from './codex-
|
|
35
|
-
import { B as BaseReasoningProcessor } from './BaseReasoningProcessor-
|
|
34
|
+
import { c as createCodexBackend, a as resolveCodexExecutable, s as shouldUseShellForCodex } from './codex-CjtUx7la.mjs';
|
|
35
|
+
import { B as BaseReasoningProcessor } from './BaseReasoningProcessor-D0lBynU3.mjs';
|
|
36
36
|
import { F as Future } from './future-xRdLl3vf.mjs';
|
|
37
|
-
import { b as bootstrapManagedProviderSession } from './bootstrapManagedProviderSession-
|
|
38
|
-
import { i as installFatalProcessHandlers } from './installFatalProcessHandlers-
|
|
37
|
+
import { b as bootstrapManagedProviderSession } from './bootstrapManagedProviderSession-HezKZOHo.mjs';
|
|
38
|
+
import { i as installFatalProcessHandlers } from './installFatalProcessHandlers-DeJFoOCl.mjs';
|
|
39
39
|
import 'zod';
|
|
40
40
|
import 'qrcode-terminal';
|
|
41
41
|
import 'node:module';
|
|
@@ -54,7 +54,7 @@ const DEFAULT_CAPABILITIES = {
|
|
|
54
54
|
structuredSpawnErrors: false,
|
|
55
55
|
metadataWatch: false
|
|
56
56
|
};
|
|
57
|
-
function supportsProtocolCapability(protocolDescriptor, capability) {
|
|
57
|
+
function supportsProtocolCapability$1(protocolDescriptor, capability) {
|
|
58
58
|
return Array.isArray(protocolDescriptor?.capabilities) && protocolDescriptor.capabilities.includes(capability);
|
|
59
59
|
}
|
|
60
60
|
function resolveProtocolStateSources(options) {
|
|
@@ -78,7 +78,7 @@ function resolveCodexRuntimeSessionCapabilities(options) {
|
|
|
78
78
|
return source.getProtocolV3SocketCapabilitiesSnapshot?.()?.connectionType === "user-scoped";
|
|
79
79
|
});
|
|
80
80
|
const protocolDescriptors = protocolStateSources.map((source) => source.getProtocolV3DescriptorSnapshot?.() ?? source.getProtocolV3SocketCapabilitiesSnapshot?.()?.protocol ?? null).filter((descriptor) => descriptor !== null);
|
|
81
|
-
const supportsCapability = (capability) => protocolDescriptors.some((descriptor) => supportsProtocolCapability(descriptor, capability)) || supportsProtocolCapability(options.protocolDescriptor, capability);
|
|
81
|
+
const supportsCapability = (capability) => protocolDescriptors.some((descriptor) => supportsProtocolCapability$1(descriptor, capability)) || supportsProtocolCapability$1(options.protocolDescriptor, capability);
|
|
82
82
|
return {
|
|
83
83
|
...DEFAULT_CAPABILITIES,
|
|
84
84
|
committedMessageAcks: supportsCapability("message_ack_v3"),
|
|
@@ -156,6 +156,9 @@ function createCodexRuntimeSession(options) {
|
|
|
156
156
|
};
|
|
157
157
|
}
|
|
158
158
|
|
|
159
|
+
function supportsProtocolCapability(descriptor, capability) {
|
|
160
|
+
return Array.isArray(descriptor?.capabilities) && descriptor.capabilities.includes(capability);
|
|
161
|
+
}
|
|
159
162
|
class CodexSession {
|
|
160
163
|
path;
|
|
161
164
|
logPath;
|
|
@@ -275,6 +278,9 @@ class CodexSession {
|
|
|
275
278
|
if (alreadyObserved || alreadyPersisted) {
|
|
276
279
|
return;
|
|
277
280
|
}
|
|
281
|
+
if (!this.supportsProtocolCapability("metadata_snapshot_only_v3")) {
|
|
282
|
+
return;
|
|
283
|
+
}
|
|
278
284
|
this.observedMachineOnline = event.active;
|
|
279
285
|
this.observedMachineOnlineAt = event.activeAt;
|
|
280
286
|
try {
|
|
@@ -282,11 +288,23 @@ class CodexSession {
|
|
|
282
288
|
...currentMetadata,
|
|
283
289
|
machineOnline: event.active,
|
|
284
290
|
machineOnlineAt: event.activeAt
|
|
285
|
-
})
|
|
291
|
+
}), {
|
|
292
|
+
durability: "snapshot-only",
|
|
293
|
+
requireCapability: true
|
|
294
|
+
});
|
|
286
295
|
} catch (error) {
|
|
287
296
|
logger.debug("[CodexSession] Failed to persist observer machine activity into metadata", { error });
|
|
288
297
|
}
|
|
289
298
|
};
|
|
299
|
+
supportsProtocolCapability(capability) {
|
|
300
|
+
if (supportsProtocolCapability(this.protocolDescriptor, capability)) {
|
|
301
|
+
return true;
|
|
302
|
+
}
|
|
303
|
+
if (supportsProtocolCapability(this.client.getProtocolV3DescriptorSnapshot?.(), capability)) {
|
|
304
|
+
return true;
|
|
305
|
+
}
|
|
306
|
+
return this.protocolStateSources.some((source) => supportsProtocolCapability(source.getProtocolV3DescriptorSnapshot?.(), capability) || supportsProtocolCapability(source.getProtocolV3SocketCapabilitiesSnapshot?.()?.protocol, capability));
|
|
307
|
+
}
|
|
290
308
|
}
|
|
291
309
|
|
|
292
310
|
const CodexDisplay = ({ messageBuffer, logPath, onExit, onSwitchToLocal, title }) => {
|
|
@@ -939,7 +957,9 @@ async function codexRemoteLauncher(session) {
|
|
|
939
957
|
let currentThinkingMessageId = null;
|
|
940
958
|
let currentHappyOrgTurn = null;
|
|
941
959
|
let unexpectedRuntimeStopRecovery = null;
|
|
942
|
-
const
|
|
960
|
+
const assistantMessageEmitter = new BufferedAssistantStreamEmitter({
|
|
961
|
+
send: (payload) => session.runtimeSession.sendCodexMessage(payload)
|
|
962
|
+
});
|
|
943
963
|
const permissionHandler = new CodexPermissionHandler(session.client);
|
|
944
964
|
const selectionHandler = new CodexSelectionHandler(session.client);
|
|
945
965
|
const conversationHistory = new ConversationHistory$1({ maxMessages: 20, maxCharacters: 5e4 });
|
|
@@ -982,14 +1002,14 @@ async function codexRemoteLauncher(session) {
|
|
|
982
1002
|
currentAssistantMessageId = null;
|
|
983
1003
|
currentThinkingMessageId = null;
|
|
984
1004
|
currentHappyOrgTurn = null;
|
|
985
|
-
|
|
1005
|
+
assistantMessageEmitter.reset();
|
|
986
1006
|
session.onThinkingChange(false);
|
|
987
1007
|
};
|
|
988
1008
|
const abortActiveTurn = () => {
|
|
989
1009
|
const activeController = rotateAbortController();
|
|
990
1010
|
activeController.abort();
|
|
991
1011
|
reasoningProcessor.abort();
|
|
992
|
-
|
|
1012
|
+
assistantMessageEmitter.reset();
|
|
993
1013
|
session.onThinkingChange(false);
|
|
994
1014
|
if (runtimeHandle) {
|
|
995
1015
|
void runtimeHandle.cancel().catch((error) => {
|
|
@@ -1022,7 +1042,7 @@ async function codexRemoteLauncher(session) {
|
|
|
1022
1042
|
message,
|
|
1023
1043
|
id: randomUUID()
|
|
1024
1044
|
});
|
|
1025
|
-
|
|
1045
|
+
assistantMessageEmitter.reset();
|
|
1026
1046
|
};
|
|
1027
1047
|
const emitTurnReport = (report) => {
|
|
1028
1048
|
session.runtimeSession.sendCodexMessage({
|
|
@@ -1083,44 +1103,39 @@ async function codexRemoteLauncher(session) {
|
|
|
1083
1103
|
id: randomUUID()
|
|
1084
1104
|
});
|
|
1085
1105
|
} else {
|
|
1086
|
-
|
|
1087
|
-
|
|
1106
|
+
assistantMessageEmitter.commit(
|
|
1107
|
+
assistantMessageEmitter.hasActive() ? finalMessage.slice(currentAssistantStreamStartLength) : finalMessage
|
|
1108
|
+
);
|
|
1088
1109
|
}
|
|
1089
1110
|
accumulatedResponse = "";
|
|
1090
1111
|
emittedResponseLength = 0;
|
|
1112
|
+
currentAssistantStreamStartLength = 0;
|
|
1091
1113
|
isResponseInProgress = false;
|
|
1092
1114
|
};
|
|
1093
1115
|
const emitPendingAssistantMessageDelta = (opts) => {
|
|
1094
1116
|
if (currentHappyOrgTurn && !opts?.force) {
|
|
1095
1117
|
return false;
|
|
1096
1118
|
}
|
|
1097
|
-
const
|
|
1098
|
-
if (!opts?.force && !
|
|
1119
|
+
const hasActiveStream = assistantMessageEmitter.hasActive();
|
|
1120
|
+
if (!opts?.force && !hasActiveStream) {
|
|
1099
1121
|
currentAssistantStreamStartLength = emittedResponseLength;
|
|
1100
1122
|
}
|
|
1101
|
-
const nextMessage = opts?.force &&
|
|
1123
|
+
const nextMessage = opts?.force && hasActiveStream ? accumulatedResponse.slice(currentAssistantStreamStartLength) : opts?.force ? accumulatedResponse : accumulatedResponse.slice(emittedResponseLength);
|
|
1102
1124
|
if (!nextMessage.trim()) {
|
|
1103
1125
|
if (opts?.force) {
|
|
1104
|
-
|
|
1105
|
-
currentAssistantStreamStartLength = emittedResponseLength;
|
|
1126
|
+
assistantMessageEmitter.reset();
|
|
1106
1127
|
}
|
|
1107
1128
|
return false;
|
|
1108
1129
|
}
|
|
1109
|
-
const
|
|
1110
|
-
session.runtimeSession.sendCodexMessage({
|
|
1111
|
-
type: "message",
|
|
1112
|
-
message: nextMessage,
|
|
1113
|
-
id: stream.messageId,
|
|
1114
|
-
...stream
|
|
1115
|
-
});
|
|
1130
|
+
const emitted = opts?.force ? assistantMessageEmitter.commit(nextMessage) : assistantMessageEmitter.pushDelta(nextMessage);
|
|
1116
1131
|
emittedResponseLength = accumulatedResponse.length;
|
|
1117
1132
|
if (opts?.force) {
|
|
1118
1133
|
currentAssistantStreamStartLength = emittedResponseLength;
|
|
1119
1134
|
}
|
|
1120
|
-
return
|
|
1135
|
+
return emitted;
|
|
1121
1136
|
};
|
|
1122
1137
|
const commitActiveAssistantMessageStream = () => {
|
|
1123
|
-
if (!
|
|
1138
|
+
if (!assistantMessageEmitter.hasActive()) {
|
|
1124
1139
|
return false;
|
|
1125
1140
|
}
|
|
1126
1141
|
return emitPendingAssistantMessageDelta({ force: true });
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var persistence = require('./types-
|
|
4
|
-
var sessionControl = require('./sessionControl-
|
|
5
|
-
var index = require('./index-
|
|
3
|
+
var persistence = require('./types-Be833t7e.cjs');
|
|
4
|
+
var sessionControl = require('./sessionControl-BM3380c0.cjs');
|
|
5
|
+
var index = require('./index-Cd7d2BMe.cjs');
|
|
6
6
|
require('cross-spawn');
|
|
7
7
|
require('@agentclientprotocol/sdk');
|
|
8
8
|
var node_crypto = require('node:crypto');
|
|
@@ -26,18 +26,18 @@ require('tweetnacl');
|
|
|
26
26
|
require('open');
|
|
27
27
|
var React = require('react');
|
|
28
28
|
var ink = require('ink');
|
|
29
|
-
var ProviderSelectionHandler = require('./ProviderSelectionHandler-
|
|
29
|
+
var ProviderSelectionHandler = require('./ProviderSelectionHandler-BsIj6tUM.cjs');
|
|
30
30
|
require('socket.io-client');
|
|
31
31
|
require('expo-server-sdk');
|
|
32
|
-
var ConversationHistory = require('./ConversationHistory-
|
|
33
|
-
var RuntimeShell = require('./RuntimeShell-
|
|
34
|
-
var AcpBackend = require('./AcpBackend-
|
|
32
|
+
var ConversationHistory = require('./ConversationHistory-DYF60lvE.cjs');
|
|
33
|
+
var RuntimeShell = require('./RuntimeShell-CoXntnel.cjs');
|
|
34
|
+
var AcpBackend = require('./AcpBackend-B3s99ivd.cjs');
|
|
35
35
|
var resolveCommand = require('./resolveCommand-DYMd9PNC.cjs');
|
|
36
|
-
var codex = require('./codex-
|
|
37
|
-
var BaseReasoningProcessor = require('./BaseReasoningProcessor-
|
|
36
|
+
var codex = require('./codex-CGoezd1l.cjs');
|
|
37
|
+
var BaseReasoningProcessor = require('./BaseReasoningProcessor-DgyEX2ex.cjs');
|
|
38
38
|
var future = require('./future-Dq4Ha1Dn.cjs');
|
|
39
|
-
var bootstrapManagedProviderSession = require('./bootstrapManagedProviderSession-
|
|
40
|
-
var installFatalProcessHandlers = require('./installFatalProcessHandlers-
|
|
39
|
+
var bootstrapManagedProviderSession = require('./bootstrapManagedProviderSession-DuPoeGsz.cjs');
|
|
40
|
+
var installFatalProcessHandlers = require('./installFatalProcessHandlers-CNnOiioM.cjs');
|
|
41
41
|
require('zod');
|
|
42
42
|
require('qrcode-terminal');
|
|
43
43
|
require('node:module');
|
|
@@ -56,7 +56,7 @@ const DEFAULT_CAPABILITIES = {
|
|
|
56
56
|
structuredSpawnErrors: false,
|
|
57
57
|
metadataWatch: false
|
|
58
58
|
};
|
|
59
|
-
function supportsProtocolCapability(protocolDescriptor, capability) {
|
|
59
|
+
function supportsProtocolCapability$1(protocolDescriptor, capability) {
|
|
60
60
|
return Array.isArray(protocolDescriptor?.capabilities) && protocolDescriptor.capabilities.includes(capability);
|
|
61
61
|
}
|
|
62
62
|
function resolveProtocolStateSources(options) {
|
|
@@ -80,7 +80,7 @@ function resolveCodexRuntimeSessionCapabilities(options) {
|
|
|
80
80
|
return source.getProtocolV3SocketCapabilitiesSnapshot?.()?.connectionType === "user-scoped";
|
|
81
81
|
});
|
|
82
82
|
const protocolDescriptors = protocolStateSources.map((source) => source.getProtocolV3DescriptorSnapshot?.() ?? source.getProtocolV3SocketCapabilitiesSnapshot?.()?.protocol ?? null).filter((descriptor) => descriptor !== null);
|
|
83
|
-
const supportsCapability = (capability) => protocolDescriptors.some((descriptor) => supportsProtocolCapability(descriptor, capability)) || supportsProtocolCapability(options.protocolDescriptor, capability);
|
|
83
|
+
const supportsCapability = (capability) => protocolDescriptors.some((descriptor) => supportsProtocolCapability$1(descriptor, capability)) || supportsProtocolCapability$1(options.protocolDescriptor, capability);
|
|
84
84
|
return {
|
|
85
85
|
...DEFAULT_CAPABILITIES,
|
|
86
86
|
committedMessageAcks: supportsCapability("message_ack_v3"),
|
|
@@ -158,6 +158,9 @@ function createCodexRuntimeSession(options) {
|
|
|
158
158
|
};
|
|
159
159
|
}
|
|
160
160
|
|
|
161
|
+
function supportsProtocolCapability(descriptor, capability) {
|
|
162
|
+
return Array.isArray(descriptor?.capabilities) && descriptor.capabilities.includes(capability);
|
|
163
|
+
}
|
|
161
164
|
class CodexSession {
|
|
162
165
|
path;
|
|
163
166
|
logPath;
|
|
@@ -277,6 +280,9 @@ class CodexSession {
|
|
|
277
280
|
if (alreadyObserved || alreadyPersisted) {
|
|
278
281
|
return;
|
|
279
282
|
}
|
|
283
|
+
if (!this.supportsProtocolCapability("metadata_snapshot_only_v3")) {
|
|
284
|
+
return;
|
|
285
|
+
}
|
|
280
286
|
this.observedMachineOnline = event.active;
|
|
281
287
|
this.observedMachineOnlineAt = event.activeAt;
|
|
282
288
|
try {
|
|
@@ -284,11 +290,23 @@ class CodexSession {
|
|
|
284
290
|
...currentMetadata,
|
|
285
291
|
machineOnline: event.active,
|
|
286
292
|
machineOnlineAt: event.activeAt
|
|
287
|
-
})
|
|
293
|
+
}), {
|
|
294
|
+
durability: "snapshot-only",
|
|
295
|
+
requireCapability: true
|
|
296
|
+
});
|
|
288
297
|
} catch (error) {
|
|
289
298
|
persistence.logger.debug("[CodexSession] Failed to persist observer machine activity into metadata", { error });
|
|
290
299
|
}
|
|
291
300
|
};
|
|
301
|
+
supportsProtocolCapability(capability) {
|
|
302
|
+
if (supportsProtocolCapability(this.protocolDescriptor, capability)) {
|
|
303
|
+
return true;
|
|
304
|
+
}
|
|
305
|
+
if (supportsProtocolCapability(this.client.getProtocolV3DescriptorSnapshot?.(), capability)) {
|
|
306
|
+
return true;
|
|
307
|
+
}
|
|
308
|
+
return this.protocolStateSources.some((source) => supportsProtocolCapability(source.getProtocolV3DescriptorSnapshot?.(), capability) || supportsProtocolCapability(source.getProtocolV3SocketCapabilitiesSnapshot?.()?.protocol, capability));
|
|
309
|
+
}
|
|
292
310
|
}
|
|
293
311
|
|
|
294
312
|
const CodexDisplay = ({ messageBuffer, logPath, onExit, onSwitchToLocal, title }) => {
|
|
@@ -941,7 +959,9 @@ async function codexRemoteLauncher(session) {
|
|
|
941
959
|
let currentThinkingMessageId = null;
|
|
942
960
|
let currentHappyOrgTurn = null;
|
|
943
961
|
let unexpectedRuntimeStopRecovery = null;
|
|
944
|
-
const
|
|
962
|
+
const assistantMessageEmitter = new sessionControl.BufferedAssistantStreamEmitter({
|
|
963
|
+
send: (payload) => session.runtimeSession.sendCodexMessage(payload)
|
|
964
|
+
});
|
|
945
965
|
const permissionHandler = new CodexPermissionHandler(session.client);
|
|
946
966
|
const selectionHandler = new CodexSelectionHandler(session.client);
|
|
947
967
|
const conversationHistory = new ConversationHistory.ConversationHistory({ maxMessages: 20, maxCharacters: 5e4 });
|
|
@@ -984,14 +1004,14 @@ async function codexRemoteLauncher(session) {
|
|
|
984
1004
|
currentAssistantMessageId = null;
|
|
985
1005
|
currentThinkingMessageId = null;
|
|
986
1006
|
currentHappyOrgTurn = null;
|
|
987
|
-
|
|
1007
|
+
assistantMessageEmitter.reset();
|
|
988
1008
|
session.onThinkingChange(false);
|
|
989
1009
|
};
|
|
990
1010
|
const abortActiveTurn = () => {
|
|
991
1011
|
const activeController = rotateAbortController();
|
|
992
1012
|
activeController.abort();
|
|
993
1013
|
reasoningProcessor.abort();
|
|
994
|
-
|
|
1014
|
+
assistantMessageEmitter.reset();
|
|
995
1015
|
session.onThinkingChange(false);
|
|
996
1016
|
if (runtimeHandle) {
|
|
997
1017
|
void runtimeHandle.cancel().catch((error) => {
|
|
@@ -1024,7 +1044,7 @@ async function codexRemoteLauncher(session) {
|
|
|
1024
1044
|
message,
|
|
1025
1045
|
id: node_crypto.randomUUID()
|
|
1026
1046
|
});
|
|
1027
|
-
|
|
1047
|
+
assistantMessageEmitter.reset();
|
|
1028
1048
|
};
|
|
1029
1049
|
const emitTurnReport = (report) => {
|
|
1030
1050
|
session.runtimeSession.sendCodexMessage({
|
|
@@ -1085,44 +1105,39 @@ async function codexRemoteLauncher(session) {
|
|
|
1085
1105
|
id: node_crypto.randomUUID()
|
|
1086
1106
|
});
|
|
1087
1107
|
} else {
|
|
1088
|
-
|
|
1089
|
-
|
|
1108
|
+
assistantMessageEmitter.commit(
|
|
1109
|
+
assistantMessageEmitter.hasActive() ? finalMessage.slice(currentAssistantStreamStartLength) : finalMessage
|
|
1110
|
+
);
|
|
1090
1111
|
}
|
|
1091
1112
|
accumulatedResponse = "";
|
|
1092
1113
|
emittedResponseLength = 0;
|
|
1114
|
+
currentAssistantStreamStartLength = 0;
|
|
1093
1115
|
isResponseInProgress = false;
|
|
1094
1116
|
};
|
|
1095
1117
|
const emitPendingAssistantMessageDelta = (opts) => {
|
|
1096
1118
|
if (currentHappyOrgTurn && !opts?.force) {
|
|
1097
1119
|
return false;
|
|
1098
1120
|
}
|
|
1099
|
-
const
|
|
1100
|
-
if (!opts?.force && !
|
|
1121
|
+
const hasActiveStream = assistantMessageEmitter.hasActive();
|
|
1122
|
+
if (!opts?.force && !hasActiveStream) {
|
|
1101
1123
|
currentAssistantStreamStartLength = emittedResponseLength;
|
|
1102
1124
|
}
|
|
1103
|
-
const nextMessage = opts?.force &&
|
|
1125
|
+
const nextMessage = opts?.force && hasActiveStream ? accumulatedResponse.slice(currentAssistantStreamStartLength) : opts?.force ? accumulatedResponse : accumulatedResponse.slice(emittedResponseLength);
|
|
1104
1126
|
if (!nextMessage.trim()) {
|
|
1105
1127
|
if (opts?.force) {
|
|
1106
|
-
|
|
1107
|
-
currentAssistantStreamStartLength = emittedResponseLength;
|
|
1128
|
+
assistantMessageEmitter.reset();
|
|
1108
1129
|
}
|
|
1109
1130
|
return false;
|
|
1110
1131
|
}
|
|
1111
|
-
const
|
|
1112
|
-
session.runtimeSession.sendCodexMessage({
|
|
1113
|
-
type: "message",
|
|
1114
|
-
message: nextMessage,
|
|
1115
|
-
id: stream.messageId,
|
|
1116
|
-
...stream
|
|
1117
|
-
});
|
|
1132
|
+
const emitted = opts?.force ? assistantMessageEmitter.commit(nextMessage) : assistantMessageEmitter.pushDelta(nextMessage);
|
|
1118
1133
|
emittedResponseLength = accumulatedResponse.length;
|
|
1119
1134
|
if (opts?.force) {
|
|
1120
1135
|
currentAssistantStreamStartLength = emittedResponseLength;
|
|
1121
1136
|
}
|
|
1122
|
-
return
|
|
1137
|
+
return emitted;
|
|
1123
1138
|
};
|
|
1124
1139
|
const commitActiveAssistantMessageStream = () => {
|
|
1125
|
-
if (!
|
|
1140
|
+
if (!assistantMessageEmitter.hasActive()) {
|
|
1126
1141
|
return false;
|
|
1127
1142
|
}
|
|
1128
1143
|
return emitPendingAssistantMessageDelta({ force: true });
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { c as createCursorBackend } from './cursor-
|
|
1
|
+
import { c as createCursorBackend } from './cursor-BxWThmbf.mjs';
|
|
2
2
|
import { randomUUID } from 'node:crypto';
|
|
3
|
-
import { l as logger, b as connectionState, A as ApiClient, h as hashObject
|
|
4
|
-
import { B as BasePermissionHandler, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, r as registerKillSessionHandler,
|
|
5
|
-
import { r as readManagedSessionTag, a as resolveManagedSessionTag, s as stopCaffeinate, b as closeProviderSession } from './index-
|
|
6
|
-
import { b as bootstrapManagedProviderSession } from './bootstrapManagedProviderSession-
|
|
7
|
-
import { i as installFatalProcessHandlers } from './installFatalProcessHandlers-
|
|
8
|
-
import { R as RuntimeShell } from './RuntimeShell-
|
|
9
|
-
import './AcpBackend-
|
|
3
|
+
import { l as logger, b as connectionState, A as ApiClient, h as hashObject } from './types-CDuesyX_.mjs';
|
|
4
|
+
import { B as BasePermissionHandler, e as ensureManagedProviderMachine, M as MissingMachineIdError, b as MessageQueue2, c as BufferedAssistantStreamEmitter, r as registerKillSessionHandler, d as resolveHappyOrgQueuedTurn, s as syncControlledByUserState, f as buildHappyOrgTurnPrompt, w as waitForResponseCompleteWithAbort, h as finalizeHappyOrgTurnWithBusinessAck, i as forwardAgentMessageToProviderSession } from './sessionControl-D8sHsOfs.mjs';
|
|
5
|
+
import { r as readManagedSessionTag, a as resolveManagedSessionTag, s as stopCaffeinate, b as closeProviderSession } from './index-B_Cm6MhB.mjs';
|
|
6
|
+
import { b as bootstrapManagedProviderSession } from './bootstrapManagedProviderSession-HezKZOHo.mjs';
|
|
7
|
+
import { i as installFatalProcessHandlers } from './installFatalProcessHandlers-DeJFoOCl.mjs';
|
|
8
|
+
import { R as RuntimeShell } from './RuntimeShell-DZhi4Zhd.mjs';
|
|
9
|
+
import './AcpBackend-Dephumdg.mjs';
|
|
10
10
|
import 'cross-spawn';
|
|
11
11
|
import '@agentclientprotocol/sdk';
|
|
12
12
|
import 'ps-list';
|
|
@@ -186,7 +186,7 @@ async function runManagedAcpProvider(opts) {
|
|
|
186
186
|
let shouldExit = false;
|
|
187
187
|
let cleanupStarted = false;
|
|
188
188
|
const abortController = new AbortController();
|
|
189
|
-
|
|
189
|
+
let assistantMessageEmitter;
|
|
190
190
|
const messageQueue = new MessageQueue2((mode) => hashObject(mode));
|
|
191
191
|
let startupRolePrompt = null;
|
|
192
192
|
const { metadata, session: initialSession, reconnectionHandle, happyOrgStartupBinding } = await bootstrapManagedProviderSession({
|
|
@@ -209,6 +209,9 @@ async function runManagedAcpProvider(opts) {
|
|
|
209
209
|
const sendAgentMessage = (body) => {
|
|
210
210
|
sessionClient.sendAgentMessage(provider, body);
|
|
211
211
|
};
|
|
212
|
+
assistantMessageEmitter = new BufferedAssistantStreamEmitter({
|
|
213
|
+
send: (payload) => sendAgentMessage(payload)
|
|
214
|
+
});
|
|
212
215
|
const sendTaskStarted = () => {
|
|
213
216
|
if (taskStartedSent) {
|
|
214
217
|
return;
|
|
@@ -230,24 +233,13 @@ async function runManagedAcpProvider(opts) {
|
|
|
230
233
|
turnAbortedSent = true;
|
|
231
234
|
};
|
|
232
235
|
const commitAssistantStream = (text) => {
|
|
233
|
-
if (!
|
|
236
|
+
if (!assistantMessageEmitter.hasActive() && text.length === 0) {
|
|
234
237
|
return;
|
|
235
238
|
}
|
|
236
|
-
|
|
237
|
-
type: "message",
|
|
238
|
-
message: text,
|
|
239
|
-
...assistantMessageStream.commit()
|
|
240
|
-
});
|
|
239
|
+
assistantMessageEmitter.commit(text);
|
|
241
240
|
};
|
|
242
241
|
const abortAssistantStream = () => {
|
|
243
|
-
|
|
244
|
-
return;
|
|
245
|
-
}
|
|
246
|
-
sendAgentMessage({
|
|
247
|
-
type: "message",
|
|
248
|
-
message: "",
|
|
249
|
-
...assistantMessageStream.abort()
|
|
250
|
-
});
|
|
242
|
+
assistantMessageEmitter.abort();
|
|
251
243
|
};
|
|
252
244
|
const handleRuntimeMessage = (msg) => {
|
|
253
245
|
if (msg.type === "model-output") {
|
|
@@ -256,11 +248,7 @@ async function runManagedAcpProvider(opts) {
|
|
|
256
248
|
return;
|
|
257
249
|
}
|
|
258
250
|
accumulatedResponse += delta;
|
|
259
|
-
|
|
260
|
-
type: "message",
|
|
261
|
-
message: delta,
|
|
262
|
-
...assistantMessageStream.delta()
|
|
263
|
-
});
|
|
251
|
+
assistantMessageEmitter.pushDelta(delta);
|
|
264
252
|
return;
|
|
265
253
|
}
|
|
266
254
|
if (msg.type === "status") {
|
|
@@ -413,6 +401,7 @@ ${originalUserMessage}` : originalUserMessage;
|
|
|
413
401
|
}
|
|
414
402
|
currentPermissionMode = normalizePermissionMode(queued.mode.permissionMode, currentPermissionMode);
|
|
415
403
|
permissionHandler.setPermissionMode(currentPermissionMode);
|
|
404
|
+
assistantMessageEmitter.reset();
|
|
416
405
|
accumulatedResponse = "";
|
|
417
406
|
taskStartedSent = false;
|
|
418
407
|
turnAbortedSent = false;
|
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
-
var cursor = require('./cursor-
|
|
3
|
+
var cursor = require('./cursor-DOu6sau_.cjs');
|
|
4
4
|
var node_crypto = require('node:crypto');
|
|
5
|
-
var persistence = require('./types-
|
|
6
|
-
var sessionControl = require('./sessionControl-
|
|
7
|
-
var index = require('./index-
|
|
8
|
-
var bootstrapManagedProviderSession = require('./bootstrapManagedProviderSession-
|
|
9
|
-
var installFatalProcessHandlers = require('./installFatalProcessHandlers-
|
|
10
|
-
var RuntimeShell = require('./RuntimeShell-
|
|
11
|
-
require('./AcpBackend-
|
|
5
|
+
var persistence = require('./types-Be833t7e.cjs');
|
|
6
|
+
var sessionControl = require('./sessionControl-BM3380c0.cjs');
|
|
7
|
+
var index = require('./index-Cd7d2BMe.cjs');
|
|
8
|
+
var bootstrapManagedProviderSession = require('./bootstrapManagedProviderSession-DuPoeGsz.cjs');
|
|
9
|
+
var installFatalProcessHandlers = require('./installFatalProcessHandlers-CNnOiioM.cjs');
|
|
10
|
+
var RuntimeShell = require('./RuntimeShell-CoXntnel.cjs');
|
|
11
|
+
require('./AcpBackend-B3s99ivd.cjs');
|
|
12
12
|
require('cross-spawn');
|
|
13
13
|
require('@agentclientprotocol/sdk');
|
|
14
14
|
require('ps-list');
|
|
@@ -188,7 +188,7 @@ async function runManagedAcpProvider(opts) {
|
|
|
188
188
|
let shouldExit = false;
|
|
189
189
|
let cleanupStarted = false;
|
|
190
190
|
const abortController = new AbortController();
|
|
191
|
-
|
|
191
|
+
let assistantMessageEmitter;
|
|
192
192
|
const messageQueue = new sessionControl.MessageQueue2((mode) => persistence.hashObject(mode));
|
|
193
193
|
let startupRolePrompt = null;
|
|
194
194
|
const { metadata, session: initialSession, reconnectionHandle, happyOrgStartupBinding } = await bootstrapManagedProviderSession.bootstrapManagedProviderSession({
|
|
@@ -211,6 +211,9 @@ async function runManagedAcpProvider(opts) {
|
|
|
211
211
|
const sendAgentMessage = (body) => {
|
|
212
212
|
sessionClient.sendAgentMessage(provider, body);
|
|
213
213
|
};
|
|
214
|
+
assistantMessageEmitter = new sessionControl.BufferedAssistantStreamEmitter({
|
|
215
|
+
send: (payload) => sendAgentMessage(payload)
|
|
216
|
+
});
|
|
214
217
|
const sendTaskStarted = () => {
|
|
215
218
|
if (taskStartedSent) {
|
|
216
219
|
return;
|
|
@@ -232,24 +235,13 @@ async function runManagedAcpProvider(opts) {
|
|
|
232
235
|
turnAbortedSent = true;
|
|
233
236
|
};
|
|
234
237
|
const commitAssistantStream = (text) => {
|
|
235
|
-
if (!
|
|
238
|
+
if (!assistantMessageEmitter.hasActive() && text.length === 0) {
|
|
236
239
|
return;
|
|
237
240
|
}
|
|
238
|
-
|
|
239
|
-
type: "message",
|
|
240
|
-
message: text,
|
|
241
|
-
...assistantMessageStream.commit()
|
|
242
|
-
});
|
|
241
|
+
assistantMessageEmitter.commit(text);
|
|
243
242
|
};
|
|
244
243
|
const abortAssistantStream = () => {
|
|
245
|
-
|
|
246
|
-
return;
|
|
247
|
-
}
|
|
248
|
-
sendAgentMessage({
|
|
249
|
-
type: "message",
|
|
250
|
-
message: "",
|
|
251
|
-
...assistantMessageStream.abort()
|
|
252
|
-
});
|
|
244
|
+
assistantMessageEmitter.abort();
|
|
253
245
|
};
|
|
254
246
|
const handleRuntimeMessage = (msg) => {
|
|
255
247
|
if (msg.type === "model-output") {
|
|
@@ -258,11 +250,7 @@ async function runManagedAcpProvider(opts) {
|
|
|
258
250
|
return;
|
|
259
251
|
}
|
|
260
252
|
accumulatedResponse += delta;
|
|
261
|
-
|
|
262
|
-
type: "message",
|
|
263
|
-
message: delta,
|
|
264
|
-
...assistantMessageStream.delta()
|
|
265
|
-
});
|
|
253
|
+
assistantMessageEmitter.pushDelta(delta);
|
|
266
254
|
return;
|
|
267
255
|
}
|
|
268
256
|
if (msg.type === "status") {
|
|
@@ -415,6 +403,7 @@ ${originalUserMessage}` : originalUserMessage;
|
|
|
415
403
|
}
|
|
416
404
|
currentPermissionMode = normalizePermissionMode(queued.mode.permissionMode, currentPermissionMode);
|
|
417
405
|
permissionHandler.setPermissionMode(currentPermissionMode);
|
|
406
|
+
assistantMessageEmitter.reset();
|
|
418
407
|
accumulatedResponse = "";
|
|
419
408
|
taskStartedSent = false;
|
|
420
409
|
turnAbortedSent = false;
|