|
13 | 13 | * - Raw RPC mode (> method.name key=val) |
14 | 14 | */ |
15 | 15 |
|
16 | | -import { useCallback, useEffect, useLayoutEffect, useMemo, useRef, useState, type CSSProperties } from 'react' |
| 16 | +import { |
| 17 | + useCallback, |
| 18 | + useEffect, |
| 19 | + useLayoutEffect, |
| 20 | + useMemo, |
| 21 | + useRef, |
| 22 | + useState, |
| 23 | + type CSSProperties, |
| 24 | +} from 'react' |
17 | 25 | import { Icon } from '@iconify/react' |
18 | 26 | import { useGateway } from '@/context/gateway-context' |
19 | 27 | import { useTheme } from '@/context/theme-context' |
@@ -450,13 +458,23 @@ export function GatewayTerminal() { |
450 | 458 | (typeof p.session === 'object' && p.session !== null |
451 | 459 | ? (p.session as Record<string, unknown>).key |
452 | 460 | : undefined)) as string | undefined |
453 | | - const eventIdempotencyKey = (p.idempotencyKey ?? p.idempotency_key) as string | undefined |
| 461 | + const eventIdempotencyKey = (p.idempotencyKey ?? |
| 462 | + p.idempotency_key ?? |
| 463 | + p.idemKey ?? |
| 464 | + p.runId) as string | undefined |
454 | 465 |
|
455 | 466 | // Accept if: idempotency key matches one we sent, OR session is terminal's, OR no session key |
456 | | - const idempotencyMatch = eventIdempotencyKey && pendingIdempotencyKeys.current.has(eventIdempotencyKey) |
| 467 | + const idempotencyMatch = |
| 468 | + eventIdempotencyKey && pendingIdempotencyKeys.current.has(eventIdempotencyKey) |
457 | 469 | const sessionMatch = !eventSessionKey || eventSessionKey === TERMINAL_SESSION_KEY |
458 | 470 |
|
459 | | - console.log('[GW-Terminal] chat event:', { state, sessionKey: eventSessionKey, idempotencyKey: eventIdempotencyKey, idempotencyMatch, sessionMatch }) |
| 471 | + console.log('[GW-Terminal] chat event:', { |
| 472 | + state, |
| 473 | + sessionKey: eventSessionKey, |
| 474 | + idempotencyKey: eventIdempotencyKey, |
| 475 | + idempotencyMatch, |
| 476 | + sessionMatch, |
| 477 | + }) |
460 | 478 |
|
461 | 479 | if (!idempotencyMatch && !sessionMatch) { |
462 | 480 | console.log('[GW-Terminal] skipping event — no match:', eventSessionKey) |
@@ -586,7 +604,10 @@ export function GatewayTerminal() { |
586 | 604 | })) as Record<string, unknown> | undefined |
587 | 605 |
|
588 | 606 | const respStatus = resp?.status as string | undefined |
589 | | - console.log('[GW-Terminal] chat.send response:', { status: respStatus, keys: resp ? Object.keys(resp).join(',') : 'null' }) |
| 607 | + console.log('[GW-Terminal] chat.send response:', { |
| 608 | + status: respStatus, |
| 609 | + keys: resp ? Object.keys(resp).join(',') : 'null', |
| 610 | + }) |
590 | 611 |
|
591 | 612 | // Check if the response contains an inline reply (synchronous path) |
592 | 613 | const inlineReply = extractEventText(resp) |
|
0 commit comments