AGENTS.md@packages/coding-agent/examples · git:20260714.3a2a79c · 2026-07-14 · sha256 c7b3d4a1d7cbb393
AGENTS.md@packages/coding-agent/examples git:20260714.3a2a79cA
Immutable. This exact content is served forever at /api/v1/blob/c7b3d4a1d7cbb393.
# packages/coding-agent/examples Runnable examples for the public Senpi SDK and extension API. Examples are documentation-quality code and must reflect shipped APIs, not private core internals. Paths below are relative to this directory unless they start with `packages/`. ## STRUCTURE ```text extensions/ Tools, commands, UI, providers, hooks, resources extensions/*/ Multi-file examples and nested private workspaces sdk/ Programmatic SDK usage rpc-extension-ui.ts RPC-compatible extension UI example ``` ## CONVENTIONS - Import public package surfaces such as `@code-yeongyu/senpi` and `@earendil-works/pi-ai`; do not reach into `src/core/` internals. - Keep examples small enough to teach one pattern, while preserving real error, cleanup, cancellation, and persistence behavior where relevant. - Extension factories have no top-level runtime side effects. Register work through the public `pi.*` API and lifecycle events. - New interactive examples should use configurable keybindings and themed TUI helpers. Existing demos may keep fixed controls when the control scheme is part of the example. Direct terminal writes belong only in examples explicitly teaching a terminal protocol; ordinary SDK examples may use normal stdout. - Tool string enums use the shared `StringEnum` helper for provider compatibility. - Stateful examples persist reconstructable state in session entries or tool-result details so fork/resume behavior remains valid. - Nested example packages are private workspaces with exact-pinned dependencies. Treat their manifests and lock impact as production dependency changes. ## DOCUMENTATION CONTRACT - Keep `extensions/README.md`, `docs/extensions.md`, and `docs/sdk.md` aligned with public API changes. - New public extension capabilities should include a focused example when usage is not obvious from types alone. - Do not present experimental or internal behavior as stable API. ## VALIDATION - Run the focused tests for the public API demonstrated by the example. - Typecheck examples through root `npm run check`. - Interactive examples require real CLI or visual QA when their behavior changes.