@docmana/sdk 0.42.0 → 0.44.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,23 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.44.0 - 2026-11-19
4
+
5
+ - Add optional `ReviewDecision.pageReassignments` to move physical pages into
6
+ new typed documents through the native versioned review decision. The request
7
+ preserves organization scope and is sent once without automatic retry.
8
+
9
+ ## 0.43.0 - 2026-11-18
10
+
11
+ - Add `authoring.renameDocumentType` and its public request/result types. It
12
+ persists an organization-wide rename through the existing native API; callers
13
+ must confirm explicitly, reload afterwards and republish affected formulas.
14
+ Ambiguous failures are not retried automatically.
15
+
16
+ - Expose optional native node-verdict proposals in authoring conversations and the
17
+ `node_verdict` acknowledgement, including joint rule/verdict proposals. Export
18
+ `AuthoringNodeVerdictProposal` and `AuthoringConversationConfirmation` types.
19
+ Confirmation does not save or publish formula changes.
20
+
3
21
  ## 0.42.0 - 2026-11-16
4
22
 
5
23
  - Support optional `documentData` in full and partial flow executions. Each string is a separate inline document. Use it with uploaded files or by itself.
package/README.md CHANGED
@@ -475,6 +475,32 @@ npm run yalc:publish
475
475
 
476
476
  ## Native formula authoring
477
477
 
478
+ ### Rename a document type across an organization (0.43.0)
479
+
480
+ After saving local edits and obtaining explicit confirmation:
481
+
482
+ ```ts
483
+ const result = await docmana.authoring.renameDocumentType(
484
+ { flow_id: "formula-id", old_document_type: "invoice", new_document_type: "bill" },
485
+ { organization: "organization-name", signal: abortController.signal },
486
+ );
487
+ console.log(result.renamed_rules, result.updated_edges);
488
+ // Reload formula/rule-registry snapshots; republish affected formulas separately.
489
+ ```
490
+
491
+ `flow_id` is optional context; this always affects the selected organization,
492
+ including other formulas. Consumer delegates to native
493
+ `POST /rules/rename-document-type`; DocMana API owns validation, rule versions,
494
+ references, classification edges and priorities. Native editing roles are
495
+ required. An empty new type is reserved for the native legacy `other` conversion.
496
+ This operation persists immediately, independently of draft save and publication.
497
+ It has no preview or idempotency receipt. On an ambiguous failure, reload and
498
+ inspect the result before another attempt; the SDK does not automatically retry
499
+ 409/422/5xx or network errors. Deploy the compatible Consumer route before using
500
+ this method.
501
+
502
+ ### Conversations and native editor
503
+
478
504
  SDK 0.30.0 adds the existing DocMana stateful assistant through
479
505
  `authoring.openConversation({ flow_id, language, scope?, node_id?, messages? }, options)`,
480
506
  `sendConversationMessage(conversationId, content, options)` and
@@ -552,6 +578,13 @@ evidence or to a tool name and zero-based call index. Tool-only values have
552
578
  empty page evidence. Older Consumer versions can omit `tools`, and an extraction
553
579
  can omit `grounding` entirely.
554
580
 
581
+ `reviews.decide()` accepts optional `pageReassignments`, for example
582
+ `[{ docKey: "receipt", page: 2, documentType: "payment_proof", group: "payment" }]`.
583
+ Pages are one-based and each moved page has one target type. The optional group
584
+ joins moved pages into the same new document. The native API validates the
585
+ document, physical page, target type and review version. Deploy Consumer support
586
+ before using this additive field; decisions are never retried automatically.
587
+
555
588
  During human review, `reviews.document(executionId, docKey, "locations", options)`
556
589
  returns a `Response` whose JSON body has type `ReviewLocationsResponse`. The
557
590
  locations are keyed by review item ID and use one-based pages of the **reviewed
@@ -674,6 +707,39 @@ MIT
674
707
 
675
708
  `authoring.editorCatalog(options)` retrieves organization-scoped models, tools, external-system field definitions, default prompts and feature flags for native node editors. External-system credentials are excluded. `authoring.generateMapping({ workflow_fields, expected_fields, current_mapping, user_instructions }, options)` returns `{ jsonataExpression }` from the native mapper; it does not save or publish the proposal.
676
709
 
710
+ ### Assistant node-verdict proposals
711
+
712
+ The native rule assistant can return an optional `proposed_node_verdict` alongside
713
+ `proposed_rule`. Its shape is `{ node_id, verdict_instruction?, score_acceptance_threshold? }`.
714
+ Only supplied settings change: an empty instruction disables the verdict; the
715
+ threshold is an integer from 1 to 100. Validate the target against the same
716
+ assisted Validation/CrossValidation node, review the before/after values, then
717
+ apply the settings to the local draft. A joint rule/verdict proposal should be
718
+ reviewed and applied together.
719
+
720
+ ```ts
721
+ const turn = await docmana.authoring.sendConversationMessage(conversationId, message, options);
722
+ const verdict = turn.proposed_node_verdict;
723
+ // After explicit user review and local draft application:
724
+ if (verdict) {
725
+ await docmana.authoring.confirmConversation(
726
+ conversationId,
727
+ {
728
+ ...(turn.proposed_rule ? { rule_id: String(turn.proposed_rule.rule_id) } : {}),
729
+ node_verdict: true,
730
+ },
731
+ options,
732
+ );
733
+ }
734
+ // Save the reviewed draft separately with authoring.save(...), retaining revisions.
735
+ // Publication remains an explicit, separate action.
736
+ ```
737
+
738
+ Confirmation only acknowledges acceptance to the assistant; it does not save or
739
+ publish a formula. Retain the local draft if acknowledgement fails. Existing
740
+ backends may omit the optional proposal. Deploy compatible Consumer support
741
+ before publishing SDK 0.43.0 and adopting it in applications.
742
+
677
743
  ### Git publication provenance (local authoring POC)
