@securecoms/agent-bridge 0.19.0 → 0.21.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 +40 -1
- package/connectors/hermes/adapter.py +5 -1
- package/connectors/hermes/tests/test_adapter_wiring.py +6 -1
- package/connectors/openclaw/openclaw-entry.js +8 -4
- package/connectors/openclaw/openclaw-entry.smoke.test.ts +23 -1
- package/dist/bin.js +506 -35
- package/dist/bridge-agent.d.ts +65 -0
- package/dist/index.js +501 -30
- package/dist/reply-receipts.d.ts +30 -0
- package/dist/service/runtime-config-dir.d.ts +35 -0
- package/dist/version.d.ts +1 -0
- package/dist/ws-server.d.ts +4 -2
- package/package.json +2 -2
package/dist/bridge-agent.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { MlsGroupKeyProvider } from "@agentvault/connect-sdk-ts";
|
|
2
|
+
import type { MemoryContextResult } from "@agentvault/connect-mls-store";
|
|
2
3
|
/**
|
|
3
4
|
* M6 (ADR-0013 Decision H): what the sweep observed about one channel.
|
|
4
5
|
*
|
|
@@ -35,12 +36,45 @@ import { type ChatMessage } from "./voice/fast-prompt.js";
|
|
|
35
36
|
import { VOICE_CALL_START_MARKER } from "./voice/prompt-compiler.js";
|
|
36
37
|
import { type VaultListNode } from "./vault.js";
|
|
37
38
|
import type { AgentActionNodeType, AgentActionNodeStatus, AgentActionNodeDetail } from "@agentvault/connect-core";
|
|
39
|
+
import { type RuntimeReplyReceipt } from "./reply-receipts.js";
|
|
40
|
+
export type AgentAudience = "owner_dm" | "team_room" | "partner_room" | "other_human_dm" | "agent_to_agent" | "unknown";
|
|
41
|
+
export type BridgeToolGrant = {
|
|
42
|
+
readonly tool: string;
|
|
43
|
+
readonly mode: "read";
|
|
44
|
+
} | {
|
|
45
|
+
readonly tool: string;
|
|
46
|
+
readonly mode: "side_effect";
|
|
47
|
+
readonly operation_sha256: string;
|
|
48
|
+
readonly confirmation_id: string;
|
|
49
|
+
readonly idempotency_key: string;
|
|
50
|
+
readonly expires_at: string;
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Immutable authorization context derived from authenticated backend roster
|
|
54
|
+
* data. The E2E plaintext never contributes to these claims. Tool grants are
|
|
55
|
+
* intentionally empty until the channel-grant persistence/API lands; this
|
|
56
|
+
* makes the new contract fail closed during staged deployment.
|
|
57
|
+
*/
|
|
58
|
+
export interface BridgeAuthorization {
|
|
59
|
+
readonly version: 1;
|
|
60
|
+
readonly audience: AgentAudience;
|
|
61
|
+
readonly sender_membership: "active" | "unknown";
|
|
62
|
+
readonly tool_grants: readonly BridgeToolGrant[];
|
|
63
|
+
}
|
|
38
64
|
export interface BridgeMessage {
|
|
39
65
|
channel_id: string;
|
|
40
66
|
message_id: string;
|
|
41
67
|
sender_id: string;
|
|
42
68
|
text: string;
|
|
43
69
|
ts: number;
|
|
70
|
+
authorization: BridgeAuthorization;
|
|
71
|
+
/**
|
|
72
|
+
* Protected, channel-scoped memory captured before this inbound turn is
|
|
73
|
+
* recorded. The runtime can therefore prepend prior context without owning
|
|
74
|
+
* a second plaintext persistence path or duplicating the current message.
|
|
75
|
+
* Missing only for non-text/legacy buffered entries.
|
|
76
|
+
*/
|
|
77
|
+
memory?: MemoryContextResult;
|
|
44
78
|
/**
|
|
45
79
|
* Phase 2 (sender attribution): the sender's display name, resolved from the
|
|
46
80
|
* channel roster cache. Undefined when the roster hasn't resolved the
|
|
@@ -383,6 +417,12 @@ export declare class BridgeAgent {
|
|
|
383
417
|
private readonly channelOwner;
|
|
384
418
|
private readonly buffer;
|
|
385
419
|
private readonly maxBuffer;
|
|
420
|
+
/**
|
|
421
|
+
* Short-lived, content-free runtime reply correlations. The attached runtime
|
|
422
|
+
* supplies the inbound message id only when an outbound send is its reply;
|
|
423
|
+
* ws-server/http-server record the receipt after send() publishes.
|
|
424
|
+
*/
|
|
425
|
+
private readonly runtimeReplyReceipts;
|
|
386
426
|
/** Cumulative count of messages shed by the buffer cap (surfaced on health()/metrics()). */
|
|
387
427
|
private droppedMessages;
|
|
388
428
|
/**
|
|
@@ -601,6 +641,7 @@ export declare class BridgeAgent {
|
|
|
601
641
|
private readonly waiters;
|
|
602
642
|
private pingHandle?;
|
|
603
643
|
private safetyTimer?;
|
|
644
|
+
private runtimeConfigTimer?;
|
|
604
645
|
private readonly listeners;
|
|
605
646
|
private startedAt;
|
|
606
647
|
private readonly store;
|
|
@@ -937,6 +978,21 @@ export declare class BridgeAgent {
|
|
|
937
978
|
seq: number;
|
|
938
979
|
deduped: boolean;
|
|
939
980
|
}>;
|
|
981
|
+
/**
|
|
982
|
+
* OpenClaw collapses text history and workspace facts into the owner's
|
|
983
|
+
* session. Resolve the channel from fresh, authenticated server metadata
|
|
984
|
+
* before exposing that provider through the local bridge API. A cold or
|
|
985
|
+
* stale cache is refreshed once; any failure remains a fail-closed denial.
|
|
986
|
+
*/
|
|
987
|
+
private mayReadOpenClawMemory;
|
|
988
|
+
/** An inbound turn may receive OpenClaw memory only from an active owner DM. */
|
|
989
|
+
private mayReadOpenClawMemoryForTurn;
|
|
990
|
+
/**
|
|
991
|
+
* Resolve the prior-turn snapshot carried to the native runtime. OpenClaw
|
|
992
|
+
* stays owner-DM-only; every provider failure degrades to empty context and
|
|
993
|
+
* never falls back to the runtime's retired plaintext JSON files.
|
|
994
|
+
*/
|
|
995
|
+
private memoryForTurn;
|
|
940
996
|
memoryContext(conversationId: string, limit?: number): Promise<import("@agentvault/connect-mls-store").MemoryContextResult>;
|
|
941
997
|
/**
|
|
942
998
|
* Task 4 (self-hosted fast voice): instant persona-voiced acknowledgement
|
|
@@ -1118,6 +1174,13 @@ export declare class BridgeAgent {
|
|
|
1118
1174
|
* attribution must NEVER block or drop a message.
|
|
1119
1175
|
*/
|
|
1120
1176
|
private refreshChannelRoster;
|
|
1177
|
+
/**
|
|
1178
|
+
* Classify the sender only from server-authenticated channel/roster data.
|
|
1179
|
+
* Missing or stale metadata is UNKNOWN with zero grants, never a permissive
|
|
1180
|
+
* guess. The returned object and grant array are frozen before they cross the
|
|
1181
|
+
* daemon boundary so one consumer cannot widen a later execution check.
|
|
1182
|
+
*/
|
|
1183
|
+
private authorizationFor;
|
|
1121
1184
|
/**
|
|
1122
1185
|
* Task 8 (owner-attested Reset Secure Session): STRUCTURAL owner selection —
|
|
1123
1186
|
* NEVER read the server's `role` field to pick the owner. In a DM the owner
|
|
@@ -1211,6 +1274,8 @@ export declare class BridgeAgent {
|
|
|
1211
1274
|
subscribe(listener: () => void): () => void;
|
|
1212
1275
|
/** Synchronous splice of buffered messages (all, or one channel). Shared by drain + SSE. */
|
|
1213
1276
|
takeBuffered(channelId?: string): BridgeMessage[];
|
|
1277
|
+
recordRuntimeReply(inReplyTo: string, channelId: string, replyMessageId: string): RuntimeReplyReceipt;
|
|
1278
|
+
runtimeReplyReceipt(inReplyTo: string): RuntimeReplyReceipt | null;
|
|
1214
1279
|
/**
|
|
1215
1280
|
* Put messages back at the front (SSE/disconnect write-failure recovery).
|
|
1216
1281
|
*
|