@yeaft/webchat-agent 0.1.904 → 0.1.906

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": "0.1.904",
3
+ "version": "0.1.906",
4
4
  "description": "Remote agent for Yeaft WebChat — connects worker machines to the central server",
5
5
  "main": "index.js",
6
6
  "type": "module",
@@ -1503,7 +1503,16 @@ export function handleYeaftCreateSession(msg) {
1503
1503
 
1504
1504
  export function handleYeaftRenameSession(msg) {
1505
1505
  const requestId = msg && msg.requestId;
1506
- const sessionId = msg && msg.sessionId;
1506
+ // fix-yeaft-delete-and-agent-revert: accept legacy `groupId` in
1507
+ // addition to `sessionId`. The contract documented in
1508
+ // `web/stores/sessions.js` header ("Inbound payloads may carry
1509
+ // either sessionId (new) or groupId (legacy); both are accepted,
1510
+ // prefer sessionId") was only honored on web-side reads; the agent
1511
+ // handlers were silently rejecting the older wire shape that today's
1512
+ // SessionSettingsModal still sends. That's what made delete/rename/
1513
+ // archive/update_config/add_member/remove_member/set_default_vp
1514
+ // all throw `not_found` on undefined ids.
1515
+ const sessionId = (msg && (msg.sessionId || msg.groupId)) || null;
1507
1516
  const name = msg && msg.name;
1508
1517
  try {
1509
1518
  const yeaftDir = ctx.CONFIG?.yeaftDir;
@@ -1532,7 +1541,8 @@ export function handleYeaftRenameSession(msg) {
1532
1541
  */
1533
1542
  export function handleYeaftUpdateSession(msg) {
1534
1543
  const requestId = msg && msg.requestId;
1535
- const sessionId = msg && msg.sessionId;
1544
+ // wire-compat: accept legacy `groupId` (see handleYeaftRenameSession).
1545
+ const sessionId = (msg && (msg.sessionId || msg.groupId)) || null;
1536
1546
  const patch = (msg && msg.patch && typeof msg.patch === 'object') ? msg.patch : null;
1537
1547
  try {
1538
1548
  const hasName = patch && typeof patch.name === 'string' && patch.name.trim().length > 0;
@@ -1566,7 +1576,8 @@ export function handleYeaftUpdateSession(msg) {
1566
1576
  */
1567
1577
  export function handleYeaftUpdateSessionConfig(msg) {
1568
1578
  const requestId = msg && msg.requestId;
1569
- const sessionId = msg && msg.sessionId;
1579
+ // wire-compat: accept legacy `groupId` (see handleYeaftRenameSession).
1580
+ const sessionId = (msg && (msg.sessionId || msg.groupId)) || null;
1570
1581
  const partial = (msg && msg.config && typeof msg.config === 'object') ? msg.config : null;
1571
1582
  try {
1572
1583
  if (!sessionId) throw new SessionConfigError('missing_group_id', 'sessionId required');
@@ -1588,7 +1599,8 @@ export function handleYeaftUpdateSessionConfig(msg) {
1588
1599
 
1589
1600
  export function handleYeaftArchiveSession(msg) {
1590
1601
  const requestId = msg && msg.requestId;
1591
- const sessionId = msg && msg.sessionId;
1602
+ // wire-compat: accept legacy `groupId` (see handleYeaftRenameSession).
1603
+ const sessionId = (msg && (msg.sessionId || msg.groupId)) || null;
1592
1604
  try {
1593
1605
  const yeaftDir = ctx.CONFIG?.yeaftDir;
1594
1606
  const result = archiveSession(yeaftDir, sessionId);
@@ -1602,7 +1614,8 @@ export function handleYeaftArchiveSession(msg) {
1602
1614
 
1603
1615
  export function handleYeaftDeleteSession(msg) {
1604
1616
  const requestId = msg && msg.requestId;
1605
- const sessionId = msg && msg.sessionId;
1617
+ // wire-compat: accept legacy `groupId` (see handleYeaftRenameSession).
1618
+ const sessionId = (msg && (msg.sessionId || msg.groupId)) || null;
1606
1619
  try {
1607
1620
  const yeaftDir = ctx.CONFIG?.yeaftDir;
1608
1621
  const result = deleteSession(yeaftDir, sessionId);
@@ -1642,7 +1655,8 @@ export function handleYeaftDeleteSession(msg) {
1642
1655
 
1643
1656
  export function handleYeaftSessionAddMember(msg) {
1644
1657
  const requestId = msg && msg.requestId;
1645
- const sessionId = msg && msg.sessionId;
1658
+ // wire-compat: accept legacy `groupId` (see handleYeaftRenameSession).
1659
+ const sessionId = (msg && (msg.sessionId || msg.groupId)) || null;
1646
1660
  const vpId = msg && msg.vpId;
1647
1661
  try {
1648
1662
  const yeaftDir = ctx.CONFIG?.yeaftDir;
@@ -1657,7 +1671,8 @@ export function handleYeaftSessionAddMember(msg) {
1657
1671
 
1658
1672
  export function handleYeaftSessionRemoveMember(msg) {
1659
1673
  const requestId = msg && msg.requestId;
1660
- const sessionId = msg && msg.sessionId;
1674
+ // wire-compat: accept legacy `groupId` (see handleYeaftRenameSession).
1675
+ const sessionId = (msg && (msg.sessionId || msg.groupId)) || null;
1661
1676
  const vpId = msg && msg.vpId;
1662
1677
  try {
1663
1678
  const yeaftDir = ctx.CONFIG?.yeaftDir;
@@ -1678,7 +1693,8 @@ export function handleYeaftSessionRemoveMember(msg) {
1678
1693
 
1679
1694
  export function handleYeaftSessionSetDefaultVp(msg) {
1680
1695
  const requestId = msg && msg.requestId;
1681
- const sessionId = msg && msg.sessionId;
1696
+ // wire-compat: accept legacy `groupId` (see handleYeaftRenameSession).
1697
+ const sessionId = (msg && (msg.sessionId || msg.groupId)) || null;
1682
1698
  const vpId = msg && msg.vpId;
1683
1699
  try {
1684
1700
  const yeaftDir = ctx.CONFIG?.yeaftDir;