@sider-ai/chrome-openclaw-sider 1.0.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 +75 -0
- package/README.zh_CN.md +108 -0
- package/dist/account-cW9SLuNu.d.ts +75 -0
- package/dist/index.d.ts +12 -0
- package/dist/index.js +87 -0
- package/dist/setup-entry.d.ts +6 -0
- package/dist/setup-entry.js +11 -0
- package/dist/setup-plugin-api.d.ts +7 -0
- package/dist/setup-plugin-api.js +4 -0
- package/dist/src/account.d.ts +6 -0
- package/dist/src/account.js +260 -0
- package/dist/src/auth.d.ts +30 -0
- package/dist/src/auth.js +225 -0
- package/dist/src/channel-auto-title.d.ts +6 -0
- package/dist/src/channel-auto-title.js +102 -0
- package/dist/src/channel-builders.d.ts +105 -0
- package/dist/src/channel-builders.js +238 -0
- package/dist/src/channel-hooks.d.ts +30 -0
- package/dist/src/channel-hooks.js +380 -0
- package/dist/src/channel-monitor.d.ts +34 -0
- package/dist/src/channel-monitor.js +335 -0
- package/dist/src/channel-parts.d.ts +26 -0
- package/dist/src/channel-parts.js +32 -0
- package/dist/src/channel-relay.d.ts +117 -0
- package/dist/src/channel-relay.js +574 -0
- package/dist/src/channel-runtime.d.ts +33 -0
- package/dist/src/channel-runtime.js +138 -0
- package/dist/src/channel-send-result.d.ts +19 -0
- package/dist/src/channel-send-result.js +126 -0
- package/dist/src/channel-send.d.ts +73 -0
- package/dist/src/channel-send.js +291 -0
- package/dist/src/channel-session-model.d.ts +19 -0
- package/dist/src/channel-session-model.js +244 -0
- package/dist/src/channel-shared.d.ts +153 -0
- package/dist/src/channel-shared.js +96 -0
- package/dist/src/channel-state.d.ts +93 -0
- package/dist/src/channel-state.js +475 -0
- package/dist/src/channel-streaming.d.ts +117 -0
- package/dist/src/channel-streaming.js +681 -0
- package/dist/src/channel-types.d.ts +209 -0
- package/dist/src/channel-types.js +40 -0
- package/dist/src/channel-typing.d.ts +17 -0
- package/dist/src/channel-typing.js +79 -0
- package/dist/src/channel-util.d.ts +78 -0
- package/dist/src/channel-util.js +604 -0
- package/dist/src/channel.d.ts +14 -0
- package/dist/src/channel.js +834 -0
- package/dist/src/channel.setup.d.ts +10 -0
- package/dist/src/channel.setup.js +9 -0
- package/dist/src/config.d.ts +18 -0
- package/dist/src/config.js +38 -0
- package/dist/src/inbound-media.d.ts +37 -0
- package/dist/src/inbound-media.js +148 -0
- package/dist/src/media-upload.d.ts +87 -0
- package/dist/src/media-upload.js +1308 -0
- package/dist/src/setup-core.d.ts +72 -0
- package/dist/src/setup-core.js +343 -0
- package/dist/src/user-agent.d.ts +4 -0
- package/dist/src/user-agent.js +6 -0
- package/openclaw.plugin.json +96 -0
- package/package.json +47 -0
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { SiderToolHookPayload } from './channel-types.js';
|
|
2
|
+
import 'openclaw/plugin-sdk';
|
|
3
|
+
import '../account-cW9SLuNu.js';
|
|
4
|
+
import 'openclaw/plugin-sdk/setup';
|
|
5
|
+
import './auth.js';
|
|
6
|
+
import 'openclaw/plugin-sdk/plugin-entry';
|
|
7
|
+
import 'openclaw/plugin-sdk/config-runtime';
|
|
8
|
+
import 'ws';
|
|
9
|
+
|
|
10
|
+
declare function recordSiderPersistedAgentMessage(params: {
|
|
11
|
+
sessionKey?: string;
|
|
12
|
+
message: unknown;
|
|
13
|
+
}): void;
|
|
14
|
+
declare function recordSiderAgentEnd(params: {
|
|
15
|
+
messages?: unknown[];
|
|
16
|
+
error?: string;
|
|
17
|
+
runId?: string;
|
|
18
|
+
success: boolean;
|
|
19
|
+
}): void;
|
|
20
|
+
declare function recordSiderLlmOutputUsage(params: {
|
|
21
|
+
sessionKey?: string;
|
|
22
|
+
runId?: string;
|
|
23
|
+
provider?: string;
|
|
24
|
+
model?: string;
|
|
25
|
+
usage?: unknown;
|
|
26
|
+
lastAssistant?: unknown;
|
|
27
|
+
}): void;
|
|
28
|
+
declare function emitSiderToolHookEvent(params: SiderToolHookPayload): Promise<void>;
|
|
29
|
+
|
|
30
|
+
export { emitSiderToolHookEvent, recordSiderAgentEnd, recordSiderLlmOutputUsage, recordSiderPersistedAgentMessage };
|
|
@@ -0,0 +1,380 @@
|
|
|
1
|
+
import { extractAssistantText } from "openclaw/plugin-sdk/agent-runtime";
|
|
2
|
+
import {
|
|
3
|
+
buildTextPart,
|
|
4
|
+
buildThinkingPart,
|
|
5
|
+
buildToolCallEvent,
|
|
6
|
+
buildToolCallPart,
|
|
7
|
+
buildToolResultEvent,
|
|
8
|
+
buildToolResultPart
|
|
9
|
+
} from "./channel-builders.js";
|
|
10
|
+
import { sendSiderEventBestEffort } from "./channel-relay.js";
|
|
11
|
+
import { logDebug, logWarn } from "./channel-runtime.js";
|
|
12
|
+
import {
|
|
13
|
+
clearBindingRunId,
|
|
14
|
+
clearRelayCallIdForToolEvent,
|
|
15
|
+
discardSiderRunState,
|
|
16
|
+
enqueueCompletedParts,
|
|
17
|
+
flushFinalQueuedPartForRun,
|
|
18
|
+
flushQueuedPartsExceptTailForRun,
|
|
19
|
+
normalizeSessionBindingKey,
|
|
20
|
+
resolveRelayCallIdForToolEvent,
|
|
21
|
+
resolveSiderRunState,
|
|
22
|
+
resolveSiderSessionBinding,
|
|
23
|
+
scheduleQueuedPartFlush,
|
|
24
|
+
updateSiderRunStateContext
|
|
25
|
+
} from "./channel-state.js";
|
|
26
|
+
import {
|
|
27
|
+
addUsageTotals,
|
|
28
|
+
choosePreferredUsageTotals,
|
|
29
|
+
hasUsageTotals,
|
|
30
|
+
parseAssistantOutput,
|
|
31
|
+
parseUsageFromAssistantLike,
|
|
32
|
+
parseUsageTotals,
|
|
33
|
+
toRecord
|
|
34
|
+
} from "./channel-util.js";
|
|
35
|
+
function recordSiderPersistedAgentMessage(params) {
|
|
36
|
+
const binding = resolveSiderSessionBinding(params.sessionKey);
|
|
37
|
+
const runId = binding?.currentRunId;
|
|
38
|
+
if (!runId) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
const message = toRecord(params.message);
|
|
42
|
+
if (!message) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
const role = typeof message.role === "string" ? message.role.trim() : "";
|
|
46
|
+
if (role !== "assistant") {
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
const runState = updateSiderRunStateContext({
|
|
50
|
+
runId,
|
|
51
|
+
sessionKey: params.sessionKey,
|
|
52
|
+
sessionId: binding?.sessionId,
|
|
53
|
+
accountId: binding?.account.accountId,
|
|
54
|
+
provider: typeof message.provider === "string" ? message.provider : void 0,
|
|
55
|
+
model: typeof message.model === "string" ? message.model : void 0
|
|
56
|
+
});
|
|
57
|
+
const directUsage = parseUsageTotals(message.usage);
|
|
58
|
+
if (directUsage && hasUsageTotals(directUsage)) {
|
|
59
|
+
addUsageTotals(runState.usage, directUsage);
|
|
60
|
+
} else if (!hasUsageTotals(runState.usage)) {
|
|
61
|
+
const fallbackUsage = parseUsageFromAssistantLike(message);
|
|
62
|
+
if (fallbackUsage && hasUsageTotals(fallbackUsage)) {
|
|
63
|
+
runState.usage = fallbackUsage;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
const parsed = parseAssistantOutput(message);
|
|
67
|
+
if (!parsed) {
|
|
68
|
+
return;
|
|
69
|
+
}
|
|
70
|
+
const assistantText = extractAssistantText(message).trim() || void 0;
|
|
71
|
+
const stopReason = parsed.stopReason?.trim();
|
|
72
|
+
const stopReasonLower = stopReason?.toLowerCase();
|
|
73
|
+
const shouldTreatAsToolUseMessage = stopReasonLower === "tooluse" || parsed.toolCalls.length > 0 && stopReasonLower !== "error" && stopReasonLower !== "aborted" && !assistantText;
|
|
74
|
+
if (stopReasonLower === "tooluse" && parsed.toolCalls.length === 0) {
|
|
75
|
+
const content = Array.isArray(message.content) ? message.content : [];
|
|
76
|
+
logDebug("assistant toolUse message contained no parsed sider tool calls", {
|
|
77
|
+
runId,
|
|
78
|
+
sessionKey: params.sessionKey,
|
|
79
|
+
contentTypes: content.map((item) => {
|
|
80
|
+
const part = toRecord(item);
|
|
81
|
+
return typeof part?.type === "string" ? part.type : typeof item;
|
|
82
|
+
}),
|
|
83
|
+
contentLength: content.length
|
|
84
|
+
});
|
|
85
|
+
}
|
|
86
|
+
if (shouldTreatAsToolUseMessage) {
|
|
87
|
+
const parts = [];
|
|
88
|
+
if (parsed.thinkingText) {
|
|
89
|
+
parts.push(buildThinkingPart(parsed.thinkingText));
|
|
90
|
+
}
|
|
91
|
+
if (assistantText) {
|
|
92
|
+
parts.push(buildTextPart(assistantText));
|
|
93
|
+
}
|
|
94
|
+
enqueueCompletedParts({
|
|
95
|
+
runId,
|
|
96
|
+
parts,
|
|
97
|
+
sessionKey: params.sessionKey,
|
|
98
|
+
sessionId: binding?.sessionId,
|
|
99
|
+
accountId: binding?.account.accountId,
|
|
100
|
+
provider: runState.provider,
|
|
101
|
+
model: runState.model
|
|
102
|
+
});
|
|
103
|
+
void scheduleQueuedPartFlush({
|
|
104
|
+
runId,
|
|
105
|
+
context: "before_message_write.tool_use"
|
|
106
|
+
});
|
|
107
|
+
return;
|
|
108
|
+
}
|
|
109
|
+
if (parsed.toolCalls.length > 0) {
|
|
110
|
+
logDebug("treat assistant message with tool calls as final sider message", {
|
|
111
|
+
runId,
|
|
112
|
+
sessionKey: params.sessionKey,
|
|
113
|
+
stopReason: parsed.stopReason,
|
|
114
|
+
textLength: assistantText?.length ?? 0,
|
|
115
|
+
toolCallCount: parsed.toolCalls.length
|
|
116
|
+
});
|
|
117
|
+
}
|
|
118
|
+
runState.pendingFinalText = assistantText;
|
|
119
|
+
runState.pendingFinalThinking = parsed.thinkingText;
|
|
120
|
+
runState.pendingFinalStopReason = parsed.stopReason;
|
|
121
|
+
}
|
|
122
|
+
function recordSiderAgentEnd(params) {
|
|
123
|
+
if (params.success || !params.runId) {
|
|
124
|
+
return;
|
|
125
|
+
}
|
|
126
|
+
logDebug("observed unsuccessful agent_end; final sider message remains enabled", {
|
|
127
|
+
runId: params.runId,
|
|
128
|
+
error: params.error?.trim() || void 0,
|
|
129
|
+
messageCount: params.messages?.length ?? 0
|
|
130
|
+
});
|
|
131
|
+
}
|
|
132
|
+
function recordSiderLlmOutputUsage(params) {
|
|
133
|
+
const binding = resolveSiderSessionBinding(params.sessionKey);
|
|
134
|
+
const runId = params.runId || binding?.currentRunId;
|
|
135
|
+
if (!runId) {
|
|
136
|
+
return;
|
|
137
|
+
}
|
|
138
|
+
const existingRunState = resolveSiderRunState(runId);
|
|
139
|
+
if (!existingRunState && binding?.currentRunId !== runId) {
|
|
140
|
+
logDebug("skip llm_output sider usage update: run already cleaned up", {
|
|
141
|
+
runId,
|
|
142
|
+
sessionKey: params.sessionKey,
|
|
143
|
+
provider: params.provider,
|
|
144
|
+
model: params.model
|
|
145
|
+
});
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const runState = existingRunState ?? updateSiderRunStateContext({
|
|
149
|
+
runId,
|
|
150
|
+
sessionKey: params.sessionKey,
|
|
151
|
+
sessionId: binding?.sessionId,
|
|
152
|
+
accountId: binding?.account.accountId
|
|
153
|
+
});
|
|
154
|
+
updateSiderRunStateContext({
|
|
155
|
+
runId,
|
|
156
|
+
sessionKey: params.sessionKey,
|
|
157
|
+
sessionId: binding?.sessionId,
|
|
158
|
+
accountId: binding?.account.accountId,
|
|
159
|
+
provider: params.provider,
|
|
160
|
+
model: params.model
|
|
161
|
+
});
|
|
162
|
+
const parsed = choosePreferredUsageTotals(
|
|
163
|
+
parseUsageTotals(params.usage),
|
|
164
|
+
parseUsageFromAssistantLike(params.lastAssistant)
|
|
165
|
+
);
|
|
166
|
+
if (parsed && hasUsageTotals(parsed)) {
|
|
167
|
+
runState.usage = parsed;
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async function emitSiderToolHookEvent(params) {
|
|
171
|
+
const binding = resolveSiderSessionBinding(params.sessionKey);
|
|
172
|
+
if (!binding) {
|
|
173
|
+
logDebug("skip sider tool hook event: session binding not found", {
|
|
174
|
+
sessionKey: params.sessionKey,
|
|
175
|
+
toolName: params.toolName,
|
|
176
|
+
toolCallId: params.toolCallId,
|
|
177
|
+
phase: params.phase
|
|
178
|
+
});
|
|
179
|
+
return;
|
|
180
|
+
}
|
|
181
|
+
if (params.runId) {
|
|
182
|
+
binding.currentRunId = params.runId;
|
|
183
|
+
}
|
|
184
|
+
const effectiveRunId = params.runId ?? binding.currentRunId;
|
|
185
|
+
const normalizedToolName = (params.toolName ?? "").trim().toLowerCase();
|
|
186
|
+
const toolArgs = toRecord(params.params);
|
|
187
|
+
const currentSessionKey = normalizeSessionBindingKey(params.sessionKey);
|
|
188
|
+
const targetSessionKeyRaw = typeof toolArgs?.sessionKey === "string" ? toolArgs.sessionKey : void 0;
|
|
189
|
+
const targetSessionKey = normalizeSessionBindingKey(targetSessionKeyRaw);
|
|
190
|
+
const hasAttachmentLikeArgs = Boolean(
|
|
191
|
+
toolArgs && [
|
|
192
|
+
"attachments",
|
|
193
|
+
"attachment",
|
|
194
|
+
"media",
|
|
195
|
+
"mediaUrl",
|
|
196
|
+
"mediaUrls",
|
|
197
|
+
"file",
|
|
198
|
+
"files",
|
|
199
|
+
"buffer",
|
|
200
|
+
"content",
|
|
201
|
+
"contentBase64"
|
|
202
|
+
].some((field) => Object.prototype.hasOwnProperty.call(toolArgs, field))
|
|
203
|
+
);
|
|
204
|
+
if (normalizedToolName === "sessions_send" && params.phase === "start") {
|
|
205
|
+
if (hasAttachmentLikeArgs) {
|
|
206
|
+
logWarn("sider observed sessions_send with attachment-like args; sessions_send only forwards text/message args", {
|
|
207
|
+
accountId: binding.account.accountId,
|
|
208
|
+
sessionId: binding.sessionId,
|
|
209
|
+
runId: params.runId,
|
|
210
|
+
sessionKey: params.sessionKey,
|
|
211
|
+
targetSessionKey: targetSessionKeyRaw,
|
|
212
|
+
toolCallId: params.toolCallId
|
|
213
|
+
});
|
|
214
|
+
}
|
|
215
|
+
if (currentSessionKey && targetSessionKey && currentSessionKey === targetSessionKey) {
|
|
216
|
+
logWarn("sider observed sessions_send targeting current session; this often times out while current run is still active", {
|
|
217
|
+
accountId: binding.account.accountId,
|
|
218
|
+
sessionId: binding.sessionId,
|
|
219
|
+
runId: params.runId,
|
|
220
|
+
sessionKey: params.sessionKey,
|
|
221
|
+
targetSessionKey: targetSessionKeyRaw,
|
|
222
|
+
toolCallId: params.toolCallId
|
|
223
|
+
});
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
const callId = resolveRelayCallIdForToolEvent({
|
|
227
|
+
binding,
|
|
228
|
+
phase: params.phase,
|
|
229
|
+
toolCallId: params.toolCallId
|
|
230
|
+
});
|
|
231
|
+
if (params.phase === "start") {
|
|
232
|
+
binding.toolSeq += 1;
|
|
233
|
+
const toolCallEvent = buildToolCallEvent({
|
|
234
|
+
sessionId: binding.sessionId,
|
|
235
|
+
accountId: binding.account.accountId,
|
|
236
|
+
seq: binding.toolSeq,
|
|
237
|
+
callId,
|
|
238
|
+
phase: "start",
|
|
239
|
+
toolName: params.toolName,
|
|
240
|
+
toolCallId: params.toolCallId,
|
|
241
|
+
runId: effectiveRunId,
|
|
242
|
+
sessionKey: params.sessionKey,
|
|
243
|
+
toolArgs: params.params,
|
|
244
|
+
error: params.error,
|
|
245
|
+
durationMs: params.durationMs
|
|
246
|
+
});
|
|
247
|
+
await sendSiderEventBestEffort({
|
|
248
|
+
account: binding.account,
|
|
249
|
+
sessionId: binding.sessionId,
|
|
250
|
+
event: toolCallEvent,
|
|
251
|
+
context: "tool.call.hook.start"
|
|
252
|
+
});
|
|
253
|
+
enqueueCompletedParts({
|
|
254
|
+
runId: effectiveRunId,
|
|
255
|
+
parts: [
|
|
256
|
+
buildToolCallPart({
|
|
257
|
+
callId,
|
|
258
|
+
toolName: params.toolName,
|
|
259
|
+
toolCallId: params.toolCallId,
|
|
260
|
+
runId: effectiveRunId,
|
|
261
|
+
toolArgs: params.params
|
|
262
|
+
})
|
|
263
|
+
],
|
|
264
|
+
sessionKey: params.sessionKey,
|
|
265
|
+
sessionId: binding.sessionId,
|
|
266
|
+
accountId: binding.account.accountId
|
|
267
|
+
});
|
|
268
|
+
void scheduleQueuedPartFlush({
|
|
269
|
+
runId: effectiveRunId,
|
|
270
|
+
context: "tool.call.hook.start"
|
|
271
|
+
});
|
|
272
|
+
}
|
|
273
|
+
if (params.phase !== "start") {
|
|
274
|
+
if (normalizedToolName === "sessions_send") {
|
|
275
|
+
const resultRecord = toRecord(params.result);
|
|
276
|
+
const status = typeof resultRecord?.status === "string" ? resultRecord.status.trim().toLowerCase() : "";
|
|
277
|
+
if (status === "timeout") {
|
|
278
|
+
logWarn("sider observed sessions_send timeout", {
|
|
279
|
+
accountId: binding.account.accountId,
|
|
280
|
+
sessionId: binding.sessionId,
|
|
281
|
+
runId: effectiveRunId,
|
|
282
|
+
sessionKey: params.sessionKey,
|
|
283
|
+
targetSessionKey: targetSessionKeyRaw,
|
|
284
|
+
toolCallId: params.toolCallId,
|
|
285
|
+
error: params.error,
|
|
286
|
+
durationMs: params.durationMs,
|
|
287
|
+
selfTargeted: Boolean(currentSessionKey && targetSessionKey && currentSessionKey === targetSessionKey),
|
|
288
|
+
hasAttachmentLikeArgs
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
binding.toolSeq += 1;
|
|
293
|
+
const toolResultEvent = buildToolResultEvent({
|
|
294
|
+
sessionId: binding.sessionId,
|
|
295
|
+
accountId: binding.account.accountId,
|
|
296
|
+
seq: binding.toolSeq,
|
|
297
|
+
callId,
|
|
298
|
+
toolName: params.toolName,
|
|
299
|
+
toolCallId: params.toolCallId,
|
|
300
|
+
runId: effectiveRunId,
|
|
301
|
+
sessionKey: params.sessionKey,
|
|
302
|
+
toolArgs: params.params,
|
|
303
|
+
result: params.result,
|
|
304
|
+
error: params.error,
|
|
305
|
+
durationMs: params.durationMs
|
|
306
|
+
});
|
|
307
|
+
await sendSiderEventBestEffort({
|
|
308
|
+
account: binding.account,
|
|
309
|
+
sessionId: binding.sessionId,
|
|
310
|
+
event: toolResultEvent,
|
|
311
|
+
context: `tool.result.hook.${params.phase}`
|
|
312
|
+
});
|
|
313
|
+
if (effectiveRunId) {
|
|
314
|
+
enqueueCompletedParts({
|
|
315
|
+
runId: effectiveRunId,
|
|
316
|
+
parts: [
|
|
317
|
+
buildToolResultPart({
|
|
318
|
+
callId,
|
|
319
|
+
toolName: params.toolName,
|
|
320
|
+
toolCallId: params.toolCallId,
|
|
321
|
+
runId: effectiveRunId,
|
|
322
|
+
toolArgs: params.params,
|
|
323
|
+
result: params.result,
|
|
324
|
+
error: params.error,
|
|
325
|
+
durationMs: params.durationMs
|
|
326
|
+
})
|
|
327
|
+
],
|
|
328
|
+
sessionKey: params.sessionKey,
|
|
329
|
+
sessionId: binding.sessionId,
|
|
330
|
+
accountId: binding.account.accountId
|
|
331
|
+
});
|
|
332
|
+
void scheduleQueuedPartFlush({
|
|
333
|
+
runId: effectiveRunId,
|
|
334
|
+
context: `tool.result.hook.${params.phase}`
|
|
335
|
+
});
|
|
336
|
+
const runState = resolveSiderRunState(effectiveRunId);
|
|
337
|
+
if (runState && !runState.managedByReplyPipeline) {
|
|
338
|
+
await flushQueuedPartsExceptTailForRun({
|
|
339
|
+
runId: effectiveRunId,
|
|
340
|
+
account: binding.account,
|
|
341
|
+
sessionId: binding.sessionId,
|
|
342
|
+
context: `tool.result.hook.${params.phase}.standalone.except_tail`
|
|
343
|
+
});
|
|
344
|
+
const finalized = await flushFinalQueuedPartForRun({
|
|
345
|
+
runId: effectiveRunId,
|
|
346
|
+
account: binding.account,
|
|
347
|
+
sessionId: binding.sessionId,
|
|
348
|
+
context: `tool.result.hook.${params.phase}.standalone.final_tail`
|
|
349
|
+
});
|
|
350
|
+
logDebug("finalized standalone sider tool run message tail", {
|
|
351
|
+
runId: effectiveRunId,
|
|
352
|
+
sessionKey: params.sessionKey,
|
|
353
|
+
toolName: params.toolName,
|
|
354
|
+
toolCallId: params.toolCallId,
|
|
355
|
+
finalized
|
|
356
|
+
});
|
|
357
|
+
clearBindingRunId(params.sessionKey, effectiveRunId);
|
|
358
|
+
discardSiderRunState(effectiveRunId);
|
|
359
|
+
}
|
|
360
|
+
} else {
|
|
361
|
+
logDebug("skip sider tool result message part enqueue: run id unavailable", {
|
|
362
|
+
sessionKey: params.sessionKey,
|
|
363
|
+
toolName: params.toolName,
|
|
364
|
+
toolCallId: params.toolCallId,
|
|
365
|
+
phase: params.phase
|
|
366
|
+
});
|
|
367
|
+
}
|
|
368
|
+
clearRelayCallIdForToolEvent({
|
|
369
|
+
binding,
|
|
370
|
+
callId,
|
|
371
|
+
toolCallId: params.toolCallId
|
|
372
|
+
});
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
export {
|
|
376
|
+
emitSiderToolHookEvent,
|
|
377
|
+
recordSiderAgentEnd,
|
|
378
|
+
recordSiderLlmOutputUsage,
|
|
379
|
+
recordSiderPersistedAgentMessage
|
|
380
|
+
};
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { OpenClawConfig } from 'openclaw/plugin-sdk';
|
|
2
|
+
import { R as ResolvedSiderAccount } from '../account-cW9SLuNu.js';
|
|
3
|
+
import { SiderRelayMonitorRegistration, SiderMonitorLogger, SiderInboundRealtimeMessage } from './channel-types.js';
|
|
4
|
+
import 'openclaw/plugin-sdk/setup';
|
|
5
|
+
import './auth.js';
|
|
6
|
+
import 'openclaw/plugin-sdk/plugin-entry';
|
|
7
|
+
import 'openclaw/plugin-sdk/config-runtime';
|
|
8
|
+
import 'ws';
|
|
9
|
+
|
|
10
|
+
declare function monitorSiderSession(params: {
|
|
11
|
+
cfg: OpenClawConfig;
|
|
12
|
+
account: ResolvedSiderAccount;
|
|
13
|
+
abortSignal: AbortSignal;
|
|
14
|
+
log?: SiderMonitorLogger;
|
|
15
|
+
onInboundMessage: (params: {
|
|
16
|
+
cfg: OpenClawConfig;
|
|
17
|
+
account: ResolvedSiderAccount;
|
|
18
|
+
event: SiderInboundRealtimeMessage;
|
|
19
|
+
}) => Promise<void>;
|
|
20
|
+
}): Promise<void>;
|
|
21
|
+
declare function launchManagedRelayMonitor(registration: SiderRelayMonitorRegistration): void;
|
|
22
|
+
declare function runManagedSiderRelayMonitor(params: {
|
|
23
|
+
cfg: OpenClawConfig;
|
|
24
|
+
account: ResolvedSiderAccount;
|
|
25
|
+
abortSignal: AbortSignal;
|
|
26
|
+
log?: SiderMonitorLogger;
|
|
27
|
+
onInboundMessage: (params: {
|
|
28
|
+
cfg: OpenClawConfig;
|
|
29
|
+
account: ResolvedSiderAccount;
|
|
30
|
+
event: SiderInboundRealtimeMessage;
|
|
31
|
+
}) => Promise<void>;
|
|
32
|
+
}): Promise<void>;
|
|
33
|
+
|
|
34
|
+
export { launchManagedRelayMonitor, monitorSiderSession, runManagedSiderRelayMonitor };
|