@yeaft/webchat-agent 1.0.490 → 1.0.491
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/index.js +1 -1
- package/local-runtime/server/handlers/agent-file-terminal.js +62 -34
- package/local-runtime/server/handlers/client-misc.js +3 -0
- package/local-runtime/server/handlers/client-workbench.js +95 -2
- package/local-runtime/server/workbench-correlation.js +185 -20
- package/local-runtime/server/workbench-route.js +14 -0
- package/local-runtime/server/ws-client.js +17 -13
- package/local-runtime/version.json +1 -1
- package/local-runtime/web/app.bundle.js +82 -82
- package/local-runtime/web/app.bundle.js.gz +0 -0
- package/local-runtime/web/index.html +1 -1
- package/package.json +1 -1
- package/terminal.js +8 -2
|
Binary file
|
package/package.json
CHANGED
package/terminal.js
CHANGED
|
@@ -78,7 +78,7 @@ function terminalOwner(source) {
|
|
|
78
78
|
};
|
|
79
79
|
}
|
|
80
80
|
|
|
81
|
-
function
|
|
81
|
+
function terminalRouteOwnerMatches(term, msg) {
|
|
82
82
|
if (!term || !msg) return false;
|
|
83
83
|
const owner = terminalOwner(term);
|
|
84
84
|
const request = terminalOwner(msg);
|
|
@@ -92,6 +92,12 @@ function terminalOwnerMatches(term, msg) {
|
|
|
92
92
|
&& request.conversationId === owner.conversationId;
|
|
93
93
|
}
|
|
94
94
|
|
|
95
|
+
function terminalOwnerMatches(term, msg) {
|
|
96
|
+
if (!terminalRouteOwnerMatches(term, msg)) return false;
|
|
97
|
+
const requestId = msg?._workbenchRequestId || '';
|
|
98
|
+
return !requestId || requestId === (term?._workbenchRequestId || '');
|
|
99
|
+
}
|
|
100
|
+
|
|
95
101
|
function rejectTerminalOwnerMismatch(msg, terminalId) {
|
|
96
102
|
ctx.sendToServer({
|
|
97
103
|
type: 'terminal_error',
|
|
@@ -147,7 +153,7 @@ export async function handleTerminalCreate(msg) {
|
|
|
147
153
|
// immutable owner, never by another Session that guessed the id.
|
|
148
154
|
if (ctx.terminals.has(terminalId)) {
|
|
149
155
|
const existing = ctx.terminals.get(terminalId);
|
|
150
|
-
if (!
|
|
156
|
+
if (!terminalRouteOwnerMatches(existing, msg)) {
|
|
151
157
|
rejectTerminalOwnerMismatch(msg, terminalId);
|
|
152
158
|
return;
|
|
153
159
|
}
|