@volter/supercode-orchestrator 0.4.17 → 0.4.19
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/adapters/chat-sdk.mjs +9 -5
- package/board/cli.mjs +818 -123
- package/board/dispatch.mjs +423 -31
- package/board/engine.mjs +273 -9
- package/board/store.mjs +7 -2
- package/board.mjs +12 -3
- package/hermes-locks.mjs +9 -1
- package/loop.mjs +1 -1
- package/package.json +1 -1
package/adapters/chat-sdk.mjs
CHANGED
|
@@ -57,7 +57,7 @@
|
|
|
57
57
|
// leaves the IR's queue as the single one. `extra.concurrency` overrides it.
|
|
58
58
|
|
|
59
59
|
import { existsSync, readFileSync } from 'node:fs';
|
|
60
|
-
import { join } from 'node:path';
|
|
60
|
+
import { basename, join } from 'node:path';
|
|
61
61
|
import { parseDotenv } from '../orchestration.mjs';
|
|
62
62
|
import { TOKEN_SCOPES, acquireTokenLock, releaseTokenLock } from '../hermes-locks.mjs';
|
|
63
63
|
import { chunks } from './chunks.mjs';
|
|
@@ -438,15 +438,19 @@ export class ChatSdkAdapter {
|
|
|
438
438
|
// A platform that caps a message's length gets the text in parts, in order, as Hermes's own adapters send it
|
|
439
439
|
// (Discord refuses past 2000 characters, and a fire's report was cut off there). The first part is the handle.
|
|
440
440
|
const limit = MESSAGE_LIMIT[this.platform];
|
|
441
|
+
const parts = limit ? chunks(content.text ?? '', limit) : [content.text ?? ''];
|
|
442
|
+
// files ride with the last part, as the Chat SDK uploads them (`{ markdown, files }`): `{ path }` read here, or `{ data, filename }`
|
|
443
|
+
const files = (content.files ?? []).map((f) => ({ data: f.data ?? readFileSync(f.path), filename: f.filename ?? basename(f.path), ...(f.mime ? { mimeType: f.mime } : {}) }));
|
|
441
444
|
let first;
|
|
442
|
-
for (const [index, text] of
|
|
445
|
+
for (const [index, text] of parts.entries()) {
|
|
446
|
+
const message = files.length && index === parts.length - 1 ? { markdown: text, files } : text;
|
|
443
447
|
let sent;
|
|
444
448
|
if (thread) {
|
|
445
|
-
sent = content.reply_to && index === 0 ? await thread.reply(String(content.reply_to),
|
|
449
|
+
sent = content.reply_to && index === 0 ? await thread.reply(String(content.reply_to), message) : await thread.post(message);
|
|
446
450
|
} else if (threadId) {
|
|
447
|
-
sent = await this.sdkAdapter.postMessage(threadId,
|
|
451
|
+
sent = await this.sdkAdapter.postMessage(threadId, message);
|
|
448
452
|
} else {
|
|
449
|
-
sent = await this.sdkAdapter.postChannelMessage(this.channelId(String(target.chat_id)),
|
|
453
|
+
sent = await this.sdkAdapter.postChannelMessage(this.channelId(String(target.chat_id)), message);
|
|
450
454
|
}
|
|
451
455
|
first ??= sent;
|
|
452
456
|
}
|