@blue-labs/document-processor 1.37.1 → 2.0.0-rc.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 (257) hide show
  1. package/dist/api/document-processor.d.ts +38 -0
  2. package/dist/api/document-processor.d.ts.map +1 -0
  3. package/dist/constants/processor-contract-constants.d.ts +24 -0
  4. package/dist/constants/processor-contract-constants.d.ts.map +1 -0
  5. package/dist/constants/processor-pointer-constants.d.ts +21 -0
  6. package/dist/constants/processor-pointer-constants.d.ts.map +1 -0
  7. package/dist/engine/boundary-violation-exception.d.ts +4 -0
  8. package/dist/engine/boundary-violation-exception.d.ts.map +1 -0
  9. package/dist/engine/channel-runner.d.ts +27 -0
  10. package/dist/engine/channel-runner.d.ts.map +1 -0
  11. package/dist/engine/checkpoint-manager.d.ts +23 -0
  12. package/dist/engine/checkpoint-manager.d.ts.map +1 -0
  13. package/dist/engine/contract-bundle.d.ts +70 -0
  14. package/dist/engine/contract-bundle.d.ts.map +1 -0
  15. package/dist/engine/contract-loader.d.ts +17 -0
  16. package/dist/engine/contract-loader.d.ts.map +1 -0
  17. package/dist/engine/handler-registration-service.d.ts +27 -0
  18. package/dist/engine/handler-registration-service.d.ts.map +1 -0
  19. package/dist/engine/illegal-state-exception.d.ts +5 -0
  20. package/dist/engine/illegal-state-exception.d.ts.map +1 -0
  21. package/dist/engine/index.d.ts +11 -0
  22. package/dist/engine/index.d.ts.map +1 -0
  23. package/dist/engine/must-understand-failure.d.ts +4 -0
  24. package/dist/engine/must-understand-failure.d.ts.map +1 -0
  25. package/dist/engine/processor-engine.d.ts +66 -0
  26. package/dist/engine/processor-engine.d.ts.map +1 -0
  27. package/dist/engine/processor-execution-context.d.ts +38 -0
  28. package/dist/engine/processor-execution-context.d.ts.map +1 -0
  29. package/dist/engine/processor-fatal-error.d.ts +6 -0
  30. package/dist/engine/processor-fatal-error.d.ts.map +1 -0
  31. package/dist/engine/run-termination-error.d.ts +5 -0
  32. package/dist/engine/run-termination-error.d.ts.map +1 -0
  33. package/dist/engine/scope-executor.d.ts +60 -0
  34. package/dist/engine/scope-executor.d.ts.map +1 -0
  35. package/dist/engine/termination-service.d.ts +17 -0
  36. package/dist/engine/termination-service.d.ts.map +1 -0
  37. package/dist/index.d.ts +14 -6
  38. package/dist/index.d.ts.map +1 -1
  39. package/dist/index.js +3176 -9
  40. package/dist/merge/index.d.ts +2 -2
  41. package/dist/merge/index.d.ts.map +1 -1
  42. package/dist/merge/processors/index.d.ts +1 -1
  43. package/dist/merge/processors/index.d.ts.map +1 -1
  44. package/dist/model/channels/document-update-channel.d.ts +41 -0
  45. package/dist/model/channels/document-update-channel.d.ts.map +1 -0
  46. package/dist/model/channels/embedded-node-channel.d.ts +43 -0
  47. package/dist/model/channels/embedded-node-channel.d.ts.map +1 -0
  48. package/dist/model/channels/index.d.ts +7 -0
  49. package/dist/model/channels/index.d.ts.map +1 -0
  50. package/dist/model/channels/lifecycle-channel.d.ts +40 -0
  51. package/dist/model/channels/lifecycle-channel.d.ts.map +1 -0
  52. package/dist/model/channels/myos-timeline-channel.d.ts +52 -0
  53. package/dist/model/channels/myos-timeline-channel.d.ts.map +1 -0
  54. package/dist/model/channels/timeline-channel.d.ts +43 -0
  55. package/dist/model/channels/timeline-channel.d.ts.map +1 -0
  56. package/dist/model/channels/triggered-event-channel.d.ts +40 -0
  57. package/dist/model/channels/triggered-event-channel.d.ts.map +1 -0
  58. package/dist/model/events/document-update.d.ts +15 -0
  59. package/dist/model/events/document-update.d.ts.map +1 -0
  60. package/dist/model/handlers/index.d.ts +3 -0
  61. package/dist/model/handlers/index.d.ts.map +1 -0
  62. package/dist/model/handlers/sequential-workflow-operation.d.ts +61 -0
  63. package/dist/model/handlers/sequential-workflow-operation.d.ts.map +1 -0
  64. package/dist/model/handlers/sequential-workflow.d.ts +57 -0
  65. package/dist/model/handlers/sequential-workflow.d.ts.map +1 -0
  66. package/dist/model/index.d.ts +6 -0
  67. package/dist/model/index.d.ts.map +1 -0
  68. package/dist/model/markers/channel-event-checkpoint.d.ts +40 -0
  69. package/dist/model/markers/channel-event-checkpoint.d.ts.map +1 -0
  70. package/dist/model/markers/index.d.ts +6 -0
  71. package/dist/model/markers/index.d.ts.map +1 -0
  72. package/dist/model/markers/initialization-marker.d.ts +36 -0
  73. package/dist/model/markers/initialization-marker.d.ts.map +1 -0
  74. package/dist/model/markers/operation.d.ts +39 -0
  75. package/dist/model/markers/operation.d.ts.map +1 -0
  76. package/dist/model/markers/process-embedded.d.ts +36 -0
  77. package/dist/model/markers/process-embedded.d.ts.map +1 -0
  78. package/dist/model/markers/processing-terminated-marker.d.ts +39 -0
  79. package/dist/model/markers/processing-terminated-marker.d.ts.map +1 -0
  80. package/dist/model/shared/channel-contract-base.d.ts +30 -0
  81. package/dist/model/shared/channel-contract-base.d.ts.map +1 -0
  82. package/dist/model/shared/contract-base.d.ts +16 -0
  83. package/dist/model/shared/contract-base.d.ts.map +1 -0
  84. package/dist/model/shared/handler-contract-base.d.ts +29 -0
  85. package/dist/model/shared/handler-contract-base.d.ts.map +1 -0
  86. package/dist/model/shared/index.d.ts +6 -0
  87. package/dist/model/shared/index.d.ts.map +1 -0
  88. package/dist/model/shared/json-patch.d.ts +24 -0
  89. package/dist/model/shared/json-patch.d.ts.map +1 -0
  90. package/dist/model/shared/marker-contract-base.d.ts +23 -0
  91. package/dist/model/shared/marker-contract-base.d.ts.map +1 -0
  92. package/dist/model/types.d.ts +13 -0
  93. package/dist/model/types.d.ts.map +1 -0
  94. package/dist/registry/contract-processor-registry-builder.d.ts +11 -0
  95. package/dist/registry/contract-processor-registry-builder.d.ts.map +1 -0
  96. package/dist/registry/contract-processor-registry.d.ts +17 -0
  97. package/dist/registry/contract-processor-registry.d.ts.map +1 -0
  98. package/dist/registry/index.d.ts +4 -0
  99. package/dist/registry/index.d.ts.map +1 -0
  100. package/dist/registry/processors/myos-timeline-channel-processor.d.ts +59 -0
  101. package/dist/registry/processors/myos-timeline-channel-processor.d.ts.map +1 -0
  102. package/dist/registry/processors/operation-marker-processor.d.ts +43 -0
  103. package/dist/registry/processors/operation-marker-processor.d.ts.map +1 -0
  104. package/dist/registry/processors/sequential-workflow-operation-processor.d.ts +76 -0
  105. package/dist/registry/processors/sequential-workflow-operation-processor.d.ts.map +1 -0
  106. package/dist/registry/processors/sequential-workflow-processor.d.ts +64 -0
  107. package/dist/registry/processors/sequential-workflow-processor.d.ts.map +1 -0
  108. package/dist/registry/processors/steps/javascript-code-step-executor.d.ts +8 -0
  109. package/dist/registry/processors/steps/javascript-code-step-executor.d.ts.map +1 -0
  110. package/dist/registry/processors/steps/quickjs-step-bindings.d.ts +4 -0
  111. package/dist/registry/processors/steps/quickjs-step-bindings.d.ts.map +1 -0
  112. package/dist/registry/processors/steps/trigger-event-step-executor.d.ts +7 -0
  113. package/dist/registry/processors/steps/trigger-event-step-executor.d.ts.map +1 -0
  114. package/dist/registry/processors/steps/update-document-step-executor.d.ts +11 -0
  115. package/dist/registry/processors/steps/update-document-step-executor.d.ts.map +1 -0
  116. package/dist/registry/processors/timeline-channel-processor.d.ts +50 -0
  117. package/dist/registry/processors/timeline-channel-processor.d.ts.map +1 -0
  118. package/dist/registry/processors/utils/operation-utils.d.ts +6 -0
  119. package/dist/registry/processors/utils/operation-utils.d.ts.map +1 -0
  120. package/dist/registry/processors/workflow/operation-matcher.d.ts +17 -0
  121. package/dist/registry/processors/workflow/operation-matcher.d.ts.map +1 -0
  122. package/dist/registry/processors/workflow/step-runner.d.ts +28 -0
  123. package/dist/registry/processors/workflow/step-runner.d.ts.map +1 -0
  124. package/dist/registry/types.d.ts +71 -0
  125. package/dist/registry/types.d.ts.map +1 -0
  126. package/dist/runtime/document-processing-runtime.d.ts +31 -0
  127. package/dist/runtime/document-processing-runtime.d.ts.map +1 -0
  128. package/dist/runtime/emission-registry.d.ts +14 -0
  129. package/dist/runtime/emission-registry.d.ts.map +1 -0
  130. package/dist/runtime/gas-helpers.d.ts +9 -0
  131. package/dist/runtime/gas-helpers.d.ts.map +1 -0
  132. package/dist/runtime/gas-meter.d.ts +32 -0
  133. package/dist/runtime/gas-meter.d.ts.map +1 -0
  134. package/dist/runtime/index.d.ts +6 -0
  135. package/dist/runtime/index.d.ts.map +1 -0
  136. package/dist/runtime/patch-engine.d.ts +28 -0
  137. package/dist/runtime/patch-engine.d.ts.map +1 -0
  138. package/dist/runtime/scope-runtime-context.d.ts +31 -0
  139. package/dist/runtime/scope-runtime-context.d.ts.map +1 -0
  140. package/dist/test-support/blue.d.ts +27 -0
  141. package/dist/test-support/blue.d.ts.map +1 -0
  142. package/dist/test-support/workflow.d.ts +18 -0
  143. package/dist/test-support/workflow.d.ts.map +1 -0
  144. package/dist/types/document-processing-result.d.ts +13 -0
  145. package/dist/types/document-processing-result.d.ts.map +1 -0
  146. package/dist/types/errors.d.ts +42 -0
  147. package/dist/types/errors.d.ts.map +1 -0
  148. package/dist/types/index.d.ts +4 -0
  149. package/dist/types/index.d.ts.map +1 -0
  150. package/dist/types/result.d.ts +23 -0
  151. package/dist/types/result.d.ts.map +1 -0
  152. package/dist/types/scope-contracts.d.ts +7 -0
  153. package/dist/types/scope-contracts.d.ts.map +1 -0
  154. package/dist/util/expression/exceptions.d.ts +6 -0
  155. package/dist/util/expression/exceptions.d.ts.map +1 -0
  156. package/dist/util/expression/quickjs-evaluator.d.ts +23 -0
  157. package/dist/util/expression/quickjs-evaluator.d.ts.map +1 -0
  158. package/dist/util/expression/quickjs-expression-utils.d.ts +29 -0
  159. package/dist/util/expression/quickjs-expression-utils.d.ts.map +1 -0
  160. package/dist/util/node-canonicalizer.d.ts +4 -0
  161. package/dist/util/node-canonicalizer.d.ts.map +1 -0
  162. package/dist/util/pointer-utils.d.ts +7 -0
  163. package/dist/util/pointer-utils.d.ts.map +1 -0
  164. package/package.json +21 -19
  165. package/dist/BlueDocumentProcessor.d.ts +0 -50
  166. package/dist/BlueDocumentProcessor.d.ts.map +0 -1
  167. package/dist/config.d.ts +0 -3
  168. package/dist/config.d.ts.map +0 -1
  169. package/dist/context.d.ts +0 -21
  170. package/dist/context.d.ts.map +0 -1
  171. package/dist/index.mjs +0 -1657
  172. package/dist/processors/BaseChannelProcessor.d.ts +0 -22
  173. package/dist/processors/BaseChannelProcessor.d.ts.map +0 -1
  174. package/dist/processors/ChannelEventCheckpointProcessor.d.ts +0 -13
  175. package/dist/processors/ChannelEventCheckpointProcessor.d.ts.map +0 -1
  176. package/dist/processors/CompositeTimelineChannelProcessor.d.ts +0 -9
  177. package/dist/processors/CompositeTimelineChannelProcessor.d.ts.map +0 -1
  178. package/dist/processors/DocumentUpdateChannelProcessor.d.ts +0 -9
  179. package/dist/processors/DocumentUpdateChannelProcessor.d.ts.map +0 -1
  180. package/dist/processors/EmbeddedNodeChannelProcessor.d.ts +0 -9
  181. package/dist/processors/EmbeddedNodeChannelProcessor.d.ts.map +0 -1
  182. package/dist/processors/InitializedMarkerProcessor.d.ts +0 -9
  183. package/dist/processors/InitializedMarkerProcessor.d.ts.map +0 -1
  184. package/dist/processors/LifecycleEventChannelProcessor.d.ts +0 -33
  185. package/dist/processors/LifecycleEventChannelProcessor.d.ts.map +0 -1
  186. package/dist/processors/MyOSAgentChannelProcessor.d.ts +0 -60
  187. package/dist/processors/MyOSAgentChannelProcessor.d.ts.map +0 -1
  188. package/dist/processors/MyOSTimelineChannelProcessor.d.ts +0 -9
  189. package/dist/processors/MyOSTimelineChannelProcessor.d.ts.map +0 -1
  190. package/dist/processors/OperationProcessor.d.ts +0 -13
  191. package/dist/processors/OperationProcessor.d.ts.map +0 -1
  192. package/dist/processors/ProcessEmbeddedProcessor.d.ts +0 -9
  193. package/dist/processors/ProcessEmbeddedProcessor.d.ts.map +0 -1
  194. package/dist/processors/SequentialWorkflowOperationProcessor.d.ts +0 -12
  195. package/dist/processors/SequentialWorkflowOperationProcessor.d.ts.map +0 -1
  196. package/dist/processors/SequentialWorkflowProcessor/SequentialWorkflowProcessor.d.ts +0 -19
  197. package/dist/processors/SequentialWorkflowProcessor/SequentialWorkflowProcessor.d.ts.map +0 -1
  198. package/dist/processors/SequentialWorkflowProcessor/index.d.ts +0 -2
  199. package/dist/processors/SequentialWorkflowProcessor/index.d.ts.map +0 -1
  200. package/dist/processors/SequentialWorkflowProcessor/steps/JavaScriptCodeExecutor.d.ts +0 -8
  201. package/dist/processors/SequentialWorkflowProcessor/steps/JavaScriptCodeExecutor.d.ts.map +0 -1
  202. package/dist/processors/SequentialWorkflowProcessor/steps/TriggerEventExecutor.d.ts +0 -8
  203. package/dist/processors/SequentialWorkflowProcessor/steps/TriggerEventExecutor.d.ts.map +0 -1
  204. package/dist/processors/SequentialWorkflowProcessor/steps/UpdateDocumentExecutor.d.ts +0 -14
  205. package/dist/processors/SequentialWorkflowProcessor/steps/UpdateDocumentExecutor.d.ts.map +0 -1
  206. package/dist/processors/SequentialWorkflowProcessor/types.d.ts +0 -7
  207. package/dist/processors/SequentialWorkflowProcessor/types.d.ts.map +0 -1
  208. package/dist/processors/SequentialWorkflowProcessor/utils/BindingsFactory.d.ts +0 -12
  209. package/dist/processors/SequentialWorkflowProcessor/utils/BindingsFactory.d.ts.map +0 -1
  210. package/dist/processors/SequentialWorkflowProcessor/utils/ExpressionEvaluator.d.ts +0 -61
  211. package/dist/processors/SequentialWorkflowProcessor/utils/ExpressionEvaluator.d.ts.map +0 -1
  212. package/dist/processors/SequentialWorkflowProcessor/utils/ExpressionResolver.d.ts +0 -8
  213. package/dist/processors/SequentialWorkflowProcessor/utils/ExpressionResolver.d.ts.map +0 -1
  214. package/dist/processors/TimelineChannelProcessor.d.ts +0 -9
  215. package/dist/processors/TimelineChannelProcessor.d.ts.map +0 -1
  216. package/dist/processors/TriggeredEventChannelProcessor.d.ts +0 -12
  217. package/dist/processors/TriggeredEventChannelProcessor.d.ts.map +0 -1
  218. package/dist/processors/index.d.ts +0 -15
  219. package/dist/processors/index.d.ts.map +0 -1
  220. package/dist/queue/TaskKey.d.ts +0 -22
  221. package/dist/queue/TaskKey.d.ts.map +0 -1
  222. package/dist/queue/TaskQueue.d.ts +0 -31
  223. package/dist/queue/TaskQueue.d.ts.map +0 -1
  224. package/dist/registry/ContractRegistry.d.ts +0 -47
  225. package/dist/registry/ContractRegistry.d.ts.map +0 -1
  226. package/dist/routing/EventRouter.d.ts +0 -51
  227. package/dist/routing/EventRouter.d.ts.map +0 -1
  228. package/dist/routing/buildContractEntries.d.ts +0 -3
  229. package/dist/routing/buildContractEntries.d.ts.map +0 -1
  230. package/dist/testUtils.d.ts +0 -15
  231. package/dist/testUtils.d.ts.map +0 -1
  232. package/dist/types.d.ts +0 -84
  233. package/dist/types.d.ts.map +0 -1
  234. package/dist/utils/CheckpointCache.d.ts +0 -10
  235. package/dist/utils/CheckpointCache.d.ts.map +0 -1
  236. package/dist/utils/EventTraceManager.d.ts +0 -47
  237. package/dist/utils/EventTraceManager.d.ts.map +0 -1
  238. package/dist/utils/TinyQueue.d.ts +0 -12
  239. package/dist/utils/TinyQueue.d.ts.map +0 -1
  240. package/dist/utils/checkpoint.d.ts +0 -4
  241. package/dist/utils/checkpoint.d.ts.map +0 -1
  242. package/dist/utils/document.d.ts +0 -29
  243. package/dist/utils/document.d.ts.map +0 -1
  244. package/dist/utils/eventFactories.d.ts +0 -37
  245. package/dist/utils/eventFactories.d.ts.map +0 -1
  246. package/dist/utils/exceptions.d.ts +0 -28
  247. package/dist/utils/exceptions.d.ts.map +0 -1
  248. package/dist/utils/expressionUtils.d.ts +0 -18
  249. package/dist/utils/expressionUtils.d.ts.map +0 -1
  250. package/dist/utils/initialized.d.ts +0 -5
  251. package/dist/utils/initialized.d.ts.map +0 -1
  252. package/dist/utils/logPatchError.d.ts +0 -3
  253. package/dist/utils/logPatchError.d.ts.map +0 -1
  254. package/dist/utils/path.d.ts +0 -2
  255. package/dist/utils/path.d.ts.map +0 -1
  256. package/dist/utils/typeGuard.d.ts +0 -5
  257. package/dist/utils/typeGuard.d.ts.map +0 -1
