Skip to content

plugin-spice

Placement runtime (out-of-process over gRPC)
Source github.com/opencharly/plugin-spice/candy/plugin-spice
Candy plugin-spice

This plugin is not listed in charly/charly.yml’s compiled_plugins:. It is not part of the shipped binary: charly builds and loads it out-of-process over gRPC when a plan references one of its words (the coexist path).

The reserved words this plugin serves:

  • spice — verb class

OUT-OF-TREE charly plugin serving the spice SPICE-wire display/input check verb — a standalone Go module (go.mod + main.go) that speaks the SPICE remote-desktop protocol over go-plugin gRPC via the charly plugin SDK (github.com/opencharly/sdk). charly’s loader fetches this candy’s repo, go-builds the provider binary on the HOST, and serves it OUT-OF-PROCESS via LocalTransport — so the github.com/Shells-com/spice library lives HERE (vendored under third_party/spice), out of charly’s core go.mod, with its cgo audio channels (the opus/portaudio decoders) removed ENTIRELY so it is unambiguously pure Go — no opus/portaudio/asound/jack (the fourth dep-shed after candy/plugin-appium, candy/plugin-adb, candy/plugin-kube). Since the schema-compaction cutover an authored spice: step desugars to the internal plugin/plugin_input envelope, and every spice-exclusive modifier (method/x/y/text/key/artifact/…) lives in the plugin’s OWN #SpiceInput (schema/spice.cue); the verb dispatches through the provider registry exactly like a built-in (ResolveVerb → grpcProvider → invokeVerbProvider hands it the full #Op). The host owns the go-libvirt VM resolution (vm_target.go’s ResolveVmTarget

  • SpiceEndpoint) and any qemu+ssh:// side tunnel, pre-resolving the VM’s live SPICE endpoint to a DIALABLE address it ships in the check env — so this plugin needs no libvirt at all. Provides the full 7-method surface (status/screenshot/cursor/click/mouse/type/key). The R10 consumer is a disposable libvirt VM bed whose desktop check composes this plugin.

The CUE schema below is the authoritative grammar for this plugin’s input. It is the same single source that generates the plugin’s Go parameter types and answers the runtime Describe RPC, so this page cannot disagree with either.

