@superdoc/sdk 2.25.0-next.1 → 2.25.0-next.10

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.
Files changed (46) hide show
  1. package/dist/agent/action-change-mode.cjs +6 -0
  2. package/dist/agent/action-change-mode.d.ts +1 -0
  3. package/dist/agent/action-change-mode.js +5 -0
  4. package/dist/agent/action-descriptors.json +2 -2
  5. package/dist/agent/actions.cjs +886 -530
  6. package/dist/agent/actions.d.ts +2 -0
  7. package/dist/agent/actions.js +887 -531
  8. package/dist/agent/catalog.cjs +5 -0
  9. package/dist/agent/catalog.js +5 -0
  10. package/dist/agent/doc-snapshot.cjs +10 -6
  11. package/dist/agent/doc-snapshot.d.ts +4 -1
  12. package/dist/agent/doc-snapshot.js +10 -6
  13. package/dist/agent/ir.d.ts +3 -0
  14. package/dist/embedded-prompts.generated.cjs +2 -1
  15. package/dist/embedded-prompts.generated.js +2 -1
  16. package/dist/embedded-tools.generated.cjs +5 -5
  17. package/dist/embedded-tools.generated.js +5 -5
  18. package/dist/generated/client.d.ts +534 -0
  19. package/dist/generated/contract.cjs +1 -1
  20. package/dist/generated/contract.js +1 -1
  21. package/dist/presets/core.cjs +2 -1
  22. package/dist/presets/core.d.ts +1 -0
  23. package/dist/presets/core.js +2 -2
  24. package/dist/presets/full.cjs +1804 -0
  25. package/dist/presets/full.d.ts +39 -0
  26. package/dist/presets/full.js +1795 -0
  27. package/dist/presets.cjs +2 -0
  28. package/dist/presets.js +2 -0
  29. package/dist/prompts/full-addendum.md +40 -0
  30. package/dist/prompts/system-prompt.md +3 -2
  31. package/dist/runtime/document-rpc.cjs +2 -8
  32. package/dist/runtime/document-rpc.js +2 -8
  33. package/dist/runtime/sdk-version.generated.cjs +1 -1
  34. package/dist/runtime/sdk-version.generated.d.ts +1 -1
  35. package/dist/runtime/sdk-version.generated.js +1 -1
  36. package/dist/runtime/tracked-support.cjs +11 -0
  37. package/dist/runtime/tracked-support.d.ts +6 -0
  38. package/dist/runtime/tracked-support.js +7 -0
  39. package/package.json +6 -6
  40. package/tools/catalog.json +9 -0
  41. package/tools/generation-receipt.json +20 -19
  42. package/tools/tools-policy.json +1 -1
  43. package/tools/tools.anthropic.json +9 -0
  44. package/tools/tools.generic.json +9 -0
  45. package/tools/tools.openai.json +9 -0
  46. package/tools/tools.vercel.json +9 -0
package/dist/presets.cjs CHANGED
@@ -3,6 +3,7 @@
3
3
  var errors = require('./runtime/errors.cjs');
4
4
  var legacy = require('./presets/legacy.cjs');
5
5
  var core = require('./presets/core.cjs');
6
+ var full = require('./presets/full.cjs');
6
7
 
