Dollie Editor SDK guide

Review and Apply Suggestions

Show people what the Copilot wants to change before it changes the page

The Copilot never edits the page by itself.

It returns a suggestion. Dollie Editor checks that suggestion and shows it in a card. The person editing the page chooses whether to apply it.

What happens when someone asks for a change

Imagine the selected section contains this heading:

Learn padel from experienced coaches.

The person asks:

Make the heading more direct.

The Copilot returns a replacement for that section. The result card shows the proposed content and an Apply to section button.

Nothing changes until the button is clicked.

Use the right kind of suggestion

Use propose_page when the Copilot needs to create or replace the whole page.

Use propose_section_edit when it only needs to change one section. This keeps the rest of the page untouched and makes the suggestion easier to review.

Create the tools in TypeScript

import {
    createProposalOperations,
    describeProposePage,
    describeProposeSectionEdit,
} from '@dollie_ai/editor';

const proposals = createProposalOperations({
    catalog,
    validateOptions: { sections: sectionDefinitions },
    pageSectionIds: context.sectionIds,
});

Add proposals.propose_page and proposals.propose_section_edit to the AI tool system you already use.

The two description helpers provide the instructions for those tools. Your AI library still defines the input schemas and handles streaming.

Create the tools in Laravel

use Dollie\Editor\Ai\ProposalTools;

public function tools(): iterable
{
    return app(ProposalTools::class)->all($this->context->sectionIds);
}

Pass the section ids from the current page. Dollie Editor uses them to check that a section suggestion still points to the expected component.

What Dollie Editor checks

Before showing a suggestion, the proposal tools check that:

  • every component exists in the current Catalog—the list of components allowed in this editor;
  • the props match the fields registered for that component;
  • a section number exists on the current page;
  • a section edit keeps the same component.

For example, a request to change the text in section 2 cannot silently replace that section with a pricing table.

If a suggestion is invalid, the card shows the validation problem instead of an Apply button.

Show the default result cards

import { registerTool } from '@dollie/ai-sdk';
import { registerEditorCopilotTools } from '@dollie_ai/editor';

registerEditorCopilotTools(registerTool);

The default cards show:

  • what the Copilot wants to change;
  • where the change will be applied;
  • validation errors;
  • an Apply button when the suggestion is safe to use.

The complete setup is in Add a Copilot to the Editor.

Applying is not saving

Clicking Apply updates the editor and adds the change to undo history.

It does not save or publish the page. Those actions continue to use your application's normal buttons, permissions, and server code.

Handle suggestions made from an older page

The page can change while the Copilot is writing.

For a section suggestion, the default card checks that the target still exists and still uses the same component. If it does not, Apply is disabled.

A whole-page suggestion does not include a revision number by default. If several people or processes can edit the same page, add your page revision to the tool result and compare it before applying or saving.