@securecoms/agent-bridge 0.30.3 → 0.31.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 +16 -0
- package/dist/bin.js +323 -44
- package/dist/bridge-agent.d.ts +89 -15
- package/dist/index.js +323 -44
- package/dist/version.d.ts +1 -1
- package/dist/voice/call-buffer.d.ts +118 -0
- package/dist/voice/persona.d.ts +9 -0
- package/dist/voice/voice-scope.d.ts +31 -0
- package/package.json +1 -1
package/dist/bridge-agent.d.ts
CHANGED
|
@@ -41,6 +41,7 @@ import { type UnifiedFrameItem } from "./memory/unified/read-book.js";
|
|
|
41
41
|
import { type MemoryNoteResultFrame } from "./memory/note-frames.js";
|
|
42
42
|
import { type ChatMessage } from "./voice/fast-prompt.js";
|
|
43
43
|
import { VOICE_CALL_START_MARKER } from "./voice/prompt-compiler.js";
|
|
44
|
+
import { type CallBufferTurn } from "./voice/call-buffer.js";
|
|
44
45
|
import { type VaultListNode, type VaultReadExpectations } from "./vault.js";
|
|
45
46
|
import type { AgentActionNodeType, AgentActionNodeStatus, AgentActionNodeDetail } from "@agentvault/connect-core";
|
|
46
47
|
import { removeManagedLlmSource, writeManagedFiles, writeManifestPolicy } from "./service/runtime-config-dir.js";
|
|
@@ -69,10 +70,12 @@ export type BridgeToolGrant =
|
|
|
69
70
|
* the envelope's authenticated sender is the channel's server-marked relay.
|
|
70
71
|
*
|
|
71
72
|
* Tool grants (architect ruling, 2026-10-02): until channel-grant persistence
|
|
72
|
-
* lands, the
|
|
73
|
-
* (`current_time` + `web_search`, read mode)
|
|
74
|
-
* that DM's pinned human counterpart AND server-marked `is_agent_owner
|
|
75
|
-
*
|
|
73
|
+
* lands, the owner DM's constant grant lists are OWNER_DM_DEFAULT_READ_GRANTS
|
|
74
|
+
* (`current_time` + `web_search`, read mode) on a typed turn whose sender is
|
|
75
|
+
* that DM's pinned human counterpart AND server-marked `is_agent_owner`, and
|
|
76
|
+
* RELAYED_VOICE_GRANTS (equal today, never manifest-eligible) on a relayed
|
|
77
|
+
* voice turn whose speaker is, or on any voice-scoped owner turn (P-5, G-1).
|
|
78
|
+
* The pin is per channel, so the
|
|
76
79
|
* owner distinction rests on the server's flag: see authorizationFor's LIMIT
|
|
77
80
|
* note. Every
|
|
78
81
|
* other audience, an unpinned or anomalous owner, and the kill switch
|
|
@@ -101,9 +104,17 @@ export declare const OWNER_DM_DEFAULT_READ_GRANTS: readonly BridgeToolGrant[];
|
|
|
101
104
|
*/
|
|
102
105
|
export declare const ROOM_DEFAULT_READ_GRANTS: readonly BridgeToolGrant[];
|
|
103
106
|
/**
|
|
104
|
-
*
|
|
105
|
-
*
|
|
106
|
-
*
|
|
107
|
+
* Voice fast-path privacy, P-5 (spec §9). The grants of a relayed owner voice turn (and, from Task 4, of every
|
|
108
|
+
* voice-scoped owner turn). A constant of its own, frozen and written out, so a later change to
|
|
109
|
+
* OWNER_DM_DEFAULT_READ_GRANTS cannot widen a spoken turn. It still passes through effectiveToolGrants in
|
|
110
|
+
* authorizationFor, so the owner's signed web_search off-switch holds. Equal to the owner-DM default today.
|
|
111
|
+
*/
|
|
112
|
+
export declare const RELAYED_VOICE_GRANTS: readonly BridgeToolGrant[];
|
|
113
|
+
/**
|
|
114
|
+
* Kill switch for OWNER_DM_DEFAULT_READ_GRANTS and RELAYED_VOICE_GRANTS (the
|
|
115
|
+
* relayed owner voice turn and every voice-scoped owner turn), read once at
|
|
116
|
+
* BridgeAgent construction (daemon startup). Unset or exactly `on` keeps the
|
|
117
|
+
* grants; any other value (`off`, `0`, `false`, empty) sends `[]` on every turn.
|
|
107
118
|
*/
|
|
108
119
|
/** Audit L-2: the owner replay prune runs at most once per this interval. */
|
|
109
120
|
export declare const OWNER_REPLAY_PRUNE_INTERVAL_MS: number;
|
|
@@ -143,7 +154,8 @@ export interface BridgeAuthorization {
|
|
|
143
154
|
* owner-DM kill switch is on. Present only when true. An OFFER HINT: the
|
|
144
155
|
* bridge's W1 to W8 are the gate. Never set on the ownerRelayed branch
|
|
145
156
|
* (OQ-C, Eric approved 2026-10-06): voice turns read notes, never write,
|
|
146
|
-
* and never on any turn with a relay speaker claim (review I-1)
|
|
157
|
+
* and never on any turn with a relay speaker claim (review I-1), nor on a
|
|
158
|
+
* voice-scoped owner-direct turn (G-1, voice fast-path privacy spec §1).
|
|
147
159
|
* NOT a tool grant: it is not, and must never be, in `tool_grants`.
|
|
148
160
|
* Reaches only the per-tool runtime consumer: withConsumerGrants strips it
|
|
149
161
|
* for a harness socket and the HTTP/SSE paths (review m-3).
|
|
@@ -278,6 +290,12 @@ export interface BridgeMessage {
|
|
|
278
290
|
identityId: string;
|
|
279
291
|
displayName: string;
|
|
280
292
|
};
|
|
293
|
+
/**
|
|
294
|
+
* Voice fast-path privacy, Task 4 (spec §1): set when the ingest loop found the turn VOICE-SCOPED (isVoiceScopedTurn:
|
|
295
|
+
* VS-1 relay speaker, VS-2 `transcribed`, VS-3 relay sender, VS-4 call-start marker). Absent on every other turn,
|
|
296
|
+
* including a typed message sent during a live call. A narrowing mark only: it never widens anything.
|
|
297
|
+
*/
|
|
298
|
+
voice_scoped?: true;
|
|
281
299
|
}
|
|
282
300
|
/**
|
|
283
301
|
* Task 4 (voice-mode carrier): the one-sentence reply guidance compiled in
|
|
@@ -660,6 +678,22 @@ export interface SendOptions {
|
|
|
660
678
|
inReplyTo?: string;
|
|
661
679
|
/** SEC-06 #18: caller idempotency key (WS path); names the reply part. */
|
|
662
680
|
idempotencyKey?: string;
|
|
681
|
+
/**
|
|
682
|
+
* Voice fast-path privacy, Task 4b (spec §2.1 agent appends, §2.2 A-3): set ONLY by the ws send handler, computed at
|
|
683
|
+
* frame arrival, for a per-tool SecureComs runtime socket with no harness claim whose `in_reply_to` was in flight on
|
|
684
|
+
* THAT socket (same delivery), for the same channel, and not retired. Only such a reply to a voice-scoped turn may
|
|
685
|
+
* enter the call buffer. `POST /v1/send`, SSE and harness replies never set it.
|
|
686
|
+
*/
|
|
687
|
+
callBufferReply?: true;
|
|
688
|
+
}
|
|
689
|
+
/**
|
|
690
|
+
* Task 4b (spec §2.2 A-6): a voice-scoped turn's history, read ONCE at ingest, the buffer seq it ends at and the
|
|
691
|
+
* buffer's reset generation then (final fix M-4: agent lines of a later call never join it).
|
|
692
|
+
*/
|
|
693
|
+
export interface VoiceSnapshot {
|
|
694
|
+
recent: CallBufferTurn[];
|
|
695
|
+
endSeq: number;
|
|
696
|
+
generation: number;
|
|
663
697
|
}
|
|
664
698
|
/**
|
|
665
699
|
* B7 (FileSafe vault): a file-backed {@link OwnerAuthorityStore} for the
|
|
@@ -1390,6 +1424,11 @@ export declare class BridgeAgent {
|
|
|
1390
1424
|
private startedAt;
|
|
1391
1425
|
private readonly store;
|
|
1392
1426
|
private readonly memory;
|
|
1427
|
+
/**
|
|
1428
|
+
* Voice fast-path privacy, Task 4b (spec §2.1, OQ-1 ruled): the current calls' spoken turns, in process only. The
|
|
1429
|
+
* ONLY history a voice-scoped turn sees; read through voiceScopedHistory, once per turn, at ingest.
|
|
1430
|
+
*/
|
|
1431
|
+
private readonly callBuffer;
|
|
1393
1432
|
/**
|
|
1394
1433
|
* Markdown memory 7a: the one owner of every note mutation and of the
|
|
1395
1434
|
* delivery cache (spec §6.3, §7.2). One per store, so one per identity.
|
|
@@ -2219,6 +2258,18 @@ export declare class BridgeAgent {
|
|
|
2219
2258
|
* its own text, never the prior-turn history snapshot, for every provider.
|
|
2220
2259
|
*/
|
|
2221
2260
|
private mayReadHistoryForTurn;
|
|
2261
|
+
/**
|
|
2262
|
+
* Voice fast-path privacy (spec §2.1, OQ-1 ruled): the ONLY history source of a voice-scoped turn, the call buffer.
|
|
2263
|
+
* Never reads the memory provider, the store, the unified store or the 7b index. A-6: called once per turn, at ingest
|
|
2264
|
+
* (takeVoiceSnapshot), after the reset signals and before the turn's own append.
|
|
2265
|
+
*/
|
|
2266
|
+
private voiceScopedHistory;
|
|
2267
|
+
/**
|
|
2268
|
+
* Task 4b (A-6): the turn's snapshot, taken BEFORE its own text is appended (audit finding 2). Final fix I-1: a turn
|
|
2269
|
+
* already admitted to this call (a redelivered row) is snapshotted up to just before its own entry, as it was the
|
|
2270
|
+
* first time, so its snapshot never contains itself.
|
|
2271
|
+
*/
|
|
2272
|
+
private takeVoiceSnapshot;
|
|
2222
2273
|
/** An inbound turn may receive OpenClaw memory only from an active owner DM. */
|
|
2223
2274
|
private mayReadOpenClawMemoryForTurn;
|
|
2224
2275
|
/**
|
|
@@ -2227,6 +2278,12 @@ export declare class BridgeAgent {
|
|
|
2227
2278
|
* never falls back to the runtime's retired plaintext JSON files.
|
|
2228
2279
|
*/
|
|
2229
2280
|
private memoryForTurn;
|
|
2281
|
+
/**
|
|
2282
|
+
* Task 6 (spec §2.2 A-1, N1): call-buffer entries as runtime-frame turns. Under the voice fence (a pin is loaded) the
|
|
2283
|
+
* fast model's own lines (origin "fast_path") are dropped, as fenceMemory drops them from store history; the fast
|
|
2284
|
+
* prompt keeps them. The internal origin is not carried into the frame; `seq` stays 0 (A-5).
|
|
2285
|
+
*/
|
|
2286
|
+
private voiceFrameTurns;
|
|
2230
2287
|
/**
|
|
2231
2288
|
* Owner grants plan 4 Task 16 (T-30, audit r2 H-1): the voice fence is on whenever a pin is loaded, on EVERY runtime
|
|
2232
2289
|
* turn (manifest, fallback, greeting, relayed, constants-only alike). It never depends on a turn's grants.
|
|
@@ -2336,6 +2393,12 @@ export declare class BridgeAgent {
|
|
|
2336
2393
|
* but lack an epoch give no recall (fail closed). Never throws.
|
|
2337
2394
|
*/
|
|
2338
2395
|
private prepareRecallForTurn;
|
|
2396
|
+
/**
|
|
2397
|
+
* Voice fast-path privacy, Task 7 (spec §4): the frame-keyed delivery check. A voice-scoped frame gets no notes, no
|
|
2398
|
+
* recall and no unified items, whatever its authorization says. Keys on the frame's own marks, NEVER on the call
|
|
2399
|
+
* buffer's id set (a reset evicts ids; the staged frame must stay scoped).
|
|
2400
|
+
*/
|
|
2401
|
+
private frameIsVoiceScoped;
|
|
2339
2402
|
/** ws flush (synchronous). Q1 to Q3 and Q6 again at delivery, on the ORIGINAL message; Q4 lives in withConsumerRecall. */
|
|
2340
2403
|
recallForDelivery(m: BridgeMessage): readonly RecallItem[] | undefined;
|
|
2341
2404
|
/** ws-server: a runtime socket with no harness claim declared memory_recall. */
|
|
@@ -2590,7 +2653,13 @@ export declare class BridgeAgent {
|
|
|
2590
2653
|
private stageRuntimeMessageInOrder;
|
|
2591
2654
|
/** Test seam: resolves once every queued fast reply has settled. */
|
|
2592
2655
|
settleFastReplies(): Promise<void>;
|
|
2593
|
-
/**
|
|
2656
|
+
/**
|
|
2657
|
+
* Send a line the voice fast path speaks: its memory record is "voice" (H1).
|
|
2658
|
+
* Task 4b (spec §2.1 agent appends (1), A-1, A-2): once published, the line enters the call buffer as "fast_path",
|
|
2659
|
+
* unless the turn it answers failed owner verification (its id, or any fragment of a coalesced turn). A line answering
|
|
2660
|
+
* a turn the ingest did not find voice-scoped is not appended either (defense in depth: the fast path fires only on
|
|
2661
|
+
* voice-scoped turns, Task 5).
|
|
2662
|
+
*/
|
|
2594
2663
|
private sendSpoken;
|
|
2595
2664
|
/** Speak a fixed acknowledgement line; failures are counted, never thrown. */
|
|
2596
2665
|
private sendFastLine;
|
|
@@ -2599,8 +2668,8 @@ export declare class BridgeAgent {
|
|
|
2599
2668
|
* the fast model's reply — or, in `ack_only`, the greeting template — is
|
|
2600
2669
|
* spoken, and the outcome decides whether the runtime answers next.
|
|
2601
2670
|
*
|
|
2602
|
-
* MUST NEVER throw: every failure path (
|
|
2603
|
-
*
|
|
2671
|
+
* MUST NEVER throw: every failure path (the LLM call, normalization,
|
|
2672
|
+
* or the send itself) is caught, counted in
|
|
2604
2673
|
* `fastPathFailed`, and logged WITHOUT the turn text or the model's reply.
|
|
2605
2674
|
* The `fastReplyId(...)` send id is deterministic, so a duplicate that
|
|
2606
2675
|
* slipped past the in-memory dedupe (e.g. a restart) resolves to the same
|
|
@@ -2856,17 +2925,22 @@ export declare class BridgeAgent {
|
|
|
2856
2925
|
* guess. The returned object and grant array are frozen before they cross the
|
|
2857
2926
|
* daemon boundary so one consumer cannot widen a later execution check.
|
|
2858
2927
|
*
|
|
2859
|
-
* Grants (architect ruling 2026-10-02):
|
|
2860
|
-
* the kill switch is on, the channel is a DM, and EITHER
|
|
2928
|
+
* Grants (architect ruling 2026-10-02; P-5 and G-1, spec §9): an owner-DM
|
|
2929
|
+
* constant only when the kill switch is on, the channel is a DM, and EITHER
|
|
2861
2930
|
* (a) audience is owner_dm AND the sender is the channel's pinned DM
|
|
2862
2931
|
* counterpart (`channelOwner`, never "anomalous"). A server-marked
|
|
2863
2932
|
* `is_agent_owner` on a member who is NOT the DM's single human
|
|
2864
2933
|
* counterpart gets nothing; on the counterpart it is trusted (see
|
|
2865
|
-
* LIMIT below);
|
|
2934
|
+
* LIMIT below). OWNER_DM_DEFAULT_READ_GRANTS on a typed turn;
|
|
2935
|
+
* RELAYED_VOICE_GRANTS and no memory_write when `opts.voiceScoped`
|
|
2936
|
+
* (G-1: the ingest predicate isVoiceScopedTurn, spec §1); OR
|
|
2866
2937
|
* (b) the sender is this channel's server-marked relay (`is_relay`) and the
|
|
2867
2938
|
* relayed `speaker_identity_id` (passed by the caller only for relay
|
|
2868
2939
|
* turns) is that same pinned owner, whose roster row is the agent's
|
|
2869
|
-
* owner. A speaker claim from any non-relay
|
|
2940
|
+
* owner: RELAYED_VOICE_GRANTS. A speaker claim from any non-relay
|
|
2941
|
+
* sender gets nothing.
|
|
2942
|
+
* RELAYED_VOICE_GRANTS is never manifest-eligible: effectiveToolGrants gives
|
|
2943
|
+
* the constant by reference, or the fallback when a good manifest is held.
|
|
2870
2944
|
* Both need the roster fetched at `heldEpoch` (the agent's current MLS
|
|
2871
2945
|
* epoch for the channel), or the DM marked epoch-fresh at this ingest
|
|
2872
2946
|
* cycle's refresh (audit M-B4).
|