@openclaw/feishu 2026.2.21 → 2026.2.23
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/package.json +1 -1
- package/src/bot.checkBotMentioned.test.ts +17 -36
- package/src/bot.test.ts +150 -54
- package/src/bot.ts +40 -10
- package/src/channel.ts +8 -4
- package/src/config-schema.test.ts +22 -0
- package/src/config-schema.ts +27 -41
- package/src/dedup.ts +47 -26
- package/src/media.test.ts +12 -14
- package/src/media.ts +11 -25
- package/src/monitor.webhook-security.test.ts +76 -67
- package/src/onboarding.ts +28 -36
- package/src/policy.test.ts +59 -0
- package/src/policy.ts +39 -3
- package/src/send-target.ts +25 -0
- package/src/send.ts +4 -26
- package/src/streaming-card.ts +22 -27
package/src/streaming-card.ts
CHANGED
|
@@ -132,6 +132,26 @@ export class FeishuStreamingSession {
|
|
|
132
132
|
this.log?.(`Started streaming: cardId=${cardId}, messageId=${sendRes.data.message_id}`);
|
|
133
133
|
}
|
|
134
134
|
|
|
135
|
+
private async updateCardContent(text: string, onError?: (error: unknown) => void): Promise<void> {
|
|
136
|
+
if (!this.state) {
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
const apiBase = resolveApiBase(this.creds.domain);
|
|
140
|
+
this.state.sequence += 1;
|
|
141
|
+
await fetch(`${apiBase}/cardkit/v1/cards/${this.state.cardId}/elements/content/content`, {
|
|
142
|
+
method: "PUT",
|
|
143
|
+
headers: {
|
|
144
|
+
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
145
|
+
"Content-Type": "application/json",
|
|
146
|
+
},
|
|
147
|
+
body: JSON.stringify({
|
|
148
|
+
content: text,
|
|
149
|
+
sequence: this.state.sequence,
|
|
150
|
+
uuid: `s_${this.state.cardId}_${this.state.sequence}`,
|
|
151
|
+
}),
|
|
152
|
+
}).catch((error) => onError?.(error));
|
|
153
|
+
}
|
|
154
|
+
|
|
135
155
|
async update(text: string): Promise<void> {
|
|
136
156
|
if (!this.state || this.closed) {
|
|
137
157
|
return;
|
|
@@ -150,20 +170,7 @@ export class FeishuStreamingSession {
|
|
|
150
170
|
return;
|
|
151
171
|
}
|
|
152
172
|
this.state.currentText = text;
|
|
153
|
-
this.
|
|
154
|
-
const apiBase = resolveApiBase(this.creds.domain);
|
|
155
|
-
await fetch(`${apiBase}/cardkit/v1/cards/${this.state.cardId}/elements/content/content`, {
|
|
156
|
-
method: "PUT",
|
|
157
|
-
headers: {
|
|
158
|
-
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
159
|
-
"Content-Type": "application/json",
|
|
160
|
-
},
|
|
161
|
-
body: JSON.stringify({
|
|
162
|
-
content: text,
|
|
163
|
-
sequence: this.state.sequence,
|
|
164
|
-
uuid: `s_${this.state.cardId}_${this.state.sequence}`,
|
|
165
|
-
}),
|
|
166
|
-
}).catch((e) => this.log?.(`Update failed: ${String(e)}`));
|
|
173
|
+
await this.updateCardContent(text, (e) => this.log?.(`Update failed: ${String(e)}`));
|
|
167
174
|
});
|
|
168
175
|
await this.queue;
|
|
169
176
|
}
|
|
@@ -181,19 +188,7 @@ export class FeishuStreamingSession {
|
|
|
181
188
|
|
|
182
189
|
// Only send final update if content differs from what's already displayed
|
|
183
190
|
if (text && text !== this.state.currentText) {
|
|
184
|
-
this.
|
|
185
|
-
await fetch(`${apiBase}/cardkit/v1/cards/${this.state.cardId}/elements/content/content`, {
|
|
186
|
-
method: "PUT",
|
|
187
|
-
headers: {
|
|
188
|
-
Authorization: `Bearer ${await getToken(this.creds)}`,
|
|
189
|
-
"Content-Type": "application/json",
|
|
190
|
-
},
|
|
191
|
-
body: JSON.stringify({
|
|
192
|
-
content: text,
|
|
193
|
-
sequence: this.state.sequence,
|
|
194
|
-
uuid: `s_${this.state.cardId}_${this.state.sequence}`,
|
|
195
|
-
}),
|
|
196
|
-
}).catch(() => {});
|
|
191
|
+
await this.updateCardContent(text);
|
|
197
192
|
this.state.currentText = text;
|
|
198
193
|
}
|
|
199
194
|
|