Skip to content

Conversation

@ardaerzin
Copy link
Contributor

the introduction of local drafts demanded a stateful url for playground with more information than just the displayed revision ids.

with this pr, we'll now have urls with:

  • displayed revisions
  • patch state information which allows
    • sharing local drafts
    • sharing uncommitted edits to api backed revisions

…mpression

- Add snapshot subpath export to package.json
- Add lz-string@1.5.0 dependency for compression
- Add @types/lz-string@1.5.0 dev dependency
… management

- Add snapshot.ts with buildOssAppRevisionDraftPatch and applyOssAppRevisionDraftPatch functions
- Add parameterConversion.ts utilities for enhanced data conversion and comparison
- Export snapshot functions and types from ossAppRevision package
- Update isDirty check to compare parameters instead of full objects
- Add stripVolatileKeys, enhancedPromptsToParameters, enhancedCustomPropertiesToParameters helpers
- Add
… runnable entities

- Add snapshotAdapter.ts registry for unified snapshot operations across runnable types
- Implement appRevision snapshot adapter with buildDraftPatch and applyDraftPatch functions
- Implement ossAppRevision snapshot adapter using existing snapshot utilities
- Add auto-registration of adapters on module import
- Add Zod validation schemas for patch data structures
- Export snapshot adapter types and registry from
…port

- Add uuid@^11.1.0 dependency for draft key generation
- Add snapshot submodule with schema, codec, and validation utilities
- Add PlaygroundSnapshotV2 schema supporting commit and draft selection items
- Add encodeSnapshot/decodeSnapshot functions using lz-string compression
- Add snapshot controller and hydration utilities to state management
- Export snapshot types and functions from main package entry point
- Add MAX_ENCODED
- Add uuid@^11.1.0 to playground package dependencies
…ydration documentation

- Export clearPendingHydrations function from state module
- Update snapshot module documentation to reference PlaygroundSnapshotV2 instead of V1
- Simplify hydrateSnapshotAtom implementation by removing unnecessary snapshotV2 variable
- Update hydration documentation to remove v1 migration step from process description
…ot and update version to 1

- Remove PlaygroundSnapshotV2 type alias in favor of single PlaygroundSnapshot type
- Update SNAPSHOT_VERSION from 2 to 1
- Update all type references from PlaygroundSnapshotV2 to PlaygroundSnapshot
- Update version validation error message to use SNAPSHOT_VERSION constant
- Update documentation examples to reference PlaygroundSnapshot and use SNAPSHOT_VERSION constant
…aring with runnable type resolution

- Add urlSnapshotController with buildEncodedSnapshot, buildUrlComponents, and hydrateFromUrl actions
- Add RunnableTypeResolver interface for entity-agnostic type resolution
- Add setRunnableTypeResolver, getRunnableTypeResolver, and resetRunnableTypeResolver utilities
- Add hydrationComplete and pendingHydrationCount selectors for tracking hydration status
- Add applyPendingHydrations action
…pport

