@brud/kernel 0.0.0-stage → 0.0.1

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 (278) hide show
  1. package/LICENSE +201 -0
  2. package/README.md +63 -2
  3. package/dist/index.d.ts +15 -0
  4. package/dist/index.js +13 -0
  5. package/dist/serviceModules/events.d.ts +1 -0
  6. package/dist/serviceModules/events.js +1 -0
  7. package/dist/serviceModules/exposedApiRegistry.d.ts +1 -0
  8. package/dist/serviceModules/exposedApiRegistry.js +1 -0
  9. package/dist/serviceModules/identityRegistry.d.ts +1 -0
  10. package/dist/serviceModules/identityRegistry.js +1 -0
  11. package/dist/serviceModules/interception.d.ts +1 -0
  12. package/dist/serviceModules/interception.js +1 -0
  13. package/dist/serviceModules/parser.d.ts +1 -0
  14. package/dist/serviceModules/parser.js +1 -0
  15. package/dist/serviceModules/router.d.ts +1 -0
  16. package/dist/serviceModules/router.js +1 -0
  17. package/dist/serviceModules/wasmCage.d.ts +1 -0
  18. package/dist/serviceModules/wasmCage.js +1 -0
  19. package/dist/services/Events/contracts/IEventsService.d.ts +64 -0
  20. package/dist/services/Events/contracts/IEventsService.js +1 -0
  21. package/dist/services/Events/contracts/errors.d.ts +31 -0
  22. package/dist/services/Events/contracts/errors.js +40 -0
  23. package/dist/services/Events/contracts/index.d.ts +3 -0
  24. package/dist/services/Events/contracts/index.js +3 -0
  25. package/dist/services/Events/contracts/tokens.d.ts +2 -0
  26. package/dist/services/Events/contracts/tokens.js +2 -0
  27. package/dist/services/Events/descriptor/EventsDescriptor.d.ts +9 -0
  28. package/dist/services/Events/descriptor/EventsDescriptor.js +56 -0
  29. package/dist/services/Events/descriptor/tokens.d.ts +1 -0
  30. package/dist/services/Events/descriptor/tokens.js +1 -0
  31. package/dist/services/Events/index.d.ts +4 -0
  32. package/dist/services/Events/index.js +4 -0
  33. package/dist/services/Events/orchestrator/EventsService.d.ts +51 -0
  34. package/dist/services/Events/orchestrator/EventsService.js +339 -0
  35. package/dist/services/Events/orchestrator/index.d.ts +2 -0
  36. package/dist/services/Events/orchestrator/index.js +2 -0
  37. package/dist/services/Events/orchestrator/limits.d.ts +22 -0
  38. package/dist/services/Events/orchestrator/limits.js +33 -0
  39. package/dist/services/Events/serviceModule.d.ts +2 -0
  40. package/dist/services/Events/serviceModule.js +5 -0
  41. package/dist/services/ExposedApiRegistry/contracts/IExposedApiRegistry.d.ts +44 -0
  42. package/dist/services/ExposedApiRegistry/contracts/IExposedApiRegistry.js +1 -0
  43. package/dist/services/ExposedApiRegistry/contracts/errors.d.ts +132 -0
  44. package/dist/services/ExposedApiRegistry/contracts/errors.js +195 -0
  45. package/dist/services/ExposedApiRegistry/contracts/index.d.ts +9 -0
  46. package/dist/services/ExposedApiRegistry/contracts/index.js +4 -0
  47. package/dist/services/ExposedApiRegistry/contracts/policy.d.ts +90 -0
  48. package/dist/services/ExposedApiRegistry/contracts/policy.js +169 -0
  49. package/dist/services/ExposedApiRegistry/contracts/registrant.d.ts +37 -0
  50. package/dist/services/ExposedApiRegistry/contracts/registrant.js +36 -0
  51. package/dist/services/ExposedApiRegistry/contracts/types.d.ts +112 -0
  52. package/dist/services/ExposedApiRegistry/contracts/types.js +73 -0
  53. package/dist/services/ExposedApiRegistry/descriptor/ExposedApiRegistryDescriptor.d.ts +44 -0
  54. package/dist/services/ExposedApiRegistry/descriptor/ExposedApiRegistryDescriptor.js +58 -0
  55. package/dist/services/ExposedApiRegistry/descriptor/tokens.d.ts +8 -0
  56. package/dist/services/ExposedApiRegistry/descriptor/tokens.js +8 -0
  57. package/dist/services/ExposedApiRegistry/index.d.ts +6 -0
  58. package/dist/services/ExposedApiRegistry/index.js +5 -0
  59. package/dist/services/ExposedApiRegistry/orchestrator/ExposedApiRegistryService.d.ts +61 -0
  60. package/dist/services/ExposedApiRegistry/orchestrator/ExposedApiRegistryService.js +407 -0
  61. package/dist/services/ExposedApiRegistry/orchestrator/index.d.ts +2 -0
  62. package/dist/services/ExposedApiRegistry/orchestrator/index.js +1 -0
  63. package/dist/services/ExposedApiRegistry/serviceModule.d.ts +10 -0
  64. package/dist/services/ExposedApiRegistry/serviceModule.js +20 -0
  65. package/dist/services/ExposedApiRegistry/storage/protection.d.ts +21 -0
  66. package/dist/services/ExposedApiRegistry/storage/protection.js +35 -0
  67. package/dist/services/ExposedApiRegistry/storage/scopeRecord.d.ts +45 -0
  68. package/dist/services/ExposedApiRegistry/storage/scopeRecord.js +178 -0
  69. package/dist/services/IdentityRegistry/contracts/errors.d.ts +88 -0
  70. package/dist/services/IdentityRegistry/contracts/errors.js +128 -0
  71. package/dist/services/IdentityRegistry/contracts/index.d.ts +5 -0
  72. package/dist/services/IdentityRegistry/contracts/index.js +3 -0
  73. package/dist/services/IdentityRegistry/contracts/types.d.ts +77 -0
  74. package/dist/services/IdentityRegistry/contracts/types.js +18 -0
  75. package/dist/services/IdentityRegistry/descriptor/descriptor.d.ts +36 -0
  76. package/dist/services/IdentityRegistry/descriptor/descriptor.js +44 -0
  77. package/dist/services/IdentityRegistry/descriptor/tokens.d.ts +8 -0
  78. package/dist/services/IdentityRegistry/descriptor/tokens.js +8 -0
  79. package/dist/services/IdentityRegistry/index.d.ts +11 -0
  80. package/dist/services/IdentityRegistry/index.js +6 -0
  81. package/dist/services/IdentityRegistry/orchestrator/IdentityRegistryService.d.ts +47 -0
  82. package/dist/services/IdentityRegistry/orchestrator/IdentityRegistryService.js +240 -0
  83. package/dist/services/IdentityRegistry/serviceModule.d.ts +10 -0
  84. package/dist/services/IdentityRegistry/serviceModule.js +24 -0
  85. package/dist/services/IdentityRegistry/storage/registryDocument.d.ts +55 -0
  86. package/dist/services/IdentityRegistry/storage/registryDocument.js +235 -0
  87. package/dist/services/Interception/contracts/IInterceptionService.d.ts +65 -0
  88. package/dist/services/Interception/contracts/IInterceptionService.js +1 -0
  89. package/dist/services/Interception/contracts/errors.d.ts +26 -0
  90. package/dist/services/Interception/contracts/errors.js +35 -0
  91. package/dist/services/Interception/contracts/index.d.ts +3 -0
  92. package/dist/services/Interception/contracts/index.js +3 -0
  93. package/dist/services/Interception/contracts/tokens.d.ts +2 -0
  94. package/dist/services/Interception/contracts/tokens.js +2 -0
  95. package/dist/services/Interception/descriptor/InterceptionDescriptor.d.ts +9 -0
  96. package/dist/services/Interception/descriptor/InterceptionDescriptor.js +49 -0
  97. package/dist/services/Interception/descriptor/tokens.d.ts +1 -0
  98. package/dist/services/Interception/descriptor/tokens.js +1 -0
  99. package/dist/services/Interception/index.d.ts +4 -0
  100. package/dist/services/Interception/index.js +4 -0
  101. package/dist/services/Interception/orchestrator/InterceptionService.d.ts +32 -0
  102. package/dist/services/Interception/orchestrator/InterceptionService.js +180 -0
  103. package/dist/services/Interception/orchestrator/index.d.ts +1 -0
  104. package/dist/services/Interception/orchestrator/index.js +1 -0
  105. package/dist/services/Interception/serviceModule.d.ts +2 -0
  106. package/dist/services/Interception/serviceModule.js +5 -0
  107. package/dist/services/Parser/contracts/IParserService.d.ts +21 -0
  108. package/dist/services/Parser/contracts/IParserService.js +1 -0
  109. package/dist/services/Parser/contracts/errors.d.ts +25 -0
  110. package/dist/services/Parser/contracts/errors.js +33 -0
  111. package/dist/services/Parser/contracts/index.d.ts +4 -0
  112. package/dist/services/Parser/contracts/index.js +1 -0
  113. package/dist/services/Parser/contracts/types.d.ts +42 -0
  114. package/dist/services/Parser/contracts/types.js +1 -0
  115. package/dist/services/Parser/descriptor/ParserDescriptor.d.ts +23 -0
  116. package/dist/services/Parser/descriptor/ParserDescriptor.js +50 -0
  117. package/dist/services/Parser/descriptor/tokens.d.ts +8 -0
  118. package/dist/services/Parser/descriptor/tokens.js +8 -0
  119. package/dist/services/Parser/index.d.ts +8 -0
  120. package/dist/services/Parser/index.js +8 -0
  121. package/dist/services/Parser/orchestrator/ParserService.d.ts +20 -0
  122. package/dist/services/Parser/orchestrator/ParserService.js +105 -0
  123. package/dist/services/Parser/orchestrator/index.d.ts +1 -0
  124. package/dist/services/Parser/orchestrator/index.js +1 -0
  125. package/dist/services/Parser/parser/indexSynthesis.d.ts +11 -0
  126. package/dist/services/Parser/parser/indexSynthesis.js +13 -0
  127. package/dist/services/Parser/parser/parameters.d.ts +14 -0
  128. package/dist/services/Parser/parser/parameters.js +89 -0
  129. package/dist/services/Parser/parser/scanner.d.ts +48 -0
  130. package/dist/services/Parser/parser/scanner.js +156 -0
  131. package/dist/services/Parser/parser/syntax.d.ts +30 -0
  132. package/dist/services/Parser/parser/syntax.js +34 -0
  133. package/dist/services/Parser/serviceModule.d.ts +2 -0
  134. package/dist/services/Parser/serviceModule.js +5 -0
  135. package/dist/services/Router/bootOptions.d.ts +2 -0
  136. package/dist/services/Router/bootOptions.js +2 -0
  137. package/dist/services/Router/contracts/IRouterService.d.ts +43 -0
  138. package/dist/services/Router/contracts/IRouterService.js +1 -0
  139. package/dist/services/Router/contracts/caller.d.ts +6 -0
  140. package/dist/services/Router/contracts/caller.js +6 -0
  141. package/dist/services/Router/contracts/errors.d.ts +56 -0
  142. package/dist/services/Router/contracts/errors.js +75 -0
  143. package/dist/services/Router/contracts/index.d.ts +8 -0
  144. package/dist/services/Router/contracts/index.js +4 -0
  145. package/dist/services/Router/contracts/kind.d.ts +7 -0
  146. package/dist/services/Router/contracts/kind.js +10 -0
  147. package/dist/services/Router/contracts/registrant.d.ts +23 -0
  148. package/dist/services/Router/contracts/registrant.js +13 -0
  149. package/dist/services/Router/contracts/types.d.ts +90 -0
  150. package/dist/services/Router/contracts/types.js +1 -0
  151. package/dist/services/Router/descriptor/RouterDescriptor.d.ts +32 -0
  152. package/dist/services/Router/descriptor/RouterDescriptor.js +92 -0
  153. package/dist/services/Router/descriptor/tokens.d.ts +9 -0
  154. package/dist/services/Router/descriptor/tokens.js +9 -0
  155. package/dist/services/Router/index.d.ts +4 -0
  156. package/dist/services/Router/index.js +4 -0
  157. package/dist/services/Router/orchestrator/RouterService.d.ts +74 -0
  158. package/dist/services/Router/orchestrator/RouterService.js +332 -0
  159. package/dist/services/Router/orchestrator/index.d.ts +2 -0
  160. package/dist/services/Router/orchestrator/index.js +1 -0
  161. package/dist/services/Router/serviceModule.d.ts +4 -0
  162. package/dist/services/Router/serviceModule.js +22 -0
  163. package/dist/services/WasmCage/index.d.ts +7 -0
  164. package/dist/services/WasmCage/index.js +4 -0
  165. package/dist/services/WasmCage/scripts/prepin.d.ts +1 -0
  166. package/dist/services/WasmCage/scripts/prepin.js +38 -0
  167. package/dist/services/WasmCage/serviceModule.d.ts +12 -0
  168. package/dist/services/WasmCage/serviceModule.js +18 -0
  169. package/dist/services/WasmCage/src/caged.d.ts +104 -0
  170. package/dist/services/WasmCage/src/caged.js +381 -0
  171. package/dist/services/WasmCage/src/descriptor.d.ts +47 -0
  172. package/dist/services/WasmCage/src/descriptor.js +56 -0
  173. package/dist/services/WasmCage/src/native.d.ts +29 -0
  174. package/dist/services/WasmCage/src/native.js +66 -0
  175. package/dist/services/WasmCage/src/nativeDigests.d.ts +9 -0
  176. package/dist/services/WasmCage/src/nativeDigests.js +15 -0
  177. package/dist/services/WasmCage/src/package.d.ts +36 -0
  178. package/dist/services/WasmCage/src/package.js +122 -0
  179. package/dist/services/shared/canonicalJson.d.ts +29 -0
  180. package/dist/services/shared/canonicalJson.js +93 -0
  181. package/dist/services/shared/documentStore.d.ts +16 -0
  182. package/dist/services/shared/documentStore.js +98 -0
  183. package/dist/src/bootstrap/bootKernelInternal.d.ts +18 -0
  184. package/dist/src/bootstrap/bootKernelInternal.js +420 -0
  185. package/dist/src/bootstrap/bootTypes.d.ts +89 -0
  186. package/dist/src/bootstrap/bootTypes.js +1 -0
  187. package/dist/src/bootstrap/config/index.d.ts +3 -0
  188. package/dist/src/bootstrap/config/index.js +2 -0
  189. package/dist/src/bootstrap/config/integrity.d.ts +34 -0
  190. package/dist/src/bootstrap/config/integrity.js +79 -0
  191. package/dist/src/bootstrap/config/parse.d.ts +15 -0
  192. package/dist/src/bootstrap/config/parse.js +81 -0
  193. package/dist/src/bootstrap/config/pathWriteGuard.d.ts +20 -0
  194. package/dist/src/bootstrap/config/pathWriteGuard.js +349 -0
  195. package/dist/src/bootstrap/config/types.d.ts +41 -0
  196. package/dist/src/bootstrap/config/types.js +15 -0
  197. package/dist/src/bootstrap/hardcore.d.ts +212 -0
  198. package/dist/src/bootstrap/hardcore.js +312 -0
  199. package/dist/src/bootstrap/hardcoreServices.d.ts +10 -0
  200. package/dist/src/bootstrap/hardcoreServices.js +258 -0
  201. package/dist/src/bootstrap/index.d.ts +8 -0
  202. package/dist/src/bootstrap/index.js +5 -0
  203. package/dist/src/bootstrap/packageRequirements.d.ts +26 -0
  204. package/dist/src/bootstrap/packageRequirements.js +52 -0
  205. package/dist/src/contracts/accessBroker.d.ts +53 -0
  206. package/dist/src/contracts/accessBroker.js +1 -0
  207. package/dist/src/contracts/brudOperation.d.ts +20 -0
  208. package/dist/src/contracts/brudOperation.js +20 -0
  209. package/dist/src/contracts/callChain.d.ts +161 -0
  210. package/dist/src/contracts/callChain.js +19 -0
  211. package/dist/src/contracts/capability.d.ts +26 -0
  212. package/dist/src/contracts/capability.js +26 -0
  213. package/dist/src/contracts/container.d.ts +17 -0
  214. package/dist/src/contracts/container.js +8 -0
  215. package/dist/src/contracts/context.d.ts +19 -0
  216. package/dist/src/contracts/context.js +1 -0
  217. package/dist/src/contracts/contextContract.d.ts +129 -0
  218. package/dist/src/contracts/contextContract.js +285 -0
  219. package/dist/src/contracts/dispatchView.d.ts +21 -0
  220. package/dist/src/contracts/dispatchView.js +1 -0
  221. package/dist/src/contracts/handler.d.ts +28 -0
  222. package/dist/src/contracts/handler.js +1 -0
  223. package/dist/src/contracts/index.d.ts +25 -0
  224. package/dist/src/contracts/index.js +8 -0
  225. package/dist/src/contracts/kernel.d.ts +60 -0
  226. package/dist/src/contracts/kernel.js +1 -0
  227. package/dist/src/contracts/lifecycle.d.ts +59 -0
  228. package/dist/src/contracts/lifecycle.js +1 -0
  229. package/dist/src/contracts/manifest.d.ts +145 -0
  230. package/dist/src/contracts/manifest.js +295 -0
  231. package/dist/src/contracts/pipeline.d.ts +8 -0
  232. package/dist/src/contracts/pipeline.js +1 -0
  233. package/dist/src/contracts/policy.d.ts +75 -0
  234. package/dist/src/contracts/policy.js +77 -0
  235. package/dist/src/contracts/registry.d.ts +7 -0
  236. package/dist/src/contracts/registry.js +1 -0
  237. package/dist/src/contracts/serviceDescriptor.d.ts +67 -0
  238. package/dist/src/contracts/serviceDescriptor.js +1 -0
  239. package/dist/src/contracts/serviceToken.d.ts +36 -0
  240. package/dist/src/contracts/serviceToken.js +16 -0
  241. package/dist/src/engine/BrudKernel.d.ts +118 -0
  242. package/dist/src/engine/BrudKernel.js +366 -0
  243. package/dist/src/engine/ExecutionPipeline.d.ts +13 -0
  244. package/dist/src/engine/ExecutionPipeline.js +62 -0
  245. package/dist/src/engine/KernelAccessBroker.d.ts +47 -0
  246. package/dist/src/engine/KernelAccessBroker.js +107 -0
  247. package/dist/src/engine/KernelRegistry.d.ts +14 -0
  248. package/dist/src/engine/KernelRegistry.js +33 -0
  249. package/dist/src/engine/OperationRegistry.d.ts +9 -0
  250. package/dist/src/engine/OperationRegistry.js +18 -0
  251. package/dist/src/engine/ServiceContainer.d.ts +13 -0
  252. package/dist/src/engine/ServiceContainer.js +53 -0
  253. package/dist/src/engine/callChain.d.ts +68 -0
  254. package/dist/src/engine/callChain.js +180 -0
  255. package/dist/src/engine/dag.d.ts +2 -0
  256. package/dist/src/engine/dag.js +34 -0
  257. package/dist/src/engine/errors.d.ts +26 -0
  258. package/dist/src/engine/errors.js +52 -0
  259. package/dist/src/engine/index.d.ts +11 -0
  260. package/dist/src/engine/index.js +8 -0
  261. package/dist/src/engine/state.d.ts +1 -0
  262. package/dist/src/engine/state.js +1 -0
  263. package/dist/src/validation/jsonSchema/compile.d.ts +8 -0
  264. package/dist/src/validation/jsonSchema/compile.js +386 -0
  265. package/dist/src/validation/jsonSchema/index.d.ts +3 -0
  266. package/dist/src/validation/jsonSchema/index.js +2 -0
  267. package/dist/src/validation/jsonSchema/jsonValue.d.ts +29 -0
  268. package/dist/src/validation/jsonSchema/jsonValue.js +190 -0
  269. package/dist/src/validation/jsonSchema/pattern.d.ts +28 -0
  270. package/dist/src/validation/jsonSchema/pattern.js +155 -0
  271. package/dist/src/validation/jsonSchema/types.d.ts +71 -0
  272. package/dist/src/validation/jsonSchema/types.js +15 -0
  273. package/package.json +59 -4
  274. package/services/WasmCage/native/brud-wasm-cage.darwin-arm64.node +0 -0
  275. package/services/WasmCage/native/brud-wasm-cage.darwin-x64.node +0 -0
  276. package/services/WasmCage/native/brud-wasm-cage.linux-arm64-gnu.node +0 -0
  277. package/services/WasmCage/native/brud-wasm-cage.linux-x64-gnu.node +0 -0
  278. package/services/WasmCage/native/brud-wasm-cage.win32-x64-msvc.node +0 -0
