Artifacts are Shiny apps the agent builds from objects in your session. It writes
.gptr/artifacts/<id>/app.R and launches it with peter$app("<id>", data = c("obj")), which
snapshots the named objects into an immutable version directory (v001/, v002/, ...) and
serves it from a supervised background R process on 127.0.0.1, so the console stays free.
gptr_artifacts() lists the artifacts of the workspace (.gptr/, else a temporary
directory) and manages their processes.
Arguments
- id
NULLto list every artifact, or the id of one artifact.- open
TRUEto open the artifact in the IDE viewer or the browser (only in an interactive session); a stopped artifact is relaunched first.- stop
TRUEto stop the artifact's process (interrupt, a 3 s grace, then the process tree is killed).- version
The number of a stored version (
2forv002/) to relaunch and make current.
Value
Without id, a gptr_artifacts data frame with the columns id, title, version
(the current version), status (running, stopped or failed), url, pid, bytes
(disk use of the artifact directory) and path (the working copy). With id, the
gptr_artifact handle: a list with id, title, kind, version, url (it carries the
launch's access token), path, status, checks (parse, launch, http and session,
each TRUE, FALSE or NA, plus messages), screenshot and session; it is returned
invisibly after open, stop or version.
Details
The built-in kind = "html" uses a working page.html and a Shiny serving wrapper.
Both built-in kinds need Shiny to launch. peter$app(..., launch = FALSE) creates a version
without launching it; startup and browser checks therefore remain unperformed. Browser
session checks and screenshots additionally need chromote and Chrome. A check value of
NA means it was skipped. Separate processes organize execution but are not OS sandboxes.
Security considerations
An artifact runs model-written code in a separate R process whose environment holds none of
your registered secrets. It listens only on 127.0.0.1, and every launch gets a new 128-bit
access token that its URL carries (?gptr_token=); without the openssl package on Windows
there is no token and a notice says so. The data snapshot in vNNN/data/ is a copy of the
objects named in data; the .gptr/.gitignore that gptr_init() writes keeps it and run/
out of git.
Options
gptr.artifact_max_bytes (default 5e8): the largest total object.size() of the objects
one version may snapshot; above it peter$app() signals gptr_error_artifact_too_large.
See also
vignette("tools-and-artifacts", package = "gptr") for working files, data
snapshots, checks and lifecycle examples.