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
178 changes: 138 additions & 40 deletions CHANGELOG.md

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions docs/guides/ai-agent-guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ authored on the engine — use the
3. Function is stateless. State belongs to the calling flow/graph.
4. Orchestration-shaped logic (sequencing, retries, branching) → STOP; author an
Event Script flow or MiniGraph graph on the engine instead.
5. Every YAML file (`application.yml`, `rest.yaml`) is YAML 1.2.2: write `true`/`false`, plain
decimal numbers, `0x` for hex, and quotes around any text that looks like a boolean, a number,
a date or null. Never `yes`/`no`/`on`/`off`, `010`, `0o10`, `0b101`, `1:30`, `16_000`, an
unquoted date or the merge key `<<` — the Java engine reads those another way
([the rule](configuration-reference.md#how-a-yaml-file-is-read)).

## The contract

Expand Down
3 changes: 2 additions & 1 deletion docs/guides/config-logging-actuators.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,8 @@ otel.service.name: 'my-python-functions'
```

With `otel.forwarding=true` (the switch is the only thing that turns it on — `false` by
default, and `-Dotel.forwarding=true` at run time is enough), the host also hands each
default, `-Dotel.forwarding=true` at run time is enough, and a value that is neither `true`
nor `false` stops the start by name), the host also hands each
dataset to the engines' extension route `distributed.trace.forwarder`, where the built-in
forwarder registers itself at start-up (private, two workers; an application that registers
its own function on that route wins). Each dataset becomes **one OpenTelemetry span carrying
Expand Down
99 changes: 92 additions & 7 deletions docs/guides/configuration-reference.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,117 @@ keywords: [configuration, reference, keys, substitution, overrides]
2. The configuration file: `resources/application.yml` | `.yaml` | `.properties` next to
the application file (the file `mercury-serve` is given, or the script `python app.py`
ran), never in the working directory; or `--config <path>`.
3. `${ENV_VAR:default}` substitution inside values: environment first, then a base
configuration key of that name, then the default.
3. `${ENV_VAR:default}` substitution inside values: the environment variable first, then the
configuration key of that name — a `-D` override of it before the file's value, as a key is
read — then the default. A reference that leads back to a key being resolved is logged
(`Config loop for 'key' detected`, as the engines log it) and has no value, so its default
stands. A value its references leave empty is no value either, as in the Java engine: with
`llm.effort: '${LLM_EFFORT:}'` and the variable unset, the key reads as its default — the
idiom for an optional setting — while an empty text written as one (`key: ''`) stays one.

## How a YAML file is read

Every YAML file of the pack — `application.yml`, `rest.yaml`, `app-log-context.yaml`, an
extension's own file — is read by **YAML 1.2.2**, the same way by the Python pack and the Node.js
pack. A scalar written without quotes is resolved by the core schema of the
specification (section 10.3.2), its rows tried in this order:

| Written | Read as |
|---------|---------|
| nothing, `~`, `null`, `Null`, `NULL` | no value: the key reads as a key that is not there, so its default applies |
| `true`, `True`, `TRUE`, `false`, `False`, `FALSE` | a boolean |
| `[-+]?[0-9]+` — `16000`, `-5`, `010` | an integer in base 10, exact at any size: `010` is 10 |
| `0o[0-7]+` — `0o17` | an integer in base 8 |
| `0x[0-9a-fA-F]+` — `0x1F` | an integer in base 16 |
| `[-+]?[0-9]+(\.[0-9]*)?([eE][-+]?[0-9]+)?` with a point or an exponent, or `[-+]?\.[0-9]+([eE][-+]?[0-9]+)?` — `1.5`, `16000.0`, `1e3`, `.5` | a float |
| `.inf`, `.Inf`, `.INF`, also with a sign; `.nan`, `.NaN`, `.NAN` | a float |
| anything else, and anything in quotes | text |

So `yes`, `no`, `on`, `off`, `y` and `n`, a number with an underscore (`16_000`), in base 2
(`0b101`) or in base 60 (`1:30`), `-0x10`, a date (`2026-11-30`), `=` and `<<` are text, and `<<`
as a key is a key like any other, not the merge key. A switch or a flag written `yes` is refused by
name (`rest.automation must be true or false`), never read as on and never as off. Under an
explicit tag a scalar is valid when the tag is one of the core schema's (`!!str`, `!!int`,
`!!float`, `!!bool`, `!!null`) and its content one of that tag's rows; a file with any other tag
(`!!binary`, `!!timestamp`, `!!set`) does not load.

### Write YAML 1.2.2, and none of the additional syntax of YAML 1.1

This is the recommendation for whoever writes a file, a developer or an AI assistant. The Java
engine's reader (SnakeYAML) reads YAML 1.1 and still accepts the older syntax, so a file that uses
it reads one way in the Java engine and another way in the packs. The Rust engine reads YAML 1.2 as
well; its library departs from the core schema in three spellings, which the table shows:

| Do not write | The Java engine reads | The Rust engine reads | The packs read | Write |
|--------------|-----------------------|-----------------------|----------------|-------|
| `yes`, `no`, `on`, `off` | a boolean | text | text | `true`, `false` |
| `010`, `08` | 8 (base 8), text | text | 10, 8 | `10`, `8` — or `'010'` when it is text |
| `0o10` | text | 8 | 8 | `8` |
| `0b101` | 5 | 5 | text | `5` |
| `-0x10` | -16 | -16 | text | `-16` |
| `1:30` | 90 (base 60) | text | text | `90` — or `'1:30'` when it is text |
| `16_000` | 16000 | text | text | `16000` |
| `2026-11-30` | a date, written in the time zone of its JVM | text | text | `'2026-11-30'` |
| `<<: *base` | the merge key | a key named `<<` | a key named `<<` | the keys themselves |

`yes`/`no`/`on`/`off`, `0b101`, `1:30`, `16_000` and the merge key are syntax of YAML 1.1 only. A
number with a leading zero (`010`, `08`), `0o10` and an unquoted date are valid YAML 1.2.2 and are
to be avoided all the same, because the Java engine reads them another way and the Rust engine keeps a
number with a leading zero as text. `y` and `n`, booleans
in YAML 1.1 itself, are text in every runtime. The forms every runtime reads alike: `true` and `false`; a plain decimal number without a leading zero, an underscore or a
colon (`16000`, `-5`, `1.5`, `1e3`); `0x` for base 16 (`0x1F`); and quotes around any text that
could be read as a boolean, a number, a date or no value (`'true'`, `'010'`, `'1e3'`,
`'2026-11-30'`, `'null'`).

### The text of a value

As text — what `get_property` returns, and what a reference inside a longer text is replaced by — a
boolean is `true` or `false` and a float keeps its point (`1.0`, never `1`), so
`info.app.version: 1.0` reads `1.0` in both packs; a float is written as Python writes one, which
is the Java engine's text too between 0.001 and 10,000,000. A mapping key YAML read as something
other than text (`True:`, `8080:`) is the text of that value (`true`, `8080`). A tab is read as two
spaces, as the Java engine reads a file, so one indented with tabs loads. A file whose document is
not a mapping has no keys, and the last of two equal keys stands.

## A number, a duration and a switch

The settings of the host read these by one rule, the same in both packs; a value that is none of
them stops the start by name instead of being read as off or as a default:

- **a whole number** — a number with a whole value (`16000`, `16000.0`), or text of the digits
`0`-`9` with white space around them at most, up to 9007199254740991. A sign, an underscore, a
point or an exponent in text and a digit of another script are refused
(`rest.upload.max.bytes must be a whole number >= 0`);
- **a duration** — such a number, in seconds, or the number and, right after it, one of `ms`, `s`,
`m`, `h`, `d`: `30`, `30s`, `500ms`, `2m`
(`event.stream.keep.alive must be a duration such as 30s, 2m or 500ms (seconds, ms, s, m, h, d), or 0 for none`);
- **a switch** — the boolean `true` or `false`, or that text in any letter case; no value and an
empty one are the default (`rest.automation must be true or false`).

## Well-known keys (shared with the engines)

| Key | Meaning | Default |
|-----|---------|---------|
| `application.name` | application identity in logs, `/info` and `/health` | `application` |
| `rest.server.port` | Event API + actuator port | `8085` |
| `rest.server.port` | Event API + actuator port: a whole number up to 65535, `0` for one the system picks | `8085` |
| `log.format` | `text`, `json` (pretty-printed) or `compact` (single-line JSONL) | `text` |
| `log.level` | log level; the `LOG_LEVEL` environment variable wins | `INFO` |
| `app.log.context` | the application log context: a `context` block on every structured log line inside a traced request ([guide](function-patterns.md#trace-context-and-span-lineage)); a switch — `false` opts out, any value but `true` or `false` stops the start | `true` |
| `info.app.version` | version reported by `/info` | package version |
| `info.app.description` | description reported by `/info` | `application.name` |
| `show.env.variables` | opt-in list of environment variables shown by `/env` | (empty) |
| `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) |
| `rest.automation` | REST automation on: the entries of `rest.yaml` served in front of the functions ([guide](rest-automation.md)) | `false` |
| `rest.automation` | REST automation on: the entries of `rest.yaml` served in front of the functions ([guide](rest-automation.md)); a switch — any value but `true` or `false` stops the start | `false` |
| `yaml.rest.automation` | the one location of `rest.yaml`: `classpath:` the resources folder, `file:` an absolute path, a relative path under the application file's folder | `classpath:/rest.yaml` |
| `rest.upload.max.bytes` | the bound on one upload: its files and its text fields together, counted in bytes (413 beyond it) | `16777216` |
| `rest.upload.max.bytes` | the bound on one upload: its files and its text fields together, counted in bytes (413 beyond it); a whole number | `16777216` |
| `http.trace.id.header` | the trace-id header a traced entry reads when no W3C `traceparent` arrives (`trace.id.header` overrides it per entry) | `X-Trace-Id` |
| `http.correlation.id.header` | the business correlation-id header, always ensured and echoed (`correlation.id.header` per entry) | `X-Correlation-Id` |
| `http.traceparent.header` | a custom name for the W3C `traceparent` header, read only when the standard one is absent (`traceparent.header` per entry) | `traceparent` |
| `event.stream.keep.alive` | the keep-alive comment interval of a Server-Sent Events reply (`/api/event` and streaming entries); `0` disables | `30s` |
| `event.stream.keep.alive` | the keep-alive comment interval of a Server-Sent Events reply (`/api/event` and streaming entries): a duration up to 2147483647 ms (about 24.8 days, the longest a timer of the Node.js pack holds); `0` disables | `30s` |
| `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.forwarding` | the OpenTelemetry forwarder's master switch ([guide](config-logging-actuators.md#distributed-tracing-the-opentelemetry-forwarder-opt-in)); a switch — any value but `true` or `false` stops the start | `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) |
| `otel.exporter.otlp.timeout` | per-export timeout in milliseconds | `10000` |
Expand Down
5 changes: 3 additions & 2 deletions docs/guides/function-patterns.md
Original file line number Diff line number Diff line change
Expand Up @@ -132,8 +132,9 @@ engines' app-log-context feature, on by default) - the standard trace context
`parentSpanId`, `service`, `timestamp`) - so application logs and the
distributed-trace records correlate in one aggregation. Customize with your
own `resources/app-log-context.yaml` (`context:` section mapping output keys
to reserved `$tokens` or constants, `${ENV:default}` supported), opt out with
`app.log.context=false`, and add per-request key-values from a handler with
to reserved `$tokens` or constants, `${ENV:default}` supported; read as every YAML
file of the pack is), opt out with `app.log.context=false` (a switch: any value but
`true` or `false` stops the start), and add per-request key-values from a handler with
`update_context("tenant", "acme")` (a logging-only sink; reserved keys are
guarded; `None` removes).

Expand Down
Loading
Loading