The app SDK defines the contract that a RentnerProxy app and its platform must fulfil: the app manifest, release and
catalog documents, the platform API, the app protocol, the UI bridge and the HTTP surface over app.sock and
core.sock. It ships as one versioned contract with matching implementations:
contracts/v1holds the TypeScript sources, the generated JSON Schema and OpenAPI documents and the shared fixtures.core/holds the Rust crates that validate and process the contract.packages/app-contractsbuilds the TypeScript package.
| Package | Install | Purpose |
|---|---|---|
@rentnerproxy/app-contracts |
npm install @rentnerproxy/app-contracts |
Zod schemas, validators, typed HTTP descriptors, JSON Schema, OpenAPI and fixtures |
rentnerproxy-app-contracts |
cargo add rentnerproxy-app-contracts |
Offline validators and typed HTTP and protocol descriptors |
rentnerproxy-app-catalog |
cargo add rentnerproxy-app-catalog |
Verify and update signed app catalogs |
rentnerproxy-app-pipeline |
cargo add rentnerproxy-app-pipeline |
Package, evidence and smoke-probe operations |
rentnerproxy-artifacts |
cargo add rentnerproxy-artifacts |
Bounded JSON, file and stream helpers |
rentnerproxy-app-runtime |
cargo add rentnerproxy-app-runtime |
Write app backends in Rust: bootstrap, platform API client and app.sock server |
core/tooling is the unpublished generator and packaging tool behind bun run contracts:generate.
The contract has one version, and every package and crate carries it: @rentnerproxy/app-contracts, the five crates
and contractVersion in contracts/v1/primitives.ts always match, and a release tag is v<version>.
- The contract follows SemVer. Within v1, changes are additive: new optional fields, operations and fixtures that existing apps and platforms keep working with. Tighter validation of accepted documents is a breaking change.
- A breaking change needs a new major version and a new
contracts/v<major>source tree. v1 stays available. - Patch releases fix defects without changing what a valid document is.
The platform API, the app protocol and the UI bridge share one protocol version, PROTOCOL_VERSION in the Rust crate
and currentProtocolVersion in the package. It is not the contract version: it rises only when a release adds
protocol features that an app may need, and it stays within major 1.
| Protocol | Contract | What it adds |
|---|---|---|
| 1.0.0 | 1.0.0 | The first stable protocol. |
| 1.1.0 | 1.4.0 | abortLegacyHandoff, offered and refused in LegacyHandoffStatus, and results in x-rentnerproxy-access (list filters). |
| 1.2.0 | 1.5.0 | permissionKeys in the UI bridge context message: the app's permission keys that the current user holds. |
- A platform advertises the version it implements at installation, in the bootstrap descriptor and in the platform
context. It checks an app's
requires.platformApi,requires.appProtocolandrequires.uiBridgeranges against that version, so an app that needs a newer feature declares>=1.1.0 <2.0.0and a platform below 1.1.0 refuses to install it. An app that declares>=1.0.0 <2.0.0runs on every platform of major 1 and must not use newer features. - The version an app runs with is negotiated per app from its manifest, not taken from the platform. For
appProtocol,platformApianduiBridge(only when the app declares a UI), the negotiated version is the lower bound of therequiresrange. It must be at most the version the platform implements and must satisfy the range; otherwise the app is incompatible.>=1.0.0 <2.0.0negotiates 1.0.0 and>=1.1.0 <2.0.0negotiates 1.1.0, so an app built for 1.0.0 keeps being bootstrapped with 1.0.0 on a 1.1.0 platform.Contracts::negotiate_versionsin the Rust crate andnegotiateVersions(requires, environment)in the package implement the rule; platforms and the candidate smoke use them, and an app should compare the versions it receives with its own negotiated ones instead of a hard-coded constant. - An app reports in
GET /app/v1/readythe protocol version it speaks. That is the version of the bootstrap descriptor, which is the negotiated version, capped at the version the app was built for. The platform accepts any version of major 1 that its own version and the app'srequires.appProtocoladmit; it must not compare it for equality with its own version.rentnerproxy-app-runtimereports exactly that. - Provider registrations keep the provider API version
1.0.0, and UI bridge messages keepbridgeVersion1.0.0: both are wire versions of their own and do not move with the protocol version. - The bootstrap descriptor and the readiness document accept any protocol version of major 1, because the manifest ranges decide compatibility. Do not pin a single version in an app.
An app UI runs in a sandboxed iframe and cannot ask which of the app's permissions the current user holds. Since
protocol 1.2.0 the host tells it in the UI bridge context message: permissionKeys lists the keys from the manifest
permissions that the user holds, as the manifest declares them (without the app ID), unique and in ascending ASCII
order, at most 64. The UI can then show a read-only view instead of a form whose save fails with 403.
- An app that wants the keys declares
requires.uiBridge>=1.2.0 <2.0.0. - A host sends
permissionKeysonly to apps whose negotiateduiBridgeis 1.2.0 or newer, and always includes it for them. An empty array means that the user holds none of the keys. - A host never sends it to an app on an older bridge version, because the strict validators of those apps reject unknown members.
- The keys only help the UI choose what to show. The platform still enforces
x-rentnerproxy-accesson every call. bridgeVersioninruntime:bootstrapstays the literal1.0.0. The negotiateduiBridgeversion, notbridgeVersion, decides whether the context carries the keys.
An official app takes over a built-in feature domain, such as monitoring, with the handoff operations. The domain
equals a provider profile that the manifest declares. The calls run on core.sock for the active generation of the
installation:
| Operation | Request | Result |
|---|---|---|
getLegacyHandoff |
none | LegacyHandoffStatus: platform, exported or committed |
beginLegacyHandoff |
Idempotency-Key |
exported with the digest and part count, or committed |
readLegacyHandoffPart |
{ digest, sequence } |
{ sequence, part } |
commitLegacyHandoff |
Idempotency-Key, { digest } |
committed |
abortLegacyHandoff |
Idempotency-Key, { digest, reason, detail? } (protocol 1.1.0) |
platform after the platform restored its state |
abortLegacyHandoff is POST /platform/v1/legacy-handoffs/{domain}/abort. An app calls it when it refuses the export
or cannot import it, so built-in features resume instead of staying paused until an administrator resets the
installation.
- When: only while the handoff of the domain is
exportedand not committed, and only by the installation that began it. A committed handoff answers409with the problem codehandoffCommitted. Another installation, or a digest that differs from the recorded export, answers409 conflict. A key reused with other input answers409 idempotencyConflict. Without a handoff of the domain, abort has nothing to undo and returnsplatform. - Effect: the platform deletes the export, runs the
restoreof the domain source, returns the domain to the platform, resumes built-in features and records the reason and time for administrators. The app may call begin again afterwards, which fixes a fresh export; its digest changes only when the exported parts change. - Request:
reasonisinvalidExport,unsupportedFormat,importFailedorother.detailis optional, at most 500 characters without control characters, and must contain no value from the export (no credentials, host names or addresses), because administrators see it. - Idempotency: repeat an interrupted abort with the same key and input to get the same result.
LegacyHandoffStatus carries two optional members since protocol 1.1.0. The platform sends them only to
installations whose manifest requires platform API 1.1.0 or newer, and readers accept documents without them.
| State | offered |
refused |
|---|---|---|
platform |
true: the platform offers a source, so begin exports. false: it does not yet, begin answers 404. |
The last abort of this installation ({ reason, at }), or null when it never aborted. |
exported |
Always true. |
The refusal that preceded the current export, or null. |
committed |
Always true. |
null: committing clears it. |
An app that sees offered: false waits and reads the status again later, instead of probing begin.
digest is lowercase hexadecimal SHA-256 of one UTF-8 text. The text joins these lines with a single line feed (\n)
and no trailing one:
- the label
rentnerproxy-legacy-feature-handoff-v1, - the domain, such as
monitoring, - the part count in decimal,
- the hash of each part in sequence order, where the hash of a part is the lowercase hexadecimal SHA-256 of its
compact
JSON.stringifyform as UTF-8.
import { createHash } from 'node:crypto'
const sha = (text: string) =>
createHash('sha256').update(text, 'utf8').digest('hex')
const digest = (domain: string, parts: unknown[]) =>
sha(
[
'rentnerproxy-legacy-feature-handoff-v1',
domain,
String(parts.length),
...parts.map((part) => sha(JSON.stringify(part))),
].join('\n'),
)An export without parts has the digest of the three lines label, domain and 0. The platform computes the digest when
it fixes the export (exportDigest in the platform's web/src/server/LegacyHandoff/journal.server.ts, label in
web/src/config/legacy-handoff.config.ts). An app can recompute it from the parts it read to verify that it holds the
whole export before it commits: hash JSON.stringify of each part as parsed from the response.
SetIncident accepts plain one-line text for title and message. The SDK rejects link-like text: after ASCII-only
lowercasing, any occurrence of a URL scheme followed by ://, of mailto: or of www. anywhere in the text, also
inside a longer word such as awww.example. Write host names without a leading www. and avoid URLs.
An app declares the operations its UI may call in the OpenAPI document that the manifest names as api. Each
post operation at /app/v1/api/{operationId}, where the path suffix equals operationId, carries an
x-rentnerproxy-access member that the platform enforces on every call. Validate it with operationAccess from
@rentnerproxy/app-contracts/schemas, or with the OperationAccess protocol document.
"x-rentnerproxy-access": {
"permissionKey": "monitoring-read",
"results": {
"capability": { "id": "proxy.hosts.read.v1", "scope": "proxyHosts" },
"listField": "hosts",
"resourceIdField": "hostId"
}
}permissionKeyis required: a key from the manifestpermissions. The platform requires the user to hold it. The platform ignores an operation whose key the manifest does not declare. The UI learns which keys the user holds frompermissionKeysin the UI context (UI bridge 1.2.0).resourceis optional and guards a request that names one resource:capabilityis a capability from the manifest andresourceIdFieldthe member of the request body that holds the resource ID as a string. The platform checks that the user may use that resource under the capability.resultsis optional, needs platform API 1.1.0 and filters a list response per user.capabilityis a capability from the manifest,listFieldthe response member that holds the list andresourceIdFieldthe member of each item that holds its resource ID. The platform drops every item whose resource the user may not see.- Field names are at most 64 ASCII letters, digits and underscores, starting with a letter.
nullis invalid forresourceandresults: omit the member. Unknown members make the platform ignore the operation, and a platform below 1.1.0 rejectsresultsand drops the operation, so an app that uses it requiresplatformApi>=1.1.0 <2.0.0. - The 200 response schema of an operation with
resultsmust be filterable, or the platform ignores the operation:- It is an object schema with
additionalProperties: falseand onlylistFieldand an optionalnextCursoras properties, withoutallOf,anyOforoneOf.nextCursorhas the typestring,["string", "null"]or["null", "string"]. listFieldis anarrayschema without composition. Itsitemsare anobjectschema without composition that listsresourceIdFieldinrequiredand declares it astype: "string".- Local
$refreferences are resolved before the check.
- It is an object schema with
Use Bun 1.4.5 and the Rust toolchain pinned in rust-toolchain.toml.
bun install --frozen-lockfile
bun run contracts:check # generated documents and crate copies are up to date
bun run typecheck
bun run lint
bun run test # TypeScript tests
bun run core:format:check
bun run core:lint
bun run core:testAfter changing contracts/v1, run bun run contracts:generate and commit the regenerated files. They include
contracts.schema.json, openapi.json, http-operations.generated.ts, core/app-contracts/src/http/operations.rs
and the copies that the packaged rentnerproxy-app-contracts crate needs, because a published crate cannot read files
outside its own directory.
bun run package:build <output> <commit> builds the npm tarball and the .crate files exactly as a release does,
verifies that the build is reproducible and smoke-tests the packages as a consumer would use them. It needs a clean
checkout of the given commit.
Releases are published by release.yml without a manual step when a tag vX.Y.Z is
pushed. The workflow, its status banners and its trusted publishing setup are described in
CONTRIBUTING.md.
Read CONTRIBUTING.md before opening a pull request and follow the code of conduct. Report vulnerabilities privately as described in SECURITY.md.
Licensed under the MIT license.