@@ -0,0 +1,38 @@
1
+ import { Blue, BlueNode } from '@blue-labs/language';
2
+ import { ContractLoader } from '../engine/contract-loader.js';
3
+ import { MarkerContract } from '../model/index.js';
4
+ import { ContractProcessorRegistry } from '../registry/contract-processor-registry.js';
5
+ import { AnyContractProcessor } from '../registry/types.js';
6
+ import { DocumentProcessingResult } from '../types/document-processing-result.js';
7
+ export interface DocumentProcessorOptions {
8
+ readonly blue?: Blue;
9
+ readonly registry?: ContractProcessorRegistry;
10
+ }
11
+ export declare class DocumentProcessor {
12
+ private readonly blue;
13
+ private readonly registryRef;
14
+ private readonly contractLoaderRef;
15
+ private readonly engine;
16
+ constructor(options?: DocumentProcessorOptions);
17
+ registerContractProcessor(processor: AnyContractProcessor): this;
18
+ initializeDocument(document: BlueNode): Promise<DocumentProcessingResult>;
19
+ processDocument(document: BlueNode, event: BlueNode): Promise<DocumentProcessingResult>;
20
+ markersFor(scopeNode: BlueNode, scopePath: string): Map<string, MarkerContract>;
21
+ isInitialized(document: BlueNode): boolean;
22
+ getContractRegistry(): ContractProcessorRegistry;
23
+ /** @internal */
24
+ registry(): ContractProcessorRegistry;
25
+ /** @internal */
26
+ contractLoader(): ContractLoader;
27
+ static builder(): DocumentProcessorBuilder;
28
+ }
29
+ export declare class DocumentProcessorBuilder {
30
+ private contractRegistry;
31
+ private blueInstance;
32
+ constructor();
33
+ withRegistry(registry: ContractProcessorRegistry): DocumentProcessorBuilder;
34
+ registerDefaults(): DocumentProcessorBuilder;
35
+ withBlue(blue: Blue): DocumentProcessorBuilder;
36
+ build(): DocumentProcessor;
37
+ }
38
+ //# sourceMappingURL=document-processor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"document-processor.d.ts","sourceRoot":"","sources":["../../src/api/document-processor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AAE9D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,mBAA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AAwB;IAK3E,gBAAgB,IAAI,wBAAwB;IAI5C,QAAQ,CAAC,IAAI,EAAE,IAAI,GAAG,wBAAwB;IAK9C,KAAK,IAAI,iBAAiB;CAM3B"}
@@ -0,0 +1,24 @@
1
+ declare const reservedContractKeysList: readonly ["embedded", "initialized", "terminated", "checkpoint"];
2
+ declare const processorManagedChannelBlueIdsList: readonly ["J5QdSiiU4zBjMeFYBn8EH4bsY4K5rrmiGfGswn9rwRz1", "716Uk7KPeunnc9PK48hNBDfRb9qsKrFCAZEcU92R169m", "Er9zZ7Yoii7D5j8PdvMYouH2TTVnHmcukFWVqJTam3To", "BnyRD7rxxRV3G4co3tVvXTpuXT383UMuRoDsLvZcPsjD"];
3
+ export type ReservedContractKey = (typeof reservedContractKeysList)[number];
4
+ export type ProcessorManagedChannelBlueId = (typeof processorManagedChannelBlueIdsList)[number];
5
+ export declare const KEY_EMBEDDED: ReservedContractKey;
6
+ export declare const KEY_INITIALIZED: ReservedContractKey;
7
+ export declare const KEY_TERMINATED: ReservedContractKey;
8
+ export declare const KEY_CHECKPOINT: ReservedContractKey;
9
+ export declare const RESERVED_CONTRACT_KEYS: ReadonlySet<ReservedContractKey>;
10
+ export declare const PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: ReadonlySet<ProcessorManagedChannelBlueId>;
11
+ export declare function isReservedContractKey(key: string | undefined | null): key is ReservedContractKey;
12
+ export declare function isProcessorManagedChannelBlueId(blueId: string | undefined | null): blueId is ProcessorManagedChannelBlueId;
13
+ export declare const ProcessorContractConstants: {
14
+ readonly KEY_EMBEDDED: "embedded";
15
+ readonly KEY_INITIALIZED: "initialized";
16
+ readonly KEY_TERMINATED: "terminated";
17
+ readonly KEY_CHECKPOINT: "checkpoint";
18
+ readonly RESERVED_CONTRACT_KEYS: ReadonlySet<"embedded" | "initialized" | "terminated" | "checkpoint">;
19
+ readonly PROCESSOR_MANAGED_CHANNEL_BLUE_IDS: ReadonlySet<"J5QdSiiU4zBjMeFYBn8EH4bsY4K5rrmiGfGswn9rwRz1" | "716Uk7KPeunnc9PK48hNBDfRb9qsKrFCAZEcU92R169m" | "Er9zZ7Yoii7D5j8PdvMYouH2TTVnHmcukFWVqJTam3To" | "BnyRD7rxxRV3G4co3tVvXTpuXT383UMuRoDsLvZcPsjD">;
20
+ readonly isReservedContractKey: typeof isReservedContractKey;
21
+ readonly isProcessorManagedChannelBlueId: typeof isProcessorManagedChannelBlueId;
22
+ };
23
+ export {};
24
+ //# sourceMappingURL=processor-contract-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor-contract-constants.d.ts","sourceRoot":"","sources":["../../src/constants/processor-contract-constants.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,wBAAwB,kEAKpB,CAAC;AAEX,QAAA,MAAM,kCAAkC,2MAK9B,CAAC;AAEX,MAAM,MAAM,mBAAmB,GAAG,CAAC,OAAO,wBAAwB,CAAC,CAAC,MAAM,CAAC,CAAC;AAE5E,MAAM,MAAM,6BAA6B,GACvC,CAAC,OAAO,kCAAkC,CAAC,CAAC,MAAM,CAAC,CAAC;AAEtD,eAAO,MAAM,YAAY,EAAE,mBAAgC,CAAC;AAC5D,eAAO,MAAM,eAAe,EAAE,mBAAmC,CAAC;AAClE,eAAO,MAAM,cAAc,EAAE,mBAAkC,CAAC;AAChE,eAAO,MAAM,cAAc,EAAE,mBAAkC,CAAC;AAEhE,eAAO,MAAM,sBAAsB,EAAE,WAAW,CAAC,mBAAmB,CAEnE,CAAC;AAEF,eAAO,MAAM,kCAAkC,EAAE,WAAW,CAAC,6BAA6B,CAC7C,CAAC;AAE9C,wBAAgB,qBAAqB,CACnC,GAAG,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAC7B,GAAG,IAAI,mBAAmB,CAE5B;AAED,wBAAgB,+BAA+B,CAC7C,MAAM,EAAE,MAAM,GAAG,SAAS,GAAG,IAAI,GAChC,MAAM,IAAI,6BAA6B,CAOzC;AAED,eAAO,MAAM,0BAA0B;;;;;;;;;CAS7B,CAAC"}
@@ -0,0 +1,21 @@
1
+ export declare const RELATIVE_CONTRACTS = "/contracts";
2
+ export declare const RELATIVE_INITIALIZED: string;
3
+ export declare const RELATIVE_TERMINATED: string;
4
+ export declare const RELATIVE_EMBEDDED: string;
5
+ export declare const RELATIVE_CHECKPOINT: string;
6
+ export declare function relativeContractsEntry(key: string): string;
7
+ export declare function relativeCheckpointLastEvent(markerKey: string, channelKey: string): string;
8
+ export declare function relativeCheckpointLastSignature(markerKey: string, channelKey: string): string;
9
+ export declare const ProcessorPointerConstants: {
10
+ readonly RELATIVE_CONTRACTS: "/contracts";
11
+ readonly RELATIVE_INITIALIZED: string;
12
+ readonly RELATIVE_TERMINATED: string;
13
+ readonly RELATIVE_EMBEDDED: string;
14
+ readonly RELATIVE_CHECKPOINT: string;
15
+ readonly LAST_EVENTS_SUFFIX: "/lastEvents";
16
+ readonly LAST_SIGNATURES_SUFFIX: "/lastSignatures";
17
+ readonly relativeContractsEntry: typeof relativeContractsEntry;
18
+ readonly relativeCheckpointLastEvent: typeof relativeCheckpointLastEvent;
19
+ readonly relativeCheckpointLastSignature: typeof relativeCheckpointLastSignature;
20
+ };
21
+ //# sourceMappingURL=processor-pointer-constants.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor-pointer-constants.d.ts","sourceRoot":"","sources":["../../src/constants/processor-pointer-constants.ts"],"names":[],"mappings":"AAOA,eAAO,MAAM,kBAAkB,eAAe,CAAC;AAC/C,eAAO,MAAM,oBAAoB,QAA6C,CAAC;AAC/E,eAAO,MAAM,mBAAmB,QAA4C,CAAC;AAC7E,eAAO,MAAM,iBAAiB,QAA0C,CAAC;AACzE,eAAO,MAAM,mBAAmB,QAA4C,CAAC;AAK7E,wBAAgB,sBAAsB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,CAE1D;AAED,wBAAgB,2BAA2B,CACzC,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAED,wBAAgB,+BAA+B,CAC7C,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,MAAM,GACjB,MAAM,CAER;AAED,eAAO,MAAM,yBAAyB;;;;;;;;;;;CAW5B,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare class BoundaryViolationException extends Error {
2
+ constructor(message: string);
3
+ }
4
+ //# sourceMappingURL=boundary-violation-exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"boundary-violation-exception.d.ts","sourceRoot":"","sources":["../../src/engine/boundary-violation-exception.ts"],"names":[],"mappings":"AAAA,qBAAa,0BAA2B,SAAQ,KAAK;gBACvC,OAAO,EAAE,MAAM;CAI5B"}
@@ -0,0 +1,27 @@
1
+ import { BlueNode } from '@blue-labs/language';
2
+ import { ContractBundle, ChannelBinding, HandlerBinding } from './contract-bundle.js';
3
+ import { DocumentProcessingRuntime } from '../runtime/document-processing-runtime.js';
4
+ import { CheckpointManager } from './checkpoint-manager.js';
5
+ import { ProcessorExecutionContext } from './processor-execution-context.js';
6
+ export interface ChannelMatch {
7
+ readonly matches: boolean;
8
+ readonly eventId?: string | null;
9
+ readonly eventNode?: BlueNode | null;
10
+ }
11
+ export interface ChannelRunnerDependencies {
12
+ evaluateChannel(channel: ChannelBinding, bundle: ContractBundle, scopePath: string, event: BlueNode): Promise<ChannelMatch>;
13
+ isScopeInactive(scopePath: string): boolean;
14
+ createContext(scopePath: string, bundle: ContractBundle, event: BlueNode, allowTerminatedWork: boolean): ProcessorExecutionContext;
15
+ shouldRunHandler(handler: HandlerBinding, context: ProcessorExecutionContext): Promise<boolean>;
16
+ executeHandler(handler: HandlerBinding, context: ProcessorExecutionContext): Promise<void>;
17
+ canonicalSignature(node: BlueNode | null): string | null;
18
+ }
19
+ export declare class ChannelRunner {
20
+ private readonly runtime;
21
+ private readonly checkpointManager;
22
+ private readonly deps;
23
+ constructor(runtime: DocumentProcessingRuntime, checkpointManager: CheckpointManager, deps: ChannelRunnerDependencies);
24
+ runExternalChannel(scopePath: string, bundle: ContractBundle, channel: ChannelBinding, event: BlueNode): Promise<void>;
25
+ runHandlers(scopePath: string, bundle: ContractBundle, channelKey: string, event: BlueNode, allowTerminatedWork: boolean): Promise<void>;
26
+ }
27
+ //# sourceMappingURL=channel-runner.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"channel-runner.d.ts","sourceRoot":"","sources":["../../src/engine/channel-runner.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAC/C,OAAO,KAAK,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AACtF,OAAO,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AAC5D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAElF,MAAM,WAAW,YAAY;IAC3B,QAAQ,CAAC,OAAO,EAAE,OAAO,CAAC;IAC1B,QAAQ,CAAC,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACjC,QAAQ,CAAC,SAAS,CAAC,EAAE,QAAQ,GAAG,IAAI,CAAC;CACtC;AAED,MAAM,WAAW,yBAAyB;IACxC,eAAe,CACb,OAAO,EAAE,cAAc,EACvB,MAAM,EAAE,cAAc,EACtB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,YAAY,CAAC,CAAC;IACzB,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5C,aAAa,CACX,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,QAAQ,EACf,mBAAmB,EAAE,OAAO,GAC3B,yBAAyB,CAAC;IAC7B,gBAAgB,CACd,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,OAAO,CAAC,CAAC;IACpB,cAAc,CACZ,OAAO,EAAE,cAAc,EACvB,OAAO,EAAE,yBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,kBAAkB,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,GAAG,MAAM,GAAG,IAAI,CAAC;CAC1D;AAED,qBAAa,aAAa;IAEtB,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAFJ,OAAO,EAAE,yBAAyB,EAClC,iBAAiB,EAAE,iBAAiB,EACpC,IAAI,EAAE,yBAAyB;IAG5C,kBAAkB,CACtB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,EACtB,OAAO,EAAE,cAAc,EACvB,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,IAAI,CAAC;IAiDV,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,MAAM,EAClB,KAAK,EAAE,QAAQ,EACf,mBAAmB,EAAE,OAAO,GAC3B,OAAO,CAAC,IAAI,CAAC;CA2BjB"}
@@ -0,0 +1,23 @@
1
+ import { BlueNode } from '@blue-labs/language';
2
+ import { ContractBundle } from './contract-bundle.js';
3
+ import { ChannelEventCheckpoint } from '../model/index.js';
4
+ import { DocumentProcessingRuntime } from '../runtime/document-processing-runtime.js';
5
+ export declare class CheckpointRecord {
6
+ readonly markerKey: string;
7
+ readonly checkpoint: ChannelEventCheckpoint;
8
+ readonly channelKey: string;
9
+ lastEventNode: BlueNode | null;
10
+ lastEventSignature: string | null;
11
+ constructor(markerKey: string, checkpoint: ChannelEventCheckpoint, channelKey: string, lastEventNode: BlueNode | null, lastEventSignature: string | null);
12
+ matches(signature: string | null | undefined): boolean;
13
+ }
14
+ export declare class CheckpointManager {
15
+ private readonly runtime;
16
+ private readonly signatureFn;
17
+ constructor(runtime: DocumentProcessingRuntime, signatureFn: (node: BlueNode | null) => string | null);
18
+ ensureCheckpointMarker(scopePath: string, bundle: ContractBundle): void;
19
+ findCheckpoint(bundle: ContractBundle, channelKey: string): CheckpointRecord | null;
20
+ isDuplicate(record: CheckpointRecord | null, signature: string | null | undefined): boolean;
21
+ persist(scopePath: string, bundle: ContractBundle, record: CheckpointRecord | null, eventSignature: string | null, eventNode: BlueNode | null): void;
22
+ }
23
+ //# sourceMappingURL=checkpoint-manager.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"checkpoint-manager.d.ts","sourceRoot":"","sources":["../../src/engine/checkpoint-manager.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AASrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,sBAAsB,EAAkB,MAAM,mBAAmB,CAAC;AAChF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AA4BtF,qBAAa,gBAAgB;IAKzB,QAAQ,CAAC,SAAS,EAAE,MAAM;IAC1B,QAAQ,CAAC,UAAU,EAAE,sBAAsB;IAC3C,QAAQ,CAAC,UAAU,EAAE,MAAM;IAN7B,aAAa,EAAE,QAAQ,GAAG,IAAI,CAAC;IAC/B,kBAAkB,EAAE,MAAM,GAAG,IAAI,CAAC;gBAGvB,SAAS,EAAE,MAAM,EACjB,UAAU,EAAE,sBAAsB,EAClC,UAAU,EAAE,MAAM,EAC3B,aAAa,EAAE,QAAQ,GAAG,IAAI,EAC9B,kBAAkB,EAAE,MAAM,GAAG,IAAI;IAMnC,OAAO,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;CAGvD;AAED,qBAAa,iBAAiB;IAE1B,OAAO,CAAC,QAAQ,CAAC,OAAO;IACxB,OAAO,CAAC,QAAQ,CAAC,WAAW;gBADX,OAAO,EAAE,yBAAyB,EAClC,WAAW,EAAE,CAAC,IAAI,EAAE,QAAQ,GAAG,IAAI,KAAK,MAAM,GAAG,IAAI;IAGxE,sBAAsB,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,EAAE,cAAc,GAAG,IAAI;IAgBvE,cAAc,CACZ,MAAM,EAAE,cAAc,EACtB,UAAU,EAAE,MAAM,GACjB,gBAAgB,GAAG,IAAI;IAoB1B,WAAW,CACT,MAAM,EAAE,gBAAgB,GAAG,IAAI,EAC/B,SAAS,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GACnC,OAAO;IAIV,OAAO,CACL,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,EACtB,MAAM,EAAE,gBAAgB,GAAG,IAAI,EAC/B,cAAc,EAAE,MAAM,GAAG,IAAI,EAC7B,SAAS,EAAE,QAAQ,GAAG,IAAI,GACzB,IAAI;CAwCR"}
@@ -0,0 +1,70 @@
1
+ import { ChannelContract, HandlerContract, MarkerContract, ProcessEmbeddedMarker, ChannelEventCheckpoint } from '../model/index.js';
2
+ type StoredChannel = {
3
+ readonly key: string;
4
+ readonly contract: ChannelContract;
5
+ readonly blueId: string;
6
+ };
7
+ type StoredMarker = {
8
+ readonly key: string;
9
+ readonly contract: MarkerContract;
10
+ readonly blueId: string;
11
+ };
12
+ type StoredHandler = {
13
+ readonly key: string;
14
+ readonly contract: HandlerContract;
15
+ readonly blueId: string;
16
+ };
17
+ export declare class ChannelBinding {
18
+ private readonly bindingKey;
19
+ private readonly bindingContract;
20
+ private readonly bindingBlueId;
21
+ constructor(bindingKey: string, bindingContract: ChannelContract, bindingBlueId: string);
22
+ key(): string;
23
+ contract(): ChannelContract;
24
+ blueId(): string;
25
+ order(): number;
26
+ }
27
+ export declare class HandlerBinding {
28
+ private readonly bindingKey;
29
+ private readonly bindingContract;
30
+ private readonly bindingBlueId;
31
+ constructor(bindingKey: string, bindingContract: HandlerContract, bindingBlueId: string);
32
+ key(): string;
33
+ contract(): HandlerContract;
34
+ blueId(): string;
35
+ order(): number;
36
+ }
37
+ export declare class ContractBundle {
38
+ private readonly channels;
39
+ private readonly handlersByChannel;
40
+ private readonly markerStore;
41
+ private readonly embeddedPathsInternal;
42
+ private checkpointDeclared;
43
+ private constructor();
44
+ static fromComponents(channels: Map<string, StoredChannel>, handlersByChannel: Map<string, StoredHandler[]>, markerStore: Map<string, StoredMarker>, embeddedPaths: readonly string[], checkpointDeclared: boolean): ContractBundle;
45
+ static builder(): ContractBundleBuilder;
46
+ static empty(): ContractBundle;
47
+ markers(): Map<string, MarkerContract>;
48
+ marker(key: string): MarkerContract | undefined;
49
+ markerEntries(): Array<[string, MarkerContract]>;
50
+ embeddedPaths(): readonly string[];
51
+ hasCheckpoint(): boolean;
52
+ registerCheckpointMarker(checkpoint: ChannelEventCheckpoint): void;
53
+ handlersFor(channelKey: string): HandlerBinding[];
54
+ channelsOfType(...blueIds: readonly string[]): ChannelBinding[];
55
+ }
56
+ export declare class ContractBundleBuilder {
57
+ private readonly channels;
58
+ private readonly handlersByChannel;
59
+ private readonly markerStore;
60
+ private embeddedPaths;
61
+ private embeddedDeclared;
62
+ private checkpointDeclared;
63
+ addChannel(key: string, contract: ChannelContract, blueId: string): this;
64
+ addHandler(key: string, contract: HandlerContract, blueId: string): this;
65
+ setEmbedded(embedded: ProcessEmbeddedMarker): this;
66
+ addMarker(key: string, contract: MarkerContract, blueId: string): this;
67
+ build(): ContractBundle;
68
+ }
69
+ export {};
70
+ //# sourceMappingURL=contract-bundle.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-bundle.d.ts","sourceRoot":"","sources":["../../src/engine/contract-bundle.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EACV,eAAe,EACf,eAAe,EACf,cAAc,EACd,qBAAqB,EACrB,sBAAsB,EACvB,MAAM,mBAAmB,CAAC;AAE3B,KAAK,aAAa,GAAG;IACnB,QAAQ,CAAC,GAAG,EAAE,MAAM,CAAC;IACrB,QAAQ,CAAC,QAAQ,EAAE,eAAe,CAAC;IACnC,QAAQ,CAAC,MAAM,EAAE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CAAC,QAAQ,EAAE,qBAAqB,GAAG,IAAI;IAWlD,SAAS,CAAC,GAAG,EAAE,MAAM,EAAE,QAAQ,EAAE,cAAc,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI;IAuBtE,KAAK,IAAI,cAAc;CAcxB"}
@@ -0,0 +1,17 @@
1
+ import { Blue, BlueNode } from '@blue-labs/language';
2
+ import { ContractBundle } from './contract-bundle.js';
3
+ import { ContractProcessorRegistry } from '../registry/contract-processor-registry.js';
4
+ export declare class ContractLoader {
5
+ private readonly registry;
6
+ private readonly blue;
7
+ private readonly handlerRegistration;
8
+ constructor(registry: ContractProcessorRegistry, blue: Blue);
9
+ load(scopeNode: BlueNode, scopePath: string): ContractBundle;
10
+ private processContract;
11
+ private handleProcessEmbedded;
12
+ private handleChannel;
13
+ private handleMarker;
14
+ private buildScopeContractsIndex;
15
+ private convert;
16
+ }
17
+ //# sourceMappingURL=contract-loader.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"contract-loader.d.ts","sourceRoot":"","sources":["../../src/engine/contract-loader.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAerD,OAAO,EAAE,cAAc,EAAyB,MAAM,sBAAsB,CAAC;AAC7E,OAAO,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAkEvF,qBAAa,cAAc;IAIvB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI;IAJvB,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAA6B;gBAG9C,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,IAAI;IAS7B,IAAI,CAAC,SAAS,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,GAAG,cAAc;IAqC5D,OAAO,CAAC,eAAe;IA+EvB,OAAO,CAAC,qBAAqB;IAkC7B,OAAO,CAAC,aAAa;IAgCrB,OAAO,CAAC,YAAY;IAgCpB,OAAO,CAAC,wBAAwB;IAgBhC,OAAO,CAAC,OAAO;CAGhB"}
@@ -0,0 +1,27 @@
1
+ import { ZodType } from 'zod';
2
+ import { Blue, BlueNode } from '@blue-labs/language';
3
+ import { ContractBundleBuilder } from './contract-bundle.js';
4
+ import { ChannelContract } from '../model/index.js';
5
+ import { ContractProcessorRegistry } from '../registry/contract-processor-registry.js';
6
+ import { HandlerProcessor } from '../registry/types.js';
7
+ import { ScopeContractsIndex } from '../types/scope-contracts.js';
8
+ interface RegisterHandlerArgs {
9
+ builder: ContractBundleBuilder;
10
+ key: string;
11
+ node: BlueNode;
12
+ processor: HandlerProcessor<unknown>;
13
+ blueId: string;
14
+ scopeContracts: ScopeContractsIndex;
15
+ }
16
+ export declare class HandlerRegistrationService {
17
+ private readonly blue;
18
+ private readonly registry;
19
+ private readonly builtinChannelSchemas;
20
+ constructor(blue: Blue, registry: ContractProcessorRegistry, builtinChannelSchemas: ReadonlyMap<string, ZodType<ChannelContract>>);
21
+ register({ builder, key, node, processor, blueId, scopeContracts, }: RegisterHandlerArgs): void;
22
+ private resolveChannelKey;
23
+ private isRegisteredChannel;
24
+ private isZodError;
25
+ }
26
+ export {};
27
+ //# sourceMappingURL=handler-registration-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"handler-registration-service.d.ts","sourceRoot":"","sources":["../../src/engine/handler-registration-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAY,OAAO,EAAE,MAAM,KAAK,CAAC;AACxC,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE1D,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,KAAK,EAAE,eAAe,EAAmB,MAAM,mBAAmB,CAAC;AAG1E,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAC5F,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,sBAAsB,CAAC;AAC7D,OAAO,KAAK,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAEvE,UAAU,mBAAmB;IAC3B,OAAO,EAAE,qBAAqB,CAAC;IAC/B,GAAG,EAAE,MAAM,CAAC;IACZ,IAAI,EAAE,QAAQ,CAAC;IACf,SAAS,EAAE,gBAAgB,CAAC,OAAO,CAAC,CAAC;IACrC,MAAM,EAAE,MAAM,CAAC;IACf,cAAc,EAAE,mBAAmB,CAAC;CACrC;AAED,qBAAa,0BAA0B;IAEnC,OAAO,CAAC,QAAQ,CAAC,IAAI;IACrB,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,qBAAqB;gBAFrB,IAAI,EAAE,IAAI,EACV,QAAQ,EAAE,yBAAyB,EACnC,qBAAqB,EAAE,WAAW,CACjD,MAAM,EACN,OAAO,CAAC,eAAe,CAAC,CACzB;IAGH,QAAQ,CAAC,EACP,OAAO,EACP,GAAG,EACH,IAAI,EACJ,SAAS,EACT,MAAM,EACN,cAAc,GACf,EAAE,mBAAmB,GAAG,IAAI;IA6D7B,OAAO,CAAC,iBAAiB;IA2CzB,OAAO,CAAC,mBAAmB;IAO3B,OAAO,CAAC,UAAU;CAGnB"}
@@ -0,0 +1,5 @@
1
+ import { ProcessorFatalError } from './processor-fatal-error.js';
2
+ export declare class IllegalStateException extends ProcessorFatalError {
3
+ constructor(message: string);
4
+ }
5
+ //# sourceMappingURL=illegal-state-exception.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"illegal-state-exception.d.ts","sourceRoot":"","sources":["../../src/engine/illegal-state-exception.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,4BAA4B,CAAC;AAGjE,qBAAa,qBAAsB,SAAQ,mBAAmB;gBAChD,OAAO,EAAE,MAAM;CAI5B"}
@@ -0,0 +1,11 @@
1
+ export * from './contract-bundle.js';
2
+ export * from './contract-loader.js';
3
+ export * from './checkpoint-manager.js';
4
+ export * from './channel-runner.js';
5
+ export * from './scope-executor.js';
6
+ export * from './processor-execution-context.js';
7
+ export * from './termination-service.js';
8
+ export * from './processor-fatal-error.js';
9
+ export * from './run-termination-error.js';
10
+ export * from './processor-engine.js';
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/engine/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAC;AACrC,cAAc,sBAAsB,CAAC;AACrC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kCAAkC,CAAC;AACjD,cAAc,0BAA0B,CAAC;AACzC,cAAc,4BAA4B,CAAC;AAC3C,cAAc,4BAA4B,CAAC;AAC3C,cAAc,uBAAuB,CAAC"}
@@ -0,0 +1,4 @@
1
+ export declare class MustUnderstandFailure extends Error {
2
+ constructor(message?: string);
3
+ }
4
+ //# sourceMappingURL=must-understand-failure.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"must-understand-failure.d.ts","sourceRoot":"","sources":["../../src/engine/must-understand-failure.ts"],"names":[],"mappings":"AAAA,qBAAa,qBAAsB,SAAQ,KAAK;gBAClC,OAAO,CAAC,EAAE,MAAM;CAI7B"}
@@ -0,0 +1,66 @@
1
+ import { Blue, BlueNode } from '@blue-labs/language';
2
+ import { ContractBundle } from './contract-bundle.js';
3
+ import { ContractLoader } from './contract-loader.js';
4
+ import { ProcessorExecutionContext, ExecutionAdapter } from './processor-execution-context.js';
5
+ import { TerminationExecutionAdapter } from './termination-service.js';
6
+ import { DocumentProcessingRuntime } from '../runtime/document-processing-runtime.js';
7
+ import { JsonPatch } from '../model/shared/json-patch.js';
8
+ import { ContractProcessorRegistry } from '../registry/contract-processor-registry.js';
9
+ import { TerminationKind } from '../runtime/scope-runtime-context.js';
10
+ import { DocumentProcessingResult } from '../types/document-processing-result.js';
11
+ interface ExecutionHooks extends ExecutionAdapter, TerminationExecutionAdapter {
12
+ bundleForScope(scopePath: string): ContractBundle | undefined;
13
+ deliverLifecycle(scopePath: string, bundle: ContractBundle | null, event: BlueNode, finalizeAfter: boolean): Promise<void>;
14
+ }
15
+ export declare class ProcessorExecution implements ExecutionHooks {
16
+ private readonly contractLoader;
17
+ private readonly registry;
18
+ private readonly runtimeRef;
19
+ private readonly bundles;
20
+ private readonly pendingTerminations;
21
+ private readonly cutOffScopes;
22
+ private readonly checkpointManager;
23
+ private readonly terminationService;
24
+ private readonly channelRunner;
25
+ private readonly scopeExecutor;
26
+ constructor(contractLoader: ContractLoader, registry: ContractProcessorRegistry, blue: Blue, document: BlueNode);
27
+ initializeScope(scopePath: string, chargeScopeEntry: boolean): Promise<void>;
28
+ loadBundles(scopePath: string): void;
29
+ processExternalEvent(scopePath: string, event: BlueNode): Promise<void>;
30
+ handlePatch(scopePath: string, bundle: ContractBundle, patch: JsonPatch, allowReservedMutation: boolean): Promise<void>;
31
+ createContext(scopePath: string, bundle: ContractBundle, event: BlueNode, allowTerminatedWork?: boolean, allowReservedMutation?: boolean): ProcessorExecutionContext;
32
+ result(): DocumentProcessingResult;
33
+ runtime(): DocumentProcessingRuntime;
34
+ bundleForScope(scopePath: string): ContractBundle | undefined;
35
+ isScopeInactive(scopePath: string): boolean;
36
+ enterGracefulTermination(scopePath: string, bundle: ContractBundle | null, reason: string | null): Promise<void>;
37
+ enterFatalTermination(scopePath: string, bundle: ContractBundle | null, reason: string | null): Promise<void>;
38
+ recordPendingTermination(scopePath: string, kind: TerminationKind, reason: string | null): void;
39
+ clearPendingTermination(scopePath: string): void;
40
+ markCutOff(scopePath: string): Promise<void>;
41
+ deliverLifecycle(scopePath: string, bundle: ContractBundle | null, event: BlueNode, finalizeAfter: boolean): Promise<void>;
42
+ recordLifecycleForBridging(scopePath: string, event: BlueNode): Promise<void>;
43
+ normalizeScope(scopePath: string): string;
44
+ resolvePointer(scopePath: string, relativePointer: string): string;
45
+ private terminate;
46
+ private nodeAt;
47
+ private evaluateChannel;
48
+ private executeHandler;
49
+ private createDocumentUpdateEvent;
50
+ private matchesDocumentUpdate;
51
+ }
52
+ export declare class ProcessorEngine {
53
+ private readonly contractLoader;
54
+ private readonly registry;
55
+ private readonly blue;
56
+ constructor(contractLoader: ContractLoader, registry: ContractProcessorRegistry, blue: Blue);
57
+ initializeDocument(document: BlueNode): Promise<DocumentProcessingResult>;
58
+ processDocument(document: BlueNode, event: BlueNode): Promise<DocumentProcessingResult>;
59
+ isInitialized(document: BlueNode): boolean;
60
+ createExecution(document: BlueNode): ProcessorExecution;
61
+ private run;
62
+ private initializationMarker;
63
+ static nodeAt(root: BlueNode, pointer: string): BlueNode | null;
64
+ }
65
+ export {};
66
+ //# sourceMappingURL=processor-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor-engine.d.ts","sourceRoot":"","sources":["../../src/engine/processor-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAKrD,OAAO,KAAK,EAEV,cAAc,EAEf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,EAAE,yBAAyB,EAAE,MAAM,kCAAkC,CAAC;AAG7E,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,kCAAkC,CAAC;AACzE,OAAO,KAAK,EAAE,2BAA2B,EAAE,MAAM,0BAA0B,CAAC;AAC5E,OAAO,EAEL,KAAK,yBAAyB,EAE/B,MAAM,2CAA2C,CAAC;AACnD,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAQ/D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,4CAA4C,CAAC;AAG5F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAE3E,OAAO,EAAE,wBAAwB,EAAE,MAAM,wCAAwC,CAAC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O,CAAC,MAAM;YAKA,eAAe;YA2Cf,cAAc;IAe5B,OAAO,CAAC,yBAAyB;IAuBjC,OAAO,CAAC,qBAAqB;CAkB9B;AAED,qBAAa,eAAe;IAExB,OAAO,CAAC,QAAQ,CAAC,cAAc;IAC/B,OAAO,CAAC,QAAQ,CAAC,QAAQ;IACzB,OAAO,CAAC,QAAQ,CAAC,IAAI;gBAFJ,cAAc,EAAE,cAAc,EAC9B,QAAQ,EAAE,yBAAyB,EACnC,IAAI,EAAE,IAAI;IAGvB,kBAAkB,CACtB,QAAQ,EAAE,QAAQ,GACjB,OAAO,CAAC,wBAAwB,CAAC;IAU9B,eAAe,CACnB,QAAQ,EAAE,QAAQ,EAClB,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,wBAAwB,CAAC;IAYpC,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,OAAO;IAI1C,eAAe,CAAC,QAAQ,EAAE,QAAQ,GAAG,kBAAkB;YASzC,GAAG;IAuBjB,OAAO,CAAC,oBAAoB;IA0B5B,MAAM,CAAC,MAAM,CAAC,IAAI,EAAE,QAAQ,EAAE,OAAO,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;CAyChE"}
@@ -0,0 +1,38 @@
1
+ import { Blue, BlueNode } from '@blue-labs/language';
2
+ import { ContractBundle } from './contract-bundle.js';
3
+ import { JsonPatch } from '../model/shared/json-patch.js';
4
+ import { DocumentProcessingRuntime } from '../runtime/document-processing-runtime.js';
5
+ import { GasMeter } from '../runtime/gas-meter.js';
6
+ export interface ExecutionAdapter {
7
+ runtime(): DocumentProcessingRuntime;
8
+ isScopeInactive(scopePath: string): boolean;
9
+ handlePatch(scopePath: string, bundle: ContractBundle, patch: JsonPatch, allowReservedMutation: boolean): Promise<void>;
10
+ resolvePointer(scopePath: string, relativePointer: string): string;
11
+ enterGracefulTermination(scopePath: string, bundle: ContractBundle, reason: string | null): Promise<void>;
12
+ enterFatalTermination(scopePath: string, bundle: ContractBundle, reason: string | null): Promise<void>;
13
+ }
14
+ export declare class ProcessorExecutionContext {
15
+ private readonly execution;
16
+ private readonly bundle;
17
+ private readonly scopePathValue;
18
+ private readonly eventNode;
19
+ private readonly allowTerminatedWork;
20
+ private readonly allowReservedMutation;
21
+ constructor(execution: ExecutionAdapter, bundle: ContractBundle, scopePathValue: string, eventNode: BlueNode, allowTerminatedWork: boolean, allowReservedMutation: boolean);
22
+ get scopePath(): string;
23
+ get blue(): Blue;
24
+ gasMeter(): GasMeter;
25
+ event(): BlueNode;
26
+ applyPatch(patch: JsonPatch): Promise<void>;
27
+ emitEvent(emission: BlueNode): void;
28
+ consumeGas(units: number): void;
29
+ throwFatal(reason: string): never;
30
+ resolvePointer(relativePointer: string): string;
31
+ documentAt(absolutePointer: string): BlueNode | null;
32
+ documentContains(absolutePointer: string): boolean;
33
+ private documentNodeAt;
34
+ terminateGracefully(reason: string | null): Promise<void>;
35
+ terminateFatally(reason: string | null): Promise<void>;
36
+ private shouldSkipTerminatedWork;
37
+ }
38
+ //# sourceMappingURL=processor-execution-context.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor-execution-context.d.ts","sourceRoot":"","sources":["../../src/engine/processor-execution-context.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AACrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAG/D,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAEtF,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,yBAAyB,CAAC;AAExD,MAAM,WAAW,gBAAgB;IAC/B,OAAO,IAAI,yBAAyB,CAAC;IACrC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5C,WAAW,CACT,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,EACtB,KAA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AI/C,UAAU,CAAC,eAAe,EAAE,MAAM,GAAG,QAAQ,GAAG,IAAI;IAYpD,gBAAgB,CAAC,eAAe,EAAE,MAAM,GAAG,OAAO;IAgBlD,OAAO,CAAC,cAAc;IAQhB,mBAAmB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAQzD,gBAAgB,CAAC,MAAM,EAAE,MAAM,GAAG,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC;IAQ5D,OAAO,CAAC,wBAAwB;CAMjC"}
@@ -0,0 +1,6 @@
1
+ import { ProcessorError } from '../types/errors.js';
2
+ export declare class ProcessorFatalError extends Error {
3
+ readonly processorError?: ProcessorError | undefined;
4
+ constructor(message: string, processorError?: ProcessorError | undefined);
5
+ }
6
+ //# sourceMappingURL=processor-fatal-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"processor-fatal-error.d.ts","sourceRoot":"","sources":["../../src/engine/processor-fatal-error.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEzD,qBAAa,mBAAoB,SAAQ,KAAK;IAG1C,QAAQ,CAAC,cAAc,CAAC,EAAE,cAAc;gBADxC,OAAO,EAAE,MAAM,EACN,cAAc,CAAC,EAAE,cAAc,YAAA;CAK3C"}
@@ -0,0 +1,5 @@
1
+ export declare class RunTerminationError extends Error {
2
+ readonly fatal: boolean;
3
+ constructor(fatal: boolean);
4
+ }
5
+ //# sourceMappingURL=run-termination-error.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"run-termination-error.d.ts","sourceRoot":"","sources":["../../src/engine/run-termination-error.ts"],"names":[],"mappings":"AAAA,qBAAa,mBAAoB,SAAQ,KAAK;aAChB,KAAK,EAAE,OAAO;gBAAd,KAAK,EAAE,OAAO;CAQ3C"}
@@ -0,0 +1,60 @@
1
+ import { BlueNode } from '@blue-labs/language';
2
+ import { ContractBundle } from './contract-bundle.js';
3
+ import { ChannelRunner } from './channel-runner.js';
4
+ import { ContractLoader } from './contract-loader.js';
5
+ import { JsonPatch } from '../model/shared/json-patch.js';
6
+ import { DocumentUpdateData, DocumentProcessingRuntime } from '../runtime/document-processing-runtime.js';
7
+ export interface ProcessorContext {
8
+ resolvePointer(relativePointer: string): string;
9
+ applyPatch(patch: JsonPatch): Promise<void>;
10
+ }
11
+ export interface ScopeExecutionHooks {
12
+ isScopeInactive(scopePath: string): boolean;
13
+ createContext(scopePath: string, bundle: ContractBundle, event: BlueNode, allowTerminatedWork: boolean, lifecycle?: boolean): ProcessorContext;
14
+ recordLifecycleForBridging(scopePath: string, event: BlueNode): Promise<void>;
15
+ enterFatalTermination(scopePath: string, bundle: ContractBundle | null, reason: string): Promise<void>;
16
+ fatalReason(error: unknown, label: string): string;
17
+ markCutOff(scopePath: string): Promise<void>;
18
+ }
19
+ export interface ScopeExecutorOptions {
20
+ runtime: DocumentProcessingRuntime;
21
+ contractLoader: ContractLoader;
22
+ channelRunner: ChannelRunner;
23
+ bundles: Map<string, ContractBundle>;
24
+ hooks: ScopeExecutionHooks;
25
+ blueId: (node: BlueNode) => string;
26
+ nodeAt(scopePath: string): BlueNode | null;
27
+ createDocumentUpdateEvent(data: DocumentUpdateData, scopePath: string): BlueNode;
28
+ matchesDocumentUpdate(scopePath: string, watchPath: string | null | undefined, changedPath: string): boolean;
29
+ }
30
+ export declare class ScopeExecutor {
31
+ private readonly runtime;
32
+ private readonly contractLoader;
33
+ private readonly channelRunner;
34
+ private readonly bundles;
35
+ private readonly hooks;
36
+ private readonly blueId;
37
+ private readonly nodeAt;
38
+ private readonly createDocumentUpdateEvent;
39
+ private readonly matchesDocumentUpdate;
40
+ constructor(options: ScopeExecutorOptions);
41
+ initializeScope(scopePath: string, chargeScopeEntry: boolean): Promise<void>;
42
+ loadBundles(scopePath: string): void;
43
+ processExternalEvent(scopePath: string, event: BlueNode): Promise<void>;
44
+ handlePatch(scopePath: string, bundle: ContractBundle, patch: JsonPatch, allowReservedMutation: boolean): Promise<void>;
45
+ deliverLifecycle(scopePath: string, bundle: ContractBundle | null, event: BlueNode, finalizeAfter: boolean): Promise<void>;
46
+ private processEmbeddedChildren;
47
+ private refreshBundle;
48
+ private nextEmbeddedPath;
49
+ private loadBundle;
50
+ private addInitializationMarker;
51
+ private finalizeScope;
52
+ private bridgeEmbeddedEmissions;
53
+ private drainTriggeredQueue;
54
+ private validatePatchBoundary;
55
+ private enforceReservedKeyWriteProtection;
56
+ private markCutOffChildrenIfNeeded;
57
+ private hasInitializationMarker;
58
+ private createLifecycleEvent;
59
+ }
60
+ //# sourceMappingURL=scope-executor.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"scope-executor.d.ts","sourceRoot":"","sources":["../../src/engine/scope-executor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAE/C,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAK3D,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,+BAA+B,CAAC;AAC/D,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,2CAA2C,CAAC;AACpF,OAAO,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AA6BtF,MAAM,WAAW,gBAAgB;IAC/B,cAAc,CAAC,eAAe,EAAE,MAAM,GAAG,MAAM,CAAC;IAChD,UAAU,CAAC,KAAK,EAAE,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;CAC7C;AAED,MAAM,WAAW,mBAAmB;IAClC,eAAe,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5C,aAAa,CACX,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,QAAQ,EACf,mBAAmB,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AC,QAAQ,CAAC,KAAK,CAAsB;IAC5C,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA6B;IACpD,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAyC;IAChE,OAAO,CAAC,QAAQ,CAAC,yBAAyB,CAG5B;IACd,OAAO,CAAC,QAAQ,CAAC,qBAAqB,CAIzB;gBAED,OAAO,EAAE,oBAAoB;IAYnC,eAAe,CACnB,SAAS,EAAE,MAAM,EACjB,gBAAgB,EAAE,OAAO,GACxB,OAAO,CAAC,IAAI,CAAC;IAkEhB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI;IAgB9B,oBAAoB,CACxB,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,QAAQ,GACd,OAAO,CAAC,IAAI,CAAC;IAkCV,WAAW,CACf,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,EACtB,KAAK,EAAE,SAAS,EAChB,qBAAqB,EAAE,OAAO,GAC7B,OAAO,CAAC,IAAI,CAAC;IA6FV,gBAAgB,CACpB,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,GAAG,IAAI,EAC7B,KAAK,EAAE,QAAQ,EACf,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC,IAAI,CAAC;YA0BF,uBAAuB;IA+BrC,OAAO,CAAC,aAAa;IAYrB,OAAO,CAAC,gBAAgB;IAexB,OAAO,CAAC,UAAU;YAsBJ,uBAAuB;YAevB,aAAa;YAWb,uBAAuB;YAgDvB,mBAAmB;IAyCjC,OAAO,CAAC,qBAAqB;IAiC7B,OAAO,CAAC,iCAAiC;YA0B3B,0BAA0B;IAoBxC,OAAO,CAAC,uBAAuB;IAkB/B,OAAO,CAAC,oBAAoB;CAQ7B"}
@@ -0,0 +1,17 @@
1
+ import { BlueNode } from '@blue-labs/language';
2
+ import { ContractBundle } from './contract-bundle.js';
3
+ import { DocumentProcessingRuntime } from '../runtime/document-processing-runtime.js';
4
+ import { TerminationKind } from '../runtime/scope-runtime-context.js';
5
+ export interface TerminationExecutionAdapter {
6
+ recordPendingTermination(scopePath: string, kind: TerminationKind, reason: string | null): void;
7
+ normalizeScope(scopePath: string): string;
8
+ bundleForScope(scopePath: string): ContractBundle | undefined;
9
+ deliverLifecycle(scopePath: string, bundle: ContractBundle | null, event: BlueNode, finalizeAfter: boolean): Promise<void>;
10
+ clearPendingTermination(scopePath: string): void;
11
+ }
12
+ export declare class TerminationService {
13
+ private readonly runtime;
14
+ constructor(runtime: DocumentProcessingRuntime);
15
+ terminateScope(execution: TerminationExecutionAdapter, scopePath: string, bundle: ContractBundle | null, kind: TerminationKind, reason: string | null): Promise<void>;
16
+ }
17
+ //# sourceMappingURL=termination-service.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"termination-service.d.ts","sourceRoot":"","sources":["../../src/engine/termination-service.ts"],"names":[],"mappings":"AAAA,OAAO,EAAQ,QAAQ,EAAE,MAAM,qBAAqB,CAAC;AAGrD,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AAC3D,OAAO,KAAK,EAAE,yBAAyB,EAAE,MAAM,2CAA2C,CAAC;AAG3F,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAO3E,MAAM,WAAW,2BAA2B;IAC1C,wBAAwB,CACtB,SAAS,EAAE,MAAM,EACjB,IAAI,EAAE,eAAe,EACrB,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,IAAI,CAAC;IACR,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAAC;IAC1C,cAAc,CAAC,SAAS,EAAE,MAAM,GAAG,cAAc,GAAG,SAAS,CAAC;IAC9D,gBAAgB,CACd,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,GAAG,IAAI,EAC7B,KAAK,EAAE,QAAQ,EACf,aAAa,EAAE,OAAO,GACrB,OAAO,CAAC,IAAI,CAAC,CAAC;IACjB,uBAAuB,CAAC,SAAS,EAAE,MAAM,GAAG,IAAI,CAAC;CAClD;AAED,qBAAa,kBAAkB;IACjB,OAAO,CAAC,QAAQ,CAAC,OAAO;gBAAP,OAAO,EAAE,yBAAyB;IAEzD,cAAc,CAClB,SAAS,EAAE,2BAA2B,EACtC,SAAS,EAAE,MAAM,EACjB,MAAM,EAAE,cAAc,GAAG,IAAI,EAC7B,IAAI,EAAE,eAAe,EACrB,MAAM,EAAE,MAAM,GAAG,IAAI,GACpB,OAAO,CAAC,IAAI,CAAC;CAsCjB"}
package/dist/index.d.ts CHANGED
@@ -1,7 +1,15 @@
1
- export * from './BlueDocumentProcessor';
2
- export * from './processors';
3
- export * from './types';
4
- export * from './utils/exceptions';
5
- export { collectEmbeddedPathSpecs } from './utils/document';
6
- export * from './merge';
1
+ export * from './types/index.js';
2
+ export * from './constants/processor-contract-constants.js';
3
+ export * from './constants/processor-pointer-constants.js';
4
+ export * from './util/pointer-utils.js';
5
+ export * from './util/node-canonicalizer.js';
6
+ export * from './util/expression/quickjs-evaluator.js';
7
+ export * from './util/expression/exceptions.js';
8
+ export * from './util/expression/quickjs-expression-utils.js';
9
+ export * from './model/index.js';
10
+ export * from './registry/index.js';
11
+ export * from './engine/index.js';
12
+ export * from './runtime/index.js';
13
+ export * from './api/document-processor.js';
14
+ export * from './merge/index.js';
7
15
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAC;AACxC,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,OAAO,EAAE,wBAAwB,EAAE,MAAM,kBAAkB,CAAC;AAC5D,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,kBAAkB,CAAC;AACjC,cAAc,6CAA6C,CAAC;AAC5D,cAAc,4CAA4C,CAAC;AAC3D,cAAc,yBAAyB,CAAC;AACxC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,wCAAwC,CAAC;AACvD,cAAc,iCAAiC,CAAC;AAChD,cAAc,+CAA+C,CAAC;AAC9D,cAAc,kBAAkB,CAAC;AACjC,cAAc,qBAAqB,CAAC;AACpC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,6BAA6B,CAAC;AAC5C,cAAc,kBAAkB,CAAC"}