@stablebaseline/sdk 0.4.1 → 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/dist/index.d.cts +26 -11
- package/dist/index.d.ts +26 -11
- package/openapi.json +69 -28
- package/package.json +1 -1
- package/src/types.generated.ts +26 -11
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
|
|
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
|
|
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.
|
|
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;
|
|
@@ -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
|
|
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
|
|
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
|
|
6196
|
-
documentVersionTimestamp
|
|
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
|
};
|
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
|
|
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
|
|
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.
|
|
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;
|
|
@@ -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
|
|
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
|
|
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
|
|
6196
|
-
documentVersionTimestamp
|
|
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
|
};
|
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
|
|
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": "
|
|
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
|
-
"
|
|
2855
|
-
|
|
2856
|
-
|
|
2857
|
-
"
|
|
2858
|
-
"
|
|
2859
|
-
|
|
2860
|
-
|
|
2861
|
-
|
|
2862
|
-
|
|
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
|
-
|
|
2865
|
-
"type": "
|
|
2866
|
-
"description": "
|
|
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
|
|
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.
|
|
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": "
|
|
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
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@stablebaseline/sdk",
|
|
3
|
-
"version": "0.4.
|
|
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/types.generated.ts
CHANGED
|
@@ -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
|
|
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
|
|
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.
|
|
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;
|
|
@@ -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
|
|
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
|
|
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
|
|
6197
|
-
documentVersionTimestamp
|
|
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
|
};
|