@yeaft/webchat-agent 0.1.789 → 0.1.790
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 +1 -1
- package/unify/tools/route-forward.js +5 -3
- package/unify/web-bridge.js +8 -28
package/package.json
CHANGED
|
@@ -109,9 +109,11 @@ Returns JSON: { ok, dispatched?, error?, detail? }.`,
|
|
|
109
109
|
// task-707: hand off control. Successful forward means the originating
|
|
110
110
|
// turn should NOT continue generating — the target VPs are now in
|
|
111
111
|
// charge. Signal the engine to break the tool-loop after this batch.
|
|
112
|
-
// The structured payload
|
|
113
|
-
//
|
|
114
|
-
//
|
|
112
|
+
// The structured payload lands on `turn_end.detail` as audit metadata
|
|
113
|
+
// (kind, fromVpId, dispatched, broadcast, text, reason); the frontend
|
|
114
|
+
// renders the hand-off as a Route tool chip from the tool_call
|
|
115
|
+
// envelope already on the wire (see PR #793 — the previous
|
|
116
|
+
// `group_handoff` UI event was removed when its single consumer was).
|
|
115
117
|
if (typeof ctx.requestEndTurn === 'function') {
|
|
116
118
|
try {
|
|
117
119
|
ctx.requestEndTurn({
|
package/unify/web-bridge.js
CHANGED
|
@@ -1404,34 +1404,14 @@ function handleEngineEvent(event, hctx) {
|
|
|
1404
1404
|
break;
|
|
1405
1405
|
|
|
1406
1406
|
case 'turn_end':
|
|
1407
|
-
//
|
|
1408
|
-
//
|
|
1409
|
-
//
|
|
1410
|
-
//
|
|
1411
|
-
//
|
|
1412
|
-
//
|
|
1413
|
-
//
|
|
1414
|
-
//
|
|
1415
|
-
// The `version` field is the wire schema version. Today there is
|
|
1416
|
-
// only one shape. Future variants (e.g. a second hand-off tool)
|
|
1417
|
-
// can bump it without breaking older frontends — they ignore
|
|
1418
|
-
// unknown versions.
|
|
1419
|
-
if (event.stopReason === 'tool_handoff' && event.detail && typeof event.detail === 'object') {
|
|
1420
|
-
const detail = event.detail;
|
|
1421
|
-
if (detail.kind === 'route_forward') {
|
|
1422
|
-
sendUnifyEvent({
|
|
1423
|
-
type: 'group_handoff',
|
|
1424
|
-
version: 1,
|
|
1425
|
-
kind: 'route_forward',
|
|
1426
|
-
fromVpId: detail.fromVpId || hctx.vpId,
|
|
1427
|
-
toVpIds: Array.isArray(detail.dispatched) ? detail.dispatched.slice() : [],
|
|
1428
|
-
broadcast: Boolean(detail.broadcast),
|
|
1429
|
-
text: typeof detail.text === 'string' ? detail.text : '',
|
|
1430
|
-
reason: detail.reason || null,
|
|
1431
|
-
ts: Date.now(),
|
|
1432
|
-
}, envelope);
|
|
1433
|
-
}
|
|
1434
|
-
}
|
|
1407
|
+
// turn_end variants are handled by the outer loop (result /
|
|
1408
|
+
// end_turn semantics). PR #793 removed the `group_handoff`
|
|
1409
|
+
// wire event that the frontend used to render a "↪ 已转交给"
|
|
1410
|
+
// pill — the Route tool chip (rendered from the tool_call
|
|
1411
|
+
// envelope already on the wire) is the single source of truth
|
|
1412
|
+
// for hand-off UX. If a future feature (notification toast,
|
|
1413
|
+
// typing-chain animation, …) needs the structured payload,
|
|
1414
|
+
// re-emit a wire event here from `event.detail`.
|
|
1435
1415
|
break;
|
|
1436
1416
|
|
|
1437
1417
|
case 'usage':
|