You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
feat(timeline): let an agent replace a whole timeline document [T18]
An agent could edit a timeline only through `edit_timeline`'s op list, so
authoring a sequence from scratch, or applying a document it had built
elsewhere, meant expressing the whole thing as incremental ops.
`set_timeline_document` replaces the document in one call, in an order
chosen so a refused call leaves nothing behind: ownership, then the
`expected_updated_at` precheck, then validation, then the snapshot, then the
CAS write, then a re-validation of what was actually stored. A conflict or a
validation error returns before the snapshot — a refused call that leaves a
version row behind is still a write. The write itself is a single attempt
with no retry loop: `edit_timeline` retries because its ops re-apply against
a newer document, but a whole-document replace does not compose, so
retrying would clobber exactly the change CAS just caught.
The return carries the post-write validation rather than the pre-write one,
so a caller sees what it created instead of what it intended, plus the
version id to undo it.
`duration_ms` is restamped from the clips, because a replaced document that
keeps the old sequence duration makes `preview_timeline_frame` truncate its
sampling window.
Resolves F18.
Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01VdzG3a3jN3Dzx6QV8xh4Bo
"document is required and must be an object ({tracks, clips, markers}). Read the current one with get_timeline."
978
+
};
979
+
}
980
+
981
+
constexpected=params["expected_updated_at"];
982
+
if(expected!==undefined&&expected!==null){
983
+
if(!isString(expected)){
984
+
return{error: "expected_updated_at must be a string timestamp."};
985
+
}
986
+
if(expected!==sequence.updated_at){
987
+
return{
988
+
error: `Timeline ${sequence.id} was modified since it was read at ${expected} (it now reads ${sequence.updated_at}); nothing was written. Read it again with get_timeline and re-apply your changes.`,
0 commit comments