@hypercli.com/sdk 2026.6.21 → 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.
Files changed (87) hide show
  1. package/README.md +82 -1
  2. package/dist/agent.d.ts +19 -2
  3. package/dist/agent.d.ts.map +1 -1
  4. package/dist/agent.js +24 -0
  5. package/dist/agent.js.map +1 -1
  6. package/dist/agents.d.ts +561 -41
  7. package/dist/agents.d.ts.map +1 -1
  8. package/dist/agents.js +2016 -106
  9. package/dist/agents.js.map +1 -1
  10. package/dist/browser.d.ts +3 -1
  11. package/dist/browser.d.ts.map +1 -1
  12. package/dist/browser.js +9 -2
  13. package/dist/browser.js.map +1 -1
  14. package/dist/channels.d.ts +156 -0
  15. package/dist/channels.d.ts.map +1 -0
  16. package/dist/channels.js +110 -0
  17. package/dist/channels.js.map +1 -0
  18. package/dist/client.d.ts +2 -0
  19. package/dist/client.d.ts.map +1 -1
  20. package/dist/client.js +9 -3
  21. package/dist/client.js.map +1 -1
  22. package/dist/connectors.d.ts +79 -0
  23. package/dist/connectors.d.ts.map +1 -0
  24. package/dist/connectors.js +2 -0
  25. package/dist/connectors.js.map +1 -0
  26. package/dist/http.d.ts +10 -3
  27. package/dist/http.d.ts.map +1 -1
  28. package/dist/http.js +135 -61
  29. package/dist/http.js.map +1 -1
  30. package/dist/index.d.ts +12 -4
  31. package/dist/index.d.ts.map +1 -1
  32. package/dist/index.js +8 -2
  33. package/dist/index.js.map +1 -1
  34. package/dist/keys.d.ts +6 -1
  35. package/dist/keys.d.ts.map +1 -1
  36. package/dist/keys.js +8 -1
  37. package/dist/keys.js.map +1 -1
  38. package/dist/openclaw/channels.d.ts +86 -0
  39. package/dist/openclaw/channels.d.ts.map +1 -0
  40. package/dist/openclaw/channels.js +290 -0
  41. package/dist/openclaw/channels.js.map +1 -0
  42. package/dist/openclaw/connectors.d.ts +61 -0
  43. package/dist/openclaw/connectors.d.ts.map +1 -0
  44. package/dist/openclaw/connectors.js +174 -0
  45. package/dist/openclaw/connectors.js.map +1 -0
  46. package/dist/openclaw/gateway.d.ts +733 -15
  47. package/dist/openclaw/gateway.d.ts.map +1 -1
  48. package/dist/openclaw/gateway.js +1720 -181
  49. package/dist/openclaw/gateway.js.map +1 -1
  50. package/dist/openclaw/skills.d.ts +106 -0
  51. package/dist/openclaw/skills.d.ts.map +1 -0
  52. package/dist/openclaw/skills.js +575 -0
  53. package/dist/openclaw/skills.js.map +1 -0
  54. package/dist/openclaw/slack.d.ts +818 -0
  55. package/dist/openclaw/slack.d.ts.map +1 -0
  56. package/dist/openclaw/slack.js +536 -0
  57. package/dist/openclaw/slack.js.map +1 -0
  58. package/dist/openclaw/whatsapp.d.ts +63 -0
  59. package/dist/openclaw/whatsapp.d.ts.map +1 -0
  60. package/dist/openclaw/whatsapp.js +264 -0
  61. package/dist/openclaw/whatsapp.js.map +1 -0
  62. package/dist/renders.js +11 -11
  63. package/dist/renders.js.map +1 -1
  64. package/dist/skills.d.ts +126 -0
  65. package/dist/skills.d.ts.map +1 -0
  66. package/dist/skills.js +2 -0
  67. package/dist/skills.js.map +1 -0
  68. package/dist/user.d.ts +15 -2
  69. package/dist/user.d.ts.map +1 -1
  70. package/dist/user.js +51 -4
  71. package/dist/user.js.map +1 -1
  72. package/dist/voice-session.d.ts +74 -0
  73. package/dist/voice-session.d.ts.map +1 -0
  74. package/dist/voice-session.js +255 -0
  75. package/dist/voice-session.js.map +1 -0
  76. package/dist/voice.d.ts +27 -3
  77. package/dist/voice.d.ts.map +1 -1
  78. package/dist/voice.js +89 -6
  79. package/dist/voice.js.map +1 -1
  80. package/dist/workspaces.d.ts +181 -0
  81. package/dist/workspaces.d.ts.map +1 -0
  82. package/dist/workspaces.js +495 -0
  83. package/dist/workspaces.js.map +1 -0
  84. package/dist/x402.d.ts.map +1 -1
  85. package/dist/x402.js +1 -2
  86. package/dist/x402.js.map +1 -1
  87. 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: 15000) */
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
  }
