airi/docs/ai/context/plans
Lilia_Chen bc7dda3d5f
feat(stage-tamagotchi): add experimental Godot stage sidecar (#1830)
## Summary

Adds the experimental Godot stage sidecar path for `stage-tamagotchi`.

This PR wires the existing Tamagotchi model selection flow into an
external Godot runtime window. The renderer gates Godot scene input to
VRM models, Electron main materialises the selected model bytes to a
local file, and the Godot sidecar receives the native path over a local
WebSocket bridge before importing and displaying the avatar at runtime.

## What Changed

- Added a typed Godot scene input contract with `format: "vrm"`.
- Added renderer-side VRM-only gating before sending selected model data
to Electron main.
- Added Electron main sidecar management for:
  - launching Godot
  - starting the local WebSocket bridge
  - materialising selected VRM bytes under app `userData`
  - forwarding scene apply messages to Godot
  - optional remote debugging support
- Added Godot runtime scripts for:
  - sidecar startup and WebSocket orchestration
  - message envelope parsing
  - avatar import and atomic replacement
  - runtime VRM import through Godot `GLTFDocument`
- Added engine-local docs for runtime import, live debugging, vendor
patches, and current VRM support boundaries.
- Removed temporary tests after using them to verify the glue behaviour
locally, to keep the review surface smaller.

## Vendor Code Note

A large part of this PR is vendored Godot add-on code, not AIRI business
logic.

The bulk of the added files under:

- `engines/stage-tamagotchi-godot/addons/vrm/**`
- `engines/stage-tamagotchi-godot/addons/Godot-MToon-Shader/**`

comes from V-Sekai Godot VRM / MToon add-ons. These files are required
because Godot plugins are project-local source/assets rather than
package-manager dependencies.

The intended review scope for vendor code is limited to:

- source baseline metadata
- license/plugin config
- Godot-generated metadata notes
- the documented local patch in `addons/vrm/vrm_extension.gd`

The application/runtime code to review is mainly under:

- `apps/stage-tamagotchi/src/shared/eventa/index.ts`
- `apps/stage-tamagotchi/src/renderer/pages/settings/models/`
- `apps/stage-tamagotchi/src/main/services/airi/godot-stage/`
- `engines/stage-tamagotchi-godot/scripts/`

## Current Boundary

This is still an experimental G1 Godot sidecar path.

The runtime scene input contract accepts `.vrm` files only. The current
Godot runtime importer covers the VRM 0.x path used by the local fixture
through AIRI’s runtime bridge over the vendored VRM extension. VRM 1.0
editor import support exists in the vendored add-on, but the sidecar
runtime importer does not yet register the full `VRMC_*` extension set,
so this PR does not claim full VRM 1.0 runtime support.

---------

Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
2026-05-15 14:37:32 +08:00
..
2026-05-09-character-cards-cloud-sync-design.md feat(stage-tamagotchi): add experimental Godot stage sidecar (#1830) 2026-05-15 14:37:32 +08:00