Files
piik/AGENTS.md
T
AAA 24e9b639a8 feat: add attended remote control and refine shared viewing (#482)
Piik can now let one invited Viewer control the Host's shared desktop or window, using the existing media route and explicit source-scoped consent. This phase also finishes Viewer playback settings, the combined interaction window, the shared control/theme/icon polish, and concrete forwarding-feedback recovery fixes.

Remote input stays off by default, uses one controller and releases held input on revocation, retirement or loss. Existing 2.x sharing remains compatible; new capabilities are negotiated with supporting App/Site/relay peers. No virtual input driver, new media listener or route planner is added.

Validation: full Web check (97 files / 1,677 tests), Windows Go/native checks; seven real Browser/App lifecycle scenarios covering P2P, SFU and fallback-to-direct continuity; existing cross-version and physical Windows routed-input evidence; native macOS/Linux packaging, Go race/security and container checks through the publishing pipeline. Physical macOS/Linux permissions, mobile devices, mixed DPI and commercial games retain their documented limits. README/wiki keep deployment under the optional self-hosted Server chapters.

Refs #472, #477, #479, #480. Issue follow-up happens after publication; unmatched field reports remain open.

## Release notes

### 中文

这是一次功能更新:一起看屏幕时,可以把键鼠交给一位朋友操作,聊天和表情也整合进了同一个互动窗口。本次还整理了分享与播放设置,并修复部分连接恢复和中转画质停滞的问题。

#### 新功能与体验

- **可选键鼠远控**:房主可以让一位朋友操作当前分享的桌面或窗口,随时撤回授权;换源或停播后关闭远控。提供手机触控、缩放和小键盘。当前实机验证覆盖 Windows App。
- **观众播放设置**:新增完整显示、等比铺满、拉伸铺满,以及自动/仅 P2P/仅 SFU 线路选择;站点和房主的线路限制仍然生效。
- **互动窗口**:聊天、参与者和表情放在同一窗口;可以从聊天头像选择接收者,新增点赞、倒彩等表情。支持的浏览器可以独立置顶,继续查看聊天和互动。全屏保留弹幕开关。
- **分享与播放设置更清楚**:暂停与停止相邻,画面、声音、连接和远控各有对应入口。观众播控在移动鼠标时显现,远控时收进画面边缘的小抽屉;点击画面不再意外暂停。没有声音输入时播控给出明确反馈,恢复输入后保留观众的音量设置。

#### 修复

- **连接与播放修复**:修正部分中转路径的媒体时钟、往返时间与重复反馈统计,改善这些错误导致的画质恢复停滞;重新进入房间后,SFU 连接仍可继续尝试直连。同步底层握手恢复修复。
- **界面修复**:修复浮窗返回后遮挡全屏、无法操作,窄屏控件错位、菜单超出边界等问题。虚拟键盘长按不会选中文字,拖出、取消或失焦后释放按键。页面和选源面板统一中性底色;App 图标与 favicon 保留小电视轮廓,精修对比度与底板层次。
- **兼容性修复**:新表情按站点支持情况显示,避免旧站点拒收后断开连接。补齐旧浏览器的浮层支持;修正 macOS `.app` 对包外启动文件的依赖。macOS 的 Finder、权限和远控仍需实机验证。

#### 更新说明

沿用 2.x 兼容边界。使用远控需要更新房主 App 和所连接的站点;要获得完整的中转修复,请同时更新 App 与自部署 Server。

### English

This feature update lets a Host hand keyboard and mouse control to one friend while sharing a screen. Chat and reactions now share one interaction window. It also clarifies sharing and playback settings and fixes specific connection-recovery and server-forwarding quality stalls.

#### Features and experience

- **Optional keyboard and mouse control:** the Host can let one friend control the shared desktop or window and revoke access at any time. Changing sources or stopping sharing disables control. Touch controls, zoom and an on-screen keyboard are included. Physical validation currently covers the Windows App.
- **Viewer playback settings:** choose fit, crop or stretch, and Auto, P2P-only or SFU-only routing. Site and Host restrictions still apply.
- **One interaction window:** chat, participants and reactions stay together. Choose a recipient from their chat avatar and use new reactions, including thumbs up and down. Supported browsers can detach the window and keep chat and reactions visible on top. Fullscreen retains the chat-overlay toggle.
- **Clearer sharing and playback controls:** pause and stop stay together, with separate picture, sound, connection and remote-control settings. Pointer movement reveals the playback bar during viewing; remote control uses a small drawer at the picture edge. Clicking the picture no longer pauses it accidentally. Sound controls reflect missing input and retain the Viewer's volume when it returns.

#### Fixes

- **Connection and playback fixes:** correct media clocks, round-trip-time updates and duplicate feedback accounting on affected forwarding paths, improving recovery from the quality stalls caused by those errors. Rejoining a room restores direct-connection attempts while SFU playback continues. Incorporate upstream handshake-recovery fixes.
- **Interface fixes:** returning a detached tool during fullscreen no longer leaves an inaccessible panel over the picture. Fix compact-layout shifts and overflowing menus. Holding a virtual key no longer selects its label; release, cancellation and focus loss clear held keys. Pages and the source picker use shared neutral surfaces. Refine App icons and favicons while retaining the familiar television outline.
- **Compatibility fixes:** show new reactions only when the site supports them, preventing disconnects on older sites. Support popovers on older browsers and remove the macOS `.app` launcher's dependency on files outside the bundle. Finder, permissions and remote input still need physical macOS validation.

#### Updating

The existing 2.x compatibility boundary is retained. Remote control needs an updated Host App and site; update both App and self-hosted Server for the complete forwarding fix.
2026-10-19 01:58:33 +08:00

7.9 KiB

Project Instructions

Aesthetic And Design Standard

Apply these constraints and relevant skills throughout every conversation turn, feature and action. Piik requires a polished experience and clear engineering: high aesthetic standards cover UI, interaction, functional boundaries, lifecycle and code. Working behavior alone is insufficient. Preserve the product's intent, usability, coherence, maintainability and appropriate extensibility.

Before changing behavior or presentation, establish the intended user flow, state/resource owner, lifecycle and what would demonstrate a complete result. Inspect existing components and mature approaches, then choose the simplest coherent design that meets those needs. Simplicity must not discard requested functionality, visual quality or necessary safety. Design and verify at the scale of the change; routine design choices within an authorized task need no separate design document or approval. Detailed criteria stay in visual language and engineering.

Authority And Scope

  • Within higher-priority instructions, the latest explicit user decision defines the task. Review, research, implementation, deployment, and cleanup grant only the authority inherent in that task type.
  • This file owns project-wide constraints; linked standards own domain rules, CONTRIBUTING owns delivery, and skills supply task methods. A skill, reference example or audit suggestion cannot override those owners or authorize extra work.
  • Model recovery from the smallest underlying authority and connection state. Restart, crash, timeout, and network loss do not justify parallel states or case-specific fallbacks when their required action is the same.
  • Ordinary scoped work uses the lean path: inspect the affected owner and code, make the smallest coherent change, run focused checks, inspect the diff, and stage the requested files. Use the full integration/release path only for an explicitly requested release or a material contract, route/security, infrastructure, persistence, or irreversible change.

Required Skills

Read each applicable skill completely before using it. Reuse that understanding until the task or instructions change; adherence does not require reloading or reciting every rule each turn. Use the repo-linked versions below when a global skill has the same name. Other skills apply only to matching tasks or explicit invocation; follow their relevant guidance without importing unrelated workflows.

When Skill and responsibility
Coding, code review, or implementation design Ponytail: smallest coherent implementation and reuse
Implementation, debugging, or review Stop That Shit: proportionate investigation, verification and complete delivery
Cross-surface consistency, recurring sibling-path defects, or standardization audits Context consistency: trace shared meanings and ownership; ordinary changes check only their affected family

Product Contract

  • Piik is private screen sharing for one Host and up to 20 authenticated Viewers, with Web Host/Viewer/relay as the current product surface.
  • Current product truth is split by owner: rooms/access, routing/transport, media quality, and presentation/lifecycle.
  • Media stays automatic and defaults to P2P-first; central services provide room authority, signaling, STUN, observability, and bounded embedded SFU/UDP fallback using mature LiveKit media components under ADR-0013. Route changes must preserve the single-graph, single-operation model in ADR-0005.
  • WebRTC and LiveKit own network and media adaptation. Do not add custom quality scores, ladders, all-pairs probes, periodic rebalancing, or hand-built SFU representations without a new accepted decision backed by primary evidence.

Durable Truth

  • Start substantial work by reading project memory, status, TODO, and only the relevant product module, ADR, research, or operations document. Then inspect branch, HEAD, status, staged diff, and worktrees.
  • Use the standards index and documentation owner map: product behavior, engineering, visual language, versions, evidence and operations each have one owner. TODO is the only work ledger; Git/PRs own completed history.
  • Give every durable fact one owner. Update memory or status only when its compact snapshot materially changes. Ordinary UI detail, protocol field listings, self-evident code, test inventories, routine validation, and agent process do not belong in long-lived product truth.
  • If semantics remain disputed, record the hold in TODO and freeze only dependent work. Never encode a guess as accepted truth.

Safety

  • Never commit credentials, TLS private keys, raw access tokens, or real user data. Commit placeholders and document local secret injection.
  • Keep media credentials short-lived and narrowly authorized. Do not log or persist private media-path identifiers beyond their accepted owner.
  • Block the current phase on P0 security, privacy, authorization, irreversible- data, generation, bounded-resource, or rollback failure, and on P1 failure of that phase's core path.

Repository And Delivery

  • Canonical root must be clean current main at audit/integration boundaries. Create branches/worktrees from that exact commit; old branches and worktrees are never truth sources.
  • main remains low-frequency: one complete, user-accepted phase per squash PR, with no intermediate release-record or cleanup commits. Keep implementation on worktrees; CONTRIBUTING.md owns the full workflow and explicit emergency exception.
  • Preserve user work. Branch, truth-checkpoint, PR, release, recovery, and cleanup rules are owned by CONTRIBUTING.md; do not mirror that workflow here.

Engineering Defaults

  • Repeated meanings across code, UI, copy, configuration and lifecycle follow one owned contextual contract. Check related producers and consumers before adding another local rule; preserve differences justified by authority, scope or user intent.
  • UI changes must follow the shared visual language: cast, semantic colours, result panels and motion have one owner. Extend the existing preview when adding a new meaning; do not invent scene-local rules.
  • Follow engineering and interface boundaries: simple cohesive modules, clear state/resource owners, mature reuse and narrow contracts. After a material module, remove additions that the accepted result does not need; total complexity matters more than marginal performance gains.
  • Versioning separates build identity, wire, storage and live generations, and owns the public compatibility design. Preserve published compatibility promises; remove replaced private experiments without aliases, dual readers/writers or migrations for stale private clients.
  • Use primary sources for non-trivial design and bugs. Add focused tests in proportion to risk; batch full browser/network/endurance checks at acceptance.
  • Keep scripts deterministic, fast, cross-platform and CI-runnable.
  • Before finishing material work, inspect status, report untracked artifacts, and stage requested files unless told otherwise.