feat(platform): Phase 482 message span metadata (v0.8.445)

Add hasAttachment/hasSticker, contentChanged, and wasOwn to message spans.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
Raven Scott
2026-05-24 06:04:23 -04:00
co-authored by Cursor
parent 0940dd9b73
commit 0e049ca053
2 changed files with 17 additions and 4 deletions
+2
View File
@@ -39,6 +39,8 @@ Expose a single `EventEmitter` API the UI drives over IPC (`apps/pearcord/index.
**v0.8.430 (Phase 467):** `voice.leave` span `end` includes `leavingIsStage`; `screen.start` span `end` includes `label`. Bundle: `npm run test:phase467-voice-stage`. See [VOICE.md](../../docs/VOICE.md), [STAGE_CHANNELS.md](../../docs/STAGE_CHANNELS.md).
**v0.8.445 (Phase 482):** `message.send` `hasAttachment`/`hasSticker`; `message.edit` `contentChanged`; `message.delete` `wasOwn`. UI messaging compositor + hints. Bundle: `npm run test:phase482-messaging`. See [MESSAGING.md](../../docs/MESSAGING.md).
**v0.8.444 (Phase 481):** `attachment.stage` `byteLength`/`isImage`; `attachment.read` `fromLocal`; `embed.resolve` `urlLen`. UI attachment compositor + clipboard staging meta. Bundle: `npm run test:phase481-attachments`. See [ATTACHMENTS.md](../../docs/ATTACHMENTS.md), [EMBEDS.md](../../docs/EMBEDS.md).
**v0.8.443 (Phase 480):** `voice.join` `wasInVoice`/`switchedChannel`; `voice.leave` `hadMedia`; `screen.start` `hasLabel`; `screen.stop` `stopped`. UI voice compositor. Bundle: `npm run test:phase480-voice`. See [VOICE.md](../../docs/VOICE.md).
+15 -4
View File
@@ -10767,7 +10767,9 @@ class PearcordPlatform extends EventEmitter {
hasMention: /(?:<@[^>]+>|@\w)/.test(body),
isSlash: body.trimStart().startsWith('/'),
attachmentCount: (opts.attachmentIds || []).length,
stickerCount: (opts.stickerNames || []).length
hasAttachment: (opts.attachmentIds || []).length > 0,
stickerCount: (opts.stickerNames || []).length,
hasSticker: (opts.stickerNames || []).length > 0
})
return msg
} catch (err) {
@@ -10914,13 +10916,15 @@ class PearcordPlatform extends EventEmitter {
if (this.mode === 'dm' && this.dm) this.dm.gossipMessageUpdate(msg)
else if (this.guild) this.guild.gossipMessageUpdate(msg)
this.emit('message', msg)
const nextLength = String(content || '').length
span.end({
messageId: msg?.id,
guildId,
channelId,
contentLength: String(content || '').length,
contentLength: nextLength,
priorLength,
edited: true
edited: true,
contentChanged: priorLength !== nextLength
})
return msg
} catch (err) {
@@ -11620,7 +11624,14 @@ class PearcordPlatform extends EventEmitter {
if (this.mode === 'dm' && this.dm) this.dm.gossipMessageDelete(payload)
else if (this.guild) this.guild.gossipMessageDelete(payload)
this.emit('message-delete', payload)
span.end({ messageId, guildId, channelId, contentLength, hadAttachments })
span.end({
messageId,
guildId,
channelId,
contentLength,
hadAttachments,
wasOwn: existing?.authorId === this.identity?.user?.id
})
} catch (err) {
this.log.error('message.delete error', {
messageId,