@@ -0,0 +1,90 @@
1
+ import type { BrudOperationKind } from '../../../src/contracts/brudOperation.js';
2
+ import type { OperationResult } from '../../../src/contracts/handler.js';
3
+ import type { BrudOperation, BrudParseFailure } from '../../Parser/contracts/index.js';
4
+ /** Terminal status of one routed operation. */
5
+ export type RoutedOperationStatus = 'success' | 'failed' | 'skipped' | 'aborted' | 'kind_not_registered';
6
+ /**
7
+ * The real caller of a routed operation, captured by the Router from the
8
+ * kernel call chain (delegation by the owner). Never supplied by the caller.
9
+ */
10
+ export interface BrudDispatchCaller {
11
+ readonly identity: string | null;
12
+ readonly callerClass: string;
13
+ readonly official: boolean;
14
+ readonly capabilities: readonly string[];
15
+ readonly origin: string;
16
+ }
17
+ /** Context handed to a kind owner's dispatch exposure for one operation. */
18
+ export interface BrudDispatchContext {
19
+ /** Kernel-derived caller of the route request. */
20
+ readonly caller: BrudDispatchCaller;
21
+ /** Cancellation signal, when the transport supplied one. */
22
+ readonly signal?: AbortSignal;
23
+ /** Validate only; do not execute. */
24
+ readonly dryRun?: boolean;
25
+ }
26
+ /**
27
+ * Options for one route request. Caller identity and capabilities are not
28
+ * options: the Router takes them from the kernel call chain.
29
+ */
30
+ export interface BrudRouteOptions {
31
+ readonly signal?: AbortSignal;
32
+ readonly stopOnFailure?: boolean;
33
+ readonly dryRun?: boolean;
34
+ readonly maxOperations?: number;
35
+ }
36
+ /** Outcome of routing one parsed operation. */
37
+ export interface RoutedOperationOutcome {
38
+ /** Synthesized 1-based document index. */
39
+ readonly operationIndex: string;
40
+ /** Zero-based document position. */
41
+ readonly sequence: number;
42
+ /** Shared kind token. */
43
+ readonly kind: BrudOperationKind;
44
+ /** Operation name written on the header. */
45
+ readonly name: string;
46
+ /** Terminal status of this operation. */
47
+ readonly status: RoutedOperationStatus;
48
+ /** Target result, when a target ran. */
49
+ readonly result?: OperationResult;
50
+ /** Diagnostic message for routing-level failures. */
51
+ readonly error?: string;
52
+ }
53
+ /** Aggregate status of a routed document. */
54
+ export type RouteStatus = 'success' | 'partial' | 'failed' | 'empty';
55
+ /** Result of parsing and routing one document. */
56
+ export interface BrudRouteResult {
57
+ readonly status: RouteStatus;
58
+ readonly operations: readonly RoutedOperationOutcome[];
59
+ readonly parseError?: BrudParseFailure;
60
+ readonly dispatched: number;
61
+ readonly failed: number;
62
+ }
63
+ /**
64
+ * A kind and the exposure that dispatches it, registered at boot. Each
65
+ * operation is dispatched through that exposure, which is looked up on the
66
+ * kernel call chain.
67
+ */
68
+ export interface BrudRouteRegistration {
69
+ readonly kind: BrudOperationKind;
70
+ /** Name of the owner's dispatch exposure (`name`, major `version`). */
71
+ readonly exposure: string;
72
+ readonly version?: number;
73
+ /** Public description declared with the kind. */
74
+ readonly description?: string;
75
+ /** Public operations declared with the kind. */
76
+ readonly operations?: Readonly<Record<string, {
77
+ readonly description?: string;
78
+ readonly input?: Readonly<Record<string, unknown>>;
79
+ }>>;
80
+ }
81
+ /** One kind as remote clients see it: the public vocabulary of Brud syntax. */
82
+ export interface BrudKindInfo {
83
+ readonly kind: BrudOperationKind;
84
+ readonly description?: string;
85
+ readonly operations?: BrudRouteRegistration['operations'];
86
+ }
87
+ /** The surface a kind owner's dispatch exposure must provide. */
88
+ export interface BrudKindDispatcher {
89
+ dispatch(operation: BrudOperation, context: BrudDispatchContext): Promise<OperationResult> | OperationResult;
90
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,32 @@
1
+ import type { ServiceTier } from '../../../src/contracts/lifecycle.js';
2
+ import type { ServiceDescriptor } from '../../../src/contracts/serviceDescriptor.js';
3
+ import type { IBrudParserService } from '../../Parser/contracts/IParserService.js';
4
+ import type { IRouterService } from '../contracts/IRouterService.js';
5
+ import { RouterService } from '../orchestrator/index.js';
6
+ /** The Router's v1 entry exposure. */
7
+ export declare const ROUTER_EXPOSURE = "syntax.route";
8
+ /** Tier assigned to the Router descriptor. */
9
+ export declare const ROUTER_SERVICE_TIER: ServiceTier;
10
+ /** Contract version declared for the Router interface. */
11
+ export declare const ROUTER_CONTRACT_VERSION = "2.0.0";
12
+ /** Methods declared for the Router interface. */
13
+ export declare const ROUTER_CONTRACT_METHODS: readonly ["register", "closeRegistration", "isRegistrationOpen", "registeredKinds", "kinds", "route", "dispatch"];
14
+ /** Configuration for {@link createRouterDescriptor}. */
15
+ export interface RouterDescriptorOptions {
16
+ /** Parser override for standalone construction and tests. */
17
+ readonly parser?: IBrudParserService;
18
+ /** Observation hook used by the standard composition to capture the instance. */
19
+ readonly onConstruct?: (service: RouterService) => void;
20
+ }
21
+ /**
22
+ * Builds the `brud.core.router` service descriptor.
23
+ *
24
+ * It declares the syntax service token as an ordering dependency. The syntax
25
+ * service is resolved lazily through the broker on the first `route` call,
26
+ * because the broker serves requests only once the kernel is RUNNING.
27
+ *
28
+ * @param options - Parser override and construction hook.
29
+ * @returns A core-tier descriptor for `brud.core.router`.
30
+ */
31
+ export declare function createRouterDescriptor(options?: RouterDescriptorOptions): ServiceDescriptor<IRouterService, RouterService>;
32
+ export declare const RouterDescriptor: ServiceDescriptor<IRouterService, RouterService>;
@@ -0,0 +1,92 @@
1
+ import { ParserToken } from '../../Parser/descriptor/tokens.js';
2
+ import { ROUTER_CALLER_ID } from '../contracts/caller.js';
3
+ import { RouterService } from '../orchestrator/index.js';
4
+ import { RouterToken } from './tokens.js';
5
+ import { withExposureBindings } from '../../ExposedApiRegistry/contracts/registrant.js';
6
+ import { ExposedApiRegistryToken } from '../../ExposedApiRegistry/descriptor/tokens.js';
7
+ /** The Router's v1 entry exposure. */
8
+ export const ROUTER_EXPOSURE = 'syntax.route';
9
+ /** Tier assigned to the Router descriptor. */
10
+ export const ROUTER_SERVICE_TIER = 'core';
11
+ /** Contract version declared for the Router interface. */
12
+ export const ROUTER_CONTRACT_VERSION = '2.0.0';
13
+ /** Methods declared for the Router interface. */
14
+ export const ROUTER_CONTRACT_METHODS = [
15
+ 'register',
16
+ 'closeRegistration',
17
+ 'isRegistrationOpen',
18
+ 'registeredKinds',
19
+ 'kinds',
20
+ 'route',
21
+ 'dispatch',
22
+ ];
23
+ /**
24
+ * Builds the `brud.core.router` service descriptor.
25
+ *
26
+ * It declares the syntax service token as an ordering dependency. The syntax
27
+ * service is resolved lazily through the broker on the first `route` call,
28
+ * because the broker serves requests only once the kernel is RUNNING.
29
+ *
30
+ * @param options - Parser override and construction hook.
31
+ * @returns A core-tier descriptor for `brud.core.router`.
32
+ */
33
+ export function createRouterDescriptor(options) {
34
+ return {
35
+ token: RouterToken,
36
+ tier: ROUTER_SERVICE_TIER,
37
+ dependencies: [ParserToken],
38
+ contract: {
39
+ version: ROUTER_CONTRACT_VERSION,
40
+ methods: ROUTER_CONTRACT_METHODS,
41
+ },
42
+ // Token access is kernel-internal. Every other caller enters through the
43
+ // `syntax.route@1` exposure, where the caller comes from the call chain.
44
+ accessPolicy: {
45
+ allowedCallers: ['kernel', ROUTER_CALLER_ID],
46
+ },
47
+ manifest: {
48
+ exposures: [{ name: ROUTER_EXPOSURE, version: 1, scope: 'any' }],
49
+ },
50
+ factory: (context, broker) => {
51
+ const callerContext = {
52
+ callerId: ROUTER_CALLER_ID,
53
+ tier: 'core',
54
+ options: context.options,
55
+ };
56
+ let registry;
57
+ const service = new RouterService({
58
+ resolveOwner: (exposure, version, owner) => {
59
+ registry ??= broker.requestAccess(callerContext, ExposedApiRegistryToken);
60
+ return registry.resolve(exposure, {
61
+ ...(version === undefined ? {} : { version }),
62
+ ...(owner === undefined ? {} : { expectedOwner: owner }),
63
+ });
64
+ },
65
+ getParser: () => options?.parser
66
+ ?? broker.requestAccess(callerContext, ParserToken),
67
+ });
68
+ options?.onConstruct?.(service);
69
+ // Delegation by the owner: the real caller is captured here, at resolve
70
+ // time, and carried to every kind owner the request reaches.
71
+ return withExposureBindings(service, {
72
+ [`${ROUTER_EXPOSURE}@1`]: {
73
+ projection: (_service, caller) => {
74
+ const view = Object.freeze({
75
+ identity: caller.identity,
76
+ callerClass: caller.callerClass,
77
+ official: caller.official,
78
+ capabilities: Object.freeze([...caller.capabilities].sort()),
79
+ origin: caller.origin,
80
+ });
81
+ return Object.freeze({
82
+ route: (rawInput, routeOptions) => service.route(rawInput, routeOptions, view),
83
+ registeredKinds: () => service.registeredKinds(),
84
+ kinds: () => service.kinds(),
85
+ });
86
+ },
87
+ },
88
+ });
89
+ },
90
+ };
91
+ }
92
+ export const RouterDescriptor = createRouterDescriptor();
@@ -0,0 +1,9 @@
1
+ import type { IRouterService } from '../contracts/IRouterService.js';
2
+ /**
3
+ * Kernel service token for `brud.core.router`.
4
+ *
5
+ * Resolution grants the ability to parse and route a `[BRUD]` document to
6
+ * registered Level-1 services. Registration is a boot-only capability and is
7
+ * not reachable through this token after the window closes.
8
+ */
9
+ export declare const RouterToken: import("../../../src/contracts/serviceToken.js").ServiceToken<IRouterService>;
@@ -0,0 +1,9 @@
1
+ import { createServiceToken } from '../../../src/contracts/serviceToken.js';
2
+ /**
3
+ * Kernel service token for `brud.core.router`.
4
+ *
5
+ * Resolution grants the ability to parse and route a `[BRUD]` document to
6
+ * registered Level-1 services. Registration is a boot-only capability and is
7
+ * not reachable through this token after the window closes.
8
+ */
9
+ export const RouterToken = createServiceToken('brud.core.router', 'Boot-registered kind router dispatching parsed operations to Level-1 services');
@@ -0,0 +1,4 @@
1
+ export * from './contracts/index.js';
2
+ export * from './descriptor/RouterDescriptor.js';
3
+ export * from './descriptor/tokens.js';
4
+ export * from './orchestrator/index.js';
@@ -0,0 +1,4 @@
1
+ export * from './contracts/index.js';
2
+ export * from './descriptor/RouterDescriptor.js';
3
+ export * from './descriptor/tokens.js';
4
+ export * from './orchestrator/index.js';
@@ -0,0 +1,74 @@
1
+ import type { KernelCallAuthority } from '../../../src/contracts/callChain.js';
2
+ import type { IServiceLifecycle } from '../../../src/contracts/lifecycle.js';
3
+ import type { BrudOperation, IBrudParserService } from '../../Parser/contracts/index.js';
4
+ import type { IRouterService } from '../contracts/IRouterService.js';
5
+ import type { BrudDispatchCaller, BrudKindDispatcher, BrudRouteOptions, BrudKindInfo, BrudRouteRegistration, BrudRouteResult } from '../contracts/types.js';
6
+ /** Collaborators injected into {@link RouterService}. */
7
+ export interface RouterDependencies {
8
+ /** Resolves a kind owner's dispatch exposure on the current kernel call chain. */
9
+ readonly resolveOwner: (exposure: string, version: number | undefined, owner: string | undefined) => BrudKindDispatcher | null;
10
+ readonly getParser: () => IBrudParserService;
11
+ }
12
+ /**
13
+ * Level-1 Brud kind Router.
14
+ *
15
+ * The registration window is open only while the kernel is booting. The
16
+ * standard composition calls {@link closeRegistration} at the end of boot,
17
+ * before the kernel announces `RUNNING`; the `onRunning` hook is a second
18
+ * guard for alternate compositions.
19
+ *
20
+ * Dispatch resolves every target through the access broker with the token the
21
+ * owning service supplied, so access policies still apply and a plugin can
22
+ * never be a routing target.
23
+ */
24
+ export declare class RouterService implements IRouterService, IServiceLifecycle {
25
+ private readonly registrations;
26
+ private authority;
27
+ private readonly dependencies;
28
+ private parser;
29
+ private closed;
30
+ private disposed;
31
+ /**
32
+ * @param dependencies - Broker, router identity, and lazy parser resolution.
33
+ */
34
+ constructor(dependencies: RouterDependencies);
35
+ /** Lifecycle no-op: registrations arrive from the boot pinner. */
36
+ /** Binds the kernel call chain (hardcore boot). */
37
+ bindAuthority(value: KernelCallAuthority): void;
38
+ /** The kernel-derived caller of the current chain, if any. */
39
+ private currentCaller;
40
+ initialize(): Promise<void>;
41
+ /** Seals the window even when no boot pinner ran. */
42
+ onRunning(): Promise<void>;
43
+ /** Clears every claim and refuses later routing. */
44
+ dispose(): Promise<void>;
45
+ /** Whether {@link dispose} has run. */
46
+ get isDisposed(): boolean;
47
+ /**
48
+ * Registers a kind a participant declared in `manifest.kinds` (hardcore
49
+ * boot). The owner's kernel identity is pinned, so only that participant's
50
+ * exposure can serve the kind.
51
+ */
52
+ registerDeclared(owner: string, declaration: {
53
+ readonly kind: string;
54
+ readonly exposure: string;
55
+ readonly version?: number | string;
56
+ readonly description?: string;
57
+ readonly operations?: BrudRouteRegistration['operations'];
58
+ }): void;
59
+ register(registration: BrudRouteRegistration, owner?: string): void;
60
+ closeRegistration(): void;
61
+ isRegistrationOpen(): boolean;
62
+ registeredKinds(): readonly string[];
63
+ /**
64
+ * The public vocabulary: every registered kind with its declared
65
+ * description and operations. What lives inside a kind is its owner's
66
+ * business (an optional `describe` operation by convention).
67
+ */
68
+ kinds(): readonly BrudKindInfo[];
69
+ route(rawInput: string, options?: BrudRouteOptions, caller?: BrudDispatchCaller): Promise<BrudRouteResult>;
70
+ dispatch(operations: readonly BrudOperation[], options?: BrudRouteOptions, caller?: BrudDispatchCaller): Promise<BrudRouteResult>;
71
+ private resolveParser;
72
+ private buildDispatchContext;
73
+ private failureResult;
74
+ }
@@ -0,0 +1,332 @@
1
+ import { isValidRouterKind } from '../contracts/kind.js';
2
+ import { RouterDisposedError, RouterInvalidKindError, RouterKindCollisionError, RouterRegistrationClosedError, } from '../contracts/errors.js';
3
+ /**
4
+ * Level-1 Brud kind Router.
5
+ *
6
+ * The registration window is open only while the kernel is booting. The
7
+ * standard composition calls {@link closeRegistration} at the end of boot,
8
+ * before the kernel announces `RUNNING`; the `onRunning` hook is a second
9
+ * guard for alternate compositions.
10
+ *
11
+ * Dispatch resolves every target through the access broker with the token the
12
+ * owning service supplied, so access policies still apply and a plugin can
13
+ * never be a routing target.
14
+ */
15
+ export class RouterService {
16
+ registrations = new Map();
17
+ authority;
18
+ dependencies;
19
+ parser;
20
+ closed = false;
21
+ disposed = false;
22
+ /**
23
+ * @param dependencies - Broker, router identity, and lazy parser resolution.
24
+ */
25
+ constructor(dependencies) {
26
+ this.dependencies = dependencies;
27
+ }
28
+ /** Lifecycle no-op: registrations arrive from the boot pinner. */
29
+ /** Binds the kernel call chain (hardcore boot). */
30
+ bindAuthority(value) {
31
+ this.authority = value;
32
+ }
33
+ /** The kernel-derived caller of the current chain, if any. */
34
+ currentCaller() {
35
+ const context = this.authority?.current();
36
+ if (context === undefined) {
37
+ return undefined;
38
+ }
39
+ return Object.freeze({
40
+ identity: context.caller.identity,
41
+ callerClass: context.caller.callerClass,
42
+ official: context.caller.official,
43
+ capabilities: Object.freeze([...context.caller.capabilities].sort()),
44
+ origin: context.origin,
45
+ });
46
+ }
47
+ async initialize() {
48
+ return undefined;
49
+ }
50
+ /** Seals the window even when no boot pinner ran. */
51
+ async onRunning() {
52
+ this.closeRegistration();
53
+ }
54
+ /** Clears every claim and refuses later routing. */
55
+ async dispose() {
56
+ this.disposed = true;
57
+ this.closed = true;
58
+ this.registrations.clear();
59
+ }
60
+ /** Whether {@link dispose} has run. */
61
+ get isDisposed() {
62
+ return this.disposed;
63
+ }
64
+ /**
65
+ * Registers a kind a participant declared in `manifest.kinds` (hardcore
66
+ * boot). The owner's kernel identity is pinned, so only that participant's
67
+ * exposure can serve the kind.
68
+ */
69
+ registerDeclared(owner, declaration) {
70
+ this.register({
71
+ kind: declaration.kind,
72
+ exposure: declaration.exposure,
73
+ ...(declaration.version === undefined ? {} : { version: Number(declaration.version) }),
74
+ ...(declaration.description === undefined ? {} : { description: declaration.description }),
75
+ ...(declaration.operations === undefined ? {} : { operations: declaration.operations }),
76
+ }, owner);
77
+ }
78
+ register(registration, owner) {
79
+ if (this.disposed) {
80
+ throw new RouterDisposedError();
81
+ }
82
+ if (this.closed) {
83
+ throw new RouterRegistrationClosedError(registration.kind);
84
+ }
85
+ if (!isValidRouterKind(registration.kind)) {
86
+ throw new RouterInvalidKindError(registration.kind);
87
+ }
88
+ const existing = this.registrations.get(registration.kind);
89
+ if (existing !== undefined) {
90
+ throw new RouterKindCollisionError(registration.kind, existing.exposure);
91
+ }
92
+ if (typeof registration.exposure !== 'string' || registration.exposure.length === 0) {
93
+ throw new RouterInvalidKindError(registration.kind);
94
+ }
95
+ this.registrations.set(registration.kind, Object.freeze({ ...registration, ...(owner === undefined ? {} : { owner }) }));
96
+ }
97
+ closeRegistration() {
98
+ this.closed = true;
99
+ }
100
+ isRegistrationOpen() {
101
+ return !this.closed && !this.disposed;
102
+ }
103
+ registeredKinds() {
104
+ return Object.freeze(Array.from(this.registrations.keys()));
105
+ }
106
+ /**
107
+ * The public vocabulary: every registered kind with its declared
108
+ * description and operations. What lives inside a kind is its owner's
109
+ * business (an optional `describe` operation by convention).
110
+ */
111
+ kinds() {
112
+ return Object.freeze(Array.from(this.registrations.values(), (registration) => Object.freeze({
113
+ kind: registration.kind,
114
+ ...(registration.description === undefined ? {} : { description: registration.description }),
115
+ ...(registration.operations === undefined ? {} : { operations: registration.operations }),
116
+ })));
117
+ }
118
+ async route(rawInput, options = {}, caller) {
119
+ if (this.disposed) {
120
+ return this.failureResult(new RouterDisposedError());
121
+ }
122
+ const parsed = this.resolveParser().parse(rawInput, options.maxOperations === undefined
123
+ ? {}
124
+ : { maxOperations: options.maxOperations });
125
+ if (!parsed.ok) {
126
+ return {
127
+ status: 'failed',
128
+ operations: Object.freeze([]),
129
+ parseError: parsed.error,
130
+ dispatched: 0,
131
+ failed: 0,
132
+ };
133
+ }
134
+ return this.dispatch(parsed.operations, options, caller);
135
+ }
136
+ async dispatch(operations, options = {}, caller) {
137
+ if (this.disposed) {
138
+ return this.failureResult(new RouterDisposedError());
139
+ }
140
+ const routeCaller = caller ?? this.currentCaller();
141
+ if (routeCaller === undefined) {
142
+ return this.failureResult({ code: 'ROUTE_NO_CALL_CONTEXT', message: 'routing requires a kernel call chain' });
143
+ }
144
+ const context = this.buildDispatchContext(options, routeCaller);
145
+ const stopOnFailure = options.stopOnFailure === true;
146
+ const outcomes = [];
147
+ let dispatched = 0;
148
+ let failed = 0;
149
+ for (let sequence = 0; sequence < operations.length; sequence += 1) {
150
+ const operation = operations[sequence];
151
+ if (options.signal?.aborted === true) {
152
+ appendRemaining(outcomes, operations, sequence, 'aborted');
153
+ break;
154
+ }
155
+ const registration = this.registrations.get(operation.kind);
156
+ if (registration === undefined) {
157
+ failed += 1;
158
+ outcomes.push({
159
+ operationIndex: operation.index,
160
+ sequence,
161
+ kind: operation.kind,
162
+ name: operation.name,
163
+ status: 'kind_not_registered',
164
+ error: `KIND_NOT_REGISTERED: kind "${operation.kind}" has no registered service`,
165
+ });
166
+ if (stopOnFailure) {
167
+ appendRemaining(outcomes, operations, sequence + 1, 'skipped');
168
+ break;
169
+ }
170
+ continue;
171
+ }
172
+ let result;
173
+ try {
174
+ // The access broker is the only resolution path: the registered token
175
+ // decides the target and its access policy still applies.
176
+ const owner = this.dependencies.resolveOwner(registration.exposure, registration.version, registration.owner);
177
+ if (owner === null) {
178
+ throw new Error(`KIND_OWNER_UNAVAILABLE: exposure "${registration.exposure}" for kind "${operation.kind}" is not resolvable`);
179
+ }
180
+ result = await owner.dispatch(operation, context);
181
+ }
182
+ catch (error) {
183
+ failed += 1;
184
+ outcomes.push({
185
+ operationIndex: operation.index,
186
+ sequence,
187
+ kind: operation.kind,
188
+ name: operation.name,
189
+ status: 'failed',
190
+ error: `ROUTE_DISPATCH_ERROR: ${describe(error)}`,
191
+ });
192
+ if (stopOnFailure) {
193
+ appendRemaining(outcomes, operations, sequence + 1, 'skipped');
194
+ break;
195
+ }
196
+ continue;
197
+ }
198
+ if (!options.dryRun) {
199
+ dispatched += 1;
200
+ }
201
+ if (!isValidOperationResult(result)) {
202
+ failed += 1;
203
+ const error = 'HANDLER_INVALID_RESULT: handler returned an invalid result shape';
204
+ outcomes.push({
205
+ operationIndex: operation.index,
206
+ sequence,
207
+ kind: operation.kind,
208
+ name: operation.name,
209
+ status: 'failed',
210
+ error,
211
+ result: { status: 'failed', error },
212
+ });
213
+ if (stopOnFailure) {
214
+ appendRemaining(outcomes, operations, sequence + 1, 'skipped');
215
+ break;
216
+ }
217
+ continue;
218
+ }
219
+ outcomes.push({
220
+ operationIndex: operation.index,
221
+ sequence,
222
+ kind: operation.kind,
223
+ name: operation.name,
224
+ status: result.status,
225
+ result,
226
+ });
227
+ if (result.status === 'failed') {
228
+ failed += 1;
229
+ if (stopOnFailure) {
230
+ appendRemaining(outcomes, operations, sequence + 1, 'skipped');
231
+ break;
232
+ }
233
+ }
234
+ }
235
+ return {
236
+ status: aggregateStatus(outcomes),
237
+ operations: Object.freeze(outcomes),
238
+ dispatched,
239
+ failed,
240
+ };
241
+ }
242
+ resolveParser() {
243
+ this.parser ??= this.dependencies.getParser();
244
+ return this.parser;
245
+ }
246
+ buildDispatchContext(options, caller) {
247
+ return Object.freeze({
248
+ caller,
249
+ ...(options.signal === undefined ? {} : { signal: options.signal }),
250
+ ...(options.dryRun === true ? { dryRun: true } : {}),
251
+ });
252
+ }
253
+ failureResult(error) {
254
+ const parseError = {
255
+ code: error.code,
256
+ friendly: error.message,
257
+ details: error.message,
258
+ };
259
+ return {
260
+ status: 'failed',
261
+ operations: Object.freeze([]),
262
+ parseError,
263
+ dispatched: 0,
264
+ failed: 0,
265
+ };
266
+ }
267
+ }
268
+ /** Appends outcomes for operations that were never attempted. */
269
+ function appendRemaining(outcomes, operations, from, status) {
270
+ for (let sequence = from; sequence < operations.length; sequence += 1) {
271
+ const operation = operations[sequence];
272
+ outcomes.push({
273
+ operationIndex: operation.index,
274
+ sequence,
275
+ kind: operation.kind,
276
+ name: operation.name,
277
+ status,
278
+ });
279
+ }
280
+ }
281
+ /** Aggregates per-operation outcomes into one document status. */
282
+ function aggregateStatus(outcomes) {
283
+ if (outcomes.length === 0) {
284
+ return 'empty';
285
+ }
286
+ const successes = outcomes.filter((outcome) => outcome.status === 'success').length;
287
+ if (successes === outcomes.length) {
288
+ return 'success';
289
+ }
290
+ if (successes === 0) {
291
+ return 'failed';
292
+ }
293
+ return 'partial';
294
+ }
295
+ /** Renders an unknown thrown value for a diagnostic message. */
296
+ function describe(error) {
297
+ if (error instanceof Error && 'code' in error) {
298
+ const code = error.code;
299
+ if (typeof code === 'string') {
300
+ return `${code}: ${error.message}`;
301
+ }
302
+ }
303
+ return error instanceof Error ? error.message : String(error);
304
+ }
305
+ /** Whether a handler returned a structurally valid {@link OperationResult}. */
306
+ function isValidOperationResult(value) {
307
+ if (value === null || typeof value !== 'object' || Array.isArray(value)) {
308
+ return false;
309
+ }
310
+ const candidate = value;
311
+ // The OperationResult contract allows all four statuses; a cancelled
312
+ // operation reports `aborted`, and that status is passed through unchanged.
313
+ if (candidate.status !== 'success'
314
+ && candidate.status !== 'failed'
315
+ && candidate.status !== 'aborted'
316
+ && candidate.status !== 'skipped') {
317
+ return false;
318
+ }
319
+ if (candidate.message !== undefined && typeof candidate.message !== 'string') {
320
+ return false;
321
+ }
322
+ if (candidate.error !== undefined
323
+ && typeof candidate.error !== 'string'
324
+ && !(candidate.error instanceof Error)) {
325
+ return false;
326
+ }
327
+ if (candidate.durationMs !== undefined
328
+ && (typeof candidate.durationMs !== 'number' || !Number.isFinite(candidate.durationMs))) {
329
+ return false;
330
+ }
331
+ return true;
332
+ }
@@ -0,0 +1,2 @@
1
+ export { RouterService } from './RouterService.js';
2
+ export type { RouterDependencies } from './RouterService.js';
@@ -0,0 +1 @@
1
+ export { RouterService } from './RouterService.js';
@@ -0,0 +1,4 @@
1
+ import type { KernelServiceModuleContext } from '../../src/bootstrap/bootTypes.js';
2
+ import type { IRouterService } from './contracts/IRouterService.js';
3
+ export declare function createService(context: KernelServiceModuleContext): import("../../index.js").ServiceDescriptor<IRouterService, import("./index.js").RouterService>;
4
+ export declare function registerBootRegistrants(context: KernelServiceModuleContext, instances: readonly object[]): void;