Skip to main content

list_widgets

Lists the workspace’s AI widgets: the storefront widgets, landing pages and app blocks Tolstoy builds and hosts for the brand. Each comes with its widgetId, name, template, store, status, Platform link, and whether its saved code differs from its published version. Most recently changed first.

create_widget

Creates an AI widget for the connected store from a template and sets up its project: the template’s files, the widget’s history and a running preview. The widget is shared with every team of the workspace. The result is the new widget, still a draft that shoppers do not see, and the files and folders at its root.

open_widget

Gets a widget’s project ready in its sandbox, and brings it up to the latest save when the project has no unsaved work. The result is the widget and the files and folders at its root. run_widget_command opens the widget on its own as well.

run_widget_command

Runs a shell command with bash in the widget’s sandbox, from the widget root, and waits for it to finish. The sandbox has Node, pnpm, git, ripgrep and fd; add a package with pnpm add. The result is the command’s stdout and stderr, cut to the last 2000 lines or 50KB, and its exit code. When the command changed the widget’s files, the change is recorded at once as one save in the widget’s history, which Platform and the Tolstoy Agent read, and the result names that save; otherwise save is null. A running preview shows the change; shoppers see it only after the widget is published. Publishing goes through publish_widget.

preview_widget

Starts the widget’s preview server in its sandbox when it is not running, and returns a link to each preview page the widget declares, such as a home page and a product page. The preview shows the widget’s current files and updates as they change. A product page needs a productId; without one its url is null. A link works while the sandbox runs, and the sandbox stops after some minutes without use; a new call then returns a working link.

publish_widget

Builds the widget from its current files and makes that version live for the store’s shoppers at once. Publishing needs a Tolstoy plan that includes AI widget publishing. On success the result carries the published version and either the snippets that embed the widget or the live page links. A failed build comes back with success false and the build’s error output, and the live version stays as it was.

discard_widget_changes

Returns the widget to its last published version. Every save after that version is removed from the widget’s files and history, so it cannot be restored. A widget that was never published has nothing to return to, and the call is refused while the Tolstoy Agent is working on the widget in Tolstoy.

get_widget_history

Returns the widget as it is now, with its status and whether its saved code differs from its published version, and lists its saves, newest first, each with its sha, time, message and the files it changed. Every run_widget_command that changes the widget’s files is one save; Platform and the Tolstoy Agent add saves of their own. With a sha, the result is that one save and its diff.

get_widget_clone_url

Returns the git URL of the widget’s repository, the one Platform, the Tolstoy Agent and run_widget_command save to. The URL carries the access to clone the repository and push to its main branch. A commit pushed there is a save in the widget’s history. run_widget_command, preview_widget and publish_widget bring the widget’s sandbox up to the pushed commits before they act; when the sandbox has work the repository lacks, they stop with an error and change nothing. Shoppers see a change only after publish_widget.