# Galley A pixel-art medieval galley for the Herdr app. Every agent is a rower chained to a bench. You can see at a glance who is pulling their oar to the drum, who snapped their oar and is waving for you, and who finished and stood up to stretch. The ship sails across the top of the window, a dark deck strip runs under it, and your terminals sit below in dark wood frames. ![Galley](preview.png) ## What you see One fixed look: no system title bar, root background `#4a2a14`, theme `graphite` with `background #1a2230`, `accent #d4a94a`, `border #4a2a14`, terminal font size 13. Pixel text is `PxPlus IBM VGA 8x16` (shipped in `mods/galley/fonts/`). Nothing is rounded. From top to bottom: 1. **The sea**, weight 1.15. Dragging it moves the window. All art is drawn in *art units* of `s` screen px, measured from the ship's stern end `x0` and its gunwale (rail top) `G`. The bow points right. - **Sky**: three bands that get lighter toward the horizon (`G - 8s`). Day is `#6fbbe9 / #8fcdf1 / #b4e0f6` with a pixel sun top right and four drifting clouds. Sunset (17–19h) is `#d9785a / #f2a65a / #f6c47a` with a low orange sun sinking into the sea. Night (19–6h) is `#141b3a / #1d2547 / #27305a` with 26 stars and a crescent moon. In daylight two gulls (`v` / `-` / `^`) fly across. - **Distant shore** on the horizon in a hazy colour (`#7d9cb8` by day): low hills on the left, and on the right at `0.78·w` a castle with two crenellated towers, a keep and a red flag. - **Sea**: `#4a92bd` near the horizon, `#2a6f99` lower down. Rows of white crest dashes (`#ffffff40`) every 14px slosh to and fro. - **Rigging**, behind the rowers: a mast (`#6b3f1f`, 3 units wide, 80 tall) at the middle of the benches. It carries a crow's nest, a yard and a square sail 38 units tall (from -64 to -26) with alternating `#efe3c2` / `#a8322a` stripes 6 units wide. The sail is half as wide as the benches, clamped to 40–84 units. Staircase-rope stays run to the stern post and the dragon, sheets run down to the rail, and a red pennant on the mast top flutters (its width loops). - **Rowers**: one per agent, seated on benches 20 units apart. They face the stern, the way real rowers do. Each has a random but stable look: hair (7 colours), skin (6 tones), style (short, long, bald, spiky, beard) and a headband 45% of the time. The tunic colour follows the agent kind (`claude #d97757`, `codex #2f3640`, `gemini #4f7dc9`, `opencode #8a62b8`, `pi #e58fb6`, ...), otherwise an earthy random one. - **Hull**, in front of the rowers: plank rows 2 units tall in alternating `#8a5530` / `#7a4a28`. It curves in toward the keel, rounder at the stern and sharper at the bow, 24 units deep. On top is a `#4a2a14` gunwale with a `#b07a48` highlight, and below the rowers is one dark oar port per bench. - Each space (project) gets a heraldic stripe 4 units tall under its benches, with the space name in the pixel font. Colours: red, blue, green, gold, purple and teal, fixed by the space id and never the same as the neighbouring space. Spaces are 6 units apart. - **Stern castle** (left): 30×14 `#9c6436` with three windows (lit `#f0c860` at night), a railing, and a curled stern post with a lantern. A bald **drummer** in a red tunic stands on it behind a drum. - **Forecastle** (right): 24×10 with a railing. A **captain** in a red hat and blue coat stands there with a spyglass. The stem rises into a gilded **dragon** figurehead, and a bronze **ram** juts out at the waterline. - **Water in front** from the waterline (`G + 16s`) down: `#1f5f86aa`, so blades and the keel show through it, with three rows of crests. - **Sign**, top left at x 84 (clear of the macOS window buttons): a parchment card `#f1e3b8` with a 3px `#6b3f1f` border. It reads `THE GALLEY` (16px) over `N at the oars` (12px), plus a blinking red `K broken oar(s)!` while any agent is blocked. 2. **Deck strip**, 28px `#4a2a14`: `space / tab` in `#f1e3b8` on the left. On the right, in `#d4a94a`: `N rowing`, `N broken oars` (`#ff8a7a`, shown only when there are any) and `N resting`. 3. **Terminals**, weight 1, 10px side padding: the active tab. Every pane, a lone one too, sits in a 4px `#2b1a10` frame (`#d4a94a` when focused), 10px apart, with a 26px `#b8864e` header. The header shows the program icon and name, and the status in capitals on the right: `ROWING`, `BROKEN OAR - NEEDS YOU` (in `#8a1f18`), `DONE - RESTING` or `IDLE`. ## How it behaves - **working**: the rower leans 2 units fore and aft while pulling the loom (iron cuff on the wrist). The oar outside swings about its port in time: its reach goes from 11 to 21 units over one 1400ms stroke, and the blade goes 15 units deep, under the water. The drummer's stick beats while anyone works. Now and then a bubble says `heave!`, `ugh`, `row!` or `...`. - **blocked** (needs you): **broken oar**. A splintered stub sticks out of the port. The other half (shaft plus blade) floats on the surface beside the hull, bobbing with a white wake line. The rower jumps (600ms) with both arms up, under a blinking red `NEEDS YOU` plate, or a `!` bubble when a bench is narrower than 60px. - **done** (finished while you weren't looking): the rower **stands up and stretches**. The arms go up and down, the oar is shipped and held upright beside them, and a `♪` / `♪♫` / `♫` bubble plays. - **idle / unknown**: the rower sits back with an arm at the side. The oar rests nearly level, out of the water. Now and then a bubble shows `♪`, `...`, `?`, `☼` or `zZ`. A done agent turns idle once you look at it, so only finished agents you haven't checked stand. - **Empty benches**: the ship always has at least four benches. A spare one shows only a resting oar. - **Clicks and hovers**: each bench has a hit area from 28 units above the rail to 18 below. Clicking a rower runs `agent.focus`. Clicking an empty bench opens a tab in that bench's space with the first installed agent from `knownAgents()`. Hovering shows a parchment note (200px): tab, space, title, status (`Empty bench` / `click: chain an agent here` on a spare). Bench order follows `agents()` and is passed to `setAgentOrder`. - **Night** (19–6h): the scene dims under `#0b123660`, and the stern and bow lanterns and the castle windows glow over the tint. 17–19h gets a warm `#f2a65a1a` tint. - **Fit**: the ship is `34 + benches·20 + (spaces-1)·6 + 30 + 12 (ram) + 10` units wide and 112 units tall. `s = min(4, (w-32)/width, (h-8)/112)`, floored to half pixels, at least 1. The ship is centred horizontally, and the gunwale sits at `max(82s, (h - 112s)/2 + 84s)`. ## Built from - `layouts/galley.json`: a `column` of three blocks. `galley-sea` holds mod `galley` and has `window_drag`. `galley-rail` holds mod `galley` with props `{role: "rail"}`. `galley-hold` is `{tab: "active"}` with a pane frame whose header is mod `galley` with props `{role: "pane"}`. `preview` points at `layouts/galley.svg`. - `mods/galley/art.js`: sprites as rows of palette letters (`sprite(rows, palette, s)` draws one `div` per run of a colour), rowers in four poses (`row`, `idle`, `help`, `stand`), the oar `shaft`, the drummer, captain and dragon, `backdrop` (sky, shore, sea, clouds, gulls), `rigging`, `hull`, `waterFront` and `lanterns`. Per-rower looks are seeded from a hash of the agent's address. - `mods/galley/main.js`: one mod with three roles chosen by `props().role`. The scene is drawn in layers so the ship overlaps correctly: backdrop → rigging → rowers → hull → drummer → oars → front water → floating wrecks → night tint and lanterns → bubbles → hit areas → hover note → sign. A 1s timer only rolls thought bubbles and watches the minute (for day and night), and it calls `cx.notify()` only on a change. Every movement is a native `loop` or `frames`. - **The oar trick**: there is no rotation. An oar is an `h_flex` of 7 segments: a fixed-width blade, then shaft segments with `flex_1`, each lifted by `mt` so together they form a diagonal staircase. The row is anchored by `.right(w - portX)`, so looping its `width` swings the oar about the port while the staircase stays joined. - `props: {demo: true}` on `galley-sea` fills the ship with 9 sample rowers in every state, in three spaces, with three times as many thought bubbles. On `galley-rail` it shows `web / fix login` and the sample crew's counts instead of your own space and agents. The preview was taken with both, so no real names show. - Uses `agents()`, `spaces()`, `panes()`, `knownAgents()`, `run("agent.focus")`, `run("tab.new")` and `setAgentOrder`. No network, no `exec`, no files outside its folder. ## Watch out - Loops are ping-pong (there and back) with no phase offset. To keep a rower and their oar in step, give both the same period and start them in the same render. Rowers added later row a little out of step with the rest, which looks natural enough. - Loops and frames need a stable `.id()`, or they restart on every render. - Give the root element an id that is unique per mod instance (`galley-root-`). Then `on_size_change` fires for a fresh copy after a props change or hot reload, instead of the copy keeping its 1200×440 default. - Every clickable bench stops `on_mouse_down`, because the block has `window_drag`. - Notify only on real hover changes: a redraw reports hover again, so an unconditional `cx.notify()` in `on_hover` loops. - Draw order matters. Rowers go before the hull (the rail hides their legs), oars after the hull, the front water after the oars (it tints the blades), and the floating wreck after the water (so it floats on top). - Gulls and clouds ping-pong too, so they fly back the way they came. - More than about 30 agents on a narrow window drives `s` down to 1. The space names on the hull disappear when the stripe is shorter than 8px. - `PxPlus IBM VGA 8x16` is CC BY-SA 4.0 (VileR, int10h.org): keep its licence file with it. ## Done when - `herdr-app check mods/galley` passes, `layout.switch {"name":"galley"}` shows the ship with one rower per running agent, and `herdr-app status` reports no errors. - A working agent's rower leans to and fro and its oar sweeps through the water. Two `herdr-app shot`s a third of a second apart show different oar angles. The drummer beats. - When an agent asks for permission, its oar snaps: a stub at the port, the other half bobbing on the water. The rower jumps under a blinking `NEEDS YOU`. The pane header reads `BROKEN OAR - NEEDS YOU` and the sign shows `1 broken oar!`. - When an agent finishes while you are elsewhere, its rower stands, stretches, holds the oar upright and hums `♪`. After you look at it, it sits back down (idle). - Clicking a rower focuses that agent's terminal. Hovering a bench shows its parchment note. - After 19h the scene goes dark with a moon and stars, and the lanterns glow.