- Add usePlaygroundUrlSync hook to sync selection and drafts to URL in real-time
- Add urlSnapshotController integration with OSS runnable type resolver
- Add snapshot hash parameter (#pgSnapshot) for encoding draft patches in URL
- Add clearSnapshotFromUrl and updatePlaygroundUrlWithDrafts utilities
- Add selectedDraftHashAtom and selectedServerDataHashAtom for change detection
- Add isSelectionStorageHydrated check to prevent overwriting persisted selections
…t clearing

- Remove clearSnapshotFromUrl import and usage from usePlaygroundUrlSync
- Remove prevHydrationCompleteRef and hydration completion URL clearing effect
- Remove snapshot clearing after applying pending hydrations
- Rely on draftHash effect to rebuild URL when draft state changes after hydration
- Add comment explaining URL rebuild behavior during hydration
…state detection

- Add debug logging to ossAppRevisionIsDirtyWithBridgeAtomFamily when dirty state is detected
- Strip null values from message objects during parameter comparison to match server data format
- Update stripVolatileKeys to skip null values in nested objects (name, toolCalls, toolCallId)
- Update stripVolatileKeys documentation to clarify null handling behavior
- Extract strippedDraft and strippedServer variables for debug
… frontend-feature/stateless-playground-url-state
@vercel
Copy link

vercel bot commented Feb 2, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
agenta-documentation Ready Ready Preview, Comment Feb 4, 2026 0:59am

Request Review

… frontend-feature/stateless-playground-url-state
… frontend-feature/stateless-playground-url-state
ardaerzin and others added 2 commits February 2, 2026 19:31
… frontend-feature/stateless-playground-url-state
… frontend-feature/stateless-playground-url-state
- Add isPlaceholderId function to detect placeholder IDs used during pending hydrations
- Update isLocalDraftId to recognize numeric-only IDs (timestamps) as local drafts
- Export isPlaceholderId from shared utils
…ter interface

- Add optional createLocalDraftWithPatch method for hydration support
- Used to recreate local drafts from URL snapshots with patches
… snapshotAdapter

- Add createLocalDraftWithPatch for hydrating local drafts from URL snapshots
- Add generatePlaceholderId and isPlaceholderId helpers
- Export isPlaceholderId from ossAppRevision module
…r createLocalDraftFromRevision

- Add resolveRootSourceId to always point to server revision, not another local draft
- Make createLocalDraftFromRevision return null instead of throwing when source unavailable
- Add getLocalDraftBySourceId helper for finding existing drafts
- Export resolveRootSourceId for use in snapshot adapters
- Add isPlaceholderId check to directQueryAtomFamily and enrichedQueryAtomFamily
- Placeholder IDs are temporary IDs used during pending hydrations
- Remove debug logging from isDirty check
…pshotController

- Add generatePlaceholderId for temporary IDs during pending hydrations
- Support creating local drafts for duplicate source revisions in compare mode
- Add selectionUpdateCallback for replacing placeholder IDs with actual local draft IDs
- Track pending hydrations with createLocalDraft flag and selectionIndex
- Export setSelectionUpdateCallback and isPlaceholderId
…arams

- Local draft IDs are ephemeral and won't work when opened in a new tab
- Resolve to source revision IDs for the query param
- Hash param contains patch data to reconstruct draft state
- Export new functions from agenta-playground package for OSS consumption
- Register callback to replace placeholder/source IDs with local draft IDs
- Use latestAppRevisionIdAtom for default selection (matches 'Last modified' tag)
- Skip URL revision processing when pending hydrations exist
- Improve ensurePlaygroundDefaults logic
- Remove console.log statements from discardRevisionDraft
- Remove unused prompt-related code from prompts.ts
- URL is now the source of truth for sharing playground state
- Add placeholder ID support to displayedVariantsAtom and earlyDisplayedVariantsAtom
- Use updatedAt for proper timestamp sorting in playgroundRevisionListAtom
- isSelectionStorageHydrated now always returns true (no async hydration needed)
- Extract source revision IDs from pending hydrations for proper triggering
- Use pendingSourceDataHash to track when source data becomes available
- Apply pending hydrations based on source IDs, not selected variants
- Remove unused imports from MainLayout, SelectVariant, VariantNavigationCard
- Remove unused code from PlaygroundVariantConfigEditors
- Simplify PlaygroundVariantCustomProperties
… frontend-feature/stateless-playground-url-state
…romptsToParameters

- Add toSnakeCaseKey and toSnakeCaseDeep helper functions for key normalization
- Extract llmConfig from enhanced prompts with snake_case conversion when needed
- Extract templateFormat from enhanced prompts with proper key detection
- Preserve existing key naming conventions (snake_case vs camelCase) in result
- Enable dirty checks for model parameters and prompt syntax changes
…onents

- Remove unused `useEffect` import from PlaygroundVariantConfigEditors
- Remove unused `debug` variable from useVariantPrompts destructuring
- Remove unused `schemaQuery` variable assignment in PlaygroundVariantCustomProperties
… oss

- Add ellipsis to --filter flags to install workspace dependencies
- Update @agenta/ee filter to @agenta/ee...
- Update @agenta/oss filter to @agenta/oss...
… frontend-feature/stateless-playground-url-state
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.

3 participants