@call-me-sensei/toonlab 0.4.20 → 0.4.22

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (46) hide show
  1. package/NPM-LIBRARY.md +60 -6
  2. package/README.md +28 -21
  3. package/agents/PROMPTS.md +10 -6
  4. package/agents/codex/AGENTS.md +6 -4
  5. package/agents/references/mcp-asset-discovery.md +12 -9
  6. package/agents/skills/claude/asset-sourcing/SKILL.md +9 -6
  7. package/agents/skills/claude/vegetation-sky/SKILL.md +7 -4
  8. package/agents/skills/codex/asset-sourcing/SKILL.md +9 -6
  9. package/agents/skills/codex/vegetation-sky/SKILL.md +7 -4
  10. package/database/apply-one-catalog-seed.mjs +63 -0
  11. package/database/seeds/catalog/0005_2026-08-c8-first12.sql +1101 -0
  12. package/database/seeds/catalog/0006_2026-09-c8-first100.sql +14245 -0
  13. package/database/seeds/catalog/0007_2026-09-c8-first100-primary-model.sql +14845 -0
  14. package/mcp/public-catalog.mjs +4 -52
  15. package/mcp/server.mjs +147 -2
  16. package/package.json +6 -5
  17. package/src/catalog/officialCatalog.js +1 -0
  18. package/src/catalog/officialCatalogAssetRuntime.js +98 -1
  19. package/src/catalog/officialCatalogLod.js +160 -16
  20. package/src/catalog/officialCatalogPlacement.js +52 -12
  21. package/src/catalog/officialCatalogProvider.js +79 -8
  22. package/src/catalog/officialCatalogRockPackage.js +172 -0
  23. package/src/rock-shader/rockMaterial.js +205 -28
  24. package/src/rock-shader/rockShaderRuntime.js +17 -1
  25. package/src/rock-shader/rockShaderSettings.js +16 -0
  26. package/src/rockgen/lod/index.js +1 -0
  27. package/src/rockgen/lod/rockDenseFieldPolicy.js +143 -0
  28. package/src/rockgen/rockDocument.js +604 -26
  29. package/src/vegetation/index.js +22 -2
  30. package/src/vegetation/scatter.js +6 -1
  31. package/src/vegetation/stylizedTree.js +3 -107
  32. package/src/version.js +1 -1
  33. package/types/catalog/officialCatalog.d.ts +1 -0
  34. package/types/catalog/officialCatalogPlacement.d.ts +4 -0
  35. package/types/catalog/officialCatalogRockPackage.d.ts +68 -0
  36. package/types/index.d.ts +24 -7
  37. package/types/rock-shader/rockMaterial.d.ts +3 -0
  38. package/types/rock-shader/rockShaderSettings.d.ts +2 -0
  39. package/types/rockgen/lod/index.d.ts +1 -0
  40. package/types/rockgen/lod/rockDenseFieldPolicy.d.ts +181 -0
  41. package/types/rockgen/rockDocument.d.ts +579 -68
  42. package/types/vegetation/index.d.ts +0 -7
  43. package/types/vegetation/stylizedTree.d.ts +0 -2
  44. package/types/version.d.ts +1 -1
  45. package/src/vegetation/legacyTreePresets.js +0 -120
  46. package/types/vegetation/legacyTreePresets.d.ts +0 -22
package/NPM-LIBRARY.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ToonLab npm library guide
2
2
 
3
3
  This guide is included in `@call-me-sensei/toonlab`. It is the package-first
4
- reference for version 0.4.20 and does not require access to the source
4
+ reference for version 0.4.22 and does not require access to the source
5
5
  repository.
6
6
 
7
7
  ## Install
@@ -45,7 +45,7 @@ them:
45
45
  - `@call-me-sensei/toonlab/styles` for portable bundles, strict labels,
46
46
  auditing, and coordinated application;
47
47
  - `@call-me-sensei/toonlab/assetlib`, `/asset-policy`, and
48
- `/official-catalog` for policy-aware Library and Gallery discovery;
48
+ `/official-catalog` for policy-aware local/released-catalog integration;
49
49
  - `@call-me-sensei/toonlab/character` and `/loaders` for supported preview and
50
50
  host-model integration;
51
51
  - `@call-me-sensei/toonlab/runtime`, `/renderer`, `/lighting`, and
@@ -76,7 +76,9 @@ The npm artifact contains four supported layers:
76
76
  It does not contain the ToonLab website, Lab application UIs, examples,
