Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
16 changes: 16 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,22 @@
mode, the PostgreSQL statements on a recording fake, the hooks and the boot; a live PostgreSQL gated on
`AGENT_QUESTION_TEST_URL`). **Upgrade note:** none - a new application; the main flow lists it in `ask.channels`.

7. **Static web content: the host serves the files of `static.html.folder` - the Java engine's key, with the Rust
engine's location as its default, `resources/public` next to the application file (Eric, 2026-11-20).** A `GET` or
`HEAD` that no host path, extension route or function claims is answered with the file the path names inside the
folder, `index.html` for a folder, so a folder's `index.html` replaces the embedded landing page at `/` while
`/info`, `/health` and the other host paths stay the host's. The content type comes from the engines' table by
extension (`text/javascript`, `text/css`, `image/svg+xml`, the fonts and images a bundle ships;
`application/octet-stream` otherwise); every file carries an ETag and answers `If-None-Match` with 304, and
`text/html` is served `Cache-Control: no-cache`, so a redeployed page is revalidated while hashed assets stay
cached. A path with a hidden segment (one starting with `.`, so `..` too), a symbolic link that leaves the folder,
or anything that is not a regular file is not found, in the engines' error shape as before. A relative value of
the key is under the application file's folder, never the working directory (`AppConfig.app_dir` names that
folder now); `file:` prefixes an absolute path as in the Java engine; an empty value turns the service off. Not
ported: the Java engine's static-content filter, its `no-cache-pages` list and its `mime.types` section. The
first consumer is the agent-question app's React front-end, built in the Node.js pack and deployed into both
packs' `resources/public`; the 2026-08-24 note that the wrappers serve no static files is withdrawn.

### Fixed

1. **The agent-question app keeps the first accepted decision when two devices decide one card at the same moment**
Expand Down
18 changes: 17 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@ The same conventions as the engines, so a polyglot installation stays uniform:
| `rest.server.port` | Event API port | `8085` |
| `log.format` | `text`, `json` (pretty-printed) or `compact` (single-line JSONL) | `text` |
| `log.level` | log level (`LOG_LEVEL` env var wins) | `INFO` |
| `static.html.folder` | the folder of static web content the host serves (HTML, CSS, JS, images), relative to the application file | `resources/public` |

Configuration lives in the `resources` folder next to the application file, mirroring the
engines' classpath resources: `resources/application.yml` (or `.yaml` / `.properties`) beside
Expand Down Expand Up @@ -167,7 +168,7 @@ Kubernetes probes and dashboards treat a Python app exactly like a Java or Rust

| Endpoint | Purpose |
|----------|---------|
| `GET /` | minimal index page linking the endpoints below |
| `GET /` | the static folder's `index.html`, else a minimal index page linking the endpoints below |
| `GET /info` | app identity, runtime, origin id, start time, uptime |
| `GET /info/routes` | registered routes split by visibility, with instance counts |
| `GET /env` | selected environment variables and configuration parameters |
Expand Down Expand Up @@ -196,6 +197,21 @@ unknown paths answer the engines' error shape
Kubernetes wiring: point `livenessProbe` at `/livenessprobe` and `readinessProbe` at
`/health`.

## Static content

The host serves the files of `static.html.folder` — the Java engine's key, with the Rust engine's
location as its default, `resources/public` next to the application file — for any `GET` or `HEAD`
that no host path, extension route or function claims, so an application can ship a web front-end
beside its functions the way the engines' Playground does. A folder is served as its `index.html`,
so `resources/public/index.html` replaces the landing page at `/`. The content type follows the
engines' table by extension (`text/javascript`, `text/css`, `image/svg+xml`, fonts and images;
`application/octet-stream` otherwise); every file carries an ETag and answers `If-None-Match` with
304, and HTML is served `Cache-Control: no-cache`, so a redeployed page is revalidated while hashed
assets stay cached. A hidden entry, a `..` segment, a symbolic link that leaves the folder or
anything that is not a regular file is not found, in the engines' error shape. A relative value of
the key is under the application file's folder, never the working directory; `file:` prefixes an
absolute path as in the Java engine; an empty value turns the service off.

## Wire compatibility

The codec implements the
Expand Down
19 changes: 18 additions & 1 deletion docs/guides/config-logging-actuators.md
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ The host serves the engines' endpoints on the same port as `/api/event`:

