@agentvault/agentvault 0.19.57 → 0.19.59
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/_cp.d.ts +10 -0
- package/dist/_cp.d.ts.map +1 -0
- package/dist/account-config.d.ts +20 -0
- package/dist/account-config.d.ts.map +1 -0
- package/dist/channel.d.ts +389 -0
- package/dist/channel.d.ts.map +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +47 -416
- package/dist/cli.js.map +2 -2
- package/dist/create-agent.d.ts +28 -0
- package/dist/create-agent.d.ts.map +1 -0
- package/dist/credential-store.d.ts +62 -0
- package/dist/credential-store.d.ts.map +1 -0
- package/dist/crypto-helpers.d.ts +2 -0
- package/dist/crypto-helpers.d.ts.map +1 -0
- package/dist/doctor.d.ts +41 -0
- package/dist/doctor.d.ts.map +1 -0
- package/dist/fetch-interceptor.d.ts +32 -0
- package/dist/fetch-interceptor.d.ts.map +1 -0
- package/dist/gateway-send.d.ts +98 -0
- package/dist/gateway-send.d.ts.map +1 -0
- package/dist/http-handlers.d.ts +53 -0
- package/dist/http-handlers.d.ts.map +1 -0
- package/dist/index.d.ts +27 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +47 -416
- package/dist/index.js.map +2 -2
- package/dist/mcp-handlers.d.ts +26 -0
- package/dist/mcp-handlers.d.ts.map +1 -0
- package/dist/mcp-proxy-helpers.d.ts +9 -0
- package/dist/mcp-proxy-helpers.d.ts.map +1 -0
- package/dist/mcp-server.d.ts +91 -0
- package/dist/mcp-server.d.ts.map +1 -0
- package/dist/mls-state.d.ts +16 -0
- package/dist/mls-state.d.ts.map +1 -0
- package/dist/openclaw-compat.d.ts +33 -0
- package/dist/openclaw-compat.d.ts.map +1 -0
- package/dist/openclaw-entry.d.ts +32 -0
- package/dist/openclaw-entry.d.ts.map +1 -0
- package/dist/openclaw-plugin.d.ts +102 -0
- package/dist/openclaw-plugin.d.ts.map +1 -0
- package/dist/openclaw-types.d.ts +186 -0
- package/dist/openclaw-types.d.ts.map +1 -0
- package/dist/policy-enforcer.d.ts +78 -0
- package/dist/policy-enforcer.d.ts.map +1 -0
- package/dist/setup.d.ts +27 -0
- package/dist/setup.d.ts.map +1 -0
- package/dist/skill-invoker.d.ts +30 -0
- package/dist/skill-invoker.d.ts.map +1 -0
- package/dist/skill-manifest.d.ts +30 -0
- package/dist/skill-manifest.d.ts.map +1 -0
- package/dist/skill-telemetry.d.ts +36 -0
- package/dist/skill-telemetry.d.ts.map +1 -0
- package/dist/skills-publish.d.ts +8 -0
- package/dist/skills-publish.d.ts.map +1 -0
- package/dist/state.d.ts +32 -0
- package/dist/state.d.ts.map +1 -0
- package/dist/transport.d.ts +24 -0
- package/dist/transport.d.ts.map +1 -0
- package/dist/types.d.ts +421 -0
- package/dist/types.d.ts.map +1 -0
- package/dist/workspace-handlers.d.ts +62 -0
- package/dist/workspace-handlers.d.ts.map +1 -0
- package/openclaw.plugin.json +1 -1
- package/package.json +1 -1
package/dist/_cp.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Lazy shell wrapper for CLI-only commands (setup, doctor, create).
|
|
3
|
+
*
|
|
4
|
+
* Loads the underlying module lazily at first call so the OpenClaw
|
|
5
|
+
* plugin entry point never references it. Type declarations use
|
|
6
|
+
* generic signatures to keep the .d.ts clean for the scanner too.
|
|
7
|
+
*/
|
|
8
|
+
export declare function execSync(command: string, options?: any): any;
|
|
9
|
+
export declare function spawnSync(command: string, args?: string[], options?: any): any;
|
|
10
|
+
//# sourceMappingURL=_cp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"_cp.d.ts","sourceRoot":"","sources":["../src/_cp.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAYH,wBAAgB,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,GAAG,CAE5D;AAED,wBAAgB,SAAS,CAAC,OAAO,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE,MAAM,EAAE,EAAE,OAAO,CAAC,EAAE,GAAG,GAAG,GAAG,CAE9E"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Shared multi-account config resolution for AgentVault OpenClaw plugin.
|
|
3
|
+
*
|
|
4
|
+
* Supports two config shapes:
|
|
5
|
+
* 1. Legacy single-agent: channels.agentvault.dataDir (returns ["default"])
|
|
6
|
+
* 2. Multi-agent: channels.agentvault.accounts.{id}.dataDir (returns account keys)
|
|
7
|
+
*
|
|
8
|
+
* When `accounts` key is present, it takes precedence over top-level dataDir.
|
|
9
|
+
*/
|
|
10
|
+
export interface ResolvedAccount {
|
|
11
|
+
accountId: string;
|
|
12
|
+
dataDir: string;
|
|
13
|
+
apiUrl: string;
|
|
14
|
+
agentName: string;
|
|
15
|
+
httpPort: number;
|
|
16
|
+
configured: boolean;
|
|
17
|
+
}
|
|
18
|
+
export declare function listAccountIds(cfg: any): string[];
|
|
19
|
+
export declare function resolveAccount(cfg: any, accountId?: string): ResolvedAccount;
|
|
20
|
+
//# sourceMappingURL=account-config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"account-config.d.ts","sourceRoot":"","sources":["../src/account-config.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAKH,MAAM,WAAW,eAAe;IAC9B,SAAS,EAAE,MAAM,CAAC;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,MAAM,CAAC;IACf,SAAS,EAAE,MAAM,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,OAAO,CAAC;CACrB;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,GAAG,MAAM,EAAE,CAOjD;AAED,wBAAgB,cAAc,CAAC,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,eAAe,CA0C5E"}
|
|
@@ -0,0 +1,389 @@
|
|
|
1
|
+
import { EventEmitter } from "node:events";
|
|
2
|
+
import { TelemetryReporter } from "@agentvault/crypto";
|
|
3
|
+
import type { SecureChannelConfig, ChannelState, HistoryEntry, SendOptions, DecisionRequest, DecisionResponse, HeartbeatStatus, StatusAlert, RoomMemberInfo, RoomConversationInfo, RoomInfo, A2AChannel, DeliveryTarget, DeliveryContent, DeliveryOptions, DeliveryReceipt, TargetInfo } from "./types.js";
|
|
4
|
+
export declare class SecureChannel extends EventEmitter {
|
|
5
|
+
private config;
|
|
6
|
+
private _state;
|
|
7
|
+
private _deviceId;
|
|
8
|
+
private _fingerprint;
|
|
9
|
+
private _primaryConversationId;
|
|
10
|
+
private _deviceJwt;
|
|
11
|
+
private _sessions;
|
|
12
|
+
private _ws;
|
|
13
|
+
private _pollTimer;
|
|
14
|
+
private _reconnectAttempt;
|
|
15
|
+
private _reconnectTimer;
|
|
16
|
+
private _rapidDisconnects;
|
|
17
|
+
private _lastWsOpenTime;
|
|
18
|
+
private _pingTimer;
|
|
19
|
+
private _lastServerMessage;
|
|
20
|
+
private _pendingAcks;
|
|
21
|
+
private _ackTimer;
|
|
22
|
+
private _stopped;
|
|
23
|
+
private _persisted;
|
|
24
|
+
private _httpServer;
|
|
25
|
+
private _mcpServer;
|
|
26
|
+
private _pollFallbackTimer;
|
|
27
|
+
private _heartbeatTimer;
|
|
28
|
+
private _heartbeatCallback;
|
|
29
|
+
private _heartbeatIntervalSeconds;
|
|
30
|
+
private _wakeDetectorTimer;
|
|
31
|
+
private _lastWakeTick;
|
|
32
|
+
private _trustToken;
|
|
33
|
+
private _trustTier;
|
|
34
|
+
private _trustTokenExpiresAt;
|
|
35
|
+
private _trustTokenInterval;
|
|
36
|
+
private _pendingPollTimer;
|
|
37
|
+
private _syncMessageIds;
|
|
38
|
+
private _deliveryHeartbeat;
|
|
39
|
+
private _deliveryPulling;
|
|
40
|
+
/** MLS group managers per room/conversation (roomId or conv:conversationId -> MLSGroupManager) */
|
|
41
|
+
private _mlsGroups;
|
|
42
|
+
/** Cached MLS KeyPackage bundle for this device (regenerated on each connect). */
|
|
43
|
+
private _mlsKeyPackage;
|
|
44
|
+
/** In-memory credential store for renter-provided credentials (never persisted). */
|
|
45
|
+
private _credentialStore;
|
|
46
|
+
/** Dedup buffer for A2A message IDs (prevents double-delivery via direct + Redis) */
|
|
47
|
+
private _a2aSeenMessageIds;
|
|
48
|
+
private static readonly A2A_SEEN_MAX;
|
|
49
|
+
/** Dedup buffer for regular message IDs (prevents double-decrypt via direct WS + Redis pub/sub) */
|
|
50
|
+
private _seenMessageIds;
|
|
51
|
+
private static readonly SEEN_MSG_MAX;
|
|
52
|
+
private _scanEngine;
|
|
53
|
+
private _scanRuleSetVersion;
|
|
54
|
+
private _telemetryReporter;
|
|
55
|
+
/** Topic ID from the most recent inbound message — used as fallback for replies. */
|
|
56
|
+
private _lastIncomingTopicId;
|
|
57
|
+
/** Room ID from the most recent inbound room message — used as fallback for HTTP /send replies. */
|
|
58
|
+
private _lastInboundRoomId;
|
|
59
|
+
/** Rate-limit: last resync_request timestamp per conversation (5-min cooldown). */
|
|
60
|
+
private _lastResyncRequest;
|
|
61
|
+
/** Debounce timer for server backup uploads (60s). */
|
|
62
|
+
private _serverBackupTimer;
|
|
63
|
+
private _serverBackupRunning;
|
|
64
|
+
private static readonly PING_INTERVAL_MS;
|
|
65
|
+
private static readonly SILENCE_TIMEOUT_MS;
|
|
66
|
+
private static readonly POLL_FALLBACK_INTERVAL_MS;
|
|
67
|
+
private static readonly POLL_FALLBACK_IDLE_MS;
|
|
68
|
+
constructor(config: SecureChannelConfig);
|
|
69
|
+
get state(): ChannelState;
|
|
70
|
+
get deviceId(): string | null;
|
|
71
|
+
get fingerprint(): string | null;
|
|
72
|
+
/** Returns the primary conversation ID (backward-compatible). */
|
|
73
|
+
get conversationId(): string | null;
|
|
74
|
+
/** Returns all active conversation IDs. */
|
|
75
|
+
get conversationIds(): string[];
|
|
76
|
+
/** Returns the number of active sessions. */
|
|
77
|
+
get sessionCount(): number;
|
|
78
|
+
/** Room ID from the most recent inbound room message (for HTTP /send fallback). */
|
|
79
|
+
get lastInboundRoomId(): string | undefined;
|
|
80
|
+
/** Returns all persisted room IDs and names (for outbound target registration). */
|
|
81
|
+
get roomIds(): Array<{
|
|
82
|
+
roomId: string;
|
|
83
|
+
name: string;
|
|
84
|
+
}>;
|
|
85
|
+
/** Returns hub addresses of all persisted A2A peer channels. */
|
|
86
|
+
get a2aPeerAddresses(): string[];
|
|
87
|
+
/** Resolves an A2A channel ID to the peer's hub address, or null if not found. */
|
|
88
|
+
resolveA2AChannelHub(channelId: string): string | null;
|
|
89
|
+
/** Returns the TelemetryReporter instance (available after WebSocket connect). */
|
|
90
|
+
get telemetry(): TelemetryReporter | null;
|
|
91
|
+
/**
|
|
92
|
+
* Check if a skill is in shadow mode. Returns the shadow config if active, undefined otherwise.
|
|
93
|
+
*/
|
|
94
|
+
getShadowConfig(skillName: string): {
|
|
95
|
+
sessionId: string;
|
|
96
|
+
autonomyLevel: string;
|
|
97
|
+
decisionClass: string;
|
|
98
|
+
} | undefined;
|
|
99
|
+
start(): Promise<void>;
|
|
100
|
+
/**
|
|
101
|
+
* Fetch scan rules from the server and load them into the ScanEngine.
|
|
102
|
+
*/
|
|
103
|
+
private _fetchScanRules;
|
|
104
|
+
/**
|
|
105
|
+
* Append a message to persistent history for cross-device replay.
|
|
106
|
+
*/
|
|
107
|
+
private _appendHistory;
|
|
108
|
+
/**
|
|
109
|
+
* Get recent message history for a specific room, for LLM context injection.
|
|
110
|
+
* Returns the last N messages tagged with `room:{roomId}`.
|
|
111
|
+
*/
|
|
112
|
+
getRoomHistory(roomId: string, maxMessages?: number): HistoryEntry[];
|
|
113
|
+
/**
|
|
114
|
+
* Encrypt and send a message to ALL owner devices (fanout).
|
|
115
|
+
* Each session gets the same plaintext encrypted independently.
|
|
116
|
+
*/
|
|
117
|
+
send(plaintext: string, options?: SendOptions): Promise<void>;
|
|
118
|
+
/**
|
|
119
|
+
* Send a typing indicator to all owner devices.
|
|
120
|
+
* Ephemeral (unencrypted metadata), no ratchet advancement.
|
|
121
|
+
*/
|
|
122
|
+
sendTyping(): void;
|
|
123
|
+
/**
|
|
124
|
+
* Send an activity span to all owner devices via WS.
|
|
125
|
+
* Ephemeral (unencrypted metadata, like typing), no ratchet advancement.
|
|
126
|
+
*/
|
|
127
|
+
sendActivitySpan(spanData: Record<string, unknown>): void;
|
|
128
|
+
/**
|
|
129
|
+
* Send a decision request to the owner.
|
|
130
|
+
* Builds a structured envelope with decision metadata and sends it
|
|
131
|
+
* as a high-priority message. Returns the generated decision_id.
|
|
132
|
+
*/
|
|
133
|
+
sendDecisionRequest(request: DecisionRequest): Promise<string>;
|
|
134
|
+
/**
|
|
135
|
+
* Wait for a decision response matching the given decisionId.
|
|
136
|
+
* Listens on the "message" event for messages where
|
|
137
|
+
* metadata.messageType === "decision_response" and the parsed plaintext
|
|
138
|
+
* contains a matching decision.decision_id.
|
|
139
|
+
* Optional timeout rejects with an Error.
|
|
140
|
+
*/
|
|
141
|
+
waitForDecision(decisionId: string, timeoutMs?: number): Promise<DecisionResponse>;
|
|
142
|
+
/**
|
|
143
|
+
* Join a room by collecting pairwise conversation IDs involving this device.
|
|
144
|
+
* Encryption is handled by MLS group operations, not per-member DR sessions.
|
|
145
|
+
*/
|
|
146
|
+
joinRoom(roomData: {
|
|
147
|
+
roomId: string;
|
|
148
|
+
name: string;
|
|
149
|
+
members: RoomMemberInfo[];
|
|
150
|
+
conversations: RoomConversationInfo[];
|
|
151
|
+
forceRekey?: boolean;
|
|
152
|
+
}): Promise<void>;
|
|
153
|
+
/**
|
|
154
|
+
* Send an encrypted message to all members of a room.
|
|
155
|
+
* Uses MLS (preferred) or pairwise fan-out as fallback.
|
|
156
|
+
*/
|
|
157
|
+
sendToRoom(roomId: string, plaintext: string, opts?: {
|
|
158
|
+
messageType?: string;
|
|
159
|
+
priority?: string;
|
|
160
|
+
metadata?: Record<string, unknown>;
|
|
161
|
+
}): Promise<void>;
|
|
162
|
+
/**
|
|
163
|
+
* Leave a room: remove sessions and persisted room state.
|
|
164
|
+
*/
|
|
165
|
+
leaveRoom(roomId: string): Promise<void>;
|
|
166
|
+
/**
|
|
167
|
+
* Return info for all joined rooms.
|
|
168
|
+
*/
|
|
169
|
+
getRooms(): RoomInfo[];
|
|
170
|
+
startHeartbeat(intervalSeconds: number, statusCallback: () => HeartbeatStatus): void;
|
|
171
|
+
stopHeartbeat(): Promise<void>;
|
|
172
|
+
sendStatusAlert(alert: StatusAlert): Promise<void>;
|
|
173
|
+
sendArtifact(artifact: {
|
|
174
|
+
filePath: string;
|
|
175
|
+
filename: string;
|
|
176
|
+
mimeType: string;
|
|
177
|
+
description?: string;
|
|
178
|
+
}): Promise<void>;
|
|
179
|
+
sendActionConfirmation(confirmation: {
|
|
180
|
+
action: string;
|
|
181
|
+
status: "completed" | "failed" | "partial";
|
|
182
|
+
decisionId?: string;
|
|
183
|
+
detail?: string;
|
|
184
|
+
}): Promise<void>;
|
|
185
|
+
sendActionConfirmationToRoom(roomId: string, confirmation: {
|
|
186
|
+
action: string;
|
|
187
|
+
status: "completed" | "failed" | "partial";
|
|
188
|
+
decisionId?: string;
|
|
189
|
+
detail?: string;
|
|
190
|
+
estimated_cost?: number;
|
|
191
|
+
}): Promise<void>;
|
|
192
|
+
/**
|
|
193
|
+
* Canonical message dispatcher. ALL outbound messages should flow through this method.
|
|
194
|
+
* Routes based on explicit target — never silently falls back to a room.
|
|
195
|
+
*/
|
|
196
|
+
deliver(target: DeliveryTarget, content: DeliveryContent, options?: DeliveryOptions): Promise<DeliveryReceipt>;
|
|
197
|
+
/**
|
|
198
|
+
* Returns all available delivery destinations with availability status.
|
|
199
|
+
*/
|
|
200
|
+
listTargets(): TargetInfo[];
|
|
201
|
+
private _sendHeartbeat;
|
|
202
|
+
getTrustHeaders(): Record<string, string>;
|
|
203
|
+
get trustToken(): string | null;
|
|
204
|
+
get trustTier(): string | null;
|
|
205
|
+
get trustTokenExpiresAt(): string | null;
|
|
206
|
+
refreshTrustToken(): Promise<void>;
|
|
207
|
+
startTrustTokenRefresh(): void;
|
|
208
|
+
stopTrustTokenRefresh(): void;
|
|
209
|
+
stop(): Promise<void>;
|
|
210
|
+
startHttpServer(port: number): void;
|
|
211
|
+
private _stopHttpServer;
|
|
212
|
+
/**
|
|
213
|
+
* Attach an MCP server instance to this channel.
|
|
214
|
+
* The MCP server will be served at /mcp on the local HTTP server.
|
|
215
|
+
*/
|
|
216
|
+
setMcpServer(mcpServer: import("./mcp-server.js").AgentVaultMcpServer): void;
|
|
217
|
+
/** The attached MCP server, if any. */
|
|
218
|
+
get mcpServer(): import("./mcp-server.js").AgentVaultMcpServer | null;
|
|
219
|
+
/**
|
|
220
|
+
* Create a new topic within the conversation group.
|
|
221
|
+
* Requires the channel to be initialized with a groupId (from activation).
|
|
222
|
+
*/
|
|
223
|
+
createTopic(name: string): Promise<{
|
|
224
|
+
id: string;
|
|
225
|
+
name: string;
|
|
226
|
+
isDefault: boolean;
|
|
227
|
+
}>;
|
|
228
|
+
/**
|
|
229
|
+
* List all topics in the conversation group.
|
|
230
|
+
* Requires the channel to be initialized with a groupId (from activation).
|
|
231
|
+
*/
|
|
232
|
+
listTopics(): Promise<Array<{
|
|
233
|
+
id: string;
|
|
234
|
+
name: string;
|
|
235
|
+
isDefault: boolean;
|
|
236
|
+
}>>;
|
|
237
|
+
/**
|
|
238
|
+
* Request a new A2A channel with another agent by their hub address.
|
|
239
|
+
* Returns the channel_id from the server response.
|
|
240
|
+
*/
|
|
241
|
+
requestA2AChannel(responderHubAddress: string): Promise<string>;
|
|
242
|
+
/**
|
|
243
|
+
* Send a message to another agent via an active A2A channel.
|
|
244
|
+
* Looks up the A2A conversation by hub address and sends via WS.
|
|
245
|
+
*
|
|
246
|
+
* If the channel has an established E2E session, the message is encrypted
|
|
247
|
+
* with the Double Ratchet. If the responder hasn't received the initiator's
|
|
248
|
+
* first message yet (ratchet not activated), the message is queued locally
|
|
249
|
+
* and flushed when the first inbound message arrives.
|
|
250
|
+
*
|
|
251
|
+
* Falls back to plaintext for channels without a session (legacy/pre-encryption).
|
|
252
|
+
*/
|
|
253
|
+
sendToAgent(hubAddress: string, text: string, opts?: {
|
|
254
|
+
parentSpanId?: string;
|
|
255
|
+
}): Promise<void>;
|
|
256
|
+
/**
|
|
257
|
+
* List all A2A channels for this agent.
|
|
258
|
+
* Fetches from the server and updates local persisted state.
|
|
259
|
+
*/
|
|
260
|
+
listA2AChannels(): Promise<A2AChannel[]>;
|
|
261
|
+
private _enroll;
|
|
262
|
+
private _poll;
|
|
263
|
+
private _activate;
|
|
264
|
+
private _connect;
|
|
265
|
+
/**
|
|
266
|
+
* Handle an incoming encrypted message from a specific conversation.
|
|
267
|
+
* Decrypts using the appropriate session ratchet, emits to the agent,
|
|
268
|
+
* and relays as sync messages to sibling sessions.
|
|
269
|
+
*/
|
|
270
|
+
/**
|
|
271
|
+
* Handle an incoming MLS-encrypted 1:1 message.
|
|
272
|
+
* Decrypts via the conversation's MLSGroupManager and emits the plaintext.
|
|
273
|
+
*/
|
|
274
|
+
private _handleMessageMLS;
|
|
275
|
+
private _handleIncomingMessage;
|
|
276
|
+
/**
|
|
277
|
+
* Download an encrypted attachment blob, decrypt it, verify integrity,
|
|
278
|
+
* and save the plaintext file to disk.
|
|
279
|
+
*/
|
|
280
|
+
private _downloadAndDecryptAttachment;
|
|
281
|
+
/**
|
|
282
|
+
* Upload an attachment file: encrypt, upload to server, return metadata
|
|
283
|
+
* for inclusion in the message envelope.
|
|
284
|
+
*/
|
|
285
|
+
private _uploadAttachment;
|
|
286
|
+
/**
|
|
287
|
+
* Send a message with an attached file. Encrypts the file, uploads it,
|
|
288
|
+
* then sends the envelope with attachment metadata via Double Ratchet.
|
|
289
|
+
*/
|
|
290
|
+
sendWithAttachment(plaintext: string, filePath: string, options?: {
|
|
291
|
+
topicId?: string;
|
|
292
|
+
}): Promise<void>;
|
|
293
|
+
/**
|
|
294
|
+
* Relay an owner's message to all sibling sessions as encrypted sync messages.
|
|
295
|
+
* This allows all owner devices to see messages from any single device.
|
|
296
|
+
*/
|
|
297
|
+
private _relaySyncToSiblings;
|
|
298
|
+
/**
|
|
299
|
+
* Resolve the agent's workspace directory.
|
|
300
|
+
* Looks for OpenClaw workspace config, falls back to default path.
|
|
301
|
+
*/
|
|
302
|
+
private _resolveWorkspaceDir;
|
|
303
|
+
/**
|
|
304
|
+
* Send a structured JSON reply to a specific conversation.
|
|
305
|
+
* Encrypts the payload via the conversation's ratchet and sends via WebSocket.
|
|
306
|
+
*/
|
|
307
|
+
private _sendStructuredReply;
|
|
308
|
+
/**
|
|
309
|
+
* Send stored message history to a newly-activated session.
|
|
310
|
+
* Batches all history into a single encrypted message.
|
|
311
|
+
*/
|
|
312
|
+
private _replayHistoryToSession;
|
|
313
|
+
/**
|
|
314
|
+
* Handle a device_linked event: a new owner device has joined.
|
|
315
|
+
* Fetches the new device's public keys, performs X3DH, and initializes
|
|
316
|
+
* a new ratchet session.
|
|
317
|
+
*/
|
|
318
|
+
private _handleDeviceLinked;
|
|
319
|
+
/**
|
|
320
|
+
* Handle a resync_request from the owner (owner-initiated ratchet re-establishment).
|
|
321
|
+
* Re-derives shared secret via X3DH as responder, initializes fresh receiver ratchet,
|
|
322
|
+
* and sends resync_ack back with agent's public keys.
|
|
323
|
+
*/
|
|
324
|
+
private _handleResyncRequest;
|
|
325
|
+
/**
|
|
326
|
+
* Handle credential protocol messages (grant, revoke, request).
|
|
327
|
+
* These are intercepted before reaching the agent's onMessage callback.
|
|
328
|
+
*/
|
|
329
|
+
private _handleCredentialMessage;
|
|
330
|
+
/**
|
|
331
|
+
* Send a credential_ack back to a room.
|
|
332
|
+
*/
|
|
333
|
+
private _sendCredentialAck;
|
|
334
|
+
/** Get a specific renter credential for a room. */
|
|
335
|
+
getCredential(roomId: string, key: string): import("./credential-store.js").RenterCredential | undefined;
|
|
336
|
+
/** Get all renter credentials for a room (includes values — for agent context). */
|
|
337
|
+
getCredentials(roomId: string): import("./credential-store.js").RenterCredential[];
|
|
338
|
+
/** Get credential key→value map for a room (for context injection). */
|
|
339
|
+
getCredentialMap(roomId: string): Record<string, string>;
|
|
340
|
+
/** Check if a specific credential exists for a room. */
|
|
341
|
+
hasCredential(roomId: string, key: string): boolean;
|
|
342
|
+
/** Purge all credentials for a room (call on rental end). */
|
|
343
|
+
purgeRoomCredentials(roomId: string): void;
|
|
344
|
+
private _handleRoomMessageMLS;
|
|
345
|
+
private _handleMlsCommit;
|
|
346
|
+
private _handleMlsWelcome;
|
|
347
|
+
/**
|
|
348
|
+
* Pull pending MLS messages from the delivery queue and process them.
|
|
349
|
+
* Called on WS connect, on mls_delivery ping, and every 30s heartbeat.
|
|
350
|
+
*/
|
|
351
|
+
private _pullDeliveryQueue;
|
|
352
|
+
private _handleMlsSyncResponse;
|
|
353
|
+
/**
|
|
354
|
+
* Handle an incoming MLS-encrypted A2A message.
|
|
355
|
+
* The observer (owner device) decrypts as a regular MLS group member.
|
|
356
|
+
*/
|
|
357
|
+
private _handleA2AMessageMLS;
|
|
358
|
+
/**
|
|
359
|
+
* Paginated sync: fetch missed messages in pages of 200, up to 5 pages (1000 messages).
|
|
360
|
+
* Tracks message IDs in _syncMessageIds to prevent duplicate processing from concurrent WS messages.
|
|
361
|
+
*/
|
|
362
|
+
private _syncMissedMessages;
|
|
363
|
+
private _sendAck;
|
|
364
|
+
private _flushAcks;
|
|
365
|
+
private _flushOutboundQueue;
|
|
366
|
+
private _startPing;
|
|
367
|
+
private _stopPing;
|
|
368
|
+
private _startWakeDetector;
|
|
369
|
+
private _stopWakeDetector;
|
|
370
|
+
private _startPendingPoll;
|
|
371
|
+
private _stopPendingPoll;
|
|
372
|
+
private _checkPendingMessages;
|
|
373
|
+
private _scheduleReconnect;
|
|
374
|
+
private _setState;
|
|
375
|
+
private _startPollFallback;
|
|
376
|
+
private _stopPollFallback;
|
|
377
|
+
private _handleError;
|
|
378
|
+
/**
|
|
379
|
+
* Persist all ratchet session states to disk.
|
|
380
|
+
* Syncs live ratchet states back into the persisted sessions map.
|
|
381
|
+
*/
|
|
382
|
+
private _persistState;
|
|
383
|
+
/**
|
|
384
|
+
* Debounced server backup upload (60s after last state change).
|
|
385
|
+
* Only runs when backupCode is configured.
|
|
386
|
+
*/
|
|
387
|
+
private _scheduleServerBackup;
|
|
388
|
+
}
|
|
389
|
+
//# sourceMappingURL=channel.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"channel.d.ts","sourceRoot":"","sources":["../src/channel.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,aAAa,CAAC;AAU3C,OAAO,EAWL,iBAAiB,EAElB,MAAM,oBAAoB,CAAC;AAI5B,OAAO,KAAK,EACV,mBAAmB,EACnB,YAAY,EAKZ,YAAY,EACZ,WAAW,EACX,eAAe,EACf,gBAAgB,EAChB,eAAe,EACf,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,QAAQ,EAER,UAAU,EAEV,cAAc,EACd,eAAe,EACf,eAAe,EACf,eAAe,EACf,UAAU,EAGX,MAAM,YAAY,CAAC;AAgEpB,qBAAa,aAAc,SAAQ,YAAY;IA8EjC,OAAO,CAAC,MAAM;IA7E1B,OAAO,CAAC,MAAM,CAAwB;IACtC,OAAO,CAAC,SAAS,CAAuB;IACxC,OAAO,CAAC,YAAY,CAAuB;IAC3C,OAAO,CAAC,sBAAsB,CAAc;IAC5C,OAAO,CAAC,UAAU,CAAuB;IACzC,OAAO,CAAC,SAAS,CAGH;IACd,OAAO,CAAC,GAAG,CAA0B;IACrC,OAAO,CAAC,UAAU,CAA8C;IAChE,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,eAAe,CAA8C;IACrE,OAAO,CAAC,iBAAiB,CAAK;IAC9B,OAAO,CAAC,eAAe,CAAK;IAC5B,OAAO,CAAC,UAAU,CAA+C;IACjE,OA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