Cocos AIR agent session and inspection
Stop once you can answer the task. Do not read another same-topic reference for the same question.
Scope: Dev-only live inspection, scoped writes and frame probes; runtime diagnostics stay separate.
Environment: use package imports in apps; source paths require an AIR checkout. See context.
Quick Start
For complete setup and teardown, read Quick Start.
Siblings: direct dependencies; reuse loaded skills.
Triggers
- Inspect a running app or scene
- Apply explicitly scoped agent-session writes
- Capture a changed frame after drawing
- Read runtime diagnostics or session errors
- Measure pixels with the correct origin
- Reject duplicate request IDs or stale targets
Exact API and symptom mappings: triggers.
Contracts
Agent sessions are devtools-only and require explicit writable scope. Inspect session-local IDs before writes. Duplicate request IDs are rejected; capture waits for AFTER_DRAW. Runtime diagnostics are a separate API.
Read references/contracts.md only when the task needs exact option rules, limits, error behavior or source annotations. Prefer the topic references below for a narrower question.
Common Mistakes
- [HIGH] Never blindly retry a write with the same requestId.
- [HIGH] Keep devtools session imports out of shipped app code.
- [MEDIUM] Diagnostics and the session error buffer are separate.
- [MEDIUM] Raw canvas and screenshot pixel origins differ.
Read relevant wrong/right examples before implementation.
Reference map
- Inspect or write? - Protocol and writable scope
- Find live state? - IDs and diagnostics
- Prove pixels changed? - Capture and origins