* @brief Builds command-specific repair hints attached to failed tool replies. */
| 688 | * @brief Builds command-specific repair hints attached to failed tool replies. |
| 689 | */ |
| 690 | static QJsonObject makeRepairHint(const QString& name, const QString& message) |
| 691 | { |
| 692 | QJsonObject repair; |
| 693 | if (name == QStringLiteral("project.workspace.addWidget") |
| 694 | || name == QStringLiteral("assistant.workspace.addTile")) { |
| 695 | repair[QStringLiteral("next")] = |
| 696 | QStringLiteral("Call assistant.snapshot, then assistant.workspace.addTile with a valid " |
| 697 | "workspaceId, groupId, widgetType slug, and dataset identifier if the " |
| 698 | "group lacks that widget compatibility."); |
| 699 | repair[QStringLiteral("identityReminder")] = |
| 700 | QStringLiteral("workspaceId identifies a workspace; groupId identifies a group; " |
| 701 | "datasetId is only scoped within a group; uniqueId is opaque."); |
| 702 | } |
| 703 | |
| 704 | if (message.contains(QStringLiteral("customizeWorkspaces"), Qt::CaseInsensitive)) |
| 705 | repair[QStringLiteral("customizeMode")] = |
| 706 | QStringLiteral("Run project.workspace.setCustomizeMode{enabled:true} before workspace " |
| 707 | "mutations."); |
| 708 | |
| 709 | if (name.contains(QStringLiteral("dryRun")) || name.contains(QStringLiteral("script"))) { |
| 710 | repair[QStringLiteral("scriptWorkflow")] = |
| 711 | QStringLiteral("Fetch the matching scripting reference, fix the code, run " |
| 712 | "assistant.script.dryRun again, then apply only after dry-run succeeds."); |
| 713 | } |
| 714 | |
| 715 | if (name == QStringLiteral("project.batch") |
| 716 | || name == QStringLiteral("assistant.project.bulkApply")) { |
| 717 | repair[QStringLiteral("batchShape")] = |
| 718 | QStringLiteral("Use ops:[{command:'project.dataset.update', params:{...}}, ...]. " |
| 719 | "Do not put params at the op top level and do not nest project.batch."); |
| 720 | } |
| 721 | |
| 722 | return repair; |
| 723 | } |
| 724 | |
| 725 | /** |
| 726 | * @brief Merges a repair hint into the error object of a failed reply. |
no test coverage detected