pi-roundtable 0.15.0 → 0.15.1
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/CHANGELOG.md +6 -0
- package/package.json +1 -1
- package/src/core/discord/agent-discord.ts +26 -6
package/CHANGELOG.md
CHANGED
|
@@ -5,6 +5,12 @@ The format follows [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
|
|
|
5
5
|
|
|
6
6
|
## [Unreleased]
|
|
7
7
|
|
|
8
|
+
## [0.15.1] - 2026-10-15
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
|
|
12
|
+
- The agent server's `#dashboard` message is updated again after a restart. The first message was posted as components v2 but later edits left the flag out, and an old v1 message found after a restart could not be edited at all: Discord answered 400 `Invalid Form Body` (`components[0][UNION_TYPE_CHOICES]`), the host logged `dashboard not updated` at every start, and the dashboard was never rebuilt. An edit now keeps the components v2 flag, and a message Discord refuses with that 400 is deleted and posted fresh once; any other failure is still reported.
|
|
13
|
+
|
|
8
14
|
## [0.15.0] - 2026-10-14
|
|
9
15
|
|
|
10
16
|
### Added
|
package/package.json
CHANGED
|
@@ -3,6 +3,7 @@ import {
|
|
|
3
3
|
ChannelType,
|
|
4
4
|
type Client,
|
|
5
5
|
ContainerBuilder,
|
|
6
|
+
DiscordAPIError,
|
|
6
7
|
discordSort,
|
|
7
8
|
type Guild,
|
|
8
9
|
type Message,
|
|
@@ -291,6 +292,15 @@ function channelMessage(message: Message): ChannelMessage {
|
|
|
291
292
|
};
|
|
292
293
|
}
|
|
293
294
|
|
|
295
|
+
/** Discord's 400 "Invalid Form Body": the payload is refused for this message, retrying it as is cannot help. */
|
|
296
|
+
function isInvalidForm(error: unknown): boolean {
|
|
297
|
+
return (
|
|
298
|
+
error instanceof DiscordAPIError &&
|
|
299
|
+
error.status === 400 &&
|
|
300
|
+
error.code === 50035
|
|
301
|
+
);
|
|
302
|
+
}
|
|
303
|
+
|
|
294
304
|
/**
|
|
295
305
|
* `#dashboard` at the top of the agent server and the assistant's one message in it, found again after a
|
|
296
306
|
* restart and made again when either is deleted. The message is pinned when the assistant has the Pin
|
|
@@ -324,6 +334,7 @@ export class DiscordDashboard implements DashboardBoard {
|
|
|
324
334
|
const body = {
|
|
325
335
|
components: [container],
|
|
326
336
|
allowedMentions: { parse: [] },
|
|
337
|
+
flags: MessageFlags.IsComponentsV2 as const,
|
|
327
338
|
};
|
|
328
339
|
const message = this.#message ?? (await this.#find());
|
|
329
340
|
if (message) {
|
|
@@ -333,15 +344,24 @@ export class DiscordDashboard implements DashboardBoard {
|
|
|
333
344
|
return;
|
|
334
345
|
} catch (error) {
|
|
335
346
|
this.#message = undefined;
|
|
336
|
-
// A message deleted by hand is made again
|
|
337
|
-
|
|
347
|
+
// A message deleted by hand is made again, and so is one Discord refuses to edit as
|
|
348
|
+
// components v2 (an old v1 message): it is deleted and posted fresh, once. Anything
|
|
349
|
+
// else is the caller's to log.
|
|
350
|
+
const gone = await this.#gone(message);
|
|
351
|
+
if (!gone && !isInvalidForm(error)) throw error;
|
|
352
|
+
if (!gone)
|
|
353
|
+
await message
|
|
354
|
+
.delete()
|
|
355
|
+
.catch((deleteError: unknown) =>
|
|
356
|
+
this.#logger.warn(
|
|
357
|
+
{ err: deleteError },
|
|
358
|
+
"old dashboard message not deleted; a fresh one is posted beside it",
|
|
359
|
+
),
|
|
360
|
+
);
|
|
338
361
|
}
|
|
339
362
|
}
|
|
340
363
|
const channel = await this.#channel();
|
|
341
|
-
const posted = await channel.send(
|
|
342
|
-
...body,
|
|
343
|
-
flags: MessageFlags.IsComponentsV2,
|
|
344
|
-
});
|
|
364
|
+
const posted = await channel.send(body);
|
|
345
365
|
this.#message = posted;
|
|
346
366
|
await this.#pin(posted);
|
|
347
367
|
}
|