@ycodium-ai/plugin-im 0.2.3020 → 0.2.3028
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/dist/index.js +26 -6
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -139119,7 +139119,7 @@ var makeModelPlan = (core, deps) => {
|
|
|
139119
139119
|
};
|
|
139120
139120
|
|
|
139121
139121
|
// src/notifications.ts
|
|
139122
|
-
import { threadOrNull as threadOrNull4 } from "@ycodium-ai/plugin-api";
|
|
139122
|
+
import { readThreadFailed, threadOrNull as threadOrNull4 } from "@ycodium-ai/plugin-api";
|
|
139123
139123
|
|
|
139124
139124
|
// src/notificationTargets.ts
|
|
139125
139125
|
var notificationChatKeys = (state, threadId, projectId) => {
|
|
@@ -139147,6 +139147,28 @@ async function* newestFirst(threads, threadId) {
|
|
|
139147
139147
|
cursor = page.nextCursor;
|
|
139148
139148
|
} while (cursor !== null);
|
|
139149
139149
|
}
|
|
139150
|
+
async function attachmentsOf(threads, threadId, message) {
|
|
139151
|
+
const collected = [...message.attachments ?? []];
|
|
139152
|
+
const total = message.attachmentsTotal ?? collected.length;
|
|
139153
|
+
while (collected.length < total) {
|
|
139154
|
+
let page;
|
|
139155
|
+
try {
|
|
139156
|
+
page = await threads.messages.list({
|
|
139157
|
+
threadId,
|
|
139158
|
+
messageId: message.id,
|
|
139159
|
+
attachmentOffset: collected.length,
|
|
139160
|
+
textLimit: 2
|
|
139161
|
+
});
|
|
139162
|
+
} catch (error) {
|
|
139163
|
+
if (isThreadNotFound(error)) break;
|
|
139164
|
+
throw error;
|
|
139165
|
+
}
|
|
139166
|
+
const more = page.items[0]?.attachments ?? [];
|
|
139167
|
+
if (more.length === 0) break;
|
|
139168
|
+
collected.push(...more);
|
|
139169
|
+
}
|
|
139170
|
+
return collected;
|
|
139171
|
+
}
|
|
139150
139172
|
async function latestMessage(threads, threadId, accept) {
|
|
139151
139173
|
for await (const message of newestFirst(threads, threadId)) {
|
|
139152
139174
|
if (accept(message)) return message;
|
|
@@ -139226,6 +139248,7 @@ var makeNotifications = (core, deps) => {
|
|
|
139226
139248
|
(message) => message.role === "assistant" && message.text.trim() !== ""
|
|
139227
139249
|
);
|
|
139228
139250
|
if (thread !== null && final !== void 0) {
|
|
139251
|
+
const attachments = await attachmentsOf(host.threads, threadId, final);
|
|
139229
139252
|
for (const binding of reporters) {
|
|
139230
139253
|
const text3 = streamsTo(binding, threadId) ? "" : `${thread.title}
|
|
139231
139254
|
|
|
@@ -139234,7 +139257,7 @@ ${final.text}`;
|
|
|
139234
139257
|
await deliver(
|
|
139235
139258
|
owns ? await anchors.anchored(binding, threadId, final.turnId) : binding,
|
|
139236
139259
|
text3,
|
|
139237
|
-
|
|
139260
|
+
attachments
|
|
139238
139261
|
);
|
|
139239
139262
|
}
|
|
139240
139263
|
}
|
|
@@ -139253,10 +139276,7 @@ ${final.text}`;
|
|
|
139253
139276
|
(binding) => !(streamsTo(binding, threadId) && turnCards.covers(threadId))
|
|
139254
139277
|
);
|
|
139255
139278
|
const drawingTurn = turnCards.drawingTurn(threadId);
|
|
139256
|
-
const notice = textTargets.length > 0 || drawingTurn !== null ? failures.forFailure(
|
|
139257
|
-
threadId,
|
|
139258
|
-
(await threadOrNull4(host.threads, threadId).catch(() => null))?.session?.lastError
|
|
139259
|
-
) : null;
|
|
139279
|
+
const notice = textTargets.length > 0 || drawingTurn !== null ? failures.forFailure(threadId, readThreadFailed(event)?.detail) : null;
|
|
139260
139280
|
if (notice !== null && drawingTurn !== null)
|
|
139261
139281
|
failures.holdForCard(threadId, drawingTurn, notice);
|
|
139262
139282
|
for (const binding of targets) {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ycodium-ai/plugin-im",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3028",
|
|
4
4
|
"description": "Talk to your agents from Telegram, WeCom, Lark, or WeChat (experimental).",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"im",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"markdown-it": "^15.0.2",
|
|
33
33
|
"react": "19.2.6",
|
|
34
34
|
"vite-plus": "0.2.2",
|
|
35
|
-
"@ycodium-ai/plugin-api": "0.2.
|
|
35
|
+
"@ycodium-ai/plugin-api": "0.2.3028"
|
|
36
36
|
},
|
|
37
37
|
"ycodium": {
|
|
38
38
|
"plugin": "./dist/index.js",
|