openclaw-stepfun 0.2.2
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/LICENSE +21 -0
- package/README.md +61 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +18 -0
- package/dist/src/accounts.d.ts +22 -0
- package/dist/src/accounts.js +43 -0
- package/dist/src/bot.d.ts +16 -0
- package/dist/src/bot.js +100 -0
- package/dist/src/channel.d.ts +4 -0
- package/dist/src/channel.js +206 -0
- package/dist/src/client.d.ts +51 -0
- package/dist/src/client.js +206 -0
- package/dist/src/monitor.d.ts +19 -0
- package/dist/src/monitor.js +153 -0
- package/dist/src/proto/capy/botauth/auth_common_pb.d.ts +82 -0
- package/dist/src/proto/capy/botauth/auth_common_pb.js +35 -0
- package/dist/src/proto/capy/botauth/botauth_connect.d.ts +118 -0
- package/dist/src/proto/capy/botauth/botauth_connect.js +118 -0
- package/dist/src/proto/capy/botauth/botauth_pb.d.ts +1065 -0
- package/dist/src/proto/capy/botauth/botauth_pb.js +348 -0
- package/dist/src/proto/capy/botauth/public_connect.d.ts +62 -0
- package/dist/src/proto/capy/botauth/public_connect.js +62 -0
- package/dist/src/proto/capy/botauth/public_pb.d.ts +254 -0
- package/dist/src/proto/capy/botauth/public_pb.js +105 -0
- package/dist/src/proto/capy/botmsg/botmsg_connect.d.ts +72 -0
- package/dist/src/proto/capy/botmsg/botmsg_connect.js +72 -0
- package/dist/src/proto/capy/botmsg/botmsg_pb.d.ts +426 -0
- package/dist/src/proto/capy/botmsg/botmsg_pb.js +160 -0
- package/dist/src/proto/capy/botway/ctrl_connect.d.ts +61 -0
- package/dist/src/proto/capy/botway/ctrl_connect.js +61 -0
- package/dist/src/proto/capy/botway/ctrl_pb.d.ts +267 -0
- package/dist/src/proto/capy/botway/ctrl_pb.js +120 -0
- package/dist/src/proto/capy/botway/stream_connect.d.ts +26 -0
- package/dist/src/proto/capy/botway/stream_connect.js +26 -0
- package/dist/src/proto/capy/botway/stream_pb.d.ts +495 -0
- package/dist/src/proto/capy/botway/stream_pb.js +165 -0
- package/dist/src/reply-dispatcher.d.ts +17 -0
- package/dist/src/reply-dispatcher.js +234 -0
- package/dist/src/runtime.d.ts +4 -0
- package/dist/src/runtime.js +11 -0
- package/dist/src/send.d.ts +19 -0
- package/dist/src/send.js +66 -0
- package/dist/src/types.d.ts +65 -0
- package/dist/src/types.js +2 -0
- package/dist/src/websocket/cacheEvent.d.ts +17 -0
- package/dist/src/websocket/cacheEvent.js +61 -0
- package/dist/src/websocket/connect.d.ts +32 -0
- package/dist/src/websocket/connect.js +79 -0
- package/dist/src/websocket/constant.d.ts +8 -0
- package/dist/src/websocket/constant.js +10 -0
- package/dist/src/websocket/eventBus.d.ts +15 -0
- package/dist/src/websocket/eventBus.js +46 -0
- package/dist/src/websocket/index.d.ts +117 -0
- package/dist/src/websocket/index.js +637 -0
- package/dist/src/websocket/service.d.ts +36 -0
- package/dist/src/websocket/service.js +4 -0
- package/dist/src/websocket/stream.d.ts +10 -0
- package/dist/src/websocket/stream.js +24 -0
- package/dist/src/websocket/streamConnect.d.ts +40 -0
- package/dist/src/websocket/streamConnect.js +48 -0
- package/openclaw.plugin.json +23 -0
- package/package.json +69 -0
- package/scripts/setup.mjs +381 -0
- package/scripts/switch-env.mjs +98 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import { ErrorRes } from "./streamConnect.js";
|
|
2
|
+
import { BotAuthBindReq } from "../proto/capy/botway/stream_pb.js";
|
|
3
|
+
import { Event } from "./eventBus.js";
|
|
4
|
+
import { MethodKind } from "@bufbuild/protobuf";
|
|
5
|
+
export declare const uuid: () => string;
|
|
6
|
+
export interface SocketOpts {
|
|
7
|
+
heartbeatTime?: number;
|
|
8
|
+
ignoreCreate?: boolean;
|
|
9
|
+
onAuthErr?: (code?: AuthSocketError) => void;
|
|
10
|
+
onAuthSuccess?: () => void;
|
|
11
|
+
}
|
|
12
|
+
export interface RequestParams {
|
|
13
|
+
module: string;
|
|
14
|
+
command: string;
|
|
15
|
+
body?: Uint8Array;
|
|
16
|
+
type?: MethodKind;
|
|
17
|
+
}
|
|
18
|
+
export interface SocketClient {
|
|
19
|
+
method: string;
|
|
20
|
+
socket: _Socket;
|
|
21
|
+
}
|
|
22
|
+
export declare enum SocketConnectState {
|
|
23
|
+
Initial = "initial",// 初始未连接
|
|
24
|
+
Connecting = "connecting",// 连接中
|
|
25
|
+
Connected = "connected",// 连接成功
|
|
26
|
+
Token = "token",// 获取token成功,打开中
|
|
27
|
+
Auth = "auth",// 鉴权成功
|
|
28
|
+
Disconnect = "disconnect"
|
|
29
|
+
}
|
|
30
|
+
export declare enum AuthState {
|
|
31
|
+
Initial = "initial",
|
|
32
|
+
Anonymous = "anonymous",
|
|
33
|
+
User = "user"
|
|
34
|
+
}
|
|
35
|
+
export declare enum ErrorCode {
|
|
36
|
+
Common = 1,
|
|
37
|
+
Auth = 2,
|
|
38
|
+
Socket = 3,
|
|
39
|
+
Login = -1006
|
|
40
|
+
}
|
|
41
|
+
export declare enum AuthSocketError {
|
|
42
|
+
AuthCodeFail = -1001,
|
|
43
|
+
AuthCodeExpired = -1002,
|
|
44
|
+
AuthCodeBanned = -1003,
|
|
45
|
+
AuthCodeNotActivated = -1004
|
|
46
|
+
}
|
|
47
|
+
export declare enum WebsocketCloseCode {
|
|
48
|
+
CloseCodeNormal = 1000,
|
|
49
|
+
CloseCodeErrorClient = 1001,
|
|
50
|
+
CloseCodeClient = 1006,
|
|
51
|
+
CloseCodeAuthFailed = 4001,
|
|
52
|
+
CloseCodeAuthTimeout = 4002,
|
|
53
|
+
CloseCodeHeartbeatTimeout = 4003,
|
|
54
|
+
CloseCodeSameUserReconnect = 4004,
|
|
55
|
+
CloseCodeKickOut = 4005,
|
|
56
|
+
CloseCodeUserForbidden = 4006,
|
|
57
|
+
CloseCodeParseMsgFailed = 4007,
|
|
58
|
+
CloseCodeServerRestart = 4008
|
|
59
|
+
}
|
|
60
|
+
interface QueueData {
|
|
61
|
+
msgId: string;
|
|
62
|
+
data: RequestParams;
|
|
63
|
+
}
|
|
64
|
+
declare class _Socket {
|
|
65
|
+
_conn: null | WebSocket;
|
|
66
|
+
_state: SocketConnectState;
|
|
67
|
+
_authState: AuthState;
|
|
68
|
+
_sendQueue: QueueData[];
|
|
69
|
+
_connectId: string | null;
|
|
70
|
+
_retryAuthTime: number;
|
|
71
|
+
_retryConnectTime: number;
|
|
72
|
+
_heartHandler: any;
|
|
73
|
+
_requestTasks: Set<unknown>;
|
|
74
|
+
_requestStreams: Set<unknown>;
|
|
75
|
+
auth: BotAuthBindReq | null;
|
|
76
|
+
heartbeatTime: number;
|
|
77
|
+
errorCount: number;
|
|
78
|
+
testCount: number;
|
|
79
|
+
limit: number;
|
|
80
|
+
events: Event<any>;
|
|
81
|
+
onAuthErr?: () => void;
|
|
82
|
+
onAuthSuccess?: () => void;
|
|
83
|
+
constructor(options?: SocketOpts);
|
|
84
|
+
private _customWsUrl?;
|
|
85
|
+
create(scene: string, url?: string): Promise<WebSocket>;
|
|
86
|
+
/**
|
|
87
|
+
* Set custom WebSocket URL
|
|
88
|
+
*/
|
|
89
|
+
setUrl(url: string): void;
|
|
90
|
+
/**
|
|
91
|
+
* Set authentication credentials
|
|
92
|
+
*/
|
|
93
|
+
setAuth(token: string, appId: string): void;
|
|
94
|
+
initAuth(): Promise<void>;
|
|
95
|
+
addConnEvents(): void;
|
|
96
|
+
onError(err: ErrorRes): Promise<void>;
|
|
97
|
+
clearAuth(): void;
|
|
98
|
+
startHeartbeat(): void;
|
|
99
|
+
sendAuth(oMsgId?: string): Promise<unknown>;
|
|
100
|
+
heartbeat(oMsgId?: string | undefined): string;
|
|
101
|
+
send(params: RequestParams, oMsgId?: string | undefined, isAuthPack?: boolean): string;
|
|
102
|
+
disconnect(type: string, onClose?: () => void): void;
|
|
103
|
+
reconnect(scene: string): Promise<void>;
|
|
104
|
+
clearConnection(): void;
|
|
105
|
+
/**
|
|
106
|
+
* 获取 WebSocket 关闭代码的文字说明
|
|
107
|
+
*/
|
|
108
|
+
getCloseReason(code: number): string;
|
|
109
|
+
handleAuthError(code: AuthSocketError): void;
|
|
110
|
+
on(key: string, fn: (args: Uint8Array | ErrorRes) => void): void;
|
|
111
|
+
emit(key: string, args?: object): void;
|
|
112
|
+
}
|
|
113
|
+
export declare let Socket: _Socket | undefined;
|
|
114
|
+
export { _Socket };
|
|
115
|
+
export declare function getSocket(): _Socket;
|
|
116
|
+
export declare function setSocket(socket: _Socket): void;
|
|
117
|
+
//# sourceMappingURL=index.d.ts.map
|