automagik-si/arca--packages-arca-canvas-dsh ↗★ 2
arca-canvas-dsh
Automagik Arca snapshots and a Doctor chat with in-canvas approvals for DSH
설치
npx -p @deepseek-ai/dsh dsh plugin --profile web add 'github:automagik-si/arca#9a5a26465d6ca36c5939e32ad7cc4c7bb095642d&path:packages/arca-canvas-dsh'Automagik Arca canvas for DSH
A host plugin for stock DSH and an embedding DSH host. It polls Arca through a
Unix socket and serves a cached snapshot at GET /arca-canvas/snapshot.
GET /arca-canvas draws a workspace from the snapshot: a top bar with the project
picker, local clock and fleet summary; a machines strip with CPU, memory and one
line per GPU card; the selected project's cards on a dotted canvas with curved
SVG edges; and a Doctor panel with Chat and Steps tabs, recent Arca activity and
waiting approvals. Under the canvas, beside the Doctor panel, a foot carries the
Open Intelligence tag of the we unfold movement: an inline picture 170 px wide,
in one colour, the page's ink on the page's ground in light and dark, loaded from
nowhere and never a link. The tag belongs to we unfold and is not under this
package's Apache licence; the Automagik Arca repository says where it comes from
in assets/open-intelligence/. A machine's Details dialog names who is using each
GPU and shows its services area. The Doctor composer is a working chat backed by
a persisted DSH session named
Doctor (model deepseek-flash). It works without a sidebar. The Doctor reads
Arca and can record one inert action proposal; it cannot change anything. The
owner approves a proposal with the passkey on a card inside the kernel-served
canvas.
When the sidebar is installed, an Arca canvas tab embeds this same page, sharing
its renderer, polling and styles.
Install
Use Node 24.9.0 or newer and @deepseek-ai/dsh@0.2.2-rc.1. npm's latest
tag was checked against that exact release on 2026-11-05. Install the package at
an exact full commit containing this directory:
dsh plugin --profile
add -w "github:automagik-si/arca#&path:/packages/arca-canvas-dsh"
Replace and `` with the desired profile and full commit SHA.
The quotes keep &path: in the same argument. DSH forwards the arguments to
pnpm, whose git spec splits the commit and path: selectors at &. The built
client.js, page.js and page.css are committed, so the git-path install needs no build hook.
Use the same command with an embedding DSH host's profile. Fully quit that host
before editing its profile, and restart it afterwards. The package contributes
one arca-canvas row via dsh.bundle.patch; the host must provide webServer.
No sidebar provider is required.
Configure
Set these keys in the inserted arca-canvas row's config map:
config:
socketPath: /run/arca/arca.sock
viewerTokenPath: /path/to/arca-viewer.token
pollMs: 5000
nodeName: 'Example machine'
address: ''
approvalUrl: ''
devicesUrl: ''
devicesTokenPath: ''
chatEnabled: true
chatStatePath: ''
dailyTokenBudget: 1000000
| Key | Meaning |
|---|---|
hosts | Optional non-empty array of host readers, described below. |
socketPath | Required when hosts is absent; absolute path to Arca's listen.unix socket. DSH must run as the same user as Arca. |
viewerTokenPath | Required when hosts is absent; absolute path to a regular token file with mode exactly 0400. Symlinks are refused. |
pollMs | Integer delay between completed polls, at least 100 ms; default 5000. Arca polls never overlap; the device phase runs independently. |
nodeName | Optional human machine title. Defaults to the host OS hostname; an empty or whitespace-only name becomes Machine. The raw Arca node ID is never the card title. |
address | Optional LAN host name or IP for a service's Open link. Bare host or IP only, no scheme or port. When set, a service card gets http://: only when the real service_list row has a lanPort host listener; a container port alone never becomes a link. Empty by default. |
chatEnabled | Enable the Doctor chat routes. Default true; when false the chat routes answer 503 and no model is called. |
chatStatePath | Optional absolute path of the persisted chat state (DSH session id, daily token counter and the panel transcript). Defaults to $DSH_HOME/storages/arca-canvas-chat.json. |
dailyTokenBudget | Positive integer total-token budget per UTC day, default 1000000. When reached the Doctor answers with the daily-budget card and spends no model call. |
approvalUrl | Optional absolute HTTP(S) URL of this deployment’s Arca /approve page, empty by default. URLs with credentials are refused. Delete plans link there; the proposal cards use the same-origin /approve/plans route on the kernel-served canvas. Without it the cards are unavailable and the badge is plain text. |
devicesUrl | Optional absolute device service HTTP(S) MCP URL without credentials or fragments, empty by default. HTTPS permits any host. HTTP requires a literal loopback, RFC1918, CGNAT (100.64/10), or fd00::/8 address; hostnames and public addresses are refused. |
devicesTokenPath | Optional absolute device reader token file path; requires a regular file with mode exactly 0400, with symlinks refused. Empty by default. |
projects | Optional owner project groups. Each entry has a unique non-empty name, an optional domain, and a non-empty members array of { host, incusProject, instance }. Every member must name a configured host, and one instance can belong to only one project. |
defaultProject | Optional project name selected on load. Otherwise the page selects the first configured project, then the first service project, then the first other Incus project. An internal Arca project is never selected. Must name a configured project when projects is present. |
To show multiple hosts, set hosts in the same config map:
config:
hosts:
- name: alpha
socketPath: /example/alpha/arca.sock
viewerTokenPath: /example/alpha/viewer.token
address: 192.0.2.10
devicesUrl: https://devices.example.com/mcp
devicesTokenPath: /example/alpha/device-reader.token
- name: beta
socketPath: /example/beta/arca.sock
viewerTokenPath: /example/beta/viewer.token
pollMs: 5000
approvalUrl: https://example.com/approve
defaultProject: Studio
projects:
- name: Studio
domain: studio.example
members:
- { host: alpha, incusProject: service, instance: app }
- { host: beta, incusProject: service, instance: api }
Each entry requires a non-empty, unique name, used as its machine card and
project host title, and absolute socketPath and viewerTokenPath paths. Token
files follow the same regular-file, 0400, no-symlink rules. Optional
devicesUrl and devicesTokenPath use the same validation rules as the
top-level settings. Hosts appear in array order; the first is the primary
host. If its device settings are omitted, it uses the existing top-level device
settings. Other hosts never inherit those settings. Devices are collected for
compatibility but are not drawn in this layout.
When hosts is absent, the existing single-host keys work unchanged: the name
comes from nodeName or the OS hostname. With hosts present, each entry supplies
its own socket, token and name; top-level socketPath, viewerTokenPath and
nodeName are unused. Each host polls concurrently on its own pollMs schedule.
An unreachable socket, refused token or failed tool affects only that host;
successful fields and the other hosts keep rendering. A failed watch report
leaves the machine card online but reports that its instance count is unknown;
configured owner-project members on that host are reported as unknown, never as
missing or as an empty host. No per-host mode is inferred from arca_status.
projects is the owner's grouping layer, not an Incus project list. A listed
member is resolved on its host and appears only inside its owner project. An
unlisted instance falls back to a project named after its Incus project on that
host, with one exception: the internal arcak-svc grouping is never a project.
Each unlisted instance in arcak-svc becomes its own project named after the
service (the instance name, humanized; web1 becomes Web1), so a
service is a first-class project by default and an owner project can group
several. The internal arcak-svc id never appears as a project, in the picker or
in a project subtitle. To group services, list them like any other member:
{ host: alpha, incusProject: arcak-svc, instance: web1 }. An Incus
project whose instances are all listed in owner projects is not rendered at all.
Owner projects render in config order; service projects follow, then the other
fallback projects by host and project name, with the host appended only when a
display name collides.
All example paths must be replaced with paths on the machine running DSH. Paths
are literal; ~ and environment variables are not expanded. Config contains
file paths, never bearer values. An unreachable Arca or missing token does not
prevent the plugin from serving its page and an error snapshot.
Mint a viewer token using the existing Arca configuration:
arca token mint --scope viewer --id canvas-viewer \
--out /path/to/arca-viewer.token --config /path/to/arca.json
Arca writes the secret directly into a new 0400 file and stores its hash in the
configured token directory. Existing files and token IDs are refused. The plugin
reads the token again before each HTTP request, including initialize; token
rotation therefore takes effect without restarting DSH. It never sends Origin.
The route is served on the DSH listener and inherits that listener's access boundary. It contains machine data; expose the DSH listener only to its intended readers.
Snapshot
The JSON object has at (ISO timestamp), approvalUrl (empty or the configured
approval URL), pageHost (the first configured host, whose kernel serves the
canvas and its approval origin), projects (the configured owner groups, each
with name, domain and members), defaultProject, and hosts in configured
order. Each
host entry has name, address (the configured LAN address or empty), at,
error (null or safe error text), nodeName
(resolved by the host), machine, instances, instancesKnown (false when
watch_report failed), projects (the Incus project ids from watch_report),
databases, services, servicesKnown (false when service_list failed),
metrics, alerts, plans, journal, journalKnown (false when
journal_list failed), journalPending (true while a deep journal read finishes
in the background), devices, devicesAt (ISO time of the last good device
list, or null), phones, and desktops. devices is off, ok, unavailable,
unreachable, or stale.
machineandmetricsholdarca_statusandnode_metricsresults.instancesflattenswatch_report.projects[].instances[], addingproject.databasesandplanscontain the arrays frompostgres_listandplan_list.servicesholds theservice_list.servicesrows (name, template, state, ipv4, ports, lanPort, links, published).lanPortis the template's host proxy port, or null when the service has no lan listener. A service whose instance is on the canvas contributes an Open link only from the configured hostaddressand its reallanPort. A row thatservice_listmarks withupdate.statediffers(the template installed on the node names another version than the one the service runs) gets the tag "Other version" on its card and beside its name in the machine's Details. The words claim no order: two digests do not say which is newer. No other row carries the tag.journalholds the newestjournal_listrecords, at most 200 per host. Every poll re-reads a trailing window of the newest ids and merges by id with the latest record winning, so an effect that moved fromIntenttoFailed(orAppliedtoConfirmed/Reverted) updates instead of staying at the first state it was seen in. A snapshot waits for at most two journal pages and a deep first read finishes in the background withjournalPendingtrue meanwhile. A journal that restarts from zero (its ids go backwards or disappear) is detected and re-read from the start, dropping the stale cache for that host. The newest records across hosts feed the Doctor's Chat and Steps views. A failed journal read leaves the array empty andjournalKnownfalse, so the page shows an unavailable notice instead of invented rows.alertsholds the fullalerts_listresult, preserving firing, unknown and recent resolved alerts plus health metadata. This layout does not draw alert cards yet; the data stays in the snapshot for later phases.
Failed reads leave machine/metrics null or the other fields empty arrays.
Successful reads survive partial failures. Requests use MCP protocol
2025-11-25, initialize then tools/call, over HTTP POST to /mcp. Error
messages omit upstream bodies and filesystem details, and successful payloads
are scrubbed of any bearer echo. Snapshot strings are never inserted as HTML.
The optional device reader uses HTTP POST to the exact configured devicesUrl,
with the same protocol and initialization sequence and its own per-request bearer.
It calls only droid_list, desktop_list, droidd_status and phone_status.
Structured list results use droids and desktops keys; older JSON text results
are also accepted. Phone entries retain name, state, network type, battery level
and screen size ([width, height]); desktop entries retain name, status and memory limit.
Every phone is eligible for a status read regardless of its droid_list state;
one phase reads at most two phone statuses, rotating through the list. A failed or
timed-out phone is kept with state: 'unreachable' and is not retried for at
least sixty seconds; the skip is based on that last call failure, never on
droid_list state. Both device settings empty means devices: 'off', with no
device requests. Configured readers report ok after a successful phase, or
unavailable on invalid settings, missing/refused tokens, an unreachable service
or a first failed read with no prior good list. Device validation happens in the
host reader and never prevents canvas startup. Refused settings make no device
HTTP requests. A failed list or service-status read keeps the last good phone and
desktop list and reports devices: 'unreachable'; a failed phone_status keeps
that phone visible with state: 'unreachable', alongside all other phones and
desktops. An HTTP 429 keeps the last good list and reports devices: 'stale';
devicesAt preserves the time of that list, and the topbar chip shows its age.
With no prior good list, even a 429 reports unavailable with empty lists.
Device reads start alongside Arca reads and update cached device cards in the
background under one five-second deadline. The phase is single-flight: a poll
never starts another phase while one is pending. Arca snapshots and paints never
wait for that phase. In-flight device requests are aborted on deadline or host
stop; a later poll may retry except for a phone still inside its sixty-second
failure window. A muted Devices unavailable, Devices unreachable or aged
Devices stale topbar chip appears for those states, with no device error banner.
The host logs one safe line per device state change, naming devicesUrl or
devicesTokenPath for a rejected setting. Setting values, device credentials and
upstream error details never enter logs, the snapshot or the browser bundle. Arca
reads keep their existing error behavior.
The page has four regions. The top bar holds the project picker, the
Arca self-hosted | Arca Cloud segmented control (Cloud is di