@docmana/sdk 0.46.0 → 0.48.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,20 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.48.0 - 2026-11-23
4
+
5
+ - Add `reviews.requestDocumentTranslation(executionId, docKey, language, options)`, which returns a `DocumentTranslation` with the HTTP `status` (202 while prepared, 200 once settled) and the served variant. Idempotent; refusals keep their `apiCode` (`TRANSLATION_*`, `REVIEW_INVALID_LANGUAGE`). Requires DOC-2781-compatible Document API and Consumer Edge.
6
+ - Add the `language` option to `reviews.document()` and the optional variant fields of `DocumentPreviewManifest`. A language read never starts a translation and falls back to the original until the variant is ready.
7
+ - Export `DocumentTranslation`, `DocumentTranslationState` and `DocumentVariant`.
8
+
9
+ ## 0.47.0 - 2026-11-21
10
+
11
+ - Add review item kind `verdict` for explicit native Receivability `__decision__` corrections (`accepted`/`rejected`), independent of formula-defined properties. Requires DOC-2786-compatible Document API and Consumer Edge; no new endpoint.
12
+
13
+ - Add signed `execution.progress` callbacks, the closed 23-message catalogue and `reviews.progress()` for one scoped recovery snapshot with labels. Order by `stateVersion` across resume attempts; current review/terminal execution state remains authoritative. No polling or consuming result read.
14
+
15
+ - Add optional `ReviewDecision.outcome` and approved `ReviewTask.outcome` for a final human acceptance/refusal with a required reason, without recalculating the conclusion. Requires DOC-2782-compatible Document API and Consumer Edge.
16
+ - Document optional correction reasons when changing Receivability from false to true; existing validation derogations still require a reason.
17
+
3
18
  ## 0.46.0 - 2026-11-20
4
19
 
5
20
  - Add `reviews.listExecutions` for sortable, offset-paginated HITL execution metadata, including runs submitted directly to DocMana.
package/LICENSE CHANGED
@@ -1,21 +1,21 @@
1
- MIT License
2
-
3
- Copyright (c) 2026 Docmana
4
-
5
- Permission is hereby granted, free of charge, to any person obtaining a copy
6
- of this software and associated documentation files (the "Software"), to deal
7
- in the Software without restriction, including without limitation the rights
8
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
- copies of the Software, and to permit persons to whom the Software is
10
- furnished to do so, subject to the following conditions:
11
-
12
- The above copyright notice and this permission notice shall be included in all
13
- copies or substantial portions of the Software.
14
-
15
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
- SOFTWARE.
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Docmana
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # @docmana/sdk
2
2
 
3
+ DOC-2786 adds review items of kind `verdict`, field `__decision__`, on executed Receivability nodes. Submit the returned opaque `itemId` through `reviews.decide()` with value `accepted` or `rejected`; an optional reason is allowed for rejected-to-accepted overrides. This native verdict is independent of formula-defined boolean properties, which an application may correct separately in the same decision. Node status and downstream routing follow the human verdict without rejudging the corrected node. Requires compatible Document API and Consumer Edge; downstream items and `status` items stay read-only.
4
+
3
5
  The HITL pilot uses the explicit prerelease `0.36.0-hitl.2` and the npm `hitl`
4
6
  distribution tag. Install the exact version for reproducible pilot builds:
5
7
 
@@ -581,6 +583,15 @@ evidence or to a tool name and zero-based call index. Tool-only values have
581
583
  empty page evidence. Older Consumer versions can omit `tools`, and an extraction
582
584
  can omit `grounding` entirely.
583
585
 
586
+ With DOC-2782-compatible Document API and Consumer Edge, a Receivability
587
+ `false` → `true` correction accepts an optional per-correction `reason`.
588
+ To record a final human decision on a `Finish` review, send `decision: "continue"`,
589
+ `outcome: "accepted"` or `"refused"`, a nonblank `reason`, and no value corrections.
590
+ This closes the existing review without recalculating the conclusion; a refused
591
+ business outcome does not technically reject the execution. The approved task's
592
+ optional `outcome` and protected history/final review block retain the decision.
593
+ Deploy Document API, then Consumer compatibility before using this additive field.
594
+
584
595
  `reviews.decide()` accepts optional `pageReassignments`, for example
585
596
  `[{ docKey: "receipt", page: 2, documentType: "payment_proof", group: "payment" }]`.
586
597
  Pages are one-based and each moved page has one target type. The optional group
@@ -694,6 +705,38 @@ const page = await docmana.reviews.document(
694
705
  // page is a streaming Fetch Response. Consume or cancel its body; do not buffer a large PDF.
695
706
  ```
696
707
 
708
+ ### Document translation (DOC-2781)
709
+
710
+ When the flow offers document translation, a reviewer can ask for a document in
711
+ one of the flow's languages:
712
+
713
+ ```ts
714
+ const translation = await docmana.reviews.requestDocumentTranslation(
715
+ task.executionResultId,
716
+ "doc01",
717
+ "fr",
718
+ scope,
719
+ );
720
+ // translation.status: 202 while prepared, 200 once settled (see translationState).
721
+ const translatedPage = await docmana.reviews.document(
722
+ task.executionResultId,
723
+ "doc01",
724
+ { page: 1 },
725
+ { ...scope, version: task.reviewId, language: "fr" },
726
+ );
727
+ ```
728
+
729
+ The request is idempotent: repeating it, or sending it while the automatic
730
+ translation runs, creates no second job. It is billed once per dossier, source
731
+ file and language. The `language` read option never starts a translation: the
732
+ original is served (`fallback: true`) until the variant is ready, and the
733
+ preview manifest then carries `requestedLanguage`, `servedLanguage`, `variant`,
734
+ `fallback` and `translationState`. A document already written in the requested
735
+ language is served as `ready` without fallback. Refusals are `DocmanaError`s
736
+ with an `apiCode`: `REVIEW_INVALID_LANGUAGE`, `TRANSLATION_LANGUAGE_UNSUPPORTED`
737
+ or `TRANSLATION_FILE_UNSUPPORTED` (400; only PDF documents are translated) and
738
+ `TRANSLATION_LANGUAGE_NOT_ALLOWED` (422; the flow does not offer the language).
739
+
697
740
  `list` accepts `pending`, `submitted`, `resuming` and an opaque `cursor`. It lists
698
741
  open tasks only. The `"*"` dossier entry is not a file. Use the returned item IDs
699
742
  unchanged; JSON values preserve `null`, `false`, `0`, objects and arrays.
@@ -793,3 +836,15 @@ stable review-scoped `id`, `code`, `message`, resolved `itemIds`, and optional
793
836
  explanation text. Missing or empty findings preserve the existing presentation.
794
837
  These are frozen evidence, not per-field decisions; editing a value does not
795
838
  erase its finding. Continue using the same global, versioned decision call.
839
+
840
+ ### Resume progress callbacks
841
+
842
+ `verifyExecutionEventCallback` also validates `execution.progress`: opaque `revision`,
843
+ monotonic `stateVersion`, phase, node/item counters and the closed `PROGRESS_MESSAGE_KEYS`.
844
+ Order by `stateVersion` across attempts; deduplicate equal/lower snapshots. Callback
845
+ payloads contain identifiers and codes only. Resolve display labels with one
846
+ `client.reviews.progress(executionId, { organization, signal })` read when opening
847
+ or reconnecting; this never polls or consumes the result. Progress describes a
848
+ resume after a correction, not initial execution or human confirmation. Missing
849
+ or partial snapshots are possible. The current pending task and terminal execution
850
+ status override an older running progress snapshot.