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

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .agents/skills/formsurface-painting/references/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ When this table and the server disagree, the server wins and this file is stale.
| `formsurface_text_resource` | text, target (alpha, stencil, fill), font (sans-serif, serif, monospace or a loaded font), bold | image size, brush |
| `formsurface_load_mesh` | file (glb, gltf, obj, fbx, usd, usda, usdc, usdz, ply, dae in workspace/meshes), reproject (carry every matched set's painting over by surface position; stays on until false) | status; bakes reset, sets keep their layers when material and tile match (reprojected when asked, undo cleared) |
| `formsurface_save_project` | name (default the open project, or a new one named after the mesh) | folder, file, bytes, sets, layers; the whole document (every set's size, channel roles, layer stack with settings, masks, generators, effects, base material and layer pixels) as workspace/projects/name/project.fsproj |
| `formsurface_open_project` | name | the project's mesh loaded and every set restored exactly (bakes are not stored: bake again), plus status |
| `formsurface_open_project` | name, answer_within_seconds (5 to 600, default 120) | the project's mesh loaded and every set restored exactly (bakes are not stored: bake again), plus status; over unsaved changes the window asks the person (Discard Changes) and the call waits: Cancel or no answer in time refuses it and keeps the document |
| `formsurface_instance_layer` | layer_id (any layer or folder on the active set, not itself an instance copy), texture_set (name or index) | new layer id in the target set; settings edits to any copy update all copies, layers added to a source folder follow; strokes stay on the source and painting a copy is refused |
| `formsurface_list_smart_materials` | none | materials with layer names and whether they have a thumbnail, intelligent mask names, saved intelligent mask names |
| `formsurface_apply_smart_material` | name | new layer ids, baked flag |
Expand Down
2 changes: 1 addition & 1 deletion .claude/skills/formsurface-painting/references/tools.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ When this table and the server disagree, the server wins and this file is stale.
| `formsurface_text_resource` | text, target (alpha, stencil, fill), font (sans-serif, serif, monospace or a loaded font), bold | image size, brush |
| `formsurface_load_mesh` | file (glb, gltf, obj, fbx, usd, usda, usdc, usdz, ply, dae in workspace/meshes), reproject (carry every matched set's painting over by surface position; stays on until false) | status; bakes reset, sets keep their layers when material and tile match (reprojected when asked, undo cleared) |
| `formsurface_save_project` | name (default the open project, or a new one named after the mesh) | folder, file, bytes, sets, layers; the whole document (every set's size, channel roles, layer stack with settings, masks, generators, effects, base material and layer pixels) as workspace/projects/name/project.fsproj |
| `formsurface_open_project` | name | the project's mesh loaded and every set restored exactly (bakes are not stored: bake again), plus status |
| `formsurface_open_project` | name, answer_within_seconds (5 to 600, default 120) | the project's mesh loaded and every set restored exactly (bakes are not stored: bake again), plus status; over unsaved changes the window asks the person (Discard Changes) and the call waits: Cancel or no answer in time refuses it and keeps the document |
| `formsurface_instance_layer` | layer_id (any layer or folder on the active set, not itself an instance copy), texture_set (name or index) | new layer id in the target set; settings edits to any copy update all copies, layers added to a source folder follow; strokes stay on the source and painting a copy is refused |
| `formsurface_list_smart_materials` | none | materials with layer names and whether they have a thumbnail, intelligent mask names, saved intelligent mask names |
| `formsurface_apply_smart_material` | name | new layer ids, baked flag |
Expand Down
4 changes: 4 additions & 0 deletions .docs/wiki/Painting-with-Agents.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ To use an agent outside this folder, `./formsurface agents install` registers th

`formsurface_status` first: it reports the texture sets, layers, brush and camera, or says that no editor is linked. Then one idea per layer: set the base material, add a layer or a fill layer, bake the mesh maps once and drive wear with generators, take a screenshot, paint strokes with viewport points, check from a second angle, save the project, export the maps. The skill's `references/tools.md` lists every tool with its arguments.

## Unsaved painting

An agent never throws away painting the person has not saved. When `formsurface_open_project` would replace a document with unsaved changes, the window shows its Discard Changes dialog with a line naming the project the agent asked for, and the agent's call waits. Discard Changes opens the project. Cancel, or no answer within the call's `answer_within_seconds` (120 by default), refuses the call and leaves the document as it was. Other agent calls wait while the dialog is open. A document with no unsaved changes opens without asking. A name that is not a saved project is refused without asking.

## Without an open editor

`./formsurface batch --headless job.json` and `./formsurface script --headless job.py` start the service, the editor and a windowless Chrome, Chromium or Edge, run, and stop what they started.
Expand Down
21 changes: 19 additions & 2 deletions backend/tests/test_f3_mcp.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def linked(engine):
return json.loads(r.read())["editor_linked"]


async def call_with_editor(engine, reply):
async def call_with_editor(engine, reply, tool="formsurface_status", arguments=None):
seen = []
ready = asyncio.Event()

Expand All @@ -55,7 +55,7 @@ async def editor():
break
await asyncio.sleep(0.1)
async with Client(params(engine["base"])) as client:
result = await client.call_tool("formsurface_status", {})
result = await client.call_tool(tool, arguments or {})
await task
return result, seen

Expand Down Expand Up @@ -100,6 +100,23 @@ def test_editor_refusal_comes_back_as_a_tool_error(engine):
assert "no mesh is loaded" in text_of(result)


def test_open_project_gives_the_person_a_time_to_answer_about_unsaved_changes(engine):
_, seen = run(call_with_editor(engine, {"ok": True, "result": {}}, "formsurface_open_project", {"name": "crate"}))
assert seen[0]["command"] == "open_project"
assert seen[0]["args"] == {"name": "crate", "answer_within": 120}
_, seen = run(call_with_editor(engine, {"ok": True, "result": {}}, "formsurface_open_project", {"name": "crate", "answer_within_seconds": 30}))
assert seen[0]["args"] == {"name": "crate", "answer_within": 30}


def test_open_project_refuses_an_answer_time_out_of_range(engine):
async def go():
async with Client(params(engine["base"])) as client:
return await client.call_tool("formsurface_open_project", {"name": "crate", "answer_within_seconds": 1})

result = run(go())
assert result.is_error


@pytest.mark.parametrize("service", ["http://evil.example:8766", "http://192.168.1.10:8766"])
def test_mcp_server_refuses_to_talk_to_a_non_local_service(service):
done = subprocess.run([sys.executable, "-I", str(MCP_SERVER)], env={"FORMSURFACE_SERVICE": service}, capture_output=True, text=True, timeout=60, stdin=subprocess.DEVNULL)
Expand Down
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/cs.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Paměť {0}",
"Reply {0} tokens": "Odpověď {0} tokenů",
"Chat {0} tokens": "Chat {0} tokenů",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV dlaždice zapnuty: UDIM dlaždice každého materiálu sdílejí zásobník vrstev aktivní dlaždice a tahy malují přes ně; každá dlaždice si ponechá vlastní malbu"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV dlaždice zapnuty: UDIM dlaždice každého materiálu sdílejí zásobník vrstev aktivní dlaždice a tahy malují přes ně; každá dlaždice si ponechá vlastní malbu",
"An agent asks to open {0}.": "Agent žádá o otevření {0}."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/da.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Hukommelse {0}",
"Reply {0} tokens": "Svar {0} tokens",
"Chat {0} tokens": "Chat {0} tokens",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-tiles slået til: hvert materiales UDIM-tiles deler den aktive tiles lagstak, og strøg maler hen over dem; hver tile beholder sin egen maling"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-tiles slået til: hvert materiales UDIM-tiles deler den aktive tiles lagstak, og strøg maler hen over dem; hver tile beholder sin egen maling",
"An agent asks to open {0}.": "En agent beder om at åbne {0}."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/de.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Speicher {0}",
"Reply {0} tokens": "Antwort {0} Tokens",
"Chat {0} tokens": "Chat {0} Tokens",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-Tiles an: Die UDIM-Tiles jedes Materials teilen sich den Ebenenstapel des aktiven Tiles, und Striche malen über alle hinweg; jedes Tile behält seine eigene Bemalung"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-Tiles an: Die UDIM-Tiles jedes Materials teilen sich den Ebenenstapel des aktiven Tiles, und Striche malen über alle hinweg; jedes Tile behält seine eigene Bemalung",
"An agent asks to open {0}.": "Ein Agent möchte {0} öffnen."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/es-MX.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Memoria {0}",
"Reply {0} tokens": "Respuesta {0} tokens",
"Chat {0} tokens": "Chat {0} tokens",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Teselas UV activadas: las teselas UDIM de cada material comparten la pila de capas de la tesela activa y los trazos pintan a través de ellas; cada tesela conserva su propia pintura"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Teselas UV activadas: las teselas UDIM de cada material comparten la pila de capas de la tesela activa y los trazos pintan a través de ellas; cada tesela conserva su propia pintura",
"An agent asks to open {0}.": "Un agente pide abrir {0}."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Memoria {0}",
"Reply {0} tokens": "Respuesta {0} tokens",
"Chat {0} tokens": "Chat {0} tokens",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Teselas UV activadas: las teselas UDIM de cada material comparten la pila de capas de la tesela activa y los trazos pintan a través de ellas; cada tesela conserva su propia pintura"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Teselas UV activadas: las teselas UDIM de cada material comparten la pila de capas de la tesela activa y los trazos pintan a través de ellas; cada tesela conserva su propia pintura",
"An agent asks to open {0}.": "Un agente pide abrir {0}."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/fi.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Muisti {0}",
"Reply {0} tokens": "Vastaus {0} tokenia",
"Chat {0} tokens": "Chat {0} tokenia",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-ruudut päällä: kunkin materiaalin UDIM-ruudut jakavat aktiivisen ruudun tasopinon ja vedot maalaavat niiden yli; jokainen ruutu säilyttää oman maalauksensa"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-ruudut päällä: kunkin materiaalin UDIM-ruudut jakavat aktiivisen ruudun tasopinon ja vedot maalaavat niiden yli; jokainen ruutu säilyttää oman maalauksensa",
"An agent asks to open {0}.": "Agentti pyytää avaamaan kohteen {0}."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/fr-CA.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Mémoire {0}",
"Reply {0} tokens": "Réponse {0} jetons",
"Chat {0} tokens": "Clavardage {0} jetons",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Tuiles UV activées : les tuiles UDIM de chaque matériau partagent la pile de calques de la tuile active et les traits peignent à travers elles; chaque tuile garde sa propre peinture"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Tuiles UV activées : les tuiles UDIM de chaque matériau partagent la pile de calques de la tuile active et les traits peignent à travers elles; chaque tuile garde sa propre peinture",
"An agent asks to open {0}.": "Un agent demande d'ouvrir {0}."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/fr.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Mémoire {0}",
"Reply {0} tokens": "Réponse {0} jetons",
"Chat {0} tokens": "Chat {0} jetons",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Tuiles UV activées : les tuiles UDIM de chaque matériau partagent la pile de calques de la tuile active et les traits peignent à travers elles ; chaque tuile garde sa propre peinture"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Tuiles UV activées : les tuiles UDIM de chaque matériau partagent la pile de calques de la tuile active et les traits peignent à travers elles ; chaque tuile garde sa propre peinture",
"An agent asks to open {0}.": "Un agent demande d'ouvrir {0}."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/hu.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Memória {0}",
"Reply {0} tokens": "Válasz {0} token",
"Chat {0} tokens": "Chat {0} token",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-csempék be: az egyes anyagok UDIM-csempéi az aktív csempe rétegvermét osztják meg, és a húzások átfestenek rajtuk; minden csempe megtartja a saját festését"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-csempék be: az egyes anyagok UDIM-csempéi az aktív csempe rétegvermét osztják meg, és a húzások átfestenek rajtuk; minden csempe megtartja a saját festését",
"An agent asks to open {0}.": "Egy ügynök a(z) {0} megnyitását kéri."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/id.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Memori {0}",
"Reply {0} tokens": "Balasan {0} token",
"Chat {0} tokens": "Obrolan {0} token",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Tile UV aktif: tile UDIM setiap material berbagi tumpukan lapisan tile aktif dan goresan melukis di semuanya; setiap tile mempertahankan lukisannya sendiri"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Tile UV aktif: tile UDIM setiap material berbagi tumpukan lapisan tile aktif dan goresan melukis di semuanya; setiap tile mempertahankan lukisannya sendiri",
"An agent asks to open {0}.": "Sebuah agen meminta untuk membuka {0}."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/it.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Memoria {0}",
"Reply {0} tokens": "Risposta {0} token",
"Chat {0} tokens": "Chat {0} token",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Tile UV attivati: i tile UDIM di ogni materiale condividono la pila di livelli del tile attivo e i tratti dipingono attraverso di essi; ogni tile conserva la propria pittura"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "Tile UV attivati: i tile UDIM di ogni materiale condividono la pila di livelli del tile attivo e i tratti dipingono attraverso di essi; ogni tile conserva la propria pittura",
"An agent asks to open {0}.": "Un agente chiede di aprire {0}."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/ja.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "メモリ {0}",
"Reply {0} tokens": "返信 {0} トークン",
"Chat {0} tokens": "チャット {0} トークン",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV タイルをオンにしました:各マテリアルの UDIM タイルがアクティブなタイルのレイヤースタックを共有し、ストロークはそれらをまたいでペイントされます。各タイルは自分のペイントを保持します"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV タイルをオンにしました:各マテリアルの UDIM タイルがアクティブなタイルのレイヤースタックを共有し、ストロークはそれらをまたいでペイントされます。各タイルは自分のペイントを保持します",
"An agent asks to open {0}.": "エージェントが {0} を開こうとしています。"
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/ko.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "메모리 {0}",
"Reply {0} tokens": "응답 {0} 토큰",
"Chat {0} tokens": "채팅 {0} 토큰",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV 타일 켜짐: 각 머티리얼의 UDIM 타일이 활성 타일의 레이어 스택을 공유하고 스트로크가 그 타일들에 걸쳐 칠해집니다. 각 타일은 자체 페인트를 유지합니다"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV 타일 켜짐: 각 머티리얼의 UDIM 타일이 활성 타일의 레이어 스택을 공유하고 스트로크가 그 타일들에 걸쳐 칠해집니다. 각 타일은 자체 페인트를 유지합니다",
"An agent asks to open {0}.": "에이전트가 {0} 열기를 요청합니다."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/nb.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Minne {0}",
"Reply {0} tokens": "Svar {0} tokens",
"Chat {0} tokens": "Chat {0} tokens",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-tiles på: UDIM-tilene til hvert materiale deler den aktive tilens lagstabel, og strøk maler på tvers av dem; hver tile beholder sin egen maling"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-tiles på: UDIM-tilene til hvert materiale deler den aktive tilens lagstabel, og strøk maler på tvers av dem; hver tile beholder sin egen maling",
"An agent asks to open {0}.": "En agent ber om å åpne {0}."
}
3 changes: 2 additions & 1 deletion frontend/src/i18n/more16/nl.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,6 @@
"Memory {0}": "Geheugen {0}",
"Reply {0} tokens": "Antwoord {0} tokens",
"Chat {0} tokens": "Chat {0} tokens",
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-tiles aan: de UDIM-tiles van elk materiaal delen de laagstapel van de actieve tile en streken schilderen erdoorheen; elke tile houdt zijn eigen schilderwerk"
"UV tiles on: the UDIM tiles of each material share the active tile's layer stack and strokes paint across them; each tile keeps its own paint": "UV-tiles aan: de UDIM-tiles van elk materiaal delen de laagstapel van de actieve tile en streken schilderen erdoorheen; elke tile houdt zijn eigen schilderwerk",
"An agent asks to open {0}.": "Een agent vraagt om {0} te openen."
}
Loading