Skip to content

Write HTML. Render video. Built for agents.

feat(sdk,studio): ws-4 — add history:false option; disable unused sdk undo in studio (#1496)

Vance Ingallse35846176e0b
diff --git a/packages/sdk/src/session.ts b/packages/sdk/src/session.ts
index 149b770b64..50cc5e680b 100644
--- a/packages/sdk/src/session.ts
+++ b/packages/sdk/src/session.ts
@@ -48,6 +48,12 @@ export interface OpenCompositionOptions {
trackedOrigins?: unknown[];
/** Auto-coalesce window for history entries (ms). Default: 300. */
coalesceMs?: number;
+ /**
+ * Pass `false` to skip attaching the history module (undo/redo).
+ * Default: history is attached in standalone (non-embedded) mode.
+ * Use when the host owns the undo stack and SDK undo is dead weight.
+ */
+ history?: false;
}
// ─── Implementation ───────────────────────────────────────────────────────────
@@ -495,7 +501,7 @@ export async function openComposition(
const isEmbedded = opts?.overrides !== undefined;
- if (!isEmbedded) {
+ if (!isEmbedded && opts?.history !== false) {
const history = createHistory(session, {
coalesceMs: opts?.coalesceMs ?? 300,
trackedOrigins: opts?.trackedOrigins,
diff --git a/packages/studio/src/hooks/useSdkSession.ts b/packages/studio/src/hooks/useSdkSession.ts
index 2c0e205011..1743814fb6 100644
--- a/packages/studio/src/hooks/useSdkSession.ts
+++ b/packages/studio/src/hooks/useSdkSession.ts
@@ -97,7 +97,9 @@ export function useSdkSession(
// 'change' AND Studio writes explicitly) and race on disk; it would
// also write the full active-composition serialization to the fixed
// persistPath even when an edit targeted a sub-composition file.
- const comp = await openComposition(content);
+ // Studio's editHistory is the authoritative undo stack — SDK history
+ // is unused dead weight here (forceReloadSdkSession discards it on undo).
+ const comp = await openComposition(content, { history: false });
// Cleanup may have fired while openComposition was awaited; dispose immediately.
if (cancelled) {
comp.dispose();