@brud/kernel 0.0.0-stage → 0.0.2

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 (286) 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 +56 -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 +133 -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 +68 -0
  60. package/dist/services/ExposedApiRegistry/orchestrator/ExposedApiRegistryService.js +452 -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 +155 -0
  88. package/dist/services/Interception/contracts/IInterceptionService.js +12 -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 +50 -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 +40 -0
  102. package/dist/services/Interception/orchestrator/InterceptionService.js +343 -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 +67 -0
  142. package/dist/services/Router/contracts/errors.js +90 -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 +110 -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 +93 -0
  158. package/dist/services/Router/orchestrator/RouterService.js +457 -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 +121 -0
  170. package/dist/services/WasmCage/src/caged.js +460 -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 +19 -0
  184. package/dist/src/bootstrap/bootKernelInternal.js +633 -0
  185. package/dist/src/bootstrap/bootTypes.d.ts +113 -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 +45 -0
  190. package/dist/src/bootstrap/config/integrity.js +92 -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 +13 -0
  202. package/dist/src/bootstrap/index.js +7 -0
  203. package/dist/src/bootstrap/loaded.d.ts +30 -0
  204. package/dist/src/bootstrap/loaded.js +45 -0
  205. package/dist/src/bootstrap/packageRequirements.d.ts +26 -0
  206. package/dist/src/bootstrap/packageRequirements.js +52 -0
  207. package/dist/src/bootstrap/reload.d.ts +44 -0
  208. package/dist/src/bootstrap/reload.js +45 -0
  209. package/dist/src/bootstrap/seal.d.ts +32 -0
  210. package/dist/src/bootstrap/seal.js +101 -0
  211. package/dist/src/contracts/accessBroker.d.ts +53 -0
  212. package/dist/src/contracts/accessBroker.js +1 -0
  213. package/dist/src/contracts/brudOperation.d.ts +20 -0
  214. package/dist/src/contracts/brudOperation.js +20 -0
  215. package/dist/src/contracts/callChain.d.ts +161 -0
  216. package/dist/src/contracts/callChain.js +19 -0
  217. package/dist/src/contracts/capability.d.ts +26 -0
  218. package/dist/src/contracts/capability.js +26 -0
  219. package/dist/src/contracts/capabilitySet.d.ts +23 -0
  220. package/dist/src/contracts/capabilitySet.js +72 -0
  221. package/dist/src/contracts/container.d.ts +17 -0
  222. package/dist/src/contracts/container.js +8 -0
  223. package/dist/src/contracts/context.d.ts +19 -0
  224. package/dist/src/contracts/context.js +1 -0
  225. package/dist/src/contracts/contextContract.d.ts +132 -0
  226. package/dist/src/contracts/contextContract.js +274 -0
  227. package/dist/src/contracts/dispatchView.d.ts +21 -0
  228. package/dist/src/contracts/dispatchView.js +1 -0
  229. package/dist/src/contracts/handler.d.ts +21 -0
  230. package/dist/src/contracts/handler.js +1 -0
  231. package/dist/src/contracts/index.d.ts +26 -0
  232. package/dist/src/contracts/index.js +9 -0
  233. package/dist/src/contracts/kernel.d.ts +60 -0
  234. package/dist/src/contracts/kernel.js +1 -0
  235. package/dist/src/contracts/lifecycle.d.ts +59 -0
  236. package/dist/src/contracts/lifecycle.js +1 -0
  237. package/dist/src/contracts/manifest.d.ts +180 -0
  238. package/dist/src/contracts/manifest.js +334 -0
  239. package/dist/src/contracts/pipeline.d.ts +8 -0
  240. package/dist/src/contracts/pipeline.js +1 -0
  241. package/dist/src/contracts/policy.d.ts +75 -0
  242. package/dist/src/contracts/policy.js +77 -0
  243. package/dist/src/contracts/registry.d.ts +7 -0
  244. package/dist/src/contracts/registry.js +1 -0
  245. package/dist/src/contracts/serviceDescriptor.d.ts +67 -0
  246. package/dist/src/contracts/serviceDescriptor.js +1 -0
  247. package/dist/src/contracts/serviceToken.d.ts +36 -0
  248. package/dist/src/contracts/serviceToken.js +16 -0
  249. package/dist/src/engine/BrudKernel.d.ts +120 -0
  250. package/dist/src/engine/BrudKernel.js +395 -0
  251. package/dist/src/engine/ExecutionPipeline.d.ts +13 -0
  252. package/dist/src/engine/ExecutionPipeline.js +62 -0
  253. package/dist/src/engine/KernelAccessBroker.d.ts +47 -0
  254. package/dist/src/engine/KernelAccessBroker.js +107 -0
  255. package/dist/src/engine/KernelRegistry.d.ts +14 -0
  256. package/dist/src/engine/KernelRegistry.js +33 -0
  257. package/dist/src/engine/OperationRegistry.d.ts +9 -0
  258. package/dist/src/engine/OperationRegistry.js +18 -0
  259. package/dist/src/engine/ServiceContainer.d.ts +13 -0
  260. package/dist/src/engine/ServiceContainer.js +53 -0
  261. package/dist/src/engine/callChain.d.ts +68 -0
  262. package/dist/src/engine/callChain.js +175 -0
  263. package/dist/src/engine/dag.d.ts +2 -0
  264. package/dist/src/engine/dag.js +34 -0
  265. package/dist/src/engine/errors.d.ts +26 -0
  266. package/dist/src/engine/errors.js +52 -0
  267. package/dist/src/engine/index.d.ts +11 -0
  268. package/dist/src/engine/index.js +8 -0
  269. package/dist/src/engine/state.d.ts +1 -0
  270. package/dist/src/engine/state.js +1 -0
  271. package/dist/src/validation/jsonSchema/compile.d.ts +8 -0
  272. package/dist/src/validation/jsonSchema/compile.js +386 -0
  273. package/dist/src/validation/jsonSchema/index.d.ts +3 -0
  274. package/dist/src/validation/jsonSchema/index.js +2 -0
  275. package/dist/src/validation/jsonSchema/jsonValue.d.ts +29 -0
  276. package/dist/src/validation/jsonSchema/jsonValue.js +190 -0
  277. package/dist/src/validation/jsonSchema/pattern.d.ts +28 -0
  278. package/dist/src/validation/jsonSchema/pattern.js +155 -0
  279. package/dist/src/validation/jsonSchema/types.d.ts +71 -0
  280. package/dist/src/validation/jsonSchema/types.js +15 -0
  281. package/package.json +59 -4
  282. package/services/WasmCage/native/brud-wasm-cage.darwin-arm64.node +0 -0
  283. package/services/WasmCage/native/brud-wasm-cage.darwin-x64.node +0 -0
  284. package/services/WasmCage/native/brud-wasm-cage.linux-arm64-gnu.node +0 -0
  285. package/services/WasmCage/native/brud-wasm-cage.linux-x64-gnu.node +0 -0
  286. package/services/WasmCage/native/brud-wasm-cage.win32-x64-msvc.node +0 -0
