Skip to content

feat(json): support optional openDepth to expand nested containers#164

Open
benvinegar wants to merge 1 commit into
mainfrom
feat/json-open-depth
Open

feat(json): support optional openDepth to expand nested containers#164
benvinegar wants to merge 1 commit into
mainfrom
feat/json-open-depth

Conversation

@benvinegar

Copy link
Copy Markdown
Member

What

This PR adds the optional openDepth field to JsonSurface. It allows agents to specify how many levels of nested containers are expanded by default on initial render.

  • openDepth: 0 (default): only the root container (object or array) is open.
  • openDepth: 2: the root + first two nested levels of containers are open at startup.

Changes

  • types.ts: Add optional openDepth: number to JsonSurface interface, and include it in surfacesByteLength calculations.
  • postSurfaces.ts: Add openDepth to strict and loose zod validation schemas and transforms.
  • JsonSurface.tsx: Pass openDepth recursively down, setting the default open signal state to depth <= openDepth instead of depth === 0.
  • sideshow.js (CLI): Add --open-depth <n> to the json subcommand and the --json option of the publish command.
  • DESIGN_GUIDE.md: Document openDepth for JSON surfaces and show CLI examples.
  • api.test.ts / assets.test.ts: Add validation and round-trip tests.

Verification

All 351 tests pass. Linter, formatter, and typecheck are clean.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant