feat(fleet): F4 Phase 2a — Matrix CS-API connector client + factory (#616)
Implements the Matrix connector behind the F4 abstraction (stacked on #617). Speaks the Matrix client-server API directly over HTTPS (injectable fetch, no SDK) so it is homeserver-agnostic (Conduit default, Synapse alt). - MatrixConnector implements OrchestratorConnector: - send → PUT /_matrix/client/v3/rooms/{room}/send/m.room.message/{txn} (thread-aware via m.thread relation), 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). - Pure helpers buildMessageBody + parseSyncResponse → send/receive unit-testable. - registerMatrixConnector(env) registers the factory; the access token comes from MATRIX_ACCESS_TOKEN, never the roster. Verified: 13 Matrix + 7 registry = 20 connector tests green; tsc/eslint/prettier clean. Still a self-contained connectors/ module (no fleet.ts changes). Stacked on #617 (F4 Phase 1). Merge order: #617 -> this; rebases onto main after. Refs #616, #613 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01EsgTQzV5YUGk1JtCLP4B83
This commit is contained in:
@@ -61,4 +61,4 @@ Active workstream is **W1 — Federation v1**. Workers should:
|
||||
|
||||
## F4 — Orchestrator chat connector + Matrix (#616) — feat/f4-matrix-connector
|
||||
|
||||
- Status: Phase 1 done (abstraction + scaffold). Connector interface (send/subscribe/health) + registry + roster connector schema + design doc; tmux default/back-compat; matrix/discord factories are Phase 2. 7 tests green; no fleet.ts changes (independent of #615). Detail: scratchpads/f4-matrix-connector.md.
|
||||
- Status: Phase 1 done (abstraction + scaffold). Connector interface (send/subscribe/health) + registry + roster connector schema + design doc; tmux default/back-compat; matrix factory + CS-API client landed (Phase 2a, #617-stacked); 20 connector tests green; no fleet.ts changes (independent of #615). Detail: scratchpads/f4-matrix-connector.md.
|
||||
|
||||
@@ -17,3 +17,14 @@
|
||||
## Phase 2+ (follow-ups, in the doc)
|
||||
|
||||
Matrix CS-API client (fetch send/sync/health) + factory; init/configure connector-selection UX + roster-parse wiring; systemd launch wiring; Conduit deploy guide; first-party Mosaic Discord (threads) as a connector.
|
||||
|
||||
## Phase 2a (feat/f4-matrix-client, stacked on #617) — Matrix CS-API client
|
||||
|
||||
- `src/fleet/connectors/matrix.ts`: `MatrixConnector implements OrchestratorConnector` over the Matrix
|
||||
client-server API (injectable fetch, no SDK). `send` → PUT m.room.message (thread-aware); `subscribe`
|
||||
→ /sync long-poll loop using the pure `parseSyncResponse`; `health` → /versions + /whoami.
|
||||
`registerMatrixConnector(env)` registers the factory (token from MATRIX_ACCESS_TOKEN, never roster).
|
||||
- Pure helpers `buildMessageBody` + `parseSyncResponse` make send/receive unit-testable.
|
||||
- 13 Matrix tests + 7 registry = 20 connector tests green; tsc/eslint/prettier clean.
|
||||
- Remaining Phase 2: init/configure connector-selection UX + roster-parse wiring (touches fleet.ts —
|
||||
after #615); systemd launch wiring; Conduit deploy guide.
|
||||
|
||||
Reference in New Issue
Block a user