@hypercli.com/sdk 2026.6.26 → 2026.7.31
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 +78 -0
- package/dist/agent.d.ts +19 -2
- package/dist/agent.d.ts.map +1 -1
- package/dist/agent.js +24 -0
- package/dist/agent.js.map +1 -1
- package/dist/agents.d.ts +534 -43
- package/dist/agents.d.ts.map +1 -1
- package/dist/agents.js +1890 -110
- package/dist/agents.js.map +1 -1
- package/dist/browser.d.ts +3 -1
- package/dist/browser.d.ts.map +1 -1
- package/dist/browser.js +9 -2
- 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 +9 -3
- package/dist/client.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/http.d.ts +10 -3
- package/dist/http.d.ts.map +1 -1
- package/dist/http.js +135 -61
- package/dist/http.js.map +1 -1
- package/dist/index.d.ts +12 -4
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -2
- package/dist/index.js.map +1 -1
- package/dist/keys.d.ts +6 -1
- package/dist/keys.d.ts.map +1 -1
- package/dist/keys.js +8 -1
- 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 +650 -15
- package/dist/openclaw/gateway.d.ts.map +1 -1
- package/dist/openclaw/gateway.js +1708 -181
- 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 +38 -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,16 @@ 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;
|
|
78
173
|
}
|
|
79
174
|
export interface GatewaySessionPatch {
|
|
80
175
|
key: string;
|
|
@@ -82,6 +177,29 @@ export interface GatewaySessionPatch {
|
|
|
82
177
|
thinkingLevel?: string;
|
|
83
178
|
[key: string]: unknown;
|
|
84
179
|
}
|
|
180
|
+
export interface GatewaySessionCreateParams {
|
|
181
|
+
key?: string;
|
|
182
|
+
agentId?: string;
|
|
183
|
+
label?: string;
|
|
184
|
+
model?: string;
|
|
185
|
+
parentSessionKey?: string;
|
|
186
|
+
fork?: boolean;
|
|
187
|
+
emitCommandHooks?: boolean;
|
|
188
|
+
task?: string;
|
|
189
|
+
message?: string;
|
|
190
|
+
worktree?: boolean;
|
|
191
|
+
}
|
|
192
|
+
export interface GatewaySessionCreateResult extends Record<string, unknown> {
|
|
193
|
+
ok: true;
|
|
194
|
+
key: string;
|
|
195
|
+
sessionId?: string;
|
|
196
|
+
entry?: Record<string, unknown>;
|
|
197
|
+
runStarted?: boolean;
|
|
198
|
+
}
|
|
199
|
+
export interface GatewaySessionsListResult extends Record<string, any> {
|
|
200
|
+
sessions: any[];
|
|
201
|
+
defaults?: Record<string, any>;
|
|
202
|
+
}
|
|
85
203
|
export interface GatewayChatAttachmentPayload {
|
|
86
204
|
type: string;
|
|
87
205
|
mimeType?: string;
|
|
@@ -96,6 +214,14 @@ export interface BrowserChatAttachment {
|
|
|
96
214
|
fileName?: string;
|
|
97
215
|
}
|
|
98
216
|
export type ChatAttachment = GatewayChatAttachmentPayload | BrowserChatAttachment;
|
|
217
|
+
export interface GatewayEphemeralChatSession {
|
|
218
|
+
readonly sessionKey: string;
|
|
219
|
+
readonly closed: boolean;
|
|
220
|
+
chatSend(message: string, attachments?: ChatAttachment[]): AsyncGenerator<ChatEvent>;
|
|
221
|
+
chatHistory(limit?: number): Promise<any[]>;
|
|
222
|
+
chatAbort(): Promise<void>;
|
|
223
|
+
close(): Promise<void>;
|
|
224
|
+
}
|
|
99
225
|
export interface GatewayCloseInfo {
|
|
100
226
|
code: number;
|
|
101
227
|
reason: string;
|
|
@@ -132,6 +258,13 @@ export interface OpenClawConfigSchemaResponse {
|
|
|
132
258
|
version?: string;
|
|
133
259
|
generatedAt?: string;
|
|
134
260
|
}
|
|
261
|
+
export interface OpenClawSlackRelayOptions {
|
|
262
|
+
url: string;
|
|
263
|
+
gatewayId: string;
|
|
264
|
+
authTokenEnv?: string;
|
|
265
|
+
accountId?: string;
|
|
266
|
+
botToken?: OpenClawSlackRelayConfiguration["botToken"];
|
|
267
|
+
}
|
|
135
268
|
export interface OpenClawConfigNodeDescriptor {
|
|
136
269
|
schema: Record<string, any>;
|
|
137
270
|
type?: string;
|
|
@@ -140,6 +273,25 @@ export interface OpenClawConfigNodeDescriptor {
|
|
|
140
273
|
additionalPropertySchema: Record<string, any> | null;
|
|
141
274
|
isDynamicMap: boolean;
|
|
142
275
|
}
|
|
276
|
+
export type OpenClawConfigReloadKind = "restart" | "hot" | "none";
|
|
277
|
+
export interface OpenClawConfigSchemaLookupChild {
|
|
278
|
+
key: string;
|
|
279
|
+
path: string;
|
|
280
|
+
type?: string | string[];
|
|
281
|
+
required: boolean;
|
|
282
|
+
hasChildren: boolean;
|
|
283
|
+
reloadKind?: OpenClawConfigReloadKind;
|
|
284
|
+
hint?: OpenClawConfigUiHint;
|
|
285
|
+
hintPath?: string;
|
|
286
|
+
}
|
|
287
|
+
export interface OpenClawConfigSchemaLookupResult {
|
|
288
|
+
path: string;
|
|
289
|
+
schema: unknown;
|
|
290
|
+
reloadKind?: OpenClawConfigReloadKind;
|
|
291
|
+
hint?: OpenClawConfigUiHint;
|
|
292
|
+
hintPath?: string;
|
|
293
|
+
children: OpenClawConfigSchemaLookupChild[];
|
|
294
|
+
}
|
|
143
295
|
export interface GatewaySkillsStatusParams {
|
|
144
296
|
agentId?: string;
|
|
145
297
|
}
|
|
@@ -448,13 +600,386 @@ export interface GatewayIntegrationDisconnectResult {
|
|
|
448
600
|
connectionId?: string;
|
|
449
601
|
[key: string]: unknown;
|
|
450
602
|
}
|
|
603
|
+
export interface GatewayMessageActionParams {
|
|
604
|
+
channel: string;
|
|
605
|
+
action: string;
|
|
606
|
+
params: Record<string, unknown>;
|
|
607
|
+
accountId?: string;
|
|
608
|
+
sessionKey?: string;
|
|
609
|
+
sessionId?: string;
|
|
610
|
+
inboundTurnKind?: "user_request" | "room_event";
|
|
611
|
+
agentId?: string;
|
|
612
|
+
conversationReadOrigin?: "direct-operator";
|
|
613
|
+
idempotencyKey?: string;
|
|
614
|
+
}
|
|
615
|
+
export interface GatewaySendParams {
|
|
616
|
+
to: string;
|
|
617
|
+
message?: string;
|
|
618
|
+
mediaUrl?: string;
|
|
619
|
+
mediaUrls?: string[];
|
|
620
|
+
buffer?: string;
|
|
621
|
+
filename?: string;
|
|
622
|
+
contentType?: string;
|
|
623
|
+
asVoice?: boolean;
|
|
624
|
+
gifPlayback?: boolean;
|
|
625
|
+
channel?: string;
|
|
626
|
+
accountId?: string;
|
|
627
|
+
agentId?: string;
|
|
628
|
+
replyToId?: string;
|
|
629
|
+
threadId?: string;
|
|
630
|
+
forceDocument?: boolean;
|
|
631
|
+
silent?: boolean;
|
|
632
|
+
parseMode?: "HTML";
|
|
633
|
+
sessionKey?: string;
|
|
634
|
+
idempotencyKey?: string;
|
|
635
|
+
}
|
|
636
|
+
export interface GatewaySendResult {
|
|
637
|
+
runId: string;
|
|
638
|
+
messageId: unknown;
|
|
639
|
+
channel: string;
|
|
640
|
+
chatId?: unknown;
|
|
641
|
+
channelId?: unknown;
|
|
642
|
+
toJid?: unknown;
|
|
643
|
+
conversationId?: unknown;
|
|
644
|
+
pollId?: unknown;
|
|
645
|
+
}
|
|
646
|
+
export type GatewayPluginState = "enabled" | "disabled" | "not-installed" | "error";
|
|
647
|
+
export type GatewayPluginCatalogInstallAction = {
|
|
648
|
+
source: "clawhub";
|
|
649
|
+
packageName: string;
|
|
650
|
+
} | {
|
|
651
|
+
source: "official";
|
|
652
|
+
pluginId: string;
|
|
653
|
+
};
|
|
654
|
+
export interface GatewayPluginCatalogEntry {
|
|
655
|
+
id: string;
|
|
656
|
+
name: string;
|
|
657
|
+
packageName?: string;
|
|
658
|
+
description?: string;
|
|
659
|
+
version?: string;
|
|
660
|
+
kind?: string[];
|
|
661
|
+
origin?: string;
|
|
662
|
+
installed: boolean;
|
|
663
|
+
enabled: boolean;
|
|
664
|
+
state: GatewayPluginState;
|
|
665
|
+
featured?: boolean;
|
|
666
|
+
order?: number;
|
|
667
|
+
hasIcon?: boolean;
|
|
668
|
+
install?: GatewayPluginCatalogInstallAction;
|
|
669
|
+
error?: string;
|
|
670
|
+
category?: string;
|
|
671
|
+
removable?: boolean;
|
|
672
|
+
}
|
|
673
|
+
export interface GatewayPluginsListResult {
|
|
674
|
+
plugins: GatewayPluginCatalogEntry[];
|
|
675
|
+
diagnostics: unknown[];
|
|
676
|
+
mutationAllowed: boolean;
|
|
677
|
+
}
|
|
678
|
+
export type GatewayPluginsInstallParams = {
|
|
679
|
+
source: "clawhub";
|
|
680
|
+
packageName: string;
|
|
681
|
+
version?: string;
|
|
682
|
+
acknowledgeClawHubRisk?: boolean;
|
|
683
|
+
} | {
|
|
684
|
+
source: "official";
|
|
685
|
+
pluginId: string;
|
|
686
|
+
};
|
|
687
|
+
export interface GatewayPluginsInstallResult {
|
|
688
|
+
ok: true;
|
|
689
|
+
plugin: GatewayPluginCatalogEntry;
|
|
690
|
+
restartRequired: true;
|
|
691
|
+
warnings?: string[];
|
|
692
|
+
}
|
|
693
|
+
export interface GatewayPluginsSetEnabledParams {
|
|
694
|
+
pluginId: string;
|
|
695
|
+
enabled: boolean;
|
|
696
|
+
}
|
|
697
|
+
export interface GatewayPluginsSetEnabledResult {
|
|
698
|
+
ok: true;
|
|
699
|
+
plugin: GatewayPluginCatalogEntry;
|
|
700
|
+
restartRequired: boolean;
|
|
701
|
+
warnings?: string[];
|
|
702
|
+
}
|
|
703
|
+
export interface GatewayPluginsUninstallParams {
|
|
704
|
+
pluginId: string;
|
|
705
|
+
}
|
|
706
|
+
export interface GatewayPluginsUninstallResult {
|
|
707
|
+
ok: true;
|
|
708
|
+
pluginId: string;
|
|
709
|
+
restartRequired: true;
|
|
710
|
+
removed: string[];
|
|
711
|
+
warnings?: string[];
|
|
712
|
+
}
|
|
713
|
+
export interface GatewayPluginsRefreshResult {
|
|
714
|
+
ok: true;
|
|
715
|
+
}
|
|
716
|
+
export type GatewayToolProfileId = "minimal" | "coding" | "messaging" | "full";
|
|
717
|
+
export type GatewayToolSource = "core" | "plugin" | "channel" | "mcp";
|
|
718
|
+
export type GatewayToolRisk = "low" | "medium" | "high";
|
|
719
|
+
export interface GatewayToolsCatalogParams {
|
|
720
|
+
agentId?: string;
|
|
721
|
+
includePlugins?: boolean;
|
|
722
|
+
}
|
|
723
|
+
export interface GatewayToolCatalogProfile {
|
|
724
|
+
id: GatewayToolProfileId;
|
|
725
|
+
label: string;
|
|
726
|
+
}
|
|
727
|
+
export interface GatewayToolCatalogEntry {
|
|
728
|
+
id: string;
|
|
729
|
+
label: string;
|
|
730
|
+
description: string;
|
|
731
|
+
source: "core" | "plugin";
|
|
732
|
+
pluginId?: string;
|
|
733
|
+
optional?: boolean;
|
|
734
|
+
risk?: GatewayToolRisk;
|
|
735
|
+
tags?: string[];
|
|
736
|
+
defaultProfiles: GatewayToolProfileId[];
|
|
737
|
+
}
|
|
738
|
+
export interface GatewayToolCatalogGroup {
|
|
739
|
+
id: string;
|
|
740
|
+
label: string;
|
|
741
|
+
source: "core" | "plugin";
|
|
742
|
+
pluginId?: string;
|
|
743
|
+
tools: GatewayToolCatalogEntry[];
|
|
744
|
+
}
|
|
745
|
+
export interface GatewayToolsCatalogResult {
|
|
746
|
+
agentId: string;
|
|
747
|
+
profiles: GatewayToolCatalogProfile[];
|
|
748
|
+
groups: GatewayToolCatalogGroup[];
|
|
749
|
+
}
|
|
750
|
+
export interface GatewayToolsEffectiveParams {
|
|
751
|
+
agentId?: string;
|
|
752
|
+
sessionKey: string;
|
|
753
|
+
}
|
|
754
|
+
export interface GatewayToolsEffectiveEntry {
|
|
755
|
+
id: string;
|
|
756
|
+
label: string;
|
|
757
|
+
description: string;
|
|
758
|
+
rawDescription: string;
|
|
759
|
+
source: GatewayToolSource;
|
|
760
|
+
pluginId?: string;
|
|
761
|
+
channelId?: string;
|
|
762
|
+
risk?: GatewayToolRisk;
|
|
763
|
+
tags?: string[];
|
|
764
|
+
}
|
|
765
|
+
export interface GatewayToolsEffectiveGroup {
|
|
766
|
+
id: GatewayToolSource;
|
|
767
|
+
label: string;
|
|
768
|
+
source: GatewayToolSource;
|
|
769
|
+
tools: GatewayToolsEffectiveEntry[];
|
|
770
|
+
}
|
|
771
|
+
export interface GatewayToolsEffectiveNotice {
|
|
772
|
+
id: string;
|
|
773
|
+
severity: "info" | "warning";
|
|
774
|
+
message: string;
|
|
775
|
+
}
|
|
776
|
+
export interface GatewayToolsEffectiveResult {
|
|
777
|
+
agentId: string;
|
|
778
|
+
profile: string;
|
|
779
|
+
groups: GatewayToolsEffectiveGroup[];
|
|
780
|
+
notices?: GatewayToolsEffectiveNotice[];
|
|
781
|
+
}
|
|
782
|
+
export interface GatewayToolsInvokeParams {
|
|
783
|
+
name: string;
|
|
784
|
+
args?: Record<string, unknown>;
|
|
785
|
+
sessionKey?: string;
|
|
786
|
+
agentId?: string;
|
|
787
|
+
confirm?: boolean;
|
|
788
|
+
idempotencyKey?: string;
|
|
789
|
+
conversationReadOrigin?: "direct-operator";
|
|
790
|
+
}
|
|
791
|
+
export interface GatewayToolsInvokeError {
|
|
792
|
+
code: string;
|
|
793
|
+
message: string;
|
|
794
|
+
details?: unknown;
|
|
795
|
+
}
|
|
796
|
+
export interface GatewayToolsInvokeResult {
|
|
797
|
+
ok: boolean;
|
|
798
|
+
toolName: string;
|
|
799
|
+
output?: unknown;
|
|
800
|
+
requiresApproval?: boolean;
|
|
801
|
+
approvalId?: string;
|
|
802
|
+
source?: GatewayToolSource | (string & {});
|
|
803
|
+
error?: GatewayToolsInvokeError;
|
|
804
|
+
}
|
|
805
|
+
export type GatewayCommandSource = "native" | "skill" | "plugin";
|
|
806
|
+
export type GatewayCommandScope = "text" | "native" | "both";
|
|
807
|
+
export type GatewayCommandCategory = "session" | "options" | "status" | "management" | "media" | "tools" | "docks";
|
|
808
|
+
export interface GatewayCommandArgChoice {
|
|
809
|
+
value: string;
|
|
810
|
+
label: string;
|
|
811
|
+
}
|
|
812
|
+
export interface GatewayCommandArg {
|
|
813
|
+
name: string;
|
|
814
|
+
description: string;
|
|
815
|
+
type: "string" | "number" | "boolean";
|
|
816
|
+
required?: boolean;
|
|
817
|
+
choices?: GatewayCommandArgChoice[];
|
|
818
|
+
dynamic?: boolean;
|
|
819
|
+
}
|
|
820
|
+
export interface GatewayCommandEntry {
|
|
821
|
+
name: string;
|
|
822
|
+
nativeName?: string;
|
|
823
|
+
textAliases?: string[];
|
|
824
|
+
description: string;
|
|
825
|
+
category?: GatewayCommandCategory;
|
|
826
|
+
source: GatewayCommandSource;
|
|
827
|
+
scope: GatewayCommandScope;
|
|
828
|
+
acceptsArgs: boolean;
|
|
829
|
+
args?: GatewayCommandArg[];
|
|
830
|
+
}
|
|
831
|
+
export interface GatewayCommandsListParams {
|
|
832
|
+
agentId?: string;
|
|
833
|
+
provider?: string;
|
|
834
|
+
scope?: GatewayCommandScope;
|
|
835
|
+
includeArgs?: boolean;
|
|
836
|
+
}
|
|
837
|
+
export interface GatewayCommandsListResult {
|
|
838
|
+
commands: GatewayCommandEntry[];
|
|
839
|
+
}
|
|
840
|
+
export interface ChannelsStatusParams {
|
|
841
|
+
probe?: boolean;
|
|
842
|
+
timeoutMs?: number;
|
|
843
|
+
channel?: string;
|
|
844
|
+
}
|
|
845
|
+
export interface ChannelsStartParams {
|
|
846
|
+
channel: string;
|
|
847
|
+
accountId?: string;
|
|
848
|
+
}
|
|
849
|
+
export interface ChannelsStartResult {
|
|
850
|
+
channel: string;
|
|
851
|
+
accountId: string;
|
|
852
|
+
started: boolean;
|
|
853
|
+
}
|
|
854
|
+
export interface ChannelsStopParams {
|
|
855
|
+
channel: string;
|
|
856
|
+
accountId?: string;
|
|
857
|
+
}
|
|
858
|
+
export interface ChannelsStopResult {
|
|
859
|
+
channel: string;
|
|
860
|
+
accountId: string;
|
|
861
|
+
stopped: boolean;
|
|
862
|
+
}
|
|
863
|
+
export type ChannelCredentialStatus = "available" | "configured_unavailable" | "missing";
|
|
864
|
+
export interface ChannelAccountSnapshot {
|
|
865
|
+
accountId: string;
|
|
866
|
+
name?: string;
|
|
867
|
+
enabled?: boolean;
|
|
868
|
+
configured?: boolean;
|
|
869
|
+
linked?: boolean;
|
|
870
|
+
running?: boolean;
|
|
871
|
+
connected?: boolean;
|
|
872
|
+
restartPending?: boolean;
|
|
873
|
+
reconnectAttempts?: number;
|
|
874
|
+
lastConnectedAt?: number;
|
|
875
|
+
lastError?: string;
|
|
876
|
+
healthState?: string;
|
|
877
|
+
lastStartAt?: number;
|
|
878
|
+
lastStopAt?: number;
|
|
879
|
+
lastInboundAt?: number;
|
|
880
|
+
lastOutboundAt?: number;
|
|
881
|
+
lastMessageAt?: number | null;
|
|
882
|
+
lastEventAt?: number | null;
|
|
883
|
+
lastTransportActivityAt?: number;
|
|
884
|
+
statusState?: string;
|
|
885
|
+
terminalDisconnect?: boolean;
|
|
886
|
+
busy?: boolean;
|
|
887
|
+
activeRuns?: number;
|
|
888
|
+
lastRunActivityAt?: number;
|
|
889
|
+
lastProbeAt?: number;
|
|
890
|
+
mode?: string;
|
|
891
|
+
dmPolicy?: string;
|
|
892
|
+
allowFrom?: string[];
|
|
893
|
+
tokenSource?: string;
|
|
894
|
+
botTokenSource?: string;
|
|
895
|
+
appTokenSource?: string;
|
|
896
|
+
signingSecretSource?: string;
|
|
897
|
+
userTokenSource?: string;
|
|
898
|
+
tokenStatus?: ChannelCredentialStatus;
|
|
899
|
+
botTokenStatus?: ChannelCredentialStatus;
|
|
900
|
+
appTokenStatus?: ChannelCredentialStatus;
|
|
901
|
+
signingSecretStatus?: ChannelCredentialStatus;
|
|
902
|
+
userTokenStatus?: ChannelCredentialStatus;
|
|
903
|
+
baseUrl?: string;
|
|
904
|
+
allowUnmentionedGroups?: boolean;
|
|
905
|
+
cliPath?: string | null;
|
|
906
|
+
dbPath?: string | null;
|
|
907
|
+
port?: number | null;
|
|
908
|
+
probe?: unknown;
|
|
909
|
+
audit?: unknown;
|
|
910
|
+
application?: unknown;
|
|
911
|
+
[key: string]: unknown;
|
|
912
|
+
}
|
|
913
|
+
export interface ChannelUiMeta {
|
|
914
|
+
id: string;
|
|
915
|
+
label: string;
|
|
916
|
+
detailLabel: string;
|
|
917
|
+
systemImage?: string;
|
|
918
|
+
[key: string]: unknown;
|
|
919
|
+
}
|
|
920
|
+
export interface ChannelEventLoopHealth {
|
|
921
|
+
degraded: boolean;
|
|
922
|
+
reasons: Array<"event_loop_delay" | "event_loop_utilization" | "cpu">;
|
|
923
|
+
intervalMs: number;
|
|
924
|
+
delayP99Ms: number;
|
|
925
|
+
delayMaxMs: number;
|
|
926
|
+
utilization: number;
|
|
927
|
+
cpuCoreRatio: number;
|
|
928
|
+
[key: string]: unknown;
|
|
929
|
+
}
|
|
930
|
+
export interface ChannelsStatusResult {
|
|
931
|
+
ts: number;
|
|
932
|
+
channelOrder: string[];
|
|
933
|
+
channelLabels: Record<string, string>;
|
|
934
|
+
channelDetailLabels?: Record<string, string>;
|
|
935
|
+
channelSystemImages?: Record<string, string>;
|
|
936
|
+
channelMeta?: ChannelUiMeta[];
|
|
937
|
+
channels: Record<string, unknown>;
|
|
938
|
+
channelAccounts: Record<string, ChannelAccountSnapshot[]>;
|
|
939
|
+
channelDefaultAccountId: Record<string, string>;
|
|
940
|
+
eventLoop?: ChannelEventLoopHealth;
|
|
941
|
+
partial?: boolean;
|
|
942
|
+
warnings?: string[];
|
|
943
|
+
[key: string]: unknown;
|
|
944
|
+
}
|
|
945
|
+
export interface GatewayWebLoginStartOptions {
|
|
946
|
+
force?: boolean;
|
|
947
|
+
timeoutMs?: number;
|
|
948
|
+
verbose?: boolean;
|
|
949
|
+
accountId?: string;
|
|
950
|
+
}
|
|
951
|
+
export interface GatewayWebLoginStartResult {
|
|
952
|
+
qrDataUrl?: string;
|
|
953
|
+
message: string;
|
|
954
|
+
connected?: boolean;
|
|
955
|
+
}
|
|
956
|
+
export interface GatewayWebLoginWaitOptions {
|
|
957
|
+
timeoutMs?: number;
|
|
958
|
+
accountId?: string;
|
|
959
|
+
currentQrDataUrl?: string;
|
|
960
|
+
}
|
|
961
|
+
export interface GatewayWebLoginWaitResult {
|
|
962
|
+
connected: boolean;
|
|
963
|
+
message: string;
|
|
964
|
+
qrDataUrl?: string;
|
|
965
|
+
}
|
|
451
966
|
export type GatewayEventHandler = (event: GatewayEvent) => void;
|
|
452
967
|
export type GatewayConnectionStateHandler = (state: GatewayConnectionState) => void;
|
|
968
|
+
export type GatewayClientRequestOptions = {
|
|
969
|
+
expectFinal?: boolean;
|
|
970
|
+
timeoutMs?: number | null;
|
|
971
|
+
signal?: AbortSignal;
|
|
972
|
+
/** Called once for expectFinal requests after an accepted response, before the final result. */
|
|
973
|
+
onAccepted?: (payload: unknown) => void;
|
|
974
|
+
};
|
|
453
975
|
type GatewayErrorShape = {
|
|
454
976
|
code: string;
|
|
455
977
|
message: string;
|
|
456
978
|
details?: unknown;
|
|
457
979
|
};
|
|
980
|
+
export declare function isOpenClawGatewayMethodUnsupported(error: unknown, method?: string): boolean;
|
|
981
|
+
export declare const MIN_GATEWAY_VERSION = 3;
|
|
982
|
+
export declare const MAX_GATEWAY_VERSION = 4;
|
|
458
983
|
export declare function normalizeChatAttachments(attachments?: ChatAttachment[]): GatewayChatAttachmentPayload[] | undefined;
|
|
459
984
|
export declare function extractGatewayChatThinking(message: unknown): string;
|
|
460
985
|
export declare function extractGatewayChatMediaUrls(message: unknown): string[];
|
|
@@ -472,6 +997,11 @@ export declare class GatewayClient {
|
|
|
472
997
|
private url;
|
|
473
998
|
private token?;
|
|
474
999
|
private gatewayToken?;
|
|
1000
|
+
private bootstrapToken?;
|
|
1001
|
+
private deviceToken?;
|
|
1002
|
+
private password?;
|
|
1003
|
+
private approvalRuntimeToken?;
|
|
1004
|
+
private agentRuntimeIdentityToken?;
|
|
475
1005
|
private deploymentId?;
|
|
476
1006
|
private apiKey?;
|
|
477
1007
|
private apiBase?;
|
|
@@ -481,13 +1011,31 @@ export declare class GatewayClient {
|
|
|
481
1011
|
private clientDisplayName?;
|
|
482
1012
|
private clientVersion;
|
|
483
1013
|
private clientPlatform;
|
|
1014
|
+
private clientDeviceFamily?;
|
|
484
1015
|
private clientInstanceId?;
|
|
485
1016
|
private caps;
|
|
1017
|
+
private role;
|
|
1018
|
+
private scopes;
|
|
1019
|
+
private commands?;
|
|
1020
|
+
private permissions?;
|
|
1021
|
+
private pathEnv?;
|
|
1022
|
+
private minProtocol;
|
|
1023
|
+
private maxProtocol;
|
|
486
1024
|
private origin?;
|
|
487
1025
|
private defaultTimeout;
|
|
488
1026
|
private ws;
|
|
489
1027
|
private pending;
|
|
490
1028
|
private eventHandlers;
|
|
1029
|
+
private internalEventHandlers;
|
|
1030
|
+
private internalStreamCloseHandlers;
|
|
1031
|
+
private activeNormalChatStreams;
|
|
1032
|
+
private activeStrictChatStreams;
|
|
1033
|
+
private activeEphemeralSessionKeys;
|
|
1034
|
+
private suppressedEphemeralRunIds;
|
|
1035
|
+
private pendingEphemeralChatAcks;
|
|
1036
|
+
private deferredEphemeralCorrelationEvents;
|
|
1037
|
+
private deferredEphemeralEventsCanRepublish;
|
|
1038
|
+
private suppressUncorrelatedChatEventsUntil;
|
|
491
1039
|
private connectionStateHandlers;
|
|
492
1040
|
private connected;
|
|
493
1041
|
private connectionState;
|
|
@@ -514,6 +1062,7 @@ export declare class GatewayClient {
|
|
|
514
1062
|
private readonly onHello?;
|
|
515
1063
|
private readonly onClose?;
|
|
516
1064
|
private readonly onGap?;
|
|
1065
|
+
private readonly onProtocolError?;
|
|
517
1066
|
private readonly onPairing?;
|
|
518
1067
|
get version(): string | null;
|
|
519
1068
|
get protocol(): number | null;
|
|
@@ -527,6 +1076,18 @@ export declare class GatewayClient {
|
|
|
527
1076
|
private storageScope;
|
|
528
1077
|
/** Subscribe to server-sent events */
|
|
529
1078
|
onEvent(handler: GatewayEventHandler): () => void;
|
|
1079
|
+
private currentEphemeralSessionKeys;
|
|
1080
|
+
private shouldSuppressPublicEvent;
|
|
1081
|
+
private suppressEphemeralRunId;
|
|
1082
|
+
private beginEphemeralChatAcknowledgement;
|
|
1083
|
+
private deferEphemeralCorrelationEvent;
|
|
1084
|
+
private finishEphemeralChatAcknowledgement;
|
|
1085
|
+
private publishPublicEvent;
|
|
1086
|
+
private notifyInternalStreamClose;
|
|
1087
|
+
private interruptNormalChatStreams;
|
|
1088
|
+
private handleForwardSequenceGap;
|
|
1089
|
+
private reportProtocolError;
|
|
1090
|
+
private rejectMalformedPendingResponse;
|
|
530
1091
|
/** Connect and keep reconnecting until stopped */
|
|
531
1092
|
connect(): Promise<void>;
|
|
532
1093
|
start(): Promise<void>;
|
|
@@ -545,12 +1106,18 @@ export declare class GatewayClient {
|
|
|
545
1106
|
private handleMessage;
|
|
546
1107
|
private sendRawRequest;
|
|
547
1108
|
private rpc;
|
|
548
|
-
request<T = any>(method: string, params?: Record<string, any>,
|
|
1109
|
+
request<T = any>(method: string, params?: Record<string, any>, options?: number | null | GatewayClientRequestOptions): Promise<T>;
|
|
549
1110
|
configGet(): Promise<Record<string, any>>;
|
|
550
1111
|
configSchema(): Promise<OpenClawConfigSchemaResponse>;
|
|
1112
|
+
configSchemaLookup(path: string): Promise<OpenClawConfigSchemaLookupResult>;
|
|
551
1113
|
configPatch(patch: Record<string, any>): Promise<void>;
|
|
552
1114
|
configApply(config: Record<string, any>): Promise<void>;
|
|
553
1115
|
configSet(config: Record<string, any>): Promise<void>;
|
|
1116
|
+
configureSlackSocket(config: OpenClawSlackSocketConfiguration, accountId?: string): Promise<void>;
|
|
1117
|
+
configureSlackHttp(config: OpenClawSlackHttpConfiguration, accountId?: string): Promise<void>;
|
|
1118
|
+
configureSlackRelay(options: OpenClawSlackRelayOptions | OpenClawSlackRelayConfiguration, accountId?: string): Promise<void>;
|
|
1119
|
+
configureTelegram(config: OpenClawTelegramConfigPatch, accountId?: string): Promise<void>;
|
|
1120
|
+
configureWhatsapp(config: OpenClawWhatsAppConfigPatch, accountId?: string): Promise<void>;
|
|
554
1121
|
modelsList(): Promise<any[]>;
|
|
555
1122
|
skillsStatus(params?: GatewaySkillsStatusParams): Promise<GatewaySkillsStatusReport>;
|
|
556
1123
|
skillsSearch(params?: GatewaySkillsSearchParams): Promise<GatewaySkillsSearchResult>;
|
|
@@ -564,26 +1131,70 @@ export declare class GatewayClient {
|
|
|
564
1131
|
integrationsStatus(params?: GatewayIntegrationStatusParams): Promise<GatewayIntegrationStatusResult>;
|
|
565
1132
|
integrationsDisconnect(params: GatewayIntegrationDisconnectParams): Promise<GatewayIntegrationDisconnectResult>;
|
|
566
1133
|
waitReady(timeoutMs?: number, options?: GatewayWaitReadyOptions): Promise<Record<string, any>>;
|
|
567
|
-
channelsStatus(probe?: boolean, timeoutMs?: number): Promise<
|
|
1134
|
+
channelsStatus(probe?: boolean, timeoutMs?: number, channel?: string): Promise<ChannelsStatusResult>;
|
|
1135
|
+
channelsStart(channel: string, accountId?: string): Promise<ChannelsStartResult>;
|
|
1136
|
+
channelsStop(channel: string, accountId?: string): Promise<ChannelsStopResult>;
|
|
568
1137
|
channelsLogout(channel: string, accountId?: string): Promise<Record<string, any>>;
|
|
569
|
-
|
|
570
|
-
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
1138
|
+
messageAction<TResult = unknown>(params: GatewayMessageActionParams): Promise<TResult>;
|
|
1139
|
+
send(params: GatewaySendParams): Promise<GatewaySendResult>;
|
|
1140
|
+
readMediaBytes(pathOrUrl: string): Promise<Uint8Array>;
|
|
1141
|
+
pluginsList(): Promise<GatewayPluginsListResult>;
|
|
1142
|
+
pluginsInstall(params: GatewayPluginsInstallParams): Promise<GatewayPluginsInstallResult>;
|
|
1143
|
+
pluginsSetEnabled(params: GatewayPluginsSetEnabledParams): Promise<GatewayPluginsSetEnabledResult>;
|
|
1144
|
+
pluginsUninstall(params: GatewayPluginsUninstallParams): Promise<GatewayPluginsUninstallResult>;
|
|
1145
|
+
pluginsRefresh(): Promise<GatewayPluginsRefreshResult>;
|
|
1146
|
+
toolsCatalog(params?: GatewayToolsCatalogParams): Promise<GatewayToolsCatalogResult>;
|
|
1147
|
+
toolsEffective(params: GatewayToolsEffectiveParams): Promise<GatewayToolsEffectiveResult>;
|
|
1148
|
+
toolsInvoke(params: GatewayToolsInvokeParams): Promise<GatewayToolsInvokeResult>;
|
|
1149
|
+
commandsList(params?: GatewayCommandsListParams): Promise<GatewayCommandsListResult>;
|
|
1150
|
+
webLoginStart(options?: GatewayWebLoginStartOptions): Promise<GatewayWebLoginStartResult>;
|
|
1151
|
+
webLoginWait(options?: GatewayWebLoginWaitOptions): Promise<GatewayWebLoginWaitResult>;
|
|
1152
|
+
sessionsListResult(): Promise<GatewaySessionsListResult>;
|
|
579
1153
|
sessionsList(): Promise<any[]>;
|
|
580
1154
|
sessionsPreview(sessionKey: string, limit?: number): Promise<any[]>;
|
|
1155
|
+
sessionsSubscribe(): Promise<boolean>;
|
|
1156
|
+
sessionsCreate(params?: GatewaySessionCreateParams): Promise<GatewaySessionCreateResult>;
|
|
581
1157
|
sessionsPatch(patch: GatewaySessionPatch): Promise<Record<string, any>>;
|
|
582
1158
|
chatHistory(sessionKey?: string, limit?: number): Promise<any[]>;
|
|
583
1159
|
chatAbort(sessionKey?: string): Promise<void>;
|
|
584
1160
|
sendChat(message: string, sessionKey?: string, agentId?: string, attachments?: ChatAttachment[]): Promise<any>;
|
|
585
|
-
sessionsReset(sessionKey: string, reason?: "new" | "reset"): Promise<
|
|
586
|
-
|
|
1161
|
+
sessionsReset(sessionKey: string, reason?: "new" | "reset"): Promise<string>;
|
|
1162
|
+
createEphemeralChatSession(): Promise<GatewayEphemeralChatSession>;
|
|
1163
|
+
/** Paired nodes known to the gateway. */
|
|
1164
|
+
nodesList(): Promise<any[]>;
|
|
1165
|
+
/** Detailed metadata for one paired node (caps + supported invoke commands). */
|
|
1166
|
+
nodeDescribe(nodeId: string): Promise<any>;
|
|
1167
|
+
/** Pending and paired node-pairing requests. */
|
|
1168
|
+
nodePairList(): Promise<{
|
|
1169
|
+
pending: any[];
|
|
1170
|
+
paired: any[];
|
|
1171
|
+
}>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Approve a pending node pairing (and its declared command surface). This is
|
|
1174
|
+
* the sibling of `device.pair.approve`; it requires `operator.pairing` and,
|
|
1175
|
+
* for command-bearing nodes, `operator.write`/`operator.admin`.
|
|
1176
|
+
*/
|
|
1177
|
+
nodePairApprove(requestId: string): Promise<any>;
|
|
1178
|
+
/** Reject a pending node pairing request. */
|
|
1179
|
+
nodePairReject(requestId: string): Promise<void>;
|
|
1180
|
+
/** Remove an already-paired node from the gateway trust set. */
|
|
1181
|
+
nodePairRemove(nodeId: string): Promise<void>;
|
|
1182
|
+
/** Rename a paired node while preserving its stable node id. */
|
|
1183
|
+
nodeRename(nodeId: string, displayName: string): Promise<void>;
|
|
1184
|
+
/**
|
|
1185
|
+
* Invoke a command on a paired node and return its result. The node must be
|
|
1186
|
+
* connected, have declared `command`, and the command must be allowed by the
|
|
1187
|
+
* gateway policy (declared + approved surface, and/or
|
|
1188
|
+
* `gateway.nodes.allowCommands`).
|
|
1189
|
+
*/
|
|
1190
|
+
nodeInvoke(nodeId: string, command: string, params?: Record<string, any>, timeoutMs?: number): Promise<any>;
|
|
1191
|
+
chatSend(message: string, sessionKey: string, attachments?: ChatAttachment[], options?: {
|
|
1192
|
+
strictCorrelation?: boolean;
|
|
1193
|
+
ephemeralSession?: boolean;
|
|
1194
|
+
captureHistoryBaseline?: boolean;
|
|
1195
|
+
priorAssistantTexts?: string[];
|
|
1196
|
+
}): AsyncGenerator<ChatEvent>;
|
|
1197
|
+
runEphemeralChat(message: string, options?: GatewayEphemeralChatOptions): Promise<string>;
|
|
587
1198
|
filesList(agentId?: string): Promise<any[]>;
|
|
588
1199
|
fileGet(agentId: string, name: string): Promise<string>;
|
|
589
1200
|
fileSet(agentId: string, name: string, content: string): Promise<void>;
|
|
@@ -597,5 +1208,29 @@ export declare class GatewayClient {
|
|
|
597
1208
|
execDeny(execId: string): Promise<void>;
|
|
598
1209
|
status(): Promise<Record<string, any>>;
|
|
599
1210
|
}
|
|
1211
|
+
/** Handler for one node command. Receives decoded params, returns a JSON-serializable payload. */
|
|
1212
|
+
export type NodeCommandHandler = (params: any) => Promise<any> | any;
|
|
1213
|
+
export interface NodeServerOptions extends Omit<GatewayOptions, "role" | "scopes" | "commands" | "clientMode"> {
|
|
1214
|
+
/** Stable node id advertised to operators (defaults to the client instance id). */
|
|
1215
|
+
nodeId?: string;
|
|
1216
|
+
}
|
|
1217
|
+
/**
|
|
1218
|
+
* Serve a node command surface over a gateway connection. Wraps a
|
|
1219
|
+
* {@link GatewayClient} connected as `role: "node"`, subscribes to
|
|
1220
|
+
* `node.invoke.request`, dispatches to the registered handlers, and replies with
|
|
1221
|
+
* `node.invoke.result` (JSON-encoded payload on success, or an error).
|
|
1222
|
+
*/
|
|
1223
|
+
export declare class NodeServer {
|
|
1224
|
+
readonly gateway: GatewayClient;
|
|
1225
|
+
private readonly handlers;
|
|
1226
|
+
private unsubscribe;
|
|
1227
|
+
constructor(commands: Record<string, NodeCommandHandler>, options: NodeServerOptions);
|
|
1228
|
+
/** Connect as a node and start answering invoke requests. Resolves once connected. */
|
|
1229
|
+
start(): Promise<void>;
|
|
1230
|
+
/** Stop answering requests and disconnect. */
|
|
1231
|
+
stop(): void;
|
|
1232
|
+
private handleInvoke;
|
|
1233
|
+
private dispatch;
|
|
1234
|
+
}
|
|
600
1235
|
export {};
|
|
601
1236
|
//# sourceMappingURL=gateway.d.ts.map
|