diff --git a/concept-art/default-art-design-v1/characters/hermes/idle-mask.png b/concept-art/default-art-design-v1/characters/hermes/idle-mask.png new file mode 100644 index 0000000..0b8cbff Binary files /dev/null and b/concept-art/default-art-design-v1/characters/hermes/idle-mask.png differ diff --git a/concept-art/default-art-design-v1/characters/hermes/idle.png b/concept-art/default-art-design-v1/characters/hermes/idle.png new file mode 100644 index 0000000..09bb1f2 Binary files /dev/null and b/concept-art/default-art-design-v1/characters/hermes/idle.png differ diff --git a/concept-art/default-art-design-v1/characters/hermes/locked-mask.png b/concept-art/default-art-design-v1/characters/hermes/locked-mask.png new file mode 100644 index 0000000..3ba4bf9 Binary files /dev/null and b/concept-art/default-art-design-v1/characters/hermes/locked-mask.png differ diff --git a/concept-art/default-art-design-v1/characters/hermes/locked.png b/concept-art/default-art-design-v1/characters/hermes/locked.png new file mode 100644 index 0000000..73bc240 Binary files /dev/null and b/concept-art/default-art-design-v1/characters/hermes/locked.png differ diff --git a/concept-art/default-art-design-v1/characters/hermes/working-mask.png b/concept-art/default-art-design-v1/characters/hermes/working-mask.png new file mode 100644 index 0000000..28f6db4 Binary files /dev/null and b/concept-art/default-art-design-v1/characters/hermes/working-mask.png differ diff --git a/concept-art/default-art-design-v1/characters/hermes/working.png b/concept-art/default-art-design-v1/characters/hermes/working.png new file mode 100644 index 0000000..549845b Binary files /dev/null and b/concept-art/default-art-design-v1/characters/hermes/working.png differ diff --git a/concept-art/default-art-design-v1/source/build.py b/concept-art/default-art-design-v1/source/build.py index 4a6b63c..91d3de2 100644 --- a/concept-art/default-art-design-v1/source/build.py +++ b/concept-art/default-art-design-v1/source/build.py @@ -7,7 +7,7 @@ WEB = PACK.parent.parent / "web" / "skins" / "guild" BRAND = PACK.parent.parent / "web" / "brand" GEN = Path("E:/projects/local-image-studio/scripts/gen.py") -PROVIDERS = ["anthropic", "docker", "google", "openai", "shell", "xai", "terminal-ai-chat"] +PROVIDERS = ["anthropic", "docker", "google", "openai", "shell", "xai", "terminal-ai-chat", "hermes"] STATES = ["idle", "working", "locked"] CHARACTER_WIDTH = 640 PROPS = { diff --git a/concept-art/gnomeland-skin/characters/hermes/idle-mask.png b/concept-art/gnomeland-skin/characters/hermes/idle-mask.png new file mode 100644 index 0000000..d6b7571 Binary files /dev/null and b/concept-art/gnomeland-skin/characters/hermes/idle-mask.png differ diff --git a/concept-art/gnomeland-skin/characters/hermes/idle.png b/concept-art/gnomeland-skin/characters/hermes/idle.png new file mode 100644 index 0000000..ed94479 Binary files /dev/null and b/concept-art/gnomeland-skin/characters/hermes/idle.png differ diff --git a/concept-art/gnomeland-skin/characters/hermes/locked-mask.png b/concept-art/gnomeland-skin/characters/hermes/locked-mask.png new file mode 100644 index 0000000..56afe8e Binary files /dev/null and b/concept-art/gnomeland-skin/characters/hermes/locked-mask.png differ diff --git a/concept-art/gnomeland-skin/characters/hermes/locked.png b/concept-art/gnomeland-skin/characters/hermes/locked.png new file mode 100644 index 0000000..5e2631f Binary files /dev/null and b/concept-art/gnomeland-skin/characters/hermes/locked.png differ diff --git a/concept-art/gnomeland-skin/characters/hermes/working-mask.png b/concept-art/gnomeland-skin/characters/hermes/working-mask.png new file mode 100644 index 0000000..0fee6f9 Binary files /dev/null and b/concept-art/gnomeland-skin/characters/hermes/working-mask.png differ diff --git a/concept-art/gnomeland-skin/characters/hermes/working.png b/concept-art/gnomeland-skin/characters/hermes/working.png new file mode 100644 index 0000000..91d89e9 Binary files /dev/null and b/concept-art/gnomeland-skin/characters/hermes/working.png differ diff --git a/concept-art/gnomeland-skin/source/build.py b/concept-art/gnomeland-skin/source/build.py index 1a6822c..10317a0 100644 --- a/concept-art/gnomeland-skin/source/build.py +++ b/concept-art/gnomeland-skin/source/build.py @@ -9,7 +9,7 @@ PACK = Path(__file__).resolve().parent.parent WEB = PACK.parent.parent / "web" / "skins" / "gnomeland" GEN = Path("E:/projects/local-image-studio/scripts/gen.py") -PROVIDERS = {"anthropic": "#dd7a3e", "openai": "#36b86f", "google": "#4d84e6", "xai": "#2cc3d3", "shell": "#9a6cf0", "docker": "#2496ed", "terminal-ai-chat": "#C8983A"} +PROVIDERS = {"anthropic": "#dd7a3e", "openai": "#36b86f", "google": "#4d84e6", "xai": "#2cc3d3", "shell": "#9a6cf0", "docker": "#2496ed", "terminal-ai-chat": "#C8983A", "hermes": "#0000F2"} STATES = ["idle", "working", "locked"] CHARACTER_WIDTH = 640 # The square around each provider's head in its idle art (1056×1408), for the provider icon. diff --git a/concept-art/goblinville-skin/characters/hermes/idle-mask.png b/concept-art/goblinville-skin/characters/hermes/idle-mask.png new file mode 100644 index 0000000..0005b20 Binary files /dev/null and b/concept-art/goblinville-skin/characters/hermes/idle-mask.png differ diff --git a/concept-art/goblinville-skin/characters/hermes/idle.png b/concept-art/goblinville-skin/characters/hermes/idle.png new file mode 100644 index 0000000..28d5e1b Binary files /dev/null and b/concept-art/goblinville-skin/characters/hermes/idle.png differ diff --git a/concept-art/goblinville-skin/characters/hermes/locked-mask.png b/concept-art/goblinville-skin/characters/hermes/locked-mask.png new file mode 100644 index 0000000..8c5d20e Binary files /dev/null and b/concept-art/goblinville-skin/characters/hermes/locked-mask.png differ diff --git a/concept-art/goblinville-skin/characters/hermes/locked.png b/concept-art/goblinville-skin/characters/hermes/locked.png new file mode 100644 index 0000000..9203033 Binary files /dev/null and b/concept-art/goblinville-skin/characters/hermes/locked.png differ diff --git a/concept-art/goblinville-skin/characters/hermes/working-mask.png b/concept-art/goblinville-skin/characters/hermes/working-mask.png new file mode 100644 index 0000000..d692fe3 Binary files /dev/null and b/concept-art/goblinville-skin/characters/hermes/working-mask.png differ diff --git a/concept-art/goblinville-skin/characters/hermes/working.png b/concept-art/goblinville-skin/characters/hermes/working.png new file mode 100644 index 0000000..26a0e65 Binary files /dev/null and b/concept-art/goblinville-skin/characters/hermes/working.png differ diff --git a/concept-art/goblinville-skin/source/build.py b/concept-art/goblinville-skin/source/build.py index 377ded0..099fe78 100644 --- a/concept-art/goblinville-skin/source/build.py +++ b/concept-art/goblinville-skin/source/build.py @@ -9,7 +9,7 @@ PACK = Path(__file__).resolve().parent.parent WEB = PACK.parent.parent / "web" / "skins" / "goblinville" GEN = Path("E:/projects/local-image-studio/scripts/gen.py") -PROVIDERS = {"anthropic": "#dd7a3e", "openai": "#36b86f", "google": "#4d84e6", "xai": "#2cc3d3", "shell": "#9a6cf0", "docker": "#2496ed", "terminal-ai-chat": "#C8983A"} +PROVIDERS = {"anthropic": "#dd7a3e", "openai": "#36b86f", "google": "#4d84e6", "xai": "#2cc3d3", "shell": "#9a6cf0", "docker": "#2496ed", "terminal-ai-chat": "#C8983A", "hermes": "#0000F2"} STATES = ["idle", "working", "locked"] CHARACTER_WIDTH = 640 # The square around each provider's head in its idle art (1056×1408), for the provider icon. diff --git a/concept-art/grove-skin/characters/hermes/idle-mask.png b/concept-art/grove-skin/characters/hermes/idle-mask.png new file mode 100644 index 0000000..acf7915 Binary files /dev/null and b/concept-art/grove-skin/characters/hermes/idle-mask.png differ diff --git a/concept-art/grove-skin/characters/hermes/idle.png b/concept-art/grove-skin/characters/hermes/idle.png new file mode 100644 index 0000000..c3bbc2b Binary files /dev/null and b/concept-art/grove-skin/characters/hermes/idle.png differ diff --git a/concept-art/grove-skin/characters/hermes/locked-mask.png b/concept-art/grove-skin/characters/hermes/locked-mask.png new file mode 100644 index 0000000..170f35a Binary files /dev/null and b/concept-art/grove-skin/characters/hermes/locked-mask.png differ diff --git a/concept-art/grove-skin/characters/hermes/locked.png b/concept-art/grove-skin/characters/hermes/locked.png new file mode 100644 index 0000000..7e78f4e Binary files /dev/null and b/concept-art/grove-skin/characters/hermes/locked.png differ diff --git a/concept-art/grove-skin/characters/hermes/working-mask.png b/concept-art/grove-skin/characters/hermes/working-mask.png new file mode 100644 index 0000000..5d6ffac Binary files /dev/null and b/concept-art/grove-skin/characters/hermes/working-mask.png differ diff --git a/concept-art/grove-skin/characters/hermes/working.png b/concept-art/grove-skin/characters/hermes/working.png new file mode 100644 index 0000000..c2a2029 Binary files /dev/null and b/concept-art/grove-skin/characters/hermes/working.png differ diff --git a/concept-art/grove-skin/source/build.py b/concept-art/grove-skin/source/build.py index 6bdc296..84b0be0 100644 --- a/concept-art/grove-skin/source/build.py +++ b/concept-art/grove-skin/source/build.py @@ -9,7 +9,7 @@ PACK = Path(__file__).resolve().parent.parent WEB = PACK.parent.parent / "web" / "skins" / "grove" GEN = Path("E:/projects/local-image-studio/scripts/gen.py") -PROVIDERS = {"anthropic": "#d97757", "openai": "#4caf6e", "google": "#4a9be8", "xai": "#2fb8c6", "shell": "#9a7ae0", "docker": "#2496ed", "terminal-ai-chat": "#C8983A"} +PROVIDERS = {"anthropic": "#d97757", "openai": "#4caf6e", "google": "#4a9be8", "xai": "#2fb8c6", "shell": "#9a7ae0", "docker": "#2496ed", "terminal-ai-chat": "#C8983A", "hermes": "#0000F2"} STATES = ["idle", "working", "locked"] CHARACTER_WIDTH = 640 # The square around each provider's head in its idle art (1056×1408), for the provider icon. diff --git a/concept-art/hermes-yard/ART.md b/concept-art/hermes-yard/ART.md new file mode 100644 index 0000000..08685b4 --- /dev/null +++ b/concept-art/hermes-yard/ART.md @@ -0,0 +1,18 @@ +# Hermes Agent's wings + +In every Yard, Hermes Agent's hall and character are the Shell's, finished +in white and Hermes blue (`#0000f2`) by the renderer, and the character wears +the wings of Hermes on its head. The wings are `web/yard/assets/hermes_wings.glb`. + +They come from the Winged Orbital Hacker, the Shell piece of the Mount +Olympus community theme, made in Agent Guild: Builders and Agent Guild: +Studio (CC BY 4.0). `wings.mjs` cuts its head wings out, leaves the ankle +wings, colours the trim Hermes blue and records the head they were made for: + +```sh +node concept-art/hermes-yard/wings.mjs +``` + +The Yard fits them to each character's `Head` bone when it loads, measured +from the vertices that follow the head in the bind pose, so any world, and +any Shell piece with a `Head` bone, gets them without a model of its own. diff --git a/concept-art/hermes-yard/wings.mjs b/concept-art/hermes-yard/wings.mjs new file mode 100644 index 0000000..89fe72f --- /dev/null +++ b/concept-art/hermes-yard/wings.mjs @@ -0,0 +1,97 @@ +// Cuts the head wings out of the Winged Orbital Hacker (the Mount Olympus +// theme's Shell piece) into web/yard/assets/hermes_wings.glb, the wings the +// Yard fits to the head of Hermes Agent's character in every world: +// node concept-art/hermes-yard/wings.mjs +// The wings keep the positions they had on the hacker, in its bind pose, and +// the file records that head's bounds (extras.head) so the Yard can fit them +// to another head. The trim takes Hermes Agent's blue. +import { NodeIO, Document } from '@gltf-transform/core'; +import { ALL_EXTENSIONS } from '@gltf-transform/extensions'; +import { fileURLToPath } from 'node:url'; + +const source = process.argv[2]; +if (!source) throw new Error('Usage: node concept-art/hermes-yard/wings.mjs '); +const out = fileURLToPath(new URL('../../web/yard/assets/hermes_wings.glb', import.meta.url)); +const COLORS = { hermes_white: [0.893, 0.873, 0.813], hermes_trim: [0, 0, 0.887] }; // #0000f2, linear +const HEAD_WEIGHT = 0.5; + +const io = new NodeIO().registerExtensions(ALL_EXTENSIONS); +const doc = await io.read(source); +const root = doc.getRoot(); +const node = root.listNodes().find((n) => n.getMesh() && n.getSkin()); +const skin = node.getSkin(); +const head = skin.listJoints().findIndex((joint) => joint.getName() === 'Head'); +if (head < 0) throw new Error('The character has no Head bone.'); +const world = node.getWorldMatrix(); +const apply = (m, [x, y, z], w = 1) => [ + m[0] * x + m[4] * y + m[8] * z + m[12] * w, + m[1] * x + m[5] * y + m[9] * z + m[13] * w, + m[2] * x + m[6] * y + m[10] * z + m[14] * w, +]; +// The share of a vertex that follows the head. +const onHead = (prim, i) => { + const joints = prim.getAttribute('JOINTS_0').getElement(i, []), weights = prim.getAttribute('WEIGHTS_0').getElement(i, []); + return joints.reduce((sum, joint, k) => sum + (joint === head ? weights[k] : 0), 0); +}; + +const box = { min: [Infinity, Infinity, Infinity], max: [-Infinity, -Infinity, -Infinity] }; +const wings = []; +for (const prim of node.getMesh().listPrimitives()) { + const name = prim.getMaterial()?.getName(); + const position = prim.getAttribute('POSITION'); + if (name in COLORS) { + // Only wings that ride on the head; the ankle wings stay behind. + if (onHead(prim, 0) >= HEAD_WEIGHT) wings.push({ prim, name }); + continue; + } + for (let i = 0; i < position.getCount(); i++) { + if (onHead(prim, i) < HEAD_WEIGHT) continue; + const p = apply(world, position.getElement(i, [])); + for (let k = 0; k < 3; k++) { box.min[k] = Math.min(box.min[k], p[k]); box.max[k] = Math.max(box.max[k], p[k]); } + } +} +if (!wings.length) throw new Error('No head wings found.'); + +const outDoc = new Document(); +const buffer = outDoc.createBuffer(); +const materials = {}; +for (const [name, color] of Object.entries(COLORS)) { + materials[name] = outDoc.createMaterial(name).setBaseColorFactor([...color, 1]).setMetallicFactor(0) + .setRoughnessFactor(name === 'hermes_trim' ? 0.5 : 0.75).setDoubleSided(true); +} +// One anchor for each side, an empty node placed at the wing's root (its point +// nearest the head's middle, at its own height and depth) so the Yard and the +// Professional render can move the root and scale the wing about it. The +// geometry hangs from the anchor on a child node, as each hall's does: the +// Yard optimizer rewrites a mesh node's transform when it quantizes it, and +// leaves the anchor as it is. +const wingRoot = outDoc.createNode('hermes_wings').setExtras({ head: box }); +const mid = box.min.map((v, k) => (v + box.max[k]) / 2); +for (const side of [1, -1]) { + const parts = wings.filter(({ prim }) => Math.sign(apply(world, prim.getAttribute('POSITION').getElement(0, []))[0] - mid[0]) === side); + const lo = [Infinity, Infinity, Infinity], hi = [-Infinity, -Infinity, -Infinity]; + for (const { prim } of parts) { + const position = prim.getAttribute('POSITION'); + for (let i = 0; i < position.getCount(); i++) apply(world, position.getElement(i, [])).forEach((v, k) => { lo[k] = Math.min(lo[k], v); hi[k] = Math.max(hi[k], v); }); + } + const anchor = [side > 0 ? lo[0] : hi[0], (lo[1] + hi[1]) / 2, (lo[2] + hi[2]) / 2]; + const mesh = outDoc.createMesh(side > 0 ? 'wing_left' : 'wing_right'); + for (const { prim, name } of parts) { + const copy = (attribute, map) => { + const array = new Float32Array(attribute.getCount() * 3); + for (let i = 0; i < attribute.getCount(); i++) array.set(map(attribute.getElement(i, [])), i * 3); + return outDoc.createAccessor().setType('VEC3').setArray(array).setBuffer(buffer); + }; + const out = outDoc.createPrimitive().setMaterial(materials[name]) + .setAttribute('POSITION', copy(prim.getAttribute('POSITION'), (p) => apply(world, p).map((v, k) => v - anchor[k]))); + const normal = prim.getAttribute('NORMAL'); + if (normal) out.setAttribute('NORMAL', copy(normal, (n) => { const v = apply(world, n, 0), l = Math.hypot(...v) || 1; return v.map((c) => c / l); })); + const indices = prim.getIndices(); + if (indices) out.setIndices(outDoc.createAccessor().setType('SCALAR').setArray(new Uint32Array(indices.getArray())).setBuffer(buffer)); + mesh.addPrimitive(out); + } + wingRoot.addChild(outDoc.createNode(mesh.getName()).setTranslation(anchor).addChild(outDoc.createNode(mesh.getName() + '_mesh').setMesh(mesh))); +} +outDoc.createScene('hermes_wings').addChild(wingRoot); +await io.write(out, outDoc); +console.log(`${wings.length} wing parts; head ${box.min.map((v) => v.toFixed(3))} to ${box.max.map((v) => v.toFixed(3))}; wrote ${out}`); diff --git a/concept-art/orbital-skin/characters/hermes/idle-mask.png b/concept-art/orbital-skin/characters/hermes/idle-mask.png new file mode 100644 index 0000000..0d55ed3 Binary files /dev/null and b/concept-art/orbital-skin/characters/hermes/idle-mask.png differ diff --git a/concept-art/orbital-skin/characters/hermes/idle.png b/concept-art/orbital-skin/characters/hermes/idle.png new file mode 100644 index 0000000..54d1e7e Binary files /dev/null and b/concept-art/orbital-skin/characters/hermes/idle.png differ diff --git a/concept-art/orbital-skin/characters/hermes/locked-mask.png b/concept-art/orbital-skin/characters/hermes/locked-mask.png new file mode 100644 index 0000000..c648519 Binary files /dev/null and b/concept-art/orbital-skin/characters/hermes/locked-mask.png differ diff --git a/concept-art/orbital-skin/characters/hermes/locked.png b/concept-art/orbital-skin/characters/hermes/locked.png new file mode 100644 index 0000000..e43487c Binary files /dev/null and b/concept-art/orbital-skin/characters/hermes/locked.png differ diff --git a/concept-art/orbital-skin/characters/hermes/working-mask.png b/concept-art/orbital-skin/characters/hermes/working-mask.png new file mode 100644 index 0000000..c705b13 Binary files /dev/null and b/concept-art/orbital-skin/characters/hermes/working-mask.png differ diff --git a/concept-art/orbital-skin/characters/hermes/working.png b/concept-art/orbital-skin/characters/hermes/working.png new file mode 100644 index 0000000..d4e0bbf Binary files /dev/null and b/concept-art/orbital-skin/characters/hermes/working.png differ diff --git a/concept-art/orbital-skin/source/build.py b/concept-art/orbital-skin/source/build.py index 8166ddf..59b8c94 100644 --- a/concept-art/orbital-skin/source/build.py +++ b/concept-art/orbital-skin/source/build.py @@ -9,7 +9,7 @@ PACK = Path(__file__).resolve().parent.parent WEB = PACK.parent.parent / "web" / "skins" / "orbital" GEN = Path("E:/projects/local-image-studio/scripts/gen.py") -PROVIDERS = {"anthropic": "#e0835f", "openai": "#1fd08f", "google": "#5b9cff", "xai": "#38d6e8", "shell": "#a67cf6", "docker": "#2496ed", "terminal-ai-chat": "#C8983A"} +PROVIDERS = {"anthropic": "#e0835f", "openai": "#1fd08f", "google": "#5b9cff", "xai": "#38d6e8", "shell": "#a67cf6", "docker": "#2496ed", "terminal-ai-chat": "#C8983A", "hermes": "#0000F2"} STATES = ["idle", "working", "locked"] CHARACTER_WIDTH = 640 # The square around each provider's head in its idle art (1056×1408), for the provider icon. diff --git a/concept-art/professional-skin/objects/hermes/dark-idle.png b/concept-art/professional-skin/objects/hermes/dark-idle.png new file mode 100644 index 0000000..fdf12cc Binary files /dev/null and b/concept-art/professional-skin/objects/hermes/dark-idle.png differ diff --git a/concept-art/professional-skin/objects/hermes/dark-locked.png b/concept-art/professional-skin/objects/hermes/dark-locked.png new file mode 100644 index 0000000..aded10c Binary files /dev/null and b/concept-art/professional-skin/objects/hermes/dark-locked.png differ diff --git a/concept-art/professional-skin/objects/hermes/dark-working.png b/concept-art/professional-skin/objects/hermes/dark-working.png new file mode 100644 index 0000000..cd524c7 Binary files /dev/null and b/concept-art/professional-skin/objects/hermes/dark-working.png differ diff --git a/concept-art/professional-skin/objects/hermes/light-idle.png b/concept-art/professional-skin/objects/hermes/light-idle.png new file mode 100644 index 0000000..7096bb3 Binary files /dev/null and b/concept-art/professional-skin/objects/hermes/light-idle.png differ diff --git a/concept-art/professional-skin/objects/hermes/light-locked.png b/concept-art/professional-skin/objects/hermes/light-locked.png new file mode 100644 index 0000000..ec1a5bf Binary files /dev/null and b/concept-art/professional-skin/objects/hermes/light-locked.png differ diff --git a/concept-art/professional-skin/objects/hermes/light-working.png b/concept-art/professional-skin/objects/hermes/light-working.png new file mode 100644 index 0000000..247380d Binary files /dev/null and b/concept-art/professional-skin/objects/hermes/light-working.png differ diff --git a/concept-art/professional-skin/source/scene.py b/concept-art/professional-skin/source/scene.py index df4a4f7..7383a56 100644 --- a/concept-art/professional-skin/source/scene.py +++ b/concept-art/professional-skin/source/scene.py @@ -15,6 +15,11 @@ EXTRA = {'empty': '#a3adbd'} # Polished metal instead of glass; locked is tarnished instead of frosted. METAL = {'terminal-ai-chat': {'color': '#ffd98a', 'locked': '#8a744a'}} +# White porcelain that glows Hermes blue, with the wings of Hermes (the Yard's, from +# web/yard/assets/hermes_wings.glb); locked is dull grey and glows nothing. +PORCELAIN = {'hermes': {'color': '#f2f4f8', 'glow': '#0000f2', 'locked': '#aeb3bd'}} +WINGS = PACK.parent.parent / 'web' / 'yard' / 'assets' / 'hermes_wings.glb' +WING_COLORS = {'hermes_white': (0.893, 0.873, 0.813), 'hermes_trim': (0, 0, 0.887)} # The world is not seen, but the glass reflects it: bright and white for light, deep slate for dark. THEMES = { 'light': {'top': '#ffffff', 'bottom': '#e9edf3', 'tint': 0.08, 'world': 1.0, 'key': 1400, 'fill': 350, 'rim': 500, 'glass': 1.0}, @@ -122,6 +127,30 @@ def hero_shell(): hero_terminal_ai_chat = hero_shell +def hero_hermes(): + # The shell's cube with a wing on each upper side, swept up and back. + parts = hero_shell() + before = set(bpy.data.objects) + bpy.ops.import_scene.gltf(filepath=str(WINGS)) + imported = [o for o in bpy.data.objects if o not in before] + # Each wing's anchor (an empty) is placed; its mesh hangs below it with the + # transform the Yard optimizer may have given it, which stays as it is. + anchors = [o for o in imported if o.type == 'EMPTY' and o.name.startswith(('wing_left', 'wing_right'))] + for o in anchors: + side = 1 if o.name.startswith('wing_left') else -1 + o.parent = None + # Turned to face the camera, so each wing sweeps out to its side. + o.location = (side * 0.8, 0.1, 1.5) + o.rotation_mode = 'XYZ' + o.rotation_euler = (0, math.radians(side * 10), math.radians(side * -62)) + o.scale = (2.4, 2.4, 2.4) + parts += [o, *o.children_recursive] + for o in imported: + if o not in parts: + bpy.data.objects.remove(o) + return parts + + def hero_empty(): # A blank tile standing at a slant. return [cube((2.1, 0.12, 1.4), (0, 0, 0.72), (0, 0, -22), bevel=0.05)] @@ -133,7 +162,7 @@ def hero_docker(): heroes = {} -for tool in {**TOOLS, **EXTRA, **METAL}: +for tool in {**TOOLS, **EXTRA, **METAL, **PORCELAIN}: col = bpy.data.collections.new(tool) scene.collection.children.link(col) for o in globals()[f'hero_{tool.replace("-", "_")}'](): @@ -152,7 +181,8 @@ def hero_docker(): gnode = glass.node_tree.nodes['Principled BSDF'] for col in heroes.values(): for o in col.objects: - o.data.materials.append(glass) + if o.type == 'MESH' and not o.data.materials: + o.data.materials.append(glass) fmat = bpy.data.materials.new('floor') fmat.use_nodes = True fnode = fmat.node_tree.nodes['Principled BSDF'] @@ -199,14 +229,17 @@ def light(name, loc, size): def render(tool, theme, state): th, st = THEMES[theme], STATES[state] - metal = METAL.get(tool) - color = rgb(metal[state if state == 'locked' else 'color'] if metal else LOCKED if state == 'locked' else {**TOOLS, **EXTRA}[tool]) + metal, porcelain = METAL.get(tool), PORCELAIN.get(tool) + finish = metal or porcelain + color = rgb(finish[state if state == 'locked' else 'color'] if finish else LOCKED if state == 'locked' else {**TOOLS, **EXTRA}[tool]) + # The colour the world, floor and rim light take on: the glow for porcelain. + light_color = rgb(porcelain['glow']) if porcelain and state != 'locked' else color for name, col in heroes.items(): col.hide_render = col.hide_viewport = name != tool - ramp.color_ramp.elements[0].color = (*mix(rgb(th['bottom']), color, th['tint']), 1) - ramp.color_ramp.elements[1].color = (*mix(rgb(th['top']), color, th['tint'] * 0.5), 1) + ramp.color_ramp.elements[0].color = (*mix(rgb(th['bottom']), light_color, th['tint']), 1) + ramp.color_ramp.elements[1].color = (*mix(rgb(th['top']), light_color, th['tint'] * 0.5), 1) wbg.inputs['Strength'].default_value = th['world'] - fnode.inputs['Base Color'].default_value = (*mix(rgb(th['bottom']), color, th['tint']), 1) + fnode.inputs['Base Color'].default_value = (*mix(rgb(th['bottom']), light_color, th['tint']), 1) fnode.inputs['Roughness'].default_value = 0.5 if theme == 'light' else 0.4 frosted = state == 'locked' gnode.inputs['Base Color'].default_value = (*color, 1) @@ -222,12 +255,29 @@ def render(tool, theme, state): gnode.inputs['Roughness'].default_value = 0.45 if frosted else 0.18 gnode.inputs['Coat Weight'].default_value = 0 if frosted else 0.4 gnode.inputs['Emission Strength'].default_value *= 0.5 + if porcelain: + # Locked, the wings go the same dull grey as the cube. + for wing in ('hermes_white', 'hermes_trim'): + bsdf = bpy.data.materials[wing].node_tree.nodes['Principled BSDF'] + bsdf.inputs['Base Color'].default_value = (*(color if frosted else WING_COLORS[wing]), 1) + gnode.inputs['Transmission Weight'].default_value = 0 + gnode.inputs['Roughness'].default_value = 0.5 if frosted else 0.22 + gnode.inputs['Coat Weight'].default_value = 0 if frosted else 0.8 + gnode.inputs['Subsurface Weight'].default_value = 0.15 + gnode.inputs['Emission Color'].default_value = (*light_color, 1) + gnode.inputs['Emission Strength'].default_value = st['glow'] * (0.6 if theme == 'light' else 1.6) key.data.energy = th['key'] * (1.8 if metal and theme == 'dark' else 1) fill.data.energy = th['fill'] if metal and theme == 'light': wbg.inputs['Strength'].default_value = th['world'] * 0.3 + if porcelain and theme == 'light': + # White on a white card needs the world dimmer, so its sides shade. + wbg.inputs['Strength'].default_value = th['world'] * 0.45 rim.data.energy = th['rim'] * (min(st['rim'], 1.4) if theme == 'light' else st['rim']) - rim.data.color = mix([1, 1, 1], color, 0.6) + rim.data.color = mix([1, 1, 1], light_color, 0.6) + if porcelain: + # The rim light is Hermes blue, strong enough to edge the white in blue. + rim.data.energy *= 1.6 out = out_dir / tool / f'{theme}-{state}.png' out.parent.mkdir(parents=True, exist_ok=True) scene.render.filepath = str(out) diff --git a/config/providers.optional.json b/config/providers.optional.json index f29613f..9844ad5 100644 --- a/config/providers.optional.json +++ b/config/providers.optional.json @@ -34,7 +34,7 @@ "homeVar": "HERMES_HOME", "profiles": "hermes", "resumeArgs": ["--resume", "{id}"], - "color": "#8B5CF6", + "color": "#0000F2", "monogram": "H", "install": "curl -fsSL https://hermes-agent.nousresearch.com/install.sh | bash", "docs": "https://hermes-agent.nousresearch.com/docs", diff --git a/docs/api.md b/docs/api.md index 0b37f26..db200a2 100644 --- a/docs/api.md +++ b/docs/api.md @@ -163,8 +163,10 @@ again, or is null. `reportingUpdate` is true for Hermes Agent while a profile that reports has an Agent Guild plugin of another commit than the one this Agent Guild installs; that plugin keeps reporting until it is updated. For Hermes Agent, `reportingEnabled` also stays true while a profile's report token -is still accepted after a revocation that failed, with a `reportingNote` that -says so, so turning it off can be tried again. +is still accepted though its plugin is off, as after a revocation that failed or +the plugin turned off in Hermes, with a `reportingNote` that says so, so turning +it off revokes it. A profile Agent Guild is still turning on or off counts as +neither until that change ends; one already on counts as on. `mcp` is null unless the tool is installed and Agent Guild can add its own MCP server (`agent-guild mcp`, see [mcp.md](mcp.md)) to the tool's settings: @@ -690,7 +692,7 @@ All paths are under `/api/v1`. | GET | `/yard-worlds` | | `{ yardWorlds }`: the world replacing each Yard, by skin. A world is `{ title, revision, lights }`, or `{ title, problem }` when it cannot be used, in which case the Yard shows its original. A Yard with no entry shows its original. | | PUT | `/yard-worlds/:skin` | `{ path }` | `{ yardWorlds }`: checks the `.agworld` file at `path` on the manager's computer and makes it this Yard's world, replacing any before it. 400 `world_invalid` says what is wrong and leaves the Yard unchanged; 404 `unknown_yard`; 409 `world_busy` while another install runs; 409 `worlds_unsupported` without a data folder; 500 `world_unwritable`. Its plates and skies are served at `/yard/worlds/:skin/:file`. | | DELETE | `/yard-worlds/:skin` | | `{ yardWorlds }`: deletes this Yard's world, so it shows its original. | -| GET | `/yard-pieces` | | `{ yardPieces }`: the pieces replacing each Yard's characters and companions, by skin, then by slot: a crew id (`anthropic`, `openai`, `google`, `xai`, `shell`, `docker`) or `companion`. A piece is `{ title, revision }`, or `{ title, problem }` when it cannot be used, in which case the Yard shows its original. Terminal AI Chat wears the `shell` piece, gilded. | +| GET | `/yard-pieces` | | `{ yardPieces }`: the pieces replacing each Yard's characters and companions, by skin, then by slot: a crew id (`anthropic`, `openai`, `google`, `xai`, `shell`, `docker`) or `companion`. A piece is `{ title, revision }`, or `{ title, problem }` when it cannot be used, in which case the Yard shows its original. Terminal AI Chat wears the `shell` piece, gilded, and Hermes Agent wears it in white and blue with wings on its head. | | PUT | `/yard-pieces/:skin/:slot` | `{ path }` | `{ yardPieces }`: copies the piece folder at `path` on the manager's computer and makes it this slot's piece, replacing any before it. The folder holds `piece.json` (`format: 1`, `kind` `character` or `companion`, optional `title`) and `character.glb`, or all four of `companion_0.glb` to `companion_3.glb`; the models follow the Yard's skeleton, animations and `yard` extras, and are checked by drawing them with the Yard's own loader; their sizes, joints, clip lengths and `yard` extras must fall within the limits in `src/manager/yard-piece-check.mjs` and `yardExtras` in `web/yard/model.mjs`. 400 `piece_invalid` says what is wrong and leaves the slot unchanged; 404 `unknown_yard` or `unknown_slot`; 409 `piece_busy` while another change runs; 409 `pieces_unsupported` without a data folder; 500 `piece_unwritable`. Its models are served at `/yard/pieces/:skin/:slot/:file`. | | DELETE | `/yard-pieces/:skin/:slot` | | `{ yardPieces }`: deletes this slot's piece, so it shows its original. 500 `piece_unwritable` leaves the piece in place. | | POST | `/companion/install` | | `201 { session }`: starts a session that downloads the latest Grove Companion, checks its signature, installs it and starts it. 400 `companion_unsupported` unless the manager runs on Windows or macOS; 409 `install_in_progress` while one runs. | diff --git a/src/manager/session-hooks.mjs b/src/manager/session-hooks.mjs index 8d8ea56..d60597d 100644 --- a/src/manager/session-hooks.mjs +++ b/src/manager/session-hooks.mjs @@ -540,9 +540,10 @@ export class SessionHooks { } const held = accounts.filter((account) => account.held); if (held.length) { - return `Agent reporting is not fully off: the report token of ${held.map((a) => a.label).join(', ')} is still accepted, because Agent Guild could not revoke it. Turn it off to try again.`; + return `Agent reporting is not fully off: the report token of ${held.map((a) => a.label).join(', ')} is still accepted while its Agent Guild plugin is off. Turn it off to revoke it.`; } - if (on.length && on.length < accounts.length) { + // A profile still being turned on or off is not yet a partial result. + if (!accounts.some((account) => account.changing) && on.length && on.length < accounts.length) { return `Agent reporting is on for ${on.map((a) => a.label).join(', ')}, not for ${accounts.filter((a) => !a.on).map((a) => a.label).join(', ')}. Turn it off, then on, to try again.`; } const stale = this.hermesTokens && accounts.some((account) => this.hermesTokens.stale.has(account.home)); @@ -708,7 +709,7 @@ export class SessionHooks { return { status: entry.status === 'enabled' ? 'enabled' : 'disabled', current, source: entry.source ?? null }; } - /** Installs the plugin at this Agent Guild's commit, over the one there when `force`, and checks Hermes recorded that commit. */ + /** Installs the plugin at this Agent Guild's commit, over the one there when `force`, checks Hermes recorded that commit, and returns what Hermes has. */ async _hermesInstall(provider, account, force) { const commit = this.hermesPluginCommit; await this._hermesRun(provider, account, ['plugins', 'install', HERMES_PLUGIN_SOURCE, '--ref', commit, ...(force ? ['--force'] : []), '--enable'], @@ -717,6 +718,7 @@ export class SessionHooks { if (plugin.status !== 'enabled' || !plugin.current) { throw Object.assign(new Error(`${provider.tool} reported success, but it does not record the Agent Guild plugin at commit ${commit.slice(0, 12)} as on`), { status: 502, code: 'reporting_setup_failed' }); } + return plugin; } /** Runs one home's reporting change in its setup turn, and makes any read that started before it obsolete. */ @@ -812,13 +814,16 @@ export class SessionHooks { return this.registry.accountsFor(provider).map((account) => { const plugin = this.hermesPlugins.get(account.home); const accepted = Boolean(this.hermesTokens?.get(account.home)); + // In its setup turn a profile can have an accepted token before its plugin is on, or after it is off: a step, not a result. + const changing = Boolean(this.hermesTokens?.setups.has(account.home)); return { ...account, plugin: plugin?.status ?? null, // Reporting and the plugin's commit are apart: a plugin of another commit that is on still reports. on: Boolean(plugin && accepted && plugin.status === 'enabled' && !this.hermesTokens.stale.has(account.home)), - // A token still accepted for a plugin that is not on: a revocation that failed, so reporting is not off. - held: Boolean(plugin && accepted && plugin.status !== 'enabled'), + // A token still accepted for a plugin that is not on, outside a change: reporting is not off until it is revoked. + held: Boolean(plugin && accepted && plugin.status !== 'enabled' && !changing), + changing, outdated: Boolean(this.hermesPluginCommit && plugin && plugin.status !== 'missing' && !plugin.current), }; }); @@ -838,18 +843,26 @@ export class SessionHooks { // A profile that turns on gets this Agent Guild's plugin; one that already reports keeps its own until updated. const install = state === 'missing' || (!wasOn && Boolean(this.hermesPluginCommit) && !plugin.current); if (install && !this.hermesPluginCommit) throw this._noPluginCommit(); + let now = null; try { await this._hermesHomeChecked(provider, account); await this.hermesTokens.ensure(account.home, this.getApiUrl()).catch((err) => { throw Object.assign(new Error(`Agent Guild could not save its reporting settings (${err.code || err.message})`), { status: 500, code: 'reporting_setup_failed' }); }); await this._hermesRun(provider, account, ['config', 'set', HERMES_TOKEN_FILE_VAR, this.hermesTokens.file(account.home)], "save Agent Guild's reporting settings"); - if (install) await this._hermesInstall(provider, account, state !== 'missing'); + if (install) now = await this._hermesInstall(provider, account, state !== 'missing'); else if (state === 'disabled') await this._hermesRun(provider, account, ['plugins', 'enable', HERMES_PLUGIN], 'turn on the Agent Guild plugin'); + else now = plugin; } catch (err) { if (!wasOn) await this.hermesTokens.remove(account.home).catch((cause) => console.error(`[hermes] could not revoke the report token of ${account.home}: ${cause.code || cause.message}`)); throw err; } + // What this profile has once it is on, so the card shows it reporting while other profiles are still turning on. + now ??= await this._hermesPlugin(provider, account).catch(() => null); + if (now && JSON.stringify(this.hermesPlugins.get(account.home)) !== JSON.stringify(now)) { + this.hermesPlugins.set(account.home, now); + this.registry.emit?.('updated'); + } return; } if (state === 'enabled' || !plugin) { diff --git a/tests/browser/yard.mjs b/tests/browser/yard.mjs index 7c18b8f..b7f4889 100644 --- a/tests/browser/yard.mjs +++ b/tests/browser/yard.mjs @@ -1,5 +1,7 @@ import test from 'node:test'; import { EventEmitter } from 'node:events'; +import { execFile } from 'node:child_process'; +import { promisify } from 'node:util'; import { fileURLToPath } from 'node:url'; import assert from 'node:assert/strict'; import fs from 'node:fs/promises'; @@ -1024,6 +1026,56 @@ test('a gilded card gets a gold hall and character of its own, and Shell keeps i assert.deepEqual(b.errors,[]); }); +// In-page: a wing's bounds in its character's own space, from its vertices as drawn. +const WING_BOX=`const wingBox=(unit,wing)=>{unit.updateMatrixWorld(true);const V=unit.position.constructor,lo=[Infinity,Infinity,Infinity],hi=[-Infinity,-Infinity,-Infinity]; + wing.traverse(n=>{if(!n.isMesh)return;const p=n.geometry.attributes.position;for(let i=0;i{lo[k]=Math.min(lo[k],v);hi[k]=Math.max(hi[k],v);});}); + return {min:lo,max:hi,center:new V((lo[0]+hi[0])/2,(lo[1]+hi[1])/2,(lo[2]+hi[2])/2)};};`; +test('Hermes Agent gets a white and blue hall and character of its own, with wings on its head in every world, and Shell keeps its look',options,async t=>{ + const {f,b}=await setup(t); + const shell=f.providers.find(p=>p.id==='shell'),gold={...shell,id:'terminal-ai-chat',tool:'Terminal AI Chat'},hermes={...shell,id:'hermes',tool:'Hermes Agent'}; + const base=[...f.data.values()][0]; + const sessions=[{...base,id:'hermes',provider:hermes,agents:[],shells:[]},{...base,id:'gold',provider:gold,agents:[],shells:[]},{...base,id:'plain',provider:shell,agents:[],shells:[]}]; + const looks=await b.evaluate(`(async()=>{ + const {YardRenderer}=await import('/yard/renderer.js'); + const host=document.createElement('div'),labels=document.createElement('div'); + host.style.cssText='position:fixed;width:900px;height:700px;top:0;left:0';host.append(labels);document.body.append(host); + window.__renderer=new YardRenderer(host,labels,{select(){},open(){}}); + const materials=root=>{const all=new Set();root.traverse(n=>{if(n.isMesh)for(const m of [n.material].flat())all.add(m);});return [...all];}; + const plain=m=>m.onBeforeCompile===Object.getPrototypeOf(m).onBeforeCompile; + const isWing=m=>/^hermes_(white|trim)$/.test(m.name); + ${WING_BOX} + const bare=root=>materials(root).filter(m=>!/^(window|magic|officeGlass)$/.test(m.name)&&!isWing(m)); + const worlds={}; + for(const world of ['guild','orbital','grove','professional','goblinville','gnomeland']){ + await __renderer.setWorld(world,'dark');__renderer.update(${q([...f.providers,gold,hermes])},${q(sessions)}); + while(![...__renderer.units.values()].every(u=>u.loaded))await new Promise(requestAnimationFrame); + const unit=__renderer.units.get('hermes').model,shellUnit=__renderer.units.get('plain').model,goldUnit=__renderer.units.get('gold').model; + const hall=__renderer.halls.get('hermes').root,shellHall=__renderer.halls.get('shell').root; + const worn=[];unit.traverse(n=>{if(n.name==='hermes_wings')worn.push(n);}); + unit.updateMatrixWorld(true); + // In the character's own space, where its sides are left and right. + const local=o=>unit.worldToLocal(o.getWorldPosition(new (unit.position.constructor)())); + const head=local(unit.getObjectByName('Head')),tips=worn.flatMap(w=>w.children.map(wing=>wingBox(unit,wing).center)); + worlds[world]={ + hallPlated:bare(hall).length>0&&bare(hall).every(m=>!plain(m))&&!materials(hall).some(m=>materials(shellHall).includes(m)), + unitPlated:bare(unit).every(m=>!plain(m))&&!materials(unit).some(m=>materials(shellUnit).includes(m)), + finishOwn:bare(unit)[0].onBeforeCompile!==bare(goldUnit)[0].onBeforeCompile, + wings:worn.length===1&&worn[0].parent.name==='Head'&&worn[0].children.length===2, + wingsKeepTheirColours:materials(worn[0]).every(plain), + // One wing on each side of the head, near it. + sides:tips.length===2&&Math.sign(tips[0].x-head.x)!==Math.sign(tips[1].x-head.x)&&tips.every(p=>p.distanceTo(head)<1.5), + shellPlain:[...materials(shellHall),...materials(shellUnit)].every(plain)&&!shellUnit.getObjectByName('hermes_wings'), + }; + } + return worlds; + })()`); + const expected={hallPlated:true,unitPlated:true,finishOwn:true,wings:true,wingsKeepTheirColours:true,sides:true,shellPlain:true}; + assert.deepEqual(looks,Object.fromEntries(Object.keys(looks).map(world=>[world,expected]))); + assert.equal(Object.keys(looks).length,6); + await b.evaluate('__renderer.dispose()'); + assert.deepEqual(b.errors,[]); +}); + test('a capture draws twice the stage in tiles without the selection ring, and leaves the live view as it was even when it fails',options,async t=>{ const {f,b}=await setup(t); const sessions=[...f.data.values()]; @@ -2520,3 +2572,78 @@ test('the Vibes Mode button stays on across Yards and reloads, and reduced motio assert.deepEqual(await b.evaluate(state),['false',false,'off']); assert.deepEqual(b.errors,[]); }); + +test('a provider whose id names an inherited property, such as constructor, gets the shell look and draws without errors',options,async t=>{ + const {f,b}=await setup(t); + const shell=f.providers.find(p=>p.id==='shell'),odd={...shell,id:'constructor',tool:'Constructor'}; + const base=[...f.data.values()][0]; + const looks=await b.evaluate(`(async()=>{ + const {YardRenderer}=await import('/yard/renderer.js'); + const host=document.createElement('div'),labels=document.createElement('div'); + host.style.cssText='position:fixed;width:900px;height:700px;top:0;left:0';host.append(labels);document.body.append(host); + window.__renderer=new YardRenderer(host,labels,{select(){},open(){}}); + await __renderer.setWorld('guild','dark');__renderer.update(${q([...f.providers,odd])},${q([{...base,id:'odd',provider:odd,agents:[],shells:[]}])}); + while(!__renderer.units.get('odd').loaded)await new Promise(requestAnimationFrame); + __renderer.renderer.render(__renderer.scene,__renderer.camera); + const materials=root=>{const all=new Set();root.traverse(n=>{if(n.isMesh)for(const m of [n.material].flat())all.add(m);});return [...all];}; + const plain=m=>m.onBeforeCompile===Object.getPrototypeOf(m).onBeforeCompile; + const unit=__renderer.units.get('odd').model,hall=__renderer.halls.get('constructor').root; + return {loaded:true,hallPlain:materials(hall).every(plain),unitPlain:materials(unit).every(plain),wings:!!unit.getObjectByName('hermes_wings')}; + })()`); + assert.deepEqual(looks,{loaded:true,hallPlain:true,unitPlain:true,wings:false}); + await b.evaluate('__renderer.dispose()'); + assert.deepEqual(b.errors,[]); +}); + +test('Hermes Agent wears its wings the same before and after the Yard optimizer quantizes them',{...options,timeout:240000},async t=>{ + // Runs the real optimizer, unchanged, on a copy of the wings beside a copy of the model it reads. + const repo=fileURLToPath(new URL('../../',import.meta.url)); + const work=await fs.mkdtemp(path.join(repo,'.cache','yard-optimize-'));t.after(()=>fs.rm(work,{recursive:true,force:true})); + await fs.mkdir(path.join(work,'scripts'));await fs.mkdir(path.join(work,'web','yard','assets'),{recursive:true}); + await fs.copyFile(path.join(repo,'scripts','optimize-yard.mjs'),path.join(work,'scripts','optimize-yard.mjs')); + await fs.copyFile(path.join(repo,'web','yard','model.mjs'),path.join(work,'web','yard','model.mjs')); + const original=await fs.readFile(path.join(repo,'web','yard','assets','hermes_wings.glb')); + await fs.writeFile(path.join(work,'web','yard','assets','hermes_wings.glb'),original); + await promisify(execFile)(process.execPath,[path.join(work,'scripts','optimize-yard.mjs'),'hermes_wings'],{cwd:repo}); + const optimized=await fs.readFile(path.join(work,'web','yard','assets','hermes_wings.glb')); + // The optimizer did quantize the wings and moved their decoding into the wings' mesh nodes. The + // anchors the Yard and the Professional render place come through as they were, with no mesh. + const json=glb=>JSON.parse(glb.toString('utf8',20,20+glb.readUInt32LE(12))); + assert.ok(json(optimized).extensionsUsed?.includes('KHR_mesh_quantization')); + assert.ok(json(optimized).nodes.some(node=>node.mesh!==undefined&&node.scale&&node.scale.some(v=>Math.abs(v-1)>1e-3))); + const anchors=glb=>json(glb).nodes.filter(node=>/^wing_(left|right)$/.test(node.name)); + assert.equal(anchors(original).length,2); + assert.deepEqual(anchors(optimized),anchors(original)); + assert.ok(anchors(optimized).every(node=>node.mesh===undefined&&node.scale===undefined&&node.children?.length===1)); + const {f,b}=await setup(t); + const shell=f.providers.find(p=>p.id==='shell'),hermes={...shell,id:'hermes',tool:'Hermes Agent'}; + const base=[...f.data.values()][0]; + const worn=async glb=>b.evaluate(`(async()=>{ + const T=await import('/yard/vendor/engine.js'),{YardRenderer}=await import('/yard/renderer.js'); + ${WING_BOX} + const host=document.createElement('div'),labels=document.createElement('div'); + host.style.cssText='position:fixed;width:900px;height:700px;top:0;left:0';host.append(labels);document.body.append(host); + const r=new YardRenderer(host,labels,{select(){},open(){}}); + const bytes=Uint8Array.from(atob(${q(glb.toString('base64'))}),c=>c.charCodeAt(0)); + r.cache.set('hermes_wings',new T.GLTFLoader().parseAsync(bytes.buffer,'')); + const out={}; + for(const world of ['guild','orbital','grove']){ + await r.setWorld(world,'dark');r.update(${q([...f.providers,hermes])},${q([{...base,id:'hermes',provider:hermes,agents:[],shells:[]}])}); + while(!r.units.get('hermes').loaded)await new Promise(requestAnimationFrame); + const unit=r.units.get('hermes').model,wings=unit.getObjectByName('hermes_wings'); + out[world]=wings.children.map(wing=>{const {min,max}=wingBox(unit,wing);return {min,max};}); + } + r.dispose();host.remove(); + return out; + })()`); + const before=await worn(original),after=await worn(optimized); + for(const world of Object.keys(before)){ + assert.equal(after[world].length,2,world); + before[world].forEach((wing,i)=>{ + const height=wing.max[1]-wing.min[1]; + assert.ok(height>0.01,`${world} wing ${i} is ${height} tall`); + for(const end of ['min','max'])wing[end].forEach((v,k)=>assert.ok(Math.abs(after[world][i][end][k]-v)<2e-3,`${world} wing ${i} ${end}[${k}]: ${v} before, ${after[world][i][end][k]} after`)); + }); + } + assert.deepEqual(b.errors,[]); +}); diff --git a/tests/hermes.test.mjs b/tests/hermes.test.mjs index 86ecc10..4ff0759 100644 --- a/tests/hermes.test.mjs +++ b/tests/hermes.test.mjs @@ -1255,7 +1255,7 @@ test('a Hermes token that cannot be revoked keeps the card from showing reportin assert.deepEqual(given.map((token) => tokens.account(token)), [base.home, work.home], 'still accepted'); assert.deepEqual(recorded(registry, hermes).map(([, p]) => p.status), ['disabled', 'disabled'], 'though Hermes turned the plugins off'); assert.equal(hooks.enabled(hermes), true, 'so the card offers Turn off'); - assert.equal(hooks.note(hermes), 'Agent reporting is not fully off: the report token of Default, work is still accepted, because Agent Guild could not revoke it. Turn it off to try again.'); + assert.equal(hooks.note(hermes), 'Agent reporting is not fully off: the report token of Default, work is still accepted while its Agent Guild plugin is off. Turn it off to revoke it.'); fs.rmdirSync(tokens.recordFile); fs.writeFileSync(tokens.recordFile, saved); @@ -1336,6 +1336,54 @@ test('a Hermes report whose token is revoked while its body is still arriving is assert.equal(live.live(work), null, 'and no activity came back'); }); +test('while Hermes reporting turns on, a profile whose plugin is still installing is neither held nor a partial failure, and one already reporting shows as on', { timeout: 30000 }, async (t) => { + const { registry, hooks, tokens, home } = hermesSetup(t, { hermes: 'home' }); + makeHermesHome(home('hermes').dir, [['work', 'config.yaml']]); + registry.reload(); + const hermes = registry.get('hermes'); + const [base, work] = registry.accountsFor(hermes); + // Each profile's plugin install waits until the test lets it go. + const installing = new Map(); + const run = hooks._hermesRun.bind(hooks); + hooks._hermesRun = async (provider, account, args, what) => { + if (args[0] === 'plugins' && args[1] === 'install') { + await new Promise((resolve) => installing.set(account.id, resolve)); + } + return run(provider, account, args, what); + }; + const turning = hooks.setEnabled(hermes, true); + + await until('the Default install held', () => installing.has('default'), Boolean); + assert.ok(tokens.get(base.home), 'its token is already accepted'); + assert.equal(hooks.note(hermes), null, 'no note says a token could not be revoked'); + assert.equal(hooks.enabled(hermes), false, 'and no profile reports yet'); + installing.get('default')(); + + await until('the work install held', () => installing.has('work'), Boolean); + assert.ok(tokens.get(work.home)); + assert.equal(hooks._hermesReporting(hermes)[0].on, true, 'Default already reports'); + assert.equal(hooks.enabled(hermes), true); + assert.equal(hooks.note(hermes), null, 'no note says reporting is on for only some profiles'); + installing.get('work')(); + + assert.equal(await turning, true); + assert.deepEqual(hooks._hermesReporting(hermes).map((a) => [a.on, a.held]), [[true, false], [true, false]]); + assert.equal(hooks.note(hermes), null); +}); + +test('a Hermes plugin turned off in Hermes while its token is accepted keeps Turn off, and the note claims no failed revocation', { timeout: 30000 }, async (t) => { + const { registry, hooks, tokens } = hermesSetup(t, { hermes: 'home' }); + const hermes = registry.get('hermes'); + const [account] = registry.accountsFor(hermes); + assert.equal(await hooks.setEnabled(hermes, true), true); + await hooks._hermesRun(hermes, account, ['plugins', 'disable', 'agent-guild'], 'turn off the Agent Guild plugin'); + await hooks._readHermes(hermes); + assert.equal(hooks.enabled(hermes), true, 'the token is still accepted, so the card offers Turn off'); + assert.equal(hooks.note(hermes), 'Agent reporting is not fully off: the report token of Default is still accepted while its Agent Guild plugin is off. Turn it off to revoke it.'); + assert.equal(await hooks.setEnabled(hermes, false), false); + assert.equal(tokens.get(account.home), null, 'turning off revokes it'); +}); + test('a Hermes plugin read that finishes after a newer change is dropped, so it cannot show an enabled plugin as off', { timeout: 30000 }, async (t) => { const { registry, hooks } = hermesSetup(t, { hermes: 'home' }); const hermes = registry.get('hermes'); diff --git a/tests/yard.test.mjs b/tests/yard.test.mjs index bc8d590..f0d169e 100644 --- a/tests/yard.test.mjs +++ b/tests/yard.test.mjs @@ -3,7 +3,7 @@ import assert from 'node:assert/strict'; import { readFileSync, statSync } from 'node:fs'; import { runInNewContext } from 'node:vm'; import { sessionPose, familiarPose, marksFor, onFire, fireTint,layoutSessions, providerPositions, characterIndex, lookLimits, yardExtras, WORLDS, CAMERA, SUN, minZoom, overviewFor, clampPan, viewBasis, plateExtent, - stage, stagingMode, nextStagingChange, restSpots, route, clipFor, doorFor, stationProp, STAGING, CLIPS, SKELETON, PROVIDER_ORDER, photoSize, photoName, VIBE, vibeStop, vibeFlight, vibeFrame, inVibeFrame } from '../web/yard/model.mjs'; + stage, stagingMode, nextStagingChange, restSpots, route, clipFor, doorFor, stationProp, STAGING, CLIPS, SKELETON, PROVIDER_ORDER, finishOf, photoSize, photoName, VIBE, vibeStop, vibeFlight, vibeFrame, inVibeFrame } from '../web/yard/model.mjs'; import { goldenVectors } from '../scripts/yard-golden.mjs'; import { Matrix4, Vector3 } from 'three'; const providers=['anthropic','openai','google','xai','shell','docker'].map(id=>({id})); @@ -535,3 +535,9 @@ test('every world\'s plates match the live camera, cover every view, and stay wi assert.ok(bytes<=36*MiB,`${skin} world is ${(bytes/MiB).toFixed(2)} MiB`); } }); + +test('only the plated cards have a finish; an id named like an inherited property has none', () => { + assert.equal(finishOf('terminal-ai-chat'), 'gold'); + assert.equal(finishOf('hermes'), 'hermes'); + for (const id of ['shell', 'my-tool', 'constructor', 'toString', 'hasOwnProperty', '__proto__', 'valueOf']) assert.equal(finishOf(id), null, id); +}); diff --git a/web/icons/hermes.svg b/web/icons/hermes.svg index 36f00c2..50c5fbd 100644 --- a/web/icons/hermes.svg +++ b/web/icons/hermes.svg @@ -1 +1 @@ - + diff --git a/web/skins/gnomeland/characters/hermes/idle.avif b/web/skins/gnomeland/characters/hermes/idle.avif new file mode 100644 index 0000000..3397c4a Binary files /dev/null and b/web/skins/gnomeland/characters/hermes/idle.avif differ diff --git a/web/skins/gnomeland/characters/hermes/idle.webp b/web/skins/gnomeland/characters/hermes/idle.webp new file mode 100644 index 0000000..db77726 Binary files /dev/null and b/web/skins/gnomeland/characters/hermes/idle.webp differ diff --git a/web/skins/gnomeland/characters/hermes/locked.avif b/web/skins/gnomeland/characters/hermes/locked.avif new file mode 100644 index 0000000..d97a152 Binary files /dev/null and b/web/skins/gnomeland/characters/hermes/locked.avif differ diff --git a/web/skins/gnomeland/characters/hermes/locked.webp b/web/skins/gnomeland/characters/hermes/locked.webp new file mode 100644 index 0000000..f142389 Binary files /dev/null and b/web/skins/gnomeland/characters/hermes/locked.webp differ diff --git a/web/skins/gnomeland/characters/hermes/working.avif b/web/skins/gnomeland/characters/hermes/working.avif new file mode 100644 index 0000000..11c77ef Binary files /dev/null and b/web/skins/gnomeland/characters/hermes/working.avif differ diff --git a/web/skins/gnomeland/characters/hermes/working.webp b/web/skins/gnomeland/characters/hermes/working.webp new file mode 100644 index 0000000..534f717 Binary files /dev/null and b/web/skins/gnomeland/characters/hermes/working.webp differ diff --git a/web/skins/gnomeland/skin.css b/web/skins/gnomeland/skin.css index 614e31f..5c7b66a 100644 --- a/web/skins/gnomeland/skin.css +++ b/web/skins/gnomeland/skin.css @@ -105,6 +105,12 @@ --working: image-set(url("characters/terminal-ai-chat/working.avif") type("image/avif"), url("characters/terminal-ai-chat/working.webp") type("image/webp")); --locked: image-set(url("characters/terminal-ai-chat/locked.avif") type("image/avif"), url("characters/terminal-ai-chat/locked.webp") type("image/webp")); } + .provider[data-id="hermes"], .session-card[data-provider="hermes"] { + --pc: #0000F2; + --idle: image-set(url("characters/hermes/idle.avif") type("image/avif"), url("characters/hermes/idle.webp") type("image/webp")); + --working: image-set(url("characters/hermes/working.avif") type("image/avif"), url("characters/hermes/working.webp") type("image/webp")); + --locked: image-set(url("characters/hermes/locked.avif") type("image/avif"), url("characters/hermes/locked.webp") type("image/webp")); + } .provider-icon[data-provider="anthropic"] { --icon: image-set(url("icons/anthropic.avif") type("image/avif"), url("icons/anthropic.webp") type("image/webp")); } .provider-icon[data-provider="openai"] { --icon: image-set(url("icons/openai.avif") type("image/avif"), url("icons/openai.webp") type("image/webp")); } diff --git a/web/skins/goblinville/characters/hermes/idle.avif b/web/skins/goblinville/characters/hermes/idle.avif new file mode 100644 index 0000000..320f1f0 Binary files /dev/null and b/web/skins/goblinville/characters/hermes/idle.avif differ diff --git a/web/skins/goblinville/characters/hermes/idle.webp b/web/skins/goblinville/characters/hermes/idle.webp new file mode 100644 index 0000000..7b28d08 Binary files /dev/null and b/web/skins/goblinville/characters/hermes/idle.webp differ diff --git a/web/skins/goblinville/characters/hermes/locked.avif b/web/skins/goblinville/characters/hermes/locked.avif new file mode 100644 index 0000000..159f3ef Binary files /dev/null and b/web/skins/goblinville/characters/hermes/locked.avif differ diff --git a/web/skins/goblinville/characters/hermes/locked.webp b/web/skins/goblinville/characters/hermes/locked.webp new file mode 100644 index 0000000..0c618fc Binary files /dev/null and b/web/skins/goblinville/characters/hermes/locked.webp differ diff --git a/web/skins/goblinville/characters/hermes/working.avif b/web/skins/goblinville/characters/hermes/working.avif new file mode 100644 index 0000000..17c5087 Binary files /dev/null and b/web/skins/goblinville/characters/hermes/working.avif differ diff --git a/web/skins/goblinville/characters/hermes/working.webp b/web/skins/goblinville/characters/hermes/working.webp new file mode 100644 index 0000000..c964d49 Binary files /dev/null and b/web/skins/goblinville/characters/hermes/working.webp differ diff --git a/web/skins/goblinville/skin.css b/web/skins/goblinville/skin.css index 0dd13f1..ebf27ea 100644 --- a/web/skins/goblinville/skin.css +++ b/web/skins/goblinville/skin.css @@ -108,6 +108,12 @@ --working: image-set(url("characters/terminal-ai-chat/working.avif") type("image/avif"), url("characters/terminal-ai-chat/working.webp") type("image/webp")); --locked: image-set(url("characters/terminal-ai-chat/locked.avif") type("image/avif"), url("characters/terminal-ai-chat/locked.webp") type("image/webp")); } + .provider[data-id="hermes"], .session-card[data-provider="hermes"] { + --pc: #0000F2; + --idle: image-set(url("characters/hermes/idle.avif") type("image/avif"), url("characters/hermes/idle.webp") type("image/webp")); + --working: image-set(url("characters/hermes/working.avif") type("image/avif"), url("characters/hermes/working.webp") type("image/webp")); + --locked: image-set(url("characters/hermes/locked.avif") type("image/avif"), url("characters/hermes/locked.webp") type("image/webp")); + } .provider-icon[data-provider="anthropic"] { --icon: image-set(url("icons/anthropic.avif") type("image/avif"), url("icons/anthropic.webp") type("image/webp")); } .provider-icon[data-provider="openai"] { --icon: image-set(url("icons/openai.avif") type("image/avif"), url("icons/openai.webp") type("image/webp")); } diff --git a/web/skins/grove/characters/hermes/idle.avif b/web/skins/grove/characters/hermes/idle.avif new file mode 100644 index 0000000..1b38c1f Binary files /dev/null and b/web/skins/grove/characters/hermes/idle.avif differ diff --git a/web/skins/grove/characters/hermes/idle.webp b/web/skins/grove/characters/hermes/idle.webp new file mode 100644 index 0000000..83f8d0d Binary files /dev/null and b/web/skins/grove/characters/hermes/idle.webp differ diff --git a/web/skins/grove/characters/hermes/locked.avif b/web/skins/grove/characters/hermes/locked.avif new file mode 100644 index 0000000..12bd08d Binary files /dev/null and b/web/skins/grove/characters/hermes/locked.avif differ diff --git a/web/skins/grove/characters/hermes/locked.webp b/web/skins/grove/characters/hermes/locked.webp new file mode 100644 index 0000000..19e2287 Binary files /dev/null and b/web/skins/grove/characters/hermes/locked.webp differ diff --git a/web/skins/grove/characters/hermes/working.avif b/web/skins/grove/characters/hermes/working.avif new file mode 100644 index 0000000..c96c6a9 Binary files /dev/null and b/web/skins/grove/characters/hermes/working.avif differ diff --git a/web/skins/grove/characters/hermes/working.webp b/web/skins/grove/characters/hermes/working.webp new file mode 100644 index 0000000..acb53e4 Binary files /dev/null and b/web/skins/grove/characters/hermes/working.webp differ diff --git a/web/skins/grove/skin.css b/web/skins/grove/skin.css index 1e54c16..f6bc105 100644 --- a/web/skins/grove/skin.css +++ b/web/skins/grove/skin.css @@ -98,6 +98,12 @@ --working: image-set(url("characters/terminal-ai-chat/working.avif") type("image/avif"), url("characters/terminal-ai-chat/working.webp") type("image/webp")); --locked: image-set(url("characters/terminal-ai-chat/locked.avif") type("image/avif"), url("characters/terminal-ai-chat/locked.webp") type("image/webp")); } + .provider[data-id="hermes"], .session-card[data-provider="hermes"] { + --pc: #0000F2; + --idle: image-set(url("characters/hermes/idle.avif") type("image/avif"), url("characters/hermes/idle.webp") type("image/webp")); + --working: image-set(url("characters/hermes/working.avif") type("image/avif"), url("characters/hermes/working.webp") type("image/webp")); + --locked: image-set(url("characters/hermes/locked.avif") type("image/avif"), url("characters/hermes/locked.webp") type("image/webp")); + } .provider-icon[data-provider="anthropic"] { --icon: image-set(url("icons/anthropic.avif") type("image/avif"), url("icons/anthropic.webp") type("image/webp")); } .provider-icon[data-provider="openai"] { --icon: image-set(url("icons/openai.avif") type("image/avif"), url("icons/openai.webp") type("image/webp")); } diff --git a/web/skins/guild/characters/hermes/idle.avif b/web/skins/guild/characters/hermes/idle.avif new file mode 100644 index 0000000..2e369fc Binary files /dev/null and b/web/skins/guild/characters/hermes/idle.avif differ diff --git a/web/skins/guild/characters/hermes/idle.webp b/web/skins/guild/characters/hermes/idle.webp new file mode 100644 index 0000000..07038b0 Binary files /dev/null and b/web/skins/guild/characters/hermes/idle.webp differ diff --git a/web/skins/guild/characters/hermes/locked.avif b/web/skins/guild/characters/hermes/locked.avif new file mode 100644 index 0000000..c33bca9 Binary files /dev/null and b/web/skins/guild/characters/hermes/locked.avif differ diff --git a/web/skins/guild/characters/hermes/locked.webp b/web/skins/guild/characters/hermes/locked.webp new file mode 100644 index 0000000..c4847bf Binary files /dev/null and b/web/skins/guild/characters/hermes/locked.webp differ diff --git a/web/skins/guild/characters/hermes/working.avif b/web/skins/guild/characters/hermes/working.avif new file mode 100644 index 0000000..ca761f4 Binary files /dev/null and b/web/skins/guild/characters/hermes/working.avif differ diff --git a/web/skins/guild/characters/hermes/working.webp b/web/skins/guild/characters/hermes/working.webp new file mode 100644 index 0000000..167d80b Binary files /dev/null and b/web/skins/guild/characters/hermes/working.webp differ diff --git a/web/skins/guild/skin.css b/web/skins/guild/skin.css index 5252711..abb7f98 100644 --- a/web/skins/guild/skin.css +++ b/web/skins/guild/skin.css @@ -102,6 +102,12 @@ --working: image-set(url("characters/terminal-ai-chat/working.avif") type("image/avif"), url("characters/terminal-ai-chat/working.webp") type("image/webp")); --locked: image-set(url("characters/terminal-ai-chat/locked.avif") type("image/avif"), url("characters/terminal-ai-chat/locked.webp") type("image/webp")); } + .provider[data-id="hermes"], .session-card[data-provider="hermes"] { + --pc: #0000F2; + --idle: image-set(url("characters/hermes/idle.avif") type("image/avif"), url("characters/hermes/idle.webp") type("image/webp")); + --working: image-set(url("characters/hermes/working.avif") type("image/avif"), url("characters/hermes/working.webp") type("image/webp")); + --locked: image-set(url("characters/hermes/locked.avif") type("image/avif"), url("characters/hermes/locked.webp") type("image/webp")); + } .provider-icon[data-provider="anthropic"] { --icon: image-set(url("icons/anthropic.avif") type("image/avif"), url("icons/anthropic.webp") type("image/webp")); } .provider-icon[data-provider="openai"] { --icon: image-set(url("icons/openai.avif") type("image/avif"), url("icons/openai.webp") type("image/webp")); } diff --git a/web/skins/orbital/characters/hermes/idle.avif b/web/skins/orbital/characters/hermes/idle.avif new file mode 100644 index 0000000..f04c85b Binary files /dev/null and b/web/skins/orbital/characters/hermes/idle.avif differ diff --git a/web/skins/orbital/characters/hermes/idle.webp b/web/skins/orbital/characters/hermes/idle.webp new file mode 100644 index 0000000..24eb53b Binary files /dev/null and b/web/skins/orbital/characters/hermes/idle.webp differ diff --git a/web/skins/orbital/characters/hermes/locked.avif b/web/skins/orbital/characters/hermes/locked.avif new file mode 100644 index 0000000..59bf604 Binary files /dev/null and b/web/skins/orbital/characters/hermes/locked.avif differ diff --git a/web/skins/orbital/characters/hermes/locked.webp b/web/skins/orbital/characters/hermes/locked.webp new file mode 100644 index 0000000..a8552dc Binary files /dev/null and b/web/skins/orbital/characters/hermes/locked.webp differ diff --git a/web/skins/orbital/characters/hermes/working.avif b/web/skins/orbital/characters/hermes/working.avif new file mode 100644 index 0000000..c0059c6 Binary files /dev/null and b/web/skins/orbital/characters/hermes/working.avif differ diff --git a/web/skins/orbital/characters/hermes/working.webp b/web/skins/orbital/characters/hermes/working.webp new file mode 100644 index 0000000..9b2273f Binary files /dev/null and b/web/skins/orbital/characters/hermes/working.webp differ diff --git a/web/skins/orbital/skin.css b/web/skins/orbital/skin.css index e92952d..730eb96 100644 --- a/web/skins/orbital/skin.css +++ b/web/skins/orbital/skin.css @@ -111,6 +111,12 @@ --working: image-set(url("characters/terminal-ai-chat/working.avif") type("image/avif"), url("characters/terminal-ai-chat/working.webp") type("image/webp")); --locked: image-set(url("characters/terminal-ai-chat/locked.avif") type("image/avif"), url("characters/terminal-ai-chat/locked.webp") type("image/webp")); } + .provider[data-id="hermes"], .session-card[data-provider="hermes"] { + --pc: #0000F2; + --idle: image-set(url("characters/hermes/idle.avif") type("image/avif"), url("characters/hermes/idle.webp") type("image/webp")); + --working: image-set(url("characters/hermes/working.avif") type("image/avif"), url("characters/hermes/working.webp") type("image/webp")); + --locked: image-set(url("characters/hermes/locked.avif") type("image/avif"), url("characters/hermes/locked.webp") type("image/webp")); + } .provider-icon[data-provider="anthropic"] { --icon: image-set(url("icons/anthropic.avif") type("image/avif"), url("icons/anthropic.webp") type("image/webp")); } .provider-icon[data-provider="openai"] { --icon: image-set(url("icons/openai.avif") type("image/avif"), url("icons/openai.webp") type("image/webp")); } diff --git a/web/skins/professional/objects/hermes/dark-idle.avif b/web/skins/professional/objects/hermes/dark-idle.avif new file mode 100644 index 0000000..9acd92b Binary files /dev/null and b/web/skins/professional/objects/hermes/dark-idle.avif differ diff --git a/web/skins/professional/objects/hermes/dark-idle.webp b/web/skins/professional/objects/hermes/dark-idle.webp new file mode 100644 index 0000000..f6682cb Binary files /dev/null and b/web/skins/professional/objects/hermes/dark-idle.webp differ diff --git a/web/skins/professional/objects/hermes/dark-locked.avif b/web/skins/professional/objects/hermes/dark-locked.avif new file mode 100644 index 0000000..dd92651 Binary files /dev/null and b/web/skins/professional/objects/hermes/dark-locked.avif differ diff --git a/web/skins/professional/objects/hermes/dark-locked.webp b/web/skins/professional/objects/hermes/dark-locked.webp new file mode 100644 index 0000000..795ec4c Binary files /dev/null and b/web/skins/professional/objects/hermes/dark-locked.webp differ diff --git a/web/skins/professional/objects/hermes/dark-working.avif b/web/skins/professional/objects/hermes/dark-working.avif new file mode 100644 index 0000000..a73acff Binary files /dev/null and b/web/skins/professional/objects/hermes/dark-working.avif differ diff --git a/web/skins/professional/objects/hermes/dark-working.webp b/web/skins/professional/objects/hermes/dark-working.webp new file mode 100644 index 0000000..770e1d1 Binary files /dev/null and b/web/skins/professional/objects/hermes/dark-working.webp differ diff --git a/web/skins/professional/objects/hermes/light-idle.avif b/web/skins/professional/objects/hermes/light-idle.avif new file mode 100644 index 0000000..dd409c2 Binary files /dev/null and b/web/skins/professional/objects/hermes/light-idle.avif differ diff --git a/web/skins/professional/objects/hermes/light-idle.webp b/web/skins/professional/objects/hermes/light-idle.webp new file mode 100644 index 0000000..fafca50 Binary files /dev/null and b/web/skins/professional/objects/hermes/light-idle.webp differ diff --git a/web/skins/professional/objects/hermes/light-locked.avif b/web/skins/professional/objects/hermes/light-locked.avif new file mode 100644 index 0000000..a0c5ade Binary files /dev/null and b/web/skins/professional/objects/hermes/light-locked.avif differ diff --git a/web/skins/professional/objects/hermes/light-locked.webp b/web/skins/professional/objects/hermes/light-locked.webp new file mode 100644 index 0000000..5ecc422 Binary files /dev/null and b/web/skins/professional/objects/hermes/light-locked.webp differ diff --git a/web/skins/professional/objects/hermes/light-working.avif b/web/skins/professional/objects/hermes/light-working.avif new file mode 100644 index 0000000..8bb1b90 Binary files /dev/null and b/web/skins/professional/objects/hermes/light-working.avif differ diff --git a/web/skins/professional/objects/hermes/light-working.webp b/web/skins/professional/objects/hermes/light-working.webp new file mode 100644 index 0000000..5a1d1fe Binary files /dev/null and b/web/skins/professional/objects/hermes/light-working.webp differ diff --git a/web/skins/professional/skin.css b/web/skins/professional/skin.css index 0a4f9d1..ad908a3 100644 --- a/web/skins/professional/skin.css +++ b/web/skins/professional/skin.css @@ -82,6 +82,12 @@ --working: image-set(url("objects/terminal-ai-chat/light-working.avif") type("image/avif"), url("objects/terminal-ai-chat/light-working.webp") type("image/webp")); --locked: image-set(url("objects/terminal-ai-chat/light-locked.avif") type("image/avif"), url("objects/terminal-ai-chat/light-locked.webp") type("image/webp")); } + .provider[data-id="hermes"], .session-card[data-provider="hermes"] { + --pc: #0000F2; + --idle: image-set(url("objects/hermes/light-idle.avif") type("image/avif"), url("objects/hermes/light-idle.webp") type("image/webp")); + --working: image-set(url("objects/hermes/light-working.avif") type("image/avif"), url("objects/hermes/light-working.webp") type("image/webp")); + --locked: image-set(url("objects/hermes/light-locked.avif") type("image/avif"), url("objects/hermes/light-locked.webp") type("image/webp")); + } .provider-icon[data-provider="anthropic"] { --icon: url("icons/anthropic.svg"); } .provider-icon[data-provider="openai"] { --icon: url("icons/openai.svg"); } @@ -282,6 +288,11 @@ --working: image-set(url("objects/terminal-ai-chat/dark-working.avif") type("image/avif"), url("objects/terminal-ai-chat/dark-working.webp") type("image/webp")); --locked: image-set(url("objects/terminal-ai-chat/dark-locked.avif") type("image/avif"), url("objects/terminal-ai-chat/dark-locked.webp") type("image/webp")); } + .provider[data-id="hermes"], .session-card[data-provider="hermes"] { + --idle: image-set(url("objects/hermes/dark-idle.avif") type("image/avif"), url("objects/hermes/dark-idle.webp") type("image/webp")); + --working: image-set(url("objects/hermes/dark-working.avif") type("image/avif"), url("objects/hermes/dark-working.webp") type("image/webp")); + --locked: image-set(url("objects/hermes/dark-locked.avif") type("image/avif"), url("objects/hermes/dark-locked.webp") type("image/webp")); + } .tier-s { --tier: #34d399; --tier-ink: #bbf7d0; } .tier-a { --tier: #22d3ee; --tier-ink: #cffafe; } diff --git a/web/yard/assets/hermes_wings.glb b/web/yard/assets/hermes_wings.glb new file mode 100644 index 0000000..9d6b341 Binary files /dev/null and b/web/yard/assets/hermes_wings.glb differ diff --git a/web/yard/model.mjs b/web/yard/model.mjs index dfaab1c..be2a2cb 100644 --- a/web/yard/model.mjs +++ b/web/yard/model.mjs @@ -2,7 +2,14 @@ export const PROVIDER_ORDER = ['anthropic', 'openai', 'google', 'xai', 'shell', 'docker']; // Character model index for a provider; custom providers wear the shell's, as they get its hall. export const characterIndex = id => PROVIDER_ORDER.includes(id) ? PROVIDER_ORDER.indexOf(id) : PROVIDER_ORDER.indexOf('shell'); -export const GILDED = ['terminal-ai-chat']; +// Cards whose hall and character wear the shell's with a finish of their own: +// gold for Terminal AI Chat, white and blue for Hermes Agent. A winged card's +// character also wears the wings of Hermes on its head. +export const PLATED = { 'terminal-ai-chat': 'gold', hermes: 'hermes' }; +export const WINGED = ['hermes']; +// A provider's finish, or null. Only PLATED's own entries count, so an id such +// as `constructor` is not mistaken for one and the provider keeps the shell's look. +export const finishOf = id => Object.hasOwn(PLATED, id) ? PLATED[id] : null; // Hall effects, one pooled particle system for every hall: how many // particles a second a hall gives off at low and high activity, how long each // lives, how fast it rises and drifts (metres a second), how widely it starts diff --git a/web/yard/renderer.js b/web/yard/renderer.js index da64af3..dcc0227 100644 --- a/web/yard/renderer.js +++ b/web/yard/renderer.js @@ -1,5 +1,5 @@ import * as T from './vendor/engine.js'; -import { WORLDS, PROVIDER_ORDER, characterIndex, GILDED, CAMERA, SUN, minZoom, overviewFor, clampPan, viewBasis, providerPositions, sessionPose, familiarPose, hash, +import { WORLDS, PROVIDER_ORDER, characterIndex, finishOf, WINGED, CAMERA, SUN, minZoom, overviewFor, clampPan, viewBasis, providerPositions, sessionPose, familiarPose, hash, stage, nextStagingChange, doorFor, arrives, route, clipFor, helperOffset, stationProp, hallActivity, lookTarget, lookLimits, yardExtras, playableClip, STAGING, photoSize, marksFor, SHOWN_HELPERS, onFire, VIBE, vibeStop, vibeFlight, vibeFrame, inVibeFrame } from './model.mjs'; import { Aura, auraShapes, EMBER_SIZE } from './aura.js'; @@ -26,22 +26,43 @@ const GLOW = { off: 0, low: .55, high: 1 }, GLOW_GAIN = { light: .9, dark: 2.2 } // Materials that light up with a hall's crew: lit windows and magic, glass // fronts, and a generated hall's baked glow map. const glows = m => m.name === 'window' || m.name === 'magic' || m.name === 'officeGlass' || m.emissiveMap; -// Near-black stays as it is, so a face keeps its dark screen. -const GOLD_SHADER = shader => { +// Each finish recolours a material by how bright and how coloured it is +// (plateTone), then sets how it shines. Near-black stays as it is, so a face +// keeps its dark screen. +const FINISHES = { + // Polished gold. + gold: { + tone: 'vec3 plateTone = vec3(1., .56, .1) * mix(.4, .9, smoothstep(.03, .4, platePeak));', + roughness: 'roughnessFactor = mix(roughnessFactor, .06 + roughnessFactor * .18, plateMix);', + metalness: 'metalnessFactor = mix(metalnessFactor, 1., plateMix);', + emissive: 'totalEmissiveRadiance = vec3(1., .66, .22) * dot(totalEmissiveRadiance, vec3(.2126, .7152, .0722)) * 1.4 + plateTone * plateMix * .06;', + }, + // White porcelain where the shell is bright, Hermes blue (#0000f2) in its darker parts and glows. + hermes: { + tone: `float plateWhite = smoothstep(.07, .2, platePeak); + vec3 plateTone = mix(vec3(0., 0., .887) * mix(.55, 1., smoothstep(.02, .07, platePeak)), vec3(.88, .89, .92) * mix(.7, 1., smoothstep(.2, .6, platePeak)), plateWhite);`, + roughness: 'roughnessFactor = mix(roughnessFactor, .28 + roughnessFactor * .3, plateMix);', + metalness: 'metalnessFactor = mix(metalnessFactor, 0., plateMix);', + emissive: 'totalEmissiveRadiance = vec3(.12, .2, 1.) * dot(totalEmissiveRadiance, vec3(.2126, .7152, .0722)) * 1.6;', + }, +}; +const plateShader = ({ tone, roughness, metalness, emissive }) => shader => { shader.fragmentShader = shader.fragmentShader .replace('#include ', `#include - float goldPeak = max(diffuseColor.r, max(diffuseColor.g, diffuseColor.b)); - float goldMix = smoothstep(.015, .045, goldPeak); - vec3 goldTone = vec3(1., .56, .1) * mix(.4, .9, smoothstep(.03, .4, goldPeak)); - diffuseColor.rgb = mix(diffuseColor.rgb, goldTone, goldMix);`) + float platePeak = max(diffuseColor.r, max(diffuseColor.g, diffuseColor.b)); + float plateMix = smoothstep(.015, .045, platePeak); + ${tone} + diffuseColor.rgb = mix(diffuseColor.rgb, plateTone, plateMix);`) .replace('#include ', `#include - roughnessFactor = mix(roughnessFactor, .06 + roughnessFactor * .18, goldMix);`) + ${roughness}`) .replace('#include ', `#include - metalnessFactor = mix(metalnessFactor, 1., goldMix);`) + ${metalness}`) .replace('#include ', `#include - totalEmissiveRadiance = vec3(1., .66, .22) * dot(totalEmissiveRadiance, vec3(.2126, .7152, .0722)) * 1.4 + goldTone * goldMix * .06;`); + ${emissive}`); }; -function gild(root, own = []) { +const SHADERS = Object.fromEntries(Object.entries(FINISHES).map(([name, finish]) => [name, plateShader(finish)])); +// Gives root's materials finish, on copies unless they are among own. Returns the copies. +function plate(root, finish, own = []) { const copies = new Map(); root.traverse(node => { if (!node.isMesh) return; @@ -49,13 +70,56 @@ function gild(root, own = []) { if (m.name === 'window' || m.name === 'magic' || m.name === 'officeGlass') return m; if (!copies.has(m)) copies.set(m, own.includes(m) ? m : m.clone()); const copy = copies.get(m); - copy.onBeforeCompile = GOLD_SHADER; copy.needsUpdate = true; + // The finishes share one compile function's source, so each needs its own program key. + copy.onBeforeCompile = SHADERS[finish]; copy.customProgramCacheKey = () => 'plate:' + finish; copy.needsUpdate = true; return copy; }; node.material = Array.isArray(node.material) ? node.material.map(swap) : swap(node.material); }); return [...copies.values()].filter(m => !own.includes(m)); } +const headPoint = new T.Vector3(); +// Puts a copy of wings on the Head bone of a character, fitted from the head +// they were made for (their extras.head) to this one's, measured in the bind +// pose from the vertices that follow the head. Returns false if it has none. +function wear(scene, wings) { + let bone = null, inverse = null; + const min = [Infinity, Infinity, Infinity], max = [-Infinity, -Infinity, -Infinity]; + scene.updateMatrixWorld(true); + scene.traverse(node => { + if (!node.isSkinnedMesh) return; + const at = node.skeleton.bones.findIndex(b => b.name === 'Head'); + if (at < 0) return; + if (!bone) { bone = node.skeleton.bones[at]; inverse = node.skeleton.boneInverses[at]; } + const { position, skinIndex, skinWeight } = node.geometry.attributes; + for (let i = 0; i < position.count; i++) { + let share = 0; + for (let k = 0; k < 4; k++) if (skinIndex.getComponent(i, k) === at) share += skinWeight.getComponent(i, k); + if (share < .5) continue; + headPoint.fromBufferAttribute(position, i).applyMatrix4(node.bindMatrix).toArray().forEach((v, k) => { min[k] = Math.min(min[k], v); max[k] = Math.max(max[k], v); }); + } + }); + if (!bone || !(max[0] > min[0])) return false; + // Each wing's root keeps its place relative to the head, stretched to + // this head's width, height and depth; the wing itself scales with the + // head's overall size, so a wide, short head does not get huge wings. + const from = wings.userData.head, size = k => (max[k] - min[k]) / (from.max[k] - from.min[k]); + const stretch = [0, 1, 2].map(size), scale = Math.cbrt(stretch[0] * stretch[1] * stretch[2]); + // Each wing's anchor holds its root; the Yard optimizer leaves anchors as + // they are and puts its own transform on the mesh below. + const worn = wings.clone(true); + worn.position.set(0, 0, 0); worn.quaternion.identity(); worn.scale.setScalar(1); + for (const anchor of worn.children) { + const at = anchor.position.toArray().map((v, k) => (min[k] + max[k]) / 2 + (v - (from.min[k] + from.max[k]) / 2) * stretch[k]); + anchor.position.fromArray(at); anchor.scale.setScalar(scale); + } + worn.traverse(node => { if (node.isMesh) { node.geometry = node.geometry.clone(); node.material = node.material.clone(); node.castShadow = node.receiveShadow = true; } }); + // The wings are placed in the bind pose's space; the head's inverse bind matrix brings them into the head's. + inverse.decompose(worn.position, worn.quaternion, worn.scale); + worn.name = 'hermes_wings'; + bone.add(worn); + return true; +} const PARTICLES = 640; const FIREWORK_COLORS = [0xffc857, 0xff507c, 0x53cfff, 0xb28aff, 0x7dffae]; const FIREWORKS = { points: 1024, batches: 8, bursts: 24, stars: 32, trail: 4, launch: .5, life: 1.7 }; @@ -234,10 +298,17 @@ export class YardRenderer { } return this.cache.get(name); } - goldAsset(name,url) { - const key='gold:'+name; + // name's character in provider id's finish, and wings if it wears them; + // a character whose wings cannot load goes without. + platedAsset(name,url,id) { + const finish=finishOf(id),winged=WINGED.includes(id),key=finish+(winged?'+wings':'')+':'+name; if(!this.cache.has(key)) { - const pending=this.asset(name,url).then(asset=>{const scene=T.cloneSkeleton(asset.scene);gild(scene);return {...asset,scene};}).catch(err=>{ + const wings=winged?this.asset('hermes_wings').then(w=>{let found=null;w.scene.traverse(n=>{if(!found&&n.userData.head)found=n;});return found;},err=>{console.warn('Hermes wings unavailable:',err.message);return null;}):null; + const pending=Promise.all([this.asset(name,url),wings]).then(([asset,worn])=>{ + const scene=T.cloneSkeleton(asset.scene);plate(scene,finish); + if(worn?.userData.head)wear(scene,worn); + return {...asset,scene}; + }).catch(err=>{ if(this.cache.get(key)===pending)this.cache.delete(key); throw err; }); @@ -286,7 +357,7 @@ export class YardRenderer { } release(name) { const loader=this.pieceLoaders.get(name);if(loader){cancel(loader);this.pieceLoaders.delete(name);} - for(const key of [name,'gold:'+name]){ + for(const key of [...this.cache.keys()].filter(key=>key===name||key.endsWith(':'+name))){ const pending=this.cache.get(key); if(!pending)continue; this.cache.delete(key); @@ -638,7 +709,7 @@ export class YardRenderer { } item={id:p.id,root,label:this.label('provider',p.id),chip:this.chip(p.id),custom,glows:this.ownGlow(root),level:0,target:0,emitted:0, smoke:root.getObjectByName('hall_'+(custom?'shell':p.id)+'_smoke')};this.halls.set(p.id,item); - item.gilt=custom&&GILDED.includes(p.id)?gild(root,item.glows):[]; + item.gilt=custom&&finishOf(p.id)?plate(root,finishOf(p.id),item.glows):[]; root.userData.entity={kind:'provider',id:p.id}; } item.target=GLOW[hallActivity(sessions,p.id)]; @@ -718,7 +789,7 @@ export class YardRenderer { const stale=()=>this.disposed||generation!==this.request||token!==unit.load||!unit.root.parent; unit.loading=true; try { - const asset=await (GILDED.includes(session.provider.id)?this.goldAsset(name,source?.urls[0]):this.asset(name,source?.urls[0])); + const asset=await (finishOf(session.provider.id)?this.platedAsset(name,source?.urls[0],session.provider.id):this.asset(name,source?.urls[0])); if(stale())return; const model=T.cloneSkeleton(asset.scene); model.rotation.y=unit.heading;