@veridid/workflow 0.0.0-stage → 1.0.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.
Files changed (194) hide show
  1. package/LICENSE +202 -0
  2. package/README.md +43 -2
  3. package/build/WorkflowEvents.d.mts +40 -0
  4. package/build/WorkflowEvents.d.mts.map +1 -0
  5. package/build/WorkflowEvents.mjs +11 -0
  6. package/build/WorkflowEvents.mjs.map +1 -0
  7. package/build/WorkflowModule.d.mts +24 -0
  8. package/build/WorkflowModule.d.mts.map +1 -0
  9. package/build/WorkflowModule.mjs +479 -0
  10. package/build/WorkflowModule.mjs.map +1 -0
  11. package/build/WorkflowModuleConfig.d.mts +53 -0
  12. package/build/WorkflowModuleConfig.d.mts.map +1 -0
  13. package/build/WorkflowModuleConfig.mjs +21 -0
  14. package/build/WorkflowModuleConfig.mjs.map +1 -0
  15. package/build/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorate.mjs +14 -0
  16. package/build/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateMetadata.mjs +11 -0
  17. package/build/_virtual/_@oxc-project_runtime@0.112.0/helpers/decorateParam.mjs +9 -0
  18. package/build/_virtual/_rolldown/runtime.mjs +41 -0
  19. package/build/actions/ActionRegistry.d.mts +65 -0
  20. package/build/actions/ActionRegistry.d.mts.map +1 -0
  21. package/build/actions/ActionRegistry.mjs +360 -0
  22. package/build/actions/ActionRegistry.mjs.map +1 -0
  23. package/build/api/WorkflowApi.d.mts +99 -0
  24. package/build/api/WorkflowApi.d.mts.map +1 -0
  25. package/build/api/WorkflowApi.mjs +228 -0
  26. package/build/api/WorkflowApi.mjs.map +1 -0
  27. package/build/engine/AttributePlanner.d.mts +12 -0
  28. package/build/engine/AttributePlanner.d.mts.map +1 -0
  29. package/build/engine/AttributePlanner.mjs +58 -0
  30. package/build/engine/AttributePlanner.mjs.map +1 -0
  31. package/build/engine/GuardEvaluator.d.mts +16 -0
  32. package/build/engine/GuardEvaluator.d.mts.map +1 -0
  33. package/build/engine/GuardEvaluator.mjs +38 -0
  34. package/build/engine/GuardEvaluator.mjs.map +1 -0
  35. package/build/index.d.mts +46 -0
  36. package/build/index.mjs +53 -0
  37. package/build/index.mjs.map +1 -0
  38. package/build/model/TemplateValidation.d.mts +8 -0
  39. package/build/model/TemplateValidation.d.mts.map +1 -0
  40. package/build/model/TemplateValidation.mjs +278 -0
  41. package/build/model/TemplateValidation.mjs.map +1 -0
  42. package/build/model/types.d.mts +120 -0
  43. package/build/model/types.d.mts.map +1 -0
  44. package/build/model/types.mjs +11 -0
  45. package/build/model/types.mjs.map +1 -0
  46. package/build/protocol/WorkflowMessageTypes.d.mts +19 -0
  47. package/build/protocol/WorkflowMessageTypes.d.mts.map +1 -0
  48. package/build/protocol/WorkflowMessageTypes.mjs +20 -0
  49. package/build/protocol/WorkflowMessageTypes.mjs.map +1 -0
  50. package/build/protocol/handlers/AdvanceHandler.d.mts +16 -0
  51. package/build/protocol/handlers/AdvanceHandler.d.mts.map +1 -0
  52. package/build/protocol/handlers/AdvanceHandler.mjs +181 -0
  53. package/build/protocol/handlers/AdvanceHandler.mjs.map +1 -0
  54. package/build/protocol/handlers/CancelHandler.d.mts +16 -0
  55. package/build/protocol/handlers/CancelHandler.d.mts.map +1 -0
  56. package/build/protocol/handlers/CancelHandler.mjs +103 -0
  57. package/build/protocol/handlers/CancelHandler.mjs.map +1 -0
  58. package/build/protocol/handlers/CompleteHandler.d.mts +16 -0
  59. package/build/protocol/handlers/CompleteHandler.d.mts.map +1 -0
  60. package/build/protocol/handlers/CompleteHandler.mjs +103 -0
  61. package/build/protocol/handlers/CompleteHandler.mjs.map +1 -0
  62. package/build/protocol/handlers/DiscoverHandler.d.mts +15 -0
  63. package/build/protocol/handlers/DiscoverHandler.d.mts.map +1 -0
  64. package/build/protocol/handlers/DiscoverHandler.mjs +73 -0
  65. package/build/protocol/handlers/DiscoverHandler.mjs.map +1 -0
  66. package/build/protocol/handlers/FetchTemplateHandler.d.mts +16 -0
  67. package/build/protocol/handlers/FetchTemplateHandler.d.mts.map +1 -0
  68. package/build/protocol/handlers/FetchTemplateHandler.mjs +64 -0
  69. package/build/protocol/handlers/FetchTemplateHandler.mjs.map +1 -0
  70. package/build/protocol/handlers/PauseHandler.d.mts +16 -0
  71. package/build/protocol/handlers/PauseHandler.d.mts.map +1 -0
  72. package/build/protocol/handlers/PauseHandler.mjs +103 -0
  73. package/build/protocol/handlers/PauseHandler.mjs.map +1 -0
  74. package/build/protocol/handlers/ProblemReportHandler.d.mts +11 -0
  75. package/build/protocol/handlers/ProblemReportHandler.d.mts.map +1 -0
  76. package/build/protocol/handlers/ProblemReportHandler.mjs +26 -0
  77. package/build/protocol/handlers/ProblemReportHandler.mjs.map +1 -0
  78. package/build/protocol/handlers/PublishTemplateHandler.d.mts +15 -0
  79. package/build/protocol/handlers/PublishTemplateHandler.d.mts.map +1 -0
  80. package/build/protocol/handlers/PublishTemplateHandler.mjs +47 -0
  81. package/build/protocol/handlers/PublishTemplateHandler.mjs.map +1 -0
  82. package/build/protocol/handlers/ResumeHandler.d.mts +16 -0
  83. package/build/protocol/handlers/ResumeHandler.d.mts.map +1 -0
  84. package/build/protocol/handlers/ResumeHandler.mjs +103 -0
  85. package/build/protocol/handlers/ResumeHandler.mjs.map +1 -0
  86. package/build/protocol/handlers/StartHandler.d.mts +16 -0
  87. package/build/protocol/handlers/StartHandler.d.mts.map +1 -0
  88. package/build/protocol/handlers/StartHandler.mjs +241 -0
  89. package/build/protocol/handlers/StartHandler.mjs.map +1 -0
  90. package/build/protocol/handlers/StatusHandler.d.mts +16 -0
  91. package/build/protocol/handlers/StatusHandler.d.mts.map +1 -0
  92. package/build/protocol/handlers/StatusHandler.mjs +174 -0
  93. package/build/protocol/handlers/StatusHandler.mjs.map +1 -0
  94. package/build/protocol/handlers/TemplateHandler.d.mts +14 -0
  95. package/build/protocol/handlers/TemplateHandler.d.mts.map +1 -0
  96. package/build/protocol/handlers/TemplateHandler.mjs +66 -0
  97. package/build/protocol/handlers/TemplateHandler.mjs.map +1 -0
  98. package/build/protocol/messages/AdvanceMessage.d.mts +24 -0
  99. package/build/protocol/messages/AdvanceMessage.d.mts.map +1 -0
  100. package/build/protocol/messages/AdvanceMessage.mjs +25 -0
  101. package/build/protocol/messages/AdvanceMessage.mjs.map +1 -0
  102. package/build/protocol/messages/CancelMessage.d.mts +20 -0
  103. package/build/protocol/messages/CancelMessage.d.mts.map +1 -0
  104. package/build/protocol/messages/CancelMessage.mjs +25 -0
  105. package/build/protocol/messages/CancelMessage.mjs.map +1 -0
  106. package/build/protocol/messages/CompleteMessage.d.mts +20 -0
  107. package/build/protocol/messages/CompleteMessage.d.mts.map +1 -0
  108. package/build/protocol/messages/CompleteMessage.mjs +25 -0
  109. package/build/protocol/messages/CompleteMessage.mjs.map +1 -0
  110. package/build/protocol/messages/DiscoverMessage.d.mts +29 -0
  111. package/build/protocol/messages/DiscoverMessage.d.mts.map +1 -0
  112. package/build/protocol/messages/DiscoverMessage.mjs +25 -0
  113. package/build/protocol/messages/DiscoverMessage.mjs.map +1 -0
  114. package/build/protocol/messages/FetchTemplateMessage.d.mts +21 -0
  115. package/build/protocol/messages/FetchTemplateMessage.d.mts.map +1 -0
  116. package/build/protocol/messages/FetchTemplateMessage.mjs +31 -0
  117. package/build/protocol/messages/FetchTemplateMessage.mjs.map +1 -0
  118. package/build/protocol/messages/PauseMessage.d.mts +20 -0
  119. package/build/protocol/messages/PauseMessage.d.mts.map +1 -0
  120. package/build/protocol/messages/PauseMessage.mjs +25 -0
  121. package/build/protocol/messages/PauseMessage.mjs.map +1 -0
  122. package/build/protocol/messages/ProblemReportMessage.d.mts +21 -0
  123. package/build/protocol/messages/ProblemReportMessage.d.mts.map +1 -0
  124. package/build/protocol/messages/ProblemReportMessage.mjs +25 -0
  125. package/build/protocol/messages/ProblemReportMessage.mjs.map +1 -0
  126. package/build/protocol/messages/PublishTemplateMessage.d.mts +23 -0
  127. package/build/protocol/messages/PublishTemplateMessage.d.mts.map +1 -0
  128. package/build/protocol/messages/PublishTemplateMessage.mjs +24 -0
  129. package/build/protocol/messages/PublishTemplateMessage.mjs.map +1 -0
  130. package/build/protocol/messages/ResumeMessage.d.mts +20 -0
  131. package/build/protocol/messages/ResumeMessage.d.mts.map +1 -0
  132. package/build/protocol/messages/ResumeMessage.mjs +25 -0
  133. package/build/protocol/messages/ResumeMessage.mjs.map +1 -0
  134. package/build/protocol/messages/StartMessage.d.mts +28 -0
  135. package/build/protocol/messages/StartMessage.d.mts.map +1 -0
  136. package/build/protocol/messages/StartMessage.mjs +25 -0
  137. package/build/protocol/messages/StartMessage.mjs.map +1 -0
  138. package/build/protocol/messages/StatusMessage.d.mts +35 -0
  139. package/build/protocol/messages/StatusMessage.d.mts.map +1 -0
  140. package/build/protocol/messages/StatusMessage.mjs +25 -0
  141. package/build/protocol/messages/StatusMessage.mjs.map +1 -0
  142. package/build/protocol/messages/StatusRequestMessage.d.mts +29 -0
  143. package/build/protocol/messages/StatusRequestMessage.d.mts.map +1 -0
  144. package/build/protocol/messages/StatusRequestMessage.mjs +25 -0
  145. package/build/protocol/messages/StatusRequestMessage.mjs.map +1 -0
  146. package/build/protocol/messages/TemplateMessage.d.mts +20 -0
  147. package/build/protocol/messages/TemplateMessage.d.mts.map +1 -0
  148. package/build/protocol/messages/TemplateMessage.mjs +25 -0
  149. package/build/protocol/messages/TemplateMessage.mjs.map +1 -0
  150. package/build/protocol/messages/WorkflowsMessage.d.mts +28 -0
  151. package/build/protocol/messages/WorkflowsMessage.d.mts.map +1 -0
  152. package/build/protocol/messages/WorkflowsMessage.mjs +25 -0
  153. package/build/protocol/messages/WorkflowsMessage.mjs.map +1 -0
  154. package/build/queue/CommandQueue.d.mts +22 -0
  155. package/build/queue/CommandQueue.d.mts.map +1 -0
  156. package/build/queue/CommandQueue.mjs +6 -0
  157. package/build/queue/CommandQueue.mjs.map +1 -0
  158. package/build/queue/PersistentCommandQueue.d.mts +56 -0
  159. package/build/queue/PersistentCommandQueue.d.mts.map +1 -0
  160. package/build/queue/PersistentCommandQueue.mjs +281 -0
  161. package/build/queue/PersistentCommandQueue.mjs.map +1 -0
  162. package/build/repository/WorkflowCommandRecord.d.mts +50 -0
  163. package/build/repository/WorkflowCommandRecord.d.mts.map +1 -0
  164. package/build/repository/WorkflowCommandRecord.mjs +48 -0
  165. package/build/repository/WorkflowCommandRecord.mjs.map +1 -0
  166. package/build/repository/WorkflowCommandRepository.d.mts +59 -0
  167. package/build/repository/WorkflowCommandRepository.d.mts.map +1 -0
  168. package/build/repository/WorkflowCommandRepository.mjs +136 -0
  169. package/build/repository/WorkflowCommandRepository.mjs.map +1 -0
  170. package/build/repository/WorkflowInstanceRecord.d.mts +65 -0
  171. package/build/repository/WorkflowInstanceRecord.d.mts.map +1 -0
  172. package/build/repository/WorkflowInstanceRecord.mjs +44 -0
  173. package/build/repository/WorkflowInstanceRecord.mjs.map +1 -0
  174. package/build/repository/WorkflowInstanceRepository.d.mts +15 -0
  175. package/build/repository/WorkflowInstanceRepository.d.mts.map +1 -0
  176. package/build/repository/WorkflowInstanceRepository.mjs +48 -0
  177. package/build/repository/WorkflowInstanceRepository.mjs.map +1 -0
  178. package/build/repository/WorkflowTemplateRecord.d.mts +27 -0
  179. package/build/repository/WorkflowTemplateRecord.d.mts.map +1 -0
  180. package/build/repository/WorkflowTemplateRecord.mjs +29 -0
  181. package/build/repository/WorkflowTemplateRecord.mjs.map +1 -0
  182. package/build/repository/WorkflowTemplateRepository.d.mts +11 -0
  183. package/build/repository/WorkflowTemplateRepository.d.mts.map +1 -0
  184. package/build/repository/WorkflowTemplateRepository.mjs +43 -0
  185. package/build/repository/WorkflowTemplateRepository.mjs.map +1 -0
  186. package/build/services/WorkflowService.d.mts +109 -0
  187. package/build/services/WorkflowService.d.mts.map +1 -0
  188. package/build/services/WorkflowService.mjs +640 -0
  189. package/build/services/WorkflowService.mjs.map +1 -0
  190. package/build/ui/UiFilter.mjs +144 -0
  191. package/build/ui/UiFilter.mjs.map +1 -0
  192. package/build/utils/peerMerge.mjs +49 -0
  193. package/build/utils/peerMerge.mjs.map +1 -0
  194. package/package.json +50 -3