| Endpoint | Purpose |
|----------|---------|
| `GET /` | minimal index page linking the endpoints below |
| `GET /` | the static folder's `index.html`, else a minimal index page linking the endpoints below |
| `GET /info` | app identity, runtime, origin id, start time, uptime |
| `GET /info/routes` | registered routes split by visibility, with instance counts |
| `GET /env` | selected environment variables and configuration parameters (opt-in lists) |
Expand Down Expand Up @@ -141,6 +141,23 @@ async def health_check(headers: dict[str, str], _body: Body):
Optional dependencies never change the overall status; mandatory ones decide
`UP`/`DOWN`, and the most recent outcome drives `/livenessprobe`.

## Static content — the engines' `public` folder

The host serves the files of `static.html.folder` for any `GET` or `HEAD` that no host path,
extension route or function claims — the Java engine's key, with the Rust engine's location as
its default: `resources/public` next to the application file, under the resources rule above (a
relative value is under the application file's folder, never the working directory; `file:`
prefixes an absolute path as in the Java engine; an empty value turns the service off). A folder
is served as its `index.html`, so `resources/public/index.html` replaces the landing page at `/`
while `/info`, `/health` and the other host paths stay the host's. The content type follows the
engines' table by extension — `text/javascript`, `text/css`, `image/svg+xml`, the fonts and images
a bundle ships — and is `application/octet-stream` otherwise; every file carries an ETag and
answers `If-None-Match` with 304, and HTML is served `Cache-Control: no-cache`, so a redeployed
page is revalidated while hashed assets stay cached. Never found, in the engines' error shape: a
hidden entry (a segment starting with `.`, so `..` too), a symbolic link that leaves the folder,
anything that is not a regular file. Not ported from the Java engine: the static-content filter,
the `no-cache-pages` list and the `mime.types` section.

## Kubernetes wiring

