feat(fleet): F4 Phase 2a — Matrix CS-API connector client + factory #618

Merged
jason.woltje merged 1 commits from feat/f4-matrix-client into main 2026-06-22 16:48:18 +00:00
Owner

F4 Phase 2a — Matrix CS-API connector client + factory (#616)

The Matrix connector behind the F4 abstraction (#617). Speaks the Matrix client-server API directly over HTTPS (injectable fetch, no SDK) — homeserver-agnostic (Conduit default, Synapse alt).

What it does

  • MatrixConnector implements OrchestratorConnector:
    • sendPUT …/rooms/{room}/send/m.room.message/{txn} (thread-aware via m.thread), returns event_id.
    • subscribe/sync long-poll loop driven by the pure parseSyncResponse (skips the orchestrator's own echoes; carries threadId).
    • health/_matrix/client/versions (reachable) + /account/whoami (authed against the configured user).
  • Pure helpers buildMessageBody + parseSyncResponse make send/receive unit-testable without running the loop or a live homeserver.
  • registerMatrixConnector(env) registers the factory; access token from MATRIX_ACCESS_TOKEN, never the roster.

Verification

  • 13 Matrix + 7 registry = 20 connector tests green (send PUT shape + event_id; non-2xx → not-delivered; health reachable/authed/mismatch/unreachable; sync parse incl. self-echo skip + threads; factory build + missing-block guard). tsc/eslint/prettier clean.
  • Still a self-contained connectors/ module — no fleet.ts changes.

Stacking

Stacked on #617 (F4 Phase 1 — the types/registry). Merge order: #617 → this. Rebases onto main after #617 lands (the #617 commit drops, leaving the Matrix-client diff).

Remaining Phase 2 (follow-ups)

init/configure connector-selection UX + roster-parse wiring (touches fleet.ts — after #615 lands to avoid churn); systemd launch wiring so the orchestrator boots on the chosen connector; Conduit deploy guide.

🤖 Generated with Claude Code

## F4 Phase 2a — Matrix CS-API connector client + factory (#616) The Matrix connector behind the F4 abstraction (#617). Speaks the **Matrix client-server API** directly over HTTPS (injectable fetch, no SDK) — homeserver-agnostic (Conduit default, Synapse alt). ### What it does - **`MatrixConnector implements OrchestratorConnector`**: - `send` → `PUT …/rooms/{room}/send/m.room.message/{txn}` (thread-aware via `m.thread`), returns `event_id`. - `subscribe` → `/sync` long-poll loop driven by the pure `parseSyncResponse` (skips the orchestrator's own echoes; carries `threadId`). - `health` → `/_matrix/client/versions` (reachable) + `/account/whoami` (authed against the configured user). - Pure helpers **`buildMessageBody` + `parseSyncResponse`** make send/receive unit-testable without running the loop or a live homeserver. - **`registerMatrixConnector(env)`** registers the factory; access token from **`MATRIX_ACCESS_TOKEN`**, never the roster. ### Verification - **13 Matrix + 7 registry = 20 connector tests** green (send PUT shape + event_id; non-2xx → not-delivered; health reachable/authed/mismatch/unreachable; sync parse incl. self-echo skip + threads; factory build + missing-block guard). tsc/eslint/prettier clean. - Still a **self-contained `connectors/` module** — no `fleet.ts` changes. ### Stacking Stacked on **#617** (F4 Phase 1 — the types/registry). **Merge order: #617 → this.** Rebases onto main after #617 lands (the #617 commit drops, leaving the Matrix-client diff). ### Remaining Phase 2 (follow-ups) init/configure connector-selection UX + roster-parse wiring (touches `fleet.ts` — after #615 lands to avoid churn); systemd launch wiring so the orchestrator boots on the chosen connector; Conduit deploy guide. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
jason.woltje force-pushed feat/f4-matrix-client from aefcc9b5c0 to eed12bd4ba 2026-06-22 16:16:49 +00:00 Compare
jason.woltje merged commit fabc413407 into main 2026-06-22 16:48:18 +00:00
jason.woltje deleted branch feat/f4-matrix-client 2026-06-22 16:48:18 +00:00
Sign in to join this conversation.