Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
19 commits
Select commit Hold shift + click to select a range
05acae4
WebFront.js: a probe that an inspector installs to follow the calls, …
ambroise-leclerc Nov 27, 2026
eea2f0a
Relay the state of a page's bridge to a detached inspector: the page …
ambroise-leclerc Nov 27, 2026
97958c6
Bridge panel of the inspectors: ready, pending calls, rejections and …
ambroise-leclerc Nov 27, 2026
53c6b86
Real-browser tests of the bridge's state: Jasmine specs of the probe …
ambroise-leclerc Nov 27, 2026
336854b
ADR-027 1.3, guide and changelog: the state of the bridge in the page…
ambroise-leclerc Nov 27, 2026
80bb105
Bridge panel: adopt the calls made between two leases, and announce a…
ambroise-leclerc Nov 27, 2026
0097d86
Say that a followed call is followed to its answer, also after the pr…
ambroise-leclerc Nov 27, 2026
1c4f483
BridgeStateTests: a thread word that the source headers know (#684)
ambroise-leclerc Nov 27, 2026
0abffb4
Merge develop into 684-etat-du-pont: the Packages panel beside the Br…
ambroise-leclerc Nov 27, 2026
485c4b8
Answer the review of #699: a state belongs to the connection that ann…
ambroise-leclerc Nov 27, 2026
e74f853
Bridge relay: drop a page's state before its place, keep the probe pa…
ambroise-leclerc Nov 27, 2026
09746f3
Merge remote-tracking branch 'origin/develop' into 684-etat-du-pont
ambroise-leclerc Nov 27, 2026
1bff766
Bridge relay: evict the publishing page too, tell long names apart by…
ambroise-leclerc Nov 27, 2026
9b0b403
Bridge relay: settle the application's calls whatever the monitor doe…
ambroise-leclerc Nov 27, 2026
981a305
Merge develop into 684-etat-du-pont: the watches of #682 beside the B…
ambroise-leclerc Nov 27, 2026
b8f7a65
Merge develop into 684-etat-du-pont: the MCP tools of #685 beside the…
ambroise-leclerc Nov 28, 2026
2568ae1
ADR-027: the bound is on the bridge state shown; the monitor follows …
ambroise-leclerc Nov 28, 2026
941a914
Answer the review of #699: the latest lease wins, labels keep their d…
ambroise-leclerc Nov 28, 2026
d5cf327
Bridge relay: one page per connection and no connected page evicted, …
ambroise-leclerc Nov 28, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ these entries stays in the GitHub releases and the Git history.
- Let an agent read the running application through MCP with the `state` grant: the `webfront.state.*` tools give the registered functions, the calls to JavaScript, the browsers and tasks, and the watches (pages, differences, whole values) in the bounds of the inspectors; they never write (#685, ADR-027, `docs/DEVELOPING_WITH_AGENTS.md`).
- Let an agent read the locked packages with the `packages` grant: the `list`, `why` and `info` operations answer `wf list --tree`, `wf why` and `wf info`, in environment 1.2.1 or later (#685, `docs/AUTOMATION.md`).
- Browse in the **Packages** panel of the inspectors the locked packages as a tree under the roots of the manifest, with the requested ranges and the `peer`, `deduped` and multiple-version marks; search a package by name and open its detail with its `wf why` chains; the tree follows `wf install` and `wf restore` (#683, ADR-027, `docs/DEVELOPER_ENVIRONMENT.md`).
- See in the **Bridge** panel of the inspectors the state of the bridge in the interface's page: `webFront.ready` (pending, resolved, or rejected and why), the pending `cppFunction` calls and their duration, the Promises rejected lately, and the JavaScript functions that C++ calls; a bridge that no inspector reads records nothing (#684, ADR-027, `docs/DEVELOPER_ENVIRONMENT.md`).
- Declare what the inspectors show with `app.watch(name, source)`, whose handle removes the watch when it is destroyed; the Watches panel follows their registrations and removals. Outside the developer environment and in a distribution build, `watch` registers nothing (#680, ADR-027).
- Embed a plain interface directory (HTML, JavaScript, CSS, vendored files) from CMake with `webfront_embed_directory(app ui CLASS AppUI)`, without the developer environment: the build regenerates the provider when a file changes, and `fs::DocumentRootFirstFSWith<AppUI>` lets a development root serve in front of it (#675, `docs/EMBEDDED_ASSETS.md`).
- Set from the configuration `Referrer-Policy` (`contentPolicy.referrerPolicy`: `"no-referrer"` forbids explicitly that a capability in your URLs leaves in `Referer`), `X-Content-Type-Options: nosniff` (`noSniff`) and the `Cache-Control` of HTML pages (`htmlCacheControl`), on files, route and generated replies unless a reply sets its own (#674, `docs/CONTENT_POLICY.md`).
Expand Down
16 changes: 14 additions & 2 deletions docs/DEVELOPER_ENVIRONMENT.md
Original file line number Diff line number Diff line change
Expand Up @@ -509,8 +509,20 @@ environment's `mount`, not to the embedded bootstrap page):
environment (`webfront.developer.read`), in the manifest directory the application chose; it uses no network and writes
nothing. Every second it asks whether either file changed and reads them again when one did, so the tree follows
`wf install` and `wf restore`; it warns when the lock no longer matches the manifest. The names and texts of packages
are not trusted: they are shown as text, never as HTML, with their control characters made visible. The Bridge panel
comes with the next versions of the environment.
are not trusted: they are shown as text, never as HTML, with their control characters made visible.

The **Bridge** panel shows the state of the bridge in the page of the interface (the `webFront` of the preview frame,
or of the developer page while no interface has one): whether `webFront.ready` is pending, resolved or rejected and
why, the state of the connection, the `cppFunction` calls that C++ has not answered yet and for how long, the Promises
rejected lately (function, reason with its error code, time; the 50 latest), and the JavaScript functions that C++
called with the number of their calls. `WebFront.js` records nothing by itself: the page that holds the tab installs
a probe in the bridge at the panel's first read and removes it fifteen seconds after the last one. A call made before
that is listed without a duration, and the rejections and the JavaScript calls are those seen while a panel reads; a
call that the panel saw pending is followed to its answer, so its rejection is listed even if the panel closed meanwhile.
The inspectors' own calls are not shown. Attached, the panel reads the page directly; detached, its window does not
see the page, so the page publishes the same state to C++ every 250 ms while the panel reads, and stops within
fifteen seconds of its last read (`webfront.inspector.bridgeSource`, `publishBridge` and `bridge`, admitted pages
only).

The tab is a button (`aria-expanded`, `aria-haspopup="menu"`, 44 px target), its menu a `menu` of `menuitem`s of 44 px,
and the window a non-modal dialog. The interface stays in the preview
Expand Down
61 changes: 59 additions & 2 deletions docs/adr/ADR-027-inspecteurs-de-l-etat-de-l-application.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

| Version | Date | État | Auteur | Évolution | Révision Git |
| --- | --- | --- | --- | --- | --- |
| 1.5 | 2026-11-28 | Proposée | Ambroise Leclerc | État du pont dans la page (#684, section 8) : sonde `probe` de `WebFront.js`, posée seulement pendant qu'un inspecteur lit ; moniteur de la page hôte, qui suit le pont de l'interface ; relais `webfront.inspector.bridgeSource`, `publishBridge` et `bridge`, sous la règle d'accès de la section 2, où la page ne publie que pendant qu'un panneau détaché lit (bail de 15 s) ; état borné à 256 lignes de textes de 256 octets, pour 16 pages au plus. | À renseigner après intégration. |
| 1.4 | 2026-11-28 | Proposée | Ambroise Leclerc | Outils MCP (#685) : la section 10 fixe les dix outils `webfront.state.*` sous le grant `state`, servis nativement et sans exécution ; lectures seules (ni `write`, ni préférences, ni fenêtres) ; une mémoire des observateurs propre à ces lectures, que `fold` et `reset` gèrent sans toucher l'application ni un panneau ; mêmes bornes que les pages ; refus aux codes `webfront.inspector.*` ; les packages passent par les opérations `list`, `why` et `info` de l'environnement, sous le grant `packages`. | Issue #685. |
| 1.3 | 2026-11-27 | Proposée | Ambroise Leclerc | Observateurs (#682) : précisions de la section « Précisions des observateurs » (6 bis) — `fold` répond par une page vide, `limits` par six nombres, la source propriétaire reçoit son état, le mutateur reçoit le texte déjà validé, un parent signalé « enfants modifiés » perd ses enfants en mémoire, la mémoire de 10 000 nœuds se compte par connexion et par observateur, `maxWriteTextBytes` tient compte de l'en-tête réel du texte, un formateur écrit pour `std::format_context` est accepté. | À renseigner après intégration. |
| 1.2 | 2026-11-26 | Proposée | Ambroise Leclerc | Registre introspectable (#681) : pages `webfront.inspector.functions`, `jsFunctions` et `browsers` (section 7) ; enregistrements tenus par les gestionnaires, donc retirés avec une fonction d'espace ; fonctions `webfront.inspector.*` non listées ; durée mesurée pendant une fenêtre de 5 s après chaque lecture des fonctions ; appels vers JavaScript comptés par nom, 1 024 noms au plus, seulement une fois l'environnement monté ; `BasicWF::registeredFunctions()` pour l'application. | À renseigner après intégration. |
Expand Down Expand Up @@ -827,8 +828,64 @@ La même règle désactive « Détacher » quand aucun conteneur détaché ne do
Chaque panneau a une action « Détacher / Rattacher », désactivée avec sa raison quand aucun conteneur détaché n'est
disponible. Le choix est conservé par projet dans `.webfront/developer/`, comme `terminal-window.json`.

L'état du pont dans la page (#684) vit dans la page de l'application. Détaché, le panneau le lit par un relais C++ :
la page publie son état par un appel réservé, et l'inspecteur le lit comme un observateur, sous la même règle d'accès.
**État du pont dans la page (#684).** Le panneau **État TypeScript ▸ Pont** montre `webFront.ready` (en attente,
résolue, ou rejetée avec sa raison), l'état de la connexion, les appels `cppFunction` en attente avec leur durée, les
Promises rejetées récemment (fonction, raison, heure) et les fonctions JavaScript que C++ appelle, avec le nombre de leurs
appels. Cet état vit dans la page de l'application.

- **Sonde.** `WebFront.js` ne garde rien pour l'inspecteur : chaque appel en attente porte seulement son nom, et `ready`
la raison de son rejet (`readyError`). Le pont a un champ `probe`, nul par défaut. Quand il est posé, `callCppFunction`
lui confie la paire qui règle la Promise (`probe.call(nom, resolve, reject)` rend la paire à utiliser) et
`callJsFunction` lui annonce chaque fonction appelée par C++ (`probe.jsCall(nom)`). Sans sonde, un appel coûte un test
de nullité : ni horloge, ni table. Le format binaire ne change pas ; les ressources du cœur restent dans la liste et le
budget de l'ADR-016.
- **Moniteur.** La page hôte (celle qui tient l'onglet, `inspector-host.mjs`) crée un moniteur (`inspector-bridge.mjs`)
qui pose la sonde à sa première lecture et la retire quinze secondes après la dernière (plus que la plus lente des
périodes d'un panneau, pour qu'un panneau qui lit ne laisse aucun moment sans sonde) : un pont que personne n'inspecte
n'enregistre rien. Il suit le pont de l'interface (le `webFront` du cadre de l'aperçu, là où l'application appelle
C++), ou celui de la page hôte quand l'interface n'en a pas ; un cadre rechargé donne un nouvel état. Les appels en
attente quand la sonde est posée (à la première lecture, ou après un bail échu) sont repris avec leur nom, sans durée
connue. Un pont d'un `WebFront.js` antérieur n'a pas de champ `probe` : le moniteur n'en pose pas, retrouve à chaque
lecture les appels en attente, apprend l'issue de `ready` par la Promise elle-même, et le panneau dit que l'historique
manque. Une exception du moniteur ne retient jamais le règlement d'une Promise de l'application. Les appels de l'inspecteur lui-même
(`webfront.inspector.*`, `wfInspect.*`) ne sont pas suivis. Un appel suivi l'est jusqu'à sa réponse, même après le
retrait de la sonde : il faut de toute façon le retirer des appels en attente, et son rejet éventuel reste donc listé. L'état rendu est borné : 100 appels en attente (les plus
anciens), 50 rejets (les plus récents), 100 fonctions JavaScript (les plus appelées, sur 1 000 noms comptés un par un),
textes de 256 octets coupés sur une frontière de caractère, caractères de contrôle rendus visibles ; un nom long est
compté sous son libellé borné. Pour savoir quand un appel
se termine, le moniteur en enveloppe chacun et garde une entrée par appel en attente, comme le pont lui-même : ce
stockage suit `pendingCalls`, que les identifiants d'appel sur 16 bits bornent à 65 535 entrées.
- **Panneau rattaché.** L'iframe de la fenêtre flottante lit le moniteur de sa page hôte
(`window.parent.webfrontInspectorHost.bridgeState`), sans passer par C++.
- **Panneau détaché : relais par C++.** Une autre fenêtre ne voit pas la page, et `BroadcastChannel` n'est pas garanti
entre les vues natives. Trois fonctions réservées, sous la règle d'accès de la section 2, relaient l'état :
`webfront.inspector.bridgeSource(hôte)` annonce la page hôte et répond si un panneau attend déjà ;
`webfront.inspector.publishBridge(hôte, lignes)` publie l'état et répond s'il faut continuer ;
`webfront.inspector.bridge(hôte, depuis, nombre)` rend une page `(lignes, suivant, publication, âge en ms, drapeaux)`
dans `responseBudget` (drapeaux : 1 la page est annoncée et connectée, 2 elle a publié). Une ligne est un tuple
`(genre, nom, détail, nombre, nombre)` : une liste de tuples des types existants (exception de l'ADR-003). `publication`
numérote l'état. `suivant` est un curseur opaque qui nomme la publication lue par la première page : C++ garde aussi la
publication précédente, si bien qu'un lecteur termine la publication qu'il a commencée même si une autre arrive entre
deux pages ; un lecteur qui voit `publication` changer (elle a disparu) recommence.
- **Rien n'est publié sans lecteur.** Une lecture ouvre un bail de 15 s (plus long que la plus lente des périodes d'un
panneau) ; si la page ne publie pas, C++ le lui demande par `wfInspect.publish()`, une fois par seconde au plus. La page
publie alors toutes les 250 ms, et s'arrête dès qu'une publication apprend que le bail est échu. Un panneau fermé ou en
pause laisse donc la page se taire, et la sonde quitter le pont.
- **Bornes du relais.** Un état de plus de 256 lignes est refusé (`std::invalid_argument`) sans remplacer le précédent ;
chaque texte est borné par `boundedText` (256 octets, 16 pour le genre). C++ connaît 256 pages au plus (un identifiant
et deux rappels chacune) et garde l'état publié de 16 d'entre elles : au-delà de 16 états, la page lue le moins
récemment perd son état mais pas sa place, et une lecture la relance. Une connexion a une page au plus (une annonce
sous un autre identifiant retire la précédente) et une page connectée ne perd jamais sa place : au-delà de 256 pages
connectées, une annonce est refusée (`webfront.inspector.unavailable`). Une page déconnectée est oubliée à la première
lecture ou annonce qui la constate, en gardant pour son identifiant le bail d'un lecteur : une lecture la trouve
déconnectée et rend une page vide, sans drapeau de source. Une page qui a perdu sa place s'annonce de nouveau quand son panneau est détaché, ou quand sa
publication est refusée (`unknown`) ; une nouvelle annonce garde le bail d'un lecteur, et celle de la même connexion
garde aussi son état. Un état appartient à la connexion qui s'est annoncée la dernière sous cet
identifiant : la publication d'une autre connexion est refusée (`webfront.inspector.unavailable`). Une publication sans annonce est
refusée (`webfront.inspector.unknown`).

Les deux panneaux affichent les mêmes lignes : le panneau rattaché passe l'état du moniteur par le même encodage en
lignes que le relais.

### 9. Ressources

Expand Down
2 changes: 1 addition & 1 deletion docs/adr/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ verification evidence remain in [PROJECT_STATUS](../PROJECT_STATUS.md).
| [ADR-024](ADR-024-tls-integre.md) | Optional integrated TLS 1.3 server | Proposed | 2026-11-21 | 1.0 |
| [ADR-025](ADR-025-mcp-http-dans-l-application.md) | The application serves MCP over Streamable HTTP on its own loopback listener, with a session Bearer token, strict Host/Origin checks, per-instance discovery and no automation in distribution builds; the webfront-agent launcher is removed; amends ADR-019 | Accepted (delivery in progress) | 2026-11-21 | 1.4 — 2026-11-28 |
| [ADR-026](ADR-026-configuration-mcp-persistante.md) | Stable MCP client configuration with explicit development security modes | Accepted | 2026-11-22 | 1.2 — 2026-11-22 |
| [ADR-027](ADR-027-inspecteurs-de-l-etat-de-l-application.md) | Application state inspectors in the developer environment only: reserved `webfront.inspector.*` functions refused to unproven views unless the application trusts loopback clients, tree nodes on existing bridge types with paged reads and paged differences, observer operations run whole under the application's lock or on its executor, writes only when the application provides them, one `inspector.html` page, shown in a floating window of the page and, for a detached panel only, in the first container that grants access (a native secondary window, else a system-browser tab); an introspectable registry of the registered C++ functions, of the JavaScript functions C++ calls and of the connected browsers, counted with relaxed atomics and timed only while an inspector reads | Proposed | 2026-11-25 | 1.4 — 2026-11-28 |
| [ADR-027](ADR-027-inspecteurs-de-l-etat-de-l-application.md) | Application state inspectors in the developer environment only: reserved `webfront.inspector.*` functions refused to unproven views unless the application trusts loopback clients, tree nodes on existing bridge types with paged reads and paged differences, observer operations run whole under the application's lock or on its executor, writes only when the application provides them, one `inspector.html` page, shown in a floating window of the page and, for a detached panel only, in the first container that grants access (a native secondary window, else a system-browser tab); an introspectable registry of the registered C++ functions, of the JavaScript functions C++ calls and of the connected browsers, counted with relaxed atomics and timed only while an inspector reads | Proposed | 2026-11-25 | 1.5 — 2026-11-28 |

Numbering follows the reading topics; milestones and individual file histories provide
the chronology, which does not follow the numerical order.
Expand Down
Loading
Loading