coakka-v2-connector-bun 1.3.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/CONSUMING.md ADDED
@@ -0,0 +1,34 @@
1
+ # Consuming The Bun Connector
2
+
3
+ This lane is the Bun-facing package for the CoAkka runtime v2 connector.
4
+
5
+ Current shape:
6
+
7
+ - package name: `coakka-v2-connector-bun`
8
+ - public runtime owner alias: `BunRuntimeHost`
9
+ - client alias: `BunRuntimeClient`
10
+ - native runtime ABI: shared `libcoakka_runtime_v2`
11
+ - implementation base: the shared JS runtime connector core compiled at package
12
+ build time
13
+
14
+ The first cut intentionally reuses the shared JS runtime connector core because
15
+ Bun 1.3.14 can run the packaged native runtime path. If Bun-specific
16
+ event-loop or package-manager behavior later needs a different binding, this
17
+ lane can replace only the native binding layer without changing runtime core
18
+ semantics.
19
+
20
+ ## Minimal Smoke
21
+
22
+ ```ts
23
+ import {
24
+ BunRuntimeHost,
25
+ BunRuntimeClient,
26
+ DeliveryHint,
27
+ EndpointFlag,
28
+ PayloadFormat,
29
+ PayloadIdentity,
30
+ } from "coakka-v2-connector-bun";
31
+ ```
32
+
33
+ Use `BunRuntimeHost.start(...)` the same way Node samples use
34
+ `RuntimeHost.start(...)` or `ConnectorOrchestrator.start(...)`.
package/LICENSE.md ADDED
@@ -0,0 +1,115 @@
1
+ # CoAkka Public Artifact Preview License 1.0
2
+
3
+ Effective: 2026-07-19
4
+
5
+ This repository is the public binary artifact surface for CoAkka. It contains
6
+ headers, native libraries, connector packages, Maven artifacts, checksums, and
7
+ artifact metadata. It is not a source-build repository.
8
+
9
+ Unless a specific release artifact includes different license terms, the
10
+ artifacts in this repository are made available under the following preview
11
+ terms.
12
+
13
+ This is not an OSI-approved open source license. The separate
14
+ `coakka-samples` repository may use a permissive open source license for sample
15
+ code and documentation; that sample license does not change the terms for the
16
+ artifacts distributed from this repository.
17
+
18
+ ## Definitions
19
+
20
+ `Artifacts` means the CoAkka binaries, headers, libraries, connector packages,
21
+ Maven artifacts, container-bundle files, checksums, manifests, and release
22
+ metadata distributed from this repository or from an official release page for
23
+ this repository.
24
+
25
+ `Production` means any environment that serves live end-user traffic, live
26
+ customer data, live operational data, revenue-generating workloads, or
27
+ customer-facing workloads outside development, test, CI, sample execution, or
28
+ proof-of-concept evaluation.
29
+
30
+ `Official sample images` means container images published by the CoAkka
31
+ project or repository owner, including the current
32
+ `docker.io/gabrielgun1983/*` sample image namespace and any future images
33
+ published under an official CoAkka container namespace, that bundle unmodified
34
+ artifacts solely to run official CoAkka samples.
35
+
36
+ ## Allowed Use
37
+
38
+ You may download, copy, and use the artifacts from this repository to:
39
+
40
+ - evaluate CoAkka locally
41
+ - run the official public samples
42
+ - build proof-of-concept integrations
43
+ - run development and test environments for applications that integrate with
44
+ CoAkka
45
+ - run CI jobs, automated tests, and integration verification for
46
+ non-production applications or evaluations
47
+ - run company evaluations, proofs of concept, and integration tests,
48
+ including evaluations inside commercial organizations
49
+ - redistribute unmodified CoAkka artifacts inside local development, test, or
50
+ sample environments, provided this notice and the included checksums or
51
+ manifests remain available
52
+ - pull, cache internally, and run official sample images for local development,
53
+ CI, test, sample execution, proof-of-concept integration, and evaluation
54
+
55
+ ## Reserved Uses
56
+
57
+ The following uses require a separate written license:
58
+
59
+ - selling, hosting, or offering CoAkka artifacts as a managed runtime service
60
+ - running CoAkka artifacts in production systems
61
+ - bundling CoAkka artifacts into a product distributed to customers
62
+ - redistributing CoAkka artifacts as part of a paid product, support package,
63
+ appliance, cloud image, or hosted service
64
+ - offering a product or service that presents modified CoAkka artifacts as
65
+ official CoAkka artifacts
66
+ - removing or obscuring copyright, license, checksum, or provenance notices
67
+ - reverse engineering artifacts except where that restriction is prohibited by
68
+ applicable law
69
+ - using the CoAkka name, package names, artifact names, image names, or other
70
+ project identifiers in a way that implies endorsement of an unofficial fork,
71
+ hosted service, or product
72
+
73
+ ## Official Samples
74
+
75
+ Official sample images may bundle unmodified artifacts solely so users can run
76
+ official CoAkka samples without installing the artifacts manually.
77
+
78
+ This sample-image permission does not grant third parties the right to create,
79
+ publish, sell, host, or distribute derivative images for production, customer
80
+ distribution, hosted services, paid support packages, appliances, or cloud
81
+ marketplace offerings.
82
+
83
+ ## Production Use
84
+
85
+ These preview terms are intended for developer evaluation, sample execution,
86
+ non-production proof-of-concept work, CI, and integration testing. Production
87
+ use, hosted service use, customer distribution, and paid redistribution require
88
+ explicit release terms or a separate written agreement.
89
+
90
+ For production, hosted service, customer distribution, paid redistribution, or
91
+ other commercial rights, contact the project through `SUPPORT.md`.
92
+
93
+ ## No Warranty
94
+
95
+ The artifacts are provided as-is, without warranties or conditions of any kind,
96
+ to the maximum extent permitted by applicable law.
97
+
98
+ ## Limitation Of Liability
99
+
100
+ To the maximum extent permitted by applicable law, the project contributors and
101
+ artifact publishers are not liable for any direct, indirect, incidental,
102
+ special, consequential, exemplary, or other damages arising from use of the
103
+ artifacts.
104
+
105
+ ## No Patent Or Trademark Grant
106
+
107
+ These preview terms do not grant patent rights, trademark rights, or rights to
108
+ use the CoAkka name beyond the limited artifact and sample uses allowed above.
109
+ Trademark use is governed by `TRADEMARKS.md`.
110
+
111
+ ## Legal Notice
112
+
113
+ This file is not legal advice. If your intended use depends on legal
114
+ interpretation of these terms, consult your own counsel or request a separate
115
+ written agreement.
package/README.md ADDED
@@ -0,0 +1,36 @@
1
+ # CoAkka Runtime Connector For Bun
2
+
3
+ This is the first Bun lane for the CoAkka runtime v2 connector.
4
+
5
+ The lane is deliberately thin for the first slice:
6
+
7
+ - it packages a Bun-named surface: `coakka-v2-connector-bun`
8
+ - it exports `BunRuntimeHost`, `BunConnectorOrchestrator`, and
9
+ `BunRuntimeClient` aliases
10
+ - it compiles the shared JS runtime connector core during package build
11
+ - it ships the same staged native runtime files inside the Bun package
12
+
13
+ Runtime semantics still belong to the native runtime and its public C ABI. Bun
14
+ owns host ergonomics, package smoke, and compatibility evidence only.
15
+
16
+ ## Local Commands
17
+
18
+ ```sh
19
+ export BUN_INSTALL="$HOME/.bun"
20
+ export PATH="$BUN_INSTALL/bin:$PATH"
21
+
22
+ bun run build
23
+ bun run verify
24
+ bash scripts/smoke-packaged-package.sh
25
+ ```
26
+
27
+ The package smoke builds a tarball, installs it into a temporary Bun consumer,
28
+ starts one embedded runtime, registers a local JSON handler, and proves
29
+ request/reply through the native runtime.
30
+
31
+ ## Boundary
32
+
33
+ This lane currently reuses the shared JS runtime connector core because Bun can
34
+ run the embedded native binding path. If that boundary stops holding, the
35
+ replacement should be a narrow Bun binding shim, not a fork of runtime routing,
36
+ request/reply, deadletter, or lifecycle semantics.
@@ -0,0 +1,6 @@
1
+ export { COAKKA_V2_NATIVE_CORE_VERSION, COAKKA_V2_NATIVE_GIT_COMMIT, COAKKA_V2_NATIVE_PACKAGE_VERSION, COAKKA_V2_NODE_VERSION, } from "./packaging.js";
2
+ export { BusinessStatus, DeliveryHint, EndpointFlag, MessageKind, OverloadMode, PayloadFormat, PayloadIdentity, RequestTerminalEventKind, RouteStrategy, localRoute, requireValidConnectorConfig, requireValidRuntimeOverloadPolicy, requireValidRoute, toConnectorConfig, type ConnectorConfig, type ConnectorStartSpec, type EndpointSpec, type MaybePromise, type ObservedDeadletter, type RuntimeOverloadPolicy, type RequestTerminalEvent, type RequestTerminalEventDeadletter, type RequestTerminalEventResponse, type RouteSpec, type SubmittedRequest, } from "./models.js";
3
+ export { ConnectorOrchestrator, RuntimeHost, RuntimeLibraryResolver, } from "./orchestrator.js";
4
+ export { DeadletterError, NodeRuntimeClient, type HandlerFn, type MonitorSnapshot, type RuntimeClientStats, type DeadlettersOptions, type TerminalEventsOptions, } from "./runtime-client.js";
5
+ export type { ControlEnvelope, RouteSnapshotPayload, TransportDeadletter, TransportEnvelope, } from "./wire-codec.js";
6
+ export { COAKKA_ABI_VERSION, COAKKA_OK, HOST_HANDLES_ENABLE_MONITOR, HOST_HANDLES_SEPARATE_DELIVERED_REQUEST_LANE, type HostHandlesSnapshot, type RuntimeConfigSnapshot, type RuntimeHealthSnapshot, type RuntimeInfoSnapshot, type RuntimeStatsSnapshot, } from "./native-runtime.js";
@@ -0,0 +1,5 @@
1
+ export { COAKKA_V2_NATIVE_CORE_VERSION, COAKKA_V2_NATIVE_GIT_COMMIT, COAKKA_V2_NATIVE_PACKAGE_VERSION, COAKKA_V2_NODE_VERSION, } from "./packaging.js";
2
+ export { BusinessStatus, DeliveryHint, EndpointFlag, MessageKind, OverloadMode, PayloadFormat, PayloadIdentity, RequestTerminalEventKind, RouteStrategy, localRoute, requireValidConnectorConfig, requireValidRuntimeOverloadPolicy, requireValidRoute, toConnectorConfig, } from "./models.js";
3
+ export { ConnectorOrchestrator, RuntimeHost, RuntimeLibraryResolver, } from "./orchestrator.js";
4
+ export { DeadletterError, NodeRuntimeClient, } from "./runtime-client.js";
5
+ export { COAKKA_ABI_VERSION, COAKKA_OK, HOST_HANDLES_ENABLE_MONITOR, HOST_HANDLES_SEPARATE_DELIVERED_REQUEST_LANE, } from "./native-runtime.js";
@@ -0,0 +1,119 @@
1
+ export declare enum MessageKind {
2
+ UNSPECIFIED = 0,
3
+ REQUEST = 1,
4
+ RESPONSE = 2,
5
+ EVENT = 3
6
+ }
7
+ export declare enum BusinessStatus {
8
+ UNSPECIFIED = 0,
9
+ OK = 1,
10
+ ERROR = 2
11
+ }
12
+ export declare enum DeliveryHint {
13
+ UNSPECIFIED = 0,
14
+ ROUTER_DEFAULT = 1,
15
+ PREFER_LOCAL = 2,
16
+ REQUIRE_LOCAL = 3,
17
+ REQUIRE_REMOTE = 4
18
+ }
19
+ export declare enum PayloadFormat {
20
+ UNSPECIFIED = 0,
21
+ JSON = 1,
22
+ WIRE_BINARY = 2,
23
+ THRIFT = 3,
24
+ MSGPACK = 4,
25
+ TEXT = 5,
26
+ PLAIN_TEXT = 5,
27
+ BINARY = 6
28
+ }
29
+ export declare enum RouteStrategy {
30
+ UNSPECIFIED = 0,
31
+ SINGLE_OWNER = 1,
32
+ WEIGHTED_ROUND_ROBIN = 2,
33
+ RENDEZVOUS_HASH = 3
34
+ }
35
+ export declare enum EndpointFlag {
36
+ NONE = 0,
37
+ LOCAL = 1,
38
+ UNAVAILABLE = 2
39
+ }
40
+ export declare enum OverloadMode {
41
+ REJECT = 0,
42
+ DROP_EXPIRED_FIRST = 1,
43
+ DROP_ONE_WAY_FIRST = 2
44
+ }
45
+ export interface RuntimeOverloadPolicy {
46
+ ingressMode?: OverloadMode;
47
+ localDeliveryMode?: OverloadMode;
48
+ remoteOutboundMode?: OverloadMode;
49
+ remoteOutboundReplyReserveSlots?: number;
50
+ }
51
+ export type MaybePromise<T> = T | Promise<T>;
52
+ export declare class PayloadIdentity {
53
+ readonly messageType: string;
54
+ readonly payloadSchemaVersion: number;
55
+ readonly payloadFormat: PayloadFormat;
56
+ constructor(messageType: string, payloadSchemaVersion?: number, payloadFormat?: PayloadFormat);
57
+ isTyped(): boolean;
58
+ requireTyped(what?: string): PayloadIdentity;
59
+ static text(messageType: string, payloadSchemaVersion?: number): PayloadIdentity;
60
+ }
61
+ export interface EndpointSpec {
62
+ host: string;
63
+ port: number;
64
+ weight?: number;
65
+ flags?: number;
66
+ }
67
+ export interface RouteSpec {
68
+ target: string;
69
+ endpoints: readonly EndpointSpec[];
70
+ strategy?: RouteStrategy;
71
+ routeKeyHint?: string;
72
+ flags?: number;
73
+ }
74
+ export interface ConnectorConfig {
75
+ systemName: string;
76
+ nodeId: string;
77
+ routes: readonly RouteSpec[];
78
+ strictNoDrop?: boolean;
79
+ queueCapacity?: number;
80
+ enableMonitor?: boolean;
81
+ separateDeliveredRequestLane?: boolean;
82
+ generation?: number;
83
+ overloadPolicy?: RuntimeOverloadPolicy;
84
+ }
85
+ export interface ConnectorStartSpec extends ConnectorConfig {
86
+ }
87
+ export interface SubmittedRequest {
88
+ messageId: string;
89
+ correlationId: string;
90
+ }
91
+ export declare const RequestTerminalEventKind: {
92
+ readonly RESPONSE: "response";
93
+ readonly DEADLETTER: "deadletter";
94
+ };
95
+ export type RequestTerminalEventKind = (typeof RequestTerminalEventKind)[keyof typeof RequestTerminalEventKind];
96
+ export interface RequestTerminalEventResponse {
97
+ kind: typeof RequestTerminalEventKind.RESPONSE;
98
+ requestMessageId: string;
99
+ correlationId: string;
100
+ envelope: import("./wire-codec.js").TransportEnvelope;
101
+ }
102
+ export interface RequestTerminalEventDeadletter {
103
+ kind: typeof RequestTerminalEventKind.DEADLETTER;
104
+ requestMessageId: string;
105
+ correlationId: string;
106
+ deadletter: import("./wire-codec.js").TransportDeadletter;
107
+ }
108
+ export type RequestTerminalEvent = RequestTerminalEventResponse | RequestTerminalEventDeadletter;
109
+ export interface ObservedDeadletter {
110
+ deadletter: import("./wire-codec.js").TransportDeadletter;
111
+ requestMessageId: string | null;
112
+ correlationId: string | null;
113
+ matchedPendingRequest: boolean;
114
+ }
115
+ export declare function requireValidRoute(route: RouteSpec): RouteSpec;
116
+ export declare function localRoute(target: string, port?: number): RouteSpec;
117
+ export declare function requireValidRuntimeOverloadPolicy(policy: RuntimeOverloadPolicy, what?: string): RuntimeOverloadPolicy;
118
+ export declare function requireValidConnectorConfig(config: ConnectorConfig): ConnectorConfig;
119
+ export declare function toConnectorConfig(startSpec: ConnectorStartSpec): ConnectorConfig;
@@ -0,0 +1,150 @@
1
+ export var MessageKind;
2
+ (function (MessageKind) {
3
+ MessageKind[MessageKind["UNSPECIFIED"] = 0] = "UNSPECIFIED";
4
+ MessageKind[MessageKind["REQUEST"] = 1] = "REQUEST";
5
+ MessageKind[MessageKind["RESPONSE"] = 2] = "RESPONSE";
6
+ MessageKind[MessageKind["EVENT"] = 3] = "EVENT";
7
+ })(MessageKind || (MessageKind = {}));
8
+ export var BusinessStatus;
9
+ (function (BusinessStatus) {
10
+ BusinessStatus[BusinessStatus["UNSPECIFIED"] = 0] = "UNSPECIFIED";
11
+ BusinessStatus[BusinessStatus["OK"] = 1] = "OK";
12
+ BusinessStatus[BusinessStatus["ERROR"] = 2] = "ERROR";
13
+ })(BusinessStatus || (BusinessStatus = {}));
14
+ export var DeliveryHint;
15
+ (function (DeliveryHint) {
16
+ DeliveryHint[DeliveryHint["UNSPECIFIED"] = 0] = "UNSPECIFIED";
17
+ DeliveryHint[DeliveryHint["ROUTER_DEFAULT"] = 1] = "ROUTER_DEFAULT";
18
+ DeliveryHint[DeliveryHint["PREFER_LOCAL"] = 2] = "PREFER_LOCAL";
19
+ DeliveryHint[DeliveryHint["REQUIRE_LOCAL"] = 3] = "REQUIRE_LOCAL";
20
+ DeliveryHint[DeliveryHint["REQUIRE_REMOTE"] = 4] = "REQUIRE_REMOTE";
21
+ })(DeliveryHint || (DeliveryHint = {}));
22
+ export var PayloadFormat;
23
+ (function (PayloadFormat) {
24
+ PayloadFormat[PayloadFormat["UNSPECIFIED"] = 0] = "UNSPECIFIED";
25
+ PayloadFormat[PayloadFormat["JSON"] = 1] = "JSON";
26
+ PayloadFormat[PayloadFormat["WIRE_BINARY"] = 2] = "WIRE_BINARY";
27
+ PayloadFormat[PayloadFormat["THRIFT"] = 3] = "THRIFT";
28
+ PayloadFormat[PayloadFormat["MSGPACK"] = 4] = "MSGPACK";
29
+ PayloadFormat[PayloadFormat["TEXT"] = 5] = "TEXT";
30
+ PayloadFormat[PayloadFormat["PLAIN_TEXT"] = 5] = "PLAIN_TEXT";
31
+ PayloadFormat[PayloadFormat["BINARY"] = 6] = "BINARY";
32
+ })(PayloadFormat || (PayloadFormat = {}));
33
+ export var RouteStrategy;
34
+ (function (RouteStrategy) {
35
+ RouteStrategy[RouteStrategy["UNSPECIFIED"] = 0] = "UNSPECIFIED";
36
+ RouteStrategy[RouteStrategy["SINGLE_OWNER"] = 1] = "SINGLE_OWNER";
37
+ RouteStrategy[RouteStrategy["WEIGHTED_ROUND_ROBIN"] = 2] = "WEIGHTED_ROUND_ROBIN";
38
+ RouteStrategy[RouteStrategy["RENDEZVOUS_HASH"] = 3] = "RENDEZVOUS_HASH";
39
+ })(RouteStrategy || (RouteStrategy = {}));
40
+ export var EndpointFlag;
41
+ (function (EndpointFlag) {
42
+ EndpointFlag[EndpointFlag["NONE"] = 0] = "NONE";
43
+ EndpointFlag[EndpointFlag["LOCAL"] = 1] = "LOCAL";
44
+ EndpointFlag[EndpointFlag["UNAVAILABLE"] = 2] = "UNAVAILABLE";
45
+ })(EndpointFlag || (EndpointFlag = {}));
46
+ export var OverloadMode;
47
+ (function (OverloadMode) {
48
+ OverloadMode[OverloadMode["REJECT"] = 0] = "REJECT";
49
+ OverloadMode[OverloadMode["DROP_EXPIRED_FIRST"] = 1] = "DROP_EXPIRED_FIRST";
50
+ OverloadMode[OverloadMode["DROP_ONE_WAY_FIRST"] = 2] = "DROP_ONE_WAY_FIRST";
51
+ })(OverloadMode || (OverloadMode = {}));
52
+ export class PayloadIdentity {
53
+ messageType;
54
+ payloadSchemaVersion;
55
+ payloadFormat;
56
+ constructor(messageType, payloadSchemaVersion = 1, payloadFormat = PayloadFormat.UNSPECIFIED) {
57
+ this.messageType = messageType;
58
+ this.payloadSchemaVersion = payloadSchemaVersion;
59
+ this.payloadFormat = payloadFormat;
60
+ }
61
+ isTyped() {
62
+ return (this.messageType.trim() !== "" &&
63
+ this.payloadSchemaVersion >= 1 &&
64
+ this.payloadFormat !== PayloadFormat.UNSPECIFIED);
65
+ }
66
+ requireTyped(what = "payload identity") {
67
+ if (this.messageType.trim() === "") {
68
+ throw new Error(`${what} requires messageType`);
69
+ }
70
+ if (this.payloadSchemaVersion < 1) {
71
+ throw new Error(`${what} requires payloadSchemaVersion >= 1`);
72
+ }
73
+ if (this.payloadFormat === PayloadFormat.UNSPECIFIED) {
74
+ throw new Error(`${what} requires declared payloadFormat`);
75
+ }
76
+ return this;
77
+ }
78
+ static text(messageType, payloadSchemaVersion = 1) {
79
+ return new PayloadIdentity(messageType, payloadSchemaVersion, PayloadFormat.TEXT);
80
+ }
81
+ }
82
+ export const RequestTerminalEventKind = {
83
+ RESPONSE: "response",
84
+ DEADLETTER: "deadletter",
85
+ };
86
+ export function requireValidRoute(route) {
87
+ if (route.target.trim() === "") {
88
+ throw new Error("route requires target");
89
+ }
90
+ if (route.endpoints.length === 0) {
91
+ throw new Error(`route target=${route.target} requires at least one endpoint`);
92
+ }
93
+ return route;
94
+ }
95
+ export function localRoute(target, port = 9001) {
96
+ return {
97
+ target,
98
+ endpoints: [{ host: "127.0.0.1", port, flags: EndpointFlag.LOCAL }],
99
+ };
100
+ }
101
+ export function requireValidRuntimeOverloadPolicy(policy, what = "overloadPolicy") {
102
+ if ((policy.ingressMode ?? OverloadMode.REJECT) !== OverloadMode.REJECT) {
103
+ throw new Error(`${what}.ingressMode currently supports only REJECT`);
104
+ }
105
+ if ((policy.localDeliveryMode ?? OverloadMode.REJECT) !== OverloadMode.REJECT) {
106
+ throw new Error(`${what}.localDeliveryMode currently supports only REJECT`);
107
+ }
108
+ if ((policy.remoteOutboundReplyReserveSlots ?? 0) < 0) {
109
+ throw new Error(`${what}.remoteOutboundReplyReserveSlots must be >= 0`);
110
+ }
111
+ return policy;
112
+ }
113
+ export function requireValidConnectorConfig(config) {
114
+ if (config.systemName.trim() === "") {
115
+ throw new Error("connector config requires systemName");
116
+ }
117
+ if (config.nodeId.trim() === "") {
118
+ throw new Error("connector config requires nodeId");
119
+ }
120
+ if ((config.queueCapacity ?? 128) < 1) {
121
+ throw new Error("connector config requires queueCapacity >= 1");
122
+ }
123
+ if ((config.generation ?? 1) < 1) {
124
+ throw new Error("connector config requires generation >= 1");
125
+ }
126
+ if (config.overloadPolicy != null) {
127
+ requireValidRuntimeOverloadPolicy(config.overloadPolicy, "connector config overloadPolicy");
128
+ }
129
+ if (config.routes.length === 0) {
130
+ throw new Error("connector config requires at least one route");
131
+ }
132
+ for (const route of config.routes) {
133
+ requireValidRoute(route);
134
+ }
135
+ return config;
136
+ }
137
+ export function toConnectorConfig(startSpec) {
138
+ requireValidConnectorConfig(startSpec);
139
+ return {
140
+ systemName: startSpec.systemName,
141
+ nodeId: startSpec.nodeId,
142
+ routes: startSpec.routes,
143
+ strictNoDrop: startSpec.strictNoDrop ?? true,
144
+ queueCapacity: startSpec.queueCapacity ?? 128,
145
+ enableMonitor: startSpec.enableMonitor ?? true,
146
+ separateDeliveredRequestLane: startSpec.separateDeliveredRequestLane ?? true,
147
+ generation: startSpec.generation ?? 1,
148
+ overloadPolicy: startSpec.overloadPolicy,
149
+ };
150
+ }
@@ -0,0 +1,105 @@
1
+ export declare const COAKKA_OK = 0;
2
+ export declare const COAKKA_ABI_VERSION = 1;
3
+ export declare const HOST_HANDLES_ENABLE_MONITOR: number;
4
+ export declare const HOST_HANDLES_SEPARATE_DELIVERED_REQUEST_LANE: number;
5
+ export interface RuntimeInfoSnapshot {
6
+ abiVersion: number;
7
+ featureFlags: number;
8
+ runtimeVersion: string;
9
+ gitCommit: string;
10
+ southboundBackend: string;
11
+ allocatorBackend: string;
12
+ docsHint: string;
13
+ }
14
+ export interface RuntimeConfigSnapshot {
15
+ systemName: string;
16
+ nodeId: string;
17
+ runtimeState: number;
18
+ snapshotPresent: boolean;
19
+ appliedGeneration: number;
20
+ routeCount: number;
21
+ southboundBindHost: string;
22
+ southboundBindPort: number;
23
+ effectiveIngressOverloadMode: number;
24
+ effectiveLocalDeliveryOverloadMode: number;
25
+ effectiveRemoteOutboundOverloadMode: number;
26
+ effectiveRemoteOutboundReplyReserveSlots: number;
27
+ }
28
+ export interface RuntimeHealthSnapshot {
29
+ runtimeState: number;
30
+ flags: number;
31
+ appliedGeneration: number;
32
+ }
33
+ export interface RuntimeStatsSnapshot {
34
+ appliedGeneration: number;
35
+ routeCount: number;
36
+ runtimeState: number;
37
+ queueRejectedCount: number;
38
+ routeMissCount: number;
39
+ deadletterCount: number;
40
+ deliveryFailedCount: number;
41
+ controlRejectedCount: number;
42
+ monitorEventEmittedCount: number;
43
+ monitorEventDroppedCount: number;
44
+ monitorEventEmittedLifetimeCount: number;
45
+ monitorEventDroppedLifetimeCount: number;
46
+ localWorkQueueCapacity: number;
47
+ localWorkQueueDepth: number;
48
+ localWorkQueueHighWatermark: number;
49
+ deliveredRequestOutboundDirectWriteCount: number;
50
+ responseOutboundDirectWriteCount: number;
51
+ deadletterOutboundDirectWriteCount: number;
52
+ remoteOutboundQueueCapacity: number;
53
+ remoteOutboundQueueDepth: number;
54
+ remoteOutboundQueueHighWatermark: number;
55
+ remoteOutboundQueueRejectedCount: number;
56
+ remoteOutboundExpiredDropCount: number;
57
+ remoteOutboundReplyReserveSlots: number;
58
+ remoteOutboundReplyReservationRejectCount: number;
59
+ remoteOutboundOneWayDropCount: number;
60
+ }
61
+ export interface HostHandlesSnapshot {
62
+ flags: number;
63
+ requestWriteFd: number;
64
+ responseReadFd: number;
65
+ deadletterReadFd: number;
66
+ controlWriteFd: number;
67
+ monitorReadFd: number;
68
+ deliveredRequestReadFd: number;
69
+ }
70
+ export interface NativeRuntimeConfig {
71
+ systemName: string;
72
+ nodeId: string;
73
+ strictNoDrop: boolean;
74
+ queueCapacity: number;
75
+ }
76
+ export declare class NativeRuntimeBindings {
77
+ readonly runtimeLibPath: string;
78
+ private readonly lib;
79
+ private readonly getAbiVersionFn;
80
+ private readonly getInfoFn;
81
+ private readonly createRuntimeFn;
82
+ private readonly destroyRuntimeFn;
83
+ private readonly getHostHandlesFn;
84
+ private readonly startRuntimeFn;
85
+ private readonly stopRuntimeFn;
86
+ private readonly getHealthFn;
87
+ private readonly getStatsFn;
88
+ private readonly getConfigFn;
89
+ private readonly submitEnvelopeFn;
90
+ private readonly applyControlEnvelopeFn;
91
+ constructor(runtimeLibPath: string);
92
+ getAbiVersion(): number;
93
+ readRuntimeInfo(): RuntimeInfoSnapshot;
94
+ createRuntime(config: NativeRuntimeConfig): unknown;
95
+ destroyRuntime(runtime: unknown): void;
96
+ getHostHandles(runtime: unknown, flags: number): HostHandlesSnapshot;
97
+ startRuntime(runtime: unknown): void;
98
+ stopRuntime(runtime: unknown): void;
99
+ getHealth(runtime: unknown): RuntimeHealthSnapshot;
100
+ getStats(runtime: unknown): RuntimeStatsSnapshot;
101
+ getConfig(runtime: unknown): RuntimeConfigSnapshot;
102
+ submitEnvelope(runtime: unknown, bytes: Uint8Array): void;
103
+ applyControlEnvelope(runtime: unknown, bytes: Uint8Array): void;
104
+ requireOk(rc: number, what: string): void;
105
+ }