BlueGit

ict rusty-teams

Files

rusty-teams / docs / decisions / 0024-kvt-cards-and-sleutels-link.md

0024-kvt-cards-and-sleutels-link.md

0024-kvt-cards-and-sleutels-link.md 5.5 KiB Download Raw

--- status: proposed date: 2026-11-28 ---

ADR 0024: KVT fork, Business Central cards through sleutels.kvt.nl

This record belongs to the KVT fork (KVT-FORK.md), not to upstream.

Context

KVT colleagues paste Business Central links (projects, work orders, contracts, customers, components, items) into chats. Those links open the BC web client and show nothing in the chat itself. Mímir on sleutels.kvt.nl already reads BC with the reader's own rights. The app needs a personal credential for Mímir that is not the Teams or Graph token.

Options for the credential were: reuse the Teams/Graph token (wrong audience, and it would hand a Microsoft token to a KVT server), a shared API key (no per-user rights), or a personal app token from the shared KVT Login through a browser flow.

Options for where that browser flow runs were: the system browser (a second Microsoft sign-in) or the app's own session browser, which is already signed in to Microsoft (ADR 0003).

Options for the message format were: an own card format, or a plain link with readable text.

Decision

  • The Login issues a personal, revocable app token (sat_…, expires 90 days after last use, scopes mimir.cards asclepius ponos daedalus) through RFC 8252: PKCE S256, a loopback redirect to 127.0.0.1, a one-time code. The token sits in the OS keyring (service rusty-teams.kvt-sleutels), never in SQLite or logs.
  • Connecting runs in a background tab of the session browser on Linux and macOS. The Login's Entra SSO then passes without asking. The app clicks «Koppelen» on the Login consent page, because the user already pressed «Connect» in Settings. When the page needs the user (account picker, MFA, password) or stalls, the app closes the tab and opens the same link in the system browser. On Windows the WebView2 host has no CDP tabs; the connect page opens in a window of the host instead (DialogMode::Page, same profile, so the Microsoft session is there). The user clicks «Koppelen» there and the app closes the window when the code arrives. If the window cannot open, the system browser.
  • No Teams or Graph token goes to the Login or Mímir.
  • A message keeps a plain HTML link with readable text (Werkorder WO… - description). Official Teams shows a normal link; Rusty Teams shows up to three cards under the text. Details load only when the card is opened, with the reader's own token.

Consequences

  • Others see nothing unusual (GUARDRAILS: no own message formats).
  • While the background tab passes login.microsoftonline.com, the session browser briefly reports a login page. The tab is closed after eight seconds on a Microsoft page, so a stuck sign-in cannot keep the Teams login window logic busy.
  • Chrome strings are English and German (ADR 0008); field labels and values come from Mímir in Dutch.
  • A token stays valid until it expires or is revoked (Settings > Disconnect, or «Gekoppelde apps» on the Login). Nothing revokes it automatically when someone leaves.

Addendum: Asclepius, Ponos and Daedalus (same release)

  • The same app token also serves Ponos (scope ponos) and Daedalus (scope daedalus). Ponos accepts a sat_… bearer only for a fixed list of task actions (navigation, list, get, create, status, complete, message), so a stolen token cannot mint API keys or change groups.
  • «Create Asclepius ticket» needs no token: it opens the existing new-ticket form with new_title and new_description prefilled. The user picks the category and saves in Asclepius, so nothing is filed without them seeing it.
  • «Create Ponos task» and «My tasks» call Ponos directly; the dialog lists only groups where the user may create tasks.
  • The Daedalus planning is a read-only calendar source (CalendarSource::Ics, calendar «Daedalus»), so the calendar offers no RSVP or delete for it. Daedalus had no ICS subscription to reuse, so a small JSON endpoint was added; its format=ics output also needs the bearer header, which plain calendar apps cannot send. The endpoint shows only the user's own work orders, without memos or materials. When BC fails, the planning is empty rather than an error. It is on by default and can be turned off in Settings.
  • The Asclepius embed view and a virtual Asclepius team are not part of this release.

Addendum: Ponos tile and board (next release)

  • Tim asked for Ponos in the navigation rail, right below Agents, with all his groups including his personal group, the columns todo / in progress / done, and creating and dragging tasks. It is a rail tile (SidebarTab::Ponos) that opens a full board in the main panel, like Calendar and Calls: the chat list is hidden while the board is open.
  • The personal group is Ponos' own virtual «Mijn Taken» (__my_tasks__, all tasks assigned to you). The board lists every group navigation returns, in Ponos' order, and uses Ponos' own status names («Nog te doen», «Onderhanden», «Afgerond»).
  • Ponos gained one action for this, reorder_task (column + place), and the app-token list now also allows update_task and move_task (ict/ponos !8). Still no API keys, groups, members, settings or reminders through an app token. Dragging inside «Mijn Taken» only changes the status: that view has no order of its own in Ponos.
  • Ponos has no delete action (done tasks are archived automatically), so the board offers «Afronden» but no delete. The old «My tasks in Ponos» panel in the «…» menu is gone; the tile replaces it.
  • Planned, not built: the Asclepius integration (virtual team / embed view) becomes the next tile, directly below Ponos.
