window.crewship. The viewer’s browser passes each call on to the
server, and the server applies the same permissions as for the viewer’s own
requests.
Interactive artifacts are off by default. All of the following must be on:
A workspace owner or admin turns on the flags with
crewship feature-flag enable artifact_projects,
crewship feature-flag enable artifact_dashboard_data and
crewship feature-flag enable artifact_interactive (see
feature-flag). An operator can turn the last one on for
every workspace with CREWSHIP_ARTIFACT_INTERACTIVE_ENABLED=true.With artifact_interactive off, nothing changes: a Project that contains
interactive.json opens as an ordinary, script-free preview.How an interactive artifact is put together
An interactive artifact is a Project with two extra JSON files:
The HTML screens hold the markup, inline
<style> and inline <script>
elements. Scripts run in document order; type="module" is supported. CSS
files of the Project apply to every screen. Links to other screens do nothing
inside a running screen; switch screens with the bar above the preview, or
build the page as one screen that changes its own content.
Create one
Ask an agent for a Project as described in Projects, and say that it should be interactive, includeinteractive.json and dashboard.json, and keep
its state in the declared collections. From the command line, put all files in
one manifest and create the Project:
crewship page artifact get lunch-poll. With every switch on, the output has an
interactive object with runtime_url (the separate application domain;
empty when none is configured) and the declared collections. Without it the
Project opens as an ordinary preview.
Open it
1
Open the artifact
Open Artifacts, select the Project and click Open. The address is
/artifacts/<id>.2
Use it
Preview shows Loading interactive artifact… until the page’s
scripts have started, then the page itself. Clicks and typing go to the
page.
3
Comment on it
Press Select to comment on an element. While Select is on, the preview
shows the screen without running its scripts, so comments anchor to
stable markup. Turn Select off to use the page again.
crewship.data.get again, for
example on a button or a timer; the runtime does not push changes.
The runtime: window.crewship
Every call returns a promise. A refused call rejects with an Error whose
code is one of invalid, forbidden, conflict, limit or unavailable.
The current interactive Dashboard can use preferences for view state such
as a filter. Other previews do not expose a storage backend. Preferences stay in the
viewer’s browser (local storage, keyed by person, workspace and artifact): they are
never sent to the server, other Crewship accounts never get them, and anyone,
including a reader without edit access, can save their own. They stay in this
browser after you sign out (anyone using the same browser profile could read
them there); clearing the browser’s site data forgets them, and a private
window forgets them when it closes.
There is no delete; write a value such as
{"done": true} instead.
A conflict means someone wrote the document after you read it. Nothing was
overwritten. Read again, decide, and write with the new version. Do not retry
the same write.
Who can do what
Each call is made with the viewer’s own session. The server decides with the same rules as for Dashboard data:
A workspace owner or admin can also read the data of any version of the
artifact; each such read is recorded in the audit log. Writing still needs
ownership or edit access.
Interactive data is not stricter than Dashboard data: an editor’s script can
change the shared collections just as the editor can from the CLI. Give edit
access only to people you trust to change that data.
When the viewer has no edit access, or is looking at an older version, the
browser refuses
crewship.data.batch itself with forbidden before anything
is sent. People without access to the artifact cannot open it at all.
What the page can and cannot do
The page runs in a frame withsandbox="allow-scripts" on a separate site,
under a policy that blocks network access.
If the page navigates its frame away, the viewer stops it with The artifact
navigated away from its verified document and was stopped.
Limits
Messages you may see
Related
- Dashboards: the same collections, bound to HTML without scripts.
crewship page artifact data: read and write the collections from the command line.- Projects