@@ -0,0 +1 @@
1
+ {"version":3,"file":"WorkflowModuleConfig.mjs","names":[],"sources":["../src/WorkflowModuleConfig.ts"],"sourcesContent":["export type GuardEngine = 'jmespath' | 'cel' | 'js'\n\nexport interface WorkflowModuleConfigOptions {\n guardEngine?: GuardEngine\n autoReturnExistingOnSingleton?: boolean\n actionTimeoutMs?: number\n enableProblemReport?: boolean\n enablePaymentsEventMapping?: boolean\n enablePoeEventMapping?: boolean\n /**\n * Integrate with `@veridid/payments` when it is installed: register its workflow\n * actions and (with `enablePaymentsEventMapping`) map its events to workflow events.\n * Set to `false` to turn the integration off, e.g. on React Native. Default `true`.\n */\n enablePaymentsIntegration?: boolean\n /**\n * Integrate with `@veridid/poe` when it is installed: register its workflow actions\n * and (with `enablePoeEventMapping`) map its events to workflow events.\n * Set to `false` to turn the integration off, e.g. on React Native. Default `true`.\n */\n enablePoeIntegration?: boolean\n enableAutoDiscoverOnStart?: boolean\n discoveryTimeoutMs?: number\n idempotencyHistoryLimit?: number\n // Disable async queue for mobile/React Native environments\n asyncQueue?: {\n pollIntervalMs?: number\n concurrency?: number\n processingTimeoutMs?: number\n staleCheckIntervalMs?: number\n cleanupIntervalMs?: number\n commandRetentionMs?: number\n failedRetentionMs?: number\n maxAttempts?: number\n }\n}\n\nexport class WorkflowModuleConfig {\n public readonly guardEngine: GuardEngine\n public readonly autoReturnExistingOnSingleton: boolean\n public readonly actionTimeoutMs: number\n public readonly enableProblemReport: boolean\n public readonly enablePaymentsEventMapping: boolean\n public readonly enablePoeEventMapping: boolean\n public readonly enablePaymentsIntegration: boolean\n public readonly enablePoeIntegration: boolean\n public readonly enableAutoDiscoverOnStart: boolean\n public readonly discoveryTimeoutMs: number\n public readonly idempotencyHistoryLimit: number\n public readonly asyncQueue?: NonNullable<WorkflowModuleConfigOptions['asyncQueue']>\n\n public constructor(options?: WorkflowModuleConfigOptions) {\n this.guardEngine = options?.guardEngine ?? 'jmespath'\n this.autoReturnExistingOnSingleton = options?.autoReturnExistingOnSingleton ?? true\n this.actionTimeoutMs = options?.actionTimeoutMs ?? 15000\n this.enableProblemReport = options?.enableProblemReport ?? true\n this.enablePaymentsEventMapping = options?.enablePaymentsEventMapping ?? true\n this.enablePoeEventMapping = options?.enablePoeEventMapping ?? true\n this.enablePaymentsIntegration = options?.enablePaymentsIntegration ?? true\n this.enablePoeIntegration = options?.enablePoeIntegration ?? true\n this.enableAutoDiscoverOnStart = options?.enableAutoDiscoverOnStart ?? true\n this.discoveryTimeoutMs = options?.discoveryTimeoutMs ?? 5000\n this.idempotencyHistoryLimit = options?.idempotencyHistoryLimit ?? 100\n this.asyncQueue = options?.asyncQueue\n }\n}\n"],"mappings":";AAqCA,IAAa,uBAAb,MAAkC;CAchC,AAAO,YAAY,SAAuC;AACxD,OAAK,cAAc,SAAS,eAAe;AAC3C,OAAK,gCAAgC,SAAS,iCAAiC;AAC/E,OAAK,kBAAkB,SAAS,mBAAmB;AACnD,OAAK,sBAAsB,SAAS,uBAAuB;AAC3D,OAAK,6BAA6B,SAAS,8BAA8B;AACzE,OAAK,wBAAwB,SAAS,yBAAyB;AAC/D,OAAK,4BAA4B,SAAS,6BAA6B;AACvE,OAAK,uBAAuB,SAAS,wBAAwB;AAC7D,OAAK,4BAA4B,SAAS,6BAA6B;AACvE,OAAK,qBAAqB,SAAS,sBAAsB;AACzD,OAAK,0BAA0B,SAAS,2BAA2B;AACnE,OAAK,aAAa,SAAS"}
@@ -0,0 +1,14 @@
1
+ import { __esmMin } from "../../_rolldown/runtime.mjs";
2
+
3
+ //#region \0@oxc-project+runtime@0.112.0/helpers/decorate.js
4
+ function __decorate(decorators, target, key, desc) {
5
+ var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
6
+ if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
7
+ else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
8
+ return c > 3 && r && Object.defineProperty(target, key, r), r;
9
+ }
10
+ var init_decorate = __esmMin(() => {});
11
+
12
+ //#endregion
13
+ init_decorate();
14
+ export { __decorate, init_decorate };
@@ -0,0 +1,11 @@
1
+ import { __esmMin } from "../../_rolldown/runtime.mjs";
2
+
3
+ //#region \0@oxc-project+runtime@0.112.0/helpers/decorateMetadata.js
4
+ function __decorateMetadata(k, v) {
5
+ if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
6
+ }
7
+ var init_decorateMetadata = __esmMin(() => {});
8
+
9
+ //#endregion
10
+ init_decorateMetadata();
11
+ export { __decorateMetadata, init_decorateMetadata };
@@ -0,0 +1,9 @@
1
+ //#region \0@oxc-project+runtime@0.112.0/helpers/decorateParam.js
2
+ function __decorateParam(paramIndex, decorator) {
3
+ return function(target, key) {
4
+ decorator(target, key, paramIndex);
5
+ };
6
+ }
7
+
8
+ //#endregion
9
+ export { __decorateParam };
@@ -0,0 +1,41 @@
1
+ //#region \0rolldown/runtime.js
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __esmMin = (fn, res) => () => (fn && (res = fn(fn = 0)), res);
7
+ var __exportAll = (all, no_symbols) => {
8
+ let target = {};
9
+ for (var name in all) {
10
+ __defProp(target, name, {
11
+ get: all[name],
12
+ enumerable: true
13
+ });
14
+ }
15
+ if (!no_symbols) {
16
+ __defProp(target, Symbol.toStringTag, { value: "Module" });
17
+ }
18
+ return target;
19
+ };
20
+ var __copyProps = (to, from, except, desc) => {
21
+ if (from && typeof from === "object" || typeof from === "function") {
22
+ for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
23
+ key = keys[i];
24
+ if (!__hasOwnProp.call(to, key) && key !== except) {
25
+ __defProp(to, key, {
26
+ get: ((k) => from[k]).bind(null, key),
27
+ enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
28
+ });
29
+ }
30
+ }
31
+ }
32
+ return to;
33
+ };
34
+ var __toCommonJS = (mod) => __hasOwnProp.call(mod, "module.exports") ? mod["module.exports"] : __copyProps(__defProp({}, "__esModule", { value: true }), mod);
35
+ var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
36
+ if (typeof require !== "undefined") return require.apply(this, arguments);
37
+ throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
38
+ });
39
+
40
+ //#endregion
41
+ export { __esmMin, __exportAll, __require, __toCommonJS };
@@ -0,0 +1,65 @@
1
+ import { ActionDef, WorkflowInstanceData, WorkflowTemplate } from "../model/types.mjs";
2
+ import { AgentContext } from "@credo-ts/core";
3
+
4
+ //#region src/actions/ActionRegistry.d.ts
5
+ type ActionCtx = {
6
+ agentContext: AgentContext;
7
+ template: WorkflowTemplate;
8
+ instance: WorkflowInstanceData;
9
+ action: ActionDef;
10
+ input?: Record<string, unknown>;
11
+ idempotency_key?: string;
12
+ };
13
+ type ActionResult = {
14
+ artifacts?: Record<string, unknown>;
15
+ contextMerge?: Record<string, unknown>;
16
+ messageId?: string;
17
+ };
18
+ interface WorkflowActionHandler {
19
+ readonly typeUri: string;
20
+ execute(ctx: ActionCtx): Promise<ActionResult>;
21
+ }
22
+ declare class ActionRegistry {
23
+ private handlers;
24
+ register(handler: WorkflowActionHandler): void;
25
+ get(typeUri: string): WorkflowActionHandler | undefined;
26
+ }
27
+ declare class LocalStateSetAction implements WorkflowActionHandler {
28
+ readonly typeUri = "https://didcomm.org/workflow/actions/state:set@1";
29
+ execute(ctx: ActionCtx): Promise<ActionResult>;
30
+ }
31
+ declare class IssueCredentialV2Action implements WorkflowActionHandler {
32
+ readonly typeUri = "https://didcomm.org/issue-credential/2.0/offer-credential";
33
+ execute(ctx: ActionCtx): Promise<ActionResult>;
34
+ }
35
+ /**
36
+ * ProposeCredentialV2Action - Holder proposes a credential to the issuer
37
+ * Used when holder initiates the credential issuance flow
38
+ */
39
+ declare class ProposeCredentialV2Action implements WorkflowActionHandler {
40
+ readonly typeUri = "https://didcomm.org/issue-credential/2.0/propose-credential";
41
+ execute(ctx: ActionCtx): Promise<ActionResult>;
42
+ }
43
+ /**
44
+ * RequestCredentialV2Action - Holder accepts a credential offer
45
+ * Used when holder receives an offer and wants to request the credential
46
+ */
47
+ declare class RequestCredentialV2Action implements WorkflowActionHandler {
48
+ readonly typeUri = "https://didcomm.org/issue-credential/2.0/request-credential";
49
+ execute(ctx: ActionCtx): Promise<ActionResult>;
50
+ }
51
+ /**
52
+ * IssueCredentialMessageV2Action - Issuer issues the credential after receiving a request
53
+ * Used when issuer receives a credential request and wants to issue the credential
54
+ */
55
+ declare class IssueCredentialMessageV2Action implements WorkflowActionHandler {
56
+ readonly typeUri = "https://didcomm.org/issue-credential/2.0/issue-credential";
57
+ execute(ctx: ActionCtx): Promise<ActionResult>;
58
+ }
59
+ declare class PresentProofV2Action implements WorkflowActionHandler {
60
+ readonly typeUri = "https://didcomm.org/present-proof/2.0/request-presentation";
61
+ execute(ctx: ActionCtx): Promise<ActionResult>;
62
+ }
63
+ //#endregion
64
+ export { ActionCtx, ActionRegistry, ActionResult, IssueCredentialMessageV2Action, IssueCredentialV2Action, LocalStateSetAction, PresentProofV2Action, ProposeCredentialV2Action, RequestCredentialV2Action, WorkflowActionHandler };
65
+ //# sourceMappingURL=ActionRegistry.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionRegistry.d.mts","names":[],"sources":["../../src/actions/ActionRegistry.ts"],"mapp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erge } from "../engine/AttributePlanner.mjs";
2
+ import { DidCommConnectionService, DidCommCredentialsApi, DidCommProofsApi } from "@credo-ts/didcomm";
3
+
4
+ //#region src/actions/ActionRegistry.ts
5
+ var ActionRegistry = class {
6
+ constructor() {
7
+ this.handlers = /* @__PURE__ */ new Map();
8
+ }
9
+ register(handler) {
10
+ this.handlers.set(handler.typeUri, handler);
11
+ }
12
+ get(typeUri) {
13
+ return this.handlers.get(typeUri);
14
+ }
15
+ };
16
+ const TPL_RE = /\{\{\s*([\s\S]+?)\s*\}\}/g;
17
+ const EXACT_TPL_RE = /^\s*\{\{\s*([\s\S]+?)\s*\}\}\s*$/;
18
+ const resolvePath = (env, expr) => {
19
+ const parts = expr.trim().split(".");
20
+ let cur = env;
21
+ for (const p of parts) {
22
+ if (cur == null || typeof cur !== "object") return void 0;
23
+ cur = cur[p];
24
+ }
25
+ return cur;
26
+ };
27
+ const interpolateString = (s, env) => {
28
+ const exact = s.match(EXACT_TPL_RE);
29
+ if (exact) return resolvePath(env, exact[1].trim());
30
+ TPL_RE.lastIndex = 0;
31
+ if (!TPL_RE.test(s)) return s;
32
+ TPL_RE.lastIndex = 0;
33
+ return s.replace(TPL_RE, (_, expr) => {
34
+ const v = resolvePath(env, expr);
35
+ return v == null ? "" : String(v);
36
+ });
37
+ };
38
+ const substituteTemplates = (node, env) => {
39
+ if (typeof node === "string") return interpolateString(node, env);
40
+ if (Array.isArray(node)) return node.map((x) => substituteTemplates(x, env));
41
+ if (node && typeof node === "object") {
42
+ const out = {};
43
+ for (const [k, v] of Object.entries(node)) {
44
+ const newKey = typeof k === "string" ? (() => {
45
+ const res = interpolateString(k, env);
46
+ return typeof res === "string" ? res : String(res ?? "");
47
+ })() : k;
48
+ out[newKey] = substituteTemplates(v, env);
49
+ }
50
+ return out;
51
+ }
52
+ return node;
53
+ };
54
+ var LocalStateSetAction = class {
55
+ constructor() {
56
+ this.typeUri = "https://didcomm.org/workflow/actions/state:set@1";
57
+ }
58
+ async execute(ctx) {
59
+ const raw = ctx.action?.staticInput;
60
+ let merge = raw;
61
+ if (raw && typeof raw === "object" && !Array.isArray(raw) && "merge" in raw) merge = raw.merge;
62
+ const env = {
63
+ input: ctx.input || {},
64
+ context: ctx.instance.context || {},
65
+ participants: ctx.instance.participants || {},
66
+ artifacts: ctx.instance.artifacts || {},
67
+ idempotency_key: ctx.idempotency_key
68
+ };
69
+ if (typeof merge === "string") {
70
+ const match = merge.match(/^\{\{\s*(.+?)\s*\}\}$/);
71
+ if (match) {
72
+ const resolved = resolvePath(env, match[1]);
73
+ if (resolved !== void 0) merge = resolved;
74
+ }
75
+ }
76
+ if (merge !== void 0 && typeof merge !== "string") merge = substituteTemplates(merge, env);
77
+ if (typeof merge === "string") {
78
+ const trimmed = merge.replace(/\{\{|\}\}/g, "").trim();
79
+ if (trimmed.includes(".")) {
80
+ const resolved = resolvePath(env, trimmed);
81
+ if (resolved && typeof resolved === "object") merge = resolved;
82
+ }
83
+ }
84
+ let mergeObj;
85
+ if (merge && typeof merge === "object" && !Array.isArray(merge)) mergeObj = merge;
86
+ if (ctx.input && typeof ctx.input === "object" && !Array.isArray(ctx.input)) mergeObj = deepMerge({ ...mergeObj || {} }, ctx.input);
87
+ if (mergeObj && Object.keys(mergeObj).length > 0) return { contextMerge: deepMerge({ ...ctx.instance.context || {} }, mergeObj) };
88
+ return {};
89
+ }
90
+ };
91
+ var IssueCredentialV2Action = class {
92
+ constructor() {
93
+ this.typeUri = "https://didcomm.org/issue-credential/2.0/offer-credential";
94
+ }
95
+ async execute(ctx) {
96
+ const ref = ctx.action.profile_ref;
97
+ if (!ref?.startsWith("cp.")) throw Object.assign(/* @__PURE__ */ new Error("invalid profile_ref"), { code: "action_error" });
98
+ const key = ref.slice(3);
99
+ const profile = ctx.template.catalog?.credential_profiles?.[key];
100
+ if (!profile) throw Object.assign(/* @__PURE__ */ new Error("missing catalog profile"), { code: "action_error" });
101
+ const attrs = AttributePlanner.materialize(profile.attribute_plan || {}, ctx.instance);
102
+ const attributes = Object.entries(attrs).map(([name, value]) => ({
103
+ name,
104
+ value: String(value)
105
+ }));
106
+ const connectionId = ctx.instance.connection_id;
107
+ if (!connectionId) throw Object.assign(/* @__PURE__ */ new Error("connectionId required"), { code: "action_error" });
108
+ {
109
+ const toRef = profile.to_ref;
110
+ const expectedDid = toRef ? ctx.instance.participants?.[toRef]?.did : void 0;
111
+ if (expectedDid && ctx.instance.connection_id) {
112
+ const theirDid = (await ctx.agentContext.dependencyManager.resolve(DidCommConnectionService).getById(ctx.agentContext, ctx.instance.connection_id))?.theirDid;
113
+ if (theirDid && theirDid !== expectedDid) throw Object.assign(/* @__PURE__ */ new Error("to_ref DID mismatch"), { code: "forbidden" });
114
+ }
115
+ }
116
+ try {
117
+ const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi);
118
+ const record = await credsApi.offerCredential({
119
+ connectionId,
120
+ protocolVersion: "v2",
121
+ credentialFormats: { anoncreds: {
122
+ credentialDefinitionId: profile.cred_def_id,
123
+ attributes
124
+ } },
125
+ comment: profile.options?.comment
126
+ });
127
+ let messageId = record?.id || record?.credentialRecord?.id;
128
+ try {
129
+ if (messageId) {
130
+ const found = await credsApi.findOfferMessage(messageId);
131
+ if (found && typeof found === "object") {
132
+ const f = found;
133
+ messageId = f.message?.id || f.id || messageId;
134
+ }
135
+ }
136
+ } catch (_e) {}
137
+ return {
138
+ artifacts: { issueRecordId: record?.id || record?.credentialRecord?.id },
139
+ messageId
140
+ };
141
+ } catch (e) {
142
+ throw Object.assign(/* @__PURE__ */ new Error(`issue action error: ${e.message}`), { code: "action_error" });
143
+ }
144
+ }
145
+ };
146
+ /**
147
+ * ProposeCredentialV2Action - Holder proposes a credential to the issuer
148
+ * Used when holder initiates the credential issuance flow
149
+ */
150
+ var ProposeCredentialV2Action = class {
151
+ constructor() {
152
+ this.typeUri = "https://didcomm.org/issue-credential/2.0/propose-credential";
153
+ }
154
+ async execute(ctx) {
155
+ const ref = ctx.action.profile_ref;
156
+ if (!ref?.startsWith("cp.")) throw Object.assign(/* @__PURE__ */ new Error("invalid profile_ref"), { code: "action_error" });
157
+ const key = ref.slice(3);
158
+ const profile = ctx.template.catalog?.credential_profiles?.[key];
159
+ if (!profile) throw Object.assign(/* @__PURE__ */ new Error("missing catalog profile"), { code: "action_error" });
160
+ const attrs = AttributePlanner.materialize(profile.attribute_plan || {}, ctx.instance);
161
+ const attributes = Object.entries(attrs).map(([name, value]) => ({
162
+ name,
163
+ value: String(value)
164
+ }));
165
+ const connectionId = ctx.instance.connection_id;
166
+ if (!connectionId) throw Object.assign(/* @__PURE__ */ new Error("connectionId required"), { code: "action_error" });
167
+ try {
168
+ const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi);
169
+ const record = await credsApi.proposeCredential({
170
+ connectionId,
171
+ protocolVersion: "v2",
172
+ credentialFormats: { anoncreds: {
173
+ credentialDefinitionId: profile.cred_def_id,
174
+ attributes
175
+ } },
176
+ comment: profile.options?.comment
177
+ });
178
+ let messageId = record?.id || record?.credentialRecord?.id;
179
+ try {
180
+ if (messageId) {
181
+ const found = await credsApi.findProposalMessage(messageId);
182
+ if (found && typeof found === "object") {
183
+ const f = found;
184
+ messageId = f.message?.id || f.id || messageId;
185
+ }
186
+ }
187
+ } catch (_e) {}
188
+ return {
189
+ artifacts: { credentialRecordId: record?.id || record?.credentialRecord?.id },
190
+ messageId
191
+ };
192
+ } catch (e) {
193
+ throw Object.assign(/* @__PURE__ */ new Error(`propose action error: ${e.message}`), { code: "action_error" });
194
+ }
195
+ }
196
+ };
197
+ /**
198
+ * RequestCredentialV2Action - Holder accepts a credential offer
199
+ * Used when holder receives an offer and wants to request the credential
200
+ */
201
+ var RequestCredentialV2Action = class {
202
+ constructor() {
203
+ this.typeUri = "https://didcomm.org/issue-credential/2.0/request-credential";
204
+ }
205
+ async execute(ctx) {
206
+ const connectionId = ctx.instance.connection_id;
207
+ if (!connectionId) throw Object.assign(/* @__PURE__ */ new Error("connectionId required"), { code: "action_error" });
208
+ try {
209
+ const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi);
210
+ let credentialRecordId = ctx.instance.artifacts?.credentialRecordId;
211
+ if (!credentialRecordId) {
212
+ const matches = (await credsApi.getAll()).filter((r) => r.connectionId === connectionId && r.state === "offer-received").sort((a, b) => {
213
+ const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
214
+ return (b.updatedAt ? new Date(b.updatedAt).getTime() : 0) - dateA;
215
+ });
216
+ if (matches.length === 0) throw Object.assign(/* @__PURE__ */ new Error("no offer found to accept"), { code: "action_error" });
217
+ credentialRecordId = matches[0].id;
218
+ }
219
+ const record = await credsApi.acceptOffer({ credentialRecordId });
220
+ let messageId = record?.id;
221
+ try {
222
+ if (messageId) {
223
+ const found = await credsApi.findRequestMessage(messageId);
224
+ if (found && typeof found === "object") {
225
+ const f = found;
226
+ messageId = f.message?.id || f.id || messageId;
227
+ }
228
+ }
229
+ } catch (_e) {}
230
+ return {
231
+ artifacts: { credentialRecordId: record?.id },
232
+ messageId
233
+ };
234
+ } catch (e) {
235
+ throw Object.assign(/* @__PURE__ */ new Error(`request action error: ${e.message}`), { code: "action_error" });
236
+ }
237
+ }
238
+ };
239
+ /**
240
+ * IssueCredentialMessageV2Action - Issuer issues the credential after receiving a request
241
+ * Used when issuer receives a credential request and wants to issue the credential
242
+ */
243
+ var IssueCredentialMessageV2Action = class {
244
+ constructor() {
245
+ this.typeUri = "https://didcomm.org/issue-credential/2.0/issue-credential";
246
+ }
247
+ async execute(ctx) {
248
+ const connectionId = ctx.instance.connection_id;
249
+ if (!connectionId) throw Object.assign(/* @__PURE__ */ new Error("connectionId required"), { code: "action_error" });
250
+ try {
251
+ const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi);
252
+ let credentialRecordId = ctx.instance.artifacts?.credentialRecordId;
253
+ if (!credentialRecordId) {
254
+ const matches = (await credsApi.getAll()).filter((r) => r.connectionId === connectionId && r.state === "request-received").sort((a, b) => {
255
+ const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0;
256
+ return (b.updatedAt ? new Date(b.updatedAt).getTime() : 0) - dateA;
257
+ });
258
+ if (matches.length === 0) throw Object.assign(/* @__PURE__ */ new Error("no request found to issue"), { code: "action_error" });
259
+ credentialRecordId = matches[0].id;
260
+ }
261
+ const record = await credsApi.acceptRequest({ credentialRecordId });
262
+ let messageId = record?.id;
263
+ try {
264
+ if (messageId) {
265
+ const found = await credsApi.findCredentialMessage(messageId);
266
+ if (found && typeof found === "object") {
267
+ const f = found;
268
+ messageId = f.message?.id || f.id || messageId;
269
+ }
270
+ }
271
+ } catch (_e) {}
272
+ return {
273
+ artifacts: { issuedCredentialRecordId: record?.id },
274
+ messageId
275
+ };
276
+ } catch (e) {
277
+ throw Object.assign(/* @__PURE__ */ new Error(`issue action error: ${e.message}`), { code: "action_error" });
278
+ }
279
+ }
280
+ };
281
+ var PresentProofV2Action = class {
282
+ constructor() {
283
+ this.typeUri = "https://didcomm.org/present-proof/2.0/request-presentation";
284
+ }
285
+ async execute(ctx) {
286
+ const ref = ctx.action.profile_ref;
287
+ if (!ref?.startsWith("pp.")) throw Object.assign(/* @__PURE__ */ new Error("invalid profile_ref"), { code: "action_error" });
288
+ const key = ref.slice(3);
289
+ const profile = ctx.template.catalog?.proof_profiles?.[key];
290
+ if (!profile) throw Object.assign(/* @__PURE__ */ new Error("missing catalog profile"), { code: "action_error" });
291
+ const connectionId = ctx.instance.connection_id;
292
+ if (!connectionId) throw Object.assign(/* @__PURE__ */ new Error("connectionId required"), { code: "action_error" });
293
+ {
294
+ const toRef2 = profile.to_ref;
295
+ const expectedDid2 = toRef2 ? ctx.instance.participants?.[toRef2]?.did : void 0;
296
+ if (expectedDid2 && ctx.instance.connection_id) {
297
+ const theirDid = (await ctx.agentContext.dependencyManager.resolve(DidCommConnectionService).getById(ctx.agentContext, ctx.instance.connection_id))?.theirDid;
298
+ if (theirDid && theirDid !== expectedDid2) throw Object.assign(/* @__PURE__ */ new Error("to_ref DID mismatch"), { code: "forbidden" });
299
+ }
300
+ }
301
+ try {
302
+ const proofsApi = ctx.agentContext.dependencyManager.resolve(DidCommProofsApi);
303
+ const credDefId = profile.cred_def_id;
304
+ const schemaId = profile.schema_id;
305
+ const restriction = credDefId ? { cred_def_id: credDefId } : schemaId ? { schema_id: schemaId } : void 0;
306
+ const reqAttrs = (profile.requested_attributes || []).reduce((acc, name, idx) => {
307
+ acc[`attr${idx + 1}`] = restriction ? {
308
+ name,
309
+ restrictions: [restriction]
310
+ } : { name };
311
+ return acc;
312
+ }, {});
313
+ const reqPreds = (profile.requested_predicates || []).reduce((acc, p, idx) => {
314
+ acc[`pred${idx + 1}`] = restriction ? {
315
+ name: p.name,
316
+ p_type: p.p_type,
317
+ p_value: p.p_value,
318
+ restrictions: [restriction]
319
+ } : {
320
+ name: p.name,
321
+ p_type: p.p_type,
322
+ p_value: p.p_value
323
+ };
324
+ return acc;
325
+ }, {});
326
+ const record = await proofsApi.requestProof({
327
+ connectionId,
328
+ protocolVersion: "v2",
329
+ proofFormats: { anoncreds: {
330
+ name: "Workflow Proof Request",
331
+ version: "1.0",
332
+ requested_attributes: reqAttrs,
333
+ requested_predicates: reqPreds
334
+ } },
335
+ willConfirm: true,
336
+ comment: profile.options?.comment
337
+ });
338
+ let messageId = record?.id || record?.proofRecord?.id;
339
+ try {
340
+ if (messageId) {
341
+ const found = await proofsApi.findRequestMessage(messageId);
342
+ if (found && typeof found === "object") {
343
+ const f = found;
344
+ messageId = f.message?.id || f.id || messageId;
345
+ }
346
+ }
347
+ } catch (_e) {}
348
+ return {
349
+ artifacts: { proofRecordId: record?.id || record?.proofRecord?.id },
350
+ messageId
351
+ };
352
+ } catch (e) {
353
+ throw Object.assign(/* @__PURE__ */ new Error(`proof action error: ${e.message}`), { code: "action_error" });
354
+ }
355
+ }
356
+ };
357
+
358
+ //#endregion
359
+ export { ActionRegistry, IssueCredentialMessageV2Action, IssueCredentialV2Action, LocalStateSetAction, PresentProofV2Action, ProposeCredentialV2Action, RequestCredentialV2Action };
360
+ //# sourceMappingURL=ActionRegistry.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ActionRegistry.mjs","names":[],"sources":["../../src/actions/ActionRegistry.ts"],"sourcesContent":["import type { ActionDef, WorkflowInstanceData, WorkflowTemplate } from '../model/types'\nimport type { AgentContext } from '@credo-ts/core'\n\nimport { DidCommCredentialsApi, DidCommProofsApi } from '@credo-ts/didcomm'\n\nimport { DidCommConnectionService } from '@credo-ts/didcomm'\n\nimport { AttributePlanner, deepMerge } from '../engine/AttributePlanner'\n\nexport type ActionCtx = {\n agentContext: AgentContext\n template: WorkflowTemplate\n instance: WorkflowInstanceData\n action: ActionDef\n input?: Record<string, unknown>\n idempotency_key?: string\n}\n\nexport type ActionResult = {\n artifacts?: Record<string, unknown>\n contextMerge?: Record<string, unknown>\n messageId?: string\n}\n\nexport interface WorkflowActionHandler {\n readonly typeUri: string\n execute(ctx: ActionCtx): Promise<ActionResult>\n}\n\nexport class ActionRegistry {\n private handlers = new Map<string, WorkflowActionHandler>()\n public register(handler: WorkflowActionHandler) {\n this.handlers.set(handler.typeUri, handler)\n }\n public get(typeUri: string): WorkflowActionHandler | undefined {\n return this.handlers.get(typeUri)\n }\n}\n\n// Template interpolation helpers (ported from Credo 5)\nconst TPL_RE = /\\{\\{\\s*([\\s\\S]+?)\\s*\\}\\}/g\nconst EXACT_TPL_RE = /^\\s*\\{\\{\\s*([\\s\\S]+?)\\s*\\}\\}\\s*$/\n\nconst resolvePath = (env: Record<string, unknown>, expr: string): unknown => {\n const parts = expr.trim().split('.')\n let cur: unknown = env\n for (const p of parts) {\n if (cur == null || typeof cur !== 'object') return undefined\n cur = (cur as Record<string, unknown>)[p]\n }\n return cur\n}\n\n// When a string is exactly one {{ expr }} (no surrounding text), preserve the\n// resolved value's type so arrays/objects/numbers survive substitution. Critical\n// for `staticInput: { menu: '{{ input.menu }}' }` patterns where the input value\n// is an array — without this, str-coercion produces \"[object Object],...\" and\n// downstream bind/row_template expansion silently fails.\nconst interpolateString = (s: string, env: Record<string, unknown>): unknown => {\n const exact = s.match(EXACT_TPL_RE)\n if (exact) {\n return resolvePath(env, exact[1].trim())\n }\n TPL_RE.lastIndex = 0\n if (!TPL_RE.test(s)) return s\n TPL_RE.lastIndex = 0\n return s.replace(TPL_RE, (_, expr: string) => {\n const v = resolvePath(env, expr)\n return v == null ? '' : String(v)\n })\n}\n\nconst substituteTemplates = (node: unknown, env: Record<string, unknown>): unknown => {\n if (typeof node === 'string') return interpolateString(node, env)\n if (Array.isArray(node)) return node.map((x) => substituteTemplates(x, env))\n if (node && typeof node === 'object') {\n const out: Record<string, unknown> = {}\n for (const [k, v] of Object.entries(node as Record<string, unknown>)) {\n // Keys must always remain strings.\n const newKey =\n typeof k === 'string'\n ? (() => {\n const res = interpolateString(k, env)\n return typeof res === 'string' ? res : String(res ?? '')\n })()\n : k\n out[newKey] = substituteTemplates(v, env)\n }\n return out\n }\n return node\n}\n\nexport class LocalStateSetAction implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/workflow/actions/state:set@1'\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const raw = (ctx.action as { staticInput?: unknown })?.staticInput\n // Accept {merge:{...}} (legacy) or a plain object/string (preferred).\n let merge: unknown = raw\n if (raw && typeof raw === 'object' && !Array.isArray(raw) && 'merge' in (raw as object)) {\n merge = (raw as { merge?: unknown }).merge\n }\n\n const env: Record<string, unknown> = {\n input: (ctx.input as Record<string, unknown>) || {},\n context: (ctx.instance.context as Record<string, unknown>) || {},\n participants: (ctx.instance.participants as Record<string, unknown>) || {},\n artifacts: (ctx.instance.artifacts as Record<string, unknown>) || {},\n idempotency_key: ctx.idempotency_key,\n }\n\n // If staticInput is a pure template string like '{{ input.application }}',\n // resolve the path directly to preserve object values (don't stringify).\n if (typeof merge === 'string') {\n const match = merge.match(/^\\{\\{\\s*(.+?)\\s*\\}\\}$/)\n if (match) {\n const resolved = resolvePath(env, match[1])\n if (resolved !== undefined) merge = resolved\n }\n }\n\n // Substitute {{...}} in keys + values throughout the merge tree (for mixed templates).\n if (merge !== undefined && typeof merge !== 'string') merge = substituteTemplates(merge, env)\n\n // String fallback: if still a string after template resolution, try path resolution.\n if (typeof merge === 'string') {\n const trimmed = merge.replace(/\\{\\{|\\}\\}/g, '').trim()\n if (trimmed.includes('.')) {\n const resolved = resolvePath(env, trimmed)\n if (resolved && typeof resolved === 'object') merge = resolved\n }\n }\n\n let mergeObj: Record<string, unknown> | undefined\n if (merge && typeof merge === 'object' && !Array.isArray(merge)) {\n mergeObj = merge as Record<string, unknown>\n }\n\n // Match the Python plugin: advance input merges on top of staticInput.\n if (ctx.input && typeof ctx.input === 'object' && !Array.isArray(ctx.input)) {\n mergeObj = deepMerge({ ...(mergeObj || {}) }, ctx.input as Record<string, unknown>)\n }\n\n if (mergeObj && Object.keys(mergeObj).length > 0) {\n const next = deepMerge({ ...(ctx.instance.context || {}) }, mergeObj)\n return { contextMerge: next }\n }\n return {}\n }\n}\n\nexport class IssueCredentialV2Action implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/issue-credential/2.0/offer-credential'\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const act = ctx.action as { profile_ref: string }\n const ref: string = act.profile_ref\n if (!ref?.startsWith('cp.')) throw Object.assign(new Error('invalid profile_ref'), { code: 'action_error' })\n const key = ref.slice(3)\n const profile = ctx.template.catalog?.credential_profiles?.[key]\n if (!profile) throw Object.assign(new Error('missing catalog profile'), { code: 'action_error' })\n const attrs = AttributePlanner.materialize(profile.attribute_plan || {}, ctx.instance)\n const attributes = Object.entries(attrs).map(([name, value]) => ({ name, value: String(value) }))\n const connectionId = ctx.instance.connection_id\n if (!connectionId) throw Object.assign(new Error('connectionId required'), { code: 'action_error' })\n // Enforce to_ref recipient DID against connection counterparty DID (if available)\n {\n const toRef = profile.to_ref\n const expectedDid = toRef ? ctx.instance.participants?.[toRef]?.did : undefined\n if (expectedDid && ctx.instance.connection_id) {\n const connSvc = ctx.agentContext.dependencyManager.resolve(DidCommConnectionService)\n const conn = await connSvc.getById(ctx.agentContext, ctx.instance.connection_id)\n const theirDid = (conn as unknown as { theirDid?: string })?.theirDid\n if (theirDid && theirDid !== expectedDid)\n throw Object.assign(new Error('to_ref DID mismatch'), { code: 'forbidden' })\n }\n }\n try {\n const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi) as unknown as {\n offerCredential: (options: unknown) => Promise<{ id: string; credentialRecord?: { id?: string } }>\n findOfferMessage: (id: string) => Promise<unknown>\n }\n const record = await credsApi.offerCredential({\n connectionId,\n protocolVersion: 'v2',\n credentialFormats: { anoncreds: { credentialDefinitionId: profile.cred_def_id, attributes } },\n comment: profile.options?.comment,\n })\n let messageId: string | undefined = record?.id || record?.credentialRecord?.id\n try {\n if (messageId) {\n const found = (await credsApi.findOfferMessage(messageId)) as unknown\n if (found && typeof found === 'object') {\n const f = found as { id?: string; message?: { id?: string } }\n messageId = f.message?.id || f.id || messageId\n }\n }\n } catch (_e) {\n void 0\n }\n return { artifacts: { issueRecordId: record?.id || record?.credentialRecord?.id }, messageId }\n } catch (e) {\n throw Object.assign(new Error(`issue action error: ${(e as Error).message}`), { code: 'action_error' })\n }\n }\n}\n\n/**\n * ProposeCredentialV2Action - Holder proposes a credential to the issuer\n * Used when holder initiates the credential issuance flow\n */\nexport class ProposeCredentialV2Action implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/issue-credential/2.0/propose-credential'\n\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const act = ctx.action as { profile_ref: string }\n const ref: string = act.profile_ref\n if (!ref?.startsWith('cp.')) throw Object.assign(new Error('invalid profile_ref'), { code: 'action_error' })\n\n const key = ref.slice(3)\n const profile = ctx.template.catalog?.credential_profiles?.[key]\n if (!profile) throw Object.assign(new Error('missing catalog profile'), { code: 'action_error' })\n\n // Materialize attributes from context using attribute_plan\n const attrs = AttributePlanner.materialize(profile.attribute_plan || {}, ctx.instance)\n const attributes = Object.entries(attrs).map(([name, value]) => ({ name, value: String(value) }))\n\n const connectionId = ctx.instance.connection_id\n if (!connectionId) throw Object.assign(new Error('connectionId required'), { code: 'action_error' })\n\n try {\n const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi) as unknown as {\n proposeCredential: (options: unknown) => Promise<{ id: string; credentialRecord?: { id?: string } }>\n findProposalMessage: (id: string) => Promise<unknown>\n }\n\n const record = await credsApi.proposeCredential({\n connectionId,\n protocolVersion: 'v2',\n credentialFormats: {\n anoncreds: {\n credentialDefinitionId: profile.cred_def_id,\n attributes,\n },\n },\n comment: profile.options?.comment,\n })\n\n // Extract message ID for correlation\n let messageId: string | undefined = record?.id || record?.credentialRecord?.id\n try {\n if (messageId) {\n const found = await credsApi.findProposalMessage(messageId)\n if (found && typeof found === 'object') {\n const f = found as { id?: string; message?: { id?: string } }\n messageId = f.message?.id || f.id || messageId\n }\n }\n } catch (_e) {\n void 0\n }\n\n // Store record ID in artifacts for later actions to find\n return {\n artifacts: { credentialRecordId: record?.id || record?.credentialRecord?.id },\n messageId,\n }\n } catch (e) {\n throw Object.assign(new Error(`propose action error: ${(e as Error).message}`), { code: 'action_error' })\n }\n }\n}\n\n/**\n * RequestCredentialV2Action - Holder accepts a credential offer\n * Used when holder receives an offer and wants to request the credential\n */\nexport class RequestCredentialV2Action implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/issue-credential/2.0/request-credential'\n\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const connectionId = ctx.instance.connection_id\n if (!connectionId) throw Object.assign(new Error('connectionId required'), { code: 'action_error' })\n\n try {\n const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi) as unknown as {\n acceptOffer: (options: { credentialRecordId: string }) => Promise<{ id: string }>\n getAll: () => Promise<Array<{ id: string; connectionId?: string; state: string; updatedAt?: Date }>>\n findRequestMessage: (id: string) => Promise<unknown>\n }\n\n // Find the credential record with OfferReceived state for this connection\n // Option 1: Check artifacts for stored credentialRecordId\n let credentialRecordId = ctx.instance.artifacts?.credentialRecordId as string | undefined\n\n // Option 2: Query by connection + state if not in artifacts\n if (!credentialRecordId) {\n const all = await credsApi.getAll()\n const matches = all\n .filter((r) => r.connectionId === connectionId && r.state === 'offer-received')\n .sort((a, b) => {\n const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0\n const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0\n return dateB - dateA // Most recent first\n })\n if (matches.length === 0) {\n throw Object.assign(new Error('no offer found to accept'), { code: 'action_error' })\n }\n credentialRecordId = matches[0].id\n }\n\n const record = await credsApi.acceptOffer({ credentialRecordId })\n\n let messageId: string | undefined = record?.id\n try {\n if (messageId) {\n const found = await credsApi.findRequestMessage(messageId)\n if (found && typeof found === 'object') {\n const f = found as { id?: string; message?: { id?: string } }\n messageId = f.message?.id || f.id || messageId\n }\n }\n } catch (_e) {\n void 0\n }\n\n return {\n artifacts: { credentialRecordId: record?.id },\n messageId,\n }\n } catch (e) {\n throw Object.assign(new Error(`request action error: ${(e as Error).message}`), { code: 'action_error' })\n }\n }\n}\n\n/**\n * IssueCredentialMessageV2Action - Issuer issues the credential after receiving a request\n * Used when issuer receives a credential request and wants to issue the credential\n */\nexport class IssueCredentialMessageV2Action implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/issue-credential/2.0/issue-credential'\n\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const connectionId = ctx.instance.connection_id\n if (!connectionId) throw Object.assign(new Error('connectionId required'), { code: 'action_error' })\n\n try {\n const credsApi = ctx.agentContext.dependencyManager.resolve(DidCommCredentialsApi) as unknown as {\n acceptRequest: (options: { credentialRecordId: string }) => Promise<{ id: string }>\n getAll: () => Promise<Array<{ id: string; connectionId?: string; state: string; updatedAt?: Date }>>\n findCredentialMessage: (id: string) => Promise<unknown>\n }\n\n // Find the credential record with RequestReceived state for this connection\n let credentialRecordId = ctx.instance.artifacts?.credentialRecordId as string | undefined\n\n if (!credentialRecordId) {\n const all = await credsApi.getAll()\n const matches = all\n .filter((r) => r.connectionId === connectionId && r.state === 'request-received')\n .sort((a, b) => {\n const dateA = a.updatedAt ? new Date(a.updatedAt).getTime() : 0\n const dateB = b.updatedAt ? new Date(b.updatedAt).getTime() : 0\n return dateB - dateA // Most recent first\n })\n if (matches.length === 0) {\n throw Object.assign(new Error('no request found to issue'), { code: 'action_error' })\n }\n credentialRecordId = matches[0].id\n }\n\n const record = await credsApi.acceptRequest({ credentialRecordId })\n\n let messageId: string | undefined = record?.id\n try {\n if (messageId) {\n const found = await credsApi.findCredentialMessage(messageId)\n if (found && typeof found === 'object') {\n const f = found as { id?: string; message?: { id?: string } }\n messageId = f.message?.id || f.id || messageId\n }\n }\n } catch (_e) {\n void 0\n }\n\n return {\n artifacts: { issuedCredentialRecordId: record?.id },\n messageId,\n }\n } catch (e) {\n throw Object.assign(new Error(`issue action error: ${(e as Error).message}`), { code: 'action_error' })\n }\n }\n}\n\nexport class PresentProofV2Action implements WorkflowActionHandler {\n public readonly typeUri = 'https://didcomm.org/present-proof/2.0/request-presentation'\n public async execute(ctx: ActionCtx): Promise<ActionResult> {\n const act = ctx.action as { profile_ref: string }\n const ref: string = act.profile_ref\n if (!ref?.startsWith('pp.')) throw Object.assign(new Error('invalid profile_ref'), { code: 'action_error' })\n const key = ref.slice(3)\n const profile = ctx.template.catalog?.proof_profiles?.[key]\n if (!profile) throw Object.assign(new Error('missing catalog profile'), { code: 'action_error' })\n const connectionId = ctx.instance.connection_id\n if (!connectionId) throw Object.assign(new Error('connectionId required'), { code: 'action_error' })\n // Enforce to_ref recipient DID against connection counterparty DID (if available)\n {\n const toRef2 = profile.to_ref\n const expectedDid2 = toRef2 ? ctx.instance.participants?.[toRef2]?.did : undefined\n if (expectedDid2 && ctx.instance.connection_id) {\n const connSvc = ctx.agentContext.dependencyManager.resolve(DidCommConnectionService)\n const conn = await connSvc.getById(ctx.agentContext, ctx.instance.connection_id)\n const theirDid = (conn as unknown as { theirDid?: string })?.theirDid\n if (theirDid && theirDid !== expectedDid2)\n throw Object.assign(new Error('to_ref DID mismatch'), { code: 'forbidden' })\n }\n }\n try {\n const proofsApi = ctx.agentContext.dependencyManager.resolve(DidCommProofsApi) as unknown as {\n requestProof: (options: unknown) => Promise<{ id: string; proofRecord?: { id?: string } }>\n findRequestMessage: (id: string) => Promise<unknown>\n }\n const credDefId = (profile as { cred_def_id?: string }).cred_def_id\n const schemaId = (profile as { schema_id?: string }).schema_id\n const restriction = credDefId ? { cred_def_id: credDefId } : schemaId ? { schema_id: schemaId } : undefined\n\n const reqAttrs = (profile.requested_attributes || []).reduce<Record<string, unknown>>(\n (acc, name: string, idx: number) => {\n acc[`attr${idx + 1}`] = restriction ? { name, restrictions: [restriction] } : { name }\n return acc\n },\n {}\n )\n const reqPreds = (profile.requested_predicates || []).reduce<Record<string, unknown>>(\n (acc, p: { name: string; p_type: string; p_value: number }, idx: number) => {\n acc[`pred${idx + 1}`] = restriction\n ? { name: p.name, p_type: p.p_type, p_value: p.p_value, restrictions: [restriction] }\n : { name: p.name, p_type: p.p_type, p_value: p.p_value }\n return acc\n },\n {}\n )\n const record = await proofsApi.requestProof({\n connectionId,\n protocolVersion: 'v2',\n proofFormats: {\n anoncreds: {\n name: 'Workflow Proof Request',\n version: '1.0',\n requested_attributes: reqAttrs,\n requested_predicates: reqPreds,\n },\n },\n willConfirm: true,\n comment: profile.options?.comment,\n })\n let messageId: string | undefined = record?.id || record?.proofRecord?.id\n try {\n if (messageId) {\n const found = (await proofsApi.findRequestMessage(messageId)) as unknown\n if (found && typeof found === 'object') {\n const f = found as { id?: string; message?: { id?: string } }\n messageId = f.message?.id || f.id || messageId\n }\n }\n } catch (_e) {\n void 0\n }\n return { artifacts: { proofRecordId: record?.id || record?.proofRecord?.id }, messageId }\n } catch (e) {\n throw Object.assign(new Error(`proof action error: ${(e as Error).message}`), { code: 'action_error' })\n }\n }\n}\n"],"mappings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