feat(sheets): add +undo shortcut for AI-tool edits#1321
Open
zhengzhijiej-tech wants to merge 2 commits into
Open
feat(sheets): add +undo shortcut for AI-tool edits#1321zhengzhijiej-tech wants to merge 2 commits into
zhengzhijiej-tech wants to merge 2 commits into
Conversation
Add a token-scoped +undo shortcut that reverses recent sheet edits made through the sheet-ai write tools, by invoking the undo_last write tool. - +undo [--steps N | --op NAME]: undo the last N steps, or a named op - thread a session-stable transaction id (LARK_CLI_SHEET_TRANSACTION_ID) into the tool request's extra.transaction_id, so a group of edits and a later +undo share one server-side undo stack; omitted when unset to preserve per-request behavior - flag-defs + generated defs for the new shortcut
|
Important Review skippedAuto reviews are disabled on base/target branches other than the default branch. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
buildToolBody attached extra.transaction_id to every tool invocation, including read tools (get_cell_ranges, get_range_as_csv, search_data, get_workbook_structure, ...). A read scoped to a transaction id resolves against that transaction's snapshot instead of the live document, so reads returned blank cells whenever LARK_CLI_SHEET_TRANSACTION_ID was set. Gate the extra block to ToolKindWrite — the undo stack only ever concerns writes — by threading kind into buildToolBody at every call site. Adds a regression test that read tools omit the transaction id.
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
Add a token-scoped
+undoshortcut that reverses recent sheet edits made through the sheet-ai write tools, by invoking theundo_lastwrite tool.+undo [--steps N | --op NAME]: undo the last N steps, or a named operationLARK_CLI_SHEET_TRANSACTION_ID) into the tool request'sextra.transaction_id, so a group of edits and a later+undoshare one server-side undo stack; omitted when unset to preserve per-request behaviorWhy
Lets an agent driving lark-cli undo a group of AI-tool sheet edits in one call, rather than manually reconstructing prior state.
Notes
Depends on the backend
undo_lastwrite tool (byted-sheet) + facade registration (sheet-facade-agg). The backend reverse-changeset path is still being finalized; the CLI side here is self-contained and gated by the transaction-id env var.