77
77
  screenshots, models, textures, or other binary media. Optional public fixtures
78
78
  are identified by immutable `https://assets.toonlab.io` metadata rather than
79
- being bundled.
79
+ being bundled. Authored tree recipes are assets too: the reviewed public tree
80
+ collection remains in the Gallery and is discovered through MCP instead of
81
+ being hard-coded into the JavaScript runtime.
80
82
 
81
83
  ## Use a focused runtime
82
84
 
@@ -122,6 +124,55 @@ The host application still owns renderer creation, geometry and XZ layout,
122
124
  cameras, controls, gameplay, dynamic physics, navigation, persistence, and the
123
125
  frame loop. ToonLab does not turn a prompt into a finished world.
124
126
 
127
+ ## Load Nature Reference Rocks
128
+
129
+ Version 0.4.22 understands both the original `rock-0001`–`rock-0480`
130
+ identities and the `rock-c8-*` Nature Reference Rocks. Acquiring an asset
131
+ directly returns its realistic PBR GLB. The one-call placement path additionally
132
+ loads that asset's reviewed geology maps and `call_me_sensei` material settings
133
+ before applying the selected style bundle.
134
+
135
+ ```js
136
+ import {
137
+ createOfficialCatalogAssetRuntime,
138
+ createOfficialCatalogProvider,
139
+ createOfficialCatalogRockEditorDescriptor,
140
+ loadOfficialCatalogAsset,
141
+ } from '@call-me-sensei/toonlab/official-catalog';
142
+ import { CALL_ME_SENSEI_STYLE_BUNDLE } from '@call-me-sensei/toonlab/styles';
143
+
144
+ const provider = createOfficialCatalogProvider({
145
+ baseUrl: 'https://toonlab.io/',
146
+ transport: 'public-rock',
147
+ });
148
+ const assets = createOfficialCatalogAssetRuntime({ provider, renderer });
149
+
150
+ // Raw acquisition keeps the realistic PBR model.
151
+ const realistic = await assets.acquireAsset('rock-c8-arch-sandstone');
152
+ scene.add(realistic.root);
153
+
154
+ // Placement loads the same rock's geology maps and applies Call Me Sensei.
155
+ const stylized = await loadOfficialCatalogAsset({
156
+ assetId: 'rock-c8-arch-sandstone',
157
+ assetRuntime: assets,
158
+ parent: scene,
159
+ styleBundle: CALL_ME_SENSEI_STYLE_BUNDLE,
160
+ });
161
+
162
+ // Rock Lab/editor integrations receive the non-destructive authoring contract.
163
+ const rockPackage = await assets.getRockPackage('rock-c8-arch-sandstone');
164
+ const editorSource = createOfficialCatalogRockEditorDescriptor(
165
+ rockPackage.asset,
166
+ rockPackage,
167
+ );
168
+ ```
169
+
170
+ `editorSource` exposes `control.glb`, retained high detail, LOD0–LOD4,
171
+ collision, recipe, material configuration, and the required post-sculpt
172
+ reprojection/rebake/rebuild flags. These are immutable R2 URLs; the package
173
+ does not embed any rock media. Release acquired handles and dispose the runtime
174
+ when their scene lifetime ends.
175
+
125
176
  ## Install the agent guidance
126
177
 
127
178
  Everything in this section is present in the installed npm package.
@@ -167,7 +218,7 @@ it uses the disk workspace passed through `--workspace`; no account is needed.
167
218
  "command": "npx",
168
219
  "args": [
169
220
  "-y",
170
- "@call-me-sensei/toonlab@0.4.20",
221
+ "@call-me-sensei/toonlab@0.4.22",
171
222
  "--workspace",
172
223
  "/absolute/path/to/your-game/.toonlab"
173
224
  ],
@@ -181,8 +232,11 @@ it uses the disk workspace passed through `--workspace`; no account is needed.
181
232
 
182
233
  This server provides the anime-game profile, runtime guide, live-Lab
183
234
  contracts, deterministic document creation and mutation, policy validation,
184
- public asset discovery, local Library operations, and optional provider-backed
185
- generation when the developer supplies server-side provider keys.
235
+ public Gallery search/retrieval, local Library operations, and optional
236
+ provider-backed generation when the developer supplies server-side provider
237
+ keys. Authored tree recipes are not bundled. Call `search_public_gallery` with
238
+ `{ query: "tree", type: "tree-recipe" }`, then use
239
+ `get_public_gallery_asset` to retrieve the reviewed portable recipe.
186
240
 
