## Quick start 1. Host your app at its own origin, for example `https://planner.example.com`. It must not be the same origin as AANCER. 2. Send this header on the embedded page, with your AANCER address: ```text Content-Security-Policy: frame-ancestors https://aancer.example.com ``` 3. Write the pack manifest: ```json { "v": 2, "kind": "bundle", "id": "acme.shift-board", "version": "1.0.0", "title": "Shift board", "publisher": { "name": "Acme Example Ltd", "keyId": "pub-0123456789ab" }, "requires": { "platform": ">=1.0.0" }, "parameters": [ { "id": "target_workspace", "type": "workspace", "label": "Workspace", "required": true } ], "items": [ { "kind": "app", "schemaVersion": 2, "id": "shift-board", "scope": "workspace", "workspace": "{{param.target_workspace}}", "spec": { "id": "shift-board", "title": "Shift board", "icon": "Table", "group": "Operations", "order": 31, "url": "https://planner.example.com/board.html", "origin": "https://planner.example.com", "sso": { "mode": "none" }, "capabilities": ["read:dataset:shift_plan"], "egress": { "hosts": [] }, "embed": { "sandbox": ["allow-scripts", "allow-same-origin"] } } } ] } ``` 4. In the page, say hello to the shell and read the dataset: ```js const PLATFORM = 'https://aancer.example.com'; const bridge = await AancerBridge.connect({ platformOrigin: PLATFORM }); const result = await bridge.call('read:dataset', { datasetId: 'shift_plan', limit: 100 }); render(result.rows); ``` `AancerBridge` is the small helper `bridge.js` from the examples repository (MIT licence). You can also write the messages yourself; see Bridge protocol below. 5. Sign the pack, import and activate it, then approve the app under **Manage app**. The app appears in the Dashboards navigation of that workspace. ## File layout The pack carries only the manifest. Your app is a normal web application on your own server. ```text acme-shift-planner/ # the pack manifest.json # one item of kind "app" (spec inline, or $ref to content/app.json) shift-planner-app/ # your app, deployed at https://planner.example.com server.mjs # serves the pages, redeems the sign-in code, checks tokens public/ index.html # the embedded page app.js # your app logic bridge.js # bridge helper (frame side) ``` ## Field reference JSON Schema: [app.schema.json](https://aancer.ai/dev/schemas/app.schema.json). `$defs/link` and `$defs/card` cover navigation links and Home cards. ### App item | Field | Type | Required | Rules | |---|---|---|---| | `kind` | string | yes | `"app"` | | `schemaVersion` | integer | yes | `2` | | `id` | string | yes | `^[a-z0-9][a-z0-9._-]{0,63}$`. Keep it equal to `spec.id` | | `scope` | string | no | `workspace` (the app shows in one workspace) or `install` (every workspace). Default `install` | | `workspace` | string | if scope is `workspace` | a workspace id or `{{param.}}` | | `spec` | object | yes | the app spec, inline or `{"$ref": "content/app.json"}` | ### App spec | Field | Type | Required | Rules | |---|---|---|---| | `id` | string | yes | `^[a-z0-9][a-z0-9._-]{0,63}$`. Approvals, the app secret and network rules are keyed by it. One active pack per app id | | `title` | string | yes | 1 to 80 characters. The navigation label and frame title | | `icon` | string | no | at most 40 characters, an icon name such as `Clock`, `Table` or `Calendar` | | `group` | string | no | at most 40 characters. The heading the app is listed under in the navigation | | `order` | integer | no | 0 or more, default 100. Sorting is by group, order, then title | | `url` | string | yes | https only, 9 to 2048 characters. No user or password, no `#fragment`. The only placeholder is `{{workspace}}` | | `origin` | string | yes | exactly the origin of `url`: scheme, host and port, no trailing slash | | `sso` | object | yes | `{ "mode": "code" or "none", "scopes"?: ["profile", "workspace"] }` | | `capabilities` | string[] | yes | up to 20, unique. See Capabilities. `[]` is valid | | `egress` | object | no | `{ "hosts": [...] }`: up to 20 extra hosts, `api.example.com` or `*.example.com`. Never `*` | | `embed` | object | no | `{ "sandbox": [...], "height"?: "full" or "auto" }`: `sandbox` takes up to 5 of `allow-scripts`, `allow-forms`, `allow-same-origin`, `allow-popups`, `allow-downloads` | | `csp` | object | no | `{ "connectSrc": [...] }`: up to 10 https origins the frame may connect to | | `workspace` | string | no | a workspace id or `{{param.}}` | No other fields are allowed. `url` rules in detail: - `{{workspace}}` is replaced by the URL-encoded workspace id, but only if the `workspace` identity scope is approved. Otherwise it becomes an empty string. - The host must not be a loopback, link-local or cloud metadata address. An IP address as host needs the operator to allow private origins; use a DNS name. - The app origin must differ from the AANCER origin. Use a separate host name such as `planner.example.com`. ### Sign-in modes and scopes | `sso.mode` | What happens | Default scopes | |---|---|---| | `code` | the frame receives a one-time code; your server redeems it and gets the user's identity | `profile`, `workspace` | | `none` | no sign-in; the app uses the bridge only | none | | Scope | Gives your app | |---|---| | `profile` | user id (`sub`), e-mail, display name | | `workspace` | workspace id and the user's role label | The role is a label for display. Do not use it to decide what a user may do. The bridge already applies the user's real permissions. ### Capabilities | Capability | Lets the app | User permission needed in the workspace | |---|---|---| | `read:me` | read the user's identity (within the approved scopes) | none | | `read:dataset:` | read rows of dataset `` | `datasets.view_own` | | `write:dataset:` | append or upsert rows in dataset `` | `datasets.write_own` | | `query:model:` | run a query on BI model `` | `dashboards.view_own` | | `navigate` | move the user to another AANCER page | none | | `notify` | show a short notice in AANCER | none | Dataset ids in capabilities match `[a-z][a-z0-9_]{0,63}` (no dashes). Model ids match `[a-z][a-z0-9_.-]{0,63}`. A capability works in a session only if it is declared in the manifest, approved by an administrator, and granted when the session starts. ### Sandbox The frame is `