@securecoms/agent-bridge 0.29.0 → 0.30.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.
@@ -0,0 +1,35 @@
1
+ export declare const PIN_FILE_NAME = "owner-signing-key.json";
2
+ export declare const PIN_STATES: readonly ["ok", "no_pin", "pin_conflict", "malformed", "unsupported_algo", "symlink_refused", "unreadable", "server_owner_mismatch"];
3
+ export type PinState = (typeof PIN_STATES)[number];
4
+ export interface OwnerGrantPin {
5
+ readonly ownerIdentityId: string;
6
+ readonly keyAlgo: "ed25519";
7
+ readonly publicKey: Uint8Array;
8
+ readonly publicKeyB64: string;
9
+ }
10
+ export interface OwnerGrantPinResult {
11
+ readonly state: Exclude<PinState, "server_owner_mismatch">;
12
+ readonly pin: OwnerGrantPin | null;
13
+ }
14
+ /** Canonical base64 of exactly `len` bytes: decode, re-encode, compare. */
15
+ export declare function canonicalBase64Bytes(v: unknown, len: number): Uint8Array | null;
16
+ export declare function parsePinObject(v: unknown): {
17
+ ok: true;
18
+ pin: OwnerGrantPin;
19
+ } | {
20
+ ok: false;
21
+ state: "malformed" | "unsupported_algo";
22
+ };
23
+ export interface PinFs {
24
+ lstat(path: string): {
25
+ isSymbolicLink(): boolean;
26
+ mode: number;
27
+ };
28
+ readFile(path: string): string;
29
+ }
30
+ /** Spec §6.5. A symlinked pin file is `symlink_refused` whatever the credential holds. */
31
+ export declare function loadOwnerGrantPin(opts: {
32
+ credentialPath: string;
33
+ credentialJson: Record<string, unknown>;
34
+ fs?: PinFs;
35
+ }): OwnerGrantPinResult;
@@ -0,0 +1,15 @@
1
+ /**
2
+ * Owner grants plan 4, Task 12 (spec §7.5, OQ-2, audit r1 L-3): the bridge's copy of the runtime's
3
+ * operator-cap parser (connect-agent-runtime/src/room-search-cap.ts). The two packages share no
4
+ * dependency; bridge-agent.room-search-cap.test.ts pins them equal on every listed input.
5
+ */
6
+ export declare const ROOM_SEARCH_DAILY_CAP = 50;
7
+ export declare const ROOM_SEARCH_CAP_ENV = "SECURECOMS_ROOM_SEARCH_DAILY_CAP";
8
+ /** /^\d+$/ and <= 50 is used (0 = no room search); anything else is 50 with one warning. Never a widening. */
9
+ export declare function parseRoomSearchCap(v: string | undefined, warn?: () => void): number;
10
+ /** Review M-3 (ERIC APPROVALS 3): the per-agent total across rooms, the runtime's parser copied (parity-tested). */
11
+ export declare const AGENT_ROOM_SEARCH_DAILY_CAP = 200;
12
+ export declare const AGENT_ROOM_SEARCH_CAP_ENV = "SECURECOMS_AGENT_ROOM_SEARCH_DAILY_CAP";
13
+ export declare function parseAgentRoomSearchCap(v: string | undefined, warn?: () => void): number;
14
+ /** The store row that holds the per-agent total (never a channel id: channel ids are UUIDs). */
15
+ export declare const AGENT_TOTAL_KEY = "agent-total";
@@ -0,0 +1,53 @@
1
+ /** "untrusted" (review H-3): an agent reply whose turn saw a relay-class line, or that could not be attributed. */
2
+ export type LineOrigin = "fast_path" | "reply" | "untrusted";
3
+ /** 2026-09-07T00:00:00Z: before this the deterministic fast-reply id did not exist (`date -u -r 1788739200`). */
4
+ export declare const FAST_ID_EPOCH_MS = 1788739200000;
5
+ /**
6
+ * The unkeyed fastReplyId of e1369a7c (2026-09-06) to 60365953 (2026-09-25): SHA-256 of `fast:<messageId>`, first 16
7
+ * bytes, RFC 4122 version and variant nibbles, as a hyphenated UUID. Rows of that period carry this form.
8
+ */
9
+ export declare function legacyFastReplyId(messageId: string): string;
10
+ export interface AgentLine {
11
+ readonly origin?: LineOrigin;
12
+ readonly modality?: string;
13
+ readonly messageId?: string;
14
+ readonly ts?: number;
15
+ }
16
+ /** `fastIds`: the keyed AND the legacy fast-reply id of every peer row of the conversation (not the 50-row window). */
17
+ export interface FenceContext {
18
+ readonly fastIds: ReadonlySet<string>;
19
+ }
20
+ /** Rule 4, history. */
21
+ export declare function classifyAgentLine(line: AgentLine, ctx: FenceContext): LineOrigin;
22
+ export interface UnifiedItemFacts {
23
+ readonly channelId: string;
24
+ readonly source: string;
25
+ readonly originId: string;
26
+ readonly role?: "peer" | "agent";
27
+ readonly origin?: LineOrigin;
28
+ readonly sourceRef?: string;
29
+ }
30
+ export type TraceRow = ({
31
+ readonly role: "peer" | "agent";
32
+ readonly peerId?: string;
33
+ } & AgentLine) | null;
34
+ /**
35
+ * Review H-3 (ruling): a peer line is relay-class when its authenticated sender is not the pinned owner identity
36
+ * (the relay, incl. owner-speaker voice transcripts) or its modality is voice.
37
+ */
38
+ export declare function isRelayClassPeer(line: {
39
+ readonly peerId?: string;
40
+ readonly modality?: string;
41
+ }, ownerId: string): boolean;
42
+ export type Trace = (conversationId: string, at: {
43
+ seq?: number;
44
+ messageId?: string;
45
+ }) => TraceRow;
46
+ /**
47
+ * Rule 4, unified. `strict` (review H-3): a turn that holds a manifest grant, which also excludes owner-voice items
48
+ * and imported peer lines that trace to a relay-class row (or cannot be traced).
49
+ */
50
+ export declare function classifyUnifiedItem(item: UnifiedItemFacts, trace: Trace, ctx: FenceContext, strict?: {
51
+ readonly ownerId: string;
52
+ readonly turnChannelId?: string;
53
+ }, keepUntrusted?: boolean): "keep" | "exclude";
@@ -25,6 +25,7 @@ export declare function writeSse(res: {
25
25
  export declare function deliverSseBatch(res: Parameters<typeof writeSse>[0], batch: BridgeMessage[], agent: {
26
26
  ackRuntimeMessages(ids: string[]): void;
27
27
  requeueFront(msgs: BridgeMessage[]): void;
28
+ harnessGrantsWithheld(): boolean;
28
29
  }, onWriteError?: (error: unknown) => void): void;
29
30
  /**
30
31
  * Once-per-connection write-failure reporter (#335). A throwing `res.write`