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 Agent Foundry - new agents walk out of it

rubenluetke10-beep6f461a068dba
diff --git a/jarvis/ui/web/frontend/src/assets/society/world/kit/agent-foundry.glb b/jarvis/ui/web/frontend/src/assets/society/world/kit/agent-foundry.glb
new file mode 100644
index 0000000000..e932dadea2
Binary files /dev/null and b/jarvis/ui/web/frontend/src/assets/society/world/kit/agent-foundry.glb differ
diff --git a/jarvis/ui/web/frontend/src/components/society/data.ts b/jarvis/ui/web/frontend/src/components/society/data.ts
index 359b538359..92f2dcda03 100644
--- a/jarvis/ui/web/frontend/src/components/society/data.ts
+++ b/jarvis/ui/web/frontend/src/components/society/data.ts
@@ -19,6 +19,7 @@ import type { SocietyAgentRow } from "@/lib/societyApi";
import { PALETTE_PRESETS, resolvePalette, type FigureRecipe } from "./figures/figureRecipe";
import { SAMPLE_ROSTER } from "./mockRoster";
+import { announceSpawn } from "./world/spawnStore";
/** MASTERPLAN §2.5 — exactly one lead (Jarvis), orchestrators may ASSIGN. */
export type AgentTier = "lead" | "orchestrator" | "specialist";
@@ -332,6 +333,8 @@ export function useCreateAgent() {
});
if (res.ok) {
const created = (await res.json()) as { agent: SocietyAgentRow };
+ // The island owes this row an entrance: it walks out of the foundry.
+ announceSpawn(created.agent.agent_id);
await client.invalidateQueries({ queryKey: ROSTER_QUERY_KEY });
return rowToAgent(created.agent);
}
@@ -372,6 +375,7 @@ export function useCreateAgent() {
stats: { runs: 0, totalCostUsd: 0, lastActiveMs: null },
};
LOCAL_ROSTER.push(agent);
+ announceSpawn(agent.agentId);
await client.invalidateQueries({ queryKey: ROSTER_QUERY_KEY });
return agent;
},
diff --git a/jarvis/ui/web/frontend/src/components/society/world/AgentFoundry.tsx b/jarvis/ui/web/frontend/src/components/society/world/AgentFoundry.tsx
new file mode 100644
index 0000000000..3c8997f4c1
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/world/AgentFoundry.tsx
@@ -0,0 +1,237 @@
+/**
+ * The Agent Foundry on its plot — the World Kit hall plus the life the GLB
+ * cannot carry: the assembly core spinning in its crown, the portal breathing,
+ * and the flare that plays when a new agent walks out of it
+ * (world-masterplan-v2.md §5, world-behaviour-manual.md §2 `foundry`).
+ *
+ * Everything here is cosmetic and client-side. The building never decides that
+ * an agent was born; it reacts to `spawnStore.portalOpenedMs`, which the
+ * walker sets as it claims its entrance. Reduced motion freezes the lot: the
+ * core stops, the portal sits at its resting glow, no flare.
+ *
+ * All effect meshes are driven inside `useFrame` by writing to materials and
+ * transforms directly — never through React state, which would re-render the
+ * whole island sixty times a second.
+ */
+import { useCallback, useMemo, useRef } from "react";
+import { useFrame } from "@react-three/fiber";
+import {
+ AdditiveBlending,
+ Color,
+ DoubleSide,
+ InstancedMesh,
+ Mesh,
+ MeshBasicMaterial,
+ Object3D,
+} from "three";
+
+import { buildIsland, groundY, type KitPlace } from "./islandLayout";
+import { KitBuilding } from "./KitBuilding";
+import { PORTAL_FLARE_MS, useSpawnStore } from "./spawnStore";
+
+/** The foundry's own accents, matching the GLB palette in build_world_kit.py. */
+const CORE = "#4cc9f0";
+const CORE_BRIGHT = "#b8f2ff";
+/** The roof beacon blinks between its hazard amber and the core's cyan. */
+const BEACON_COLD = new Color("#ffb703");
+const BEACON_HOT = new Color(CORE_BRIGHT);
+
+/** Nodes of the GLB the core animation drives, with their turn rate (rad/s). */
+const SPINNERS: ReadonlyArray<{ node: string; rate: number }> = [
+ { node: "core_ring_a", rate: 0.28 },
+ { node: "core_ring_b", rate: -0.44 },
+ { node: "core_ring_c", rate: 0.62 },
+];
+
+const SPARK_COUNT = 22;
+/** Local z of the portal mouth and of the ramp's foot (the kit's own anchors). */
+const PORTAL_Z = 6.4;
+const RAMP_END_Z = 13.4;
+/** Height of the conveyor deck above the plot, in metres. */
+const BELT_Y = 0.55;
+
+interface Spark {
+ /** Sideways drift, metres per unit of flare. */
+ dx: number;
+ /** Forward drift. */
+ dz: number;
+ /** How high it climbs. */
+ up: number;
+ /** Fraction of the flare it waits before appearing. */
+ delay: number;
+ spin: number;
+}
+
+/** Deterministic spark field — no RNG, so both windows show the same burst. */
+function makeSparks(): Spark[] {
+ return Array.from({ length: SPARK_COUNT }, (_, i) => {
+ const a = (i / SPARK_COUNT) * Math.PI * 2;
+ const r = 0.5 + ((i * 37) % 13) / 13;
+ return {
+ dx: Math.sin(a) * r * 2.6,
+ dz: 0.4 + ((i * 53) % 11) / 11 * 3.4,
+ up: 1.4 + ((i * 29) % 17) / 17 * 3.2,
+ delay: ((i * 43) % 19) / 19 * 0.3,
+ spin: ((i * 17) % 7) - 3,
+ };
+ });
+}
+
+function PortalEffects({ paused }: { paused: boolean }) {
+ const glow = useRef<Mesh>(null);
+ const pool = useRef<Mesh>(null);
+ const wave = useRef<Mesh>(null);
+ const sparks = useRef<InstancedMesh>(null);
+ const dummy = useMemo(() => new Object3D(), []);
+ const field = useMemo(makeSparks, []);
+
+ useFrame(({ clock }) => {
+ const opened = useSpawnStore.getState().portalOpenedMs;
+ const elapsed = opened === 0 ? Infinity : Date.now() - opened;
+ // 1 the instant a figure comes through, easing to 0 over the flare.
+ const flare = paused || !Number.isFinite(elapsed) ? 0 : Math.max(0, 1 - elapsed / PORTAL_FLARE_MS);
+ const eased = flare * flare;
+ const breathe = paused ? 0 : Math.sin(clock.getElapsedTime() * 1.6) * 0.06;
+
+ const glowMat = glow.current?.material as MeshBasicMaterial | undefined;
+ if (glowMat) glowMat.opacity = 0.34 + breathe + eased * 0.55;
+
+ const poolMat = pool.current?.material as MeshBasicMaterial | undefined;
+ if (pool.current && poolMat) {
+ pool.current.visible = eased > 0.01;
+ poolMat.opacity = eased * 0.5;
+ }
+
+ const waveMat = wave.current?.material as MeshBasicMaterial | undefined;
+ if (wave.current && waveMat) {
+ const travel = 1 - flare; // rides out along the belt as the flare fades
+ wave.current.visible = flare > 0.02;
+ wave.current.position.z = PORTAL_Z + travel * (RAMP_END_Z - PORTAL_Z + 1.5);
+ wave.current.scale.setScalar(0.7 + travel * 0.9);
+ waveMat.opacity = flare * 0.75;
+ }
+
+ if (sparks.current) {
+ sparks.current.visible = flare > 0.02;
+ if (sparks.current.visible) {
+ const t = 1 - flare;
+ field.forEach((s, i) => {
+ const life = Math.max(0, Math.min(1, (t - s.delay) / (1 - s.delay)));
+ const scale = life === 0 ? 0 : (1 - life) * 0.34;
+ dummy.position.set(
+ s.dx * life,
+ BELT_Y + 0.9 + s.up * life - life * life * 1.8,
+ PORTAL_Z + s.dz * life,
+ );
+ dummy.rotation.set(life * s.spin, life * s.spin * 0.6, 0);
+ dummy.scale.setScalar(scale);
+ dummy.updateMatrix();
+ sparks.current?.setMatrixAt(i, dummy.matrix);
+ });
+ sparks.current.instanceMatrix.needsUpdate = true;
+ }
+ }
+ });
+
+ return (
+ <group>
+ {/* the containment field in the portal mouth */}
+ <mesh ref={glow} position={[0, 3.0, PORTAL_Z + 0.12]}>
+ <planeGeometry args={[6.0, 4.9]} />
+ <meshBasicMaterial color={CORE_BRIGHT} transparent opacity={0.34} depthWrite={false} side={DoubleSide} />
+ </mesh>
+ {/* light spilling onto the conveyor deck */}
+ <mesh ref={pool} position={[0, BELT_Y + 0.06, PORTAL_Z + 2.6]} rotation={[-Math.PI / 2, 0, 0]} visible={false}>
+ <planeGeometry args={[6.6, 7.4]} />
+ <meshBasicMaterial
+ color={CORE}
+ transparent
+ opacity={0}
+ depthWrite={false}
+ blending={AdditiveBlending}
+ />
+ </mesh>
+ {/* the pulse that rides out along the belt with the new figure */}
+ <mesh ref={wave} position={[0, BELT_Y + 0.1, PORTAL_Z]} rotation={[-Math.PI / 2, 0, 0]} visible={false}>
+ <ringGeometry args={[2.1, 2.9, 32]} />
+ <meshBasicMaterial
+ color={CORE_BRIGHT}
+ transparent
+ opacity={0}
+ depthWrite={false}
+ blending={AdditiveBlending}
+ />
+ </mesh>
+ <instancedMesh ref={sparks} args={[undefined, undefined, SPARK_COUNT]} visible={false} frustumCulled={false}>
+ <boxGeometry args={[1, 1, 1]} />
+ <meshBasicMaterial color={CORE_BRIGHT} transparent opacity={0.9} depthWrite={false} blending={AdditiveBlending} />
+ </instancedMesh>
+ </group>
+ );
+}
+
+export function AgentFoundry({
+ paused,
+ onClick,
+ selected,
+}: {
+ paused: boolean;
+ onClick?: (place: KitPlace) => void;
+ selected?: boolean;
+}) {
+ const { map, content } = buildIsland();
+ const { x, z, rotation } = content.kitPoses.foundry;
+ const y = groundY(map, x, z);
+ const spinners = useRef<Array<{ obj: Object3D; rate: number }>>([]);
+ const orb = useRef<Object3D | null>(null);
+ const beaconMat = useRef<MeshBasicMaterial | null>(null);
+
+ // The GLB's named nodes are the animation rig; a renamed node simply means
+ // that part stays still, never an error.
+ const bind = useCallback((root: Object3D) => {
+ spinners.current = SPINNERS.flatMap(({ node, rate }) => {
+ const obj = root.getObjectByName(node);
+ return obj ? [{ obj, rate }] : [];
+ });
+ orb.current = root.getObjectByName("core_orb") ?? null;
+ const beacon = root.getObjectByName("core_beacon");
+ const mat = beacon instanceof Mesh ? beacon.material : null;
+ beaconMat.current = mat instanceof MeshBasicMaterial ? mat : null;
+ }, []);
+
+ useFrame(({ clock }, dt) => {
+ if (paused) return;
+ const opened = useSpawnStore.getState().portalOpenedMs;
+ const elapsed = opened === 0 ? Infinity : Date.now() - opened;
+ const flare = Number.isFinite(elapsed) ? Math.max(0, 1 - elapsed / PORTAL_FLARE_MS) : 0;
+ // The core runs faster while the foundry is delivering.
+ const boost = 1 + flare * 3.5;
+ const step = Math.min(dt, 0.1);
+ for (const s of spinners.current) s.obj.rotation.z += s.rate * boost * step;
+ if (orb.current) {
+ const pulse = 1 + Math.sin(clock.getElapsedTime() * 2.2) * 0.03 + flare * 0.12;
+ orb.current.scale.set(pulse, pulse, pulse);
+ }
+ if (beaconMat.current) {
+ // The roof beacon blinks like a real plant's; it flashes on a delivery.
+ const blink = 0.55 + Math.sin(clock.getElapsedTime() * 3.4) * 0.45;
+ beaconMat.current.color.copy(BEACON_COLD).lerp(BEACON_HOT, Math.min(1, blink * 0.6 + flare));
+ }
+ });
+
+ return (
+ <>
+ <KitBuilding
+ kit="agent-foundry"
+ place="foundry"
+ onClick={onClick}
+ selected={selected}
+ onInstance={bind}
+ />
+ <group position={[x, y, z]} rotation={[0, rotation, 0]}>
+ <PortalEffects paused={paused} />
+ </group>
+ </>
+ );
+}
+
diff --git a/jarvis/ui/web/frontend/src/components/society/world/FoundryDrawer.tsx b/jarvis/ui/web/frontend/src/components/society/world/FoundryDrawer.tsx
new file mode 100644
index 0000000000..5ad8ee5da8
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/world/FoundryDrawer.tsx
@@ -0,0 +1,168 @@
+/**
+ * What a click on the Agent Foundry opens: the island's own front door to
+ * agent creation. The building is where new agents come from, so its drawer
+ * is where you make one — the creator opens straight from here, and closing
+ * it puts you back on the island in time to watch the figure walk out.
+ *
+ * A drawer over the world, never a page navigation (one-viewer doctrine): the
+ * island keeps living behind it. App chrome, so it wears the theme tokens;
+ * only the portal swatch echoes the building's cyan.
+ */
+import { Suspense, lazy, useCallback, useEffect, useMemo, useState } from "react";
+import { Factory, Plus, X } from "lucide-react";
+
+import { fill, useT, useUiLanguage } from "@/i18n";
+import { AgentSwatch } from "../AgentSwatch";
+import { useSocietyRoster, type SocietyAgent } from "../data";
+
+const CreateAgentDialog = lazy(() =>
+ import("../create/CreateAgentDialog").then((m) => ({ default: m.CreateAgentDialog })),
+);
+
+/** How many of the newest agents the drawer lists. */
+const RECENT_LIMIT = 6;
+
+function useRelativeTime(): (ms: number) => string {
+ const language = useUiLanguage();
+ const rtf = useMemo(() => new Intl.RelativeTimeFormat(language, { numeric: "auto" }), [language]);
+ return useCallback(
+ (ms: number) => {
+ const seconds = Math.round((ms - Date.now()) / 1000);
+ const abs = Math.abs(seconds);
+ if (abs < 60) return rtf.format(Math.round(seconds), "second");
+ if (abs < 3600) return rtf.format(Math.round(seconds / 60), "minute");
+ if (abs < 86_400) return rtf.format(Math.round(seconds / 3600), "hour");
+ return rtf.format(Math.round(seconds / 86_400), "day");
+ },
+ [rtf],
+ );
+}
+
+export function FoundryDrawer({
+ onClose,
+ onSelectAgent,
+}: {
+ onClose: () => void;
+ /** Opens an agent's model card, the same as clicking its figure. */
+ onSelectAgent?: (agentId: string) => void;
+}) {
+ const t = useT();
+ const roster = useSocietyRoster();
+ const relative = useRelativeTime();
+ const [creating, setCreating] = useState(false);
+
+ useEffect(() => {
+ const onKey = (e: KeyboardEvent) => {
+ // Escape closes the creator first, then the drawer.
+ if (e.key === "Escape" && !creating) onClose();
+ };
+ window.addEventListener("keydown", onKey);
+ return () => window.removeEventListener("keydown", onKey);
+ }, [onClose, creating]);
+
+ const agents: SocietyAgent[] = useMemo(() => roster.data?.agents ?? [], [roster.data]);
+ const recent = useMemo(
+ () => [...agents].sort((a, b) => b.createdMs - a.createdMs).slice(0, RECENT_LIMIT),
+ [agents],
+ );
+
+ const created = useCallback(
+ (agentId: string) => {
+ setCreating(false);
+ // Get out of the way — the new figure is walking out of the portal now.
+ onClose();
+ onSelectAgent?.(agentId);
+ },
+ [onClose, onSelectAgent],
+ );
+
+ 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_foundry_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="flex items-center gap-2 font-display text-base font-semibold tracking-tight">
+ <span
+ className="inline-block h-2.5 w-2.5 rounded-sm"
+ style={{ background: "#4cc9f0" }}
+ aria-hidden
+ />
+ {t("society.world.drawer_foundry_title")}
+ </h2>
+ <p className="mt-0.5 text-xs text-muted-foreground">
+ {t("society.world.drawer_foundry_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">
+ <button
+ type="button"
+ onClick={() => setCreating(true)}
+ className="flex w-full items-center justify-center gap-2 rounded-md bg-primary px-3 py-2 text-sm font-medium text-primary-foreground hover:opacity-90"
+ >
+ <Plus size={15} />
+ {t("society.world.foundry_create")}
+ </button>
+ <p className="mt-2 flex items-center gap-1.5 text-xs text-muted-foreground">
+ <Factory size={13} aria-hidden />
+ {fill(t("society.world.foundry_population"), { count: agents.length })}
+ </p>
+
+ <h3 className="mb-1.5 mt-4 text-xs font-medium uppercase tracking-wide text-muted-foreground">
+ {t("society.world.foundry_recent")}
+ </h3>
+ {roster.isLoading && (
+ <p className="text-sm text-muted-foreground">{t("society.world.drawer_loading")}</p>
+ )}
+ {!roster.isLoading && recent.length === 0 && (
+ <p className="text-sm text-muted-foreground">{t("society.world.foundry_none")}</p>
+ )}
+ <ul className="flex flex-col gap-1">
+ {recent.map((a) => (
+ <li key={a.agentId}>
+ <button
+ type="button"
+ onClick={() => onSelectAgent?.(a.agentId)}
+ className="flex w-full items-center gap-2.5 rounded-md px-2 py-1.5 text-left hover:bg-muted"
+ >
+ <AgentSwatch agent={a} size={28} />
+ <span className="min-w-0 flex-1">
+ <span className="block truncate text-sm font-medium">{a.name}</span>
+ <span className="block truncate text-xs text-muted-foreground">
+ {a.title || a.providerLabel}
+ </span>
+ </span>
+ <span className="shrink-0 text-xs tabular-nums text-muted-foreground">
+ {relative(a.createdMs)}
+ </span>
+ </button>
+ </li>
+ ))}
+ </ul>
+ </div>
+
+ <footer className="border-t border-border px-4 py-3">
+ <p className="text-xs text-muted-foreground">{t("society.world.foundry_walkout")}</p>
+ </footer>
+ </aside>
+ {creating && (
+ <Suspense fallback={null}>
+ <CreateAgentDialog open onClose={() => setCreating(false)} onCreated={created} />
+ </Suspense>
+ )}
+ </>
+ );
+}
diff --git a/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx b/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
index b6238c1613..a1d4746215 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/KitBuilding.tsx
@@ -13,6 +13,7 @@ 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 agentFoundryUrl from "@/assets/society/world/kit/agent-foundry.glb";
import pluginDocksUrl from "@/assets/society/world/kit/plugin-docks.glb";
import relayTowerUrl from "@/assets/society/world/kit/relay-tower.glb";
import skillForgeUrl from "@/assets/society/world/kit/skill-forge.glb";
@@ -27,25 +28,28 @@ export const KIT_URLS = {
"skill-forge": skillForgeUrl,
"relay-tower": relayTowerUrl,
"terminal-cantina": terminalCantinaUrl,
+ "agent-foundry": agentFoundryUrl,
} as const;
export type KitId = keyof typeof KIT_URLS;
-/** Which kit file stands at which kit place; the pose comes from the island layout. */
-export const KIT_PLACEMENTS: ReadonlyArray<{ kit: KitId; place: KitPlace }> = [
- { kit: "plugin-docks", place: "plugins" },
- { kit: "skill-forge", place: "skills" },
- { kit: "relay-tower", place: "mcp" },
- { kit: "terminal-cantina", place: "cli" },
-];
-
/** Radius of the hover/selection ring drawn under each kit, in metres. */
const KIT_RING_R: Record<KitId, number> = {
"plugin-docks": 9.9,
+ "agent-foundry": 13.6,
"skill-forge": 8.6,
"relay-tower": 6.4,
"terminal-cantina": 8.8,
};
+/** Which kit file stands at which kit place; the pose comes from the island layout. */
+export const KIT_PLACEMENTS: ReadonlyArray<{ kit: KitId; place: KitPlace }> = [
+ { kit: "plugin-docks", place: "plugins" },
+ { kit: "agent-foundry", place: "foundry" },
+ { kit: "skill-forge", place: "skills" },
+ { kit: "relay-tower", place: "mcp" },
+ { kit: "terminal-cantina", place: "cli" },
+];
+
/** Emission above this strength renders unlit (a lamp, a neon tube), below it stays a lit toon. */
const GLOW_STRENGTH = 1.5;
@@ -75,11 +79,14 @@ export function KitBuilding({
place,
onClick,
selected,
+ onInstance,
}: {
kit: KitId;
place: KitPlace;
onClick?: (place: KitPlace) => void;
selected?: boolean;
+ /** The restyled clone, once per load — a building animates its own nodes. */
+ onInstance?: (root: Object3D) => void;
}) {
const { scene } = useGLTF(KIT_URLS[kit]);
const gl = useThree((s) => s.gl);
@@ -91,6 +98,10 @@ export function KitBuilding({
return clone;
}, [scene, ramp]);
+ useEffect(() => {
+ onInstance?.(instance);
+ }, [instance, onInstance]);
+
useEffect(
() => () => {
instance.traverse((o) => {
@@ -142,4 +153,5 @@ export function KitBuilding({
);
}
-for (const url of Object.values(KIT_URLS)) useGLTF.preload(url);
+useGLTF.preload(pluginDocksUrl);
+useGLTF.preload(agentFoundryUrl);
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 7e31f09f2a..4403497a9b 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/Landmarks.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/Landmarks.tsx
@@ -1,6 +1,6 @@
/**
* The four quarters' landmarks — the places MASTERPLAN §4.1 names, in the
- * solarpunk language: the workshop hall (west), the archive tower (north), the
+ * solarpunk language: the workshop hall (west), the Memory House (north), the
* harbor gate with its dock and boat (south), the lighthouse on the eastern
* cape, plus the greenhouses and the solar field that fill the corners.
*/
@@ -8,8 +8,10 @@ import { useMemo, useRef } from "react";
import { useFrame } from "@react-three/fiber";
import { Group, InstancedMesh, Mesh, Object3D } from "three";
+import { AgentFoundry } from "./AgentFoundry";
import { buildIsland, groundY, tileToWorld, type PlaceId, type Post } from "./islandLayout";
import { KIT_PLACEMENTS, KitBuilding } from "./KitBuilding";
+import { MemoryHouse } from "./MemoryHouse";
import { Block, useKit, type Kit } from "./WorldKit";
import { PAL } from "./worldMaterials";
@@ -45,25 +47,6 @@ function Workshop({ kit }: { kit: Kit }) {
);
}
-function Archive({ kit }: { kit: Kit }) {
- const [x, y, z] = placeWorld("archive");
- return (
- <group position={[x, y, z]}>
- <mesh geometry={kit.g.cylinder} material={kit.m.lit(PAL.trim)} position={[0, 0.2, 0]} scale={[13, 0.4, 13]} />
- <mesh geometry={kit.g.cylinder} material={kit.m.lit(PAL.wall)} position={[0, 4.5, 0]} scale={[11, 9, 11]} />
- {/* two glass bands */}
- <mesh geometry={kit.g.cylinder} material={kit.m.glow(PAL.glass)} position={[0, 3.2, 0]} scale={[11.1, 0.9, 11.1]} />
- <mesh geometry={kit.g.cylinder} material={kit.m.glow(PAL.glass)} position={[0, 6.6, 0]} scale={[11.1, 0.9, 11.1]} />
- <mesh geometry={kit.g.cylinder} material={kit.m.lit(PAL.hubAccent)} position={[0, 9.1, 0]} scale={[11.6, 0.3, 11.6]} />
- <mesh geometry={kit.g.dome} material={kit.m.lit(PAL.archiveDome)} position={[0, 9.2, 0]} scale={[11, 6, 11]} />
- <mesh geometry={kit.g.cone} material={kit.m.lit(PAL.metal)} position={[0, 12.9, 0]} scale={[0.6, 1.6, 0.6]} />
- {/* entrance arch facing the village (south, +z) */}
- <Block kit={kit} at={[0, 1.7, 5.6]} size={[3.6, 3.4, 0.6]} color={PAL.wood} />
- <Block kit={kit} at={[0, 1.4, 5.95]} size={[2.2, 2.8, 0.2]} color={PAL.door} />
- </group>
- );
-}
-
function Harbor({ kit, paused }: { kit: Kit; paused: boolean }) {
const [x, y, z] = placeWorld("harbor");
const boat = useRef<Mesh>(null);
@@ -197,21 +180,35 @@ export function Landmarks({
paused,
onHubClick,
openHub,
+ memoryOpen,
+ atMemory,
}: {
paused: boolean;
/** A kit building was clicked — the stage opens that hub's drawer. */
onHubClick?: (place: PlaceId) => void;
openHub?: PlaceId | null;
+ /** The Memory House's drawer is open (it is not a ring hub, so it has its own flag). */
+ memoryOpen?: boolean;
+ /** Agents whose checkpoint is `archive` right now — the house lights up for them. */
+ atMemory?: number;
}) {
const kit = useKit();
const { content } = buildIsland();
return (
<group>
- {KIT_PLACEMENTS.map((k) => (
- <KitBuilding key={k.kit} kit={k.kit} place={k.place} onClick={onHubClick} selected={openHub === k.place} />
+ {/* The foundry has its own component: it animates its core and portal. */}
+ {KIT_PLACEMENTS.filter((k) => k.place !== "foundry").map((k) => (
+ <KitBuilding
+ key={k.kit}
+ kit={k.kit}
+ place={k.place}
+ onClick={onHubClick}
+ selected={openHub === k.place}
+ />
))}
+ <AgentFoundry paused={paused} onClick={onHubClick} selected={openHub === "foundry"} />
<Workshop kit={kit} />
- <Archive kit={kit} />
+ <MemoryHouse paused={paused} busy={atMemory ?? 0} onClick={onHubClick} selected={memoryOpen} />
<Harbor kit={kit} paused={paused} />
<Lighthouse kit={kit} paused={paused} />
<Greenhouses kit={kit} posts={content.greenhouses} />
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 921faf01b0..cbfa13bbdf 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/PlaceLabels.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/PlaceLabels.tsx
@@ -13,12 +13,13 @@ const LABEL_Y: Record<PlaceId, number> = {
market: 12.5,
hub: 26,
workshop: 9,
- archive: 15,
+ archive: 19,
harbor: 8,
lighthouse: 20,
gardens: 6,
solar: 5,
plugins: 13,
+ foundry: 18,
skills: 9,
mcp: 12,
cli: 7,
diff --git a/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsx b/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsx
index bc5ae8d5f0..5a92739588 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/Walkers.tsx
@@ -15,8 +15,10 @@ import type { Group } from "three";
import type { AgentCheckpoint, AgentRunState, SocietyAgent } from "../data";
import { useCameraStore } from "./cameraStore";
import {
+ FOUNDRY_BELT_LIFT_M,
buildIsland,
findPath,
+ foundryWalkOut,
groundY,
randomPlazaTile,
smoothPath,
@@ -35,6 +37,7 @@ import {
turnToward,
} from "./walkerKinematics";
import { WORLD_HERO_SCALE, WalkerFigure, type WalkerAnim, type WalkerMode } from "./WalkerFigure";
+import { claimEntrance } from "./spawnStore";
import { clearWalkerPin, setWalkerPin } from "./walkerRegistry";
import { mulberry32, nextBeat, seedFromString } from "./wander";
@@ -59,6 +62,12 @@ interface Sim {
speed: number;
purpose: PlaceId | null;
atPurpose: boolean;
+ /** True while the figure is still riding the foundry's conveyor out of the
+ * portal: it follows a fixed two-point path instead of an A* route, because
+ * its first metres run over the building's own blocked footprint. */
+ exiting: boolean;
+ /** Height above the ground the belt still carries it, in metres. */
+ lift: number;
rng: () => number;
}
@@ -103,23 +112,48 @@ function Walker({
const { map, content } = buildIsland();
const rng = mulberry32(seedFromString(agent.agentId) ^ Date.now());
const purpose = CHECKPOINT_PLACE[agent.checkpoint];
- const startTile = purpose ? content.places[purpose].standTile : randomPlazaTile(map, rng);
- const [x, z] = tileToWorld(startTile[0], startTile[1]);
- const facing = purpose ? content.places[purpose].facing : rng() * Math.PI * 2;
- sim.current = {
- x: x + offset,
- z,
- y: groundY(map, x, z),
- heading: facing,
- mode: stateMode(agent.state, purpose !== null),
- timer: 1 + rng() * 3,
- waypoints: [],
- index: 0,
- speed: WANDER_SPEED_MPS,
- purpose,
- atPurpose: purpose !== null,
- rng,
- };
+ // A row that was just created walks out of the Agent Foundry; every other
+ // figure is simply standing where the backend says it is.
+ const born = claimEntrance(agent.agentId, agent.createdMs);
+ if (born) {
+ const exit = foundryWalkOut();
+ sim.current = {
+ x: exit.from[0],
+ z: exit.from[1],
+ y: groundY(map, exit.from[0], exit.from[1]) + FOUNDRY_BELT_LIFT_M,
+ heading: exit.heading,
+ mode: "walk",
+ timer: 0,
+ waypoints: [exit.to],
+ index: 0,
+ speed: NOMINAL_WALK_MPS,
+ purpose,
+ atPurpose: false,
+ exiting: true,
+ lift: FOUNDRY_BELT_LIFT_M,
+ rng,
+ };
+ } else {
+ const startTile = purpose ? content.places[purpose].standTile : randomPlazaTile(map, rng);
+ const [x, z] = tileToWorld(startTile[0], startTile[1]);
+ const facing = purpose ? content.places[purpose].facing : rng() * Math.PI * 2;
+ sim.current = {
+ x: x + offset,
+ z,
+ y: groundY(map, x, z),
+ heading: facing,
+ mode: stateMode(agent.state, purpose !== null),
+ timer: 1 + rng() * 3,
+ waypoints: [],
+ index: 0,
+ speed: WANDER_SPEED_MPS,
+ purpose,
+ atPurpose: purpose !== null,
+ exiting: false,
+ lift: 0,
+ rng,
+ };
+ }
}
// A checkpoint or state change from the roster re-targets the walker.
@@ -127,7 +161,11 @@ function Walker({
const s = sim.current;
if (!s) return;
const purpose = CHECKPOINT_PLACE[agent.checkpoint];
- if (purpose !== s.purpose) {
+ if (s.exiting) {
+ // Still on the conveyor: remember the target, walk there once outside.
+ s.purpose = purpose;
+ s.atPurpose = false;
+ } else if (purpose !== s.purpose) {
s.purpose = purpose;
s.atPurpose = false;
if (purpose) {
@@ -164,7 +202,21 @@ function Walker({
s.heading = turnToward(s.heading, headingFor(r.vx, r.vz), TURN_RATE_RAD_S * step);
}
anim.current.speed = Math.hypot(r.vx, r.vz);
- if (r.arrived) {
+ if (r.arrived && s.exiting) {
+ // Off the belt and on the plaza: head for wherever the roster says.
+ s.exiting = false;
+ s.lift = 0;
+ const target = s.purpose
+ ? content.places[s.purpose].standTile
+ : randomPlazaTile(map, s.rng);
+ if (pathTo(s, target)) {
+ s.speed = s.purpose ? NOMINAL_WALK_MPS : WANDER_SPEED_MPS;
+ } else {
+ s.mode = stateMode(agent.state, false);
+ s.timer = 2;
+ s.speed = WANDER_SPEED_MPS;
+ }
+ } else if (r.arrived) {
if (s.purpose && !s.atPurpose) {
s.atPurpose = true;
s.heading = content.places[s.purpose].facing;
@@ -189,8 +241,14 @@ function Walker({
}
}
}
+ if (s.exiting) {
+ // The conveyor lowers its passenger over the last two metres.
+ const end = s.waypoints[s.waypoints.length - 1];
+ const remain = end ? Math.hypot(end[0] - s.x, end[1] - s.z) : 0;
+ s.lift = FOUNDRY_BELT_LIFT_M * Math.min(1, remain / 2.0);
+ }
// Ground snap with a short ease so a level step reads as a step.
- const targetY = groundY(map, s.x, s.z);
+ const targetY = groundY(map, s.x, s.z) + s.lift;
s.y += (targetY - s.y) * Math.min(1, step * 12);
}
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 d5b98b94d7..e60d8bfc8b 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx
+++ b/jarvis/ui/web/frontend/src/components/society/world/WorldStage.tsx
@@ -29,7 +29,9 @@ import { useWebglSupported } from "@/lib/graphDimension";
import { useSocietyRoster } from "../data";
import { useCameraStore } from "./cameraStore";
import { Clouds } from "./Clouds";
+import { FoundryDrawer } from "./FoundryDrawer";
import { Landmarks } from "./Landmarks";
+import { MemoryDrawer } from "./MemoryDrawer";
import { PlaceLabels } from "./PlaceLabels";
import { HubDrawer } from "./HubDrawer";
import { QuestBoardDrawer } from "./QuestBoardDrawer";
@@ -81,6 +83,7 @@ export function WorldStage({ topRight, onOpenLedger, onSelectAgent }: WorldStage
const [selected, setSelected] = useState<string | null>(null);
const [openHub, setOpenHub] = useState<KitPlace | null>(null);
const [questOpen, setQuestOpen] = useState(false);
+ const [memoryOpen, setMemoryOpen] = useState(false);
useWorldControls(hostRef, webgl);
@@ -149,6 +152,7 @@ export function WorldStage({ topRight, onOpenLedger, onSelectAgent }: WorldStage
questOpen={questOpen}
onQuestClick={() => {
setOpenHub(null);
+ setMemoryOpen(false);
setQuestOpen((cur) => !cur);
}}
/>
@@ -156,10 +160,18 @@ export function WorldStage({ topRight, onOpenLedger, onSelectAgent }: WorldStage
paused={reduced}
onHubClick={(p) => {
setQuestOpen(false);
+ if (p === "archive") {
+ setOpenHub(null);
+ setMemoryOpen((cur) => !cur);
+ return;
+ }
+ setMemoryOpen(false);
const hub = asHub(p);
if (hub) setOpenHub((cur) => (cur === hub ? null : hub));
}}
openHub={openHub}
+ memoryOpen={memoryOpen}
+ atMemory={agents.filter((a) => a.checkpoint === "archive").length}
/>
<Trees />
<Walkers agents={agents} paused={reduced} selectedId={selected} onSelect={select} />
@@ -174,7 +186,15 @@ export function WorldStage({ topRight, onOpenLedger, onSelectAgent }: WorldStage
{ready && (
<WorldHud agents={agents} sample={sample} awake={awake} reducedMotion={reduced} topRight={topRight} />
)}
- {ready && openHub && <HubDrawer hub={openHub} onClose={() => setOpenHub(null)} />}
+ {/* Every hub lists what it stands for; the foundry also BUILDS, so it
+ has its own drawer with the creator in it. */}
+ {ready && openHub && openHub !== "foundry" && (
+ <HubDrawer hub={openHub} onClose={() => setOpenHub(null)} />
+ )}
+ {ready && openHub === "foundry" && (
+ <FoundryDrawer onClose={() => setOpenHub(null)} onSelectAgent={select} />
+ )}
+ {ready && memoryOpen && <MemoryDrawer onClose={() => setMemoryOpen(false)} />}
{ready && questOpen && <QuestBoardDrawer onClose={() => setQuestOpen(false)} />}
</div>
);
diff --git a/jarvis/ui/web/frontend/src/components/society/world/foundry.test.ts b/jarvis/ui/web/frontend/src/components/society/world/foundry.test.ts
new file mode 100644
index 0000000000..596a09de66
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/world/foundry.test.ts
@@ -0,0 +1,128 @@
+/**
+ * The Agent Foundry's two testable halves: where a new figure walks out, and
+ * WHO is owed that walk. The second one is the fragile half — the roster
+ * refetches every 30 s, so an entrance that is not remembered would march the
+ * same agent out of the factory over and over.
+ */
+import { beforeEach, describe, expect, it } from "vitest";
+
+import {
+ FOUNDRY_PORTAL_M,
+ FOUNDRY_RAMP_END_M,
+ buildIsland,
+ foundryWalkOut,
+ isWalkable,
+ kitPose,
+ worldToTile,
+} from "./islandLayout";
+import { CAMERA_YAW_DEG } from "./worldCamera";
+import { ENTRANCE_REPLAY_MS, FRESH_ENTRANCE_MS, useSpawnStore } from "./spawnStore";
+
+const NOW = Date.UTC(2026, 8, 2, 12, 0, 0);
+
+function resetStore(): void {
+ try {
+ sessionStorage.clear();
+ } catch {
+ /* jsdom without storage: the store falls back to an empty set anyway */
+ }
+ useSpawnStore.setState({ portalOpenedMs: 0, announced: new Set(), seen: new Map() });
+}
+
+describe("foundryWalkOut", () => {
+ it("starts inside the portal and ends past the conveyor, straight ahead", () => {
+ const pose = kitPose("foundry");
+ const walk = foundryWalkOut();
+ const distance = (p: [number, number]) => Math.hypot(p[0] - pose.x, p[1] - pose.z);
+ expect(distance(walk.from)).toBeCloseTo(FOUNDRY_PORTAL_M, 5);
+ expect(distance(walk.to)).toBeCloseTo(FOUNDRY_RAMP_END_M, 5);
+ // Both points sit on the building's forward axis, so the figure walks out
+ // of the door rather than through a wall.
+ expect(walk.heading).toBeCloseTo(pose.rotation, 5);
+ const ahead = Math.atan2(walk.to[0] - walk.from[0], walk.to[1] - walk.from[1]);
+ expect(ahead).toBeCloseTo(pose.rotation, 5);
+ });
+
+ it("faces its portal at the camera, which no other kit building has to", () => {
+ // The whole point of the building is that you SEE an agent come out of it,
+ // and the island camera never turns. A change that swings the foundry back
+ // in line with the other halls hides the door — this test is the guard.
+ const front = kitPose("foundry").rotation;
+ const toCamera = (CAMERA_YAW_DEG * Math.PI) / 180;
+ const off = Math.abs(Math.atan2(Math.sin(front - toCamera), Math.cos(front - toCamera)));
+ expect(off).toBeLessThan(Math.PI / 6);
+ });
+
+ it("sets the figure down on ground it may stand on", () => {
+ const { map } = buildIsland();
+ const [tx, tz] = worldToTile(...foundryWalkOut().to);
+ expect(isWalkable(map, tx, tz)).toBe(true);
+ });
+
+ it("puts the ramp foot where the walker's stand tile is", () => {
+ const { content } = buildIsland();
+ const [tx, tz] = worldToTile(...foundryWalkOut().to);
+ const [sx, sz] = content.places.foundry.standTile;
+ expect(Math.abs(tx - sx)).toBeLessThanOrEqual(1);
+ expect(Math.abs(tz - sz)).toBeLessThanOrEqual(1);
+ });
+});
+
+describe("spawn entrances", () => {
+ beforeEach(resetStore);
+
+ it("walks an announced agent out, and not again once it has arrived", () => {
+ const { announce, claim } = useSpawnStore.getState();
+ announce("scout");
+ expect(claim("scout", NOW, NOW)).toBe(true);
+ // The roster refetch a minute later must not repeat the parade.
+ const later = NOW + ENTRANCE_REPLAY_MS + 1;
+ expect(useSpawnStore.getState().claim("scout", NOW, later)).toBe(false);
+ });
+
+ it("resumes the entrance when the walker remounts mid-walk", () => {
+ // A rebuilt canvas (AP-32) remounts every walker. Burning the claim on the
+ // first mount would strand the newborn on the plaza mid-flare.
+ const { announce, claim } = useSpawnStore.getState();
+ announce("scout");
+ expect(claim("scout", NOW, NOW)).toBe(true);
+ expect(useSpawnStore.getState().claim("scout", NOW, NOW + 900)).toBe(true);
+ });
+
+ it("never grants an entrance a second time to an agent that was denied one", () => {
+ const { claim } = useSpawnStore.getState();
+ expect(claim("veteran", NOW - FRESH_ENTRANCE_MS - 1, NOW)).toBe(false);
+ expect(useSpawnStore.getState().claim("veteran", NOW - 10, NOW + 10)).toBe(false);
+ });
+
+ it("walks out a row created in another window while it is still fresh", () => {
+ const { claim } = useSpawnStore.getState();
+ expect(claim("fresh", NOW - 5_000, NOW)).toBe(true);
+ });
+
+ it("leaves an agent created long ago standing where it is", () => {
+ const { claim } = useSpawnStore.getState();
+ expect(claim("veteran", NOW - FRESH_ENTRANCE_MS - 1, NOW)).toBe(false);
+ expect(useSpawnStore.getState().portalOpenedMs).toBe(0);
+ });
+
+ it("opens the portal for the building to react to", () => {
+ useSpawnStore.getState().claim("scout", NOW, NOW);
+ expect(useSpawnStore.getState().portalOpenedMs).toBe(NOW);
+ });
+
+ it("remembers walked agents across a reload of the same window", () => {
+ useSpawnStore.getState().claim("scout", NOW, NOW);
+ // A reload rebuilds the store from sessionStorage; simulate that.
+ const stored = sessionStorage.getItem("jarvis.world.foundry.seen.v2");
+ expect(stored).toContain("scout");
+ useSpawnStore.setState({
+ portalOpenedMs: 0,
+ announced: new Set(),
+ seen: new Map(JSON.parse(stored ?? "[]") as Array<[string, number]>),
+ });
+ // Long after the walk: the reload shows the agent where it stands.
+ const later = NOW + ENTRANCE_REPLAY_MS + 1;
+ expect(useSpawnStore.getState().claim("scout", NOW, later)).toBe(false);
+ });
+});
diff --git a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts
index 503e34eab5..d93ec6b796 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.test.ts
@@ -9,6 +9,7 @@ import {
ISLAND_FIELDS,
ISLAND_TILES,
ISLETS,
+ KIT_FACING,
LEVEL_Y,
MARKET_FIELDS,
MARKET_HALF_TILES,
@@ -143,7 +144,7 @@ describe("islandLayout", () => {
it("opens a paved square in the middle with a ring of houses around it", () => {
const { map, content } = island;
expect(map.kind[tileIndex(map, CENTER_TILE + 5, CENTER_TILE + 5)]).toBe(TileKind.plaza);
- expect(content.houses.length).toBe(7); // 12 slots, five taken by the four ring hubs
+ expect(content.houses.length).toBe(5); // 12 slots, seven taken by the five ring hubs
for (const h of content.houses) {
const r = Math.hypot(h.x, h.z) / 2;
expect(r).toBeGreaterThan(PLAZA_RADIUS_TILES);
@@ -160,13 +161,14 @@ describe("islandLayout", () => {
}
});
- it("puts every ring hub on the house ring, facing the square, with a reachable stand", () => {
+ it("puts the Plugin Docks on the house ring, facing the square, with a reachable stand", () => {
const { map, content } = island;
for (const [id, pose] of Object.entries(content.kitPoses)) {
expect(Math.hypot(pose.x, pose.z) / 2, id).toBeCloseTo(HOUSE_RING_TILES, 5);
const fx = Math.sin(pose.rotation);
const fz = Math.cos(pose.rotation);
- expect(fx * -pose.x + fz * -pose.z, id).toBeGreaterThan(0); // the front points at the centre
+ // The front points at the centre, unless the building faces the road on purpose.
+ if (!(id in KIT_FACING)) expect(fx * -pose.x + fz * -pose.z, id).toBeGreaterThan(0);
const [sx, sz] = content.places[id as keyof typeof content.places].standTile;
expect(isWalkable(map, sx, sz), id).toBe(true);
const [bx, bz] = worldToTile(pose.x, pose.z);
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 ef5cb8b394..f6c8910acb 100644
--- a/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
+++ b/jarvis/ui/web/frontend/src/components/society/world/islandLayout.ts
@@ -131,6 +131,7 @@ export type PlaceId =
| "gardens"
| "solar"
| "plugins"
+ | "foundry"
| "skills"
| "mcp"
| "cli";
@@ -213,7 +214,7 @@ export interface IslandContent {
}
/** Places that are World Kit buildings sitting IN the house ring (world-masterplan-v2.md §5). */
-export type KitPlace = "plugins" | "skills" | "mcp" | "cli";
+export type KitPlace = "plugins" | "foundry" | "skills" | "mcp" | "cli";
export interface KitPose {
x: number;
@@ -328,32 +329,52 @@ export const HEDGE_RING_TILES = 29;
export const GATE_GAP_TILES = 3;
/**
- * Ring slots (of 16) a kit building takes over instead of houses. The Plugin
- * Docks are 16 m wide, a house slot is ~15 m of arc, so the docks take two
- * neighbouring north-west slots and stand centred between them.
+ * Ring slots (of 16) a kit building takes over instead of houses. A house slot
+ * is ~15 m of arc, so a hall takes two neighbouring slots and stands centred
+ * between them. The Agent Foundry sits on 2-3, the mirror image of the Plugin
+ * Docks on 13-14 across the north axis: the two halls frame the square's north
+ * side, and the foundry's ramp runs down onto the plaza in full view of the
+ * island camera (which looks from the south-east).
*/
export const RING_KIT_SLOTS: Record<KitPlace, readonly number[]> = {
+ plugins: [13, 14],
+ foundry: [2, 3],
// Hubs sit on the north and west of the ring so their fronts face the camera
// (it looks from the south-east); houses take the slots whose backs it sees.
- plugins: [13, 14], // north-west, two slots (16 m wide)
skills: [15], // north, beside the docks: the Skill Forge
- mcp: [1], // north-east: the Relay Tower
+ mcp: [1], // north, beside the foundry: the Relay Tower
cli: [11], // west: the Terminal Cantina
};
-/** Footprints (tiles) of the kit buildings, for blocking the walk grid. */
-export const KIT_FOOTPRINTS: Record<KitPlace, [number, number]> = {
- plugins: [8, 5],
- skills: [7, 5],
- mcp: [5, 5],
- cli: [7, 5],
+/**
+ * Footprint of each kit building in TILES, as its GLB's `jarvis_building`
+ * extras declare it. Walkers route around these the way they route around a
+ * house; the foundry's conveyor ramp stays walkable on purpose — a figure
+ * leaving the portal walks down it.
+ */
+export const KIT_FOOTPRINT_TILES: Record<KitPlace, { w: number; d: number }> = {
+ plugins: { w: 8, d: 5 },
+ foundry: { w: 10, d: 7 },
+ skills: { w: 7, d: 5 },
+ mcp: { w: 5, d: 5 },
+ cli: { w: 7, d: 5 },
};
-const KIT_PLACES = Object.keys(RING_KIT_SLOTS) as KitPlace[];
+/**
+ * Kit buildings face the square by default. The Agent Foundry does not: it
+ * faces the ring road (south-east), because a factory's loading side belongs
+ * on the road rather than on the market place — and because its door is the
+ * one door a viewer has to SEE. The island camera is fixed at a 45° yaw from
+ * the south-east, so this is the heading that puts the portal, the sign, the
+ * assembly arms and the whole conveyor in plain view of the default camera.
+ */
+export const KIT_FACING: Partial<Record<KitPlace, number>> = { foundry: Math.PI / 4 };
-function kitTile(place: KitPlace): [number, number] {
- const p = ringPose(RING_KIT_SLOTS[place]);
- return [Math.floor(p.x / TILE_M + CENTER_TILE), Math.floor(p.z / TILE_M + CENTER_TILE)];
+/** Where a kit building stands and which way it turns — the one source. */
+export function kitPose(place: KitPlace): KitPose {
+ const pose = ringPose(RING_KIT_SLOTS[place]);
+ const facing = KIT_FACING[place];
+ return facing === undefined ? pose : { ...pose, rotation: facing };
}
/**
@@ -390,13 +411,49 @@ const PLACE_TILES: Record<PlaceId, [number, number]> = {
lighthouse: [CENTER_TILE + 84, CENTER_TILE],
gardens: [CENTER_TILE + 44, CENTER_TILE + 48],
solar: [CENTER_TILE - 40, CENTER_TILE - 40],
- // Kit hubs stand in the house ring (RING_KIT_SLOTS); these are their ring poses' tiles.
- plugins: kitTile("plugins"),
- skills: kitTile("skills"),
- mcp: kitTile("mcp"),
- cli: kitTile("cli"),
+ // Kit buildings stand in the house ring (RING_KIT_SLOTS); the tile is the ring pose's.
+ plugins: ringTile("plugins"),
+ foundry: ringTile("foundry"),
+ skills: ringTile("skills"),
+ mcp: ringTile("mcp"),
+ cli: ringTile("cli"),
};
+/**
+ * The Agent Foundry's walk-out, in world metres: where a brand-new figure
+ * appears (just behind the portal's containment field) and where the conveyor
+ * ramp sets it down on the plaza. Both distances are the GLB's own
+ * `jarvis_building` anchors — `door` 6.5 m and `ramp_end` 13.4 m ahead of the
+ * origin — nudged so the figure starts inside the glow and lands past the belt.
+ */
+export const FOUNDRY_PORTAL_M = 5.2;
+export const FOUNDRY_RAMP_END_M = 13.6;
+/** Centre of the conveyor deck ahead of the origin, in metres. */
+export const FOUNDRY_RAMP_MID_M = 9.5;
+/** How high the conveyor carries a figure above the plaza, in metres. */
+export const FOUNDRY_BELT_LIFT_M = 0.55;
+
+export function foundryWalkOut(): {
+ from: [number, number];
+ to: [number, number];
+ heading: number;
+} {
+ const p = kitPose("foundry");
+ const fx = Math.sin(p.rotation);
+ const fz = Math.cos(p.rotation);
+ return {
+ from: [p.x + fx * FOUNDRY_PORTAL_M, p.z + fz * FOUNDRY_PORTAL_M],
+ to: [p.x + fx * FOUNDRY_RAMP_END_M, p.z + fz * FOUNDRY_RAMP_END_M],
+ heading: p.rotation,
+ };
+}
+
+/** The tile a ring kit building's origin falls on. */
+function ringTile(place: KitPlace): [number, number] {
+ const p = kitPose(place);
+ return [Math.floor(p.x / TILE_M + CENTER_TILE), Math.floor(p.z / TILE_M + CENTER_TILE)];
+}
+
/** Half extents (tiles) of the flat plots each place is built on. */
const PLOT_HALF: Record<PlaceId, [number, number]> = {
market: [0, 0],
@@ -407,8 +464,8 @@ const PLOT_HALF: Record<PlaceId, [number, number]> = {
lighthouse: [4, 4],
gardens: [9, 7],
solar: [8, 7],
- // Ring hubs have no flat plot of their own: they sit on the village plateau.
- plugins: [0, 0],
+ plugins: [0, 0], // no flat plot of its own: it sits on the village plateau
+ foundry: [0, 0],
skills: [0, 0],
mcp: [0, 0],
cli: [0, 0],
@@ -425,6 +482,7 @@ const PLOT_LEVEL: Record<PlaceId, number> = {
gardens: 2,
solar: 4,
plugins: PLATEAU_LEVEL,
+ foundry: PLATEAU_LEVEL,
skills: PLATEAU_LEVEL,
mcp: PLATEAU_LEVEL,
cli: PLATEAU_LEVEL,
@@ -433,7 +491,7 @@ const PLOT_LEVEL: Record<PlaceId, number> = {
/** Building footprints (half extents, tiles) that block walking. */
const BUILDING_HALF: Partial<Record<PlaceId, [number, number]>> = {
hub: [6, 3],
- archive: [3, 3],
+ archive: [4, 3], // the Memory House: 8 x 6 tiles
workshop: [6, 3],
lighthouse: [1, 1],
};
@@ -1013,6 +1071,13 @@ function placeBoulders(map: IslandMap): Boulder[] {
return boulders;
}
+/** A stand point `ahead` metres in front of a kit building, facing it. */
+function kitPlace(id: KitPlace, ahead: number): Place {
+ const p = kitPose(id);
+ const tile = worldToTile(p.x + Math.sin(p.rotation) * ahead, p.z + Math.cos(p.rotation) * ahead);
+ return { id, tile: PLACE_TILES[id], standTile: tile, facing: p.rotation + Math.PI };
+}
+
function buildPlaces(map: IslandMap): Record<PlaceId, Place> {
const C = CENTER_TILE;
const place = (id: PlaceId, standTile: [number, number], facing: number): Place => ({
@@ -1032,16 +1097,13 @@ function buildPlaces(map: IslandMap): Record<PlaceId, Place> {
lighthouse: place("lighthouse", [PLACE_TILES.lighthouse[0] - 4, 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] + 9], Math.PI),
- // Ring hubs: 7.5 m in front of the doors, toward the square, facing the building.
- ...(Object.fromEntries(
- KIT_PLACES.map((id) => {
- const p = ringPose(RING_KIT_SLOTS[id]);
- const fx = Math.sin(p.rotation);
- const fz = Math.cos(p.rotation);
- const tile = worldToTile(p.x + fx * 7.5, p.z + fz * 7.5);
- return [id, place(id, tile, p.rotation + Math.PI)];
- }),
- ) as Record<KitPlace, Place>),
+ // In front of the docks' bays (7.5 m toward the square), facing the building.
+ plugins: kitPlace("plugins", 7.5),
+ // At the foot of the foundry's conveyor ramp, facing the portal.
+ foundry: kitPlace("foundry", 13.5),
+ skills: kitPlace("skills", 7.5),
+ mcp: kitPlace("mcp", 7.0),
+ cli: kitPlace("cli", 7.5),
};
// Make sure every stand tile is walkable — a place nobody can reach is a bug.
for (const p of Object.values(places)) {
@@ -1083,20 +1145,38 @@ export function buildIsland(): Island {
buildVillage(map);
const houses = placeHouses();
blockHouses(map, houses);
- const kitPoses = Object.fromEntries(
- KIT_PLACES.map((id) => [id, ringPose(RING_KIT_SLOTS[id])]),
- ) as Record<KitPlace, KitPose>;
- // Kit footprints block walking like houses do.
+ const kitPoses: Record<KitPlace, KitPose> = {
+ plugins: kitPose("plugins"),
+ foundry: kitPose("foundry"),
+ skills: kitPose("skills"),
+ mcp: kitPose("mcp"),
+ cli: kitPose("cli"),
+ };
+ // Every kit footprint blocks walking the way a house does.
blockHouses(
map,
- KIT_PLACES.map((id) => ({
+ (Object.keys(kitPoses) as KitPlace[]).map((id) => ({
...kitPoses[id],
- w: KIT_FOOTPRINTS[id][0],
- d: KIT_FOOTPRINTS[id][1],
- variant: "glass-loft" as const,
+ ...KIT_FOOTPRINT_TILES[id],
+ variant: "glass-loft" as HouseVariant,
seed: 0,
})),
);
+ // The foundry's conveyor deck is furniture, not floor: it keeps trees off
+ // and keeps strollers beside it. A newborn rides it on fixed waypoints, so
+ // the block costs the entrance nothing.
+ const belt = kitPose("foundry");
+ blockHouses(map, [
+ {
+ x: belt.x + Math.sin(belt.rotation) * FOUNDRY_RAMP_MID_M,
+ z: belt.z + Math.cos(belt.rotation) * FOUNDRY_RAMP_MID_M,
+ rotation: belt.rotation,
+ w: 3,
+ d: 3,
+ variant: "glass-loft" as HouseVariant,
+ seed: 0,
+ },
+ ]);
blockSquareFurniture(map);
const { hedges, lamps } = placeRingFurniture(map);
const { panels, greenhouses } = placeQuarterFurniture(map);
diff --git a/jarvis/ui/web/frontend/src/components/society/world/spawnStore.ts b/jarvis/ui/web/frontend/src/components/society/world/spawnStore.ts
new file mode 100644
index 0000000000..b894c48d91
--- /dev/null
+++ b/jarvis/ui/web/frontend/src/components/society/world/spawnStore.ts
@@ -0,0 +1,125 @@
+/**
+ * New agents walk out of the Agent Foundry — the client half of it.
+ *
+ * The island is a projection of the society log (MASTERPLAN §2.7): the backend
+ * owns WHERE an agent is, never how it got there. A brand-new agent therefore
+ * does not get a new checkpoint from the backend; it gets a one-off entrance,
+ * the same way footsteps are one-off and never synced. This store is the whole
+ * memory of that entrance:
+ *
+ * - `announceSpawn` is called the moment an agent is created in THIS window,
+ * so its walker knows to come out of the portal instead of appearing on the
+ * plaza;
+ * - a row created in another window (or another device) still gets its
+ * entrance, because a `createdMs` younger than `FRESH_ENTRANCE_MS` counts;
+ * - `sessionStorage` remembers the ids this window has already decided about,
+ * so the roster's 30 s refetch — or a reload — never marches the same figure
+ * out of the factory twice;
+ * - but a walker that is REMOUNTED mid-entrance keeps it. The canvas is torn
+ * down and rebuilt on a WebGL context loss (AP-32), and React can remount a
+ * subtree at any time; a claim that burned on the first mount would leave
+ * the figure standing on the plaza with the portal still flaring. So a
+ * claimed entrance stays claimable for `ENTRANCE_REPLAY_MS`, which is
+ * longer than the walk and shorter than anyone's next visit.
+ *
+ * `portalOpenedMs` is what the building itself listens to: the portal flares
+ * and the forecourt lights up for a few seconds after any entrance.
+ */
+import { create } from "zustand";
+
+/** A row created less than this ago is treated as newly born (ms). */
+export const FRESH_ENTRANCE_MS = 60_000;
+/** How long the portal keeps glowing after a figure came through (ms). */
+export const PORTAL_FLARE_MS = 4_200;
+/**
+ * A claimed entrance stays claimable this long, so a remount of the walker
+ * (a rebuilt canvas, a re-rendered subtree) resumes the walk instead of
+ * dropping the figure on the plaza. Longer than the ~6 s ride down the belt.
+ */
+export const ENTRANCE_REPLAY_MS = 15_000;
+
+const SEEN_KEY = "jarvis.world.foundry.seen.v2";
+
+/** Decisions this window has made: agent id → when it walked, or 0 for never. */
+type Decisions = Map<string, number>;
+
+function readSeen(): Decisions {
+ try {
+ const raw = sessionStorage.getItem(SEEN_KEY);
+ if (!raw) return new Map();
+ const parsed = JSON.parse(raw) as unknown;
+ if (!Array.isArray(parsed)) return new Map();
+ const rows = parsed.filter(
+ (v): v is [string, number] =>
+ Array.isArray(v) && typeof v[0] === "string" && typeof v[1] === "number",
+ );
+ return new Map(rows);
+ } catch {
+ // Private mode or a blocked store: the entrance simply plays again.
+ return new Map();
+ }
+}
+
+function writeSeen(seen: Decisions): void {
+ try {
+ // Keep the tail only — a long-lived window never needs the whole history.
+ sessionStorage.setItem(SEEN_KEY, JSON.stringify([...seen].slice(-200)));
+ } catch {
+ /* not persisted, still remembered for this window */
+ }
+}
+
+interface SpawnState {
+ /** Epoch ms of the last figure that came through the portal; 0 = never. */
+ portalOpenedMs: number;
+ /** Ids created in this window that are still owed their entrance. */
+ announced: Set<string>;
+ /** What this window decided per agent: when it walked out, or 0 for never. */
+ seen: Decisions;
+ announce: (agentId: string) => void;
+ claim: (agentId: string, createdMs: number, now?: number) => boolean;
+}
+
+export const useSpawnStore = create<SpawnState>((set, get) => ({
+ portalOpenedMs: 0,
+ announced: new Set<string>(),
+ seen: typeof sessionStorage === "undefined" ? (new Map() as Decisions) : readSeen(),
+ announce: (agentId) => {
+ const announced = new Set(get().announced);
+ announced.add(agentId);
+ set({ announced });
+ },
+ claim: (agentId, createdMs, now = Date.now()) => {
+ const { seen, announced } = get();
+ const decided = seen.get(agentId);
+ if (decided !== undefined) {
+ // Already answered for this agent: a remount within the replay window
+ // resumes the walk, anything later stands where the roster says.
+ return decided > 0 && now - decided < ENTRANCE_REPLAY_MS;
+ }
+ const wasAnnounced = announced.has(agentId);
+ const isFresh = Number.isFinite(createdMs) && now - createdMs < FRESH_ENTRANCE_MS;
+ const owed = wasAnnounced || isFresh;
+ const nextSeen = new Map(seen);
+ nextSeen.set(agentId, owed ? now : 0);
+ writeSeen(nextSeen);
+ if (!owed) {
+ set({ seen: nextSeen });
+ return false;
+ }
+ const nextAnnounced = new Set(announced);
+ nextAnnounced.delete(agentId);
+ set({ seen: nextSeen, announced: nextAnnounced, portalOpenedMs: now });
+ return true;
+ },
+}));
+
+/** Called by the create flow the moment a row exists. */
+export function announceSpawn(agentId: string): void {
+ useSpawnStore.getState().announce(agentId);
+}
+
+/** Called once per walker on mount: may this figure walk out of the foundry? */
+export function claimEntrance(agentId: string, createdMs: number): boolean {
+ return useSpawnStore.getState().claim(agentId, createdMs);
+}
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 b7a5d3bddb..993c4681e3 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/de.json
@@ -18,10 +18,53 @@
"open_ledger": "Ledger öffnen",
"loading": "Die Insel wird gebaut…",
"place_plugins": "Plugin-Docks",
+ "place_foundry": "Agent-Foundry",
+ "drawer_foundry_title": "Agent-Foundry",
+ "drawer_foundry_hint": "Hier entstehen neue Agenten. Wer gebaut wird, tritt aus dem Portal und fährt über das Förderband hinunter auf den Platz.",
+ "foundry_create": "Neuen Agenten bauen",
+ "foundry_population": "{count} Agenten leben auf der Insel",
+ "foundry_recent": "Zuletzt gebaut",
+ "foundry_none": "Noch kein Agent gebaut.",
+ "foundry_walkout": "Ein frisch gebauter Agent kommt aus dem Portal und sucht sich seinen Platz im Dorf.",
"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",
+ "place_quests": "Questtafel",
+ "drawer_quests_title": "Questtafel",
+ "drawer_quests_hint": "Gib einen Auftrag auf. Der passende Agent übernimmt ihn – passt niemand, schmiedet die Foundry einen.",
+ "quest_compose_placeholder": "Was soll erledigt werden? Zum Beispiel: die fünf wichtigsten Mails von heute",
+ "quest_compose_hint": "Strg+Enter schickt ab",
+ "quest_post": "Quest aufgeben",
+ "quest_posting": "Wird aufgegeben…",
+ "quest_group_active": "Auf der Tafel",
+ "quest_group_done": "Erledigt",
+ "quest_group_failed": "Gescheitert",
+ "quest_group_cancelled": "Abgebrochen",
+ "quest_empty": "Noch keine Quests. Gib die erste auf.",
+ "quest_state": {
+ "open": "wartet auf jemanden",
+ "assigned": "zugeteilt",
+ "running": "in Arbeit",
+ "done": "erledigt",
+ "failed": "gescheitert",
+ "cancelled": "abgebrochen"
+ },
+ "quest_taken_by": "{agent} hat sie übernommen",
+ "quest_forged": "{agent} wurde dafür geschmiedet",
+ "quest_no_taker": "Noch niemand konnte sie übernehmen",
+ "quest_cancel": "Abbrechen",
+ "quest_retry": "Erneut versuchen",
+ "quest_result_label": "Übergabe",
+ "quest_open_label": "Noch offen",
+ "quest_refused": "Abgelehnt: {reason}",
+ "quest_age_now": "gerade eben",
+ "quest_age_min": "vor {n} Min.",
+ "quest_age_h": "vor {n} Std.",
+ "quest_age_d": "vor {n} Tagen",
+ "quest_close": "Schließen",
+ "quest_loading": "Tafel wird gelesen…",
+ "quest_open_ledger": "Agenten-Register öffnen",
"drawer_loading": "Plugin-Katalog wird gelesen…",
"drawer_empty": "Keine Plugins gefunden.",
"plugin_group_brain": "Gehirne",
@@ -49,10 +92,27 @@
"cli_group_connected": "Verbunden",
"cli_group_installed": "Installiert, nicht verbunden",
"cli_group_missing": "Nicht installiert",
+ "drawer_foundry_body": "Ein neuer Agent wird hier erschaffen und läuft aus dieser Tür zu seinem eigenen Haus im Ring. Erstelle einen über „Neu“ in der Agenten-Leiste; auch Avatar-Änderungen passieren hier drinnen.",
"place_market": "Marktplatz",
"place_hub": "Jarvis-Hub",
"place_workshop": "Werkstatt",
- "place_archive": "Archiv",
+ "place_archive": "Gedächtnis-Haus",
+ "drawer_memory_title": "Gedächtnis-Haus",
+ "drawer_memory_hint": "Das gemeinsame Gedächtnis der Agenten: geprüftes Team-Wissen, das Gedächtnis jedes Agenten und die Prüf-Warteschlange. Ein Agent geht hierher, wenn er sich erinnert oder etwas nachschlägt.",
+ "memory_search_placeholder": "Im Gedächtnis suchen…",
+ "memory_search_button": "Suchen",
+ "memory_hits": "Treffer",
+ "memory_no_hits": "Nichts gefunden.",
+ "memory_shared": "Team-Wissen",
+ "memory_empty_shared": "Noch kein geprüftes Team-Wissen. Vorschläge der Agenten landen unten in der Warteschlange.",
+ "memory_agents": "Gedächtnis je Agent",
+ "memory_notes": "{count} Notizen",
+ "memory_nothing_remembered": "Noch nichts gemerkt.",
+ "memory_queue": "Zu prüfen",
+ "memory_empty_queue": "Nichts zu prüfen.",
+ "memory_promote": "Ins Team-Wissen",
+ "memory_dismiss": "Geprüft",
+ "memory_open_wiki": "Wiki öffnen",
"place_harbor": "Hafentor",
"place_lighthouse": "Leuchtturm",
"place_gardens": "Gärten",
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 413f52d852..8fb23f1c11 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/en.json
@@ -18,10 +18,53 @@
"open_ledger": "Open the ledger",
"loading": "Building the island…",
"place_plugins": "Plugin Docks",
+ "place_foundry": "Agent Foundry",
+ "drawer_foundry_title": "Agent Foundry",
+ "drawer_foundry_hint": "Where new agents are made. Whoever is built steps out of the portal and rides the conveyor down to the square.",
+ "foundry_create": "Build a new agent",
+ "foundry_population": "{count} agents live on the island",
+ "foundry_recent": "Built most recently",
+ "foundry_none": "No agent built yet.",
+ "foundry_walkout": "A freshly built agent comes through the portal and finds its place in the village.",
"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",
+ "place_quests": "Quest Board",
+ "drawer_quests_title": "Quest Board",
+ "drawer_quests_hint": "Post a job. The agent who fits takes it — when nobody fits, the Foundry forges one.",
+ "quest_compose_placeholder": "What should be done? For example: the five most important mails of today",
+ "quest_compose_hint": "Ctrl+Enter posts",
+ "quest_post": "Post quest",
+ "quest_posting": "Posting…",
+ "quest_group_active": "On the board",
+ "quest_group_done": "Completed",
+ "quest_group_failed": "Failed",
+ "quest_group_cancelled": "Cancelled",
+ "quest_empty": "No quests yet. Post the first one.",
+ "quest_state": {
+ "open": "waiting for a taker",
+ "assigned": "assigned",
+ "running": "in progress",
+ "done": "done",
+ "failed": "failed",
+ "cancelled": "cancelled"
+ },
+ "quest_taken_by": "{agent} took it",
+ "quest_forged": "{agent} was forged for it",
+ "quest_no_taker": "Nobody could take it yet",
+ "quest_cancel": "Cancel",
+ "quest_retry": "Retry",
+ "quest_result_label": "Handoff",
+ "quest_open_label": "Still open",
+ "quest_refused": "Refused: {reason}",
+ "quest_age_now": "just now",
+ "quest_age_min": "{n} min ago",
+ "quest_age_h": "{n} h ago",
+ "quest_age_d": "{n} d ago",
+ "quest_close": "Close",
+ "quest_loading": "Reading the board…",
+ "quest_open_ledger": "Open the agents ledger",
"drawer_loading": "Reading the plugin catalog…",
"drawer_empty": "No plugins found.",
"plugin_group_brain": "Brains",
@@ -49,10 +92,27 @@
"cli_group_connected": "Connected",
"cli_group_installed": "Installed, not connected",
"cli_group_missing": "Not installed",
+ "drawer_foundry_body": "A new agent is created here and walks out of this door to its own house on the ring. Use “New” in the agents rail to create one; avatar changes happen inside as well.",
"place_market": "Market Square",
"place_hub": "Jarvis Hub",
"place_workshop": "Workshop",
- "place_archive": "Archive",
+ "place_archive": "Memory House",
+ "drawer_memory_title": "Memory House",
+ "drawer_memory_hint": "The agents' shared memory: reviewed team knowledge, every agent's own memory and the review queue. An agent walks here when it remembers or looks something up.",
+ "memory_search_placeholder": "Search the memory…",
+ "memory_search_button": "Search",
+ "memory_hits": "Hits",
+ "memory_no_hits": "Nothing found.",
+ "memory_shared": "Team knowledge",
+ "memory_empty_shared": "No reviewed team knowledge yet. Agents' proposals land in the queue below.",
+ "memory_agents": "Memory per agent",
+ "memory_notes": "{count} notes",
+ "memory_nothing_remembered": "Nothing remembered yet.",
+ "memory_queue": "To review",
+ "memory_empty_queue": "Nothing to review.",
+ "memory_promote": "Promote to team",
+ "memory_dismiss": "Reviewed",
+ "memory_open_wiki": "Open the wiki",
"place_harbor": "Harbor Gate",
"place_lighthouse": "Lighthouse",
"place_gardens": "Gardens",
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 ca4822c139..6cf2c805f0 100644
--- a/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
+++ b/jarvis/ui/web/frontend/src/i18n/locales/society/es.json
@@ -18,10 +18,53 @@
"open_ledger": "Abrir el registro",
"loading": "Construyendo la isla…",
"place_plugins": "Muelles de Plugins",
+ "place_foundry": "Fundición de Agentes",
+ "drawer_foundry_title": "Fundición de Agentes",
+ "drawer_foundry_hint": "Aquí se crean los nuevos agentes. Quien se construye sale por el portal y baja por la cinta hasta la plaza.",
+ "foundry_create": "Construir un agente",
+ "foundry_population": "{count} agentes viven en la isla",
+ "foundry_recent": "Construidos hace poco",
+ "foundry_none": "Aún no se ha construido ningún agente.",
+ "foundry_walkout": "Un agente recién construido sale por el portal y busca su lugar en el pueblo.",
"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",
+ "place_quests": "Tablón de misiones",
+ "drawer_quests_title": "Tablón de misiones",
+ "drawer_quests_hint": "Publica un encargo. El agente adecuado lo toma; si nadie encaja, la Fundición forja uno.",
+ "quest_compose_placeholder": "¿Qué hay que hacer? Por ejemplo: los cinco correos más importantes de hoy",
+ "quest_compose_hint": "Ctrl+Intro publica",
+ "quest_post": "Publicar misión",
+ "quest_posting": "Publicando…",
+ "quest_group_active": "En el tablón",
+ "quest_group_done": "Completadas",
+ "quest_group_failed": "Fallidas",
+ "quest_group_cancelled": "Canceladas",
+ "quest_empty": "Aún no hay misiones. Publica la primera.",
+ "quest_state": {
+ "open": "espera a alguien",
+ "assigned": "asignada",
+ "running": "en curso",
+ "done": "hecha",
+ "failed": "fallida",
+ "cancelled": "cancelada"
+ },
+ "quest_taken_by": "{agent} la tomó",
+ "quest_forged": "{agent} fue forjado para ella",
+ "quest_no_taker": "Nadie ha podido tomarla aún",
+ "quest_cancel": "Cancelar",
+ "quest_retry": "Reintentar",
+ "quest_result_label": "Entrega",
+ "quest_open_label": "Pendiente",
+ "quest_refused": "Rechazada: {reason}",
+ "quest_age_now": "ahora mismo",
+ "quest_age_min": "hace {n} min",
+ "quest_age_h": "hace {n} h",
+ "quest_age_d": "hace {n} d",
+ "quest_close": "Cerrar",
+ "quest_loading": "Leyendo el tablón…",
+ "quest_open_ledger": "Abrir el registro de agentes",
"drawer_loading": "Leyendo el catálogo de plugins…",
"drawer_empty": "No se encontraron plugins.",
"plugin_group_brain": "Cerebros",
@@ -49,10 +92,27 @@
"cli_group_connected": "Conectadas",
"cli_group_installed": "Instaladas, sin conectar",
"cli_group_missing": "No instaladas",
+ "drawer_foundry_body": "Un agente nuevo se crea aquí y sale por esta puerta hacia su propia casa en el anillo. Créalo con “Nuevo” en la barra de agentes; los cambios de avatar también ocurren dentro.",
"place_market": "Plaza del Mercado",
"place_hub": "Centro Jarvis",
"place_workshop": "Taller",
- "place_archive": "Archivo",
+ "place_archive": "Casa de la Memoria",
+ "drawer_memory_title": "Casa de la Memoria",
+ "drawer_memory_hint": "La memoria compartida de los agentes: conocimiento del equipo revisado, la memoria de cada agente y la cola de revisión. Un agente viene aquí cuando recuerda o consulta algo.",
+ "memory_search_placeholder": "Buscar en la memoria…",
+ "memory_search_button": "Buscar",
+ "memory_hits": "Resultados",
+ "memory_no_hits": "Nada encontrado.",
+ "memory_shared": "Conocimiento del equipo",
+ "memory_empty_shared": "Aún no hay conocimiento del equipo revisado. Las propuestas de los agentes aparecen abajo en la cola.",
+ "memory_agents": "Memoria por agente",
+ "memory_notes": "{count} notas",
+ "memory_nothing_remembered": "Todavía no recuerda nada.",
+ "memory_queue": "Por revisar",
+ "memory_empty_queue": "Nada por revisar.",
+ "memory_promote": "Al conocimiento del equipo",
+ "memory_dismiss": "Revisado",
+ "memory_open_wiki": "Abrir la wiki",
"place_harbor": "Puerta del Puerto",
"place_lighthouse": "Faro",
"place_gardens": "Jardines",
diff --git a/scripts/world/build_world_kit.py b/scripts/world/build_world_kit.py
index a328599412..8cabf55b31 100644
--- a/scripts/world/build_world_kit.py
+++ b/scripts/world/build_world_kit.py
@@ -53,6 +53,15 @@ PALETTE = {
"fam_tts": "#ffb703",
"fam_channel": "#06d6a0",
"fam_realtime": "#4cc9f0",
+ # the Agent Foundry: brushed steel, hazard stripes and the assembly core
+ "steel": "#9aa2b1",
+ "steel_dark": "#5d6472",
+ "belt": "#3a3f4f",
+ "hazard": "#ffb703",
+ "hazard_dark": "#2b2f42",
+ "core": "#4cc9f0",
+ "core_bright": "#b8f2ff",
+ "copper": "#d98d4a",
}
FAMILY_BAYS = ["fam_brain", "fam_tool", "fam_stt", "fam_tts", "fam_channel", "fam_realtime"]
@@ -174,6 +183,31 @@ def half_barrel(
return _finish(obj, material(mat_key), 0.05, parent)
+def torus(
+ name: str,
+ major: float,
+ minor: float,
+ at: tuple[float, float, float],
+ mat_key: str,
+ parent: bpy.types.Object,
+ rot: tuple[float, float, float] = (0, 0, 0),
+ emissive: float = 0.0,
+ segments: int = 24,
+) -> bpy.types.Object:
+ """A ring lying in the XY plane before `rot` — the foundry's core hoops."""
+ bpy.ops.mesh.primitive_torus_add(
+ location=at,
+ rotation=rot,
+ major_radius=major,
+ minor_radius=minor,
+ major_segments=segments,
+ minor_segments=8,
+ )
+ obj = bpy.context.active_object
+ obj.name = name
+ return _finish(obj, material(mat_key, emissive), 0.0, parent)
+
+
def text_mesh(
name: str,
body: str,
@@ -423,7 +457,475 @@ def build_plugin_docks() -> bpy.types.Object:
return root
-BUILDERS = {"plugin-docks": build_plugin_docks}
+def _robot_arm(root: bpy.types.Object, side: int, x: float, y: float, z: float) -> None:
+ """One assembly manipulator beside the conveyor.
+
+ A column with a boom reaching in over the belt and a gripper hanging off
+ its end — the shape reads as "factory arm" at island zoom, where a
+ multi-jointed arm would just be a tangle. `side` is -1 (left of the ramp)
+ or +1 (right); the pair frames the door a new agent walks out of.
+ """
+ s = "l" if side < 0 else "r"
+ cylinder(f"arm_foot_{s}", 0.95, 0.5, (x, y, z + 0.25), "steel_dark", root, verts=12)
+ cylinder(f"arm_turn_{s}", 0.78, 0.5, (x, y, z + 0.72), "hazard", root, verts=12)
+ box(f"arm_column_{s}", (0.95, 0.95, 3.4), (x, y, z + 2.6), "steel", root, bevel=0.08)
+ # hazard banding at the foot of the column
+ for k in range(3):
+ box(
+ f"arm_band_{s}{k}",
+ (1.02, 1.02, 0.16),
+ (x, y, z + 1.35 + k * 0.42),
+ "hazard" if k % 2 == 0 else "hazard_dark",
+ root,
+ bevel=0.02,
+ )
+ cylinder(
+ f"arm_shoulder_{s}",
+ 0.55,
+ 1.3,
+ (x, y, z + 4.35),
+ "steel_dark",
+ root,
+ verts=12,
+ rot=(0, math.pi / 2, 0),
+ )
+ # the boom, reaching in over the belt
+ reach = 3.1
+ bx = x - side * reach / 2
+ box(f"arm_boom_{s}", (reach, 0.6, 0.6), (bx, y, z + 4.35), "steel", root, bevel=0.07)
+ box(
+ f"arm_boom_rail_{s}",
+ (reach - 0.3, 0.66, 0.12),
+ (bx, y, z + 4.68),
+ "copper",
+ root,
+ bevel=0.03,
+ )
+ # the head at the boom's tip
+ hx = x - side * reach
+ box(f"arm_head_{s}", (0.9, 0.9, 0.7), (hx, y, z + 4.1), "steel_dark", root, bevel=0.08)
+ for j, dx in enumerate((-0.32, 0.32)):
+ box(
+ f"arm_claw_{s}{j}",
+ (0.16, 0.55, 0.75),
+ (hx + dx, y, z + 3.4),
+ "steel",
+ root,
+ bevel=0.04,
+ )
+ box(
+ f"arm_lamp_{s}",
+ (0.42, 0.42, 0.22),
+ (hx, y, z + 3.35),
+ "core_bright",
+ root,
+ bevel=0.06,
+ emissive=2.4,
+ )
+
+
+def build_agent_foundry() -> bpy.types.Object:
+ """The Agent Foundry — where a new agent is assembled and walks out of the
+ door (world-masterplan-v2.md §5, world-behaviour-manual.md §2 `foundry`).
+
+ A wide steel-and-plaster hall: corner columns, a sawtooth skylight roof, a
+ tall arched portal with a glowing containment field in the middle of the
+ front, a conveyor ramp running out of it onto the square, two assembly arms
+ over the ramp and the assembly core in a crowned tower on the roof.
+ Footprint 10 × 7 tiles (20 × 13 m); the portal faces −Y (glTF +Z).
+ """
+ W, D = 20.0, 13.0 # footprint
+ PL = 0.45 # plinth
+ H = 6.4 # hall height
+ roof_z = PL + H
+ y_front = -D / 2
+ root = new_root(
+ "agent-foundry",
+ {
+ "jarvis_building": {
+ "contract": 1,
+ "id": "agent-foundry",
+ "footprint": [10, 7],
+ "forward": "+Z",
+ # glTF metres: +Z is the front. The door is the portal mouth,
+ # `stand` the foot of the conveyor ramp where a figure appears.
+ "door": [0, 6.5],
+ "stand": [0, 13.0],
+ "ramp_end": [0, 13.4],
+ "sign": [0, 15.5, 0],
+ "height_m": 14.6,
+ }
+ },
+ )
+
+ # ---- plinth, hall body, corner columns --------------------------------
+ box("plinth", (W + 1.0, D + 1.0, PL), (0, 0, PL / 2), "plinth", root, bevel=0.1)
+ box("hall", (W, D, H), (0, 0, PL + H / 2), "wall", root, bevel=0.16)
+ box("base_band", (W + 0.12, D + 0.12, 0.7), (0, 0, PL + 0.35), "wall_shade", root, bevel=0.06)
+ for sx in (-1, 1):
+ for sy in (-1, 1):
+ box(
+ f"column_{'w' if sx < 0 else 'e'}{'n' if sy > 0 else 's'}",
+ (1.15, 1.15, H + 0.5),
+ (sx * (W / 2 - 0.2), sy * (D / 2 - 0.2), PL + (H + 0.5) / 2),
+ "steel",
+ root,
+ bevel=0.1,
+ )
+
+ # ---- roof: overhanging slab, copper fascia, sawtooth skylights ---------
+ box("roof_slab", (W + 1.4, D + 1.4, 0.45), (0, 0, roof_z + 0.22), "trim", root, bevel=0.12)
+ for i, (fw, fd, fx, fy) in enumerate(
+ (
+ (W + 1.5, 0.4, 0.0, -(D + 1.4) / 2),
+ (W + 1.5, 0.4, 0.0, (D + 1.4) / 2),
+ (0.4, D + 1.5, -(W + 1.4) / 2, 0.0),
+ (0.4, D + 1.5, (W + 1.4) / 2, 0.0),
+ )
+ ):
+ box(f"roof_fascia_{i}", (fw, fd, 0.3), (fx, fy, roof_z + 0.5), "copper", root, bevel=0.05)
+ for i, ox in enumerate((-6.0, -1.4, 3.2)):
+ box(
+ f"skylight_glass_{i}",
+ (3.4, D * 0.62, 0.18),
+ (ox, 0.6, roof_z + 1.45),
+ "glass",
+ root,
+ bevel=0.03,
+ emissive=0.9,
+ rot=(0, math.radians(38), 0),
+ )
+ box(
+ f"skylight_back_{i}",
+ (2.4, D * 0.62, 0.18),
+ (ox + 2.4, 0.6, roof_z + 1.5),
+ "roof",
+ root,
+ bevel=0.03,
+ rot=(0, math.radians(-58), 0),
+ )
+ # cooling fins along the back edge
+ for i in range(6):
+ box(
+ f"fin_{i}",
+ (0.22, 2.6, 1.1),
+ (-6.5 + i * 2.6, D / 2 - 1.6, roof_z + 1.0),
+ "steel_dark",
+ root,
+ bevel=0.04,
+ )
+
+ # ---- the portal: the door a new agent walks out of ---------------------
+ PW, PH = 6.8, 5.4 # portal opening
+ # recessed dark bay so the glow reads as depth, not as a sticker
+ box(
+ "portal_bay",
+ (PW, 1.2, PH),
+ (0, y_front + 0.5, PL + PH / 2),
+ "hazard_dark",
+ root,
+ bevel=0.06,
+ )
+ box(
+ "portal_field",
+ (PW - 0.7, 0.28, PH - 0.7),
+ (0, y_front + 0.02, PL + PH / 2 - 0.2),
+ "core",
+ root,
+ bevel=0.05,
+ emissive=2.6,
+ )
+ # heavy frame: two posts, a lintel and the arch above it
+ for sx in (-1, 1):
+ box(
+ f"portal_post_{'l' if sx < 0 else 'r'}",
+ (0.9, 1.5, PH + 0.5),
+ (sx * (PW / 2 + 0.35), y_front - 0.25, PL + (PH + 0.5) / 2),
+ "steel",
+ root,
+ bevel=0.08,
+ )
+ # hazard stripes on the lower posts
+ for k in range(4):
+ box(
+ f"portal_stripe_{'l' if sx < 0 else 'r'}{k}",
+ (0.98, 0.2, 0.28),
+ (sx * (PW / 2 + 0.35), y_front - 1.02, PL + 0.45 + k * 0.62),
+ "hazard" if k % 2 == 0 else "hazard_dark",
+ root,
+ bevel=0.02,
+ )
+ box(
+ "portal_lintel",
+ (PW + 2.4, 1.5, 0.9),
+ (0, y_front - 0.25, PL + PH + 0.45),
+ "steel_dark",
+ root,
+ bevel=0.08,
+ )
+ half_barrel("portal_arch", 0.7, PW + 2.4, (0, y_front - 0.05, PL + PH + 0.95), "copper", root)
+ # threshold plate and the two guide rails leaving the door
+ box(
+ "portal_sill",
+ (PW + 0.6, 1.9, 0.2),
+ (0, y_front - 0.5, PL + 0.05),
+ "steel_dark",
+ root,
+ bevel=0.04,
+ )
+ # side panels: recessed plaster with a lit window band over each
+ for sx in (-1, 1):
+ px = sx * (PW / 2 + 3.9)
+ box(
+ f"front_panel_{'l' if sx < 0 else 'r'}",
+ (5.2, 0.3, H - 0.9),
+ (px, y_front - 0.12, PL + (H - 0.9) / 2),
+ "wall_shade",
+ root,
+ bevel=0.06,
+ )
+ box(
+ f"front_ledge_{'l' if sx < 0 else 'r'}",
+ (5.4, 0.5, 0.22),
+ (px, y_front - 0.25, PL + 3.4),
+ "trim",
+ root,
+ bevel=0.04,
+ )
+ box(
+ f"front_window_{'l' if sx < 0 else 'r'}",
+ (4.4, 0.22, 1.3),
+ (px, y_front - 0.3, PL + 4.3),
+ "glass",
+ root,
+ bevel=0.04,
+ emissive=0.5,
+ )
+ # a row of small lamps under the arch
+ for i in range(5):
+ box(
+ f"portal_lamp_{i}",
+ (0.42, 0.3, 0.22),
+ (-3.2 + i * 1.6, y_front - 1.05, PL + PH + 0.05),
+ "core",
+ root,
+ bevel=0.04,
+ emissive=2.2,
+ )
+
+ # ---- the conveyor ramp out of the portal -------------------------------
+ RL = 7.0 # ramp length
+ ry = y_front - RL / 2 - 0.4
+ box("ramp_bed", (6.2, RL, 0.34), (0, ry, PL - 0.1), "belt", root, bevel=0.05)
+ for sx in (-1, 1):
+ box(
+ f"ramp_rail_{'l' if sx < 0 else 'r'}",
+ (0.42, RL, 0.62),
+ (sx * 3.1, ry, PL + 0.12),
+ "steel_dark",
+ root,
+ bevel=0.06,
+ )
+ box(
+ f"ramp_stripe_{'l' if sx < 0 else 'r'}",
+ (0.46, RL, 0.12),
+ (sx * 3.1, ry, PL + 0.44),
+ "hazard",
+ root,
+ bevel=0.02,
+ )
+ for i in range(9):
+ cylinder(
+ f"ramp_roller_{i}",
+ 0.26,
+ 5.9,
+ (0, y_front - 0.9 - i * 0.74, PL + 0.06),
+ "steel",
+ root,
+ verts=10,
+ rot=(0, math.pi / 2, 0),
+ bevel=0.02,
+ )
+ # a lit strip down the middle of the belt — the path the figure takes
+ box(
+ "ramp_guide",
+ (0.5, RL - 0.5, 0.08),
+ (0, ry, PL + 0.14),
+ "core",
+ root,
+ bevel=0.02,
+ emissive=1.6,
+ )
+
+ # ---- assembly arms over the ramp ---------------------------------------
+ _robot_arm(root, -1, -4.6, y_front - 2.6, PL)
+ _robot_arm(root, 1, 4.6, y_front - 2.6, PL)
+
+ # ---- the assembly core in its crowned tower ----------------------------
+ cylinder("core_base", 3.9, 0.9, (0, 1.2, roof_z + 0.85), "steel", root, verts=20, bevel=0.1)
+ cylinder("core_shaft", 3.2, 3.6, (0, 1.2, roof_z + 3.1), "wall", root, verts=20, bevel=0.1)
+ cylinder("core_glass", 3.3, 0.9, (0, 1.2, roof_z + 2.3), "glass", root, verts=20, emissive=0.7)
+ cylinder("core_collar", 3.7, 0.4, (0, 1.2, roof_z + 4.9), "copper", root, verts=20, bevel=0.06)
+ # four struts hold the crown open so the core is visible from every side
+ for i in range(4):
+ a = math.pi / 4 + i * math.pi / 2
+ box(
+ f"core_strut_{i}",
+ (0.4, 0.4, 2.4),
+ (math.cos(a) * 2.6, 1.2 + math.sin(a) * 2.6, roof_z + 6.1),
+ "steel_dark",
+ root,
+ bevel=0.05,
+ )
+ cylinder(
+ "core_orb", 1.6, 2.9, (0, 1.2, roof_z + 6.5), "core_bright", root, verts=16, emissive=3.0
+ )
+ torus("core_ring_a", 2.7, 0.16, (0, 1.2, roof_z + 6.5), "copper", root)
+ torus(
+ "core_ring_b",
+ 2.5,
+ 0.14,
+ (0, 1.2, roof_z + 6.5),
+ "core",
+ root,
+ rot=(math.radians(62), 0, 0),
+ emissive=1.4,
+ )
+ torus(
+ "core_ring_c",
+ 2.5,
+ 0.14,
+ (0, 1.2, roof_z + 6.5),
+ "core",
+ root,
+ rot=(0, math.radians(62), 0),
+ emissive=1.4,
+ )
+ cylinder("core_cap", 1.9, 0.5, (0, 1.2, roof_z + 8.3), "steel", root, verts=20, bevel=0.08)
+ cylinder("core_mast", 0.24, 2.0, (0, 1.2, roof_z + 9.5), "metal", root, verts=8)
+ box(
+ "core_beacon",
+ (0.7, 0.7, 0.7),
+ (0, 1.2, roof_z + 10.6),
+ "hazard",
+ root,
+ bevel=0.1,
+ emissive=2.8,
+ )
+
+ # ---- the sign on the front roof edge -----------------------------------
+ box(
+ "sign_board",
+ (W * 0.52, 0.55, 2.3),
+ (0, y_front + 0.5, roof_z + 2.6),
+ "sign_board",
+ root,
+ bevel=0.1,
+ )
+ box(
+ "sign_rim",
+ (W * 0.52 + 0.34, 0.32, 2.62),
+ (0, y_front + 0.66, roof_z + 2.6),
+ "core",
+ root,
+ bevel=0.08,
+ emissive=0.9,
+ )
+ text_mesh(
+ "sign_text",
+ "FOUNDRY",
+ 1.28,
+ 0.18,
+ (0, y_front + 0.2, roof_z + 2.55),
+ "core_bright",
+ root,
+ emissive=3.0,
+ )
+
+ # ---- side and back: glass bands, vents, service door --------------------
+ for sx in (-1, 1):
+ box(
+ f"glass_band_{'l' if sx < 0 else 'r'}",
+ (0.18, D * 0.62, 1.4),
+ (sx * (W / 2 + 0.03), 0.8, PL + 4.1),
+ "glass",
+ root,
+ bevel=0.02,
+ emissive=0.4,
+ )
+ for i, x in enumerate((-4.6, 4.6)):
+ cylinder(f"vent_{i}", 0.55, 1.8, (x, D / 2 - 1.5, roof_z + 1.1), "metal", root, verts=12)
+ box(
+ "back_door",
+ (1.8, 0.18, 2.6),
+ (W * 0.28, D / 2 + 0.06, PL + 1.3),
+ "steel_dark",
+ root,
+ bevel=0.04,
+ )
+
+ # ---- forecourt: bollards, part racks, crates ---------------------------
+ for sx in (-1, 1):
+ bx = sx * 4.3
+ cylinder(
+ f"bollard_{'l' if sx < 0 else 'r'}",
+ 0.3,
+ 1.5,
+ (bx, y_front - 7.4, PL + 0.6),
+ "steel_dark",
+ root,
+ verts=10,
+ )
+ box(
+ f"bollard_lamp_{'l' if sx < 0 else 'r'}",
+ (0.5, 0.5, 0.34),
+ (bx, y_front - 7.4, PL + 1.45),
+ "hazard",
+ root,
+ bevel=0.06,
+ emissive=2.0,
+ )
+ box(
+ "rack_frame",
+ (3.4, 1.2, 2.6),
+ (-W / 2 + 2.0, y_front - 2.4, PL + 1.3),
+ "steel_dark",
+ root,
+ bevel=0.06,
+ )
+ for i in range(2):
+ box(
+ f"rack_part_{i}",
+ (2.6, 0.9, 0.5),
+ (-W / 2 + 2.0, y_front - 2.4, PL + 0.75 + i * 1.1),
+ "copper" if i == 0 else "core",
+ root,
+ bevel=0.06,
+ emissive=1.2 if i == 1 else 0.0,
+ )
+ box(
+ "crate_a", (1.2, 1.2, 1.2), (W / 2 - 2.2, y_front - 2.6, PL + 0.6), "wood", root, bevel=0.06
+ )
+ box(
+ "crate_b",
+ (0.95, 0.95, 0.95),
+ (W / 2 - 2.2, y_front - 2.6, PL + 1.68),
+ "wood_dark",
+ root,
+ bevel=0.06,
+ )
+ box(
+ "crate_c",
+ (1.0, 1.0, 1.0),
+ (W / 2 - 3.6, y_front - 2.2, PL + 0.5),
+ "steel",
+ root,
+ bevel=0.06,
+ )
+ return root
+
+
+BUILDERS = {"plugin-docks": build_plugin_docks, "agent-foundry": build_agent_foundry}
# ---------------------------------------------------------------------------
@@ -468,16 +970,22 @@ def export_glb(root: bpy.types.Object, out_dir: Path) -> Path:
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)."""
+def render_preview(
+ root: bpy.types.Object, path: Path, ortho: float = 30.0, yaw_deg: float = 45.0
+) -> None:
+ """A dimetric preview from the island's camera angle (50° pitch, 45° yaw).
+
+ `ortho` is the ground width the frame shows; give a wide building more.
+ `yaw_deg` swings the camera around so a facade can be checked head on.
+ """
scene = bpy.context.scene
cam_data = bpy.data.cameras.new("kit_preview_cam")
cam_data.type = "ORTHO"
- cam_data.ortho_scale = 30
+ cam_data.ortho_scale = ortho
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)
+ pitch, yaw = math.radians(50), math.radians(yaw_deg)
cam.location = (
dist * math.cos(pitch) * math.sin(yaw),
-dist * math.cos(pitch) * math.cos(yaw),
@@ -519,6 +1027,8 @@ def main(argv: list[str]) -> None:
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("--preview-scale", type=float, default=30.0)
+ parser.add_argument("--preview-yaw", type=float, default=45.0)
parser.add_argument(
"--keep-scene", action="store_true", help="do not clear the scene first (MCP inner loop)"
)
@@ -529,7 +1039,7 @@ def main(argv: list[str]) -> None:
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))
+ render_preview(root, Path(args.preview), args.preview_scale, args.preview_yaw)
print(f"preview {args.preview}")