eggs
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseEggs
Eggs
Quick Start
快速开始
When the user asks to spawn the desktop companion, including , run the bundled runtime from this skill directory:
/eggsbash
python3 scripts/egg_desktop.py startWhen the user asks to stop it:
bash
python3 scripts/egg_desktop.py stopFor status:
bash
python3 scripts/egg_desktop.py statusFor restart:
bash
python3 scripts/egg_desktop.py restartRemote interaction is opt-in. To connect this skill to a separately deployed remote sprite server:
bash
python3 scripts/egg_desktop.py remote server http://localhost:8787
python3 scripts/egg_desktop.py remote upload dino
python3 scripts/egg_desktop.py remote
python3 scripts/egg_desktop.py remote statusremoteremote randomFor invite rooms:
bash
python3 scripts/egg_desktop.py remote room ABC123To leave:
bash
python3 scripts/egg_desktop.py remote leaveFor state changes:
bash
python3 scripts/egg_desktop.py state unborn
python3 scripts/egg_desktop.py state ready
python3 scripts/egg_desktop.py state hatching
python3 scripts/egg_desktop.py state hatched
python3 scripts/egg_desktop.py state walk
python3 scripts/egg_desktop.py state sleep
python3 scripts/egg_desktop.py state eat
python3 scripts/egg_desktop.py state drink
python3 scripts/egg_desktop.py state play
python3 scripts/egg_desktop.py state roar
python3 scripts/egg_desktop.py state attackTo install a replacement spritesheet:
bash
python3 scripts/egg_desktop.py spritesheet /path/to/dino.png dino
python3 scripts/egg_desktop.py restart当用户请求生成桌面助手(包括输入)时,运行本技能目录中的捆绑运行时:
/eggsbash
python3 scripts/egg_desktop.py start当用户要求停止时:
bash
python3 scripts/egg_desktop.py stop查看状态:
bash
python3 scripts/egg_desktop.py status重启:
bash
python3 scripts/egg_desktop.py restart远程交互为可选功能。如需将本技能连接到单独部署的远程精灵服务器:
bash
python3 scripts/egg_desktop.py remote server http://localhost:8787
python3 scripts/egg_desktop.py remote upload dino
python3 scripts/egg_desktop.py remote
python3 scripts/egg_desktop.py remote status默认情况下,会加入服务器端的随机等待池(等同于)。匹配成功后,服务器会为该配对创建临时私人房间。
remoteremote random邀请房间操作:
bash
python3 scripts/egg_desktop.py remote room ABC123退出房间:
bash
python3 scripts/egg_desktop.py remote leave状态更改:
bash
python3 scripts/egg_desktop.py state unborn
python3 scripts/egg_desktop.py state ready
python3 scripts/egg_desktop.py state hatching
python3 scripts/egg_desktop.py state hatched
python3 scripts/egg_desktop.py state walk
python3 scripts/egg_desktop.py state sleep
python3 scripts/egg_desktop.py state eat
python3 scripts/egg_desktop.py state drink
python3 scripts/egg_desktop.py state play
python3 scripts/egg_desktop.py state roar
python3 scripts/egg_desktop.py state attack安装替换精灵图:
bash
python3 scripts/egg_desktop.py spritesheet /path/to/dino.png dino
python3 scripts/egg_desktop.py restartSprite Tools
精灵工具
Use the bundled Swift tools in when asked to process, extract, validate, or merge desktop companion sprite sheets.
When tools are run with , they write and to the requested output directory and also install copies to and . If extraction is run without , use the input image stem and write .
tools/--name <sprite><sprite>.png<sprite>.json~/.codex/eggs/<sprite>.png~/.codex/eggs/<sprite>.json--name<input-name>_spritesheet.png/jsonBuild tools into a temporary location instead of committing platform-specific binaries:
bash
mkdir -p .swift-module-cache
CLANG_MODULE_CACHE_PATH="$PWD/.swift-module-cache" \
swiftc -module-cache-path "$PWD/.swift-module-cache" \
eggs/tools/extract_sprite.swift \
-o /tmp/extract_spriteExtract a bordered grid:
bash
/tmp/extract_sprite <input.png> <output-dir> --prefix <name>Extract a borderless regular grid:
bash
/tmp/extract_sprite <input.png> <output-dir> \
--grid uniform \
--columns <n> \
--rows <n> \
--prefix <name>Force multiple source sheets into a common frame canvas:
bash
/tmp/extract_sprite <input.png> <output-dir> --frame-size 251 --prefix <name>Merge extracted sheets vertically:
bash
CLANG_MODULE_CACHE_PATH="$PWD/.swift-module-cache" \
swiftc -module-cache-path "$PWD/.swift-module-cache" \
eggs/tools/merge_spritesheets.swift \
-o /tmp/merge_spritesheets
/tmp/merge_spritesheets <output-dir> [--name <sprite>] <sheet-a.json> <sheet-b.json>Validation helpers:
bash
swiftc eggs/tools/check_sprite.swift -o /tmp/check_sprite
swiftc eggs/tools/bounds_sprite.swift -o /tmp/bounds_sprite当需要处理、提取、验证或合并桌面助手精灵图时,使用目录中的捆绑Swift工具。
当工具使用参数运行时,会将和写入指定的输出目录,同时将副本安装到和。如果提取时未使用参数,则使用输入图像的文件名前缀,生成。
tools/--name <sprite><sprite>.png<sprite>.json~/.codex/eggs/<sprite>.png~/.codex/eggs/<sprite>.json--name<input-name>_spritesheet.png/json将工具编译到临时位置,而非提交特定平台的二进制文件:
bash
mkdir -p .swift-module-cache
CLANG_MODULE_CACHE_PATH="$PWD/.swift-module-cache" \
swiftc -module-cache-path "$PWD/.swift-module-cache" \
eggs/tools/extract_sprite.swift \
-o /tmp/extract_sprite提取带边框的网格:
bash
/tmp/extract_sprite <input.png> <output-dir> --prefix <name>提取无边框的规则网格:
bash
/tmp/extract_sprite <input.png> <output-dir> \
--grid uniform \
--columns <n> \
--rows <n> \
--prefix <name>强制将多个源图合并到统一的帧画布中:
bash
/tmp/extract_sprite <input.png> <output-dir> --frame-size 251 --prefix <name>垂直合并提取的精灵图:
bash
CLANG_MODULE_CACHE_PATH="$PWD/.swift-module-cache" \
swiftc -module-cache-path "$PWD/.swift-module-cache" \
eggs/tools/merge_spritesheets.swift \
-o /tmp/merge_spritesheets
/tmp/merge_spritesheets <output-dir> [--name <sprite>] <sheet-a.json> <sheet-b.json>验证辅助工具:
bash
swiftc eggs/tools/check_sprite.swift -o /tmp/check_sprite
swiftc eggs/tools/bounds_sprite.swift -o /tmp/bounds_spriteRuntime Behavior
运行时行为
- Use only the bundled ; it has no third-party Python dependencies.
scripts/egg_desktop.py - On macOS, the manager compiles and launches the bundled native Swift/Cocoa overlay at first run. This requires and the macOS Swift compiler, but no npm, Electron, PyPI packages, or external assets.
python3 - When remote interaction is enabled, the Swift runtime remains the display runtime. A separate Python sidecar handles remote WebSocket sync and writes for Swift to render remote peers.
~/.codex/eggs/remote-peers.json - On non-macOS, the manager falls back to its Python/Tk runtime. If Tkinter is unavailable, report that the local Python build cannot display the fallback GUI.
- The script launches a detached local GUI process and stores its PID/log under .
~/.codex/eggs/ - Re-running should not create duplicates; use
startwhen the user wants a fresh companion.restart - The runtime reads the current sprite and state from .
~/.codex/eggs/state.json - The runtime reads optional user animation names from under
~/.codex/eggs/config.json, where each animation object usesanimations.<sprite>.<name>androw.loop - The runtime first looks for a user-installed sprite at with optional
~/.codex/eggs/<sprite>.png, then bundled skill assets at~/.codex/eggs/<sprite>.jsonandassets/<sprite>.png, then falls back to a simple procedural placeholder drawing.assets/<sprite>.json - Resolve bundled assets relative to this installed skill directory; never rely on the original repo path or any absolute path.
/Users/... - Do not hardcode the frame size. The animation runtime reads and
frameWidthfromframeHeightto slice the PNG and size the desktop window. It only falls back to 251x251 if metadata is missing or invalid.<sprite>.json - The bundled spritesheet currently has 251x251 frames in a 5x11 regular grid.
- keeps
assets/dino.jsonasimage, relative to the JSON file's own directory. Generated sprite metadata should stay portable in the same way.dino.png - Without custom config, each row is a state: ,
unborn,ready,hatching,hatched,walk,sleep,eat,drink,play,roar.attack - With custom config, accept animation names from , for example
config.json,"idle": { "row": 3, "loop": true }, or"attackOnce": { "row": 10, "loop": false }."roar3": { "row": 9, "loop": 3 } - Chinese state requests are supported through aliases such as ,
睡觉,吃鸡腿,喝水,玩耍, and咆哮.攻击 - The and
statecommands writesprite; running windows poll it and switch animation rows or sprite assets without restarting.~/.codex/eggs/state.json - The desktop window can be repositioned by dragging it with the mouse.
- Remote settings are stored in , anonymous device identity in
~/.codex/eggs/remote.json, and downloaded remote peer indexes in~/.codex/eggs/client.jsonwith shared blob files under~/.codex/eggs/remote/<peer_id>/. Remote cache never overwrites local~/.codex/eggs/remote/blobs/.<sprite>.png/json - Remote upload remembers the selected sprite name, and room/random interaction uses for the live WebSocket session rather than resolving peers through the public sprite detail endpoint.
device_id + sprite name - The remote Go server is not part of the installed skill; it lives at the repository root under and should be deployed separately.
server/ - Sprite preparation tools are bundled under ; do not rely on old root-level compiled binaries.
tools/
- 仅使用捆绑的;它没有第三方Python依赖。
scripts/egg_desktop.py - 在macOS系统上,管理器会在首次运行时编译并启动捆绑的原生Swift/Cocoa覆盖层。这需要和macOS Swift编译器,但不需要npm、Electron、PyPI包或外部资源。
python3 - 启用远程交互后,Swift运行时仍作为显示运行时。独立的Python辅助进程处理远程WebSocket同步,并将写入供Swift渲染远程伙伴。
~/.codex/eggs/remote-peers.json - 在非macOS系统上,管理器会回退到Python/Tk运行时。如果Tkinter不可用,则报告本地Python构建无法显示备用GUI。
- 该脚本会启动一个独立的本地GUI进程,并将其PID/日志存储在目录下。
~/.codex/eggs/ - 重复运行不应创建重复进程;当用户需要全新的助手时,请使用
start。restart - 运行时从读取当前精灵和状态。
~/.codex/eggs/state.json - 运行时从中的
~/.codex/eggs/config.json读取可选的用户动画名称,其中每个动画对象使用animations.<sprite>.<name>和row参数。loop - 运行时首先在(可选搭配
~/.codex/eggs/<sprite>.png)中查找用户安装的精灵,然后在技能捆绑资源~/.codex/eggs/<sprite>.json和assets/<sprite>.png中查找,最后回退到简单的程序生成占位图。assets/<sprite>.json - 相对于已安装的技能目录解析捆绑资源;切勿依赖原始仓库路径或任何绝对路径。
/Users/... - 不要硬编码帧大小。动画运行时从读取
<sprite>.json和frameWidth来切割PNG并设置桌面窗口大小。只有当元数据缺失或无效时,才会回退到251x251。frameHeight - 当前捆绑的精灵图在5x11规则网格中包含251x251的帧。
- 中的
assets/dino.json字段设为image,相对于JSON文件自身的目录。生成的精灵元数据应保持同样的可移植性。dino.png - 若无自定义配置,每一行对应一个状态:(未孵化)、
unborn(就绪)、ready(孵化中)、hatching(已孵化)、hatched(行走)、walk(睡眠)、sleep(进食)、eat(饮水)、drink(玩耍)、play(咆哮)、roar(攻击)。attack - 若有自定义配置,接受中的动画名称,例如
config.json、"idle": { "row": 3, "loop": true }或"attackOnce": { "row": 10, "loop": false }。"roar3": { "row": 9, "loop": 3 } - 支持中文状态请求,对应别名如、
睡觉、吃鸡腿、喝水、玩耍和咆哮。攻击 - 和
state命令会写入sprite;运行中的窗口会轮询该文件,无需重启即可切换动画行或精灵资源。~/.codex/eggs/state.json - 可通过鼠标拖动重新定位桌面窗口。
- 远程设置存储在中,匿名设备标识存储在
~/.codex/eggs/remote.json中,下载的远程伙伴索引存储在~/.codex/eggs/client.json中,共享Blob文件存储在~/.codex/eggs/remote/<peer_id>/下。远程缓存永远不会覆盖本地~/.codex/eggs/remote/blobs/。<sprite>.png/json - 远程上传会记住所选的精灵名称,房间/随机交互使用作为实时WebSocket会话标识,而非通过公共精灵详情端点解析伙伴。
device_id + sprite name - 远程Go服务器不属于已安装的技能;它位于仓库根目录的下,需单独部署。
server/ - 精灵准备工具捆绑在目录下;请勿依赖旧的根目录编译二进制文件。
tools/
Notes For Codex
给Codex的提示
If the user types or asks to spawn the companion, do the start action immediately and briefly report whether it launched. If the user asks to change companion state, run the command with the closest matching state name. Do not open or explain the script unless launch fails.
/eggsstate如果用户输入或请求生成助手,请立即执行启动操作,并简要报告是否启动成功。如果用户要求更改助手状态,请使用最匹配的状态名称运行命令。除非启动失败,否则不要打开或解释脚本。
/eggsstate