@@ -369,13 +521,465 @@ export interface GatewaySkillsUpdateResult {
369
521
  config: Record<string, unknown>;
370
522
  [key: string]: unknown;
371
523
  }
524
+ export interface GatewayIntegrationAuthStartParams {
525
+ integrationId: string;
526
+ scopes?: string[];
527
+ accountId?: string;
528
+ force?: boolean;
529
+ [key: string]: unknown;
530
+ }
531
+ export interface GatewayIntegrationAuthStartResult {
532
+ authId?: string;
533
+ integrationId?: string;
534
+ verificationUri?: string;
535
+ url?: string;
536
+ userCode?: string;
537
+ expiresAt?: string | number;
538
+ intervalMs?: number;
539
+ scopes?: string[];
540
+ instructions?: string;
541
+ [key: string]: unknown;
542
+ }
543
+ export interface GatewayIntegrationAuthStatusParams {
544
+ authId: string;
545
+ integrationId?: string;
546
+ accountId?: string;
547
+ [key: string]: unknown;
548
+ }
549
+ export interface GatewayIntegrationAuthStatusResult {
550
+ status?: string;
551
+ integrationId?: string;
552
+ connectionId?: string;
553
+ accountId?: string;
554
+ accountDisplayName?: string;
555
+ scopes?: string[];
556
+ error?: string;
557
+ [key: string]: unknown;
558
+ }
559
+ export interface GatewayIntegrationStatusEntry {
560
+ configured?: boolean;
561
+ authenticated?: boolean;
562
+ usable?: boolean;
563
+ connectionId?: string;
564
+ accountId?: string;
565
+ accountDisplayName?: string;
566
+ scopes?: string[];
567
+ missingScopes?: string[];
568
+ errorDetail?: string;
569
+ probe?: {
570
+ ok?: boolean;
571
+ code?: string;
572
+ message?: string;
573
+ latencyMs?: number;
574
+ [key: string]: unknown;
575
+ };
576
+ [key: string]: unknown;
577
+ }
578
+ export interface GatewayIntegrationStatusParams {
579
+ integrationId?: string;
580
+ connectionId?: string;
581
+ probe?: boolean;
582
+ timeoutMs?: number;
583
+ [key: string]: unknown;
584
+ }
585
+ export interface GatewayIntegrationStatusResult {
586
+ integrations?: Record<string, GatewayIntegrationStatusEntry>;
587
+ integration?: GatewayIntegrationStatusEntry;
588
+ [key: string]: unknown;
589
+ }
590
+ export interface GatewayIntegrationDisconnectParams {
591
+ integrationId: string;
592
+ connectionId?: string;
593
+ accountId?: string;
594
+ revoke?: boolean;
595
+ [key: string]: unknown;
596
+ }
597
+ export interface GatewayIntegrationDisconnectResult {
598
+ ok: boolean;
599
+ integrationId?: string;
600
+ connectionId?: string;
601
+ [key: string]: unknown;
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
+ }
372
966
  export type GatewayEventHandler = (event: GatewayEvent) => void;
