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,206 @@
|
|
|
1
|
+
import { setSocket, _Socket, SocketConnectState, } from "./websocket/index.js";
|
|
2
|
+
import { ErrorRes } from "./websocket/streamConnect.js";
|
|
3
|
+
import { BotMsgSocketClient } from "./websocket/service.js";
|
|
4
|
+
import { ChatMessage, ChatMessageContent, MessageType, BotType, SendMessagesRequest, PushMessagesResponse, } from "./proto/capy/botmsg/botmsg_pb.js";
|
|
5
|
+
/**
|
|
6
|
+
* Wrapper class that adapts getSocket() to the StepfunWSClient interface.
|
|
7
|
+
* Maintains backward compatibility with existing code.
|
|
8
|
+
*/
|
|
9
|
+
class StepfunWSClientWrapper {
|
|
10
|
+
socket;
|
|
11
|
+
account;
|
|
12
|
+
onMessage;
|
|
13
|
+
onError;
|
|
14
|
+
onClose;
|
|
15
|
+
isConnectedFlag = false;
|
|
16
|
+
constructor(socket, account) {
|
|
17
|
+
this.socket = socket;
|
|
18
|
+
this.account = account;
|
|
19
|
+
this.setupEventHandlers();
|
|
20
|
+
}
|
|
21
|
+
setupEventHandlers() {
|
|
22
|
+
// Listen for connection events
|
|
23
|
+
this.socket.on("connected", () => {
|
|
24
|
+
this.isConnectedFlag = true;
|
|
25
|
+
});
|
|
26
|
+
this.socket.on("disconnect", () => {
|
|
27
|
+
this.isConnectedFlag = false;
|
|
28
|
+
});
|
|
29
|
+
this.socket.on("close", () => {
|
|
30
|
+
this.isConnectedFlag = false;
|
|
31
|
+
this.onClose?.();
|
|
32
|
+
});
|
|
33
|
+
// Listen for incoming BotMsg messages
|
|
34
|
+
// Module: BotMsg, Command: NewMessage (for push messages)
|
|
35
|
+
this.socket.on("BotMsg/PushMessages", (data) => {
|
|
36
|
+
try {
|
|
37
|
+
if (data instanceof ErrorRes) {
|
|
38
|
+
throw new Error(data.reason);
|
|
39
|
+
}
|
|
40
|
+
const message = PushMessagesResponse.fromBinary(data).messages;
|
|
41
|
+
// console.debug("BotMsg/PushMessages---fromBinary", message);
|
|
42
|
+
if (!message) {
|
|
43
|
+
throw new Error("message is empty");
|
|
44
|
+
}
|
|
45
|
+
const inboundMessage = this.convertToInboundMessage(message);
|
|
46
|
+
this.onMessage?.(inboundMessage);
|
|
47
|
+
}
|
|
48
|
+
catch (err) {
|
|
49
|
+
console.error("[stepfun] Failed to parse incoming message:", err);
|
|
50
|
+
this.onError?.(err instanceof Error ? err : new Error(String(err)));
|
|
51
|
+
}
|
|
52
|
+
});
|
|
53
|
+
// Listen for errors
|
|
54
|
+
this.socket.on("error", (error) => {
|
|
55
|
+
const errorMsg = error instanceof Error ? error.message : JSON.stringify(error);
|
|
56
|
+
this.onError?.(new Error(errorMsg));
|
|
57
|
+
});
|
|
58
|
+
}
|
|
59
|
+
convertToInboundMessage(message) {
|
|
60
|
+
// Handle timestamp - if createdAt is 0 or invalid, use current time
|
|
61
|
+
let timestamp;
|
|
62
|
+
if (message.createdAt) {
|
|
63
|
+
const parsed = new Date(message.createdAt).getTime();
|
|
64
|
+
// Check for invalid date (NaN) or zero/negative timestamps that indicate epoch issues
|
|
65
|
+
timestamp = !isNaN(parsed) && parsed > 0 ? parsed : Date.now();
|
|
66
|
+
}
|
|
67
|
+
else {
|
|
68
|
+
timestamp = Date.now();
|
|
69
|
+
}
|
|
70
|
+
return {
|
|
71
|
+
chatSessionId: message.sessionId,
|
|
72
|
+
type: "text",
|
|
73
|
+
appId: this.account.config.appId || "",
|
|
74
|
+
messageId: message.msgId,
|
|
75
|
+
userId: message.senderUid,
|
|
76
|
+
userName: undefined,
|
|
77
|
+
content: message.content?.content || "",
|
|
78
|
+
timestamp,
|
|
79
|
+
};
|
|
80
|
+
}
|
|
81
|
+
/**
|
|
82
|
+
* Connect to the gateway.
|
|
83
|
+
* Note: Errors are handled via onError callback, not thrown, to ensure
|
|
84
|
+
* the OpenClaw gateway is not affected by connection failures.
|
|
85
|
+
*/
|
|
86
|
+
connect(handlers) {
|
|
87
|
+
this.onMessage = handlers.onMessage;
|
|
88
|
+
this.onError = handlers.onError;
|
|
89
|
+
this.onClose = handlers.onClose;
|
|
90
|
+
// Set auth credentials from config
|
|
91
|
+
const token = this.account.config.appToken;
|
|
92
|
+
const appId = this.account.config.appId;
|
|
93
|
+
if (!token || !appId) {
|
|
94
|
+
// Report error via callback instead of throwing, to avoid affecting the gateway
|
|
95
|
+
const error = new Error("Stepfun appId and appToken are required");
|
|
96
|
+
console.error("[stepfun] Configuration error:", error.message);
|
|
97
|
+
this.onError?.(error);
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
this.socket.setAuth(token, appId);
|
|
101
|
+
// Create connection
|
|
102
|
+
this.socket
|
|
103
|
+
.create("stepfun connect")
|
|
104
|
+
.then(() => {
|
|
105
|
+
console.log("[stepfun] WebSocket connection initiated");
|
|
106
|
+
})
|
|
107
|
+
.catch((err) => {
|
|
108
|
+
const error = err instanceof Error ? err : new Error(String(err));
|
|
109
|
+
console.error("[stepfun] Connection failed:", error.message);
|
|
110
|
+
this.onError?.(error);
|
|
111
|
+
});
|
|
112
|
+
}
|
|
113
|
+
/**
|
|
114
|
+
* Send a message to the gateway.
|
|
115
|
+
* Converts JSON message to Protobuf format.
|
|
116
|
+
*/
|
|
117
|
+
async send(data) {
|
|
118
|
+
const message = data;
|
|
119
|
+
// Get appId from config
|
|
120
|
+
const appId = this.account.config.appId;
|
|
121
|
+
if (!appId) {
|
|
122
|
+
throw new Error("Stepfun appId is required to send messages");
|
|
123
|
+
}
|
|
124
|
+
// Build Protobuf message
|
|
125
|
+
const chatMessage = new ChatMessage({
|
|
126
|
+
appId: appId,
|
|
127
|
+
sessionId: message.chatSessionId,
|
|
128
|
+
senderUid: "0", // Robot sends as 0
|
|
129
|
+
msgType: MessageType.MessageType_BOT_MSG,
|
|
130
|
+
botType: BotType.BotType_OPENCLAW,
|
|
131
|
+
content: new ChatMessageContent({
|
|
132
|
+
content: message.content,
|
|
133
|
+
}),
|
|
134
|
+
});
|
|
135
|
+
// console.debug("send-----", chatMessage);
|
|
136
|
+
const request = new SendMessagesRequest({
|
|
137
|
+
message: chatMessage,
|
|
138
|
+
});
|
|
139
|
+
// Send via BotMsg service
|
|
140
|
+
await BotMsgSocketClient.sendMessages(request);
|
|
141
|
+
}
|
|
142
|
+
/**
|
|
143
|
+
* Close the connection.
|
|
144
|
+
*/
|
|
145
|
+
close() {
|
|
146
|
+
this.socket.disconnect("client close");
|
|
147
|
+
this.isConnectedFlag = false;
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Check if connected.
|
|
151
|
+
*/
|
|
152
|
+
isConnected() {
|
|
153
|
+
return (this.isConnectedFlag && this.socket._state === SocketConnectState.Auth);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
// Global WebSocket client instance
|
|
157
|
+
let wsClient = null;
|
|
158
|
+
let currentAccountConfig = null;
|
|
159
|
+
/**
|
|
160
|
+
* Check if account config has changed (appId or appToken).
|
|
161
|
+
*/
|
|
162
|
+
function hasAccountConfigChanged(newAccount) {
|
|
163
|
+
if (!currentAccountConfig) {
|
|
164
|
+
return true;
|
|
165
|
+
}
|
|
166
|
+
return (currentAccountConfig.config.appId !== newAccount.config.appId ||
|
|
167
|
+
currentAccountConfig.config.appToken !== newAccount.config.appToken);
|
|
168
|
+
}
|
|
169
|
+
/**
|
|
170
|
+
* Get or create WebSocket client.
|
|
171
|
+
* If account config (appId or appToken) has changed, recreates the client with new credentials.
|
|
172
|
+
*/
|
|
173
|
+
export function getStepfunWSClient(account) {
|
|
174
|
+
// If config has changed, close existing client and create new one
|
|
175
|
+
if (wsClient && hasAccountConfigChanged(account)) {
|
|
176
|
+
console.log("[stepfun] Account config changed (appId or appToken), recreating WebSocket client...");
|
|
177
|
+
closeStepfunWSClient();
|
|
178
|
+
}
|
|
179
|
+
if (!wsClient) {
|
|
180
|
+
// Create socket with ignoreCreate to prevent auto-connection before auth is set
|
|
181
|
+
const socket = new _Socket({ ignoreCreate: true });
|
|
182
|
+
// Set auth credentials before any connection attempt
|
|
183
|
+
const token = account.config.appToken;
|
|
184
|
+
const appId = account.config.appId;
|
|
185
|
+
// console.debug("----appId----", appId, token);
|
|
186
|
+
if (token && appId) {
|
|
187
|
+
socket.setAuth(token, appId);
|
|
188
|
+
}
|
|
189
|
+
// Set the socket so getSocket() returns this instance
|
|
190
|
+
setSocket(socket);
|
|
191
|
+
wsClient = new StepfunWSClientWrapper(socket, account);
|
|
192
|
+
currentAccountConfig = account;
|
|
193
|
+
}
|
|
194
|
+
return wsClient;
|
|
195
|
+
}
|
|
196
|
+
/**
|
|
197
|
+
* Close and clear WebSocket client.
|
|
198
|
+
*/
|
|
199
|
+
export function closeStepfunWSClient() {
|
|
200
|
+
if (wsClient) {
|
|
201
|
+
wsClient.close();
|
|
202
|
+
wsClient = null;
|
|
203
|
+
}
|
|
204
|
+
currentAccountConfig = null;
|
|
205
|
+
}
|
|
206
|
+
//# sourceMappingURL=client.js.map
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import type { OpenClawConfig, RuntimeEnv } from "openclaw/plugin-sdk";
|
|
2
|
+
export type MonitorStepfunOpts = {
|
|
3
|
+
config?: OpenClawConfig;
|
|
4
|
+
runtime?: RuntimeEnv;
|
|
5
|
+
abortSignal?: AbortSignal;
|
|
6
|
+
accountId?: string;
|
|
7
|
+
};
|
|
8
|
+
/**
|
|
9
|
+
* Main entry: start monitoring for all enabled accounts.
|
|
10
|
+
* Note: This function should never throw, as plugin failures should not
|
|
11
|
+
* affect the OpenClaw gateway. Errors are logged and the function returns
|
|
12
|
+
* normally even if connections fail.
|
|
13
|
+
*/
|
|
14
|
+
export declare function monitorStepfunProvider(opts?: MonitorStepfunOpts): Promise<void>;
|
|
15
|
+
/**
|
|
16
|
+
* Stop monitoring.
|
|
17
|
+
*/
|
|
18
|
+
export declare function stopStepfunMonitor(): void;
|
|
19
|
+
//# sourceMappingURL=monitor.d.ts.map
|
|
@@ -0,0 +1,153 @@
|
|
|
1
|
+
import { resolveStepfunAccount, listEnabledStepfunAccounts, } from "./accounts.js";
|
|
2
|
+
import { handleStepfunMessage } from "./bot.js";
|
|
3
|
+
import { getStepfunWSClient, closeStepfunWSClient } from "./client.js";
|
|
4
|
+
/**
|
|
5
|
+
* Monitor a single Stepfun account.
|
|
6
|
+
* Note: This function should never reject, as WebSocket connection failures
|
|
7
|
+
* should not affect the OpenClaw gateway. Errors are logged and the connection
|
|
8
|
+
* will be retried automatically.
|
|
9
|
+
*/
|
|
10
|
+
async function monitorSingleAccount(params) {
|
|
11
|
+
const { cfg, account, runtime, abortSignal } = params;
|
|
12
|
+
const { accountId } = account;
|
|
13
|
+
const log = runtime?.log ?? console.log;
|
|
14
|
+
const error = runtime?.error ?? console.error;
|
|
15
|
+
log(`stepfun[${accountId}]: starting WebSocket connection...`);
|
|
16
|
+
// Check if account is properly configured before attempting connection
|
|
17
|
+
if (!account.configured) {
|
|
18
|
+
log(`stepfun[${accountId}]: account not configured (missing appId or appToken), skipping connection`);
|
|
19
|
+
return;
|
|
20
|
+
}
|
|
21
|
+
const wsClient = getStepfunWSClient(account);
|
|
22
|
+
return new Promise((resolve) => {
|
|
23
|
+
const cleanup = () => {
|
|
24
|
+
closeStepfunWSClient();
|
|
25
|
+
};
|
|
26
|
+
const handleAbort = () => {
|
|
27
|
+
log(`stepfun[${accountId}]: abort signal received, stopping`);
|
|
28
|
+
cleanup();
|
|
29
|
+
resolve();
|
|
30
|
+
};
|
|
31
|
+
if (abortSignal?.aborted) {
|
|
32
|
+
cleanup();
|
|
33
|
+
resolve();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
abortSignal?.addEventListener("abort", handleAbort, { once: true });
|
|
37
|
+
try {
|
|
38
|
+
wsClient.connect({
|
|
39
|
+
onMessage: async (data) => {
|
|
40
|
+
try {
|
|
41
|
+
// Parse incoming message from gateway
|
|
42
|
+
const message = data;
|
|
43
|
+
// console.debug("message-----", message);
|
|
44
|
+
// Validate message format
|
|
45
|
+
if (!message.messageId || !message.content) {
|
|
46
|
+
log(`stepfun[${accountId}]: invalid message format, skipping`);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Handle the message
|
|
50
|
+
await handleStepfunMessage({
|
|
51
|
+
cfg,
|
|
52
|
+
message,
|
|
53
|
+
runtime,
|
|
54
|
+
accountId,
|
|
55
|
+
});
|
|
56
|
+
}
|
|
57
|
+
catch (err) {
|
|
58
|
+
error(`stepfun[${accountId}]: error handling message: ${String(err)}`);
|
|
59
|
+
}
|
|
60
|
+
},
|
|
61
|
+
onError: (err) => {
|
|
62
|
+
const errorMsg = err instanceof Error ? err.message : JSON.stringify(err);
|
|
63
|
+
error(`stepfun[${accountId}]: WebSocket error: ${errorMsg}`);
|
|
64
|
+
// Don't reject - let the WebSocket client handle reconnection
|
|
65
|
+
},
|
|
66
|
+
onClose: () => {
|
|
67
|
+
if (abortSignal?.aborted) {
|
|
68
|
+
log(`stepfun[${accountId}]: connection closed (aborted)`);
|
|
69
|
+
cleanup();
|
|
70
|
+
resolve();
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
log(`stepfun[${accountId}]: connection closed, will attempt reconnect`);
|
|
74
|
+
// Don't resolve here - let the WebSocket client handle reconnection
|
|
75
|
+
}
|
|
76
|
+
},
|
|
77
|
+
});
|
|
78
|
+
log(`stepfun[${accountId}]: WebSocket client started`);
|
|
79
|
+
}
|
|
80
|
+
catch (err) {
|
|
81
|
+
// Log the error but don't reject - this ensures the gateway continues running
|
|
82
|
+
// even if the initial connection fails. The WebSocket client will retry.
|
|
83
|
+
const errorMsg = err instanceof Error ? err.message : String(err);
|
|
84
|
+
error(`stepfun[${accountId}]: failed to start WebSocket client: ${errorMsg}`);
|
|
85
|
+
error(`stepfun[${accountId}]: connection will be retried automatically when configured`);
|
|
86
|
+
// Clean up but resolve (not reject) to avoid affecting the gateway
|
|
87
|
+
cleanup();
|
|
88
|
+
abortSignal?.removeEventListener("abort", handleAbort);
|
|
89
|
+
resolve();
|
|
90
|
+
}
|
|
91
|
+
});
|
|
92
|
+
}
|
|
93
|
+
/**
|
|
94
|
+
* Main entry: start monitoring for all enabled accounts.
|
|
95
|
+
* Note: This function should never throw, as plugin failures should not
|
|
96
|
+
* affect the OpenClaw gateway. Errors are logged and the function returns
|
|
97
|
+
* normally even if connections fail.
|
|
98
|
+
*/
|
|
99
|
+
export async function monitorStepfunProvider(opts = {}) {
|
|
100
|
+
const cfg = opts.config;
|
|
101
|
+
if (!cfg) {
|
|
102
|
+
console.error("[stepfun] Config is required for Stepfun monitor");
|
|
103
|
+
return;
|
|
104
|
+
}
|
|
105
|
+
const log = opts.runtime?.log ?? console.log;
|
|
106
|
+
const error = opts.runtime?.error ?? console.error;
|
|
107
|
+
// If accountId is specified, only monitor that account
|
|
108
|
+
if (opts.accountId) {
|
|
109
|
+
const account = resolveStepfunAccount({ cfg, accountId: opts.accountId });
|
|
110
|
+
if (!account.enabled) {
|
|
111
|
+
log(`[stepfun] Account "${opts.accountId}" is disabled, skipping`);
|
|
112
|
+
return;
|
|
113
|
+
}
|
|
114
|
+
if (!account.configured) {
|
|
115
|
+
log(`[stepfun] Account "${opts.accountId}" is not configured (missing appId or appToken), skipping`);
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
return monitorSingleAccount({
|
|
119
|
+
cfg,
|
|
120
|
+
account,
|
|
121
|
+
runtime: opts.runtime,
|
|
122
|
+
abortSignal: opts.abortSignal,
|
|
123
|
+
});
|
|
124
|
+
}
|
|
125
|
+
// Otherwise, start all enabled accounts
|
|
126
|
+
const accounts = listEnabledStepfunAccounts(cfg);
|
|
127
|
+
if (accounts.length === 0) {
|
|
128
|
+
log("[stepfun] No enabled and configured Stepfun accounts found");
|
|
129
|
+
return;
|
|
130
|
+
}
|
|
131
|
+
log(`[stepfun] Starting ${accounts.length} account(s): ${accounts.map((a) => a.accountId).join(", ")}`);
|
|
132
|
+
// Start all accounts in parallel, with error isolation
|
|
133
|
+
// Use Promise.allSettled to ensure one account's failure doesn't affect others
|
|
134
|
+
const results = await Promise.allSettled(accounts.map((account) => monitorSingleAccount({
|
|
135
|
+
cfg,
|
|
136
|
+
account,
|
|
137
|
+
runtime: opts.runtime,
|
|
138
|
+
abortSignal: opts.abortSignal,
|
|
139
|
+
})));
|
|
140
|
+
// Log any failures but don't throw
|
|
141
|
+
results.forEach((result, index) => {
|
|
142
|
+
if (result.status === "rejected") {
|
|
143
|
+
error(`[stepfun] Account ${accounts[index]?.accountId} failed: ${result.reason}`);
|
|
144
|
+
}
|
|
145
|
+
});
|
|
146
|
+
}
|
|
147
|
+
/**
|
|
148
|
+
* Stop monitoring.
|
|
149
|
+
*/
|
|
150
|
+
export function stopStepfunMonitor() {
|
|
151
|
+
closeStepfunWSClient();
|
|
152
|
+
}
|
|
153
|
+
//# sourceMappingURL=monitor.js.map
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v1.8.0 with parameter "target=js+dts"
|
|
2
|
+
// @generated from file capy/botauth/auth_common.proto (package step.capy.botauth, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
|
|
6
|
+
import type { BinaryReadOptions, FieldList, JsonReadOptions, JsonValue, PartialMessage, PlainMessage } from "@bufbuild/protobuf";
|
|
7
|
+
import { Message, proto3 } from "@bufbuild/protobuf";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @generated from enum step.capy.botauth.BotAccountStatus
|
|
11
|
+
*/
|
|
12
|
+
export declare enum BotAccountStatus {
|
|
13
|
+
/**
|
|
14
|
+
* @generated from enum value: Normal = 0;
|
|
15
|
+
*/
|
|
16
|
+
Normal = 0,
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @generated from enum value: Disabled = 1;
|
|
20
|
+
*/
|
|
21
|
+
Disabled = 1,
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* @generated from enum value: Deleted = 100;
|
|
25
|
+
*/
|
|
26
|
+
Deleted = 100,
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/**
|
|
30
|
+
* @generated from message step.capy.botauth.BotAccount
|
|
31
|
+
*/
|
|
32
|
+
export declare class BotAccount extends Message<BotAccount> {
|
|
33
|
+
/**
|
|
34
|
+
* @generated from field: string app_id = 1;
|
|
35
|
+
*/
|
|
36
|
+
appId: string;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @generated from field: string uid = 2;
|
|
40
|
+
*/
|
|
41
|
+
uid: string;
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* @generated from field: string token = 3;
|
|
45
|
+
*/
|
|
46
|
+
token: string;
|
|
47
|
+
|
|
48
|
+
/**
|
|
49
|
+
* @generated from field: string name = 4;
|
|
50
|
+
*/
|
|
51
|
+
name: string;
|
|
52
|
+
|
|
53
|
+
/**
|
|
54
|
+
* @generated from field: step.capy.botauth.BotAccountStatus state = 5;
|
|
55
|
+
*/
|
|
56
|
+
state: BotAccountStatus;
|
|
57
|
+
|
|
58
|
+
/**
|
|
59
|
+
* @generated from field: string created_at = 6;
|
|
60
|
+
*/
|
|
61
|
+
createdAt: string;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* @generated from field: string updated_at = 7;
|
|
65
|
+
*/
|
|
66
|
+
updatedAt: string;
|
|
67
|
+
|
|
68
|
+
constructor(data?: PartialMessage<BotAccount>);
|
|
69
|
+
|
|
70
|
+
static readonly runtime: typeof proto3;
|
|
71
|
+
static readonly typeName = "step.capy.botauth.BotAccount";
|
|
72
|
+
static readonly fields: FieldList;
|
|
73
|
+
|
|
74
|
+
static fromBinary(bytes: Uint8Array, options?: Partial<BinaryReadOptions>): BotAccount;
|
|
75
|
+
|
|
76
|
+
static fromJson(jsonValue: JsonValue, options?: Partial<JsonReadOptions>): BotAccount;
|
|
77
|
+
|
|
78
|
+
static fromJsonString(jsonString: string, options?: Partial<JsonReadOptions>): BotAccount;
|
|
79
|
+
|
|
80
|
+
static equals(a: BotAccount | PlainMessage<BotAccount> | undefined, b: BotAccount | PlainMessage<BotAccount> | undefined): boolean;
|
|
81
|
+
}
|
|
82
|
+
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
// @generated by protoc-gen-es v1.8.0 with parameter "target=js+dts"
|
|
2
|
+
// @generated from file capy/botauth/auth_common.proto (package step.capy.botauth, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
|
|
6
|
+
import { proto3 } from "@bufbuild/protobuf";
|
|
7
|
+
|
|
8
|
+
/**
|
|
9
|
+
* @generated from enum step.capy.botauth.BotAccountStatus
|
|
10
|
+
*/
|
|
11
|
+
export const BotAccountStatus = /*@__PURE__*/ proto3.makeEnum(
|
|
12
|
+
"step.capy.botauth.BotAccountStatus",
|
|
13
|
+
[
|
|
14
|
+
{no: 0, name: "Normal"},
|
|
15
|
+
{no: 1, name: "Disabled"},
|
|
16
|
+
{no: 100, name: "Deleted"},
|
|
17
|
+
],
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
/**
|
|
21
|
+
* @generated from message step.capy.botauth.BotAccount
|
|
22
|
+
*/
|
|
23
|
+
export const BotAccount = /*@__PURE__*/ proto3.makeMessageType(
|
|
24
|
+
"step.capy.botauth.BotAccount",
|
|
25
|
+
() => [
|
|
26
|
+
{ no: 1, name: "app_id", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
27
|
+
{ no: 2, name: "uid", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
28
|
+
{ no: 3, name: "token", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
29
|
+
{ no: 4, name: "name", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
30
|
+
{ no: 5, name: "state", kind: "enum", T: proto3.getEnumType(BotAccountStatus) },
|
|
31
|
+
{ no: 6, name: "created_at", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
32
|
+
{ no: 7, name: "updated_at", kind: "scalar", T: 9 /* ScalarType.STRING */ },
|
|
33
|
+
],
|
|
34
|
+
);
|
|
35
|
+
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
// @generated by protoc-gen-connect-es v1.4.0 with parameter "target=js+dts"
|
|
2
|
+
// @generated from file capy/botauth/botauth.proto (package step.capy.botauth, syntax proto3)
|
|
3
|
+
/* eslint-disable */
|
|
4
|
+
// @ts-nocheck
|
|
5
|
+
|
|
6
|
+
import { BotHeartbeatReq, BotHeartbeatRes, BotLoginReq, BotLoginRes, BotLogoutReq, BotLogoutRes, GetUserBotAccountReq, GetUserBotAccountRes, HeartbeatReq, HeartbeatRes, LoginReq, LoginRes, LogoutReq, LogoutRes, QueryBotReq, QueryBotRes, QueryBotSessionReq, QueryBotSessionRes, QuerySessionReq, QuerySessionRes, QueryUserReq, QueryUserRes } from "./botauth_pb.js";
|
|
7
|
+
import { MethodKind } from "@bufbuild/protobuf";
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* @generated from service step.capy.botauth.Auth
|
|
11
|
+
*/
|
|
12
|
+
export declare const Auth: {
|
|
13
|
+
readonly typeName: "step.capy.botauth.Auth",
|
|
14
|
+
readonly methods: {
|
|
15
|
+
/**
|
|
16
|
+
* @generated from rpc step.capy.botauth.Auth.Login
|
|
17
|
+
*/
|
|
18
|
+
readonly login: {
|
|
19
|
+
readonly name: "Login",
|
|
20
|
+
readonly I: typeof LoginReq,
|
|
21
|
+
readonly O: typeof LoginRes,
|
|
22
|
+
readonly kind: MethodKind.Unary,
|
|
23
|
+
},
|
|
24
|
+
/**
|
|
25
|
+
* @generated from rpc step.capy.botauth.Auth.Logout
|
|
26
|
+
*/
|
|
27
|
+
readonly logout: {
|
|
28
|
+
readonly name: "Logout",
|
|
29
|
+
readonly I: typeof LogoutReq,
|
|
30
|
+
readonly O: typeof LogoutRes,
|
|
31
|
+
readonly kind: MethodKind.Unary,
|
|
32
|
+
},
|
|
33
|
+
/**
|
|
34
|
+
* @generated from rpc step.capy.botauth.Auth.Heartbeat
|
|
35
|
+
*/
|
|
36
|
+
readonly heartbeat: {
|
|
37
|
+
readonly name: "Heartbeat",
|
|
38
|
+
readonly I: typeof HeartbeatReq,
|
|
39
|
+
readonly O: typeof HeartbeatRes,
|
|
40
|
+
readonly kind: MethodKind.Unary,
|
|
41
|
+
},
|
|
42
|
+
/**
|
|
43
|
+
* @generated from rpc step.capy.botauth.Auth.BotLogin
|
|
44
|
+
*/
|
|
45
|
+
readonly botLogin: {
|
|
46
|
+
readonly name: "BotLogin",
|
|
47
|
+
readonly I: typeof BotLoginReq,
|
|
48
|
+
readonly O: typeof BotLoginRes,
|
|
49
|
+
readonly kind: MethodKind.Unary,
|
|
50
|
+
},
|
|
51
|
+
/**
|
|
52
|
+
* @generated from rpc step.capy.botauth.Auth.BotLogout
|
|
53
|
+
*/
|
|
54
|
+
readonly botLogout: {
|
|
55
|
+
readonly name: "BotLogout",
|
|
56
|
+
readonly I: typeof BotLogoutReq,
|
|
57
|
+
readonly O: typeof BotLogoutRes,
|
|
58
|
+
readonly kind: MethodKind.Unary,
|
|
59
|
+
},
|
|
60
|
+
/**
|
|
61
|
+
* @generated from rpc step.capy.botauth.Auth.BotHeartbeat
|
|
62
|
+
*/
|
|
63
|
+
readonly botHeartbeat: {
|
|
64
|
+
readonly name: "BotHeartbeat",
|
|
65
|
+
readonly I: typeof BotHeartbeatReq,
|
|
66
|
+
readonly O: typeof BotHeartbeatRes,
|
|
67
|
+
readonly kind: MethodKind.Unary,
|
|
68
|
+
},
|
|
69
|
+
/**
|
|
70
|
+
* @generated from rpc step.capy.botauth.Auth.QuerySession
|
|
71
|
+
*/
|
|
72
|
+
readonly querySession: {
|
|
73
|
+
readonly name: "QuerySession",
|
|
74
|
+
readonly I: typeof QuerySessionReq,
|
|
75
|
+
readonly O: typeof QuerySessionRes,
|
|
76
|
+
readonly kind: MethodKind.Unary,
|
|
77
|
+
},
|
|
78
|
+
/**
|
|
79
|
+
* @generated from rpc step.capy.botauth.Auth.QueryUser
|
|
80
|
+
*/
|
|
81
|
+
readonly queryUser: {
|
|
82
|
+
readonly name: "QueryUser",
|
|
83
|
+
readonly I: typeof QueryUserReq,
|
|
84
|
+
readonly O: typeof QueryUserRes,
|
|
85
|
+
readonly kind: MethodKind.Unary,
|
|
86
|
+
},
|
|
87
|
+
/**
|
|
88
|
+
* @generated from rpc step.capy.botauth.Auth.QueryBotSession
|
|
89
|
+
*/
|
|
90
|
+
readonly queryBotSession: {
|
|
91
|
+
readonly name: "QueryBotSession",
|
|
92
|
+
readonly I: typeof QueryBotSessionReq,
|
|
93
|
+
readonly O: typeof QueryBotSessionRes,
|
|
94
|
+
readonly kind: MethodKind.Unary,
|
|
95
|
+
},
|
|
96
|
+
/**
|
|
97
|
+
* @generated from rpc step.capy.botauth.Auth.QueryBot
|
|
98
|
+
*/
|
|
99
|
+
readonly queryBot: {
|
|
100
|
+
readonly name: "QueryBot",
|
|
101
|
+
readonly I: typeof QueryBotReq,
|
|
102
|
+
readonly O: typeof QueryBotRes,
|
|
103
|
+
readonly kind: MethodKind.Unary,
|
|
104
|
+
},
|
|
105
|
+
/**
|
|
106
|
+
* 查询数据库
|
|
107
|
+
*
|
|
108
|
+
* @generated from rpc step.capy.botauth.Auth.GetUserBotAccount
|
|
109
|
+
*/
|
|
110
|
+
readonly getUserBotAccount: {
|
|
111
|
+
readonly name: "GetUserBotAccount",
|
|
112
|
+
readonly I: typeof GetUserBotAccountReq,
|
|
113
|
+
readonly O: typeof GetUserBotAccountRes,
|
|
114
|
+
readonly kind: MethodKind.Unary,
|
|
115
|
+
},
|
|
116
|
+
}
|
|
117
|
+
};
|
|
118
|
+
|