@docmana/sdk 0.42.0 → 0.43.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,17 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.43.0 - 2026-11-18
4
+
5
+ - Add `authoring.renameDocumentType` and its public request/result types. It
6
+ persists an organization-wide rename through the existing native API; callers
7
+ must confirm explicitly, reload afterwards and republish affected formulas.
8
+ Ambiguous failures are not retried automatically.
9
+
10
+ - Expose optional native node-verdict proposals in authoring conversations and the
11
+ `node_verdict` acknowledgement, including joint rule/verdict proposals. Export
12
+ `AuthoringNodeVerdictProposal` and `AuthoringConversationConfirmation` types.
13
+ Confirmation does not save or publish formula changes.
14
+
3
15
  ## 0.42.0 - 2026-11-16
4
16
 
5
17
  - 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
@@ -674,6 +700,39 @@ MIT
674
700
 
675
701
  `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
702
 
703
+ ### Assistant node-verdict proposals
704
+
705
+ The native rule assistant can return an optional `proposed_node_verdict` alongside
706
+ `proposed_rule`. Its shape is `{ node_id, verdict_instruction?, score_acceptance_threshold? }`.
707
+ Only supplied settings change: an empty instruction disables the verdict; the
708
+ threshold is an integer from 1 to 100. Validate the target against the same
709
+ assisted Validation/CrossValidation node, review the before/after values, then
710
+ apply the settings to the local draft. A joint rule/verdict proposal should be
711
+ reviewed and applied together.
712
+
713
+ ```ts
714
+ const turn = await docmana.authoring.sendConversationMessage(conversationId, message, options);
715
+ const verdict = turn.proposed_node_verdict;
716
+ // After explicit user review and local draft application:
717
+ if (verdict) {
718
+ await docmana.authoring.confirmConversation(
719
+ conversationId,
720
+ {
721
+ ...(turn.proposed_rule ? { rule_id: String(turn.proposed_rule.rule_id) } : {}),
722
+ node_verdict: true,
723
+ },
724
+ options,
725
+ );
726
+ }
727
+ // Save the reviewed draft separately with authoring.save(...), retaining revisions.
728
+ // Publication remains an explicit, separate action.
729
+ ```
730
+
731
+ Confirmation only acknowledges acceptance to the assistant; it does not save or
732
+ publish a formula. Retain the local draft if acknowledgement fails. Existing
733
+ backends may omit the optional proposal. Deploy compatible Consumer support
734
+ before publishing SDK 0.43.0 and adopting it in applications.
735
+
677
736
  ### Git publication provenance (local authoring POC)
678
737
 
679
738
  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
  }