373
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
+ };
374
975
  type GatewayErrorShape = {
375
976
  code: string;
376
977
  message: string;
377
978
  details?: unknown;
378
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;
379
983
  export declare function normalizeChatAttachments(attachments?: ChatAttachment[]): GatewayChatAttachmentPayload[] | undefined;
380
984
  export declare function extractGatewayChatThinking(message: unknown): string;
381
985
  export declare function extractGatewayChatMediaUrls(message: unknown): string[];
@@ -393,6 +997,11 @@ export declare class GatewayClient {
393
997
  private url;
394
998
  private token?;
395
999
  private gatewayToken?;
1000
+ private bootstrapToken?;
1001
+ private deviceToken?;
1002
+ private password?;
1003
+ private approvalRuntimeToken?;
1004
+ private agentRuntimeIdentityToken?;
396
1005
  private deploymentId?;
397
1006
  private apiKey?;
398
1007
  private apiBase?;
@@ -402,13 +1011,31 @@ export declare class GatewayClient {
402
1011
  private clientDisplayName?;
403
1012
  private clientVersion;
404
1013
  private clientPlatform;
1014
+ private clientDeviceFamily?;
405
1015
  private clientInstanceId?;
406
1016
  private caps;
1017
+ private role;
1018
+ private scopes;
1019
+ private commands?;
1020
+ private permissions?;
1021
+ private pathEnv?;
1022
+ private minProtocol;
1023
+ private maxProtocol;
407
1024
  private origin?;
408
1025
  private defaultTimeout;
409
1026
  private ws;
410
1027
  private pending;
411
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;
412
1039
  private connectionStateHandlers;
413
1040
  private connected;
414
1041
  private connectionState;
@@ -435,6 +1062,7 @@ export declare class GatewayClient {
435
1062
  private readonly onHello?;
436
1063
  private readonly onClose?;
437
1064
  private readonly onGap?;
1065
+ private readonly onProtocolError?;
438
1066
  private readonly onPairing?;
439
1067
  get version(): string | null;
440
1068
  get protocol(): number | null;
@@ -448,6 +1076,18 @@ export declare class GatewayClient {
448
1076
  private storageScope;
449
1077
  /** Subscribe to server-sent events */
450
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;
451
1091
  /** Connect and keep reconnecting until stopped */
452
1092
  connect(): Promise<void>;
453
1093
  start(): Promise<void>;
@@ -466,12 +1106,18 @@ export declare class GatewayClient {
466
1106
  private handleMessage;
467
1107
  private sendRawRequest;
468
1108
  private rpc;
469
- request<T = any>(method: string, params?: Record<string, any>, timeout?: number): Promise<T>;
1109
+ request<T = any>(method: string, params?: Record<string, any>, options?: number | null | GatewayClientRequestOptions): Promise<T>;
470
1110
  configGet(): Promise<Record<string, any>>;
471
1111
  configSchema(): Promise<OpenClawConfigSchemaResponse>;
1112
+ configSchemaLookup(path: string): Promise<OpenClawConfigSchemaLookupResult>;
472
1113
  configPatch(patch: Record<string, any>): Promise<void>;
473
1114
  configApply(config: Record<string, any>): Promise<void>;
474
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>;
475
1121
  modelsList(): Promise<any[]>;
476
1122
  skillsStatus(params?: GatewaySkillsStatusParams): Promise<GatewaySkillsStatusReport>;
477
1123
  skillsSearch(params?: GatewaySkillsSearchParams): Promise<GatewaySkillsSearchResult>;
@@ -480,27 +1126,75 @@ export declare class GatewayClient {
480
1126
  skillsSkillCard(params: GatewaySkillsSkillCardParams): Promise<GatewaySkillsSkillCardResult>;
481
1127
  skillsInstall(params: GatewaySkillsInstallParams): Promise<GatewaySkillsInstallResult>;
482
1128
  skillsUpdate(params: GatewaySkillsUpdateParams): Promise<GatewaySkillsUpdateResult>;
1129
+ integrationsAuthStart(params: GatewayIntegrationAuthStartParams): Promise<GatewayIntegrationAuthStartResult>;
1130
+ integrationsAuthStatus(params: GatewayIntegrationAuthStatusParams): Promise<GatewayIntegrationAuthStatusResult>;
1131
+ integrationsStatus(params?: GatewayIntegrationStatusParams): Promise<GatewayIntegrationStatusResult>;
1132
+ integrationsDisconnect(params: GatewayIntegrationDisconnectParams): Promise<GatewayIntegrationDisconnectResult>;
483
1133
  waitReady(timeoutMs?: number, options?: GatewayWaitReadyOptions): Promise<Record<string, any>>;
484
- channelsStatus(probe?: boolean, timeoutMs?: number): Promise<Record<string, any>>;
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>;
485
1137
  channelsLogout(channel: string, accountId?: string): Promise<Record<string, any>>;
486
- webLoginStart(options?: {
487
- force?: boolean;
488
- timeoutMs?: number;
489
- verbose?: boolean;
490
- accountId?: string;
491
- }): Promise<Record<string, any>>;
492
- webLoginWait(options?: {
493
- timeoutMs?: number;
494
- accountId?: string;
495
- }): Promise<Record<string, any>>;
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>;
496
1153
  sessionsList(): Promise<any[]>;
497
1154
  sessionsPreview(sessionKey: string, limit?: number): Promise<any[]>;
1155
+ sessionsSubscribe(): Promise<boolean>;
1156
+ sessionsCreate(params?: GatewaySessionCreateParams): Promise<GatewaySessionCreateResult>;
498
1157
  sessionsPatch(patch: GatewaySessionPatch): Promise<Record<string, any>>;
499
1158
  chatHistory(sessionKey?: string, limit?: number): Promise<any[]>;
500
1159
  chatAbort(sessionKey?: string): Promise<void>;
501
1160
  sendChat(message: string, sessionKey?: string, agentId?: string, attachments?: ChatAttachment[]): Promise<any>;
502
- sessionsReset(sessionKey: string, reason?: "new" | "reset"): Promise<void>;
503
- chatSend(message: string, sessionKey: string, attachments?: ChatAttachment[]): AsyncGenerator<ChatEvent>;
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>;
504
1198
  filesList(agentId?: string): Promise<any[]>;
505
1199
  fileGet(agentId: string, name: string): Promise<string>;
506
1200
  fileSet(agentId: string, name: string, content: string): Promise<void>;
@@ -514,5 +1208,29 @@ export declare class GatewayClient {
514
1208
  execDeny(execId: string): Promise<void>;
515
1209
  status(): Promise<Record<string, any>>;
516
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
+ }
517
1235
  export {};
518
1236
  //# sourceMappingURL=gateway.d.ts.map