678
744
 
679
745
  The types preserve optional `authoringSource`, Git commit/artifact hashes and
@@ -110,6 +110,17 @@ export interface AuthoringRuleImpact {
110
110
  }[];
111
111
  flows_to_republish: string[];
112
112
  }
113
+ export interface AuthoringDocumentTypeRename {
114
+ /** Editor context only. The rename always affects the selected organization. */
115
+ flow_id?: string;
116
+ old_document_type: string;
117
+ /** Empty is accepted only for the native legacy other-to-untyped conversion. */
118
+ new_document_type: string;
119
+ }
120
+ export interface AuthoringDocumentTypeRenameResult {
121
+ renamed_rules: string[];
122
+ updated_edges: number;
123
+ }
113
124
  export interface AuthoringChanges {
114
125
  create?: AuthoringData[];
115
126
  update?: {
@@ -257,11 +268,25 @@ export interface AuthoringConversationInput {
257
268
  content: string;
258
269
  }[];
259
270
  }
271
+ /** Only supplied settings change. An empty instruction disables the verdict. */
272
+ export interface AuthoringNodeVerdictProposal {
273
+ node_id: string;
274
+ verdict_instruction?: string;
275
+ /** Integer from 1 to 100. */
276
+ score_acceptance_threshold?: number;
277
+ }
278
+ /** Acknowledge a reviewed proposal; does not save or publish formula data. */
279
+ export interface AuthoringConversationConfirmation {
280
+ rule_id?: string;
281
+ document_type_rename?: boolean;
282
+ node_verdict?: boolean;
283
+ }
260
284
  export interface AuthoringConversationTurn {
261
285
  assistant_message: string;
262
286
  options?: unknown[] | null;
263
287
  proposed_rule?: AuthoringData | null;
264
288
  proposed_document_type_rename?: AuthoringData | null;
289
+ proposed_node_verdict?: AuthoringNodeVerdictProposal | null;
265
290
  context: AuthoringConversationContext;
266
291
  target_resolved: boolean;
267
292
  expires_at: string;
@@ -288,6 +313,8 @@ export declare class FormulaAuthoring {
288
313
  /** Native manual execution through Consumer Edge; assisted trials use definitions plus server-side Flows. */
289
314
  trialDocument(file: Blob, filename: string, spec: AuthoringDocumentTrialSpec, options: AuthoringOptions): Promise<AuthoringDocumentTrialReport>;
290
315
  editorCatalog(options: AuthoringOptions): Promise<AuthoringEditorCatalog>;
316
+ /** Persists organization-wide. No idempotency receipt: reload after ambiguous failure before retrying. */
317
+ renameDocumentType(body: AuthoringDocumentTypeRename, options: AuthoringOptions): Promise<AuthoringDocumentTypeRenameResult>;
291
318
  generateMapping(body: {
292
319
  workflow_fields: AuthoringData[];
293
320
  expected_fields: AuthoringData[];
@@ -298,10 +325,7 @@ export declare class FormulaAuthoring {
298
325
  }>;
299
326
  openConversation(body: AuthoringConversationInput, options: AuthoringOptions): Promise<AuthoringConversation>;
300
327
  sendConversationMessage(id: string, content: string, options: AuthoringOptions): Promise<AuthoringConversationTurn>;
301
- confirmConversation(id: string, body: {
302
- rule_id?: string;
303
- document_type_rename?: boolean;
304
- }, options: AuthoringOptions): Promise<{
328
+ confirmConversation(id: string, body: AuthoringConversationConfirmation, options: AuthoringOptions): Promise<{
305
329
  expires_at: string;
306
330
  }>;
307
331
  private request;
package/dist/cli.mjs CHANGED
@@ -78,6 +78,11 @@ var FormulaAuthoring = class {
78
78
  editorCatalog(options) {
79
79
  return this.request("GET", "editor-catalog", options);
80
80
  }
81
+ /** Persists organization-wide. No idempotency receipt: reload after ambiguous failure before retrying. */
82
+ renameDocumentType(body, options) {
83
+ if (body.flow_id !== void 0) identity(body.flow_id);
84
+ return this.request("POST", "document-types/rename", options, body);
85
+ }
81
86
  generateMapping(body, options) {
82
87
  return this.request("POST", "generate-mapping", options, body);
83
88
  }