@mjml-agent-editor/editor 0.1.14 → 0.1.16

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 CHANGED
@@ -143,6 +143,11 @@ exception and merges key by key — renaming one step would otherwise silently d
143
143
  eight. `DEFAULT_LABELS` and the `EditorLabels` type are exported if you want to see the full
144
144
  list or build a complete translation.
145
145
 
146
+ New keys arrive with new features, including in 0.1.x releases. They always have English
147
+ defaults, so a host passing `Partial<EditorLabels>` picks them up untouched; a host that
148
+ types a complete translation as `EditorLabels` fails to compile until it adds them, which is
149
+ the signal that there is a new string to translate.
150
+
146
151
  Values that interpolate are functions rather than format strings — `copied(kind)`,
147
152
  `completedSteps(count, failed)` — so word order belongs to the translator.
148
153
 
@@ -219,6 +224,43 @@ The visitor sees the host's own sentence when the rejection carries one:
219
224
  So a `DocumentStore.save` refusing a document over a size cap should throw with
220
225
  `status: 413` and a sentence. Autosave reports the same way, under one toast id.
221
226
 
227
+ ## Switching the agent off
228
+
229
+ A host that stops the agent — a spending cap reached, a kill switch — passes
230
+ `agentUnavailable` and says why through the label of the same name:
231
+
232
+ ```tsx
233
+ <EditorStoreProvider
234
+ stores={stores}
235
+ labels={{ ...translation, agentUnavailable: "The agent is paused for maintenance." }}
236
+ >
237
+ <ChatPanel docId={docId} agentUnavailable={paused} {...handlers} />
238
+ </EditorStoreProvider>
239
+ ```
240
+
241
+ The label only shows while the flag is set, so it can be passed all the time.
242
+
243
+ The message box, Send and "Apply changes from comments" are disabled, and the reason is
244
+ shown above them and linked to each through `aria-describedby`. The box shows no
245
+ placeholder meanwhile, so `chatPlaceholder` is not the place for the reason. Nothing else in
246
+ the panel can start a turn, including one the visitor sent just before the switch: a turn
247
+ whose pre-turn save is still running when the flag flips is dropped, and its prompt stays in
248
+ the box. That holds when the host sets the flag from inside `onBeforeSend`, for instance
249
+ because its save reported the cap. The conversation stays readable, and the canvas,
250
+ comments, preview, code, export and saving work as usual. Without the prop the panel
251
+ behaves as it always has.
252
+
253
+ The flag can flip while the page is open. The reason is announced through a live region,
254
+ and a keyboard user whose focus was on one of the controls being disabled is moved to it
255
+ rather than dropped to the page — and back to the message box when the agent returns.
256
+
257
+ It stops new turns only. A turn already running when the flag flips is left to finish and
258
+ Stop still ends it; `resume` still re-attaches to one. The server remains the place that
259
+ enforces the switch — the panel only stops offering what the server would refuse.
260
+
261
+ The empty-state copy (`chatEmptyTitle`, `chatEmptyDescription`) is left alone; override it
262
+ too if an empty conversation should mention the pause.
263
+
222
264
  ## A note on field names
223
265
 
224
266
  The ports are camelCase (`sectionId`, `objectId`, `projectData`); Postgres columns are
package/dist/canvas.cjs CHANGED
@@ -108,11 +108,13 @@ var DEFAULT_LABELS = {
108
108
  agentWorking: "Agent is working\u2026",
109
109
  reasoning: "Reasoning",
110
110
  completedSteps: (count, failed) => failed > 0 ? `Completed steps (${count}, ${failed} failed)` : `Completed steps (${count})`,
111
+ stepLimitReached: "The agent ran out of steps for this turn. Ask it to continue.",
111
112
  applyComments: "Apply changes from comments",
112
113
  chatPlaceholder: "Describe what you want to change\u2026 (Enter = send, Shift+Enter = new line)",
113
114
  stop: "Stop",
114
115
  send: "Send",
115
116
  chatError: "Agent chat error.",
117
+ agentUnavailable: "The agent is unavailable right now. You can still edit the email and leave comments.",
116
118
  toolLabels: {
117
119
  get_document: "Reading document",
118
120
  get_section: "Reading section",