7
8
  /**
8
9
  * Preset registry for SuperDoc LLM tools.
@@ -37,6 +38,7 @@ const DEFAULT_PRESET = 'legacy';
37
38
  const BUILTIN_PRESETS = {
38
39
  legacy: legacy.legacyPreset,
39
40
  core: core.corePreset,
41
+ full: full.fullPreset,
40
42
  };
41
43
  /**
42
44
  * Mutable registry, seeded with the built-ins. Customers add their own presets
package/dist/presets.js CHANGED
@@ -21,6 +21,7 @@
21
21
  import { SuperDocCliError } from './runtime/errors.js';
22
22
  import { legacyPreset } from './presets/legacy.js';
23
23
  import { corePreset } from './presets/core.js';
24
+ import { fullPreset } from './presets/full.js';
24
25
  // ---------------------------------------------------------------------------
25
26
  // Registry
26
27
  // ---------------------------------------------------------------------------
@@ -34,6 +35,7 @@ export const DEFAULT_PRESET = 'legacy';
34
35
  const BUILTIN_PRESETS = {
35
36
  legacy: legacyPreset,
36
37
  core: corePreset,
38
+ full: fullPreset,
37
39
  };
38
40
  /**
39
41
  * Mutable registry, seeded with the built-ins. Customers add their own presets
@@ -0,0 +1,40 @@
1
+ ============================================================
2
+ EXTENDED SURFACE — the whole Document API (full preset)
3
+ ============================================================
4
+
5
+ superdoc_perform_action covers the common verbs. Everything else the engine can do (a few hundred operations) is one step away. Escalation ladder — always in this order:
6
+
7
+ 1. superdoc_perform_action — when a named action fits, use it. It matches surrounding formatting and numbering for you.
8
+ 2. Helper actions on superdoc_perform_action for the frequent gaps: insert_image, insert_footnote, shade_cells, compare_with_file. One call each; they resolve ids and verify for you.
9
+ 3. superdoc_api_search — when nothing above fits, search: {query:"page margins"} / {domain:"sections"}. Then {operationId:"doc.sections.setPageMargins"} for the exact parameters. One catalog call, then act; do not browse the catalog for its own sake.
10
+ 4. superdoc_api_call — call the operation with {operationId, args}. Several operations in ONE round trip: {calls:[{operationId, args}, …]} — this is how you do repetitive work (shade eight cells, insert twelve paragraphs, apply one format to every match): read the targets once, then send one batch. It runs in order, stops at the first failure, and returns per-call receipts. Read them like any other receipt.
11
+
12
+ Recipes (ids for superdoc_api_call unless a helper is named):
13
+ - Footnote / endnote: superdoc_perform_action {action:"insert_footnote", anchorText:"Confidential Information", occurrence:1, content:"…", noteType:"footnote"}. The mark lands right after the phrase. Raw form: doc.footnotes.insert {type, content, at:{kind:"text", segments:[{blockId, range:{start,end}}]}}.
14
+ - Picture: superdoc_perform_action {action:"insert_image", src:"eval-logo.png", position:"after", anchorText:"…", caption:"Figure 1 — …"} (file path, URL, or data URI; omit position/anchorText for document end). Centre it afterwards with format_paragraph on the image's paragraph and the caption if asked. Fine-tuning: doc.images.setSize / setWrapType / setPosition / setAltText.
15
+ - Shade a header row / column / table: superdoc_perform_action {action:"shade_cells", tableOrdinal:1, rowIndex:0, color:"D9D9D9"}. Borders: doc.tables.setBorders / applyBorderPreset; cell props: doc.tables.setCellProperties (cell target only); widths/heights: setColumnWidth / setRowHeight / distributeRows / distributeColumns; merge/split: mergeCells / splitCell; sort; setStyle / applyStyle / setLayout.
16
+ - New table cells that must match neighbours: after insert_table_row / setCellText, read a sibling cell's run properties (superdoc_inspect with table runs) and apply them with doc.format.apply {target:{kind:"selection", start:{kind:"text", blockId:<cell paragraph>, offset:0}, end:{kind:"text", blockId, offset:<text length>}}, inline:{fontSize, fontFamily, bold, …}}. A new cell with default formatting next to 10pt siblings is a bug.
17
+ - Page layout: doc.sections.list first (sectionId), then doc.sections.setPageMargins / setPageSetup (size, orientation) / setColumns / setPageNumbering / setTitlePage / setOddEvenHeadersFooters / setPageBorders / setBreakType; doc.create.sectionBreak for a new section.
18
+ - Header / footer text: (1) doc.sections.list → sectionId; (2) doc.headerFooters.list → which slots exist and whether the slot is explicit; (3) if the slot has no explicit part: doc.headerFooters.parts.create {kind:"header"|"footer"} → refId, then doc.headerFooters.refs.set {target:{kind:"headerFooterSlot", section:{kind:"section", sectionId}, headerFooterKind, variant:"default"|"first"|"even"}, refId}; (4) write text with doc.create.paragraph {text, in:{kind:"story", storyType:"headerFooterSlot", section:{kind:"section", sectionId}, headerFooterKind, variant}, at:{kind:"documentEnd"}}; (5) page number: doc.fields.insert {mode:"raw", instruction:"PAGE", at:{kind:"text", story:<that same story>, segments:[{blockId:<the paragraph you created>, range:{start:N, end:N}}]}} where N is the offset inside that paragraph. Repeat for variant "first"/"even" when the document uses different first/even pages (headerFooters.list tells you).
19
+ - Table of contents: insert_toc action, or doc.create.tableOfContents; doc.toc.configure / update / remove.
20
+ - Fields, bookmarks, cross-references, hyperlinks: doc.fields.insert {mode:"raw", instruction:"…", at:<text span>}, doc.bookmarks.insert, doc.crossRefs.insert, doc.hyperlinks.insert / wrap / patch.
21
+ - Comments & tracked changes beyond the actions: doc.comments.create / patch / delete / list; doc.trackChanges.list / get / decide {decision:"accept"|"reject", target:{kind:"id", id} | {kind:"all"}}.
22
+ - Paragraph formatting: doc.format.paragraph.setAlignment / setIndentation / setSpacing / setBorder / setShading / setKeepOptions / setTabStop / setNumbering (block target). Character formatting: doc.format.apply {target|ref, inline:{bold, italic, underline, color, fontSize, fontFamily, highlight, …}}.
23
+ - Lists / numbering: doc.lists.create / attach / detach / indent / outdent / setLevel / setValue / restartAt / setType / setLevelNumbering / setLevelBullet / split / join / merge.
24
+ - Drafting long or structured content (whole memos, multi-section drafts, a document from blank): ONE doc.insert {value:"# Title\n\nParagraph…\n\n## Heading 2\n\n- bullet\n\n| col | col |\n|---|---|\n| a | b |", type:"markdown", target:{kind:"block", nodeType, nodeId}, placement:"after"|"before"} — Markdown headings become real heading styles, lists become real numbering, pipe tables become tables. Into an empty document target its only paragraph with placement:"after" (then delete_blocks it if it is blank). target:{kind:"documentStart"} is NOT valid for doc.insert; use a block target. Verify with superdoc_inspect countsOnly afterwards (headings, lists, tables counts). Read back with doc.getMarkdown.
25
+ - Compare two documents: superdoc_perform_action {action:"compare_with_file", path:"…/other.docx"} — differences land in THIS document as tracked changes; comments/styles/numbering differences apply directly.
26
+ - Content controls, protection, metadata, custom XML, citations, index, captions: browse the matching domain in superdoc_api_search.
27
+
28
+ Targets for superdoc_api_call:
29
+ - Block: {kind:"block", nodeType:"paragraph"|"heading"|"listItem"|"table"|"tableRow"|"tableCell"|"image"|"tableOfContents"|"sdt", nodeId}. nodeIds come from superdoc_inspect (or doc.blocks.list {textSearch:{terms:["…"]}, includeText:true}).
30
+ - Position (`at`): {kind:"documentEnd"} | {kind:"documentStart"} | {kind:"before"|"after", target:<block>}.
31
+ - Text span: {kind:"text", segments:[{blockId, range:{start, end}}]} — character offsets inside that block's text (doc.blocks.list with includeText:true gives the text). Add story:{…} when the block lives in a header/footer.
32
+ - Story scope (`in`): omit for the body; headers/footers use {kind:"story", storyType:"headerFooterSlot", section:{kind:"section", sectionId}, headerFooterKind, variant}.
33
+ - changeMode:"tracked" only where the catalog says supportsTrackedMode (some refuse it for certain inputs; the error says why), dryRun only where supportsDryRun — otherwise the call is refused before anything runs. Table and section property changes are direct-only.
34
+ - Preview requests ("preview", "what would change", "without making the change"): if the operation supportsDryRun, call it with dryRun:true and report the receipt; nothing is written. Otherwise describe from an inspect.
35
+
36
+ Rules for the extended surface:
37
+ - The receipt is still the truth. {success:false, failure} means nothing changed for that call — read the failure, fix the args (usually a wrong target shape or a missing nodeId), retry once. A thrown VALIDATION error (unknown/missing parameter, wrong id) also changed nothing. After a TIMEOUT or transport error, re-inspect before retrying an insert: the mutation may have landed.
38
+ - After a structural superdoc_api_call (table, section, header/footer, footnote, image), verify with a narrow superdoc_inspect before declaring done.
39
+ - Repetition is a batch, not a call per item. If you are about to make the same superdoc_api_call call a third time with different arguments, send the rest as one {calls:[…]} batch instead.
40
+ - Never claim a capability is missing without a superdoc_api_search search first.
@@ -20,6 +20,7 @@ Users speak in what they SEE, not in file-format terms. Translate their words in
20
20
  - REMOVING an item from a lettered or numbered run ("(a) …, (b) … and (c) …", sub-clauses ending "; and") reletters the items that follow and moves the closing conjunction to the new penultimate item, so the last one ends the way the list ends: deleting (iv) from "(ii) …; (iii) …; and (iv) …." takes TWO edits, (ii) "…;" becomes "…; and" and (iii) "…; and" becomes "…." (read (ii) first; it is in the paragraph above). Striking a defined term touches only clauses that use that exact term; look-alike terms ("Material Subsidiary" beside "Immaterial Subsidiary") stay. Clause text the user supplies goes in exactly as written: no added lead-ins, no rephrasing unless asked.
21
21
  - NEVER END THE TURN WITH THE DOCUMENT WORSE THAN YOU FOUND IT. If your own cleanup or undo removed content the user wanted — including text you wrote earlier this conversation — restore it IMMEDIATELY in the same turn (you know what it said; re-insert it or redo). Do not ask permission to repair damage you caused.
22
22
  - REVIEW means READING. "Comment on what can be improved" / "review this" / "give feedback" = read the actual text first (superdoc_inspect), then write comments that are SPECIFIC to each passage — quote or reference what the passage says and what to change. Identical boilerplate stamped on every paragraph is a failed review, not a review. comment_paragraphs applies ONE identical text everywhere — it is ONLY for broadcast notes ("please verify this section"); for review feedback use add_comments per target, each with its own text.
23
+ - SUMMARIES: when inspect counts show comments or trackedChanges, read those domains too and mention them.
23
24
  - ACT when intent is plain; ask only when the request is genuinely ambiguous AND the wrong guess would be destructive. One clarifying question maximum, with your best-guess default stated.
24
25
 
25
26
  ============================================================
@@ -48,7 +49,7 @@ ACTIONS (superdoc_perform_action with flat args)
48
49
  - undo_changes: untilMarker (rendered marker from the original state, e.g. "2.1.") or steps (1-25). Deterministic revert — steps history back until the marker reappears; the receipt proves it. NEVER use steps > 1 blindly: prefer untilMarker, and after ANY undo verify (superdoc_inspect) that content you meant to KEEP still exists — if you overshot, redo_changes {steps:N} steps forward again to recover it.
49
50
  - redo_changes: steps (1-25, default 1). Steps history FORWARD to re-apply edits a prior undo removed — THE recovery for an undo overshoot. Only reaches the forward branch until a NEW edit is made.
50
51
  - attach_numbering: anchorText (text of the block) or nodeId, likeMarker (rendered marker of a sibling clause, e.g. "10."). Scheme numbering only (it fails where the numbers are typed text). Makes an EXISTING block a numbered clause at the same scheme/level — "make this the section 11 heading" in a clause-numbered document is exactly this (it will render as the next number).
51
- - replace_text: edits:[{find,replace,occurrence?}], caseSensitive default false. selector to scope. Keep find/replace spans MINIMAL. If the find appears more than once in the selected block and only one should change, give that edit occurrence (1 = first match in the block; needs selector; not selector.occurrence). With occurrence, also pass expectedRevision from your latest inspect or receipt; on REVISION_CONFLICT inspect again and recount. changeMode:"tracked" if asked. The receipt reports editsApplied and editsSkipped per find — READ IT: a skipped find is not in the selected block; re-target instead of assuming success.
52
+ - replace_text: edits:[{find,replace,occurrence?}], caseSensitive default false. selector to scope. Keep find/replace spans MINIMAL. If the find appears more than once in the selected block and only one should change, give that edit occurrence (1 = first match in the block; needs selector; not selector.occurrence). With occurrence, also pass expectedRevision from your latest inspect or receipt; on REVISION_CONFLICT inspect again and recount. changeMode:"tracked" if asked; to redline a reworded phrase or clause as ONE deletion plus ONE insertion, add granularity:"range". The receipt reports editsApplied and editsSkipped per find — READ IT: a skipped find is not in the selected block; re-target instead of assuming success.
52
53
  - delete_text: finds:[string]. selector to scope deletions to ONE block — REQUIRED for whitespace-only finds (unscoped whitespace matches document-wide and is refused). changeMode:"tracked" if asked. Deletes TEXT ONLY: the block survives, so a list item keeps its bullet/number and an accepted tracked deletion leaves an empty numbered item behind. To remove the item itself use delete_blocks.
53
54
  - delete_blocks: selectors:[…], each resolving to ONE block (list item, paragraph or heading). changeMode:"tracked" if asked. THE way to DELETE a whole LIST ITEM, paragraph or heading — the bullet/number goes with it and scheme-numbered items renumber (typed markers after a deleted typed clause need the replace_text renumbering above). "Delete the first item under Article II" / "remove that clause" is exactly this, NOT delete_text. Pass every target in ONE call. Use delete_table for a whole table. The receipt's listPunctuation names the two edits that close the run after the deletion; apply them.
54
55
  - rewrite_block: selector, text. Inspect first to gather current text; never ask the user to paste text already in the doc.
@@ -73,7 +74,7 @@ ACTIONS (superdoc_perform_action with flat args)
73
74
  - move_text: text (the exact span/clause to relocate), afterText (destination — REQUIRED for a direct move). changeMode:"tracked" records the move as a redline (tracked delete of the source + tracked insert at the destination; afterText may then be omitted — the copy lands right after the struck source). For a text SPAN; whole sections = move_range, tables = move_table.
74
75
  - move_table: tableOrdinal? (default 1), placement {at:"document_end"|"document_start"|"after"|"before", selector?}. THE way to move a whole table in ONE call — never delete-and-recreate or chain inserts/undos to relocate a table. changeMode:"tracked" records the move for review.
75
76
  - delete_table: tableOrdinal? (default 1), changeMode?. THE way to delete an entire table in ONE call — never delete rows one by one or reuse another table.
76
- - style_table: tableOrdinal? (default 1), accentColor? (header fill hex). ONE call makes a table look professional: accent header row with white bold text, bold first column, banded rows, clean borders. Use after create_table or on any existing table. changeMode:"tracked" records the formatting for review.
77
+ - style_table: tableOrdinal? (default 1), accentColor? (header fill hex). ONE call makes a table look professional: accent header row with white bold text, bold first column, accent top and bottom borders. Use after create_table or on any existing table. changeMode:"tracked" records the formatting for review.
77
78
  - insert_table_row: tableOrdinal (1-based), rowIndex (0-based; omit to append), position:"above"|"below", optional cellTexts.
78
79
  - insert_table_column: tableOrdinal, columnIndex (0-based; omit to append right), position:"left"|"right", optional headerText.
79
80
  - delete_table_row / delete_table_column: rowIndex or columnIndex required, tableOrdinal optional.
@@ -3,6 +3,7 @@
3
3
  var node_crypto = require('node:crypto');
4
4
  var errors = require('./errors.cjs');
5
5
  var sdkPolicy = require('./sdk-policy.cjs');
6
+ var trackedSupport = require('./tracked-support.cjs');
6
7
  var transportCommon = require('./transport-common.cjs');
7
8
 
8
9
  const DOCUMENT_RPC_FEATURES = sdkPolicy.SDK_POLICY.documentRpcFeatures;
@@ -125,13 +126,6 @@ function mapDocumentReplaceFileResult(response, sessionId) {
125
126
  document: { byteLength: record.byteLength, revision: record.revision },
126
127
  };
127
128
  }
128
- function supportsTrackedMode(operation) {
129
- if (operation.trackedSupport === 'always' || operation.trackedSupport === 'conditional')
130
- return true;
131
- if (operation.trackedSupport === 'never')
132
- return false;
133
- return operation.supportsTrackedMode === true || operation.supportsConditionalTrackedMode === true;
134
- }
135
129
  function documentInvokePayload(operation, params, invokeOptions) {
136
130
  params = transportCommon.captureMutationPlanAuthor(operation.operationId, params, invokeOptions);
137
131
  const normalizedParams = transportCommon.applyOperationParamAliases(operation, params);
@@ -177,7 +171,7 @@ function documentInvokePayload(operation, params, invokeOptions) {
177
171
  options[name] = projectedValue;
178
172
  }
179
173
  }
180
- if (options.changeMode !== undefined && !supportsTrackedMode(operation)) {
174
+ if (options.changeMode !== undefined && !trackedSupport.operationAcceptsTrackedMode(operation)) {
181
175
  if (options.changeMode === 'tracked') {
182
176
  throw unsupported(`Structured document RPC does not support tracked mode for ${operation.operationId}.`, operation.operationId);
183
177
  }
@@ -1,6 +1,7 @@
1
1
  import { randomUUID } from 'node:crypto';
2
2
  import { SuperDocCliError } from './errors.js';
3
3
  import { SDK_POLICY } from './sdk-policy.js';
4
+ import { operationAcceptsTrackedMode } from './tracked-support.js';
4
5
  import { applyOperationParamAliases, captureMutationPlanAuthor, } from './transport-common.js';
5
6
  export const DOCUMENT_RPC_FEATURES = SDK_POLICY.documentRpcFeatures;
6
7
  export const DOCUMENT_RPC_REPLACE_FILE_FEATURE = SDK_POLICY.features.replaceFile;
@@ -122,13 +123,6 @@ export function mapDocumentReplaceFileResult(response, sessionId) {
122
123
  document: { byteLength: record.byteLength, revision: record.revision },
123
124
  };
124
125
  }
125
- function supportsTrackedMode(operation) {
126
- if (operation.trackedSupport === 'always' || operation.trackedSupport === 'conditional')
127
- return true;
128
- if (operation.trackedSupport === 'never')
129
- return false;
130
- return operation.supportsTrackedMode === true || operation.supportsConditionalTrackedMode === true;
131
- }
132
126
  function documentInvokePayload(operation, params, invokeOptions) {
133
127
  params = captureMutationPlanAuthor(operation.operationId, params, invokeOptions);
134
128
  const normalizedParams = applyOperationParamAliases(operation, params);
@@ -174,7 +168,7 @@ function documentInvokePayload(operation, params, invokeOptions) {
174
168
  options[name] = projectedValue;
175
169
  }
176
170
  }
177
- if (options.changeMode !== undefined && !supportsTrackedMode(operation)) {
171
+ if (options.changeMode !== undefined && !operationAcceptsTrackedMode(operation)) {
178
172
  if (options.changeMode === 'tracked') {
179
173
  throw unsupported(`Structured document RPC does not support tracked mode for ${operation.operationId}.`, operation.operationId);
180
174
  }
@@ -3,6 +3,6 @@
3
3
  // AUTO-GENERATED by scripts/embed-version.mjs — DO NOT EDIT.
4
4
  // Source of truth: package.json. Regenerated on every SDK build so the
5
5
  // SDK retains its own version identity when bundled into another package.
6
- const SDK_VERSION = '2.25.0-next.1';
6
+ const SDK_VERSION = '2.25.0-next.10';
7
7
 
8
8
  exports.SDK_VERSION = SDK_VERSION;
@@ -1 +1 @@
1
- export declare const SDK_VERSION = "2.25.0-next.1";
1
+ export declare const SDK_VERSION = "2.25.0-next.10";
@@ -1,4 +1,4 @@
1
1
  // AUTO-GENERATED by scripts/embed-version.mjs — DO NOT EDIT.
2
2
  // Source of truth: package.json. Regenerated on every SDK build so the
3
3
  // SDK retains its own version identity when bundled into another package.
4
- export const SDK_VERSION = '2.25.0-next.1';
4
+ export const SDK_VERSION = '2.25.0-next.10';
@@ -0,0 +1,11 @@
1
+ 'use strict';
2
+
3
+ function operationAcceptsTrackedMode(operation) {
4
+ if (operation?.trackedSupport === 'always' || operation?.trackedSupport === 'conditional')
5
+ return true;
6
+ if (operation?.trackedSupport === 'never')
7
+ return false;
8
+ return operation?.supportsTrackedMode === true || operation?.supportsConditionalTrackedMode === true;
9
+ }
10
+
11
+ exports.operationAcceptsTrackedMode = operationAcceptsTrackedMode;
@@ -0,0 +1,6 @@
1
+ export type TrackedSupportFlags = {
2
+ readonly trackedSupport?: unknown;
3
+ readonly supportsTrackedMode?: unknown;
4
+ readonly supportsConditionalTrackedMode?: unknown;
5
+ };
6
+ export declare function operationAcceptsTrackedMode(operation: TrackedSupportFlags | undefined): boolean;
@@ -0,0 +1,7 @@
1
+ export function operationAcceptsTrackedMode(operation) {
2
+ if (operation?.trackedSupport === 'always' || operation?.trackedSupport === 'conditional')
3
+ return true;
4
+ if (operation?.trackedSupport === 'never')
5
+ return false;
6
+ return operation?.supportsTrackedMode === true || operation?.supportsConditionalTrackedMode === true;
7
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@superdoc/sdk",
3
- "version": "2.25.0-next.1",
3
+ "version": "2.25.0-next.10",
4
4
  "description": "Node SDK for SuperDoc, wrapping the SuperDoc CLI to read and edit .docx files from JavaScript and TypeScript.",
5
5
  "private": false,
6
6
  "license": "AGPL-3.0",
@@ -38,11 +38,11 @@
38
38
  "typescript": "^5.9.2"
39
39
  },
40
40
  "optionalDependencies": {
41
- "@superdoc/sdk-darwin-arm64": "2.25.0-next.1",
42
- "@superdoc/sdk-darwin-x64": "2.25.0-next.1",
43
- "@superdoc/sdk-linux-x64": "2.25.0-next.1",
44
- "@superdoc/sdk-linux-arm64": "2.25.0-next.1",
45
- "@superdoc/sdk-windows-x64": "2.25.0-next.1"
41
+ "@superdoc/sdk-darwin-arm64": "2.25.0-next.10",
42
+ "@superdoc/sdk-darwin-x64": "2.25.0-next.10",
43
+ "@superdoc/sdk-linux-x64": "2.25.0-next.10",
44
+ "@superdoc/sdk-linux-arm64": "2.25.0-next.10",
45
+ "@superdoc/sdk-windows-x64": "2.25.0-next.10"
46
46
  },
47
47
  "publishConfig": {
48
48
  "access": "public"
@@ -7297,6 +7297,15 @@
7297
7297
  ],
7298
7298
  "type": "string"
7299
7299
  },
7300
+ "replacementGranularity": {
7301
+ "enum": [
7302
+ "word",
7303
+ "phrase",
7304
+ "range"
7305
+ ],
7306
+ "type": "string",
7307
+ "description": "Tracked revision boundaries for each rewritten range. word (default) preserves matching tokens; phrase joins edits separated only by spaces; range replaces the complete range. Requires changeMode: tracked and a single-paragraph text range in visible coordinates; by:\"ref\" steps do not accept it."
7308
+ },
7300
7309
  "style": {
7301
7310
  "type": "object",
7302
7311
  "properties": {
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "formatVersion": 1,
3
- "contractHash": "571c15fc12f574bfea752e1f34d5d26943b857086f82aa803386b16ff6cb748b",
4
- "documentApiSourceHash": "be4011c4eaa7e9ab162283b4b61ae458c938f68f8f56098ba851d1fe777a280e",
5
- "generatorHash": "555e161a6df034042019bf44c7c396e6971ff680d0f2e53c4987fcad3859f24b",
3
+ "contractHash": "756068a9617daba6d9b4281bbb7efe4225ac79896afbafaee12a4c7f90d21fa1",
4
+ "documentApiSourceHash": "e1a052db04cdc53e9bdc5773aac68ae29b283a12a9452b7c083f84cd60aa31a0",
5
+ "generatorHash": "87fa6da38480ef496e4a79a020a382f7e29fe3add24751483153042aca970c2e",
6
6
  "inputs": {
7
7
  "apps/cli/src/host/sdk-policy.ts": "8820bc2cb4694bd665cbfacbb55c262a5df5cde4ed2a1a8d0735c09c6a5e6dd8",
8
8
  "packages/sdk/codegen/src/artifacts.mjs": "aecab7eca4694cbcf2366ddd9cabc033abddad2ff8fb0960d505580dbaf4d8b7",
@@ -15,13 +15,14 @@
15
15
  "packages/sdk/codegen/src/model/schema.mjs": "29cb1167413280907ad324d8a1fcb54dc70cce829df00c1a755f43040d01cf3b",
16
16
  "packages/sdk/codegen/src/shared.mjs": "a411e7ea4fab43b5b08b00294c746ff7063ceddbae66ece8d8c5990f131e0f7c",
17
17
  "packages/sdk/codegen/src/targets.mjs": "62c5ae3e3813e07b37e62487d973bac60ef6bea558a01f3ace2e0c6e8374e147",
18
- "packages/sdk/langs/node/package.json": "c527a428e4f0e1607cee8ec49ab918c3c54752cfcae122bb1e4f3a9d0b0d4beb",
18
+ "packages/sdk/langs/node/package.json": "c03be53800c98f324458cbc200c85c784160da2ff4f5b15b0090c00ef97c690d",
19
19
  "packages/sdk/langs/node/scripts/embed-prompts.mjs": "1b1641bf89cad962a4ff11d93f301fe5a4e32fe856cd3c9586106d8aaab4ad80",
20
20
  "packages/sdk/langs/node/scripts/embed-tools.mjs": "4cd8b0605b088421ea1fdf8e4e19c70f571f4e3352309a1480491600122e7bb3",
21
21
  "packages/sdk/langs/node/scripts/embed-version.mjs": "95e2ff3a7c15cb38130e12f04c8a96c901a5e55d9960610ebefa37178fd19cde",
22
- "packages/sdk/langs/node/src/agent/action-descriptors.json": "427fdf2a163bbc6c25f0a165b84cfb17ea2b27a92611ec74cdc19bc77bff2594",
22
+ "packages/sdk/langs/node/src/agent/action-descriptors.json": "b2afbe8a23454bf807f7220172fb6211ccd098849f1ca27dc3546fdc352c8e48",
23
+ "packages/sdk/langs/node/src/prompts/full-addendum.md": "1c18055ddee8e40661417f75d16c12741c7b5f89987386396dc673b4fc837875",
23
24
  "packages/sdk/langs/node/src/prompts/mcp-prompt.md": "ba1e239877b2b316744477e3ca7b6982fa265edb1358759209cc439457728e8b",
24
- "packages/sdk/langs/node/src/prompts/system-prompt.md": "a756ec031837351f5a47b73968472910211c826deaf7afe401cef5c2690e3ac3",
25
+ "packages/sdk/langs/node/src/prompts/system-prompt.md": "dd9bdac644843db2f4964ea091f5c832b8c8eb058703861210374037c077bb92",
25
26
  "packages/sdk/scripts/sdk-generate.mjs": "fc5b0cb07a39972694a0c60cfef19b2e166ec12890fb5060e97b2b818f746ef3",
26
27
  "packages/sdk/scripts/sdk-platform-targets.mjs": "6bdcd55fec9695c7af44ee5c7f67065450f61c27cdd9552d68b92e88abb9d7ab",
27
28
  "packages/sdk/tools/prompt-templates/system-prompt-core.md": "98632908dbece800115db92181b2a48823725b6e2612383de6bc6c34f57ac72e",
@@ -32,14 +33,14 @@
32
33
  "outputs": {
33
34
  "packages/sdk/langs/node/src/generated/contract.ts": {
34
35
  "id": "node-contract",
35
- "sha256": "3a731906dd26de618b324ea4fd035211dac464d3cb7e923d56ad58ae581b601e",
36
+ "sha256": "120d819c4fae9de6ded1a66369dbfa91c038b96f1f15b9ca192e42cd31c4a55b",
36
37
  "consumers": [
37
38
  "node"
38
39
  ]
39
40
  },
40
41
  "packages/sdk/langs/node/src/generated/client.ts": {
41
42
  "id": "node-client",
42
- "sha256": "3ad801a85830aa6b29983a199557ae3a2172b03870b9faeadecf838c53c3dea6",
43
+ "sha256": "443e8cc3ed7a72ade8fb9539b024c5caab231e7320594994335985871f4a180a",
43
44
  "consumers": [
44
45
  "node"
45
46
  ]
@@ -53,14 +54,14 @@
53
54
  },
54
55
  "packages/sdk/langs/python/superdoc/generated/contract.py": {
55
56
  "id": "python-contract",
56
- "sha256": "55af1018df757766c0f9a699a472e5319902b6506af55e47ede87f185fd6a4ba",
57
+ "sha256": "a08508e328c7c41b8e8ecd8ef086d537d20407dc95becb3d920b240b625d68b1",
57
58
  "consumers": [
58
59
  "python"
59
60
  ]
60
61
  },
61
62
  "packages/sdk/langs/python/superdoc/generated/client.py": {
62
63
  "id": "python-client",
63
- "sha256": "8f45241f01762c57e4c8e8d6fd6e4cae669f11f9095d712d7a3f19af605b4788",
64
+ "sha256": "f55c6cf0cd9c0f9cb330608faa4f18936bebf61e1ec297062d894f791043d2a2",
64
65
  "consumers": [
65
66
  "python"
66
67
  ]
@@ -95,7 +96,7 @@
95
96
  },
96
97
  "packages/sdk/tools/catalog.json": {
97
98
  "id": "tool-catalog",
98
- "sha256": "606606282b03c08d15c437e064f9a96783ddf02662ac3634b0e750528b1f5a4e",
99
+ "sha256": "0d22fe1e3bda56c043cd8e2156ec2af6f53e71db18dd1ce3a04486952c564976",
99
100
  "consumers": [
100
101
  "node",
101
102
  "python",
@@ -104,7 +105,7 @@
104
105
  },
105
106
  "packages/sdk/tools/tools-policy.json": {
106
107
  "id": "tool-policy",
107
- "sha256": "8d3fd959cb3b3fd22bb8f5da31a33fb6de801376cb8e54e22fa5d9e8ececab10",
108
+ "sha256": "fb0195e4130bb323efa3fc9bddab193c6ea595656da14fa64222464ead34f853",
108
109
  "consumers": [
109
110
  "node",
110
111
  "python"
@@ -112,7 +113,7 @@
112
113
  },
113
114
  "packages/sdk/tools/tools.openai.json": {
114
115
  "id": "tools-openai",
115
- "sha256": "fdf1f16a1555ff4262e6889417ba712c3f4f139e930c272ee2ede2032c2aced1",
116
+ "sha256": "f41b4b2c1813d784bb2d32b48575e69d6fc05545bfcb3d29fa6ee690342d6270",
116
117
  "consumers": [
117
118
  "node",
118
119
  "python",
@@ -121,7 +122,7 @@
121
122
  },
122
123
  "packages/sdk/tools/tools.anthropic.json": {
123
124
  "id": "tools-anthropic",
124
- "sha256": "790291ea69a13c8d1cbc73443dac73cc39c7a488b1a835a5fd40274b1ebe64bc",
125
+ "sha256": "0920c8379fe6b116d34114a0f56378b52a7261aad78b55a59514ea5d1af3a903",
125
126
  "consumers": [
126
127
  "node",
127
128
  "python",
@@ -130,7 +131,7 @@
130
131
  },
131
132
  "packages/sdk/tools/tools.vercel.json": {
132
133
  "id": "tools-vercel",
133
- "sha256": "fdf1f16a1555ff4262e6889417ba712c3f4f139e930c272ee2ede2032c2aced1",
134
+ "sha256": "f41b4b2c1813d784bb2d32b48575e69d6fc05545bfcb3d29fa6ee690342d6270",
134
135
  "consumers": [
135
136
  "node",
136
137
  "python",
@@ -139,7 +140,7 @@
139
140
  },
140
141
  "packages/sdk/tools/tools.generic.json": {
141
142
  "id": "tools-generic",
142
- "sha256": "ea4d922bed6f2f42cc42ce4e618f91614cf0a265874ff80b15ec510b4ef5e312",
143
+ "sha256": "81d9007fb7daaf902da38f0bb83681e21969e5eee609a74eb80c637f33b95e50",
143
144
  "consumers": [
144
145
  "node",
145
146
  "python",
@@ -172,21 +173,21 @@
172
173
  },
173
174
  "packages/sdk/langs/node/src/embedded-prompts.generated.ts": {
174
175
  "id": "node-embedded-prompts",
175
- "sha256": "c1d21c0865063d6ebb6058f71949865cd7d0a7ee30d3a7341297a38684a2c540",
176
+ "sha256": "ce8426cf995a2d6d693626b175263d63df7cc736fd71a96e262d4b4eebbdb45e",
176
177
  "consumers": [
177
178
  "node"
178
179
  ]
179
180
  },
180
181
  "packages/sdk/langs/node/src/embedded-tools.generated.ts": {
181
182
  "id": "node-embedded-tools",
182
- "sha256": "93669a5667db7f68372e3a8695b207ce064ec87599c99afbc372e08f122ef841",
183
+ "sha256": "69cd0f4c4a7fdb5c1fc631dc99ce659da811b4ab3fed9a220aabe8f2e62a503c",
183
184
  "consumers": [
184
185
  "node"
185
186
  ]
186
187
  },
187
188
  "packages/sdk/langs/node/src/runtime/sdk-version.generated.ts": {
188
189
  "id": "node-sdk-version",
189
- "sha256": "d83e737e02020f832a97557c8c4ac5daf38bb81ef58c3bd010dde2385ab24fbc",
190
+ "sha256": "8c36ae4227c435ef950b4237e6d408fde0555e6df1dce86fad64488a7886b68a",
190
191
  "consumers": [
191
192
  "node"
192
193
  ]
@@ -43,5 +43,5 @@
43
43
  "mutates": true
44
44
  }
45
45
  ],
46
- "contractHash": "571c15fc12f574bfea752e1f34d5d26943b857086f82aa803386b16ff6cb748b"
46
+ "contractHash": "756068a9617daba6d9b4281bbb7efe4225ac79896afbafaee12a4c7f90d21fa1"
47
47
  }
@@ -6849,6 +6849,15 @@
6849
6849
  ],
6850
6850
  "type": "string"
6851
6851
  },
6852
+ "replacementGranularity": {
6853
+ "enum": [
6854
+ "word",
6855
+ "phrase",
6856
+ "range"
6857
+ ],
6858
+ "type": "string",
6859
+ "description": "Tracked revision boundaries for each rewritten range. word (default) preserves matching tokens; phrase joins edits separated only by spaces; range replaces the complete range. Requires changeMode: tracked and a single-paragraph text range in visible coordinates; by:\"ref\" steps do not accept it."
6860
+ },
6852
6861
  "style": {
6853
6862
  "type": "object",
6854
6863
  "properties": {
@@ -7017,6 +7017,15 @@
7017
7017
  ],
7018
7018
  "type": "string"
7019
7019
  },
7020
+ "replacementGranularity": {
7021
+ "enum": [
7022
+ "word",
7023
+ "phrase",
7024
+ "range"
7025
+ ],
7026
+ "type": "string",
7027
+ "description": "Tracked revision boundaries for each rewritten range. word (default) preserves matching tokens; phrase joins edits separated only by spaces; range replaces the complete range. Requires changeMode: tracked and a single-paragraph text range in visible coordinates; by:\"ref\" steps do not accept it."
7028
+ },
7020
7029
  "style": {
7021
7030
  "type": "object",
7022
7031
  "properties": {
@@ -6875,6 +6875,15 @@
6875
6875
  ],
6876
6876
  "type": "string"
6877
6877
  },
6878
+ "replacementGranularity": {
6879
+ "enum": [
6880
+ "word",
6881
+ "phrase",
6882
+ "range"
6883
+ ],
6884
+ "type": "string",
6885
+ "description": "Tracked revision boundaries for each rewritten range. word (default) preserves matching tokens; phrase joins edits separated only by spaces; range replaces the complete range. Requires changeMode: tracked and a single-paragraph text range in visible coordinates; by:\"ref\" steps do not accept it."
6886
+ },
6878
6887
  "style": {
6879
6888
  "type": "object",
6880
6889
  "properties": {
@@ -6875,6 +6875,15 @@
6875
6875
  ],
6876
6876
  "type": "string"
6877
6877
  },
6878
+ "replacementGranularity": {
6879
+ "enum": [
6880
+ "word",
6881
+ "phrase",
6882
+ "range"
6883
+ ],
6884
+ "type": "string",
6885
+ "description": "Tracked revision boundaries for each rewritten range. word (default) preserves matching tokens; phrase joins edits separated only by spaces; range replaces the complete range. Requires changeMode: tracked and a single-paragraph text range in visible coordinates; by:\"ref\" steps do not accept it."
6886
+ },
6878
6887
  "style": {
6879
6888
  "type": "object",
6880
6889
  "properties": {