- TypeScript 76%
- Shell 17%
- Docker 6%
- Python <1%
paperclip-plugin-daevix — daevix sandbox-provider plugin for Paperclip #
Paperclip sandbox-provider plugin that makes a daevix enclave the execution backend for Paperclip-managed agents: each Paperclip agent runs inside its own persistent daevix-managed kata-clh agent VM (one daevix agent per agent, reused across runs), provisioned through the daevix operator-agent API with lease-scoped egress and no inbound surface.
Provider model #
- Manifest:
kind: "sandbox_provider",driverKey: "daevix", capabilityenvironment.drivers.register. - Lifecycle: persistent agents — the manifest declares
supportsReusableLeases: true. For environments configured withreuseLease: true, acquire creates-or-adopts the daevix agent keyedpaperclip-<agentId>(a 1:1 Paperclip-agent → daevix agent mapping), release is akeep_runningno-op (the daevix agent idles between runs), resume re-enters it, and only destroy deletes it. The reuse verbs (environmentResumeLease/environmentReleaseLease) are implemented by the worker; the orphan-cleanup sweep reusesenvironmentDestroyLeasefor stranded leases. - Transport: dial_wss — the plugin declares neither
runnerWebSocketIngressnorenvironmentRunnerIngressEndpoint; Paperclip therefore launches runnerd in outbound-onlydial_wssmode. - Operator auth: per-company service account via the daevix controlplane
— the plugin mints a jwt-bearer assertion signed with the connector
service-account key (the worker-held
apiCredentialsecret-ref) and exchanges it at the controlplane's/oauth/tokenfacade. The assertion audience is the deployment token issuer's issuer URL (tokenAudience); the plugin never contacts the issuer itself. TLS to the relay is pinned via an optional CA bundle. - Secret redaction: credentials and lease secrets are redacted before anything
crosses the agent-visible surface; the daevix API credential is a
worker-held secret-ref (
format: "secret-ref"in the configSchema) that holds the per-company connector service-account key JSON (inner.credentialobject ofconnector-sa-key.json— not the Zitadel provisioning key, which is tooling-only). The value is resolved only inside the plugin worker at lease-operation time and never appears in lease metadata, config, logs, or anything agent-visible.
Config schema #
| Field | Meaning |
|---|---|
relayUrl |
daevix enclave relay base URL (https:///wss://) |
apiCredential |
secret-ref id of the daevix connector service-account key JSON ({keyId,key,userId}; worker-held) |
controlplaneUrl |
daevix controlplane base URL — hosts the /oauth/token token facade and the operator-agent API |
tokenAudience |
optional jwt-bearer assertion audience (the deployment token issuer's issuer URL); the plugin never contacts the issuer |
daevixOrg |
daevix org the persistent agents are authored in |
agentGroup |
daevix group the daevix agent joins (maps to the Paperclip company) |
enclaveId |
daevix enclave id the daevix agent materializes in (from the controlplane's /api/v1/enclaves) |
reuseLease |
keep the daevix agent up across runs (requires one Paperclip environment per agent — agent.defaultEnvironmentId) |
imageRef |
OCI image reference for the lease VM (no embedded digest) |
imageDigest |
pinned digest, sha256:<64 hex> |
relayCaBundlePath |
optional path to a CA bundle for pinning relay TLS |
workspaceRepo / workspaceRef |
workspace repository + ref to materialize |
egressAllowlist |
optional advisory host:port additions (the lease's egress grant is authored by the daevix deployment's configured destination policy) |
Worker methods (v1) #
Implemented: initialize/health/shutdown (SDK lifecycle),
environmentValidateConfig, environmentProbe, environmentAcquireLease,
environmentResumeLease, environmentReleaseLease,
environmentDestroyLease, environmentRealizeWorkspace, environmentExecute.
Omitted (deliberately): runner ingress endpoint, interactive-setup, template, sync, login-PTY, and duplex-channel hooks.
Operator/exec calls go through the daevix controlplane operator-agent API
(/api/v1/orgs/{org}/agents[...], problem+json errors) authenticated by the
per-company connector service account via the /oauth/token facade
(jwt-bearer; bearer cached by the worker). environmentExecute execs over
the relay's wss rendezvous; the bootstrap ticket rides the
PAPERCLIP_RUNNER_BOOTSTRAP_TICKET env of the executed command (never argv
and never logged).
Install #
From npm (published as
@daevix/paperclip-plugin-daevix,
v0.1.0; installed into Paperclip via the paperclipai plugin install flow):
npm install @daevix/paperclip-plugin-daevix
From a local checkout (the plugin is loaded from disk; build first —
plugin install packages dist/):
pnpm install && pnpm build
paperclipai plugin install /absolute/path/to/paperclip-plugin-daevix
If you previously installed from another path, uninstall and reinstall so the install source points at this checkout:
paperclipai plugin uninstall daevix
paperclipai plugin install /absolute/path/to/paperclip-plugin-daevix
Publishing #
Releases use npm staged publishing — see MAINTAINERS.md for the full flow. Summary:
- Bump the version in
package.json, commit, push. - Push a
v*tag — CI (.tangled/workflows/publish.yaml) builds, tests, and stages the version withnpm stage publishusing the stage-onlyNPM_TOKENheld by the CI system (never in the repo). - A maintainer approves the staged version with 2FA
(
npm stage approve <stage-id>, or the Staged Packages tab on npmjs.com). Only then does the version go live.
CI never publishes directly; a human with 2FA completes every release. On a version conflict (version already exists on the registry or in staging), the pipeline fails with a clear "bump package.json version" message. The package is live at https://www.npmjs.com/package/@daevix/paperclip-plugin-daevix (v0.1.0, published directly before staged publishing was set up); all future versions flow through staged publishing.
Runner image #
The lease VM image (docker/daevix-runner/Dockerfile) builds ENTIRELY from
this repository against 100% stock Paperclip — no Paperclip checkout or PR
is needed anywhere.
-
Pinned upstream source: the first build stage (
paperclip-source) shallow-fetches the upstream Paperclip repository (https://github.com/paperclipai/paperclip.git) and checks out the revision pinned byPAPERCLIP_RUNNER_SOURCE_REVISION(a full commit SHA; the build fails closed if the argument is empty or the checked-out SHA does not match). The pin is currently0f14d261233c545aa6a8a38ec253c498a5130fff— the stock upstream master tip the historical daevix Paperclip branch forked from. The runnerd binary and the provider pack are therefore built from reviewed, unmodified upstream code only. -
Build (from this repo, not from Paperclip):
content_id="$(node scripts/daevix-image-content.ts)" sudo -n podman build \ --build-arg PAPERCLIP_RUNNER_CONTENT_ID="$content_id" \ --build-arg PAPERCLIP_RUNNER_SOURCE_REVISION=0f14d261233c545aa6a8a38ec253c498a5130fff \ --tag localhost/dvx-runner:dev --file docker/daevix-runner/Dockerfile . -
Content identity:
node scripts/daevix-image-content.ts(also exposed aspnpm test:e2e:daevix-runner:image-id) computes the audited content id from the pinned upstream revision, the digest-pinned base images, the Dockerfile syntax frontend digest, and the out-of-tree daevix build inputs (Dockerfile, entrypoint, LiteLLM bridge config + hook). It must be passed asPAPERCLIP_RUNNER_CONTENT_IDat build time and is advertised as theio.paperclip.runner.content-idlabel. -
Gates kept identical: the provider-pack lockfile-SHA gate (
PAPERCLIP_RUNNER_LOCK_SHA256, default matches the pinned revision'spnpm-lock.yaml), the--build-metadataverification layer (dial_ws_loopback/dial_wss/listen_ws),/bin/shpresence for lease exec, the fail-closed entrypoint self-tests (bootstrap ticket only viaPAPERCLIP_RUNNER_BOOTSTRAP_TICKETenv, wss-only connect URL, exit 64 negatives), the codex shim + LiteLLM responses→chat wire bridge, and fully-qualified base image refs. -
Rationale: maintaining the image out-of-tree in this repo means the daevix integration operates against stock Paperclip with zero upstream PRs. The pinned revision is bumped deliberately (recompute the content id), never silently.
Development #
pnpm install
pnpm dev # watch builds (worker + manifest bundles into dist/)
mise x -- pnpm test # vitest (115 tests): config validation, capability gating, daevix agent/lease paths
mise x -- pnpm typecheck
pnpm build
pnpm install requires the packed Paperclip SDK snapshot in .paperclip-sdk/
(gitignored). Regenerate it with paperclipai plugin init --sdk-path against a
Paperclip checkout, or copy the tarballs from a prior dev home. plugin install
packages dist/, so run pnpm build BEFORE reinstalling into Paperclip.
Dev install #
dev-install/ owns the local dev install (Paperclip on
http://127.0.0.1:3144 with this plugin installed, connected to the
daevix-dev kind cluster). Its README is the canonical operational runbook —
component map, canonical state locations, and a bootstrap-from-zero guide.
Toolset (all idempotent, interactive-shell safe):
dev-install/bin/status # check every dependency
dev-install/bin/port-forwards # ensure relay + zitadel port-forwards are up
dev-install/bin/verify # end-to-end provider probe (secret resolve → token mint → lease acquire)
dev-install/bin/install-plugin # pnpm build + (re)install plugin into Paperclip
dev-install/bin/redeploy # in-place daevix redeploy (pg_dump → image → kind load → rolling restarts)
dev-install/bin/build-runner-image # build localhost/dvx-runner:dev, load + push to localhost:5000
dev-install/bin/expose-controlplane # port-forward svc/dvx-controlplane + /etc/hosts entries
dev-install/bin/provision-sa # provision the connector service account (org/group + grants + SA key)
dev-install/bin/provision-agent-env # 1:1 per-agent environment (reuseLease) + agent.defaultEnvironmentId
dev-install/bin/enable-exec # enable exec on the daevix agent
dev-install/bin/exec-roundtrip # one in-VM command over wss, with dial/total timings
Provenance #
Developed in tandem with the daevix enclave work (bead bd_2_0-2ek) against a
short-lived local Paperclip integration branch, and validated end to end
against a live daevix dev deployment. The canonical source of this plugin AND
of the daevix runner image is now this repository; nothing daevix-related
remains in any Paperclip repo — the integration runs against stock Paperclip
with zero PRs.