Repository navigation
feat(slides): let the user edit, reorder and delete slides, and make the agent wait while the user edits an artifact - #259
Merged
Conversation
…the agent wait while the user edits an artifact Slides, with Edit on in the deck toolbar: - Click a text block to change it in place. Enter saves, Shift+Enter starts a new line, Escape cancels. The block under the pointer that a click would edit is outlined. The block keeps its layout while it is edited, whatever line breaks and indentation its source has. - Reorder slides in the overview by dragging or with Cmd/Ctrl and the arrow keys. The dragged slide follows the pointer, the others glide to their places, the overview scrolls at its edges, and Escape cancels the drag. - Delete the current slide from the toolbar or with Delete in the overview, after a confirmation. - The overview shows slide numbers, and the current slide zooms between the overview and the single-slide view. Artifacts in general: - While the user edits an artifact in the app (slide text, slide order, a canvas board), the sidecar holds a lock on that artifact folder. The agent's Write and Edit wait for it, the conversation says it is waiting, and the write is refused with the list of changed files if the user changed something meanwhile. - After the user changes an artifact, a chip in that session's composer tells the agent with the next message which files changed, and for a deck whose slides were reordered or deleted, to check its section numbers.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Phase 3 of docs/features/slides/tech-design.md: the user can change a deck in the app. It also adds a lock that applies to every artifact kind, so the user and the agent do not write the same artifact at the same time.
Editing a deck
<br>). Blocks that preserve white space, such as code blocks, keep their text as typed.PUT /api/artifacts/slides/content(writes only if the file still equals what the edit was based on, otherwise 409),PATCH /api/artifacts/slides/orderandDELETE /api/artifacts/slides.The user-edit lock, for all artifact kinds
POST/DELETE /api/artifacts/edit-lock, renewed every 5 seconds, expiring after 20 seconds without renewal).Write,EditandArtifactCopyask the sidecar through a new control request,artifact_edit_wait, and wait until the lock is free. If the user changed files meanwhile, the tool call is refused with the list of changed files so the agent reads them first.artifactWait: the conversation shows that the agent is waiting for the user.{ dir, files, latestMtimeMs }; the renderer builds the chip from it instead of composing paths itself.Also in this PR
fileInsideFolderinsrc/utils/artifacts.tsis now the one check that a file is still inside its artifact folder; the entry file, board files and slide files use it.Why
Until now only the agent could change a deck. Small corrections (a typo, the order of two slides, one slide too many) should not need a message to the agent. Once the user can write an artifact, the agent must not overwrite that work or build on a stale copy, which is what the lock and the chip are for.
How it was tested
bun test: 2766 pass, 0 fail.cd desktop && bun run lint: pass.cd desktop && bun run test -- --run: 3104 pass, 4 skipped. This run was before the last round of changes, which touched only the two design documents andsrc/server/__tests__/artifact-edit-locks.test.ts.bun test --randomize --seed=1on the lock and artifact test files: pass.<br>, no layout jump when a block enters editing, page-number labels.Known limits