@junctionpanel/server 0.1.100 → 0.1.101

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.
@@ -1322,10 +1322,10 @@ export class Session {
1322
1322
  await this.handleCancelAgentRequest(msg.agentId);
1323
1323
  break;
1324
1324
  case 'restart_server_request':
1325
- await this.handleRestartServerRequest(msg.requestId, msg.reason);
1325
+ await this.handleRestartServerRequest(msg.requestId, msg.reason, msg.sourceCommand);
1326
1326
  break;
1327
1327
  case 'shutdown_server_request':
1328
- await this.handleShutdownServerRequest(msg.requestId);
1328
+ await this.handleShutdownServerRequest(msg.requestId, msg.sourceCommand);
1329
1329
  break;
1330
1330
  case 'fetch_agent_timeline_request':
1331
1331
  await this.handleFetchAgentTimelineRequest(msg);
@@ -1595,11 +1595,12 @@ export class Session {
1595
1595
  }
1596
1596
  this.sessionLogger.warn({ streamId: frame.streamId, messageType: frame.messageType }, 'Unhandled terminal binary frame');
1597
1597
  }
1598
- async handleRestartServerRequest(requestId, reason) {
1598
+ async handleRestartServerRequest(requestId, reason, sourceCommand) {
1599
1599
  this.assertLifecycleControlAllowed('restart', requestId, reason);
1600
1600
  this.requestServerRestart(requestId, reason, {
1601
1601
  logLevel: 'warn',
1602
1602
  logMessage: 'Restart requested via websocket',
1603
+ sourceCommand,
1603
1604
  });
1604
1605
  }
1605
1606
  requestServerRestart(requestId, reason, options) {
@@ -1610,10 +1611,13 @@ export class Session {
1610
1611
  if (reason && reason.trim().length > 0) {
1611
1612
  payload.reason = reason;
1612
1613
  }
1614
+ if (options?.sourceCommand) {
1615
+ payload.sourceCommand = options.sourceCommand;
1616
+ }
1613
1617
  payload.requestId = requestId;
1614
1618
  const logLevel = options?.logLevel ?? 'warn';
1615
1619
  const logMessage = options?.logMessage ?? 'Restart requested';
1616
- this.sessionLogger[logLevel]({ reason, requestId }, logMessage);
1620
+ this.sessionLogger[logLevel]({ reason, requestId, sourceCommand: options?.sourceCommand ?? null }, logMessage);
1617
1621
  this.emit({
1618
1622
  type: 'status',
1619
1623
  payload,
@@ -1626,17 +1630,19 @@ export class Session {
1626
1630
  initiatorTransport: this.connectionContext.transport,
1627
1631
  initiatorRemoteAddress: this.connectionContext.remoteAddress,
1628
1632
  initiatorOrigin: this.connectionContext.origin,
1633
+ ...(options?.sourceCommand ? { sourceCommand: options.sourceCommand } : {}),
1629
1634
  ...(reason ? { reason } : {}),
1630
1635
  });
1631
1636
  }
1632
- async handleShutdownServerRequest(requestId) {
1637
+ async handleShutdownServerRequest(requestId, sourceCommand) {
1633
1638
  this.assertLifecycleControlAllowed('shutdown', requestId);
1634
- this.sessionLogger.warn('Shutdown requested via websocket');
1639
+ this.sessionLogger.warn({ requestId, sourceCommand: sourceCommand ?? null }, 'Shutdown requested via websocket');
1635
1640
  this.emit({
1636
1641
  type: 'status',
1637
1642
  payload: {
1638
1643
  status: 'shutdown_requested',
1639
1644
  clientId: this.clientId,
1645
+ ...(sourceCommand ? { sourceCommand } : {}),
1640
1646
  requestId,
1641
1647
  },
1642
1648
  });
@@ -1648,6 +1654,7 @@ export class Session {
1648
1654
  initiatorTransport: this.connectionContext.transport,
1649
1655
  initiatorRemoteAddress: this.connectionContext.remoteAddress,
1650
1656
  initiatorOrigin: this.connectionContext.origin,
1657
+ ...(sourceCommand ? { sourceCommand } : {}),
1651
1658
  });
1652
1659
  }
1653
1660
  assertLifecycleControlAllowed(action, requestId, reason) {