Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions .dsh-version.json
Original file line number Diff line number Diff line change
Expand Up @@ -177,6 +177,29 @@
"NOTHING is vendored, downloaded or installed: the daemon is the user's own service, and this package ships the HTTP client, one argv for `ollama --version`, and the arithmetic"
]
},
"dsh-comfyui": {
"version": "0.1.0-alpha.1",
"rows": [
"comfyui"
],
"rowOverrides": [],
"role": "ComfyUI as a surface the agent can BUILD against: seven `comfy_*` tools over the machine's own ComfyUI (Desktop, portable, or a server on loopback) that turn a small readable project spec into a real workflow.json + prompt.json - nodes by KEY, values by NAME, wires by `<key>.<OUTPUT>`, `@bindings` for anything that belongs to a machine - validate them against the live node catalog the server reports (`/object_info`), with ComfyUI's own error vocabulary (required_input_missing, return_type_mismatch, value_not_in_list, dependency_cycle, prompt_no_outputs), queue them (`/prompt`) and report what came out of `/history`, and a `comfy_test` that compiles the whole shipped example library and, when a server answers, runs it - every item reporting the rung it actually reached (v1-structural, v2-schema, v3-queued, v4-executed), so 'it compiles' is never printed as 'it runs'. `comfy_cli` drives the user's own comfy-cli as a SECOND witness: `comfy run --workflow` converts the generated canvas with comfy-cli's own converter, `comfy node deps-in-workflow` names the node packs a graph needs, `comfy launch --background` / `comfy stop` give a server to test against; it never runs `comfy install`, installs a node, downloads a model or removes anything. Four model-free-or-model-bound examples and six skills (the fundamentals, the two workflow dialects and the `control_after_generate` shift that silently moves every later `widgets_values` entry, the HTTP API with the twelve validation error types, comfy-cli across platforms, authoring a node class, and this project dialect). Host-only: one row, no route, no browser half, zero npm dependencies, no bundled engine, nothing started on its own. See packages/dsh-comfyui/README.md.",
"uses": [
"@deepseek-ai/dsh-tools (the registry the seven tools are registered into)",
"@deepseek-ai/dsh-skill (ctx.skills, resolved lazily; the six skills are also copied into $DSH_HOME/skills by both installers)",
"the user's own ComfyUI server on loopback (8188, and the Desktop ports 8000-8003, probed in order)",
"the user's own comfy-cli (`comfy`, from `pip install comfy-cli`) for `comfy_cli`, argv-only with a deadline"
],
"requires": [
"ComfyUI installed by the user (Desktop, portable or a checkout) - `comfy_status` finds it or names where it looked; nothing here installs one",
"a RUNNING server for /object_info (the full catalog), for comfy_run and for comfy_test action=run; compiling and validating a project need no server at all",
"the model files a graph names for it to run - `comfy_validate` reports a missing one by name and nothing here downloads it",
"comfy-cli only for the comfy_cli tool: without it the seven HTTP tools are unaffected and the tool says so with the install line"
],
"vendors": [
"NOTHING is vendored, downloaded or installed: ComfyUI and comfy-cli are the user's own programs, and this package ships the spec compiler, the canvas/prompt reader, the validator, the HTTP client and eighteen core node signatures transcribed from ComfyUI 0.21.1 (with /object_info always overruling them)"
]
},
"dsh-media": {
"version": "0.1.0-alpha.4",
"rows": [
Expand Down
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,19 @@ packages/dsh-rust-dev/checks/fixtures/**/target/
# check removes it itself, and this is the belt for the run that is killed.
packages/dsh-proto-lab/checks/.tmp/

# A COMFYUI PROJECT FOLDER (`dsh-comfyui`) is workshop material, the same shape as
# the lab above: `comfy_project` action=new writes `<workspace>/comfyui/<slug>/`
# (spec, generated canvas, generated prompt, README, build receipt) for a person to
# edit and run, and a repository that accumulated every graph anyone ever built
# would stop being a plugin pack. What ships is the compiler and the checked example
# library under `packages/dsh-comfyui/examples/`, which IS committed.
#
# Anchored to the repository root, for the reason the `/dsh-diagrams/` rule below
# records: an unanchored `comfyui/` would also match any `comfyui/` inside a package.
# `DSH_COMFYUI_ROOT` points the projects somewhere else entirely; this rule is what
# keeps the DEFAULT location out of every commit.
/comfyui/

# The vendoring DOWNLOAD CACHE, the same shape as the diagrams rule further down:
# `vendor/build.mjs` installs the pinned p5 once into `vendor/node_modules` and
# reads two published files out of it. What is committed is the generated
Expand Down Expand Up @@ -124,3 +137,11 @@ packages/dsh-frontend-craft/vendor/impeccable/.cache/
Thumbs.db
.vscode/
.idea/

# A DEFENSIVE belt for a plugin that resolves its own cache root from
# `$DSH_HOME`: `dsh-comfyui` caches the node catalog it read from a server under
# `<home>/dsh-comfyui/schema/`, and a run whose environment had no home once wrote
# `<package>/.dsh/...` instead. `lib/client.js` now falls back to the OS home and
# then the temp dir, NEVER the working directory - this rule is the belt for the
# case where a future change or a stripped environment gets it wrong again.
packages/*/.dsh/
20 changes: 16 additions & 4 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,18 @@ for its behaviour, `SECURITY.md` before touching credentials or the launcher, an
confirmed pull/delete, embeddings with cosine similarity - three skills whose
examples a check parses/compiles, and a loopback fence that refuses a daemon on
another machine before any request; host-only, zero npm dependencies),
`dsh-comfyui` (ComfyUI as a surface the agent can BUILD against: seven
`comfy_*` tools that turn a small readable project spec - nodes by key, values
by name, wires by `<key>.<OUTPUT>`, `@bindings` for anything machine-specific -
into a real `workflow.json` + `prompt.json`, validate it against the server's
own `/object_info` with ComfyUI's own error types, queue it and report what
`/history` says came out, and compile/run the whole shipped example library at
a stated rung - `comfy_status`, `comfy_nodes`, `comfy_project`,
`comfy_validate`, `comfy_run`, `comfy_test`, `comfy_cli` - plus six skills
(the fundamentals, the two workflow dialects and the `control_after_generate`
shift in `widgets_values`, the HTTP API, comfy-cli across platforms, authoring
a node class, this project dialect); host-only, zero npm dependencies, no
bundled engine, and `comfy_cli` never installs anything),
`dsh-research` (a run is a folder with a `passport.json` recording the user's own
words; nine `rs_*` tools over an append-only claim and source ledger, a claim's
numbers recorded as a validated `statistic` rather than left in the prose, a
Expand Down Expand Up @@ -161,12 +173,12 @@ for its behaviour, `SECURITY.md` before touching credentials or the launcher, an
- A package may carry its OWN checks under `packages/<name>/checks/`, run with
`npm run check` in that folder. They travel with the package (which is what
makes them useful outside this repository) and they are ADDITIONAL to
`scripts/checks/`, never a replacement for it: today eleven packages ship their
`scripts/checks/`, never a replacement for it: today twelve packages ship their
own (`dsh-supercollider` with four checks, `dsh-research` with seven,
`dsh-rust-dev` with two, plus `dsh-diagrams`, `dsh-frontend-craft`,
`dsh-proto-lab`, `dsh-ocr`, `dsh-wsl`, `dsh-docker`, `dsh-ollama` and
`dsh-image-upscale`), and the pack-wide checks still own the routes, the bundle
and the manifest.
`dsh-proto-lab`, `dsh-ocr`, `dsh-wsl`, `dsh-docker`, `dsh-ollama`,
`dsh-image-upscale` and `dsh-comfyui`), and the pack-wide checks still own the
routes, the bundle and the manifest.
- `scripts/` — the launcher (`run-web.*`), and four folders: `console/` (the shared
console layer), `setup/` (install and uninstall, which a fresh machine runs once),
`tools/` (maintainer-only: the fork re-sync for the client bundles this pack vendors)
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ way and what it touches. The exact versions are in
| [`dsh-audio`](packages/dsh-audio/README.md) | A waveform surface for WAV, AIFF and FLAC: one track per channel, dBFS, selection and playback. It also draws the Media panel, which lists every audio, image, video and GIF file in the workspace. No microphone, no device list, no output routing. |
| [`dsh-browser`](packages/dsh-browser/README.md) | The Browser tab, replacing the shipped iframe one: a page rendered on the host in a disposable engine behind an https-only egress gate. It answers with a screenshot, post-script text and measured styles, for the tab and for three `browser_*` tools. Built and shipped but turned OFF, because the master layer disables the row. |
| [`dsh-cmdbar`](packages/dsh-cmdbar/README.md) | The command bar: the agent's own commands in a bottom dock, as a read-only transcript of the conversation log. It follows whichever conversation is on screen. |
| [`dsh-comfyui`](packages/dsh-comfyui/README.md) | ComfyUI as a surface the agent can build against: seven `comfy_*` tools turn a small readable project spec into the canvas the app opens and the prompt `/prompt` accepts, validate it against the server's own `/object_info` with ComfyUI's own error types, and report what a run produced. Every answer names the rung it reached (`v1-structural` to `v4-executed`), so a graph that compiles is never called one that runs, and with no server it still checks the files on disk and names a missing checkpoint beside the nearest one. `comfy_cli` drives comfy-cli as a second, independent path, and six skills teach the fundamentals, the two workflow formats and how to write a node class. |
| [`dsh-deckcraft`](packages/dsh-deckcraft/README.md) | Slides from the chat: four `deck_*` tools over the DeckCraft CLI (MIT OR Apache-2.0). `deck_commands` lists the command ids the build offers, `deck_run` saves a `.deckcraft` in the workspace, `deck_export` renders the slides to PNG so you can look at them. Nothing is hardcoded: DeckCraft's "every button is a command" contract is the API. |
| [`dsh-diagrams`](packages/dsh-diagrams/README.md) | Mermaid, TikZ and the Diagram Design kit as tabs and as seven `diagram_*` tools. The kit 204 examples and 44 documented types are vendored at a pinned commit and browsable on the index page. Every write, including a self-contained HTML document, is validated before it is stored. |
| [`dsh-docker`](packages/dsh-docker/README.md) | Docker or Podman as a surface: nine `docker_*` tools over the machine's own CLI, argv-only, with every removal confirmed by repeating the target. `docker_start` launches Docker Desktop or a podman machine and waits for the **daemon**. A Docker tab lists containers and images with their logs, and there is no `exec`, no `system prune` and no free-form `run`. |
Expand Down
162 changes: 162 additions & 0 deletions packages/dsh-comfyui/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,162 @@
# dsh-comfyui

ComfyUI as a surface the agent can **build against**: a project spec becomes a
real `workflow.json` + `prompt.json`, is validated against the server's own node
catalog with ComfyUI's own error vocabulary, is queued, and reports what came
out. One row, seven tools, six skills, no browser half, zero npm dependencies, no
bundled engine.

## Why it exists

A ComfyUI workflow is a graph saved in **two dialects that are not
interchangeable**:

- the **canvas** the app saves — integer node ids, links as array positions, and
`widgets_values`, an *unnamed* positional array;
- the **API prompt** `/prompt` accepts — ids as keys, wires as
`["<id>", <slot>]`, values by name.

Nothing in the harness could turn one into the other, so nothing could tell a
reader *which* of the two things a broken workflow does: fail to open, or fail to
run. And the quietest defect in the whole format lives in that unnamed array —
measured on ComfyUI 0.21.1, `KSampler` declares `control_after_generate` on
`seed`, so its array is seven long:

```
[42, "fixed", 4, 1.5, "lcm", "sgm_uniform", 1.0]
seed │ steps cfg sampler scheduler denoise
└─ the value a converter forgets, shifting every later widget by one
```

A graph converted with that shift still opens, still runs, and produces the wrong
image with nothing reporting it. This row exists to make that impossible.

## The seven tools

| Tool | Answers |
|---|---|
| `comfy_status` | four facts that fail independently: an **install** on disk (Desktop base path, portable folder, checkout — version, python, model counts), a **server** answering on loopback (`/system_stats`, device, VRAM), the **catalog** in force (`/object_info`, a cache, or the built-in core table), and the **projects** in the workspace. It probes 8188 *and* the Desktop ports 8000-8003 — Desktop does not use 8188. Starts nothing. |
| `comfy_nodes` | the catalog: categories, one class's exact inputs and outputs (widget vs link, default/min/max, the option list), or a search. Every answer says which catalog it read. |
| `comfy_project` | `new` (from a shipped template or an inline spec, **rebinding** model filenames to what this machine has), `list`, `show`, `build`, `import` |
| `comfy_validate` | ComfyUI's own checks, offline, with `/prompt`'s `type` strings (`required_input_missing`, `return_type_mismatch`, `value_not_in_list`, `dependency_cycle`, `prompt_no_outputs`, …) plus the node KEY and input NAME. Never queues, never writes |
| `comfy_run` | the only tool that executes: builds, refuses a graph with errors, submits, waits for `/history`, reports files with `/view` URLs — or the node that raised |
| `comfy_test` | the ladder over the shipped library: compile always (writes nothing), run when a server answers |
| `comfy_cli` | comfy-cli as a **second witness**: `run` (which converts the canvas itself), `deps` (which node packs a graph needs), `launch`/`stop`, `status`. Never `install` |

## The ladder — every answer names the rung it reached

| Rung | Means |
|---|---|
| `v1-structural` | the spec compiles and the wires type-check, against the built-in core table (eighteen nodes) |
| `v2-schema` | the same against a **complete** server catalog: every class exists, every value is in the server's list |
| `v3-queued` | `/prompt` accepted it and returned a `prompt_id` |
| `v4-executed` | a `/history` entry finished and named files |

`v1` says one thing plainly: *no server catalog was in force*. "It compiles" is
never printed as "it runs".

## What it checks with no server at all

A server's `/object_info` is what turns a dropdown into a file list, so with the
app closed nothing used to check that a graph's checkpoint exists. This row reads
the **install** instead — the base path `comfy_status` found, `models/<folder>/`,
`input/`, plus any extra model root comfy-cli reports — and reports a missing
file with ComfyUI's own type:

```
ERROR value_not_in_list (node 2 · input lora_name): models/loras/lcm-lora-sdXL.safetensors
does not exist on this machine (1 file(s) there; nearest: lcm-lora-sd15.safetensors).
ComfyUI refuses a prompt naming a file it does not have with value_not_in_list, so
this graph cannot run yet.
```

It runs on the **compiled prompt**, where `@bindings` are already filenames, and
only for a file input whose option list the catalog did not know — when a server
did answer, its list is the truth and this stays quiet. A folder that does not
exist is a warning, not a missing file: nothing can be claimed about a path that
is not there.

So `v1-structural` on a machine whose models happen to be present is now a
claim somebody made, and a missing model is named, with the nearest file beside
it, before anything is queued.

## A project is a folder

```
comfyui/<slug>/
project.json the SOURCE — nodes by key, values by name, wires by <key>.<OUTPUT>, @bindings for anything machine-specific
workflow.json GENERATED — drag it onto the canvas
prompt.json GENERATED — what /prompt accepts
README.md GENERATED — what it is, what it needs, what was checked
build.json GENERATED — the receipt: spec sha256, catalog, rung, findings
```

`comfy_project action=new template=text-to-image` on a machine with a different
checkpoint does not fail: it rebinds `@checkpoint` — only on an exact
case-insensitive match or when the server lists exactly one file, never by
guessing between two — and prints every rebinding it made. An unresolvable
binding is an ERROR, because a graph built against a model nobody chose fails one
step from the cause.

## The shipped examples

| Slug | Graph | Needs |
|---|---|---|
| `smoke-image` | `EmptyImage` → `SaveImage` | **nothing** |
| `smoke-video` | `EmptyImage` → `RepeatImageBatch` → `CreateVideo` → `SaveVideo` | **nothing** |
| `text-to-image` | the 8-node class build: checkpoint → LCM LoRA → 2× CLIP → latent → KSampler (4 steps, cfg 1.5) → VAE decode → save | a checkpoint + a LoRA |
| `image-to-image` | the same graph with `LoadImage` → `ImageScale` → `VAEEncode` and denoise 0.55 | both + an input image |

The two model-free ones exist so a person proves the server, the queue, the
output folder and this row's compiler work **before** a 2 GB download is blamed.
`comfy_test action=compile` checks all four with nothing running.

## The six skills

`comfyui-fundamentals` (the mental model: graph is a program, latent arithmetic,
the dials, the six failures) · `comfyui-workflow-json` (both dialects and the
positional trap) · `comfyui-api` (the endpoints, the `node_errors` body, the
twelve error types, polling) · `comfyui-cli` (comfy-cli across platforms —
install, launch, run, deps, nodes, models, `--json`) · `comfyui-node-class`
(writing a node: classic `INPUT_TYPES`, the V3 `IO.ComfyNode` schema, the
verification step) · `comfyui-projects` (this row's dialect and the rung ladder).

Every fenced example in them is checked by this package's own check: JSON must
parse, JavaScript must pass `node --check`, Python must pass `ast.parse`, and
every `curl` must name a documented route and every `comfy` line a real
subcommand.

## What it deliberately does not do

No UI of its own (the app is the UI), no installing ComfyUI / a node pack / a
model, no starting a server except through `comfy launch --background`, no
WebSocket (it polls `/history`), no remote servers unless
`DSH_COMFYUI_ALLOW_REMOTE=1`, and no lowering of a subgraph export — it names the
ungroup step instead, because a subgraph has virtual input/output nodes and a
guess would produce a prompt that runs and means something else.

## Where things live

| | |
|---|---|
| projects | `<workspace>/comfyui/` (`DSH_COMFYUI_ROOT` moves it) |
| catalog cache | `$DSH_HOME/dsh-comfyui/schema/<origin>.json` — one per server read |
| the server this row talks to | `DSH_COMFYUI_URL` (loopback only, unless opted in) |
| the install, if it is somewhere unusual | `DSH_COMFYUI_DIR` |
| the comfy-cli binary | `DSH_COMFY_CLI` |
| the port ComfyUI Desktop picked | discovered, not assumed — 8188 and 8000-8003 are probed |

## Checking it

```bash
node checks/check-comfyui-node.mjs
```

363 assertions with no server and no CLI: a fake ComfyUI answers the real routes
with real-shaped bodies, a fake runner answers `comfy --version`, the four
examples compile, the canvas round-trips back to the same prompt, every refusal
is produced by name, and the live half runs only when a real server answers
(`DSH_COMFYUI_CHECK_LIVE=0` skips it).

This is **additional** to `scripts/checks/` — it travels with the package, which
is what makes it useful outside this repository.
Loading