@docmana/sdk 0.48.0 → 0.49.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,9 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.49.0 - 2026-11-26
4
+
5
+ - Add `Docmana.feedback` to open, continue and confirm an execution feedback conversation on behalf of a signed-in operator. Requires the matching Consumer Edge routes and a service identity with the `feedback.delegate` role.
6
+
3
7
  ## 0.48.0 - 2026-11-23
4
8
 
5
9
  - 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.
package/README.md CHANGED
@@ -605,6 +605,10 @@ locations are keyed by review item ID and use one-based pages of the **reviewed
605
605
  document**, matching the preview images. Items without page evidence are omitted.
606
606
  Use `ifNoneMatch` with the response `ETag` and handle `304` before reading JSON.
607
607
 
608
+ ## Execution feedback
609
+
610
+ `docmana.feedback` supports opening and resuming a conversation with the signed transcript, sending a message, selecting a suggested topic, and confirming the selected feedback. Every operation takes an `organization`, an `executionId`, and the `actorEmail` from the signed-in operator's session. Use the organization's service token with the `feedback.delegate` application role. Retain the latest `signed_transcript` to reopen expired conversations.
611
+
608
612
  ## Human review of formula executions
609
613
 
610
614
  `reviews.listExecutions` lists active and terminal HITL executions in one organization, including runs submitted outside Arcana. It returns `{ items, limit, offset, total }` and leaves final results available for retrieval. Use `flowId` or `executionId` to narrow the list. The default is 50 rows (maximum 100), offset zero, newest first.
package/dist/cli.mjs CHANGED
@@ -713,6 +713,59 @@ function parseDocumentTranslation(body, status, response) {
713
713
  };
714
714
  }
715
715
 
716
+ // src/sdk/feedback.ts
717
+ function feedbackSegment(id) {
718
+ if (typeof id !== "string" || !/^[A-Za-z0-9_-]{1,200}$/.test(id))
719
+ throw new TypeError("Invalid feedback identifier");
720
+ return id;
721
+ }
722
+ var ExecutionFeedback = class {
723
+ constructor(http) {
724
+ this.http = http;
725
+ }
726
+ http;
727
+ async open(input, options) {
728
+ return this.request("POST", "", input, options);
729
+ }
730
+ async sendMessage(id, content, options) {
731
+ return this.request("POST", `/${feedbackSegment(id)}/messages`, { content }, options);
732
+ }
733
+ async selectTopic(id, topicId, selected, options) {
734
+ return this.request(
735
+ "PATCH",
736
+ `/${feedbackSegment(id)}/topics/${feedbackSegment(topicId)}`,
737
+ { selected },
738
+ options
739
+ );
740
+ }
741
+ async confirm(id, options, topicIds) {
742
+ return this.request(
743
+ "POST",
744
+ `/${feedbackSegment(id)}/confirm`,
745
+ topicIds === void 0 ? {} : { topic_ids: topicIds },
746
+ options
747
+ );
748
+ }
749
+ request(method, suffix, body, { organization, executionId, actorEmail, signal }) {
750
+ if (typeof organization !== "string" || !organization.trim())
751
+ throw new TypeError("Organization is required for execution feedback");
752
+ if (typeof executionId !== "string" || !executionId.trim())
753
+ throw new TypeError("Execution ID is required for execution feedback");
754
+ if (typeof actorEmail !== "string" || !actorEmail.trim())
755
+ throw new TypeError("Operator email is required for execution feedback");
756
+ return this.http.requestJson(method, `/feedback/conversations${suffix}`, {
757
+ query: { organization: organization.trim() },
758
+ body: JSON.stringify({
759
+ ...body,
760
+ execution_id: executionId.trim(),
761
+ actor_email: actorEmail.trim()
762
+ }),
763
+ headers: { "content-type": "application/json" },
764
+ signal
765
+ });
766
+ }
767
+ };
768
+
716
769
  // src/sdk/execution-events.ts
717
770
  import { createHmac as createHmac2, timingSafeEqual as timingSafeEqual2 } from "crypto";
718
771
  var EXECUTION_NODE_EVENT_TYPES = [
@@ -1389,6 +1442,7 @@ function fullJitterDelay(intervalMs, maxIntervalMs, attempt, random) {
1389
1442
  var Docmana = class {
1390
1443
  authoring;
1391
1444
  reviews;
1445
+ feedback;
1392
1446
  executionEvents;
1393
1447
  /** Whether this SDK serializes callbackUrl for asynchronous fraud submissions. */
1394
1448
  supportsFraudCallbacks = true;
@@ -1405,6 +1459,7 @@ var Docmana = class {
1405
1459
  });
1406
1460
  this.authoring = new FormulaAuthoring(this.http);
1407
1461
  this.reviews = new Reviews(this.http);
1462
+ this.feedback = new ExecutionFeedback(this.http);
1408
1463
  this.executionEvents = new ExecutionEvents(this.http);
1409
1464
  }
1410
1465
  async runFlowAsync(flowId, params, options = {}) {