@stablebaseline/sdk 0.4.0 → 0.4.2

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
@@ -1,9 +1,9 @@
1
1
  # @stablebaseline/sdk
2
2
 
3
3
  [![npm](https://img.shields.io/npm/v/@stablebaseline/sdk?color=orange)](https://www.npmjs.com/package/@stablebaseline/sdk)
4
- [![Tools](https://img.shields.io/badge/MCP%20tools-163-orange)](https://stablebaseline.io/docs/mcp/tools)
4
+ [![Tools](https://img.shields.io/badge/MCP%20tools-184-orange)](https://stablebaseline.io/docs/mcp/tools)
5
5
 
6
- TypeScript SDK for the **[Stable Baseline](https://stablebaseline.io) REST API** — the simplest, most complete, end-to-end agent-managed company brain. Living docs, 40+ visual diagrams, plans, and a self-learning Knowledge Graph. 163 tools across 16 categories.
6
+ TypeScript SDK for the **[Stable Baseline](https://stablebaseline.io) REST API** — the simplest, most complete, end-to-end agent-managed company brain. Living docs, 40+ visual diagrams, plans, and a self-learning Knowledge Graph. 184 tools across 19 categories.
7
7
 
8
8
  ## Install
9
9
 
@@ -52,7 +52,7 @@ Both go in the `Authorization: Bearer <...>` header.
52
52
 
53
53
  ## Tool catalogue
54
54
 
55
- 163 tools across 16 categories. The full list lives at [stablebaseline.io/docs/mcp/tools](https://stablebaseline.io/docs/mcp/tools). Highlights:
55
+ 184 tools across 19 categories. The full list lives at [stablebaseline.io/docs/mcp/tools](https://stablebaseline.io/docs/mcp/tools). Highlights:
56
56
 
57
57
  | Category | Sample tools |
58
58
  |---|---|
package/dist/index.cjs CHANGED
@@ -49,7 +49,7 @@ var StableBaseline = class {
49
49
  authHeader;
50
50
  signal;
51
51
  /**
52
- * Strongly-typed dispatch surface. Every entry is one of the 163 MCP tools.
52
+ * Strongly-typed dispatch surface. Every entry is one of the 184 MCP tools.
53
53
  *
54
54
  * const orgs = await sb.tools.listOrganisations({});
55
55
  * const doc = await sb.tools.createDocument({ folderId, title, cdmd });
package/dist/index.d.cts CHANGED
@@ -434,7 +434,7 @@ interface paths {
434
434
  put?: never;
435
435
  /**
436
436
  * getDocument
437
- * @description Read a document's content with line numbers. Returns numbered lines for use with editDocument. Diagrams/images appear as OMITTED markers with metadata (type, diagramId, nlDescription) — use getDiagramInDocument(diagramId) for full DSL code, or dedicated diagram/image tools to manage them.
437
+ * @description Read a document's content with line numbers. Returns numbered lines for use with editDocument. Diagrams/images appear as OMITTED markers with metadata (type, diagramId, nlDescription) — use getDiagramInDocument(diagramId) for full DSL code, or dedicated diagram/image tools to manage them. Pass includeDiagramDsl:true to inline each diagram's DSL and versionTimestamp directly into its DIAGRAM_OMITTED marker (saves a getDiagramInDocument call when you intend to read or edit diagrams).
438
438
  */
439
439
  post: operations["getDocument"];
440
440
  delete?: never;
@@ -474,7 +474,7 @@ interface paths {
474
474
  put?: never;
475
475
  /**
476
476
  * editDocument
477
- * @description Edit a document with line-based patches. Call getDocument first for line numbers and versionTimestamp. Call getCdmdLanguageGuide if unfamiliar with CDMD syntax. Do not edit DIAGRAM/IMAGE markers manually — use dedicated diagram/image tools. To @-mention a person in your patch, insert `<!-- REFERENCE: {"type":"user","id":"<user_uuid>","label":"Name"} -->`; look up the user_id via listAssignablePrincipals. Mentioned users are notified automatically.
477
+ * @description Edit a document: the PREFERRED tool for small targeted changes. Two patch dialects — do NOT mix them in one call. (1) ANCHOR patches {oldText, newText, before?, after?} — RECOMMENDED: replace an exact snippet of existing text with new text. oldText must match the document byte-for-byte AND be unique; if it occurs more than once, add `before`/`after` (short nearby surrounding text) to disambiguate. A no-match returns nearby context; an ambiguous match returns the occurrence count. Anchors do NOT drift, so you don't need fresh line numbers and they survive concurrent edits. Use newText:"" to delete. (2) LINE patches {startLine, endLine, replacement} — 1-based and INCLUSIVE: call getDocument first for line numbers; replace line 5 with {startLine:5,endLine:5}; INSERT before line N (deleting nothing) with {startLine:N,endLine:N-1}; append to an L-line document with {startLine:L+1,endLine:L}. Line numbers are ABSOLUTE and GO STALE after ANY edit — re-call getDocument before further line patches; out-of-range patches are rejected with the current line count. versionTimestamp from getDocument is required for optimistic locking, EXCEPT when dryRun:true. Set dryRun:true to apply the patches and get the resulting text back WITHOUT saving (verify before committing — kills retry loops). Do not edit or delete DIAGRAM/IMAGE marker lines (rejected with guidance) — use dedicated diagram/image tools. To @-mention a person, insert `<!-- REFERENCE: {"type":"user","id":"<user_uuid>","label":"Name"} -->`; look up the user_id via listAssignablePrincipals. Mentioned users are notified automatically.
478
478
  */
479
479
  post: operations["editDocument"];
480
480
  delete?: never;
@@ -494,7 +494,7 @@ interface paths {
494
494
  put?: never;
495
495
  /**
496
496
  * findAndReplaceTextInDocument
497
- * @description Find and replace text in a document. Searches for all occurrences and replaces them. Case-sensitive by default. Diagrams/images are automatically protected — only document text is affected. Note: when the `replace` value contains a `<!-- REFERENCE: {...} -->` marker (e.g. inserting a user mention), it round-trips losslessly through the editor and triggers notifications if it adds a new user mention.
497
+ * @description Find and replace EXACT substrings in a document (NOT regex: wildcards and patterns are matched literally). Replaces EVERY occurrence and returns the replacement count; best for renames and repeated phrases. For a single targeted change at a known location, prefer editDocument (line patches with optimistic locking). Case-sensitive by default. Diagrams/images are automatically protected — only document text is affected. Note: when the `replace` value contains a `<!-- REFERENCE: {...} -->` marker (e.g. inserting a user mention), it round-trips losslessly through the editor and triggers notifications if it adds a new user mention.
498
498
  */
499
499
  post: operations["findAndReplaceTextInDocument"];
500
500
  delete?: never;
@@ -554,7 +554,7 @@ interface paths {
554
554
  put?: never;
555
555
  /**
556
556
  * updateDiagramInDocument
557
- * @description Update a diagram's code, description, or properties. Call getDiagramTypeGuide for DSL syntax. Requires documentVersionTimestamp from getDocument. IMPORTANT: To change what the diagram visually shows, you MUST provide diagramCode with the full updated DSL source. The prompt and nlDescription fields are metadata only and do NOT change the rendered diagram. After updating, re-render with getDiagramImage to confirm it now looks right (iterate if not), and keep prompt/nlDescription in step with what the diagram now shows.
557
+ * @description Update a diagram's code, description, or properties. Call getDiagramTypeGuide for DSL syntax. Provide a version lock: EITHER documentVersionTimestamp (from getDocument — locks the whole document) OR diagramVersionTimestamp (from getDiagramInDocument, or getDocument with includeDiagramDsl:true — locks just THIS diagram, so two agents can edit two different diagrams in the same document concurrently without a conflict). At least one is required; diagramVersionTimestamp is preferred for concurrency. IMPORTANT: To change what the diagram visually shows, you MUST provide diagramCode with the full updated DSL source. The prompt and nlDescription fields are metadata only and do NOT change the rendered diagram. After updating, re-render with getDiagramImage to confirm it now looks right (iterate if not), and keep prompt/nlDescription in step with what the diagram now shows.
558
558
  */
559
559
  post: operations["updateDiagramInDocument"];
560
560
  delete?: never;
@@ -874,7 +874,7 @@ interface paths {
874
874
  put?: never;
875
875
  /**
876
876
  * getWhiteboardImage
877
- * @description Render a whiteboard to an IMAGE so you can SEE it and confirm your edits look right, then iterate — like taking a screenshot. Returns the rendered board as a viewable PNG (default) attached to the result. Pass elementIds to render only specific shapes (e.g. to inspect one section/slide), format:'svg' for vector markup instead of a raster, or background to set the canvas colour. Call this after addWhiteboardElements/updateWhiteboardScene to check layout, overlaps, labels and alignment before continuing.
877
+ * @description Render a whiteboard to an IMAGE so you can SEE it and confirm your edits look right, then iterate — like taking a screenshot. Returns the rendered board as a viewable image attached to the result. Pass elementIds to render only specific shapes (e.g. to inspect one section/slide), region:{x,y,width,height} to capture an exact scene-coordinate window (e.g. the user's viewport), theme:'light' for the fastest single-variant render, format:'svg' for vector markup, or background to set the canvas colour. Unchanged boards return instantly from a content-keyed cache. Call this after addWhiteboardElements/updateWhiteboardScene to check layout, overlaps, labels and alignment before continuing.
878
878
  */
879
879
  post: operations["getWhiteboardImage"];
880
880
  delete?: never;
@@ -5598,6 +5598,8 @@ interface operations {
5598
5598
  offset?: number;
5599
5599
  /** @description Max lines to return. Default: 200. */
5600
5600
  limit?: number;
5601
+ /** @description If true, inline each diagram's full DSL (as diagramCode) and its versionTimestamp into the DIAGRAM_OMITTED markers, so you can inspect and then edit a diagram (updateDiagramInDocument with diagramVersionTimestamp) without a second read. Default false. Note: large DSL inflates the response. */
5602
+ includeDiagramDsl?: boolean;
5601
5603
  /** @description Field projection. Valid fields: id, title, friendlyId, friendlyIdNumber, projectId, folderId, createdAt, updatedAt, versionTimestamp. */
5602
5604
  fields?: string[];
5603
5605
  /** @description Content field projection. Valid fields: offset, limit, totalLines, nextOffset, metadata, text. */
@@ -5779,19 +5781,30 @@ interface operations {
5779
5781
  folderId?: string;
5780
5782
  /** @description Sort position within the parent folder. Use to reposition a single document. For batch sibling reorder, use reorderDocuments. */
5781
5783
  position?: number;
5782
- /** @description Version timestamp from getDocument() for optimistic locking. */
5783
- versionTimestamp: number;
5784
+ /** @description Version timestamp from getDocument() for optimistic locking. Required unless dryRun:true. */
5785
+ versionTimestamp?: number;
5786
+ /** @description If true, apply the patches and RETURN the resulting document text without saving — no version bump, no lock required. Use to preview/verify a patch before committing. Default false. */
5787
+ dryRun?: boolean;
5784
5788
  /** @description Version history summary. */
5785
5789
  changeSummary?: string;
5786
- /** @description Line-based patches. Can be empty if only updating title, folderId, or position. */
5787
- patches?: {
5790
+ /** @description Patches to apply. Use EITHER anchor patches OR line patches, not both in the same call. May be empty if only updating title, folderId, or position. */
5791
+ patches?: ({
5792
+ /** @description Exact existing text to replace. Must match the document byte-for-byte and be unique (or use before/after to disambiguate). */
5793
+ oldText: string;
5794
+ /** @description Replacement text. Empty string to delete the matched text. */
5795
+ newText: string;
5796
+ /** @description Optional. Text that appears immediately before oldText, used to disambiguate when oldText occurs more than once. */
5797
+ before?: string;
5798
+ /** @description Optional. Text that appears immediately after oldText, used to disambiguate. */
5799
+ after?: string;
5800
+ } | {
5788
5801
  /** @description 1-based start line. */
5789
5802
  startLine: number;
5790
5803
  /** @description 1-based end line (inclusive). */
5791
5804
  endLine: number;
5792
5805
  /** @description Replacement text. Empty string to delete lines. */
5793
5806
  replacement: string;
5794
- }[];
5807
+ })[];
5795
5808
  };
5796
5809
  };
5797
5810
  };
@@ -6192,8 +6205,10 @@ interface operations {
6192
6205
  [key: string]: string;
6193
6206
  };
6194
6207
  };
6195
- /** @description Version timestamp from getDocument() for optimistic locking. */
6196
- documentVersionTimestamp: number;
6208
+ /** @description Document-level optimistic lock: versionTimestamp from getDocument(). Locks the whole document. Provide this OR diagramVersionTimestamp (at least one is required). */
6209
+ documentVersionTimestamp?: number;
6210
+ /** @description Diagram-level optimistic lock: versionTimestamp of THIS diagram (from getDiagramInDocument, or getDocument with includeDiagramDsl:true). Pass this instead of documentVersionTimestamp to lock only this diagram, so concurrent edits to OTHER diagrams in the same document don't conflict. Preferred for multi-agent concurrency. The response returns the new diagram.diagramVersionTimestamp for chaining further edits. */
6211
+ diagramVersionTimestamp?: number;
6197
6212
  };
6198
6213
  };
6199
6214
  };
@@ -7694,6 +7709,22 @@ interface operations {
7694
7709
  elementIds?: string[];
7695
7710
  /** @description Canvas background colour (default white), e.g. '#ffffff' or 'transparent'. */
7696
7711
  background?: string;
7712
+ /** @description Capture only this scene-coordinate window instead of the whole board — e.g. the user's current viewport, or the neighbourhood you are editing. The output is cropped to the exact rectangle. */
7713
+ region?: {
7714
+ /** @description Window left edge (scene coordinates). */
7715
+ x: number;
7716
+ /** @description Window top edge (scene coordinates). */
7717
+ y: number;
7718
+ /** @description Window width (> 0). */
7719
+ width: number;
7720
+ /** @description Window height (> 0). */
7721
+ height: number;
7722
+ };
7723
+ /**
7724
+ * @description Which theme variant(s) to render. 'light' is fastest and right for inspecting your own edits; 'both' (default) also produces the dark variant used by the chat widget.
7725
+ * @enum {string}
7726
+ */
7727
+ theme?: "light" | "dark" | "both";
7697
7728
  };
7698
7729
  };
7699
7730
  };
@@ -20202,7 +20233,7 @@ declare class StableBaseline {
20202
20233
  private authHeader;
20203
20234
  private signal?;
20204
20235
  /**
20205
- * Strongly-typed dispatch surface. Every entry is one of the 163 MCP tools.
20236
+ * Strongly-typed dispatch surface. Every entry is one of the 184 MCP tools.
20206
20237
  *
20207
20238
  * const orgs = await sb.tools.listOrganisations({});
20208
20239
  * const doc = await sb.tools.createDocument({ folderId, title, cdmd });
package/dist/index.d.ts CHANGED
@@ -434,7 +434,7 @@ interface paths {
434
434
  put?: never;
435
435
  /**
436
436
  * getDocument
437
- * @description Read a document's content with line numbers. Returns numbered lines for use with editDocument. Diagrams/images appear as OMITTED markers with metadata (type, diagramId, nlDescription) — use getDiagramInDocument(diagramId) for full DSL code, or dedicated diagram/image tools to manage them.
437
+ * @description Read a document's content with line numbers. Returns numbered lines for use with editDocument. Diagrams/images appear as OMITTED markers with metadata (type, diagramId, nlDescription) — use getDiagramInDocument(diagramId) for full DSL code, or dedicated diagram/image tools to manage them. Pass includeDiagramDsl:true to inline each diagram's DSL and versionTimestamp directly into its DIAGRAM_OMITTED marker (saves a getDiagramInDocument call when you intend to read or edit diagrams).
438
438
  */
439
439
  post: operations["getDocument"];
440
440
  delete?: never;
@@ -474,7 +474,7 @@ interface paths {
474
474
  put?: never;
475
475
  /**
476
476
  * editDocument
477
- * @description Edit a document with line-based patches. Call getDocument first for line numbers and versionTimestamp. Call getCdmdLanguageGuide if unfamiliar with CDMD syntax. Do not edit DIAGRAM/IMAGE markers manually — use dedicated diagram/image tools. To @-mention a person in your patch, insert `<!-- REFERENCE: {"type":"user","id":"<user_uuid>","label":"Name"} -->`; look up the user_id via listAssignablePrincipals. Mentioned users are notified automatically.
477
+ * @description Edit a document: the PREFERRED tool for small targeted changes. Two patch dialects — do NOT mix them in one call. (1) ANCHOR patches {oldText, newText, before?, after?} — RECOMMENDED: replace an exact snippet of existing text with new text. oldText must match the document byte-for-byte AND be unique; if it occurs more than once, add `before`/`after` (short nearby surrounding text) to disambiguate. A no-match returns nearby context; an ambiguous match returns the occurrence count. Anchors do NOT drift, so you don't need fresh line numbers and they survive concurrent edits. Use newText:"" to delete. (2) LINE patches {startLine, endLine, replacement} — 1-based and INCLUSIVE: call getDocument first for line numbers; replace line 5 with {startLine:5,endLine:5}; INSERT before line N (deleting nothing) with {startLine:N,endLine:N-1}; append to an L-line document with {startLine:L+1,endLine:L}. Line numbers are ABSOLUTE and GO STALE after ANY edit — re-call getDocument before further line patches; out-of-range patches are rejected with the current line count. versionTimestamp from getDocument is required for optimistic locking, EXCEPT when dryRun:true. Set dryRun:true to apply the patches and get the resulting text back WITHOUT saving (verify before committing — kills retry loops). Do not edit or delete DIAGRAM/IMAGE marker lines (rejected with guidance) — use dedicated diagram/image tools. To @-mention a person, insert `<!-- REFERENCE: {"type":"user","id":"<user_uuid>","label":"Name"} -->`; look up the user_id via listAssignablePrincipals. Mentioned users are notified automatically.
478
478
  */
479
479
  post: operations["editDocument"];
480
480
  delete?: never;
@@ -494,7 +494,7 @@ interface paths {
494
494
  put?: never;
495
495
  /**
496
496
  * findAndReplaceTextInDocument
497
- * @description Find and replace text in a document. Searches for all occurrences and replaces them. Case-sensitive by default. Diagrams/images are automatically protected — only document text is affected. Note: when the `replace` value contains a `<!-- REFERENCE: {...} -->` marker (e.g. inserting a user mention), it round-trips losslessly through the editor and triggers notifications if it adds a new user mention.
497
+ * @description Find and replace EXACT substrings in a document (NOT regex: wildcards and patterns are matched literally). Replaces EVERY occurrence and returns the replacement count; best for renames and repeated phrases. For a single targeted change at a known location, prefer editDocument (line patches with optimistic locking). Case-sensitive by default. Diagrams/images are automatically protected — only document text is affected. Note: when the `replace` value contains a `<!-- REFERENCE: {...} -->` marker (e.g. inserting a user mention), it round-trips losslessly through the editor and triggers notifications if it adds a new user mention.
498
498
  */
499
499
  post: operations["findAndReplaceTextInDocument"];
500
500
  delete?: never;
@@ -554,7 +554,7 @@ interface paths {
554
554
  put?: never;
555
555
  /**
556
556
  * updateDiagramInDocument
557
- * @description Update a diagram's code, description, or properties. Call getDiagramTypeGuide for DSL syntax. Requires documentVersionTimestamp from getDocument. IMPORTANT: To change what the diagram visually shows, you MUST provide diagramCode with the full updated DSL source. The prompt and nlDescription fields are metadata only and do NOT change the rendered diagram. After updating, re-render with getDiagramImage to confirm it now looks right (iterate if not), and keep prompt/nlDescription in step with what the diagram now shows.
557
+ * @description Update a diagram's code, description, or properties. Call getDiagramTypeGuide for DSL syntax. Provide a version lock: EITHER documentVersionTimestamp (from getDocument — locks the whole document) OR diagramVersionTimestamp (from getDiagramInDocument, or getDocument with includeDiagramDsl:true — locks just THIS diagram, so two agents can edit two different diagrams in the same document concurrently without a conflict). At least one is required; diagramVersionTimestamp is preferred for concurrency. IMPORTANT: To change what the diagram visually shows, you MUST provide diagramCode with the full updated DSL source. The prompt and nlDescription fields are metadata only and do NOT change the rendered diagram. After updating, re-render with getDiagramImage to confirm it now looks right (iterate if not), and keep prompt/nlDescription in step with what the diagram now shows.
558
558
  */
559
559
  post: operations["updateDiagramInDocument"];
560
560
  delete?: never;
@@ -874,7 +874,7 @@ interface paths {
874
874
  put?: never;
875
875
  /**
876
876
  * getWhiteboardImage
877
- * @description Render a whiteboard to an IMAGE so you can SEE it and confirm your edits look right, then iterate — like taking a screenshot. Returns the rendered board as a viewable PNG (default) attached to the result. Pass elementIds to render only specific shapes (e.g. to inspect one section/slide), format:'svg' for vector markup instead of a raster, or background to set the canvas colour. Call this after addWhiteboardElements/updateWhiteboardScene to check layout, overlaps, labels and alignment before continuing.
877
+ * @description Render a whiteboard to an IMAGE so you can SEE it and confirm your edits look right, then iterate — like taking a screenshot. Returns the rendered board as a viewable image attached to the result. Pass elementIds to render only specific shapes (e.g. to inspect one section/slide), region:{x,y,width,height} to capture an exact scene-coordinate window (e.g. the user's viewport), theme:'light' for the fastest single-variant render, format:'svg' for vector markup, or background to set the canvas colour. Unchanged boards return instantly from a content-keyed cache. Call this after addWhiteboardElements/updateWhiteboardScene to check layout, overlaps, labels and alignment before continuing.
878
878
  */
879
879
  post: operations["getWhiteboardImage"];
880
880
  delete?: never;
@@ -5598,6 +5598,8 @@ interface operations {
5598
5598
  offset?: number;
5599
5599
  /** @description Max lines to return. Default: 200. */
5600
5600
  limit?: number;
5601
+ /** @description If true, inline each diagram's full DSL (as diagramCode) and its versionTimestamp into the DIAGRAM_OMITTED markers, so you can inspect and then edit a diagram (updateDiagramInDocument with diagramVersionTimestamp) without a second read. Default false. Note: large DSL inflates the response. */
5602
+ includeDiagramDsl?: boolean;
5601
5603
  /** @description Field projection. Valid fields: id, title, friendlyId, friendlyIdNumber, projectId, folderId, createdAt, updatedAt, versionTimestamp. */
5602
5604
  fields?: string[];
5603
5605
  /** @description Content field projection. Valid fields: offset, limit, totalLines, nextOffset, metadata, text. */
@@ -5779,19 +5781,30 @@ interface operations {
5779
5781
  folderId?: string;
5780
5782
  /** @description Sort position within the parent folder. Use to reposition a single document. For batch sibling reorder, use reorderDocuments. */
5781
5783
  position?: number;
5782
- /** @description Version timestamp from getDocument() for optimistic locking. */
5783
- versionTimestamp: number;
5784
+ /** @description Version timestamp from getDocument() for optimistic locking. Required unless dryRun:true. */
5785
+ versionTimestamp?: number;
5786
+ /** @description If true, apply the patches and RETURN the resulting document text without saving — no version bump, no lock required. Use to preview/verify a patch before committing. Default false. */
5787
+ dryRun?: boolean;
5784
5788
  /** @description Version history summary. */
5785
5789
  changeSummary?: string;
5786
- /** @description Line-based patches. Can be empty if only updating title, folderId, or position. */
5787
- patches?: {
5790
+ /** @description Patches to apply. Use EITHER anchor patches OR line patches, not both in the same call. May be empty if only updating title, folderId, or position. */
5791
+ patches?: ({
5792
+ /** @description Exact existing text to replace. Must match the document byte-for-byte and be unique (or use before/after to disambiguate). */
5793
+ oldText: string;
5794
+ /** @description Replacement text. Empty string to delete the matched text. */
5795
+ newText: string;
5796
+ /** @description Optional. Text that appears immediately before oldText, used to disambiguate when oldText occurs more than once. */
5797
+ before?: string;
5798
+ /** @description Optional. Text that appears immediately after oldText, used to disambiguate. */
5799
+ after?: string;
5800
+ } | {
5788
5801
  /** @description 1-based start line. */
5789
5802
  startLine: number;
5790
5803
  /** @description 1-based end line (inclusive). */
5791
5804
  endLine: number;
5792
5805
  /** @description Replacement text. Empty string to delete lines. */
5793
5806
  replacement: string;
5794
- }[];
5807
+ })[];
5795
5808
  };
5796
5809
  };
5797
5810
  };
@@ -6192,8 +6205,10 @@ interface operations {
6192
6205
  [key: string]: string;
6193
6206
  };
6194
6207
  };
6195
- /** @description Version timestamp from getDocument() for optimistic locking. */
6196
- documentVersionTimestamp: number;
6208
+ /** @description Document-level optimistic lock: versionTimestamp from getDocument(). Locks the whole document. Provide this OR diagramVersionTimestamp (at least one is required). */
6209
+ documentVersionTimestamp?: number;
6210
+ /** @description Diagram-level optimistic lock: versionTimestamp of THIS diagram (from getDiagramInDocument, or getDocument with includeDiagramDsl:true). Pass this instead of documentVersionTimestamp to lock only this diagram, so concurrent edits to OTHER diagrams in the same document don't conflict. Preferred for multi-agent concurrency. The response returns the new diagram.diagramVersionTimestamp for chaining further edits. */
6211
+ diagramVersionTimestamp?: number;
6197
6212
  };
6198
6213
  };
6199
6214
  };
@@ -7694,6 +7709,22 @@ interface operations {
7694
7709
  elementIds?: string[];
7695
7710
  /** @description Canvas background colour (default white), e.g. '#ffffff' or 'transparent'. */
7696
7711
  background?: string;
7712
+ /** @description Capture only this scene-coordinate window instead of the whole board — e.g. the user's current viewport, or the neighbourhood you are editing. The output is cropped to the exact rectangle. */
7713
+ region?: {
7714
+ /** @description Window left edge (scene coordinates). */
7715
+ x: number;
7716
+ /** @description Window top edge (scene coordinates). */
7717
+ y: number;
7718
+ /** @description Window width (> 0). */
7719
+ width: number;
7720
+ /** @description Window height (> 0). */
7721
+ height: number;
7722
+ };
7723
+ /**
7724
+ * @description Which theme variant(s) to render. 'light' is fastest and right for inspecting your own edits; 'both' (default) also produces the dark variant used by the chat widget.
7725
+ * @enum {string}
7726
+ */
7727
+ theme?: "light" | "dark" | "both";
7697
7728
  };
7698
7729
  };
7699
7730
  };
@@ -20202,7 +20233,7 @@ declare class StableBaseline {
20202
20233
  private authHeader;
20203
20234
  private signal?;
20204
20235
  /**
20205
- * Strongly-typed dispatch surface. Every entry is one of the 163 MCP tools.
20236
+ * Strongly-typed dispatch surface. Every entry is one of the 184 MCP tools.
20206
20237
  *
20207
20238
  * const orgs = await sb.tools.listOrganisations({});
20208
20239
  * const doc = await sb.tools.createDocument({ folderId, title, cdmd });
package/dist/index.js CHANGED
@@ -23,7 +23,7 @@ var StableBaseline = class {
23
23
  authHeader;
24
24
  signal;
25
25
  /**
26
- * Strongly-typed dispatch surface. Every entry is one of the 163 MCP tools.
26
+ * Strongly-typed dispatch surface. Every entry is one of the 184 MCP tools.
27
27
  *
28
28
  * const orgs = await sb.tools.listOrganisations({});
29
29
  * const doc = await sb.tools.createDocument({ folderId, title, cdmd });
package/openapi.json CHANGED
@@ -2569,7 +2569,7 @@
2569
2569
  "/tools/getDocument": {
2570
2570
  "post": {
2571
2571
  "summary": "getDocument",
2572
- "description": "Read a document's content with line numbers. Returns numbered lines for use with editDocument. Diagrams/images appear as OMITTED markers with metadata (type, diagramId, nlDescription) — use getDiagramInDocument(diagramId) for full DSL code, or dedicated diagram/image tools to manage them.",
2572
+ "description": "Read a document's content with line numbers. Returns numbered lines for use with editDocument. Diagrams/images appear as OMITTED markers with metadata (type, diagramId, nlDescription) — use getDiagramInDocument(diagramId) for full DSL code, or dedicated diagram/image tools to manage them. Pass includeDiagramDsl:true to inline each diagram's DSL and versionTimestamp directly into its DIAGRAM_OMITTED marker (saves a getDiagramInDocument call when you intend to read or edit diagrams).",
2573
2573
  "operationId": "getDocument",
2574
2574
  "tags": [
2575
2575
  "documents"
@@ -2593,6 +2593,10 @@
2593
2593
  "type": "number",
2594
2594
  "description": "Max lines to return. Default: 200."
2595
2595
  },
2596
+ "includeDiagramDsl": {
2597
+ "type": "boolean",
2598
+ "description": "If true, inline each diagram's full DSL (as diagramCode) and its versionTimestamp into the DIAGRAM_OMITTED markers, so you can inspect and then edit a diagram (updateDiagramInDocument with diagramVersionTimestamp) without a second read. Default false. Note: large DSL inflates the response."
2599
+ },
2596
2600
  "fields": {
2597
2601
  "type": "array",
2598
2602
  "items": {
@@ -2812,7 +2816,7 @@
2812
2816
  "/tools/editDocument": {
2813
2817
  "post": {
2814
2818
  "summary": "editDocument",
2815
- "description": "Edit a document with line-based patches. Call getDocument first for line numbers and versionTimestamp. Call getCdmdLanguageGuide if unfamiliar with CDMD syntax. Do not edit DIAGRAM/IMAGE markers manually — use dedicated diagram/image tools. To @-mention a person in your patch, insert `<!-- REFERENCE: {\"type\":\"user\",\"id\":\"<user_uuid>\",\"label\":\"Name\"} -->`; look up the user_id via listAssignablePrincipals. Mentioned users are notified automatically.",
2819
+ "description": "Edit a document: the PREFERRED tool for small targeted changes. Two patch dialects — do NOT mix them in one call. (1) ANCHOR patches {oldText, newText, before?, after?} — RECOMMENDED: replace an exact snippet of existing text with new text. oldText must match the document byte-for-byte AND be unique; if it occurs more than once, add `before`/`after` (short nearby surrounding text) to disambiguate. A no-match returns nearby context; an ambiguous match returns the occurrence count. Anchors do NOT drift, so you don't need fresh line numbers and they survive concurrent edits. Use newText:\"\" to delete. (2) LINE patches {startLine, endLine, replacement} — 1-based and INCLUSIVE: call getDocument first for line numbers; replace line 5 with {startLine:5,endLine:5}; INSERT before line N (deleting nothing) with {startLine:N,endLine:N-1}; append to an L-line document with {startLine:L+1,endLine:L}. Line numbers are ABSOLUTE and GO STALE after ANY edit — re-call getDocument before further line patches; out-of-range patches are rejected with the current line count. versionTimestamp from getDocument is required for optimistic locking, EXCEPT when dryRun:true. Set dryRun:true to apply the patches and get the resulting text back WITHOUT saving (verify before committing — kills retry loops). Do not edit or delete DIAGRAM/IMAGE marker lines (rejected with guidance) — use dedicated diagram/image tools. To @-mention a person, insert `<!-- REFERENCE: {\"type\":\"user\",\"id\":\"<user_uuid>\",\"label\":\"Name\"} -->`; look up the user_id via listAssignablePrincipals. Mentioned users are notified automatically.",
2816
2820
  "operationId": "editDocument",
2817
2821
  "tags": [
2818
2822
  "documents"
@@ -2841,7 +2845,11 @@
2841
2845
  },
2842
2846
  "versionTimestamp": {
2843
2847
  "type": "number",
2844
- "description": "Version timestamp from getDocument() for optimistic locking."
2848
+ "description": "Version timestamp from getDocument() for optimistic locking. Required unless dryRun:true."
2849
+ },
2850
+ "dryRun": {
2851
+ "type": "boolean",
2852
+ "description": "If true, apply the patches and RETURN the resulting document text without saving — no version bump, no lock required. Use to preview/verify a patch before committing. Default false."
2845
2853
  },
2846
2854
  "changeSummary": {
2847
2855
  "type": "string",
@@ -2849,34 +2857,64 @@
2849
2857
  },
2850
2858
  "patches": {
2851
2859
  "type": "array",
2852
- "description": "Line-based patches. Can be empty if only updating title, folderId, or position.",
2860
+ "description": "Patches to apply. Use EITHER anchor patches OR line patches, not both in the same call. May be empty if only updating title, folderId, or position.",
2853
2861
  "items": {
2854
- "type": "object",
2855
- "properties": {
2856
- "startLine": {
2857
- "type": "number",
2858
- "description": "1-based start line."
2859
- },
2860
- "endLine": {
2861
- "type": "number",
2862
- "description": "1-based end line (inclusive)."
2862
+ "oneOf": [
2863
+ {
2864
+ "type": "object",
2865
+ "description": "Anchor patch (recommended): replace an exact, unique snippet of existing text. Drift-proof — no line numbers needed.",
2866
+ "properties": {
2867
+ "oldText": {
2868
+ "type": "string",
2869
+ "description": "Exact existing text to replace. Must match the document byte-for-byte and be unique (or use before/after to disambiguate)."
2870
+ },
2871
+ "newText": {
2872
+ "type": "string",
2873
+ "description": "Replacement text. Empty string to delete the matched text."
2874
+ },
2875
+ "before": {
2876
+ "type": "string",
2877
+ "description": "Optional. Text that appears immediately before oldText, used to disambiguate when oldText occurs more than once."
2878
+ },
2879
+ "after": {
2880
+ "type": "string",
2881
+ "description": "Optional. Text that appears immediately after oldText, used to disambiguate."
2882
+ }
2883
+ },
2884
+ "required": [
2885
+ "oldText",
2886
+ "newText"
2887
+ ]
2863
2888
  },
2864
- "replacement": {
2865
- "type": "string",
2866
- "description": "Replacement text. Empty string to delete lines."
2889
+ {
2890
+ "type": "object",
2891
+ "description": "Line patch: 1-based inclusive line range. Requires fresh line numbers from getDocument().",
2892
+ "properties": {
2893
+ "startLine": {
2894
+ "type": "number",
2895
+ "description": "1-based start line."
2896
+ },
2897
+ "endLine": {
2898
+ "type": "number",
2899
+ "description": "1-based end line (inclusive)."
2900
+ },
2901
+ "replacement": {
2902
+ "type": "string",
2903
+ "description": "Replacement text. Empty string to delete lines."
2904
+ }
2905
+ },
2906
+ "required": [
2907
+ "startLine",
2908
+ "endLine",
2909
+ "replacement"
2910
+ ]
2867
2911
  }
2868
- },
2869
- "required": [
2870
- "startLine",
2871
- "endLine",
2872
- "replacement"
2873
2912
  ]
2874
2913
  }
2875
2914
  }
2876
2915
  },
2877
2916
  "required": [
2878
- "documentId",
2879
- "versionTimestamp"
2917
+ "documentId"
2880
2918
  ]
2881
2919
  }
2882
2920
  }
@@ -2960,7 +2998,7 @@
2960
2998
  "/tools/findAndReplaceTextInDocument": {
2961
2999
  "post": {
2962
3000
  "summary": "findAndReplaceTextInDocument",
2963
- "description": "Find and replace text in a document. Searches for all occurrences and replaces them. Case-sensitive by default. Diagrams/images are automatically protected — only document text is affected. Note: when the `replace` value contains a `<!-- REFERENCE: {...} -->` marker (e.g. inserting a user mention), it round-trips losslessly through the editor and triggers notifications if it adds a new user mention.",
3001
+ "description": "Find and replace EXACT substrings in a document (NOT regex: wildcards and patterns are matched literally). Replaces EVERY occurrence and returns the replacement count; best for renames and repeated phrases. For a single targeted change at a known location, prefer editDocument (line patches with optimistic locking). Case-sensitive by default. Diagrams/images are automatically protected — only document text is affected. Note: when the `replace` value contains a `<!-- REFERENCE: {...} -->` marker (e.g. inserting a user mention), it round-trips losslessly through the editor and triggers notifications if it adds a new user mention.",
2964
3002
  "operationId": "findAndReplaceTextInDocument",
2965
3003
  "tags": [
2966
3004
  "documents"
@@ -3376,7 +3414,7 @@
3376
3414
  "/tools/updateDiagramInDocument": {
3377
3415
  "post": {
3378
3416
  "summary": "updateDiagramInDocument",
3379
- "description": "Update a diagram's code, description, or properties. Call getDiagramTypeGuide for DSL syntax. Requires documentVersionTimestamp from getDocument. IMPORTANT: To change what the diagram visually shows, you MUST provide diagramCode with the full updated DSL source. The prompt and nlDescription fields are metadata only and do NOT change the rendered diagram. After updating, re-render with getDiagramImage to confirm it now looks right (iterate if not), and keep prompt/nlDescription in step with what the diagram now shows.",
3417
+ "description": "Update a diagram's code, description, or properties. Call getDiagramTypeGuide for DSL syntax. Provide a version lock: EITHER documentVersionTimestamp (from getDocument — locks the whole document) OR diagramVersionTimestamp (from getDiagramInDocument, or getDocument with includeDiagramDsl:true — locks just THIS diagram, so two agents can edit two different diagrams in the same document concurrently without a conflict). At least one is required; diagramVersionTimestamp is preferred for concurrency. IMPORTANT: To change what the diagram visually shows, you MUST provide diagramCode with the full updated DSL source. The prompt and nlDescription fields are metadata only and do NOT change the rendered diagram. After updating, re-render with getDiagramImage to confirm it now looks right (iterate if not), and keep prompt/nlDescription in step with what the diagram now shows.",
3380
3418
  "operationId": "updateDiagramInDocument",
3381
3419
  "tags": [
3382
3420
  "diagrams"
@@ -3435,12 +3473,15 @@
3435
3473
  },
3436
3474
  "documentVersionTimestamp": {
3437
3475
  "type": "number",
3438
- "description": "Version timestamp from getDocument() for optimistic locking."
3476
+ "description": "Document-level optimistic lock: versionTimestamp from getDocument(). Locks the whole document. Provide this OR diagramVersionTimestamp (at least one is required)."
3477
+ },
3478
+ "diagramVersionTimestamp": {
3479
+ "type": "number",
3480
+ "description": "Diagram-level optimistic lock: versionTimestamp of THIS diagram (from getDiagramInDocument, or getDocument with includeDiagramDsl:true). Pass this instead of documentVersionTimestamp to lock only this diagram, so concurrent edits to OTHER diagrams in the same document don't conflict. Preferred for multi-agent concurrency. The response returns the new diagram.diagramVersionTimestamp for chaining further edits."
3439
3481
  }
3440
3482
  },
3441
3483
  "required": [
3442
- "diagramId",
3443
- "documentVersionTimestamp"
3484
+ "diagramId"
3444
3485
  ]
3445
3486
  }
3446
3487
  }
@@ -5417,7 +5458,7 @@
5417
5458
  "/tools/getWhiteboardImage": {
5418
5459
  "post": {
5419
5460
  "summary": "getWhiteboardImage",
5420
- "description": "Render a whiteboard to an IMAGE so you can SEE it and confirm your edits look right, then iterate — like taking a screenshot. Returns the rendered board as a viewable PNG (default) attached to the result. Pass elementIds to render only specific shapes (e.g. to inspect one section/slide), format:'svg' for vector markup instead of a raster, or background to set the canvas colour. Call this after addWhiteboardElements/updateWhiteboardScene to check layout, overlaps, labels and alignment before continuing.",
5461
+ "description": "Render a whiteboard to an IMAGE so you can SEE it and confirm your edits look right, then iterate — like taking a screenshot. Returns the rendered board as a viewable image attached to the result. Pass elementIds to render only specific shapes (e.g. to inspect one section/slide), region:{x,y,width,height} to capture an exact scene-coordinate window (e.g. the user's viewport), theme:'light' for the fastest single-variant render, format:'svg' for vector markup, or background to set the canvas colour. Unchanged boards return instantly from a content-keyed cache. Call this after addWhiteboardElements/updateWhiteboardScene to check layout, overlaps, labels and alignment before continuing.",
5421
5462
  "operationId": "getWhiteboardImage",
5422
5463
  "tags": [
5423
5464
  "whiteboards"
@@ -5451,6 +5492,43 @@
5451
5492
  "background": {
5452
5493
  "type": "string",
5453
5494
  "description": "Canvas background colour (default white), e.g. '#ffffff' or 'transparent'."
5495
+ },
5496
+ "region": {
5497
+ "type": "object",
5498
+ "description": "Capture only this scene-coordinate window instead of the whole board — e.g. the user's current viewport, or the neighbourhood you are editing. The output is cropped to the exact rectangle.",
5499
+ "properties": {
5500
+ "x": {
5501
+ "type": "number",
5502
+ "description": "Window left edge (scene coordinates)."
5503
+ },
5504
+ "y": {
5505
+ "type": "number",
5506
+ "description": "Window top edge (scene coordinates)."
5507
+ },
5508
+ "width": {
5509
+ "type": "number",
5510
+ "description": "Window width (> 0)."
5511
+ },
5512
+ "height": {
5513
+ "type": "number",
5514
+ "description": "Window height (> 0)."
5515
+ }
5516
+ },
5517
+ "required": [
5518
+ "x",
5519
+ "y",
5520
+ "width",
5521
+ "height"
5522
+ ]
5523
+ },
5524
+ "theme": {
5525
+ "type": "string",
5526
+ "enum": [
5527
+ "light",
5528
+ "dark",
5529
+ "both"
5530
+ ],
5531
+ "description": "Which theme variant(s) to render. 'light' is fastest and right for inspecting your own edits; 'both' (default) also produces the dark variant used by the chat widget."
5454
5532
  }
5455
5533
  },
5456
5534
  "required": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@stablebaseline/sdk",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "TypeScript SDK for the Stable Baseline REST API. End-to-end agent-managed company brain — docs, diagrams, plans, and a self-learning Knowledge Graph. 184 tools across 19 categories.",
5
5
  "homepage": "https://stablebaseline.io",
6
6
  "repository": {
package/src/client.ts CHANGED
@@ -93,7 +93,7 @@ export class StableBaseline {
93
93
  private signal?: AbortSignal;
94
94
 
95
95
  /**
96
- * Strongly-typed dispatch surface. Every entry is one of the 163 MCP tools.
96
+ * Strongly-typed dispatch surface. Every entry is one of the 184 MCP tools.
97
97
  *
98
98
  * const orgs = await sb.tools.listOrganisations({});
99
99
  * const doc = await sb.tools.createDocument({ folderId, title, cdmd });
package/src/index.ts CHANGED
@@ -10,7 +10,7 @@
10
10
  // cdmd: "# ...",
11
11
  // });
12
12
  //
13
- // All 163 MCP tools are reachable from `sb.tools.<toolName>(input)`. Types
13
+ // All 184 MCP tools are reachable from `sb.tools.<toolName>(input)`. Types
14
14
  // are generated from the live OpenAPI spec (`openapi.json` in this package).
15
15
 
16
16
  export { StableBaseline } from "./client.js";
@@ -435,7 +435,7 @@ export interface paths {
435
435
  put?: never;
436
436
  /**
437
437
  * getDocument
438
- * @description Read a document's content with line numbers. Returns numbered lines for use with editDocument. Diagrams/images appear as OMITTED markers with metadata (type, diagramId, nlDescription) — use getDiagramInDocument(diagramId) for full DSL code, or dedicated diagram/image tools to manage them.
438
+ * @description Read a document's content with line numbers. Returns numbered lines for use with editDocument. Diagrams/images appear as OMITTED markers with metadata (type, diagramId, nlDescription) — use getDiagramInDocument(diagramId) for full DSL code, or dedicated diagram/image tools to manage them. Pass includeDiagramDsl:true to inline each diagram's DSL and versionTimestamp directly into its DIAGRAM_OMITTED marker (saves a getDiagramInDocument call when you intend to read or edit diagrams).
439
439
  */
440
440
  post: operations["getDocument"];
441
441
  delete?: never;
@@ -475,7 +475,7 @@ export interface paths {
475
475
  put?: never;
476
476
  /**
477
477
  * editDocument
478
- * @description Edit a document with line-based patches. Call getDocument first for line numbers and versionTimestamp. Call getCdmdLanguageGuide if unfamiliar with CDMD syntax. Do not edit DIAGRAM/IMAGE markers manually — use dedicated diagram/image tools. To @-mention a person in your patch, insert `<!-- REFERENCE: {"type":"user","id":"<user_uuid>","label":"Name"} -->`; look up the user_id via listAssignablePrincipals. Mentioned users are notified automatically.
478
+ * @description Edit a document: the PREFERRED tool for small targeted changes. Two patch dialects — do NOT mix them in one call. (1) ANCHOR patches {oldText, newText, before?, after?} — RECOMMENDED: replace an exact snippet of existing text with new text. oldText must match the document byte-for-byte AND be unique; if it occurs more than once, add `before`/`after` (short nearby surrounding text) to disambiguate. A no-match returns nearby context; an ambiguous match returns the occurrence count. Anchors do NOT drift, so you don't need fresh line numbers and they survive concurrent edits. Use newText:"" to delete. (2) LINE patches {startLine, endLine, replacement} — 1-based and INCLUSIVE: call getDocument first for line numbers; replace line 5 with {startLine:5,endLine:5}; INSERT before line N (deleting nothing) with {startLine:N,endLine:N-1}; append to an L-line document with {startLine:L+1,endLine:L}. Line numbers are ABSOLUTE and GO STALE after ANY edit — re-call getDocument before further line patches; out-of-range patches are rejected with the current line count. versionTimestamp from getDocument is required for optimistic locking, EXCEPT when dryRun:true. Set dryRun:true to apply the patches and get the resulting text back WITHOUT saving (verify before committing — kills retry loops). Do not edit or delete DIAGRAM/IMAGE marker lines (rejected with guidance) — use dedicated diagram/image tools. To @-mention a person, insert `<!-- REFERENCE: {"type":"user","id":"<user_uuid>","label":"Name"} -->`; look up the user_id via listAssignablePrincipals. Mentioned users are notified automatically.
479
479
  */
480
480
  post: operations["editDocument"];
481
481
  delete?: never;
@@ -495,7 +495,7 @@ export interface paths {
495
495
  put?: never;
496
496
  /**
497
497
  * findAndReplaceTextInDocument
498
- * @description Find and replace text in a document. Searches for all occurrences and replaces them. Case-sensitive by default. Diagrams/images are automatically protected — only document text is affected. Note: when the `replace` value contains a `<!-- REFERENCE: {...} -->` marker (e.g. inserting a user mention), it round-trips losslessly through the editor and triggers notifications if it adds a new user mention.
498
+ * @description Find and replace EXACT substrings in a document (NOT regex: wildcards and patterns are matched literally). Replaces EVERY occurrence and returns the replacement count; best for renames and repeated phrases. For a single targeted change at a known location, prefer editDocument (line patches with optimistic locking). Case-sensitive by default. Diagrams/images are automatically protected — only document text is affected. Note: when the `replace` value contains a `<!-- REFERENCE: {...} -->` marker (e.g. inserting a user mention), it round-trips losslessly through the editor and triggers notifications if it adds a new user mention.
499
499
  */
500
500
  post: operations["findAndReplaceTextInDocument"];
501
501
  delete?: never;
@@ -555,7 +555,7 @@ export interface paths {
555
555
  put?: never;
556
556
  /**
557
557
  * updateDiagramInDocument
558
- * @description Update a diagram's code, description, or properties. Call getDiagramTypeGuide for DSL syntax. Requires documentVersionTimestamp from getDocument. IMPORTANT: To change what the diagram visually shows, you MUST provide diagramCode with the full updated DSL source. The prompt and nlDescription fields are metadata only and do NOT change the rendered diagram. After updating, re-render with getDiagramImage to confirm it now looks right (iterate if not), and keep prompt/nlDescription in step with what the diagram now shows.
558
+ * @description Update a diagram's code, description, or properties. Call getDiagramTypeGuide for DSL syntax. Provide a version lock: EITHER documentVersionTimestamp (from getDocument — locks the whole document) OR diagramVersionTimestamp (from getDiagramInDocument, or getDocument with includeDiagramDsl:true — locks just THIS diagram, so two agents can edit two different diagrams in the same document concurrently without a conflict). At least one is required; diagramVersionTimestamp is preferred for concurrency. IMPORTANT: To change what the diagram visually shows, you MUST provide diagramCode with the full updated DSL source. The prompt and nlDescription fields are metadata only and do NOT change the rendered diagram. After updating, re-render with getDiagramImage to confirm it now looks right (iterate if not), and keep prompt/nlDescription in step with what the diagram now shows.
559
559
  */
560
560
  post: operations["updateDiagramInDocument"];
561
561
  delete?: never;
@@ -875,7 +875,7 @@ export interface paths {
875
875
  put?: never;
876
876
  /**
877
877
  * getWhiteboardImage
878
- * @description Render a whiteboard to an IMAGE so you can SEE it and confirm your edits look right, then iterate — like taking a screenshot. Returns the rendered board as a viewable PNG (default) attached to the result. Pass elementIds to render only specific shapes (e.g. to inspect one section/slide), format:'svg' for vector markup instead of a raster, or background to set the canvas colour. Call this after addWhiteboardElements/updateWhiteboardScene to check layout, overlaps, labels and alignment before continuing.
878
+ * @description Render a whiteboard to an IMAGE so you can SEE it and confirm your edits look right, then iterate — like taking a screenshot. Returns the rendered board as a viewable image attached to the result. Pass elementIds to render only specific shapes (e.g. to inspect one section/slide), region:{x,y,width,height} to capture an exact scene-coordinate window (e.g. the user's viewport), theme:'light' for the fastest single-variant render, format:'svg' for vector markup, or background to set the canvas colour. Unchanged boards return instantly from a content-keyed cache. Call this after addWhiteboardElements/updateWhiteboardScene to check layout, overlaps, labels and alignment before continuing.
879
879
  */
880
880
  post: operations["getWhiteboardImage"];
881
881
  delete?: never;
@@ -5599,6 +5599,8 @@ export interface operations {
5599
5599
  offset?: number;
5600
5600
  /** @description Max lines to return. Default: 200. */
5601
5601
  limit?: number;
5602
+ /** @description If true, inline each diagram's full DSL (as diagramCode) and its versionTimestamp into the DIAGRAM_OMITTED markers, so you can inspect and then edit a diagram (updateDiagramInDocument with diagramVersionTimestamp) without a second read. Default false. Note: large DSL inflates the response. */
5603
+ includeDiagramDsl?: boolean;
5602
5604
  /** @description Field projection. Valid fields: id, title, friendlyId, friendlyIdNumber, projectId, folderId, createdAt, updatedAt, versionTimestamp. */
5603
5605
  fields?: string[];
5604
5606
  /** @description Content field projection. Valid fields: offset, limit, totalLines, nextOffset, metadata, text. */
@@ -5780,19 +5782,30 @@ export interface operations {
5780
5782
  folderId?: string;
5781
5783
  /** @description Sort position within the parent folder. Use to reposition a single document. For batch sibling reorder, use reorderDocuments. */
5782
5784
  position?: number;
5783
- /** @description Version timestamp from getDocument() for optimistic locking. */
5784
- versionTimestamp: number;
5785
+ /** @description Version timestamp from getDocument() for optimistic locking. Required unless dryRun:true. */
5786
+ versionTimestamp?: number;
5787
+ /** @description If true, apply the patches and RETURN the resulting document text without saving — no version bump, no lock required. Use to preview/verify a patch before committing. Default false. */
5788
+ dryRun?: boolean;
5785
5789
  /** @description Version history summary. */
5786
5790
  changeSummary?: string;
5787
- /** @description Line-based patches. Can be empty if only updating title, folderId, or position. */
5788
- patches?: {
5791
+ /** @description Patches to apply. Use EITHER anchor patches OR line patches, not both in the same call. May be empty if only updating title, folderId, or position. */
5792
+ patches?: ({
5793
+ /** @description Exact existing text to replace. Must match the document byte-for-byte and be unique (or use before/after to disambiguate). */
5794
+ oldText: string;
5795
+ /** @description Replacement text. Empty string to delete the matched text. */
5796
+ newText: string;
5797
+ /** @description Optional. Text that appears immediately before oldText, used to disambiguate when oldText occurs more than once. */
5798
+ before?: string;
5799
+ /** @description Optional. Text that appears immediately after oldText, used to disambiguate. */
5800
+ after?: string;
5801
+ } | {
5789
5802
  /** @description 1-based start line. */
5790
5803
  startLine: number;
5791
5804
  /** @description 1-based end line (inclusive). */
5792
5805
  endLine: number;
5793
5806
  /** @description Replacement text. Empty string to delete lines. */
5794
5807
  replacement: string;
5795
- }[];
5808
+ })[];
5796
5809
  };
5797
5810
  };
5798
5811
  };
@@ -6193,8 +6206,10 @@ export interface operations {
6193
6206
  [key: string]: string;
6194
6207
  };
6195
6208
  };
6196
- /** @description Version timestamp from getDocument() for optimistic locking. */
6197
- documentVersionTimestamp: number;
6209
+ /** @description Document-level optimistic lock: versionTimestamp from getDocument(). Locks the whole document. Provide this OR diagramVersionTimestamp (at least one is required). */
6210
+ documentVersionTimestamp?: number;
6211
+ /** @description Diagram-level optimistic lock: versionTimestamp of THIS diagram (from getDiagramInDocument, or getDocument with includeDiagramDsl:true). Pass this instead of documentVersionTimestamp to lock only this diagram, so concurrent edits to OTHER diagrams in the same document don't conflict. Preferred for multi-agent concurrency. The response returns the new diagram.diagramVersionTimestamp for chaining further edits. */
6212
+ diagramVersionTimestamp?: number;
6198
6213
  };
6199
6214
  };
6200
6215
  };
@@ -7695,6 +7710,22 @@ export interface operations {
7695
7710
  elementIds?: string[];
7696
7711
  /** @description Canvas background colour (default white), e.g. '#ffffff' or 'transparent'. */
7697
7712
  background?: string;
7713
+ /** @description Capture only this scene-coordinate window instead of the whole board — e.g. the user's current viewport, or the neighbourhood you are editing. The output is cropped to the exact rectangle. */
7714
+ region?: {
7715
+ /** @description Window left edge (scene coordinates). */
7716
+ x: number;
7717
+ /** @description Window top edge (scene coordinates). */
7718
+ y: number;
7719
+ /** @description Window width (> 0). */
7720
+ width: number;
7721
+ /** @description Window height (> 0). */
7722
+ height: number;
7723
+ };
7724
+ /**
7725
+ * @description Which theme variant(s) to render. 'light' is fastest and right for inspecting your own edits; 'both' (default) also produces the dark variant used by the chat widget.
7726
+ * @enum {string}
7727
+ */
7728
+ theme?: "light" | "dark" | "both";
7698
7729
  };
7699
7730
  };
7700
7731
  };