@pixerate/editor 0.235.0 → 0.237.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -1
- package/dist/agent/index.cjs +286 -27
- package/dist/agent/index.d.cts +1 -0
- package/dist/agent/index.d.ts +1 -0
- package/dist/agent/index.js +261 -2
- package/dist/agent/reviewTools.d.cts +16 -0
- package/dist/agent/reviewTools.d.ts +16 -0
- package/dist/{chunk-CZBRY4SW.cjs → chunk-CZWUDFR3.cjs} +214 -389
- package/dist/{chunk-PI2UYMZY.js → chunk-FSLKBQU7.js} +269 -15
- package/dist/{chunk-3MO3ZS7E.js → chunk-JVSX5QTS.js} +141 -316
- package/dist/{chunk-O7QXVGMP.cjs → chunk-WV5WTOC6.cjs} +295 -41
- package/dist/extensions/index.cjs +8 -6
- package/dist/extensions/index.js +12 -10
- package/dist/extensions/loading-node.d.cts +45 -1
- package/dist/extensions/loading-node.d.ts +45 -1
- package/dist/index.cjs +13 -11
- package/dist/index.js +12 -10
- package/package.json +1 -1
- package/skills/pixerate-rich-text/SKILL.md +28 -1
- package/skills/pixerate-rich-text-revise/SKILL.md +8 -1
package/dist/index.js
CHANGED
|
@@ -53,10 +53,8 @@ import {
|
|
|
53
53
|
BUILT_IN_IMPORT_ADAPTERS,
|
|
54
54
|
Bookmark,
|
|
55
55
|
CHARACTER_STYLE_MARK_NAME,
|
|
56
|
-
COMMENT_MARK_NAME,
|
|
57
56
|
CharacterStyle,
|
|
58
57
|
ColorHighlighter,
|
|
59
|
-
Comments,
|
|
60
58
|
CrossReference,
|
|
61
59
|
DEFAULT_AUTOCORRECT_EXCEPTIONS,
|
|
62
60
|
DEFAULT_DOCX_MAX_IMAGE_SIZE,
|
|
@@ -93,7 +91,6 @@ import {
|
|
|
93
91
|
buildOutlineTree,
|
|
94
92
|
capitalizeSentenceRules,
|
|
95
93
|
captureSelectionFormat,
|
|
96
|
-
commentsPluginKey,
|
|
97
94
|
compareInEditor,
|
|
98
95
|
computeOutline,
|
|
99
96
|
createDocxImportAdapter,
|
|
@@ -113,7 +110,6 @@ import {
|
|
|
113
110
|
docxToDocumentImport,
|
|
114
111
|
fileImportPluginKey,
|
|
115
112
|
findAutocorrection,
|
|
116
|
-
findCommentRanges,
|
|
117
113
|
findHexColors,
|
|
118
114
|
findImportAdapter,
|
|
119
115
|
findReplacePluginKey,
|
|
@@ -123,10 +119,6 @@ import {
|
|
|
123
119
|
fractionRules,
|
|
124
120
|
getActiveHeading,
|
|
125
121
|
getBookmarks,
|
|
126
|
-
getCommentAnchors,
|
|
127
|
-
getCommentAuthor,
|
|
128
|
-
getCommentIdsAt,
|
|
129
|
-
getCommentStore,
|
|
130
122
|
getCrossReferenceTargets,
|
|
131
123
|
getDocumentStructureCommandItems,
|
|
132
124
|
getFindReplaceState,
|
|
@@ -148,6 +140,7 @@ import {
|
|
|
148
140
|
insertImportedDocument,
|
|
149
141
|
isInsidePromptToken,
|
|
150
142
|
isParagraphStyleAvailable,
|
|
143
|
+
loadingSpinnerSpec,
|
|
151
144
|
markdownImportAdapter,
|
|
152
145
|
navigateToHeading,
|
|
153
146
|
outlinePluginKey,
|
|
@@ -169,7 +162,7 @@ import {
|
|
|
169
162
|
updateImageSrc,
|
|
170
163
|
validateFindPattern,
|
|
171
164
|
writeRichClipboard
|
|
172
|
-
} from "./chunk-
|
|
165
|
+
} from "./chunk-JVSX5QTS.js";
|
|
173
166
|
import {
|
|
174
167
|
DEFAULT_STYLES,
|
|
175
168
|
NORMAL_STYLE_ID,
|
|
@@ -188,8 +181,10 @@ import {
|
|
|
188
181
|
import {
|
|
189
182
|
ALLOW_NESTED_TABLES_META,
|
|
190
183
|
AgentCaret,
|
|
184
|
+
COMMENT_MARK_NAME,
|
|
191
185
|
Chart,
|
|
192
186
|
ChartNodeView,
|
|
187
|
+
Comments,
|
|
193
188
|
DEFAULT_AGENT_CARET_COLOR,
|
|
194
189
|
DEFAULT_AGENT_CARET_NAME,
|
|
195
190
|
DEFAULT_TABLE_OPTIONS,
|
|
@@ -211,6 +206,7 @@ import {
|
|
|
211
206
|
applyReplacements,
|
|
212
207
|
chartPluginKey,
|
|
213
208
|
clearAgentCaret,
|
|
209
|
+
commentsPluginKey,
|
|
214
210
|
compileFindPattern,
|
|
215
211
|
createAgentCaretPlugin,
|
|
216
212
|
createChartNodeView,
|
|
@@ -221,8 +217,13 @@ import {
|
|
|
221
217
|
ensureAgentCaret,
|
|
222
218
|
expandReplacement,
|
|
223
219
|
findAllMatches,
|
|
220
|
+
findCommentRanges,
|
|
224
221
|
foldCodePoint,
|
|
225
222
|
getAgentCarets,
|
|
223
|
+
getCommentAnchors,
|
|
224
|
+
getCommentAuthor,
|
|
225
|
+
getCommentIdsAt,
|
|
226
|
+
getCommentStore,
|
|
226
227
|
getDocumentCharts,
|
|
227
228
|
getTableActionState,
|
|
228
229
|
getTableState,
|
|
@@ -250,7 +251,7 @@ import {
|
|
|
250
251
|
tableNestingPluginKey,
|
|
251
252
|
typeAgentText,
|
|
252
253
|
unnestTables
|
|
253
|
-
} from "./chunk-
|
|
254
|
+
} from "./chunk-FSLKBQU7.js";
|
|
254
255
|
import "./chunk-23E5GI2U.js";
|
|
255
256
|
import "./chunk-KGRZMHZB.js";
|
|
256
257
|
import "./chunk-WKMUBATU.js";
|
|
@@ -2703,6 +2704,7 @@ export {
|
|
|
2703
2704
|
isUnsafeZipPath,
|
|
2704
2705
|
isValidStyleId,
|
|
2705
2706
|
listFormulaFunctions,
|
|
2707
|
+
loadingSpinnerSpec,
|
|
2706
2708
|
mapConditionalFormatFormulas,
|
|
2707
2709
|
mapDataValidationFormulas,
|
|
2708
2710
|
mapFormulaReferences,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: pixerate-rich-text
|
|
3
|
-
description: How to read and edit Pixerate rich text documents and prompt editors through agent tools - reading text with document positions (get_text, find_text), minimal-diff edits (replace_range, replace_text, insert_text), formatting (format_text for bold, italic, links and colour; set_block_type for headings, lists and quotes; set_text_align), selections, tables (edit_table and table.* commands), charts and sparklines embedded in a document, find and replace commands, and prompt editing with templates, variables and instructions (prompt_insert_text, prompt_replace_range, prompt_set_variable, get_editor_state, view_editor). Use when asked to write, rewrite, proofread, restructure or format a document, report, note, heading, paragraph or table, to insert a chart or sparkline into text, or to edit an image-generation or LLM prompt with {{template}}, {variable} and __instruction__ tokens.
|
|
3
|
+
description: How to read and edit Pixerate rich text documents and prompt editors through agent tools - reading text with document positions (get_text, find_text), minimal-diff edits (replace_range, replace_text, insert_text), formatting (format_text for bold, italic, links and colour; set_block_type for headings, lists and quotes; set_text_align), selections, tables (edit_table and table.* commands), charts and sparklines embedded in a document, comments and tracked changes (add_comment, list_changes, accept_change), find and replace commands, and prompt editing with templates, variables and instructions (prompt_insert_text, prompt_replace_range, prompt_set_variable, get_editor_state, view_editor). Use when asked to write, rewrite, proofread, restructure or format a document, report, note, heading, paragraph or table, to insert a chart or sparkline into text, to comment, suggest edits or accept changes, or to edit an image-generation or LLM prompt with {{template}}, {variable} and __instruction__ tokens.
|
|
4
4
|
---
|
|
5
5
|
|
|
6
6
|
# Editing rich text documents and prompts
|
|
@@ -72,6 +72,13 @@ the pitfalls, and uses the tools below.
|
|
|
72
72
|
- **Charts in text.** Introduce a chart in the sentence before it and state the takeaway in
|
|
73
73
|
its title ("Revenue doubled in Q3", not "Revenue"). Use a sparkline for a trend inside a
|
|
74
74
|
sentence or table cell and give it a `label` that says what it shows.
|
|
75
|
+
- **Review.** When the user asks you to suggest edits rather than make them, call
|
|
76
|
+
`set_track_changes {enabled: true}` first so every write shows as a suggestion they can
|
|
77
|
+
accept or reject, and turn it back off only if it was off before. Comment (`add_comment`)
|
|
78
|
+
when a point needs the author's decision instead of a fix; keep each comment to one point and
|
|
79
|
+
say what you suggest. Resolve threads you have addressed rather than deleting them. Read
|
|
80
|
+
`list_changes` before accepting or rejecting, and act on ids one at a time unless the user
|
|
81
|
+
asked for all.
|
|
75
82
|
- **Prompt hygiene.** Put everything that changes between runs in a `{variable}` and set it
|
|
76
83
|
with `prompt_set_variable` rather than editing the text. Give variables descriptive
|
|
77
84
|
snake_case names and, where useful, a default and a description:
|
|
@@ -114,6 +121,26 @@ the pitfalls, and uses the tools below.
|
|
|
114
121
|
| `prompt_set_variable` | Set the value of a template variable (`name` without braces, `value` any JSON value). Prefer this over editing the prompt text when only a slot's value changes. |
|
|
115
122
|
| `prompt_select` | Select prompt text between two positions (`from === to` places the cursor), e.g. to show the user what you changed. |
|
|
116
123
|
|
|
124
|
+
### Review
|
|
125
|
+
|
|
126
|
+
Present when the editor has the `Comments` and / or `TrackChanges` extensions (the host may give
|
|
127
|
+
them their own namespace, e.g. `review__list_comments`). Positions are document positions, as
|
|
128
|
+
above. The write tools are hidden while the document is read-only.
|
|
129
|
+
|
|
130
|
+
| Tool | Use it to |
|
|
131
|
+
| --- | --- |
|
|
132
|
+
| `list_comments` | List comment threads in document order: `id`, the commented `from` / `to` and `quote`, `author`, `body`, `replies` (`id`, `author`, `body`), `resolved`, `orphaned` (its text was deleted; `from` / `to` are null). `includeResolved` default true. Call before replying, resolving or deleting. |
|
|
133
|
+
| `add_comment` | Comment on `from`..`to` (from `find_text`) with a `body`. One undo step; the selection moves to the commented text. Returns the new thread with its `id`. Fails on an empty or out-of-range span. |
|
|
134
|
+
| `reply_to_comment` | Reply to a thread by `commentId` with a `body`. Re-opens a resolved thread. Returns `replyId` and the thread. |
|
|
135
|
+
| `resolve_comment` | Resolve a thread by `commentId` (`resolved: false` re-opens it). Keeps the thread and its text. Returns the thread. Prefer this over deleting once a point is addressed. |
|
|
136
|
+
| `delete_comment` | Delete a thread and its replies and remove its highlight (one undo step). Returns `deleted` and how many remain. Only when the user asks, or for a comment you added by mistake. |
|
|
137
|
+
| `list_changes` | List tracked changes in document order: `id`, `type` (`insertion`, `deletion`, `format`, `block`, `move`), `author`, `from` / `to`, `text`, a plain-language `description` (moves add `movedFrom` / `movedTo`), and `trackingEnabled`. `type` filters. Call before accepting or rejecting. |
|
|
138
|
+
| `accept_change` | Accept one change by `changeId` (one undo step): inserted text stays, deleted text goes, a move keeps its destination. Returns the change and how many `remaining`. Ids of other changes stay valid. |
|
|
139
|
+
| `reject_change` | Reject one change by `changeId` (one undo step): inserted text goes, deleted text and old formatting come back, a move returns to its source. Returns the change and `remaining`. |
|
|
140
|
+
| `accept_all_changes` | Accept every tracked change in one undo step. Returns how many. Only when the user asks for all; otherwise go one by one. |
|
|
141
|
+
| `reject_all_changes` | Reject every tracked change in one undo step. Returns how many. |
|
|
142
|
+
| `set_track_changes` | Turn tracking on (`enabled: true`: every later edit, yours included, becomes a suggestion) or off. Returns `trackingEnabled`. Turn it on before suggesting edits. |
|
|
143
|
+
|
|
117
144
|
### Save and open
|
|
118
145
|
|
|
119
146
|
The host may add the shared document tools (see `pixerate-agent-tools`). A rich text document is the editor's ProseMirror JSON (`{ "type": "doc", "content": [...] }`), with marks such as tracked changes and comment anchors; comment threads stay in their own store.
|
|
@@ -29,6 +29,9 @@ This skill is the method. `pixerate-rich-text` has the full tool reference.
|
|
|
29
29
|
|
|
30
30
|
- **Scope:** spelling only, grammar and style, or a rewrite of named passages.
|
|
31
31
|
- **Exceptions:** text that must stay as written (quotes, legal text, product names, titles).
|
|
32
|
+
- **Edit or suggest:** when the user wants to review your changes, turn on `set_track_changes`
|
|
33
|
+
first so each fix is a suggestion, and flag doubtful points with `add_comment` instead of
|
|
34
|
+
changing them.
|
|
32
35
|
- **House style:** spelling variant (UK or US), how numbers and dates are written.
|
|
33
36
|
|
|
34
37
|
## Working method
|
|
@@ -47,7 +50,8 @@ This skill is the method. `pixerate-rich-text` has the full tool reference.
|
|
|
47
50
|
**Check:** `get_text` `blocks`: the other blocks' text is unchanged.
|
|
48
51
|
5. **Consistency.** Terms, numbers and dates one way: `find_text` with a `regex` for the
|
|
49
52
|
variants, then `replace_text`.
|
|
50
|
-
6. **Report** the fixes made, the matches you left and why.
|
|
53
|
+
6. **Report** the fixes made, the matches you left and why. When tracking is on, `list_changes`
|
|
54
|
+
shows the suggestions you made; leave accepting them to the user.
|
|
51
55
|
|
|
52
56
|
## Decision table
|
|
53
57
|
|
|
@@ -58,6 +62,7 @@ This skill is the method. `pixerate-rich-text` has the full tool reference.
|
|
|
58
62
|
| A family of variants (e-mail, email, E-mail) | `find_text` / `replace_text` with `regex: true` |
|
|
59
63
|
| Rewrite a sentence or paragraph | `replace_range` over its exact range |
|
|
60
64
|
| Insert a missing word | `insert_text` at the position from `find_text` |
|
|
65
|
+
| A point only the author can decide | `add_comment` on the passage, saying what you suggest |
|
|
61
66
|
| Formatting only | `format_text` on the range; leave the words |
|
|
62
67
|
|
|
63
68
|
## Recipes
|
|
@@ -90,3 +95,5 @@ blocks[0].to, text }` with one sentence.
|
|
|
90
95
|
- `replace_range`, `insert_text`: rewrite or insert at exact positions
|
|
91
96
|
- `format_text`: formatting fixes without touching words
|
|
92
97
|
- `undo_rich_text`: take back a step
|
|
98
|
+
- `set_track_changes`, `list_changes`: suggest fixes as tracked changes and list them
|
|
99
|
+
- `add_comment`: flag what the author should decide
|