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
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
</p>

<p align="center">
<a href="https://ota-ns.getcortexlabs.com/guide/">Documentation</a> · <a href="https://github.com/getcortexlabs/ota-nativescript/issues/1">Roadmap (#1)</a> · <a href="./SUPPORT_MATRIX.md">Support matrix</a> · <a href="https://github.com/getcortexlabs/ota-nativescript/milestones">Milestones</a>
<a href="https://otto.getcortexlabs.com/docs/guide/">Documentation</a> · <a href="https://github.com/getcortexlabs/ota-nativescript/issues/1">Roadmap (#1)</a> · <a href="./SUPPORT_MATRIX.md">Support matrix</a> · <a href="https://github.com/getcortexlabs/ota-nativescript/milestones">Milestones</a>
</p>

```ts
Expand All @@ -38,9 +38,9 @@ Shipping JavaScript over the air in NativeScript breaks in three specific ways w

`ota-nativescript` addresses those directly. Minimal native bootstrappers on iOS and Android select the active bundle before V8 starts, without forking `@nativescript/ios` or `@nativescript/android` and without hand-editing generated `platforms/` folders. Bundles are staged atomically as complete, Ed25519-signed packages verified against a per-platform runtime contract, activated on the next full process launch, and rolled back offline if startup fails before `markReady()`.

The SDK stays independent of any specific UI library or hosting backend. It speaks a server-agnostic HTTP contract tested locally via a fixture server; [Orbit](https://github.com/getcortexlabs/orbit-docs) integration and Mavis CLI setup come separately once the on-device SDK holds on release builds.
The SDK stays independent of any specific UI library or hosting backend. It speaks a server-agnostic HTTP contract tested locally via a fixture server; [Otto](https://otto.getcortexlabs.com) provides the hosted console, app-scoped publishing, channels and delivery telemetry. The SDK also works with self-hosted Otto or any compatible server.

**Current status (M0–M3 + `#15`, `#16`, `#17` verified).** All v0.1 milestones plus NativeScript 9.1 `@nativescript/vite` production support ([#15](https://github.com/getcortexlabs/ota-nativescript/issues/15)), Android V8 snapshot compatibility rules & `codeCache` verification ([#16](https://github.com/getcortexlabs/ota-nativescript/issues/16)), and content-addressed file reuse across releases ([#17](https://github.com/getcortexlabs/ota-nativescript/issues/17)) are delivered and verified 8/8 on both **Webpack 5** (`fixtures/vue-mavis-app`, NativeScript-Vue 3 + Mavis + Jolt) and **Vite 8 / Rolldown** (`fixtures/vite-app`, native ESM + `require(esm)` + `ns:util` + Web Worker) running on iOS 26.2 Simulator (`@nativescript/ios` `9.1.1`) and a physical Xiaomi `M2103K19PG` Android 16 / API 36 device (`@nativescript/android` `9.1.3`, signed R8 `minifyEnabled true` APK). Full operational docs and interactive Jolt Web labs live at [ota-ns.getcortexlabs.com](https://ota-ns.getcortexlabs.com/guide/). Follow roadmap & ecosystem integrations in [#1](https://github.com/getcortexlabs/ota-nativescript/issues/1).
**Current status (M0–M3 + `#15`, `#16`, `#17` verified).** All v0.1 milestones plus NativeScript 9.1 `@nativescript/vite` production support ([#15](https://github.com/getcortexlabs/ota-nativescript/issues/15)), Android V8 snapshot compatibility rules & `codeCache` verification ([#16](https://github.com/getcortexlabs/ota-nativescript/issues/16)), and content-addressed file reuse across releases ([#17](https://github.com/getcortexlabs/ota-nativescript/issues/17)) are delivered and verified 8/8 on both **Webpack 5** (`fixtures/vue-mavis-app`, NativeScript-Vue 3 + Mavis + Jolt) and **Vite 8 / Rolldown** (`fixtures/vite-app`, native ESM + `require(esm)` + `ns:util` + Web Worker) running on iOS 26.2 Simulator (`@nativescript/ios` `9.1.1`) and a physical Xiaomi `M2103K19PG` Android 16 / API 36 device (`@nativescript/android` `9.1.3`, signed R8 `minifyEnabled true` APK). Full operational docs and interactive Jolt Web labs live at [otto.getcortexlabs.com/docs](https://otto.getcortexlabs.com/docs/guide/). Follow roadmap & ecosystem integrations in [#1](https://github.com/getcortexlabs/ota-nativescript/issues/1).

## How it works

Expand Down
4 changes: 2 additions & 2 deletions docs/.vitepress/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@ export default defineConfig({
['link', { rel: 'icon', type: 'image/png', sizes: '192x192', href: '/favicon-192.png' }],
['link', { rel: 'apple-touch-icon', sizes: '180x180', href: '/apple-touch-icon.png' }],
['meta', { name: 'theme-color', content: '#0c100f' }],
['meta', { property: 'og:image', content: 'https://ota-ns.getcortexlabs.com/logo.png' }],
['meta', { name: 'twitter:image', content: 'https://ota-ns.getcortexlabs.com/logo.png' }],
['meta', { property: 'og:image', content: 'https://otto.getcortexlabs.com/docs/logo.png' }],
['meta', { name: 'twitter:image', content: 'https://otto.getcortexlabs.com/docs/logo.png' }],
],
themeConfig: {
logo: {
Expand Down
3 changes: 2 additions & 1 deletion docs/.vitepress/sidebar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export const SIDEBAR_GROUPS: SidebarGroupMeta[] = [
{
id: 'operations',
title: ['Operations & release', 'Operação e release'],
slugs: ['store-policy', 'support-matrix', 'validation'],
slugs: ['otto', 'store-policy', 'support-matrix', 'validation'],
},
{
id: 'reference',
Expand All @@ -48,6 +48,7 @@ const pageTitles: Record<string, Bilingual> = {
fingerprinting: ['Runtime fingerprinting', 'Fingerprint de compatibilidade'],
cli: ['CLI reference (ota-ns)', 'Referência da CLI (ota-ns)'],
'fixture-server': ['Fault-injection server', 'Servidor local de falhas'],
otto: ['Operating Otto', 'Operando o Otto'],
'store-policy': ['Store policy boundaries', 'Regras das lojas'],
'support-matrix': ['Support matrix', 'Matriz de suporte'],
validation: ['Device validation (8/8)', 'Validação em devices (8/8)'],
Expand Down
10 changes: 9 additions & 1 deletion docs/guide/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ Removes any release directories in `releases/` not referenced by active, `confir

### `updates.onEvent(listener): () => void`

Subscribes to structured `OtaLifecycleEvent` updates (`check_started`, `download_progress`, `staged`, `boot_confirmed`, `recovery_triggered`, `error`) and returns an unsubscribe function.
Subscribes to structured `OtaLifecycleEvent` updates (`download_completed`, `validation_failed`, `staged`, `startup_confirmed`, `recovered_fallback`) and returns an unsubscribe function.

## Error codes (`OTA_ERROR_CODES`)

Expand All @@ -91,3 +91,11 @@ All verification, compatibility, download and staging failures throw `OtaError`
- **Crypto & protocol:** `SIGNATURE_INVALID`, `KEY_NOT_FOUND`, `MANIFEST_INVALID`, `DIRECTIVE_INVALID`, `DIRECTIVE_RELEASE_MISMATCH`, `REPLAY_DETECTED`, `INSECURE_URL`
- **Compatibility:** `PLATFORM_MISMATCH`, `APP_ID_MISMATCH`, `TARGET_BUILD_MISMATCH`, `RUNTIME_CONTRACT_MISMATCH`, `PROTOCOL_VERSION_UNSUPPORTED`
- **Integrity & staging:** `HASH_MISMATCH`, `SIZE_MISMATCH`, `MISSING_FILE`, `UNEXPECTED_FILE`, `UNSAFE_PATH`, `BUNDLE_TOO_LARGE`, `DOWNLOAD_FAILED`, `STORAGE_IO_ERROR`, `RELEASE_BLOCKLISTED`

## Installation references and remote reports

Create one `createOtaUpdates({ installId })` instance with a random app-scoped UUID persisted across launches, and use that instance for `markReady()` and checks. [Operating Otto](./otto#observed-installations) includes a NativeScript persistence example. The default singleton does not invent an installation identity.

The optional ID accompanies checks and lifecycle reports. Checks also report a timestamp and nullable confirmed/prepared release IDs. `recovered_fallback.recoveredAt` preserves the native recovery time, while its `timestamp` is the report time. Telemetry failure never blocks offline startup confirmation or recovery. A new SDK build is required for these optional observation fields; legacy reports stay valid and anonymous when no ID is supplied.

`download_completed` includes downloaded/reused bytes, file counts and staging duration. `validation_failed` carries a stable error code. `staged` identifies the prepared release/directive. `startup_confirmed` reports the actual boot source and release. `recovered_fallback` identifies the failed release and fallback destination. Download progress is the `onProgress` callback, not a separate lifecycle event.
30 changes: 30 additions & 0 deletions docs/guide/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,33 @@ Verifies:
## `ota-ns serve`

Starts the local HTTP/TLS fixture server for device and simulator testing. See [Fault-injection server](/guide/fixture-server) for full mode documentation.

## `ota-ns publish`

In Otto Console, register the application ID, pin the release public key from `ota-ns keygen`, and create an app publishing token. Set `OTTO_TOKEN` in your shell or CI secret store, then send a bundle previously produced by `ota-ns pack`.

```sh
ota-ns publish --bundle ./dist-ota --endpoint https://otto.getcortexlabs.com/api/publish --channel beta
```

New apps start with `beta` and `production`. Owners can create more channels in **Settings → App**. Use a registered, active channel name: lowercase letters, numbers and hyphens, beginning with a letter, up to 48 characters; `all` is reserved. The SDK must use the same channel name. The CLI checks the signed inventory against the files before sending them. Otto verifies the manifest signature with the pinned key. The server accepts up to 32 MiB of files per bundle. Retrying the same publication keeps subsequent pauses and rollbacks in effect. Use `--json` for a machine-readable receipt.

Attach the fingerprint for the exact native build when publishing:

```sh
ota-ns publish --bundle ./dist-ota --endpoint https://otto.getcortexlabs.com/api/publish --channel internal --fingerprint ./ota.baseline.ios.json
```

`--fingerprint` accepts the raw JSON saved by `ota-ns fingerprint --write-baseline`. The CLI checks its section hashes, runtime contract, platform and target build before sending it. Otto repeats those checks and saves the report with the publication. The optional report is separate from the signed bundle and does not change its signature. Up to 2 MiB and 10,000 fingerprint entries are accepted. Private signing keys stay local.

### Operating a release in Console

**Releases → Compare** compares two signed file inventories from the same platform: added, changed, removed and identical files, bundle sizes, signing key IDs and native targets. Identical bytes are a potential reuse opportunity; actual reuse depends on files present on each device.

**Releases → Compatibility** shows native delivery routes, recent real check outcomes and a simulation using the same decision rules as `/api/check`. The simulation issues no directive and stores no report. Real checks are aggregated by UTC hour and outcome, with up to 2,000 groups per app for 7 days; the Console shows the latest 200 groups. Installation IDs are used for rollout calculations but are not stored in these diagnostics. These counts are requests, not unique devices.

Import another fingerprint in this view to compare runtime, native plugins, native resources, generated metadata and static bindings. Browser import also accepts the `{ fingerprint, diff }` output of `fingerprint --json`. A `static-only` report is incomplete: rebuild natively and regenerate it before deciding compatibility. Reports are supplied by the team and are not attestation of an installed binary. Each app retains up to 100 distinct native reports.

**Activity** retains SDK download bytes, reused bytes/files, staging duration, startup attempts and fallback destination. Aggregates follow the active filters across all retained matching events, not just the current page; Overview uses the last 24 hours. Older reports without metrics remain visible and are excluded from those aggregates. Lifecycle reports are best effort, not unique-device adoption or billing metrics.

Archiving a channel stops new publishing and update directives through it, while preserving history and downloaded bundles. Restoring resumes its saved delivery rules. Owners manage channels; publishers can dispatch releases and import native reports; viewers can inspect and simulate. Up to 20 channels, including archived channels, can exist per app.
2 changes: 1 addition & 1 deletion docs/guide/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Treating OTA updates in NativeScript as a JavaScript file copy breaks in three c

## Server-agnostic by design

The on-device SDK speaks an explicit, signed HTTP contract (`POST /check`, signed `manifest.json`, immutable file URLs, optional `POST /events`). You can host releases on static object storage + any backend, test locally with `ota-ns serve`, or connect Orbit once the hosted control plane lands.
The on-device SDK speaks an explicit, signed HTTP contract (`POST /check`, signed `manifest.json`, immutable file URLs, optional `POST /events`). You can host releases on static object storage + any backend, test locally with `ota-ns serve`, or connect Otto for workspaces, channels, signed delivery directives and the Console. See [Operating Otto](./otto).

## What can ship over the air

Expand Down
66 changes: 66 additions & 0 deletions docs/guide/otto.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Operating Otto

Otto puts the public site, Console, documentation and API under one origin: `https://otto.getcortexlabs.com`, `/dashboard`, `/docs` and `/api`. A self-hosted installation uses the same paths on its own domain. The domain is the intended canonical address; verify the deployment before connecting production apps.

## First delivery

Create an account, verify its email and create a workspace. The workspace selector opens existing workspaces; **New workspace** below that selector creates another. Owners manage apps, access, signing keys, tokens and storage. Publishers manage deliveries; viewers inspect the workspace.

Register the app identifier and platforms in the Console. In **Settings → App & integrations**, register your release public key, create a scoped publishing token, choose a channel and copy the generated `ota.config.json`. Keep the release private key in your signing environment. The app trusts both the release key and Otto's delivery public key; never put a publishing token in the app.

Build the store binary with its native runtime fingerprint. Use `ota-ns pack` and `ota-ns verify`, then publish:

```sh
# Supply OTTO_TOKEN through your secret manager or shell environment.
ota-ns publish --bundle ./dist-ota \
--endpoint https://otto.getcortexlabs.com/api/publish --channel beta
```

The Console offers delivery/pause/rollback, per-channel rollout percentages, native compatibility comparison and a request simulator. A compatible OTA changes JavaScript and assets. Changes to native dependencies, permissions or the native contract require a new store binary.

## Observed installations

**Activity → Installations** shows the latest reported running version, startup confirmation, prepared release, recent failure and last contact. Counts cover references seen in the selected period, with a 30-day retention window and a limit of 10,000 references per app. They are not people, a count of every installed app, or proof of ongoing device health. Anonymous SDK reports still appear in the delivery log.

Opt in with a random UUID persisted by your app. Use a separate identifier per app; do not use an email address, advertising identifier or hardware identifier. For example, with NativeScript's platform types available:

```ts
import { ApplicationSettings, isAndroid } from '@nativescript/core';
import { createOtaUpdates } from '@getcortexlabs/ota-nativescript';

let installId = ApplicationSettings.getString('otto.installation');
if (!installId) {
installId = isAndroid ? java.util.UUID.randomUUID().toString() : NSUUID.UUID().UUIDString;
ApplicationSettings.setString('otto.installation', installId);
}
const updates = createOtaUpdates({ installId });
// Use this instance for markReady(), checkAndStage() and event subscriptions.
```

Otto derives a platform/app-scoped HMAC reference and stores that reference rather than the raw ID. Reinstallation or restored app data may change identity semantics. Out-of-order reports remain in the log but cannot rewind a newer running state. A staged release is not counted as adoption. Recovery timestamps reflect when native recovery happened, even if reported later.

These lifecycle identity extensions require an SDK build that contains them. Older versions may send `installId` only on checks and remain anonymous in lifecycle events. The signed manifest and directive formats are unchanged.

## Delivery protection

**Settings → Delivery protection** is off by default. Choose a time window, a failure percentage and at least three affected installation references. Only distinct identified clients offered the same active delivery sequence and reporting within the configured window contribute. Repeated reports cannot multiply the sample. Anonymous reports and failures from older delivery sequences cannot trigger a pause.

Automatic pause is a separate opt-in requiring the app name. Reports come from public clients and are not attested; this is a best-effort operational signal, not abuse-resistant device attestation. A pause stops new update directives, not downloads already staged on a device. Review the release before resuming manually.

**Activity → Alerts** lists the latest 100 alerts, with 90-day retention and a cap of 1,000 per app. Acknowledging an alert records review without changing delivery. Email is optional and subscribes only the verified owner who saves the setting. Failed sends retry with backoff up to five attempts. “Accepted by transport” does not prove inbox delivery.

## Storage and retirement

**Settings → Release storage** lets owners pin, retire, restore and clean up artifacts. A current route remains protected even when its channel is archived or delivery is paused. Recently observed running, confirmed, staged and recovery versions are protected too.

Retirement stops redispatch and republication. Cleanup requires 30 days since retirement, expiration of the last offer/download's 30-day lease, no protected reference and a fresh server-checked plan. Pin releases needed by clients that can stay offline longer. Observations cannot account for every offline device.

Cleanup deletes bundle bytes and frees the workspace allowance, retaining the signed manifest, immutable release ID and audit history. A purged ID cannot be republished, downloads return HTTP 410, and restore is unavailable. SQLite can reuse freed pages without shrinking its file immediately. Native fingerprints can be deleted only without live bundle/installation references and without a pin.

## Hosting acceptance

Run one Node server with a persistent local SQLite volume behind HTTPS. Back up using SQLite's online backup API, not a lone copy of an active WAL database. Verify restore in a separate data directory before upgrading. Never place the data directory or SMTP credentials in a public static directory.

Set `OTTO_ORIGIN`, `OTTO_DATA_DIR`, transactional SMTP and the verified administrator list. The private Otto repository includes the container, backup and deployment checks. `OTTO_MAIL_MODE=file` is a loopback-only local outbox, not production delivery.

Before declaring the hosted service ready, validate HTTPS and the intended origin, persistent data across restarts, account verification/recovery and invitation mail, a real CLI publish, signed checks, a cold launch on iOS/Android and the Console's matching reports. The local suite cannot prove DNS, TLS termination, real inbox delivery or the host's backup schedule.
Loading
Loading