@yeaft/webchat-agent 1.0.489 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@yeaft/webchat-agent",
3
- "version": "1.0.489",
3
+ "version": "1.0.491",
4
4
  "description": "Remote worker agent for Yeaft Web Code Agent — connects the native Yeaft engine, CLI providers, and workbench tools",
5
5
  "main": "index.js",
6
6
  "type": "module",
package/terminal.js CHANGED
@@ -78,7 +78,7 @@ function terminalOwner(source) {
78
78
  };
79
79
  }
80
80
 
81
- function terminalOwnerMatches(term, msg) {
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 (!terminalOwnerMatches(existing, msg)) {
156
+ if (!terminalRouteOwnerMatches(existing, msg)) {
151
157
  rejectTerminalOwnerMismatch(msg, terminalId);
152
158
  return;
153
159
  }