Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

feat(society): the Plugin Docks - first World Kit building, built in Blender by script

rubenluetke10-beep0aafd905205e
diff --git a/docs/agent-society/world-behaviour-manual.md b/docs/agent-society/world-behaviour-manual.md
new file mode 100644
index 0000000000..275fbe3a9c
--- /dev/null
+++ b/docs/agent-society/world-behaviour-manual.md
@@ -0,0 +1,128 @@
+# World Behaviour Manual — how agents live on the island
+
+Status: **binding for M3c/M3d, written 2026-09-02.** Subordinate to [`MASTERPLAN.md`](MASTERPLAN.md)
+§2 (the world is a projection; idle is LLM-free; dispatch is the scheduler's privilege) and to
+[`world-masterplan-v2.md`](world-masterplan-v2.md) §5–6, which this manual turns into rules a
+programmer, an agent prompt and a tester can each check. The maintainer's ask: *"the agents must
+know the world — when one uses a plugin it goes to the Plugin Store; the world has to work."*
+
+## 1. Two truths, one picture
+
+The island shows two things and never invents a third:
+
+1. **What the backend says an agent IS doing** — its `checkpoint` (the semantic place) and its
+ `state`. This comes from the society event log through the bridge; the world only reads it.
+2. **How the island shows it** — the walk, the pose, the bubble. This is client-side and cosmetic.
+
+Nothing an agent *says* moves it. Nothing the *viewer* does moves it directly either (§5): every
+gesture becomes a typed event, and the figure follows because the truth changed.
+
+## 2. Places — the vocabulary
+
+| checkpoint | island place | the agent is… |
+|---|---|---|
+| `home` | its own house on the ring | off duty: paused, or between runs at night |
+| `square` | the table under the tree | in a bounded room (`ROOM_OPEN … ROOM_SETTLE`), or idling on the square |
+| `hub:plugins` | **Plugin Docks** | running a task whose dominant hands are **plugin tools** (Gmail, calendar, files via a plugin…) |
+| `hub:skills` | Skill Forge | running a task whose dominant hands are skills |
+| `hub:mcp` | Relay Tower | calling MCP servers |
+| `hub:cli` | Terminal Cantina | working through a CLI seat (Claude Code, Codex, …) |
+| `hub:workshop` | Workshop | core file/shell work, no dominant family |
+| `hub:models` | Model Foundry | its brain is a local model that is currently inferring |
+| `archive` | Archive | writing knowledge / a reviewed promotion |
+| `gallery` | Gallery | delivering a `RESULT` (carries the crate) |
+| `gate` | Harbor Gate | waiting for an `ask`-tier approval |
+| `foundry` | Agent Foundry | being created (3 s), or changing its avatar |
+| `wander` | the square and its own street | idle; the rest-biased model picks the beats |
+
+V1 ships `desk | meeting | archive | gate | idle` (`data.ts`); this table is the M3d superset.
+`hub:*` values join the five-layer parity set (Python enum ↔ SQL CHECK ↔ Pydantic ↔ TS ↔ UI, AP-4)
+when they land in the schema — never as free strings.
+
+## 3. Derivation — who decides the place (trusted Python, no LLM)
+
+The **society bridge** (`jarvis/society/bridge.py`, M1) derives `checkpoint` from events it already
+sees. Rules, in priority order; the first that matches wins:
+
+1. `state == paused` → `home`.
+2. An open approval for the agent → `gate`.
+3. The agent is a member of an open room → `square`.
+4. A `RESULT` was emitted in the last 6 s → `gallery` (then rule 6 or 8 applies).
+5. A worker runs under the agent's identity → `hub:<family>` where family is the **dominant
+ capability family of its last 8 tool calls** (`plugin | skill | mcp | cli | core`, from the ONE
+ capability catalog of `agent-definition.md` §3.1). The place changes only when a different
+ family has dominated for **≥ 20 s** — hysteresis, so a figure never ping-pongs between shops.
+ A local-brain agent whose model is inferring right now → `hub:models` outranks the family.
+6. A knowledge write in the last 6 s → `archive`.
+7. Being created / avatar change → `foundry`.
+8. Otherwise → `wander`.
+
+The rule set is pure and unit-tested (`tests/unit/society/test_checkpoint_rules.py`, M3d): given a
+list of events with timestamps, it returns one checkpoint. The world never runs it.
+
+## 4. What the agent itself knows — the "world card"
+
+Agents do not need the map to work, but they should be able to **talk about where they are**
+("I'm at the Plugin Docks, sending the mail through the Gmail plugin") and to reason about the
+society's places when the user asks. The prompt assembly of `agent-definition.md` §3.3 gains one
+short, cached section — the world card — and nothing else:
+
+```
+You live in a small island village with your fellow agents. Places: your house (rest),
+the market square (group discussions), the Plugin Docks (plugin tools), the Skill
+Forge (skills), the Relay Tower (MCP servers), the Terminal Cantina (coding CLIs),
+the Workshop (files and shell), the Archive (shared memory), the Gallery (finished
+work), the Harbor Gate (waiting for approval), the Agent Foundry (where agents are
+created). You are placed by what you actually do; you cannot move yourself. When you
+mention your location, use these names.
+```
+
+Rules: prefix-stable (cached), ≤ 120 tokens, identical for every agent, never carries live state
+(the place is a fact the runtime knows; the agent narrates, it does not decide). Runtime output
+language stays with `turn_language.py` — the card is English in the prompt; the agent answers
+in the turn's language.
+
+## 5. Steering — how a viewer moves an agent
+
+| Gesture in the world | Event | Guard |
+|---|---|---|
+| card → "Assign task" | `ASSIGN` through the scheduler | tier wall (§2.5), budget pre-check |
+| drag a figure onto a hub | `ASSIGN` with the hub's capability as `focus`; the card opens pre-filled, the user confirms | user confirms every time |
+| right-click → "Pause" / "Go home" | `state = paused` / `active` | — |
+| voice via Jarvis: "send Scout to the Plugin Docks and …" | router's `delegate-to-agent` (M4) → `ASSIGN` | voice ACK ≤ 5 s |
+| click a building → "Send someone here" | pick an agent → as drag | — |
+| follow-cam, select, hover | none — camera only | — |
+
+The figure walks when, and only when, the derived checkpoint changes. A rejected `ASSIGN` (tier,
+budget, kill switch) never moves anyone; the card shows the typed failure reason.
+
+## 6. What the buildings do
+
+Every hub has three faces, and all three are required before a building ships (finish-it-everywhere):
+
+| Face | Plugin Docks (the first, shipped in M3b/M3c) | Every other hub |
+|---|---|---|
+| **for the agent** | stand point in front of the bays; `work` clip while there | stand point + clip from the kit contract |
+| **for the viewer** | click → drawer listing every installed plugin by family (`/api/plugins`), link to the Plugins section | click → drawer for that section, deep link |
+| **live signal** | (M3d) bay stripe of the active family glows while an agent works there | per §5 of the v2 plan |
+
+Bay colours are the family colours everywhere — the building, the drawer swatches, later the
+bubbles: brains violet, tools teal, speech-to-text coral, text-to-speech amber, channels mint,
+realtime sky.
+
+## 7. Zero-cost guarantees (unchanged)
+
+- Idle costs nothing: wander is a timer and a random tile; no LLM is ever called to "look alive".
+- A closed app freezes the society; the island shows the last derived places on reopen.
+- Two windows show the same places; footsteps differ by design.
+- Reduced motion: figures stand at their places; the Ledger stays the declared equivalent.
+
+## 8. Test plan (M3d exit)
+
+1. Unit: `checkpoint_rules` — the eight rules, the hysteresis, the priority order.
+2. Contract: a fake worker run with 10 plugin tool calls → the agent's row reads `hub:plugins`
+ within one bridge tick; a `RESULT` → `gallery` then `wander`.
+3. Screenshot (headless Chrome, recipe in project memory): the walker stands in front of the
+ Plugin Docks' bays, facing north, nameplate visible.
+4. Steering: drag Scout onto the Docks → an `ASSIGN` with `focus=[plugin:*]` appears in the log;
+ a specialist dragging (via API) is refused with the typed reason.
diff --git a/jarvis/ui/web/frontend/src/assets/society/world/kit/plugin-docks.glb b/jarvis/ui/web/frontend/src/assets/society/world/kit/plugin-docks.glb
new file mode 100644
index 0000000000..0bf86d0c04
Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/world/kit/plugin-docks.glb differ
diff --git a/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx b/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
new file mode 100644
index 0000000000..7cb4b4df51
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
@@ -0,0 +1,131 @@
+/**
+ * A World Kit building: a GLB built by `scripts/world/build_world_kit.py`,
+ * placed on its island plot, restyled to the world's toon ramp on load and
+ * clickable (world-masterplan-v2.md §4, §5).
+ *
+ * The GLB's materials arrive as Standard (PBR) from Blender; the island lights
+ * everything with the same four-step ramp, so every mesh gets a Toon material
+ * with the GLB's colour and emissive — one code path for kit and primitives.
+ */
+import { useEffect, useMemo, useState } from "react";
+import { useGLTF } from "@react-three/drei";
+import { useThree, type ThreeEvent } from "@react-three/fiber";
+import { Color, Mesh, MeshBasicMaterial, MeshStandardMaterial, MeshToonMaterial, type Object3D } from "three";
+import * as SkeletonUtils from "three/examples/jsm/utils/SkeletonUtils.js";
+
+import pluginDocksUrl from "@/assets/society/world/kit/plugin-docks.glb";
+import { useCameraStore } from "./cameraStore";
+import { buildIsland, groundY, tileToWorld, type PlaceId } from "./islandLayout";
+import { createToonRamp } from "./worldMaterials";
+
+/** Every kit file the registry knows. Adding a building = adding a row. */
+export const KIT_URLS = {
+ "plugin-docks": pluginDocksUrl,
+} as const;
+export type KitId = keyof typeof KIT_URLS;
+
+/** Where each kit building stands and which place it is. */
+export const KIT_PLACEMENTS: ReadonlyArray<{ kit: KitId; place: PlaceId; rotation: number }> = [
+ { kit: "plugin-docks", place: "plugins", rotation: 0 },
+];
+
+/** Emission above this strength renders unlit (a lamp, a neon tube), below it stays a lit toon. */
+const GLOW_STRENGTH = 1.5;
+
+function restyle(root: Object3D, ramp: ReturnType<typeof createToonRamp>): void {
+ root.traverse((o) => {
+ if (!(o instanceof Mesh)) return;
+ const src = o.material as MeshStandardMaterial;
+ if (!(src instanceof MeshStandardMaterial)) return;
+ const emissiveStrength = src.emissiveIntensity * Math.max(src.emissive.r, src.emissive.g, src.emissive.b);
+ if (emissiveStrength >= GLOW_STRENGTH) {
+ o.material = new MeshBasicMaterial({ color: src.emissive.clone().multiplyScalar(1) });
+ } else {
+ o.material = new MeshToonMaterial({
+ color: src.color.clone(),
+ gradientMap: ramp,
+ emissive: emissiveStrength > 0 ? src.emissive.clone() : new Color(0, 0, 0),
+ emissiveIntensity: emissiveStrength > 0 ? Math.min(0.6, src.emissiveIntensity) : 0,
+ });
+ }
+ o.castShadow = true;
+ o.receiveShadow = true;
+ });
+}
+
+export function KitBuilding({
+ kit,
+ place,
+ rotation,
+ onClick,
+ selected,
+}: {
+ kit: KitId;
+ place: PlaceId;
+ rotation: number;
+ onClick?: (place: PlaceId) => void;
+ selected?: boolean;
+}) {
+ const { scene } = useGLTF(KIT_URLS[kit]);
+ const gl = useThree((s) => s.gl);
+ const [hover, setHover] = useState(false);
+ const ramp = useMemo(createToonRamp, []);
+ const instance = useMemo(() => {
+ const clone = SkeletonUtils.clone(scene);
+ restyle(clone, ramp);
+ return clone;
+ }, [scene, ramp]);
+
+ useEffect(
+ () => () => {
+ instance.traverse((o) => {
+ if (o instanceof Mesh) (o.material as MeshToonMaterial | MeshBasicMaterial).dispose();
+ });
+ ramp.dispose();
+ },
+ [instance, ramp],
+ );
+
+ useEffect(() => {
+ if (!onClick) return;
+ gl.domElement.style.cursor = hover ? "pointer" : "";
+ return () => {
+ gl.domElement.style.cursor = "";
+ };
+ }, [hover, gl, onClick]);
+
+ const { map, content } = buildIsland();
+ const [tx, tz] = content.places[place].tile;
+ const [x, z] = tileToWorld(tx, tz);
+ const y = groundY(map, x, z);
+
+ const click = (e: ThreeEvent<MouseEvent>) => {
+ if (!onClick) return;
+ e.stopPropagation();
+ if (useCameraStore.getState().dragging) return;
+ onClick(place);
+ };
+
+ return (
+ <group
+ position={[x, y, z]}
+ rotation={[0, rotation, 0]}
+ onClick={click}
+ onPointerOver={(e) => {
+ e.stopPropagation();
+ setHover(true);
+ }}
+ onPointerOut={() => setHover(false)}
+ >
+ <primitive object={instance} />
+ {(hover || selected) && (
+ <mesh position={[0, 0.06, 0]} rotation={[-Math.PI / 2, 0, 0]}>
+ <ringGeometry args={[9.6, 10.2, 48]} />
+ <meshBasicMaterial color={selected ? "#ffd166" : "#fffaf0"} transparent opacity={0.85} />
+ </mesh>
+ )}
+ </group>
+ );
+}
+
+useGLTF.preload(pluginDocksUrl);
diff --git a/jarvis/ui/web/frontend/src/components/society/world/Landmarks.tsx b/jarvis/ui/web/frontend/src/components/society/world/Landmarks.tsx
index c67c5247a9..705eaa32c3 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/Landmarks.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/Landmarks.tsx
@@ -9,6 +9,7 @@ import { useFrame } from "@react-three/fiber";
import { InstancedMesh, Mesh, Object3D } from "three";
import { buildIsland, groundY, tileToWorld, type PlaceId, type Post } from "./islandLayout";
+import { KIT_PLACEMENTS, KitBuilding } from "./KitBuilding";
import { Block, useKit, type Kit } from "./WorldKit";
import { PAL } from "./worldMaterials";
@@ -165,11 +166,23 @@ function SolarField({ kit, posts }: { kit: Kit; posts: Post[] }) {
);
}
-export function Landmarks({ paused }: { paused: boolean }) {
+export function Landmarks({
+ paused,
+ onHubClick,
+ openHub,
+}: {
+ paused: boolean;
+ /** A kit building was clicked — the stage opens that hub's drawer. */
+ onHubClick?: (place: PlaceId) => void;
+ openHub?: PlaceId | null;
+}) {
const kit = useKit();
const { content } = buildIsland();
return (
<group>
+ {KIT_PLACEMENTS.map((k) => (
+ <KitBuilding key={k.kit} kit={k.kit} place={k.place} rotation={k.rotation} onClick={onHubClick} selected={openHub === k.place} />
+ ))}
<Workshop kit={kit} />
<Archive kit={kit} />
<Harbor kit={kit} paused={paused} />
diff --git a/jarvis/ui/web/frontend/src/components/society/world/PlaceLabels.tsx b/jarvis/ui/web/frontend/src/components/society/world/PlaceLabels.tsx
index 2197fdf9ef..ec5b38df07 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/PlaceLabels.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/PlaceLabels.tsx
@@ -18,6 +18,7 @@ const LABEL_Y: Record<PlaceId, number> = {
lighthouse: 16,
gardens: 6,
solar: 5,
+ plugins: 13,
};
export function PlaceLabels() {
diff --git a/jarvis/ui/web/frontend/src/components/society/world/PluginStoreDrawer.tsx b/jarvis/ui/web/frontend/src/components/society/world/PluginStoreDrawer.tsx
new file mode 100644
index 0000000000..12b2d5a2fe
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/world/PluginStoreDrawer.tsx
@@ -0,0 +1,105 @@
+/**
+ * What a click on the Plugin Docks opens: every plugin installed in this app,
+ * grouped by family, as a drawer over the island (one-viewer doctrine — the
+ * world keeps living behind it). Data: `/api/plugins`, the entry-point
+ * catalog the backend already serves. The drawer is app chrome, so it wears
+ * the theme tokens; only the family swatches echo the building's bay colours.
+ */
+import { useEffect } from "react";
+import { useQuery } from "@tanstack/react-query";
+import { ExternalLink, X } from "lucide-react";
+
+import { useT } from "@/i18n";
+import { useEventStore } from "@/store/events";
+
+/** Entry-point group → family key, label key and the bay colour it wears. */
+const FAMILIES: ReadonlyArray<{ group: string; key: string; color: string }> = [
+ { group: "jarvis.brain", key: "brain", color: "#9b5de5" },
+ { group: "jarvis.tool", key: "tool", color: "#2ec4b6" },
+ { group: "jarvis.stt", key: "stt", color: "#ff6f61" },
+ { group: "jarvis.tts", key: "tts", color: "#ffb703" },
+ { group: "jarvis.channel", key: "channel", color: "#06d6a0" },
+ { group: "jarvis.realtime", key: "realtime", color: "#4cc9f0" },
+ { group: "jarvis.wakeword", key: "wakeword", color: "#c9c2b2" },
+ { group: "jarvis.harness", key: "harness", color: "#8b8f9c" },
+];
+
+async function fetchPlugins(): Promise<Record<string, string[]>> {
+ const res = await fetch("/api/plugins");
+ if (!res.ok) throw new Error(`HTTP ${res.status}`);
+ return (await res.json()) as Record<string, string[]>;
+}
+
+export function PluginStoreDrawer({ onClose }: { onClose: () => void }) {
+ const t = useT();
+ const setActiveSection = useEventStore((s) => s.setActiveSection);
+ const plugins = useQuery({ queryKey: ["plugins", "catalog"], queryFn: fetchPlugins, staleTime: 60_000 });
+
+ useEffect(() => {
+ const onKey = (e: KeyboardEvent) => {
+ if (e.key === "Escape") onClose();
+ };
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, [onClose]);
+
+ const total = plugins.data ? Object.values(plugins.data).reduce((n, v) => n + v.length, 0) : 0;
+
+ return (
+ <aside
+ className="absolute inset-y-3 right-3 z-30 flex w-[340px] max-w-[85%] flex-col overflow-hidden rounded-lg border border-border bg-popover text-foreground shadow-float"
+ role="dialog"
+ aria-label={t("society.world.drawer_plugins_title")}
+ >
+ <header className="flex items-start justify-between gap-3 border-b border-border px-4 py-3">
+ <div className="min-w-0">
+ <h2 className="font-display text-base font-semibold tracking-tight">{t("society.world.drawer_plugins_title")}</h2>
+ <p className="mt-0.5 text-xs text-muted-foreground">{t("society.world.drawer_plugins_hint")}</p>
+ </div>
+ <button
+ type="button"
+ onClick={onClose}
+ aria-label={t("society.world.drawer_close")}
+ className="rounded-md p-1 text-muted-foreground hover:bg-muted hover:text-foreground"
+ >
+ <X size={16} />
+ </button>
+ </header>
+ <div className="min-h-0 flex-1 overflow-y-auto px-4 py-3">
+ {plugins.isLoading && <p className="text-sm text-muted-foreground">{t("society.world.drawer_loading")}</p>}
+ {plugins.isError && <p className="text-sm text-destructive">{String(plugins.error)}</p>}
+ {plugins.data && total === 0 && <p className="text-sm text-muted-foreground">{t("society.world.drawer_empty")}</p>}
+ {plugins.data &&
+ FAMILIES.filter((f) => (plugins.data?.[f.group]?.length ?? 0) > 0).map((f) => {
+ const names = [...(plugins.data?.[f.group] ?? [])].sort();
+ return (
+ <section key={f.group} className="mb-4">
+ <h3 className="mb-1.5 flex items-center gap-2 text-xs font-medium uppercase tracking-wide text-muted-foreground">
+ <span className="inline-block h-2.5 w-2.5 rounded-sm" style={{ background: f.color }} aria-hidden />
+ {t(`society.world.plugin_group_${f.key}`)}
+ <span className="tabular-nums">{names.length}</span>
+ </h3>
+ <ul className="flex flex-wrap gap-1.5">
+ {names.map((n) => (
+ <li key={n} className="rounded-md bg-secondary px-2 py-1 font-mono text-xs text-foreground">
+ {n}
+ </li>
+ ))}
+ </ul>
+ </section>
+ );
+ })}
+ </div>
+ <footer className="border-t border-border px-4 py-3">
+ <button
+ type="button"
+ onClick={() => setActiveSection("plugins")}
+ className="inline-flex h-8 items-center gap-2 rounded-md bg-secondary px-3 text-sm font-medium text-foreground hover:bg-muted"
+ >
+ <ExternalLink size={14} />
+ {t("society.world.drawer_open_section")}
+ </button>
+ </footer>
+ </aside>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx b/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx
index d52a01eacd..1b428428ba 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx
@@ -31,6 +31,7 @@ import { useCameraStore } from "./cameraStore";
import { Clouds } from "./Clouds";
import { Landmarks } from "./Landmarks";
import { PlaceLabels } from "./PlaceLabels";
+import { PluginStoreDrawer } from "./PluginStoreDrawer";
import { Shadowed } from "./Shadowed";
import { SunRig } from "./SunRig";
import { Terrain, Water } from "./Terrain";
@@ -42,6 +43,7 @@ import { WorldCameraRig } from "./WorldCameraRig";
import { WorldComposer } from "./WorldComposer";
import { WorldHud } from "./WorldHud";
import { WorldKitProvider } from "./WorldKit";
+import type { PlaceId } from "./islandLayout";
import { cameraOffset } from "./worldCamera";
import { SKY } from "./worldPalette";
import { useWorldSettings } from "./worldSettings";
@@ -71,6 +73,7 @@ export function WorldStage({ topRight, onOpenLedger, onSelectAgent }: WorldStage
const agents = roster.data?.agents ?? [];
const sample = roster.data?.sample ?? true;
const [selected, setSelected] = useState<string | null>(null);
+ const [openHub, setOpenHub] = useState<PlaceId | null>(null);
useWorldControls(hostRef, webgl);
@@ -135,11 +138,11 @@ export function WorldStage({ topRight, onOpenLedger, onSelectAgent }: WorldStage
<Water paused={reduced} />
<Shadowed>
<Village paused={reduced} />
- <Landmarks paused={reduced} />
+ <Landmarks paused={reduced} onHubClick={(p) => setOpenHub((cur) => (cur === p ? null : p))} openHub={openHub} />
<Trees />
<Walkers agents={agents} paused={reduced} selectedId={selected} onSelect={select} />
</Shadowed>
- <Clouds paused={reduced} />
+ {shadows && <Clouds paused={reduced} />}
{ready && <PlaceLabels />}
</WorldKitProvider>
<WorldCameraRig />
@@ -149,6 +152,7 @@ export function WorldStage({ topRight, onOpenLedger, onSelectAgent }: WorldStage
{ready && (
<WorldHud agents={agents} sample={sample} awake={awake} reducedMotion={reduced} topRight={topRight} />
)}
+ {ready && openHub === "plugins" && <PluginStoreDrawer onClose={() => setOpenHub(null)} />}
</div>
);
}
diff --git a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
index bdb0baaedc..0488b2fd30 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
@@ -103,7 +103,8 @@ export type PlaceId =
| "harbor"
| "lighthouse"
| "gardens"
- | "solar";
+ | "solar"
+ | "plugins";
export interface Place {
id: PlaceId;
@@ -279,6 +280,8 @@ const PLACE_TILES: Record<PlaceId, [number, number]> = {
lighthouse: [CENTER_TILE + 62, CENTER_TILE],
gardens: [CENTER_TILE + 30, CENTER_TILE + 34],
solar: [CENTER_TILE - 32, CENTER_TILE - 32],
+ // The Plugin Docks: first World Kit building, north of the west spoke.
+ plugins: [CENTER_TILE - 42, CENTER_TILE - 9],
};
/** Half extents (tiles) of the flat plots each place is built on. */
@@ -291,6 +294,7 @@ const PLOT_HALF: Record<PlaceId, [number, number]> = {
lighthouse: [3, 3],
gardens: [9, 7],
solar: [8, 6],
+ plugins: [6, 5],
};
/** Building footprints (half extents, tiles) that block walking. */
@@ -299,6 +303,7 @@ const BUILDING_HALF: Partial<Record<PlaceId, [number, number]>> = {
archive: [3, 3],
workshop: [6, 3],
lighthouse: [1, 1],
+ plugins: [4, 3],
};
/** Where the dock reaches into the bay: from the harbor plot southward. */
@@ -637,6 +642,8 @@ function buildPlaces(map: IslandMap): Record<PlaceId, Place> {
lighthouse: place("lighthouse", [PLACE_TILES.lighthouse[0] - 3, C], Math.PI / 2),
gardens: place("gardens", [PLACE_TILES.gardens[0], PLACE_TILES.gardens[1]], 0),
solar: place("solar", [PLACE_TILES.solar[0] + 1, PLACE_TILES.solar[1] + 8], Math.PI),
+ // In front of the docks' bays, facing the building (north).
+ plugins: place("plugins", [PLACE_TILES.plugins[0], PLACE_TILES.plugins[1] + 5], Math.PI),
};
void facingCentre;
// Make sure every stand tile is walkable — a place nobody can reach is a bug.
diff --git a/jarvis/ui/web/frontend/src/components/society/world/worldSettings.ts b/jarvis/ui/web/frontend/src/components/society/world/worldSettings.ts
index 1f03a380ec..ad77cb7b39 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/worldSettings.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/worldSettings.ts
@@ -66,7 +66,9 @@ export const useWorldSettings = create<WorldSettings>((set, get) => ({
grain: normalizeGrain(initial.grain),
scale: normalizeScale(initial.scale),
bloom: initial.bloom ?? false,
- shadows: initial.shadows ?? true,
+ // Off by default (maintainer, 2026-09-02): the sun shadows read as noise on
+ // his machine; the setting stays for those who want them.
+ shadows: initial.shadows ?? false,
setGrain: (grain) => {
set({ grain });
persist(get());
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
index 94721764b8..2077807479 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
@@ -17,6 +17,21 @@
"webgl_missing_body": "Dieses Fenster kann gerade kein 3D zeichnen. Das Ledger zeigt dieselben Agenten.",
"open_ledger": "Ledger öffnen",
"loading": "Die Insel wird gebaut…",
+ "place_plugins": "Plugin-Docks",
+ "drawer_plugins_title": "Plugin-Docks",
+ "drawer_plugins_hint": "Alle in dieser App installierten Plugins, nach Familie. Ein Agent geht hierher, wenn sein Lauf auf ein Plugin setzt.",
+ "drawer_open_section": "Bereich Plugins öffnen",
+ "drawer_close": "Schließen",
+ "drawer_loading": "Plugin-Katalog wird gelesen…",
+ "drawer_empty": "Keine Plugins gefunden.",
+ "plugin_group_brain": "Gehirne",
+ "plugin_group_tool": "Werkzeuge",
+ "plugin_group_stt": "Sprache zu Text",
+ "plugin_group_tts": "Text zu Sprache",
+ "plugin_group_channel": "Kanäle",
+ "plugin_group_realtime": "Echtzeit-Stimme",
+ "plugin_group_wakeword": "Weckwörter",
+ "plugin_group_harness": "Harnesse",
"place_market": "Marktplatz",
"place_hub": "Jarvis-Hub",
"place_workshop": "Werkstatt",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
index 0e42243870..897c7491a3 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
@@ -17,6 +17,21 @@
"webgl_missing_body": "This window cannot draw 3D right now. The ledger lists the same agents.",
"open_ledger": "Open the ledger",
"loading": "Building the island…",
+ "place_plugins": "Plugin Docks",
+ "drawer_plugins_title": "Plugin Docks",
+ "drawer_plugins_hint": "Every plugin installed in this app, by family. An agent walks here when its run leans on a plugin.",
+ "drawer_open_section": "Open the Plugins section",
+ "drawer_close": "Close",
+ "drawer_loading": "Reading the plugin catalog…",
+ "drawer_empty": "No plugins found.",
+ "plugin_group_brain": "Brains",
+ "plugin_group_tool": "Tools",
+ "plugin_group_stt": "Speech to text",
+ "plugin_group_tts": "Text to speech",
+ "plugin_group_channel": "Channels",
+ "plugin_group_realtime": "Realtime voice",
+ "plugin_group_wakeword": "Wake words",
+ "plugin_group_harness": "Harnesses",
"place_market": "Market Square",
"place_hub": "Jarvis Hub",
"place_workshop": "Workshop",
diff --git a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
index 010daa8f58..6e350cef67 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
@@ -17,6 +17,21 @@
"webgl_missing_body": "Esta ventana no puede dibujar 3D ahora mismo. El registro muestra los mismos agentes.",
"open_ledger": "Abrir el registro",
"loading": "Construyendo la isla…",
+ "place_plugins": "Muelles de Plugins",
+ "drawer_plugins_title": "Muelles de Plugins",
+ "drawer_plugins_hint": "Todos los plugins instalados en esta app, por familia. Un agente viene aquí cuando su tarea depende de un plugin.",
+ "drawer_open_section": "Abrir la sección Plugins",
+ "drawer_close": "Cerrar",
+ "drawer_loading": "Leyendo el catálogo de plugins…",
+ "drawer_empty": "No se encontraron plugins.",
+ "plugin_group_brain": "Cerebros",
+ "plugin_group_tool": "Herramientas",
+ "plugin_group_stt": "Voz a texto",
+ "plugin_group_tts": "Texto a voz",
+ "plugin_group_channel": "Canales",
+ "plugin_group_realtime": "Voz en tiempo real",
+ "plugin_group_wakeword": "Palabras de activación",
+ "plugin_group_harness": "Arneses",
"place_market": "Plaza del Mercado",
"place_hub": "Centro Jarvis",
"place_workshop": "Taller",
diff --git a/scripts/world/build_world_kit.py b/scripts/world/build_world_kit.py
new file mode 100644
index 0000000000..a328599412
--- /dev/null
+++ b/scripts/world/build_world_kit.py
@@ -0,0 +1,541 @@
+"""Build the island's World Kit buildings in Blender — reproducible, headless.
+
+The ONLY producer of the GLBs under
+``jarvis/ui/web/frontend/src/assets/society/world/kit/`` (world-masterplan-v2.md §4).
+Runs inside Blender's Python::
+
+ blender -b --python scripts/world/build_world_kit.py -- --target plugin-docks \
+ --out jarvis/ui/web/frontend/src/assets/society/world/kit [--preview out.png]
+
+or, during development, through the Blender MCP (``exec(open(path).read())`` with
+``KIT_ARGS`` set) — the MCP is the fast inner loop, never a build dependency.
+
+Contract (§4.1): origin at the footprint's ground centre, the FRONT (door side)
+faces glTF +Z, which is Blender −Y; metres; bevelled edges; one flat material
+per colour; the root empty carries ``jarvis_building`` extras.
+
+Never imports ``jarvis.*`` — Blender's bundled interpreter knows nothing of it.
+"""
+
+from __future__ import annotations
+
+import json
+import math
+import sys
+from pathlib import Path
+
+import bpy # type: ignore[import-not-found]
+
+# ---------------------------------------------------------------------------
+# Palette — the world's own (worldPalette.ts), plus the plugin-family accents
+# ---------------------------------------------------------------------------
+
+PALETTE = {
+ "wall": "#f7f3ea",
+ "wall_shade": "#e6e0d2",
+ "trim": "#c9c2b2",
+ "plinth": "#b8a58a",
+ "glass": "#8ed2f0",
+ "roof": "#1d3557",
+ "roof_line": "#3e5f95",
+ "wood": "#b57f45",
+ "wood_dark": "#8c5e2f",
+ "metal": "#8b8f9c",
+ "sign_board": "#22243a",
+ "neon": "#ff5fa2",
+ "neon_glow": "#ffd166",
+ "plug": "#ffd166",
+ "plug_dark": "#e0a800",
+ # one accent per plugin family — the bay stripes
+ "fam_brain": "#9b5de5",
+ "fam_tool": "#2ec4b6",
+ "fam_stt": "#ff6f61",
+ "fam_tts": "#ffb703",
+ "fam_channel": "#06d6a0",
+ "fam_realtime": "#4cc9f0",
+}
+
+FAMILY_BAYS = ["fam_brain", "fam_tool", "fam_stt", "fam_tts", "fam_channel", "fam_realtime"]
+
+
+def srgb_to_linear(c: float) -> float:
+ return c / 12.92 if c <= 0.04045 else ((c + 0.055) / 1.055) ** 2.4
+
+
+def hex_rgba(hex_color: str) -> tuple[float, float, float, float]:
+ h = hex_color.lstrip("#")
+ r, g, b = (int(h[i : i + 2], 16) / 255 for i in (0, 2, 4))
+ return (srgb_to_linear(r), srgb_to_linear(g), srgb_to_linear(b), 1.0)
+
+
+_materials: dict[str, bpy.types.Material] = {}
+
+
+def material(key: str, emissive: float = 0.0) -> bpy.types.Material:
+ """One flat Principled material per palette key (+ optional emission)."""
+ name = f"kit_{key}" + ("_glow" if emissive else "")
+ if name in _materials:
+ return _materials[name]
+ mat = bpy.data.materials.get(name) or bpy.data.materials.new(name)
+ mat.use_nodes = True
+ bsdf = mat.node_tree.nodes.get("Principled BSDF")
+ rgba = hex_rgba(PALETTE[key])
+ bsdf.inputs["Base Color"].default_value = rgba
+ bsdf.inputs["Roughness"].default_value = 0.85
+ if "Specular IOR Level" in bsdf.inputs:
+ bsdf.inputs["Specular IOR Level"].default_value = 0.2
+ if emissive:
+ bsdf.inputs["Emission Color"].default_value = rgba
+ bsdf.inputs["Emission Strength"].default_value = emissive
+ _materials[name] = mat
+ return mat
+
+
+# ---------------------------------------------------------------------------
+# Primitive helpers (all sizes in metres; Blender Z is up, front is −Y)
+# ---------------------------------------------------------------------------
+
+
+def _finish(
+ obj: bpy.types.Object, mat: bpy.types.Material, bevel: float, parent: bpy.types.Object
+) -> bpy.types.Object:
+ obj.data.materials.clear()
+ obj.data.materials.append(mat)
+ if bevel > 0:
+ mod = obj.modifiers.new("Bevel", "BEVEL")
+ mod.width = bevel
+ mod.segments = 2
+ mod.limit_method = "ANGLE"
+ mod.angle_limit = math.radians(40)
+ bpy.context.view_layer.objects.active = obj
+ bpy.ops.object.modifier_apply(modifier=mod.name)
+ obj.parent = parent
+ return obj
+
+
+def box(
+ name: str,
+ size: tuple[float, float, float],
+ at: tuple[float, float, float],
+ mat_key: str,
+ parent: bpy.types.Object,
+ bevel: float = 0.06,
+ emissive: float = 0.0,
+ rot: tuple[float, float, float] = (0, 0, 0),
+) -> bpy.types.Object:
+ """A bevelled box; `at` is its centre."""
+ bpy.ops.mesh.primitive_cube_add(size=1, location=at, rotation=rot)
+ obj = bpy.context.active_object
+ obj.name = name
+ obj.scale = (size[0], size[1], size[2])
+ bpy.ops.object.transform_apply(scale=True)
+ return _finish(obj, material(mat_key, emissive), min(bevel, min(size) * 0.45), parent)
+
+
+def cylinder(
+ name: str,
+ radius: float,
+ depth: float,
+ at: tuple[float, float, float],
+ mat_key: str,
+ parent: bpy.types.Object,
+ verts: int = 16,
+ rot: tuple[float, float, float] = (0, 0, 0),
+ bevel: float = 0.04,
+ emissive: float = 0.0,
+) -> bpy.types.Object:
+ bpy.ops.mesh.primitive_cylinder_add(
+ vertices=verts, radius=radius, depth=depth, location=at, rotation=rot
+ )
+ obj = bpy.context.active_object
+ obj.name = name
+ return _finish(obj, material(mat_key, emissive), bevel, parent)
+
+
+def half_barrel(
+ name: str,
+ radius: float,
+ length: float,
+ at: tuple[float, float, float],
+ mat_key: str,
+ parent: bpy.types.Object,
+) -> bpy.types.Object:
+ """A half cylinder lying along X — the solar barrel roof of the village."""
+ bpy.ops.mesh.primitive_cylinder_add(
+ vertices=24, radius=radius, depth=length, location=at, rotation=(0, math.pi / 2, 0)
+ )
+ obj = bpy.context.active_object
+ obj.name = name
+ # Cut away the lower half with a bisect in edit mode.
+ bpy.ops.object.mode_set(mode="EDIT")
+ bpy.ops.mesh.select_all(action="SELECT")
+ bpy.ops.mesh.bisect(plane_co=at, plane_no=(0, 0, 1), clear_inner=True, use_fill=True)
+ bpy.ops.object.mode_set(mode="OBJECT")
+ return _finish(obj, material(mat_key), 0.05, parent)
+
+
+def text_mesh(
+ name: str,
+ body: str,
+ size: float,
+ extrude: float,
+ at: tuple[float, float, float],
+ mat_key: str,
+ parent: bpy.types.Object,
+ emissive: float = 0.0,
+) -> bpy.types.Object:
+ """Extruded letters standing upright, facing the front (−Y)."""
+ bpy.ops.object.text_add(location=at, rotation=(math.pi / 2, 0, 0))
+ obj = bpy.context.active_object
+ obj.name = name
+ obj.data.body = body
+ obj.data.size = size
+ obj.data.extrude = extrude
+ obj.data.align_x = "CENTER"
+ obj.data.align_y = "CENTER"
+ bpy.ops.object.convert(target="MESH")
+ obj = bpy.context.active_object
+ return _finish(obj, material(mat_key, emissive), 0.0, parent)
+
+
+# ---------------------------------------------------------------------------
+# Buildings
+# ---------------------------------------------------------------------------
+
+
+def new_root(name: str, extras: dict) -> bpy.types.Object:
+ root = bpy.data.objects.new(name, None)
+ root.empty_display_size = 0.5
+ bpy.context.scene.collection.objects.link(root)
+ for k, v in extras.items():
+ root[k] = json.dumps(v) if isinstance(v, (dict, list)) else v
+ return root
+
+
+def build_plugin_docks() -> bpy.types.Object:
+ """The Plugin Store — 'Plugin Docks': a hall with six loading bays, one per
+ plugin family, a giant plug on the roof and a retro neon sign. Footprint
+ 8 × 5 tiles (16 × 10 m); the front with the bays faces −Y (glTF +Z)."""
+ W, D = 16.0, 10.0 # footprint
+ H = 4.6 # hall height
+ root = new_root(
+ "plugin-docks",
+ {
+ "jarvis_building": {
+ "contract": 1,
+ "id": "plugin-docks",
+ "footprint": [8, 5],
+ "forward": "+Z",
+ "door": [0, 5.0],
+ "stand": [0, 7.0],
+ "sign": [0, 9.6, 0],
+ "height_m": 10.8,
+ }
+ },
+ )
+ # Plinth and hall body
+ box("plinth", (W + 0.8, D + 0.8, 0.35), (0, 0, 0.175), "plinth", root, bevel=0.08)
+ box("hall", (W, D, H), (0, 0, 0.35 + H / 2), "wall", root, bevel=0.14)
+ # Shade band along the base of the walls
+ box("base_band", (W + 0.1, D + 0.1, 0.5), (0, 0, 0.6), "wall_shade", root, bevel=0.05)
+ # Roof: flat slab with an overhang, then the solar barrel along X
+ roof_z = 0.35 + H
+ box("roof_slab", (W + 1.0, D + 1.0, 0.4), (0, 0, roof_z + 0.2), "trim", root, bevel=0.1)
+ half_barrel("solar_barrel", D * 0.36, W * 0.62, (-W * 0.12, 0.6, roof_z + 0.4), "roof", root)
+ box(
+ "barrel_ridge",
+ (W * 0.62, 0.35, 0.12),
+ (-W * 0.12, 0.6, roof_z + 0.4 + D * 0.36),
+ "roof_line",
+ root,
+ bevel=0.03,
+ )
+ for i in range(4):
+ box(
+ f"barrel_seam_{i}",
+ (0.12, D * 0.7, 0.14),
+ (-W * 0.12 - W * 0.24 + i * W * 0.16, 0.6, roof_z + 0.4 + D * 0.36 * 0.72),
+ "roof_line",
+ root,
+ bevel=0.02,
+ )
+
+ # The plug on the roof — the plugin symbol everyone knows
+ px, py, pz = W * 0.28, 0.8, roof_z + 0.4
+ cylinder("plug_body", 1.45, 1.9, (px, py, pz + 0.95), "plug", root, verts=24, bevel=0.12)
+ box("plug_cable", (0.5, 0.5, 1.2), (px, py, pz + 0.6 - 0.9), "plug_dark", root, bevel=0.12)
+ for dx in (-0.55, 0.55):
+ box(
+ f"prong_{'l' if dx < 0 else 'r'}",
+ (0.34, 0.34, 2.2),
+ (px + dx, py, pz + 1.9 + 1.0),
+ "metal",
+ root,
+ bevel=0.08,
+ )
+ box("plug_face", (1.9, 1.9, 0.3), (px, py, pz + 1.95), "plug_dark", root, bevel=0.08)
+
+ # Front: six loading bays with roll-up doors, one accent per plugin family
+ bay_w = 2.1
+ gap = (W - 6 * bay_w) / 7
+ y_front = -D / 2
+ for i, fam in enumerate(FAMILY_BAYS):
+ x = -W / 2 + gap + bay_w / 2 + i * (bay_w + gap)
+ box(
+ f"bay_frame_{i}",
+ (bay_w + 0.3, 0.35, 3.1),
+ (x, y_front - 0.1, 0.35 + 1.55),
+ "trim",
+ root,
+ bevel=0.05,
+ )
+ box(
+ f"bay_door_{i}",
+ (bay_w, 0.18, 2.6),
+ (x, y_front - 0.2, 0.35 + 1.3),
+ "wall_shade",
+ root,
+ bevel=0.03,
+ )
+ # roll-up slats
+ for s in range(5):
+ box(
+ f"bay_slat_{i}_{s}",
+ (bay_w - 0.2, 0.06, 0.08),
+ (x, y_front - 0.31, 0.35 + 0.5 + s * 0.5),
+ "trim",
+ root,
+ bevel=0.0,
+ )
+ # family stripe over the door
+ box(
+ f"bay_stripe_{i}",
+ (bay_w + 0.3, 0.22, 0.55),
+ (x, y_front - 0.22, 0.35 + 3.1 + 0.95),
+ fam,
+ root,
+ bevel=0.04,
+ emissive=0.6,
+ )
+ # a small lamp above each bay
+ box(
+ f"bay_lamp_{i}",
+ (0.5, 0.35, 0.2),
+ (x, y_front - 0.45, 0.35 + 4.55),
+ "neon_glow",
+ root,
+ bevel=0.03,
+ emissive=2.0,
+ )
+
+ # Retro striped awning over the bays
+ for i in range(12):
+ x = -W / 2 + 0.2 + i * (W - 0.4) / 12 + (W - 0.4) / 24
+ key = "neon" if i % 2 == 0 else "wall"
+ box(
+ f"awning_{i}",
+ ((W - 0.4) / 12, 1.6, 0.12),
+ (x, y_front - 0.9, 0.35 + 3.35),
+ key,
+ root,
+ bevel=0.02,
+ rot=(math.radians(-18), 0, 0),
+ )
+
+ # The sign: a dark board on the roof edge with glowing letters
+ box(
+ "sign_board",
+ (W * 0.66, 0.5, 2.2),
+ (-W * 0.08, y_front + 0.6, roof_z + 1.55),
+ "sign_board",
+ root,
+ bevel=0.1,
+ )
+ box(
+ "sign_rim",
+ (W * 0.66 + 0.3, 0.3, 2.5),
+ (-W * 0.08, y_front + 0.75, roof_z + 1.55),
+ "neon",
+ root,
+ bevel=0.08,
+ emissive=0.8,
+ )
+ text_mesh(
+ "sign_text",
+ "PLUGINS",
+ 1.45,
+ 0.18,
+ (-W * 0.08, y_front + 0.3, roof_z + 1.5),
+ "neon_glow",
+ root,
+ emissive=3.0,
+ )
+
+ # Side windows: a glass band on both ends
+ for sx in (-1, 1):
+ box(
+ f"glass_band_{'l' if sx < 0 else 'r'}",
+ (0.15, D * 0.7, 1.1),
+ (sx * (W / 2 + 0.02), 0.4, 0.35 + 2.9),
+ "glass",
+ root,
+ bevel=0.02,
+ emissive=0.35,
+ )
+ # Back: two vents and a service door
+ for i, x in enumerate((-3.5, 3.5)):
+ cylinder(
+ f"vent_{i}", 0.45, 1.6, (x, D / 2 - 1.2, roof_z + 0.4 + 0.8), "metal", root, verts=12
+ )
+ box(
+ "back_door", (1.6, 0.16, 2.4), (W * 0.3, D / 2 + 0.05, 0.35 + 1.2), "wood", root, bevel=0.03
+ )
+
+ # Forecourt furniture: two planters and a crate stack
+ for x in (-W / 2 + 1.2, W / 2 - 1.2):
+ box(
+ f"planter_{int(x)}",
+ (1.4, 1.0, 0.7),
+ (x, y_front - 2.2, 0.35),
+ "wood_dark",
+ root,
+ bevel=0.05,
+ )
+ cylinder(
+ f"bush_{int(x)}",
+ 0.6,
+ 0.9,
+ (x, y_front - 2.2, 1.05),
+ "fam_channel",
+ root,
+ verts=10,
+ bevel=0.2,
+ )
+ box("crate_a", (1.0, 1.0, 1.0), (W / 2 - 3.2, y_front - 2.4, 0.85), "wood", root, bevel=0.05)
+ box(
+ "crate_b",
+ (0.8, 0.8, 0.8),
+ (W / 2 - 3.2, y_front - 2.4, 1.75),
+ "wood_dark",
+ root,
+ bevel=0.05,
+ )
+ return root
+
+
+BUILDERS = {"plugin-docks": build_plugin_docks}
+
+
+# ---------------------------------------------------------------------------
+# Export and preview
+# ---------------------------------------------------------------------------
+
+
+def clear_scene() -> None:
+ bpy.ops.object.select_all(action="SELECT")
+ bpy.ops.object.delete(use_global=False)
+ for block in (bpy.data.meshes, bpy.data.materials, bpy.data.curves):
+ for item in list(block):
+ if item.users == 0:
+ block.remove(item)
+ _materials.clear()
+
+
+def select_tree(root: bpy.types.Object) -> None:
+ bpy.ops.object.select_all(action="DESELECT")
+ root.select_set(True)
+ for child in root.children_recursive:
+ child.select_set(True)
+ bpy.context.view_layer.objects.active = root
+
+
+def export_glb(root: bpy.types.Object, out_dir: Path) -> Path:
+ out_dir.mkdir(parents=True, exist_ok=True)
+ path = out_dir / f"{root.name}.glb"
+ select_tree(root)
+ bpy.ops.export_scene.gltf(
+ filepath=str(path),
+ export_format="GLB",
+ use_selection=True,
+ export_apply=True,
+ export_yup=True,
+ export_animations=False,
+ export_extras=True,
+ export_texcoords=False,
+ export_normals=True,
+ export_materials="EXPORT",
+ )
+ return path
+
+
+def render_preview(root: bpy.types.Object, path: Path) -> None:
+ """A dimetric preview from the island's camera angle (50° pitch, 45° yaw)."""
+ scene = bpy.context.scene
+ cam_data = bpy.data.cameras.new("kit_preview_cam")
+ cam_data.type = "ORTHO"
+ cam_data.ortho_scale = 30
+ cam = bpy.data.objects.new("kit_preview_cam", cam_data)
+ scene.collection.objects.link(cam)
+ dist = 60
+ pitch, yaw = math.radians(50), math.radians(45)
+ cam.location = (
+ dist * math.cos(pitch) * math.sin(yaw),
+ -dist * math.cos(pitch) * math.cos(yaw),
+ dist * math.sin(pitch) + 3,
+ )
+ cam.rotation_euler = (math.pi / 2 - pitch, 0, yaw)
+ scene.camera = cam
+ sun_data = bpy.data.lights.new("kit_sun", "SUN")
+ sun_data.energy = 3.5
+ sun_data.angle = math.radians(6)
+ sun = bpy.data.objects.new("kit_sun", sun_data)
+ scene.collection.objects.link(sun)
+ sun.rotation_euler = (math.radians(45), math.radians(-25), math.radians(20))
+ world = scene.world or bpy.data.worlds.new("kit_world")
+ scene.world = world
+ world.use_nodes = True
+ bg = world.node_tree.nodes.get("Background")
+ if bg:
+ bg.inputs[0].default_value = hex_rgba("#a5dbff")
+ bg.inputs[1].default_value = 1.0
+ scene.render.engine = (
+ "BLENDER_EEVEE"
+ if "BLENDER_EEVEE"
+ in {e.identifier for e in bpy.types.RenderSettings.bl_rna.properties["engine"].enum_items}
+ else "BLENDER_EEVEE_NEXT"
+ )
+ scene.render.resolution_x = 1400
+ scene.render.resolution_y = 900
+ scene.render.film_transparent = False
+ scene.render.filepath = str(path)
+ scene.render.image_settings.file_format = "PNG"
+ bpy.ops.render.render(write_still=True)
+
+
+def main(argv: list[str]) -> None:
+ import argparse
+
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("--target", default="plugin-docks", choices=sorted(BUILDERS))
+ parser.add_argument("--out", required=True)
+ parser.add_argument("--preview", default=None)
+ parser.add_argument(
+ "--keep-scene", action="store_true", help="do not clear the scene first (MCP inner loop)"
+ )
+ args = parser.parse_args(argv)
+ if not args.keep_scene:
+ clear_scene()
+ root = BUILDERS[args.target]()
+ path = export_glb(root, Path(args.out))
+ print(f"exported {path} ({path.stat().st_size} bytes)")
+ if args.preview:
+ render_preview(root, Path(args.preview))
+ print(f"preview {args.preview}")
+
+
+if __name__ == "__main__":
+ # `blender -b --python this.py -- <args>`: everything after `--` is ours.
+ own = sys.argv[sys.argv.index("--") + 1 :] if "--" in sys.argv else []
+ main(own)
+elif "KIT_ARGS" in globals():
+ main(globals()["KIT_ARGS"]) # the MCP inner loop: exec() with KIT_ARGS set