@agentunion/fastaun 0.5.14 → 0.5.16

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.
@@ -1 +1 @@
1
- {"version":3,"file":"logger.js","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,cAAc,EAAE,WAAW,EAAE,QAAQ,EAAE,UAAU,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC5G,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAC5B,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAiB7B,MAAM,WAAW,GAAG,kBAAkB,CAAC;AACvC,MAAM,MAAM,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC;AACnC,MAAM,WAAW,GAAG,CAAC,CAAC;AACtB,MAAM,WAAW,GAA0B,EAAE,KAAK,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,IAAI,EAAE,CAAC,EAAE,KAAK,EAAE,CAAC,EAAE,CAAC;AAEpF,SAAS,WAAW,CAAC,IAAY;IAC/B,IAAI,CAAC;QACH,IAAI,CAAC,UAAU,CAAC,IAAI,CAAC;YAAE,OAAO,IAAI,CAAC;QACnC,MAAM,OAAO,GAAG,YAAY,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;QAC5C,MAAM,MAAM,GAA2B,EAAE,CAAC;QAC1C,KAAK,MAAM,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC,OAAO,CAAC,EAAE,CAAC;YACzC,MAAM,IAAI,GAAG,GAAG,CAAC,IAAI,EAAE,CAAC;YACxB,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,IAAI,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC;gBAAE,SAAS;YACpE,MAAM,GAAG,GAAG,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAA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AAM,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAC,EAAE,GAAG,CAAC,CAAC;QAC7D,MAAM,IAAI,GAAG,GAAG,CAAC,CAAC,WAAW,EAAE,IAAI,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC;QAC/E,MAAM,IAAI,GAAG,GAAG,GAAG,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC,UAAU,EAAE,CAAC,EAAE,CAAC;QAClF,MAAM,EAAE,GAAG,GAAG,CAAC,CAAC,CAAC,eAAe,EAAE,EAAE,CAAC,CAAC,CAAC;QACvC,OAAO,EAAE,IAAI,EAAE,IAAI,EAAE,EAAE,EAAE,CAAC;IAC5B,CAAC;CACF"}
package/dist/result.d.ts CHANGED
@@ -4,7 +4,6 @@
4
4
  export interface ErrorInfo {
5
5
  code: string;
6
6
  message: string;
7
- cause?: unknown;
8
7
  }
