@songsid/agend 2.1.2-beta.18 → 2.1.2-beta.19
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/dist/agent-endpoint.d.ts +2 -0
- package/dist/agent-endpoint.js +17 -1
- package/dist/agent-endpoint.js.map +1 -1
- package/dist/backend/antigravity.d.ts +18 -0
- package/dist/backend/antigravity.js +31 -5
- package/dist/backend/antigravity.js.map +1 -1
- package/dist/channel/ipc-timeouts.d.ts +7 -1
- package/dist/channel/ipc-timeouts.js +8 -1
- package/dist/channel/ipc-timeouts.js.map +1 -1
- package/dist/fleet-manager.d.ts +5 -0
- package/dist/fleet-manager.js +57 -28
- package/dist/fleet-manager.js.map +1 -1
- package/dist/reply-dedup.d.ts +41 -0
- package/dist/reply-dedup.js +0 -0
- package/dist/reply-dedup.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Suppresses duplicate replies caused by retries above a non-idempotent send.
|
|
3
|
+
*
|
|
4
|
+
* The reply pipeline has no idempotency, and every layer above it retries on an
|
|
5
|
+
* uncertain outcome: the daemon times out `fleet_outbound` at its budget and
|
|
6
|
+
* tells the agent the reply failed while the adapter send is still in flight
|
|
7
|
+
* (and about to succeed — Discord's REST layer queues rate-limited requests
|
|
8
|
+
* rather than failing them), and an HTTP agent's shell tool kills a slow
|
|
9
|
+
* `agend-agent reply` the same way. The agent then re-sends the identical text
|
|
10
|
+
* and the channel shows it twice.
|
|
11
|
+
*
|
|
12
|
+
* Semantics, chosen per failure mode:
|
|
13
|
+
* - A duplicate of an IN-FLIGHT reply subscribes to the first send's outcome —
|
|
14
|
+
* this is the actual race (the retry arrives while the original is still
|
|
15
|
+
* waiting out a rate limit), and both callers report whatever the one real
|
|
16
|
+
* send did.
|
|
17
|
+
* - A duplicate of a COMPLETED reply within the window replays the stored
|
|
18
|
+
* result without sending.
|
|
19
|
+
* - A FAILED reply clears its entry: an agent retrying a genuine failure is
|
|
20
|
+
* correct behaviour and must go through.
|
|
21
|
+
*/
|
|
22
|
+
export declare class ReplyDeduper {
|
|
23
|
+
private readonly windowMs;
|
|
24
|
+
private readonly now;
|
|
25
|
+
private entries;
|
|
26
|
+
constructor(windowMs?: number, now?: () => number);
|
|
27
|
+
/**
|
|
28
|
+
* Register an outgoing reply. Returns `fresh` (send it, then call `complete`
|
|
29
|
+
* exactly once with the outcome) or `duplicate` (do NOT send; `subscribe` for
|
|
30
|
+
* the outcome the original send produces / produced).
|
|
31
|
+
*/
|
|
32
|
+
begin(instance: string, text: string, files?: readonly string[]): {
|
|
33
|
+
duplicate: false;
|
|
34
|
+
complete(result: unknown, error?: string): void;
|
|
35
|
+
} | {
|
|
36
|
+
duplicate: true;
|
|
37
|
+
subscribe(cb: (result: unknown, error?: string) => void): void;
|
|
38
|
+
};
|
|
39
|
+
private key;
|
|
40
|
+
private prune;
|
|
41
|
+
}
|
|
Binary file
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"reply-dedup.js","sourceRoot":"","sources":["../src/reply-dedup.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AAEzC;;;;;;;;;;;;;;;;;;;;GAoBG;AACH,MAAM,OAAO,YAAY;IAGM;IAAoC;IAFzD,OAAO,GAAG,IAAI,GAAG,EAAiB,CAAC;IAE3C,YAA6B,WAAW,MAAM,EAAmB,MAAM,IAAI,CAAC,GAAG;QAAlD,aAAQ,GAAR,QAAQ,CAAS;QAAmB,QAAG,GAAH,GAAG,CAAW;IAAG,CAAC;IAEnF;;;;OAIG;IACH,KAAK,CAAC,QAAgB,EAAE,IAAY,EAAE,QAA2B,EAAE;QAGjE,IAAI,CAAC,KAAK,EAAE,CAAC;QACb,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,CAAC,QAAQ,EAAE,IAAI,EAAE,KAAK,CAAC,CAAC;QAC5C,MAAM,QAAQ,GAAG,IA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