Repository navigation
feat: punktfunk check verb plugin - #1
Conversation
Serves the `punktfunk:` verb, which drives a running punktfunk streaming host through its management REST API - probing it (health, status, diagnostics, compositors, gpus, clients, pending devices, library, displays, plugins, hooks, actions) and managing it (pairing, approvals, PIN, rename, access presets, unpair, scanner toggle, display release, power actions, end game, and a bounded SSE event subscription). Not a re-skin of the generic http: verb. It exists for the three things http: cannot do: it reads the per-host bearer token from inside the venue over the reverse channel, it carries domain semantics that return real verdicts, and its events method can assert a TRANSITION rather than a state. The request is issued from INSIDE the venue rather than the charly host. punktfunk binds its management API to loopback by design; reaching it from the host would mean republishing or relaying the port, weakening the posture upstream chose. Probing in-venue also puts the request on the same side as the token. The token travels via curl --config on stdin, never argv, because argv is world-readable through /proc. Mutating methods are refused in a check: step, so a probe can never unpair a device or reboot a machine. Claude-Session: https://claude.ai/code/session_016fnPmYiC6ZkqXSi6D8PAP6
Review — BLOCKHead SHA: Change class: new plugin candy (feature) — new out-of-tree Go plugin module serving the Security screen: PASS — no T1–T4 findings. Token travels via Placement: CORRECT — the capability (a verb) is placed as a candy/plugin, the correct outermost layer. No core/sdk changes. Blocks
Verdict: BLOCK ollama/deepseek-v4-flash — pi-review-action. |
Review — PASSHead SHA: Security screen: PASS — no T1–T4 findings. Token travels via Checklist: All applicable rules PASS or NA. Prior reviewer comments considered:
Placement: CORRECT — the capability (a verb) is placed as a candy/plugin, the correct outermost layer; no core/sdk changes. ADE satisfied (non-empty Verdict: PASS ollama/deepseek-v4-flash — pi-review-action. |
Summary
Adds the
punktfunk:check verb — an out-of-tree, out-of-process plugin that drives arunning punktfunk streaming host through its
management REST API. It is the management half of punktfunk support in charly; the host
itself is installed by
layer-punktfunk.30 methods, split read/write:
healthstatusdiagnosticsdiagnostics-refreshcompositorsgpuspluginshookspair-statuspair-armpair-disarmpendingapprovedenypinclientsrenameaccessunpairlibraryscannersscanner-toggledisplay-statedisplay-monitorsdisplay-settingsdisplay-releaseactionsaction-invokeend-gameevents(bounded SSE)No edit to
charly/orspec/is needed:checkVerbProviderBijectionexplicitly allowsout-of-tree verbs, and
punktfunkcollides with no authored#Opfield.Why this is not the generic
http:verb (R3)http:already does URL + status + body/header matchers +allow_insecure, andduplicating that would be pointless. This verb exists for what
http:structurally cannotdo:
inside the venue. An authored
http:step cannot read a per-deploy secret out of acontainer or guest.
json_path:to assert one field rather than pattern-matching a JSON blob.events. A bounded SSE subscription is the only way to assert a transition;polling
/api/v1/hostobserves a state, never that a stream started.Three design decisions worth reviewing
1. The request is issued from inside the venue, not from the charly host. punktfunk
binds its management API to loopback by default and its documentation is explicit that the
API stays loopback-only while the web console is the network-facing surface. A host-vantage
cc.HTTPDocannot reach a loopback-bound listener in a container, and the two ways to makeit reachable — republishing the port, or a socat eth0→loopback relay — would both weaken
exactly the posture upstream chose. Probing in-venue keeps that intact and puts the request
on the same side as the token. The cost is a
curldependency, so its absence is reportedas a precise, actionable message rather than a bare exit code (tested).
2. The token never touches argv. It travels through
curl --configon stdin, via aheredoc with a quoted delimiter so the shell cannot expand it. argv is world-readable
through
/proc, and a management token inpsoutput would be a real leak on a sharedhost.
TestTokenNeverReachesArgvpins this.3. The TLS flag is
verify_tls, notinsecure. punktfunk serves a self-signedcertificate, so verification must be off by default. A Go bool cannot distinguish "unset"
from "false", so an
insecurefield could never default to true — inverting the name makesthe ZERO VALUE the correct default instead of relying on a tri-state that does not survive
codegen.
Mutating methods are refused in a
check:step (viaOp.IntentDo == assert, which therunner stamps from the step keyword and authors cannot set), so a probe can never silently
unpair a device or reboot a machine.
How tested
Built with the binary from the pinned charly checkout (
task build:binaryatv2026.241.1535+1). The repo'sdeploy.yml— onmainfrom bootstrap, not in this diff;see the CI-gate section below — pins that same tag, whose
spec v0.2026241.931declaresSchemaVersion = "2026.240.1943". Verified, which is why thebuildcheck is green.Unit tests
Beyond the happy paths, the suite pins the properties that would otherwise rot silently:
a drift gate that reads the method disjunction out of the embedded CUE and fails if it
and the Go dispatch table diverge (measured: 30 methods on both sides); the read/write
classification of every method; required-field enforcement; path-escaping of
attacker-influenced identifiers (a fingerprint arrives from a pairing request); SSE
multi-line payload joining; and the token-leak guard above.
Live proof — the verb dispatching against a real host
A disposable pod bed (CachyOS base + headless sway + the
punktfunkcandy + this plugin)was built and driven end to end. Full R10 sequence, every step green:
The verb's own verdicts, from the fresh-rebuild leg (note the container id differs from
the first leg — this is a genuinely rebuilt deployment, not a re-read of the first):
A doc-vs-reality divergence the live run caught (R1)
The first live run failed three of five verb checks with a clean HTTP 401:
Root cause, measured in the venue rather than guessed: the management-token file is not
a bare token, which is what the upstream documentation implies ("generated and persisted
API token … path=~/.config/punktfunk/mgmt-token"). Against punktfunk-host 0.33.0-1 it is an
env-file line:
The plugin was sending the whole line as the bearer. Fixed with a real parser
(
token.go) that accepts both the env-file and bare forms and prefers thePUNKTFUNK_MGMT_TOKENkey — the host writes a siblingplugin-token, so key preference isload-bearing rather than cosmetic.
TestParseTokenFilecovers the measured shape,quoting, CRLF, comments and the multi-key ordering both ways.
No schema check would have found this. It is the concrete reason the verb was proved on a
live bed before landing rather than after.
The stock plugin CI gate is empty — this repo's is not
While setting this up I measured that running
charly box validateat a plugin reporoot validates nothing: a plugin repo has no project
charly.yml, so discovery neverreaches
candy/<name>/charly.ymland the command exits 0 on any manifest. Injecting amalformed provider class (
notaclass:punktfunk) still exited 0 at the repo root, while thesame manifest under a project with a
discover:block failed correctly:Where the fixed gate lives, precisely: this repo's
deploy.ymlalready carries thecorrected shape — it stages a minimal project with a
discover:block so the manifest isactually parsed, and additionally runs
go build/go vet/go test/gofmt -l, thesubstance of a plugin repo that the stock template omits entirely. It is not in this
diff. It was installed on
mainduring repo bootstrap, together with thepr-validatorand
tag-on-mergedispatchers, becausetag-on-mergefires onworkflow_runandworkflow_runonly fires for workflows already present on the default branch — a first PRthat installed the dispatcher could never be tagged by it. So the gate that produced the
green
buildcheck on this PR is the corrected one, and this PR's 16 files are the pluginmodule itself. Every step of it was dry-run locally before being installed.
The same weakness affects the other plugin repos still on the stock template. It is
tracked as opencharly/charly#459, which carries the measurement, the control against
plugin-vnc, and the concrete template fix; this repo is named there as the referenceshape. That is the exit — this PR advances it by shipping and proving the corrected gate.
Rulebook compliance
code changed; the doc-vs-reality divergence is documented in
token.goso the nextreader does not re-derive it.
http:; the justification is above and theboundary is deliberate. The in-venue transport is one implementation used by every method.
rather than relaxing it with a port relay.
-F <file>requirement wascomplied with, not disabled.
charly check runon the final tree,including the fresh-rebuild leg, not a green
git status.covered by checks that fail if it breaks (the 401 above is exactly such a failure, caught
by these checks before landing).
is routed to a named exit, Plugin repos' candy CI gate validates nothing (charly box validate at a plugin repo root scans an empty set) charly#459, which this PR advances by shipping the
corrected gate and standing as its reference implementation.
deploy.ymlreferences now state plainly that the file liveson
mainfrom bootstrap and is not part of this diff, and why it has to.Change classification
go build/go vet/go test/gofmt, a real manifestvalidate under discovery, and a full
charly check runR10 sequence on a disposable pod bed.fully tested and validated— the R10 bed passed on the final treeand every changed path executed live, with the output retained above.
Assisted-by: Claude Code claude-opus-5[1m] (fully tested and validated)