@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.
- package/LICENSE +201 -0
- package/README.md +63 -2
- package/dist/index.d.ts +15 -0
- package/dist/index.js +13 -0
- package/dist/serviceModules/events.d.ts +1 -0
- package/dist/serviceModules/events.js +1 -0
- package/dist/serviceModules/exposedApiRegistry.d.ts +1 -0
- package/dist/serviceModules/exposedApiRegistry.js +1 -0
- package/dist/serviceModules/identityRegistry.d.ts +1 -0
- package/dist/serviceModules/identityRegistry.js +1 -0
- package/dist/serviceModules/interception.d.ts +1 -0
- package/dist/serviceModules/interception.js +1 -0
- package/dist/serviceModules/parser.d.ts +1 -0
- package/dist/serviceModules/parser.js +1 -0
- package/dist/serviceModules/router.d.ts +1 -0
- package/dist/serviceModules/router.js +1 -0
- package/dist/serviceModules/wasmCage.d.ts +1 -0
- package/dist/serviceModules/wasmCage.js +1 -0
- package/dist/services/Events/contracts/IEventsService.d.ts +64 -0
- package/dist/services/Events/contracts/IEventsService.js +1 -0
- package/dist/services/Events/contracts/errors.d.ts +31 -0
- package/dist/services/Events/contracts/errors.js +40 -0
- package/dist/services/Events/contracts/index.d.ts +3 -0
- package/dist/services/Events/contracts/index.js +3 -0
- package/dist/services/Events/contracts/tokens.d.ts +2 -0
- package/dist/services/Events/contracts/tokens.js +2 -0
- package/dist/services/Events/descriptor/EventsDescriptor.d.ts +9 -0
- package/dist/services/Events/descriptor/EventsDescriptor.js +56 -0
- package/dist/services/Events/descriptor/tokens.d.ts +1 -0
- package/dist/services/Events/descriptor/tokens.js +1 -0
- package/dist/services/Events/index.d.ts +4 -0
- package/dist/services/Events/index.js +4 -0
- package/dist/services/Events/orchestrator/EventsService.d.ts +51 -0
- package/dist/services/Events/orchestrator/EventsService.js +339 -0
- package/dist/services/Events/orchestrator/index.d.ts +2 -0
- package/dist/services/Events/orchestrator/index.js +2 -0
- package/dist/services/Events/orchestrator/limits.d.ts +22 -0
- package/dist/services/Events/orchestrator/limits.js +33 -0
- package/dist/services/Events/serviceModule.d.ts +2 -0
- package/dist/services/Events/serviceModule.js +5 -0
- package/dist/services/ExposedApiRegistry/contracts/IExposedApiRegistry.d.ts +44 -0
- package/dist/services/ExposedApiRegistry/contracts/IExposedApiRegistry.js +1 -0
- package/dist/services/ExposedApiRegistry/contracts/errors.d.ts +132 -0
- package/dist/services/ExposedApiRegistry/contracts/errors.js +195 -0
- package/dist/services/ExposedApiRegistry/contracts/index.d.ts +9 -0
- package/dist/services/ExposedApiRegistry/contracts/index.js +4 -0
- package/dist/services/ExposedApiRegistry/contracts/policy.d.ts +90 -0
- package/dist/services/ExposedApiRegistry/contracts/policy.js +169 -0
- package/dist/services/ExposedApiRegistry/contracts/registrant.d.ts +37 -0
- package/dist/services/ExposedApiRegistry/contracts/registrant.js +36 -0
- package/dist/services/ExposedApiRegistry/contracts/types.d.ts +112 -0
- package/dist/services/ExposedApiRegistry/contracts/types.js +73 -0
- package/dist/services/ExposedApiRegistry/descriptor/ExposedApiRegistryDescriptor.d.ts +44 -0
- package/dist/services/ExposedApiRegistry/descriptor/ExposedApiRegistryDescriptor.js +58 -0
- package/dist/services/ExposedApiRegistry/descriptor/tokens.d.ts +8 -0
- package/dist/services/ExposedApiRegistry/descriptor/tokens.js +8 -0
- package/dist/services/ExposedApiRegistry/index.d.ts +6 -0
- package/dist/services/ExposedApiRegistry/index.js +5 -0
- package/dist/services/ExposedApiRegistry/orchestrator/ExposedApiRegistryService.d.ts +61 -0
- package/dist/services/ExposedApiRegistry/orchestrator/ExposedApiRegistryService.js +407 -0
- package/dist/services/ExposedApiRegistry/orchestrator/index.d.ts +2 -0
- package/dist/services/ExposedApiRegistry/orchestrator/index.js +1 -0
- package/dist/services/ExposedApiRegistry/serviceModule.d.ts +10 -0
- package/dist/services/ExposedApiRegistry/serviceModule.js +20 -0
- package/dist/services/ExposedApiRegistry/storage/protection.d.ts +21 -0
- package/dist/services/ExposedApiRegistry/storage/protection.js +35 -0
- package/dist/services/ExposedApiRegistry/storage/scopeRecord.d.ts +45 -0
- package/dist/services/ExposedApiRegistry/storage/scopeRecord.js +178 -0
- package/dist/services/IdentityRegistry/contracts/errors.d.ts +88 -0
- package/dist/services/IdentityRegistry/contracts/errors.js +128 -0
- package/dist/services/IdentityRegistry/contracts/index.d.ts +5 -0
- package/dist/services/IdentityRegistry/contracts/index.js +3 -0
- package/dist/services/IdentityRegistry/contracts/types.d.ts +77 -0
- package/dist/services/IdentityRegistry/contracts/types.js +18 -0
- package/dist/services/IdentityRegistry/descriptor/descriptor.d.ts +36 -0
- package/dist/services/IdentityRegistry/descriptor/descriptor.js +44 -0
- package/dist/services/IdentityRegistry/descriptor/tokens.d.ts +8 -0
- package/dist/services/IdentityRegistry/descriptor/tokens.js +8 -0
- package/dist/services/IdentityRegistry/index.d.ts +11 -0
- package/dist/services/IdentityRegistry/index.js +6 -0
- package/dist/services/IdentityRegistry/orchestrator/IdentityRegistryService.d.ts +47 -0
- package/dist/services/IdentityRegistry/orchestrator/IdentityRegistryService.js +240 -0
- package/dist/services/IdentityRegistry/serviceModule.d.ts +10 -0
- package/dist/services/IdentityRegistry/serviceModule.js +24 -0
- package/dist/services/IdentityRegistry/storage/registryDocument.d.ts +55 -0
- package/dist/services/IdentityRegistry/storage/registryDocument.js +235 -0
- package/dist/services/Interception/contracts/IInterceptionService.d.ts +65 -0
- package/dist/services/Interception/contracts/IInterceptionService.js +1 -0
- package/dist/services/Interception/contracts/errors.d.ts +26 -0
- package/dist/services/Interception/contracts/errors.js +35 -0
- package/dist/services/Interception/contracts/index.d.ts +3 -0
- package/dist/services/Interception/contracts/index.js +3 -0
- package/dist/services/Interception/contracts/tokens.d.ts +2 -0
- package/dist/services/Interception/contracts/tokens.js +2 -0
- package/dist/services/Interception/descriptor/InterceptionDescriptor.d.ts +9 -0
- package/dist/services/Interception/descriptor/InterceptionDescriptor.js +49 -0
- package/dist/services/Interception/descriptor/tokens.d.ts +1 -0
- package/dist/services/Interception/descriptor/tokens.js +1 -0
- package/dist/services/Interception/index.d.ts +4 -0
- package/dist/services/Interception/index.js +4 -0
- package/dist/services/Interception/orchestrator/InterceptionService.d.ts +32 -0
- package/dist/services/Interception/orchestrator/InterceptionService.js +180 -0
- package/dist/services/Interception/orchestrator/index.d.ts +1 -0
- package/dist/services/Interception/orchestrator/index.js +1 -0
- package/dist/services/Interception/serviceModule.d.ts +2 -0
- package/dist/services/Interception/serviceModule.js +5 -0
- package/dist/services/Parser/contracts/IParserService.d.ts +21 -0
- package/dist/services/Parser/contracts/IParserService.js +1 -0
- package/dist/services/Parser/contracts/errors.d.ts +25 -0
- package/dist/services/Parser/contracts/errors.js +33 -0
- package/dist/services/Parser/contracts/index.d.ts +4 -0
- package/dist/services/Parser/contracts/index.js +1 -0
- package/dist/services/Parser/contracts/types.d.ts +42 -0
- package/dist/services/Parser/contracts/types.js +1 -0
- package/dist/services/Parser/descriptor/ParserDescriptor.d.ts +23 -0
- package/dist/services/Parser/descriptor/ParserDescriptor.js +50 -0
- package/dist/services/Parser/descriptor/tokens.d.ts +8 -0
- package/dist/services/Parser/descriptor/tokens.js +8 -0
- package/dist/services/Parser/index.d.ts +8 -0
- package/dist/services/Parser/index.js +8 -0
- package/dist/services/Parser/orchestrator/ParserService.d.ts +20 -0
- package/dist/services/Parser/orchestrator/ParserService.js +105 -0
- package/dist/services/Parser/orchestrator/index.d.ts +1 -0
- package/dist/services/Parser/orchestrator/index.js +1 -0
- package/dist/services/Parser/parser/indexSynthesis.d.ts +11 -0
- package/dist/services/Parser/parser/indexSynthesis.js +13 -0
- package/dist/services/Parser/parser/parameters.d.ts +14 -0
- package/dist/services/Parser/parser/parameters.js +89 -0
- package/dist/services/Parser/parser/scanner.d.ts +48 -0
- package/dist/services/Parser/parser/scanner.js +156 -0
- package/dist/services/Parser/parser/syntax.d.ts +30 -0
- package/dist/services/Parser/parser/syntax.js +34 -0
- package/dist/services/Parser/serviceModule.d.ts +2 -0
- package/dist/services/Parser/serviceModule.js +5 -0
- package/dist/services/Router/bootOptions.d.ts +2 -0
- package/dist/services/Router/bootOptions.js +2 -0
- package/dist/services/Router/contracts/IRouterService.d.ts +43 -0
- package/dist/services/Router/contracts/IRouterService.js +1 -0
- package/dist/services/Router/contracts/caller.d.ts +6 -0
- package/dist/services/Router/contracts/caller.js +6 -0
- package/dist/services/Router/contracts/errors.d.ts +56 -0
- package/dist/services/Router/contracts/errors.js +75 -0
- package/dist/services/Router/contracts/index.d.ts +8 -0
- package/dist/services/Router/contracts/index.js +4 -0
- package/dist/services/Router/contracts/kind.d.ts +7 -0
- package/dist/services/Router/contracts/kind.js +10 -0
- package/dist/services/Router/contracts/registrant.d.ts +23 -0
- package/dist/services/Router/contracts/registrant.js +13 -0
- package/dist/services/Router/contracts/types.d.ts +90 -0
- package/dist/services/Router/contracts/types.js +1 -0
- package/dist/services/Router/descriptor/RouterDescriptor.d.ts +32 -0
- package/dist/services/Router/descriptor/RouterDescriptor.js +92 -0
- package/dist/services/Router/descriptor/tokens.d.ts +9 -0
- package/dist/services/Router/descriptor/tokens.js +9 -0
- package/dist/services/Router/index.d.ts +4 -0
- package/dist/services/Router/index.js +4 -0
- package/dist/services/Router/orchestrator/RouterService.d.ts +74 -0
- package/dist/services/Router/orchestrator/RouterService.js +332 -0
- package/dist/services/Router/orchestrator/index.d.ts +2 -0
- package/dist/services/Router/orchestrator/index.js +1 -0
- package/dist/services/Router/serviceModule.d.ts +4 -0
- package/dist/services/Router/serviceModule.js +22 -0
- package/dist/services/WasmCage/index.d.ts +7 -0
- package/dist/services/WasmCage/index.js +4 -0
- package/dist/services/WasmCage/scripts/prepin.d.ts +1 -0
- package/dist/services/WasmCage/scripts/prepin.js +38 -0
- package/dist/services/WasmCage/serviceModule.d.ts +12 -0
- package/dist/services/WasmCage/serviceModule.js +18 -0
- package/dist/services/WasmCage/src/caged.d.ts +104 -0
- package/dist/services/WasmCage/src/caged.js +381 -0
- package/dist/services/WasmCage/src/descriptor.d.ts +47 -0
- package/dist/services/WasmCage/src/descriptor.js +56 -0
- package/dist/services/WasmCage/src/native.d.ts +29 -0
- package/dist/services/WasmCage/src/native.js +66 -0
- package/dist/services/WasmCage/src/nativeDigests.d.ts +9 -0
- package/dist/services/WasmCage/src/nativeDigests.js +15 -0
- package/dist/services/WasmCage/src/package.d.ts +36 -0
- package/dist/services/WasmCage/src/package.js +122 -0
- package/dist/services/shared/canonicalJson.d.ts +29 -0
- package/dist/services/shared/canonicalJson.js +93 -0
- package/dist/services/shared/documentStore.d.ts +16 -0
- package/dist/services/shared/documentStore.js +98 -0
- package/dist/src/bootstrap/bootKernelInternal.d.ts +18 -0
- package/dist/src/bootstrap/bootKernelInternal.js +420 -0
- package/dist/src/bootstrap/bootTypes.d.ts +89 -0
- package/dist/src/bootstrap/bootTypes.js +1 -0
- package/dist/src/bootstrap/config/index.d.ts +3 -0
- package/dist/src/bootstrap/config/index.js +2 -0
- package/dist/src/bootstrap/config/integrity.d.ts +34 -0
- package/dist/src/bootstrap/config/integrity.js +79 -0
- package/dist/src/bootstrap/config/parse.d.ts +15 -0
- package/dist/src/bootstrap/config/parse.js +81 -0
- package/dist/src/bootstrap/config/pathWriteGuard.d.ts +20 -0
- package/dist/src/bootstrap/config/pathWriteGuard.js +349 -0
- package/dist/src/bootstrap/config/types.d.ts +41 -0
- package/dist/src/bootstrap/config/types.js +15 -0
- package/dist/src/bootstrap/hardcore.d.ts +212 -0
- package/dist/src/bootstrap/hardcore.js +312 -0
- package/dist/src/bootstrap/hardcoreServices.d.ts +10 -0
- package/dist/src/bootstrap/hardcoreServices.js +258 -0
- package/dist/src/bootstrap/index.d.ts +8 -0
- package/dist/src/bootstrap/index.js +5 -0
- package/dist/src/bootstrap/packageRequirements.d.ts +26 -0
- package/dist/src/bootstrap/packageRequirements.js +52 -0
- package/dist/src/contracts/accessBroker.d.ts +53 -0
- package/dist/src/contracts/accessBroker.js +1 -0
- package/dist/src/contracts/brudOperation.d.ts +20 -0
- package/dist/src/contracts/brudOperation.js +20 -0
- package/dist/src/contracts/callChain.d.ts +161 -0
- package/dist/src/contracts/callChain.js +19 -0
- package/dist/src/contracts/capability.d.ts +26 -0
- package/dist/src/contracts/capability.js +26 -0
- package/dist/src/contracts/container.d.ts +17 -0
- package/dist/src/contracts/container.js +8 -0
- package/dist/src/contracts/context.d.ts +19 -0
- package/dist/src/contracts/context.js +1 -0
- package/dist/src/contracts/contextContract.d.ts +129 -0
- package/dist/src/contracts/contextContract.js +285 -0
- package/dist/src/contracts/dispatchView.d.ts +21 -0
- package/dist/src/contracts/dispatchView.js +1 -0
- package/dist/src/contracts/handler.d.ts +28 -0
- package/dist/src/contracts/handler.js +1 -0
- package/dist/src/contracts/index.d.ts +25 -0
- package/dist/src/contracts/index.js +8 -0
- package/dist/src/contracts/kernel.d.ts +60 -0
- package/dist/src/contracts/kernel.js +1 -0
- package/dist/src/contracts/lifecycle.d.ts +59 -0
- package/dist/src/contracts/lifecycle.js +1 -0
- package/dist/src/contracts/manifest.d.ts +145 -0
- package/dist/src/contracts/manifest.js +295 -0
- package/dist/src/contracts/pipeline.d.ts +8 -0
- package/dist/src/contracts/pipeline.js +1 -0
- package/dist/src/contracts/policy.d.ts +75 -0
- package/dist/src/contracts/policy.js +77 -0
- package/dist/src/contracts/registry.d.ts +7 -0
- package/dist/src/contracts/registry.js +1 -0
- package/dist/src/contracts/serviceDescriptor.d.ts +67 -0
- package/dist/src/contracts/serviceDescriptor.js +1 -0
- package/dist/src/contracts/serviceToken.d.ts +36 -0
- package/dist/src/contracts/serviceToken.js +16 -0
- package/dist/src/engine/BrudKernel.d.ts +118 -0
- package/dist/src/engine/BrudKernel.js +366 -0
- package/dist/src/engine/ExecutionPipeline.d.ts +13 -0
- package/dist/src/engine/ExecutionPipeline.js +62 -0
- package/dist/src/engine/KernelAccessBroker.d.ts +47 -0
- package/dist/src/engine/KernelAccessBroker.js +107 -0
- package/dist/src/engine/KernelRegistry.d.ts +14 -0
- package/dist/src/engine/KernelRegistry.js +33 -0
- package/dist/src/engine/OperationRegistry.d.ts +9 -0
- package/dist/src/engine/OperationRegistry.js +18 -0
- package/dist/src/engine/ServiceContainer.d.ts +13 -0
- package/dist/src/engine/ServiceContainer.js +53 -0
- package/dist/src/engine/callChain.d.ts +68 -0
- package/dist/src/engine/callChain.js +180 -0
- package/dist/src/engine/dag.d.ts +2 -0
- package/dist/src/engine/dag.js +34 -0
- package/dist/src/engine/errors.d.ts +26 -0
- package/dist/src/engine/errors.js +52 -0
- package/dist/src/engine/index.d.ts +11 -0
- package/dist/src/engine/index.js +8 -0
- package/dist/src/engine/state.d.ts +1 -0
- package/dist/src/engine/state.js +1 -0
- package/dist/src/validation/jsonSchema/compile.d.ts +8 -0
- package/dist/src/validation/jsonSchema/compile.js +386 -0
- package/dist/src/validation/jsonSchema/index.d.ts +3 -0
- package/dist/src/validation/jsonSchema/index.js +2 -0
- package/dist/src/validation/jsonSchema/jsonValue.d.ts +29 -0
- package/dist/src/validation/jsonSchema/jsonValue.js +190 -0
- package/dist/src/validation/jsonSchema/pattern.d.ts +28 -0
- package/dist/src/validation/jsonSchema/pattern.js +155 -0
- package/dist/src/validation/jsonSchema/types.d.ts +71 -0
- package/dist/src/validation/jsonSchema/types.js +15 -0
- package/package.json +59 -4
- package/services/WasmCage/native/brud-wasm-cage.darwin-arm64.node +0 -0
- package/services/WasmCage/native/brud-wasm-cage.darwin-x64.node +0 -0
- package/services/WasmCage/native/brud-wasm-cage.linux-arm64-gnu.node +0 -0
- package/services/WasmCage/native/brud-wasm-cage.linux-x64-gnu.node +0 -0
- package/services/WasmCage/native/brud-wasm-cage.win32-x64-msvc.node +0 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
1
|
+
Apache License
|
|
2
|
+
Version 2.0, January 2004
|
|
3
|
+
http://www.apache.org/licenses/
|
|
4
|
+
|
|
5
|
+
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
|
|
6
|
+
|
|
7
|
+
1. Definitions.
|
|
8
|
+
|
|
9
|
+
"License" shall mean the terms and conditions for use, reproduction,
|
|
10
|
+
and distribution as defined by Sections 1 through 9 of this document.
|
|
11
|
+
|
|
12
|
+
"Licensor" shall mean the copyright owner or entity authorized by
|
|
13
|
+
the copyright owner that is granting the License.
|
|
14
|
+
|
|
15
|
+
"Legal Entity" shall mean the union of the acting entity and all
|
|
16
|
+
other entities that control, are controlled by, or are under common
|
|
17
|
+
control with that entity. For the purposes of this definition,
|
|
18
|
+
"control" means (i) the power, direct or indirect, to cause the
|
|
19
|
+
direction or management of such entity, whether by contract or
|
|
20
|
+
otherwise, or (ii) ownership of fifty percent (50%) or more of the
|
|
21
|
+
outstanding shares, or (iii) beneficial ownership of such entity.
|
|
22
|
+
|
|
23
|
+
"You" (or "Your") shall mean an individual or Legal Entity
|
|
24
|
+
exercising permissions granted by this License.
|
|
25
|
+
|
|
26
|
+
"Source" form shall mean the preferred form for making modifications,
|
|
27
|
+
including but not limited to software source code, documentation
|
|
28
|
+
source, and configuration files.
|
|
29
|
+
|
|
30
|
+
"Object" form shall mean any form resulting from mechanical
|
|
31
|
+
transformation or translation of a Source form, including but
|
|
32
|
+
not limited to compiled object code, generated documentation,
|
|
33
|
+
and conversions to other media types.
|
|
34
|
+
|
|
35
|
+
"Work" shall mean the work of authorship, whether in Source or
|
|
36
|
+
Object form, made available under the License, as indicated by a
|
|
37
|
+
copyright notice that is included in or attached to the work
|
|
38
|
+
(an example is provided in the Appendix below).
|
|
39
|
+
|
|
40
|
+
"Derivative Works" shall mean any work, whether in Source or Object
|
|
41
|
+
form, that is based on (or derived from) the Work and for which the
|
|
42
|
+
editorial revisions, annotations, elaborations, or other modifications
|
|
43
|
+
represent, as a whole, an original work of authorship. For the purposes
|
|
44
|
+
of this License, Derivative Works shall not include works that remain
|
|
45
|
+
separable from, or merely link (or bind by name) to the interfaces of,
|
|
46
|
+
the Work and Derivative Works thereof.
|
|
47
|
+
|
|
48
|
+
"Contribution" shall mean any work of authorship, including
|
|
49
|
+
the original version of the Work and any modifications or additions
|
|
50
|
+
to that Work or Derivative Works thereof, that is intentionally
|
|
51
|
+
submitted to Licensor for inclusion in the Work by the copyright owner
|
|
52
|
+
or by an individual or Legal Entity authorized to submit on behalf of
|
|
53
|
+
the copyright owner. For the purposes of this definition, "submitted"
|
|
54
|
+
means any form of electronic, verbal, or written communication sent
|
|
55
|
+
to the Licensor or its representatives, including but not limited to
|
|
56
|
+
communication on electronic mailing lists, source code control systems,
|
|
57
|
+
and issue tracking systems that are managed by, or on behalf of, the
|
|
58
|
+
Licensor for the purpose of discussing and improving the Work, but
|
|
59
|
+
excluding communication that is conspicuously marked or otherwise
|
|
60
|
+
designated in writing by the copyright owner as "Not a Contribution."
|
|
61
|
+
|
|
62
|
+
"Contributor" shall mean Licensor and any individual or Legal Entity
|
|
63
|
+
on behalf of whom a Contribution has been received by Licensor and
|
|
64
|
+
subsequently incorporated within the Work.
|
|
65
|
+
|
|
66
|
+
2. Grant of Copyright License. Subject to the terms and conditions of
|
|
67
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
68
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
69
|
+
copyright license to reproduce, prepare Derivative Works of,
|
|
70
|
+
publicly display, publicly perform, sublicense, and distribute the
|
|
71
|
+
Work and such Derivative Works in Source or Object form.
|
|
72
|
+
|
|
73
|
+
3. Grant of Patent License. Subject to the terms and conditions of
|
|
74
|
+
this License, each Contributor hereby grants to You a perpetual,
|
|
75
|
+
worldwide, non-exclusive, no-charge, royalty-free, irrevocable
|
|
76
|
+
(except as stated in this section) patent license to make, have made,
|
|
77
|
+
use, offer to sell, sell, import, and otherwise transfer the Work,
|
|
78
|
+
where such license applies only to those patent claims licensable
|
|
79
|
+
by such Contributor that are necessarily infringed by their
|
|
80
|
+
Contribution(s) alone or by combination of their Contribution(s)
|
|
81
|
+
with the Work to which such Contribution(s) was submitted. If You
|
|
82
|
+
institute patent litigation against any entity (including a
|
|
83
|
+
cross-claim or counterclaim in a lawsuit) alleging that the Work
|
|
84
|
+
or a Contribution incorporated within the Work constitutes direct
|
|
85
|
+
or contributory patent infringement, then any patent licenses
|
|
86
|
+
granted to You under this License for that Work shall terminate
|
|
87
|
+
as of the date such litigation is filed.
|
|
88
|
+
|
|
89
|
+
4. Redistribution. You may reproduce and distribute copies of the
|
|
90
|
+
Work or Derivative Works thereof in any medium, with or without
|
|
91
|
+
modifications, and in Source or Object form, provided that You
|
|
92
|
+
meet the following conditions:
|
|
93
|
+
|
|
94
|
+
(a) You must give any other recipients of the Work or
|
|
95
|
+
Derivative Works a copy of this License; and
|
|
96
|
+
|
|
97
|
+
(b) You must cause any modified files to carry prominent notices
|
|
98
|
+
stating that You changed the files; and
|
|
99
|
+
|
|
100
|
+
(c) You must retain, in the Source form of any Derivative Works
|
|
101
|
+
that You distribute, all copyright, patent, trademark, and
|
|
102
|
+
attribution notices from the Source form of the Work,
|
|
103
|
+
excluding those notices that do not pertain to any part of
|
|
104
|
+
the Derivative Works; and
|
|
105
|
+
|
|
106
|
+
(d) If the Work includes a "NOTICE" text file as part of its
|
|
107
|
+
distribution, then any Derivative Works that You distribute must
|
|
108
|
+
include a readable copy of the attribution notices contained
|
|
109
|
+
within such NOTICE file, excluding those notices that do not
|
|
110
|
+
pertain to any part of the Derivative Works, in at least one
|
|
111
|
+
of the following places: within a NOTICE text file distributed
|
|
112
|
+
as part of the Derivative Works; within the Source form or
|
|
113
|
+
documentation, if provided along with the Derivative Works; or,
|
|
114
|
+
within a display generated by the Derivative Works, if and
|
|
115
|
+
wherever such third-party notices normally appear. The contents
|
|
116
|
+
of the NOTICE file are for informational purposes only and
|
|
117
|
+
do not modify the License. You may add Your own attribution
|
|
118
|
+
notices within Derivative Works that You distribute, alongside
|
|
119
|
+
or as an addendum to the NOTICE text from the Work, provided
|
|
120
|
+
that such additional attribution notices cannot be construed
|
|
121
|
+
as modifying the License.
|
|
122
|
+
|
|
123
|
+
You may add Your own copyright statement to Your modifications and
|
|
124
|
+
may provide additional or different license terms and conditions
|
|
125
|
+
for use, reproduction, or distribution of Your modifications, or
|
|
126
|
+
for any such Derivative Works as a whole, provided Your use,
|
|
127
|
+
reproduction, and distribution of the Work otherwise complies with
|
|
128
|
+
the conditions stated in this License.
|
|
129
|
+
|
|
130
|
+
5. Submission of Contributions. Unless You explicitly state otherwise,
|
|
131
|
+
any Contribution intentionally submitted for inclusion in the Work
|
|
132
|
+
by You to the Licensor shall be under the terms and conditions of
|
|
133
|
+
this License, without any additional terms or conditions.
|
|
134
|
+
Notwithstanding the above, nothing herein shall supersede or modify
|
|
135
|
+
the terms of any separate license agreement you may have executed
|
|
136
|
+
with Licensor regarding such Contributions.
|
|
137
|
+
|
|
138
|
+
6. Trademarks. This License does not grant permission to use the trade
|
|
139
|
+
names, trademarks, service marks, or product names of the Licensor,
|
|
140
|
+
except as required for reasonable and customary use in describing the
|
|
141
|
+
origin of the Work and reproducing the content of the NOTICE file.
|
|
142
|
+
|
|
143
|
+
7. Disclaimer of Warranty. Unless required by applicable law or
|
|
144
|
+
agreed to in writing, Licensor provides the Work (and each
|
|
145
|
+
Contributor provides its Contributions) on an "AS IS" BASIS,
|
|
146
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
|
|
147
|
+
implied, including, without limitation, any warranties or conditions
|
|
148
|
+
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
|
|
149
|
+
PARTICULAR PURPOSE. You are solely responsible for determining the
|
|
150
|
+
appropriateness of using or redistributing the Work and assume any
|
|
151
|
+
risks associated with Your exercise of permissions under this License.
|
|
152
|
+
|
|
153
|
+
8. Limitation of Liability. In no event and under no legal theory,
|
|
154
|
+
whether in tort (including negligence), contract, or otherwise,
|
|
155
|
+
unless required by applicable law (such as deliberate and grossly
|
|
156
|
+
negligent acts) or agreed to in writing, shall any Contributor be
|
|
157
|
+
liable to You for damages, including any direct, indirect, special,
|
|
158
|
+
incidental, or consequential damages of any character arising as a
|
|
159
|
+
result of this License or out of the use or inability to use the
|
|
160
|
+
Work (including but not limited to damages for loss of goodwill,
|
|
161
|
+
work stoppage, computer failure or malfunction, or any and all
|
|
162
|
+
other commercial damages or losses), even if such Contributor
|
|
163
|
+
has been advised of the possibility of such damages.
|
|
164
|
+
|
|
165
|
+
9. Accepting Warranty or Additional Liability. While redistributing
|
|
166
|
+
the Work or Derivative Works thereof, You may choose to offer,
|
|
167
|
+
and charge a fee for, acceptance of support, warranty, indemnity,
|
|
168
|
+
or other liability obligations and/or rights consistent with this
|
|
169
|
+
License. However, in accepting such obligations, You may act only
|
|
170
|
+
on Your own behalf and on Your sole responsibility, not on behalf
|
|
171
|
+
of any other Contributor, and only if You agree to indemnify,
|
|
172
|
+
defend, and hold each Contributor harmless for any liability
|
|
173
|
+
incurred by, or claims asserted against, such Contributor by reason
|
|
174
|
+
of your accepting any such warranty or additional liability.
|
|
175
|
+
|
|
176
|
+
END OF TERMS AND CONDITIONS
|
|
177
|
+
|
|
178
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Akkhar-Labs
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
package/README.md
CHANGED
|
@@ -1,3 +1,64 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @brud/kernel
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The BrudOS kernel: boots a set of participants, gives each one an identity, and enforces who may call what.
|
|
4
|
+
|
|
5
|
+
## What is BrudOS?
|
|
6
|
+
|
|
7
|
+
BrudOS is a small kernel you embed in a program to build software out of independent pieces, called **participants**, that do not have to trust each other. The kernel gives every participant an identity, lets each participant decide who may call its APIs, and enforces that on every call.
|
|
8
|
+
|
|
9
|
+
The kernel has no abilities of its own: it does not read files, use the network or run commands. That makes it a good base for plugin systems and AI-agent runtimes, where you need to know exactly who was allowed to do what.
|
|
10
|
+
|
|
11
|
+
> **Status: beta (0.0.x).** The core works and is tested, but APIs may still change before 1.0.
|
|
12
|
+
|
|
13
|
+
## Which package do I need?
|
|
14
|
+
|
|
15
|
+
BrudOS is published as four packages. Install only what you need.
|
|
16
|
+
|
|
17
|
+
| Package | Use it to | Install |
|
|
18
|
+
|---|---|---|
|
|
19
|
+
| **`@brud/kernel`** (this package) | The engine. Embed it in your program to run participants. | `npm install @brud/kernel` |
|
|
20
|
+
| [`@brud/sdk`](https://www.npmjs.com/package/@brud/sdk) | Write and test participants (plugins, services, agent tools). | `npm install @brud/sdk @brud/kernel` |
|
|
21
|
+
| [`@brud/daemon`](https://www.npmjs.com/package/@brud/daemon) | Run kernels as a local background process that editors, agents and scripts connect to. | `npm install @brud/daemon` |
|
|
22
|
+
| [`@brud/protocol`](https://www.npmjs.com/package/@brud/protocol) | The message types the daemon and its clients share. Installed with the daemon; you only need it directly to write your own client. | `npm install @brud/protocol` |
|
|
23
|
+
|
|
24
|
+
New to BrudOS? Start with the [introduction](https://github.com/rahatarch/brud/tree/main/docs-next/01-introduction/what-is-brudos.md) and the [getting-started guide](https://github.com/rahatarch/brud/tree/main/docs-next/02-getting-started).
|
|
25
|
+
|
|
26
|
+
## Install
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
npm install @brud/kernel
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
Requires Node.js 22 or newer. The package is ESM only.
|
|
33
|
+
|
|
34
|
+
## What you get
|
|
35
|
+
|
|
36
|
+
- **`bootKernel(configPath, { options })`** reads a composition (a small `brud.config.json` listing the participants to run), checks the seven built-in core services against pinned content hashes, starts your participants, and returns a running kernel.
|
|
37
|
+
- **`kernel.runHostCall({ capabilities }, callback)`** is how your program makes calls into the kernel.
|
|
38
|
+
- **`kernel.shutdown()`** stops it.
|
|
39
|
+
- **Types** for writing participants. In practice you will write them with [`@brud/sdk`](https://www.npmjs.com/package/@brud/sdk).
|
|
40
|
+
|
|
41
|
+
## Quick start
|
|
42
|
+
|
|
43
|
+
```js
|
|
44
|
+
import { bootKernel } from '@brud/kernel';
|
|
45
|
+
|
|
46
|
+
const kernel = await bootKernel('./brud.config.json', { options: {} });
|
|
47
|
+
// make calls inside kernel.runHostCall(...)
|
|
48
|
+
await kernel.shutdown();
|
|
49
|
+
```
|
|
50
|
+
|
|
51
|
+
A kernel needs a composition and at least one participant, so the fastest way to a working example is the tested tutorial: [Boot a kernel and call it](https://github.com/rahatarch/brud/tree/main/docs-next/02-getting-started/boot-a-kernel-and-call-it.md).
|
|
52
|
+
|
|
53
|
+
## Good to know
|
|
54
|
+
|
|
55
|
+
- The package bundles prebuilt WebAssembly sandbox binaries for Linux (x64, arm64), macOS (x64, arm64) and Windows (x64). Untrusted participants run inside that sandbox. This makes the install large (about 47 MB unpacked).
|
|
56
|
+
- The kernel has no runtime dependencies.
|
|
57
|
+
|
|
58
|
+
## Documentation
|
|
59
|
+
|
|
60
|
+
[BrudOS documentation](https://github.com/rahatarch/brud/tree/main/docs-next) · [Report an issue](https://github.com/rahatarch/brud/issues)
|
|
61
|
+
|
|
62
|
+
## License
|
|
63
|
+
|
|
64
|
+
[Apache-2.0](LICENSE)
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export * from './src/contracts/index.js';
|
|
2
|
+
export type { DispatchCallerView, DispatchContextView } from './src/contracts/dispatchView.js';
|
|
3
|
+
export * from './src/bootstrap/index.js';
|
|
4
|
+
export * from './services/IdentityRegistry/index.js';
|
|
5
|
+
export * from './services/ExposedApiRegistry/index.js';
|
|
6
|
+
export { ServiceContainer } from './src/engine/ServiceContainer.js';
|
|
7
|
+
export { OperationRegistry } from './src/engine/OperationRegistry.js';
|
|
8
|
+
export { ExecutionPipeline } from './src/engine/ExecutionPipeline.js';
|
|
9
|
+
export { BrudKernel } from './src/engine/BrudKernel.js';
|
|
10
|
+
export { KernelRegistry } from './src/engine/KernelRegistry.js';
|
|
11
|
+
export { KernelAccessBroker } from './src/engine/KernelAccessBroker.js';
|
|
12
|
+
export type { KernelStateChecker } from './src/engine/KernelAccessBroker.js';
|
|
13
|
+
export { topologicalSort } from './src/engine/dag.js';
|
|
14
|
+
export { LifecycleStateError, CircularDependencyError, MissingDependencyError, ServiceNotFoundError, } from './src/engine/errors.js';
|
|
15
|
+
export type { KernelLifecycleState } from './src/engine/state.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export * from './src/contracts/index.js';
|
|
2
|
+
export * from './src/bootstrap/index.js';
|
|
3
|
+
// Hardcore services shipped inside the kernel package.
|
|
4
|
+
export * from './services/IdentityRegistry/index.js';
|
|
5
|
+
export * from './services/ExposedApiRegistry/index.js';
|
|
6
|
+
export { ServiceContainer } from './src/engine/ServiceContainer.js';
|
|
7
|
+
export { OperationRegistry } from './src/engine/OperationRegistry.js';
|
|
8
|
+
export { ExecutionPipeline } from './src/engine/ExecutionPipeline.js';
|
|
9
|
+
export { BrudKernel } from './src/engine/BrudKernel.js';
|
|
10
|
+
export { KernelRegistry } from './src/engine/KernelRegistry.js';
|
|
11
|
+
export { KernelAccessBroker } from './src/engine/KernelAccessBroker.js';
|
|
12
|
+
export { topologicalSort } from './src/engine/dag.js';
|
|
13
|
+
export { LifecycleStateError, CircularDependencyError, MissingDependencyError, ServiceNotFoundError, } from './src/engine/errors.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/Events/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/Events/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/ExposedApiRegistry/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/ExposedApiRegistry/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/IdentityRegistry/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/IdentityRegistry/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/Interception/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/Interception/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/Parser/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/Parser/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/Router/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/Router/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/WasmCage/serviceModule.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export * from '../services/WasmCage/serviceModule.js';
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import type { ExposedApiCaller } from '../../ExposedApiRegistry/contracts/types.js';
|
|
2
|
+
/** Backpressure a subscriber declares at subscribe time; enforced at emit. */
|
|
3
|
+
export type EventsBackpressurePolicy = 'drop-oldest' | 'refuse-emit' | 'drop-newest';
|
|
4
|
+
/** Options a subscriber passes to `subscribe`. */
|
|
5
|
+
export interface EventsSubscribeOptions {
|
|
6
|
+
/** Backpressure policy; defaults to `drop-oldest`. */
|
|
7
|
+
readonly policy?: EventsBackpressurePolicy;
|
|
8
|
+
/** Last sequence already seen; the subscription starts after it. */
|
|
9
|
+
readonly lastSequence?: number;
|
|
10
|
+
/**
|
|
11
|
+
* The end subscriber's caller view, forwarded by the event's owner when its
|
|
12
|
+
* subscription API creates the subscription on a subscriber's behalf.
|
|
13
|
+
* Honoured only when the resolver of `events.subscribe` is the event's owner.
|
|
14
|
+
*/
|
|
15
|
+
readonly subscriber?: ExposedApiCaller;
|
|
16
|
+
}
|
|
17
|
+
/** Options a subscriber passes to `pull`. */
|
|
18
|
+
export interface EventsPullOptions {
|
|
19
|
+
/** Reconnect: return the retained emits after this sequence. */
|
|
20
|
+
readonly lastSequence?: number;
|
|
21
|
+
/** Batch bound, capped by the hardcore's batch size. */
|
|
22
|
+
readonly maxBatch?: number;
|
|
23
|
+
}
|
|
24
|
+
/** One plain delivery. */
|
|
25
|
+
export interface EventDeliveryRecord {
|
|
26
|
+
readonly eventName: string;
|
|
27
|
+
readonly eventVersion: number;
|
|
28
|
+
readonly emitterIdentity: string | null;
|
|
29
|
+
readonly emitOrigin: string;
|
|
30
|
+
readonly sequence: number;
|
|
31
|
+
readonly payload: unknown;
|
|
32
|
+
}
|
|
33
|
+
/** A reason-carrying refusal, distinguishable from an empty batch. */
|
|
34
|
+
export interface EventsRefusal {
|
|
35
|
+
readonly refused: true;
|
|
36
|
+
readonly reason: 'unknown-subscription' | 'not-subscriber' | 'closed';
|
|
37
|
+
readonly detail?: string;
|
|
38
|
+
}
|
|
39
|
+
/**
|
|
40
|
+
* The emit outcome. An accepted emit carries its sequence and the
|
|
41
|
+
* subscriptions whose `refuse-emit` queue refused their copy; a refused emit
|
|
42
|
+
* consumes no sequence.
|
|
43
|
+
*/
|
|
44
|
+
export type EventsEmitResult = {
|
|
45
|
+
readonly ok: true;
|
|
46
|
+
readonly sequence: number;
|
|
47
|
+
readonly refusedSubscriptions: readonly string[];
|
|
48
|
+
} | {
|
|
49
|
+
readonly ok: false;
|
|
50
|
+
readonly reason: 'malformed' | 'refused';
|
|
51
|
+
readonly detail: string;
|
|
52
|
+
};
|
|
53
|
+
export interface IEventsService {
|
|
54
|
+
emit(name: string, payload: unknown): EventsEmitResult;
|
|
55
|
+
pull(subscriptionId: string, options?: EventsPullOptions): readonly EventDeliveryRecord[] | EventsRefusal;
|
|
56
|
+
close(subscriptionId: string): EventsRefusal | undefined;
|
|
57
|
+
list(): readonly string[];
|
|
58
|
+
/**
|
|
59
|
+
* Creates a subscription to the highest declared major of `eventName`.
|
|
60
|
+
* Returns the subscription identity the events hardcore assigns, or the
|
|
61
|
+
* uniform `null` (E-08).
|
|
62
|
+
*/
|
|
63
|
+
subscribe(eventName: string, options?: EventsSubscribeOptions): string | null;
|
|
64
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/** Stable, machine-readable codes for events-catalogue failures. */
|
|
2
|
+
export type EventErrorCode = 'EVENTS_NAME_COLLISION' | 'EVENTS_DUPLICATE_DECLARATION';
|
|
3
|
+
/** Base class for every events-catalogue domain failure. */
|
|
4
|
+
export declare abstract class EventError extends Error {
|
|
5
|
+
/** Stable, machine-readable error code. */
|
|
6
|
+
abstract readonly code: EventErrorCode;
|
|
7
|
+
protected constructor(message: string, options?: ErrorOptions);
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Raised when a second identity declares an event name another identity owns.
|
|
11
|
+
*
|
|
12
|
+
* A name is owned by the identity that first declared it, across every major
|
|
13
|
+
* version: a version upgrade keeps ownership.
|
|
14
|
+
*/
|
|
15
|
+
export declare class EventNameCollisionError extends EventError {
|
|
16
|
+
readonly code: "EVENTS_NAME_COLLISION";
|
|
17
|
+
/** Contested event name. */
|
|
18
|
+
readonly eventName: string;
|
|
19
|
+
/** Identity token that owns the name. */
|
|
20
|
+
readonly owner: string;
|
|
21
|
+
constructor(eventName: string, owner: string);
|
|
22
|
+
}
|
|
23
|
+
/** Raised when the same (name, major) event is declared twice. */
|
|
24
|
+
export declare class EventDuplicateDeclarationError extends EventError {
|
|
25
|
+
readonly code: "EVENTS_DUPLICATE_DECLARATION";
|
|
26
|
+
/** Duplicated event name. */
|
|
27
|
+
readonly eventName: string;
|
|
28
|
+
/** Duplicated major version. */
|
|
29
|
+
readonly major: number;
|
|
30
|
+
constructor(eventName: string, major: number);
|
|
31
|
+
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/** Base class for every events-catalogue domain failure. */
|
|
2
|
+
export class EventError extends Error {
|
|
3
|
+
constructor(message, options) {
|
|
4
|
+
super(message, options);
|
|
5
|
+
this.name = 'EventError';
|
|
6
|
+
}
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Raised when a second identity declares an event name another identity owns.
|
|
10
|
+
*
|
|
11
|
+
* A name is owned by the identity that first declared it, across every major
|
|
12
|
+
* version: a version upgrade keeps ownership.
|
|
13
|
+
*/
|
|
14
|
+
export class EventNameCollisionError extends EventError {
|
|
15
|
+
code = 'EVENTS_NAME_COLLISION';
|
|
16
|
+
/** Contested event name. */
|
|
17
|
+
eventName;
|
|
18
|
+
/** Identity token that owns the name. */
|
|
19
|
+
owner;
|
|
20
|
+
constructor(eventName, owner) {
|
|
21
|
+
super(`Event "${eventName}" is already owned by another identity`);
|
|
22
|
+
this.name = 'EventNameCollisionError';
|
|
23
|
+
this.eventName = eventName;
|
|
24
|
+
this.owner = owner;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/** Raised when the same (name, major) event is declared twice. */
|
|
28
|
+
export class EventDuplicateDeclarationError extends EventError {
|
|
29
|
+
code = 'EVENTS_DUPLICATE_DECLARATION';
|
|
30
|
+
/** Duplicated event name. */
|
|
31
|
+
eventName;
|
|
32
|
+
/** Duplicated major version. */
|
|
33
|
+
major;
|
|
34
|
+
constructor(eventName, major) {
|
|
35
|
+
super(`Event "${eventName}" major ${String(major)} is already declared`);
|
|
36
|
+
this.name = 'EventDuplicateDeclarationError';
|
|
37
|
+
this.eventName = eventName;
|
|
38
|
+
this.major = major;
|
|
39
|
+
}
|
|
40
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import type { ServiceTier } from '../../../src/contracts/lifecycle.js';
|
|
2
|
+
import type { ServiceDescriptor } from '../../../src/contracts/serviceDescriptor.js';
|
|
3
|
+
import type { IEventsService } from '../contracts/IEventsService.js';
|
|
4
|
+
import { EventsService } from '../orchestrator/index.js';
|
|
5
|
+
export declare const EVENTS_SERVICE_TIER: ServiceTier;
|
|
6
|
+
export declare const EVENTS_CONTRACT_VERSION = "1.0.0";
|
|
7
|
+
export declare const EVENTS_CONTRACT_METHODS: readonly ["emit", "pull", "close", "list", "subscribe"];
|
|
8
|
+
export declare function createEventsDescriptor(): ServiceDescriptor<IEventsService, EventsService>;
|
|
9
|
+
export declare const EventsDescriptor: ServiceDescriptor<IEventsService, EventsService>;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { withExposureBindings } from '../../ExposedApiRegistry/contracts/registrant.js';
|
|
2
|
+
import { EventsService } from '../orchestrator/index.js';
|
|
3
|
+
import { EventsToken } from './tokens.js';
|
|
4
|
+
export const EVENTS_SERVICE_TIER = 'core';
|
|
5
|
+
export const EVENTS_CONTRACT_VERSION = '1.0.0';
|
|
6
|
+
export const EVENTS_CONTRACT_METHODS = ['emit', 'pull', 'close', 'list', 'subscribe'];
|
|
7
|
+
/**
|
|
8
|
+
* Per-exposure projection bindings.
|
|
9
|
+
*
|
|
10
|
+
* Each mechanism exposure resolves to a narrowed object exposing only its own
|
|
11
|
+
* method, so a caller that resolves `events.emit` cannot reach `pull`, `close`,
|
|
12
|
+
* `list`, or `bindAuthority`. The delivery methods are the instance's stubs;
|
|
13
|
+
* the projections only narrow what a caller can see.
|
|
14
|
+
*/
|
|
15
|
+
function eventsExposureBindings(instance) {
|
|
16
|
+
// withExposureBindings looks up a binding by `name@major`
|
|
17
|
+
// (registrant.ts:exposureBindingKey), so each key carries its major version.
|
|
18
|
+
// The registry runs projection calls as the owner (the events hardcore), so
|
|
19
|
+
// each projection captures the resolver's caller view at resolve time and
|
|
20
|
+
// threads it into the instance (delegation by the owner, Step 5).
|
|
21
|
+
return {
|
|
22
|
+
'events.emit@1': { projection: (_service, caller) => ({ emit: (name, payload) => instance.emitAs(caller, name, payload) }) },
|
|
23
|
+
'events.pull@1': { projection: (_service, caller) => ({ pull: (subscriptionId, options) => instance.pullAs(caller, subscriptionId, options) }) },
|
|
24
|
+
'events.close@1': { projection: (_service, caller) => ({ close: (subscriptionId) => instance.closeAs(caller, subscriptionId) }) },
|
|
25
|
+
'events.list@1': { projection: () => ({ list: () => instance.list() }) },
|
|
26
|
+
'events.subscribe@1': { projection: (_service, caller) => ({ subscribe: (eventName, options) => instance.subscribeAs(caller, eventName, options) }) },
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
export function createEventsDescriptor() {
|
|
30
|
+
return {
|
|
31
|
+
token: EventsToken,
|
|
32
|
+
tier: EVENTS_SERVICE_TIER,
|
|
33
|
+
dependencies: [],
|
|
34
|
+
contract: {
|
|
35
|
+
version: EVENTS_CONTRACT_VERSION,
|
|
36
|
+
methods: EVENTS_CONTRACT_METHODS,
|
|
37
|
+
},
|
|
38
|
+
accessPolicy: {
|
|
39
|
+
allowedCallers: ['kernel'],
|
|
40
|
+
},
|
|
41
|
+
manifest: {
|
|
42
|
+
exposures: [
|
|
43
|
+
{ name: 'events.emit', version: 1, scope: 'runtime' },
|
|
44
|
+
{ name: 'events.pull', version: 1, scope: 'runtime' },
|
|
45
|
+
{ name: 'events.close', version: 1, scope: 'runtime' },
|
|
46
|
+
{ name: 'events.list', version: 1, scope: 'runtime' },
|
|
47
|
+
{ name: 'events.subscribe', version: 1, scope: 'runtime' },
|
|
48
|
+
],
|
|
49
|
+
},
|
|
50
|
+
factory: () => {
|
|
51
|
+
const instance = new EventsService();
|
|
52
|
+
return withExposureBindings(instance, eventsExposureBindings(instance));
|
|
53
|
+
},
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
export const EventsDescriptor = createEventsDescriptor();
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EventsToken } from '../contracts/tokens.js';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { EventsToken } from '../contracts/tokens.js';
|