@brud/kernel 0.0.1 → 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.
- package/LICENSE +0 -0
- package/README.md +0 -0
- package/dist/index.d.ts +0 -0
- package/dist/index.js +0 -0
- package/dist/serviceModules/events.d.ts +0 -0
- package/dist/serviceModules/events.js +0 -0
- package/dist/serviceModules/exposedApiRegistry.d.ts +0 -0
- package/dist/serviceModules/exposedApiRegistry.js +0 -0
- package/dist/serviceModules/identityRegistry.d.ts +0 -0
- package/dist/serviceModules/identityRegistry.js +0 -0
- package/dist/serviceModules/interception.d.ts +0 -0
- package/dist/serviceModules/interception.js +0 -0
- package/dist/serviceModules/parser.d.ts +0 -0
- package/dist/serviceModules/parser.js +0 -0
- package/dist/serviceModules/router.d.ts +0 -0
- package/dist/serviceModules/router.js +0 -0
- package/dist/serviceModules/wasmCage.d.ts +0 -0
- package/dist/serviceModules/wasmCage.js +0 -0
- package/dist/services/Events/contracts/IEventsService.d.ts +0 -0
- package/dist/services/Events/contracts/IEventsService.js +0 -0
- package/dist/services/Events/contracts/errors.d.ts +0 -0
- package/dist/services/Events/contracts/errors.js +0 -0
- package/dist/services/Events/contracts/index.d.ts +0 -0
- package/dist/services/Events/contracts/index.js +0 -0
- package/dist/services/Events/contracts/tokens.d.ts +0 -0
- package/dist/services/Events/contracts/tokens.js +0 -0
- package/dist/services/Events/descriptor/EventsDescriptor.d.ts +0 -0
- package/dist/services/Events/descriptor/EventsDescriptor.js +0 -0
- package/dist/services/Events/descriptor/tokens.d.ts +0 -0
- package/dist/services/Events/descriptor/tokens.js +0 -0
- package/dist/services/Events/index.d.ts +0 -0
- package/dist/services/Events/index.js +0 -0
- package/dist/services/Events/orchestrator/EventsService.d.ts +0 -0
- package/dist/services/Events/orchestrator/EventsService.js +0 -0
- package/dist/services/Events/orchestrator/index.d.ts +0 -0
- package/dist/services/Events/orchestrator/index.js +0 -0
- package/dist/services/Events/orchestrator/limits.d.ts +0 -0
- package/dist/services/Events/orchestrator/limits.js +0 -0
- package/dist/services/Events/serviceModule.d.ts +0 -0
- package/dist/services/Events/serviceModule.js +0 -0
- package/dist/services/ExposedApiRegistry/contracts/IExposedApiRegistry.d.ts +13 -1
- package/dist/services/ExposedApiRegistry/contracts/IExposedApiRegistry.js +0 -0
- package/dist/services/ExposedApiRegistry/contracts/errors.d.ts +0 -0
- package/dist/services/ExposedApiRegistry/contracts/errors.js +0 -0
- package/dist/services/ExposedApiRegistry/contracts/index.d.ts +1 -1
- package/dist/services/ExposedApiRegistry/contracts/index.js +0 -0
- package/dist/services/ExposedApiRegistry/contracts/policy.d.ts +0 -0
- package/dist/services/ExposedApiRegistry/contracts/policy.js +0 -0
- package/dist/services/ExposedApiRegistry/contracts/registrant.d.ts +0 -0
- package/dist/services/ExposedApiRegistry/contracts/registrant.js +0 -0
- package/dist/services/ExposedApiRegistry/contracts/types.d.ts +21 -0
- package/dist/services/ExposedApiRegistry/contracts/types.js +0 -0
- package/dist/services/ExposedApiRegistry/descriptor/ExposedApiRegistryDescriptor.d.ts +2 -2
- package/dist/services/ExposedApiRegistry/descriptor/ExposedApiRegistryDescriptor.js +2 -2
- package/dist/services/ExposedApiRegistry/descriptor/tokens.d.ts +0 -0
- package/dist/services/ExposedApiRegistry/descriptor/tokens.js +0 -0
- package/dist/services/ExposedApiRegistry/index.d.ts +0 -0
- package/dist/services/ExposedApiRegistry/index.js +0 -0
- package/dist/services/ExposedApiRegistry/orchestrator/ExposedApiRegistryService.d.ts +9 -2
- package/dist/services/ExposedApiRegistry/orchestrator/ExposedApiRegistryService.js +50 -5
- package/dist/services/ExposedApiRegistry/orchestrator/index.d.ts +0 -0
- package/dist/services/ExposedApiRegistry/orchestrator/index.js +0 -0
- package/dist/services/ExposedApiRegistry/serviceModule.d.ts +0 -0
- package/dist/services/ExposedApiRegistry/serviceModule.js +0 -0
- package/dist/services/ExposedApiRegistry/storage/protection.d.ts +0 -0
- package/dist/services/ExposedApiRegistry/storage/protection.js +0 -0
- package/dist/services/ExposedApiRegistry/storage/scopeRecord.d.ts +0 -0
- package/dist/services/ExposedApiRegistry/storage/scopeRecord.js +0 -0
- package/dist/services/IdentityRegistry/contracts/errors.d.ts +0 -0
- package/dist/services/IdentityRegistry/contracts/errors.js +0 -0
- package/dist/services/IdentityRegistry/contracts/index.d.ts +0 -0
- package/dist/services/IdentityRegistry/contracts/index.js +0 -0
- package/dist/services/IdentityRegistry/contracts/types.d.ts +0 -0
- package/dist/services/IdentityRegistry/contracts/types.js +0 -0
- package/dist/services/IdentityRegistry/descriptor/descriptor.d.ts +0 -0
- package/dist/services/IdentityRegistry/descriptor/descriptor.js +0 -0
- package/dist/services/IdentityRegistry/descriptor/tokens.d.ts +0 -0
- package/dist/services/IdentityRegistry/descriptor/tokens.js +0 -0
- package/dist/services/IdentityRegistry/index.d.ts +0 -0
- package/dist/services/IdentityRegistry/index.js +0 -0
- package/dist/services/IdentityRegistry/orchestrator/IdentityRegistryService.d.ts +0 -0
- package/dist/services/IdentityRegistry/orchestrator/IdentityRegistryService.js +0 -0
- package/dist/services/IdentityRegistry/serviceModule.d.ts +0 -0
- package/dist/services/IdentityRegistry/serviceModule.js +0 -0
- package/dist/services/IdentityRegistry/storage/registryDocument.d.ts +0 -0
- package/dist/services/IdentityRegistry/storage/registryDocument.js +0 -0
- package/dist/services/Interception/contracts/IInterceptionService.d.ts +91 -1
- package/dist/services/Interception/contracts/IInterceptionService.js +12 -1
- package/dist/services/Interception/contracts/errors.d.ts +0 -0
- package/dist/services/Interception/contracts/errors.js +0 -0
- package/dist/services/Interception/contracts/index.d.ts +0 -0
- package/dist/services/Interception/contracts/index.js +0 -0
- package/dist/services/Interception/contracts/tokens.d.ts +0 -0
- package/dist/services/Interception/contracts/tokens.js +0 -0
- package/dist/services/Interception/descriptor/InterceptionDescriptor.d.ts +1 -1
- package/dist/services/Interception/descriptor/InterceptionDescriptor.js +2 -1
- package/dist/services/Interception/descriptor/tokens.d.ts +0 -0
- package/dist/services/Interception/descriptor/tokens.js +0 -0
- package/dist/services/Interception/index.d.ts +0 -0
- package/dist/services/Interception/index.js +0 -0
- package/dist/services/Interception/orchestrator/InterceptionService.d.ts +9 -1
- package/dist/services/Interception/orchestrator/InterceptionService.js +167 -4
- package/dist/services/Interception/orchestrator/index.d.ts +0 -0
- package/dist/services/Interception/orchestrator/index.js +0 -0
- package/dist/services/Interception/serviceModule.d.ts +0 -0
- package/dist/services/Interception/serviceModule.js +0 -0
- package/dist/services/Parser/contracts/IParserService.d.ts +0 -0
- package/dist/services/Parser/contracts/IParserService.js +0 -0
- package/dist/services/Parser/contracts/errors.d.ts +0 -0
- package/dist/services/Parser/contracts/errors.js +0 -0
- package/dist/services/Parser/contracts/index.d.ts +0 -0
- package/dist/services/Parser/contracts/index.js +0 -0
- package/dist/services/Parser/contracts/types.d.ts +0 -0
- package/dist/services/Parser/contracts/types.js +0 -0
- package/dist/services/Parser/descriptor/ParserDescriptor.d.ts +0 -0
- package/dist/services/Parser/descriptor/ParserDescriptor.js +0 -0
- package/dist/services/Parser/descriptor/tokens.d.ts +0 -0
- package/dist/services/Parser/descriptor/tokens.js +0 -0
- package/dist/services/Parser/index.d.ts +0 -0
- package/dist/services/Parser/index.js +0 -0
- package/dist/services/Parser/orchestrator/ParserService.d.ts +0 -0
- package/dist/services/Parser/orchestrator/ParserService.js +0 -0
- package/dist/services/Parser/orchestrator/index.d.ts +0 -0
- package/dist/services/Parser/orchestrator/index.js +0 -0
- package/dist/services/Parser/parser/indexSynthesis.d.ts +0 -0
- package/dist/services/Parser/parser/indexSynthesis.js +0 -0
- package/dist/services/Parser/parser/parameters.d.ts +0 -0
- package/dist/services/Parser/parser/parameters.js +0 -0
- package/dist/services/Parser/parser/scanner.d.ts +0 -0
- package/dist/services/Parser/parser/scanner.js +0 -0
- package/dist/services/Parser/parser/syntax.d.ts +0 -0
- package/dist/services/Parser/parser/syntax.js +0 -0
- package/dist/services/Parser/serviceModule.d.ts +0 -0
- package/dist/services/Parser/serviceModule.js +0 -0
- package/dist/services/Router/bootOptions.d.ts +0 -0
- package/dist/services/Router/bootOptions.js +0 -0
- package/dist/services/Router/contracts/IRouterService.d.ts +1 -1
- package/dist/services/Router/contracts/IRouterService.js +0 -0
- package/dist/services/Router/contracts/caller.d.ts +0 -0
- package/dist/services/Router/contracts/caller.js +0 -0
- package/dist/services/Router/contracts/errors.d.ts +12 -1
- package/dist/services/Router/contracts/errors.js +15 -0
- package/dist/services/Router/contracts/index.d.ts +2 -2
- package/dist/services/Router/contracts/index.js +1 -1
- package/dist/services/Router/contracts/kind.d.ts +0 -0
- package/dist/services/Router/contracts/kind.js +0 -0
- package/dist/services/Router/contracts/registrant.d.ts +0 -0
- package/dist/services/Router/contracts/registrant.js +0 -0
- package/dist/services/Router/contracts/types.d.ts +28 -8
- package/dist/services/Router/contracts/types.js +0 -0
- package/dist/services/Router/descriptor/RouterDescriptor.d.ts +0 -0
- package/dist/services/Router/descriptor/RouterDescriptor.js +1 -1
- package/dist/services/Router/descriptor/tokens.d.ts +0 -0
- package/dist/services/Router/descriptor/tokens.js +0 -0
- package/dist/services/Router/index.d.ts +0 -0
- package/dist/services/Router/index.js +0 -0
- package/dist/services/Router/orchestrator/RouterService.d.ts +22 -3
- package/dist/services/Router/orchestrator/RouterService.js +131 -6
- package/dist/services/Router/orchestrator/index.d.ts +0 -0
- package/dist/services/Router/orchestrator/index.js +0 -0
- package/dist/services/Router/serviceModule.d.ts +0 -0
- package/dist/services/Router/serviceModule.js +0 -0
- package/dist/services/WasmCage/index.d.ts +0 -0
- package/dist/services/WasmCage/index.js +0 -0
- package/dist/services/WasmCage/scripts/prepin.d.ts +0 -0
- package/dist/services/WasmCage/scripts/prepin.js +0 -0
- package/dist/services/WasmCage/serviceModule.d.ts +0 -0
- package/dist/services/WasmCage/serviceModule.js +0 -0
- package/dist/services/WasmCage/src/caged.d.ts +19 -2
- package/dist/services/WasmCage/src/caged.js +85 -6
- package/dist/services/WasmCage/src/descriptor.d.ts +0 -0
- package/dist/services/WasmCage/src/descriptor.js +0 -0
- package/dist/services/WasmCage/src/native.d.ts +0 -0
- package/dist/services/WasmCage/src/native.js +0 -0
- package/dist/services/WasmCage/src/nativeDigests.d.ts +0 -0
- package/dist/services/WasmCage/src/nativeDigests.js +5 -5
- package/dist/services/WasmCage/src/package.d.ts +0 -0
- package/dist/services/WasmCage/src/package.js +0 -0
- package/dist/services/shared/canonicalJson.d.ts +0 -0
- package/dist/services/shared/canonicalJson.js +0 -0
- package/dist/services/shared/documentStore.d.ts +0 -0
- package/dist/services/shared/documentStore.js +0 -0
- package/dist/src/bootstrap/bootKernelInternal.d.ts +4 -3
- package/dist/src/bootstrap/bootKernelInternal.js +284 -71
- package/dist/src/bootstrap/bootTypes.d.ts +25 -1
- package/dist/src/bootstrap/bootTypes.js +0 -0
- package/dist/src/bootstrap/config/index.d.ts +0 -0
- package/dist/src/bootstrap/config/index.js +0 -0
- package/dist/src/bootstrap/config/integrity.d.ts +11 -0
- package/dist/src/bootstrap/config/integrity.js +13 -0
- package/dist/src/bootstrap/config/parse.d.ts +0 -0
- package/dist/src/bootstrap/config/parse.js +0 -0
- package/dist/src/bootstrap/config/pathWriteGuard.d.ts +0 -0
- package/dist/src/bootstrap/config/pathWriteGuard.js +0 -0
- package/dist/src/bootstrap/config/types.d.ts +1 -1
- package/dist/src/bootstrap/config/types.js +0 -0
- package/dist/src/bootstrap/hardcore.d.ts +0 -0
- package/dist/src/bootstrap/hardcore.js +0 -0
- package/dist/src/bootstrap/hardcoreServices.d.ts +0 -0
- package/dist/src/bootstrap/hardcoreServices.js +14 -14
- package/dist/src/bootstrap/index.d.ts +6 -1
- package/dist/src/bootstrap/index.js +2 -0
- package/dist/src/bootstrap/loaded.d.ts +30 -0
- package/dist/src/bootstrap/loaded.js +45 -0
- package/dist/src/bootstrap/packageRequirements.d.ts +0 -0
- package/dist/src/bootstrap/packageRequirements.js +0 -0
- package/dist/src/bootstrap/reload.d.ts +44 -0
- package/dist/src/bootstrap/reload.js +45 -0
- package/dist/src/bootstrap/seal.d.ts +32 -0
- package/dist/src/bootstrap/seal.js +101 -0
- package/dist/src/contracts/accessBroker.d.ts +0 -0
- package/dist/src/contracts/accessBroker.js +0 -0
- package/dist/src/contracts/brudOperation.d.ts +0 -0
- package/dist/src/contracts/brudOperation.js +0 -0
- package/dist/src/contracts/callChain.d.ts +0 -0
- package/dist/src/contracts/callChain.js +0 -0
- package/dist/src/contracts/capability.d.ts +0 -0
- package/dist/src/contracts/capability.js +0 -0
- package/dist/src/contracts/capabilitySet.d.ts +23 -0
- package/dist/src/contracts/capabilitySet.js +72 -0
- package/dist/src/contracts/container.d.ts +0 -0
- package/dist/src/contracts/container.js +0 -0
- package/dist/src/contracts/context.d.ts +0 -0
- package/dist/src/contracts/context.js +0 -0
- package/dist/src/contracts/contextContract.d.ts +11 -8
- package/dist/src/contracts/contextContract.js +21 -32
- package/dist/src/contracts/dispatchView.d.ts +3 -3
- package/dist/src/contracts/dispatchView.js +0 -0
- package/dist/src/contracts/handler.d.ts +0 -7
- package/dist/src/contracts/handler.js +0 -0
- package/dist/src/contracts/index.d.ts +2 -1
- package/dist/src/contracts/index.js +1 -0
- package/dist/src/contracts/kernel.d.ts +0 -0
- package/dist/src/contracts/kernel.js +0 -0
- package/dist/src/contracts/lifecycle.d.ts +0 -0
- package/dist/src/contracts/lifecycle.js +0 -0
- package/dist/src/contracts/manifest.d.ts +35 -0
- package/dist/src/contracts/manifest.js +62 -23
- package/dist/src/contracts/pipeline.d.ts +0 -0
- package/dist/src/contracts/pipeline.js +0 -0
- package/dist/src/contracts/policy.d.ts +0 -0
- package/dist/src/contracts/policy.js +0 -0
- package/dist/src/contracts/registry.d.ts +0 -0
- package/dist/src/contracts/registry.js +0 -0
- package/dist/src/contracts/serviceDescriptor.d.ts +0 -0
- package/dist/src/contracts/serviceDescriptor.js +0 -0
- package/dist/src/contracts/serviceToken.d.ts +0 -0
- package/dist/src/contracts/serviceToken.js +0 -0
- package/dist/src/engine/BrudKernel.d.ts +2 -0
- package/dist/src/engine/BrudKernel.js +35 -6
- package/dist/src/engine/ExecutionPipeline.d.ts +0 -0
- package/dist/src/engine/ExecutionPipeline.js +0 -0
- package/dist/src/engine/KernelAccessBroker.d.ts +0 -0
- package/dist/src/engine/KernelAccessBroker.js +0 -0
- package/dist/src/engine/KernelRegistry.d.ts +0 -0
- package/dist/src/engine/KernelRegistry.js +0 -0
- package/dist/src/engine/OperationRegistry.d.ts +0 -0
- package/dist/src/engine/OperationRegistry.js +0 -0
- package/dist/src/engine/ServiceContainer.d.ts +0 -0
- package/dist/src/engine/ServiceContainer.js +0 -0
- package/dist/src/engine/callChain.d.ts +0 -0
- package/dist/src/engine/callChain.js +5 -10
- package/dist/src/engine/dag.d.ts +0 -0
- package/dist/src/engine/dag.js +0 -0
- package/dist/src/engine/errors.d.ts +0 -0
- package/dist/src/engine/errors.js +0 -0
- package/dist/src/engine/index.d.ts +0 -0
- package/dist/src/engine/index.js +0 -0
- package/dist/src/engine/state.d.ts +0 -0
- package/dist/src/engine/state.js +0 -0
- package/dist/src/validation/jsonSchema/compile.d.ts +0 -0
- package/dist/src/validation/jsonSchema/compile.js +0 -0
- package/dist/src/validation/jsonSchema/index.d.ts +0 -0
- package/dist/src/validation/jsonSchema/index.js +0 -0
- package/dist/src/validation/jsonSchema/jsonValue.d.ts +0 -0
- package/dist/src/validation/jsonSchema/jsonValue.js +0 -0
- package/dist/src/validation/jsonSchema/pattern.d.ts +0 -0
- package/dist/src/validation/jsonSchema/pattern.js +0 -0
- package/dist/src/validation/jsonSchema/types.d.ts +0 -0
- package/dist/src/validation/jsonSchema/types.js +0 -0
- package/package.json +1 -1
- 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
CHANGED
|
File without changes
|
package/README.md
CHANGED
|
File without changes
|
package/dist/index.d.ts
CHANGED
|
File without changes
|
package/dist/index.js
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ExposureDeclaration } from '../../../src/contracts/manifest.js';
|
|
2
|
-
import type { ExposedApiResolveOptions } from './types.js';
|
|
2
|
+
import type { ExposedApiRefusal, ExposedApiResolveOptions } from './types.js';
|
|
3
3
|
/**
|
|
4
4
|
* The resolution primitive, as every participant sees it.
|
|
5
5
|
*
|
|
@@ -25,6 +25,18 @@ export interface IExposedApiRegistry {
|
|
|
25
25
|
* @returns The handle, or `null`.
|
|
26
26
|
*/
|
|
27
27
|
resolve<T = unknown>(name: string, options?: ExposedApiResolveOptions): T | null;
|
|
28
|
+
/**
|
|
29
|
+
* Why the most recent `resolve` in the current call frame returned `null`.
|
|
30
|
+
*
|
|
31
|
+
* Returns `null` when that resolve succeeded or none was made in this
|
|
32
|
+
* frame. Outside any call frame (for example during a participant's
|
|
33
|
+
* synchronous `create`) it returns `no-call-context`: exposures are not
|
|
34
|
+
* attached yet, so every resolve is refused. The answer is scoped to the
|
|
35
|
+
* frame, so no other caller's refusal is ever visible. It keeps the
|
|
36
|
+
* indistinguishability above: reasons that depend on policy or on other
|
|
37
|
+
* participants all read as `unavailable`.
|
|
38
|
+
*/
|
|
39
|
+
lastRefusal(): ExposedApiRefusal | null;
|
|
28
40
|
}
|
|
29
41
|
/**
|
|
30
42
|
* Registration, as only the kernel sees it.
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -4,6 +4,6 @@ export { exposureBindingKey, isExposureProvider, withExposureBindings, } from '.
|
|
|
4
4
|
export { EXPOSED_API_MAX_POLICY_BYTES, EXPOSED_API_POLICY_VERSION, evaluateExposedApiPolicy, parseExposedApiPolicy, } from './policy.js';
|
|
5
5
|
export type { ExposedApiPolicy, ExposedApiPolicyDecision } from './policy.js';
|
|
6
6
|
export { EXPOSED_API_NAME_PATTERN, EXPOSED_API_ORIGINS, EXPOSED_API_SCOPES, exposedApiMajor, exposedApiScopeAllowsOrigin, exposedApiScopeRank, isExposedApiOrigin, isExposedApiScope, isExposedApiVersion, } from './types.js';
|
|
7
|
-
export type { ExposedApiBinding, ExposedApiCaller, ExposedApiIdentity, ExposedApiOrigin, ExposedApiProjection, ExposedApiResolveOptions, ExposedApiScope, ExposedApiVersion, } from './types.js';
|
|
7
|
+
export type { ExposedApiBinding, ExposedApiCaller, ExposedApiIdentity, ExposedApiOrigin, ExposedApiProjection, ExposedApiRefusal, ExposedApiRefusalCode, ExposedApiResolveOptions, ExposedApiScope, ExposedApiVersion, } from './types.js';
|
|
8
8
|
export type { ExposedApiErrorCode } from './errors.js';
|
|
9
9
|
export { ExposedApiDisposedError, ExposedApiDuplicateExposureError, ExposedApiError, ExposedApiInvalidNameError, ExposedApiInvalidPolicyError, ExposedApiInvalidScopeError, ExposedApiInvalidVersionError, ExposedApiNameCollisionError, ExposedApiNotAttachedError, ExposedApiOwnerPinError, ExposedApiRegistrationClosedError, ExposedApiScopeNarrowingError, ExposedApiScopeRecordCorruptError, ExposedApiScopeRecordPathError, ExposedApiScopeRecordWriteError, ExposedApiUnavailableError, } from './errors.js';
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -93,6 +93,27 @@ export interface ExposedApiBinding {
|
|
|
93
93
|
/** Layer 2 projection. Defaults to the giver's instance itself. */
|
|
94
94
|
readonly projection?: ExposedApiProjection;
|
|
95
95
|
}
|
|
96
|
+
/**
|
|
97
|
+
* Why the last `resolve` in a call frame returned `null`.
|
|
98
|
+
*
|
|
99
|
+
* `unavailable` deliberately covers every reason that depends on another
|
|
100
|
+
* participant or on policy (no such exposure, policy refuses, owner not live,
|
|
101
|
+
* owner mismatch, owner code does not provide it): a caller cannot learn from
|
|
102
|
+
* it whether an exposure exists. The other codes depend only on the caller's
|
|
103
|
+
* own request or state.
|
|
104
|
+
*/
|
|
105
|
+
export type ExposedApiRefusalCode = 'no-call-context' | 'registry-closed' | 'limit-exceeded' | 'malformed-request' | 'unavailable';
|
|
106
|
+
/** A refusal as the refused caller may read it. */
|
|
107
|
+
export interface ExposedApiRefusal {
|
|
108
|
+
/** Stable code. */
|
|
109
|
+
readonly code: ExposedApiRefusalCode;
|
|
110
|
+
/** Short fixed message for logs. Never names an exposure, owner, policy or capability. */
|
|
111
|
+
readonly message: string;
|
|
112
|
+
/** The refused caller's own root origin, when a call frame exists. */
|
|
113
|
+
readonly callerOrigin?: ExposedApiOrigin;
|
|
114
|
+
/** The refused caller's own class, when a call frame exists. */
|
|
115
|
+
readonly callerClass?: CallerClass;
|
|
116
|
+
}
|
|
96
117
|
/** Options for one resolve. */
|
|
97
118
|
export interface ExposedApiResolveOptions {
|
|
98
119
|
/** API version: a major version or a semantic version. Defaults to 1. */
|
|
File without changes
|
|
@@ -11,11 +11,11 @@ export declare const EXPOSED_API_REGISTRY_CONTRACT_VERSION = "1.0.0";
|
|
|
11
11
|
/**
|
|
12
12
|
* Methods declared for the Registry interface.
|
|
13
13
|
*
|
|
14
|
-
* `resolve`
|
|
14
|
+
* `resolve` and `lastRefusal` are open to every participant. `register` is kernel-only: the
|
|
15
15
|
* kernel calls it during admission, and it is never part of the view a
|
|
16
16
|
* participant receives.
|
|
17
17
|
*/
|
|
18
|
-
export declare const EXPOSED_API_REGISTRY_CONTRACT_METHODS: readonly ["register", "resolve"];
|
|
18
|
+
export declare const EXPOSED_API_REGISTRY_CONTRACT_METHODS: readonly ["lastRefusal", "register", "resolve"];
|
|
19
19
|
/**
|
|
20
20
|
* Optional context field holding the absolute protected scope-record path.
|
|
21
21
|
*
|
|
@@ -9,11 +9,11 @@ export const EXPOSED_API_REGISTRY_CONTRACT_VERSION = '1.0.0';
|
|
|
9
9
|
/**
|
|
10
10
|
* Methods declared for the Registry interface.
|
|
11
11
|
*
|
|
12
|
-
* `resolve`
|
|
12
|
+
* `resolve` and `lastRefusal` are open to every participant. `register` is kernel-only: the
|
|
13
13
|
* kernel calls it during admission, and it is never part of the view a
|
|
14
14
|
* participant receives.
|
|
15
15
|
*/
|
|
16
|
-
export const EXPOSED_API_REGISTRY_CONTRACT_METHODS = ['register', 'resolve'];
|
|
16
|
+
export const EXPOSED_API_REGISTRY_CONTRACT_METHODS = ['lastRefusal', 'register', 'resolve'];
|
|
17
17
|
/**
|
|
18
18
|
* Optional context field holding the absolute protected scope-record path.
|
|
19
19
|
*
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -2,7 +2,7 @@ import type { KernelCallAuthority } from '../../../src/contracts/callChain.js';
|
|
|
2
2
|
import type { IServiceLifecycle } from '../../../src/contracts/lifecycle.js';
|
|
3
3
|
import type { ExposureDeclaration } from '../../../src/contracts/manifest.js';
|
|
4
4
|
import type { IExposedApiAdmission, IExposedApiRegistry } from '../contracts/IExposedApiRegistry.js';
|
|
5
|
-
import { EXPOSED_API_NAME_PATTERN, type ExposedApiResolveOptions } from '../contracts/types.js';
|
|
5
|
+
import { EXPOSED_API_NAME_PATTERN, type ExposedApiRefusal, type ExposedApiResolveOptions } from '../contracts/types.js';
|
|
6
6
|
/** API names accept dotted, kebab, and snake segments. */
|
|
7
7
|
export { EXPOSED_API_NAME_PATTERN };
|
|
8
8
|
/** Collaborators injected into {@link ExposedApiRegistryService}. */
|
|
@@ -25,7 +25,7 @@ export interface ExposedApiRegistryDependencies {
|
|
|
25
25
|
*/
|
|
26
26
|
export declare class ExposedApiRegistryService implements IExposedApiRegistry, IExposedApiAdmission, IServiceLifecycle {
|
|
27
27
|
#private;
|
|
28
|
-
/** The only view a participant receives: `resolve`. */
|
|
28
|
+
/** The only view a participant receives: `resolve` and `lastRefusal`. */
|
|
29
29
|
readonly publicView: IExposedApiRegistry;
|
|
30
30
|
constructor(dependencies?: ExposedApiRegistryDependencies);
|
|
31
31
|
/**
|
|
@@ -58,4 +58,11 @@ export declare class ExposedApiRegistryService implements IExposedApiRegistry, I
|
|
|
58
58
|
/** Seals the registration window. Idempotent. Kernel-only. */
|
|
59
59
|
seal(): void;
|
|
60
60
|
resolve<T = unknown>(name: string, options?: ExposedApiResolveOptions): T | null;
|
|
61
|
+
/**
|
|
62
|
+
* Why the most recent `resolve` in the current call frame returned `null`.
|
|
63
|
+
*
|
|
64
|
+
* Reads only the current frame's own record, so no other caller's refusal is
|
|
65
|
+
* visible. Outside any frame the only possible refusal is the absence of one.
|
|
66
|
+
*/
|
|
67
|
+
lastRefusal(): ExposedApiRefusal | null;
|
|
61
68
|
}
|
|
@@ -26,6 +26,23 @@ function withParentCallerClass(authority, context) {
|
|
|
26
26
|
? context
|
|
27
27
|
: { ...context, parentCallerClass: parent.callerClass };
|
|
28
28
|
}
|
|
29
|
+
const REFUSAL_MESSAGES = Object.freeze({
|
|
30
|
+
'no-call-context': 'no kernel call context: exposures are not attached yet (for example during synchronous create)',
|
|
31
|
+
'registry-closed': 'the resolution primitive is closed',
|
|
32
|
+
'limit-exceeded': 'the call or request size limit was exceeded',
|
|
33
|
+
'malformed-request': 'the name or version is malformed',
|
|
34
|
+
unavailable: 'the exposure is not available to this caller (it does not exist, or policy does not admit this caller)',
|
|
35
|
+
});
|
|
36
|
+
/** Builds a refusal. Carries only what the refused caller already knows about itself. */
|
|
37
|
+
function refusalOf(code, context) {
|
|
38
|
+
return Object.freeze({
|
|
39
|
+
code,
|
|
40
|
+
message: REFUSAL_MESSAGES[code],
|
|
41
|
+
...(context === undefined
|
|
42
|
+
? {}
|
|
43
|
+
: { callerOrigin: context.origin, callerClass: context.caller.callerClass }),
|
|
44
|
+
});
|
|
45
|
+
}
|
|
29
46
|
/** Default projection: the giver's instance itself. */
|
|
30
47
|
function identityProjection(service) {
|
|
31
48
|
return service;
|
|
@@ -53,6 +70,8 @@ export class ExposedApiRegistryService {
|
|
|
53
70
|
#entries = new Map();
|
|
54
71
|
#owners = new Map();
|
|
55
72
|
#bindings = new Map();
|
|
73
|
+
/** The last refusal per call frame. Weak: an entry dies with its frame. */
|
|
74
|
+
#refusals = new WeakMap();
|
|
56
75
|
#scopes = new Map();
|
|
57
76
|
#storagePath;
|
|
58
77
|
#authority;
|
|
@@ -62,12 +81,13 @@ export class ExposedApiRegistryService {
|
|
|
62
81
|
#initialized = false;
|
|
63
82
|
#protectedRecord = false;
|
|
64
83
|
#dirty = false;
|
|
65
|
-
/** The only view a participant receives: `resolve`. */
|
|
84
|
+
/** The only view a participant receives: `resolve` and `lastRefusal`. */
|
|
66
85
|
publicView;
|
|
67
86
|
constructor(dependencies = {}) {
|
|
68
87
|
this.#storagePath = dependencies.scopeRecordPath;
|
|
69
88
|
this.publicView = Object.freeze({
|
|
70
89
|
resolve: (name, options) => this.resolve(name, options),
|
|
90
|
+
lastRefusal: () => this.lastRefusal(),
|
|
71
91
|
});
|
|
72
92
|
}
|
|
73
93
|
/**
|
|
@@ -206,8 +226,9 @@ export class ExposedApiRegistryService {
|
|
|
206
226
|
return this.#refuse(authority, undefined, 'resolve-refused', {
|
|
207
227
|
name: typeof name === 'string' ? name : null,
|
|
208
228
|
reason: 'no kernel call context',
|
|
209
|
-
});
|
|
229
|
+
}, this.#disposed ? 'registry-closed' : 'no-call-context');
|
|
210
230
|
}
|
|
231
|
+
this.#refusals.delete(context);
|
|
211
232
|
const expectedOwner = options?.expectedOwner;
|
|
212
233
|
const requestBytes = Buffer.byteLength(String(name), 'utf8')
|
|
213
234
|
+ Buffer.byteLength(typeof expectedOwner === 'string' ? expectedOwner : '', 'utf8')
|
|
@@ -216,14 +237,14 @@ export class ExposedApiRegistryService {
|
|
|
216
237
|
return this.#refuse(authority, context, 'resolve-refused', {
|
|
217
238
|
name: String(name),
|
|
218
239
|
reason: 'call or size limit exceeded',
|
|
219
|
-
});
|
|
240
|
+
}, 'limit-exceeded');
|
|
220
241
|
}
|
|
221
242
|
const version = options?.version ?? 1;
|
|
222
243
|
if (typeof name !== 'string' || !isExposedApiVersion(version)) {
|
|
223
244
|
return this.#refuse(authority, context, 'resolve-refused', {
|
|
224
245
|
name: String(name),
|
|
225
246
|
reason: 'malformed request',
|
|
226
|
-
});
|
|
247
|
+
}, 'malformed-request');
|
|
227
248
|
}
|
|
228
249
|
const entry = this.#entries.get(scopeRecordIdentityKey(name, exposedApiMajor(version)));
|
|
229
250
|
if (entry === undefined) {
|
|
@@ -261,10 +282,34 @@ export class ExposedApiRegistryService {
|
|
|
261
282
|
const instance = authority.instanceOf(entry.owner);
|
|
262
283
|
const projection = binding.projection ?? identityProjection;
|
|
263
284
|
const value = authority.runAs(entry.owner, () => projection(instance, callerView(context)));
|
|
285
|
+
if (value === null || value === undefined) {
|
|
286
|
+
// The giver declined to project for this caller. The caller sees the
|
|
287
|
+
// same refusal as for any other policy decision, and the stream records it.
|
|
288
|
+
return this.#refuse(authority, context, 'resolve-refused', {
|
|
289
|
+
name,
|
|
290
|
+
reason: 'giver projection declined this caller',
|
|
291
|
+
});
|
|
292
|
+
}
|
|
264
293
|
return this.#handle(authority, entry, value);
|
|
265
294
|
}
|
|
295
|
+
/**
|
|
296
|
+
* Why the most recent `resolve` in the current call frame returned `null`.
|
|
297
|
+
*
|
|
298
|
+
* Reads only the current frame's own record, so no other caller's refusal is
|
|
299
|
+
* visible. Outside any frame the only possible refusal is the absence of one.
|
|
300
|
+
*/
|
|
301
|
+
lastRefusal() {
|
|
302
|
+
const context = this.#authority?.current();
|
|
303
|
+
if (context === undefined) {
|
|
304
|
+
return refusalOf(this.#disposed ? 'registry-closed' : 'no-call-context');
|
|
305
|
+
}
|
|
306
|
+
return this.#refusals.get(context) ?? null;
|
|
307
|
+
}
|
|
266
308
|
/** Records a refusal on the observation stream and returns the uniform refusal. */
|
|
267
|
-
#refuse(authority, context, event, detail) {
|
|
309
|
+
#refuse(authority, context, event, detail, code = 'unavailable') {
|
|
310
|
+
if (context !== undefined) {
|
|
311
|
+
this.#refusals.set(context, refusalOf(code, context));
|
|
312
|
+
}
|
|
268
313
|
authority?.observe(OBSERVATION_SOURCE, event, {
|
|
269
314
|
...detail,
|
|
270
315
|
callerIdentity: context?.caller.identity ?? null,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -4,7 +4,7 @@ export interface InterceptedCaller {
|
|
|
4
4
|
readonly identity: string | null;
|
|
5
5
|
readonly callerClass: string;
|
|
6
6
|
readonly official: boolean;
|
|
7
|
-
readonly capabilities:
|
|
7
|
+
readonly capabilities: ReadonlySet<string>;
|
|
8
8
|
readonly origin: string;
|
|
9
9
|
}
|
|
10
10
|
/** The plain, frozen record of one intercepted call. */
|
|
@@ -39,6 +39,88 @@ export type InterceptionVerdict = {
|
|
|
39
39
|
export interface IInterceptor {
|
|
40
40
|
intercept(call: InterceptedCall): InterceptionVerdict;
|
|
41
41
|
}
|
|
42
|
+
/** A stage of interception. */
|
|
43
|
+
export type InterceptionStage = 'input' | 'output';
|
|
44
|
+
/**
|
|
45
|
+
* Largest values the output stage allows, in bytes of canonical JSON. A point
|
|
46
|
+
* may lower any of them with `outputLimits` and can never raise one.
|
|
47
|
+
*/
|
|
48
|
+
export declare const INTERCEPTION_OUTPUT_CEILINGS: Readonly<{
|
|
49
|
+
/** A giver's result, as shown to interceptors. */
|
|
50
|
+
maxResultBytes: 1048576;
|
|
51
|
+
/** The content of one interceptor's addition. */
|
|
52
|
+
maxAdditionBytes: 65536;
|
|
53
|
+
/** All additions to one result together. */
|
|
54
|
+
maxTotalBytes: 262144;
|
|
55
|
+
}>;
|
|
56
|
+
/** The intercepted call and the giver's result: plain, deep-frozen JSON. */
|
|
57
|
+
export interface InterceptedResult extends InterceptedCall {
|
|
58
|
+
/** What the giver returned. */
|
|
59
|
+
readonly result: unknown;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* An output-stage verdict. An interceptor can only add: there is no way to
|
|
63
|
+
* change, replace or remove the result, or to withhold it.
|
|
64
|
+
*/
|
|
65
|
+
export type InterceptionOutputVerdict = {
|
|
66
|
+
readonly verdict: 'none';
|
|
67
|
+
} | {
|
|
68
|
+
readonly verdict: 'append';
|
|
69
|
+
readonly content: unknown;
|
|
70
|
+
};
|
|
71
|
+
/**
|
|
72
|
+
* What an interceptor implements on its instance to take part in the output
|
|
73
|
+
* stage (non-enumerable, like `intercept`): reached only through the hardcore.
|
|
74
|
+
*/
|
|
75
|
+
export interface IResultInterceptor {
|
|
76
|
+
interceptResult(call: InterceptedResult): InterceptionOutputVerdict;
|
|
77
|
+
}
|
|
78
|
+
/** One piece of content an interceptor appended, attributed to it. */
|
|
79
|
+
export interface InterceptionAddition {
|
|
80
|
+
/** Service token of the interceptor that appended it. */
|
|
81
|
+
readonly interceptor: string;
|
|
82
|
+
/** The appended plain JSON content. */
|
|
83
|
+
readonly content: unknown;
|
|
84
|
+
}
|
|
85
|
+
/** An output-stage interceptor the kernel skipped, and why. */
|
|
86
|
+
export interface InterceptionSkipped {
|
|
87
|
+
/** Service token of the interceptor that was skipped. */
|
|
88
|
+
readonly interceptor: string;
|
|
89
|
+
/** What it did wrong: it threw, returned anything but an append, or exceeded a limit. */
|
|
90
|
+
readonly reason: string;
|
|
91
|
+
}
|
|
92
|
+
/**
|
|
93
|
+
* What a caller of an intercepted exposure receives: the giver's result
|
|
94
|
+
* exactly as returned, the additions in the order the interceptors ran, the
|
|
95
|
+
* interceptors whose contribution was taken, and the interceptors that were
|
|
96
|
+
* skipped because they misbehaved.
|
|
97
|
+
*/
|
|
98
|
+
export interface InterceptionEnvelope {
|
|
99
|
+
readonly result: unknown;
|
|
100
|
+
readonly additions: readonly InterceptionAddition[];
|
|
101
|
+
readonly interceptedBy: readonly string[];
|
|
102
|
+
readonly skipped: readonly InterceptionSkipped[];
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* The outcome of the output stage. `applied: false` means the giver returns
|
|
106
|
+
* its result as it always did: no admitted interceptor takes part in the
|
|
107
|
+
* stage, or the result is one the stage cannot carry. An interceptor that
|
|
108
|
+
* misbehaves never withholds the result: it is skipped and listed in
|
|
109
|
+
* `envelope.skipped`. `allowed: false` is returned only when the giver itself
|
|
110
|
+
* called the stage wrongly (it is not the point's owner, the point is
|
|
111
|
+
* unknown, or the arguments are not plain data).
|
|
112
|
+
*/
|
|
113
|
+
export type InterceptionResultOutcome = {
|
|
114
|
+
readonly applied: false;
|
|
115
|
+
} | {
|
|
116
|
+
readonly applied: true;
|
|
117
|
+
readonly allowed: true;
|
|
118
|
+
readonly envelope: InterceptionEnvelope;
|
|
119
|
+
} | {
|
|
120
|
+
readonly applied: true;
|
|
121
|
+
readonly allowed: false;
|
|
122
|
+
readonly reason: string;
|
|
123
|
+
};
|
|
42
124
|
/** Options the giver passes to `evaluate`. */
|
|
43
125
|
export interface InterceptionEvaluateOptions {
|
|
44
126
|
/** The caller view the giver's projection received (delegation by the owner). */
|
|
@@ -60,6 +142,14 @@ export interface IInterceptionService {
|
|
|
60
142
|
* giver's order. Only the point's owner may evaluate it.
|
|
61
143
|
*/
|
|
62
144
|
evaluate(target: string, method: string, args: readonly unknown[], options?: InterceptionEvaluateOptions): InterceptionOutcome;
|
|
145
|
+
/**
|
|
146
|
+
* Runs the output stage of the giver's interception point on the result the
|
|
147
|
+
* giver produced: each interceptor that declared the output stage may append
|
|
148
|
+
* content, in the giver's order. The result is never changed. Only the
|
|
149
|
+
* point's owner may evaluate it, and `args` are the final arguments of the
|
|
150
|
+
* call (after any input modification). The result must be plain JSON.
|
|
151
|
+
*/
|
|
152
|
+
evaluateResult(target: string, method: string, args: readonly unknown[], result: unknown, options?: InterceptionEvaluateOptions): InterceptionResultOutcome;
|
|
63
153
|
/** The interception points in this composition, as `name@major`. */
|
|
64
154
|
list(): readonly string[];
|
|
65
155
|
}
|
|
@@ -1 +1,12 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Largest values the output stage allows, in bytes of canonical JSON. A point
|
|
3
|
+
* may lower any of them with `outputLimits` and can never raise one.
|
|
4
|
+
*/
|
|
5
|
+
export const INTERCEPTION_OUTPUT_CEILINGS = Object.freeze({
|
|
6
|
+
/** A giver's result, as shown to interceptors. */
|
|
7
|
+
maxResultBytes: 1_048_576,
|
|
8
|
+
/** The content of one interceptor's addition. */
|
|
9
|
+
maxAdditionBytes: 65_536,
|
|
10
|
+
/** All additions to one result together. */
|
|
11
|
+
maxTotalBytes: 262_144,
|
|
12
|
+
});
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
@@ -4,6 +4,6 @@ import type { IInterceptionService } from '../contracts/IInterceptionService.js'
|
|
|
4
4
|
import { InterceptionService } from '../orchestrator/index.js';
|
|
5
5
|
export declare const INTERCEPTION_SERVICE_TIER: ServiceTier;
|
|
6
6
|
export declare const INTERCEPTION_CONTRACT_VERSION = "1.0.0";
|
|
7
|
-
export declare const INTERCEPTION_CONTRACT_METHODS: readonly ["evaluate", "list"];
|
|
7
|
+
export declare const INTERCEPTION_CONTRACT_METHODS: readonly ["evaluate", "evaluateResult", "list"];
|
|
8
8
|
export declare function createInterceptionDescriptor(): ServiceDescriptor<IInterceptionService, InterceptionService>;
|
|
9
9
|
export declare const InterceptionDescriptor: ServiceDescriptor<IInterceptionService, InterceptionService>;
|
|
@@ -3,7 +3,7 @@ import { InterceptionService } from '../orchestrator/index.js';
|
|
|
3
3
|
import { InterceptionToken } from './tokens.js';
|
|
4
4
|
export const INTERCEPTION_SERVICE_TIER = 'core';
|
|
5
5
|
export const INTERCEPTION_CONTRACT_VERSION = '1.0.0';
|
|
6
|
-
export const INTERCEPTION_CONTRACT_METHODS = ['evaluate', 'list'];
|
|
6
|
+
export const INTERCEPTION_CONTRACT_METHODS = ['evaluate', 'evaluateResult', 'list'];
|
|
7
7
|
/**
|
|
8
8
|
* Per-exposure projection bindings. Each projection captures the resolver's
|
|
9
9
|
* caller view at resolve time (the registry runs projection calls as the
|
|
@@ -14,6 +14,7 @@ function interceptionExposureBindings(instance) {
|
|
|
14
14
|
'interception.evaluate@1': {
|
|
15
15
|
projection: (_service, caller) => ({
|
|
16
16
|
evaluate: (target, method, args, options) => instance.evaluateAs(caller, target, method, args, options),
|
|
17
|
+
evaluateResult: (target, method, args, result, options) => instance.evaluateResultAs(caller, target, method, args, result, options),
|
|
17
18
|
}),
|
|
18
19
|
},
|
|
19
20
|
'interception.list@1': { projection: () => ({ list: () => instance.list() }) },
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|