187
241
  ### ToonLab Pro MCP
188
242
 
package/README.md CHANGED
@@ -19,7 +19,7 @@ Use ToonLab as a focused runtime library (`@call-me-sensei/toonlab` on npm), as
19
19
  an asset/preset authoring workspace, or as an asset-discovery service—not as a
20
20
  one-shot world generator.
21
21
 
22
- ## Versioned expectation: 0.4.20
22
+ ## Versioned expectation: 0.4.22
23
23
 
24
24
  For a correctly constructed and semantically labeled scene, one strict Call Me
25
25
  Sensei bundle application is expected to establish the supported visual
@@ -277,8 +277,9 @@ Catalog data therefore does **not** use a separate downloadable “current
277
277
  seed,” and new datasets are **not** schema migrations. Keeping every released
278
278
  batch in the repository gives fresh and upgraded installations the same final
279
279
  catalog while preserving a simple, auditable upgrade path. The checked-in
280
- catalog currently contains 8,163 official assets: 480 first-party ToonLab
281
- rocks plus 7,683 verified open assets.
280
+ catalog includes the original 480 first-party Stylized rocks, the 100-item
281
+ Nature Reference Rocks by ToonLab collection, and the verified open-asset
282
+ release. The two ToonLab rock collections keep distinct searchable identities.
282
283
 
283
284
  Applied filenames and SHA-256 digests are recorded in `schema_migrations` and
284
285
  `catalog_seed_batches`. Never edit, rename, or replace a released migration or
@@ -310,10 +311,13 @@ npm run dev
310
311
  # In an MCP client, use the command/config shown at /settings/.
311
312
  ```
312
313
 
313
- The local server can search the built-in procedural catalog and public CC0
314
- sources, read your saved presets and exported files, generate seeded recipes,
315
- and import assets into the project. It uses stdio, requires no account or
316
- OAuth, and keeps work local. See [Local MCP and workspace](https://github.com/call-me-sensei/toonlab/blob/main/docs/mcp.md) and
314
+ The local server can search your workspace, the public ToonLab Gallery, the
315
+ released official catalog, and public CC0 sources; read saved presets and
316
+ exported files; generate approved seeded recipes; and import assets into the
317
+ project. Authored Gallery recipes are fetched with their public license and
318
+ provenance instead of being copied into the npm package. The server uses stdio,
319
+ requires no account or OAuth for public discovery, and keeps local work local.
320
+ See [Local MCP and workspace](https://github.com/call-me-sensei/toonlab/blob/main/docs/mcp.md) and
317
321
  [Local database and public asset releases](https://github.com/call-me-sensei/toonlab/blob/main/docs/local-database-and-public-assets.md).
318
322
 
319
323
  ## The labs
@@ -375,7 +379,7 @@ camera behavior, and game feel remain host-owned or pre-beta.
375
379
  | Toon character shading | `@call-me-sensei/toonlab/toon` | Modern anime character shader: cel bands with art-directed face lighting, skin-tone shadow management, shadow-color HSV control, scene/self/contact shadows, average-shadow smoothing, rim light (fresnel or screen-space depth), stylized + anisotropic hair highlights, eye catchlights, role-aware specular, source map routing (normal/AO/emissive/MatCap/ramp/detail), inverted-hull outlines, glitter, stickers, perspective removal, shell fur, dither fades — 23 settings groups, all preset-serializable. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/toon-shading.md) |
376
380
  | Environment shading | `@call-me-sensei/toonlab/environment` | Modern anime-style scene shader for texture packs, standard glTF, and untextured scenes: material-role classification, wrapped lighting, packed-map hints, window cutouts, sun/lamp rigs, time-of-day, six-direction ambient probe, planar floor reflections, BVH vertex-AO baking, height fog, cloud shadows. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/environment.md) |
377
381
  | Water | `@call-me-sensei/toonlab/water` | Focused water treatment for a host-authored water footprint, continuous shore, and closed seabed: Gerstner waves, absorption color, refraction/caustics/foam, ripples, splashes, wakes, kelp, underwater treatment, and CPU buoyancy sampling. It does not design the coast or underwater habitat. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/water.md) |
378
- | Vegetation | `@call-me-sensei/toonlab/vegetation` | Instanced grass and flower fields; the 12 named pre-species legacy trees; and a focused procedural broadleaf `BranchTree` with deterministic branching, five leaf silhouettes, caller-supplied leaf/bark textures, and a portable recipe. Package-generated Call Me Sensei trees preserve authored bark first and otherwise select a registered deterministic bark surface instead of a bare trunk. The 165-species research roster remains repository-only experimental work. Independent Tree, Grass, and Flower shader profiles share one semantic-role renderer family. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/vegetation-sky.md) |
382
+ | Vegetation | `@call-me-sensei/toonlab/vegetation` | Tree/grass/flower construction and shader runtimes, including the focused procedural broadleaf `BranchTree` with deterministic branching, five leaf silhouettes, caller-supplied leaf/bark textures, and a portable recipe. No authored tree asset collection is bundled or exported: reviewed tree recipes remain searchable Gallery assets delivered through MCP with their CC0 metadata. Package-generated trees preserve authored bark first and otherwise select a registered deterministic bark surface instead of a bare trunk. The experimental species roster remains repository-only. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/vegetation-sky.md) |
379
383
  | Rock shader | `@call-me-sensei/toonlab/rock-shader` | Detailed, versioned rock-material profiles with projected detail, distance tint, normal fading, striping, moss and optional top layers, plus explicit source-albedo and vertex-color/AO integration. Call Me Sensei is the default. Geometry generation remains separate in `rockgen`. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/rock-shader.md) |
380
384
  | Ground shader | `@call-me-sensei/toonlab/ground-shader` | Splat-weighted anime terrain with slope/cliff detail, shoreline and weather response, HDR sun/shade controls, safe shadow defaults, and flat-albedo ground-field output for vegetation adoption. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/ground-shader.md) |
381
385
  | Sky | `@call-me-sensei/toonlab/sky` | Reusable atmosphere, palette, sun, moon, stars, and god-ray settings authored by Sky Lab and Sky & Cloud Lab. Your application coordinates final lighting and scene state. [Docs](https://github.com/call-me-sensei/toonlab/blob/main/docs/sky.md) |
@@ -460,21 +464,21 @@ profile parameters for other authored styles. Its recipe-v3 LOD0/1/2 topology
460
464
  uses 40/14/6 primary blades and compensates retained stroke width so zooming
461
465
  does not make the underlying terrain appear to change color.
462
466
 
463
- The supported tree set is intentionally the proven pre-species surface.
464
- Use a named legacy silhouette directly:
467
+ ToonLab does not ship predefined tree assets in npm. Search reviewed public
468
+ tree recipes through MCP, then pass the retrieved portable recipe options to
469
+ the runtime:
465
470
 
466
471
  ```js
