@agentunion/fastaun 0.5.35 → 0.5.36
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 +26 -0
- package/_packed_docs/CHANGELOG.md +26 -0
- package/_packed_docs/INDEX.md +10 -3
- package/_packed_docs/sdk/0.5.36-SDK/345/272/224/347/224/250/351/233/206/346/210/220/346/214/207/345/215/227.md +130 -0
- package/_packed_docs/sdk/0.5.36-SDK/345/274/200/345/217/221/344/270/216/347/247/273/346/244/215/346/214/207/345/215/227.md +176 -0
- package/_packed_docs/sdk/INDEX.md +15 -10
- package/dist/agent-md.d.ts +2 -1
- package/dist/agent-md.js +33 -6
- package/dist/agent-md.js.map +1 -1
- package/dist/aid-store.js +5 -1
- package/dist/aid-store.js.map +1 -1
- package/dist/auth.js +5 -2
- package/dist/auth.js.map +1 -1
- package/dist/client/delivery.d.ts +1 -0
- package/dist/client/delivery.js +66 -34
- package/dist/client/delivery.js.map +1 -1
- package/dist/client/rpc-pipeline.d.ts +2 -0
- package/dist/client/rpc-pipeline.js +28 -3
- package/dist/client/rpc-pipeline.js.map +1 -1
- package/dist/client/v2-e2ee.js +5 -1
- package/dist/client/v2-e2ee.js.map +1 -1
- package/dist/client.js +19 -7
- package/dist/client.js.map +1 -1
- package/dist/ownership-v21.d.ts +2 -1
- package/dist/ownership-v21.js +19 -9
- package/dist/ownership-v21.js.map +1 -1
- package/dist/pubsub/channel.js +3 -3
- package/dist/pubsub/channel.js.map +1 -1
- package/dist/pubsub/client.js +3 -4
- package/dist/pubsub/client.js.map +1 -1
- package/dist/pubsub/service.js +1 -1
- package/dist/pubsub/service.js.map +1 -1
- package/dist/tools/cross-sdk-agent.d.ts +1 -1
- package/dist/udp-standby.d.ts +0 -1
- package/dist/udp-standby.js +7 -11
- package/dist/udp-standby.js.map +1 -1
- package/dist/version.d.ts +1 -1
- package/dist/version.js +1 -1
- package/package.json +1 -1
package/dist/client/delivery.js
CHANGED
|
@@ -180,6 +180,7 @@ export class MessageDeliveryEngine {
|
|
|
180
180
|
backgroundPullTimerAt = 0;
|
|
181
181
|
pendingP2PInlineAcks = null;
|
|
182
182
|
pendingGroupInlineAcks = null;
|
|
183
|
+
pendingGroupInlineAckCount = 0;
|
|
183
184
|
pendingGroupInlineAckNamespaces = null;
|
|
184
185
|
inlineAckGeneration = 0;
|
|
185
186
|
pendingDeliveryChanges = null;
|
|
@@ -638,6 +639,7 @@ export class MessageDeliveryEngine {
|
|
|
638
639
|
if (!namespace.startsWith('p2p.peer.v1/') || !Number.isSafeInteger(sequence) || sequence < 0)
|
|
639
640
|
return;
|
|
640
641
|
this.peerServerConfirmedAcks.set(namespace, Math.max(this.peerServerConfirmedAcks.get(namespace) ?? 0, sequence));
|
|
642
|
+
this.runtime.client._rpcPipeline?.confirmBackgroundAck?.(namespace, sequence);
|
|
641
643
|
}
|
|
642
644
|
rememberCommittedSeqState(namespace) {
|
|
643
645
|
this.ensurePeerContext();
|
|
@@ -999,6 +1001,8 @@ export class MessageDeliveryEngine {
|
|
|
999
1001
|
if (this.peerRecoveryTasks.has(sender))
|
|
1000
1002
|
return;
|
|
1001
1003
|
const generation = this.captureInlineAckGeneration();
|
|
1004
|
+
const recoveryVersion = this.capturePeerTailVersion(sender);
|
|
1005
|
+
const recoveryAck = this.peerCommittedAck(namespace);
|
|
1002
1006
|
const task = (async () => {
|
|
1003
1007
|
await this.runAutomaticPull(`peer-init:${sender}`, () => this.initializePeer(sender));
|
|
1004
1008
|
if (!this.hasP2pApplicationSubscription())
|
|
@@ -1060,7 +1064,9 @@ export class MessageDeliveryEngine {
|
|
|
1060
1064
|
const beforeAck = this.peerCommittedAck(namespace);
|
|
1061
1065
|
const beforeVolatile = this.peerVolatilePullCursor(sender);
|
|
1062
1066
|
const beforeWindow = this.syncState(namespace);
|
|
1063
|
-
const result = await client._v2E2EE.pullPeerV2(sender, { background: true, retainMessages: false, budget: { remaining: 100 }
|
|
1067
|
+
const result = await client._v2E2EE.pullPeerV2(sender, { background: true, retainMessages: false, budget: { remaining: 100 },
|
|
1068
|
+
...(!need.volatile && need.head > 0 && pushVersion === recoveryVersion.push && catalogVersion === recoveryVersion.catalog
|
|
1069
|
+
? { autoPeerHead: need.head, autoPeerAckFloor: recoveryAck } : {}) });
|
|
1064
1070
|
need.volatile ||= result.volatile_has_more === true;
|
|
1065
1071
|
const afterWindow = this.syncState(namespace);
|
|
1066
1072
|
if ((!result.complete || result.ack_seq < need.head) && this.peerCommittedAck(namespace) <= beforeAck && this.peerVolatilePullCursor(sender) === beforeVolatile
|
|
@@ -1522,6 +1528,7 @@ export class MessageDeliveryEngine {
|
|
|
1522
1528
|
void this.runtime.client._rpcPipeline?.invalidatePulls?.();
|
|
1523
1529
|
this.pendingP2PInlineAcks = null;
|
|
1524
1530
|
this.pendingGroupInlineAcks = null;
|
|
1531
|
+
this.pendingGroupInlineAckCount = 0;
|
|
1525
1532
|
this.pendingGroupInlineAckNamespaces = null;
|
|
1526
1533
|
this.realtimeSyncing = null;
|
|
1527
1534
|
this.pendingGroupPullUpper = null;
|
|
@@ -1783,7 +1790,7 @@ export class MessageDeliveryEngine {
|
|
|
1783
1790
|
await processing;
|
|
1784
1791
|
}
|
|
1785
1792
|
pendingInlineAckNamespaceCount() {
|
|
1786
|
-
return (this.pendingP2PInlineAcks?.size ?? 0) +
|
|
1793
|
+
return (this.pendingP2PInlineAcks?.size ?? 0) + this.pendingGroupInlineAckCount;
|
|
1787
1794
|
}
|
|
1788
1795
|
markRealtimeTailCompleted(result, tailHead) {
|
|
1789
1796
|
const heads = this.realtimeTailHeads ?? new WeakMap();
|
|
@@ -3694,7 +3701,7 @@ export class MessageDeliveryEngine {
|
|
|
3694
3701
|
return result;
|
|
3695
3702
|
}
|
|
3696
3703
|
reservePendingGroupInlineAck(ns, seq, row, groupAid) {
|
|
3697
|
-
if (!ns || !Number.isSafeInteger(seq) || seq <= 0 || this.pendingGroupInlineAcks?.
|
|
3704
|
+
if (!ns || !Number.isSafeInteger(seq) || seq <= 0 || this.pendingGroupInlineAcks?.get(ns)?.has(seq)
|
|
3698
3705
|
|| this.pendingInlineAckNamespaceCount() >= MAX_INLINE_PENDING_ACK_NAMESPACES)
|
|
3699
3706
|
return false;
|
|
3700
3707
|
const normalizedGroupAid = typeof groupAid === 'string' ? groupAid.trim() : '';
|
|
@@ -3704,7 +3711,9 @@ export class MessageDeliveryEngine {
|
|
|
3704
3711
|
const namespaceMap = this.pendingGroupInlineAckNamespaces ?? new Map();
|
|
3705
3712
|
this.pendingGroupInlineAcks = pendingMap;
|
|
3706
3713
|
this.pendingGroupInlineAckNamespaces = namespaceMap;
|
|
3707
|
-
pendingMap.
|
|
3714
|
+
const entries = pendingMap.get(ns) ?? new Map();
|
|
3715
|
+
pendingMap.set(ns, entries);
|
|
3716
|
+
entries.set(seq, {
|
|
3708
3717
|
seq,
|
|
3709
3718
|
row: this.inlinePostAckRow(row),
|
|
3710
3719
|
groupAid: normalizedGroupAid,
|
|
@@ -3713,6 +3722,7 @@ export class MessageDeliveryEngine {
|
|
|
3713
3722
|
committed: false,
|
|
3714
3723
|
observedAckSeq: 0,
|
|
3715
3724
|
});
|
|
3725
|
+
this.pendingGroupInlineAckCount++;
|
|
3716
3726
|
for (const namespace of namespaces) {
|
|
3717
3727
|
let candidates = namespaceMap.get(namespace);
|
|
3718
3728
|
if (!candidates) {
|
|
@@ -3725,10 +3735,23 @@ export class MessageDeliveryEngine {
|
|
|
3725
3735
|
}
|
|
3726
3736
|
removePendingGroupInlineAck(ns, pending) {
|
|
3727
3737
|
const pendingMap = this.pendingGroupInlineAcks;
|
|
3728
|
-
|
|
3738
|
+
const entries = pendingMap?.get(ns);
|
|
3739
|
+
if (entries?.get(pending.seq) !== pending)
|
|
3729
3740
|
return false;
|
|
3730
|
-
|
|
3741
|
+
entries.delete(pending.seq);
|
|
3742
|
+
this.pendingGroupInlineAckCount--;
|
|
3743
|
+
if (entries.size === 0)
|
|
3744
|
+
pendingMap?.delete(ns);
|
|
3731
3745
|
for (const namespace of pending.namespaces) {
|
|
3746
|
+
let retained = false;
|
|
3747
|
+
for (const other of entries.values()) {
|
|
3748
|
+
if (other.namespaces.includes(namespace)) {
|
|
3749
|
+
retained = true;
|
|
3750
|
+
break;
|
|
3751
|
+
}
|
|
3752
|
+
}
|
|
3753
|
+
if (retained)
|
|
3754
|
+
continue;
|
|
3732
3755
|
const aliases = this.pendingGroupInlineAckNamespaces?.get(namespace);
|
|
3733
3756
|
if (!aliases)
|
|
3734
3757
|
continue;
|
|
@@ -3739,8 +3762,8 @@ export class MessageDeliveryEngine {
|
|
|
3739
3762
|
return true;
|
|
3740
3763
|
}
|
|
3741
3764
|
dropPendingGroupInlineAck(ns, seq) {
|
|
3742
|
-
const pending = this.pendingGroupInlineAcks?.get(ns);
|
|
3743
|
-
if (pending
|
|
3765
|
+
const pending = this.pendingGroupInlineAcks?.get(ns)?.get(seq);
|
|
3766
|
+
if (pending)
|
|
3744
3767
|
this.removePendingGroupInlineAck(ns, pending);
|
|
3745
3768
|
}
|
|
3746
3769
|
resolvePendingGroupInlineAckNamespace(ns) {
|
|
@@ -3761,19 +3784,23 @@ export class MessageDeliveryEngine {
|
|
|
3761
3784
|
const canonicalNs = candidates.values().next().value;
|
|
3762
3785
|
if (typeof canonicalNs !== 'string')
|
|
3763
3786
|
return;
|
|
3764
|
-
const
|
|
3765
|
-
if (!
|
|
3766
|
-
return;
|
|
3767
|
-
if (!pending.committed) {
|
|
3768
|
-
pending.observedAckSeq = Math.max(pending.observedAckSeq, upToSeq);
|
|
3787
|
+
const entries = this.pendingGroupInlineAcks?.get(canonicalNs);
|
|
3788
|
+
if (!entries)
|
|
3769
3789
|
return;
|
|
3790
|
+
for (const pending of entries.values()) {
|
|
3791
|
+
if (upToSeq < pending.seq)
|
|
3792
|
+
continue;
|
|
3793
|
+
if (!pending.committed) {
|
|
3794
|
+
pending.observedAckSeq = Math.max(pending.observedAckSeq, upToSeq);
|
|
3795
|
+
continue;
|
|
3796
|
+
}
|
|
3797
|
+
this.removePendingGroupInlineAck(canonicalNs, pending);
|
|
3798
|
+
this.runPostInlineCommit(pending.row);
|
|
3770
3799
|
}
|
|
3771
|
-
this.removePendingGroupInlineAck(canonicalNs, pending);
|
|
3772
|
-
this.runPostInlineCommit(pending.row);
|
|
3773
3800
|
}
|
|
3774
3801
|
markPendingGroupInlineAckCommitted(ns, seq) {
|
|
3775
|
-
const pending = this.pendingGroupInlineAcks?.get(ns);
|
|
3776
|
-
if (!pending
|
|
3802
|
+
const pending = this.pendingGroupInlineAcks?.get(ns)?.get(seq);
|
|
3803
|
+
if (!pending)
|
|
3777
3804
|
return false;
|
|
3778
3805
|
pending.committed = true;
|
|
3779
3806
|
if (pending.observedAckSeq < seq)
|
|
@@ -3783,8 +3810,8 @@ export class MessageDeliveryEngine {
|
|
|
3783
3810
|
return true;
|
|
3784
3811
|
}
|
|
3785
3812
|
retryPendingGroupInlineAck(ns, seq, reason, ackThrough = seq) {
|
|
3786
|
-
const pending = this.pendingGroupInlineAcks?.get(ns);
|
|
3787
|
-
if (!pending
|
|
3813
|
+
const pending = this.pendingGroupInlineAcks?.get(ns)?.get(seq);
|
|
3814
|
+
if (!pending)
|
|
3788
3815
|
return false;
|
|
3789
3816
|
if (pending.acking || !pending.committed)
|
|
3790
3817
|
return true;
|
|
@@ -3803,12 +3830,12 @@ export class MessageDeliveryEngine {
|
|
|
3803
3830
|
})).then((result) => {
|
|
3804
3831
|
this.onGroupV2AckResult(groupId, result, requestedSeq, generation);
|
|
3805
3832
|
}).catch((error) => {
|
|
3806
|
-
const current = this.pendingGroupInlineAcks?.get(ns);
|
|
3833
|
+
const current = this.pendingGroupInlineAcks?.get(ns)?.get(seq);
|
|
3807
3834
|
if (current === pending)
|
|
3808
3835
|
current.acking = false;
|
|
3809
3836
|
this.runtime.client._clientLog.debug(`group.v2 ${reason} ack failed: group=${groupId} ${formatDeliveryError(error)}`);
|
|
3810
3837
|
}).finally(() => {
|
|
3811
|
-
const current = this.pendingGroupInlineAcks?.get(ns);
|
|
3838
|
+
const current = this.pendingGroupInlineAcks?.get(ns)?.get(seq);
|
|
3812
3839
|
if (current === pending)
|
|
3813
3840
|
current.acking = false;
|
|
3814
3841
|
});
|
|
@@ -3831,6 +3858,7 @@ export class MessageDeliveryEngine {
|
|
|
3831
3858
|
const gid = String(groupId ?? '').trim();
|
|
3832
3859
|
if (!gid || !Number.isSafeInteger(upToSeq) || upToSeq <= 0)
|
|
3833
3860
|
return;
|
|
3861
|
+
this.runtime.client._rpcPipeline?.confirmBackgroundAck?.(this.resolvePendingGroupInlineAckNamespace(`group:${gid}`), upToSeq);
|
|
3834
3862
|
this.completePendingGroupInlineAck(`group:${gid}`, upToSeq);
|
|
3835
3863
|
}
|
|
3836
3864
|
onGroupV2AckResult(groupId, result, requestedSeq, generation = this.inlineAckGeneration) {
|
|
@@ -4797,15 +4825,20 @@ export class MessageDeliveryEngine {
|
|
|
4797
4825
|
client._seqTracker._restoreNamespaceSnapshotPreservingPush(ns, snapshot);
|
|
4798
4826
|
throw error;
|
|
4799
4827
|
}
|
|
4800
|
-
await client._v2E2EE.ackPeerV2(sender, this.syncState(ns).ack);
|
|
4801
4828
|
return true;
|
|
4802
4829
|
})).catch((error) => {
|
|
4803
4830
|
if (generation === this.captureInlineAckGeneration())
|
|
4804
4831
|
this.schedulePeerRecovery(sender, seq);
|
|
4805
4832
|
throw error;
|
|
4806
4833
|
});
|
|
4807
|
-
if (consumed?.acquired && consumed.value &&
|
|
4808
|
-
|
|
4834
|
+
if (consumed?.acquired && consumed.value && generation === this.captureInlineAckGeneration()) {
|
|
4835
|
+
this.scheduleForwardAck(ns, this.peerCommittedAck(ns), async (ack) => {
|
|
4836
|
+
if (!this.isPeerHeadCovered(ns, ack))
|
|
4837
|
+
await client._v2E2EE.ackPeerV2(sender, ack);
|
|
4838
|
+
});
|
|
4839
|
+
if (!unbounded)
|
|
4840
|
+
return;
|
|
4841
|
+
}
|
|
4809
4842
|
}
|
|
4810
4843
|
if ((!unbounded && this.isPeerHeadCovered(ns, seq)) || !this.hasP2pApplicationSubscription())
|
|
4811
4844
|
return;
|
|
@@ -4817,7 +4850,7 @@ export class MessageDeliveryEngine {
|
|
|
4817
4850
|
}
|
|
4818
4851
|
else {
|
|
4819
4852
|
await this.runAutomaticPull(ns, () => client._v2E2EE.pullPeerV2(sender, { limit: _INTERNAL_MESSAGE_FLOW_LIMITS.pullPageSize, budget: { remaining: 1 },
|
|
4820
|
-
...(!unbounded ? { autoPeerHead: seq, peerPullVersion } : {}),
|
|
4853
|
+
...(!unbounded ? { autoPeerHead: seq, autoPeerAckFloor: committedAck, peerPullVersion } : {}),
|
|
4821
4854
|
...(this.shouldTailPeer(ns, seq, _INTERNAL_MESSAGE_FLOW_LIMITS.pullPageSize) ? { window_mode: 'tail', autoTail: { head: seq, forward: false } } : {}) }));
|
|
4822
4855
|
}
|
|
4823
4856
|
}
|
|
@@ -4935,7 +4968,7 @@ export class MessageDeliveryEngine {
|
|
|
4935
4968
|
}
|
|
4936
4969
|
else {
|
|
4937
4970
|
const pendingNs = this.resolvePendingGroupInlineAckNamespace(ns);
|
|
4938
|
-
const pending = this.pendingGroupInlineAcks?.get(pendingNs);
|
|
4971
|
+
const pending = this.pendingGroupInlineAcks?.get(pendingNs)?.values().next().value;
|
|
4939
4972
|
if (pending)
|
|
4940
4973
|
this.retryPendingGroupInlineAck(pendingNs, pending.seq, 'covered online hint', committedAck);
|
|
4941
4974
|
}
|
|
@@ -5023,9 +5056,7 @@ export class MessageDeliveryEngine {
|
|
|
5023
5056
|
if (this.automaticGroupPullStopped(ns))
|
|
5024
5057
|
return;
|
|
5025
5058
|
let inlineConsumed = false;
|
|
5026
|
-
|
|
5027
|
-
const inlineBlockedByPendingAck = Boolean(pendingInlineAck && pendingInlineAck.seq !== seq);
|
|
5028
|
-
if (inlinePresent && !inlineBlockedByPendingAck && isJsonObject(d.inline_message)) {
|
|
5059
|
+
if (inlinePresent && isJsonObject(d.inline_message)) {
|
|
5029
5060
|
try {
|
|
5030
5061
|
inlineConsumed = await this.tryConsumeInlineGroup(d, groupId, ns, seq, expectedVersion, inlineGeneration);
|
|
5031
5062
|
if (inlineGeneration !== undefined && !this.inlineGenerationIsCurrent(inlineGeneration))
|
|
@@ -5046,8 +5077,8 @@ export class MessageDeliveryEngine {
|
|
|
5046
5077
|
client._seqTracker.updateMaxSeen(ns, seq);
|
|
5047
5078
|
if (seq <= before.ack && before.ack >= before.tail - 1) {
|
|
5048
5079
|
client._clientLog.debug(`V2 group duplicate push ignored: group=${groupId} seq=${seq} A/T/H=${JSON.stringify(before)}`);
|
|
5049
|
-
const pending = this.pendingGroupInlineAcks?.get(ns);
|
|
5050
|
-
if (inlinePresent && pending
|
|
5080
|
+
const pending = this.pendingGroupInlineAcks?.get(ns)?.get(seq);
|
|
5081
|
+
if (inlinePresent && pending) {
|
|
5051
5082
|
this.retryPendingGroupInlineAck(ns, seq, 'covered inline push');
|
|
5052
5083
|
}
|
|
5053
5084
|
return;
|
|
@@ -5534,9 +5565,10 @@ export class MessageDeliveryEngine {
|
|
|
5534
5565
|
}
|
|
5535
5566
|
else if (method === 'group.v2.ack' || method === 'group.ack_messages') {
|
|
5536
5567
|
const canonicalNs = this.resolvePendingGroupInlineAckNamespace(ns);
|
|
5537
|
-
const pending
|
|
5538
|
-
|
|
5539
|
-
|
|
5568
|
+
for (const pending of this.pendingGroupInlineAcks?.get(canonicalNs)?.values() ?? []) {
|
|
5569
|
+
if (!pending.committed && next >= pending.seq)
|
|
5570
|
+
next = pending.seq - 1;
|
|
5571
|
+
}
|
|
5540
5572
|
}
|
|
5541
5573
|
}
|
|
5542
5574
|
return next;
|