@@ -0,0 +1,105 @@
1
+ import { OperationLimitExceededError, ParserDisposedError, } from '../contracts/errors.js';
2
+ import { synthesizeIndex } from '../parser/indexSynthesis.js';
3
+ import { BrudParseError, scanBrudDocument } from '../parser/scanner.js';
4
+ /** Default DoS bound for one parsed document. */
5
+ const DEFAULT_MAX_OPERATIONS = 1_000;
6
+ /**
7
+ * Level-1 Brud Protocol v2 Parser.
8
+ *
9
+ * Owns the `[BRUD]` scanner and nothing else. It has no registry, no broker
10
+ * dependency, and no knowledge of the kind vocabulary beyond validating the
11
+ * kind token written on the header. Routing belongs to `brud.core.router`.
12
+ */
13
+ export class ParserService {
14
+ disposed = false;
15
+ /** Lifecycle no-op: bootstrap is synchronous. */
16
+ async initialize() {
17
+ return undefined;
18
+ }
19
+ /** Refuses every later parse. */
20
+ async dispose() {
21
+ this.disposed = true;
22
+ }
23
+ /** Whether {@link dispose} has run. */
24
+ get isDisposed() {
25
+ return this.disposed;
26
+ }
27
+ parse(rawInput, options = {}) {
28
+ if (this.disposed) {
29
+ return { ok: false, error: parseFailure(new ParserDisposedError()) };
30
+ }
31
+ const maxOperations = options.maxOperations ?? DEFAULT_MAX_OPERATIONS;
32
+ if (!Number.isSafeInteger(maxOperations) || maxOperations < 1) {
33
+ return {
34
+ ok: false,
35
+ error: {
36
+ code: 'PARSE_ERROR',
37
+ friendly: 'invalid operation bound',
38
+ details: `maxOperations must be a positive integer, received ${String(maxOperations)}`,
39
+ },
40
+ };
41
+ }
42
+ try {
43
+ // The Parser is schema-agnostic: every brace region is opaque. The
44
+ // resolver is still passed so the scanner's protected-region semantics
45
+ // remain one implementation.
46
+ const calls = scanBrudDocument(rawInput, () => undefined);
47
+ if (calls.length > maxOperations) {
48
+ return {
49
+ ok: false,
50
+ error: parseFailure(new OperationLimitExceededError(calls.length, maxOperations)),
51
+ };
52
+ }
53
+ const operations = calls.map((call, sequence) => Object.freeze({
54
+ index: synthesizeIndex(sequence),
55
+ kind: call.kind,
56
+ name: call.name,
57
+ parameters: call.parameters,
58
+ }));
59
+ return { ok: true, operations: Object.freeze(operations) };
60
+ }
61
+ catch (error) {
62
+ return { ok: false, error: parseFailure(error) };
63
+ }
64
+ }
65
+ }
66
+ /** Converts a thrown failure into the public parse-failure shape. */
67
+ function parseFailure(error) {
68
+ if (error instanceof BrudParseError) {
69
+ return {
70
+ code: error.code,
71
+ friendly: error.message,
72
+ details: error.message,
73
+ line: error.line,
74
+ };
75
+ }
76
+ if (error instanceof OperationLimitExceededError) {
77
+ return {
78
+ code: error.code,
79
+ friendly: 'too many operations',
80
+ details: error.message,
81
+ };
82
+ }
83
+ if (error instanceof ParserDisposedError) {
84
+ return {
85
+ code: error.code,
86
+ friendly: error.message,
87
+ details: error.message,
88
+ };
89
+ }
90
+ if (error instanceof Error && 'code' in error) {
91
+ const code = error.code;
92
+ if (typeof code === 'string') {
93
+ return { code, friendly: error.message, details: error.message };
94
+ }
95
+ }
96
+ return {
97
+ code: 'PARSE_ERROR',
98
+ friendly: describe(error),
99
+ details: describe(error),
100
+ };
101
+ }
102
+ /** Renders an unknown thrown value for a diagnostic message. */
103
+ function describe(error) {
104
+ return error instanceof Error ? error.message : String(error);
105
+ }
@@ -0,0 +1 @@
1
+ export { ParserService } from './ParserService.js';
@@ -0,0 +1 @@
1
+ export { ParserService } from './ParserService.js';
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Synthesizes the document index for a parsed Brud operation.
3
+ *
4
+ * The `[BRUD]` wire grammar has no index marker, so the scanner derives it
5
+ * from document position. `sequence` is zero-based; the first operation is
6
+ * `'1'`, matching the frozen 21-kind matrix which requires `index`.
7
+ *
8
+ * @param sequence - Zero-based document position of the operation.
9
+ * @returns The 1-based index as a decimal string.
10
+ */
11
+ export declare function synthesizeIndex(sequence: number): string;
@@ -0,0 +1,13 @@
1
+ /**
2
+ * Synthesizes the document index for a parsed Brud operation.
3
+ *
4
+ * The `[BRUD]` wire grammar has no index marker, so the scanner derives it
5
+ * from document position. `sequence` is zero-based; the first operation is
6
+ * `'1'`, matching the frozen 21-kind matrix which requires `index`.
7
+ *
8
+ * @param sequence - Zero-based document position of the operation.
9
+ * @returns The 1-based index as a decimal string.
10
+ */
11
+ export function synthesizeIndex(sequence) {
12
+ return String(sequence + 1);
13
+ }
@@ -0,0 +1,14 @@
1
+ /**
2
+ * Parses `key: value` parameters and `{param}` … `{/param}` protected regions.
3
+ *
4
+ * Plain parameters are single-line and trimmed. Protected content is captured
5
+ * byte-for-byte between its own-line markers, including blank lines, braces and
6
+ * protocol-like markers. Duplicate keys and malformed lines fail closed.
7
+ *
8
+ * @param lines - Block body lines, opener excluded and `[END]` excluded.
9
+ * @param protectedNames - Protected names for the operation, or `undefined`
10
+ * when every brace region is opaque (the schema-agnostic Parser default).
11
+ * @param firstLine - Absolute 1-based line number of the first body line.
12
+ * @returns The parsed parameter map.
13
+ */
14
+ export declare function parseParameters(lines: readonly string[], protectedNames: readonly string[] | undefined, firstLine: number): Readonly<Record<string, unknown>>;
@@ -0,0 +1,89 @@
1
+ import { BRACE_PATTERN, BrudParseError, KEY_PATTERN } from './syntax.js';
2
+ /**
3
+ * Parses `key: value` parameters and `{param}` … `{/param}` protected regions.
4
+ *
5
+ * Plain parameters are single-line and trimmed. Protected content is captured
6
+ * byte-for-byte between its own-line markers, including blank lines, braces and
7
+ * protocol-like markers. Duplicate keys and malformed lines fail closed.
8
+ *
9
+ * @param lines - Block body lines, opener excluded and `[END]` excluded.
10
+ * @param protectedNames - Protected names for the operation, or `undefined`
11
+ * when every brace region is opaque (the schema-agnostic Parser default).
12
+ * @param firstLine - Absolute 1-based line number of the first body line.
13
+ * @returns The parsed parameter map.
14
+ */
15
+ export function parseParameters(lines, protectedNames, firstLine) {
16
+ const parameters = {};
17
+ const seen = new Set();
18
+ let index = 0;
19
+ while (index < lines.length) {
20
+ const rawLine = lines[index] ?? '';
21
+ const line = firstLine + index;
22
+ const trimmed = rawLine.trim();
23
+ if (trimmed === '') {
24
+ index += 1;
25
+ continue;
26
+ }
27
+ const brace = BRACE_PATTERN.exec(trimmed);
28
+ const braceName = brace?.[1] ?? '';
29
+ if (brace !== null && !braceName.startsWith('/') && isProtected(protectedNames, braceName)) {
30
+ if (seen.has(braceName)) {
31
+ throw new BrudParseError(`duplicate parameter "${braceName}"`, line);
32
+ }
33
+ const closedAt = findCloser(lines, index + 1, braceName);
34
+ if (closedAt < 0) {
35
+ throw new BrudParseError(`unterminated protected parameter "${braceName}"`, line);
36
+ }
37
+ seen.add(braceName);
38
+ parameters[braceName] = lines.slice(index + 1, closedAt).join('\n');
39
+ index = closedAt + 1;
40
+ continue;
41
+ }
42
+ if (brace !== null) {
43
+ throw new BrudParseError(`unprotected parameter "${braceName}" must not use brace form`, line);
44
+ }
45
+ const parameter = KEY_PATTERN.exec(trimmed);
46
+ if (parameter === null) {
47
+ throw new BrudParseError('expected a "key: value" parameter', line);
48
+ }
49
+ const key = parameter[1] ?? '';
50
+ const value = (parameter[2] ?? '').trim();
51
+ if (isDeclaredProtected(protectedNames, key)) {
52
+ throw new BrudParseError(`protected parameter "${key}" requires the {${key}} … {/${key}} form`, line);
53
+ }
54
+ if (seen.has(key)) {
55
+ throw new BrudParseError(`duplicate parameter "${key}"`, line);
56
+ }
57
+ seen.add(key);
58
+ parameters[key] = value;
59
+ index += 1;
60
+ }
61
+ return Object.freeze(parameters);
62
+ }
63
+ /**
64
+ * Whether a brace region is protected.
65
+ *
66
+ * `undefined` means the schema is unknown and every brace region is opaque.
67
+ */
68
+ function isProtected(protectedNames, name) {
69
+ return protectedNames === undefined || protectedNames.includes(name);
70
+ }
71
+ /**
72
+ * Whether a plain `key: value` parameter is declared protected.
73
+ *
74
+ * Only an explicit schema declaration can force the brace form; when the
75
+ * schema is unknown, plain parameters remain admissible.
76
+ */
77
+ function isDeclaredProtected(protectedNames, name) {
78
+ return protectedNames !== undefined && protectedNames.includes(name);
79
+ }
80
+ /** Finds the own-line closer for a protected region, or -1 when absent. */
81
+ function findCloser(lines, from, name) {
82
+ const expected = `{/${name}}`;
83
+ for (let index = from; index < lines.length; index += 1) {
84
+ if ((lines[index] ?? '').trim() === expected) {
85
+ return index;
86
+ }
87
+ }
88
+ return -1;
89
+ }
@@ -0,0 +1,48 @@
1
+ import { type BrudOperationKind } from '../../../src/contracts/brudOperation.js';
2
+ export { BRUD_PARSE_ERROR, BrudParseError } from './syntax.js';
3
+ /** One `[CALL …]` … `[END]` block with its kind, name and parsed parameters. */
4
+ export interface ScannedCall {
5
+ /** Operation kind declared by the header. */
6
+ readonly kind: BrudOperationKind;
7
+ /** Operation name (tool or action name) taken from the opening marker. */
8
+ readonly name: string;
9
+ /** Parsed parameter map; protected values are literal strings. */
10
+ readonly parameters: Readonly<Record<string, unknown>>;
11
+ /** Absolute 1-based line number of the opening marker. */
12
+ readonly line: number;
13
+ }
14
+ /**
15
+ * Resolves the protected parameter names for an operation.
16
+ *
17
+ * The Parser is schema-agnostic and passes `undefined`, which makes every
18
+ * brace region opaque. The hook stays injectable so a future syntax-only
19
+ * profile can narrow the protected set without changing the scanner.
20
+ */
21
+ export type ProtectedParameterResolver = (kind: BrudOperationKind, name: string) => readonly string[] | undefined;
22
+ /**
23
+ * Extracts the first `[BRUD]` … `[/BRUD]` wrapper body.
24
+ *
25
+ * Text outside the wrapper is ignored. A missing, reversed or unterminated
26
+ * wrapper is a parse error.
27
+ *
28
+ * @param raw - Untrusted model output.
29
+ * @returns The body between the markers and its first-line number.
30
+ */
31
+ export declare function extractWrapper(raw: string): {
32
+ readonly body: string;
33
+ readonly line: number;
34
+ };
35
+ /**
36
+ * Scans a full document into ordered operations.
37
+ *
38
+ * The wrapper is extracted first, then every `[CALL …]` is split at the first
39
+ * `[END]` that is not inside a protected parameter.
40
+ *
41
+ * Header form: `[CALL <kind> <name>]`, e.g. `[CALL action list_sessions]`.
42
+ * A bare `[CALL <name>]` header names no kind and is refused.
43
+ *
44
+ * @param raw - Untrusted model output.
45
+ * @param resolveProtected - Protected-parameter resolver.
46
+ * @returns Ordered calls, each with parsed parameters.
47
+ */
48
+ export declare function scanBrudDocument(raw: string, resolveProtected: ProtectedParameterResolver): readonly ScannedCall[];
@@ -0,0 +1,156 @@
1
+ import { isValidBrudKind, } from '../../../src/contracts/brudOperation.js';
2
+ import { parseParameters } from './parameters.js';
3
+ import { BRACE_PATTERN, BrudParseError, CALL_PATTERN } from './syntax.js';
4
+ export { BRUD_PARSE_ERROR, BrudParseError } from './syntax.js';
5
+ const WRAPPER_OPEN = '[BRUD]';
6
+ const WRAPPER_CLOSE = '[/BRUD]';
7
+ const END_MARKER = '[END]';
8
+ /**
9
+ * Extracts the first `[BRUD]` … `[/BRUD]` wrapper body.
10
+ *
11
+ * Text outside the wrapper is ignored. A missing, reversed or unterminated
12
+ * wrapper is a parse error.
13
+ *
14
+ * @param raw - Untrusted model output.
15
+ * @returns The body between the markers and its first-line number.
16
+ */
17
+ export function extractWrapper(raw) {
18
+ const text = raw.replace(/\r\n/g, '\n').replace(/\r/g, '\n');
19
+ const open = text.indexOf(WRAPPER_OPEN);
20
+ if (open < 0) {
21
+ throw new BrudParseError('missing [BRUD] wrapper', lineAt(text, 0));
22
+ }
23
+ const close = text.indexOf(WRAPPER_CLOSE, open + WRAPPER_OPEN.length);
24
+ if (close < 0) {
25
+ throw new BrudParseError('unterminated [BRUD] wrapper', lineAt(text, open));
26
+ }
27
+ const bodyStart = open + WRAPPER_OPEN.length;
28
+ return { body: text.slice(bodyStart, close), line: lineAt(text, bodyStart) };
29
+ }
30
+ /**
31
+ * Scans a full document into ordered operations.
32
+ *
33
+ * The wrapper is extracted first, then every `[CALL …]` is split at the first
34
+ * `[END]` that is not inside a protected parameter.
35
+ *
36
+ * Header form: `[CALL <kind> <name>]`, e.g. `[CALL action list_sessions]`.
37
+ * A bare `[CALL <name>]` header names no kind and is refused.
38
+ *
39
+ * @param raw - Untrusted model output.
40
+ * @param resolveProtected - Protected-parameter resolver.
41
+ * @returns Ordered calls, each with parsed parameters.
42
+ */
43
+ export function scanBrudDocument(raw, resolveProtected) {
44
+ const { body, line } = extractWrapper(raw);
45
+ const lines = body.split('\n');
46
+ const calls = [];
47
+ let index = 0;
48
+ while (index < lines.length) {
49
+ const candidate = lines[index] ?? '';
50
+ if (candidate.trim() === '') {
51
+ index += 1;
52
+ continue;
53
+ }
54
+ const header = parseCallHeader(candidate.trim(), line + index);
55
+ if (header === undefined) {
56
+ throw new BrudParseError('expected [CALL <kind> <name>]', line + index);
57
+ }
58
+ const openingLine = line + index;
59
+ const protectedNames = resolveProtected(header.kind, header.name);
60
+ const bodyLines = [];
61
+ index += 1;
62
+ let closed = false;
63
+ let activeProtected = null;
64
+ while (index < lines.length) {
65
+ const current = lines[index] ?? '';
66
+ const trimmed = current.trim();
67
+ if (activeProtected !== null) {
68
+ if (trimmed === closer(activeProtected)) {
69
+ activeProtected = null;
70
+ }
71
+ bodyLines.push(current);
72
+ index += 1;
73
+ continue;
74
+ }
75
+ if (trimmed === END_MARKER) {
76
+ closed = true;
77
+ index += 1;
78
+ break;
79
+ }
80
+ const brace = BRACE_PATTERN.exec(trimmed);
81
+ const braceName = brace?.[1] ?? '';
82
+ if (brace !== null
83
+ && !braceName.startsWith('/')
84
+ && isProtected(protectedNames, braceName)) {
85
+ activeProtected = braceName;
86
+ }
87
+ if (CALL_PATTERN.test(trimmed)) {
88
+ throw new BrudParseError('nested [CALL] is not allowed', line + index);
89
+ }
90
+ bodyLines.push(current);
91
+ index += 1;
92
+ }
93
+ if (!closed) {
94
+ throw new BrudParseError('missing [END] for [CALL]', openingLine);
95
+ }
96
+ calls.push({
97
+ kind: header.kind,
98
+ name: header.name,
99
+ parameters: parseParameters(bodyLines, protectedNames, openingLine + 1),
100
+ line: openingLine,
101
+ });
102
+ }
103
+ if (calls.length === 0) {
104
+ throw new BrudParseError('wrapper contains no [CALL] block', line);
105
+ }
106
+ return calls;
107
+ }
108
+ /**
109
+ * Parses a `[CALL …]` header.
110
+ *
111
+ * Two tokens are `<kind> <name>`. The kind must satisfy the shared kind
112
+ * grammar. One token names no kind, so the header is refused.
113
+ *
114
+ * @param trimmed - Trimmed header line.
115
+ * @param line - Absolute 1-based line number for diagnostics.
116
+ * @returns The header, or `undefined` when the line is not a call header.
117
+ */
118
+ function parseCallHeader(trimmed, line) {
119
+ const match = CALL_PATTERN.exec(trimmed);
120
+ if (match === null) {
121
+ return undefined;
122
+ }
123
+ const first = match[1] ?? '';
124
+ const second = match[2];
125
+ if (first === '') {
126
+ throw new BrudParseError('empty operation name in [CALL]', line);
127
+ }
128
+ if (second === undefined) {
129
+ throw new BrudParseError('operation kind is required in [CALL]', line);
130
+ }
131
+ if (second === '') {
132
+ throw new BrudParseError('empty operation name in [CALL]', line);
133
+ }
134
+ if (!isValidBrudKind(first)) {
135
+ throw new BrudParseError(`invalid operation kind "${first}"`, line);
136
+ }
137
+ return { kind: first, name: second };
138
+ }
139
+ /** Whether a parameter is protected for an operation whose schema is known. */
140
+ function isProtected(protectedNames, name) {
141
+ return protectedNames === undefined || protectedNames.includes(name);
142
+ }
143
+ /** The own-line closer form for a protected parameter. */
144
+ function closer(name) {
145
+ return `{/${name}}`;
146
+ }
147
+ /** Computes the 1-based line number of a string offset. */
148
+ function lineAt(text, offset) {
149
+ let line = 1;
150
+ for (let index = 0; index < offset; index += 1) {
151
+ if (text[index] === '\n') {
152
+ line += 1;
153
+ }
154
+ }
155
+ return line;
156
+ }
@@ -0,0 +1,30 @@
1
+ /** Stable code for every Brud Protocol v2 structural failure. */
2
+ export declare const BRUD_PARSE_ERROR: "PARSE_ERROR";
3
+ /** Bare parameter key: `key: value`. */
4
+ export declare const KEY_PATTERN: RegExp;
5
+ /** Own-line brace marker: `{name}` or `{/name}`. */
6
+ export declare const BRACE_PATTERN: RegExp;
7
+ /**
8
+ * Call header: `[CALL <name>]` or `[CALL <kind> <name>]`.
9
+ *
10
+ * Group 1 is the first token and group 2 the optional second token. The
11
+ * scanner requires the two-token form and refuses the bare single-token form,
12
+ * because a bare header names no kind.
13
+ */
14
+ export declare const CALL_PATTERN: RegExp;
15
+ /**
16
+ * Fail-closed scanner error.
17
+ *
18
+ * Carries the document line number so a caller can point at the offending
19
+ * construct without re-scanning the input.
20
+ */
21
+ export declare class BrudParseError extends Error {
22
+ readonly code: "PARSE_ERROR";
23
+ /** Absolute 1-based line number in the original document. */
24
+ readonly line: number;
25
+ /**
26
+ * @param message - Human-readable failure description.
27
+ * @param line - Absolute 1-based line number in the original document.
28
+ */
29
+ constructor(message: string, line: number);
30
+ }
@@ -0,0 +1,34 @@
1
+ /** Stable code for every Brud Protocol v2 structural failure. */
2
+ export const BRUD_PARSE_ERROR = 'PARSE_ERROR';
3
+ /** Bare parameter key: `key: value`. */
4
+ export const KEY_PATTERN = /^([A-Za-z_][A-Za-z0-9_]*):\s*(.*)$/;
5
+ /** Own-line brace marker: `{name}` or `{/name}`. */
6
+ export const BRACE_PATTERN = /^\{([^{}]+)\}$/;
7
+ /**
8
+ * Call header: `[CALL <name>]` or `[CALL <kind> <name>]`.
9
+ *
10
+ * Group 1 is the first token and group 2 the optional second token. The
11
+ * scanner requires the two-token form and refuses the bare single-token form,
12
+ * because a bare header names no kind.
13
+ */
14
+ export const CALL_PATTERN = /^\[CALL\s+([^\s\]]+)(?:\s+([^\s\]]+))?\s*\]$/;
15
+ /**
16
+ * Fail-closed scanner error.
17
+ *
18
+ * Carries the document line number so a caller can point at the offending
19
+ * construct without re-scanning the input.
20
+ */
21
+ export class BrudParseError extends Error {
22
+ code = BRUD_PARSE_ERROR;
23
+ /** Absolute 1-based line number in the original document. */
24
+ line;
25
+ /**
26
+ * @param message - Human-readable failure description.
27
+ * @param line - Absolute 1-based line number in the original document.
28
+ */
29
+ constructor(message, line) {
30
+ super(`${message} (line ${String(line)})`);
31
+ this.name = 'BrudParseError';
32
+ this.line = line;
33
+ }
34
+ }
@@ -0,0 +1,2 @@
1
+ import type { KernelServiceModuleContext } from '../../src/bootstrap/bootTypes.js';
2
+ export declare function createService(context: KernelServiceModuleContext): import("../../index.js").ServiceDescriptor<import("./index.js").IBrudParserService, import("./index.js").ParserService>;
@@ -0,0 +1,5 @@
1
+ import { createParserDescriptor } from './descriptor/ParserDescriptor.js';
2
+ export function createService(context) {
3
+ void context;
4
+ return createParserDescriptor();
5
+ }
@@ -0,0 +1,2 @@
1
+ /** Namespace owned by the router service in the context contract. */
2
+ export declare const ROUTER_CONTEXT_SCOPE = "router";
@@ -0,0 +1,2 @@
1
+ /** Namespace owned by the router service in the context contract. */
2
+ export const ROUTER_CONTEXT_SCOPE = 'router';
@@ -0,0 +1,43 @@
1
+ import type { BrudOperationKind } from '../../../src/contracts/brudOperation.js';
2
+ import type { BrudOperation } from '../../Parser/contracts/index.js';
3
+ import type { BrudKindInfo, BrudDispatchCaller, BrudRouteOptions, BrudRouteRegistration, BrudRouteResult } from './types.js';
4
+ /**
5
+ * Level-1 Brud kind Router.
6
+ *
7
+ * Accepts boot-time kind registrations from kernel services, resolves the
8
+ * owning service through the kernel access broker with its `ServiceToken`, and
9
+ * dispatches parsed operations. It routes only to the service that owns a kind.
10
+ */
11
+ export interface IRouterService {
12
+ /**
13
+ * Claims a kind on behalf of a Level-1 service.
14
+ *
15
+ * @throws RouterRegistrationClosedError when the boot window has closed.
16
+ * @throws RouterInvalidKindError when the kind token is malformed.
17
+ * @throws RouterKindCollisionError when another service already owns it.
18
+ * @throws RouterUnknownServiceError when the token is not registered.
19
+ */
20
+ register(registration: BrudRouteRegistration): void;
21
+ /** Seals the registration window. Idempotent. */
22
+ closeRegistration(): void;
23
+ /** Whether new kinds may still be claimed. */
24
+ isRegistrationOpen(): boolean;
25
+ /** Kinds currently claimed, in registration order. */
26
+ registeredKinds(): readonly BrudOperationKind[];
27
+ /** Public vocabulary: registered kinds with declared descriptions. */
28
+ kinds(): readonly BrudKindInfo[];
29
+ /**
30
+ * Parses a raw document with `brud.core.parser` and routes every operation.
31
+ *
32
+ * @param rawInput - Raw `[BRUD]` document.
33
+ * @param options - Caller context and routing bounds.
34
+ */
35
+ route(rawInput: string, options?: BrudRouteOptions, caller?: BrudDispatchCaller): Promise<BrudRouteResult>;
36
+ /**
37
+ * Routes an already-parsed operation list.
38
+ *
39
+ * @param operations - Operations emitted by the Parser.
40
+ * @param options - Caller context and routing bounds.
41
+ */
42
+ dispatch(operations: readonly BrudOperation[], options?: BrudRouteOptions, caller?: BrudDispatchCaller): Promise<BrudRouteResult>;
43
+ }
@@ -0,0 +1 @@
1
+ export {};
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Caller identity the Router uses when resolving a registered service.
3
+ *
4
+ * Access policies that must accept Router dispatch name this exact value.
5
+ */
6
+ export declare const ROUTER_CALLER_ID: "brud.core.router";
@@ -0,0 +1,6 @@
1
+ /**
2
+ * Caller identity the Router uses when resolving a registered service.
3
+ *
4
+ * Access policies that must accept Router dispatch name this exact value.
5
+ */
6
+ export const ROUTER_CALLER_ID = 'brud.core.router';
@@ -0,0 +1,67 @@
1
+ /** Stable, machine-readable codes for Router failures. */
2
+ export type RouterErrorCode = 'ROUTER_REGISTRATION_CLOSED' | 'ROUTER_KIND_COLLISION' | 'ROUTER_INVALID_KIND' | 'ROUTER_INVALID_DECLARATION' | 'ROUTER_UNKNOWN_SERVICE' | 'ROUTER_DISPOSED';
3
+ /** Base class for every Router domain failure. */
4
+ export declare abstract class RouterError extends Error {
5
+ /** Stable, machine-readable error code. */
6
+ abstract readonly code: RouterErrorCode;
7
+ protected constructor(message: string, options?: ErrorOptions);
8
+ }
9
+ /** Raised when a kind is claimed after the boot registration window closed. */
10
+ export declare class RouterRegistrationClosedError extends RouterError {
11
+ readonly code: "ROUTER_REGISTRATION_CLOSED";
12
+ /** Kind the late registrant attempted to claim. */
13
+ readonly kind: string;
14
+ /**
15
+ * @param kind - Kind the late registrant attempted to claim.
16
+ */
17
+ constructor(kind: string);
18
+ }
19
+ /** Raised when a kind's operations or permissions are missing or invalid. Refuses boot. */
20
+ export declare class RouterInvalidDeclarationError extends RouterError {
21
+ readonly code: "ROUTER_INVALID_DECLARATION";
22
+ /** Kind whose declaration was refused. */
23
+ readonly kind: string;
24
+ /**
25
+ * @param kind - Kind whose declaration was refused.
26
+ * @param reason - What is wrong with it.
27
+ */
28
+ constructor(kind: string, reason: string);
29
+ }
30
+ /** Raised when two services claim the same kind. */
31
+ export declare class RouterKindCollisionError extends RouterError {
32
+ readonly code: "ROUTER_KIND_COLLISION";
33
+ /** Contested kind. */
34
+ readonly kind: string;
35
+ /** Token id that already owns the kind. */
36
+ readonly existingTokenId: string;
37
+ /**
38
+ * @param kind - Contested kind.
39
+ * @param existingTokenId - Token id that already owns the kind.
40
+ */
41
+ constructor(kind: string, existingTokenId: string);
42
+ }
43
+ /** Raised when a registrant supplies a malformed kind token. */
44
+ export declare class RouterInvalidKindError extends RouterError {
45
+ readonly code: "ROUTER_INVALID_KIND";
46
+ /** Rejected value. */
47
+ readonly kind: string;
48
+ /**
49
+ * @param kind - Rejected value.
50
+ */
51
+ constructor(kind: string);
52
+ }
53
+ /** Raised when a registrant names a service the kernel does not own. */
54
+ export declare class RouterUnknownServiceError extends RouterError {
55
+ readonly code: "ROUTER_UNKNOWN_SERVICE";
56
+ /** Token id that could not be resolved. */
57
+ readonly tokenId: string;
58
+ /**
59
+ * @param tokenId - Token id that could not be resolved.
60
+ */
61
+ constructor(tokenId: string);
62
+ }
63
+ /** Raised when routing is attempted after disposal. */
64
+ export declare class RouterDisposedError extends RouterError {
65
+ readonly code: "ROUTER_DISPOSED";
66
+ constructor();
67
+ }