9
8
  export type Result<T> = {
10
9
  ok: true;
@@ -14,4 +13,4 @@ export type Result<T> = {
14
13
  error: ErrorInfo;
15
14
  };
16
15
  export declare function resultOk<T>(data: T): Result<T>;
17
- export declare function resultErr(code: string, message: string, cause?: unknown): Result<never>;
16
+ export declare function resultErr(code: string, message: string, _cause?: unknown): Result<never>;
package/dist/result.js CHANGED
@@ -4,7 +4,7 @@
4
4
  export function resultOk(data) {
5
5
  return { ok: true, data };
6
6
  }
7
- export function resultErr(code, message, cause) {
8
- return { ok: false, error: { code, message, cause } };
7
+ export function resultErr(code, message, _cause) {
8
+ return { ok: false, error: { code, message } };
9
9
  }
10
10
  //# sourceMappingURL=result.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA;;GAEG;AAYH,MAAM,UAAU,QAAQ,CAAI,IAAO;IACjC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,OAAe,EAAE,KAAe;IACtE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,KAAK,EAAE,EAAE,CAAC;AACxD,CAAC"}
1
+ {"version":3,"file":"result.js","sourceRoot":"","sources":["../src/result.ts"],"names":[],"mappings":"AAAA;;GAEG;AAWH,MAAM,UAAU,QAAQ,CAAI,IAAO;IACjC,OAAO,EAAE,EAAE,EAAE,IAAI,EAAE,IAAI,EAAE,CAAC;AAC5B,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,IAAY,EAAE,OAAe,EAAE,MAAgB;IACvE,OAAO,EAAE,EAAE,EAAE,KAAK,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,OAAO,EAAE,EAAE,CAAC;AACjD,CAAC"}
@@ -8,7 +8,7 @@
8
8
  * - 事件路由 → EventDispatcher
9
9
  */
10
10
  import type { EventDispatcher } from './events.js';
11
- import type { ModuleLogger } from './logger.js';
11
+ import { type ModuleLogger } from './logger.js';
12
12
  import { type JsonObject, type RpcMessage, type RpcParams, type RpcResult } from './types.js';
13
13
  /** 断线回调,closeCode 为 WebSocket close code(1006 = 网络异常断开,其他 = 服务端主动关闭) */
14
14
  export type DisconnectCallback = (error: Error | null, closeCode?: number) => void | Promise<void>;
@@ -29,6 +29,8 @@ export declare class RPCTransport {
29
29
  private _timeout;
30
30
  private _connectTimeout;
31
31
  private _onDisconnect;
32
+ private _protocolDisconnectCallback;
33
+ private _applicationDisconnectSubscription;
32
34
  private _verifySsl;
33
35
  private _dnsNet;
34
36
  private _ws;
@@ -51,6 +53,7 @@ export declare class RPCTransport {
51
53
  private _sendChain;
52
54
  private _idCounter;
53
55
  private _metaObserver;
56
+ private _protocolMetaObserver;
54
57
  private _traceMode;
55
58
  private _traceObserver;
56
59
  private _actorTail;
@@ -64,6 +67,7 @@ export declare class RPCTransport {
64
67
  private _workerConnected;
65
68
  private _workerGeneration;
66
69
  private _workerConnecting;
70
+ private _workerConnectAttempt;
67
71
  private _workerBufferedEvents;
68
72
  private _workerOptions;
69
73
  constructor(opts: {
@@ -94,6 +98,8 @@ export declare class RPCTransport {
94
98
  * 不影响 RPC 结果返回。
95
99
  */
96
100
  setMetaObserver(observer: MetaObserver | null): void;
101
+ setProtocolMetaObserver(observer: MetaObserver | null): void;
102
+ setProtocolDisconnectCallback(callback: DisconnectCallback | null): void;
97
103
  /** 设置 trace 模式:off / log / diag */
98
104
  setTraceMode(mode: string): void;
99
105
  /** 注册 trace observer;observer(traceInfo) 在每次 RPC/事件携带 _trace 时调用。 */
package/dist/transport.js CHANGED
@@ -11,6 +11,7 @@ import WebSocket from 'ws';
11
11
  import * as crypto from 'node:crypto';
12
12
  import { Worker, isMainThread, parentPort, workerData } from 'node:worker_threads';
13
13
  import { AUNError, AuthError, CertificateRevokedError, ClientSignatureError, ConnectionError, E2EEDecryptFailedError, E2EEDegradedError, E2EEError, GroupError, GroupNotFoundError, GroupStateError, IdentityConflictError, NotFoundError, PermissionError, RateLimitError, SerializationError, SessionError, StateError, TimeoutError, ValidationError, VersionConflictError, mapRemoteError, } from './errors.js';
14
+ import { trafficLogContext, withLogContext } from './logger.js';
14
15
  import { isJsonObject } from './types.js';
15
16
  const MAX_WS_PAYLOAD_SIZE = 1_000_000;
16
17
  const MAX_RPC_INFLIGHT = 16;
@@ -506,6 +507,8 @@ export class RPCTransport {
506
507
  _timeout;
507
508
  _connectTimeout;
508
509
  _onDisconnect;
510
+ _protocolDisconnectCallback = false;
511
+ _applicationDisconnectSubscription = null;
509
512
  _verifySsl;
510
513
  _dnsNet = null;
511
514
  _ws = null;
@@ -530,6 +533,7 @@ export class RPCTransport {
530
533
  // Gateway 在 RPC envelope 注入 _meta 字段(与 result 同级),由 client 层 observer 接收。
531
534
  // observer 抛异常会被吞掉,不影响 RPC result 返回。
532
535
  _metaObserver = null;
536
+ _protocolMetaObserver = false;
533
537
  // Trace 模式:off / log / diag
534
538
  _traceMode = 'off';
535
539
  // Trace observer:observer(traceInfo) 在每次 RPC/事件携带 _trace 时调用
@@ -546,20 +550,29 @@ export class RPCTransport {
546
550
  _workerConnected = false;
547
551
  _workerGeneration = null;
548
552
  _workerConnecting = false;
553
+ _workerConnectAttempt = 0;
549
554
  _workerBufferedEvents = [];
550
555
  _workerOptions;
551
556
  constructor(opts) {
552
557
  this._logger = opts.logger ?? _noopLogger;
553
558
  this._dispatcher = opts.eventDispatcher;
554
- this._timeout = opts.timeout ?? 10_000;
559
+ this._timeout = opts.timeout ?? 35_000;
555
560
  this._connectTimeout = opts.timeout ?? 10_000;
556
561
  this._onDisconnect = opts.onDisconnect ?? null;
557
562
  this._verifySsl = opts.verifySsl ?? true;
558
563
  this._dnsNet = opts.dnsNet ?? null;
559
564
  this._workerOptions = { timeout: opts.timeout, verifySsl: opts.verifySsl };
560
- this._dispatcher.subscribe('_transport.observer', (item) => this._dispatchObserver(item));
561
- // 断线回调统一经过应用分发边界,避免 WebSocket close 处理器直接进入用户/客户端逻辑。
562
- this._dispatcher.subscribe('_transport.disconnect', (item) => {
565
+ this._dispatcher.subscribeProtocol('_transport.observer', (item) => {
566
+ const observerEvent = item;
567
+ if (!observerEvent.protocol) {
568
+ this._dispatcher.enqueue('_transport.observer.app', item);
569
+ return;
570
+ }
571
+ return this._dispatchObserver(item);
572
+ });
573
+ this._dispatcher.subscribe('_transport.observer.app', (item) => this._dispatchObserver(item));
574
+ // 断线回调通过对应管线执行,避免 WebSocket close 处理器直接进入用户/客户端逻辑。
575
+ const dispatchDisconnect = (item) => {
563
576
  const event = item;
564
577
  const callback = this._onDisconnect;
565
578
  if (!callback || !event)
@@ -575,7 +588,14 @@ export class RPCTransport {
575
588
  catch {
576
589
  this._logger.warn('disconnect callback error');
577
590
  }
591
+ };
592
+ this._dispatcher.subscribeProtocol('_transport.disconnect', (item) => {
593
+ if (this._protocolDisconnectCallback)
594
+ return dispatchDisconnect(item);
578
595
  });
596
+ if (opts.onDisconnect) {
597
+ this._applicationDisconnectSubscription = this._dispatcher.subscribe('_transport.disconnect', dispatchDisconnect);
598
+ }
579
599
  if (isMainThread && !process.env.VITEST && process.env.AUN_TRANSPORT_LOCAL !== '1') {
580
600
  this._startNetworkWorker(opts);
581
601
  }
@@ -588,7 +608,7 @@ export class RPCTransport {
588
608
  execArgv: process.execArgv.filter((arg) => !arg.startsWith('--input-type')),
589
609
  workerData: {
590
610
  aunTransportWorker: true,
591
- timeout: opts.timeout ?? 10_000,
611
+ timeout: opts.timeout ?? 35_000,
592
612
  verifySsl: opts.verifySsl ?? true,
593
613
  },
594
614
  });
@@ -619,6 +639,15 @@ export class RPCTransport {
619
639
  const pending = this._workerPending.get(message.id);
620
640
  if (!pending)
621
641
  return;
642
+ if (pending.commandType === 'connect'
643
+ && pending.connectAttempt !== undefined
644
+ && pending.connectAttempt !== this._workerConnectAttempt) {
645
+ this._workerPending.delete(message.id);
646
+ if (pending.timer !== null)
647
+ clearTimeout(pending.timer);
648
+ pending.reject(new ConnectionError('transport connection superseded'));
649
+ return;
650
+ }
622
651
  if (typeof message.generation === 'number'
623
652
  && this._workerGeneration !== null
624
653
  && pending.commandType !== 'connect'
@@ -633,13 +662,14 @@ export class RPCTransport {
633
662
  this._workerPending.delete(message.id);
634
663
  if (pending.timer !== null)
635
664
  clearTimeout(pending.timer);
636
- if (pending.commandType === 'connect' && message.ok && typeof message.generation === 'number') {
665
+ if (pending.commandType === 'connect' && pending.connectAttempt === this._workerConnectAttempt
666
+ && message.ok && typeof message.generation === 'number') {
637
667
  this._workerGeneration = message.generation;
638
668
  }
639
669
  if (message.ok)
640
670
  pending.resolve(message.result);
641
671
  else {
642
- if (pending.commandType === 'connect') {
672
+ if (pending.commandType === 'connect' && pending.connectAttempt === this._workerConnectAttempt) {
643
673
  this._workerGeneration = null;
644
674
  this._workerBufferedEvents = [];
645
675
  }
@@ -688,8 +718,8 @@ export class RPCTransport {
688
718
  this._workerPending.clear();
689
719
  void worker.terminate().catch(() => { });
690
720
  if (wasConnected) {
691
- this._dispatcher.enqueue('connection.error', { error });
692
- this._dispatcher.enqueue('_transport.disconnect', { error, closeCode: 1006 });
721
+ this._dispatcher.enqueueProtocol('connection.error', { error });
722
+ this._dispatcher.enqueueProtocol('_transport.disconnect', { error, closeCode: 1006 });
693
723
  }
694
724
  else {
695
725
  this._logger.warn(`transport worker unavailable; using local transport: ${error.message}`);
@@ -736,9 +766,7 @@ export class RPCTransport {
736
766
  const item = message.payload;
737
767
  const observer = item?.kind?.includes('trace') ? this._traceObserver : this._metaObserver;
738
768
  if (observer && item?.payload)
739
- this._dispatcher.enqueue('_transport.observer', {
740
- kind: item.kind ?? 'observer', observer, payload: item.payload,
741
- });
769
+ this._queueObserver(item.kind ?? 'observer', observer, item.payload);
742
770
  return;
743
771
  }
744
772
  if (message.event === '_transport.disconnect') {
@@ -751,10 +779,16 @@ export class RPCTransport {
751
779
  if (workerError && typeof workerError === 'object') {
752
780
  payload.error = new ConnectionError(String(workerError.message ?? 'transport disconnected'));
753
781
  }
754
- this._dispatcher.enqueue('_transport.disconnect', payload);
782
+ this._dispatcher.enqueueProtocol('_transport.disconnect', payload);
755
783
  }
756
784
  else if (message.event) {
757
- this._dispatcher.enqueue(message.event, message.payload);
785
+ withLogContext(this._logger, trafficLogContext('inbound', message.payload)).debug(`event recv: event=${message.event}`);
786
+ if (message.event.startsWith('app.')) {
787
+ this._dispatcher.enqueue(message.event, message.payload);
788
+ }
789
+ else {
790
+ this._dispatcher.enqueueProtocol(message.event, message.payload);
791
+ }
758
792
  }
759
793
  }
760
794
  _flushWorkerEvents() {
@@ -763,7 +797,7 @@ export class RPCTransport {
763
797
  for (const message of buffered)
764
798
  this._handleWorkerEvent(message);
765
799
  }
766
- _workerCommand(command) {
800
+ _workerCommand(command, connectAttempt) {
767
801
  this._ensureNetworkWorker();
768
802
  if (!this._worker)
769
803
  return Promise.reject(new ConnectionError('transport worker unavailable'));
@@ -788,7 +822,13 @@ export class RPCTransport {
788
822
  }
789
823
  reject(new TimeoutError(`rpc timeout: ${String(command.method ?? command.type)}`, { retryable: true }));
790
824
  }, timeoutMs);
791
- this._workerPending.set(id, { resolve: resolve, reject, timer, commandType: command.type });
825
+ this._workerPending.set(id, {
826
+ resolve: resolve,
827
+ reject,
828
+ timer,
829
+ commandType: command.type,
830
+ connectAttempt,
831
+ });
792
832
  const postCommand = () => {
793
833
  if (!this._workerPending.has(id))
794
834
  return;
@@ -865,6 +905,17 @@ export class RPCTransport {
865
905
  */
866
906
  setMetaObserver(observer) {
867
907
  this._metaObserver = observer;
908
+ this._protocolMetaObserver = false;
909
+ }
910
+ setProtocolMetaObserver(observer) {
911
+ this._metaObserver = observer;
912
+ this._protocolMetaObserver = true;
913
+ }
914
+ setProtocolDisconnectCallback(callback) {
915
+ this._applicationDisconnectSubscription?.unsubscribe();
916
+ this._applicationDisconnectSubscription = null;
917
+ this._onDisconnect = callback;
918
+ this._protocolDisconnectCallback = callback !== null;
868
919
  }
869
920
  /** 设置 trace 模式:off / log / diag */
870
921
  setTraceMode(mode) {
@@ -888,10 +939,11 @@ export class RPCTransport {
888
939
  this._traceObserver = observer;
889
940
  }
890
941
  _queueObserver(kind, observer, payload) {
891
- this._dispatcher.enqueue('_transport.observer', {
942
+ this._dispatcher.enqueueProtocol('_transport.observer', {
892
943
  kind,
893
944
  observer,
894
945
  payload,
946
+ protocol: !kind.includes('trace') && this._protocolMetaObserver,
895
947
  });
896
948
  }
897
949
  async _dispatchObserver(item) {
@@ -997,22 +1049,27 @@ export class RPCTransport {
997
1049
  async connect(url) {
998
1050
  this._ensureNetworkWorker();
999
1051
  if (this._worker) {
1052
+ const attempt = ++this._workerConnectAttempt;
1000
1053
  this._workerConnecting = true;
1001
1054
  try {
1002
1055
  const result = await this._workerCommand({
1003
1056
  type: 'connect', url, dnsFallback: this._dnsFallbackSnapshot(url),
1004
- });
1005
- this._workerConnected = true;
1006
- this._workerConnecting = false;
1007
- this._flushWorkerEvents();
1057
+ }, attempt);
1058
+ if (attempt === this._workerConnectAttempt) {
1059
+ this._workerConnected = true;
1060
+ this._workerConnecting = false;
1061
+ this._flushWorkerEvents();
1062
+ }
1008
1063
  return result;
1009
1064
  }
1010
1065
  catch (error) {
1011
- this._workerConnecting = false;
1012
- this._workerConnected = false;
1013
- this._workerGeneration = null;
1014
- this._workerBufferedEvents = [];
1015
- if (this._workerDisabled && this._worker === null) {
1066
+ if (attempt === this._workerConnectAttempt) {
1067
+ this._workerConnecting = false;
1068
+ this._workerConnected = false;
1069
+ this._workerGeneration = null;
1070
+ this._workerBufferedEvents = [];
1071
+ }
1072
+ if (attempt === this._workerConnectAttempt && this._workerDisabled && this._worker === null) {
1016
1073
  return this._enqueueActorStart(() => this._connectLocal(url));
1017
1074
  }
1018
1075
  throw error;
@@ -1256,6 +1313,7 @@ export class RPCTransport {
1256
1313
  await this._workerCommand({ type: 'close' });
1257
1314
  }
1258
1315
  finally {
1316
+ this._workerConnectAttempt++;
1259
1317
  if (this._worker === worker)
1260
1318
  this._worker = null;
1261
1319
  this._workerConnected = false;
@@ -1361,7 +1419,19 @@ export class RPCTransport {
1361
1419
  */
1362
1420
  call(method, params, timeout, trace, background = false) {
1363
1421
  if (this._worker) {
1364
- return this._workerCommand({ type: 'call', method, params, timeout, trace, background });
1422
+ const requestContext = trafficLogContext('outbound', params ?? {});
1423
+ const requestLog = withLogContext(this._logger, requestContext);
1424
+ const responseLog = withLogContext(requestLog, { direction: 'inbound', peerAid: requestContext.peerAid });
1425
+ requestLog.debug(`RPC request queued: method=${method}`);
1426
+ const request = this._workerCommand({ type: 'call', method, params, timeout, trace, background });
1427
+ const result = request.then((result) => {
1428
+ responseLog.debug(`RPC response ok: method=${method}`);
1429
+ return result;
1430
+ }, (error) => {
1431
+ responseLog.warn(`RPC response failed: method=${method}, error=${error instanceof Error ? error.message : String(error)}`);
1432
+ throw error;
1433
+ });
1434
+ return Object.assign(result, { cancel: request.cancel });
1365
1435
  }
1366
1436
  return this._enqueueActorStart(() => this._callLocal(method, params, timeout, trace, background), () => new TimeoutError(`rpc cancelled: ${method}`, { retryable: true }));
1367
1437
  }
@@ -1382,6 +1452,12 @@ export class RPCTransport {
1382
1452
  const localParams = sendParams;
1383
1453
  const backgroundRpc = background || localParams._rpc_background === true;
1384
1454
  delete localParams._rpc_background;
1455
+ const requestContext = trafficLogContext('outbound', sendParams);
1456
+ const requestLog = withLogContext(this._logger, requestContext);
1457
+ const responseLog = withLogContext(requestLog, {
1458
+ direction: 'inbound',
1459
+ peerAid: requestContext.peerAid,
1460
+ });
1385
1461
  if (effectiveTraceMode !== 'off') {
1386
1462
  traceId = crypto.randomBytes(16).toString('hex');
1387
1463
  const tracePayload = { trace_id: traceId, mode: effectiveTraceMode };
@@ -1389,7 +1465,7 @@ export class RPCTransport {
1389
1465
  tracePayload.spans = [{ node: 'sdk', ts: tStart, action: 'send' }];
1390
1466
  }
1391
1467
  localParams._trace = tracePayload;
1392
- this._logger.info(`[trace=${traceId}] rpc_send method=${method} rpc_id=${rpcId}`);
1468
+ requestLog.info(`[trace=${traceId}] rpc_send method=${method} rpc_id=${rpcId}`);
1393
1469
  }
1394
1470
  const payload = JSON.stringify({
1395
1471
  jsonrpc: '2.0',
@@ -1405,7 +1481,7 @@ export class RPCTransport {
1405
1481
  const promise = new Promise((resolve, reject) => {
1406
1482
  const timer = setTimeout(() => {
1407
1483
  this._removeRpc(rpcId, pending);
1408
- this._logger.warn(`RPC timeout: method=${method}, id=${rpcId}, elapsed=${Date.now() - tStart}ms, timeout=${effectiveTimeout}ms`);
1484
+ requestLog.warn(`RPC timeout: method=${method}, id=${rpcId}, elapsed=${Date.now() - tStart}ms, timeout=${effectiveTimeout}ms`);
1409
1485
  reject(new TimeoutError(`rpc timeout: ${method}`, { retryable: true }));
1410
1486
  this._drainRpcQueue();
1411
1487
  }, effectiveTimeout);
@@ -1414,21 +1490,21 @@ export class RPCTransport {
1414
1490
  clearTimeout(timer);
1415
1491
  const elapsed = Date.now() - tStart;
1416
1492
  if (response.error !== undefined) {
1417
- this._logger.debug(`RPC error response: method=${method}, id=${rpcId}, elapsed=${elapsed}ms, error=${JSON.stringify(response.error)}`);
1493
+ responseLog.debug(`RPC error response: method=${method}, id=${rpcId}, elapsed=${elapsed}ms, error=${JSON.stringify(response.error)}`);
1418
1494
  if (traceId) {
1419
- this._logger.info(`[trace=${traceId}] rpc_recv method=${method} rpc_id=${rpcId} duration_ms=${elapsed} status=error`);
1495
+ responseLog.info(`[trace=${traceId}] rpc_recv method=${method} rpc_id=${rpcId} duration_ms=${elapsed} status=error`);
1420
1496
  }
1421
1497
  // 处理 error 路径的 _trace
1422
1498
  const respTrace = response._trace;
1423
1499
  if (respTrace && typeof respTrace === 'object' && !Array.isArray(respTrace)) {
1424
- this._handleResponseTrace(method, 'error', elapsed, respTrace);
1500
+ this._handleResponseTrace(method, 'error', elapsed, respTrace, responseLog);
1425
1501
  }
1426
1502
  reject(mapRemoteError(response.error));
1427
1503
  }
1428
1504
  else if (response.result !== undefined) {
1429
- this._logger.debug(`RPC response ok: method=${method}, id=${rpcId}, elapsed=${elapsed}ms ${summarizeDict(response.result, DIAG_RESULT_FIELDS)}`);
1505
+ responseLog.debug(`RPC response ok: method=${method}, id=${rpcId}, elapsed=${elapsed}ms ${summarizeDict(response.result, DIAG_RESULT_FIELDS)}`);
1430
1506
  if (traceId) {
1431
- this._logger.info(`[trace=${traceId}] rpc_recv method=${method} rpc_id=${rpcId} duration_ms=${elapsed} status=ok`);
1507
+ responseLog.info(`[trace=${traceId}] rpc_recv method=${method} rpc_id=${rpcId} duration_ms=${elapsed} status=ok`);
1432
1508
  }
1433
1509
  // 透传 envelope._meta 给 observer
1434
1510
  if (this._metaObserver !== null) {
@@ -1440,12 +1516,12 @@ export class RPCTransport {
1440
1516
  // 处理 success 路径的 _trace
1441
1517
  const respTrace = response._trace;
1442
1518
  if (respTrace && typeof respTrace === 'object' && !Array.isArray(respTrace)) {
1443
- this._handleResponseTrace(method, 'ok', elapsed, respTrace);
1519
+ this._handleResponseTrace(method, 'ok', elapsed, respTrace, responseLog);
1444
1520
  }
1445
1521
  resolve(response.result);
1446
1522
  }
1447
1523
  else {
1448
- this._logger.warn(`RPC response missing result or error: method=${method}, id=${rpcId}, elapsed=${elapsed}ms`);
1524
+ responseLog.warn(`RPC response missing result or error: method=${method}, id=${rpcId}, elapsed=${elapsed}ms`);
1449
1525
  reject(new SerializationError(`rpc response missing result and error: ${method}`));
1450
1526
  }
1451
1527
  },
@@ -1468,6 +1544,7 @@ export class RPCTransport {
1468
1544
  tStart,
1469
1545
  timeoutMs: effectiveTimeout,
1470
1546
  background: backgroundRpc,
1547
+ logger: requestLog,
1471
1548
  });
1472
1549
  if (backgroundRpc) {
1473
1550
  this._rpcQueue.pop();
@@ -1479,6 +1556,7 @@ export class RPCTransport {
1479
1556
  tStart,
1480
1557
  timeoutMs: effectiveTimeout,
1481
1558
  background: true,
1559
+ logger: requestLog,
1482
1560
  });
1483
1561
  }
1484
1562
  this._drainRpcQueue();
@@ -1516,8 +1594,9 @@ export class RPCTransport {
1516
1594
  if (payloadSize > MAX_WS_PAYLOAD_SIZE) {
1517
1595
  throw new ValidationError('payload is too large');
1518
1596
  }
1597
+ const notifyLog = withLogContext(this._logger, trafficLogContext('outbound', params ?? {}));
1519
1598
  await this._sendText(payload, `notification ${normalizedMethod}`);
1520
- this._logger.debug(`notification sent: method=${normalizedMethod}, size=${payloadSize}`);
1599
+ notifyLog.debug(`notification sent: method=${normalizedMethod}, size=${payloadSize}`);
1521
1600
  }
1522
1601
  _enqueueSend(task) {
1523
1602
  const run = this._sendChain.then(task, task);
@@ -1633,7 +1712,7 @@ export class RPCTransport {
1633
1712
  const elapsed = Date.now() - entry.tStart;
1634
1713
  if (elapsed >= entry.timeoutMs) {
1635
1714
  clearTimeout(entry.pending.timer);
1636
- this._logger.warn(`RPC queue timeout: method=${entry.method}, id=${entry.rpcId}, elapsed=${elapsed}ms, timeout=${entry.timeoutMs}ms`);
1715
+ entry.logger.warn(`RPC queue timeout: method=${entry.method}, id=${entry.rpcId}, elapsed=${elapsed}ms, timeout=${entry.timeoutMs}ms`);
1637
1716
  entry.pending.reject(new TimeoutError(`rpc timeout before send: ${entry.method}`, { retryable: true }));
1638
1717
  continue;
1639
1718
  }
@@ -1649,12 +1728,12 @@ export class RPCTransport {
1649
1728
  this._pendingBackground.add(entry.rpcId);
1650
1729
  }
1651
1730
  this._sendText(entry.payload, `rpc ${entry.method}`, () => this._pending.get(entry.rpcId) === entry.pending).then(() => {
1652
- this._logger.debug(`RPC request sent: method=${entry.method}, id=${entry.rpcId}, background=${entry.background}`);
1731
+ entry.logger.debug(`RPC request sent: method=${entry.method}, id=${entry.rpcId}, background=${entry.background}`);
1653
1732
  }).catch((err) => {
1654
1733
  if (this._pending.get(entry.rpcId) !== entry.pending)
1655
1734
  return;
1656
1735
  this._removeRpc(entry.rpcId, entry.pending);
1657
- this._logger.error(`RPC send failed: method=${entry.method}, id=${entry.rpcId}, error=${err instanceof Error ? err.message : String(err)}`);
1736
+ entry.logger.error(`RPC send failed: method=${entry.method}, id=${entry.rpcId}, error=${err instanceof Error ? err.message : String(err)}`);
1658
1737
  entry.pending.reject(err instanceof ConnectionError
1659
1738
  ? err
1660
1739
  : new ConnectionError(`failed to send rpc ${entry.method}: ${err instanceof Error ? err.message : String(err)}`));
@@ -1667,7 +1746,7 @@ export class RPCTransport {
1667
1746
  }
1668
1747
  }
1669
1748
  /** 处理 RPC 响应中的 _trace 字段:追加 sdk.recv span,格式化输出,通知 observer */
1670
- _handleResponseTrace(method, status, elapsedMs, respTrace) {
1749
+ _handleResponseTrace(method, status, elapsedMs, respTrace, logger = this._logger) {
1671
1750
  try {
1672
1751
  const sdkRecvSpan = {
1673
1752
  node: 'sdk',
@@ -1678,7 +1757,7 @@ export class RPCTransport {
1678
1757
  const existingSpans = Array.isArray(respTrace.spans) ? respTrace.spans : [];
1679
1758
  const spans = [...existingSpans, sdkRecvSpan];
1680
1759
  const enriched = { ...respTrace, spans };
1681
- this._logger.info(traceDisplay(method, status, elapsedMs, respTrace, spans));
1760
+ logger.info(traceDisplay(method, status, elapsedMs, respTrace, spans));
1682
1761
  if (this._traceObserver !== null) {
1683
1762
  this._queueObserver('trace_observer', this._traceObserver, {
1684
1763
  type: 'rpc', method, trace: enriched, status, duration_ms: elapsedMs,
@@ -1686,7 +1765,7 @@ export class RPCTransport {
1686
1765
  }
1687
1766
  }
1688
1767
  catch (err) {
1689
- this._logger.debug(`trace handling raised: ${err instanceof Error ? err.message : String(err)}`);
1768
+ logger.debug(`trace handling raised: ${err instanceof Error ? err.message : String(err)}`);
1690
1769
  }
1691
1770
  }
1692
1771
  // ── 内部方法 ────────────────────────────────────────────
@@ -1702,7 +1781,7 @@ export class RPCTransport {
1702
1781
  }
1703
1782
  catch (err) {
1704
1783
  // 解析异常,发布错误事件
1705
- this._dispatcher.enqueue('connection.error', {
1784
+ this._dispatcher.enqueueProtocol('connection.error', {
1706
1785
  error: err instanceof Error ? err : String(err),
1707
1786
  });
1708
1787
  }
@@ -1735,7 +1814,7 @@ export class RPCTransport {
1735
1814
  }
1736
1815
  this._backgroundRpcQueue = [];
1737
1816
  if (!wasClosed && this._onDisconnect) {
1738
- this._dispatcher.enqueue('_transport.disconnect', {
1817
+ this._dispatcher.enqueueProtocol('_transport.disconnect', {
1739
1818
  error: null,
1740
1819
  closeCode: code,
1741
1820
  });
@@ -1746,7 +1825,7 @@ export class RPCTransport {
1746
1825
  return;
1747
1826
  if (!this._closed) {
1748
1827
  this._logger.error(`WebSocket error: ${err.message}`);
1749
- this._dispatcher.enqueue('connection.error', { error: err });
1828
+ this._dispatcher.enqueueProtocol('connection.error', { error: err });
1750
1829
  }
1751
1830
  });
1752
1831
  this._startWebSocketHeartbeat(ws);
@@ -1854,15 +1933,16 @@ export class RPCTransport {
1854
1933
  // Challenge 消息
1855
1934
  if (method === 'challenge') {
1856
1935
  this._challenge = message;
1857
- this._logger.debug('challenge received');
1858
- this._dispatcher.enqueue('connection.challenge', message.params ?? {});
1936
+ withLogContext(this._logger, trafficLogContext('inbound', message.params ?? message)).debug('challenge received');
1937
+ this._dispatcher.enqueueProtocol('connection.challenge', message.params ?? {});
1859
1938
  return;
1860
1939
  }
1861
1940
  // 事件消息(event/ 前缀)
1862
1941
  if (method.startsWith('event/')) {
1863
1942
  const protocolEvent = method.slice('event/'.length);
1864
1943
  const sdkEvent = EVENT_NAME_MAP[protocolEvent] ?? protocolEvent;
1865
- this._logger.debug(`event recv: event=${sdkEvent} ${summarizeDict(message.params, DIAG_RESULT_FIELDS)}`);
1944
+ const eventLog = withLogContext(this._logger, trafficLogContext('inbound', message.params ?? message));
1945
+ eventLog.debug(`event recv: event=${sdkEvent} ${summarizeDict(message.params, DIAG_RESULT_FIELDS)}`);
1866
1946
  const meta = message._meta;
1867
1947
  if (this._metaObserver !== null && meta !== null && typeof meta === 'object' && !Array.isArray(meta)) {
1868
1948
  this._queueObserver('event meta_observer', this._metaObserver, meta);
@@ -1879,7 +1959,7 @@ export class RPCTransport {
1879
1959
  });
1880
1960
  }
1881
1961
  const traceObj = eventTrace;
1882
- this._logger.info(`[trace=${String(traceObj.trace_id ?? '')}] event_recv event=${sdkEvent}`);
1962
+ eventLog.info(`[trace=${String(traceObj.trace_id ?? '')}] event_recv event=${sdkEvent}`);
1883
1963
  }
1884
1964
  }
1885
1965
  // 发布为 _raw.{event},由 AUNClient 处理后再发布用户可见的事件
@@ -1887,7 +1967,7 @@ export class RPCTransport {
1887
1967
  this._dispatcher.enqueue(sdkEvent, params);
1888
1968
  return;
1889
1969
  }
1890
- this._dispatcher.enqueue(`_raw.${sdkEvent}`, params);
1970
+ this._dispatcher.enqueueProtocol(`_raw.${sdkEvent}`, params);
1891
1971
  return;
1892
1972
  }
1893
1973
  // 其他通知
@@ -1895,7 +1975,7 @@ export class RPCTransport {
1895
1975
  if (this._metaObserver !== null && meta !== null && typeof meta === 'object' && !Array.isArray(meta)) {
1896
1976
  this._queueObserver('notification meta_observer', this._metaObserver, meta);
1897
1977
  }
1898
- this._dispatcher.enqueue('notification', message);
1978
+ this._dispatcher.enqueueProtocol('notification', message);
1899
1979
  }
1900
1980
  /** 解码 WebSocket 消息为 JSON 对象 */
1901
1981
  _decodeMessage(raw) {
@@ -1948,6 +2028,9 @@ if (!isMainThread && Boolean(workerData?.aunTransportWorker) && parentPort) {
1948
2028
  const bridgeGeneration = () => Number(workerActor?._connectionGeneration ?? 0);
1949
2029
  const workerDispatcher = {
1950
2030
  enqueue(event, payload) {
2031
+ workerDispatcher.enqueueProtocol(event, payload);
2032
+ },
2033
+ enqueueProtocol(event, payload) {
1951
2034
  if (event === '_transport.observer') {
1952
2035
  const item = payload;
1953
2036
  parentPort.postMessage({ type: 'event', generation: bridgeGeneration(), event, payload: {
@@ -1958,19 +2041,20 @@ if (!isMainThread && Boolean(workerData?.aunTransportWorker) && parentPort) {
1958
2041
  parentPort.postMessage({ type: 'event', generation: bridgeGeneration(), event, payload });
1959
2042
  },
1960
2043
  subscribe() { return { unsubscribe() { } }; },
2044
+ subscribeProtocol() { return { unsubscribe() { } }; },
1961
2045
  };
1962
2046
  const actor = new RPCTransport({
1963
2047
  eventDispatcher: workerDispatcher,
1964
- timeout: Number(workerData.timeout ?? 10_000),
2048
+ timeout: Number(workerData.timeout ?? 35_000),
1965
2049
  verifySsl: Boolean(workerData.verifySsl ?? true),
1966
2050
  // Worker 内只让 close handler 经 workerDispatcher 转发一次,主线程负责执行真实回调。
1967
2051
  onDisconnect: () => { },
1968
2052
  });
1969
2053
  workerActor = actor;
1970
- actor.setMetaObserver((meta) => workerDispatcher.enqueue('_transport.observer', {
2054
+ actor.setProtocolMetaObserver((meta) => workerDispatcher.enqueueProtocol('_transport.observer', {
1971
2055
  kind: 'meta_observer', payload: meta,
1972
2056
  }));
1973
- actor.setTraceObserver((trace) => workerDispatcher.enqueue('_transport.observer', {
2057
+ actor.setTraceObserver((trace) => workerDispatcher.enqueueProtocol('_transport.observer', {
1974
2058
  kind: 'trace_observer', payload: trace,
1975
2059
  }));
1976
2060
  const active = new Map();