// The `spice` plugin's OWN CUE schema — the typed plugin_input for the `spice`
// SPICE-wire check verb. It is the SINGLE SOURCE for this plugin's params, used
// two ways (the same contract core `spec` and the http plugin use):
//
// 1. GENERATE the Go param struct — `cue exp gengotypes` (driven by the cue:gen
// pipeline, which wraps this with `package params` + `@go(params)`) emits
// ../params/cue_types_gen.go, so the provider decodes plugin_input into a
// TYPED struct, never a hand-parsed map.
// 2. VALIDATE authored input AT RUNTIME — the plugin serves this source over the
// Describe channel; the host splices it onto the base (base ++ plugin) and
// validates every authored `spice:` step's plugin_input against #SpiceInput.
//
// Since the schema-compaction cutover the per-verb fields LEFT core #Op: an
// authored `spice: <method>` step (scalar sugar) or `spice: {method: …, x: …}`
// (map form) desugars to the INTERNAL plugin/plugin_input envelope, and every
// spice-exclusive modifier lives HERE — the former core #SpiceMethod enum is
// this def's `method` field. The shared assertion matchers
// (exit_status/stdout/stderr) and the general `timeout` stay on core #Op, read
// off the step Op by the provider.
//
// SELF-CONTAINED: it references NO base def, so it compiles standalone
// (gengotypes + the load-gate compile) AND splices onto the base (base ++ plugin
// is a def-name collision check, not a base-reference resolver).
#SpiceInput: {
// method — the spice method to dispatch (the former core #SpiceMethod enum;
// also the scalar-sugar primary: `spice: <method>`).
//
// S3: the words are rows of the `_method` table at the foot of `schema/spice.cue`, and
// the enum this field accepts is derived from that table's word list, so the catalog
// has ONE home — a new method is one row there, and the table, the derived list and
// the enum cannot disagree.
method: or(_methodWord)
// action — start|stop for a record session (record); start|stop|status for a
// session (session). record start begins capturing the display framebuffer at
// fps into an MJPEG stream; record stop flushes it to artifact.
//
// S3: `_action`, NOT the console step's `_consoleAction` — the two `action` fields in
// this file are two different sets that only share a name.
action?: or(_actionWord) @go(Action)
// record_name — the recording session name (default "default"); multiple
// concurrent sessions supported.
record_name?: string @go(RecordName)
// fps — the display-frame capture rate for record (default 5).
fps?: int & >=1 @go(Fps,type=int)
// x / y — guest-absolute coordinates (click/mouse).
x?: int @go(,type=int)
y?: int @go(,type=int)
// button — the mouse button for click (left/right/middle; default left).
button?: string
// text — the text `type` types (PC-AT scancode sequence).
text?: string
// key — the named key `key` presses.
key?: string @go(KeyName)
// artifact — the host path `screenshot`/`cursor` writes the PNG to.
artifact?: string
// artifact_min_bytes / artifact_min_dimensions / artifact_not_uniform — the
// post-run artifact-reality assertions (sdk.RunArtifactValidators).
artifact_min_bytes?: int & >=0 @go(ArtifactMinBytes,type=int)
artifact_min_dimensions?: string & =~"^[0-9]+x[0-9]+$" @go(ArtifactMinDimensions)
artifact_not_uniform?: bool @go(ArtifactNotUniform)
// session — the DETACHED host-side recorder (Cutover A, A-task-2b): `spice: session` starts
// the plugin's OWN binary in recorder mode through the runner's generic
// background-session service (plugin-check's verb:session seam). The recorder
// holds the SPICE wire itself — the provider stays wire-free — polls the display
// at fps into state_dir/frames.mjpeg, and on SIGTERM finalizes with the FINAL
// marker + the evidence row.json. venue/phase are stamped into the evidence row.
session_id?: string @go(SessionId)
state_dir?: string @go(StateDir)
// artifact_dir — the runner-injected generic evidence-artifact dir (verb-agnostic;
// the provider appends its own filename/extension).
artifact_dir?: string @go(ArtifactDir)
log_dir?: string @go(LogDir)
venue?: string @go(Venue)
phase?: string @go(Phase)
// --- console wizard: drive a text-console wizard on the VM's SPICE console
// via the SHARED console engine (sdk/kit ConsoleWizard) — the SAME engine and
// the SAME recipe the JetKVM verb uses (R3). steps: inline, or device:+recipe:
// referencing a transport-neutral console-recipe entity.
steps?: [...#SpiceConsoleStep] @go(Steps)
device?: string @go(Device)
recipe?: string @go(Recipe)
answers?: {[string]: string} @go(Answers)
}
// #SpiceConsoleStep — ONE step of a console-wizard recipe (the neutral shape,
// mirrored from kit.ConsoleStep).
#SpiceConsoleStep: {
wait_for: string & !="" @go(WaitFor)
// action — the console step's action. S3: rows of `_consoleAction`, a DIFFERENT set
// from `#SpiceInput.action`'s `_action` — the two fields share a name, not a
// vocabulary.
action?: or(_consoleActionWord)
key?: string @go(KeyName)
combo?: string
text?: string
timeout_sec?: int & >=1 @go(TimeoutSec,type=int)
optional?: bool @go(Optional)
artifact?: string
description?: string @go(Description)
}
// #SpiceConsoleRecipe — the console-recipe bundle a `spice: wizard` step reads
// from a transport-neutral console-recipe entity (a `kind: jetkvm` entity, the
// recipe home BOTH transports share). It is the AUTHORED shape spice decodes;
// the shared engine (sdk/kit) holds no wire type, so the shape lives here.
#SpiceConsoleRecipe: {
recipes?: {[string]: [...#SpiceConsoleStep]} @go(Recipes)
steps?: [...#SpiceConsoleStep] @go(Steps)
answers?: {[string]: string} @go(Answers)
answers_env?: {[string]: string} @go(AnswersEnv)
}
// #SpiceConsoleRecipeEntity — the entity body half spice reads: the `installer`
// recipe bundle. The rest of the entity (host, device fields) belongs to the
// verb that OWNS the device (jetkvm); spice reads only the transport-neutral
// recipe.
#SpiceConsoleRecipeEntity: {
installer?: #SpiceConsoleRecipe @go(Installer,optional=nillable)
}
// --- vocabulary tables (S3) --------------------------------------------------
// Every closed set of words is a table keyed by word, and its word list is derived
// from the table and used as `or()` of that list (§10.1 S3, D-PAT-3). The table and
// the enum it feeds therefore cannot disagree, and a new word is ONE row here.
// `@vocab` names the owner (§3.1): these sets are compiled into THIS plugin, so the
// owner is the plugin's own word `spice`.
//
// TWO of the tables feed fields both named `action` — `_action` is the record/session
// action on `#SpiceInput`, `_consoleAction` is a console step's action on
// `#SpiceConsoleStep`. They are separate sets that share a field NAME, which is why they
// are two tables and not one: merged, a step could ask for a record session with the
// action "key-combo" and a console step could carry the action "stop", and both would
// validate here and then fail (or do nothing) at dispatch.
_method: {
// display + input
status: {}
screenshot: {}
cursor: {}
click: {}
mouse: {}
type: {}
key: {}
// recording
record: {}
// the DETACHED host-side recorder (session_method.go): start / stop / status talk to
// the runner's background-session service, and the provider never dials
session: {}
// the console wizard
wizard: {}
} @vocab(spice)
_methodWord: [for w, _ in _method {w}]
_action: {start: {}, stop: {}, status: {}} @vocab(spice)
_actionWord: [for w, _ in _action {w}]
_consoleAction: {key: {}, type: {}, "key-combo": {}} @vocab(spice)
_consoleActionWord: [for w, _ in _consoleAction {w}]

See also the candy reference for this candy’s install surface.