Source
1---
2status: proposed
3date: 2026-11-28
4---
5
6# ADR 0024: KVT fork, Business Central cards through sleutels.kvt.nl
7
8This record belongs to the KVT fork (`KVT-FORK.md`), not to upstream.
9
10## Context
11
12KVT colleagues paste Business Central links (projects, work orders, contracts, customers, components, items) into chats. Those links open the BC web client and show nothing in the chat itself. Mímir on sleutels.kvt.nl already reads BC with the reader's own rights. The app needs a personal credential for Mímir that is not the Teams or Graph token.
13
14Options for the credential were: reuse the Teams/Graph token (wrong audience, and it would hand a Microsoft token to a KVT server), a shared API key (no per-user rights), or a personal app token from the shared KVT Login through a browser flow.
15
16Options for where that browser flow runs were: the system browser (a second Microsoft sign-in) or the app's own session browser, which is already signed in to Microsoft (ADR 0003).
17
18Options for the message format were: an own card format, or a plain link with readable text.
19
20## Decision
21
22- The Login issues a personal, revocable app token (`sat_…`, expires 90 days after last use, scopes `mimir.cards asclepius ponos daedalus`) through RFC 8252: PKCE S256, a loopback redirect to `127.0.0.1`, a one-time code. The token sits in the OS keyring (service `rusty-teams.kvt-sleutels`), never in SQLite or logs.
23- Connecting runs in a background tab of the session browser on Linux and macOS. The Login's Entra SSO then passes without asking. The app clicks «Koppelen» on the Login consent page, because the user already pressed «Connect» in Settings. When the page needs the user (account picker, MFA, password) or stalls, the app closes the tab and opens the same link in the system browser. On Windows the WebView2 host has no CDP tabs; the connect page opens in a window of the host instead (`DialogMode::Page`, same profile, so the Microsoft session is there). The user clicks «Koppelen» there and the app closes the window when the code arrives. If the window cannot open, the system browser.
24- No Teams or Graph token goes to the Login or Mímir.
25- A message keeps a plain HTML link with readable text (`Werkorder WO… - description`). Official Teams shows a normal link; Rusty Teams shows up to three cards under the text. Details load only when the card is opened, with the reader's own token.
26
27## Consequences
28
29- Others see nothing unusual (GUARDRAILS: no own message formats).
30- While the background tab passes `login.microsoftonline.com`, the session browser briefly reports a login page. The tab is closed after eight seconds on a Microsoft page, so a stuck sign-in cannot keep the Teams login window logic busy.
31- Chrome strings are English and German (ADR 0008); field labels and values come from Mímir in Dutch.
32- A token stays valid until it expires or is revoked (Settings > Disconnect, or «Gekoppelde apps» on the Login). Nothing revokes it automatically when someone leaves.
33
34## Addendum: Asclepius, Ponos and Daedalus (same release)
35
36- The same app token also serves Ponos (scope `ponos`) and Daedalus (scope `daedalus`). Ponos accepts a `sat_…` bearer only for a fixed list of task actions (navigation, list, get, create, status, complete, message), so a stolen token cannot mint API keys or change groups.
37- «Create Asclepius ticket» needs no token: it opens the existing new-ticket form with `new_title` and `new_description` prefilled. The user picks the category and saves in Asclepius, so nothing is filed without them seeing it.
38- «Create Ponos task» and «My tasks» call Ponos directly; the dialog lists only groups where the user may create tasks.
39- The Daedalus planning is a read-only calendar source (`CalendarSource::Ics`, calendar «Daedalus»), so the calendar offers no RSVP or delete for it. Daedalus had no ICS subscription to reuse, so a small JSON endpoint was added; its `format=ics` output also needs the bearer header, which plain calendar apps cannot send. The endpoint shows only the user's own work orders, without memos or materials. When BC fails, the planning is empty rather than an error. It is on by default and can be turned off in Settings.
40- The Asclepius embed view and a virtual Asclepius team are not part of this release.
41
42## Addendum: Ponos tile and board (next release)
43
44- Tim asked for Ponos in the navigation rail, right below Agents, with all his groups including his personal group, the columns todo / in progress / done, and creating and dragging tasks. It is a rail tile (`SidebarTab::Ponos`) that opens a full board in the main panel, like Calendar and Calls: the chat list is hidden while the board is open.
45- The personal group is Ponos' own virtual «Mijn Taken» (`__my_tasks__`, all tasks assigned to you). The board lists every group `navigation` returns, in Ponos' order, and uses Ponos' own status names («Nog te doen», «Onderhanden», «Afgerond»).
46- Ponos gained one action for this, `reorder_task` (column + place), and the app-token list now also allows `update_task` and `move_task` (ict/ponos !8). Still no API keys, groups, members, settings or reminders through an app token. Dragging inside «Mijn Taken» only changes the status: that view has no order of its own in Ponos.
47- Ponos has no delete action (done tasks are archived automatically), so the board offers «Afronden» but no delete. The old «My tasks in Ponos» panel in the «…» menu is gone; the tile replaces it.
48- Planned, not built: the Asclepius integration (virtual team / embed view) becomes the next tile, directly below Ponos.