Skip to content

feat: add a local Discord protocol sidecar - #7

Merged
Peyton-Spencer merged 8 commits into
feat/discord-media-cachefrom
feat/discord-accessibility-replies
Aug 30, 2026
Merged

feat: add a local Discord protocol sidecar#7
Peyton-Spencer merged 8 commits into
feat/discord-media-cachefrom
feat/discord-accessibility-replies

Conversation

@Peyton-Spencer

@Peyton-Spencer Peyton-Spencer commented Aug 29, 2026

Copy link
Copy Markdown

Summary

Adds a device-local Discord protocol sidecar as the authoritative read/write transport while retaining the existing macOS Accessibility sender as an explicit fallback.

The sidecar is built on the BSD-3-Clause github.com/beeper/discordgo fork. It keeps Discord credentials on the device, connects directly to Discord Gateway/REST, and returns Discord message IDs as authoritative send receipts. No Matrix homeserver or mautrix-discord code is embedded.

Changes

  • add a local Go sidecar with QR remote-auth, reconnect/resume, message fetch, send, replies, and prepared attachment uploads
  • store the Discord credential in the OS credential boundary rather than the ordinary inbox database
  • package/build the sidecar for desktop development and release artifacts
  • add typed desktop IPC and server adapter boundaries
  • retain the fail-closed Accessibility transport for an explicit fallback path only
  • document BSD dependency provenance, AGPL reference boundaries, and Discord account-policy risk
  • add a dedicated Go CI job with formatting, tests, vet, and a Darwin arm64 cross-build

Send guarantees

  • successful protocol sends return the created Discord message ID
  • attachment sends use Discord's prepare/upload/create flow with bounded file count and size
  • idempotency and target identity are explicit inputs
  • ambiguous UI automation never becomes an inferred success

Validation

  • Go tests, vet, and Darwin arm64 build pass locally
  • focused desktop transport tests pass
  • server, web, and desktop typechecks pass on the stack head
  • native sidecar and Accessibility helper build as arm64 Mach-O executables
  • GitHub CI is running on the corrected stacked head

Stack

Layer 2 of 6 in Stack pingdotgg#13, based on #6 (feat/discord-media-cache). Draft only; do not merge until live QR/login/send QA is complete.

Note

Add local Discord protocol sidecar and macOS Accessibility reply transport

  • Adds a Go-based Discord sidecar (native/discord-sidecar/main.go) that runs as a stdio JSON-lines RPC server, supporting QR login, connection restore, conversation/message listing, and message sending with idempotency receipts and attachment uploads (10 files, 25MB/file, 100MB total limits).
  • Adds a TypeScript client (DiscordSidecarClient.ts) and channel adapter (DiscordLocalAdapter.ts) on the server to spawn and communicate with the sidecar, mapping sidecar responses into the Ditto channel contract.
  • Adds a macOS Accessibility helper (main.swift) and desktop transport (DiscordAccessibilityTransport.ts) that drive Discord via deep links and AXUIElement to prepare or send replies, with duplicate detection, concurrency guards, and timeout/cancel support.
  • Wires up desktop IPC handlers, preload bridge, build scripts for mac packaging, and web composer UI changes to show 'Send via Discord' when server-side send is unavailable.
  • Risk: the accessibility helper uses macOS Accessibility APIs and synthesized keypresses; reviewers should check performSend in main.swift and the deep-link validation in discordDeepLink in DiscordAccessibilityTransport.ts for permission and input safety. The sidecar pins discordgo to a Beeper fork commit in go.mod.

Macroscope summarized cdacc00.

@github-actions github-actions Bot added vouch:trusted PR author is trusted by repo permissions or the VOUCHED list. size:XXL labels Aug 29, 2026
@github-actions

github-actions Bot commented Aug 29, 2026

Copy link
Copy Markdown

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

ℹ️ No successful main baseline artifact is available yet. This run establishes the initial measurement.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 13.3 KiB 15.1 KiB
Codex Thread snapshot wire 6.9 KiB 7.3 KiB
Codex Live turn WebSocket wire 6.4 KiB 7.8 KiB
Codex Live turn WebSocket decoded 55.6 KiB 66.4 KiB
Codex Live turn messages 11 21
Claude Total thread wire 13.3 KiB 15.1 KiB
Claude Thread snapshot wire 6.9 KiB 7.3 KiB
Claude Live turn WebSocket wire 6.5 KiB 7.8 KiB
Claude Live turn WebSocket decoded 56.4 KiB 66.4 KiB
Claude Live turn messages 11 21

Baseline: unavailable · PR result: cdacc00 · Source CI: success

Scenario and decoded snapshot size

10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.

  • Codex decoded thread snapshot: 109.4 KiB
  • Claude decoded thread snapshot: 110.1 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@Peyton-Spencer
Peyton-Spencer force-pushed the feat/discord-accessibility-replies branch 2 times, most recently from 333e358 to b9d98ed Compare August 29, 2026 04:45
@Peyton-Spencer
Peyton-Spencer force-pushed the feat/discord-accessibility-replies branch from b9d98ed to 8518787 Compare August 29, 2026 07:32
@Peyton-Spencer
Peyton-Spencer changed the base branch from feat/unified-inbox to feat/discord-media-cache August 29, 2026 07:34
@Peyton-Spencer Peyton-Spencer changed the title feat(desktop): send Discord replies with macOS Accessibility feat: add a local Discord protocol sidecar Aug 29, 2026
@Peyton-Spencer
Peyton-Spencer marked this pull request as ready for review August 30, 2026 18:50
@Peyton-Spencer
Peyton-Spencer merged commit 747ebe9 into feat/unified-inbox Aug 30, 2026
30 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:XXL vouch:trusted PR author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant