@hypercli.com/sdk 2026.6.26 → 2026.8.11
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 +181 -1
- package/dist/agent-slots.d.ts +17 -0
- package/dist/agent-slots.d.ts.map +1 -0
- package/dist/agent-slots.js +18 -0
- package/dist/agent-slots.js.map +1 -0
- package/dist/agent.d.ts +67 -12
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +220 -28
- package/dist/agent.js.map +1 -1
- package/dist/agents.d.ts +690 -82
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +2595 -225
- package/dist/agents.js.map +1 -1
- package/dist/browser.d.ts +4 -2
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +10 -3
- package/dist/browser.js.map +1 -1
- package/dist/channels.d.ts +156 -0
- package/dist/channels.d.ts.map +1 -0
- package/dist/channels.js +110 -0
- package/dist/channels.js.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +14 -4
- package/dist/client.js.map +1 -1
- package/dist/config.d.ts +1 -1
- package/dist/config.js +2 -2
- package/dist/config.js.map +1 -1
- package/dist/connectors.d.ts +79 -0
- package/dist/connectors.d.ts.map +1 -0
- package/dist/connectors.js +2 -0
- package/dist/connectors.js.map +1 -0
- package/dist/errors.d.ts +4 -1
- package/dist/errors.d.ts.map +1 -1
- package/dist/errors.js +9 -2
- package/dist/errors.js.map +1 -1
- package/dist/hermes/gateway.d.ts +194 -0
- package/dist/hermes/gateway.d.ts.map +1 -0
- package/dist/hermes/gateway.js +209 -0
- package/dist/hermes/gateway.js.map +1 -0
- package/dist/http.d.ts +16 -3
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +196 -63
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +15 -5
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +13 -4
- package/dist/index.js.map +1 -1
- package/dist/job/base.d.ts +6 -0
- package/dist/job/base.d.ts.map +1 -1
- package/dist/job/base.js +7 -1
- package/dist/job/base.js.map +1 -1
- package/dist/keys.d.ts +21 -5
- package/dist/keys.d.ts.map +1 -1
- package/dist/keys.js +62 -3
- package/dist/keys.js.map +1 -1
- package/dist/openclaw/channels.d.ts +86 -0
- package/dist/openclaw/channels.d.ts.map +1 -0
- package/dist/openclaw/channels.js +290 -0
- package/dist/openclaw/channels.js.map +1 -0
- package/dist/openclaw/connectors.d.ts +61 -0
- package/dist/openclaw/connectors.d.ts.map +1 -0
- package/dist/openclaw/connectors.js +174 -0
- package/dist/openclaw/connectors.js.map +1 -0
- package/dist/openclaw/gateway.d.ts +682 -16
- package/dist/openclaw/gateway.d.ts.map +1 -1
- package/dist/openclaw/gateway.js +1794 -187
- package/dist/openclaw/gateway.js.map +1 -1
- package/dist/openclaw/skills.d.ts +106 -0
- package/dist/openclaw/skills.d.ts.map +1 -0
- package/dist/openclaw/skills.js +575 -0
- package/dist/openclaw/skills.js.map +1 -0
- package/dist/openclaw/slack.d.ts +818 -0
- package/dist/openclaw/slack.d.ts.map +1 -0
- package/dist/openclaw/slack.js +536 -0
- package/dist/openclaw/slack.js.map +1 -0
- package/dist/openclaw/whatsapp.d.ts +63 -0
- package/dist/openclaw/whatsapp.d.ts.map +1 -0
- package/dist/openclaw/whatsapp.js +264 -0
- package/dist/openclaw/whatsapp.js.map +1 -0
- package/dist/renders.js +11 -11
- package/dist/renders.js.map +1 -1
- package/dist/skills.d.ts +126 -0
- package/dist/skills.d.ts.map +1 -0
- package/dist/skills.js +2 -0
- package/dist/skills.js.map +1 -0
- package/dist/user.d.ts +15 -2
- package/dist/user.d.ts.map +1 -1
- package/dist/user.js +51 -4
- package/dist/user.js.map +1 -1
- package/dist/voice-session.d.ts +74 -0
- package/dist/voice-session.d.ts.map +1 -0
- package/dist/voice-session.js +255 -0
- package/dist/voice-session.js.map +1 -0
- package/dist/voice.d.ts +27 -3
- package/dist/voice.d.ts.map +1 -1
- package/dist/voice.js +89 -6
- package/dist/voice.js.map +1 -1
- package/dist/workspaces.d.ts +181 -0
- package/dist/workspaces.d.ts.map +1 -0
- package/dist/workspaces.js +495 -0
- package/dist/workspaces.js.map +1 -0
- package/dist/x402.d.ts.map +1 -1
- package/dist/x402.js +1 -2
- package/dist/x402.js.map +1 -1
- package/package.json +42 -2
|
@@ -6,6 +6,23 @@
|
|
|
6
6
|
*
|
|
7
7
|
* Protocol: OpenClaw Gateway v3-v4
|
|
8
8
|
*/
|
|
9
|
+
import type { OpenClawSlackHttpConfiguration, OpenClawSlackRelayConfiguration, OpenClawSlackSocketConfiguration } from "./slack.js";
|
|
10
|
+
import type { OpenClawTelegramConfigPatch, OpenClawWhatsAppConfigPatch } from "./channels.js";
|
|
11
|
+
export declare const OPENCLAW_INTERNAL_MAIN_SESSION_KEY = "main";
|
|
12
|
+
export declare const OPENCLAW_SDK_SESSION_PREFIX = "hcli:";
|
|
13
|
+
export declare const OPENCLAW_DASHBOARD_SESSION_PREFIX = "dashboard:";
|
|
14
|
+
export declare function createOpenClawSessionKey(existingSessionKeys?: Array<string | null | undefined>, prefix?: string): string;
|
|
15
|
+
export declare function createOpenClawSdkSessionKey(existingSessionKeys?: Array<string | null | undefined>): string;
|
|
16
|
+
export declare function isOpenClawInternalMainSessionKey(sessionKey: string | null | undefined): boolean;
|
|
17
|
+
export declare function isOpenClawSdkSessionKey(sessionKey: string | null | undefined): boolean;
|
|
18
|
+
export type GatewayProtocolErrorCode = "INVALID_JSON" | "INVALID_FRAME" | "INVALID_EVENT" | "INVALID_RESPONSE" | "AMBIGUOUS_CHAT_STREAM_EVENT" | "DUPLICATE_SEQUENCE" | "OUT_OF_ORDER_SEQUENCE";
|
|
19
|
+
export interface GatewayProtocolErrorInfo {
|
|
20
|
+
code: GatewayProtocolErrorCode;
|
|
21
|
+
message: string;
|
|
22
|
+
frameType?: string;
|
|
23
|
+
event?: string;
|
|
24
|
+
requestId?: string;
|
|
25
|
+
}
|
|
9
26
|
export interface GatewayOptions {
|
|
10
27
|
/** WebSocket URL for the agent gateway (typically wss://{agent-host}) */
|
|
11
28
|
url: string;
|
|
@@ -13,6 +30,16 @@ export interface GatewayOptions {
|
|
|
13
30
|
token?: string;
|
|
14
31
|
/** Shared gateway auth token used in the WebSocket connect handshake. */
|
|
15
32
|
gatewayToken?: string;
|
|
33
|
+
/** Bootstrap auth token used by newer OpenClaw gateway handshakes. */
|
|
34
|
+
bootstrapToken?: string;
|
|
35
|
+
/** Explicit device auth token used by newer OpenClaw gateway handshakes. */
|
|
36
|
+
deviceToken?: string;
|
|
37
|
+
/** Password auth field used by compatible gateway deployments. */
|
|
38
|
+
password?: string;
|
|
39
|
+
/** Approval-runtime auth token used by compatible gateway deployments. */
|
|
40
|
+
approvalRuntimeToken?: string;
|
|
41
|
+
/** Agent-runtime identity token used by compatible gateway deployments. */
|
|
42
|
+
agentRuntimeIdentityToken?: string;
|
|
16
43
|
/** Deployment id used for trusted pairing approval via agent exec. */
|
|
17
44
|
deploymentId?: string;
|
|
18
45
|
/** HyperCLI API bearer token used for trusted pairing approval via agent exec. */
|
|
@@ -31,13 +58,29 @@ export interface GatewayOptions {
|
|
|
31
58
|
clientVersion?: string;
|
|
32
59
|
/** Client platform sent to the gateway */
|
|
33
60
|
platform?: string;
|
|
61
|
+
/** Optional device family sent to the gateway */
|
|
62
|
+
deviceFamily?: string;
|
|
34
63
|
/** Optional client instance ID */
|
|
35
64
|
instanceId?: string;
|
|
36
65
|
/** Optional gateway capability list */
|
|
37
66
|
caps?: string[];
|
|
67
|
+
/** Connection role in the connect handshake (default: "operator"). Use "node" to serve node commands. */
|
|
68
|
+
role?: string;
|
|
69
|
+
/** Auth scopes requested in the connect handshake (default: operator scopes for the operator role, else empty). */
|
|
70
|
+
scopes?: string[];
|
|
71
|
+
/** Declared node command surface advertised in the connect handshake (node role). */
|
|
72
|
+
commands?: string[];
|
|
73
|
+
/** Optional policy permissions advertised in the connect handshake. */
|
|
74
|
+
permissions?: Record<string, boolean>;
|
|
75
|
+
/** Optional PATH-like environment hint advertised in the connect handshake. */
|
|
76
|
+
pathEnv?: string;
|
|
77
|
+
/** Minimum gateway protocol version this client can speak. Defaults to v3 for live-agent compatibility. */
|
|
78
|
+
minProtocol?: number;
|
|
79
|
+
/** Maximum gateway protocol version this client can speak. */
|
|
80
|
+
maxProtocol?: number;
|
|
38
81
|
/** Origin header (default: omitted for non-browser SDK clients) */
|
|
39
82
|
origin?: string;
|
|
40
|
-
/** Default RPC timeout in ms (default:
|
|
83
|
+
/** Default RPC timeout in ms (default: 30000) */
|
|
41
84
|
timeout?: number;
|
|
42
85
|
/** Called after a successful hello-ok response */
|
|
43
86
|
onHello?: (hello: Record<string, any>) => void;
|
|
@@ -48,6 +91,8 @@ export interface GatewayOptions {
|
|
|
48
91
|
expected: number;
|
|
49
92
|
received: number;
|
|
50
93
|
}) => void;
|
|
94
|
+
/** Called when an inbound frame fails validation. Raw payloads are never included. */
|
|
95
|
+
onProtocolError?: (info: GatewayProtocolErrorInfo) => void;
|
|
51
96
|
/** Called when a browser device pairing request is pending or updated. */
|
|
52
97
|
onPairing?: (pairing: GatewayPairingState | null) => void;
|
|
53
98
|
}
|
|
@@ -60,8 +105,48 @@ export interface GatewayEvent {
|
|
|
60
105
|
export interface ChatEvent {
|
|
61
106
|
type: "content" | "thinking" | "tool_call" | "tool_result" | "done" | "error";
|
|
62
107
|
text?: string;
|
|
108
|
+
/** For content events, `true` replaces the turn's display text; `false` or omission appends. */
|
|
109
|
+
replace?: boolean;
|
|
110
|
+
/** Protocol event identity, when supplied by the gateway payload. */
|
|
111
|
+
eventId?: string;
|
|
112
|
+
/** Protocol message identity, when supplied by the gateway payload. */
|
|
113
|
+
messageId?: string;
|
|
114
|
+
/** Protocol turn identity, when supplied by the gateway payload. */
|
|
115
|
+
turnId?: string;
|
|
116
|
+
/** Protocol run identity, when supplied by the gateway payload. */
|
|
117
|
+
runId?: string;
|
|
118
|
+
/** Canonical session key reported by the gateway. */
|
|
119
|
+
sessionKey?: string;
|
|
120
|
+
/** Protocol payload revision, when supplied by the gateway. */
|
|
121
|
+
revision?: number | string;
|
|
63
122
|
data?: Record<string, any>;
|
|
64
123
|
}
|
|
124
|
+
export declare class GatewayChatStreamInterruptedError extends Error {
|
|
125
|
+
static readonly code: "GATEWAY_CHAT_STREAM_INTERRUPTED";
|
|
126
|
+
readonly code: "GATEWAY_CHAT_STREAM_INTERRUPTED";
|
|
127
|
+
readonly reason: "sequence-gap" | "ambiguous-event";
|
|
128
|
+
readonly expectedSequence?: number;
|
|
129
|
+
readonly receivedSequence?: number;
|
|
130
|
+
constructor(reason: "sequence-gap" | "ambiguous-event", sequence?: {
|
|
131
|
+
expected: number;
|
|
132
|
+
received: number;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
export interface GatewayAbortSignal {
|
|
136
|
+
readonly aborted: boolean;
|
|
137
|
+
addEventListener(type: "abort", listener: () => void, options?: {
|
|
138
|
+
once?: boolean;
|
|
139
|
+
}): void;
|
|
140
|
+
removeEventListener(type: "abort", listener: () => void): void;
|
|
141
|
+
}
|
|
142
|
+
export interface GatewayEphemeralChatOptions {
|
|
143
|
+
signal?: GatewayAbortSignal;
|
|
144
|
+
timeoutMs?: number;
|
|
145
|
+
maxResponseChars?: number;
|
|
146
|
+
/** Request the selected model's fastest supported service tier for this hidden session. */
|
|
147
|
+
fastMode?: boolean;
|
|
148
|
+
onEvent?: (event: ChatEvent) => void | Promise<void>;
|
|
149
|
+
}
|
|
65
150
|
export interface GatewayChatToolCall {
|
|
66
151
|
id?: string;
|
|
67
152
|
name: string;
|
|
@@ -75,6 +160,45 @@ export interface GatewayChatMessageSummary {
|
|
|
75
160
|
toolCalls: GatewayChatToolCall[];
|
|
76
161
|
mediaUrls: string[];
|
|
77
162
|
timestamp?: number;
|
|
163
|
+
/** Protocol message identity, when supplied by the raw history message. */
|
|
164
|
+
messageId?: string;
|
|
165
|
+
/** Protocol turn identity, when supplied by the raw history message. */
|
|
166
|
+
turnId?: string;
|
|
167
|
+
/** Protocol run identity, when supplied by the raw history message. */
|
|
168
|
+
runId?: string;
|
|
169
|
+
/** Canonical session key reported by the raw history message. */
|
|
170
|
+
sessionKey?: string;
|
|
171
|
+
/** Protocol message revision, when supplied by the raw history message. */
|
|
172
|
+
revision?: number | string;
|
|
173
|
+
}
|
|
174
|
+
export interface GatewayChatMessageGetOptions {
|
|
175
|
+
agentId?: string;
|
|
176
|
+
maxChars?: number;
|
|
177
|
+
}
|
|
178
|
+
export interface GatewayChatMessageGetResult {
|
|
179
|
+
ok: boolean;
|
|
180
|
+
message?: unknown;
|
|
181
|
+
unavailableReason?: "not_found" | "oversized" | "not_visible";
|
|
182
|
+
}
|
|
183
|
+
export interface GatewayChatHistorySessionInfo extends Record<string, unknown> {
|
|
184
|
+
key?: string;
|
|
185
|
+
sessionId?: string;
|
|
186
|
+
status?: string;
|
|
187
|
+
hasActiveRun?: boolean;
|
|
188
|
+
activeRunIds?: string[];
|
|
189
|
+
}
|
|
190
|
+
export interface GatewayChatInFlightRun extends Record<string, unknown> {
|
|
191
|
+
runId?: string;
|
|
192
|
+
text?: string;
|
|
193
|
+
events?: unknown[];
|
|
194
|
+
plan?: unknown;
|
|
195
|
+
}
|
|
196
|
+
export interface GatewayChatHistoryResult extends Record<string, unknown> {
|
|
197
|
+
messages: any[];
|
|
198
|
+
sessionKey?: string;
|
|
199
|
+
sessionId?: string;
|
|
200
|
+
sessionInfo?: GatewayChatHistorySessionInfo | null;
|
|
201
|
+
inFlightRun?: GatewayChatInFlightRun | null;
|
|
78
202
|
}
|
|
79
203
|
export interface GatewaySessionPatch {
|
|
80
204
|
key: string;
|
|
@@ -82,6 +206,29 @@ export interface GatewaySessionPatch {
|
|
|
82
206
|
thinkingLevel?: string;
|
|
83
207
|
[key: string]: unknown;
|
|
84
208
|
}
|
|
209
|
+
export interface GatewaySessionCreateParams {
|
|
210
|
+
key?: string;
|
|
211
|
+
agentId?: string;
|
|
212
|
+
label?: string;
|
|
213
|
+
model?: string;
|
|
214
|
+
parentSessionKey?: string;
|
|
215
|
+
fork?: boolean;
|
|
216
|
+
emitCommandHooks?: boolean;
|
|
217
|
+
task?: string;
|
|
218
|
+
message?: string;
|
|
219
|
+
worktree?: boolean;
|
|
220
|
+
}
|
|
221
|
+
export interface GatewaySessionCreateResult extends Record<string, unknown> {
|
|
222
|
+
ok: true;
|
|
223
|
+
key: string;
|
|
224
|
+
sessionId?: string;
|
|
225
|
+
entry?: Record<string, unknown>;
|
|
226
|
+
runStarted?: boolean;
|
|
227
|
+
}
|
|
228
|
+
export interface GatewaySessionsListResult extends Record<string, any> {
|
|
229
|
+
sessions: any[];
|
|
230
|
+
defaults?: Record<string, any>;
|
|
231
|
+
}
|
|
85
232
|
export interface GatewayChatAttachmentPayload {
|
|
86
233
|
type: string;
|
|
87
234
|
mimeType?: string;
|
|
@@ -96,6 +243,14 @@ export interface BrowserChatAttachment {
|
|
|
96
243
|
fileName?: string;
|
|
97
244
|
}
|
|
98
245
|
export type ChatAttachment = GatewayChatAttachmentPayload | BrowserChatAttachment;
|
|
246
|
+
export interface GatewayEphemeralChatSession {
|
|
247
|
+
readonly sessionKey: string;
|
|
248
|
+
readonly closed: boolean;
|
|
249
|
+
chatSend(message: string, attachments?: ChatAttachment[]): AsyncGenerator<ChatEvent>;
|
|
250
|
+
chatHistory(limit?: number): Promise<any[]>;
|
|
251
|
+
chatAbort(): Promise<void>;
|
|
252
|
+
close(): Promise<void>;
|
|
253
|
+
}
|
|
99
254
|
export interface GatewayCloseInfo {
|
|
100
255
|
code: number;
|
|
101
256
|
reason: string;
|
|
@@ -132,6 +287,13 @@ export interface OpenClawConfigSchemaResponse {
|
|
|
132
287
|
version?: string;
|
|
133
288
|
generatedAt?: string;
|
|
134
289
|
}
|
|
290
|
+
export interface OpenClawSlackRelayOptions {
|
|
291
|
+
url: string;
|
|
292
|
+
gatewayId: string;
|
|
293
|
+
authTokenEnv?: string;
|
|
294
|
+
accountId?: string;
|
|
295
|
+
botToken?: OpenClawSlackRelayConfiguration["botToken"];
|
|
296
|
+
}
|
|
135
297
|
export interface OpenClawConfigNodeDescriptor {
|
|
136
298
|
schema: Record<string, any>;
|
|
137
299
|
type?: string;
|
|
@@ -140,6 +302,25 @@ export interface OpenClawConfigNodeDescriptor {
|
|
|
140
302
|
additionalPropertySchema: Record<string, any> | null;
|
|
141
303
|
isDynamicMap: boolean;
|
|
142
304
|
}
|
|
305
|
+
export type OpenClawConfigReloadKind = "restart" | "hot" | "none";
|
|
306
|
+
export interface OpenClawConfigSchemaLookupChild {
|
|
307
|
+
key: string;
|
|
308
|
+
path: string;
|
|
309
|
+
type?: string | string[];
|
|
310
|
+
required: boolean;
|
|
311
|
+
hasChildren: boolean;
|
|
312
|
+
reloadKind?: OpenClawConfigReloadKind;
|
|
313
|
+
hint?: OpenClawConfigUiHint;
|
|
314
|
+
hintPath?: string;
|
|
315
|
+
}
|
|
316
|
+
export interface OpenClawConfigSchemaLookupResult {
|
|
317
|
+
path: string;
|
|
318
|
+
schema: unknown;
|
|
319
|
+
reloadKind?: OpenClawConfigReloadKind;
|
|
320
|
+
hint?: OpenClawConfigUiHint;
|
|
321
|
+
hintPath?: string;
|
|
322
|
+
children: OpenClawConfigSchemaLookupChild[];
|
|
323
|
+
}
|
|
143
324
|
export interface GatewaySkillsStatusParams {
|
|
144
325
|
agentId?: string;
|
|
145
326
|
}
|
|
@@ -448,13 +629,386 @@ export interface GatewayIntegrationDisconnectResult {
|
|
|
448
629
|
connectionId?: string;
|
|
449
630
|
[key: string]: unknown;
|
|
450
631
|
}
|
|
632
|
+
export interface GatewayMessageActionParams {
|
|
633
|
+
channel: string;
|
|
634
|
+
action: string;
|
|
635
|
+
params: Record<string, unknown>;
|
|
636
|
+
accountId?: string;
|
|
637
|
+
sessionKey?: string;
|
|
638
|
+
sessionId?: string;
|
|
639
|
+
inboundTurnKind?: "user_request" | "room_event";
|
|
640
|
+
agentId?: string;
|
|
641
|
+
conversationReadOrigin?: "direct-operator";
|
|
642
|
+
idempotencyKey?: string;
|
|
643
|
+
}
|
|
644
|
+
export interface GatewaySendParams {
|
|
645
|
+
to: string;
|
|
646
|
+
message?: string;
|
|
647
|
+
mediaUrl?: string;
|
|
648
|
+
mediaUrls?: string[];
|
|
649
|
+
buffer?: string;
|
|
650
|
+
filename?: string;
|
|
651
|
+
contentType?: string;
|
|
652
|
+
asVoice?: boolean;
|
|
653
|
+
gifPlayback?: boolean;
|
|
654
|
+
channel?: string;
|
|
655
|
+
accountId?: string;
|
|
656
|
+
agentId?: string;
|
|
657
|
+
replyToId?: string;
|
|
658
|
+
threadId?: string;
|
|
659
|
+
forceDocument?: boolean;
|
|
660
|
+
silent?: boolean;
|
|
661
|
+
parseMode?: "HTML";
|
|
662
|
+
sessionKey?: string;
|
|
663
|
+
idempotencyKey?: string;
|
|
664
|
+
}
|
|
665
|
+
export interface GatewaySendResult {
|
|
666
|
+
runId: string;
|
|
667
|
+
messageId: unknown;
|
|
668
|
+
channel: string;
|
|
669
|
+
chatId?: unknown;
|
|
670
|
+
channelId?: unknown;
|
|
671
|
+
toJid?: unknown;
|
|
672
|
+
conversationId?: unknown;
|
|
673
|
+
pollId?: unknown;
|
|
674
|
+
}
|
|
675
|
+
export type GatewayPluginState = "enabled" | "disabled" | "not-installed" | "error";
|
|
676
|
+
export type GatewayPluginCatalogInstallAction = {
|
|
677
|
+
source: "clawhub";
|
|
678
|
+
packageName: string;
|
|
679
|
+
} | {
|
|
680
|
+
source: "official";
|
|
681
|
+
pluginId: string;
|
|
682
|
+
};
|
|
683
|
+
export interface GatewayPluginCatalogEntry {
|
|
684
|
+
id: string;
|
|
685
|
+
name: string;
|
|
686
|
+
packageName?: string;
|
|
687
|
+
description?: string;
|
|
688
|
+
version?: string;
|
|
689
|
+
kind?: string[];
|
|
690
|
+
origin?: string;
|
|
691
|
+
installed: boolean;
|
|
692
|
+
enabled: boolean;
|
|
693
|
+
state: GatewayPluginState;
|
|
694
|
+
featured?: boolean;
|
|
695
|
+
order?: number;
|
|
696
|
+
hasIcon?: boolean;
|
|
697
|
+
install?: GatewayPluginCatalogInstallAction;
|
|
698
|
+
error?: string;
|
|
699
|
+
category?: string;
|
|
700
|
+
removable?: boolean;
|
|
701
|
+
}
|
|
702
|
+
export interface GatewayPluginsListResult {
|
|
703
|
+
plugins: GatewayPluginCatalogEntry[];
|
|
704
|
+
diagnostics: unknown[];
|
|
705
|
+
mutationAllowed: boolean;
|
|
706
|
+
}
|
|
707
|
+
export type GatewayPluginsInstallParams = {
|
|
708
|
+
source: "clawhub";
|
|
709
|
+
packageName: string;
|
|
710
|
+
version?: string;
|
|
711
|
+
acknowledgeClawHubRisk?: boolean;
|
|
712
|
+
} | {
|
|
713
|
+
source: "official";
|
|
714
|
+
pluginId: string;
|
|
715
|
+
};
|
|
716
|
+
export interface GatewayPluginsInstallResult {
|
|
717
|
+
ok: true;
|
|
718
|
+
plugin: GatewayPluginCatalogEntry;
|
|
719
|
+
restartRequired: true;
|
|
720
|
+
warnings?: string[];
|
|
721
|
+
}
|
|
722
|
+
export interface GatewayPluginsSetEnabledParams {
|
|
723
|
+
pluginId: string;
|
|
724
|
+
enabled: boolean;
|
|
725
|
+
}
|
|
726
|
+
export interface GatewayPluginsSetEnabledResult {
|
|
727
|
+
ok: true;
|
|
728
|
+
plugin: GatewayPluginCatalogEntry;
|
|
729
|
+
restartRequired: boolean;
|
|
730
|
+
warnings?: string[];
|
|
731
|
+
}
|
|
732
|
+
export interface GatewayPluginsUninstallParams {
|
|
733
|
+
pluginId: string;
|
|
734
|
+
}
|
|
735
|
+
export interface GatewayPluginsUninstallResult {
|
|
736
|
+
ok: true;
|
|
737
|
+
pluginId: string;
|
|
738
|
+
restartRequired: true;
|
|
739
|
+
removed: string[];
|
|
740
|
+
warnings?: string[];
|
|
741
|
+
}
|
|
742
|
+
export interface GatewayPluginsRefreshResult {
|
|
743
|
+
ok: true;
|
|
744
|
+
}
|
|
745
|
+
export type GatewayToolProfileId = "minimal" | "coding" | "messaging" | "full";
|
|
746
|
+
export type GatewayToolSource = "core" | "plugin" | "channel" | "mcp";
|
|
747
|
+
export type GatewayToolRisk = "low" | "medium" | "high";
|
|
748
|
+
export interface GatewayToolsCatalogParams {
|
|
749
|
+
agentId?: string;
|
|
750
|
+
includePlugins?: boolean;
|
|
751
|
+
}
|
|
752
|
+
export interface GatewayToolCatalogProfile {
|
|
753
|
+
id: GatewayToolProfileId;
|
|
754
|
+
label: string;
|
|
755
|
+
}
|
|
756
|
+
export interface GatewayToolCatalogEntry {
|
|
757
|
+
id: string;
|
|
758
|
+
label: string;
|
|
759
|
+
description: string;
|
|
760
|
+
source: "core" | "plugin";
|
|
761
|
+
pluginId?: string;
|
|
762
|
+
optional?: boolean;
|
|
763
|
+
risk?: GatewayToolRisk;
|
|
764
|
+
tags?: string[];
|
|
765
|
+
defaultProfiles: GatewayToolProfileId[];
|
|
766
|
+
}
|
|
767
|
+
export interface GatewayToolCatalogGroup {
|
|
768
|
+
id: string;
|
|
769
|
+
label: string;
|
|
770
|
+
source: "core" | "plugin";
|
|
771
|
+
pluginId?: string;
|
|
772
|
+
tools: GatewayToolCatalogEntry[];
|
|
773
|
+
}
|
|
774
|
+
export interface GatewayToolsCatalogResult {
|
|
775
|
+
agentId: string;
|
|
776
|
+
profiles: GatewayToolCatalogProfile[];
|
|
777
|
+
groups: GatewayToolCatalogGroup[];
|
|
778
|
+
}
|
|
779
|
+
export interface GatewayToolsEffectiveParams {
|
|
780
|
+
agentId?: string;
|
|
781
|
+
sessionKey: string;
|
|
782
|
+
}
|
|
783
|
+
export interface GatewayToolsEffectiveEntry {
|
|
784
|
+
id: string;
|
|
785
|
+
label: string;
|
|
786
|
+
description: string;
|
|
787
|
+
rawDescription: string;
|
|
788
|
+
source: GatewayToolSource;
|
|
789
|
+
pluginId?: string;
|
|
790
|
+
channelId?: string;
|
|
791
|
+
risk?: GatewayToolRisk;
|
|
792
|
+
tags?: string[];
|
|
793
|
+
}
|
|
794
|
+
export interface GatewayToolsEffectiveGroup {
|
|
795
|
+
id: GatewayToolSource;
|
|
796
|
+
label: string;
|
|
797
|
+
source: GatewayToolSource;
|
|
798
|
+
tools: GatewayToolsEffectiveEntry[];
|
|
799
|
+
}
|
|
800
|
+
export interface GatewayToolsEffectiveNotice {
|
|
801
|
+
id: string;
|
|
802
|
+
severity: "info" | "warning";
|
|
803
|
+
message: string;
|
|
804
|
+
}
|
|
805
|
+
export interface GatewayToolsEffectiveResult {
|
|
806
|
+
agentId: string;
|
|
807
|
+
profile: string;
|
|
808
|
+
groups: GatewayToolsEffectiveGroup[];
|
|
809
|
+
notices?: GatewayToolsEffectiveNotice[];
|
|
810
|
+
}
|
|
811
|
+
export interface GatewayToolsInvokeParams {
|
|
812
|
+
name: string;
|
|
813
|
+
args?: Record<string, unknown>;
|
|
814
|
+
sessionKey?: string;
|
|
815
|
+
agentId?: string;
|
|
816
|
+
confirm?: boolean;
|
|
817
|
+
idempotencyKey?: string;
|
|
818
|
+
conversationReadOrigin?: "direct-operator";
|
|
819
|
+
}
|
|
820
|
+
export interface GatewayToolsInvokeError {
|
|
821
|
+
code: string;
|
|
822
|
+
message: string;
|
|
823
|
+
details?: unknown;
|
|
824
|
+
}
|
|
825
|
+
export interface GatewayToolsInvokeResult {
|
|
826
|
+
ok: boolean;
|
|
827
|
+
toolName: string;
|
|
828
|
+
output?: unknown;
|
|
829
|
+
requiresApproval?: boolean;
|
|
830
|
+
approvalId?: string;
|
|
831
|
+
source?: GatewayToolSource | (string & {});
|
|
832
|
+
error?: GatewayToolsInvokeError;
|
|
833
|
+
}
|
|
834
|
+
export type GatewayCommandSource = "native" | "skill" | "plugin";
|
|
835
|
+
export type GatewayCommandScope = "text" | "native" | "both";
|
|
836
|
+
export type GatewayCommandCategory = "session" | "options" | "status" | "management" | "media" | "tools" | "docks";
|
|
837
|
+
export interface GatewayCommandArgChoice {
|
|
838
|
+
value: string;
|
|
839
|
+
label: string;
|
|
840
|
+
}
|
|
841
|
+
export interface GatewayCommandArg {
|
|
842
|
+
name: string;
|
|
843
|
+
description: string;
|
|
844
|
+
type: "string" | "number" | "boolean";
|
|
845
|
+
required?: boolean;
|
|
846
|
+
choices?: GatewayCommandArgChoice[];
|
|
847
|
+
dynamic?: boolean;
|
|
848
|
+
}
|
|
849
|
+
export interface GatewayCommandEntry {
|
|
850
|
+
name: string;
|
|
851
|
+
nativeName?: string;
|
|
852
|
+
textAliases?: string[];
|
|
853
|
+
description: string;
|
|
854
|
+
category?: GatewayCommandCategory;
|
|
855
|
+
source: GatewayCommandSource;
|
|
856
|
+
scope: GatewayCommandScope;
|
|
857
|
+
acceptsArgs: boolean;
|
|
858
|
+
args?: GatewayCommandArg[];
|
|
859
|
+
}
|
|
860
|
+
export interface GatewayCommandsListParams {
|
|
861
|
+
agentId?: string;
|
|
862
|
+
provider?: string;
|
|
863
|
+
scope?: GatewayCommandScope;
|
|
864
|
+
includeArgs?: boolean;
|
|
865
|
+
}
|
|
866
|
+
export interface GatewayCommandsListResult {
|
|
867
|
+
commands: GatewayCommandEntry[];
|
|
868
|
+
}
|
|
869
|
+
export interface ChannelsStatusParams {
|
|
870
|
+
probe?: boolean;
|
|
871
|
+
timeoutMs?: number;
|
|
872
|
+
channel?: string;
|
|
873
|
+
}
|
|
874
|
+
export interface ChannelsStartParams {
|
|
875
|
+
channel: string;
|
|
876
|
+
accountId?: string;
|
|
877
|
+
}
|
|
878
|
+
export interface ChannelsStartResult {
|
|
879
|
+
channel: string;
|
|
880
|
+
accountId: string;
|
|
881
|
+
started: boolean;
|
|
882
|
+
}
|
|
883
|
+
export interface ChannelsStopParams {
|
|
884
|
+
channel: string;
|
|
885
|
+
accountId?: string;
|
|
886
|
+
}
|
|
887
|
+
export interface ChannelsStopResult {
|
|
888
|
+
channel: string;
|
|
889
|
+
accountId: string;
|
|
890
|
+
stopped: boolean;
|
|
891
|
+
}
|
|
892
|
+
export type ChannelCredentialStatus = "available" | "configured_unavailable" | "missing";
|
|
893
|
+
export interface ChannelAccountSnapshot {
|
|
894
|
+
accountId: string;
|
|
895
|
+
name?: string;
|
|
896
|
+
enabled?: boolean;
|
|
897
|
+
configured?: boolean;
|
|
898
|
+
linked?: boolean;
|
|
899
|
+
running?: boolean;
|
|
900
|
+
connected?: boolean;
|
|
901
|
+
restartPending?: boolean;
|
|
902
|
+
reconnectAttempts?: number;
|
|
903
|
+
lastConnectedAt?: number;
|
|
904
|
+
lastError?: string;
|
|
905
|
+
healthState?: string;
|
|
906
|
+
lastStartAt?: number;
|
|
907
|
+
lastStopAt?: number;
|
|
908
|
+
lastInboundAt?: number;
|
|
909
|
+
lastOutboundAt?: number;
|
|
910
|
+
lastMessageAt?: number | null;
|
|
911
|
+
lastEventAt?: number | null;
|
|
912
|
+
lastTransportActivityAt?: number;
|
|
913
|
+
statusState?: string;
|
|
914
|
+
terminalDisconnect?: boolean;
|
|
915
|
+
busy?: boolean;
|
|
916
|
+
activeRuns?: number;
|
|
917
|
+
lastRunActivityAt?: number;
|
|
918
|
+
lastProbeAt?: number;
|
|
919
|
+
mode?: string;
|
|
920
|
+
dmPolicy?: string;
|
|
921
|
+
allowFrom?: string[];
|
|
922
|
+
tokenSource?: string;
|
|
923
|
+
botTokenSource?: string;
|
|
924
|
+
appTokenSource?: string;
|
|
925
|
+
signingSecretSource?: string;
|
|
926
|
+
userTokenSource?: string;
|
|
927
|
+
tokenStatus?: ChannelCredentialStatus;
|
|
928
|
+
botTokenStatus?: ChannelCredentialStatus;
|
|
929
|
+
appTokenStatus?: ChannelCredentialStatus;
|
|
930
|
+
signingSecretStatus?: ChannelCredentialStatus;
|
|
931
|
+
userTokenStatus?: ChannelCredentialStatus;
|
|
932
|
+
baseUrl?: string;
|
|
933
|
+
allowUnmentionedGroups?: boolean;
|
|
934
|
+
cliPath?: string | null;
|
|
935
|
+
dbPath?: string | null;
|
|
936
|
+
port?: number | null;
|
|
937
|
+
probe?: unknown;
|
|
938
|
+
audit?: unknown;
|
|
939
|
+
application?: unknown;
|
|
940
|
+
[key: string]: unknown;
|
|
941
|
+
}
|
|
942
|
+
export interface ChannelUiMeta {
|
|
943
|
+
id: string;
|
|
944
|
+
label: string;
|
|
945
|
+
detailLabel: string;
|
|
946
|
+
systemImage?: string;
|
|
947
|
+
[key: string]: unknown;
|
|
948
|
+
}
|
|
949
|
+
export interface ChannelEventLoopHealth {
|
|
950
|
+
degraded: boolean;
|
|
951
|
+
reasons: Array<"event_loop_delay" | "event_loop_utilization" | "cpu">;
|
|
952
|
+
intervalMs: number;
|
|
953
|
+
delayP99Ms: number;
|
|
954
|
+
delayMaxMs: number;
|
|
955
|
+
utilization: number;
|
|
956
|
+
cpuCoreRatio: number;
|
|
957
|
+
[key: string]: unknown;
|
|
958
|
+
}
|
|
959
|
+
export interface ChannelsStatusResult {
|
|
960
|
+
ts: number;
|
|
961
|
+
channelOrder: string[];
|
|
962
|
+
channelLabels: Record<string, string>;
|
|
963
|
+
channelDetailLabels?: Record<string, string>;
|
|
964
|
+
channelSystemImages?: Record<string, string>;
|
|
965
|
+
channelMeta?: ChannelUiMeta[];
|
|
966
|
+
channels: Record<string, unknown>;
|
|
967
|
+
channelAccounts: Record<string, ChannelAccountSnapshot[]>;
|
|
968
|
+
channelDefaultAccountId: Record<string, string>;
|
|
969
|
+
eventLoop?: ChannelEventLoopHealth;
|
|
970
|
+
partial?: boolean;
|
|
971
|
+
warnings?: string[];
|
|
972
|
+
[key: string]: unknown;
|
|
973
|
+
}
|
|
974
|
+
export interface GatewayWebLoginStartOptions {
|
|
975
|
+
force?: boolean;
|
|
976
|
+
timeoutMs?: number;
|
|
977
|
+
verbose?: boolean;
|
|
978
|
+
accountId?: string;
|
|
979
|
+
}
|
|
980
|
+
export interface GatewayWebLoginStartResult {
|
|
981
|
+
qrDataUrl?: string;
|
|
982
|
+
message: string;
|
|
983
|
+
connected?: boolean;
|
|
984
|
+
}
|
|
985
|
+
export interface GatewayWebLoginWaitOptions {
|
|
986
|
+
timeoutMs?: number;
|
|
987
|
+
accountId?: string;
|
|
988
|
+
currentQrDataUrl?: string;
|
|
989
|
+
}
|
|
990
|
+
export interface GatewayWebLoginWaitResult {
|
|
991
|
+
connected: boolean;
|
|
992
|
+
message: string;
|
|
993
|
+
qrDataUrl?: string;
|
|
994
|
+
}
|
|
451
995
|
export type GatewayEventHandler = (event: GatewayEvent) => void;
|
|
452
996
|
export type GatewayConnectionStateHandler = (state: GatewayConnectionState) => void;
|
|
997
|
+
export type GatewayClientRequestOptions = {
|
|
998
|
+
expectFinal?: boolean;
|
|
999
|
+
timeoutMs?: number | null;
|
|
1000
|
+
signal?: AbortSignal;
|
|
1001
|
+
/** Called once for expectFinal requests after an accepted response, before the final result. */
|
|
1002
|
+
onAccepted?: (payload: unknown) => void;
|
|
1003
|
+
};
|
|
453
1004
|
type GatewayErrorShape = {
|
|
454
1005
|
code: string;
|
|
455
1006
|
message: string;
|
|
456
1007
|
details?: unknown;
|
|
457
1008
|
};
|
|
1009
|
+
export declare function isOpenClawGatewayMethodUnsupported(error: unknown, method?: string): boolean;
|
|
1010
|
+
export declare const MIN_GATEWAY_VERSION = 3;
|
|
1011
|
+
export declare const MAX_GATEWAY_VERSION = 4;
|
|
458
1012
|
export declare function normalizeChatAttachments(attachments?: ChatAttachment[]): GatewayChatAttachmentPayload[] | undefined;
|
|
459
1013
|
export declare function extractGatewayChatThinking(message: unknown): string;
|
|
460
1014
|
export declare function extractGatewayChatMediaUrls(message: unknown): string[];
|
|
@@ -472,6 +1026,11 @@ export declare class GatewayClient {
|
|
|
472
1026
|
private url;
|
|
473
1027
|
private token?;
|
|
474
1028
|
private gatewayToken?;
|
|
1029
|
+
private bootstrapToken?;
|
|
1030
|
+
private deviceToken?;
|
|
1031
|
+
private password?;
|
|
1032
|
+
private approvalRuntimeToken?;
|
|
1033
|
+
private agentRuntimeIdentityToken?;
|
|
475
1034
|
private deploymentId?;
|
|
476
1035
|
private apiKey?;
|
|
477
1036
|
private apiBase?;
|
|
@@ -481,13 +1040,31 @@ export declare class GatewayClient {
|
|
|
481
1040
|
private clientDisplayName?;
|
|
482
1041
|
private clientVersion;
|
|
483
1042
|
private clientPlatform;
|
|
1043
|
+
private clientDeviceFamily?;
|
|
484
1044
|
private clientInstanceId?;
|
|
485
1045
|
private caps;
|
|
1046
|
+
private role;
|
|
1047
|
+
private scopes;
|
|
1048
|
+
private commands?;
|
|
1049
|
+
private permissions?;
|
|
1050
|
+
private pathEnv?;
|
|
1051
|
+
private minProtocol;
|
|
1052
|
+
private maxProtocol;
|
|
486
1053
|
private origin?;
|
|
487
1054
|
private defaultTimeout;
|
|
488
1055
|
private ws;
|
|
489
1056
|
private pending;
|
|
490
1057
|
private eventHandlers;
|
|
1058
|
+
private internalEventHandlers;
|
|
1059
|
+
private internalStreamCloseHandlers;
|
|
1060
|
+
private activeNormalChatStreams;
|
|
1061
|
+
private activeStrictChatStreams;
|
|
1062
|
+
private activeEphemeralSessionKeys;
|
|
1063
|
+
private suppressedEphemeralRunIds;
|
|
1064
|
+
private pendingEphemeralChatAcks;
|
|
1065
|
+
private deferredEphemeralCorrelationEvents;
|
|
1066
|
+
private deferredEphemeralEventsCanRepublish;
|
|
1067
|
+
private suppressUncorrelatedChatEventsUntil;
|
|
491
1068
|
private connectionStateHandlers;
|
|
492
1069
|
private connected;
|
|
493
1070
|
private connectionState;
|
|
@@ -514,6 +1091,7 @@ export declare class GatewayClient {
|
|
|
514
1091
|
private readonly onHello?;
|
|
515
1092
|
private readonly onClose?;
|
|
516
1093
|
private readonly onGap?;
|
|
1094
|
+
private readonly onProtocolError?;
|
|
517
1095
|
private readonly onPairing?;
|
|
518
1096
|
get version(): string | null;
|
|
519
1097
|
get protocol(): number | null;
|
|
@@ -527,6 +1105,18 @@ export declare class GatewayClient {
|
|
|
527
1105
|
private storageScope;
|
|
528
1106
|
/** Subscribe to server-sent events */
|
|
529
1107
|
onEvent(handler: GatewayEventHandler): () => void;
|
|
1108
|
+
private currentEphemeralSessionKeys;
|
|
1109
|
+
private shouldSuppressPublicEvent;
|
|
1110
|
+
private suppressEphemeralRunId;
|
|
1111
|
+
private beginEphemeralChatAcknowledgement;
|
|
1112
|
+
private deferEphemeralCorrelationEvent;
|
|
1113
|
+
private finishEphemeralChatAcknowledgement;
|
|
1114
|
+
private publishPublicEvent;
|
|
1115
|
+
private notifyInternalStreamClose;
|
|
1116
|
+
private interruptNormalChatStreams;
|
|
1117
|
+
private handleForwardSequenceGap;
|
|
1118
|
+
private reportProtocolError;
|
|
1119
|
+
private rejectMalformedPendingResponse;
|
|
530
1120
|
/** Connect and keep reconnecting until stopped */
|
|
531
1121
|
connect(): Promise<void>;
|
|
532
1122
|
start(): Promise<void>;
|
|
@@ -545,12 +1135,18 @@ export declare class GatewayClient {
|
|
|
545
1135
|
private handleMessage;
|
|
546
1136
|
private sendRawRequest;
|
|
547
1137
|
private rpc;
|
|
548
|
-
request<T = any>(method: string, params?: Record<string, any>,
|
|
1138
|
+
request<T = any>(method: string, params?: Record<string, any>, options?: number | null | GatewayClientRequestOptions): Promise<T>;
|
|
549
1139
|
configGet(): Promise<Record<string, any>>;
|
|
550
1140
|
configSchema(): Promise<OpenClawConfigSchemaResponse>;
|
|
1141
|
+
configSchemaLookup(path: string): Promise<OpenClawConfigSchemaLookupResult>;
|
|
551
1142
|
configPatch(patch: Record<string, any>): Promise<void>;
|
|
552
1143
|
configApply(config: Record<string, any>): Promise<void>;
|
|
553
1144
|
configSet(config: Record<string, any>): Promise<void>;
|
|
1145
|
+
configureSlackSocket(config: OpenClawSlackSocketConfiguration, accountId?: string): Promise<void>;
|
|
1146
|
+
configureSlackHttp(config: OpenClawSlackHttpConfiguration, accountId?: string): Promise<void>;
|
|
1147
|
+
configureSlackRelay(options: OpenClawSlackRelayOptions | OpenClawSlackRelayConfiguration, accountId?: string): Promise<void>;
|
|
1148
|
+
configureTelegram(config: OpenClawTelegramConfigPatch, accountId?: string): Promise<void>;
|
|
1149
|
+
configureWhatsapp(config: OpenClawWhatsAppConfigPatch, accountId?: string): Promise<void>;
|
|
554
1150
|
modelsList(): Promise<any[]>;
|
|
555
1151
|
skillsStatus(params?: GatewaySkillsStatusParams): Promise<GatewaySkillsStatusReport>;
|
|
556
1152
|
skillsSearch(params?: GatewaySkillsSearchParams): Promise<GatewaySkillsSearchResult>;
|
|
@@ -564,26 +1160,72 @@ export declare class GatewayClient {
|
|
|
564
1160
|
integrationsStatus(params?: GatewayIntegrationStatusParams): Promise<GatewayIntegrationStatusResult>;
|
|
565
1161
|
integrationsDisconnect(params: GatewayIntegrationDisconnectParams): Promise<GatewayIntegrationDisconnectResult>;
|
|
566
1162
|
waitReady(timeoutMs?: number, options?: GatewayWaitReadyOptions): Promise<Record<string, any>>;
|
|
567
|
-
channelsStatus(probe?: boolean, timeoutMs?: number): Promise<
|
|
1163
|
+
channelsStatus(probe?: boolean, timeoutMs?: number, channel?: string): Promise<ChannelsStatusResult>;
|
|
1164
|
+
channelsStart(channel: string, accountId?: string): Promise<ChannelsStartResult>;
|
|
1165
|
+
channelsStop(channel: string, accountId?: string): Promise<ChannelsStopResult>;
|
|
568
1166
|
channelsLogout(channel: string, accountId?: string): Promise<Record<string, any>>;
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
1167
|
+
messageAction<TResult = unknown>(params: GatewayMessageActionParams): Promise<TResult>;
|
|
1168
|
+
send(params: GatewaySendParams): Promise<GatewaySendResult>;
|
|
1169
|
+
readMediaBytes(pathOrUrl: string): Promise<Uint8Array>;
|
|
1170
|
+
pluginsList(): Promise<GatewayPluginsListResult>;
|
|
1171
|
+
pluginsInstall(params: GatewayPluginsInstallParams): Promise<GatewayPluginsInstallResult>;
|
|
1172
|
+
pluginsSetEnabled(params: GatewayPluginsSetEnabledParams): Promise<GatewayPluginsSetEnabledResult>;
|
|
1173
|
+
pluginsUninstall(params: GatewayPluginsUninstallParams): Promise<GatewayPluginsUninstallResult>;
|
|
1174
|
+
pluginsRefresh(): Promise<GatewayPluginsRefreshResult>;
|
|
1175
|
+
toolsCatalog(params?: GatewayToolsCatalogParams): Promise<GatewayToolsCatalogResult>;
|
|
1176
|
+
toolsEffective(params: GatewayToolsEffectiveParams): Promise<GatewayToolsEffectiveResult>;
|
|
1177
|
+
toolsInvoke(params: GatewayToolsInvokeParams): Promise<GatewayToolsInvokeResult>;
|
|
1178
|
+
commandsList(params?: GatewayCommandsListParams): Promise<GatewayCommandsListResult>;
|
|
1179
|
+
webLoginStart(options?: GatewayWebLoginStartOptions): Promise<GatewayWebLoginStartResult>;
|
|
1180
|
+
webLoginWait(options?: GatewayWebLoginWaitOptions): Promise<GatewayWebLoginWaitResult>;
|
|
1181
|
+
sessionsListResult(): Promise<GatewaySessionsListResult>;
|
|
579
1182
|
sessionsList(): Promise<any[]>;
|
|
580
1183
|
sessionsPreview(sessionKey: string, limit?: number): Promise<any[]>;
|
|
1184
|
+
sessionsSubscribe(): Promise<boolean>;
|
|
1185
|
+
sessionsCreate(params?: GatewaySessionCreateParams): Promise<GatewaySessionCreateResult>;
|
|
581
1186
|
sessionsPatch(patch: GatewaySessionPatch): Promise<Record<string, any>>;
|
|
1187
|
+
chatHistoryResult(sessionKey?: string, limit?: number): Promise<GatewayChatHistoryResult>;
|
|
582
1188
|
chatHistory(sessionKey?: string, limit?: number): Promise<any[]>;
|
|
583
|
-
|
|
1189
|
+
chatMessageGet(sessionKey: string, messageId: string, options?: GatewayChatMessageGetOptions): Promise<GatewayChatMessageGetResult>;
|
|
1190
|
+
chatAbort(sessionKey?: string, runId?: string): Promise<void>;
|
|
584
1191
|
sendChat(message: string, sessionKey?: string, agentId?: string, attachments?: ChatAttachment[]): Promise<any>;
|
|
585
|
-
sessionsReset(sessionKey: string, reason?: "new" | "reset"): Promise<
|
|
586
|
-
|
|
1192
|
+
sessionsReset(sessionKey: string, reason?: "new" | "reset"): Promise<string>;
|
|
1193
|
+
createEphemeralChatSession(): Promise<GatewayEphemeralChatSession>;
|
|
1194
|
+
/** Paired nodes known to the gateway. */
|
|
1195
|
+
nodesList(): Promise<any[]>;
|
|
1196
|
+
/** Detailed metadata for one paired node (caps + supported invoke commands). */
|
|
1197
|
+
nodeDescribe(nodeId: string): Promise<any>;
|
|
1198
|
+
/** Pending and paired node-pairing requests. */
|
|
1199
|
+
nodePairList(): Promise<{
|
|
1200
|
+
pending: any[];
|
|
1201
|
+
paired: any[];
|
|
1202
|
+
}>;
|
|
1203
|
+
/**
|
|
1204
|
+
* Approve a pending node pairing (and its declared command surface). This is
|
|
1205
|
+
* the sibling of `device.pair.approve`; it requires `operator.pairing` and,
|
|
1206
|
+
* for command-bearing nodes, `operator.write`/`operator.admin`.
|
|
1207
|
+
*/
|
|
1208
|
+
nodePairApprove(requestId: string): Promise<any>;
|
|
1209
|
+
/** Reject a pending node pairing request. */
|
|
1210
|
+
nodePairReject(requestId: string): Promise<void>;
|
|
1211
|
+
/** Remove an already-paired node from the gateway trust set. */
|
|
1212
|
+
nodePairRemove(nodeId: string): Promise<void>;
|
|
1213
|
+
/** Rename a paired node while preserving its stable node id. */
|
|
1214
|
+
nodeRename(nodeId: string, displayName: string): Promise<void>;
|
|
1215
|
+
/**
|
|
1216
|
+
* Invoke a command on a paired node and return its result. The node must be
|
|
1217
|
+
* connected, have declared `command`, and the command must be allowed by the
|
|
1218
|
+
* gateway policy (declared + approved surface, and/or
|
|
1219
|
+
* `gateway.nodes.allowCommands`).
|
|
1220
|
+
*/
|
|
1221
|
+
nodeInvoke(nodeId: string, command: string, params?: Record<string, any>, timeoutMs?: number): Promise<any>;
|
|
1222
|
+
chatSend(message: string, sessionKey: string, attachments?: ChatAttachment[], options?: {
|
|
1223
|
+
strictCorrelation?: boolean;
|
|
1224
|
+
ephemeralSession?: boolean;
|
|
1225
|
+
captureHistoryBaseline?: boolean;
|
|
1226
|
+
priorAssistantTexts?: string[];
|
|
1227
|
+
}): AsyncGenerator<ChatEvent>;
|
|
1228
|
+
runEphemeralChat(message: string, options?: GatewayEphemeralChatOptions): Promise<string>;
|
|
587
1229
|
filesList(agentId?: string): Promise<any[]>;
|
|
588
1230
|
fileGet(agentId: string, name: string): Promise<string>;
|
|
589
1231
|
fileSet(agentId: string, name: string, content: string): Promise<void>;
|
|
@@ -597,5 +1239,29 @@ export declare class GatewayClient {
|
|
|
597
1239
|
execDeny(execId: string): Promise<void>;
|
|
598
1240
|
status(): Promise<Record<string, any>>;
|
|
599
1241
|
}
|
|
1242
|
+
/** Handler for one node command. Receives decoded params, returns a JSON-serializable payload. */
|
|
1243
|
+
export type NodeCommandHandler = (params: any) => Promise<any> | any;
|
|
1244
|
+
export interface NodeServerOptions extends Omit<GatewayOptions, "role" | "scopes" | "commands" | "clientMode"> {
|
|
1245
|
+
/** Stable node id advertised to operators (defaults to the client instance id). */
|
|
1246
|
+
nodeId?: string;
|
|
1247
|
+
}
|
|
1248
|
+
/**
|
|
1249
|
+
* Serve a node command surface over a gateway connection. Wraps a
|
|
1250
|
+
* {@link GatewayClient} connected as `role: "node"`, subscribes to
|
|
1251
|
+
* `node.invoke.request`, dispatches to the registered handlers, and replies with
|
|
1252
|
+
* `node.invoke.result` (JSON-encoded payload on success, or an error).
|
|
1253
|
+
*/
|
|
1254
|
+
export declare class NodeServer {
|
|
1255
|
+
readonly gateway: GatewayClient;
|
|
1256
|
+
private readonly handlers;
|
|
1257
|
+
private unsubscribe;
|
|
1258
|
+
constructor(commands: Record<string, NodeCommandHandler>, options: NodeServerOptions);
|
|
1259
|
+
/** Connect as a node and start answering invoke requests. Resolves once connected. */
|
|
1260
|
+
start(): Promise<void>;
|
|
1261
|
+
/** Stop answering requests and disconnect. */
|
|
1262
|
+
stop(): void;
|
|
1263
|
+
private handleInvoke;
|
|
1264
|
+
private dispatch;
|
|
1265
|
+
}
|
|
600
1266
|
export {};
|
|
601
1267
|
//# sourceMappingURL=gateway.d.ts.map
|