```yaml
Expand Down
1 change: 1 addition & 0 deletions docs/guides/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ keywords: [configuration, reference, keys, substitution, overrides]
| `show.application.properties` | opt-in list of configuration keys shown by `/env` | (empty) |
| `mandatory.health.dependencies` | routes of health check functions that decide `/health` | (empty) |
| `optional.health.dependencies` | health check routes reported but never affecting status | (empty) |
| `static.html.folder` | the folder of static web content the host serves for the paths nothing else claims — relative to the application file's folder ([guide](config-logging-actuators.md#static-content-the-engines-public-folder)) | `resources/public` |
| `otel.forwarding` | the OpenTelemetry forwarder's master switch ([guide](config-logging-actuators.md#distributed-tracing-the-opentelemetry-forwarder-opt-in)) | `false` |
| `otel.exporter.otlp.endpoint` | the OTLP/HTTP traces URL including the signal path | `http://localhost:4318/v1/traces` |
| `otel.exporter.otlp.headers` | request headers, `k=v` or `k: v`, comma-separated (re-read per export) | (none) |
Expand Down
12 changes: 11 additions & 1 deletion docs/guides/http-surface-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ charset=utf-8` (the engines' default-serializer presentation).

| Endpoint | Content type | Shape |
|----------|--------------|-------|
| `GET /` | `text/html` | minimal index page linking the endpoints |
| `GET /` | `text/html` | the static folder's `index.html`, else a minimal index page linking the endpoints |
| `GET /info` | JSON | `{app{name,version,description}, runtime{language,python,mercury_composable}, origin, time{start,current}, up_time}` |
| `GET /info/routes` | JSON | `{app, routing{public{route: instances}, private{...}}}` |
| `GET /env` | JSON | `{app, env{environment{...}, properties{...}}}` (opt-in lists) |
Expand All @@ -47,6 +47,16 @@ reports `status_code: 404` with `Please check - Route X not found`.
uuid (the Java reference engine's format).
- `up_time` — the engines' rendering (`59 seconds`, `1 minute 1 second`, …).

## Static content

A `GET` or `HEAD` of any other path is answered with the file it names inside `static.html.folder`
(`resources/public` next to the application file by default; `index.html` for a folder) when there
is one: the content type by extension from the engines' table, an `ETag` (`If-None-Match` answers
304 with no body) and, for HTML, `Cache-Control: no-cache`. A path that names nothing — including a
hidden entry, a link out of the folder or a folder without an index page — falls through to the
error signature below. See the
[guide](config-logging-actuators.md#static-content-the-engines-public-folder).

## Error signature (host-level)

Unknown paths and non-GET methods on known paths answer the engines' shape —
Expand Down
18 changes: 18 additions & 0 deletions memory/continuity.md
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,24 @@
second front-end here.
<!-- id: agent-question-app | created: 2026-11-19 | last_used: 2026-11-19 | uses: 1 | tier: working | origin: 2026-11-19-071444 -->

- **The host serves static web content from `resources/public` next to the application file - the engines' `public`
folder (Eric, 2026-11-20; PR #73, the Node twin mercury-nodejs #138).** `static.html.folder` is honoured as the Java
engine's key with the Rust engine's location as its default, under the resources rule
([[conv-resources-next-to-the-application-file]]): a GET or HEAD that no host path, extension route or function claims
is answered with the file it names, `index.html` for a folder (so a folder's `index.html` replaces the embedded
landing page at `/`), the content type from the engines' table by extension, an ETag with 304 on `If-None-Match`,
`Cache-Control: no-cache` for HTML; a hidden segment, a link out of the folder or anything that is not a regular file
is not found, in the engines' error shape; `file:` prefixes an absolute path, an empty value turns the service off;
`AppConfig.app_dir` names the application file's folder. Withdraws the 2026-08-24 note that the wrappers serve no
static files (session 2026-08-24-015208): a pack application now ships a web front-end beside its functions as the
engines' Playground does - the first is the agent-question app's React UI, built in the Node pack and deployed into
both packs' `resources/public`, served by each backend from its own origin, so no CORS ([[bp-question-record-and-ui]]).
Not ported: the Java engine's static-content filter, its `no-cache-pages` list and its `mime.types` section.
**How to apply:** a web bundle goes into `resources/public` next to the application file and nothing else is
configured; a host path or an extension route always wins over a file of the same name; a relative folder is never
the working directory's.
<!-- id: static-content-resources-public | created: 2026-11-20 | last_used: 2026-11-20 | uses: 1 | tier: working | origin: 2026-11-20-075621 -->

## Conventions

- **Quality gates (adopted 2026-08-23, Eric's IDE review round): ruff + basedpyright +
Expand Down
31 changes: 31 additions & 0 deletions memory/open-threads/thread-bp-question-record-and-ui.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
- [ ] **(blueprint) The 2026-11-20 sprint: the question record joins the audit log, the agent-question backend serves
the React UI's reads, and the hosts serve static content (Eric's three items, reviewed and agreed 2026-11-20).**
The agreed design, in build order. **(1) Static content** - `static.html.folder`, default `resources/public` next to
the application file, in both hosts: BUILT, PR #73 (the Node twin mercury-nodejs #138), [[static-content-resources-public]].
**(2) The question record** - the main flow records, the channels deliver: every question and advice passes
`person.ask` and every answer, from any channel, passes `POST /ask/reply`, so the recorder is a private one-instance
function of the ask-person process behind drop-n-forget local events, the helper's `transcript.audit` pattern
([[transcript-audit-store-python]]) - not the helper itself, since a deterministic flow has no helper in its path. The
table is today's inbox row moved into the audit database: one row per wait upserted on graph, correlation id and
turn, one row per advice appended, the answer columns written once under the first-decision rule, the change sequence
kept for the feed, the message as received kept as the audit copy, linked to the transcript by correlation id and
graph id (no new column). A published store contract (Eric: PostgreSQL out of the box, a memory implementation as the
pattern for unit tests, the interface published so a field implements another database), and the engines' published
schema page gains a question section (ADR-0035). The writes order-independent from the start with an `.instances` key:
the mailbox's ordering replaced by a per-conversation row lock, a monotonic guard on the row and a forward-only mark -
the same relaxation proposed for `transcript.audit` (follow-up, `llm.transcript.audit.instances`, default 1). `seen`
leaves the record (a device's state, kept in the UI). The deterministic node is the generalized record only: a flow
that asks at a stage sends its id as `graph_id` and the stage as `turn`, its continuation an allowlisted entry. The
agent-question app becomes a reader of the table under the store's read role plus the click, its intake a wake-up of
connected devices; the reads for the UI, in both packs and in the shared vectors: `GET /questions?before=<seq>` for
the history's infinite scroll, `GET /transcripts` and `GET /transcripts/{conversation}` over the audit store,
`GET /questions/config` for the sign-in. **(3) The React UI**, in the Node pack only (mercury-nodejs thread
`agent-question-react-ui`), deployed into both packs' `resources/public`, same origin, no CORS. Identity `none` and
`oauth2` only - `proxy` removed here and from the reply endpoint (Eric: the field's installations use 3-legged SSO and
OAuth 2.0 access tokens): Authorization Code with PKCE in the browser, the bearer on every call, the stream read with
`fetch` since `EventSource` carries no bearer, the reply page signing in the same way; a Keycloak development
container plus a mock issuer fixture for the tests; the vanilla page retired in both packs when the UI lands; no
source maps. RFC-0014 gets a round-4 amendment in mercury-composable before the record is built. Status: step 1 of 3
built (PR #73); next the RFC amendment, then the record.
→ serves: vision-mercury-python
<!-- id: bp-question-record-and-ui | created: 2026-11-20 | last_used: 2026-11-20 | uses: 1 | tier: working | origin: 2026-11-20-075621 -->
40 changes: 40 additions & 0 deletions memory/sessions/2026-11-20-075621.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Session (2026-11-20T07:56:21.000Z)

**Agent:** Claude Code
**Title:** The hosts serve static web content from `resources/public` - step 1 of the 2026-11-20 sprint
**User:** Eric - "let's resume AI SDLC work. In this sprint, we will do the following: 1. make the question-inbox for questions, answers and advices as part of transcript audit log ... 2. upgrade the agent-question-UI from plain javascript into a full React application ... 3. Check if the language packs (python and nodejs) are capable of serving static HTML/JS/CSS content like what the engines do. If not, add the functionality." Then "agree with your recommendations" with two refinements - no `proxy` mode (the field's installations use 3-legged SSO and OAuth 2.0 access tokens) and a published store contract (PostgreSQL out of the box, a memory implementation as the unit-test pattern, another database by the contract) - and a question on relaxing the audit writer's single instance.

## What We Did

- **The review** (no code): the three items against the code of the four repositories; the agreed design, in build
order, is the new blueprint thread [[bp-question-record-and-ui]] - the main flow records and the channels deliver, the
record in the audit database under a published contract, the React UI in the Node pack deployed into both packs'
`resources/public` and served same-origin (Eric: no CORS), identity `none` and `oauth2` only with PKCE in the browser,
static content first because the UI depends on it.
- **Static content, built here and in the Node twin:** `src/mercury_composable/static_content.py` - `static.html.folder`
(the Java engine's key), default `resources/public` next to the application file (the Rust engine's location);
`AppConfig.app_dir` names that folder; the host's `/` serves the folder's `index.html` else the embedded landing page,
and the catch-all serves the file a GET or HEAD names else the engines' error shape; the engines' content-type table,
ETag with 304 and HEAD through aiohttp's FileResponse, `no-cache` for HTML; a hidden segment, a link out of the folder
or a special file not found. 12 tests (`tests/test_static_content.py`, one in `tests/test_config.py`); README, the
three guides, CHANGELOG Added 7; the 2026-08-24 "no static file service" note withdrawn. Gates: ruff OK, basedpyright
0 errors, pytest 763 passed / 75 skipped. Driven live through `mercury-serve` with a bundle in a scratch
`resources/public`: the page with `no-cache` and an ETag, the script as `text/javascript`, HEAD, 304, the actuator
and the error shape untouched (a first empty curl was the smoke script's startup race, not the host).
- **Decision recorded:** [[static-content-resources-public]].
- **Eric's optimization question** - may the audit writer run several instances since every write is timestamped? -
answered in the conversation: viable, with the mailbox's ordering replaced by a per-conversation row lock (the
conversation upsert first in the transaction), a monotonic guard on the conversation row and a forward-only audited
mark, a check racing a write tolerated; a key `llm.transcript.audit.instances` with default 1, worth raising only
where the database is remote. The question recorder of step 2 is to be built order-independent from the start.
- Opened as PR #73 (the Node twin mercury-nodejs #138).

## Memory References

- Referenced: engine-consistent-conventions (the key carries the Java engine's name and the default the Rust engine's
location), conv-resources-next-to-the-application-file (the default under the application file, never the working
directory), scope-wrapper-no-orchestration (checked: serving files is neither orchestration nor persistence),
agent-question-app (the first consumer - the React UI deployed into its resources/public), conv-python-quality-gates
(ran them), ask-person-main-flow (the recorder's home in the agreed design), transcript-audit-store-python (the
recorder's pattern and the multi-instance guards)
- Created: static-content-resources-public (tier: working), bp-question-record-and-ui (tier: working, blueprint thread)
4 changes: 2 additions & 2 deletions src/mercury_composable/actuator.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,8 @@ async def health(headers: dict[str, str], _body: Body) -> Body:
HEALTH_TIMEOUT_MS = 10000 # engine value for the type=health probe
UNHEALTHY = "Unhealthy. Please check '/health' endpoint."

# The engines' minimal landing page (platform-core public/index.html style);
# the wrappers embed it - no static file service by design.
# The engines' minimal landing page (platform-core public/index.html style), embedded: served
# at / unless the static content folder (static_content.py) has an index.html of its own.
INDEX_HTML = """<!DOCTYPE html>
<html>
<body>
Expand Down
Loading
Loading