@agentunion/fastaun 0.5.34 → 0.5.35
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/CHANGELOG.md +30 -1
- package/_packed_docs/CHANGELOG.md +30 -1
- package/_packed_docs/INDEX.md +11 -11
- package/_packed_docs/KITE_DOCS_GUIDE.md +9 -9
- package/_packed_docs/agent.md/SCHEMA.md +1 -1
- package/_packed_docs/aun/346/265/213/350/257/225/350/277/220/350/241/214/346/214/207/345/215/227.md +2 -2
- package/_packed_docs/protocol/Ownership/345/215/217/350/256/256/345/256/232/344/271/2112.1.md +17 -17
- package/_packed_docs/protocol/echo-probe-gateway.md +99 -0
- package/_packed_docs/protocol/echo-probe-sdk.md +91 -0
- package/_packed_docs/sdk/0.5.35-SDK/345/272/224/347/224/250/351/233/206/346/210/220/346/214/207/345/215/227.md +189 -0
- package/_packed_docs/sdk/0.5.35-SDK/345/274/200/345/217/221/344/270/216/347/247/273/346/244/215/346/214/207/345/215/227.md +204 -0
- package/_packed_docs/sdk/04-/350/277/236/346/216/245/344/270/216/350/256/244/350/257/201.md +2 -2
- package/_packed_docs/sdk/06-API/346/211/213/345/206/214.md +32 -6
- package/_packed_docs/sdk/09-group-rpc-manual.md +7 -7
- package/_packed_docs/sdk/AUN_DOCS_GUIDE.md +13 -13
- package/_packed_docs/sdk/AUN/344/272/213/344/273/266/345/217/221/345/270/203/350/256/242/351/230/205/345/272/224/347/224/250/351/233/206/346/210/220/346/214/207/345/215/227.md +73 -3
- package/_packed_docs/sdk/AUN/344/272/213/344/273/266/345/217/221/345/270/203/350/256/242/351/230/205/345/274/200/345/217/221/347/247/273/346/244/215/346/214/207/345/215/227.md +50 -8
- package/_packed_docs/sdk/INDEX.md +18 -18
- package/_packed_docs/sdk/Ownership-SDK/347/274/226/346/216/222/346/214/207/345/215/2272.1.md +1 -1
- package/_packed_docs/sdk/Ownership2.1-SDK/345/272/224/347/224/250/351/233/206/346/210/220/346/214/207/345/215/227.md +5 -5
- package/_packed_docs/sdk/Ownership2.1-SDK/345/274/200/345/217/221/344/270/216/347/247/273/346/244/215/346/214/207/345/215/227.md +5 -5
- package/_packed_docs/sdk/Ownership2.1/350/257/246/347/273/206/350/256/276/350/256/241.md +9 -9
- package/_packed_docs//346/266/210/346/201/257/345/274/271/346/200/247/350/241/245/346/213/211/351/200/232/351/201/223/345/256/236/346/226/275/350/256/241/345/210/222.md +400 -0
- package/_packed_docs//346/266/210/346/201/257/345/274/271/346/200/247/350/241/245/346/213/211/351/200/232/351/201/223/346/226/271/346/241/210.md +485 -0
- package/dist/auth.js +31 -43
- package/dist/auth.js.map +1 -1
- package/dist/client/delivery.d.ts +7 -1
- package/dist/client/delivery.js +137 -16
- package/dist/client/delivery.js.map +1 -1
- package/dist/client/lifecycle.js +10 -1
- package/dist/client/lifecycle.js.map +1 -1
- package/dist/client/rpc-pipeline.d.ts +2 -0
- package/dist/client/rpc-pipeline.js +65 -7
- package/dist/client/rpc-pipeline.js.map +1 -1
- package/dist/client/sync-channels.d.ts +2 -1
- package/dist/client/sync-channels.js +33 -14
- package/dist/client/sync-channels.js.map +1 -1
- package/dist/client/v2-e2ee.d.ts +1 -0
- package/dist/client/v2-e2ee.js +19 -5
- package/dist/client/v2-e2ee.js.map +1 -1
- package/dist/client.d.ts +15 -0
- package/dist/client.js +310 -49
- package/dist/client.js.map +1 -1
- package/dist/events.d.ts +1 -0
- package/dist/events.js +5 -0
- package/dist/events.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/mail-client.d.ts +101 -0
- package/dist/mail-client.js +369 -0
- package/dist/mail-client.js.map +1 -0
- package/dist/pubsub/binding.js +9 -2
- package/dist/pubsub/binding.js.map +1 -1
- package/dist/pubsub/channel.d.ts +11 -3
- package/dist/pubsub/channel.js +88 -7
- package/dist/pubsub/channel.js.map +1 -1
- package/dist/pubsub/client.d.ts +8 -2
- package/dist/pubsub/client.js +59 -17
- package/dist/pubsub/client.js.map +1 -1
- package/dist/pubsub/index.d.ts +2 -2
- package/dist/pubsub/index.js +1 -1
- package/dist/pubsub/index.js.map +1 -1
- package/dist/pubsub/service.d.ts +6 -0
- package/dist/pubsub/service.js +100 -9
- package/dist/pubsub/service.js.map +1 -1
- package/dist/pubsub/types.d.ts +11 -1
- package/dist/tools/cross-sdk-agent.d.ts +1 -1
- package/dist/transport.d.ts +4 -0
- package/dist/transport.js +39 -2
- package/dist/transport.js.map +1 -1
- package/dist/udp-standby.d.ts +89 -0
- package/dist/udp-standby.js +487 -0
- package/dist/udp-standby.js.map +1 -0
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +5 -1
- package/scripts/patch-imapflow-external.mjs +69 -0
package/dist/transport.js
CHANGED
|
@@ -601,6 +601,9 @@ export class RPCTransport {
|
|
|
601
601
|
_budgetWaiters = new Set();
|
|
602
602
|
_requestAdmission = null;
|
|
603
603
|
_requestCheck = null;
|
|
604
|
+
_standbyGate = null;
|
|
605
|
+
_businessActivity = null;
|
|
606
|
+
_standbyAuthParams = null;
|
|
604
607
|
_riskControlHandler = null;
|
|
605
608
|
_classMessageHandler = null;
|
|
606
609
|
_protocolMetaObserver = false;
|
|
@@ -876,6 +879,8 @@ export class RPCTransport {
|
|
|
876
879
|
}
|
|
877
880
|
if (this._workerGeneration === null || message.generation !== this._workerGeneration)
|
|
878
881
|
return;
|
|
882
|
+
if (message.event && !['_transport.disconnect', '_transport.observer', '_transport.sync_control', '_transport.rate_limit'].includes(message.event))
|
|
883
|
+
this._businessActivity?.();
|
|
879
884
|
if (message.event === '_transport.sync_control') {
|
|
880
885
|
const value = message.payload;
|
|
881
886
|
this._syncControlObserver?.(value.meta, value.method, value.params ?? {});
|
|
@@ -1057,6 +1062,11 @@ export class RPCTransport {
|
|
|
1057
1062
|
return this._workerConnected;
|
|
1058
1063
|
return !this._closed && this._ws !== null && this._ws.readyState === WebSocket.OPEN;
|
|
1059
1064
|
}
|
|
1065
|
+
setStandbyGate(gate, inbound = null, authentication = null) {
|
|
1066
|
+
this._standbyGate = gate;
|
|
1067
|
+
this._businessActivity = inbound;
|
|
1068
|
+
this._standbyAuthParams = authentication;
|
|
1069
|
+
}
|
|
1060
1070
|
/**
|
|
1061
1071
|
* 注册 RPC envelope _meta 字段观察者;observer(meta) 在每次成功 RPC 时调用。
|
|
1062
1072
|
*
|
|
@@ -1140,7 +1150,7 @@ export class RPCTransport {
|
|
|
1140
1150
|
const value = guard;
|
|
1141
1151
|
const policy = this._syncAdmission;
|
|
1142
1152
|
if (!policy || policy.parent_connection_id !== value.parent_connection_id || policy.version !== value.version
|
|
1143
|
-
|| Number(policy.max_history_pull_inflight) <= 0 || Number(policy.max_history_inflight_bytes) <= 0
|
|
1153
|
+
|| Number(policy.max_history_pull_inflight) <= 0 || Number(policy.max_history_inflight_bytes) <= 0) {
|
|
1144
1154
|
throw new StateError('history sync policy changed before send', { data: { sync_policy_changed: true }, retryable: true });
|
|
1145
1155
|
}
|
|
1146
1156
|
}
|
|
@@ -1709,7 +1719,29 @@ export class RPCTransport {
|
|
|
1709
1719
|
const result = Promise.all([request, sent]).then(([response]) => response);
|
|
1710
1720
|
return Object.assign(result, { cancel: request.cancel });
|
|
1711
1721
|
}
|
|
1712
|
-
_call(method, params, timeout, trace, background = false, onSent, sentCheckpoint) {
|
|
1722
|
+
_call(method, params, timeout, trace, background = false, onSent, sentCheckpoint, bypassStandby = false) {
|
|
1723
|
+
if (method === 'auth.connect' && this._standbyAuthParams)
|
|
1724
|
+
params = this._standbyAuthParams(params ?? {});
|
|
1725
|
+
if (this._standbyGate && !bypassStandby && !method.startsWith('gateway.standby.')
|
|
1726
|
+
&& !['auth.aid_login1', 'auth.aid_login2', 'auth.connect'].includes(method)) {
|
|
1727
|
+
const deadline = Math.min(typeof params?._rpc_deadline === 'number' ? params._rpc_deadline : Infinity, Date.now() + (timeout ?? this._timeout));
|
|
1728
|
+
const abort = new AbortController();
|
|
1729
|
+
let active;
|
|
1730
|
+
const gate = this._standbyGate;
|
|
1731
|
+
const waiting = (async () => {
|
|
1732
|
+
const release = await gate(method, deadline, abort.signal);
|
|
1733
|
+
try {
|
|
1734
|
+
if (abort.signal.aborted || Date.now() >= deadline)
|
|
1735
|
+
throw new TimeoutError('rpc timeout during standby recovery', { retryable: true });
|
|
1736
|
+
active = this._call(method, params, deadline - Date.now(), trace, background, onSent, sentCheckpoint, true);
|
|
1737
|
+
return await active;
|
|
1738
|
+
}
|
|
1739
|
+
finally {
|
|
1740
|
+
release();
|
|
1741
|
+
}
|
|
1742
|
+
})();
|
|
1743
|
+
return Object.assign(waiting, { cancel: () => { abort.abort(); active?.cancel?.(); } });
|
|
1744
|
+
}
|
|
1713
1745
|
const selected = normalizeRpcBackground(background !== false ? background : params?._rpc_background);
|
|
1714
1746
|
const kind = selected === true && ['message.peers', 'message.pull', 'message.v2.pull', 'message.ack', 'message.v2.ack', 'group.pull', 'group.v2.pull', 'group.pull_events', 'group.ack_messages', 'group.v2.ack'].includes(method) ? 'pull' : selected;
|
|
1715
1747
|
const deadline = Math.min(typeof params?._rpc_deadline === 'number' ? params._rpc_deadline : Infinity, Date.now() + (timeout ?? this._timeout));
|
|
@@ -1916,10 +1948,13 @@ export class RPCTransport {
|
|
|
1916
1948
|
/** 发送 JSON-RPC 2.0 Notification,不分配 id,也不等待响应。 */
|
|
1917
1949
|
async notify(method, params) {
|
|
1918
1950
|
const release = this._requestAdmission?.(`rpc:${String(method).replace(/^(notification|event)\//, '')}`);
|
|
1951
|
+
let standbyRelease;
|
|
1919
1952
|
try {
|
|
1953
|
+
standbyRelease = await this._standbyGate?.(method, Date.now() + this._timeout);
|
|
1920
1954
|
await this._notifyAdmitted(method, params);
|
|
1921
1955
|
}
|
|
1922
1956
|
finally {
|
|
1957
|
+
standbyRelease?.();
|
|
1923
1958
|
release?.();
|
|
1924
1959
|
}
|
|
1925
1960
|
}
|
|
@@ -2434,6 +2469,8 @@ export class RPCTransport {
|
|
|
2434
2469
|
}
|
|
2435
2470
|
/** 路由消息:RPC 响应 / challenge / 事件 / 通知 */
|
|
2436
2471
|
_routeMessage(message) {
|
|
2472
|
+
if (typeof message.method === 'string' && !['meta.ping', 'system.ping', 'ping'].includes(message.method))
|
|
2473
|
+
this._businessActivity?.();
|
|
2437
2474
|
const syncMethod = String(message.method ?? '');
|
|
2438
2475
|
const syncMeta = isJsonObject(message._meta) ? message._meta : {};
|
|
2439
2476
|
if (syncMeta.sync_policy !== undefined || syncMethod.startsWith('event/gateway.sync_')) {
|