@securecoms/agent-bridge 0.32.0 → 0.33.0
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/README.md +15 -0
- package/dist/bin.js +751 -130
- package/dist/bridge-agent.d.ts +112 -1
- package/dist/index.js +734 -113
- package/dist/version.d.ts +1 -1
- package/dist/voice-channel-binding.d.ts +201 -0
- package/dist/voice-channel-frame.d.ts +22 -0
- package/package.json +1 -1
package/dist/bridge-agent.d.ts
CHANGED
|
@@ -103,6 +103,13 @@ export declare const OWNER_DM_DEFAULT_READ_GRANTS: readonly BridgeToolGrant[];
|
|
|
103
103
|
* it with ROOM_SAFE_READ_TOOLS (turn-loop.ts).
|
|
104
104
|
*/
|
|
105
105
|
export declare const ROOM_DEFAULT_READ_GRANTS: readonly BridgeToolGrant[];
|
|
106
|
+
/**
|
|
107
|
+
* ADR-0024 step 2a Task 18 (spec §2): the per-device capability tokens this build declares on every
|
|
108
|
+
* runtime-config report. `voice_channel_v1` is declared ONLY by a build that binds V: the server counts a device
|
|
109
|
+
* as voice-capable from this token, so a build that cannot bind V must never send it. A constant enum list,
|
|
110
|
+
* content-free by design (F-0 #1209).
|
|
111
|
+
*/
|
|
112
|
+
export declare const BRIDGE_CAPABILITIES: readonly ["voice_channel_v1"];
|
|
106
113
|
/**
|
|
107
114
|
* Voice fast-path privacy, P-5 (spec §9). The grants of a relayed owner voice turn (and, from Task 4, of every
|
|
108
115
|
* voice-scoped owner turn). A constant of its own, frozen and written out, so a later change to
|
|
@@ -982,6 +989,13 @@ export declare class BridgeAgent {
|
|
|
982
989
|
private readonly supersedeRefundable;
|
|
983
990
|
/** M-1: channels this process has used as a FileSafe vault channel. */
|
|
984
991
|
private readonly vaultChannelIds;
|
|
992
|
+
/**
|
|
993
|
+
* ADR-0024 step 2a Task 19 (spec §9): hidden voice channels V resolved to their conversation P, lookup back-off, and
|
|
994
|
+
* each V's binding verdict. In memory only: a restart re-resolves (one get_channel per V) and re-evaluates.
|
|
995
|
+
*/
|
|
996
|
+
private readonly voiceChannels;
|
|
997
|
+
/** Fix M-3: channels a listing row marked channel_kind "voice"; never recorded as listed. */
|
|
998
|
+
private readonly listedAsVoice;
|
|
985
999
|
/** Phase 3 F3: consecutive agent turns per channel. */
|
|
986
1000
|
private readonly agentHops;
|
|
987
1001
|
private readonly maxAgentHops;
|
|
@@ -1012,6 +1026,12 @@ export declare class BridgeAgent {
|
|
|
1012
1026
|
* counter is incremented. Surfaced on health()/metrics().
|
|
1013
1027
|
*/
|
|
1014
1028
|
private failedAttachments;
|
|
1029
|
+
/** Task 20 R4: V frames dropped by the per-frame verdict (not bound, or not at the verdict's positions). A number only. */
|
|
1030
|
+
private voiceFramesRefused;
|
|
1031
|
+
/** Task 20: frames on a bound V the accept filter dropped (not R's voice frame, a greeting marker or a transcript). */
|
|
1032
|
+
private voiceFramesFiltered;
|
|
1033
|
+
/** Task 20: message id of an admitted V frame -> its P (B.8 keys). Bounded; an entry lives one ingest cycle in practice. */
|
|
1034
|
+
private readonly voiceFrameParent;
|
|
1015
1035
|
/** Files link: vault_ref bodies refused by R1 (strict parse) or R2 (enclave binding). */
|
|
1016
1036
|
private refusedVaultRefs;
|
|
1017
1037
|
/**
|
|
@@ -2155,8 +2175,91 @@ export declare class BridgeAgent {
|
|
|
2155
2175
|
private fetchBounded;
|
|
2156
2176
|
/** H-A rule 4 (audit r1 C2): GET /api/v1/channels/{id}; only 404 is "gone" (404, not 403, for non-members). */
|
|
2157
2177
|
private probeChannelMembership;
|
|
2178
|
+
/**
|
|
2179
|
+
* Task 20's accessor: P's channel id ONLY while V is bound under the spec §9 rule at both groups' held positions as
|
|
2180
|
+
* of the last evaluation (every receive cycle, before any frame is processed; or {@link voiceParentNow}); undefined
|
|
2181
|
+
* for an unbound or refused V, and for any channel that is not a resolved V.
|
|
2182
|
+
*/
|
|
2183
|
+
voiceParentOf(channelId: string): string | undefined;
|
|
2184
|
+
/** True for a channel resolved as a V, bound or not. Such a channel is never processed as a normal channel. */
|
|
2185
|
+
isKnownVoiceChannel(channelId: string): boolean;
|
|
2186
|
+
/** Re-evaluates one V at the held positions now, then answers as {@link voiceParentOf}. */
|
|
2187
|
+
private voiceParentNow;
|
|
2188
|
+
/** A channel no listing has ever classified (in memory or persisted). V is hidden from the listing, so it is one. */
|
|
2189
|
+
private isUnlistedChannel;
|
|
2190
|
+
private voiceChannelGate;
|
|
2191
|
+
/**
|
|
2192
|
+
* Looks up one channel with get_channel (the voice arm, OQ-5 (a)). Only the classification is kept. Never throws; a
|
|
2193
|
+
* failure is recorded and retried (30 s doubling to 10 min). Called only from {@link resolveUnlistedChannels}, which
|
|
2194
|
+
* selects unlisted channels whose back-off allows.
|
|
2195
|
+
*/
|
|
2196
|
+
private resolveVoiceChannel;
|
|
2197
|
+
/**
|
|
2198
|
+
* Looks up every unlisted channel among `channelIds` whose back-off allows. A channel is "unlisted" only after this
|
|
2199
|
+
* cycle's listing: if any candidate remains and the cycle has not listed yet, one listing runs first, so a channel
|
|
2200
|
+
* that is merely new (listed, not yet cached) is never looked up. Returns true when it ran that listing.
|
|
2201
|
+
*/
|
|
2202
|
+
private resolveUnlistedChannels;
|
|
2203
|
+
/** Final review M-c: V -> consecutive failed member-list reads for the binding, and when the last one ran. */
|
|
2204
|
+
private readonly voiceRosterRetry;
|
|
2205
|
+
/** The first retry after a failure is immediate (next cycle); then 30 s, doubling, capped at 10 min. */
|
|
2206
|
+
private voiceRosterRetryDue;
|
|
2207
|
+
private noteVoiceRosterRead;
|
|
2208
|
+
/** Every resolved V, re-evaluated where a position or a roster moved. */
|
|
2209
|
+
private reevaluateVoiceBindings;
|
|
2210
|
+
/**
|
|
2211
|
+
* The spec §9 binding rule over the bridge's OWN ratchet trees (never a server list of leaves), keyed by both
|
|
2212
|
+
* groups' held (group, epoch) and both rosters' fetch times: a change in any of them re-evaluates. V's member list
|
|
2213
|
+
* is read only for `is_relay`, and only when it is fresh at V's held position. Fail closed: a tree that moved while
|
|
2214
|
+
* it was read, or any exception, leaves V unbound and is re-evaluated next time.
|
|
2215
|
+
*/
|
|
2216
|
+
private reevaluateVoiceBinding;
|
|
2217
|
+
/**
|
|
2218
|
+
* Fix I-1 / Task 20 R1: P's held position for every resolved V, read before a receive so frames can be stamped. V's
|
|
2219
|
+
* half is not stamped here: each frame carries the epoch that opened it (`openedAt`).
|
|
2220
|
+
*/
|
|
2221
|
+
private voicePositionSnapshot;
|
|
2222
|
+
/**
|
|
2223
|
+
* Fix I-1, for Task 20: P for ONE frame on V, only when V is bound now AND neither P's nor V's held (group, epoch)
|
|
2224
|
+
* moved between that frame's first receipt and the verdict. Otherwise undefined: the frame is dropped (acked, never
|
|
2225
|
+
* held, never processed). A frame first received before V was resolved has no receipt positions and is refused.
|
|
2226
|
+
*/
|
|
2227
|
+
voiceParentForFrame(channelId: string, messageId: string, openedAt?: {
|
|
2228
|
+
groupId: string;
|
|
2229
|
+
epoch: number;
|
|
2230
|
+
} | null): string | undefined;
|
|
2231
|
+
/** Stores a verdict; a change of verdict logs one content-free line. */
|
|
2232
|
+
private noteVoiceBinding;
|
|
2233
|
+
/**
|
|
2234
|
+
* The receive-cycle gate, before any per-frame work. A resolved V is never a normal channel: a frame passes only when
|
|
2235
|
+
* the per-frame verdict names P (bound now, its P stamp and its own opening epoch at the verdict's positions) AND the
|
|
2236
|
+
* accept filter takes it (Task 20: R's voice frame or a P member's greeting marker; a call_transcript is acked, not a
|
|
2237
|
+
* turn). Every other V frame is acked unprocessed and never recorded. A channel get_channel answered 404 is acked
|
|
2238
|
+
* unprocessed (fail closed). An unlisted channel whose lookup errored or has not run is held: neither processed nor
|
|
2239
|
+
* acked, so it is re-served once the lookup answers. Everything else passes unchanged.
|
|
2240
|
+
*/
|
|
2241
|
+
private gateVoiceEntries;
|
|
2242
|
+
/**
|
|
2243
|
+
* Task 20: the per-frame verdict and the accept filter for one frame on a resolved V. True only for a model turn
|
|
2244
|
+
* (R's voice frame, a P member's greeting marker), which is then keyed per B.8 through {@link voiceFrameParent}. A
|
|
2245
|
+
* call_transcript is accepted but is not a turn (acked, nothing more, as step 1 on P). Counters are numbers only.
|
|
2246
|
+
*/
|
|
2247
|
+
private admitVoiceFrame;
|
|
2248
|
+
/**
|
|
2249
|
+
* Task 20 (B.8): the key channel for metadata, audience, owner, manifest and caps. For an admitted V frame, its P;
|
|
2250
|
+
* for any other frame, its own channel.
|
|
2251
|
+
*/
|
|
2252
|
+
private keyChannelForFrame;
|
|
2253
|
+
/**
|
|
2254
|
+
* Task 20 (B.8 "per-room daily caps → P", the room rate floor): the channel a cap or floor counts against. A known V
|
|
2255
|
+
* counts against its bound P; an unbound V against itself (no grant can be issued there, so nothing is widened).
|
|
2256
|
+
*/
|
|
2257
|
+
private capChannelFor;
|
|
2258
|
+
/** Phase 3 F1 pause, for a voice channel V also read on its P (a paused agent runs no inference on the call either). */
|
|
2259
|
+
private pausedFor;
|
|
2158
2260
|
/** §5.4: one conversation's turns, facts, notes and recall, inside the memory mutex, with every in-memory copy. */
|
|
2159
2261
|
private purgeConversation;
|
|
2262
|
+
private purgeOneConversation;
|
|
2160
2263
|
/**
|
|
2161
2264
|
* 7b Task 17: the purged conversation's recall cache and pending map
|
|
2162
2265
|
* entries go too, inside the memory mutex. The purge already moved the
|
|
@@ -3220,7 +3323,7 @@ export declare class BridgeAgent {
|
|
|
3220
3323
|
/** Spec §7.5: the room is capped today: cap 0, reached (by the runtime or the backstop), or at the cap. Fails closed. */
|
|
3221
3324
|
private roomSearchCapped;
|
|
3222
3325
|
/** Spec §7.5 (T-14c, M-4): the runtime reports an executed-call cap for a room. Never throws. */
|
|
3223
|
-
noteRoomCapReached(
|
|
3326
|
+
noteRoomCapReached(reported: string): void;
|
|
3224
3327
|
/** K-14, once per room per UTC day; the flag is persisted only after the send resolves. Called only from noteRoomCapReached. */
|
|
3225
3328
|
private noticeRoomSearchCap;
|
|
3226
3329
|
private logRoomCap;
|
|
@@ -3490,6 +3593,14 @@ export declare class BridgeAgent {
|
|
|
3490
3593
|
failed_attachments: number;
|
|
3491
3594
|
/** Files link: vault_ref bodies refused by R1 (strict parse) or R2 (enclave binding), acked. */
|
|
3492
3595
|
refused_vault_refs: number;
|
|
3596
|
+
/** ADR-0024 step 2a Task 20 R4: frames on a voice channel V dropped by the per-frame verdict (number only). */
|
|
3597
|
+
voice_frames_refused: number;
|
|
3598
|
+
/** Task 20: frames on a bound V the accept filter dropped (number only). */
|
|
3599
|
+
voice_frames_filtered: number;
|
|
3600
|
+
/** Task 20 final review M-d: arrivals refused because the receipt map was full (number only). */
|
|
3601
|
+
voice_receipt_cap_reached: number;
|
|
3602
|
+
/** Task 20 final review: bound Vs whose relay is also a P leaf (pre-stamp shape; PR-F sunset signal). */
|
|
3603
|
+
voice_relay_in_parent: number;
|
|
3493
3604
|
/** Task 4 (self-hosted fast voice): cumulative fast-path replies actually sent. */
|
|
3494
3605
|
fast_path_sent: number;
|
|
3495
3606
|
/** Task 4 (self-hosted fast voice): cumulative fast-path attempts that errored (LLM call, normalization, or send) — fail-soft, never blocks the buffered turn. */
|