467
- import {
468
- LEGACY_TREE_IDS,
469
- createLegacyTree,
470
- } from '@call-me-sensei/toonlab/vegetation';
472
+ import { StylizedTree } from '@call-me-sensei/toonlab/vegetation';
471
473
 
472
- console.log(LEGACY_TREE_IDS); // straight, leaning, see-through, ...
473
- const legacyTree = createLegacyTree('golden-gingko', {
474
+ // treeRecipe is the document returned by get_public_gallery_asset after
475
+ // search_public_gallery({ query: 'tree', type: 'tree-recipe' }).
476
+ const tree = new StylizedTree({
477
+ ...treeRecipe.options,
474
478
  trunkMap: barkTexture,
475
479
  vegetationShader: { preset: 'call_me_sensei' },
476
480
  });
477
- scene.add(legacyTree);
481
+ scene.add(tree);
478
482
  ```
479
483
 
480
484
  For a configurable recursive branch-type broadleaf, use the focused wrapper:
@@ -495,7 +499,8 @@ scene.add(tree);
495
499
  shapes. Botanical species generation is not a public package claim.
496
500
 
497
501
  Water, sky, flowers, trees, grass, and splashes keep procedural defaults, while
498
- legacy trees and BranchTree may use caller-owned leaf and bark textures. The
502
+ Gallery tree recipes, `StylizedTree`, and `BranchTree` may use caller-owned
503
+ leaf and bark textures. The
499
504
  Call Me Sensei tree path resolves bark in this order: explicit
500
505
  `trunkSurfaceProfile`, authored `trunkMap`, then the registered
501
506
  `call-me-sensei-bark-v1` fallback. Use `getTreeSurfaceProfileOptions()` when a
@@ -698,9 +703,11 @@ Ready-to-paste supported prompts are included in
698
703
  Two servers, and they compose:
699
704
 
700
705
  **Local (free, no account).** The stdio server included in this package
701
- searches the built-in procedural catalog and public CC0 sources, reads your
702
- saved presets and lab exports, generates seeded recipes, and imports assets
703
- into a disk-backed `.toonlab/` workspace:
706
+ searches local/project content, reviewed public Gallery recipes, the released
707
+ official catalog, and public CC0 sources; reads saved presets and Lab exports;
708
+ generates approved seeded recipes; and imports assets into a disk-backed
709
+ `.toonlab/` workspace. Use `search_public_gallery` for authored assets such as
710
+ the public tree collection—those recipes are not npm built-ins:
704
711
 
705
712
  ```json
706
713
  {
package/agents/PROMPTS.md CHANGED
@@ -1,7 +1,7 @@
1
1
  # ToonLab agent prompts
2
2
 
3
3
  These prompts are included with the npm package. They use only the supported
4
- 0.4.20 runtime, agent skills, and MCP workflows.
4
+ 0.4.22 runtime, agent skills, and MCP workflows.
5
5
 
6
6
  ## Existing-scene integration
7
7
 
@@ -55,11 +55,15 @@ document.
55
55
 
56
56
  ```text
57
57
  Using the ToonLab vegetation-sky skill, create the requested tree, shrub,
58
- grass, or groundcover with the public vegetation runtime. Keep species/recipe,
59
- seed, geometry, palette, and placement separate from the Tree/Grass/Flower
60
- shader profile. Emit stable modeled-part and material-role labels, preserve
61
- the recipe for regeneration, and verify LOD and shadow behavior. Do not use the
62
- repository-only experimental species engine.
58
+ grass, or groundcover. For an existing authored tree, search the public Gallery
59
+ through MCP first and retrieve its portable recipe; the npm package contains
60
+ tree construction/shader capability but no predefined tree asset collection.
61
+ Author a new `StylizedTree` or `BranchTree` only when requested or when accepted
62
+ discovery does not close the role. Keep recipe, seed, geometry, palette, and
63
+ placement separate from the Tree/Grass/Flower shader profile. Emit stable
64
+ modeled-part and material-role labels, preserve the recipe for regeneration,
65
+ and verify LOD and shadow behavior. Do not use the repository-only experimental
66
+ species engine.
63
67
  ```
64
68
 
65
69
  ## Rock generation and shader separation
@@ -82,10 +82,12 @@ or environment with ToonLab's runtime library in their own Three.js app.
82
82
  system preset with embedded shader controls. Sky, Cloud, and Sky & Cloud are
83
83
  live focused authoring surfaces. Vegetation is one shared
84
84
  implementation family with separate Tree, Grass, and Flower shader profiles;
85
- their Generation Labs own geometry/material data. The stable public package
86
- trees are the 12 named pre-species legacy presets plus the generic
87
- `BranchTree`; repository species work is experimental and must not be
88
- presented as supported. Ground is a separate shader domain. Scene weather,
85
+ their Generation Labs own geometry/material data. The public package ships
86
+ tree construction and shader capability, not predefined tree assets. Search
87
+ reviewed authored tree recipes through MCP; use `StylizedTree` or
88
+ `BranchTree` to instantiate or deliberately author them. Repository species
89
+ work is experimental and must not be presented as supported. Ground is a
90
+ separate shader domain. Scene weather,
89
91
  lighting, camera, interactions, and complete Sky/Cloud composition stay
90
92
  host-owned or experimental.
91
93
  - For style-bundle, multi-shader, or arbitrary-asset work, read
@@ -10,11 +10,12 @@ Inspect the connected server's tool names before calling anything. Do not
10
10
  assume the developer has ToonLab Pro, and do not assume a local OSS checkout.
11
11
 
12
12
  - **ToonLab OSS local MCP** exposes `get_workspace_info`,
13
- `search_cc0_assets`, `get_cc0_asset`, and `import_cc0_asset`. Its
14
- `search_assets` searches built-in procedural entries, the complete official
15
- R2-backed Gallery catalog, and the disk-backed project/library/workspace.
16
- Use `source: 'official'` for released assets and follow `nextOffset` until
17
- null.
13
+ `search_public_gallery`, `get_public_gallery_asset`, `search_cc0_assets`,
14
+ `get_cc0_asset`, and `import_cc0_asset`. Its `search_assets` searches
15
+ approved built-in generator/settings entries, the local released official
16
+ catalog, and the disk-backed project/library/workspace. Authored assets such
17
+ as reviewed tree recipes are searched through `search_public_gallery` rather
18
+ than copied into npm.
18
19
  - **ToonLab Pro remote MCP** exposes `get_runtime_guide`,
19
20
  `search_public_gallery`, and `get_toonlab_asset`. Its `search_assets`
20
21
  searches indexed external open assets; first-party rocks/trees and community
@@ -41,10 +42,12 @@ the surface the developer actually has and report which surface was used.
41
42
  1. Call `list_my_creations` with the task's text and exact tag filters, then
42
43
  `search_assets` with `source: 'library'`,
43
44
  `'workspace'`, `'workspace-storage'`, or `'builtin'` as appropriate. If no
44
- accepted local entry closes the role, call it with `source: 'official'` to
45
- search the released Gallery through the local database. Follow
46
- `nextOffset` until null so all matching official assets remain reachable.
47
- 2. Call local `get_asset` for the complete recipe/file descriptor.
45
+ accepted local entry closes the role, call `search_public_gallery` for
46
+ authored public assets and follow `nextOffset` until null. Use
47
+ `type: 'tree-recipe'` for reviewed trees. Use `search_assets` with
48
+ `source: 'official'` only for the installed released catalog.
49
+ 2. Call local `get_public_gallery_asset` for a selected Gallery document or
50
+ `get_asset` for a local/released-catalog record.
48
51
  3. When policy permits external CC0, call `search_cc0_assets`, then
49
52
  `get_cc0_asset`; call `import_cc0_asset` only after selection to download
50
53
  bytes plus their provenance manifest into `.toonlab/imports/`.
@@ -50,9 +50,11 @@ scene-kit role.
50
50
  2. **Reuse what exists.** In OSS, earlier imports, saved presets, and exports
51
51
  live in `.toonlab/`; call local `list_my_creations` and `search_assets` with
52
52
  `source: 'workspace'`, `'workspace-storage'`, `'library'`, or `'builtin'`.
53
- If those do not close the role, use local `search_assets` with
54
- `source: 'official'` for the complete released Gallery catalog and follow
55
- `nextOffset` until null.
53
+ If those do not close the role, use local `search_public_gallery` and follow
54
+ `nextOffset` until null; use `type: 'tree-recipe'` for authored trees and
55
+ retrieve a finalist with `get_public_gallery_asset`. Use local
56
+ `search_assets({ source: 'official' })` only for the installed released
57
+ catalog.
56
58
  In Pro, call cloud `list_my_creations`, then `search_public_gallery`; use
57
59
  `source: 'toonlab'` plus the appropriate catalog for first-party assets and
58
60
  follow `nextOffset`. For rocks on either surface, shortlist from positive
@@ -195,9 +197,10 @@ table, as the source of truth):
195
197
 
196
198
  - Seamless PBR material sets (brick, wood, ground …) → ambientCG.
197
199
  - Photoscanned props, HDRIs, high-end texture sets → Poly Haven.
198
- - Stylized/toon-ready models, vegetation, buildings → the built-in
199
- procedural catalog first only for families that passed the base-set
200
- reliability gate; otherwise compare curated external candidates.
200
+ - Authored stylized/toon-ready models and vegetation → the public Gallery
201
+ first; retrieve their portable document and provenance through MCP. Use a
202
+ built-in procedural family only when it passed the base-set reliability gate
203
+ and the task calls for new generation rather than an existing asset.
201
204
  - Stylized *seamless textures* → `@call-me-sensei/toonlab/texgen` in code
202
205
  (60+ presets); the catalog has no texture entries, so this route is a
203
206
  package import, not an MCP call.
@@ -80,8 +80,11 @@ User guidance:
80
80
  create the pass after all writer meshes exist, call its `update()` every frame before grass, require
81
81
  `writerCount > 0` and `ready`, and call `invalidate()` after repainting a
82
82
  writer without a transform change.
83
- - In the public package, use `LEGACY_TREE_PRESETS` and `createLegacyTree()` for the 12
84
- supported pre-species silhouettes. Use `BranchTree` when the developer wants
83
+ - The public package contains tree construction and shader capability, not a
84
+ predefined tree asset collection. For an authored tree, use the connected
85
+ MCP's `search_public_gallery` and `get_public_gallery_asset` tools, then
86
+ instantiate its portable recipe with `StylizedTree`. Use `BranchTree` when
87
+ the developer explicitly wants
85
88
  recursive branching, five broadleaf silhouettes, leaf color/texture plus a
86
89
  portable lit/shadow/crown palette, independent leaf `coverageScale`, bark
87
90
  color/texture, authored trunk bend/twist/taper, roots, portable documents,
@@ -108,11 +111,11 @@ User guidance:
108
111
  `GRASS_SHADER_PROFILE`, and `FLOWER_SHADER_PROFILE` through the bundle's
109
112
  `treeShader`, `grassShader`, and `flowerShader` slots. They share a renderer
110
113
  family and semantic material contract, but serialize and apply independently.
111
- Keep asset albedo and legacy/BranchTree geometry/material inputs separate from all
114
+ Keep asset albedo and Gallery-recipe/BranchTree geometry/material inputs separate from all
112
115
  three shader treatments.
113
116
  - Grass palettes update base, tip, and shadow tint together; they do not change
114
117
  shadow strength, wind, or current weather.
115
- - Use the public versioned Grass, vegetation-shader, legacy/BranchTree/flower recipe, and Sky
118
+ - Use the public versioned Grass, vegetation-shader, BranchTree/flower recipe, and Sky
116
119
  preset document APIs for portable data; do not copy lab-local validators.
117
120
  - Treat Sky as one integrated World System, not a separate Shader Lab. Its
118
121
  shader, sun, clouds, stars, and procedural motion form one system preset with
@@ -50,9 +50,11 @@ scene-kit role.
50
50
  2. **Reuse what exists.** In OSS, earlier imports, saved presets, and exports
51
51
  live in `.toonlab/`; call local `list_my_creations` and `search_assets` with
52
52
  `source: 'workspace'`, `'workspace-storage'`, `'library'`, or `'builtin'`.
53
- If those do not close the role, use local `search_assets` with
54
- `source: 'official'` for the complete released Gallery catalog and follow
55
- `nextOffset` until null.
53
+ If those do not close the role, use local `search_public_gallery` and follow
54
+ `nextOffset` until null; use `type: 'tree-recipe'` for authored trees and
55
+ retrieve a finalist with `get_public_gallery_asset`. Use local
56
+ `search_assets({ source: 'official' })` only for the installed released
57
+ catalog.
56
58
  In Pro, call cloud `list_my_creations`, then `search_public_gallery`; use
57
59
  `source: 'toonlab'` plus the appropriate catalog for first-party assets and
58
60
  follow `nextOffset`. For rocks on either surface, shortlist from positive
@@ -195,9 +197,10 @@ table, as the source of truth):
195
197
 
196
198
  - Seamless PBR material sets (brick, wood, ground …) → ambientCG.
197
199
  - Photoscanned props, HDRIs, high-end texture sets → Poly Haven.
198
- - Stylized/toon-ready models, vegetation, buildings → the built-in
199
- procedural catalog first only for families that passed the base-set
200
- reliability gate; otherwise compare curated external candidates.
200
+ - Authored stylized/toon-ready models and vegetation → the public Gallery
201
+ first; retrieve their portable document and provenance through MCP. Use a
202
+ built-in procedural family only when it passed the base-set reliability gate
203
+ and the task calls for new generation rather than an existing asset.
201
204
  - Stylized *seamless textures* → `@call-me-sensei/toonlab/texgen` in code
202
205
  (60+ presets); the catalog has no texture entries, so this route is a
203
206
  package import, not an MCP call.
@@ -80,8 +80,11 @@ User guidance:
80
80
  create the pass after all writer meshes exist, call its `update()` every frame before grass, require
81
81
  `writerCount > 0` and `ready`, and call `invalidate()` after repainting a
82
82
  writer without a transform change.
83
- - In the public package, use `LEGACY_TREE_PRESETS` and `createLegacyTree()` for the 12
84
- supported pre-species silhouettes. Use `BranchTree` when the developer wants
83
+ - The public package contains tree construction and shader capability, not a
84
+ predefined tree asset collection. For an authored tree, use the connected
85
+ MCP's `search_public_gallery` and `get_public_gallery_asset` tools, then
86
+ instantiate its portable recipe with `StylizedTree`. Use `BranchTree` when
87
+ the developer explicitly wants
85
88
  recursive branching, five broadleaf silhouettes, leaf color/texture plus a
86
89
  portable lit/shadow/crown palette, independent leaf `coverageScale`, bark
87
90
  color/texture, authored trunk bend/twist/taper, roots, portable documents,
@@ -108,11 +111,11 @@ User guidance:
108
111
  `GRASS_SHADER_PROFILE`, and `FLOWER_SHADER_PROFILE` through the bundle's
109
112
  `treeShader`, `grassShader`, and `flowerShader` slots. They share a renderer
110
113
  family and semantic material contract, but serialize and apply independently.
111
- Keep asset albedo and legacy/BranchTree geometry/material inputs separate from all
114
+ Keep asset albedo and Gallery-recipe/BranchTree geometry/material inputs separate from all
112
115
  three shader treatments.
113
116
  - Grass palettes update base, tip, and shadow tint together; they do not change
114
117
  shadow strength, wind, or current weather.
115
- - Use the public versioned Grass, vegetation-shader, legacy/BranchTree/flower recipe, and Sky
118
+ - Use the public versioned Grass, vegetation-shader, BranchTree/flower recipe, and Sky
116
119
  preset document APIs for portable data; do not copy lab-local validators.
117
120
  - Treat Sky as one integrated World System, not a separate Shader Lab. Its
118
121
  shader, sun, clouds, stars, and procedural motion form one system preset with
@@ -0,0 +1,63 @@
1
+ #!/usr/bin/env node
2
+
3
+ import { createHash } from 'node:crypto';
4
+ import { readFile } from 'node:fs/promises';
5
+ import path from 'node:path';
6
+
7
+ import { closeDatabase, getPool, withTransaction } from './client.mjs';
8
+
9
+ const fileArgument = process.argv[2];
10
+ if (!fileArgument) throw new Error('Usage: node database/apply-one-catalog-seed.mjs database/seeds/catalog/NNNN_release.sql');
11
+ const file = path.resolve(fileArgument);
12
+ const catalogSeedRoot = `${path.resolve('database/seeds/catalog')}${path.sep}`;
13
+ if (!file.startsWith(catalogSeedRoot) || !/^\d{4}_[a-z0-9._-]+\.sql$/iu.test(path.basename(file))) {
14
+ throw new Error('Only one numbered catalog seed below database/seeds/catalog may be applied.');
15
+ }
16
+
17
+ const sql = await readFile(file, 'utf8');
18
+ const hash = createHash('sha256').update(sql).digest('hex');
19
+ const name = path.basename(file);
20
+ const release = sql.match(/^-- Release: ([a-z0-9._-]+)$/im)?.[1];
21
+ const assetCount = Number(sql.match(/^-- Asset count: (\d+)$/m)?.[1]);
22
+ if (!release || !Number.isSafeInteger(assetCount) || assetCount < 0) {
23
+ throw new Error(`${name}: missing generated release metadata.`);
24
+ }
25
+
26
+ try {
27
+ const pool = await getPool();
28
+ await pool.query(
29
+ `create table if not exists catalog_seed_batches (
30
+ name text primary key,
31
+ sha256 text not null,
32
+ release text,
33
+ asset_count integer not null default 0,
34
+ applied_at timestamptz not null default now()
35
+ )`,
36
+ );
37
+ const result = await withTransaction(async (client) => {
38
+ await client.query('select pg_advisory_xact_lock(hashtext($1))', ['toonlab:catalog_seed_batches']);
39
+ const existing = await client.query('select sha256 from catalog_seed_batches where name = $1', [name]);
40
+ if (existing.rowCount) {
41
+ if (existing.rows[0].sha256 !== hash) throw new Error(`${name} changed after it was applied`);
42
+ return { status: 'unchanged' };
43
+ }
44
+ await client.query(sql);
45
+ await client.query(
46
+ `insert into catalog_seed_batches (name, sha256, release, asset_count)
47
+ values ($1, $2, $3, $4)`,
48
+ [name, hash, release, assetCount],
49
+ );
50
+ const published = await client.query(
51
+ `select count(*)::int as count from catalog_assets
52
+ where release = $1 and availability_status = 'active'`,
53
+ [release],
54
+ );
55
+ if (Number(published.rows[0].count) !== assetCount) {
56
+ throw new Error(`${release}: expected ${assetCount} active assets after seed.`);
57
+ }
58
+ return { published: Number(published.rows[0].count), status: 'applied' };
59
+ });
60
+ process.stdout.write(`${JSON.stringify({ assetCount, hash, name, release, ...result }, null, 2)}\n`);
61
+ } finally {
62
+ await closeDatabase();
63
+ }