1实现原理 · 为什么它能做到
核心取巧:装置不是建出来的,而是一张既有照片。plate.png 就是那台展开的折叠屏(含手、边框、铰链),skill 明令不得重画、不得 CSS 建模、不得换图;缺图就停下重装而不是自己造一台手机。
`assets/plate.png` IS the device. Never recreate, redraw, or CSS-model the foldable, its bezel, the hinge, or the hands, and never substitute a different image.
rig 是锁定块:两个 .screen 矩形、各自圆角与铰链分割都是从那张照片逐像素量出来的,agent 只被允许改每个 .content 里的内容与那一条共享时间线。
/* ===== LOCKED RIG — do not edit this block. Geometry is measured from the plate. ===== */
mask 走几何而不是分割:曾用亮度分割 + 形态学闭运算做 mask-image,结果填平了 12 px 的铰链侧圆角、并吞掉铰链分割线的抗锯齿像素,于是改为数值测量边缘与圆角后直接用 CSS 圆角矩形。
Lesson: for device-screen replacement, measure edges and corners numerically and build the mask from geometry. Never ship a morphology-cleaned segmentation as a mask.
时间轴纪律为「可 seek」服务:整片只允许一条共享 GSAP 时间线(往标记处的 tl 加补间),禁止再建第二条时间线或注册第二个 window.__timelines 键,禁 repeat:-1、禁 Math.random、禁时钟。
One timeline. Add your tweens to `tl` inside the marked hook; do not create a second `gsap.timeline` or register another `window.__timelines` key.
脚手架刻意最小化:build.mjs 无网络、无第三方依赖、只写 --out 内,并在每次写入前 lstat 检查、拒绝穿过符号链接写;它把 plate、screen-spec 与(可选的)真实图标表拷进项目,并把帧规格写死成 1448×1086@30fps。
if (st.isSymbolicLink()) throw new Error(`refusing to write through symlink: ${p}`);
「看起来是真的」由取材纪律保证:用户要 TikTok/Instagram,就得去线上移动端抠真实图标与版式度量、并配真实帖子与真实账号计数;发明 handle 只允许用在用户明说要的虚构/戏仿屏。
Real content must be real: if the user asks for TikTok or Instagram, pull the actual UI glyphs and layout metrics from the live site and use real posts (with their real usernames and counts), not invented ones.
交付面被刻意收窄:整片固定 1448×1086(底图原生 4:3),想要 16:9 或 1:1 只能作为后续裁切,不允许改 rig 尺寸来迁就内容。
| Plate | 1448 × 1086 |
2核心能力
3外部依赖
| 类型 | 依赖 |
|---|---|
| cli | HyperFrames CLI(npx hyperframes@latest;check / snapshot / render) |
| network | GSAP 3.14.2(合成页在预览/渲染时由浏览器加载;未随包分发) |
| cli | yt-dlp(取真实帖子的说明、计数与时长;登录态外可用) |
| network | Instagram Reels 直链下载(登出页面里的 scontent-*.cdninstagram.com mp4,用 Safari UA + instagram.com Referer 取;链接数小时内失效) |
| package | Node 18+(自带脚本无第三方依赖) |
| cli | 素材来源:用户自备或按上面配方自抓的片段、头像、字体(SKILL.md 把它们归为用户侧副作用,须来自有权使用的来源) |
| package | 随包的真实应用图标表(icons-tiktok.svg / icons-instagram.svg,从公开移动端 DOM 抠出的 <symbol> 集;含他人商标,声明为戏仿/评论用途) |
4风险提醒 风险提醒:黄色 · 留意使用
- 底图与图标表的版权/商标面 — 底图取自他人公开发布的照片(抹屏后作为梗图模板再分发),图标表复刻 TikTok/Instagram 的商标 glyph,仅声明戏仿/评论用途。商用或大规模发布前应自行评估,SKILL.md 也把责任交回用户('users of this skill publish results at their own judgment')。
- 取材文档会引导访问真实站点并伪装 UA — sourcing-real-ui.md 指示用 iPhone/Safari UA 与 instagram.com Referer 取公开页面与 CDN 直链。虽未发现验证码绕过或自动化侦测规避,但这属于对平台的自动化访问,账号与合规风险由用户承担;该行为只发生在用户要求真实内容时。
- 渲染非完全离线,且 CLI 用可变标签 — GSAP 从 cdn.jsdelivr.net 在预览/渲染时加载;HyperFrames CLI 经 npx hyperframes@latest 取(SKILL.md 自己提示 @latest 可变、建议钉版本以做到逐字节可复现)——供应链与可复现性都需自控。
- SKILL.md 的副作用清单不完整 — 『complete list』只列了 npm registry 与 CDN,漏掉取材文档指引的站点抓取(见 second_pass 的 discrepancy);只读 SKILL.md 的用户会对执行期外发面估计不足。
- 装置是一张照片,也就只有一个机型/机位 — SKILL.md 明说这是『one specific photo』:想换单屏、笔记本或自己提供真机边框都不适用;换底图须按 screen-geometry.md 的重量测流程重新量几何(含圆角与铰链)。
- 内容合规靠人工 — 『真实内容必须真实』的要求(真实账号、真实计数)没有代码校验;抓来的 caption/用户名会原样进画面,若含敏感或指令式文本,skill 不会拦。
5第二遍独立确认
- [ok] build.mjs 是否真的无网络、无第三方依赖 — import 仅 { promises as fs } from 'node:fs'、path、fileURLToPath;无 fetch/http/https/dns/child_process。全部行为是读模板、字符串替换 __COMPOSITION_ID__/__DURATION__、写文件与拷贝资源。头注释亦声明 '// No network access. No dependencies beyond Node 18+.'
- [ok] 『不改 rig』是否只是文案(模板与 spec 是否一致) — 模板 #screen-left{left:223px;width:495px} / #screen-right{left:724px;width:498px}、.screen{top:105px;height:849px}、圆角 56px 12px 与 screen-spec.json 的 rect/outer_corner_radius_px/hinge_corner_radius_px 完全对应;build.mjs 也把可用视口打印成 '495x849' / '498x849'。
- [ok] feed-recipes.md 引用的图标 symbol 是否随包(避免抄了配方却没有图标) — grep 确认 assets/icons-instagram.svg 内含 id="ig-like-filled"(配方里 tl.set('#ig-heart-use', { attr: { href: '#ig-like-filled' } }, 2.7) 用到),另有 ig-like/ig-comment/ig-share/ig-home/ig-reels/ig-search/ig-camera/ig-verified 等 10 个 symbol;icons-tiktok.svg 含 tt-like/tt-comment/tt-bookmark/tt-share/tt-plus/tt-home/tt-discover/tt-inbox/tt-profile/tt-search/tt-add/tt-live/tt-verified/tt-note 共 14 个。
- [discrepancy] SKILL.md 的『Network and side effects (complete list)』是否真的完整 — 该清单只列 registry.npmjs.org 与 cdn.jsdelivr.net,把抓取归入『Anything YOU add to the screens … is your side effect』;但同目录的 references/sourcing-real-ui.md 给出了具体抓取路径(www.tiktok.com、instagram.com、scontent-*.cdninstagram.com)与 UA/Referer 做法,并附 ffmpeg 裁片命令。对只读 SKILL.md 的用户而言,执行期外发面被低估了(文档级出入,非代码行为不符)。
- [unlocatable] 『几何是从照片逐像素量出来的』能否在包内独立复核 — screen-spec.json 给出了量测结论(左右 rect、r=56/12、铰链 x719–723)与出处推文,但两个屏幕已被抹平、原始推文照片不在包内,且本次为只读侦查不联网取原图,故这些数值无法独立复算;references/screen-geometry.md 提供的是重测方法而非原始数据。
- [ok] 状态栏与铰链的还原是否有据可依 — screen-spec.json 的 hinge 字段(x 719 / w 5 / rgb(130,133,142))与 status_bar(左 9:41@x44,y18;右 wifi_battery_right_inset 40)给出像素级依据;feed-recipes.md 的忠实度清单要求复现该分置,SKILL.md 亦在 Flow 第 3 步复述。
- [ok] 底图与预览图的引用是否都在包内 — SKILL.md 正文  与 build.mjs 拷贝的 assets/plate.png、assets/screen-spec.json 均在包内;plate-preview.jpg 仅作预览,不参与渲染。
6结论
d33100badc2a58ee…ba7a0bb6d3