a3f75d61ec
Reorganizacion de dev/issues en subcarpetas (completed/, cpp/, gamedev/, kanban/, trading/, imagegen/, matrix/) y cambios acumulados en cmd/fn/pyrunner, .claude/commands y settings. Trabajo de otro LLM/sesion, commiteado a peticion del usuario para desbloquear el working tree. Excluido logs/ardour_mcp_server.log (ruido).
55 lines
2.9 KiB
Markdown
55 lines
2.9 KiB
Markdown
---
|
|
id: "0147"
|
|
title: "matrix-client-pc scaffold: Wails + React+Mantine + login MAS"
|
|
status: pendiente
|
|
priority: alta
|
|
created: 2026-05-24
|
|
related_flows: ["0010"]
|
|
related_issues: ["0148", "0162"]
|
|
dependencies: ["0162"]
|
|
tags: [matrix, wails, react, mantine, mas, oidc, scaffold]
|
|
---
|
|
|
|
## Objetivo
|
|
|
|
Crear el esqueleto de la app `projects/element_agents/apps/matrix_client_pc/` con Wails v2 (Go) + React+Vite+Mantine+`@fn_library` y dejar funcionando el login MAS OIDC contra `mas-...organic-machine.com`. Resultado: arrancar binario -> redirect navegador a MAS -> volver con token -> mostrar perfil del usuario.
|
|
|
|
## Tareas
|
|
|
|
1. `wails init -n matrix_client_pc -t react-ts` dentro de `projects/element_agents/apps/`.
|
|
2. Sub-repo Gitea: `git init -b master` + crear repo `dataforge/matrix_client_pc` + push inicial.
|
|
3. `app.md` con frontmatter (lang=go, framework=wails, tags incluyen `matrix` + `service`? — NO, es app cliente, sin tag service).
|
|
4. `go.mod` con deps: `wails/v2`, `mautrix-go`, `keyring`.
|
|
5. Reemplazar template frontend por React+Mantine+`@fn_library`. Symlink `frontend/src/fn_library` -> `../../../../../frontend/functions/ui/` (o copia si symlink no funciona en build).
|
|
6. Backend Go (`backend/`):
|
|
- `wails.json` con `bindings` para `MatrixService`.
|
|
- `MatrixService.Login() -> URL` (devuelve URL MAS OIDC).
|
|
- `MatrixService.HandleCallback(code) -> User`.
|
|
- `MatrixService.GetSession() -> *Session` (lee de keyring).
|
|
- `MatrixService.Logout()`.
|
|
7. Frontend React: layout `AppShell` Mantine, pagina `Login.tsx` con boton "Sign in with Matrix" -> abre URL MAS en navegador del SO.
|
|
8. Persistencia tokens en keyring SO (`github.com/zalando/go-keyring`).
|
|
9. Loopback HTTP local (`127.0.0.1:0`, puerto libre aleatorio) para recibir callback OIDC.
|
|
10. Test e2e basico: arrancar app, login con `@dev-pc:matrix-af2f3d.organic-machine.com`, ver perfil.
|
|
|
|
## Funciones del registry a crear (delegar a fn-constructor)
|
|
|
|
- `matrix_client_init_go_infra` — `mautrix.NewClient(homeserver, userID, accessToken) -> *Client, error`. Wrapper que configura SQLite store + crypto store.
|
|
- `mas_oidc_flow_go_infra` — `StartFlow(masURL) -> authURL, codeVerifier, state`. `ExchangeCode(code, codeVerifier) -> *Token`.
|
|
- `keyring_save_token_go_infra` / `keyring_load_token_go_infra` — wrappers `go-keyring`.
|
|
|
|
## Acceptance
|
|
|
|
- [ ] Binario Wails compila para linux/amd64 + windows/amd64.
|
|
- [ ] `wails dev` arranca con hot-reload.
|
|
- [ ] Login MAS OIDC end-to-end: boton -> navegador -> consent -> callback -> perfil visible.
|
|
- [ ] Token persistido entre re-arranques (no re-login si token vigente).
|
|
- [ ] `app.md` con `uses_functions` que apunta a las 3 funciones nuevas.
|
|
- [ ] Sub-repo `dataforge/matrix_client_pc` creado con commit inicial.
|
|
|
|
## Notas
|
|
|
|
- MAS URL: leerla de `.well-known/matrix/client` del homeserver para no hardcodear.
|
|
- Refresh token: MAS usa OAuth 2.0 estandar — implementar refresh proactivo (~5min antes de expiry).
|
|
- Gotcha: en Windows, `wails dev` requiere WebView2 instalado.
|